/* =========================================================
   The Tape Vault — styles
   ========================================================= */
:root {
  --kraft: #c89a5f;
  --kraft-dark: #a87942;
  --kraft-light: #ddb47c;
  --marker: #1c1712;
  --wood-1: #5a3a22;
  --wood-2: #4a2f1b;
  --wood-3: #6b4528;
  --cream: #f3e9d2;
  --lcd: #9fe870;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Kalam", "Segoe Print", cursive;
  color: var(--cream);
  background: #2b1c11;
  overflow-x: hidden;
}
button { font: inherit; cursor: pointer; }
.hidden { display: none !important; }

/* ---------------- WALL ---------------- */
#wall {
  min-height: 100vh;
  /* 70s wood paneling */
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255, 210, 140, .18), transparent 60%),
    repeating-linear-gradient(90deg,
      var(--wood-1) 0 2px, var(--wood-3) 2px 70px, var(--wood-2) 70px 74px,
      var(--wood-1) 74px 150px, #3c2616 150px 153px, var(--wood-3) 153px 220px);
  padding: 24px 3vw 40px;
}
.wall-header { text-align: center; margin-bottom: 18px; }
.wall-header h1 {
  font-family: "Permanent Marker", cursive;
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  margin: 0;
  color: #ffd86b;
  text-shadow: 3px 3px 0 #b5361d, 6px 6px 0 rgba(0,0,0,.35);
  letter-spacing: 2px;
}
.wall-header p { margin: 4px 0 0; opacity: .85; }
.artist-switch {
  display: inline-flex; margin-top: 12px;
  background: rgba(0,0,0,.35); border-radius: 999px; padding: 4px;
  box-shadow: inset 0 2px 6px rgba(0,0,0,.5);
}
.artist-switch a {
  font-family: "Permanent Marker", cursive; font-size: 1.05rem;
  color: var(--cream); text-decoration: none;
  padding: 6px 18px; border-radius: 999px; opacity: .7;
  transition: background .15s, color .15s, opacity .15s;
}
.artist-switch a:hover { opacity: 1; }
.artist-switch a.active { background: #ffd86b; color: #2b1c11; opacity: 1; box-shadow: 0 2px 0 #b5361d; }
.wall-footer { text-align: center; margin-top: 30px; opacity: .7; font-size: .9rem; }
.wall-footer a { color: #ffd86b; }

.shelves { max-width: 1250px; margin: 0 auto; }
.shelf {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: clamp(6px, 1.2vw, 16px);
  padding: 26px 18px 0;
  margin-bottom: 34px;
}
.shelf::after { /* the plank */
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -20px;
  height: 20px;
  background: linear-gradient(#8a5a33, #6a4224 55%, #3d2514);
  border-radius: 2px;
  box-shadow: 0 14px 18px rgba(0,0,0,.55);
}
.shelf::before { /* bracket shadows */
  content: "";
  position: absolute;
  left: 8%; right: 8%; bottom: -46px; height: 26px;
  background:
    linear-gradient(135deg, #2a1a0e 50%, transparent 50%) left / 26px 26px no-repeat,
    linear-gradient(225deg, #2a1a0e 50%, transparent 50%) right / 26px 26px no-repeat;
  opacity: .8;
}

/* a cardboard box (front + lid in light perspective) */
.box {
  --w: clamp(92px, 11vw, 138px);
  position: relative;
  width: var(--w);
  height: calc(var(--w) * .78);
  border: 0;
  padding: 0;
  background: none;
  transform: rotate(var(--tilt, 0deg));
  transition: transform .18s ease;
  z-index: 1;
}
.box:hover, .box:focus-visible {
  transform: translateY(-8px) rotate(calc(var(--tilt, 0deg) * -1)) scale(1.04);
  z-index: 2;
  outline: none;
}
.box .lid {
  position: absolute;
  left: 4%; right: -4%;
  top: -14px; height: 16px;
  background: linear-gradient(var(--kraft-light), var(--kraft));
  transform: skewX(-35deg);
  transform-origin: bottom;
  border: 1px solid rgba(0,0,0,.18);
}
.box .side {
  position: absolute;
  right: -12px; top: -9px; bottom: 5px; width: 12px;
  background: linear-gradient(90deg, var(--kraft-dark), #8a6033);
  transform: skewY(-55deg);
  transform-origin: left;
}
.box .front {
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(255,255,255,.08), rgba(0,0,0,.12)),
    repeating-linear-gradient(90deg, rgba(0,0,0,.025) 0 3px, transparent 3px 7px),
    var(--kraft);
  border: 1px solid rgba(0,0,0,.25);
  box-shadow: inset 0 -6px 10px rgba(0,0,0,.12), 0 6px 10px rgba(0,0,0,.4);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.box .handle {
  position: absolute;
  top: 10%;
  width: 34%; height: 11%;
  border-radius: 99px;
  background: #2a1a0e;
  box-shadow: inset 0 3px 3px rgba(0,0,0,.8);
}
.box .tape-strip {
  position: absolute;
  left: 0; right: 0; top: 0; height: 10%;
  background: rgba(214, 190, 140, .75);
  border-bottom: 1px solid rgba(0,0,0,.1);
}
.box .year {
  font-family: "Permanent Marker", cursive;
  color: var(--marker);
  font-size: calc(var(--w) * .27);
  line-height: 1;
  margin-top: 14%;
  transform: rotate(-3deg);
  opacity: .92;
}
.box .count {
  font-size: calc(var(--w) * .1);
  color: #3a2a18;
  opacity: .8;
  min-height: 1.2em;
}
.box .sticker {
  position: absolute;
  right: 7%; bottom: 8%;
  width: 18%; aspect-ratio: 1;
  border-radius: 50%;
  background: var(--sticker, #d8402c);
  box-shadow: 0 1px 2px rgba(0,0,0,.35);
  opacity: .85;
}

/* ---------------- BOX (TOP-DOWN) ---------------- */
#boxview {
  min-height: 100vh;
  background:
    radial-gradient(ellipse at center, rgba(0,0,0,0) 30%, rgba(0,0,0,.55) 100%),
    repeating-linear-gradient(0deg, #6e4a2b 0 3px, #7a5332 3px 38px, #64422a 38px 41px, #82593a 41px 90px);
  padding: 16px 3vw 40px;
  animation: dropIn .35s ease-out;
}
@keyframes dropIn { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }

.boxview-bar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  max-width: 1200px; margin: 0 auto 16px;
}
.boxview-bar h2 {
  font-family: "Permanent Marker", cursive;
  margin: 0; flex: 1;
  font-size: clamp(1.4rem, 3vw, 2.2rem);
  color: #ffd86b;
  text-shadow: 2px 2px 0 rgba(0,0,0,.5);
}
.chip {
  background: var(--cream); color: #2b1c11;
  border: 0; border-radius: 6px; padding: 6px 14px;
  box-shadow: 0 3px 0 #9a8a6a;
}
.chip:active { transform: translateY(2px); box-shadow: 0 1px 0 #9a8a6a; }
#boxFilter {
  font: inherit; padding: 6px 10px; border-radius: 6px; border: 0;
  background: rgba(243,233,210,.92); color: #2b1c11; min-width: 0; flex: 0 1 260px;
}

.crate-wrap { max-width: 1200px; margin: 0 auto; padding: 56px; position: relative; }
.crate {
  position: relative;
  background: var(--kraft-dark);
  padding: 16px;
  box-shadow: 0 30px 50px rgba(0,0,0,.55);
}
/* open flaps folded out, seen from above */
.flap { position: absolute; background:
  linear-gradient(rgba(255,255,255,.07), rgba(0,0,0,.1)),
  repeating-linear-gradient(90deg, rgba(0,0,0,.03) 0 3px, transparent 3px 8px),
  var(--kraft); }
.flap-top    { left: 0; right: 0; bottom: 100%; height: 56px; clip-path: polygon(3% 0, 97% 0, 100% 100%, 0 100%); }
.flap-bottom { left: 0; right: 0; top: 100%;    height: 56px; clip-path: polygon(0 0, 100% 0, 97% 100%, 3% 100%); }
.flap-left   { top: 0; bottom: 0; right: 100%;  width: 56px;  clip-path: polygon(0 3%, 100% 0, 100% 100%, 0 97%); background-color: var(--kraft-light); }
.flap-right  { top: 0; bottom: 0; left: 100%;   width: 56px;  clip-path: polygon(0 0, 100% 3%, 100% 97%, 0 100%); background-color: var(--kraft-light); }
.flap-top::after, .flap-bottom::after {
  content: ""; position: absolute; left: 30%; right: 30%; top: 40%; height: 14px;
  background: rgba(214, 190, 140, .6);
}

.crate-inner {
  background: linear-gradient(#5b3c1f, #6e4a28);
  box-shadow: inset 0 0 40px rgba(0,0,0,.75), inset 0 0 6px rgba(0,0,0,.9);
  min-height: 60vh;
  padding: 18px;
}
.box-status { text-align: center; padding: 40px 10px; font-size: 1.3rem; }
.box-status:empty { display: none; }
.box-status button { margin-top: 12px; }

.tapes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr));
  gap: 6px 10px;
}

/* a cassette case standing upright, seen from above: we see its spine */
.tape-case {
  --c: #e4572e;
  position: relative;
  display: flex; align-items: stretch;
  height: 72px;
  border: 0; padding: 0; text-align: left; color: #1d1712;
  background: linear-gradient(180deg, rgba(255,255,255,.65), rgba(220,230,235,.35) 20%, rgba(255,255,255,.25) 80%, rgba(255,255,255,.55));
  border-radius: 3px;
  box-shadow: 0 3px 4px rgba(0,0,0,.6), inset 0 0 0 1px rgba(255,255,255,.4);
  transform: rotate(var(--tilt, 0deg));
  transition: transform .15s ease, box-shadow .15s ease;
  animation: tapeIn .35s ease-out backwards;
  animation-delay: var(--delay, 0ms);
}
@keyframes tapeIn { from { opacity: 0; transform: translateY(-14px) rotate(var(--tilt)); } }
.tape-case:hover, .tape-case:focus-visible {
  transform: translateY(-5px) scale(1.03);
  box-shadow: 0 12px 16px rgba(0,0,0,.6);
  outline: none; z-index: 2;
}
.tape-case .spine {
  flex: 1; margin: 4px; border-radius: 2px;
  background:
    linear-gradient(90deg, var(--c) 0 12px, transparent 12px),
    linear-gradient(#fbf6e8, #efe6cf);
  padding: 2px 8px 2px 18px;
  display: flex; flex-direction: column; justify-content: center;
  overflow: hidden;
  border-left: 0;
}
.tape-case .t-date { font-weight: 700; font-size: 1.02rem; line-height: 1.1; }
.tape-case .t-venue {
  font-size: .82rem; line-height: 1.1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tape-case .t-lineage {
  font-family: "VT323", monospace; font-size: .85rem; line-height: 1; color: #6b5d43;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; padding-right: 22px;
}
.tape-case .t-of {
  position: absolute; right: 9px; bottom: 6px;
  font-family: "VT323", monospace; font-size: .8rem; color: #6b5d43;
}
.tape-case .t-badges { position: absolute; right: 9px; top: 6px; display: flex; gap: 3px; }
.tape-case .t-src, .tape-case .t-proj {
  font-family: "VT323", monospace; font-size: .8rem; line-height: 1.2;
  background: var(--c); color: #fff; padding: 0 4px; border-radius: 2px;
  opacity: .9;
}
.tape-case .t-proj { background: #1d1712; color: #ffd86b; }

/* ---------------- PLAYER ---------------- */
.player-overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(10, 6, 3, .72);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  padding: 14px;
  animation: fadeIn .2s ease-out;
}
@keyframes fadeIn { from { opacity: 0; } }
.deck {
  width: min(980px, 100%);
  max-height: calc(100vh - 28px);
  overflow: auto;
  border-radius: 14px;
  padding: 18px 22px 20px;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,.035) 0 1px, transparent 1px 3px),
    linear-gradient(#cfcfcb, #a9a9a4 45%, #8e8e89);
  color: #222;
  box-shadow: 0 30px 70px rgba(0,0,0,.7), inset 0 1px 0 rgba(255,255,255,.7), inset 0 -3px 0 rgba(0,0,0,.25);
  animation: deckIn .3s cubic-bezier(.2,.9,.3,1.2);
}
@keyframes deckIn { from { transform: translateY(30px) scale(.97); opacity: 0; } }

.deck-top { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.brand { font-family: "Permanent Marker", cursive; font-size: 1.5rem; letter-spacing: 2px; color: #222; }
.brand .dash { color: #c0392b; }
.brand b { font-weight: inherit; }
.brand small { display: block; font-family: "VT323", monospace; font-size: .9rem; letter-spacing: 3px; color: #444; }

.lcd {
  background: linear-gradient(#0f1a0c, #172615);
  border-radius: 6px;
  padding: 6px 12px;
  min-width: 0; flex: 1 1 260px; max-width: 420px;
  font-family: "VT323", monospace;
  color: var(--lcd);
  text-shadow: 0 0 6px rgba(159,232,112,.6);
  box-shadow: inset 0 2px 8px rgba(0,0,0,.9), 0 1px 0 rgba(255,255,255,.6);
}
.lcd-row { display: flex; justify-content: space-between; font-size: 1.6rem; line-height: 1; }
.lcd-marquee { overflow: hidden; white-space: nowrap; font-size: 1.25rem; }
.lcd-marquee span { display: inline-block; padding-left: 100%; animation: marquee 14s linear infinite; }
@keyframes marquee { to { transform: translateX(-100%); } }

.deck-middle { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 18px; margin: 16px 0; }
@media (max-width: 760px) { .deck-middle { grid-template-columns: 1fr; } }

/* cassette door */
.door {
  background: linear-gradient(#1c1c1c, #2a2a2a);
  border-radius: 10px;
  padding: 16px;
  box-shadow: inset 0 4px 14px rgba(0,0,0,.9), 0 1px 0 rgba(255,255,255,.5);
  position: relative;
  display: flex; align-items: center; justify-content: center;
}
.door::after { /* smoked glass reflection */
  content: ""; position: absolute; inset: 0; border-radius: 10px; pointer-events: none;
  background: linear-gradient(115deg, rgba(255,255,255,.14), transparent 35%, transparent 70%, rgba(255,255,255,.06));
}
.cassette {
  width: 100%; max-width: 440px; aspect-ratio: 1.6;
  background: linear-gradient(#3a3a3e, #26262a);
  border-radius: 10px;
  padding: 6% 5% 0;
  position: relative;
  box-shadow: 0 4px 10px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.15);
  display: flex; flex-direction: column;
}
.cassette.empty .cass-label { opacity: .25; }
.cass-label {
  flex: 1;
  border-radius: 6px;
  background:
    linear-gradient(180deg, #f6efda 0 26%, #e8573a 26% 30%, #f2b134 30% 34%, #f6efda 34%);
  padding: 4px 10px 8px;
  display: flex; flex-direction: column;
  color: #1d1712;
}
.cass-label-top { display: flex; align-items: center; gap: 8px; }
.cass-label .side {
  font-family: "Permanent Marker", cursive; font-size: 1.3rem;
  background: #1d1712; color: #f6efda; width: 1.6em; text-align: center; border-radius: 3px;
}
.cass-date { font-weight: 700; font-size: 1.15rem; flex: 1; }
.cass-brand { font-family: "VT323", monospace; font-size: 1rem; }
.cass-venue { font-size: .9rem; line-height: 1.1; min-height: 1.1em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 2px 0 6px; }
.cass-window {
  flex: 1;
  margin: 0 8%;
  background: #1a1410;
  border-radius: 40px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 4%;
  position: relative;
  min-height: 74px;
  box-shadow: inset 0 2px 6px rgba(0,0,0,.9);
}
.window-glass {
  position: absolute; left: 33%; right: 33%; top: 22%; bottom: 22%;
  background: rgba(130, 90, 60, .55);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 3px;
}
.reel {
  position: relative;
  width: 64px; height: 64px;
  display: flex; align-items: center; justify-content: center;
  z-index: 1;
}
.reel .tape {
  position: absolute;
  width: var(--size, 40px); height: var(--size, 40px);
  border-radius: 50%;
  background: repeating-radial-gradient(circle, #4a2c1a 0 1px, #3a2214 1px 2px);
  box-shadow: 0 0 0 1px rgba(0,0,0,.6);
  transition: width .4s linear, height .4s linear;
}
.reel .hub {
  position: relative;
  width: 30px; height: 30px; border-radius: 50%;
  background:
    radial-gradient(circle, #1a1410 0 5px, transparent 5.5px),
    conic-gradient(#f4f4f4 0 20deg, transparent 20deg 60deg, #f4f4f4 60deg 80deg, transparent 80deg 120deg,
                   #f4f4f4 120deg 140deg, transparent 140deg 180deg, #f4f4f4 180deg 200deg, transparent 200deg 240deg,
                   #f4f4f4 240deg 260deg, transparent 260deg 300deg, #f4f4f4 300deg 320deg, transparent 320deg),
    radial-gradient(circle, transparent 9px, #f4f4f4 9.5px 15px);
  -webkit-mask: radial-gradient(circle, transparent 4px, #000 4.5px);
          mask: radial-gradient(circle, transparent 4px, #000 4.5px);
  animation: spin 1.6s linear infinite;
  animation-play-state: paused;
}
.playing .reel .hub { animation-play-state: running; }
.seeking-fwd .reel .hub { animation-duration: .35s; animation-play-state: running; }
@keyframes spin { to { transform: rotate(360deg); } }

.cass-bottom {
  height: 18%;
  margin: 4px 14% 0;
  background: linear-gradient(#2f2f33, #1f1f22);
  clip-path: polygon(6% 0, 94% 0, 100% 100%, 0 100%);
  display: flex; justify-content: space-around; align-items: center;
}
.cass-bottom i { width: 9px; height: 9px; border-radius: 50%; background: #0c0c0c; box-shadow: inset 0 1px 2px #000; }

/* J-card */
.jcard {
  background: #f6efda;
  color: #1d1712;
  border-radius: 4px;
  padding: 10px 14px;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.1), 0 2px 6px rgba(0,0,0,.35);
  display: flex; flex-direction: column;
  max-height: 340px;
  min-height: 220px;
}
.jcard-head { border-bottom: 2px solid #e8573a; padding-bottom: 6px; margin-bottom: 6px; }
.j-date { font-family: "Permanent Marker", cursive; font-size: 1.3rem; }
.j-venue { font-size: .95rem; line-height: 1.15; }
.j-source { display: block; font-size: .8rem; margin-top: 4px; }
.j-source select { font: inherit; font-size: .8rem; width: 100%; max-width: 100%; text-overflow: ellipsis; background: #fffaf0; border: 1px solid #c9bc9a; border-radius: 3px; }
.tracklist { margin: 0; padding: 0; list-style: none; counter-reset: trk; overflow-y: auto; flex: 1; font-size: .98rem; }
.tracklist li { cursor: pointer; padding: 1px 4px; border-radius: 3px; display: flex; gap: 6px; counter-increment: trk; }
.tracklist li:not(.muted)::before { content: counter(trk, decimal-leading-zero) "."; font-family: "VT323", monospace; color: #8a7a5a; min-width: 1.8em; }
.tracklist li.current::before { color: #ffe; }
.tracklist li .tl-title { flex: 1; }
.tracklist li .tl-len { font-family: "VT323", monospace; color: #6b5d43; }
.tracklist li:hover { background: rgba(232, 87, 58, .12); }
.tracklist li.current { background: #e8573a; color: #fff; }
.tracklist li.current .tl-len { color: #ffe; }
.tracklist .muted { color: #6b5d43; cursor: default; }

/* piano keys */
.deck-bottom { display: flex; flex-wrap: wrap; gap: 16px 24px; align-items: flex-end; justify-content: space-between; }
.keys {
  display: flex; gap: 3px;
  background: #1c1c1c; padding: 4px; border-radius: 6px;
  box-shadow: inset 0 2px 6px #000, 0 1px 0 rgba(255,255,255,.5);
}
.key {
  width: 74px; height: 64px;
  border: 0; border-radius: 3px 3px 6px 6px;
  background: linear-gradient(#f2f2ee, #cfcfc9 70%, #b5b5ae);
  color: #222;
  font-family: "VT323", monospace; font-size: .95rem; letter-spacing: 1px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  box-shadow: 0 6px 0 #77776f, 0 7px 4px rgba(0,0,0,.6);
  transform: translateY(-6px);
  transition: transform .06s, box-shadow .06s;
}
.key span { font-family: system-ui, sans-serif; font-size: 1.1rem; }
.key:active, .key.down {
  transform: translateY(-1px);
  box-shadow: 0 1px 0 #77776f, 0 2px 2px rgba(0,0,0,.6);
  background: linear-gradient(#deded8, #c2c2bb);
}
#kPlay.down span { color: #2e9e3a; }
#kPause.down span { color: #d68a00; }
#kEject span { color: #444; }
@media (max-width: 560px) { .key { width: 48px; font-size: .75rem; } }

.sliders { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 220px; font-family: "VT323", monospace; font-size: 1.1rem; }
.sliders label { display: flex; align-items: center; gap: 10px; }
.sliders input[type=range] { flex: 1; accent-color: #c0392b; }
.archive-link { align-self: flex-end; color: #333; font-size: .95rem; }

/* ---------------- SMALL SCREENS ---------------- */
@media (max-width: 700px) {
  #wall { padding: 18px 10px 30px; }
  .shelf { padding: 22px 8px 0; margin-bottom: 30px; }
  .box { --w: clamp(84px, 24vw, 130px); }
  .box .side { right: -9px; width: 9px; }

  #boxview { padding: 12px 8px 30px; }
  .boxview-bar { gap: 10px; }
  .boxview-bar h2 { flex-basis: calc(100% - 180px); }
  #boxFilter { flex: 1 1 100%; }
  .crate-wrap { padding: 24px; }
  .crate { padding: 8px; }
  .flap-top, .flap-bottom { height: 24px; }
  .flap-left, .flap-right { width: 24px; }
  .crate-inner { padding: 10px; }

  .player-overlay { padding: 0; align-items: stretch; }
  .deck { border-radius: 0; max-height: 100vh; max-height: 100dvh; padding: 12px; }
  .deck-top { gap: 10px; }
  .lcd { max-width: none; }
  .deck-middle { margin: 12px 0; gap: 12px; }
  .door { padding: 10px; }
  .cass-window { min-height: 60px; }
  .reel { width: 52px; height: 52px; }
  .jcard { max-height: 45vh; }
  .keys { width: 100%; justify-content: space-between; }
  .key { flex: 1; width: auto; min-width: 0; height: 58px; }
}
@media (max-width: 400px) {
  .key { font-size: .7rem; letter-spacing: 0; }
  .key span { font-size: .95rem; }
  .cass-label { padding: 3px 6px 6px; }
  .cass-date { font-size: 1rem; }
}
