:root {
  --room: #1a110b;
  --room-2: #2b1b10;
  --wood-1: #5a2f17;
  --wood-2: #7a4322;
  --wood-3: #3b1d0d;
  --ivory: #efe3c6;
  --ivory-2: #d9c8a0;
  --brass: #c9a24a;
  --brass-2: #8a6a22;
  --dial-bg: #1d1208;
  --dial-ink: #f3d79a;
  --needle: #d8261b;
  --glow: 0;
  --paper: #f4ecd8;
  --paper-ink: #2a1d12;
  --muted: #8f7c62;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--room); color: var(--ivory); overflow-x: hidden; }
body {
  font-family: "Cormorant Garamond", Georgia, serif;
  background:
    radial-gradient(ellipse at 50% 35%, rgba(255, 170, 70, calc(0.10 + var(--glow) * 0.18)), transparent 60%),
    radial-gradient(ellipse at 50% 120%, #000 0%, transparent 60%),
    linear-gradient(180deg, var(--room-2), var(--room));
  transition: background 2s;
}
.room { min-height: 100svh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px 32px; gap: 18px; }

/* ---------- cabinet ---------- */
.radio { width: min(560px, 100%); position: relative; filter: drop-shadow(0 30px 40px rgba(0, 0, 0, .6)); }
.cabinet {
  border-radius: 34px 34px 18px 18px;
  padding: 16px 16px 18px;
  background:
    repeating-linear-gradient(92deg, rgba(0,0,0,.10) 0 2px, transparent 2px 9px),
    repeating-linear-gradient(88deg, rgba(255,210,150,.05) 0 1px, transparent 1px 13px),
    radial-gradient(ellipse at 30% 10%, var(--wood-2), var(--wood-1) 55%, var(--wood-3));
  box-shadow: inset 0 2px 0 rgba(255,220,170,.25), inset 0 -6px 14px rgba(0,0,0,.5), inset 0 0 0 3px rgba(0,0,0,.25);
}
.crown { display: flex; justify-content: space-between; align-items: baseline; padding: 2px 10px 10px; }
.brand { font-family: "Limelight", serif; font-size: clamp(26px, 7vw, 38px); letter-spacing: .04em;
  background: linear-gradient(180deg, #fff6dc, var(--brass) 55%, var(--brass-2)); -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 1px 0 rgba(0,0,0,.2); }
.model { font-family: "Oswald", sans-serif; font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: rgba(239,227,198,.55); }

.grille {
  height: clamp(110px, 30vw, 170px); border-radius: 14px; position: relative;
  background:
    repeating-linear-gradient(0deg, rgba(0,0,0,.28) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgba(0,0,0,.22) 0 1px, transparent 1px 3px),
    linear-gradient(180deg, #c8b48a, #a88f62);
  box-shadow: inset 0 0 0 6px rgba(60,30,10,.55), inset 0 0 30px rgba(0,0,0,.45);
}
.grille::before, .grille::after { content: ""; position: absolute; top: 12%; bottom: 12%; width: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--brass-2), var(--brass), var(--brass-2)); }
.grille::before { left: 33%; } .grille::after { right: 33%; }
.emblem { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center; font-family: "Limelight", serif; font-size: 17px; color: #3a250f;
  background: radial-gradient(circle at 35% 30%, #fff1c4, var(--brass) 60%, var(--brass-2)); box-shadow: 0 2px 6px rgba(0,0,0,.5); z-index: 1; }

/* ---------- dial ---------- */
.dial-row { display: flex; gap: 12px; align-items: stretch; margin-top: 14px; }
.dial { flex: 1; min-width: 0; border-radius: 12px; padding: 6px; background: linear-gradient(180deg, #2a1a0d, #120a04);
  box-shadow: inset 0 0 0 2px var(--brass-2), 0 1px 0 rgba(255,220,170,.2); cursor: grab; touch-action: none; outline: none; }
.dial:focus-visible { box-shadow: inset 0 0 0 2px var(--brass), 0 0 0 3px rgba(243,215,154,.35); }
.dial:active { cursor: grabbing; }
.dial-glass { position: relative; height: 92px; border-radius: 8px; overflow: hidden;
  background: radial-gradient(ellipse at 50% 60%, rgba(255,185,80, calc(var(--glow) * .55)), transparent 70%), var(--dial-bg);
  transition: background 2s; }
.dial-glass::after { content: ""; position: absolute; inset: 0; background: linear-gradient(170deg, rgba(255,255,255,.12), transparent 40%); pointer-events: none; }
.dial-band { position: absolute; top: 4px; left: 0; right: 0; text-align: center; font-family: "Oswald", sans-serif; font-size: 9px; letter-spacing: .3em;
  color: var(--dial-ink); opacity: calc(.25 + var(--glow) * .6); }
.dial-scale { position: absolute; inset: 0; color: var(--dial-ink); opacity: calc(.3 + var(--glow) * .7); transition: opacity 2s; }
.tick { position: absolute; bottom: 18px; width: 1px; background: currentColor; }
.tick.major { height: 12px; } .tick.minor { height: 6px; opacity: .6; }
.khz { position: absolute; bottom: 2px; transform: translateX(-50%); font-family: "Oswald", sans-serif; font-size: 10px; }
.city { position: absolute; transform: translateX(-50%); font-size: 12px; font-style: italic; white-space: nowrap; }
.city.r0 { top: 18px; } .city.r1 { top: 36px; }
.needle { position: absolute; top: 8px; bottom: 6px; width: 2px; margin-left: -1px; background: var(--needle); box-shadow: 0 0 6px rgba(216,38,27,.8); }

.magic-eye { width: 92px; height: 92px; align-self: center; border-radius: 50%; background: #050805;
  box-shadow: inset 0 0 0 4px #222, 0 0 0 3px var(--brass-2), 0 0 calc(var(--glow) * 24px) rgba(80,255,120,.35); }

/* ---------- controls ---------- */
.controls { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; margin-top: 16px; }
.knob-wrap { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.knob { width: 64px; height: 64px; border-radius: 50%; border: 0; position: relative; cursor: pointer; touch-action: none;
  background:
    repeating-conic-gradient(from 0deg, rgba(255,255,255,.06) 0 6deg, rgba(0,0,0,.12) 6deg 12deg),
    radial-gradient(circle at 35% 30%, #6b4a33, #2a170b 70%);
  box-shadow: 0 6px 10px rgba(0,0,0,.55), inset 0 2px 2px rgba(255,220,170,.25), inset 0 -3px 6px rgba(0,0,0,.6); }
.knob:focus-visible { outline: 3px solid rgba(243,215,154,.5); outline-offset: 3px; }
.knob-mark { position: absolute; left: 50%; top: 7px; width: 4px; height: 14px; margin-left: -2px; border-radius: 2px; background: var(--ivory-2); }
.knob.on .knob-mark { background: #ffcf6e; box-shadow: 0 0 6px #ffb347; }
.knob-label { font-family: "Oswald", sans-serif; font-size: 9px; letter-spacing: .16em; color: rgba(239,227,198,.6); }
.plate { min-width: 0; text-align: center; padding: 10px 8px; border-radius: 8px;
  background: linear-gradient(180deg, var(--ivory), var(--ivory-2)); color: #3a250f;
  box-shadow: inset 0 1px 0 #fff, inset 0 -2px 3px rgba(0,0,0,.2), 0 2px 4px rgba(0,0,0,.4); }
.plate-station { font-family: "Limelight", serif; font-size: clamp(14px, 4vw, 18px); line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plate-prog { font-size: 15px; font-style: italic; line-height: 1.25; margin-top: 2px; min-height: 2.5em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.volume { width: 100%; margin: 14px 0 0; accent-color: var(--brass); }
.feet { display: flex; justify-content: space-between; padding: 0 40px; }
.feet span { width: 48px; height: 10px; border-radius: 0 0 8px 8px; background: #160b04; }

/* ---------- actions & sheets ---------- */
.actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.act { font: 600 15px "Cormorant Garamond", serif; padding: 10px 16px; border-radius: 999px; border: 1px solid rgba(201,162,74,.5);
  background: rgba(0,0,0,.25); color: var(--ivory); cursor: pointer; min-height: 44px; }
.act:hover { border-color: var(--brass); }
.act.primary { background: var(--brass); color: #2a1a08; border-color: var(--brass); }
.act:disabled { opacity: .45; cursor: default; }
.whisper { min-height: 1.4em; margin: 0; font-style: italic; color: var(--muted); text-align: center; }

.sheet { border: 0; padding: 0; background: transparent; width: min(520px, calc(100% - 24px)); max-height: 86svh; }
.sheet::backdrop { background: rgba(10,6,3,.7); backdrop-filter: blur(2px); }
.paper { position: relative; padding: 22px 20px 20px; border-radius: 6px; color: var(--paper-ink); max-height: 86svh; overflow: auto;
  background: repeating-linear-gradient(0deg, rgba(120,90,40,.05) 0 1px, transparent 1px 28px), var(--paper);
  box-shadow: 0 20px 40px rgba(0,0,0,.6); }
.paper h2 { font-family: "Limelight", serif; font-weight: 400; margin: 0 28px 10px 0; font-size: 22px; }
.paper p { font-size: 17px; line-height: 1.45; }
.hint { color: #6d5a40; font-style: italic; }
.paper label { display: block; margin: 12px 0; font-weight: 700; }
.paper input:not([type]), .paper select { display: block; width: 100%; margin-top: 4px; padding: 10px; font: 17px "Cormorant Garamond", serif; border-radius: 4px; border: 1px solid #b9a37a; background: #fffaf0; color: var(--paper-ink); }
.paper .act { color: var(--paper-ink); background: transparent; border-color: #9c8150; }
.paper .act.primary { background: #3a250f; color: var(--paper); border-color: #3a250f; }
.row { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0; }
.paper audio { width: 100%; margin-top: 6px; }
.close { position: absolute; top: 8px; right: 10px; width: 36px; height: 36px; border: 0; background: none; font-size: 26px; color: var(--paper-ink); cursor: pointer; }
fieldset { border: 1px solid #c9b48a; border-radius: 4px; margin: 10px 0; padding: 8px 10px; }
legend { font-weight: 700; padding: 0 4px; }
fieldset label { display: flex; gap: 8px; align-items: center; margin: 6px 0; font-weight: 500; }
.schedule { list-style: none; margin: 0; padding: 0; font-size: 16px; }
.schedule li { display: grid; grid-template-columns: 52px 1fr; gap: 8px; padding: 6px 0; border-bottom: 1px dotted #c9b48a; }
.schedule li.now { font-weight: 700; }
.schedule time { font-family: "Oswald", sans-serif; color: #7a6040; }

@media (max-width: 420px) {
  .knob { width: 54px; height: 54px; }
  .magic-eye { width: 70px; height: 70px; }
  .dial-glass { height: 84px; }
  .city { font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- piano-key presets ---------- */
.presets { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 4px; margin-top: 12px; padding: 6px; border-radius: 8px;
  background: linear-gradient(180deg, #1a0e06, #2a170b); box-shadow: inset 0 2px 6px rgba(0,0,0,.6); }
.preset { position: relative; min-width: 0; height: 54px; border: 0; border-radius: 3px 3px 6px 6px; cursor: pointer; padding: 6px 2px 4px;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between; color: #4a3218;
  background: linear-gradient(180deg, #fbf3dc 0%, #efe2bf 70%, #d9c79b 100%);
  box-shadow: 0 5px 0 #a8946a, 0 6px 8px rgba(0,0,0,.45), inset 0 1px 0 #fff; transition: transform .08s, box-shadow .08s; }
.preset:hover { filter: brightness(1.04); }
.preset:active, .preset.down { transform: translateY(4px); box-shadow: 0 1px 0 #a8946a, 0 2px 3px rgba(0,0,0,.45), inset 0 2px 4px rgba(0,0,0,.18); }
.preset.down { background: linear-gradient(180deg, #f3e3b6 0%, #e3cf98 100%); }
.preset.down .pk-num { color: #b0261b; }
.preset:focus-visible { outline: 3px solid rgba(243,215,154,.6); outline-offset: 2px; }
.pk-num { font: 600 11px "Oswald", sans-serif; letter-spacing: .04em; }
.pk-name { font: italic 600 12px "Cormorant Garamond", serif; line-height: 1; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- name plate with seek buttons ---------- */
.plate { display: grid; grid-template-columns: 34px 1fr 34px; align-items: center; gap: 4px; padding: 8px 4px; }
.plate-text { min-width: 0; }
.seek { width: 34px; height: 44px; border: 0; background: none; color: #6b4a22; font-size: 16px; cursor: pointer; border-radius: 6px; }
.seek:hover { background: rgba(0,0,0,.06); }
.seek:active { transform: scale(.92); }

/* ---------- dial life ---------- */
.city { transition: color .3s, text-shadow .3s, opacity .3s; }
.city.lit { color: #ffd88a; text-shadow: 0 0 8px rgba(255,190,90, calc(var(--glow) * .9)); }
.needle { transition: box-shadow .3s; }
.knob.tune { cursor: grab; }
.knob.tune.grab { cursor: grabbing; box-shadow: 0 3px 6px rgba(0,0,0,.55), inset 0 2px 2px rgba(255,220,170,.25), inset 0 -3px 6px rgba(0,0,0,.6), 0 0 0 3px rgba(243,215,154,.25); }
.knob { width: 72px; height: 72px; }
@media (max-width: 420px) {
  .presets { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .preset { height: 48px; }
  .knob { width: 62px; height: 62px; }
}

/* ---------- phone layout ---------- */
@media (max-width: 480px) {
  .city { opacity: 0; font-size: 12px; }
  .city.lit { opacity: 1; }
  .controls { grid-template-columns: 1fr 1fr; grid-template-areas: "vol tune" "plate plate"; row-gap: 12px; }
  .controls > .knob-wrap:first-child { grid-area: vol; }
  .controls > .knob-wrap:last-child { grid-area: tune; }
  .plate { grid-area: plate; }
  .plate-station { white-space: normal; }
}
