/* ---------- dig button ---------- */
.dig {
  display: flex; align-items: center; gap: .9rem; width: 100%; margin-top: .9rem; padding: .85rem 1rem;
  border-radius: 16px; border: 1px solid rgba(255, 211, 110, .45); cursor: pointer; text-align: left;
  color: var(--ink); font: inherit;
  background: linear-gradient(100deg, rgba(255, 79, 184, .28), rgba(255, 211, 110, .22), rgba(122, 252, 255, .2));
  transition: transform .25s, box-shadow .25s;
}
.dig:hover, .dig:focus-visible { transform: translateY(-2px); box-shadow: 0 10px 40px -12px #ffd36e; outline: none; }
.dig > span:nth-child(2) { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.dig b { font-size: 1.05rem; }
.dig small { color: var(--muted); font-size: .75rem; }
.dig .arrow { font-size: 1.3rem; transition: transform .25s; }
.dig:hover .arrow { transform: translateX(4px); }
.dig-stack { position: relative; width: 34px; height: 34px; flex: none; }
.dig-stack i { position: absolute; inset: 0; border-radius: 4px; border: 1px solid rgba(255, 255, 255, .4); }
.dig-stack i:nth-child(1) { background: #6b2bd9; transform: translate(-5px, 3px) rotate(-10deg); }
.dig-stack i:nth-child(2) { background: #ff4fb8; transform: translate(-2px, 1px) rotate(-4deg); }
.dig-stack i:nth-child(3) { background: #ffd36e; }

/* ---------- crate mode ---------- */
#wave, .card { transition: opacity .6s, transform .8s cubic-bezier(.2, .8, .2, 1); }
body.crate .card, body.crate #wave, body.crate .again, body.crate .hud { opacity: 0; pointer-events: none; }
body.crate #wave { transform: translateY(12%); }

.crate-ui { position: fixed; inset: 0; z-index: 5; pointer-events: none; }
.crate-ui[hidden] { display: none; }
.crate-ui > * { pointer-events: auto; }
.crate-ui > .crate-hint { pointer-events: none; }
.pill {
  border: 1px solid var(--edge); background: rgba(10, 4, 24, .6); color: var(--ink);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-radius: 999px; padding: .55rem 1rem; font: inherit; font-size: .88rem; cursor: pointer; white-space: nowrap;
}
.pill:hover { border-color: rgba(255, 255, 255, .5); }
.pill.hot { background: #ff4fb8; border-color: #ff4fb8; color: #1a0b3a; font-weight: 700; }
.pill.hot:hover { background: #ff78c9; }
.pill:disabled { opacity: .45; cursor: default; }

.crate-top {
  position: absolute; top: max(1rem, env(safe-area-inset-top)); left: 1rem; right: 1rem;
  display: flex; gap: .6rem; align-items: flex-start;
}
.search { position: relative; flex: 0 1 340px; margin-left: auto; }
.search input {
  width: 100%; padding: .55rem 1rem; border-radius: 999px; border: 1px solid var(--edge);
  background: rgba(10, 4, 24, .6); color: var(--ink); font: inherit; font-size: .9rem;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.search input:focus { outline: none; border-color: #7afcff; }
.search ol {
  position: absolute; top: calc(100% + .4rem); left: 0; right: 0; margin: 0; padding: .3rem; list-style: none;
  background: rgba(10, 4, 24, .94); border: 1px solid var(--edge); border-radius: 14px; max-height: 50vh; overflow: auto;
}
.search ol[hidden] { display: none; }
.search li button {
  display: flex; gap: .6rem; align-items: center; width: 100%; padding: .4rem; border: 0; border-radius: 10px;
  background: none; color: var(--ink); font: inherit; font-size: .85rem; text-align: left; cursor: pointer;
}
.search li button:hover, .search li button:focus { background: rgba(255, 255, 255, .08); outline: none; }
.search li img { width: 36px; height: 36px; border-radius: 4px; object-fit: cover; flex: none; }
.search li small { color: var(--muted); display: block; }
.search li.empty { padding: .6rem; color: var(--muted); font-size: .85rem; }

.crate-caption {
  position: absolute; left: 50%; bottom: max(1.2rem, env(safe-area-inset-bottom)); transform: translateX(-50%);
  width: min(520px, calc(100vw - 2rem)); text-align: center;
  padding: .9rem 1.1rem; border-radius: 20px; background: rgba(10, 4, 24, .62); border: 1px solid var(--edge);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  transition: bottom .4s, left .4s;
}
body.has-player .crate-caption { bottom: calc(max(1.2rem, env(safe-area-inset-bottom)) + 74px); }
.crate-caption small { display: block; color: #7afcff; letter-spacing: .14em; text-transform: uppercase; font-size: .7rem; }
.crate-caption b { display: block; font-size: 1.25rem; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crate-caption > span { display: block; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cc-actions { display: flex; gap: .5rem; justify-content: center; margin-top: .6rem; }
.crate-hint {
  position: absolute; left: 0; right: 0; top: 4.2rem; margin: 0; text-align: center;
  font-size: .78rem; letter-spacing: .08em; color: var(--muted); transition: opacity .6s;
}

.sleeve {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(400px, 100vw); overflow-y: auto;
  padding: 4.2rem 1.4rem 7rem; background: rgba(12, 5, 28, .88); border-left: 1px solid var(--edge);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  animation: slide-in .45s cubic-bezier(.2, .8, .2, 1);
}
.sleeve[hidden] { display: none; }
@keyframes slide-in { from { transform: translateX(40px); opacity: 0; } }
.sleeve .close {
  position: absolute; top: 1rem; right: 1rem; width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--edge); background: none; color: var(--ink); cursor: pointer; font-size: 1rem;
}
#sl-cover { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; box-shadow: 0 20px 60px -20px #000; display: block; }
.sl-meta { margin: 1rem 0 .2rem; color: #7afcff; font-size: .75rem; letter-spacing: .14em; text-transform: uppercase; }
.sleeve h2 { margin: 0; font: 800 1.7rem/1.1 "Bricolage Grotesque", sans-serif; letter-spacing: -.02em; }
.sl-artist { margin: .3rem 0 1rem; color: var(--muted); font-size: 1.05rem; }
.needle {
  width: 100%; padding: .85rem; border-radius: 14px; border: 0; cursor: pointer; font: inherit; font-weight: 700; font-size: 1rem;
  color: #1a0b3a; background: linear-gradient(100deg, #ff4fb8, #ffd36e);
}
.needle:disabled { opacity: .5; cursor: default; }
.tracks { list-style: none; margin: .8rem 0 0; padding: 0; counter-reset: t; }
.tracks button {
  display: flex; gap: .7rem; width: 100%; padding: .5rem .4rem; border: 0; border-bottom: 1px solid rgba(255, 255, 255, .06);
  background: none; color: var(--ink); font: inherit; font-size: .9rem; text-align: left; cursor: pointer; border-radius: 6px;
}
.tracks button:hover { background: rgba(255, 255, 255, .06); }
.tracks button::before { counter-increment: t; content: counter(t); width: 1.4rem; color: var(--muted); text-align: right; flex: none; }
.tracks .on button { color: #ffd36e; }
.tracks .on button::before { content: "\266A"; color: #ff4fb8; }
.tracks .dur { margin-left: auto; color: var(--muted); font-size: .78rem; }
.sl-note { color: var(--muted); font-size: .8rem; margin: .8rem 0 0; }
.sl-links { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: 1.2rem; }
.sl-links a {
  --c: #fff; padding: .45rem .8rem; border-radius: 999px; border: 1px solid var(--edge); color: var(--ink);
  text-decoration: none; font-size: .82rem;
}
.sl-links a:hover { border-color: var(--c); box-shadow: 0 0 20px -6px var(--c); }

/* ---------- player bar ---------- */
.player {
  position: fixed; z-index: 7; left: 50%; bottom: max(.8rem, env(safe-area-inset-bottom)); transform: translateX(-50%);
  width: min(520px, calc(100vw - 1.2rem)); display: flex; align-items: center; gap: .7rem;
  padding: .55rem .7rem .8rem; border-radius: 16px; background: rgba(10, 4, 24, .88); border: 1px solid var(--edge);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
}
.player[hidden] { display: none; }
.player img { width: 44px; height: 44px; border-radius: 6px; object-fit: cover; flex: none; }
.pl-text { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.25; }
.pl-text b, .pl-text span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-text span { color: var(--muted); font-size: .82rem; }
.pl-buttons { display: flex; gap: .15rem; flex: none; }
.pl-buttons button { width: 36px; height: 36px; border-radius: 50%; border: 0; background: none; color: var(--ink); cursor: pointer; font-size: 1rem; }
.pl-buttons button:hover { background: rgba(255, 255, 255, .1); }
.pl-bar { position: absolute; left: .7rem; right: .7rem; bottom: .35rem; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .12); cursor: pointer; }
.pl-bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, #ff4fb8, #ffd36e); }

.pl-volume { display: flex; align-items: center; gap: .2rem; flex: none; }
.pl-volume button { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; border: 0; background: none; color: var(--ink); cursor: pointer; }
.pl-volume button:hover { background: rgba(255, 255, 255, .1); }
.pl-volume input {
  --fill: 80%;
  -webkit-appearance: none; appearance: none; width: 84px; height: 4px; border-radius: 4px; cursor: pointer;
  background: linear-gradient(90deg, #ff4fb8, #ffd36e var(--fill), rgba(255, 255, 255, .15) var(--fill));
}
.pl-volume input::-webkit-slider-thumb { -webkit-appearance: none; width: 13px; height: 13px; border-radius: 50%; background: #fff7ec; border: 0; }
.pl-volume input::-moz-range-thumb { width: 13px; height: 13px; border-radius: 50%; background: #fff7ec; border: 0; }
.pl-volume input:focus-visible { outline: 2px solid #7afcff; outline-offset: 4px; }
.player { width: min(600px, calc(100vw - 1.2rem)); }

@media (min-width: 701px) {
  body.sleeve-open .crate-caption { left: calc(50% - 200px); }
}
@media (max-width: 700px) {
  .crate-top { flex-wrap: wrap; }
  .search { flex: 1 1 100%; order: 3; }
  .crate-hint { top: 6.9rem; }
  .crate-caption { padding: .7rem .8rem; }
  .crate-caption b { font-size: 1.05rem; }
  .sleeve {
    top: 16vh; width: 100vw; border-left: 0; border-top: 1px solid var(--edge); border-radius: 22px 22px 0 0;
    padding: 1.4rem 1.2rem 7rem; animation-name: slide-up;
  }
  @keyframes slide-up { from { transform: translateY(60px); opacity: 0; } }
  .sleeve #sl-cover { width: 42%; float: left; margin: 0 1rem .6rem 0; }
  .sleeve .sl-meta { margin-top: .2rem; }
  .sleeve h2 { font-size: 1.3rem; }
  .needle, .tracks, .sl-links, .sl-note { clear: both; }
  .pl-buttons #pl-prev { display: none; }
  .pl-volume input { display: none; }   /* phones: hardware buttons + mute */
}

body.no-anim, body.no-anim * { transition: none !important; }
