/* My Playlists: tape deck on the left, cassette rack on the right (stacked on phones). */
:root {
  --marker: 'Permanent Marker', 'Comic Sans MS', 'Chalkboard SE', cursive;
  --wall: #2f4a48;
  --wood: #8a5a34;
  --wood-dark: #5b3a20;
  --home-color: #ddd;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: #f2eee6;
  background-color: var(--wall);
  background-image:
    var(--wall-art, repeating-linear-gradient(90deg, rgba(255,255,255,.035) 0 18px, transparent 18px 46px)),
    radial-gradient(ellipse at 30% 20%, rgba(255,230,180,.12), transparent 60%);
  overflow: hidden;
}
[hidden] { display: none !important; }

.page {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
  gap: clamp(20px, 3vw, 48px);
  height: 100vh;
  height: 100dvh;
  padding: 20px clamp(20px, 3vw, 40px) 20px 76px;
}

/* ---------- Deck side ---------- */
.deckside {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.25) transparent;
}
.title { margin: 0; font: 400 clamp(1.6rem, 3vw, 2.3rem) / 1 var(--marker); color: #222; }
.title span {
  display: inline-block;
  padding: 10px 26px 8px;
  background: #e9dcb6;
  background-image: linear-gradient(rgba(0,0,0,.04), rgba(0,0,0,0) 40%, rgba(0,0,0,.05));
  transform: rotate(-1.5deg);
  box-shadow: 0 2px 6px rgba(0,0,0,.35);
  clip-path: polygon(1% 4%, 9% 0, 20% 5%, 33% 1%, 48% 4%, 61% 0, 76% 4%, 90% 1%, 100% 5%, 98% 50%, 100% 96%, 88% 100%, 72% 96%, 55% 100%, 40% 96%, 24% 100%, 10% 96%, 0 100%, 2% 50%);
}

.deck {
  width: min(100%, 600px);
  flex: none;
  padding: 14px 18px 20px;
  border-radius: 10px;
  background: linear-gradient(#cfd0cf, #a9aaa8 55%, #8f908e);
  background-image:
    repeating-linear-gradient(90deg, rgba(255,255,255,.07) 0 1px, transparent 1px 3px),
    linear-gradient(#cfd0cf, #a9aaa8 55%, #8f908e);
  box-shadow: 0 1px 0 rgba(255,255,255,.6) inset, 0 -2px 0 rgba(0,0,0,.25) inset, 0 14px 30px rgba(0,0,0,.45);
}
.deck-face { display: flex; align-items: center; justify-content: space-between; min-height: 30px; margin-bottom: 10px; }
.deck-brand { font: 700 .72rem/1 system-ui, sans-serif; letter-spacing: .22em; text-transform: uppercase; color: #3d3e3d; text-shadow: 0 1px 0 rgba(255,255,255,.5); }
.eject {
  font: 700 .8rem/1 system-ui, sans-serif;
  letter-spacing: .06em;
  padding: 7px 12px;
  border: 0;
  border-radius: 5px;
  color: #2b2b2b;
  background: linear-gradient(#f2f2f0, #c3c4c1);
  box-shadow: 0 2px 0 #6f706e, 0 3px 5px rgba(0,0,0,.3);
  cursor: pointer;
}
.eject:active { transform: translateY(2px); box-shadow: 0 0 0 #6f706e, 0 1px 2px rgba(0,0,0,.3); }
.eject:focus-visible, .spine:focus-visible, .player-link:focus-visible { outline: 3px solid #f4c95d; outline-offset: 3px; }

.well {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 400 / 268;
  padding: 3.5% 4%;
  border-radius: 8px;
  background: radial-gradient(ellipse at 50% 35%, #3b3b3b, #151515 75%);
  box-shadow: 0 3px 10px rgba(0,0,0,.8) inset, 0 1px 0 rgba(255,255,255,.4);
}
.prompt { margin: 0; padding: 0 8%; text-align: center; font: 400 clamp(1.1rem, 2.4vw, 1.6rem) / 1.3 var(--marker); color: #d9d2c0; opacity: .85; }
.arrow-down { display: none; }

/* The cassette */
.cassette {
  position: relative;
  width: 100%;
  aspect-ratio: 400 / 254;
  container-type: inline-size;
  filter: drop-shadow(0 6px 10px rgba(0,0,0,.55));
  transform-origin: 0 0;
}
.cassette-svg, .cassette-art { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.c-body { fill: var(--body, #2b2a29); stroke: var(--edge, #141313); stroke-width: 3; }
.c-edge { fill: var(--edge, #141313); opacity: .55; }
.c-paper { fill: var(--paper, #f3ead2); }
.c-stripe { fill: var(--stripe, #c9493b); }
.c-side { font: 700 22px/1 system-ui, sans-serif; fill: #222; opacity: .75; }
.reel { transform-box: fill-box; transform-origin: center; }
.cassette.spin .reel use { animation: spin 1s linear 2; transform-box: fill-box; transform-origin: center; }
@keyframes spin { to { transform: rotate(-360deg); } }
.cassette-label {
  position: absolute;
  left: 15%; top: 8%;
  width: 76%; height: 26%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font: 400 7.5cqw / 1.05 var(--marker);
  color: #1f1d1b;
  overflow: hidden;
  overflow-wrap: anywhere;
  transform: rotate(-1deg);
}
.cassette.has-art .cassette-label { left: 9%; top: 10%; width: 82%; height: 24%; }

/* Player */
.player { width: min(100%, 600px); flex: none; display: flex; flex-direction: column; gap: 8px; }
.player-frame { border-radius: 10px; overflow: hidden; background: #111; box-shadow: 0 10px 24px rgba(0,0,0,.4); }
.player-frame iframe { display: block; width: 100%; height: 360px; border: 0; }
.player-link { align-self: flex-end; color: #e9dcb6; font-size: .9rem; text-decoration: none; }
.player-link:hover { text-decoration: underline; }

/* ---------- Rack ---------- */
.rackside { min-height: 0; display: flex; flex-direction: column; }
.rack {
  flex: 0 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 16px;
  border-radius: 6px;
  background-color: var(--wood);
  background-image: var(--rack-art,
    repeating-linear-gradient(92deg, rgba(0,0,0,.06) 0 2px, transparent 2px 9px, rgba(255,255,255,.04) 9px 11px, transparent 11px 23px),
    linear-gradient(90deg, var(--wood-dark), var(--wood) 12%, var(--wood) 88%, var(--wood-dark)));
  box-shadow: 0 0 0 6px var(--wood-dark), 0 18px 34px rgba(0,0,0,.5), inset 0 0 22px rgba(0,0,0,.35);
  scrollbar-color: var(--wood-dark) transparent;
}
.tapes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.tapes li {
  position: relative;
  border-radius: 3px;
  background: rgba(0,0,0,.42);                      /* the empty slot shows when a tape is out */
  box-shadow: inset 0 3px 6px rgba(0,0,0,.6);
}
.spine {
  position: relative;
  display: flex;
  align-items: center;
  height: 42px;
  padding: 0 10px;
  border-radius: 3px;
  background: var(--body);
  background-image: linear-gradient(rgba(255,255,255,.18), rgba(255,255,255,0) 35%, rgba(0,0,0,.2));
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.35), 0 2px 3px rgba(0,0,0,.4);
  text-decoration: none;
  transition: transform .18s ease, opacity .2s ease;
  -webkit-tap-highlight-color: transparent;
}
.spine::before, .spine::after {                       /* screws at the ends */
  content: '';
  flex: none;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #b9b6b0;
  box-shadow: inset 0 0 0 1px #5d5a56;
}
.spine span {
  flex: 1;
  min-width: 0;
  margin: 0 8px;
  padding: 2px 10px 7px;
  border-radius: 2px;
  background: linear-gradient(var(--paper) 80%, var(--stripe) 80% 90%, var(--paper) 90%);
  color: #1f1d1b;
  font: 400 1rem / 1.35 var(--marker);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.spine:hover { transform: translateX(-12px); }
.spine.out { opacity: 0; pointer-events: none; transform: translateX(-24px); }
.rack-empty { margin: 30px 0; text-align: center; font: 400 1.2rem/1.3 var(--marker); color: #f3ead2; opacity: .85; }

/* ---------- Phones: deck and player on top, the rack below ---------- */
@media (max-width: 800px) {
  body { overflow: auto; }
  .page { display: flex; flex-direction: column; height: auto; min-height: 100vh; padding: 16px 16px 32px; gap: 24px; }
  .deckside { overflow: visible; padding-top: 34px; }
  .rack { overflow: visible; flex: none; }
  .arrow-side { display: none; }
  .arrow-down { display: inline; }
  .player-frame iframe { height: 320px; }
  .spine:hover { transform: none; }
}
@media (max-width: 420px) {
  .deck { padding: 10px 10px 14px; }
  .deck-brand { font-size: .6rem; letter-spacing: .14em; }
}

@media (prefers-reduced-motion: reduce) {
  .spine { transition: none; }
  .spine:hover { transform: none; }
  .cassette.spin .reel use { animation: none; }
}
