:root {
  color-scheme: dark;
  --night: #120d09;
  --night-2: #1c140e;
  --cream: #fff6ea;
  --cream-dim: #f3ddc4;
  --amber: #ffc15a;
  --amber-deep: #e0892a;
  --ink: #24160c;
  --wood-1: #6a3d22;
  --wood-2: #3d2414;
  --wood-3: #2a170e;
  --line: rgba(255, 214, 160, 0.45);
  --focus: #fff1cc;
  --font: "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, "Times New Roman", serif;
  --sans: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-size: 21px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background:
    radial-gradient(ellipse at 50% -10%, rgba(255, 170, 60, 0.16), transparent 46%),
    var(--night);
  color: var(--cream);
  font-family: var(--font);
  line-height: 1.45;
}

body {
  min-height: 100vh;
}

a { color: var(--amber); }
a:hover { color: var(--cream); }

.skip {
  position: absolute;
  left: 0.75rem;
  top: -4rem;
  background: var(--amber);
  color: var(--ink);
  padding: 0.6rem 1rem;
  z-index: 5;
  border-radius: 8px;
  font-weight: 700;
}
.skip:focus { top: 0.75rem; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--line);
}

.brand-link {
  color: var(--amber);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.6rem;
  letter-spacing: 0.04em;
  min-width: 48px;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
}

.top nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.9rem;
  justify-content: flex-end;
}

.top nav a {
  color: var(--cream);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  padding: 0 0.15rem;
}

.layout {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 1rem 1rem 2rem;
}

.cabinet {
  background:
    repeating-linear-gradient(90deg, rgba(255, 220, 170, 0.05) 0 2px, transparent 2px 7px),
    linear-gradient(180deg, #7a4a28 0%, #4a2b16 42%, #2c190f 100%);
  border-radius: 28px;
  padding: 1rem 0.9rem 0.85rem;
  box-shadow:
    inset 0 1px 0 rgba(255, 220, 170, 0.35),
    inset 0 -12px 24px rgba(0, 0, 0, 0.35),
    0 18px 40px rgba(0, 0, 0, 0.45);
  border: 3px solid #1a0e08;
}

.cabinet-top {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 0.8rem;
  align-items: center;
}

.speaker {
  height: 92px;
  border-radius: 12px;
  background-color: #1a0d08;
  background-image: radial-gradient(circle, #3a2416 1.1px, transparent 1.3px);
  background-size: 7px 7px;
  box-shadow: inset 0 0 0 3px #120a06, inset 0 0 18px #000;
}

.nameplate { text-align: left; }
.kicker {
  margin: 0;
  color: var(--amber);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.95rem;
  font-family: var(--sans);
}
.nameplate h1 {
  margin: 0.1rem 0;
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1.15;
  color: var(--cream);
}
.wavelength {
  margin: 0;
  color: var(--cream-dim);
  font-size: 1rem;
}

.dial {
  margin-top: 0.9rem;
  touch-action: pan-y;
  outline: none;
  border-radius: 16px;
}
.dial:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 4px;
}

.glass {
  position: relative;
  height: 148px;
  border-radius: 14px;
  background:
    radial-gradient(ellipse at 50% 120%, rgba(255, 186, 70, 0.55), transparent 55%),
    linear-gradient(180deg, #4a2a12 0%, #1a0d06 100%);
  box-shadow:
    inset 0 0 0 3px #c8923e,
    inset 0 0 30px rgba(255, 170, 50, 0.35),
    0 0 24px rgba(255, 160, 40, 0.25);
  overflow: hidden;
}

.glass-scale {
  position: relative;
  height: 1.8rem;
  margin: 0.45rem 0.85rem 0;
  color: #ffe1ad;
  font-family: var(--sans);
  font-size: 1rem;
}
.glass-scale .tick {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
}
.glass-scale .tick-start { left: 0; transform: none; }
.glass-scale .tick-end { right: 0; left: auto; transform: none; }
.glass-scale .marks {
  position: absolute;
  left: 0;
  right: 0;
  top: 1.55rem;
  height: 10px;
  background-image: repeating-linear-gradient(
    90deg,
    rgba(255, 226, 170, 0.85) 0 2px,
    transparent 2px calc(100% / 19)
  );
  transform: none;
}

.needle {
  position: absolute;
  top: 2.15rem;
  bottom: 3.4rem;
  left: calc(0.85rem + (100% - 1.7rem) * var(--year-t, 0.263158));
  width: 3px;
  margin-left: -1.5px;
  background: #fff6df;
  box-shadow: 0 0 10px #fff, 0 0 18px var(--amber);
  border-radius: 2px;
  transition: left 180ms ease-out;
}
.needle::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -8px;
  width: 12px;
  height: 12px;
  margin-left: -6px;
  background: var(--amber);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--amber);
}

.glass-year {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0.35rem;
  margin: 0;
  text-align: center;
  font-size: 2.4rem;
  line-height: 1;
  color: #2a1608;
  background: linear-gradient(#ffe7ad, #ffbf55);
  padding: 0.2rem 0 0.35rem;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
}

.tune-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.85rem;
}

.knob {
  width: 76px;
  height: 76px;
  flex: 0 0 76px;
  border-radius: 50%;
  touch-action: none;
  cursor: grab;
  background:
    repeating-conic-gradient(from 0deg, #2a1c14 0 8deg, #140c08 8deg 14deg);
  box-shadow:
    inset 0 0 0 8px #1a100c,
    inset 0 0 0 10px #8a6a45,
    0 6px 0 #120c08;
  position: relative;
}
.knob-mark {
  position: absolute;
  left: 50%;
  top: 10px;
  width: 4px;
  height: 16px;
  margin-left: -2px;
  background: var(--amber);
  border-radius: 2px;
  transform-origin: 2px 28px;
  transform: rotate(var(--knob-turn, 70deg));
}

.hint, .sound {
  color: var(--cream-dim);
  font-size: 1rem;
}
.hint { margin: 0.75rem 0 0.35rem; }
.sound {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-height: 48px;
  cursor: pointer;
}
.sound input {
  width: 1.4rem;
  height: 1.4rem;
  accent-color: var(--amber-deep);
}

.story { margin-top: 1.25rem; }
.eyebrow {
  margin: 0;
  font-family: var(--sans);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--amber);
  font-size: 0.85rem;
}
.year-display {
  margin: 0;
  font-size: clamp(4.2rem, 18vw, 7rem);
  line-height: 0.9;
  font-weight: 700;
  color: var(--amber);
  text-shadow: 0 0 24px rgba(255, 170, 50, 0.35);
}
.family, .year-line, .preview-note, .note-label {
  font-size: 1.05rem;
}
.family { margin-bottom: 0.4rem; }
.year-line { margin-top: 0.2rem; }
.range-note { color: var(--amber); }

.actions {
  display: grid;
  gap: 0.7rem;
  margin: 1rem 0 0.6rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  min-width: 48px;
  padding: 0.75rem 1rem;
  border-radius: 14px;
  border: 2px solid transparent;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  text-align: center;
}
.btn:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn-wood {
  flex: 1;
  background: #1a100c;
  color: var(--cream);
  border-color: #e7c08a;
}
.btn-play {
  background: linear-gradient(#ffd78a, #f0a12d);
  color: var(--ink);
  font-size: 1.35rem;
  box-shadow: 0 0 0 1px #8a5a20, 0 8px 20px rgba(255, 160, 40, 0.25);
}
.btn-open {
  background: var(--cream);
  color: var(--ink);
  font-size: 1.2rem;
}
.btn-open:hover { color: var(--ink); background: #fff; }

.preview-note { margin-top: 0; color: var(--cream-dim); }

.spotify-slot {
  margin: 1rem 0;
  min-height: 180px;
  background: #1a120c;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.spotify-slot iframe {
  display: block;
  width: 100%;
  height: 352px;
  border: 0;
}
.slot-wait {
  margin: 0;
  padding: 1.2rem 1rem;
  color: var(--cream-dim);
}

.panel { margin: 1.3rem 0; }
.panel h2 {
  font-size: 1.45rem;
  margin: 1.1rem 0 0.45rem;
}
.panel h2:first-child { margin-top: 0; }
.note-label {
  margin-bottom: 0.2rem;
  color: var(--amber);
  font-family: var(--sans);
}

.mix { display: grid; gap: 0.55rem; margin-top: 0.8rem; }
.mix-row {
  display: grid;
  grid-template-columns: minmax(7.5rem, 1.15fr) 1.6fr auto;
  gap: 0.55rem 0.7rem;
  align-items: center;
}
.mix-label { font-size: 1rem; }
.mix-track {
  display: block;
  height: 1.15rem;
  background: #2a1c14;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.mix-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #e0892a, #ffd27a);
}
.mix-pct {
  font-variant-numeric: tabular-nums;
  min-width: 3.2rem;
  text-align: right;
}

.highlights, .songs {
  margin: 0.4rem 0 0;
  padding-left: 1.4rem;
}
.highlights li, .songs li {
  margin: 0.45rem 0;
  padding: 0.15rem 0;
}
.song-title { font-weight: 700; }
.song-by { color: var(--cream-dim); }
.song-meta {
  display: block;
  color: var(--amber);
  font-size: 1rem;
}
.caveat {
  color: var(--cream-dim);
  margin-top: 0.9rem;
}
.songs li, .highlights li {
  margin: 0.55rem 0;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid rgba(255, 214, 160, 0.15);
}

.track-details {
  margin-top: 0.5rem;
  border-top: 1px solid var(--line);
  padding-top: 0.6rem;
}
.track-details summary {
  cursor: pointer;
  font-size: 1.25rem;
  font-weight: 700;
  min-height: 48px;
  display: flex;
  align-items: center;
}
.track-details summary:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
.list-status { color: var(--cream-dim); }

.foot, .noscript {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto 2rem;
  color: var(--cream-dim);
}
.noscript {
  background: #2a1c12;
  padding: 1rem;
  border-radius: 12px;
}

.prose {
  width: min(42rem, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1rem 0 2rem;
}
.prose h1 {
  font-size: clamp(2.2rem, 8vw, 3.4rem);
  line-height: 1.05;
  margin: 0.2rem 0 0.8rem;
}
.prose h2 { font-size: 1.5rem; margin-top: 1.4rem; }
.prose li { margin: 0.4rem 0; }
.prose .btn { margin-top: 0.6rem; }

@media (min-width: 960px) {
  .layout {
    display: grid;
    grid-template-columns: minmax(340px, 440px) minmax(0, 1fr);
    gap: 2rem;
    align-items: start;
    padding-top: 1.5rem;
  }
  .cabinet-wrap { position: sticky; top: 1rem; }
  .story { margin-top: 0; }
  .nameplate h1 { font-size: 1.7rem; }
}

@media (max-width: 700px) {
  .top { padding: 0.35rem 0.7rem; }
  .top nav { flex-wrap: nowrap; gap: 0.55rem; }
  .glass { height: 132px; }
  .glass-year { font-size: 2.15rem; }
  .needle { bottom: 2.85rem; top: 2rem; }
  .speaker { height: 74px; }
  .cabinet { padding: 0.75rem 0.75rem 0.5rem; }
  .tune-row { margin-top: 0.55rem; }
  .hint { margin: 0.45rem 0 0.1rem; }
  .nameplate h1 { font-size: 1.4rem; }
  .mix-row { grid-template-columns: 1fr auto; }
  .mix-track { grid-column: 1 / -1; }
}
@media (max-width: 380px) {
  :root { font-size: 20px; }
  .cabinet-top { grid-template-columns: 56px 1fr; }
  .knob { width: 64px; height: 64px; flex-basis: 64px; }
  .top nav { gap: 0.35rem; }
}

body.easy .year-display {
  font-size: clamp(5rem, 22vw, 8rem);
}
body.easy .btn-play,
body.easy .btn-wood,
body.easy .btn-open {
  min-height: 72px;
  font-size: 1.4rem;
}
body.easy .hint { font-size: 1.15rem; }

@media (prefers-reduced-motion: reduce) {
  .needle { transition: none; }
  html { scroll-behavior: auto; }
}

.glass {
  animation: glow 4.5s ease-in-out infinite;
}
@keyframes glow {
  0%, 100% { box-shadow: inset 0 0 0 3px #c8923e, inset 0 0 22px rgba(255, 170, 50, 0.28), 0 0 16px rgba(255, 160, 40, 0.18); }
  50% { box-shadow: inset 0 0 0 3px #e0b15a, inset 0 0 36px rgba(255, 180, 60, 0.48), 0 0 28px rgba(255, 170, 50, 0.32); }
}
@media (prefers-reduced-motion: reduce) {
  .glass { animation: none; }
}
