:root {
  color-scheme: light;
  --paper: #eee7d6;
  --ink: #344237;
  --muted: #8c8b79;
  --line: #c7c4b1;
  --accent: #bb6044;
  --wheel: min(25dvh, calc(100vw - 164px), 208px);
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; }
body {
  position: fixed; inset: 0;
  background: radial-gradient(ellipse at 45% 20%, #f7f2e5, transparent 65%), repeating-linear-gradient(0deg, #b4aa8b08 0 1px, transparent 1px 4px), var(--paper);
  color: var(--ink); -webkit-font-smoothing: antialiased;
  -webkit-user-select: none; user-select: none; touch-action: none;
}
button, input, select { font: inherit; color: inherit; touch-action: manipulation; }
button { border: 0; padding: 0; cursor: pointer; }
button:disabled, input:disabled { opacity: .45; cursor: default; }
button:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 5px; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.receiver {
  width: 100%; max-width: 560px; height: 100%; height: 100dvh; margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) max(25px, env(safe-area-inset-right)) max(22px, env(safe-area-inset-bottom)) max(25px, env(safe-area-inset-left));
  display: grid; grid-template-rows: 44px minmax(0, 1fr) minmax(0, 1.16fr) 70px; gap: 12px;
}
.app-header { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.wordmark { font-size: 18px; font-weight: 600; letter-spacing: 3px; }
.wordmark span { display: block; font: 7px ui-monospace, monospace; letter-spacing: 2.6px; color: var(--muted); margin-top: 5px; }
.city-picker { position: relative; display: flex; align-items: center; justify-content: flex-end; min-height: 44px; min-width: 84px; gap: 6px; font-size: 14px; }
.city-picker svg { width: 14px; height: 14px; color: #8b8068; }
.chevron { font-size: 15px; color: var(--muted); margin-left: 3px; }
.city-picker select { position: absolute; inset: 0; width: 100%; opacity: 0; font-size: 16px; cursor: pointer; }
.city-picker:has(select:focus-visible) { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }
.readout { min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding-top: 8px; }
.readout > * { flex-shrink: 0; }
.status-line { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 18px; font-size: 11px; letter-spacing: 1px; color: var(--muted); }
.status-line i { width: 5px; height: 5px; border-radius: 50%; background: #b0ab97; }
.playing .status-line i { background: #637b50; box-shadow: 0 0 6px #70965760; }
.has-error .status-line { color: #a4583e; }
.has-error .status-line i { background: #b46447; }
.frequency { display: flex; flex-direction: column; align-items: center; margin-top: 12px; }
#frequencyValue { font: 300 clamp(54px, 9dvh, 88px)/1 ui-monospace, "SFMono-Regular", monospace; letter-spacing: -4px; font-variant-numeric: tabular-nums; color: #354a3b; }
.frequency-unit { margin-top: 10px; font: 9px ui-monospace, monospace; letter-spacing: 2.6px; color: #92917c; }
h1 { width: 100%; margin: 20px 0 0; font-size: 21px; font-weight: 500; letter-spacing: 1px; line-height: 1.4; text-align: center; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.station-meta { max-width: 100%; margin: 8px 0 0; min-height: 17px; font-size: 11px; line-height: 1.5; text-align: center; color: #97927e; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.frequency-scale { position: relative; width: 100%; max-width: 352px; height: 53px; margin-top: 26px; }
.scale-numbers { display: flex; justify-content: space-between; font: 9px ui-monospace, monospace; color: #9b917b; padding: 0 1px; }
.scale-ticks { height: 25px; margin-top: 8px; border-top: 1px solid #b5ad9666; background: repeating-linear-gradient(90deg, #ac9f8177 0 1px, transparent 1px 6px); mask-image: linear-gradient(#000 0 35%, #0004 35% 100%); }
.dial-needle { position: absolute; top: -5px; bottom: 6px; width: 2px; left: 9%; background: var(--accent); box-shadow: 0 0 4px #a7542830; transition: left .12s; }
.dial-needle:after { content: ""; position: absolute; top: -1px; left: -2px; width: 6px; height: 3px; background: var(--accent); border-radius: 1px; }
.tuning-section { min-height: 0; display: flex; flex-direction: column; justify-content: center; align-items: center; }
.tuning-controls { display: grid; grid-template-columns: 48px var(--wheel) 48px; align-items: center; gap: 14px; }
.channel-key { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; color: #8a8a72; border: 1px solid #c7c1aa; background: #e8e2cf70; box-shadow: inset 0 1px #fff6, 0 2px 2px #a0937820; }
.channel-key svg { width: 19px; height: 19px; }
.channel-key:active { transform: translateY(2px); box-shadow: inset 0 1px 3px #7d755b20; }
.next-key svg { transform: rotate(180deg); }
.tuning-wheel { position: relative; width: var(--wheel); height: var(--wheel); border-radius: 50%; touch-action: none; }
.wheel-ticks { position: absolute; inset: -8px; border-radius: 50%; background: repeating-conic-gradient(from -135deg, #9f957773 0 1deg, transparent 1deg 15deg); mask-image: radial-gradient(circle, transparent 67%, #000 68%); }
.wheel-ticks:after { content: ""; position: absolute; bottom: 0; left: 18%; right: 18%; height: 22%; background: var(--paper); }
.knob { position: absolute; inset: 5px; border-radius: 50%; background: repeating-conic-gradient(from 0deg, transparent 0 3deg, #75674b17 3deg 4deg), conic-gradient(from 20deg, #ece5d1, #c6bba0 55deg, #f6efda 100deg, #c4b99e 150deg, #ebe3cd 220deg, #f1e9d5 270deg, #c4b799 310deg, #ece5d1); box-shadow: 0 10px 17px #7565442a, 0 0 0 1px #c1b493, inset 0 0 0 5px #b9aa8838; }
.knob-center { position: absolute; inset: 14%; border-radius: 50%; background: linear-gradient(125deg, #eee6d1, #d4c9ad 58%, #e9e1ca); box-shadow: inset 1px 1px 2px #fffaeaaa, 0 0 0 1px #b8aa8650; }
#knobIndicator { position: absolute; left: calc(50% - 1px); top: 15%; width: 2px; height: 10%; border-radius: 2px; background: #687054; transform-origin: 1px calc(var(--wheel) * .35 - 3.5px); transform: rotate(-135deg); box-shadow: 0 1px #fff6; }
.tuning-wheel.turning .knob { box-shadow: 0 6px 10px #7565442f, 0 0 0 1px #b4a587, inset 0 0 0 5px #b9aa8840; }
#tuning { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: grab; touch-action: none; }
#tuning:active { cursor: grabbing; }
.tuning-wheel:has(input:focus-visible) { outline: 2px solid #a4603d88; outline-offset: 14px; }
.tuning-caption { display: flex; align-items: center; gap: 14px; margin-top: 22px; font-size: 13px; letter-spacing: 3px; color: #7a7e66; }
.tuning-caption output { font: 10px ui-monospace, monospace; letter-spacing: 1px; color: #a29880; }
#tuningHint { margin: 10px 0 0; font-size: 11px; color: #aaa08b; letter-spacing: .6px; }
.playback-controls { display: flex; align-items: center; justify-content: space-between; gap: 28px; border-top: 1px solid #c9c1ab77; padding-top: 13px; }
.volume-control { min-width: 0; flex: 1; }
.volume-control label { display: flex; align-items: center; gap: 6px; font-size: 10px; color: #989079; }
.volume-control label svg { width: 13px; height: 13px; }
.volume-control output { margin-left: auto; font: 10px ui-monospace, monospace; }
#volume { display: block; width: 100%; height: 34px; margin: 2px 0 0; padding: 0; appearance: none; -webkit-appearance: none; background: transparent; touch-action: none; }
#volume::-webkit-slider-runnable-track { height: 3px; border-radius: 3px; background: linear-gradient(90deg, #809071 var(--volume,75%), #d4cbb5 var(--volume,75%)); }
#volume::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; width: 21px; height: 21px; margin-top: -9px; border-radius: 50%; background: linear-gradient(135deg, #f2ead5, #d5c8a9); border: 1px solid #b8aa88; box-shadow: 0 2px 3px #79674830, inset 0 1px #fff8; }
#volume::-moz-range-track { height: 3px; border-radius: 3px; background: #d4cbb5; }
#volume::-moz-range-progress { height: 3px; background: #809071; }
#volume::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: #e6ddc4; border: 1px solid #b8aa88; }
#volume:focus-visible { outline: 1px solid #a4603d88; outline-offset: 2px; }
.power-key { min-width: 64px; height: 55px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; border-radius: 7px; color: #8f8b74; background: #e2dac360; border: 1px solid #c9c0a7; box-shadow: inset 0 1px #fff6, 0 2px 1px #b8ac8c55; }
.power-key svg { width: 21px; height: 21px; }
.power-key span { font-size: 9px; letter-spacing: 2px; }
.power-key.is-on { color: #586f46; background: #d9ddc9; box-shadow: inset 0 1px 4px #647a3620; transform: translateY(1px); }
@media (max-height: 780px) {
  .receiver { gap: 8px; padding-top: max(12px, env(safe-area-inset-top)); padding-bottom: max(14px, env(safe-area-inset-bottom)); grid-template-rows: 44px minmax(0,1fr) minmax(0,1.08fr) 65px; }
  h1 { font-size: 18px; margin-top: 12px; }
  .frequency { margin-top: 7px; }
  .frequency-unit { margin-top: 6px; }
  .frequency-scale { margin-top: 17px; height: 42px; }
  .scale-ticks { height: 20px; }
  .tuning-caption { margin-top: 16px; }
  #tuningHint { margin-top: 7px; font-size: 10px; }
}
@media (max-height: 600px) and (max-width: 599px) {
  .readout { padding-top: 0; }
  .status-line { min-height: 16px; font-size: 10px; }
  .frequency { margin-top: 4px; }
  #frequencyValue { font-size: 48px; }
  .frequency-unit { margin-top: 4px; font-size: 8px; }
  h1 { margin-top: 8px; font-size: 17px; line-height: 1.3; }
  .station-meta { margin-top: 5px; font-size: 10px; line-height: 1.4; min-height: 14px; }
  .frequency-scale { margin-top: 12px; height: 35px; }
  .scale-ticks { height: 18px; }
}
@media (max-height: 530px) and (min-width: 600px) {
  :root { --wheel: min(41dvh, 180px); }
  .receiver { max-width: 1000px; grid-template-columns: minmax(0,1fr) minmax(0,1fr); grid-template-rows: 40px minmax(0,1fr) 60px; gap: 8px 32px; }
  .app-header { grid-column: 1 / -1; }
  .readout { grid-column: 1; padding-top: 0; }
  .tuning-section { grid-column: 2; }
  .playback-controls { grid-column: 1 / -1; }
  .volume-control { max-width: 280px; }
  #tuningHint { display: none; }
  #frequencyValue { font-size: 56px; }
  .station-meta { margin-top: 5px; }
  h1 { margin-top: 10px; }
}
@media (max-width: 360px) {
  .receiver { padding-left: max(20px, env(safe-area-inset-left)); padding-right: max(20px, env(safe-area-inset-right)); }
  .tuning-controls { gap: 10px; }
  h1 { font-size: 18px; }
  .wordmark { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
