/* Lanterna happens at night. The page is as dark as the unlit map, so the only
   bright things are what the player has lit: warm lantern light, from deep
   amber for a common answer to white for the rarest. Type is chalk on the dark.
   How rare an answer is shows as star magnitude: a bigger, paler mark, and a
   rayed star for the rarest. */
:root {
  --night: #070a13;    /* the page, and the sea on the map */
  --plate: #151c2f;    /* pressed controls */
  --chalk: #f3efe4;    /* text and linework */
  --mist: #939db4;     /* secondary text */
  --gilt: #f2b450;     /* lantern light: the main action */
  --rule: rgba(243, 239, 228, 0.17);

  /* The five tiers, common to legendary, each a clearly different colour
     (Ivan's choice): bronze, pale green, light blue, gold, and the brightest
     white for legendary. Same as the map (js/mapview.js). */
  --m1: #cd7f32;  /* bronze */
  --m2: #dcf8b1;  /* pale green */
  --m3: #5ec4ff;  /* light blue */
  --m4: #f5c542;  /* gold */
  --m5: #ffffff;  /* brightest white */

  /* The timer burning down, and the brighter lantern light under the pointer. */
  --fuse: #ff4a3d;
  --gilt-hi: #ffdd3c;

  --serif: 'Old Standard TT', 'Iowan Old Style', Georgia, serif;
  --sans: 'Schibsted Grotesk', 'Segoe UI', system-ui, sans-serif;

  --gutter: 1.25rem;
}

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

html { background: var(--night); }

body {
  margin: 0;
  background: var(--night);
  color: var(--chalk);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

h1, h2, p, ol, ul, dl { margin: 0; }
ol, ul { padding: 0; list-style: none; }

::selection { background: var(--gilt); color: var(--night); }

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

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

/* ---------- Layout: bar, map, text ---------- */

.shell {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  max-width: 34rem;
  margin: 0 auto;
}

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 3.5rem;
  padding: max(0.5rem, env(safe-area-inset-top)) var(--gutter) 0;
}

/* The map fills its space edge to edge and fades into the page, which is the
   same colour as the night sea. */
.stage {
  position: relative;
  height: 46dvh;
  margin-top: 0.25rem;
  overflow: hidden;
}

.stage[hidden] { display: none; }

.stage::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(to bottom, var(--night), transparent 8%, transparent 88%, var(--night)),
    linear-gradient(to right, var(--night), transparent 5%, transparent 95%, var(--night));
}

.shell[data-screen='reveal'] .stage { height: 44dvh; }

.shell[data-screen='atlas'] .stage { height: 48dvh; }

.map { display: block; width: 100%; height: 100%; }

/* Setting off: the text steps back while the camera drops to where you are. */
.panel { transition: opacity 400ms ease; }
.shell.is-leaving .panel { opacity: 0.3; }

.panel { padding: 1.25rem var(--gutter) 3rem; }

/* While typing on a phone the keyboard needs the room, so the map steps aside. */
@media (max-width: 59.99rem) {
  .shell[data-screen='rules'] .stage,
  .shell[data-screen='about'] .stage { display: none; }
}

/* Wide screens: the plate fills the left side and stays put; text runs down the right. */
@media (min-width: 60rem) {
  :root { --gutter: 3.5rem; }

  .shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(26rem, 36rem);
    grid-template-rows: auto 1fr;
    max-width: none;
    margin: 0;
  }

  .stage,
  .shell[data-screen] .stage {
    grid-column: 1;
    grid-row: 1 / 3;
    position: sticky;
    top: 0;
    height: 100dvh;
    margin: 0;
  }

  .stage::after {
    background:
      linear-gradient(to bottom, var(--night), transparent 5%, transparent 95%, var(--night)),
      linear-gradient(to right, var(--night), transparent 3%, transparent 90%, var(--night));
  }

  .bar {
    grid-column: 2;
    min-height: 4.5rem;
    padding: 2.25rem var(--gutter) 0 1rem;
  }

  .panel {
    grid-column: 2;
    padding: 3rem var(--gutter) 4rem 1rem;
  }

  /* With the map missing (its data failed to load) the text takes the middle. */
  .shell:has(.stage[hidden]) .bar,
  .shell:has(.stage[hidden]) .panel { grid-column: 1 / 3; width: 100%; max-width: 36rem; margin: 0 auto; }
}

/* ---------- Top bar ---------- */

.wordmark {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.5rem;
  line-height: 1;
}

.tabs { display: flex; gap: 1.5rem; }

.tab {
  min-height: 2.75rem;
  padding: 0.75rem 0 0.375rem;
  border: 0;
  border-bottom: 1.5px solid transparent;
  background: none;
  color: var(--mist);
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
}

.tab:hover { color: var(--chalk); }
.tab[aria-current='page'] { color: var(--chalk); border-bottom-color: var(--chalk); cursor: default; }

.bar-side { display: flex; align-items: center; gap: 0.25rem; }

/* Sound on or off, during a game. */
.sound-icon {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  margin-right: -0.625rem;
  border: 0;
  background: none;
  color: var(--mist);
  cursor: pointer;
}

.sound-icon svg { width: 1.375rem; height: 1.375rem; }
.sound-icon:hover { color: var(--chalk); }
.sound-icon[aria-pressed='false'] { opacity: 0.75; }

.count {
  color: var(--mist);
  font-size: 0.9375rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---------- Rarity marks: one per question ---------- */

.lamps {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  height: 1.5rem;
}

/* Not answered yet: a small open ring. */
.lamp {
  --c: transparent;
  --size: 0.5rem;
  display: block;
  flex: none;
  width: var(--size);
  height: var(--size);
  border: 1px solid rgba(242, 245, 241, 0.42);
  border-radius: 50%;
}

.lamp.is-current { --size: 0.625rem; border: 1.5px solid var(--chalk); }

/* Missed: a short dash where a star would be. */
.lamp.is-miss {
  width: 0.625rem;
  height: 0;
  border: 0;
  border-top: 1.5px solid var(--mist);
  border-radius: 0;
}

.lamp.is-lit { border: 0; background: var(--c); box-shadow: 0 0 0.625rem -0.0625rem var(--c); }

.tier-common    { --c: var(--m1); --size: 0.375rem; }
.tier-uncommon  { --c: var(--m2); --size: 0.5rem; }
.tier-rare      { --c: var(--m3); --size: 0.6875rem; }
.tier-veryrare  { --c: var(--m4); --size: 0.875rem; }
.tier-legendary { --c: var(--m5); --size: 1.25rem; }

/* First magnitude: a rayed star, as on a star chart. */
.lamp.tier-legendary.is-lit {
  border-radius: 0;
  clip-path: polygon(50% 0, 55% 38%, 72.6% 27.4%, 62% 45%, 100% 50%, 62% 55%, 72.6% 72.6%, 55% 62%, 50% 100%, 45% 62%, 27.4% 72.6%, 38% 55%, 0 50%, 38% 45%, 27.4% 27.4%, 45% 38%);
  box-shadow: none;
}

/* ---------- Buttons ---------- */

.button {
  min-height: 3.25rem;
  padding: 0 1.5rem;
  border: 0;
  border-radius: 2px;
  background: var(--gilt);
  color: var(--night);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.button:hover { background: var(--gilt-hi); }
.button:focus-visible { outline-color: var(--chalk); }
.button:active { transform: translateY(1px); }

.button.is-quiet {
  background: transparent;
  color: var(--chalk);
  box-shadow: inset 0 0 0 1px var(--rule);
}

.button.is-quiet:hover { background: transparent; box-shadow: inset 0 0 0 1px var(--chalk); }

/* ---------- Headlines and running text ---------- */

.route {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.5rem, 11.5vw, 3.75rem);
  line-height: 1;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.lede {
  margin-top: 1rem;
  max-width: 31em;
  font-size: 1.125rem;
}

.rules {
  margin-top: 0.5rem;
  max-width: 31em;
  color: var(--mist);
}

.note {
  margin-top: 0.75rem;
  color: var(--mist);
  font-size: 0.9375rem;
}

.credits {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  color: var(--mist);
  font-size: 0.8125rem;
}

.credits a { color: inherit; text-underline-offset: 2px; }
.credits a:hover { color: var(--chalk); }

/* ---------- Tonight ---------- */

.home .button { margin-top: 1.5rem; }
.home .rules { margin-top: 1.5rem; }

/* The key to the marks, as a chart would print it. */
.legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.125rem;
  margin-top: 1rem;
  padding: 0.875rem 0;
  border-block: 1px solid var(--rule);
  color: var(--mist);
  font-size: 0.875rem;
}

.legend li { display: inline-flex; align-items: center; gap: 0.5rem; }

/* Test builds: a plain menu for opening any day. */
.daypick {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.875rem;
  margin-top: 2rem;
  color: var(--mist);
  font-size: 0.9375rem;
}

.daypick select {
  min-height: 2.75rem;
  padding: 0 0.75rem;
  border: 1px solid var(--rule);
  border-radius: 2px;
  background: var(--plate);
  color: var(--chalk);
  font: inherit;
  font-weight: 600;
}

.daypick select:hover { border-color: var(--mist); }

.wait { margin-top: 0.5rem; max-width: 31em; color: var(--mist); }

/* How to play, About, sound: quiet links at the foot of the start screen. */
.footlinks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
  margin-top: 2rem;
}

.textlink {
  min-height: 2.75rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--chalk);
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  cursor: pointer;
}

.textlink:hover { text-decoration-color: var(--chalk); }
.textlink[aria-pressed='false'] { color: var(--mist); }

.footlinks + .credits { margin-top: 1rem; }

/* ---------- How to play, and about ---------- */

.page p { margin-top: 0.75rem; max-width: 34em; }
.page .route + p { margin-top: 1.25rem; font-size: 1.125rem; }

.page h2 {
  margin-top: 2rem;
  font-family: var(--serif);
  font-weight: 400;
  font-style: italic;
  font-size: 1.5rem;
  line-height: 1.2;
}

.page a { color: inherit; text-underline-offset: 3px; }
.page a:hover { color: var(--gilt); }
.page .button { margin-top: 2.25rem; }

.legend.is-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  max-width: 22rem;
  padding: 0;
  color: var(--chalk);
  font-size: 1rem;
}

.legend.is-list li {
  display: grid;
  grid-template-columns: 1.75rem 1fr auto;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0;
}

.legend.is-list li + li { border-top: 1px solid var(--rule); }
.legend.is-list .lamp { justify-self: center; }
.legend.is-list .range { color: var(--mist); font-variant-numeric: tabular-nums; }

/* ---------- Question ---------- */

.fuse {
  display: flex;
  align-items: center;
  gap: 0.875rem;
}

.fuse-track {
  flex: 1;
  height: 1px;
  background: var(--rule);
}

/* The time left is a rule that shortens. */
.fuse-light {
  display: block;
  width: 100%;
  height: 3px;
  margin-top: -1px;
  background: var(--chalk);
}

.fuse-secs {
  min-width: 1.5em;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.fuse.is-low .fuse-light { height: 5px; margin-top: -2px; background: var(--gilt); }
.fuse.is-low .fuse-secs { color: var(--gilt); animation: tighten 1s ease-in-out infinite; }

@keyframes tighten {
  50% { transform: scale(1.18); }
}

/* Your Europe: how much is lit, said once and large. */
.big-share { display: flex; align-items: baseline; gap: 0.75rem; margin-top: 0.5rem; }
.big-num {
  font-family: var(--serif);
  font-size: clamp(3.5rem, 18vw, 5.5rem);
  line-height: 1;
  color: var(--gilt);
  font-variant-numeric: tabular-nums;
}
.big-label { color: var(--mist); }

.whereabouts {
  margin-top: 1.5rem;
  color: var(--mist);
  font-size: 0.9375rem;
}

.question {
  margin-top: 0.5rem;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2rem, 8.6vw, 2.875rem);
  line-height: 1.08;
  letter-spacing: -0.005em;
  text-wrap: balance;
}

/* The answer is written on a ruled line, not typed into a box. */
.answer-form {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  margin-top: 1.75rem;
}

.answer-form input {
  flex: 1;
  min-width: 0;
  height: 3.25rem;
  padding: 0;
  border: 0;
  border-bottom: 1.5px solid var(--chalk);
  border-radius: 0;
  background: none;
  color: var(--chalk);
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.75rem;
}

.answer-form input::placeholder { color: var(--mist); opacity: 0.75; }
.answer-form input:focus { outline: none; border-bottom: 2.5px solid var(--gilt); }

.hint {
  min-height: 1.5rem;
  margin-top: 0.5rem;
  color: var(--mist);
  font-size: 0.9375rem;
}

/* ---------- Result ---------- */

.asked {
  color: var(--mist);
  font-size: 0.9375rem;
}

.given {
  margin-top: 0.125rem;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(2.75rem, 12.5vw, 4.25rem);
  line-height: 1;
  color: var(--c);
  overflow-wrap: anywhere;
}

.reveal.is-miss .given {
  color: var(--mist);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

.reveal .given { animation: set-down 320ms ease-out both; }

@keyframes set-down {
  from { opacity: 0; transform: translateY(0.2em); }
  to   { opacity: 1; transform: none; }
}

.read-as {
  margin-top: 0.375rem;
  color: var(--mist);
  font-size: 0.9375rem;
}

.verdict {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-top: 1rem;
  font-size: 1.125rem;
  font-weight: 700;
}

.verdict .points {
  font-weight: 400;
  color: var(--mist);
  font-variant-numeric: tabular-nums;
}

.travel { margin-top: 0.625rem; max-width: 31em; }

.context {
  margin-top: 1.125rem;
  max-width: 31em;
  color: var(--mist);
  font-size: 0.875rem;
  opacity: 0.85;
}

.context b { color: var(--chalk); font-weight: 600; }

.reveal .button { margin-top: 1.5rem; }

/* ---------- End of the night ---------- */

.total {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2rem, 8.6vw, 2.875rem);
  line-height: 1.06;
  text-wrap: balance;
}

.total-note { margin-top: 0.875rem; max-width: 32em; color: var(--mist); }

/* The night's answers, set out like a catalogue of stars. */
.recap { margin-top: 1.75rem; border-top: 1px solid var(--rule); }

.recap > li { border-bottom: 1px solid var(--rule); }

/* Each answer is a row that opens into every answer on our list. */
.recap summary {
  display: grid;
  grid-template-columns: 1.75rem 1fr auto;
  align-items: baseline;
  column-gap: 0.5rem;
  padding: 0.75rem 0;
  list-style: none;
  cursor: pointer;
}

.recap summary::-webkit-details-marker { display: none; }
.recap summary:focus-visible { outline: 2px solid var(--gilt); outline-offset: 2px; border-radius: 0.25rem; }

/* A small chevron after the score: down when shut, up when open. */
.recap .worth::after {
  content: '';
  display: inline-block;
  width: 0.4em;
  height: 0.4em;
  margin-left: 0.6em;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-0.2em) rotate(45deg);
  transition: transform 160ms ease;
}

.recap details[open] .worth::after { transform: translateY(0.05em) rotate(-135deg); }

.answers-panel { margin: 0 0 0.875rem 2.25rem; }
.answers-head { margin-bottom: 0.375rem; color: var(--mist); font-size: 0.8125rem; }

.answer-tiers { border-left: 1px solid var(--rule); }

/* One line per tier: its name, then its answers flowing along the line. */
.answer-tier {
  display: grid;
  grid-template-columns: 5.25rem 1fr;
  column-gap: 0.75rem;
  align-items: baseline;
  padding: 0.5rem 0 0.5rem 0.875rem;
}

.answer-tier + .answer-tier { border-top: 1px solid var(--rule); }

.answer-tier-name { color: var(--c); font-size: 0.8125rem; font-weight: 600; }

.answer-words {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.875rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.0625rem;
  line-height: 1.35;
  color: var(--chalk);
}

.answer-score {
  margin-left: 0.2rem;
  color: var(--mist);
  font-family: var(--sans);
  font-style: normal;
  font-size: 0.6875rem;
  vertical-align: 0.35em;
}

/* Your own answer: ringed in its tier's colour. */
.answer-words .is-yours {
  margin: -0.0625rem -0.4rem;
  padding: 0.0625rem 0.4rem;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1.5px var(--c);
  color: var(--c);
  font-weight: 700;
}

.answer-words .is-yours .answer-score { color: var(--c); }

@media (max-width: 26rem) {
  .answer-tier { grid-template-columns: 1fr; row-gap: 0.25rem; }
}

@media (prefers-reduced-motion: reduce) { .recap .worth::after { transition: none; } }

.recap .lamp { align-self: center; justify-self: center; }
.recap .asked { grid-column: 2 / 4; font-size: 0.875rem; }

.recap .said {
  grid-column: 2;
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.625rem;
  line-height: 1.2;
  color: var(--c);
  overflow-wrap: anywhere;
}

.recap .is-missed .said { color: var(--mist); }

.recap .worth {
  grid-column: 3;
  text-align: right;
  white-space: nowrap;
  font-size: 0.875rem;
  color: var(--mist);
}

.actions { display: flex; flex-wrap: wrap; gap: 0.625rem; margin-top: 2rem; }

/* ---------- Your Europe ---------- */

.atlas > .button { margin-top: 1.5rem; }

.facts {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.625rem 1.75rem;
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
}

.facts dt { color: var(--mist); }
.facts dd { margin: 0; font-weight: 600; }

.erase {
  display: block;
  margin-top: 2.5rem;
  padding: 0.5rem 0;
  border: 0;
  background: none;
  color: var(--mist);
  font: inherit;
  font-size: 0.9375rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.erase:hover, .erase.is-armed { color: var(--chalk); }

@media (prefers-reduced-motion: reduce) {
  .fuse.is-low .fuse-secs { animation: none; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Small additions: reports, share, returning-player line. */
.report { display: block; margin-top: 0.5rem; }
.report:disabled { opacity: 0.75; cursor: default; text-decoration: none; }
.player-line { margin-top: 0.75rem; color: var(--gilt); font-size: 0.9375rem; }
.share-note { margin-top: 0.75rem; color: var(--mist); font-size: 0.9375rem; }
.share-box { display: block; width: 100%; margin-top: 0.5rem; padding: 0.5rem; border: 1px solid var(--rule); background: var(--plate); color: var(--chalk); font: inherit; resize: none; }

/* The night as a picture: seven lamps, large. */
.lamps.is-big { height: 2.5rem; gap: 1.5rem; margin-top: 1.25rem; padding-left: 0.5rem; }
.lamps.is-big .lamp { transform: scale(1.9); }
.lamps.is-big .lamp:not(.is-lit):not(.is-miss) { opacity: 0.5; border: 1.5px solid var(--mist); background: none; --size: 0.5rem; }

/* The main button: wide on a phone, so the thumb finds it, with a warm glow. */
.home .button, .night .actions .button:first-child { box-shadow: 0 0 2rem -0.5rem var(--gilt); }
@media (max-width: 59.99rem) {
  .home > .button { width: 100%; }
}

/* ---------- Result: the rarity meter ---------- */
.reveal .asked { margin-bottom: 0.5rem; }
.meter { position: relative; height: 3px; margin-top: 0.875rem; max-width: 20rem; background: var(--rule); }
.meter-fill {
  position: absolute; inset: 0 auto 0 0;
  width: var(--to);
  background: var(--c);
  box-shadow: 0 0 0.75rem var(--c);
  animation: fill-meter 700ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.meter-tick { position: absolute; top: -3px; width: 1px; height: 9px; background: var(--mist); opacity: 0.6; }
.travel b { color: var(--chalk); font-weight: 700; }
@keyframes fill-meter { from { width: 0; } }
@media (prefers-reduced-motion: reduce) { .meter-fill { animation: none; } }

/* ---------- End of the night: three figures ---------- */
.figures { display: flex; gap: 1.5rem; margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--rule); }
.figures > div { flex: 1; min-width: 0; display: grid; align-content: start; text-align: left; }
.figures dd { order: 1; white-space: nowrap; }
.figures dt { order: 2; }
.figures dd { font-family: var(--serif); font-size: clamp(1.5rem, 7vw, 2.5rem); line-height: 1.05; color: var(--chalk); font-variant-numeric: tabular-nums; }
.figures dt { margin-top: 0.25rem; color: var(--mist); font-size: 0.8125rem; line-height: 1.3; }
.figures dd, .figures dt { margin: 0; }
.figures dt { margin-top: 0.25rem; }

/* ---------- Second critique pass ---------- */
.lamps.is-big .lamp.is-miss { width: 0.5rem; height: 0.5rem; border: 1.5px solid var(--mist); border-radius: 50%; background: none; }
.figures .is-main { flex: 1.4; }
.figures .is-main dd { font-size: clamp(2.25rem, 11vw, 3.5rem); color: var(--gilt); }
.best-line { margin-top: 1rem; color: var(--mist); font-size: 0.9375rem; }
.fuse-light { height: 4px; margin-top: -1px; }
.fuse.is-low .fuse-light { height: 6px; margin-top: -2px; }
.report { min-height: 2.75rem; padding: 0.75rem 0; margin-top: 0; }

/* Tablets and narrow desktop windows: one column, but wider, with a bigger map. */
@media (min-width: 34rem) and (max-width: 59.99rem) {
  .shell { max-width: 46rem; }
  .stage { height: 58dvh; }
  .shell[data-screen='reveal'] .stage { height: 52dvh; }
  .stage::after {
    background:
      linear-gradient(to bottom, var(--night), transparent 8%, transparent 88%, var(--night)),
      linear-gradient(to right, var(--night), transparent 14%, transparent 86%, var(--night));
  }
}
/* A missed answer is a dim dot; an empty ring means not asked yet. */
.lamps.is-big .lamp.is-miss { width: 0.4rem; height: 0.4rem; border: 0; background: var(--mist); opacity: 0.45; }
/* The three figures share a baseline for their labels. */
.figures { align-items: flex-end; }
.design-icon svg { width: 1.25rem; height: 1.25rem; }

/* ---------- The question: a card floating over the whole map ---------- */
/* The map fills the window; the bar floats along the top; the question sits
   in a card at the top (phone) or top right (wide screen), so a phone
   keyboard never covers it. Same layout as the new design, classic colours. */

.shell[data-screen='question'] .stage,
.shell[data-screen='reveal'] .stage {
  position: fixed;
  inset: 0;
  z-index: 0;
  height: auto;
  margin: 0;
}

.shell[data-screen='question'] .stage::after,
.shell[data-screen='reveal'] .stage::after { background: none; }

.shell[data-screen='question'] .bar,
.shell[data-screen='reveal'] .bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  max-width: none;
  min-height: 3.5rem;
  margin: 0;
  padding: max(0.625rem, env(safe-area-inset-top)) 1rem 0.5rem;
  background: linear-gradient(to bottom, rgba(7, 10, 19, 0.85), rgba(7, 10, 19, 0));
}

.shell[data-screen='question'] .panel,
.shell[data-screen='reveal'] .panel {
  position: fixed;
  z-index: 10;
  top: calc(max(0.625rem, env(safe-area-inset-top)) + 3.5rem);
  left: 0.625rem;
  right: 0.625rem;
  padding: 1.25rem 1.25rem 1rem;
  border: 1px solid var(--rule);
  border-radius: 1.5rem;
  background: rgba(21, 28, 47, 0.94);
  box-shadow: 0 1.5rem 3rem -1rem rgba(0, 0, 0, 0.7);
}

/* The result: on a phone the card sits at the bottom, so the light you just
   lit stays in view above it. */
.shell[data-screen='reveal'] .panel {
  top: auto;
  bottom: max(0.625rem, env(safe-area-inset-bottom));
  max-height: 60dvh;
  overflow-y: auto;
}

.shell[data-screen='reveal'] .reveal .button { width: 100%; margin-top: 1.25rem; }
.shell[data-screen='reveal'] .given { font-size: clamp(2.25rem, 10vw, 3.25rem); }
.shell[data-screen='reveal'] .meter { max-width: none; }

@media (min-width: 60rem) {
  .shell[data-screen='question'] .bar,
  .shell[data-screen='reveal'] .bar { padding: 1.25rem 1.5rem 0.5rem; }

  .shell[data-screen='question'] .panel,
  .shell[data-screen='reveal'] .panel {
    top: 5rem;
    bottom: auto;
    max-height: calc(100dvh - 6.5rem);
    left: auto;
    right: 1.5rem;
    width: 27rem;
    padding: 1.75rem 1.75rem 1.25rem;
  }
}

/* The time left: a thick rounded bar, the seconds in a circle. */
.shell[data-screen='question'] .fuse-track {
  height: 0.5rem;
  border-radius: 999px;
  background: var(--plate);
  box-shadow: inset 0 0 0 1px var(--rule);
  overflow: hidden;
}

.shell[data-screen='question'] .fuse-light,
.shell[data-screen='question'] .fuse.is-low .fuse-light {
  height: 100%;
  margin: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--fuse), var(--gilt));
}

.shell[data-screen='question'] .fuse.is-low .fuse-light { background: var(--fuse); }

.shell[data-screen='question'] .fuse-secs {
  display: grid;
  place-items: center;
  min-width: 0;
  width: 2.375rem;
  height: 2.375rem;
  border-radius: 50%;
  background: var(--chalk);
  color: var(--night);
  font-size: 0.9375rem;
}

.shell[data-screen='question'] .fuse.is-low .fuse-secs { background: var(--gilt); color: var(--night); }

.shell[data-screen='question'] .whereabouts { margin-top: 0.875rem; font-size: 0.875rem; }

.shell[data-screen='question'] .question { margin-top: 0.25rem; font-size: clamp(1.625rem, 6.6vw, 2rem); line-height: 1.1; }

/* A rounded field and a round arrow button. */
.shell[data-screen='question'] .answer-form { align-items: center; gap: 0.5rem; margin-top: 1rem; }

.shell[data-screen='question'] .answer-form input {
  height: 3.25rem;
  padding: 0 1.125rem;
  border: 1.5px solid var(--rule);
  border-radius: 999px;
  background: var(--night);
  font-size: 1.25rem;
}

.shell[data-screen='question'] .answer-form input:focus { border: 1.5px solid var(--gilt); }

.send {
  display: grid;
  place-items: center;
  flex: none;
  width: 3.25rem;
  height: 3.25rem;
  border: 0;
  border-radius: 50%;
  background: var(--gilt);
  color: var(--night);
  cursor: pointer;
  transition: background 150ms ease;
}

.send:hover { background: var(--gilt-hi); }
.send svg { width: 1.375rem; height: 1.375rem; }

.shell[data-screen='question'] .hint { margin-top: 0.25rem; min-height: 1.25rem; font-size: 0.875rem; }

/* A wrong try: the answer box gives a small shake. */
.answer-form.is-wrong { animation: shake 320ms ease-in-out; }

@keyframes shake {
  20% { transform: translateX(-6px); }
  45% { transform: translateX(5px); }
  70% { transform: translateX(-3px); }
}

@media (prefers-reduced-motion: reduce) { .answer-form.is-wrong { animation: none; } }

/* ---------- Phone fixes (Ivan's phone test, 2026-11-18) ---------- */

/* Start screen: the line, the seven rings and the button sit together as one
   group instead of floating apart. The rings are smaller and sit flush left. */
.home .lede + .lamps.is-big { margin-top: 0.875rem; }
.home .lamps.is-big { height: 1.75rem; gap: 1.125rem; padding-left: 0.35rem; }
.home .lamps.is-big .lamp { transform: scale(1.5); }
.home .lamps.is-big + .player-line { margin-top: 0.5rem; }
.home > .button { margin-top: 1.25rem; }

/* The result card on a phone: compact, so the lit route stays in view above it. */
@media (max-width: 59.99rem) {
  .shell[data-screen='reveal'] .panel { padding: 1rem 1.125rem 0.875rem; max-height: 46dvh; }
  .shell[data-screen='reveal'] .asked { font-size: 0.875rem; line-height: 1.35; }
  .shell[data-screen='reveal'] .given { margin-top: 0.125rem; font-size: clamp(1.875rem, 8.5vw, 2.375rem); }
  .shell[data-screen='reveal'] .read-as { font-size: 0.8125rem; }
  .shell[data-screen='reveal'] .verdict { margin-top: 0.5rem; font-size: 1rem; }
  .shell[data-screen='reveal'] .meter { margin-top: 0.5rem; }
  .shell[data-screen='reveal'] .travel { margin-top: 0.5rem; font-size: 0.9375rem; line-height: 1.4; }
  .shell[data-screen='reveal'] .context { margin-top: 0.25rem; font-size: 0.8125rem; line-height: 1.4; }
  .shell[data-screen='reveal'] .reveal .button { min-height: 2.875rem; margin-top: 0.75rem; }
}

/* Phones: the map runs edge to edge. Its box has Europe's own shape (about
   1.1 times as tall as wide), so all of Europe fills the full width with no
   empty night at the sides, and the sides no longer fade into the page. */
@media (max-width: 33.99rem) {
  .stage,
  .shell[data-screen='atlas'] .stage,
  .shell[data-screen='home'] .stage,
  .shell[data-screen='night'] .stage { height: min(110vw, 70dvh); margin-top: 0; }

  .stage::after { background: linear-gradient(to bottom, var(--night), transparent 6%, transparent 86%, var(--night)); }
}

/* Wide screens: the map column has Europe's own shape (as tall as the window,
   0.91 as wide), so Europe fills it with no empty night inside, and the text
   sits right beside it. The pair is centred in the window, so any spare width
   becomes even margins at the outer edges, not a gap between map and text. */
@media (min-width: 60rem) {
  .shell {
    grid-template-columns: min(calc(100dvh * 0.91), calc(100vw - 30rem)) minmax(26rem, 36rem);
    justify-content: center;
    column-gap: 1rem;
  }

  .stage::after {
    background:
      linear-gradient(to bottom, var(--night), transparent 5%, transparent 95%, var(--night)),
      linear-gradient(to right, var(--night), transparent 4%, transparent 96%, var(--night));
  }
}


/* ---------- The map is the page ---------- */
/* (2026-11-18: map on one side and text on the other looked like a slide.)
   On the start screen, the end of the night, Your Europe and the info pages
   the map fills the window and the text is written straight onto the night,
   with no box: lower left on a wide screen, along the bottom on a phone. The
   map darkens smoothly towards the text so it stays readable, and the camera
   keeps Europe and the route in the open part. */

.shell[data-screen='home'],
.shell[data-screen='night'],
.shell[data-screen='atlas'],
.shell[data-screen='rules'],
.shell[data-screen='about'] { height: 100dvh; overflow: hidden; }

.shell[data-screen='home'] .stage,
.shell[data-screen='night'] .stage,
.shell[data-screen='atlas'] .stage,
.shell[data-screen='rules'] .stage,
.shell[data-screen='about'] .stage {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 0;
  width: auto;
  height: auto;
  margin: 0;
}

/* The night deepens towards the text: from the bottom on a phone. */
.shell[data-screen='home'] .stage::after,
.shell[data-screen='night'] .stage::after,
.shell[data-screen='atlas'] .stage::after,
.shell[data-screen='rules'] .stage::after,
.shell[data-screen='about'] .stage::after {
  background: linear-gradient(to top, rgba(7, 10, 19, 0.97) 0%, rgba(7, 10, 19, 0.9) 40%, rgba(7, 10, 19, 0) 62%);
}

.shell[data-screen='home'] .bar,
.shell[data-screen='night'] .bar,
.shell[data-screen='atlas'] .bar,
.shell[data-screen='rules'] .bar,
.shell[data-screen='about'] .bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  max-width: none;
  margin: 0;
  padding: max(0.625rem, env(safe-area-inset-top)) var(--gutter) 0.5rem;
  background: linear-gradient(to bottom, rgba(7, 10, 19, 0.8), rgba(7, 10, 19, 0));
}

.shell[data-screen='home'] .panel,
.shell[data-screen='night'] .panel,
.shell[data-screen='atlas'] .panel,
.shell[data-screen='rules'] .panel,
.shell[data-screen='about'] .panel {
  position: fixed;
  z-index: 10;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 60dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0.5rem var(--gutter) max(1.5rem, env(safe-area-inset-bottom));
}

.shell[data-screen='rules'] .panel,
.shell[data-screen='about'] .panel,
.shell[data-screen='night'] .panel { max-height: 64dvh; }

.shell[data-screen='home'] .panel .route { font-size: clamp(2.25rem, 10vw, 3.5rem); }

@media (min-width: 60rem) {
  /* Wide screens: the text runs down the left over the darkened night. */
  .shell[data-screen='home'] .stage::after,
  .shell[data-screen='night'] .stage::after,
  .shell[data-screen='atlas'] .stage::after,
  .shell[data-screen='rules'] .stage::after,
  .shell[data-screen='about'] .stage::after {
    background: linear-gradient(to right, rgba(7, 10, 19, 0.96) 0, rgba(7, 10, 19, 0.88) 30rem, rgba(7, 10, 19, 0) 46rem);
  }

  .shell[data-screen='home'] .bar,
  .shell[data-screen='night'] .bar,
  .shell[data-screen='atlas'] .bar,
  .shell[data-screen='rules'] .bar,
  .shell[data-screen='about'] .bar { padding: 1.75rem 3.5rem 0.5rem; }

  .shell[data-screen='home'] .panel,
  .shell[data-screen='night'] .panel,
  .shell[data-screen='atlas'] .panel,
  .shell[data-screen='rules'] .panel,
  .shell[data-screen='about'] .panel {
    top: 0;
    right: auto;
    width: 36rem;
    max-height: none;
    display: flex;
    flex-direction: column;
    padding: 6rem 3.5rem 3rem;
  }

  /* The start screen's text sits low, like a title over an opening shot. */
  .shell[data-screen='home'] .panel > .home { margin-top: auto; }
}

/* The start screen: tonight's crossing low on the left, and everything else
   in one quiet strip along the foot of the window. */
.homefoot { margin-top: 1.75rem; padding-top: 1rem; border-top: 1px solid var(--rule); font-size: 0.875rem; }
.homefoot .daypick { margin-top: 0; }
.homefoot .footlinks { margin-top: 0.75rem; }

@media (min-width: 60rem) {
  .shell[data-screen='home'] .panel { width: 34rem; padding-bottom: 6.5rem; }

  .homefoot {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 15;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 1.5rem;
    margin: 0;
    padding: 0.75rem 3.5rem 1rem;
    border-top: 0;
    background: linear-gradient(to top, rgba(7, 10, 19, 0.92), rgba(7, 10, 19, 0));
    color: var(--mist);
  }

  .homefoot .daypick { display: flex; align-items: center; gap: 0.625rem; }
  .homefoot .daypick label { margin: 0; }
  .homefoot .daypick select { min-height: 2.25rem; }
  .homefoot .note { margin: 0; font-size: 0.8125rem; }
  .homefoot .footlinks { margin: 0 0 0 auto; gap: 1.25rem; }
  .homefoot .footlinks .textlink { font-size: 0.875rem; }
  .homefoot .credits { flex-basis: 100%; margin: 0; font-size: 0.75rem; }
}

/* Phones: the start screen's text takes under half the screen, so the map
   keeps the top half; the rest scrolls inside the text area. */
@media (max-width: 59.99rem) {
  .shell[data-screen='home'] .panel { max-height: 47dvh; }
  .shell[data-screen='home'] .panel .route { margin-top: 0.25rem; }
}

/* Text that scrolls up over the map fades out at the top of its area instead
   of being cut off in a hard line. The area starts with some room, so nothing
   is faded until you scroll. */
.shell[data-screen='home'] .panel,
.shell[data-screen='night'] .panel,
.shell[data-screen='atlas'] .panel,
.shell[data-screen='rules'] .panel,
.shell[data-screen='about'] .panel {
  padding-top: 2.5rem;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 2.5rem);
  mask-image: linear-gradient(to bottom, transparent 0, #000 2.5rem);
}

@media (min-width: 60rem) {
  .shell[data-screen='home'] .panel,
  .shell[data-screen='night'] .panel,
  .shell[data-screen='atlas'] .panel,
  .shell[data-screen='rules'] .panel,
  .shell[data-screen='about'] .panel {
    padding-top: 6rem;
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, transparent 3.5rem, #000 6rem);
    mask-image: linear-gradient(to bottom, transparent 0, transparent 3.5rem, #000 6rem);
  }
}

/* Counting up: the score and the places lit rise with the light, then land
   with a small pop. */
.is-landed { display: inline-block; animation: landed 420ms cubic-bezier(0.2, 0.9, 0.3, 1.3); }
@keyframes landed { 40% { transform: scale(1.3); } }
@media (prefers-reduced-motion: reduce) { .is-landed { animation: none; } }
.meter-fill.is-driven { animation: none; }
.verdict .points .count, .travel b { font-variant-numeric: tabular-nums; }
