/* Let's Learn Morse Code: Blackout
   Everything that glows means something: a lit window is a finished day,
   amber is Grandpa, white is Zoya's torch, red is The Static and his gang,
   blue is the police. */

@font-face {
  font-family: "Big Shoulders Display";
  src: url("../fonts/big-shoulders-display-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("../fonts/atkinson-hyperlegible-next-latin-wght-normal.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("../fonts/atkinson-hyperlegible-next-latin-wght-italic.woff2") format("woff2");
  font-weight: 200 800;
  font-style: italic;
  font-display: swap;
}

:root {
  --sky-top: #0b1024;
  --sky: #0f1630;
  --sky-low: #16204a;
  --ground: #070a15;
  --tower: #121a33;
  --tower-top: #1a2448;
  --glass: #18213f;
  --glass-edge: #27325d;
  --line: #2d3968;
  --moon: #ece7da;
  --mist: #a9b1cc;
  --mist-dim: #737c9e;
  --amber: #ffb23e;
  --amber-hot: #ffe2a1;
  --amber-deep: #b5600c;
  --paper: #efe3c8;
  --ink: #2b2217;
  --ink-soft: #66543c;
  --static: #ff5b4d;
  --static-soft: #ff9b91;
  --phosphor: #7ff0b0;
  --torch: #fff4d2;
  --police: #5b9bff;
  --bakelite: #5a3423;

  --font-display: "Big Shoulders Display", "Arial Narrow", "Roboto Condensed", sans-serif;
  --font-body: "Atkinson Hyperlegible Next", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --gutter: clamp(20px, 4.5vw, 48px);
  --max: 1200px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--ground);
  color: var(--moon);
  font-family: var(--font-body);
  font-size: 1.125rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body.in-lesson {
  overflow: hidden;
}

h1,
h2,
h3,
p,
figure,
blockquote,
dl,
dd {
  margin: 0;
}

button,
input {
  font: inherit;
  color: inherit;
}

a {
  color: var(--amber-hot);
  text-underline-offset: 3px;
}

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

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -80px;
  z-index: 50;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--amber);
  color: #2a1505;
  font-weight: 700;
}
.skip-link:focus {
  top: 12px;
}

.icon {
  display: inline-flex;
}
.icon svg {
  width: 22px;
  height: 22px;
}

/* ---------- buttons ---------- */

.btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 24px;
  border-radius: 14px;
  font-weight: 700;
  font-size: 1.125rem;
  line-height: 1.1;
  text-decoration: none;
  transition: transform 0.08s var(--ease), box-shadow 0.08s var(--ease), background-color 0.2s, border-color 0.2s, opacity 0.2s;
  touch-action: manipulation;
}

/* Like a chunky radio push button: it really goes down. */
.btn-primary {
  color: #2a1505;
  background: linear-gradient(180deg, #ffd37e, var(--amber) 70%);
  box-shadow: 0 5px 0 var(--amber-deep), 0 14px 28px -10px rgba(255, 170, 50, 0.5);
}
.btn-primary:hover {
  background: linear-gradient(180deg, #ffdd98, #ffbb52 70%);
}
.btn-primary:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 var(--amber-deep), 0 6px 14px -8px rgba(255, 170, 50, 0.4);
}
.btn-big {
  min-height: 60px;
  padding: 0 32px;
  font-size: 1.25rem;
}
.btn-ghost {
  color: var(--moon);
  background: transparent;
  box-shadow: inset 0 0 0 2px var(--line);
}
.btn-ghost:hover {
  box-shadow: inset 0 0 0 2px var(--mist-dim);
}
.btn-small {
  min-height: 42px;
  padding: 0 16px;
  font-size: 1rem;
}
.btn[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.link-btn {
  background: none;
  border: 0;
  padding: 10px 6px;
  color: var(--mist);
  font-size: 1rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.link-btn:hover {
  color: var(--moon);
}

.icon-btn {
  width: 44px;
  height: 44px;
  flex: none;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(15, 22, 48, 0.6);
  cursor: pointer;
}
.icon-btn:hover {
  border-color: var(--mist-dim);
}

/* ---------- Morse shapes ---------- */

.shapes {
  display: inline-flex;
  align-items: center;
  gap: 0.34em;
}
.shapes .dit,
.shapes .dah {
  display: block;
  height: 0.46em;
  border-radius: 999px;
  background: currentColor;
}
.shapes .dit {
  width: 0.46em;
}
.shapes .dah {
  width: 1.38em;
}

/* ---------- top bar ---------- */

.topbar {
  position: absolute;
  inset: 0 0 auto 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: calc(var(--max) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 18px var(--gutter);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--moon);
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
}
.brand-lamp {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, var(--amber-hot), var(--amber) 55%, var(--amber-deep));
  box-shadow: 0 0 14px 2px rgba(255, 178, 62, 0.55);
}
.topbar-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}
.agent {
  margin-right: 6px;
  color: var(--mist);
  font-size: 0.95rem;
}

/* ---------- hero ---------- */

.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}
/* The street fades into the ground below */
.hero::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 140px;
  z-index: -1;
  background: linear-gradient(180deg, rgba(7, 10, 21, 0), var(--ground));
}
.sky {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(1.5px 1.5px at 8% 14%, rgba(255, 255, 255, 0.75), transparent 70%),
    radial-gradient(1px 1px at 19% 31%, rgba(255, 255, 255, 0.5), transparent 70%),
    radial-gradient(1.5px 1.5px at 33% 9%, rgba(255, 255, 255, 0.6), transparent 70%),
    radial-gradient(1px 1px at 46% 22%, rgba(255, 255, 255, 0.45), transparent 70%),
    radial-gradient(1.5px 1.5px at 57% 6%, rgba(255, 255, 255, 0.7), transparent 70%),
    radial-gradient(1px 1px at 66% 27%, rgba(255, 255, 255, 0.4), transparent 70%),
    radial-gradient(1.5px 1.5px at 78% 12%, rgba(255, 255, 255, 0.65), transparent 70%),
    radial-gradient(1px 1px at 89% 24%, rgba(255, 255, 255, 0.5), transparent 70%),
    radial-gradient(1px 1px at 94% 5%, rgba(255, 255, 255, 0.55), transparent 70%),
    radial-gradient(1px 1px at 27% 44%, rgba(255, 255, 255, 0.3), transparent 70%),
    radial-gradient(1px 1px at 72% 41%, rgba(255, 255, 255, 0.3), transparent 70%),
    radial-gradient(110% 55% at 72% 100%, var(--sky-low), transparent 70%),
    linear-gradient(180deg, var(--sky-top), var(--sky) 60%, #111a3c);
}
.hero-inner {
  max-width: calc(var(--max) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 128px var(--gutter) 0;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  gap: clamp(28px, 5vw, 80px);
  align-items: end;
}
.hero-copy {
  padding-bottom: 80px;
  max-width: 36rem;
}
.wordmark {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(4.4rem, 10.6vw, 10.4rem);
  line-height: 0.8;
  letter-spacing: 0.005em;
  text-transform: uppercase;
  margin-left: -0.03em;
}
.wordmark-code {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 22px 0 30px;
  color: var(--amber);
  font-size: 16px;
}
.wordmark-code .dit,
.wordmark-code .dah {
  opacity: 0.2;
  transition: opacity 0.12s, box-shadow 0.3s;
}
.wordmark-code .on {
  opacity: 1;
  box-shadow: 0 0 10px rgba(255, 178, 62, 0.65);
}
.subtitle {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.6rem, 2.6vw, 2.2rem);
  line-height: 1.05;
  color: var(--amber-hot);
  margin-bottom: 18px;
}
.lede {
  max-width: 33em;
}
.lede-quiet {
  margin-top: 12px;
  color: var(--mist);
}
.cta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 20px;
  margin-top: 32px;
}
.cta-note {
  color: var(--mist);
  font-size: 1rem;
}
.progress-line {
  margin-top: 18px;
  color: var(--mist);
  font-size: 1rem;
}

/* ---------- the city map: three towers, 21 windows ---------- */

.city-map {
  position: relative;
  padding-top: 56px;
}
.towers {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(10px, 2vw, 24px);
  align-items: end;
}
.tower {
  position: relative;
  padding: clamp(10px, 1.3vw, 16px) clamp(9px, 1.2vw, 15px) 0;
  border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, var(--tower-top), var(--tower) 22%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.tower-1::before {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 18%;
  width: 26%;
  height: 34px;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(90deg, #17203f, #1d2850);
  box-shadow: 0 -6px 0 -2px #17203f;
}
.tower-2 {
  padding-bottom: 28px;
}
.tower-2::before {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 14%;
  right: 14%;
  height: 22px;
  border-radius: 3px 3px 0 0;
  background: var(--tower-top);
}
.tower-2::after {
  content: "";
  position: absolute;
  bottom: calc(100% + 22px);
  left: 32%;
  right: 32%;
  height: 16px;
  border-radius: 3px 3px 0 0;
  background: var(--tower-top);
}
.tower-3 {
  padding-bottom: 12px;
}
.tower-3::before {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 62%;
  width: 3px;
  height: 52px;
  background: #24305c;
}
.tower-3::after {
  content: "";
  position: absolute;
  bottom: calc(100% + 30px);
  left: calc(62% - 10px);
  width: 23px;
  height: 3px;
  background: #24305c;
  box-shadow: 0 12px 0 #24305c;
}
.tower-sign {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1rem, 1.7vw, 1.3rem);
  line-height: 1;
  text-align: center;
  color: var(--mist);
  padding: 2px 2px 12px;
}
.tower-act {
  display: block;
  margin-bottom: 3px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.75rem;
  color: var(--mist-dim);
}
.floors {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column-reverse;
  gap: clamp(7px, 1vw, 11px);
}
.win {
  position: relative;
  isolation: isolate;
  width: 100%;
  aspect-ratio: 1.6;
  padding: 0;
  display: grid;
  place-content: center;
  gap: 2px;
  text-align: center;
  border: 1px solid var(--glass-edge);
  border-radius: 3px;
  background: linear-gradient(155deg, #212b4f, var(--glass) 48%, #141b36);
  color: var(--mist-dim);
  overflow: hidden;
  cursor: default;
  transition: color 0.25s, border-color 0.25s, box-shadow 0.4s;
}
.win::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(120% 120% at 50% 15%, #fff1c6, #ffc45c 45%, #e3871a);
  opacity: 0;
  transition: opacity 0.25s;
}
.win.is-lit,
.win.flash-on {
  color: #3a1f06;
  border-color: #ffcf7a;
}
.win.is-lit::before,
.win.flash-on::before {
  opacity: 1;
}
.win.is-lit {
  box-shadow: 0 0 22px -2px rgba(255, 180, 70, 0.5);
  cursor: pointer;
}
.win.is-next {
  color: var(--moon);
  border-color: var(--amber);
  cursor: pointer;
}
.win.is-next::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(55% 75% at 28% 72%, rgba(255, 214, 140, 0.42), transparent 72%);
  animation: torch 3.4s ease-in-out infinite;
}
.win.is-next.flash-on::after {
  opacity: 0;
}
.win.is-soon {
  cursor: not-allowed;
}
.win:not(.is-soon):hover {
  border-color: var(--amber-hot);
}
.win.just-lit {
  animation: just-lit 1.2s var(--ease) 2;
}
.win-num {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.35rem, 2.3vw, 1.95rem);
  line-height: 0.9;
}
.win-sub {
  font-size: clamp(0.66rem, 0.95vw, 0.8rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0.02em;
}
.win-stars {
  letter-spacing: 1px;
}
.street {
  height: 16px;
  margin: 0 -40px;
  background: linear-gradient(180deg, #0c1122, var(--ground));
}
.city-caption {
  padding: 14px 0 28px;
  text-align: center;
  color: var(--mist);
  font-size: 0.95rem;
}

@keyframes torch {
  0%,
  100% {
    opacity: 0.55;
    transform: translateX(0);
  }
  35% {
    opacity: 1;
    transform: translateX(14%);
  }
  60% {
    opacity: 0.7;
    transform: translateX(6%);
  }
}
@keyframes just-lit {
  0%,
  100% {
    box-shadow: 0 0 22px -2px rgba(255, 180, 70, 0.5);
  }
  50% {
    box-shadow: 0 0 46px 8px rgba(255, 190, 90, 0.85);
  }
}

/* ---------- Grandpa's codebook: paper under torchlight ---------- */

.codebook-wrap {
  max-width: calc(var(--max) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 72px var(--gutter) 16px;
}
.codebook {
  position: relative;
  color: var(--ink);
  padding: clamp(24px, 4vw, 48px) clamp(22px, 4vw, 48px) clamp(26px, 4vw, 48px) clamp(30px, 5vw, 60px);
  border-radius: 4px 16px 16px 4px;
  background:
    radial-gradient(80% 110% at 28% 0%, rgba(255, 252, 240, 0.55), transparent 62%),
    repeating-linear-gradient(180deg, transparent 0 33px, rgba(78, 106, 160, 0.16) 33px 34px),
    var(--paper);
  box-shadow: inset 8px 0 0 #cbb68c, inset 10px 0 0 #b9a174, 0 32px 60px -24px rgba(0, 0, 0, 0.75);
}
.codebook h2 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.1rem, 4.5vw, 3.2rem);
  line-height: 1;
}
.codebook .note {
  margin: 10px 0 26px;
  font-style: italic;
  color: var(--ink-soft);
}
.cb-group {
  margin: 28px 0 12px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.5rem;
  line-height: 1;
}
.codebook-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
  gap: 10px;
}
.cb-cell {
  min-height: 92px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 10px;
  border: 1.5px dashed rgba(43, 34, 23, 0.22);
  color: rgba(43, 34, 23, 0.32);
}
.cb-cell.is-known {
  border: 0;
  padding: 0;
}
.cb-play {
  width: 100%;
  height: 100%;
  min-height: 92px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 10px;
  border: 1.5px solid rgba(43, 34, 23, 0.55);
  background: rgba(255, 255, 255, 0.4);
  color: var(--ink);
  cursor: pointer;
}
.cb-play:hover {
  background: rgba(255, 255, 255, 0.65);
}
.cb-play:focus-visible {
  outline-color: var(--ink);
}
.cb-letter {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 2.1rem;
  line-height: 1;
}
.cb-play .shapes {
  font-size: 12px;
}
.cb-blank {
  width: 34px;
  height: 0;
  border-top: 2px dotted rgba(43, 34, 23, 0.25);
}
/* Numbers and punctuation have five or six beeps, so their boxes are wider. */
#codebook-digits,
#codebook-extra {
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
}
#codebook-digits .cb-play .shapes,
#codebook-extra .cb-play .shapes {
  font-size: 10px;
}

/* ---------- leaderboard ---------- */

.leaderboard {
  max-width: calc(var(--max) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 56px var(--gutter) 8px;
}
.leaderboard h2 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.1rem, 4.5vw, 3.2rem);
  line-height: 1;
  margin-bottom: 20px;
}
.lb-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: 720px;
  border-top: 1px solid var(--line);
}
.lb-list li {
  display: grid;
  grid-template-columns: 2.4em minmax(0, 1fr) auto auto;
  gap: 16px;
  align-items: baseline;
  padding: 12px 4px;
  border-bottom: 1px solid var(--line);
}
.lb-list li.is-me {
  color: var(--amber-hot);
}
.lb-rank {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.4rem;
  color: var(--mist);
}
.lb-name {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lb-you {
  font-weight: 400;
  color: var(--mist);
}
.lb-days {
  color: var(--mist);
  font-size: 0.95rem;
}
.lb-pts {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}
.leaderboard .note {
  margin-top: 14px;
  color: var(--mist);
}

/* ---------- how it works ---------- */

.how {
  max-width: calc(var(--max) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 64px var(--gutter) 48px;
}
.how h2 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.1rem, 4.5vw, 3.2rem);
  line-height: 1;
  margin-bottom: 28px;
}
.how-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 28px 44px;
}
.how-item h3 {
  margin-bottom: 8px;
  font-size: 1.2rem;
  color: var(--amber-hot);
}
.how-item p {
  color: var(--mist);
  max-width: 30em;
}

.site-footer {
  max-width: calc(var(--max) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 28px var(--gutter) 48px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  border-top: 1px solid var(--line);
  color: var(--mist);
  font-size: 0.95rem;
}

.noscript {
  max-width: 40em;
  margin: 24px auto;
  padding: 16px var(--gutter);
  color: var(--amber-hot);
}

/* ---------- lesson ---------- */

.lesson {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: radial-gradient(70% 45% at 50% 22%, rgba(255, 170, 60, 0.08), transparent 70%), linear-gradient(180deg, #0a0e1f, var(--ground));
}
.lesson-bar {
  position: sticky;
  top: 0;
  z-index: 3;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 10px var(--gutter);
  background: rgba(7, 10, 21, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(45, 57, 104, 0.6);
}
.lesson-mid {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}
.lesson-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.3rem;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lesson-progress {
  height: 6px;
  border-radius: 999px;
  background: #19213f;
  overflow: hidden;
}
.lesson-progress > span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--amber);
  transition: width 0.45s var(--ease);
}
.lesson-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}
.points {
  position: relative;
  margin-right: 4px;
  font-weight: 800;
  color: var(--amber-hot);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.points-unit {
  font-weight: 600;
  color: var(--mist);
  font-size: 0.9rem;
}
.points-pop {
  position: absolute;
  right: 0;
  bottom: 100%;
  color: var(--phosphor);
  font-weight: 800;
  pointer-events: none;
  animation: pop 0.95s var(--ease) forwards;
}
@keyframes pop {
  from {
    transform: translateY(14px);
    opacity: 1;
  }
  to {
    transform: translateY(-6px);
    opacity: 0;
  }
}

.stage {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: clamp(20px, 4vh, 40px) var(--gutter) 72px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  outline: none;
}
.step-head {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.step-title {
  font-family: var(--font-display);
  font-weight: 850;
  font-size: clamp(2.5rem, 7vw, 3.9rem);
  line-height: 0.92;
}
.step-intro {
  color: var(--mist);
  max-width: 34em;
}
.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 14px;
}
/* Game steps centre their buttons under the instrument; reading steps keep them left. */
.stage[data-step="drill"] .controls,
.stage[data-step="decode"] .controls,
.stage[data-step="choice"] .controls,
.stage[data-step="tune"] .controls {
  justify-content: center;
}
.stage[data-step="drill"] .radio,
.stage[data-step="decode"] .radio,
.stage[data-step="choice"] .radio,
.stage[data-step="reply"] .radio,
.stage[data-step="learnSet"] .radio {
  width: min(100%, 380px);
}
.stage[data-step="learn"] .radio,
.stage[data-step="tune"] .radio {
  width: min(100%, 440px);
}
/* Game screens keep the keys in view on a laptop: a smaller title and picture. */
.stage[data-step="drill"],
.stage[data-step="decode"],
.stage[data-step="choice"],
.stage[data-step="reply"] {
  gap: 16px;
}
.stage[data-step="drill"] .step-title,
.stage[data-step="decode"] .step-title,
.stage[data-step="choice"] .step-title,
.stage[data-step="reply"] .step-title,
.stage[data-step="tune"] .step-title {
  font-size: clamp(2.1rem, 5.4vw, 3rem);
}
.stage .step-scene {
  width: min(100%, 460px);
  margin: 0 auto;
}
.type-hint {
  margin-top: -6px;
  text-align: center;
  color: var(--mist);
  font-size: 0.95rem;
}
@media (hover: none) {
  .type-hint {
    display: none;
  }
}
@media (min-width: 561px) and (max-height: 860px) {
  .stage[data-step="drill"],
  .stage[data-step="decode"],
  .stage[data-step="choice"] {
    padding-top: 16px;
  }
  .keys-board .key {
    height: 46px;
  }
  .stage[data-step="decode"] .controls .btn,
  .stage[data-step="drill"] .controls .btn-ghost {
    min-height: 44px;
  }
}

/* ---------- the radio ---------- */

.radio {
  position: relative;
  width: min(100%, 500px);
  margin: 0 auto;
  aspect-ratio: 2.05;
  display: grid;
  grid-template-columns: 1fr 1.18fr;
  gap: 6%;
  padding: 7% 6% 8%;
  border-radius: 28px 28px 20px 20px;
  background: radial-gradient(120% 95% at 28% 0%, #7d4b31 0%, var(--bakelite) 42%, #3a2115 100%);
  box-shadow: inset 0 2px 0 rgba(255, 220, 180, 0.2), inset 0 -10px 22px rgba(0, 0, 0, 0.35), 0 26px 50px -18px rgba(0, 0, 0, 0.85);
}
.radio::after {
  content: "";
  position: absolute;
  left: 9%;
  right: 9%;
  bottom: -9px;
  height: 9px;
  border-radius: 0 0 8px 8px;
  background: #241409;
}
.radio-grille {
  border-radius: 14px;
  background: repeating-linear-gradient(180deg, #2a160c 0 7px, #4f2e1e 7px 12px);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.6);
}
.radio-face {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10%;
  min-width: 0;
}
.radio-dial {
  position: relative;
  height: 44%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 9px;
  background: linear-gradient(180deg, #2a1a10, #1c120b);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.7);
  transition: background 0.6s;
}
.dial-scale {
  position: absolute;
  left: 3%;
  right: 3%;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  justify-content: space-between;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(0.5rem, 1.25vw, 0.72rem);
  letter-spacing: 0.02em;
  color: rgba(255, 200, 120, 0.22);
  transition: color 0.6s;
}
.dial-scale i {
  font-style: normal;
}
.dial-needle {
  position: absolute;
  top: 14%;
  bottom: 14%;
  left: 30%;
  width: 2px;
  background: var(--static);
  opacity: 0.45;
  transition: left 0.3s var(--ease), opacity 0.6s;
}
.radio[data-power="on"] .radio-dial {
  background: radial-gradient(120% 150% at 50% 50%, #ffd384 0%, #ec952e 48%, #7d4110 100%);
}
.radio[data-power="on"] .dial-scale {
  color: rgba(62, 26, 4, 0.85);
}
.radio[data-power="on"] .dial-needle {
  left: var(--needle, 30%);
  opacity: 1;
}
.radio.is-receiving .radio-dial {
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.4), 0 0 26px 4px rgba(255, 178, 62, 0.45);
}
.radio-controls {
  display: flex;
  align-items: center;
  gap: 8%;
}
.radio-lamp {
  width: 34%;
  aspect-ratio: 1;
  flex: none;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #6b3c18, #3a1f0c 70%);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.6), 0 0 0 4px #2a170c;
}
.radio-lamp.on {
  background: radial-gradient(circle at 40% 35%, #fff7dc, var(--amber) 45%, #c4650c 82%);
  box-shadow: 0 0 0 4px #2a170c, 0 0 36px 12px rgba(255, 178, 62, 0.62);
}
.radio-lamp.on[data-tone="cold"] {
  background: radial-gradient(circle at 40% 35%, #ffe3df, var(--static) 45%, #8d1d14 82%);
  box-shadow: 0 0 0 4px #2a170c, 0 0 36px 12px rgba(255, 80, 60, 0.6);
}
.radio-knob {
  width: 19%;
  aspect-ratio: 1;
  flex: none;
  border-radius: 50%;
  background: radial-gradient(circle at 36% 30%, #5d5d5d, #1a1a1a 70%);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.6);
}

/* ---------- scenes: one picture frame, many places ---------- */

.scene-art {
  position: relative;
  width: 100%;
  aspect-ratio: 2.1;
  overflow: hidden;
  border-radius: 16px;
  background: #0b1129;
  box-shadow: inset 0 0 0 1px rgba(45, 57, 104, 0.7);
}
.scene-art > svg {
  display: block;
  width: 100%;
  height: 100%;
}
.scene {
  position: relative;
  width: 100%;
  aspect-ratio: 2.1;
  overflow: hidden;
  border-radius: 16px;
  background: #0b1129;
  box-shadow: inset 0 0 0 1px rgba(45, 57, 104, 0.7);
  cursor: pointer;
}
.scene .scene-art {
  position: absolute;
  inset: 0;
  width: auto;
  aspect-ratio: auto;
  border-radius: 0;
  box-shadow: none;
}
.scene-layer {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.7s var(--ease), visibility 0s linear 0.7s;
}
.scene-layer.is-on {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.7s var(--ease), visibility 0s;
}

/* Lights in the pictures */
.src .glow {
  opacity: 0;
  transition: opacity 0.03s;
}
.src.on .glow {
  opacity: 1;
}
.src .bulb {
  fill: #4d3c22;
  transition: fill 0.03s;
}
.src[data-tone="white"] .bulb {
  fill: #4f5875;
}
.src[data-tone="red"] .bulb {
  fill: #5a2621;
}
.src[data-tone="blue"] .bulb {
  fill: #283d6b;
}
.src.on .bulb {
  fill: #fffaf0;
}
.src .ring {
  fill: none;
  stroke: var(--amber-hot);
  stroke-width: 2;
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
}
.src.watch .ring {
  animation: ring 1.8s ease-out infinite;
}
.src .tag {
  font: 700 15px var(--font-body);
  fill: #d7dcf0;
  paint-order: stroke;
  stroke: #070a18;
  stroke-width: 4px;
  stroke-linejoin: round;
}
.src.watch .tag {
  fill: var(--amber-hot);
}
@keyframes ring {
  0% {
    opacity: 0.9;
    transform: scale(0.6);
  }
  100% {
    opacity: 0;
    transform: scale(2.4);
  }
}

/* City and sunrise */
.scene-city .blocks,
.scene-dawn .blocks {
  fill: #121a36;
}
.scene-city .w,
.scene-dawn .w {
  fill: #ffcf6b;
  transition-property: opacity;
  transition-duration: 0.3s;
}
.scene-city.out .w,
.scene-dawn .wins.off .w {
  opacity: 0;
}
.scene-dawn .w {
  transition-duration: 0.6s;
}
.scene-city.flicker .wins {
  animation: flicker 0.8s steps(1, end) 1;
}
.scene-city .van {
  transform: translateX(-140px);
}
.scene-city.van-go .van {
  animation: drive 4.2s linear forwards;
}
@keyframes drive {
  from {
    transform: translateX(-140px);
  }
  to {
    transform: translateX(940px);
  }
}
@keyframes flicker {
  0% {
    opacity: 1;
  }
  15% {
    opacity: 0.15;
  }
  30% {
    opacity: 1;
  }
  45% {
    opacity: 0.3;
  }
  60%,
  100% {
    opacity: 1;
  }
}
.scene-dawn .warm {
  opacity: 0;
  transition: opacity 3.4s ease;
}
.scene-dawn .sun {
  transform: translateY(170px);
  transition: transform 3.6s var(--ease);
}
.scene-dawn .stars {
  transition: opacity 2.4s ease;
}
.scene-dawn.risen .warm {
  opacity: 1;
}
.scene-dawn.risen .sun {
  transform: translateY(0);
}
.scene-dawn.risen .stars {
  opacity: 0;
}

/* Grandpa's room */
.scene-radio {
  display: grid;
  place-items: center;
  background: radial-gradient(60% 70% at 50% 40%, #1d1a2c, #0d0f1d 75%);
}
.radio-wall {
  position: absolute;
  inset: 0 0 26% 0;
  background: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.015) 0 2px, transparent 2px 46px);
}
.radio-desk {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 26%;
  background: linear-gradient(180deg, #3a2417, #24160d);
  box-shadow: inset 0 3px 0 rgba(255, 210, 160, 0.1);
}
.scene-radio .radio {
  position: relative;
  width: min(60%, 400px);
  margin-top: -6%;
}
.scene-radio.jamming .radio {
  animation: shake 0.1s linear 12;
}
@keyframes shake {
  0%,
  100% {
    transform: translate(0, 0);
  }
  25% {
    transform: translate(-3px, 1px);
  }
  75% {
    transform: translate(3px, -1px);
  }
}

/* Your front door */
.scene-door .flame {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  animation: flame 1.3s ease-in-out infinite alternate;
}
.scene-door .candle-glow {
  opacity: 0.55;
}
.scene-door.knocking .door-g {
  animation: knock 0.26s ease-out 3;
}
.scene-door .bolt {
  transition: transform 0.35s var(--ease);
}
.scene-door.locked .bolt {
  transform: translateX(20px);
}
.src-door .strip {
  fill: #5c4120;
  transition: fill 0.03s;
}
.src-door.on .strip {
  fill: #ffd27a;
}
@keyframes flame {
  from {
    transform: scale(1, 1);
  }
  to {
    transform: scale(0.85, 1.12);
  }
}
@keyframes knock {
  0%,
  100% {
    transform: translateX(0);
  }
  30% {
    transform: translateX(-4px);
  }
}

/* Roof: Zoya's torch goes dead on Day 20 */
.scene-roof.zoya-dead [data-src="zoya"] .bulb {
  fill: #262b3d;
}

/* Police station sign */
.scene-relay .sign {
  font: 800 13px var(--font-body);
  fill: #8fb3ff;
  letter-spacing: 0.08em;
}

/* Museum: sirens */
.scene-museum .flash {
  opacity: 0;
  mix-blend-mode: screen;
}
.scene-museum .siren {
  fill: #2a3050;
}
.scene-museum.sirens .s-red {
  fill: #ff3b30;
  animation: siren 0.7s steps(1, end) infinite;
}
.scene-museum.sirens .s-blue {
  fill: #3f73ff;
  animation: siren 0.7s 0.35s steps(1, end) infinite;
}
.scene-museum.sirens .flash-blue {
  animation: wash 0.7s steps(1, end) infinite;
}
.scene-museum.sirens .flash-red {
  animation: wash 0.7s 0.35s steps(1, end) infinite;
}
.scene-museum .gem {
  animation: gem 2.6s ease-in-out infinite;
}
@keyframes siren {
  0%,
  49% {
    opacity: 1;
  }
  50%,
  100% {
    opacity: 0.25;
  }
}
@keyframes wash {
  0%,
  49% {
    opacity: 0.16;
  }
  50%,
  100% {
    opacity: 0;
  }
}
@keyframes gem {
  0%,
  100% {
    opacity: 0.65;
  }
  50% {
    opacity: 1;
  }
}

/* Grandpa's codebook as a picture */
.scene-codebook {
  display: grid;
  place-items: center;
  background: radial-gradient(70% 90% at 50% 30%, #2a2133, #110f1c 80%);
}
.book {
  width: 86%;
  height: 82%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-radius: 6px;
  background: linear-gradient(90deg, #e9dcbf 0 49.6%, #b9a174 49.6% 50.4%, #efe3c8 50.4%);
  box-shadow: 0 18px 40px -12px rgba(0, 0, 0, 0.8), inset 0 0 0 1px rgba(80, 60, 30, 0.25);
  color: var(--ink);
}
.book-page {
  padding: 6% 7%;
  display: flex;
  flex-direction: column;
  gap: 8%;
  min-width: 0;
  background: repeating-linear-gradient(180deg, transparent 0 22px, rgba(78, 106, 160, 0.14) 22px 23px);
}
.book-head {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1rem, 3vw, 1.5rem);
  line-height: 1;
  color: var(--ink-soft);
}
.book-syms {
  display: flex;
  flex-wrap: wrap;
  gap: 6% 10%;
  align-content: flex-start;
}
.book-sym {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.book-sym b {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(1.6rem, 6vw, 3rem);
  line-height: 1;
}
.book-sym .shapes {
  font-size: clamp(9px, 1.8vw, 14px);
  color: #6b5233;
}
.book-hand,
.book-note {
  font-style: italic;
  font-size: clamp(0.8rem, 2.4vw, 1.1rem);
  color: var(--ink-soft);
}
.book-right {
  align-items: center;
  justify-content: center;
  text-align: center;
}
.book-doodle {
  width: 42%;
  height: auto;
}

/* Your torch, for sending with light */
.torch {
  width: min(100%, 420px);
  margin: 0 auto;
}
.torch svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}
.torch .beam {
  opacity: 0;
  transition: opacity 0.03s;
}
.torch .lens {
  transition: fill 0.03s;
}
.torch.on .beam {
  opacity: 1;
}
.torch.on .lens {
  fill: #fff6d8;
}

/* The signal strip under a picture */
.tape {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: 12px 26px;
  min-height: 24px;
}
.tape-word {
  display: flex;
  gap: 12px;
}
.tape-ch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.tape .shapes {
  font-size: 15px;
}
.tape .dit,
.tape .dah {
  background: #2c3767;
  transition: background-color 0.05s, box-shadow 0.05s;
}
.tape .seen {
  background: #b9822f;
}
.tape .live {
  background: var(--amber-hot);
  box-shadow: 0 0 12px rgba(255, 210, 120, 0.9);
}
.tape-l {
  font-family: var(--font-display);
  font-weight: 850;
  font-size: 1.7rem;
  line-height: 1;
  min-height: 1em;
}
.tape-ch.is-known .tape-l {
  color: var(--amber-hot);
}
.tape-ch.is-unknown .tape-l {
  color: var(--static);
}

.story-log {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 9.5em;
  cursor: pointer;
}
.story-log p {
  max-width: 32em;
  font-size: clamp(1.2rem, 2.6vw, 1.42rem);
  line-height: 1.5;
}
.story-log p.is-past {
  color: var(--mist-dim);
}
.story-log p.is-stamp {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.5rem, 3.4vw, 2rem);
  color: var(--amber);
}
.story-log p.is-letter {
  padding-left: 16px;
  border-left: 3px solid var(--amber);
  font-style: italic;
  color: var(--amber-hot);
}
.story-log p.is-cold {
  color: var(--static-soft);
}
.story-log p.is-past.is-cold,
.story-log p.is-past.is-stamp,
.story-log p.is-past.is-letter {
  color: var(--mist-dim);
}

.partial {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 22px;
}
.partial-word {
  display: flex;
  gap: 8px;
}
.partial-slot {
  min-width: 46px;
  height: 58px;
  padding: 0 6px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  border: 2px dashed rgba(255, 91, 77, 0.45);
  font-family: var(--font-display);
  font-weight: 850;
  font-size: 2.1rem;
  line-height: 1;
}
.partial-slot.is-known {
  border-style: solid;
  border-color: var(--amber);
  color: var(--amber-hot);
}
.partial-slot.is-unknown {
  color: var(--static);
}

/* ---------- concept and learn ---------- */

.pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.pair-item {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pair-item p {
  color: var(--mist);
  font-size: 1rem;
}
.sound-btn {
  min-height: 88px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 14px;
  border-radius: 16px;
  border: 2px solid var(--line);
  background: rgba(24, 33, 66, 0.7);
  cursor: pointer;
  font-weight: 700;
}
.sound-btn:hover {
  border-color: var(--amber);
}
.sound-btn .shapes {
  font-size: 24px;
  color: var(--amber);
}
.grandpa-quote {
  padding-left: 18px;
  border-left: 3px solid var(--amber);
}
.grandpa-quote blockquote p {
  font-size: 1.3rem;
  font-style: italic;
  line-height: 1.4;
}
.grandpa-quote figcaption {
  margin-top: 6px;
  color: var(--mist);
  font-size: 0.95rem;
}

.learn-head {
  display: flex;
  align-items: center;
  gap: clamp(16px, 4vw, 36px);
}
.learn-letter {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(6.5rem, 22vw, 10rem);
  line-height: 0.8;
  color: var(--amber-hot);
}
.learn-meta {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.learn-shapes {
  font-size: 30px;
  color: #6b5233;
}
.learn-shapes .dit,
.learn-shapes .dah,
.set-shapes .dit,
.set-shapes .dah {
  transition: background-color 0.04s, box-shadow 0.04s;
}
.learn-shapes .on,
.set-shapes .on {
  background: var(--amber);
  box-shadow: 0 0 16px rgba(255, 178, 62, 0.8);
}
.learn-say {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  line-height: 1;
}
.learn-status {
  font-weight: 700;
  color: var(--amber-hot);
}

.set-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 12px;
}
.set-card {
  min-height: 132px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 10px;
  border-radius: 16px;
  border: 2px solid var(--line);
  background: rgba(24, 33, 66, 0.7);
  cursor: pointer;
  text-align: center;
}
.set-card.is-playing {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(255, 178, 62, 0.2);
}
.set-sym {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 2.8rem;
  line-height: 0.9;
  color: var(--amber-hot);
}
.set-shapes {
  font-size: 13px;
  color: #6b5233;
}
.set-sub {
  font-size: 0.85rem;
  color: var(--mist);
  line-height: 1.3;
}

/* ---------- answering: slots, keys and options ---------- */

.round {
  min-height: 1.4em;
  text-align: center;
  color: var(--mist);
  font-size: 1rem;
}
.slots {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px 24px;
  min-height: 82px;
}
.slot-word {
  display: flex;
  gap: 8px;
}
.slot {
  position: relative;
  width: 64px;
  height: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 10px;
  border: 2px solid var(--line);
  background: rgba(20, 28, 58, 0.6);
  font-family: var(--font-display);
  font-weight: 850;
  font-size: 3rem;
  line-height: 1;
}
.slots.is-long {
  gap: 10px 18px;
}
.slots.is-long .slot-word {
  gap: 6px;
}
.slots.is-long .slot {
  width: 44px;
  height: 58px;
  font-size: 2.1rem;
}
.slot.is-active {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(255, 178, 62, 0.18);
}
.slot.is-right {
  border-color: var(--phosphor);
  color: var(--phosphor);
}
.slot.is-wrong {
  border-color: var(--static);
  color: var(--static);
}
.slot.is-reveal {
  border-color: var(--amber);
  color: var(--amber-hot);
}
.slot.is-fixed {
  width: auto;
  padding: 0 10px;
  border-style: dashed;
  color: var(--mist);
  font-size: 2rem;
}
.slot-shapes {
  font-size: 9px;
  color: var(--amber);
}
.slot:has(.slot-shapes) .slot-ch {
  font-size: 0.8em;
}

.timer {
  height: 10px;
  border-radius: 999px;
  background: #19213f;
  overflow: hidden;
}
.timer > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ff9b4a, var(--amber-hot));
  transform-origin: left center;
  animation-name: drain;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
}
@keyframes drain {
  from {
    transform: scaleX(1);
  }
  to {
    transform: scaleX(0);
  }
}

.feedback {
  min-height: 1.6em;
  text-align: center;
  font-weight: 700;
}
.feedback.good {
  color: var(--phosphor);
}
.feedback.bad {
  color: var(--static-soft);
}

.keys {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 18px;
}
.key {
  width: 108px;
  height: 108px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0;
  border-radius: 18px;
  border: 2px solid #3a477a;
  background: linear-gradient(180deg, #27325c, #1a2347);
  box-shadow: 0 7px 0 #0c1228, 0 16px 26px -10px rgba(0, 0, 0, 0.7);
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.06s, box-shadow 0.06s, opacity 0.2s;
}
.key-ch {
  font-family: var(--font-display);
  font-weight: 850;
  font-size: 3.5rem;
  line-height: 0.9;
}
.key-hint {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--mist-dim);
}
.key:active,
.key.is-pressed {
  transform: translateY(5px);
  box-shadow: 0 2px 0 #0c1228, 0 8px 14px -8px rgba(0, 0, 0, 0.7);
}
.key[disabled] {
  opacity: 0.45;
  cursor: default;
  transform: none;
}

/* A keyboard once there are more than six symbols */
.keys-board {
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.krow {
  display: flex;
  justify-content: center;
  gap: 6px;
  width: 100%;
}
.keys-board .key {
  width: auto;
  flex: 0 1 54px;
  min-width: 0;
  height: 54px;
  border-radius: 10px;
  border-width: 1.5px;
  box-shadow: 0 4px 0 #0c1228;
}
.keys-board .key-ch {
  font-size: 1.7rem;
}
.keys-board .key.is-unknown {
  opacity: 0.18;
  box-shadow: none;
}
.keys-board .key:active,
.keys-board .key.is-pressed {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #0c1228;
}

.options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}
.option {
  min-height: 66px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-radius: 14px;
  border: 2px solid var(--line);
  background: rgba(24, 33, 66, 0.75);
  font-weight: 700;
  font-size: 1.15rem;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
}
.option:hover:not([disabled]) {
  border-color: var(--amber);
}
.option-k {
  flex: none;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #0f1531;
  color: var(--mist);
  font-size: 0.85rem;
}
.option.is-right {
  border-color: var(--phosphor);
  color: var(--phosphor);
}
.option.is-wrong {
  border-color: var(--static);
  color: var(--static-soft);
}
.option[disabled] {
  cursor: default;
}

/* ---------- sending with the telegraph key ---------- */

.send-target {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 28px;
}
.send-word {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}
.send-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 2px solid transparent;
  transition: border-color 0.2s;
}
.send-group.is-active {
  border-color: var(--line);
}
.send-letter {
  font-family: var(--font-display);
  font-weight: 850;
  font-size: 2.4rem;
  line-height: 1;
  color: var(--mist-dim);
}
.send-group.is-active .send-letter {
  color: var(--moon);
}
.send-group.is-done .send-letter {
  color: var(--amber);
}
.send-shapes {
  font-size: 18px;
}
.send-shapes .dit,
.send-shapes .dah {
  background: transparent;
  box-shadow: inset 0 0 0 2px var(--mist-dim);
}
.send-shapes .is-filled {
  background: var(--amber);
  box-shadow: 0 0 12px rgba(255, 178, 62, 0.7);
}
.send-shapes .is-wrong {
  background: var(--static);
  box-shadow: 0 0 12px rgba(255, 91, 77, 0.7);
}

.tkey {
  position: relative;
  width: min(100%, 440px);
  height: 150px;
  margin: 0 auto;
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: none;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
.tkey > span {
  pointer-events: none;
}
.tkey-base {
  position: absolute;
  left: 3%;
  right: 3%;
  bottom: 0;
  height: 36%;
  border-radius: 14px;
  background: linear-gradient(180deg, #6d4228, #3d2416);
  box-shadow: inset 0 2px 0 rgba(255, 220, 180, 0.2), 0 16px 30px -12px rgba(0, 0, 0, 0.85);
}
.tkey-arm {
  position: absolute;
  left: 12%;
  right: 16%;
  bottom: 44%;
  height: 11%;
  border-radius: 6px;
  background: linear-gradient(180deg, #ffe9a8, #d6a64b 50%, #8f6420);
  transform-origin: 6% 50%;
  transition: transform 0.05s;
}
.tkey-knob {
  position: absolute;
  right: 10%;
  bottom: 40%;
  width: 26%;
  aspect-ratio: 1.6;
  border-radius: 50% / 46%;
  background: radial-gradient(circle at 40% 30%, #4d4d4d, #0d0d0d 70%);
  box-shadow: 0 7px 10px rgba(0, 0, 0, 0.55);
  transition: transform 0.05s;
}
.tkey.is-down .tkey-arm {
  transform: rotate(3deg);
}
.tkey.is-down .tkey-knob {
  transform: translateY(10px);
}
.tkey-label {
  position: absolute;
  left: 7%;
  bottom: 10%;
  font-size: 0.85rem;
  font-weight: 700;
  color: rgba(255, 228, 196, 0.75);
}
.howto {
  text-align: center;
  color: var(--mist);
  font-size: 1rem;
}

/* ---------- tuning dial ---------- */

.tune {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.tune-readout {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(3rem, 12vw, 4.4rem);
  line-height: 1;
  color: var(--amber-hot);
  font-variant-numeric: tabular-nums;
}
.tune-unit {
  font-size: 0.4em;
  color: var(--mist);
}
.tune-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(100%, 520px);
}
.tune-range {
  flex: 1;
  min-width: 0;
  height: 44px;
  accent-color: var(--amber);
  cursor: pointer;
}

/* ---------- codename ---------- */

.chips {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 10px;
}
.chip {
  min-height: 56px;
  padding: 10px 16px;
  border-radius: 14px;
  border: 2px solid var(--line);
  background: rgba(24, 33, 66, 0.6);
  cursor: pointer;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.4rem;
  text-align: left;
}
.chip:hover {
  border-color: var(--mist-dim);
}
.chip[aria-checked="true"] {
  border-color: var(--amber);
  color: var(--amber-hot);
  box-shadow: 0 0 0 3px rgba(255, 178, 62, 0.2);
}

/* ---------- results ---------- */

.results {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.results-stars {
  display: flex;
  gap: 10px;
}
.star {
  width: 56px;
  height: 56px;
}
.star svg {
  width: 100%;
  height: 100%;
}
.star path {
  fill: transparent;
  stroke: var(--mist-dim);
  stroke-width: 1.4;
  stroke-linejoin: round;
}
.star.is-on path {
  fill: var(--amber);
  stroke: var(--amber-hot);
}
.star.is-on {
  filter: drop-shadow(0 0 12px rgba(255, 178, 62, 0.55));
  animation: star-in 0.5s var(--ease) both;
  animation-delay: calc(var(--k) * 220ms + 150ms);
}
@keyframes star-in {
  from {
    transform: scale(0.3) rotate(-30deg);
    opacity: 0;
  }
  to {
    transform: scale(1) rotate(0);
    opacity: 1;
  }
}
.star-hint,
.rank-note {
  color: var(--mist);
  font-size: 1rem;
}
.rank-note:empty {
  display: none;
}
.rank-note {
  color: var(--amber-hot);
  font-weight: 700;
}
.results-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.stat {
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(20, 28, 58, 0.55);
}
.stat dt {
  color: var(--mist);
  font-size: 0.9rem;
}
.stat dd {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.9rem;
  line-height: 1.05;
}
.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  align-items: start;
  gap: 14px;
}
.result-grid:empty {
  display: none;
}
.result-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 18px;
  border-radius: 14px;
  border: 1px solid var(--line);
}
.result-card h2 {
  font-size: 1.15rem;
  color: var(--amber-hot);
}
.result-card p {
  color: var(--mist);
}
.result-card.is-cold {
  border-style: dashed;
  border-color: rgba(255, 91, 77, 0.5);
}
.result-card.is-cold h2 {
  color: var(--static-soft);
}
.result-card.is-solved {
  border-color: rgba(127, 240, 176, 0.5);
}
.result-card.is-solved h2 {
  color: var(--phosphor);
}
.result-card .partial {
  justify-content: flex-start;
}
.result-card .partial-slot {
  min-width: 38px;
  height: 48px;
  font-size: 1.7rem;
}
.cert-card {
  border-color: var(--amber);
}
.cert-img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  background: #0b1024;
}
.learned {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 22px;
}
.learned-letter {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.learned-letter b {
  font-family: var(--font-display);
  font-weight: 850;
  font-size: 2.2rem;
  line-height: 1;
}
.learned-letter .shapes {
  font-size: 14px;
  color: var(--amber);
}
.share-note {
  min-height: 1.4em;
  color: var(--mist);
  font-size: 1rem;
}

/* ---------- settings ---------- */

.settings {
  width: min(92vw, 460px);
  max-height: 90vh;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #0e1430;
  color: var(--moon);
}
.settings::backdrop {
  background: rgba(3, 5, 12, 0.72);
}
.settings h2 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 2rem;
  line-height: 1;
  margin-bottom: 8px;
}
.setting {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin: 0;
  padding: 14px 0;
  border: 0;
  border-bottom: 1px solid rgba(45, 57, 104, 0.6);
}
.setting-col {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}
.setting legend {
  float: left;
  width: 100%;
  margin-bottom: 10px;
  padding: 0;
}
.setting label,
.setting legend,
.setting p {
  font-weight: 700;
}
.setting small {
  display: block;
  margin-top: 2px;
  font-weight: 400;
  font-size: 0.9rem;
  color: var(--mist);
}
.code-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.code-row code {
  flex: 1;
  padding: 10px 12px;
  border-radius: 10px;
  background: #0a0f24;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.4rem;
  letter-spacing: 0.06em;
  color: var(--amber-hot);
}
.code-row input {
  flex: 1;
  min-width: 0;
  height: 44px;
  padding: 0 12px;
  border-radius: 10px;
  border: 2px solid var(--line);
  background: #0a0f24;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.3rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.cloud-msg {
  min-height: 1.3em;
  font-weight: 400 !important;
  color: var(--mist);
  font-size: 0.95rem;
}
.switch {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  position: relative;
  width: 52px;
  height: 30px;
  margin: 0;
  border-radius: 999px;
  background: #273160;
  cursor: pointer;
  transition: background 0.2s;
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--moon);
  transition: transform 0.2s var(--ease);
}
.switch:checked {
  background: var(--amber);
}
.switch:checked::after {
  transform: translateX(22px);
  background: #2a1505;
}
.seg {
  clear: both;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-radius: 12px;
  box-shadow: inset 0 0 0 1.5px var(--line);
  overflow: hidden;
}
.seg input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.seg label {
  padding: 10px 8px;
  text-align: center;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
}
.seg input:checked + label {
  background: var(--amber);
  color: #2a1505;
}
.seg input:focus-visible + label {
  outline: 3px solid var(--amber-hot);
  outline-offset: -3px;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 20px;
}

/* ---------- smaller screens ---------- */

@media (max-width: 900px) {
  .hero-inner {
    grid-template-columns: 1fr;
    padding-top: 100px;
  }
  .hero-copy {
    padding-bottom: 8px;
  }
  .wordmark {
    font-size: clamp(4.4rem, 18vw, 9rem);
  }
  .city-map {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
  }
  .how-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  body {
    font-size: 1.0625rem;
  }
  .wordmark {
    font-size: clamp(4.4rem, 24vw, 6.5rem);
  }
  .brand span:last-child {
    font-size: 0.95rem;
  }
  .agent {
    display: none;
  }
  .lesson-bar {
    gap: 10px;
  }
  .lesson-title {
    font-size: 1.1rem;
  }
  .points-unit {
    display: none;
  }
  .lesson-tools {
    gap: 6px;
  }
  .stage {
    gap: 18px;
  }
  .pair {
    grid-template-columns: 1fr;
  }
  .key {
    width: 92px;
    height: 92px;
  }
  .key-ch {
    font-size: 3rem;
  }
  .keys-board .key {
    height: 48px;
    border-radius: 8px;
  }
  .keys-board .key-ch {
    font-size: 1.4rem;
  }
  .krow {
    gap: 4px;
  }
  .slot {
    width: 54px;
    height: 70px;
    font-size: 2.6rem;
  }
  .slots.is-long .slot {
    width: 34px;
    height: 46px;
    font-size: 1.6rem;
  }
  .slots.is-long .slot-word {
    gap: 4px;
  }
  .results-stats {
    grid-template-columns: 1fr 1fr;
  }
  .stat:last-child {
    grid-column: span 2;
  }
  .learn-shapes {
    font-size: 24px;
  }
  .send-letter {
    font-size: 1.9rem;
  }
  .send-shapes {
    font-size: 14px;
  }
  .send-target {
    gap: 8px 18px;
  }
  .tape .shapes {
    font-size: 12px;
  }
  .tape-l {
    font-size: 1.4rem;
  }
  .scene-art .src .tag {
    font-size: 20px;
  }
  .codebook-grid {
    grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
    gap: 8px;
  }
  .cb-cell,
  .cb-play {
    min-height: 72px;
    gap: 8px;
  }
  .cb-letter {
    font-size: 1.7rem;
  }
  .cb-play .shapes {
    font-size: 9px;
  }
  .cb-blank {
    width: 24px;
  }
  #codebook-digits,
  #codebook-extra {
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  }
  #codebook-digits .cb-play .shapes,
  #codebook-extra .cb-play .shapes {
    font-size: 7px;
  }
  .lb-list li {
    grid-template-columns: 1.8em minmax(0, 1fr) auto;
    gap: 10px;
  }
  .lb-days {
    display: none;
  }
  .chip {
    font-size: 1.25rem;
  }
}

@media (hover: none) {
  .key-hint,
  .kbd-hint {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    transition-delay: 0s !important;
    scroll-behavior: auto !important;
  }
}

/* Picture labels are scaled down with the picture on phones, so they start bigger. */
@media (max-width: 560px) {
  .scene-art .src .tag {
    font-size: 30px;
    stroke-width: 7px;
  }
}
