:root {
  color-scheme: dark;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  --ink: #18210f;
  --case: url("assets/receiver.webp");
  --glass: url("assets/glass.webp");
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100svh;
  display: grid;
  place-items: center;
  grid-template-columns: minmax(0, 1fr);
  padding: max(16px, env(safe-area-inset-top)) max(15px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(15px, env(safe-area-inset-left));
  background: radial-gradient(ellipse at 76% 16%, #343532 0%, #202120 50%, #141514 100%);
}
.receiver {
  position: relative;
  container-type: inline-size;
  width: min(100%, 450px);
  aspect-ratio: 360 / 444;
  border-radius: 4.7% / 4%;
  background: #2b2c29 var(--case) center / 100% 100% no-repeat;
  box-shadow: 0 3px 5px #0009, 0 22px 48px #0007;
  color: var(--ink);
  user-select: none;
  -webkit-user-select: none;
}
.screen {
  position: absolute;
  left: 7.972%; top: 8.184%; width: 84.057%; height: 38.765%;
  overflow: hidden;
  border-radius: 2% / 4%;
}
/* The transparent optical plate is registered to the same photograph as the case. */
.screen::after, .dial-glass {
  position: absolute; inset: 0; pointer-events: none;
  background-image: var(--glass);
  background-size: 100cqw 123.3333cqw; background-repeat: no-repeat;
}
.screen::after {
  content: ""; background-position: -7.972cqw -10.097cqw;
}
.screen-top, .reception, .calendar, .channel-readout, .signal { display: flex; }
.screen-top {
  position: absolute; inset: 8.5% 3.4% auto;
  align-items: center; justify-content: space-between; gap: 1cqi;
}
.reception { min-width: 0; align-items: center; gap: 1.6cqi; }
.calendar { flex: none; align-items: center; gap: 2.2cqi; }
.screen-main {
  position: absolute; inset: 27% 3.4% auto; height: 43%;
  display: grid; place-items: center;
}
#status { min-width: 0; font-size: clamp(16px, 4.9cqi, 22px); }
#date { font-size: clamp(15px, 4.7cqi, 21px); }
#station-name {
  min-width: 0; max-width: 95%;
  font-size: 9.9cqi;
}
.pixel-ink { display: block; height: 1em; width: auto; max-width: 100%; shape-rendering: crispEdges; }
.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}
.signal { flex: none; gap: .5cqi; height: 4cqi; align-items: end; opacity: .85; }
.signal i {
  width: 1.06cqi;
  height: calc(var(--level) * .78cqi);
  background: repeating-linear-gradient(to top, currentColor 0 .55cqi, transparent .55cqi .78cqi);
  opacity: .17;
}
.signal i.on { opacity: 1; }
.signal i:nth-child(1) { --level: 1; } .signal i:nth-child(2) { --level: 2; }
.signal i:nth-child(3) { --level: 3; } .signal i:nth-child(4) { --level: 4; }
.signal i:nth-child(5) { --level: 5; }
.channel-readout {
  position: absolute; right: 3.4%; bottom: 6.5%;
  align-items: flex-end; gap: 1.2cqi;
}
.channel-readout small { flex: none; font-size: clamp(15px, 4.8cqi, 22px); }
#unit .pixel-ink { max-width: none; }
#station-display, #clock { display: block; flex: none; width: auto; shape-rendering: crispEdges; }
#station-display { height: clamp(22px, 6.96cqi, 32px); }
#clock { height: clamp(14px, 4.3cqi, 20px); }
.spectrum {
  position: absolute; left: 3.2%; bottom: 6.5%;
  width: 39%; height: 9%; display: block; image-rendering: pixelated;
}
.tuning-shell { position: absolute; left: 6.732%; width: 86.094%; top: 50.251%; height: 20.244%; }
.dial {
  position: absolute; inset: 0; overflow: hidden; touch-action: none;
  border-radius: 2% / 7%; cursor: grab; isolation: isolate;
  color: #30271b;
}
.dial.dragging { cursor: grabbing; }
.dial-bed {
  position: absolute; inset: 10.28% 2% 10.28%; overflow: hidden;
  border-radius: 1.6% / 6%;
}
.dial-track { position: absolute; left: 50%; top: 0; height: 100%; will-change: transform; }
.dial-track::before {
  content: ""; position: absolute; inset: 0 -100cqw; z-index: -1;
  background:
    linear-gradient(90deg, #ad81231c, #fffbef0f 26%, transparent 46%, #a4773210 64%, #fff6d718 79%, #99763a17),
    #eed8b0 url("assets/dial-paper.webp") repeat-x 0 center / 72cqw 100%;
}
.tuning-label {
  position: absolute; inset: 6% 3.3% auto; display: flex; justify-content: space-between;
  font-size: clamp(10px, 2.94cqi, 14px); pointer-events: none;
}
.tick {
  position: absolute; top: 32%; width: 1px; height: 10%;
  transform: translateX(-50%); background: currentColor;
}
.tick.major { height: 18%; }
.station-mark {
  position: absolute; top: 66%; width: 90px; transform: translateX(-50%);
  text-align: center; white-space: nowrap; font-size: clamp(13px, 4.05cqi, 19px);
  font-variant-numeric: tabular-nums; line-height: 1;
}
.station-mark::before {
  content: ""; position: absolute; top: -2.05cqi; left: 50%; transform: translateX(-50%);
  width: 1.2cqi; height: 1.2cqi; border-radius: 50%; background: currentColor;
}
.station-mark.failed { color: #817667; }
.needle {
  pointer-events: none; position: absolute; top: 0; left: 50%;
  width: 7.4074%; height: 100%; transform: translateX(-50%);
  background: url("assets/needle.webp") center / 100% 100% no-repeat;
}
.dial-glass { background-position: -6.732cqw -62.002cqw; }
.controls {
  position: absolute; left: 57.927%; top: 74.444%; width: 33.304%; height: 15.291%;
  border-radius: 10% / 18%; background: #0e0e0c;
}
.play-key {
  appearance: none; -webkit-appearance: none; -webkit-tap-highlight-color: transparent;
  border: 0; padding: 0; position: absolute; inset: 0; display: grid; place-items: center;
  border-radius: inherit; background: var(--case) -57.927cqw -91.851cqw / 100cqw 123.3333cqw no-repeat;
  color: #d4c8ac; cursor: pointer; touch-action: manipulation;
  transition: transform 120ms ease-out, filter 120ms ease-out, box-shadow 120ms ease-out;
}
.play-key:active, .play-key.pressed {
  transform: translateY(2px) scale(.982); filter: brightness(.88);
  box-shadow: inset -1px 2px 3px #0006;
  transition-duration: 55ms;
}
.play-shape {
  width: 5.6cqi; height: 6.3cqi; background: currentColor;
  clip-path: polygon(0 0,100% 50%,0 100%,0 0,15% 22%,15% 78%,71% 50%,15% 22%);
}
.is-playing .play-shape { width: 4.5cqi; height: 6.3cqi; clip-path: none; background: linear-gradient(90deg,currentColor 0 26%,transparent 26% 74%,currentColor 74%); }
button:focus-visible, [role=slider]:focus-visible { outline: 2px solid #ed994d; outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .play-key { transition: none; } }
