  /* Anek Latin by Ek Type (SIL OFL), self-hosted. Its width axis gives the condensed sign type. */
  @font-face { font-family: Anek; font-weight: 100 800; font-stretch: 75% 125%; font-display: swap; src: url(/fonts/anek-latin.woff2) format("woff2"); }
  :root {
    color-scheme: light;
    --bg: #E3E6E9;
    --surface: #F5F6F7;
    --ink: #1E2226;
    --muted: #59626B;
    --rule: #BCC3CA;
    --board: #FFD100;
    --board-ink: #000000;
    --w: #C8102E;
    --c: #00843D;
    --h: #0067B1;
    --t: #6E3FA3;
    --p: #C2187A;
    --hit: #2E9E4F;
    --near: #F2C300;
    --far: #EE8A22;
    --swap: #BCC3CA;
    --focus: #0067B1;
    box-sizing: border-box;
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
      color-scheme: dark;
      --bg: #18202A;
      --surface: #222C37;
      --ink: #E9EDF1;
      --muted: #9AA6B2;
      --rule: #3A4756;
      --w: #FF5466;
      --c: #2FBF71;
      --h: #4DA3FF;
      --t: #B08AE6;
      --p: #F06BB0;
      --hit: #3CC266;
      --near: #F2C300;
      --far: #F29A3A;
      --swap: #4A5868;
      --focus: #4DA3FF;
    }
  }
  :root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #18202A;
    --surface: #222C37;
    --ink: #E9EDF1;
    --muted: #9AA6B2;
    --rule: #3A4756;
    --w: #FF5466;
    --c: #2FBF71;
    --h: #4DA3FF;
    --t: #B08AE6;
    --p: #F06BB0;
    --hit: #3CC266;
    --near: #F2C300;
    --far: #F29A3A;
    --swap: #4A5868;
    --focus: #4DA3FF;
  }
  *, *::before, *::after { box-sizing: inherit; }
  html { scroll-padding-top: env(safe-area-inset-top, 0px); -webkit-text-size-adjust: 100%; }
  body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: Anek, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 1rem;
    line-height: 1.45;
  }
  main { max-width: 30rem; margin: 0 auto; padding: 1.25rem 1rem 2.5rem; }
  :focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

  /* The station board: the one loud thing on the page */
  .board-wrap { perspective: 900px; margin-bottom: 0.9rem; }
  .board {
    display: grid;
    transform-style: preserve-3d;
    transition: transform 0.8s cubic-bezier(0.3, 0.7, 0.2, 1);
  }
  .board.flipped { transform: rotateX(180deg); }
  .board.no-anim { transition: none; }
  .face {
    grid-area: 1 / 1;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    background: var(--board);
    color: var(--board-ink);
    border-radius: 6px;
    box-shadow: inset 0 0 0 6px var(--board), inset 0 0 0 9px var(--board-ink);
    padding: 1.1rem 1rem 1.2rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 11rem;
  }
  .face.back { transform: rotateX(180deg); }
  .deva { font-family: "Noto Sans Devanagari", "Kohinoor Devanagari", "Devanagari Sangam MN", sans-serif; font-weight: 700; font-size: 1.35rem; line-height: 1.25; }
  .deva + .deva { margin-top: 0.1rem; }
  .board-en {
    font-family: Anek, "Arial Narrow", sans-serif; font-stretch: 75%;
    font-weight: 700;
    font-size: clamp(2.4rem, 11vw, 3.1rem);
    line-height: 1;
    letter-spacing: 0.01em;
    margin-top: 0.35rem;
  }
  .answer-name { text-transform: uppercase; overflow-wrap: anywhere; }
  .answer-lines { display: flex; justify-content: center; gap: 0.4rem; margin-top: 0.6rem; font-weight: 600; font-size: 0.85rem; }
  .answer-lines span { display: inline-flex; align-items: center; gap: 0.3rem; }
  .answer-lines i { width: 0.7rem; height: 0.7rem; border-radius: 2px; display: inline-block; }

  .lede { margin: 0 0 1rem; color: var(--muted); }
  .lede strong { color: var(--ink); font-weight: 600; }

  details { margin: 0 0 1.1rem; }
  summary { cursor: pointer; font-weight: 600; width: max-content; }
  details[open] summary { margin-bottom: 0.5rem; }
  .rules p { margin: 0 0 0.55rem; max-width: 34rem; }
  .legend { list-style: none; padding: 0; margin: 0.4rem 0 0.6rem; display: grid; gap: 0.35rem; }
  .legend li { display: flex; align-items: center; gap: 0.55rem; }

  /* Guess input */
  .entry { position: relative; margin-bottom: 1rem; }
  .entry-row { display: flex; gap: 0.5rem; }
  .entry input {
    flex: 1;
    min-width: 0;
    font: inherit;
    font-size: 1.125rem;
    padding: 0.7rem 0.8rem;
    border: 2px solid var(--ink);
    border-radius: 4px;
    background: var(--surface);
    color: var(--ink);
  }
  .entry input::placeholder { color: var(--muted); }
  .entry button {
    font: inherit;
    font-weight: 600;
    font-size: 1.05rem;
    padding: 0 1.1rem;
    border: 2px solid var(--ink);
    border-radius: 4px;
    background: var(--ink);
    color: var(--bg);
    cursor: pointer;
  }
  .entry button:disabled, .entry input:disabled { opacity: 0.5; cursor: not-allowed; }
  .suggest {
    list-style: none;
    margin: 0;
    padding: 0;
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% - 2px);
    background: var(--surface);
    border: 2px solid var(--ink);
    border-radius: 0 0 4px 4px;
    z-index: 5;
    max-height: 18rem;
    overflow-y: auto;
  }
  .suggest[hidden] { display: none; }
  .suggest li {
    padding: 0.6rem 0.8rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
  }
  .suggest li[aria-selected="true"] { background: var(--board); color: var(--board-ink); }
  .dots { display: inline-flex; gap: 0.25rem; flex-shrink: 0; }
  .dots i { width: 0.6rem; height: 0.6rem; border-radius: 50%; display: inline-block; }

  /* Guess rows, styled like the route strip above a local train door */
  .guesses { list-style: none; padding: 0; margin: 0 0 1.25rem; display: grid; gap: 0.45rem; }
  .row {
    display: grid;
    grid-template-columns: 6px 1fr 1.75rem;
    gap: 0.75rem;
    align-items: center;
    background: var(--surface);
    border-radius: 3px;
    padding: 0.55rem 0.75rem 0.55rem 0;
    min-height: 3.6rem;
  }
  .row.fresh { animation: drop 0.35s ease-out; }
  @keyframes drop { from { transform: translateY(-6px); opacity: 0; } to { transform: none; opacity: 1; } }
  .strip { align-self: stretch; display: flex; flex-direction: column; border-radius: 3px 0 0 3px; overflow: hidden; }
  .strip i { flex: 1; display: block; }
  .name { font-family: Anek, "Arial Narrow", sans-serif; font-stretch: 75%; font-weight: 600; font-size: 1.3rem; line-height: 1.1; }
  .tags { display: flex; flex-wrap: wrap; gap: 0.3rem; margin: 0.25rem 0 0.2rem; }
  .tag {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.05rem 0.45rem;
    border-radius: 999px;
    border: 1.5px solid var(--line);
    color: var(--muted);
  }
  .tag.on { background: var(--line); color: #fff; }
  .hint { font-size: 0.95rem; color: var(--muted); }
  .row.hit .hint { color: var(--ink); font-weight: 600; }
  .tile { width: 1.75rem; height: 1.75rem; border-radius: 4px; justify-self: end; }
  .tile.hit { background: var(--hit); }
  .tile.near { background: var(--near); }
  .tile.far { background: var(--far); }
  .tile.swap { background: var(--swap); }
  .legend .tile { width: 1.1rem; height: 1.1rem; border-radius: 3px; flex-shrink: 0; }

  /* Result */
  .result[hidden] { display: none; }
  .result { border-top: 2px solid var(--ink); padding-top: 1rem; }
  .result h2 { font-family: Anek, "Arial Narrow", sans-serif; font-stretch: 75%; font-weight: 700; font-size: 1.8rem; line-height: 1.1; margin: 0 0 0.4rem; }
  .result p { margin: 0 0 0.75rem; color: var(--muted); }
  .share {
    font: inherit;
    font-weight: 600;
    font-size: 1.05rem;
    padding: 0.75rem 1.2rem;
    border: 2px solid var(--board-ink);
    border-radius: 4px;
    background: var(--board);
    color: var(--board-ink);
    cursor: pointer;
    margin-bottom: 0.9rem;
  }
  .clock { font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 600; }

  footer { margin-top: 2rem; font-size: 0.9rem; color: var(--muted); }
  footer a { color: inherit; }

  .toast {
    position: fixed;
    left: 50%;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 1.25rem);
    transform: translateX(-50%);
    background: var(--ink);
    color: var(--bg);
    padding: 0.65rem 1rem;
    border-radius: 4px;
    font-weight: 500;
    max-width: calc(100% - 2rem);
    z-index: 20;
    transition: opacity 0.2s;
  }
  .toast[hidden] { display: none; }
  .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

  @media (prefers-reduced-motion: reduce) {
    .board { transition: none; }
    .row.fresh { animation: none; }
  }

  /* Language link above the board */
  .lang { display: flex; justify-content: flex-end; margin: 0 0 0.5rem; font-size: 0.95rem; }
  .lang a { color: var(--muted); }

  /* The network map. Your guesses are plotted on it as you play. */
  .map { margin: 0 0 1.25rem; }
  .map h2 { font-family: Anek, "Arial Narrow", sans-serif; font-stretch: 75%; font-weight: 700; font-size: 1.4rem; margin: 0 0 0.25rem; }
  .map > p { margin: 0 0 0.5rem; color: var(--muted); font-size: 0.95rem; }
  .map svg { display: block; width: 100%; height: auto; background: var(--surface); border-radius: 4px; }
  .map text { font: 600 17px Anek, "Noto Sans Devanagari", "Kohinoor Devanagari", sans-serif; font-stretch: 75%;
    fill: var(--ink); paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }
  .map .st { fill: var(--surface); stroke: var(--ink); stroke-width: 1.5; }
  .map .tap { fill: transparent; cursor: pointer; }
  .map .g { stroke: var(--ink); stroke-width: 2.5; }
  .map .ans { fill: var(--board); stroke: #000; stroke-width: 3; }
  .pick { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-top: 0.6rem; }
  .pick[hidden] { display: none; }
  .pick button { font: inherit; font-weight: 600; padding: 0.5rem 1rem; border: 2px solid var(--ink); border-radius: 4px;
    background: var(--ink); color: var(--bg); cursor: pointer; }
  .face h1 { margin-bottom: 0; }
  h1.deva { margin-top: 0; }

  /* Streak badge on the board corner */
  .board-wrap { position: relative; }
  .streak { position: absolute; top: -0.6rem; right: -0.4rem; z-index: 2; background: #000; color: #FFD100;
    font-weight: 700; font-size: 1.05rem; padding: 0.2rem 0.65rem; border-radius: 999px; box-shadow: 0 0 0 2px var(--board); }
  .streak[hidden] { display: none; }
  .left { margin: -0.6rem 0 1.25rem; color: var(--muted); font-size: 0.95rem; }
  .left:empty { display: none; }

  /* Result numbers */
  .stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem; margin: 0.25rem 0 1rem; text-align: center; }
  .stats dd { margin: 0; font-family: Anek, "Arial Narrow", sans-serif; font-stretch: 75%; font-weight: 700; font-size: 2.2rem; line-height: 1; }
  .stats div { display: flex; flex-direction: column-reverse; }
  .stats dt { color: var(--muted); font-size: 0.85rem; margin-top: 0.2rem; }
  .preview { font: inherit; white-space: pre-wrap; background: var(--surface); border-radius: 4px; padding: 0.6rem 0.8rem;
    margin: 0 0 0.75rem; line-height: 1.3; }
  .socials { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: -0.3rem 0 1rem; }
  .socials button { font: inherit; font-weight: 600; font-size: 0.95rem; padding: 0.45rem 0.9rem; border-radius: 999px;
    border: 1.5px solid var(--rule); background: var(--surface); color: var(--ink); cursor: pointer; }
  .socials button:hover { border-color: var(--ink); }
  .map text.n { font-size: 16px; font-stretch: 100%; font-weight: 700; text-anchor: middle; fill: #000; stroke: none; pointer-events: none; }
  .left a { color: var(--ink); }
  #map { scroll-margin-top: 1rem; }
  .pin { font: inherit; font-size: 0.8rem; font-weight: 600; padding: 0.05rem 0.5rem; margin-left: 0.15rem; border-radius: 999px;
    border: 1.5px solid var(--rule); background: none; color: var(--ink); cursor: pointer; white-space: nowrap; }
  .pin:hover { border-color: var(--ink); }
  .map .pulse { transform-box: fill-box; transform-origin: center; animation: pulse 0.6s ease-out 3; }
  @keyframes pulse { 50% { transform: scale(1.8); } }
  @media (prefers-reduced-motion: reduce) { .map .pulse { animation: none; stroke-width: 5; } }
