@import url('https://fonts.googleapis.com/css2?family=Permanent+Marker&family=Caveat:wght@400;600&family=Orbitron:wght@400;700&display=swap');

/* ════════════════════════════════
   MUSIC PAGE — Cassette Shelf
   Pioneer KEX-M700 / Sony XE-700
════════════════════════════════ */

/* ── PAGE WRAPPER ── */
.music-page {
  width: 100%;
  max-width: var(--page-width);
  margin: 0 auto;
  padding: 24px 16px 32px;
}


.music-intro {
  overflow: hidden;
  margin-bottom: 24px;
}

.music-intro .index-notice {
  float: right;
  margin-left: 20px;
  margin-bottom: 8px;
  max-width: 240px;
}

.music-page .page-sub {
  margin-bottom: 0;
}

/* ════════════════════════════════
   DECK
════════════════════════════════ */
.deck-sticky {
  position: sticky;
  top: 0;
  z-index: 10001;
  padding-top: 8px;
  margin-bottom: 24px;
  background: #000030;
}

.deck-wrap {
  margin: 0 auto 0;
}

.deck-ledge {
  width: 100vw;
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  height: 26px;
  background-color: #7a4e28;
  background-image:
    repeating-linear-gradient(
      90deg,
      rgba(0,0,0,0.04) 0px, transparent 1px,
      transparent 20px, rgba(0,0,0,0.02) 20px,
      transparent 21px, transparent 40px
    );
  border-top: 3px solid #a06830;
  border-bottom: 4px solid #5a3410;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  margin-bottom: 0;
}
.deck-ledge::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 0;
  right: 0;
  height: 2px;
  background: rgba(255, 255, 255, 0.1);
}

.deck {
  background: #F2E0C9;
  border: 2px solid #bfa065;
  border-radius: 5px;
  /* overflow must NOT be hidden — paper note overhangs the bottom */
}

.deck-face {
  background: #F2E0C9;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid #bfa065;
  flex-wrap: wrap;
  position: relative;
  overflow: hidden;
}

/* ── PLASTIC TEXTURE OVERLAY ── */
.deck-face::before,
.deck-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  border-radius: inherit;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23noise)' opacity='1'/%3E%3C/svg%3E");
  background-size: 180px 180px;
  mix-blend-mode: multiply;
  opacity: 0.18;
}

/* Corner grime — darkness pooling at edges like aged plastic */
.deck-face::after,
.deck-panel::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 101;
  border-radius: inherit;
  background:
    radial-gradient(ellipse at top left,     rgba(60, 30, 0, 0.18) 0%, transparent 50%),
    radial-gradient(ellipse at top right,    rgba(60, 30, 0, 0.12) 0%, transparent 50%),
    radial-gradient(ellipse at bottom left,  rgba(60, 30, 0, 0.20) 0%, transparent 50%),
    radial-gradient(ellipse at bottom right, rgba(60, 30, 0, 0.15) 0%, transparent 50%);
  mix-blend-mode: multiply;
}

/* Brand */
.brand-col { flex-shrink: 0; }
.brand-name { font-size: 14px; color: #8a4a00; letter-spacing: 3px; }
.brand-model { font-size: 8px; color: #bfa065; letter-spacing: 2px; }

/* Tape window */
.tape-window {
  width: 170px;
  height: 60px;
  background: #0a0806;
  border: 2px solid #8a6a3a;
  border-radius: 3px;
  flex-shrink: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 16px;
  overflow: hidden;
}
.tape-window::after {
  content: '';
  position: absolute;
  inset: 4px;
  border: 1px solid #1a1208;
  border-radius: 1px;
  pointer-events: none;
}
.tape-bar {
  position: absolute;
  width: 100%;
  height: 1.5px;
  background: #1e1408;
  top: 50%;
  transform: translateY(-50%);
}

/* Reels */
.reel {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid #8a6a3a;
  background: #080604;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.reel-hub {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #151008;
  border: 1px solid #3a2a18;
  position: absolute;
}
.reel-s {
  position: absolute;
  width: 1.5px;
  height: 11px;
  background: #2e2010;
  transform-origin: center;
  border-radius: 1px;
}
.reel.spin { animation: rspin 2s linear infinite; }
@keyframes rspin { to { transform: rotate(360deg); } }

/* LCD */
.lcd {
  flex: 1;
  background: #0c0700;
  border: 1px solid #2a1800;
  border-radius: 2px;
  padding: 6px 10px;
  height: auto;
  min-height: 60px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  min-width: 120px;
}
.lcd-main-row   { display: flex; align-items: stretch; flex: 1; min-width: 0; }
.lcd-left       { flex: 0 0 50%; min-width: 0; overflow: hidden; }
.lcd-year       { font-size: 14px; color: #6a4200; letter-spacing: 2px; margin-top: 4px; }
.lcd-field-wrap { overflow: hidden; }
.lcd-album {
  font-size: 18px;
  color: #ff9500;
  letter-spacing: 1px;
  white-space: nowrap;
  display: inline-block;
}
.lcd-artist {
  font-size: 22px;
  color: #6a4200;
  letter-spacing: 2px;
  white-space: nowrap;
  display: inline-block;
}
.lcd-artist.is-scrolling,
.lcd-album.is-scrolling {
  animation: lcd-marquee 5s ease-in-out infinite;
}
@keyframes lcd-marquee {
  0%   { transform: translateX(0); }
  15%  { transform: translateX(0); }
  85%  { transform: translateX(var(--scroll-dist)); }
  100% { transform: translateX(var(--scroll-dist)); }
}
.lcd-blink-done {
  animation: lcd-blink-done 300ms linear 3;
}
@keyframes lcd-blink-done {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}
.lcd-scroll-wrap { overflow: hidden; height: 10px; }
.lcd-scroll {
  font-size: 8px;
  color: #7a5000;
  letter-spacing: 1px;
  white-space: nowrap;
  display: inline-block;
  animation: mq 20s linear infinite;
}
@keyframes mq {
  0%   { transform: translateX(100%); }
  100% { transform: translateX(-300%); }
}

/* Controls */
.ctrl-col { display: flex; flex-direction: column; gap: 5px; flex-shrink: 0; }
.ctrl-row { display: flex; gap: 4px; }
.btn {
  background: #e8d0aa;
  border: 1px solid #bfa065;
  border-bottom: 3px solid #8a6030;
  border-radius: 2px;
  box-shadow: 0 4px 4px -2px rgba(0, 0, 0, 0.35);
  color: #7a4400;
  font-family: 'Share Tech Mono', monospace;
  font-size: 8px;
  letter-spacing: 1px;
  padding: 4px 8px;
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
}
.btn:hover          { background: #FFB33F; color: #000; }
.btn:active         { border-bottom-width: 1px; box-shadow: 0 1px 3px rgba(0,0,0,0.25); transform: translateY(2px); }
.btn.lit            { background: #ff9500; color: #000; border-color: #ff9500; }
.btn.play           { border-color: #ff9500; color: #ff9500; font-size: 10px; padding: 4px 10px; }
.btn.play:hover,
.btn.play.lit       { background: #ff9500; color: #000; }

/* EQ strip */
.deck-panel {
  background: #F2E0C9;
  border-top: 1px solid #bfa065;
  padding: 7px 14px 10px;
  display: flex;
  align-items: stretch;
  gap: 14px;
  position: relative;
  overflow: hidden;
  border-radius: 0 0 5px 5px;
}
.eq-left  { flex-shrink: 0; margin-top: auto; }
.lcd .eq-left  { flex: 0 0 50%; margin-top: 0; padding-left: 10px; box-sizing: border-box; display: flex; align-items: flex-end; justify-content: flex-end; align-self: stretch; }
.lcd .eq-bars  { width: 100%; justify-content: space-between; height: auto; }
.lcd .eq-seg   { height: 5px; }
.eq-label { font-size: 7px; color: #4a3018; letter-spacing: 3px; margin-bottom: 4px; }
.eq-bars  { display: flex; gap: 3px; align-items: flex-end; height: 24px; }
.eq-col   { display: flex; flex-direction: column-reverse; gap: 1px; align-items: center; }
.eq-seg   { width: 11px; height: 2px; background: #1e1408; }
.eq-seg.lo  { background: #662200; }
.eq-seg.md  { background: #bb6600; }
.eq-seg.hi  { background: #ff9500; }
.eq-seg.pk  { background: #ff5533; }
.eq-hz { font-size: 6px; color: #4a3018; margin-top: 2px; }

.eq-divider {
  width: 1px;
  background: #bfa065;
  align-self: stretch;
  margin: 0 2px;
  flex-shrink: 0;
}

/* ════════════════════════════════
   EQ + TRACKLIST COLUMN
════════════════════════════════ */
.eq-center-col {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-self: stretch;
  flex-shrink: 0;
  gap: 6px;
}

/* ── TRACKLIST PANEL (compact, inside deck-panel) ── */
.tracklist-panel {
  background: transparent;
  width: 140px;
  display: flex;
  flex-direction: column;
  flex: 1;
  height: 0;
  overflow: hidden;
}

.tl-header {
  display: flex;
  justify-content: space-between;
  font-family: 'Share Tech Mono', monospace;
  font-size: 6px;
  color: #4a2e00;
  letter-spacing: 2px;
  margin-bottom: 3px;
  padding-bottom: 2px;
  border-bottom: 1px solid #1e1000;
}

.tracklist-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: #3a1e00 transparent;
}
.tracklist-body::-webkit-scrollbar       { width: 3px; }
.tracklist-body::-webkit-scrollbar-track { background: transparent; }
.tracklist-body::-webkit-scrollbar-thumb { background: #3a1e00; border-radius: 2px; }

.tl-row {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 8px;
  color: #cc7700;
  line-height: 1.7;
  overflow: hidden;
}

.tl-num {
  flex-shrink: 0;
  width: 14px;
  color: #663300;
  font-size: 7px;
}

.tl-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.tl-name.can-scroll {
  text-overflow: clip;
  cursor: default;
}
.tl-row:hover .tl-name.can-scroll {
  animation: tl-marquee 3.5s ease-in-out forwards;
}
@keyframes tl-marquee {
  0%,  15% { transform: translateX(0); }
  85%, 100% { transform: translateX(var(--tl-scroll)); }
}

.tl-dur {
  flex-shrink: 0;
  color: #663300;
  font-size: 7px;
  text-align: right;
}

/* ════════════════════════════════
   CRT VIDEO SCREEN
════════════════════════════════ */
.crt-wrap {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  align-self: flex-end;
  padding-bottom: 2px;
}

.crt-label {
  font-size: 6px;
  color: #4a3018;
  letter-spacing: 3px;
}

.crt-bezel {
  width: 255px;
  height: 158px;
  background: #100c06;
  border: 2px solid #251a0e;
  border-radius: 6px;
  padding: 4px;
  position: relative;
  box-shadow:
    inset 0 0 6px #000,
    0 2px 8px #000,
    0 0 0 1px #0a0604;
}
.crt-bezel::before {
  content: '';
  position: absolute;
  inset: 2px;
  border-radius: 4px;
  border: 1px solid #1a1208;
  pointer-events: none;
  z-index: 20;
}

.crt-screen {
  width: 100%;
  height: 100%;
  background: #0a0500;
  position: relative;
  overflow: hidden;
  border-radius: 6px / 5px;
}
.crt-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 15;
  border-radius: inherit;
  background:
    radial-gradient(ellipse 80% 30% at 50% -10%, #ffffff09 0%, transparent 70%),
    radial-gradient(ellipse 20% 80% at -5% 50%,  #ffffff06 0%, transparent 60%),
    radial-gradient(ellipse 120% 120% at 50% 50%, transparent 55%, #000000cc 100%);
  pointer-events: none;
}
.crt-screen::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 14;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px, transparent 2px,
    #00000033 2px, #00000033 3px
  );
  border-radius: inherit;
  pointer-events: none;
  animation: scanroll 8s linear infinite;
}
@keyframes scanroll {
  0%   { background-position: 0 0; }
  100% { background-position: 0 120px; }
}

/* ── Idle static canvas ── */
#crtIdleCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 3;
  image-rendering: pixelated;
  display: none;
}

/* ── Cover art layer ── */
.crt-cover {
  position: absolute;
  inset: 0;
  z-index: 4;
  border-radius: inherit;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity 0.4s ease;
  filter: brightness(0.35) saturate(0.6);
}
.crt-cover.visible { opacity: 1; }

/* ── Video layer ── */
.crt-video {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 5;
  border-radius: inherit;
}
.crt-video iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* ── Video static overlay ── */
#crtVideoStatic {
  display: none;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 6;
  pointer-events: none;
  opacity: 0.25;
  border-radius: inherit;
}

.crt-content {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: inherit;
  animation: phflicker 6s ease-in-out infinite;
}
@keyframes phflicker {
  0%, 95%, 100% { opacity: 1; }
  96%           { opacity: 0.92; }
  97%           { opacity: 0.97; }
  98%           { opacity: 0.88; }
}

.crt-screen.off .crt-content { opacity: 0; }
.crt-screen.off { background: #060300; }

.crt-line {
  font-family: 'Share Tech Mono', monospace;
  font-size: 14px;
  color: #ff9500;
  letter-spacing: 0.5px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  text-shadow: 0 0 4px #cc6600, 0 0 8px #884400aa;
  line-height: 1.5;
}
.crt-line.artist {
  color: #884400;
  font-size: 12px;
  letter-spacing: 1px;
  text-shadow: 0 0 3px #66220044;
}
.crt-line.track-num {
  color: #ff9500;
  font-size: 26px;
  font-weight: bold;
  text-shadow: 0 0 6px #cc6600, 0 0 14px #88440088;
  line-height: 1.2;
}

.crt-dots {
  position: absolute;
  inset: 0;
  z-index: 6;
  border-radius: inherit;
  background-image: radial-gradient(circle, #ffffff05 1px, transparent 1px);
  background-size: 3px 3px;
  pointer-events: none;
}

.crt-static {
  position: absolute;
  inset: 0;
  z-index: 12;
  border-radius: inherit;
  opacity: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='82' height='60'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
  background-size: cover;
  mix-blend-mode: screen;
}
.crt-static.burst {
  animation: staticburst 0.38s steps(1) forwards;
}
@keyframes staticburst {
  0%   { opacity: 0.95; filter: brightness(2.5) saturate(0) contrast(3); }
  12%  { opacity: 0.7;  filter: brightness(1.5) saturate(0) contrast(2); transform: translateY(-2px) scaleX(1.01); }
  25%  { opacity: 0.9;  filter: brightness(2)   saturate(0) contrast(3); transform: translateY(1px); }
  37%  { opacity: 0.5;  filter: brightness(1.2) saturate(0) contrast(2); transform: translateX(-1px); }
  50%  { opacity: 0.8;  filter: brightness(2)   saturate(0) contrast(3); transform: translateY(-1px) scaleX(0.99); }
  62%  { opacity: 0.3;  filter: brightness(1)   saturate(0) contrast(2); }
  75%  { opacity: 0.6;  filter: brightness(1.5) saturate(0); transform: translateX(1px); }
  87%  { opacity: 0.15; filter: brightness(1); }
  100% { opacity: 0; }
}

.crt-hbar {
  position: absolute;
  left: 0; right: 0;
  height: 8px;
  z-index: 13;
  background: linear-gradient(90deg, #ff950033, #cc660066, #ff950022);
  opacity: 0;
  pointer-events: none;
  mix-blend-mode: screen;
}
.crt-hbar.sweep {
  animation: hbarsweep 0.32s ease-in forwards;
}
@keyframes hbarsweep {
  0%   { top: 0%;   opacity: 0.9; }
  60%  { top: 80%;  opacity: 0.7; }
  100% { top: 100%; opacity: 0;   }
}

/* ════════════════════════════════
   TORN PAPER NOTE
════════════════════════════════ */
.paper-col {
  flex: 1;
  align-self: stretch;
  position: relative;
  min-width: 0;
}

.paper-outer {
  position: relative;
  z-index: 10;
  transform-origin: 50% 0%;
}

.scotch {
  position: absolute;
  top: -25px;
  left: 40%;
  transform: translateX(-50%);
  width: 200px;
  height: 50px;
  background: #fffed845;
  border: 1px solid #aaccee33;
  z-index: 4;
  clip-path: polygon(
    7%  0%,
    100% 0%,
    96% 30%,
    100% 60%,
    93% 100%,
    0%  100%,
    4%  65%,
    0%  35%
  );
}
.scotch::before {
  content: '';
  position: absolute;
  inset: 1px;
  background: repeating-linear-gradient(
    90deg,
    transparent 0px, transparent 68px,
    #99bbdd18 68px, #99bbdd18 71px
  );
}
.scotch::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0; left: 0;
  width: 3px;
  background: #00000010;
}

.paper {
  background: #f0ebe0;
  padding: 7px 11px 8px;
  position: relative;
  z-index: 3;
  display: flow-root;
}
.paper::before {
  content: '';
  position: absolute;
  top: -3px; left: 0; right: 0;
  height: 4px;
  background: repeating-linear-gradient(
    90deg,
    #f0ebe0 0px,  #f0ebe0 4px,
    #e4dece 4px,  #e4dece 5px,
    #f0ebe0 5px,  #f0ebe0 9px,
    #d8d0c0 9px,  #d8d0c0 10px,
    #f0ebe0 10px, #f0ebe0 15px,
    #e8e0d0 15px, #e8e0d0 16px,
    #f0ebe0 16px, #f0ebe0 22px,
    #ddd5c5 22px, #ddd5c5 23px,
    #f0ebe0 23px, #f0ebe0 28px
  );
}
.paper::after {
  content: '';
  position: absolute;
  bottom: -4px; left: 0; right: 0;
  height: 5px;
  background: repeating-linear-gradient(
    90deg,
    #f0ebe0 0px,  #f0ebe0 3px,
    #c8c0b0 3px,  #c8c0b0 4px,
    #f0ebe0 4px,  #f0ebe0 8px,
    #d8d0c0 8px,  #d8d0c0 9px,
    #f0ebe0 9px,  #f0ebe0 14px,
    #e0d8c8 14px, #e0d8c8 15px,
    #f0ebe0 15px, #f0ebe0 20px,
    #ccc4b4 20px, #ccc4b4 21px,
    #f0ebe0 21px, #f0ebe0 27px
  );
}
.paper-cover {
  float: right;
  width: 80px;
  height: 80px;
  object-fit: cover;
  margin: 2px 0 4px 8px;
  box-shadow: 1px 1px 4px #0003;
  opacity: 0.88;
}

.paper-rule { height: 1px; background: #c8b89848; margin: 4px 0; }
.paper-text {
  font-family: 'Caveat', cursive;
  font-size: var(--text-lg);
  color: #2a1e08;
  line-height: 1.4;
  font-weight: 400;
}
.paper-text.faint {
  color: #9a8a68;
  font-size: var(--text-md);
}

/* ════════════════════════════════
   ANALOG DIALS (below paper note)
════════════════════════════════ */
.dials-strip {
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 10px 8px 6px;
  background: #F2E0C9;
  border-top: 1px solid #bfa065;
  gap: 8px;
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1;
}

.dial-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  flex: 1;
}

.dial-label {
  font-family: 'Share Tech Mono', monospace;
  font-size: 6px;
  color: #4a3018;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.dial-svg {
  width: 38px;
  height: 38px;
  display: block;
  filter: drop-shadow(0 1px 3px #000a);
}

/* ════════════════════════════════
   SHELF / GRID
════════════════════════════════ */
.shelf-wrap { margin: 0 auto; position: relative; z-index: 10000; }
.shelf-label { font-size: 8px; color: #4a3018; letter-spacing: 4px; margin-bottom: 12px; }

.tape-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  gap: 12px;
}
@media (min-width: 900px) {
  .tape-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

.cassette {
  cursor: pointer;
  border-radius: 4px;
  overflow: hidden;
  transition: transform 0.12s;
}
.cassette:hover  { transform: translateY(-3px); }
.cassette.active { outline: 2px solid #ff9500; outline-offset: 2px; }
.cassette svg    { display: block; width: 100%; height: auto; }
.cassette.active .svg-reel {
  animation: rspin 2s linear infinite;
  transform-box: fill-box;
  transform-origin: center;
}

.cassette-cover {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  opacity: 0.75;
  transition: opacity 0.2s;
}
.cassette:hover .cassette-cover,
.cassette.active .cassette-cover { opacity: 1; }
