:root {
  --night: #120c08;
  --wall: #1f1712;
  --wood: #5a3519;
  --wood-hi: #84522a;
  --wood-lo: #2e1a0b;
  --bakelite: #2a1c13;
  --brass: #c9a24a;
  --brass-lo: #8a6a24;
  --amber: #ffb54a;
  --amber-dim: #8a5a1c;
  --glass: #f3d9a4;
  --eye: #5dff9a;
  --paper: #f4ecd8;
  --paper-line: #c9d6e6;
  --ink: #2a2622;
  --pencil: #4a4a4a;
  --red: #c0392b;
  --label: 'Archivo Narrow', 'Arial Narrow', sans-serif;
  --type: 'Cutive Mono', 'Courier New', monospace;
  --hand: 'Reenie Beanie', 'Bradley Hand', cursive;
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overflow-x: clip;
}

body {
  margin: 0;
  min-height: 100dvh;
  color: var(--paper);
  font-family: var(--label);
  font-size: 17px;
  /* A kitchen at night: a warm lamp somewhere above the set */
  background:
    radial-gradient(ellipse 70% 50% at 50% 12%, rgba(255, 181, 74, 0.16), transparent 70%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.018) 0 1px, transparent 1px 46px),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.018) 0 1px, transparent 1px 46px),
    linear-gradient(var(--wall), var(--night));
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: 8px;
  top: -60px;
  z-index: 50;
  padding: 8px 12px;
  background: var(--paper);
  color: #111;
  font-weight: 700;
}
.skip-link:focus { top: 8px; }

:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 3px;
}

main {
  max-width: 1040px;
  margin: 0 auto;
  padding: 34px 16px 40px;
}

/* ---------- the set ---------- */

.set { position: relative; }

.counter {
  position: absolute;
  right: 60px;
  top: -24px;
  z-index: 2;
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 5px 12px 6px;
  border-radius: 4px;
  background: #151515;
  box-shadow: 0 0 0 2px #3a3a3a, 0 4px 8px rgba(0, 0, 0, 0.6);
}
.counter-digits {
  font-family: var(--type);
  font-size: 22px;
  letter-spacing: 0.08em;
  color: #ff8a3a;
  text-shadow: 0 0 6px rgba(255, 110, 40, 0.8);
  font-variant-numeric: tabular-nums;
}
.counter-unit { font-size: 12px; color: #aa7a55; }

.cabinet {
  padding: 22px 22px 26px;
  border-radius: 26px 26px 14px 14px;
  background:
    repeating-linear-gradient(92deg, rgba(0, 0, 0, 0.08) 0 2px, transparent 2px 11px),
    linear-gradient(175deg, var(--wood-hi), var(--wood) 45%, var(--wood-lo));
  box-shadow:
    inset 0 2px 0 rgba(255, 220, 170, 0.25),
    inset 0 -6px 12px rgba(0, 0, 0, 0.45),
    0 24px 50px rgba(0, 0, 0, 0.7);
}

.dial-window {
  position: relative;
  height: 150px;
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(180deg, #e9cf98, var(--glass) 40%, #e3c58c);
  box-shadow: inset 0 0 0 5px var(--brass-lo), inset 0 0 0 7px var(--brass), inset 0 6px 18px rgba(0, 0, 0, 0.45);
  cursor: ew-resize;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  filter: brightness(0.45) saturate(0.6);
  transition: filter 1.8s ease;
}
.on .dial-window { filter: none; }
.brand {
  position: absolute;
  left: 0;
  right: 0;
  top: 10px;
  margin: 0;
  text-align: center;
  font-family: var(--label);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.5em;
  text-transform: uppercase;
  color: #6b4a1e;
  pointer-events: none;
}
.dial {
  position: absolute;
  left: 18px;
  right: 18px;
  top: 30px;
  width: calc(100% - 36px);
  height: 108px;
}
.dial text { font-family: var(--label); fill: #3b2a14; }
.dial .mhz { font-size: 15px; font-weight: 700; }
.dial .band { font-size: 10px; fill: #7a5426; letter-spacing: 0.08em; }
.dial .pencil-mark { font-family: var(--hand); font-size: 22px; fill: #555; }
.needle {
  position: absolute;
  top: 26px;
  bottom: 10px;
  width: 3px;
  margin-left: -1.5px;
  border-radius: 2px;
  background: var(--red);
  box-shadow: 0 0 4px rgba(192, 57, 43, 0.6);
  pointer-events: none;
}
.dial-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 120%, rgba(255, 181, 74, 0.55), transparent 65%);
  opacity: 0;
  transition: opacity 2s ease;
}
.on .dial-glow { opacity: 1; }

.panel {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: 22px;
  margin-top: 20px;
}

.grille {
  position: relative;
  min-height: 190px;
  border-radius: 12px;
  background:
    repeating-linear-gradient(45deg, rgba(0, 0, 0, 0.18) 0 2px, transparent 2px 5px),
    repeating-linear-gradient(-45deg, rgba(0, 0, 0, 0.18) 0 2px, transparent 2px 5px),
    #8c7a5c;
  box-shadow: inset 0 0 0 4px var(--wood-lo), inset 0 0 26px rgba(0, 0, 0, 0.6);
}
.badge {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  padding: 6px 14px 5px;
  border-radius: 4px;
  background: linear-gradient(170deg, #f1d892, var(--brass) 60%, var(--brass-lo));
  box-shadow: inset 0 0 0 1px rgba(60, 40, 10, 0.5), 0 2px 4px rgba(0, 0, 0, 0.5);
  color: #2e2008;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
}
.badge span { font-weight: 700; }
.badge:hover { text-decoration: underline; }

.controls {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
}
.meters {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
}
.smeter {
  position: relative;
  width: 150px;
  padding: 6px 8px 2px;
  border-radius: 8px;
  background: linear-gradient(#efe0b8, #d8c08a);
  box-shadow: inset 0 0 0 3px var(--brass-lo), inset 0 3px 8px rgba(0, 0, 0, 0.35);
  text-align: center;
  filter: brightness(0.45);
  transition: filter 1.8s;
}
.on .smeter { filter: none; }
.smeter svg { display: block; width: 100%; }
.smeter .arc { fill: none; stroke: #3b2a14; stroke-width: 1.5; }
.smeter #sticks line { stroke: #3b2a14; stroke-width: 1.2; }
.smeter #sneedle { stroke: var(--red); stroke-width: 2; stroke-linecap: round; transform-origin: 60px 64px; }
.smeter span { display: block; margin-top: -4px; font-size: 11px; letter-spacing: 0.2em; color: #5b3f17; text-transform: uppercase; }

/* The magic eye: a green fan that closes as the signal comes in */
.eye {
  --open: 120deg;
  position: relative;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: #0d1a10;
  box-shadow: 0 0 0 5px var(--brass-lo), 0 0 0 7px #1a1208, inset 0 0 10px #000;
}
.eye::before {
  content: '';
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: conic-gradient(from calc(180deg + var(--open) / 2), var(--eye) 0, var(--eye) calc(360deg - var(--open)), transparent 0);
  opacity: 0;
  filter: drop-shadow(0 0 6px var(--eye));
  transition: opacity 2.2s ease;
}
.on .eye::before { opacity: 0.85; }
.eye-cap {
  position: absolute;
  inset: 24px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #444, #111);
}

.knobs {
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  gap: 10px;
}
.ctl {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.ctl-label {
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #f0d9b0;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.6);
}
.knob {
  --turn: 0deg;
  position: relative;
  border-radius: 50%;
  background:
    repeating-conic-gradient(from 0deg, rgba(255, 255, 255, 0.06) 0 6deg, transparent 6deg 12deg),
    radial-gradient(circle at 35% 30%, #5a4130, var(--bakelite) 55%, #120b06);
  box-shadow: 0 6px 10px rgba(0, 0, 0, 0.6), inset 0 0 0 3px rgba(0, 0, 0, 0.35);
  transform: rotate(var(--turn));
  cursor: grab;
  touch-action: none;
}
.knob:active { cursor: grabbing; }
.knob.big { width: 110px; height: 110px; }
.knob.small { width: 64px; height: 64px; }
.knob-mark {
  position: absolute;
  left: 50%;
  top: 7%;
  width: 4px;
  height: 22%;
  margin-left: -2px;
  border-radius: 2px;
  background: #e8d3a6;
}
.knob:focus-visible { outline-offset: 6px; }

.power, .toggle {
  position: relative;
  width: 52px;
  height: 52px;
  border: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #5a4130, var(--bakelite) 60%, #120b06);
  box-shadow: 0 5px 8px rgba(0, 0, 0, 0.6);
  cursor: pointer;
}
.lamp {
  position: absolute;
  inset: 16px;
  border-radius: 50%;
  background: #3b1a12;
  transition: background 0.4s, box-shadow 0.4s;
}
.power[aria-pressed='true'] .lamp { background: #ff6a3a; box-shadow: 0 0 12px #ff6a3a; }
.toggle-bat {
  position: absolute;
  left: 50%;
  top: 8px;
  width: 8px;
  height: 22px;
  margin-left: -4px;
  border-radius: 4px;
  background: linear-gradient(90deg, #888, #eee, #888);
  transform-origin: 50% 100%;
  transform: translateY(8px) rotate(-30deg);
  transition: transform 0.15s;
}
.toggle[aria-pressed='true'] .toggle-bat { transform: translateY(8px) rotate(30deg); }

.status {
  margin: 14px 0 0;
  min-height: 1.4em;
  text-align: center;
  font-size: 16px;
  color: #d9c19a;
}

/* ---------- the table ---------- */

.desk {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  margin-top: 30px;
}
.desk h2 {
  margin: 0;
  font-family: var(--hand);
  font-weight: 400;
  font-size: 32px;
  line-height: 1;
  color: var(--ink);
}
.pencil, .notes, .worksheet, .logbook {
  padding: 16px 18px 18px;
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.5);
}
.pencil {
  grid-column: 1 / -1;
  background:
    repeating-linear-gradient(transparent 0 27px, var(--paper-line) 27px 28px),
    var(--paper);
}
.pencil-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.heard {
  margin: 6px 0 0;
  min-height: 56px;
  max-height: 112px;
  overflow: hidden;
  font-family: var(--hand);
  font-size: 28px;
  line-height: 28px;
  color: var(--pencil);
  word-spacing: 0.3em;
  overflow-wrap: anywhere;
}
.small-btn {
  padding: 6px 12px;
  border: 2px solid var(--ink);
  border-radius: 4px;
  background: var(--ink);
  color: var(--paper);
  font: 700 15px var(--label);
  cursor: pointer;
}
.small-btn.ghost { background: transparent; color: var(--ink); }
.small-btn:focus-visible { outline-color: var(--red); }

.notes {
  position: relative;
  transform: rotate(-0.6deg);
  background: #f6efdc;
}
.notes::before, .notes::after {
  /* tape */
  content: '';
  position: absolute;
  top: -10px;
  width: 80px;
  height: 22px;
  background: rgba(240, 225, 170, 0.75);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}
.notes::before { left: 20px; transform: rotate(-4deg); }
.notes::after { right: 24px; transform: rotate(5deg); }
.notes-list {
  margin: 10px 0 12px;
  padding-left: 18px;
  font-family: var(--hand);
  font-size: 24px;
  line-height: 1.05;
}
.notes-list li { margin-bottom: 6px; }
.board {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--type);
  font-size: 15px;
  text-align: center;
}
.board th, .board td { padding: 3px 2px; border: 1px solid #b9ab8a; }
.board thead th { color: var(--red); }
.board tbody th { color: var(--red); width: 2em; }
.board td.nil { background: #e4d8bb; }
.pad {
  margin-top: 14px;
  padding: 10px 12px;
  background: #fffaf0;
  box-shadow: inset 0 0 0 1px #d8c9a6;
}
.pad-title { margin: 0 0 4px; font-family: var(--type); font-weight: 700; }
.pad-digits {
  margin: 0;
  font-family: var(--type);
  font-size: 15px;
  line-height: 1.6;
  word-spacing: 0.35em;
}

.worksheet label {
  display: block;
  margin: 10px 0 4px;
  font-weight: 700;
  font-size: 15px;
}
.worksheet textarea {
  width: 100%;
  padding: 8px;
  border: 1px solid #b9ab8a;
  border-radius: 3px;
  background: #fffdf6;
  color: var(--ink);
  font: 15px/1.5 var(--type);
  resize: vertical;
}
.w-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.w-out { margin-top: 12px; font-family: var(--type); font-size: 15px; line-height: 1.5; }
.w-out p { margin: 0 0 6px; }
.w-out .plain {
  font-family: var(--hand);
  font-size: 28px;
  line-height: 1.05;
  color: #1d3a8a;
}

.logbook { grid-column: 1 / -1; }
.log {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  font-family: var(--type);
  font-size: 15px;
}
.log li {
  padding: 8px 0;
  border-bottom: 1px dashed #b9ab8a;
}
.log li.empty { color: #5a5042; }
.log .when { font-weight: 700; }
.log .copy { display: block; margin: 4px 0; word-spacing: 0.3em; overflow-wrap: anywhere; }
.log .entry-actions { display: flex; gap: 8px; }
.log .entry-actions button {
  padding: 2px 8px;
  border: 1px solid var(--ink);
  border-radius: 3px;
  background: transparent;
  color: var(--ink);
  font: 600 14px var(--label);
  cursor: pointer;
}

.unplug {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px 8px 10px;
  border-radius: 999px;
  background: rgba(18, 12, 8, 0.85);
  box-shadow: 0 0 0 2px #6b5233;
  color: var(--paper);
  font-weight: 700;
  text-decoration: none;
}
.plug {
  width: 18px;
  height: 12px;
  border-radius: 3px;
  background: #222;
  box-shadow: 6px -3px 0 -4px #ccc, 6px 3px 0 -4px #ccc;
}

.noscript { text-align: center; padding: 40px; }

@media (max-width: 760px) {
  main { padding: 30px 10px 80px; }
  .cabinet { padding: 14px 12px 16px; border-radius: 18px 18px 10px 10px; }
  .counter { right: 24px; }
  .dial-window { height: 150px; }
  .panel { grid-template-columns: 1fr; gap: 14px; }
  .grille { min-height: 70px; order: 2; }
  .knobs { flex-wrap: wrap; justify-content: center; gap: 14px 18px; }
  .knob.big { width: 96px; height: 96px; }
  .desk { grid-template-columns: 1fr; }
  .heard { font-size: 24px; line-height: 28px; }
}

/* The share card */
.card main { padding-top: 44px; max-width: 1060px; }
.card .desk, .card .unplug, .card .status { display: none; }
.card .dial-window, .card .dial-glow, .card .smeter, .card .eye::before { transition: none; }

@media (prefers-reduced-motion: reduce) {
  .dial-window, .dial-glow, .smeter, .eye::before { transition: none; }
}
