/* Every colour in the app resolves through the tokens below, so a theme is a
   block of values rather than a pile of per-component overrides. To add one,
   copy a block, rename it, and register the name in the THEMES list in app.js.
   --scene points at an SVG in public/; swapping in a photograph means dropping
   the file next to them and adding it to the static route map in server. */

:root {
  font-family: Inter, "Segoe UI", "Malgun Gothic", sans-serif;
  --display: Georgia, "Times New Roman", "Nanum Myeongjo", "Apple SD Gothic Neo", serif;
  color: var(--text);
  /* The lamp sits on the root so the scene layer can paint above it. */
  background-color: var(--bg);
  background-image: radial-gradient(120% 75% at 50% -12%, var(--glow), transparent 68%);
  background-attachment: fixed;
}

/* ── 네온 사쿠라 · neon signs through falling petals ──────────────────────── */
:root,
[data-theme=neon] {
  color-scheme: dark;
  --bg: #150e1a;
  --surface: #1e1425e6;
  --surface-2: #1a1020d9;
  --input: #180f1e;
  --text: #f0e2f0;
  --text-2: #f7ecf5;
  --muted: #a894ad;
  --muted-2: #8a7590;
  --line: #34243c;
  --line-soft: #2b1d33;
  --green: #ff5c9a;
  --accent-ink: #1a0d14;
  --accent-soft: #ffa8cc;
  --eyebrow: #d97ab0;
  --chip: #33203d;
  --chip-line: #57306a;
  --chip-ink: #ffb3d4;
  --badge: #45213a;
  --badge-ink: #ff9ec4;
  --disc-a: #1b1226;
  --disc-b: #2a1c38;
  --label: #ffc2da;
  --label-ink: #2a1020;
  --spindle-ring: #ffffff70;
  --progress: #3a2545;
  --progress-fill: #ff5c9a;
  --toast: #ffb3d4;
  --toast-ink: #2a1020;
  --shadow: #ff5c9a26;
  --focus: #ff8ab8;
  --glow: #ff5c9a1f;
  --grain: .05;
  --arm: #e2cadd;
  --arm-2: #3a2445;
  --scene: url("/scene-livehouse-shelter-v2.png");
  --scene-op: .9;
}

/* 햇살 레코드숍 — warm wood, paper sleeves and late-afternoon light */
[data-theme=sakura-day] {
  color-scheme: light;
  --bg: #f4efe5;
  --surface: #fffdf8dc;
  --surface-2: #f8f0e4d9;
  --input: #fffdf9e6;
  --text: #34312d;
  --text-2: #292723;
  --muted: #756b61;
  --muted-2: #9a8c7e;
  --line: #ddcdbb;
  --line-soft: #eadfd2;
  --green: #c85f43;
  --accent-ink: #fffaf2;
  --accent-soft: #d98a62;
  --eyebrow: #a55540;
  --chip: #eee2d3;
  --chip-line: #d4bca6;
  --chip-ink: #8e4938;
  --badge: #eadbc9;
  --badge-ink: #9a4638;
  --disc-a: #26363b;
  --disc-b: #344950;
  --label: #d8a064;
  --label-ink: #3f2e26;
  --spindle-ring: #ffffffb0;
  --progress: #dfd2c4;
  --progress-fill: #c85f43;
  --toast: #49372f;
  --toast-ink: #fff9ed;
  --shadow: #68433126;
  --focus: #c85f43;
  --glow: #f3c47c66;
  --grain: .018;
  --arm: #81756b;
  --arm-2: #c5ad99;
  --scene: linear-gradient(90deg, #f6eee2c7 0%, #f6eee270 34%, #f6eee21f 72%), url("/scene-day-photo.png");
  --scene-op: .9;
}

/* ── the room behind the app ─────────────────────────────────────────────── */
/* z-index -1 keeps the scene above the root background but under every card,
   so the panels read as furniture standing in front of it. */
#scene {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: var(--scene-op);
  background-image: var(--scene);
  background-size: cover;
  background-position: center bottom;
  background-repeat: no-repeat;
}

/* Cards are translucent so the scene shows through; without the blur the
   bottles behind them turn into visual noise under the text. */
.card {
  backdrop-filter: blur(14px) saturate(115%);
  -webkit-backdrop-filter: blur(14px) saturate(115%);
}

h1, h2 { font-family: var(--display); font-weight: 500; }
h1 { letter-spacing: -1.2px; }
body { min-height: 100vh; }

/* The light theme's window passes behind the opening copy. A broad, soft
   shadow keeps the letters readable without turning the hero into another card. */
[data-theme=sakura-day] #lobby > .eyebrow,
[data-theme=sakura-day] #lobby > h1,
[data-theme=sakura-day] #lobby > .intro {
  text-shadow: 0 1px 8px #fffaf0, 0 1px 22px #fffaf0, 0 0 36px #fffaf0;
}

/* Film grain. An inline SVG keeps it a texture rather than an extra request,
   and pointer-events:none keeps every control underneath clickable. */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9998;
  pointer-events: none;
  opacity: var(--grain);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ── tonearm ─────────────────────────────────────────────────────────────── */
/* Parked by default and lowered onto the disc while the player reports
   PLAYING, which app.js already signals by putting .spinning on #record. */
/* Centred on the record, not on the stage: the stage is shorter than this box,
   so inset:0 + margin:auto would resolve over-constrained and sit too low. One
   SVG unit is one pixel here, which is what puts the stylus on the groove. */
#tonearm {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 400px;
  height: 400px;
  pointer-events: none;
  z-index: 3;
  filter: drop-shadow(0 6px 10px #00000055);
}
#tonearm .tube { fill: none; stroke: var(--arm); stroke-width: 5; stroke-linecap: round; }
#tonearm .weight { fill: none; stroke: var(--arm-2); stroke-width: 8; stroke-linecap: round; }
#tonearm .wt { fill: var(--arm-2); stroke: var(--arm); stroke-width: 1.5; }
#tonearm .shell { fill: var(--arm); }
#tonearm .base { fill: var(--arm-2); stroke: var(--arm); stroke-width: 2; }
#tonearm .hub { fill: var(--arm); }
#tonearm-arm {
  transform-origin: 350px 290px;
  transform: rotate(38deg);
  transition: transform 1.2s cubic-bezier(.4, 0, .2, 1);
}
#record.spinning ~ #tonearm #tonearm-arm { transform: rotate(0deg); }

@media (prefers-reduced-motion: reduce) {
  body::after { display: none; }
  #tonearm-arm { transition: none; }
}

/* ── theme picker ────────────────────────────────────────────────────────── */
.theme-picker { display: flex; gap: 7px; align-items: center; }
.swatch {
  width: 19px;
  height: 19px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  transition: transform .18s, box-shadow .18s;
}
.swatch[aria-pressed=true] { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--green); }
.swatch[data-theme-pick=neon] { background: linear-gradient(135deg, #ff5c9a, #2a1030); }
.swatch[data-theme-pick=sakura-day] { background: linear-gradient(135deg, #f6edda 35%, #c85f43 36% 68%, #657f76 69%); }

@media (max-width: 760px) {
  .theme-picker { margin-left: auto; gap: 6px; }
  .swatch { width: 17px; height: 17px; }
  #tonearm { width: 344px; height: 344px; }
}
