/* Lanternhold. Chunky rounded panels with thick dark outlines and big numbers
   (DESIGN.md, art direction). */

:root {
  --ink: #2b1d3f;
  --cream: #f6ecd2;
  --cobalt: #2f5fd0;
  --gold: #ffc62e;
  --sky: #9fd8f5;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* The page is exactly the visible screen: 100dvh, never the screen's full height (on
   Android that pushed the farm's buttons under the navigation bar). */
html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--sky);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* Clip, not hidden: a hidden box can still be scrolled by focus or a sliding panel. */
#app { position: fixed; inset: 0; overflow: hidden; overflow: clip; }

button { font: inherit; color: inherit; touch-action: manipulation; }

#world {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

/* The layer over the world. It lets touches through to the world except on its own
   buttons and panels, and keeps them inside the safe areas. */
.hud {
  position: absolute;
  inset: 0;
  padding: max(8px, var(--safe-top)) max(10px, var(--safe-right)) max(8px, var(--safe-bottom)) max(10px, var(--safe-left));
  pointer-events: none;
}
.hud > * { pointer-events: auto; }

/* The floating joystick: a soft ring under the thumb and a chunky knob that follows it.
   Placed by transform at the thumb; its own size is the stick's reach (stick.js). */
.stick {
  --reach: 54px;
  position: absolute;
  left: 0;
  top: 0;
  width: calc(var(--reach) * 2 + 16px);
  height: calc(var(--reach) * 2 + 16px);
  margin: calc(var(--reach) * -1 - 8px) 0 0 calc(var(--reach) * -1 - 8px);
  border: 4px solid rgba(43, 29, 63, 0.55);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(246, 236, 210, 0.18) 0 55%, rgba(246, 236, 210, 0.42) 56% 100%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s ease-out;
  will-change: transform;
}
.stick.on { opacity: 1; transition: none; }
.stick-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 54px;
  height: 54px;
  margin: -27px 0 0 -27px;
  border: 4px solid var(--ink);
  border-radius: 50%;
  background: radial-gradient(circle at 38% 34%, #fffaf0 0 18%, var(--cream) 19% 62%, #e3d3ad 63% 100%);
  box-shadow: 0 4px 0 rgba(43, 29, 63, 0.55);
  will-change: transform;
}

.trouble {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(92vw, 420px);
  padding: 18px 20px;
  border: 4px solid var(--ink);
  border-radius: 18px;
  background: var(--cream);
  text-align: center;
  box-shadow: 0 6px 0 var(--ink);
}
.trouble[hidden] { display: none; }
.trouble-head { margin: 0 0 8px; font-size: 22px; font-weight: 800; }
.trouble-error { margin: 0 0 14px; font-family: ui-monospace, monospace; font-size: 13px; word-break: break-word; }
.trouble-again {
  padding: 10px 22px;
  border: 3px solid var(--ink);
  border-radius: 14px;
  background: var(--gold);
  font-weight: 800;
  font-size: 18px;
  box-shadow: 0 4px 0 var(--ink);
}

/* The Keep's health over the Keep, once it's been hit (hud/keepbar.js). Placed by
   transform at the point over the Great Lantern; its middle sits on that point. */
.keep-bar {
  position: absolute;
  left: 0;
  top: 0;
  width: 76px;
  height: 14px;
  margin: -7px 0 0 -38px;
  border: 3px solid var(--ink);
  border-radius: 8px;
  background: #5a3a4a;
  box-shadow: 0 2px 0 rgba(43, 29, 63, 0.35);
  overflow: hidden;
  pointer-events: none;
  will-change: transform;
}
.keep-bar[hidden] { display: none; }
.keep-bar-fill {
  height: 100%;
  width: 100%;
  border-radius: 4px 0 0 4px;
  background: linear-gradient(#8ff07a, #43c24a);
  transition: width 0.15s ease-out;
}
.keep-bar[data-low="1"] .keep-bar-fill { background: linear-gradient(#ff9a7a, #e8433a); }

/* A boss's health over its head (Task 30, hud/bossbar.js): its name over a long red bar.
   Placed by transform at the point over its horns; held at the screen's edge when it's
   off the screen, pointing the way to it. As wide as its name, 124 px at least (Task 77: on
   Linux fonts "The Mire Mother" spilled out of 124 px to the right, cut at the screen's
   edge); centred by its transform. */
.boss-bar {
  position: absolute;
  left: 0;
  top: 0;
  width: max-content;
  min-width: 124px;
  margin: -30px 0 0 0;
  text-align: center;
  pointer-events: none;
  will-change: transform;
}
.boss-bar[hidden] { display: none; }
.boss-bar-name {
  font-size: 15px;
  font-weight: 900;
  line-height: 1.1;
  color: #ffb04a;
  -webkit-text-stroke: 4px var(--ink);
  paint-order: stroke fill;
  white-space: nowrap;
}
.boss-bar-track {
  height: 16px;
  margin-top: 1px;
  border: 3px solid var(--ink);
  border-radius: 9px;
  background: #2b1d3f;
  box-shadow: 0 2px 0 rgba(43, 29, 63, 0.35);
  overflow: hidden;
}
.boss-bar-fill {
  height: 100%;
  width: 100%;
  border-radius: 5px 0 0 5px;
  background: linear-gradient(#ff8a6a, #d8343a);
  transition: width 0.15s ease-out;
}
.boss-bar[data-edge="1"] { opacity: 0.85; }
/* The Keep's, a boss's and a lair's bars see-through over a tower or building a tap there
   picks (Task 127, hud/clearof.js), as tonight's markers are. */
.keep-bar, .boss-bar, .lair-bar { transition: opacity 0.2s ease-out; }
.keep-bar.over-building, .boss-bar.over-building, .lair-bar.over-building { opacity: 0.3; }

/* A wounded Murk lair's health over it (Task 44b, hud/lairbar.js): the boss's red, shorter
   and thinner, with no name. */
.lair-bar {
  position: absolute;
  left: 0;
  top: 0;
  width: 76px;
  margin: -8px 0 0 -38px;
  pointer-events: none;
  will-change: transform;
}
.lair-bar[hidden] { display: none; }
.lair-bar-track {
  height: 12px;
  border: 3px solid var(--ink);
  border-radius: 7px;
  background: #2b1d3f;
  box-shadow: 0 2px 0 rgba(43, 29, 63, 0.35);
  overflow: hidden;
}
.lair-bar-fill {
  height: 100%;
  width: 100%;
  border-radius: 4px 0 0 4px;
  background: linear-gradient(#ff8a6a, #d8343a);
  transition: width 0.15s ease-out;
}

/* The coin counter, top left (hud/coins.js): a chunky cream panel with a thick dark
   outline, the coin, and a big number. It's not a button, so touches pass through it. */
/* The top row (main.js): the coins left, the night chip in the middle, and on the right
   room for build view's done button. */
.topbar {
  position: absolute;
  left: max(10px, var(--safe-left));
  right: max(10px, var(--safe-right));
  top: max(8px, var(--safe-top));
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: 6px;
  pointer-events: none;
}
.building .topbar { grid-template-columns: 1fr auto minmax(54px, 1fr); }
.topbar > * { pointer-events: none; }

.coins {
  justify-self: start;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 14px 0 5px;
  border: 3px solid var(--ink);
  border-radius: 20px;
  background: var(--cream);
  box-shadow: 0 3px 0 rgba(43, 29, 63, 0.35);
  pointer-events: none;
}
.coins-icon { display: block; width: 32px; height: 32px; }
.coins-icon svg, .coins-icon img { display: block; width: 100%; height: 100%; }
.coins-count {
  display: inline-block;
  min-width: 1.4em;
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  transform-origin: 30% 55%;
}

/* The Sparks (Task 28), in the coins' panel from the night the Brutes first come: a blue
   shard and how many, a little smaller than the coins, after a thin divider. */
.sparks { display: flex; align-items: center; gap: 3px; margin-left: 4px; padding-left: 8px; border-left: 2px solid rgba(43, 29, 63, 0.25); }
.sparks[hidden] { display: none; }
.sparks-icon { display: block; width: 26px; height: 26px; }
.sparks-icon svg, .sparks-icon img { display: block; width: 100%; height: 100%; }
.sparks-count { display: inline-block; min-width: 0.8em; font-size: 19px; font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; color: #1f6fb0; transform-origin: 30% 55%; }

/* The night chip, top middle (hud/nightbar.js): the coming night, what it holds and the
   Start button with the horn by day (the night begins when it's tapped); the night and
   the Murk left by night. */
.night {
  grid-column: 2;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 4px 0 6px;
  border: 3px solid var(--ink);
  border-radius: 20px;
  background: var(--cream);
  box-shadow: 0 3px 0 rgba(43, 29, 63, 0.35);
  color: var(--ink);
  white-space: nowrap;
  pointer-events: none;
}
.night[data-phase="night"] { background: #2f3a6e; color: #f6ecd2; padding-right: 14px; }
.night-icon { display: block; width: 26px; height: 26px; }
.night-icon svg { display: block; width: 100%; height: 100%; }
.night-label { font-size: 16px; font-weight: 900; letter-spacing: 0.01em; }
/* The night's name and the Murk kept apart by a short rule (Task 120: in a level "Night 1 of 3
   8 Murk" read as "of 38"). Not after "Won ★★★", which has no count. */
.night-label::after { content: ''; display: inline-block; width: 2px; height: 0.85em; margin-left: 8px; border-radius: 1px; background: currentColor; opacity: 0.3; vertical-align: -0.08em; }
.night[data-won] .night-label::after { display: none; }
.night-count { min-width: 2.3em; font-size: 15px; font-weight: 900; font-variant-numeric: tabular-nums; }
.horn {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 46px;
  margin: -6px -6px -6px 2px;
  padding: 0 13px 0 4px;
  border: 3px solid var(--ink);
  border-radius: 23px;
  background: #ffd36b;
  box-shadow: 0 4px 0 rgba(43, 29, 63, 0.4);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  font-weight: 900;
  pointer-events: auto;
  cursor: pointer;
}
.horn[hidden] { display: none; }
.horn-icon { display: block; width: 34px; height: 34px; }
.horn-icon svg, .horn-icon img { display: block; width: 100%; height: 100%; }
.horn:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(43, 29, 63, 0.4); }
/* Fast-forward (Task 33, hud/speed.js): by night, where Start stands by day, a button
   going 1x, 2x, 3x; cream at 1x, gold while the night runs fast. */
.speed {
  display: flex;
  align-items: center;
  gap: 1px;
  height: 40px;
  margin: -5px -11px -5px 2px;
  padding: 0 11px 0 5px;
  border: 3px solid var(--ink);
  border-radius: 20px;
  background: var(--cream);
  box-shadow: 0 3px 0 rgba(43, 29, 63, 0.4);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  pointer-events: auto;
  cursor: pointer;
}
.speed[hidden] { display: none; }
.speed.fast { background: #ffd36b; }
.speed-icon { display: block; width: 26px; height: 26px; }
.speed-icon svg { display: block; width: 100%; height: 100%; }
.speed:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(43, 29, 63, 0.4); }
/* Calling the dawn (Task 118, hud/nightbar.js): by night, once only the night's last few have
   been left a while, a gold Dawn with the sun before the speed button; it pops in. */
.call-dawn {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 40px;
  margin: -5px 0 -5px 2px;
  padding: 0 11px 0 4px;
  border: 3px solid var(--ink);
  border-radius: 20px;
  background: #ffd36b;
  box-shadow: 0 3px 0 rgba(43, 29, 63, 0.4);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  font-weight: 900;
  pointer-events: auto;
  cursor: pointer;
  animation: call-dawn-in 0.35s ease-out;
}
.call-dawn[hidden] { display: none; }
.call-dawn-icon { display: block; width: 26px; height: 26px; }
.call-dawn-icon svg { display: block; width: 100%; height: 100%; }
.call-dawn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(43, 29, 63, 0.4); }
@keyframes call-dawn-in { from { transform: scale(0.6); opacity: 0; } to { transform: none; opacity: 1; } }
/* The Night Bell (Task 115d-3, hud/nightbell.js): once lit, by day a round bell before Start, its
   switch: cream with a pale bell off, Clockwork green with a gold bell on. Its last 10 s it swings
   and counts them beside it. */
.night-bell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1px;
  min-width: 40px;
  height: 40px;
  margin: -5px 0 -5px 2px;
  padding: 0 4px;
  border: 3px solid var(--ink);
  border-radius: 20px;
  background: var(--cream);
  box-shadow: 0 3px 0 rgba(43, 29, 63, 0.4);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  pointer-events: auto;
  cursor: pointer;
}
.night-bell[hidden] { display: none; }
.night-bell-icon { display: block; width: 26px; height: 26px; opacity: 0.45; filter: grayscale(0.85); }
.night-bell-icon svg { display: block; width: 100%; height: 100%; }
.night-bell.on { background: #43d1a7; }
.night-bell.on .night-bell-icon { opacity: 1; filter: none; }
.night-bell-n[hidden] { display: none; }
.night-bell.counting { padding-right: 10px; background: #ffd36b; animation: bell-glow 1s ease-in-out infinite; }
.night-bell.counting .night-bell-icon { transform-origin: 50% 12%; animation: bell-swing 0.5s ease-in-out infinite alternate; }
.night-bell:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(43, 29, 63, 0.4); }
@keyframes bell-swing { from { transform: rotate(-16deg); } to { transform: rotate(16deg); } }
@keyframes bell-glow { 0%, 100% { box-shadow: 0 3px 0 rgba(43, 29, 63, 0.4), 0 0 0 0 rgba(67, 209, 167, 0.9); } 50% { box-shadow: 0 3px 0 rgba(43, 29, 63, 0.4), 0 0 0 9px rgba(67, 209, 167, 0); } }
/* A long day: the Start button glows (a nudge, never a timer). */
.horn.nudge { animation: horn-nudge 1.4s ease-in-out infinite; }
@keyframes horn-nudge { 0%, 100% { box-shadow: 0 4px 0 rgba(43, 29, 63, 0.4), 0 0 0 0 rgba(255, 211, 107, 0.95); } 50% { transform: scale(1.07); box-shadow: 0 4px 0 rgba(43, 29, 63, 0.4), 0 0 0 12px rgba(255, 211, 107, 0); } }

/* Tonight's sides (render/nightmarks.js): a Murk's face and the count over each marker,
   held at the screen's edge when the marker is out of view. */
.night-mark {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  align-items: center;
  gap: 3px;
  height: 32px;
  margin: -16px 0 0 -30px;
  padding: 0 10px 0 3px;
  border: 3px solid var(--ink);
  border-radius: 16px;
  background: #8a5ce0;
  color: #fff;
  box-shadow: 0 3px 0 rgba(43, 29, 63, 0.35);
  pointer-events: none;
  transition: opacity 0.2s ease-out;
}
/* Over a tower or building a tap there picks (Task 127, hud/clearof.js; Devin's note 19), a
   chip and its tag go see-through, so the tower shows; a touch passes through them anyway. */
.night-mark.over-building { opacity: 0.3; }
/* A chip the banner would cover fades out for the banner's moment, and back after. */
.night-mark.under-banner { opacity: 0; }
/* Upright on a phone the night chip keeps, by day, the sun and Start (the markers show what
   comes, the dusk banner which night), by night the moon and the Murk left (the banner
   named the night), and in build view only the sun and the horn, so it never meets the
   coins. With a big bank (Devin, 11 November: "over 10k coins it squashes the other text
   on the top") the chip keeps only Start by day and the Murk left (and the boon) by night,
   its colour saying which, and the coins' panel is a little smaller: 99.9k coins and 999
   Sparks still fit beside it on a 360 px phone. */
@media (max-width: 480px) {
  .night[data-phase="day"] .night-label, .night[data-phase="day"] .night-count, .night[data-phase="night"] .night-label { display: none; }
  .topbar:has(.coins.with-sparks) .night .night-icon { display: none; }
  .topbar:has(.coins.with-sparks) .night[data-phase="day"] { padding-left: 4px; }
  .coins { gap: 4px; padding-right: 10px; }
  .coins-icon { width: 28px; height: 28px; }
  .coins-count { font-size: 19px; }
  .sparks { padding-left: 6px; }
  .sparks-icon { width: 22px; height: 22px; }
  .sparks-count { font-size: 16px; }
  .building .night-label, .building .night-count, .building .horn-text { display: none; }
  .building .horn { padding: 0 4px; }
  /* While the Night Bell counts its last seconds (Task 115d-3), Start its horn alone: with 99.9k
     coins and 999 Sparks on a 360 px phone the chip ran 4 px off the screen. */
  .night:has(.night-bell.counting) .horn-text { display: none; }
  .night:has(.night-bell.counting) .horn { padding: 0 4px; }
  /* By night with the Sparks shown, the fullest chip (the Murk left, the boon and the speed
     button, Task 33): the speed button its text only and the boon a little smaller, so 99.9k
     coins and 999 Sparks still fit beside it. */
  .topbar:has(.coins.with-sparks) .night[data-phase="night"] .speed-icon { display: none; }
  .topbar:has(.coins.with-sparks) .night[data-phase="night"] .speed { padding: 0 11px 0 10px; }
  .topbar:has(.coins.with-sparks) .night[data-phase="night"] .night-boon { width: 22px; height: 22px; }
  /* A campaign level won (Task 116a): its "Won" and stars kept upright too (no Start beside them). */
  .night[data-won] .night-label { display: inline; }
  /* Dawn (Task 118) the sun alone upright, so the fullest chip still fits beside the coins. */
  .call-dawn-text { display: none; }
  .call-dawn { padding: 0 5px; }
  /* And while Dawn shows (Task 124), the Murk left as the number alone and only as wide as it
     (the last few are few): on a wider font (the test pod's) the fullest chip ran past an
     upright phone's edge. */
  .night:has(.call-dawn:not([hidden])) .night-count-word { display: none; }
  .night:has(.call-dawn:not([hidden])) .night-count { min-width: 0; }
}
/* And on the narrowest phones (360 px) the Murk left as the number alone, in the night's blue. */
@media (max-width: 380px) {
  .topbar:has(.coins.with-sparks) .night[data-phase="night"] .night-count-word { display: none; }
}
.night-mark-arrow { display: none; position: absolute; left: 50%; top: 50%; width: 0; height: 0; border-top: 8px solid transparent; border-bottom: 8px solid transparent; border-left: 12px solid var(--ink); }
.night-mark.held .night-mark-arrow { display: block; }
.night-mark-face { display: block; width: 24px; height: 24px; }
.night-mark-face svg { display: block; width: 100%; height: 100%; }
.night-mark-count { font-size: 16px; font-weight: 900; font-variant-numeric: tabular-nums; }
/* A side bringing Brutes (Task 28): a small dark tag hanging under its chip. */
.night-mark-brute { position: absolute; left: 50%; top: 100%; margin-top: 1px; transform: translateX(-50%); width: max-content; max-width: min(270px, calc(100vw - 24px)); padding: 1px 7px 2px; border: 2px solid var(--ink); border-radius: 9px; background: #2b1d3f; color: #ffb04a; font-size: 12px; font-weight: 900; line-height: 1.1; text-align: center; }
/* Each kind whole: a tag wider than 270 px (or the screen) wraps between them (Task 61:
   era 3's "+5 Brutes · 19 Scuttlers · 3 Shieldbacks · 3 Ram crews · Old Gnash" ran off an
   upright phone, and four side by side could not keep apart in landscape). */
.night-mark-brute > span { white-space: nowrap; }
.night-mark-brute[hidden] { display: none; }
/* Five parts or more (Task 77: era 4's "+8 Brutes · 33 Scuttlers · 5 Shieldbacks · 5 Ram crews
   · 17 Flappers"): a little smaller and tighter. */
.night-mark-brute[data-long="1"] { font-size: 11px; line-height: 1.05; padding: 1px 6px; }
/* The side a boss comes with (Task 30): its tag in the boss's red. */
.night-mark-brute[data-boss="1"] { background: #7a2238; color: #ffd27a; }

/* Anything in the HUD told to hide, hides, whatever else styles it. */
.hud [hidden] { display: none !important; }

/* Build view (hud/buildbar.js). Chunky round cream buttons with thick dark outlines. */
.hammer, .build-done, .ghost-actions button {
  position: absolute;
  display: grid;
  place-items: center;
  padding: 0;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: var(--cream);
  box-shadow: 0 4px 0 rgba(43, 29, 63, 0.4);
  cursor: pointer;
}
.hammer svg, .hammer img, .build-done svg, .ghost-actions svg { display: block; width: 70%; height: 70%; }
.hammer:active, .build-done:active, .ghost-actions button:active, .build-item:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(43, 29, 63, 0.4); }

/* The hammer, bottom right in walk view, where the right thumb rests. */
.hammer {
  right: max(14px, var(--safe-right));
  bottom: max(14px, var(--safe-bottom));
  width: 66px;
  height: 66px;
  background: #ffd36b;
}

/* Done: back to walking, top right. */
.build-done {
  right: max(10px, var(--safe-right));
  top: max(8px, var(--safe-top));
  width: 48px;
  height: 48px;
}
/* Undo (Task 107): beside Done, while there's something to undo by day. */
.build-undo {
  position: absolute;
  display: grid;
  place-items: center;
  right: calc(max(10px, var(--safe-right)) + 56px);
  top: max(8px, var(--safe-top));
  width: 48px;
  height: 48px;
  padding: 0;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: var(--cream);
  box-shadow: 0 4px 0 rgba(43, 29, 63, 0.4);
  cursor: pointer;
}
.build-undo svg, .build-undo img { display: block; width: 70%; height: 70%; }
.build-undo:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(43, 29, 63, 0.4); }

/* The bar along the bottom: what can be built, and Remove. Touches between its buttons
   reach the world. */
/* The bar scrolls sideways when it's wider than the screen; its padding leaves room for
   the picked item's lift and shadow inside the scrolling box. In landscape every item fits
   across an 800 to 844 px phone however many there are (Task 65, with the Mortar's
   seventeen, which ran 36 px off a 844 px screen): each button is 5.7% of the width, or its
   share of the bar (`--items`, set by hud/buildbar.js) if that's less, about 45 px for
   seventeen and 36 to 38 px for Copy and Stamp's twenty (Task 73: never below 34 px, as
   upright; at 38 px twenty ran off an 800 px screen), its picture shrinking with it below
   34 px. Before (Task 53, with the Factory: 46 to 48 px each;
   48 to 51 px with the Volley Tower's fifteen, Task 51; 55 px with the Cart Shed's
   fourteen, Task 42; 59 px with the
   Spark Drill's thirteen, Task 41b; 64 px with the Stone Thrower's twelve, Task 38; 69 px
   with the Bridge's eleven, Task 34). */
.build-bar {
  position: absolute;
  left: 50%;
  bottom: calc(max(8px, var(--safe-bottom)) - 10px);
  transform: translateX(-50%);
  display: flex;
  gap: clamp(2px, 0.4vw, 6px);
  max-width: calc(100% - 2 * max(6px, var(--safe-left), var(--safe-right)));
  padding: 6px 2px 10px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
  pointer-events: none;
}
.build-bar::-webkit-scrollbar { display: none; }
.build-item {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  flex: 0 0 auto;
  width: clamp(34px, min(5.7vw, calc((100vw - 2 * max(6px, var(--safe-left), var(--safe-right)) - 4px) / var(--items, 16) - clamp(2px, 0.4vw, 6px))), 92px);
  padding: 5px 2px 4px;
  border: 3px solid var(--ink);
  border-radius: 14px;
  background: var(--cream);
  box-shadow: 0 4px 0 rgba(43, 29, 63, 0.4);
  cursor: pointer;
}
.build-item.on { background: #ffd36b; transform: translateY(-4px); box-shadow: 0 8px 0 rgba(43, 29, 63, 0.4); }
/* The button whose card shows (Task 54b): ringed in cobalt. */
.build-item.tipped { outline: 3px solid #2f5fd0; outline-offset: 2px; }
.build-icon { display: block; width: 34px; max-width: 100%; aspect-ratio: 1 / 1; height: auto; }
.build-icon svg, .build-icon img { display: block; width: 100%; height: 100%; }
/* A name too long for its button (fonts differ from phone to phone) is squeezed to fit by
   the bar (hud/buildbar.js fitNames), about its middle. */
.build-name { font-size: clamp(10px, 1.35vw, 12px); letter-spacing: -0.2px; font-weight: 800; line-height: 1.1; white-space: nowrap; transform-origin: 50% 50%; }
.build-price { display: inline-flex; align-items: center; gap: 2px; height: 16px; font-size: 13px; font-weight: 900; font-variant-numeric: tabular-nums; white-space: nowrap; flex: 0 0 auto; transform-origin: 50% 50%; }
.build-price svg { width: 15px; height: 15px; }
.build-price-free { color: #2e7d32; letter-spacing: 0.02em; }
/* Upright, the bar is two rows: of five with Milestone 2's buildings (Task 27), of six since
   the Bridge (Task 34, eleven items; twelve with the Stone Thrower, Task 38), of seven since
   the Spark Drill (Task 41b, thirteen; fourteen with the Cart Shed, Task 42), of eight since
   the Volley Tower (Task 51, fifteen; the buttons a little narrower, the icons a little
   smaller; sixteen with the Factory, Task 53, two full rows), of half the items once there
   are more than sixteen (`--cols`, set by hud/buildbar.js: nine with the Mortar's seventeen,
   Task 65, the buttons each their share of the width; ten with Copy and Stamp's twenty, Task
   73, never below 30 px: at 34 px ten ran off a 360 px screen; eleven with Move's twenty-one,
   Task 104, never below 28 px: at 30 px eleven ran off a 360 px screen, found in Task 108):
   everything in sight at once, no scrolling. */
@media (max-aspect-ratio: 1/1) {
  .build-bar {
    display: grid;
    grid-template-columns: repeat(var(--cols, 8), auto);
    gap: clamp(3px, 0.9vw, 6px);
    justify-content: center;
    overflow: visible;
    padding: 6px 2px 10px;
  }
  .build-item { width: clamp(28px, min(10.6vw, calc((100vw - 16px) / var(--cols, 8) - clamp(3px, 0.9vw, 6px))), 96px); padding: 4px 1px 3px; }
  .build-icon { width: clamp(26px, 7.8vw, 34px); }
  .build-name { font-size: clamp(9px, 2.4vw, 12px); letter-spacing: -0.3px; }
}

/* Kept copies (Task 106; hud/shelf.js): in Stamp, a strip over the bar (its bottom set from
   script, above the bar's top), each kept copy a tile with its picture on the grass, its count
   of pieces bottom right and a pin top left when pinned; the one held lifted and ringed in
   gold, as a picked item in the bar is. `--tile` is set from script: eight fit across. */
.shelf {
  position: absolute;
  left: 50%;
  bottom: 96px;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  padding: 4px 4px 6px;
  pointer-events: none;
}
.shelf-copy {
  pointer-events: auto;
  position: relative;
  flex: 0 0 auto;
  width: var(--tile, 44px);
  height: var(--tile, 44px);
  padding: 0;
  border: 3px solid var(--ink);
  border-radius: 10px;
  overflow: hidden;
  background: #7cc243;
  box-shadow: 0 3px 0 rgba(43, 29, 63, 0.4);
  cursor: pointer;
  -webkit-touch-callout: none;
  user-select: none;
}
.shelf-copy:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(43, 29, 63, 0.4); }
.shelf-copy.on { border-color: #ffd36b; outline: 3px solid var(--ink); outline-offset: 0; transform: translateY(-4px); box-shadow: 0 7px 0 rgba(43, 29, 63, 0.4); }
.shelf-pic { display: block; width: 100%; height: 100%; }
.shelf-count {
  position: absolute;
  right: 1px;
  bottom: 1px;
  min-width: 14px;
  padding: 0 3px;
  border-radius: 6px;
  background: rgba(43, 29, 63, 0.82);
  color: #f6ecd2;
  font-size: 10px;
  font-weight: 900;
  line-height: 13px;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
.shelf-pin { position: absolute; left: 1px; top: 1px; width: 17px; height: 17px; padding: 1px; border: 1.5px solid var(--ink); border-radius: 50%; background: #f6ecd2; pointer-events: none; }
.shelf-pin svg { display: block; width: 100%; height: 100%; }

/* Rotate and the tick, floating just above the ghost (placed by transform). */
.ghost-actions {
  position: absolute;
  left: 0;
  top: 0;
  width: 116px;
  height: 52px;
  margin: -26px 0 0 -58px;
  pointer-events: none;
  will-change: transform;
}
.ghost-actions button { pointer-events: auto; width: 52px; height: 52px; top: 0; }
.ghost-rotate { left: 0; }
.ghost-ok { right: 0; background: #4fc463; }
.ghost-ok.remove { background: #e8533f; }
.ghost-ok:disabled { background: #b9b2a6; opacity: 0.75; cursor: default; }
/* With rotate hidden, the tick sits in the middle. */
.ghost-rotate[hidden] + .ghost-ok { right: 32px; }

/* Upgrade together (Task 110; hud/buildbar.js): "All 12 Bolt Towers", a gold pill over the bar's
   middle (its bottom set from script, above the bar's top) while one tower or building is picked. */
.raise-all {
  position: absolute;
  left: 50%;
  bottom: 96px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 4px;
  height: 46px;
  max-width: calc(100% - 24px);
  padding: 0 16px 0 8px;
  border: 3px solid var(--ink);
  border-radius: 23px;
  background: #ffd36b;
  box-shadow: 0 4px 0 rgba(43, 29, 63, 0.4);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  font-weight: 900;
  white-space: nowrap;
  cursor: pointer;
}
.raise-all svg { display: block; flex: 0 0 auto; width: 32px; height: 32px; }
.raise-all-say { overflow: hidden; text-overflow: ellipsis; }
.raise-all:active { transform: translate(-50%, 2px); box-shadow: 0 2px 0 rgba(43, 29, 63, 0.4); }

/* The line under the top edge: what to do, or why it won't fit. */
.build-note {
  position: absolute;
  left: 50%;
  top: calc(max(8px, var(--safe-top)) + 50px);
  transform: translateX(-50%);
  max-width: calc(100% - 40px);
  padding: 5px 14px;
  border: 3px solid var(--ink);
  border-radius: 16px;
  background: rgba(246, 236, 210, 0.94);
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}
.build-note.bad { background: #ffd9d2; color: #8a1d12; }
/* Upright, a line too long for the screen wraps rather than losing its end (Task 120: "Drag
   anywhere in the light to draw a …" on a wider font than Roboto, as a newcomer's first). */
@media (max-aspect-ratio: 1/1) {
  .build-note { white-space: normal; width: max-content; text-align: center; line-height: 1.2; }
}

/* What a thing in the bar does (Task 54b; hud/buildtips.js): a card over the bar, its arrow
   at the button (placed from script: left, bottom and --arrow), shown by a hold, a tap that
   picks, or the mouse resting on it. It never takes a touch. Over the night's side markers
   and the tick (they still take their touches through it), under the hints and panels. */
.hud > .build-tip {
  position: absolute;
  z-index: 4;
  left: 0;
  bottom: 0;
  width: min(270px, calc(100% - 16px));
  padding: 7px 11px 8px;
  border: 3px solid var(--ink);
  border-radius: 14px;
  background: #f6ecd2;
  box-shadow: 0 4px 0 rgba(43, 29, 63, 0.35);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.25;
  pointer-events: none;
}
.build-tip::after {
  content: '';
  position: absolute;
  left: var(--arrow, 50%);
  bottom: -9px;
  width: 12px;
  height: 12px;
  margin-left: -8px;
  background: #f6ecd2;
  border: solid var(--ink);
  border-width: 0 3px 3px 0;
  transform: rotate(45deg);
}
.build-tip.pop { animation: build-tip-pop 0.14s ease-out; }
@keyframes build-tip-pop {
  from { opacity: 0; transform: translateY(6px) scale(0.95); }
  to { opacity: 1; transform: none; }
}
.build-tip-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.build-tip-name { font-size: 15px; font-weight: 900; }
.build-tip p { margin: 3px 0 0; }
.build-tip-needs { color: #6e4526; font-weight: 800; }
.build-tip-next { color: #2f5fd0; font-weight: 800; }
.build-tip-short { color: #b3261e; font-weight: 900; }
/* A tower's rank on its card in Upgrade (Task 113): a flame for each rank, lit gold for those
   won, hollow for those to come, as the flames over the towers are drawn. */
.rank-flames { display: inline-flex; gap: 1px; flex: none; }
.rank-flame svg { display: block; width: 12px; height: 18px; }
.rank-flame path { fill: rgba(107, 52, 16, 0.08); stroke: #b58b55; stroke-width: 1.3; }
.rank-flame.lit path { fill: #ffbf2a; stroke: #6b3410; stroke-width: 1.5; }
@media (max-aspect-ratio: 1/1) {
  .hud > .build-tip { width: min(300px, calc(100% - 16px)); }
}

/* The night's banners (hud/banner.js): "Night 3" at dusk, "Night 3 held!" at dawn, "The
   lantern dims" if the Keep falls. Big, outlined words that read over day and night
   alike, high in the middle and clear of the Warden; they never take a touch. */
.banner {
  position: absolute;
  left: 50%;
  top: calc(max(8px, var(--safe-top)) + 54px);
  width: max-content;
  max-width: calc(100% - 24px);
  text-align: center;
  pointer-events: none;
  transform: translateX(-50%);
  opacity: 0;
  /* Over the night markers' chips for its moment (at dawn tomorrow's come up beneath it). */
  z-index: 4;
}
.banner[hidden] { display: none; }
/* Upright, the goal chip and the mute button share the row under the top bar (Task 21: the
   banner came in behind them): the banner comes in below that row, and below the column of
   round buttons down the right (the Menu since Task 117, the compass once the view is turned:
   a boss's name ran under the Menu, Task 116d-3). */
@media (max-aspect-ratio: 1/1) {
  .banner { top: calc(max(8px, var(--safe-top)) + 204px); }
}
.banner.up { animation: banner-up var(--banner-time, 2.8s) ease-out forwards; }
.banner-title {
  /* By the height too: on a short landscape phone screen the words stay clear of the goal
     chip beside them and of the Warden below. */
  font-size: clamp(32px, min(9vw, 12.5vh), 54px);
  font-weight: 900;
  line-height: 1.02;
  letter-spacing: 0.01em;
  color: #dfe9ff;
  -webkit-text-stroke: 7px var(--ink);
  paint-order: stroke fill;
  text-shadow: 0 5px 0 rgba(43, 29, 63, 0.55);
}
.banner-sub {
  display: inline-block;
  margin-top: 4px;
  padding: 3px 14px 4px;
  border: 3px solid var(--ink);
  border-radius: 14px;
  background: #2f3a6e;
  color: var(--cream);
  font-size: clamp(14px, 3.9vw, 18px);
  font-weight: 900;
  box-shadow: 0 3px 0 rgba(43, 29, 63, 0.4);
}
.banner[data-kind="dawn"] .banner-title { color: var(--gold); }
.banner[data-kind="dawn"] .banner-sub { background: #fff4d4; color: var(--ink); }
.banner[data-kind="fell"] .banner-title { color: #ff9c6b; }
.banner[data-kind="fell"] .banner-sub { background: #5a2f4a; }
/* A boss night's dusk (Task 30): the boss named in orange on the night's dark plum. */
.banner[data-kind="boss-night"] .banner-sub { background: #5a2f4a; color: #ffb04a; }
/* A boss falls: gold words, and what it left on cream. */
.banner[data-kind="boss"] .banner-title { color: #ffb04a; }
.banner[data-kind="boss"] .banner-sub { background: #fff4d4; color: var(--ink); }
/* The Keep raised to a new era (Task 35): the era's name in gold over a cobalt band. */
.banner[data-kind="era"] .banner-title { color: var(--gold); }
.banner[data-kind="era"] .banner-sub { background: #2f5fd0; color: #fff4d4; }
/* A rockfall's words (Task 111c): sandstone, as the crags. */
.banner[data-kind="fall"] .banner-title { color: #f2c98a; }
.banner[data-kind="fall"] .banner-sub { background: #7a5a3a; color: #fff4d4; }
@keyframes banner-up {
  0% { opacity: 0; transform: translateX(-50%) scale(0.55); }
  9% { opacity: 1; transform: translateX(-50%) scale(1.1); }
  16% { transform: translateX(-50%) scale(0.97); }
  22% { transform: translateX(-50%) scale(1); }
  80% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-14px) scale(1); }
}

/* A building's panel (hud/barrackspanel.js): on the right in landscape, clear of the
   coins and the hammer; a sheet along the bottom upright (the hammer hides under it). */
.panel {
  position: absolute;
  right: max(10px, var(--safe-right));
  top: calc(max(8px, var(--safe-top)) + 52px);
  width: 264px;
  max-height: calc(100% - max(8px, var(--safe-top)) - 52px - 80px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 6px 10px 8px;
  border: 3px solid var(--ink);
  border-radius: 18px;
  background: var(--cream);
  box-shadow: 0 5px 0 rgba(43, 29, 63, 0.4);
  animation: panel-in-side 0.18s ease-out;
  /* In front of the labels pinned to the world (the Murk's side markers, added to the HUD
     after the panels, lay over an open panel's corner: Task 75), behind the build tip (4),
     the hints (5) and the banners. */
  z-index: 3;
}
.panel[hidden] { display: none; }
@keyframes panel-in-side { from { opacity: 0; transform: translateX(30px); } }
@keyframes panel-in-up { from { opacity: 0; transform: translateY(40px); } }
@media (max-aspect-ratio: 1/1) {
  .panel {
    top: auto;
    left: max(10px, var(--safe-left));
    right: max(10px, var(--safe-right));
    bottom: max(8px, var(--safe-bottom));
    width: auto;
    max-height: 50%;
    border-radius: 22px;
    animation-name: panel-in-up;
  }
  .panel-open .hammer { visibility: hidden; }
}
.panel-head { display: flex; align-items: center; gap: 7px; }
.panel-icon { display: block; width: 30px; height: 30px; flex: 0 0 auto; }
.panel-icon svg, .panel-icon img { display: block; width: 100%; height: 100%; }
.panel-title { font-size: 19px; font-weight: 900; }
.panel-level { padding: 1px 8px 2px; border: 2px solid var(--ink); border-radius: 10px; background: var(--cobalt); color: var(--cream); font-size: 12px; font-weight: 900; white-space: nowrap; }
.panel-close, .report-close {
  flex: 0 0 auto;
  margin-left: auto;
  width: 36px;
  height: 36px;
  padding: 4px;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: #e05a45;
  box-shadow: 0 3px 0 rgba(43, 29, 63, 0.4);
  cursor: pointer;
}
.panel-close svg, .report-close svg { display: block; width: 100%; height: 100%; }
.panel-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 7px;
  border: 2.5px solid var(--ink);
  border-radius: 14px;
  background: #fffaf0;
}
.panel-unit-icon { display: block; width: 46px; height: 46px; flex: 0 0 auto; }
.panel-unit-icon svg, .panel-unit-icon img { display: block; width: 100%; height: 100%; }
.panel-unit-text { display: flex; flex-direction: column; min-width: 0; }
.panel-unit-name { font-size: 16px; font-weight: 900; line-height: 1.1; }
.panel-unit-about { display: flex; flex-direction: column; font-size: 11.5px; font-weight: 700; color: #5a4a6e; line-height: 1.2; white-space: nowrap; }
/* The Barracks' cards (Task 39): the Bolter's, and the Piker's from Stonehold; with two,
   each a little smaller, so the panel still fits a landscape phone without scrolling. */
.panel-cards { display: flex; flex-direction: column; gap: 4px; }
.two-kinds .panel-card { padding: 2px 7px; }
.two-kinds .panel-unit-icon { width: 38px; height: 38px; }
.two-kinds .panel-unit-name { font-size: 15px; }
.two-kinds .train { min-width: 66px; padding: 3px 8px 2px; }
.two-kinds .train-word { font-size: 14.5px; }
/* With three (Task 52: the Bomber's from Powderworks), tiles side by side: the picture, the
   name, what it does, and Train with its price on one line under it. In landscape the panel
   is a little wider, the tiles say only what each does (the HP left out), and the slots are
   smaller, so a level 3 Barracks' ten fit one row and the whole panel a phone's height. */
.three-kinds .panel-cards { flex-direction: row; gap: 5px; }
.three-kinds .panel-card { flex: 1 1 0; min-width: 0; flex-direction: column; justify-content: space-between; gap: 2px; padding: 3px 3px 4px; text-align: center; }
.three-kinds .panel-unit-icon { width: 32px; height: 32px; }
.three-kinds .panel-unit-text { align-items: center; max-width: 100%; }
.three-kinds .panel-unit-name { font-size: 14px; }
.three-kinds .panel-unit-about { align-items: center; font-size: 10.5px; }
.three-kinds .train { flex-direction: row; justify-content: center; gap: 5px; margin-left: 0; min-width: 0; width: 100%; padding: 2px 4px; }
.three-kinds .train-word { font-size: 14px; }
.barracks-panel.three-kinds { gap: 4px; padding-bottom: 6px; }
@media (min-aspect-ratio: 1/1) {
  .barracks-panel.three-kinds { width: 330px; }
  .three-kinds .panel-unit-about span:first-child { display: none; }
  .three-kinds .panel-slots { gap: 4px; }
  .three-kinds .slot { width: 26px; height: 26px; padding: 1px; border-width: 2px; border-radius: 8px; }
}
/* With four (Task 67: the Kettle Knight's from Steamworks), four tiles in the row, a long
   name wrapping onto two lines, and in landscape the panel a little wider again. */
.four-kinds .panel-cards { gap: 4px; }
.four-kinds .panel-card { padding: 3px 2px 4px; }
.four-kinds .panel-unit-icon { width: 30px; height: 30px; }
.four-kinds .panel-unit-name { font-size: 13px; line-height: 1; white-space: normal; overflow-wrap: anywhere; }
.four-kinds .panel-unit-about { font-size: 10px; white-space: normal; text-align: center; }
.four-kinds .train { gap: 3px; padding: 2px 2px; }
.four-kinds .train-word { font-size: 13px; }
@media (min-aspect-ratio: 1/1) {
  .barracks-panel.four-kinds { width: 372px; }
}
/* With five (Task 83: the Lamplighter's from Brightworks), five tiles in the row: a little
   smaller again, and in landscape the panel wider again, so "Lamplighter" fits on one line. */
.five-kinds .panel-cards { gap: 3px; }
.five-kinds .panel-unit-icon { width: 28px; height: 28px; }
.five-kinds .panel-unit-name { font-size: 12px; }
.five-kinds .panel-unit-about { font-size: 9.5px; }
.five-kinds .train-word { font-size: 12px; }
/* (Task 119: on a wider font than this laptop's, "Train 20" ran 3 px past the button's edge and
   clipped its last digit: the gaps, sides and price a little tighter, the panel 456 px, was 440.) */
.five-kinds .train { gap: 1px; padding: 2px 1px; }
.five-kinds .train .build-price { gap: 1px; font-size: 12px; }
.five-kinds .train .build-price svg { width: 13px; height: 13px; }
@media (min-aspect-ratio: 1/1) {
  .barracks-panel.five-kinds { width: 456px; }
}
@media (max-aspect-ratio: 1/1) {
  .five-kinds .train-word { display: none; }
  .five-kinds .panel-unit-name { hyphens: manual; }
}
.train, .research-go {
  margin-left: auto;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  min-width: 72px;
  padding: 5px 8px 4px;
  border: 3px solid var(--ink);
  border-radius: 14px;
  background: #ffd36b;
  box-shadow: 0 4px 0 rgba(43, 29, 63, 0.4);
  cursor: pointer;
}
.train-word, .research-word { font-size: 16px; font-weight: 900; line-height: 1.05; }
.train:active:not(:disabled), .research-go:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 2px 0 rgba(43, 29, 63, 0.4); }
.train:disabled, .research-go:disabled { background: #e6dcc4; color: #8a7f96; box-shadow: none; cursor: default; }
.train:disabled svg, .research-go:disabled svg { opacity: 0.55; }
.panel-room { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 900; font-variant-numeric: tabular-nums; }
.panel-room-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Keep at strength (Task 40): "Retrain", a little switch at the room line's end. */
.keep-toggle {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  padding: 0 6px 0 2px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: #e6dcc4;
  color: #6b5f78;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}
.keep-toggle[hidden] { display: none; }
.keep-switch { position: relative; width: 22px; height: 13px; border: 2px solid var(--ink); border-radius: 7px; background: #b8ad98; transition: background 0.15s; }
.keep-switch::after { content: ''; position: absolute; top: 1px; left: 1px; width: 7px; height: 7px; border-radius: 50%; background: var(--cream); transition: transform 0.15s; }
.keep-toggle.on { background: #d8f0c4; color: var(--ink); }
.keep-toggle.on .keep-switch { background: #4fa83d; }
.keep-toggle.on .keep-switch::after { transform: translateX(9px); }
/* With two cards and the switch, a little closer together, so it all fits a landscape phone. */
.barracks-panel.two-kinds { gap: 4px; padding-bottom: 6px; }
.panel-slots { display: flex; flex-wrap: wrap; gap: 4px 5px; }
.slot {
  position: relative;
  width: 34px;
  height: 34px;
  padding: 2px;
  overflow: hidden;
  border: 2.5px solid var(--ink);
  border-radius: 10px;
  background: var(--cobalt);
  cursor: default;
}
.slot-face { position: relative; display: block; width: 100%; height: 100%; }
.slot-face svg, .slot-face img { display: block; width: 100%; height: 100%; }
.slot[data-look="training"] { background: #f1e6cb; cursor: pointer; }
.slot-fill { position: absolute; inset: 0; background: #ffc62e; transform: scaleY(0); transform-origin: bottom center; }
.slot[data-look="waiting"] { background: #f1e6cb; cursor: pointer; }
.slot[data-look="waiting"] .slot-face { opacity: 0.45; }
.slot[data-look="free"] { border-style: dashed; border-color: #a8998a; background: transparent; }
/* The Workshop's research cards (Task 29): a picture, the name and what it does, and the
   button: its price in Sparks and coins, filling up while it runs, "Done" once it is. */
.research { display: flex; align-items: center; gap: 7px; padding: 2px 6px; border: 2.5px solid var(--ink); border-radius: 14px; background: #fffaf0; }
.research-icon { display: block; width: 38px; height: 38px; flex: 0 0 auto; }
.research-icon svg, .research-icon img { display: block; width: 100%; height: 100%; }
.research-text { display: flex; flex-direction: column; min-width: 0; }
.research-name { font-size: 14.5px; font-weight: 900; line-height: 1.1; white-space: nowrap; }
.research-about { font-size: 11px; font-weight: 700; color: #5a4a6e; line-height: 1.2; }
/* A refinement's rank (Task 90): a small gold line under its name. */
.research-rank { font-size: 11px; font-weight: 900; color: #a8711a; line-height: 1.15; white-space: nowrap; }
.research-rank[hidden] { display: none; }
.research-go { position: relative; overflow: hidden; min-width: 78px; padding: 3px 6px 3px; }
.research-go .research-word { font-size: 13.5px; position: relative; z-index: 1; }
.research-price { display: flex; gap: 5px; position: relative; z-index: 1; }
.research-price .build-price { font-size: 12.5px; }
.research-bar { display: none; position: absolute; inset: 0; }
.research-fill { position: absolute; inset: 0; background: #8fdcff; transform: scaleX(0); transform-origin: left center; }
.research[data-look="running"] .research-go { background: #e3f6ff; cursor: pointer; }
/* Lined up next (Research Queue, Task 115c-2): Clockwork's green, its price still on it (paid as it
   starts); a tap takes it out of the line. */
.research[data-look="lined"] { background: #eefaf4; }
.research[data-look="lined"] .research-go { background: #b8ecd6; cursor: pointer; }
.research[data-look="running"] .research-bar { display: block; }
.research[data-look="running"] .research-price { display: none; }
.research[data-look="running"] .research-word { font-size: 16px; }
.research[data-look="done"] { background: #eaf7e4; }
.research[data-look="done"] .research-go { background: #8fd17a; color: var(--ink); }
.research[data-look="done"] .research-price, .research[data-look="elsewhere"] .research-price { display: none; }
.research-go.short { background: #f1e6cb; }
/* A later era's card waits for its era (Task 36); research done goes below what's left, and
   one waiting for the research before it (Task 50) below what can be started. */
.research[hidden] { display: none; }
.research[data-look="done"] { order: 2; }
.research[data-look="after"] { order: 1; }
.research[data-look="after"] .research-icon { opacity: 0.6; }
.workshop-panel .panel-why { order: 3; }
/* In landscape the Workshop's panel is a little wider than the Barracks', for its cards. */
@media (min-aspect-ratio: 1/1) {
  .workshop-panel { width: 318px; }
}
.panel-why { min-height: 15px; font-size: 12px; font-weight: 800; color: #5a4a6e; }
.panel-why.bad { color: #c2412f; }

/* The mute button (hud/soundbutton.js): the top row's right end in landscape; upright,
   just under it on the right, where the row has no room. Hidden in build view, where the
   done button takes the corner. */
.sound {
  justify-self: end;
  width: 42px;
  height: 42px;
  padding: 5px;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: var(--cream);
  box-shadow: 0 3px 0 rgba(43, 29, 63, 0.35);
  pointer-events: auto;
  cursor: pointer;
}
.topbar > .sound { pointer-events: auto; }
.sound img, .sound svg { display: block; width: 100%; height: 100%; }
/* The music's badge on the bell's lower right (Task 101): a note, or the note struck through. */
.topbar > .sound { position: relative; }
.sound .sound-badge { position: absolute; right: -7px; bottom: -7px; width: 22px; height: 22px; pointer-events: none; }
.sound:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(43, 29, 63, 0.35); }
.building .sound { display: none; }
@media (max-aspect-ratio: 1/1) {
  .topbar > .sound { position: absolute; right: 0; top: 50px; }
}

/* The Menu (Task 117; hud/menu.js): three bars on a cream button, just left of the sound button
   in landscape, just under it upright; hidden in build view, as the sound button is. */
.menu-button {
  position: absolute;
  right: 50px;
  top: 0;
  width: 42px;
  height: 42px;
  padding: 3px;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: var(--cream);
  box-shadow: 0 3px 0 rgba(43, 29, 63, 0.35);
  cursor: pointer;
}
.topbar > .menu-button { pointer-events: auto; }
.menu-button svg { display: block; width: 100%; height: 100%; }
.menu-button:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(43, 29, 63, 0.35); }
.building .menu-button { display: none; }
@media (max-aspect-ratio: 1/1) {
  .topbar > .menu-button { right: 0; top: 100px; }
}
/* The menu itself, over the dimmed screen; the game waits behind it. */
.game-menu {
  position: absolute;
  inset: 0;
  z-index: 35;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(10px, var(--safe-top)) max(12px, var(--safe-right)) max(10px, var(--safe-bottom)) max(12px, var(--safe-left));
  background: rgba(20, 15, 40, 0.5);
}
.game-menu[hidden] { display: none; }
.game-menu-card {
  display: flex;
  flex-direction: column;
  gap: 7px;
  width: 270px;
  max-width: 100%;
  max-height: 100%;
  overflow-y: auto;
  padding: 8px 12px 10px;
  border: 3px solid var(--ink);
  border-radius: 18px;
  background: var(--cream);
  box-shadow: 0 5px 0 rgba(43, 29, 63, 0.4);
  color: var(--ink);
  animation: panel-in-up 0.18s ease-out;
}
.game-menu-head { display: flex; align-items: center; gap: 8px; }
.game-menu-icon { display: block; width: 28px; height: 28px; }
.game-menu-icon svg { display: block; width: 100%; height: 100%; }
.game-menu-name { font-size: 21px; font-weight: 900; }
.game-menu-where { margin-top: -4px; font-size: 13px; font-weight: 800; color: #5a4a6e; }
.game-menu-go {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 46px;
  padding: 0 12px;
  border: 3px solid var(--ink);
  border-radius: 16px;
  background: var(--cream);
  box-shadow: 0 3px 0 rgba(43, 29, 63, 0.45);
  font: inherit;
  font-size: 17px;
  font-weight: 900;
  color: var(--ink);
  cursor: pointer;
}
.game-menu-go svg { flex: 0 0 auto; width: 28px; height: 28px; }
.game-menu-go:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(43, 29, 63, 0.45); }
.game-menu-play { background: #ffd36b; }
.game-menu-note { font-size: 11.5px; font-weight: 700; line-height: 1.25; color: #5a4a6e; text-align: center; }
.game-menu.leaving .game-menu-card { opacity: 0.7; pointer-events: none; }

/* The compass (Task 54c; hud/compass.js): once the view is turned, a small round button top
   right, under the sound button (under Done in build view), its needle pointing north as the
   eye sees it (turned from script); a tap turns the view back. */
.compass {
  position: absolute;
  right: max(10px, var(--safe-right));
  top: calc(max(8px, var(--safe-top)) + 54px);
  width: 42px;
  height: 42px;
  padding: 3px;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: var(--cream);
  box-shadow: 0 3px 0 rgba(43, 29, 63, 0.35);
  cursor: pointer;
}
.compass:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(43, 29, 63, 0.35); }
.compass-needle { display: block; width: 100%; height: 100%; }
.compass-needle svg { display: block; width: 100%; height: 100%; }
@media (max-aspect-ratio: 1/1) {
  /* (Under the Menu, Task 117, which is under the sound button upright.) */
  .compass { top: calc(max(8px, var(--safe-top)) + 150px); }
  .building .compass { top: calc(max(8px, var(--safe-top)) + 56px); }
}

/* Floating numbers (hud/floaters.js): a hit's damage, white with the game's dark outline;
   a heavy one gold; a perfect night's bonus big and gold. */
.floaters { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.floater {
  position: absolute;
  left: 0;
  top: 0;
  font-size: 17px;
  font-weight: 900;
  line-height: 1;
  color: #fff;
  -webkit-text-stroke: 4px var(--ink);
  paint-order: stroke fill;
  pointer-events: none;
  will-change: transform, opacity;
}
.floater[hidden] { display: none; }
.floater[data-kind="heavy"] { font-size: 21px; color: var(--gold); }
.floater[data-kind="spend"] { font-size: 22px; color: #ffd36b; }
.floater[data-kind="bonus"] { font-size: 30px; color: var(--gold); -webkit-text-stroke: 6px var(--ink); }
.floater[data-kind="spark"] { font-size: 22px; color: #8fdcff; }
.floater[data-kind="ember"] { font-size: 24px; color: #ff9a3c; } /* Embers earned (Task 115a-1) */
.floater[data-kind="fire"] { font-size: 16px; color: #ff9a3c; }
.floater[data-kind="spike"] { font-size: 16px; color: #dfe6ee; } /* the spikes' hurt (Task 50) */
.floater[data-kind="blocked"] { font-size: 15px; color: #e8e2f4; letter-spacing: 0.02em; }
.floater[data-kind="tip"] { font-size: 18px; color: #d4f1ff; white-space: nowrap; }
/* A tip wider than the screen wraps to two lines (Task 92: upright, a refinement's "Every
   Sunlens and your Arc Lantern now +30%" ran off the left edge), centred, kept whole, its
   lines no wider than the screen allows at the pop's 1.2 (floaters.js keeps it whole so). */
.floater[data-kind="tip"].long { white-space: normal; width: max-content; max-width: calc((100vw - 24px) / 1.2); text-align: center; line-height: 1.12; }
.floater[data-kind="alarm"] { font-size: 19px; color: #ffb59c; white-space: nowrap; } /* a tower or building silenced (Task 66) */

/* The title (hud/title.js): the title painting filling the screen, anchored at 46% across
   so an upright crop keeps the Warden's face; the name in its sky, Play on the grass. */
.title {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: max(14px, var(--safe-top)) max(14px, var(--safe-right)) max(14px, var(--safe-bottom)) max(14px, var(--safe-left));
  background: #2b2a5a center / cover no-repeat;
  background-position: 46% 50%;
  transition: opacity 0.4s ease-out;
}
.title.gone { opacity: 0; }
.title-name {
  margin-top: 2vh;
  font-size: clamp(42px, 11vmin, 92px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.01em;
  color: #ffd36b;
  -webkit-text-stroke: 9px var(--ink);
  paint-order: stroke fill;
  text-shadow: 0 7px 0 rgba(43, 29, 63, 0.6);
}
.title-line {
  margin-top: 6px;
  padding: 2px 14px 3px;
  border: 3px solid var(--ink);
  border-radius: 14px;
  background: var(--cream);
  font-size: clamp(14px, 3.6vmin, 20px);
  font-weight: 900;
}
.title-play {
  margin-top: auto;
  margin-bottom: 4vh;
  min-width: 190px;
  padding: 10px 34px 12px;
  border: 4px solid var(--ink);
  border-radius: 28px;
  background: #ffd36b;
  box-shadow: 0 6px 0 rgba(43, 29, 63, 0.55);
  font-size: clamp(28px, 7vmin, 40px);
  font-weight: 900;
  color: var(--ink);
  cursor: pointer;
  animation: title-play 1.6s ease-in-out infinite;
}
.title-play:active { transform: translateY(3px); box-shadow: 0 3px 0 rgba(43, 29, 63, 0.55); }
@keyframes title-play { 50% { transform: scale(1.05); } }
.title-note { margin-bottom: 2vh; color: var(--cream); font-weight: 800; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; }
/* The version, small in the corner (offline.js): which build this is, and once it is kept
   on the phone, that it plays offline. */
.title-build {
  position: absolute;
  right: max(10px, var(--safe-right));
  bottom: max(6px, var(--safe-bottom));
  color: var(--cream);
  font-size: 11px;
  font-weight: 800;
  opacity: 0.8;
  -webkit-text-stroke: 2px var(--ink);
  paint-order: stroke fill;
  pointer-events: none;
}

/* The next goal (hud/goal.js), under the coins; a tap goes straight to it. */
.goal {
  position: absolute;
  left: max(10px, var(--safe-left));
  top: calc(max(8px, var(--safe-top)) + 48px);
  display: flex;
  align-items: center;
  gap: 5px;
  height: 36px;
  padding: 0 11px 0 4px;
  border: 3px solid var(--ink);
  border-radius: 18px;
  background: #fff4d4;
  box-shadow: 0 3px 0 rgba(43, 29, 63, 0.35);
  font-size: 14px;
  font-weight: 900;
  white-space: nowrap;
  cursor: pointer;
  transition: opacity 0.2s ease-out;
}
/* Under the night's banner (hud/banner.js), it fades for the banner's moment. */
.goal.under-banner { opacity: 0; pointer-events: none; }
.goal[hidden], .building .goal { display: none; }
/* Upright on a narrow phone a level's chip a touch smaller, clear of the bell beside it (Task
   120: 1-3's "Bank 150 from Glintrock · 0 of 150" ran under it). */
@media (max-aspect-ratio: 1/1) and (max-width: 420px) {
  .goal.level { font-size: 13px; padding-right: 9px; gap: 4px; }
}
/* A level's raise ready (Task 121): the chip glows gold, growing from its left edge. */
.goal.ready { transform-origin: left center; animation: goal-ready 1.1s ease-in-out infinite; }
@keyframes goal-ready { 0%, 100% { box-shadow: 0 3px 0 rgba(43, 29, 63, 0.35), 0 0 0 0 rgba(255, 211, 107, 0.95); } 50% { transform: scale(1.06); box-shadow: 0 3px 0 rgba(43, 29, 63, 0.35), 0 0 0 11px rgba(255, 211, 107, 0); } }
.goal-icon { display: block; width: 28px; height: 28px; }
.goal-icon svg, .goal-icon img { display: block; width: 100%; height: 100%; }
.goal-next { padding: 1px 6px; border-radius: 8px; background: var(--cobalt); color: var(--cream); font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
.goal-price { display: inline-flex; align-items: center; gap: 2px; font-variant-numeric: tabular-nums; }
.goal-price svg { width: 16px; height: 16px; }
.goal.met { background: #b8f08a; animation: goal-met 0.4s ease-out; }
.goal.met .goal-next { display: none; }
@keyframes goal-met { 0% { transform: scale(0.8); } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }
/* The last goal of era 1, the Keep's raise, comes with the next era: a quieter chip. */
.goal.soon .goal-next { background: #8a7f96; }

/* The quests' scroll (hud/quests.js; Task 31), under the next-goal chip, with a green count
   of the quests done and waiting to be claimed. Hidden in build view. */
.quests {
  position: absolute;
  left: max(10px, var(--safe-left));
  top: calc(max(8px, var(--safe-top)) + 92px);
  width: 44px;
  height: 44px;
  padding: 3px;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: #fff4d4;
  box-shadow: 0 3px 0 rgba(43, 29, 63, 0.35);
  cursor: pointer;
  transition: opacity 0.2s ease-out;
}
.quests[hidden], .building .quests { display: none; }
.quests.under-banner { opacity: 0; pointer-events: none; }
.quests:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(43, 29, 63, 0.35); }
.quests-icon { display: block; width: 100%; height: 100%; }
.quests-icon svg, .quests-icon img { display: block; width: 100%; height: 100%; }
.quests-badge {
  position: absolute;
  right: -8px;
  top: -8px;
  min-width: 23px;
  height: 23px;
  padding: 0 5px;
  border: 2.5px solid var(--ink);
  border-radius: 12px;
  background: #5fd34a;
  font-size: 13px;
  font-weight: 900;
  line-height: 18px;
  text-align: center;
}
.quests-badge[hidden] { display: none; }
.quests.ready { background: #e8ffd0; animation: quests-ready 1.6s ease-in-out infinite; }
@keyframes quests-ready { 50% { box-shadow: 0 3px 0 rgba(43, 29, 63, 0.35), 0 0 0 6px rgba(95, 211, 74, 0.5); } }
/* The quest panel's cards: a picture, what it asks and a bar filling up, and its reward,
   a Claim button once done. */
.quest { display: flex; align-items: center; gap: 7px; padding: 3px 6px; border: 2.5px solid var(--ink); border-radius: 14px; background: #fffaf0; }
.quest[hidden] { display: none; }
.quest-icon { display: block; width: 36px; height: 36px; flex: 0 0 auto; }
.quest-icon svg, .quest-icon img { display: block; width: 100%; height: 100%; }
.quest-text { display: flex; flex-direction: column; gap: 3px; flex: 1 1 auto; min-width: 0; }
.quest-name { font-size: 13.5px; font-weight: 900; line-height: 1.1; }
.quest-bar { position: relative; height: 15px; border: 2px solid var(--ink); border-radius: 8px; background: #e6dcc4; overflow: hidden; }
.quest-fill { position: absolute; inset: 0; background: #ffc62e; transform: scaleX(0); transform-origin: left center; transition: transform 0.25s ease-out; }
.quest-count { position: relative; display: block; font-size: 10.5px; font-weight: 900; line-height: 11px; text-align: center; font-variant-numeric: tabular-nums; }
.quest-claim {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 62px;
  padding: 3px 6px;
  border: 3px solid var(--ink);
  border-radius: 14px;
  background: #8fe36f;
  box-shadow: 0 4px 0 rgba(43, 29, 63, 0.4);
  cursor: pointer;
}
.quest-word { font-size: 14.5px; font-weight: 900; line-height: 1.05; }
.quest-claim .build-price { font-size: 12.5px; }
.quest-claim:disabled { background: #f1e6cb; box-shadow: none; cursor: default; }
.quest-claim:disabled .quest-word { display: none; }
.quest-claim:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 2px 0 rgba(43, 29, 63, 0.4); }
.quest[data-look="done"] { background: #eaf7e4; }
.quest[data-look="done"] .quest-fill { background: #5fd34a; }
.quest[data-look="done"] .quest-claim { animation: quest-claim 1.2s ease-in-out infinite; }
@keyframes quest-claim { 50% { transform: scale(1.07); } }
@media (min-aspect-ratio: 1/1) {
  /* 320 px wide, so era 5's "Sunlenses burn 11 Murk" and "Walkers stomp 6 Murk" fit on one
     line, and the cards a little tighter, so three names of two lines ("Gyrocopters down 9
     Flappers", "Hold a night, no wall broken", "Prospectors bank 270 coins") still leave the
     line under them in the panel at 390 px tall (Task 88: it scrolled 14 px under; 300 px and
     3 px before). */
  .quest-panel { width: 320px; }
  .quest-panel .quest { padding-block: 1px; }
  .quest-panel .quest-text { gap: 2px; }
}
/* A claim's coins on their way to the counter. */
.quest-coin { position: absolute; left: -11px; top: -11px; width: 22px; height: 22px; pointer-events: none; z-index: 30; }
.quest-coin svg { display: block; width: 100%; height: 100%; }

/* The ghost-finger hints (hud/hints.js): a finger showing the gesture, and what it means.
   Never takes a touch. */
.hint { position: absolute; left: 0; top: 0; width: 0; height: 0; pointer-events: none; z-index: 5; }
.hint[hidden] { display: none; }
.hint-finger {
  position: absolute;
  left: -14px;
  top: -6px;
  width: 46px;
  height: 58px;
  filter: drop-shadow(0 3px 0 rgba(43, 29, 63, 0.35));
  animation: hint-drag 1.9s ease-in-out infinite;
}
.hint-finger svg { display: block; width: 100%; height: 100%; }
.hint-dot {
  position: absolute;
  left: -14px;
  top: -14px;
  width: 28px;
  height: 28px;
  border: 3px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  animation: hint-dot 1.9s ease-in-out infinite;
}
.hint-text {
  position: absolute;
  left: 0;
  top: -58px;
  transform: translateX(-50%);
  padding: 3px 12px 4px;
  border: 3px solid var(--ink);
  border-radius: 14px;
  background: var(--cream);
  font-size: 15px;
  font-weight: 900;
  white-space: nowrap;
  box-shadow: 0 3px 0 rgba(43, 29, 63, 0.35);
}
@keyframes hint-drag {
  0% { transform: translate(0, 0) scale(1.1); opacity: 0; }
  12% { transform: translate(0, 0) scale(1.1); opacity: 1; }
  22% { transform: translate(0, 0) scale(0.95); }
  72% { transform: translate(var(--dx), var(--dy)) scale(0.95); opacity: 1; }
  88%, 100% { transform: translate(var(--dx), var(--dy)) scale(1.05); opacity: 0; }
}
@keyframes hint-dot {
  0%, 18% { transform: translate(0, 0) scale(0.4); opacity: 0; }
  22% { transform: translate(0, 0) scale(1); opacity: 1; }
  72% { transform: translate(var(--dx), var(--dy)) scale(1); opacity: 1; }
  80%, 100% { transform: translate(var(--dx), var(--dy)) scale(1.4); opacity: 0; }
}
.hint.tap .hint-finger { animation: hint-tap 1.1s ease-in-out infinite; }
.hint.tap .hint-dot { animation: hint-tap-dot 1.1s ease-out infinite; }
.hint.tap .hint-text { top: -86px; left: -40px; }
/* A tap high on the screen (Start, in the top row): the words under the finger, where over it
   they'd be off the screen's top (Task 120). */
.hint.tap.below .hint-text { top: 66px; left: 8px; }
@keyframes hint-tap { 0%, 100% { transform: translate(8px, 10px) scale(1.05); } 45% { transform: translate(0, 0) scale(0.92); } }
@keyframes hint-tap-dot { 0%, 40% { transform: scale(0.4); opacity: 0; } 50% { transform: scale(1); opacity: 1; } 100% { transform: scale(1.8); opacity: 0; } }
/* The hammer, pulsing when it's the next thing to tap. */
.hammer.pulse { animation: hammer-pulse 1.1s ease-in-out infinite; }
@keyframes hammer-pulse { 0%, 100% { box-shadow: 0 4px 0 rgba(43, 29, 63, 0.4), 0 0 0 0 rgba(255, 211, 107, 0.9); } 50% { transform: scale(1.1); box-shadow: 0 4px 0 rgba(43, 29, 63, 0.4), 0 0 0 12px rgba(255, 211, 107, 0); } }
/* Drawing a wall: the words under the finger, clear of the tick and rotate over the pen; over
   it where under would run into the build bar (Task 116c, hints.js WALL_WORDS). */
.hint[data-hint="wall"] .hint-text { top: 66px; }
.hint.high[data-hint="wall"] .hint-text { top: -58px; }
/* The wall's finger holds a moment, its ring swelling, before it draws (Task 128: a drag at once
   moves the view; a hold, then a drag, draws). */
.hint[data-hint="wall"] .hint-finger { animation: hint-hold-drag 2.6s ease-in-out infinite; }
.hint[data-hint="wall"] .hint-dot { animation: hint-hold-dot 2.6s ease-in-out infinite; }
@keyframes hint-hold-drag {
  0% { transform: translate(0, 0) scale(1.1); opacity: 0; }
  8% { transform: translate(0, 0) scale(1.1); opacity: 1; }
  14%, 40% { transform: translate(0, 0) scale(0.95); }
  78% { transform: translate(var(--dx), var(--dy)) scale(0.95); opacity: 1; }
  90%, 100% { transform: translate(var(--dx), var(--dy)) scale(1.05); opacity: 0; }
}
@keyframes hint-hold-dot {
  0%, 12% { transform: translate(0, 0) scale(0.4); opacity: 0; }
  16% { transform: translate(0, 0) scale(0.7); opacity: 1; }
  37% { transform: translate(0, 0) scale(1.35); opacity: 1; }
  41% { transform: translate(0, 0) scale(1); opacity: 1; }
  78% { transform: translate(var(--dx), var(--dy)) scale(1); opacity: 1; }
  86%, 100% { transform: translate(var(--dx), var(--dy)) scale(1.4); opacity: 0; }
}

/* The title's buttons (Task 19): Play or Continue, and for a saved game New game beside it,
   which asks first. */
.title-buttons { margin-top: auto; margin-bottom: 1.5vh; display: flex; align-items: center; gap: 12px; }
.title-buttons .title-play { margin: 0; }
.title-new {
  padding: 8px 16px 9px;
  border: 3px solid var(--ink);
  border-radius: 20px;
  background: var(--cream);
  box-shadow: 0 4px 0 rgba(43, 29, 63, 0.5);
  font-size: 16px;
  font-weight: 900;
  color: var(--ink);
  cursor: pointer;
}
.title-new:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(43, 29, 63, 0.5); }
/* A save from before the dales (Task 111g): New game says what a new one brings, a gold tag under
   its words. */
.title-new-land {
  display: block;
  margin: 3px -6px 0;
  padding: 1px 8px 2px;
  border: 2px solid var(--ink);
  border-radius: 9px;
  background: var(--gold);
  font-size: 11.5px;
  font-weight: 900;
  line-height: 1.2;
  white-space: nowrap;
}
/* Upright, beside Continue, it wraps to two lines (the row fits a 390 px screen). */
@media (max-aspect-ratio: 1/1) {
  .title-new:has(.title-new-land) { max-width: 150px; }
  .title-new-land { white-space: normal; }
}
.title-note { margin-bottom: 2.5vh; font-size: 16px; }
/* The Records card (Task 89, hud/records.js), under Play or Continue: the laurel and lantern,
   then the five bests side by side, each its value over its name (three and two upright). */
.title-records { display: flex; align-items: center; gap: 10px; margin-bottom: 1vh; padding: 5px 14px 6px 8px; border: 3px solid var(--ink); border-radius: 16px; background: var(--cream); box-shadow: 0 4px 0 rgba(43, 29, 63, 0.45); }
.title-records-icon { display: block; flex: 0 0 auto; width: 40px; height: 40px; }
.title-records-icon svg, .title-records-icon img { display: block; width: 100%; height: 100%; }
.title-records-list { display: grid; grid-template-columns: repeat(5, auto); gap: 2px 16px; }
.title-record { display: flex; flex-direction: column; align-items: center; min-width: 0; }
.title-record b { font-size: 17px; font-weight: 900; line-height: 1.1; white-space: nowrap; font-variant-numeric: tabular-nums; }
.title-record span { font-size: 10.5px; font-weight: 800; color: #5a4a6e; white-space: nowrap; }
@media (max-aspect-ratio: 1/1) {
  .title-records-list { grid-template-columns: repeat(3, auto); gap: 4px 14px; }
}
.title-ask {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(340px, calc(100% - 32px));
  transform: translate(-50%, -50%);
  padding: 14px 16px 16px;
  border: 4px solid var(--ink);
  border-radius: 22px;
  background: var(--cream);
  box-shadow: 0 0 0 100vmax rgba(20, 15, 40, 0.6), 0 6px 0 rgba(43, 29, 63, 0.5);
  text-align: center;
}
.title-ask[hidden] { display: none; }
.title.asking .title-play { animation: none; }
.title-ask-head { font-size: 24px; font-weight: 900; }
.title-ask-text { margin: 6px 0 12px; font-size: 15px; font-weight: 700; line-height: 1.3; }
.title-ask-buttons { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.title-ask-buttons button {
  padding: 9px 14px 10px;
  border: 3px solid var(--ink);
  border-radius: 18px;
  box-shadow: 0 4px 0 rgba(43, 29, 63, 0.5);
  font-size: 16px;
  font-weight: 900;
  cursor: pointer;
}
.title-keep { background: #ffd36b; color: var(--ink); }
.title-again { background: #e05a45; color: #fff; }
/* A copy he can keep (Task 96, savecopy.js): Keep a copy and Open a copy, small under the
   Records card (Keep a copy says "Kept in Downloads" a moment once done); and "Open this copy?"
   with the copy's night, era and coins on a strip of their own. */
.title-copies { display: flex; gap: 10px; margin-bottom: 0.5vh; }
.title-copies button {
  min-height: 36px;
  padding: 5px 13px 6px;
  border: 3px solid var(--ink);
  border-radius: 16px;
  background: rgba(255, 244, 222, 0.92);
  box-shadow: 0 3px 0 rgba(43, 29, 63, 0.45);
  font-size: 14px;
  font-weight: 900;
  color: var(--ink);
  cursor: pointer;
}
.title-copies button:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(43, 29, 63, 0.45); }
.title-copies .title-copy-keep.done { background: #9be37a; }
.title-copies .title-copy-keep.done::before { content: "\2713\00a0"; }
.title-open-save {
  margin-top: 8px;
  padding: 6px 10px 7px;
  border-radius: 12px;
  background: #2b1d3f;
  color: #ffd36b;
  font-size: 17px;
  font-weight: 900;
}
.title-open-save[hidden], .title-open-yes[hidden] { display: none; }
.title-open-yes { background: #ffd36b; color: var(--ink); }
.title-open-no { background: #fff4de; color: var(--ink); }
.title-open[data-ok="0"] .title-open-no { background: #ffd36b; min-width: 110px; }

/* The night report (hud/report.js; Devin's ninth play note, 9 November 2026): a moment
   after dawn, over everything but the title, on a dim backdrop that keeps taps off the
   game (Start waits behind it). Landscape: the map on the left, the night's numbers on the
   right. Upright: a sheet with the map on top. */
.report-back {
  position: absolute;
  inset: 0;
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(8px, var(--safe-top)) max(10px, var(--safe-right)) max(8px, var(--safe-bottom)) max(10px, var(--safe-left));
  background: rgba(20, 14, 34, 0.55);
  animation: report-fade 0.2s ease-out;
}
@keyframes report-fade { from { opacity: 0; } }
@keyframes report-in { from { opacity: 0; transform: translateY(18px) scale(0.96); } }
.report {
  --map: min(calc(100dvh - 40px), 380px, 52vw);
  display: grid;
  grid-template-columns: var(--map) minmax(0, 1fr);
  grid-template-rows: auto auto 1fr auto;
  grid-template-areas: "map head" "map stats" "map words" "map done";
  gap: 6px 12px;
  width: 100%;
  max-width: 820px;
  max-height: 100%;
  padding: 8px 10px 10px 8px;
  border: 3px solid var(--ink);
  border-radius: 20px;
  background: var(--cream);
  box-shadow: 0 5px 0 rgba(43, 29, 63, 0.4);
  animation: report-in 0.26s cubic-bezier(0.2, 1.3, 0.4, 1);
}
.report-head { grid-area: head; display: flex; align-items: center; gap: 8px; min-width: 0; }
.report-title { font-size: 24px; font-weight: 900; line-height: 1; white-space: nowrap; }
.report-tag {
  min-width: 0;
  overflow: hidden;
  padding: 3px 10px 4px;
  border: 2.5px solid var(--ink);
  border-radius: 12px;
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.report-tag[data-kind="perfect"] { background: var(--gold); color: var(--ink); }
.report-tag[data-kind="broken"] { background: #e05a45; color: #fff; }
.report-map {
  grid-area: map;
  position: relative;
  width: var(--map);
  height: var(--map);
  overflow: hidden;
  border: 3px solid var(--ink);
  border-radius: 14px;
  background: #1c182e;
}
.report-map canvas { position: absolute; left: 0; top: 0; display: block; }
/* On the dales (Task 111f): each frontier pass's name and its share of the night's heat, just
   past its mark on the map; the hardest pressed red. Under the flags, and never in a tap's way. */
.report-passes { position: absolute; inset: 0; pointer-events: none; }
.report-pass {
  position: absolute;
  display: flex;
  align-items: baseline;
  gap: 4px;
  padding: 1px 6px 2px;
  border: 2px solid var(--ink);
  border-radius: 9px;
  background: rgba(246, 236, 210, 0.94);
  color: var(--ink);
  font-size: 11px;
  font-weight: 900;
  line-height: 1.15;
  white-space: nowrap;
  box-shadow: 0 2px 0 rgba(20, 14, 34, 0.45);
}
.report-pass i { font-style: normal; color: #b4561c; font-variant-numeric: tabular-nums; }
.report-pass[data-hot="1"] { background: #e05a45; color: #fff; }
.report-pass[data-hot="1"] i { color: #ffe79a; }
.report-flags { position: absolute; inset: 0; }
.report-flag {
  position: absolute;
  width: 34px;
  height: 44px;
  padding: 2px;
  border: 0;
  background: none;
  transform: translate(-26%, -91%);
  cursor: pointer;
  animation: flag-in 0.26s cubic-bezier(0.2, 1.5, 0.4, 1) backwards;
}
.report-flag svg { display: block; width: 30px; height: 40px; filter: drop-shadow(0 2px 0 rgba(20, 14, 34, 0.5)); }
.report-flag:active svg { transform: translateY(2px); }
@keyframes flag-in { from { opacity: 0; transform: translate(-26%, -140%); } }
.flag-count {
  position: absolute;
  right: -3px;
  top: 0;
  min-width: 19px;
  height: 19px;
  padding: 0 4px;
  border: 2px solid var(--cream);
  border-radius: 10px;
  background: var(--ink);
  color: var(--cream);
  font-size: 11px;
  font-weight: 900;
  line-height: 15px;
  text-align: center;
}
.report-legend {
  position: absolute;
  left: 6px;
  bottom: 6px;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px 3px 5px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: rgba(246, 236, 210, 0.92);
  font-size: 11px;
  font-weight: 800;
  pointer-events: none;
}
.report-legend-bar {
  width: 42px;
  height: 9px;
  border: 1.5px solid var(--ink);
  border-radius: 5px;
  background: linear-gradient(90deg, #ffec78, #ffa028 50%, #e22230);
}
.report-stats { grid-area: stats; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; }
.stat {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: 4px 9px 5px;
  border: 2.5px solid var(--ink);
  border-radius: 13px;
  background: #fffaf0;
}
.stat b { display: flex; align-items: center; gap: 4px; font-size: 22px; font-weight: 900; line-height: 1.05; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat > span { font-size: 12px; font-weight: 800; color: #5a4a6e; white-space: nowrap; }
.stat-coin { display: block; width: 22px; height: 22px; }
.stat-coin svg { display: block; width: 100%; height: 100%; }
.stat-coins b { color: #8a5a00; }
.stat-broken[data-kind="bad"] b { color: #d23a2c; }
.stat-broken[data-kind="good"] b { color: #2f8f3a; }
.stat-keep b { font-size: 18px; }
.stat-keep-bar { display: block; height: 8px; margin: 2px 0 1px; overflow: hidden; border: 2px solid var(--ink); border-radius: 5px; background: #e6dcc4; }
.stat-keep-fill { display: block; height: 100%; background: linear-gradient(#8ff07a, #43c24a); }
.stat-keep[data-low="1"] .stat-keep-fill { background: linear-gradient(#ff9a7a, #e8433a); }
.stat-lost, .stat-mended { grid-column: 1 / -1; flex-direction: row; align-items: baseline; gap: 8px; }
.report-stats[data-pair="1"] .stat-lost, .report-stats[data-pair="1"] .stat-mended { grid-column: auto; }
.stat-mended b { color: #2f5fd0; }
.report-words { grid-area: words; display: flex; flex-direction: column; justify-content: center; gap: 1px; min-height: 0; font-weight: 800; line-height: 1.25; }
.report-side { font-size: 15px; font-weight: 900; }
/* The towers that rose a rank tonight (Task 113): gold-brown, a little flame before it. */
.report-ranks { font-size: 14px; font-weight: 900; color: #8a5a00; }
.report-ranks[hidden] { display: none; }
.report-ranks .rank-flame { display: inline-block; margin-right: 4px; vertical-align: -3px; }
.report-ranks .rank-flame svg { width: 11px; height: 16px; }
.report-ranks .rank-flame path { fill: #ffbf2a; stroke: #2b1d3f; stroke-width: 1.6; }
/* What Builders' Orders did at dawn (Task 115a-3): Clockwork's green, the builder's hammer before it. */
.report-orders { font-size: 14px; font-weight: 900; color: #17765a; }
.report-orders[hidden] { display: none; }
.report-hammer { display: inline-block; margin-right: 3px; vertical-align: -4px; }
.report-hammer svg { display: block; width: 18px; height: 18px; }
.report-note { font-size: 14px; color: #c2412f; }
.report-note[data-kind="good"] { color: #2f8f3a; }
.report-time { font-size: 12px; color: #6d5e80; }
/* "New best!" (Task 89): the records this dawn beat, a gold tag and a line each, a gold star
   before each so a line wrapped onto the next still reads as its own. */
/* The dawn's Embers (Task 115a-1): in landscape a chip in the head ("+44 Embers", the words there
   full on a busy night); upright, where there's room, an Ember and its line above "New best!". */
.report-ember-chip { flex: 0 0 auto; display: flex; align-items: center; gap: 3px; padding: 1px 9px 2px 4px; border: 2.5px solid var(--ink); border-radius: 12px; background: #ffe0c2; color: #8a3208; font-size: 14px; font-weight: 900; white-space: nowrap; }
.report-ember-chip[hidden] { display: none; }
.report-embers { display: none; align-items: center; gap: 5px; margin-bottom: 2px; font-size: 13px; font-weight: 900; line-height: 1.2; color: #b04a12; }
.report-ember { flex: 0 0 auto; display: block; width: 20px; height: 20px; }
.report-ember svg, .report-ember img { display: block; width: 100%; height: 100%; }
@media (max-aspect-ratio: 1/1) {
  .report-ember-chip, .report-ember-chip[hidden] { display: none; }
  .report-embers:not([hidden]) { display: flex; }
}
.report-best { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; margin-bottom: 3px; font-size: 13px; font-weight: 900; line-height: 1.2; }
.report-best[hidden] { display: none; }
.report-best-tag { padding: 1px 8px 2px; border: 2.5px solid var(--ink); border-radius: 10px; background: var(--gold); white-space: nowrap; animation: best-in 0.9s ease-out 0.3s backwards; }
@keyframes best-in { 0% { transform: scale(0.4); opacity: 0; } 55% { transform: scale(1.18); opacity: 1; } 100% { transform: scale(1); } }
.report-best-line { color: #8a5a00; white-space: nowrap; }
.report-best-line::before { content: '\2605'; margin-right: 3px; color: #e8a400; }
.report-done {
  grid-area: done;
  height: 44px;
  border: 3px solid var(--ink);
  border-radius: 16px;
  background: #ffd36b;
  box-shadow: 0 4px 0 rgba(43, 29, 63, 0.4);
  color: var(--ink);
  font-size: 18px;
  font-weight: 900;
  cursor: pointer;
}
.report-done:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(43, 29, 63, 0.4); }
@media (max-aspect-ratio: 1/1) {
  .report {
    --map: min(calc(100vw - 46px), 52dvh, 440px);
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: none;
    grid-template-areas: "head" "map" "stats" "words" "done";
    max-width: 480px;
    overflow-y: auto;
    padding: 8px 10px 10px;
  }
  .report-map { justify-self: center; }
}
/* After a flag's tap, a pin on each breach in the world while build view is open; the one
   tapped bobs. */
.breach-pins { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.breach-pins > .breach-pin { position: absolute; left: 0; top: 0; width: 30px; height: 40px; margin: -38px 0 0 -7px; pointer-events: none; }
.breach-pin svg { display: block; width: 100%; height: 100%; filter: drop-shadow(0 2px 0 rgba(20, 14, 34, 0.45)); }
.breach-pin.picked svg { animation: pin-bob 0.9s ease-in-out infinite; }
@keyframes pin-bob { 50% { transform: translateY(-6px); } }

/* While you were away (Task 45, hud/away.js): back after a while away by day, a card over
   the world on a dim backdrop: how long, what the base banked and what finished, and a
   green Collect that pulses like a quest's Claim. */
.away-back {
  position: absolute;
  inset: 0;
  z-index: 13;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(8px, var(--safe-top)) max(10px, var(--safe-right)) max(8px, var(--safe-bottom)) max(10px, var(--safe-left));
  background: rgba(20, 14, 34, 0.55);
  animation: report-fade 0.2s ease-out;
}
.away-back[hidden], .away [hidden] { display: none; }
.away {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(100%, 430px);
  max-height: 100%;
  overflow-y: auto;
  padding: 10px 12px 12px;
  border: 3px solid var(--ink);
  border-radius: 20px;
  background: var(--cream);
  box-shadow: 0 5px 0 rgba(43, 29, 63, 0.4);
  animation: report-in 0.26s cubic-bezier(0.2, 1.3, 0.4, 1);
}
.away-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.away-title { font-size: 22px; font-weight: 900; line-height: 1.05; }
.away-time {
  flex: 0 0 auto;
  padding: 2px 10px 3px;
  border: 2.5px solid var(--ink);
  border-radius: 12px;
  background: var(--cobalt);
  color: var(--cream);
  font-size: 14px;
  font-weight: 900;
  white-space: nowrap;
}
.away-gains { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.away-gains[data-pair="1"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.away-gains .stat b { font-size: 27px; }
.away-gains .stat-coin { width: 26px; height: 26px; }
.away-gains .stat-coin img { display: block; width: 100%; height: 100%; }
.away-coins b { color: #8a5a00; }
.away-sparks b { color: #1f6fb0; }
.away-done { display: flex; flex-direction: column; gap: 3px; margin: 0; padding: 0; list-style: none; }
.away-done li { position: relative; padding-left: 22px; font-size: 15px; font-weight: 900; line-height: 1.2; }
.away-done li::before {
  content: "";
  position: absolute;
  left: 1px;
  top: 2px;
  width: 14px;
  height: 14px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: #5fd34a;
}
.away-done li::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 5px;
  width: 4px;
  height: 7px;
  border: solid var(--ink);
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(40deg);
}
.away-note { font-size: 12px; font-weight: 800; line-height: 1.25; color: #6d5e80; text-wrap: balance; }
.away-collect {
  flex: 0 0 auto;
  height: 46px;
  border: 3px solid var(--ink);
  border-radius: 16px;
  background: #8fe36f;
  box-shadow: 0 4px 0 rgba(43, 29, 63, 0.4);
  color: var(--ink);
  font: inherit;
  font-size: 19px;
  font-weight: 900;
  cursor: pointer;
  animation: away-collect 1.2s ease-in-out infinite;
}
/* Gentler than a quest's Claim: it's the card's whole width. */
@keyframes away-collect { 50% { transform: scale(1.03); } }
.away-collect:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(43, 29, 63, 0.4); animation: none; }

/* The night boons (Task 31b, hud/boons.js): from night 2 Start opens the picker over the
   world, on a dim backdrop: three cards in the art's boon-frame, the boon's picture in its
   clear middle on a warm cream ground, its name on the cobalt ribbon, and what it does
   under the card. Landscape: three across. Upright: three rows, the words beside. */
.boon-pick {
  position: absolute;
  inset: 0;
  z-index: 14;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: max(6px, var(--safe-top)) max(10px, var(--safe-right)) max(6px, var(--safe-bottom)) max(10px, var(--safe-left));
  background: rgba(20, 14, 34, 0.62);
  animation: report-fade 0.2s ease-out;
}
/* While it's open, the rest of the HUD steps aside (the coins and the night chip sat under
   its heading). */
.hud.boon-open > :not(.boon-pick) { visibility: hidden; }
.boon-head { display: flex; align-items: center; gap: 10px; }
.boon-title { color: var(--cream); font-size: 24px; font-weight: 900; -webkit-text-stroke: 5px var(--ink); paint-order: stroke fill; }
.boon-sub { color: #ffd36b; font-size: 14px; font-weight: 900; -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; white-space: nowrap; }
.boon-close { margin-left: 4px; }
.boon-cards { display: flex; align-items: flex-start; justify-content: center; gap: clamp(10px, 3vw, 22px); }
.boon-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: min(28vw, calc((100dvh - 118px) * 0.75), 196px);
  padding: 0;
  border: 0;
  background: none;
  color: var(--cream);
  font: inherit;
  cursor: pointer;
  animation: boon-deal 0.32s cubic-bezier(0.2, 1.4, 0.4, 1) backwards;
}
.boon-card:nth-child(2) { animation-delay: 0.06s; }
.boon-card:nth-child(3) { animation-delay: 0.12s; }
@keyframes boon-deal { from { opacity: 0; transform: translateY(28px) scale(0.86); } }
.boon-face { position: relative; display: block; width: 100%; aspect-ratio: 384 / 512; filter: drop-shadow(0 5px 0 rgba(20, 14, 34, 0.5)); }
/* The warm ground in the frame's clear window, under the frame. */
.boon-face::before {
  content: "";
  position: absolute;
  left: 23%;
  right: 23%;
  top: 17%;
  bottom: 23%;
  border-radius: 4px;
  background: radial-gradient(circle at 50% 42%, #fffaf0 0 22%, #f6ecd2 50%, #e3c995 100%);
}
.boon-frame { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.boon-frame-drawn { border: 10px solid #b07a45; border-radius: 12px; }
.boon-icon { position: absolute; left: 27%; right: 27%; top: 27%; aspect-ratio: 1; }
.boon-icon svg, .boon-icon img { display: block; width: 100%; height: 100%; }
.boon-name { position: absolute; left: 17%; right: 17%; bottom: 14.5%; display: block; color: var(--cream); font-size: clamp(11px, 1.9vw, 15px); font-weight: 900; line-height: 1; text-align: center; white-space: nowrap; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; }
.boon-say { display: block; max-width: 100%; color: var(--cream); font-size: 13px; font-weight: 800; line-height: 1.15; text-align: center; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; }
.boon-card:active .boon-face { transform: translateY(3px) scale(0.97); }
.boon-card:focus-visible .boon-face { outline: 3px solid #ffd36b; outline-offset: 2px; border-radius: 12px; }
@media (max-aspect-ratio: 1/1) {
  .boon-pick { gap: 10px; }
  .boon-head { flex-wrap: wrap; justify-content: center; row-gap: 2px; }
  .boon-cards { flex-direction: column; align-items: stretch; gap: 10px; }
  .boon-card { flex-direction: row; gap: 12px; width: min(92vw, 380px); text-align: left; }
  .boon-face { flex: 0 0 auto; width: min(34vw, 136px, calc((100dvh - 140px) / 4)); }
  .boon-name { font-size: 12px; }
  .boon-say { font-size: 16px; text-align: left; }
}

/* Tonight's boon in the night chip, by night. */
.night-boon { display: block; width: 26px; height: 26px; margin-left: -2px; }
.night-boon svg, .night-boon img { display: block; width: 100%; height: 100%; }

/* The Dawnburst (Task 31b): by night, beside the hammer. The art's lantern in a dark ring
   that fills gold with the Great Lantern's charge; full, it lights up and pulses. */
.dawnburst {
  position: absolute;
  right: calc(max(14px, var(--safe-right)) + 78px);
  bottom: calc(max(14px, var(--safe-bottom)) + 3px);
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  padding: 0;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: #3b2d5e;
  box-shadow: 0 4px 0 rgba(43, 29, 63, 0.4);
  cursor: pointer;
}
.hud.building .dawnburst { display: none; }
.dawnburst-ring {
  position: absolute;
  inset: 1px;
  border-radius: 50%;
  background: conic-gradient(#ffd36b var(--fill, 0deg), rgba(246, 236, 210, 0.16) 0);
  -webkit-mask: radial-gradient(circle, transparent 60%, #000 62%);
  mask: radial-gradient(circle, transparent 60%, #000 62%);
}
.dawnburst-icon { position: relative; display: block; width: 74%; height: 74%; filter: saturate(0.35) brightness(0.7); transition: filter 0.2s; }
.dawnburst-icon svg, .dawnburst-icon img { display: block; width: 100%; height: 100%; }
.dawnburst:disabled { cursor: default; }
.dawnburst.full { background: #ffe9a8; animation: dawn-ready 1.15s ease-in-out infinite; }
.dawnburst.full .dawnburst-icon { filter: none; }
.dawnburst.full:active { transform: translateY(2px); }
@keyframes dawn-ready {
  0%, 100% { box-shadow: 0 4px 0 rgba(43, 29, 63, 0.4), 0 0 0 0 rgba(255, 236, 160, 0.95); }
  50% { box-shadow: 0 4px 0 rgba(43, 29, 63, 0.4), 0 0 0 14px rgba(255, 236, 160, 0); transform: scale(1.08); }
}
@media (max-aspect-ratio: 1/1) {
  .panel-open .dawnburst { visibility: hidden; }
}

/* Rally (Task 40): from Stonehold by night, left of the Dawnburst. The order in force, the
   shield ("Hold") or the lantern flag ("Follow"), its word on a tag below; following, a
   blue ring pulses round it. */
.rally {
  position: absolute;
  right: calc(max(14px, var(--safe-right)) + 146px);
  bottom: calc(max(14px, var(--safe-bottom)) + 3px);
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  padding: 0;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: var(--cream);
  box-shadow: 0 4px 0 rgba(43, 29, 63, 0.4);
  cursor: pointer;
}
.rally[hidden] { display: none; }
.hud.building .rally { display: none; }
.rally:active { transform: translateY(2px); }
.rally-icon { display: block; width: 80%; height: 80%; margin-top: -6px; }
.rally-icon svg, .rally-icon img { display: block; width: 100%; height: 100%; }
.rally-follow, .rally.following .rally-hold { display: none; }
.rally.following .rally-follow { display: block; }
.rally-word {
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  padding: 0 6px 1px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--cobalt);
  color: var(--cream);
  font-size: 11px;
  font-weight: 900;
  line-height: 1.25;
  white-space: nowrap;
}
.rally.following { background: #dce6ff; animation: rally-follow 1.4s ease-in-out infinite; }
.rally.following .rally-word { background: #ffd36b; color: var(--ink); }
@keyframes rally-follow {
  0%, 100% { box-shadow: 0 4px 0 rgba(43, 29, 63, 0.4), 0 0 0 0 rgba(91, 140, 255, 0.9); }
  50% { box-shadow: 0 4px 0 rgba(43, 29, 63, 0.4), 0 0 0 9px rgba(91, 140, 255, 0); }
}
@media (max-aspect-ratio: 1/1) {
  .panel-open .rally { visibility: hidden; }
}

/* Its flash: the whole screen goes warm white and fades. */
.dawn-flash {
  position: absolute;
  inset: 0;
  z-index: 11;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle at 50% 55%, rgba(255, 255, 244, 0.96) 0%, rgba(255, 238, 178, 0.8) 42%, rgba(255, 206, 120, 0.4) 100%);
}
.dawn-flash.up { animation: dawn-flash 0.8s ease-out forwards; }
/* Bright Dawnburst's (Task 85): whiter in the middle, gold to the edges, a little longer. */
.dawn-flash.bright { background: radial-gradient(circle at 50% 55%, rgba(255, 255, 255, 1) 0%, rgba(255, 246, 214, 0.9) 30%, rgba(255, 210, 92, 0.6) 70%, rgba(255, 178, 40, 0.45) 100%); }
.dawn-flash.bright.up { animation-duration: 1.05s; }
@keyframes dawn-flash { 0% { opacity: 0; } 10% { opacity: 1; } 100% { opacity: 0; } }

/* How to play (Task 105, hud/howto.js): over the title and the game, a cream box on a dark
   veil (a tap on the veil puts it away). Its head holds the four groups' tabs (on a line of
   their own upright); its cards, two across in landscape and one upright, scroll inside it,
   each a picture with a small drawn hand for the touch, a name and a line or two. */
.howto {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(10px, var(--safe-top)) max(12px, var(--safe-right)) max(10px, var(--safe-bottom)) max(12px, var(--safe-left));
  background: rgba(20, 15, 40, 0.6);
}
.howto[hidden] { display: none; }
.howto-box {
  display: flex;
  flex-direction: column;
  gap: 7px;
  width: min(800px, 100%);
  height: min(100%, 520px);
  padding: 7px 10px 10px;
  border: 4px solid var(--ink);
  border-radius: 22px;
  background: var(--cream);
  box-shadow: 0 6px 0 rgba(43, 29, 63, 0.5);
  animation: howto-in 0.18s ease-out;
}
@keyframes howto-in { from { opacity: 0; transform: scale(0.94); } }
.howto-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.howto-icon { display: block; width: 30px; height: 30px; flex: 0 0 auto; }
.howto-icon svg { display: block; width: 100%; height: 100%; }
.howto-title { font-size: 19px; font-weight: 900; white-space: nowrap; }
.howto-tabs { display: flex; gap: 5px; margin-left: auto; }
.howto-tab {
  padding: 5px 11px 6px;
  border: 2.5px solid var(--ink);
  border-radius: 14px;
  background: #fffaf0;
  font: inherit;
  font-size: 14px;
  font-weight: 900;
  line-height: 1.1;
  color: var(--ink);
  white-space: nowrap;
  cursor: pointer;
}
.howto-tab.on { background: var(--cobalt); color: var(--cream); box-shadow: inset 0 -3px 0 rgba(43, 29, 63, 0.35); }
.howto .howto-close { margin-left: 0; }
.howto-cards {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-content: start;
  gap: 6px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1px 2px 4px 1px;
}
.howto-card { display: flex; align-items: center; gap: 10px; padding: 5px 9px 5px 6px; border: 2.5px solid var(--ink); border-radius: 14px; background: #fffaf0; }
.howto-pic { position: relative; display: block; width: 50px; height: 50px; flex: 0 0 auto; }
.howto-pic > svg, .howto-pic > img { display: block; width: 100%; height: 100%; }
.howto-hand { position: absolute; right: -8px; bottom: -6px; width: 30px; height: 30px; }
.howto-hand svg { display: block; width: 100%; height: 100%; }
.howto-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.howto-name { font-size: 15px; font-weight: 900; line-height: 1.15; }
.howto-say { font-size: 12.5px; font-weight: 700; line-height: 1.25; color: #4a3b5e; }
@media (max-aspect-ratio: 1/1) {
  .howto-box { height: min(100%, 760px); }
  .howto-tabs { order: 3; width: 100%; margin-left: 0; }
  /* (Five since Task 116h: each shares the width, its words a little smaller.) */
  .howto-tabs { gap: 4px; }
  .howto-tab { flex: 1 1 0; min-width: 0; padding: 6px 1px 7px; font-size: 12.5px; letter-spacing: -0.01em; }
  .howto .howto-close { margin-left: auto; }
  .howto-cards { grid-template-columns: 1fr; }
}
/* Its buttons: How to play first under Play on the title, with the copy buttons; and in the
   quest panel's head, beside its close button. */
.title-copies { flex-wrap: wrap; justify-content: center; }
.title-copies .title-help, .quest-help { display: inline-flex; align-items: center; gap: 6px; }
.title-copies .title-help { padding-left: 7px; background: #ffe9a8; }
.title-help svg { display: block; width: 24px; height: 24px; flex: 0 0 auto; }
.quest-panel .quest-help + .panel-close { margin-left: 0; }
.quest-help {
  flex: 0 0 auto;
  margin-left: auto;
  padding: 3px 10px 4px 4px;
  border: 2.5px solid var(--ink);
  border-radius: 14px;
  background: #ffe9a8;
  box-shadow: 0 2px 0 rgba(43, 29, 63, 0.4);
  font: inherit;
  font-size: 13px;
  font-weight: 900;
  color: var(--ink);
  white-space: nowrap;
  cursor: pointer;
}
.quest-help svg { display: block; width: 22px; height: 22px; flex: 0 0 auto; }
.quest-help:active, .title-copies .title-help:active { transform: translateY(2px); }

/* The campaign (Task 116b; DESIGN.md, "The campaign and the sandbox"): the title's Campaign and
   Sandbox, the Sandbox's sheet, the Lantern Road (hud/road.js), a level's panel and its end
   (hud/levelpanel.js), and the goal chip in a level. */
.title-modes { margin-top: auto; margin-bottom: 1.4vh; display: flex; gap: 12px; }
.title-mode, .title-mode.title-play {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 214px;
  margin: 0;
  padding: 6px 16px 8px;
  border: 4px solid var(--ink);
  border-radius: 26px;
  background: var(--cream);
  box-shadow: 0 6px 0 rgba(43, 29, 63, 0.55);
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  cursor: pointer;
  animation: none;
}
.title-mode:active { transform: translateY(3px); box-shadow: 0 3px 0 rgba(43, 29, 63, 0.55); }
.title-mode b { display: flex; align-items: center; gap: 8px; font-size: clamp(24px, 6.4vmin, 30px); font-weight: 900; line-height: 1.05; }
.title-mode b img, .title-mode b svg { display: block; width: 34px; height: 34px; flex: 0 0 auto; }
.title-mode-says { max-width: 280px; overflow: hidden; text-overflow: ellipsis; font-size: 12.5px; font-weight: 900; color: #5a4a6e; white-space: nowrap; }
.title-campaign { background: #ffd36b; animation: title-play 1.6s ease-in-out infinite; }
.title.asking .title-campaign, .title.sheet-up .title-campaign { animation: none; }
/* The Lantern Road lit (Task 116g-3): once the Gloam is felled in 5-5, a warm light over the
   title's painting (under the words), lantern sparks drifting up through it, and the line under
   the name gold ("The Lantern Road is lit"). On the road, its name chip glows. */
.title-glow {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(ellipse 70% 55% at 50% 36%, rgba(255, 214, 120, 0.42), rgba(255, 190, 90, 0.12) 55%, rgba(255, 190, 90, 0) 75%),
    linear-gradient(to top, rgba(255, 170, 60, 0.3), rgba(255, 170, 60, 0) 45%);
  mix-blend-mode: screen;
}
.title-glow i {
  position: absolute;
  bottom: -12px;
  width: var(--size, 6px);
  height: var(--size, 6px);
  border-radius: 50%;
  background: radial-gradient(circle, #fff6c8 0 30%, #ffc62e 55%, rgba(255, 198, 46, 0) 72%);
  opacity: 0;
  animation: title-spark 9s linear infinite;
}
@keyframes title-spark {
  0% { transform: translate(0, 0); opacity: 0; }
  12% { opacity: 0.95; }
  70% { opacity: 0.8; }
  100% { transform: translate(14px, -78vh); opacity: 0; }
}
.title.lit .title-line { background: #ffd36b; box-shadow: 0 0 0 3px #fff6c8, 0 0 22px 8px rgba(255, 198, 46, 0.7); }
.road-name.lit { box-shadow: 0 0 0 3px #fff6c8, 0 0 18px 6px rgba(255, 198, 46, 0.7), 0 4px 0 rgba(0, 0, 0, 0.35); }
@media (prefers-reduced-motion: reduce) {
  .title-glow i { display: none; }
}
.title-sheet {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  width: min(560px, calc(100% - 20px));
  max-height: calc(100% - 16px);
  overflow-y: auto;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 7px;
  padding: 8px 12px 12px;
  border: 3px solid var(--ink);
  border-radius: 20px;
  background: var(--cream);
  box-shadow: 0 0 0 100vmax rgba(20, 15, 40, 0.55), 0 6px 0 rgba(43, 29, 63, 0.45);
}
.title-sheet[hidden] { display: none; }
/* "Start again?" and "Open this copy?" over the sheet (New game asks from it). */
.title-ask { z-index: 3; }
.title-sheet-head { display: flex; align-items: center; gap: 8px; }
.title-sheet-head img, .title-sheet-head > svg { display: block; width: 30px; height: 30px; }
.title-sheet-name { font-size: 21px; font-weight: 900; }
.title-sheet-close, .road-card-close, .level-menu-close, .game-menu-close {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  margin-left: auto;
  padding: 0;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: #e05a45;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.3);
  cursor: pointer;
}
.title-sheet-close svg, .road-card-close svg, .level-menu-close svg, .game-menu-close svg { width: 15px; height: 15px; }
.title-yours { display: flex; align-items: center; gap: 10px; padding: 5px 6px 5px 10px; border: 2.5px solid var(--ink); border-radius: 14px; background: #fffaf0; }
.title-yours .title-note { flex: 1; min-width: 0; margin: 0; color: var(--ink); font-size: 15px; font-weight: 900; line-height: 1.2; -webkit-text-stroke: 0; }
.title-yours .title-note small { display: block; font-size: 11.5px; font-weight: 800; color: #6a5a80; }
.title-yours .title-play { flex: 0 0 auto; min-width: 0; margin: 0; padding: 6px 18px 7px; border-width: 3px; border-radius: 18px; font-size: 20px; box-shadow: 0 4px 0 rgba(43, 29, 63, 0.5); }
.title-sheet .title-records { margin: 0; align-self: center; box-shadow: none; }
.title-sheet .title-new { align-self: center; }
.title-sheet-home { display: flex; flex-direction: column; align-items: stretch; gap: 7px; }
.title-sheet-home[hidden], .title-choose[hidden], .title-sheet-back[hidden] { display: none; }
/* A best set in a game begun further on (Task 116h): where, small and gold-brown under its name. */
.title-record-from { font-size: 9.5px; font-style: normal; font-weight: 900; color: #a8662e; white-space: nowrap; line-height: 1.1; }
/* On the sheet the five share its width, each name wrapping under its value as upright. */
.title-sheet .title-records-list { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 2px 8px; }
.title-sheet .title-record span, .title-sheet .title-record-from { white-space: normal; text-align: center; line-height: 1.1; }
/* His game's land, small beside its night and coins (Task 116h). */
.title-yours-pic { flex: 0 0 auto; display: block; width: 54px; }
.title-yours-pic .title-land-pic { height: 34px; }

/* A new game's page on the Sandbox's sheet (Task 116h): the lands, where it starts, Start. Wider
   than his game's page, so the six lands sit in one row in landscape. */
.title-sheet.choosing { width: min(820px, calc(100% - 16px)); gap: 5px; padding-top: 6px; }
.title-sheet-back {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: #fffaf0;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.25);
  cursor: pointer;
}
.title-sheet-back svg { width: 16px; height: 16px; }
.title-choose { display: flex; flex-direction: column; gap: 5px; }
.title-choose-label { font-size: 11.5px; font-weight: 900; letter-spacing: 0.04em; text-transform: uppercase; color: #5a4a6e; }
.title-lands { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.title-land {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 0;
  padding: 4px 3px 5px;
  border: 2.5px solid var(--ink);
  border-radius: 12px;
  background: #fffaf0;
  color: var(--ink);
  font: inherit;
  text-align: center;
  cursor: pointer;
}
.title-land b { font-size: 12.5px; font-weight: 900; line-height: 1.05; }
.title-land small { font-size: 9.5px; font-weight: 800; line-height: 1.12; color: #6a5a80; }
.title-land-pic { display: block; width: 100%; height: 38px; border: 2px solid var(--ink); border-radius: 7px; }
.title-land.on, .title-head.on { background: #d9f6ea; box-shadow: 0 0 0 3px #43d1a7; }
.title-land.shut, .title-head.shut { background: #e6dfcb; border-color: #8b7f97; color: #8b7f97; }
.title-land.shut small { color: #9a90a6; }
.title-land.shut .title-land-pic { filter: grayscale(0.85) brightness(0.82); border-color: #8b7f97; }
.title-lock {
  position: absolute;
  left: 50%;
  top: 12px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 3px;
  max-width: calc(100% - 4px);
  padding: 0 6px 1px;
  border: 2px solid #120e22;
  border-radius: 9px;
  background: #4a4572;
  color: #e6e0ff;
  font-size: 9.5px;
  font-weight: 900;
  line-height: 1.05;
  text-align: center;
  /* (Two short lines where the phone's font runs wide, never cut.) */
  white-space: normal;
}
.title-lock svg, .title-head svg { flex: 0 0 auto; width: 10px; height: 11px; }
.title-heads { display: flex; flex-wrap: wrap; gap: 5px; }
.title-head {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 30px;
  padding: 0 10px;
  border: 2.5px solid var(--ink);
  border-radius: 11px;
  background: #fffaf0;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
  cursor: pointer;
}
.title-head small { font-size: 10.5px; font-weight: 800; color: #6a5a80; }
.title-head.shut small { color: #9a90a6; }
.title-choose-foot { display: flex; align-items: center; gap: 10px; margin-top: 2px; }
.title-choose-note { flex: 1; min-width: 0; font-size: 12px; font-weight: 800; line-height: 1.25; color: #5a4a6e; }
.title-choose-note.why { color: #a8402e; }
.title-start {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 18px 8px;
  border: 3px solid var(--ink);
  border-radius: 18px;
  background: #7ed957;
  box-shadow: 0 4px 0 rgba(43, 29, 63, 0.5);
  color: var(--ink);
  font: inherit;
  font-size: 18px;
  font-weight: 900;
  cursor: pointer;
}
.title-start svg { width: 13px; height: 13px; }
.title-start:active, .title-land:active, .title-head:active { transform: translateY(2px); }
.title-start:active { box-shadow: 0 2px 0 rgba(43, 29, 63, 0.5); }
@media (max-aspect-ratio: 1/1) {
  .title-sheet.choosing { width: calc(100% - 16px); }
  .title-lands { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .title-lock { gap: 2px; padding: 0 4px 1px; font-size: 8.5px; }
  .title-lock svg { width: 8px; height: 9px; }
  .title-yours-pic { width: 44px; }
  .title-yours-pic .title-land-pic { height: 30px; }
  .title-choose-foot { flex-direction: column; align-items: stretch; gap: 7px; }
  .title-start { justify-content: center; }
}
@media (max-aspect-ratio: 1/1) {
  .title-modes { flex-direction: column; gap: 10px; }
  .title-mode, .title-mode.title-play { min-width: 280px; }
  .title-sheet { top: auto; bottom: max(8px, var(--safe-bottom)); transform: translateX(-50%); }
  .title-sheet .title-records-list { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px 6px; }
  .title-sheet .title-record span { white-space: normal; text-align: center; line-height: 1.1; }
}

/* The goal chip in a level: a star, "Goal", and its words. */
.goal.level .goal-next { background: #a8662e; }
.goal.level.won { background: #ffe9a8; }
.goal.level.won .goal-next { background: #3f8a35; }

/* The Lantern Road, over the title. */
.road { position: absolute; inset: 0; z-index: 22; overflow: hidden; background: #141128; touch-action: none; user-select: none; -webkit-user-select: none; }
.road[hidden] { display: none; }
.road-defs { position: absolute; width: 0; height: 0; }
.road-view { position: absolute; inset: 0; overflow: hidden; touch-action: none; }
.road-world { position: absolute; left: 0; top: 0; will-change: transform; }
.road-map { position: absolute; left: 0; top: 0; display: block; }
.road-names, .road-nodes { position: absolute; inset: 0; }
.road-names { pointer-events: none; }
.road-lv { position: absolute; width: 0; height: 0; padding: 0; border: 0; background: none; font: inherit; color: var(--ink); cursor: pointer; }
.road-lv-ring { position: absolute; left: -23px; top: -23px; width: 46px; height: 46px; display: grid; place-items: center; border: 3px solid var(--ink); border-radius: 50%; background: #3d3870; box-shadow: 0 3px 0 rgba(0, 0, 0, 0.4); }
.road-lv-ring img, .road-lv-ring svg { display: block; width: 34px; height: 34px; }
.road-lv.done .road-lv-ring { background: var(--cream); box-shadow: 0 0 0 3px var(--gold), 0 0 16px 5px rgba(255, 198, 46, 0.55), 0 3px 0 rgba(0, 0, 0, 0.4); }
.road-lv.next .road-lv-ring, .road-lv.playing .road-lv-ring { background: #ffe9b0; box-shadow: 0 0 0 4px #fff, 0 0 0 7px var(--gold), 0 0 24px 10px rgba(255, 198, 46, 0.7); animation: road-next 1.6s ease-in-out infinite; }
@keyframes road-next { 50% { transform: scale(1.08); } }
.road-lv.open .road-lv-ring { background: #ffe9b0; box-shadow: 0 0 0 3px var(--gold); }
.road-lv.shut .road-lv-ring { background: #24203f; border-color: #120e22; }
.road-lv.shut .road-lv-ring img, .road-lv.shut .road-lv-ring svg { opacity: 0.25; filter: grayscale(1); }
.road-lv.finale .road-lv-ring { left: -30px; top: -30px; width: 60px; height: 60px; border-width: 3.5px; }
.road-lv.finale .road-lv-ring img, .road-lv.finale .road-lv-ring svg { width: 48px; height: 48px; }
/* A boss's portrait (the art's 230 px circle in 256) drawn at 256/230 of the ring's inside, so its
   circle fills the ring; Old Foes' two overlapping, each a little smaller. */
.road-lv.finale .road-lv-ring { overflow: hidden; }
.road-lv.finale .road-lv-ring img.road-portrait { position: absolute; left: 50%; top: 50%; width: calc(100% * 256 / 230); height: calc(100% * 256 / 230); max-width: none; transform: translate(-50%, -50%); }
.road-lv.finale .road-lv-ring img.road-portrait.two { left: auto; top: 14%; width: 74%; height: 74%; transform: none; }
.road-lv.finale .road-lv-ring img.road-portrait.two.at0 { left: -6%; }
.road-lv.finale .road-lv-ring img.road-portrait.two.at1 { right: -6%; }
.road-lv.picked .road-lv-ring { outline: 4px solid #fff; outline-offset: 4px; }
.road-lv-num { position: absolute; z-index: 1; left: 0; top: -38px; transform: translateX(-50%); padding: 0 6px 1px; border: 2px solid var(--ink); border-radius: 8px; background: var(--cream); font-size: 11px; font-weight: 900; white-space: nowrap; }
.road-lv.finale .road-lv-num { top: -45px; }
.road-lv.shut .road-lv-num { background: #6b6690; color: #1b1838; }
.road-lv-stars { position: absolute; left: 0; top: 22px; transform: translateX(-50%); display: flex; }
.road-lv.finale .road-lv-stars { top: 29px; }
.road-lv-stars svg { width: 16px; height: 16px; margin: 0 -1px; }
.road-lv-play { position: absolute; left: 0; top: 26px; transform: translateX(-50%); padding: 1px 8px 2px; border: 2.5px solid var(--ink); border-radius: 10px; background: #7ed957; font-size: 12px; font-weight: 900; white-space: nowrap; }
.road-lv.finale .road-lv-play { top: 33px; }
.road-lv.playing .road-lv-play { background: #ffd36b; }
.road-land { position: absolute; transform: translate(-50%, -50%); text-align: center; white-space: nowrap; }
.road-land b { display: block; font-size: 21px; font-weight: 900; line-height: 1.05; color: var(--cream); -webkit-text-stroke: 5px var(--ink); paint-order: stroke fill; }
.road-land span { display: inline-flex; align-items: center; gap: 4px; margin-top: 3px; padding: 1px 8px 2px; border: 2.5px solid var(--ink); border-radius: 10px; background: var(--cream); font-size: 11.5px; font-weight: 900; color: var(--ink); }
.road-land span svg { width: 13px; height: 13px; }
.road-land.shut b { color: #b7b0dc; }
.road-land.shut span { background: #4a4572; color: #e6e0ff; border-color: #120e22; }
.road-fade { position: absolute; left: 0; right: 0; top: 0; height: 58px; background: linear-gradient(rgba(20, 17, 40, 0.85) 40%, rgba(20, 17, 40, 0)); pointer-events: none; }
.road-bar { position: absolute; left: max(10px, var(--safe-left)); right: max(10px, var(--safe-right)); top: max(8px, var(--safe-top)); display: flex; align-items: center; gap: 8px; pointer-events: none; }
.road-bar > * { pointer-events: auto; }
.road-back { flex: 0 0 auto; display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 3px solid var(--ink); border-radius: 50%; background: var(--cream); box-shadow: 0 3px 0 rgba(0, 0, 0, 0.35); cursor: pointer; }
.road-back svg { width: 20px; height: 20px; }
.road-chip { display: flex; align-items: center; gap: 6px; height: 38px; padding: 0 12px 0 8px; border: 3px solid var(--ink); border-radius: 16px; background: var(--cream); box-shadow: 0 4px 0 rgba(0, 0, 0, 0.35); font-size: 15px; font-weight: 900; white-space: nowrap; font-variant-numeric: tabular-nums; }
.road-chip svg { width: 24px; height: 24px; flex: 0 0 auto; }
.road-chip small { font-size: 12px; font-weight: 800; color: #6a5a80; }
.road-name { padding-left: 12px; background: #ffd36b; font-size: 17px; }
.road-lands { position: absolute; left: max(10px, var(--safe-left)); bottom: max(8px, var(--safe-bottom)); display: flex; flex-wrap: wrap; gap: 4px; max-width: calc(100% - 316px); }
.road-land-chip { display: flex; align-items: center; gap: 3px; height: 28px; padding: 0 7px 0 4px; border: 2.5px solid var(--ink); border-radius: 12px; background: #e9e1cb; font: inherit; font-size: 11.5px; font-weight: 900; color: var(--ink); white-space: nowrap; cursor: pointer; }
.road-land-chip i { width: 13px; height: 13px; border: 2px solid var(--ink); border-radius: 50%; background: var(--c); }
.road-land-chip.on { background: var(--cream); box-shadow: 0 0 0 3px var(--c); }
.road-land-chip b { display: flex; align-items: center; gap: 1px; font-size: 10.5px; font-weight: 800; color: #6a5a80; }
.road-land-chip b svg { width: 11px; height: 11px; }
.road-land-chip.shut { background: #4a4572; color: #e6e0ff; border-color: #120e22; }
.road-land-chip.shut i { background: #6b6690; border-color: #120e22; }
.road-land-chip.shut b { color: #e6e0ff; }
.road-card {
  position: absolute;
  right: max(10px, var(--safe-right));
  top: calc(max(8px, var(--safe-top)) + 46px);
  bottom: max(6px, var(--safe-bottom));
  width: 286px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 7px 11px 9px;
  border: 3px solid var(--ink);
  border-radius: 18px;
  background: var(--cream);
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.4);
  animation: panel-in-side 0.18s ease-out;
}
.road-card[hidden] { display: none; }
.road-card-head { display: flex; align-items: center; gap: 8px; }
.road-card-names { flex: 1; min-width: 0; }
.road-badge { flex: 0 0 auto; display: grid; place-items: center; width: 38px; height: 38px; border: 3px solid var(--ink); border-radius: 50%; background: var(--c); font-size: 14px; font-weight: 900; }
.road-card-title { font-size: 18px; font-weight: 900; line-height: 1.05; }
.road-card-where { display: flex; align-items: center; gap: 5px; margin-top: 2px; font-size: 11px; font-weight: 800; color: #5a4a6e; white-space: nowrap; }
.road-era { padding: 0 7px 1px; border: 2px solid var(--ink); border-radius: 9px; background: var(--cobalt); color: var(--cream); font-size: 10.5px; font-weight: 900; }
.road-card-body { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 5px; }
.road-card p { margin: 0; font-size: 12.5px; font-weight: 700; line-height: 1.25; }
.road-line { font-style: italic; color: #4a3a5e; }
.road-facts { display: flex; flex-wrap: wrap; gap: 4px; }
.road-facts span { padding: 0 7px 1px; border: 2px solid var(--ink); border-radius: 9px; background: #fffaf0; font-size: 11px; font-weight: 900; }
.road-starrows { display: flex; flex-direction: column; gap: 2px; }
.road-starrow { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 800; line-height: 1.15; }
.road-ss { flex: 0 0 auto; display: flex; width: 46px; }
.road-ss svg { width: 15px; height: 15px; margin-right: -1px; }
.road-label { font-size: 10.5px; font-weight: 900; letter-spacing: 0.06em; color: #7a6a8e; text-transform: uppercase; }
.road-news { display: flex; flex-wrap: wrap; gap: 4px 6px; }
.road-new { display: flex; flex-direction: column; align-items: center; width: 60px; text-align: center; font-size: 10px; font-weight: 900; line-height: 1.05; }
.road-new img, .road-new i { display: block; width: 30px; height: 30px; margin-bottom: 2px; padding: 2px; border: 2.5px solid var(--ink); border-radius: 10px; background: #fffaf0; }
.road-start { font-size: 11px !important; color: #5a4a6e; }
.road-go-row { display: flex; gap: 6px; flex: 0 0 auto; }
.road-go { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 10px; border: 3px solid var(--ink); border-radius: 18px; background: #ffd36b; box-shadow: 0 4px 0 rgba(43, 29, 63, 0.5); font: inherit; font-size: 20px; font-weight: 900; color: var(--ink); white-space: nowrap; cursor: pointer; }
.road-go svg { width: 20px; height: 20px; flex: 0 0 auto; }
.road-go-words { display: flex; flex-direction: column; align-items: flex-start; line-height: 1; }
.road-go small { font-size: 11.5px; font-weight: 800; color: #5a4a6e; }
.road-restart { flex: 0 0 auto; height: 44px; padding: 0 12px; border: 3px solid var(--ink); border-radius: 18px; background: var(--cream); box-shadow: 0 4px 0 rgba(43, 29, 63, 0.5); font: inherit; font-size: 14px; font-weight: 900; color: var(--ink); cursor: pointer; }
.road-go:active, .road-restart:active { transform: translateY(2px); }
.road-shut { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; height: 42px; border: 3px solid #120e22; border-radius: 18px; background: #4a4572; color: #e6e0ff; font-size: 15px; font-weight: 900; }
.road-shut svg { width: 16px; height: 16px; }
.road-ask {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(360px, calc(100% - 32px));
  transform: translate(-50%, -50%);
  padding: 14px 16px 16px;
  border: 4px solid var(--ink);
  border-radius: 22px;
  background: var(--cream);
  box-shadow: 0 0 0 100vmax rgba(20, 15, 40, 0.6), 0 6px 0 rgba(43, 29, 63, 0.5);
  text-align: center;
}
.road-ask[hidden] { display: none; }
.road-ask-head { font-size: 22px; font-weight: 900; }
.road-ask-text { margin: 6px 0 12px; font-size: 15px; font-weight: 700; line-height: 1.3; }
.road-ask-buttons { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.road-ask-buttons button { padding: 9px 14px 10px; border: 3px solid var(--ink); border-radius: 18px; box-shadow: 0 4px 0 rgba(43, 29, 63, 0.5); font: inherit; font-size: 16px; font-weight: 900; color: var(--ink); cursor: pointer; }
.road-ask-no { background: #ffd36b; }
.road-ask-yes { background: #fff4de; }
@media (max-aspect-ratio: 1/1) {
  .road-name, .road-lands { display: none; }
  .road-card { left: max(8px, var(--safe-left)); right: max(8px, var(--safe-right)); top: auto; bottom: max(8px, var(--safe-bottom)); width: auto; max-height: 56%; animation-name: panel-in-up; }
}

/* A level's panel (from the goal chip). */
.level-menu { width: 300px; }
/* On a short landscape screen it stands left of the hammer and reaches down to the bottom
   (Task 120: 1-3's, a goal of two parts, ran past the room left above the hammer, its Restart
   and Map hidden below). */
@media (min-aspect-ratio: 1/1) and (max-height: 520px) {
  .level-menu { right: calc(max(14px, var(--safe-right)) + 74px); max-height: calc(100% - max(8px, var(--safe-top)) - 52px - max(8px, var(--safe-bottom))); }
}
.level-menu-head { display: flex; align-items: center; gap: 8px; }
.level-menu-badge { flex: 0 0 auto; display: grid; place-items: center; width: 36px; height: 36px; border: 3px solid var(--ink); border-radius: 50%; background: var(--c); font-size: 13px; font-weight: 900; }
.level-menu-names { flex: 1; min-width: 0; }
.level-menu-title { font-size: 18px; font-weight: 900; line-height: 1.05; }
.level-menu-where { font-size: 11.5px; font-weight: 800; color: #5a4a6e; }
.level-menu-line { margin: 0; font-size: 12.5px; font-weight: 700; font-style: italic; line-height: 1.25; color: #4a3a5e; }
.level-menu-row { display: flex; align-items: center; gap: 7px; padding: 3px 6px; border: 2px solid var(--ink); border-radius: 11px; background: #fffaf0; font-size: 12.5px; font-weight: 800; line-height: 1.15; }
.level-menu-row > span:nth-child(2) { flex: 1; }
.level-menu-row > b { flex: 0 0 auto; padding: 0 6px 1px; border-radius: 8px; background: #ece3cc; font-size: 11px; white-space: nowrap; }
.level-menu-row.ok > b { background: #b8f08a; }
.level-menu-row.missed > b { background: #f3b2a6; }
.level-menu-stars { flex: 0 0 auto; display: flex; width: 44px; }
.level-menu-stars svg { width: 14px; height: 14px; margin-right: -1px; }
.level-menu-goal { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.level-menu-part { display: flex; align-items: center; gap: 6px; }
.level-menu-part span { flex: 1; }
.level-menu-part b { flex: 0 0 auto; padding: 0 6px 1px; border-radius: 8px; background: #ece3cc; font-size: 11px; white-space: nowrap; }
.level-menu-part.done b { background: #b8f08a; }
/* "Show me" under a by-day aim (Task 120): small, gold, the way to it. */
.level-menu-lead { align-self: flex-start; margin: 1px 0 2px; padding: 2px 10px 3px; border: 2.5px solid var(--ink); border-radius: 10px; background: #ffd36b; box-shadow: 0 2px 0 rgba(43, 29, 63, 0.45); font: inherit; font-size: 12px; font-weight: 900; color: var(--ink); cursor: pointer; }
.level-menu-buttons { display: flex; gap: 8px; }
.level-menu-buttons button { flex: 1; height: 40px; border: 3px solid var(--ink); border-radius: 16px; background: var(--cream); box-shadow: 0 3px 0 rgba(43, 29, 63, 0.45); font: inherit; font-size: 15px; font-weight: 900; color: var(--ink); cursor: pointer; }
.level-menu-buttons .level-menu-map, .level-menu-buttons .level-menu-keep { background: #ffd36b; }
.level-menu-buttons .level-menu-again { background: #e05a45; color: #fff; }
.level-menu-ask { display: flex; flex-direction: column; gap: 6px; padding: 6px; border: 2.5px solid var(--ink); border-radius: 12px; background: #ffe9d9; }
.level-menu-ask[hidden] { display: none; }
.level-menu-ask-text { font-size: 13px; font-weight: 800; line-height: 1.25; }
.level-menu.asking > .level-menu-buttons { display: none; }

/* A level's end: the stars rise one by one. */
.level-end { position: absolute; inset: 0; z-index: 21; display: grid; place-items: center; padding: 10px; background: rgba(10, 8, 24, 0.6); }
.level-end[hidden] { display: none; }
.level-end-box {
  width: min(540px, 100%);
  max-height: 100%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 14px 12px;
  border: 3px solid var(--ink);
  border-radius: 22px;
  background: var(--cream);
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.45);
  text-align: center;
  animation: level-end-in 0.3s ease-out;
}
@keyframes level-end-in { from { opacity: 0; transform: scale(0.85); } }
.level-end-title { font-size: 28px; font-weight: 900; line-height: 1; color: #ffd36b; -webkit-text-stroke: 6px var(--ink); paint-order: stroke fill; }
.level-end-sub { font-size: 13px; font-weight: 800; color: #5a4a6e; }
.level-end-stars { display: flex; align-items: flex-end; gap: 6px; }
.level-end-star { display: block; width: 52px; height: 52px; opacity: 0; transform: scale(0.2); animation: level-end-star 0.45s cubic-bezier(0.2, 1.6, 0.4, 1) forwards; }
.level-end-star:nth-child(2) { width: 64px; height: 64px; }
.level-end-star svg { display: block; width: 100%; height: 100%; }
.level-end-star.got { filter: drop-shadow(0 0 8px rgba(255, 198, 46, 0.8)); }
@keyframes level-end-star { to { opacity: 1; transform: scale(1); } }
.level-end-says { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; font-size: 11.5px; font-weight: 800; color: #8b7f97; }
.level-end-says .got { color: #3a2a4e; }
.level-end-kept, .level-end-fresh { display: flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 800; color: #5a4a6e; }
/* The road's Embers this win paid (Task 115a-1). */
.level-end-embers { display: flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 900; color: #b04a12; }
.level-end-ember { display: block; width: 18px; height: 18px; }
.level-end-ember svg, .level-end-ember img { display: block; width: 100%; height: 100%; }
.level-end-kept svg { width: 14px; height: 14px; }
.level-end-opens { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.level-end-open { display: flex; align-items: center; gap: 7px; max-width: 260px; padding: 4px 10px 4px 6px; border: 2.5px solid var(--ink); border-radius: 13px; background: #fffaf0; font-size: 12.5px; font-weight: 900; text-align: left; line-height: 1.15; }
.level-end-open i { flex: 0 0 auto; width: 16px; height: 16px; border: 2.5px solid var(--ink); border-radius: 50%; }
.level-end-open small { display: block; font-size: 10.5px; font-weight: 800; color: #6a5a80; }
.level-end-buttons { display: flex; gap: 8px; width: 100%; }
.level-end-buttons button { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; height: 44px; padding: 0 12px; border: 3px solid var(--ink); border-radius: 17px; background: var(--cream); box-shadow: 0 4px 0 rgba(43, 29, 63, 0.5); font: inherit; font-size: 16px; font-weight: 900; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.level-end-buttons .level-end-next { flex: 2; background: #ffd36b; }
.level-end-buttons svg { width: 18px; height: 18px; flex: 0 0 auto; }
@media (max-aspect-ratio: 1/1) {
  .level-end-title { font-size: 24px; }
  .level-end-buttons { flex-direction: column; }
  .level-end-buttons button, .level-end-buttons .level-end-next { flex: none; }
}

/* The Lantern Tree (Task 115a-2; hud/lanterntree.js; the plan's mock-up tools/mockups/lantern-tree.html):
   full screen over the game or the title, the night sky glowing round the Great Lantern, the seven
   branches drawn in the tree's own pixels and moved and zoomed as one (`.ltree-world`). */
.ltree { position: absolute; inset: 0; z-index: 30; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; color: var(--ink);
  background: radial-gradient(circle at var(--lx, 50%) var(--ly, 50%), #3b3478 0, #262150 26%, #1b1838 60%, #141128 100%); }
.ltree[hidden] { display: none; }
.ltree-defs { position: absolute; width: 0; height: 0; }
.ltree-stars { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.ltree-view { position: absolute; inset: 0; overflow: hidden; touch-action: none; }
.ltree-world { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.ltree-lines { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.ltree-nodes { position: absolute; left: 0; top: 0; }
.lt-gate { fill: none; stroke: #3d3870; stroke-width: 2; stroke-dasharray: 4 10; }
.lt-gate.shut { stroke: #5b5590; stroke-width: 3; stroke-dasharray: 10 8; }
.lt-edge .lt-dim { stroke: #4d4787; stroke-width: 5; stroke-linecap: round; }
.lt-edge .lt-glow { stroke-width: 12; opacity: 0.55; display: none; }
.lt-edge .lt-core { stroke-width: 6; stroke-linecap: round; display: none; }
.lt-edge.lit .lt-glow, .lt-edge.lit .lt-core { display: inline; }
.lt-edge.lit .lt-dim { display: none; }
.lt-lantern { position: absolute; left: -58px; top: -58px; width: 116px; height: 116px; border-radius: 50%; display: grid; place-items: center; pointer-events: none;
  background: radial-gradient(circle, rgba(255, 228, 140, 0.95) 0, rgba(255, 190, 70, 0.55) 45%, rgba(255, 160, 40, 0) 72%); }
.lt-lantern img, .lt-lantern svg { width: 88px; height: 88px; display: block; }
/* A node: its lamp (round; a keystone six-sided; an endless node in a dashed ring), its pip (level
   or price) and its name under it. */
.lt-node { position: absolute; width: 0; height: 0; padding: 0; border: 0; background: none; font: inherit; color: var(--ink); cursor: pointer; }
.lt-lamp { position: absolute; left: -23px; top: -23px; width: 46px; height: 46px; border-radius: 50%; border: 3px solid var(--ink); background: #3d3870; display: grid; place-items: center; }
.lt-lamp img, .lt-lamp > svg:not(.lt-hex), .lt-noart { display: block; width: 36px; height: 36px; }
.lt-node.dark .lt-lamp img { opacity: 0.55; filter: saturate(0.5); }
.lt-node.locked .lt-lamp { background: #24203f; border-color: #120e22; }
.lt-node.locked .lt-lamp img, .lt-node.locked .lt-lamp > svg:not(.lt-hex) { opacity: 0.22; filter: grayscale(1); }
.lt-node.lit .lt-lamp { background: var(--cream); box-shadow: 0 0 0 3px var(--c), 0 0 18px 6px color-mix(in srgb, var(--c) 70%, transparent); }
.lt-node.full .lt-lamp { box-shadow: 0 0 0 3px var(--gold), 0 0 0 6px var(--ink), 0 0 22px 8px rgba(255, 198, 46, 0.6); }
.lt-node.can .lt-lamp { box-shadow: 0 0 0 3px var(--gold), 0 0 14px 4px rgba(255, 198, 46, 0.55); animation: lt-can 1.6s ease-in-out infinite; }
@keyframes lt-can { 50% { box-shadow: 0 0 0 4px var(--gold), 0 0 22px 9px rgba(255, 198, 46, 0.75); } }
.lt-node.picked .lt-lamp { outline: 4px solid #fff; outline-offset: 5px; }
.lt-node.key .lt-lamp { border: 0; background: none; border-radius: 0; left: -28px; top: -28px; width: 56px; height: 56px; box-shadow: none; animation: none; }
.lt-hex { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.lt-hex polygon { fill: #3d3870; stroke: var(--ink); stroke-width: 3; }
.lt-node.key.lit .lt-hex polygon { fill: var(--cream); }
.lt-node.key.lit .lt-hex { filter: drop-shadow(0 0 8px var(--c)); }
.lt-node.key.locked .lt-hex polygon { fill: #24203f; stroke: #120e22; }
.lt-node.key.can .lt-hex polygon { stroke: var(--gold); stroke-width: 4; }
.lt-node.key .lt-lamp img { position: relative; }
.lt-node.endless .lt-lamp::after { content: ""; position: absolute; inset: -9px; border-radius: 50%; border: 3px dashed var(--c); opacity: 0.8; }
.lt-node.picked.key .lt-lamp { outline: none; }
.lt-node.picked.key .lt-hex { filter: drop-shadow(0 0 3px #fff) drop-shadow(0 0 3px #fff); }
.lt-node.pop .lt-lamp { animation: lt-pop 0.42s ease-out; }
@keyframes lt-pop { 0% { transform: scale(1); } 35% { transform: scale(1.35); } 100% { transform: scale(1); } }
.lt-pip { position: absolute; left: 0; top: 14px; transform: translateX(-50%); display: flex; align-items: center; gap: 2px; padding: 0 5px 1px; border: 2px solid var(--ink); border-radius: 8px;
  background: var(--cream); font-size: 10.5px; font-weight: 900; line-height: 1.25; white-space: nowrap; font-variant-numeric: tabular-nums; pointer-events: none; }
.lt-node.key .lt-pip { top: 19px; }
.lt-node.full .lt-pip { background: var(--gold); }
.lt-node.can .lt-pip { background: #ffe9b0; }
.lt-node.locked .lt-pip { background: #6b6690; color: #1b1838; }
.lt-ember { display: block; width: 12px; height: 12px; flex: 0 0 auto; }
.lt-ember svg, .lt-ember img { display: block; width: 100%; height: 100%; }
.lt-name { position: absolute; left: 0; top: 32px; transform: translateX(-50%); width: 96px; text-align: center; font-size: 10.5px; font-weight: 900; line-height: 1.05;
  color: var(--cream); -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; pointer-events: none; }
.lt-node.key .lt-name { top: 36px; }
.lt-node.locked .lt-name { color: #8d88b8; }
.lt-or { position: absolute; transform: translate(-50%, -50%); padding: 0 6px 1px; border: 2px solid var(--ink); border-radius: 9px; background: #e4dcc6; font-size: 10.5px; font-weight: 900; pointer-events: none; }
.lt-lock { position: absolute; transform: translate(-50%, calc(-100% - 27px)); display: flex; align-items: center; gap: 3px; padding: 1px 7px 2px 5px; border: 2px solid #120e22; border-radius: 10px;
  background: #4a4572; color: #e6e0ff; font-size: 10px; font-weight: 900; white-space: nowrap; pointer-events: none; }
.lt-lock[hidden] { display: none; }
.lt-lock svg { width: 11px; height: 11px; }
/* Seen whole: no pips, names or locks; the branches named round it. */
.ltree.far .lt-pip, .ltree.far .lt-name, .ltree.far .lt-or, .ltree.far .lt-lock { display: none; }
.ltree-names { position: absolute; inset: 0; pointer-events: none; display: none; }
.ltree.far .ltree-names { display: block; }
.ltree.far .ltree-branches { display: none; }
.lt-bname { position: absolute; transform: translate(-50%, -50%); padding: 2px 10px 3px; border: 3px solid var(--ink); border-radius: 13px; font: inherit; font-size: 13px; font-weight: 900;
  color: var(--ink); white-space: nowrap; box-shadow: 0 3px 0 rgba(0, 0, 0, 0.35); pointer-events: auto; cursor: pointer; }
.lt-bname small { margin-left: 4px; font-size: 11px; opacity: 0.75; }
/* The top row: the name (landscape), the Embers, close. */
.ltree-fade { position: absolute; left: 0; right: 0; top: 0; height: 58px; background: linear-gradient(#141128 55%, rgba(20, 17, 40, 0)); pointer-events: none; }
.ltree-bar { position: absolute; left: max(10px, var(--safe-left)); right: max(10px, var(--safe-right)); top: max(8px, var(--safe-top)); display: flex; align-items: center; gap: 8px; pointer-events: none; }
.ltree-bar > * { pointer-events: auto; }
.ltree-chip { display: flex; align-items: center; gap: 6px; height: 38px; padding: 0 12px 0 8px; border: 3px solid var(--ink); border-radius: 16px; background: var(--cream);
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.35); font-size: 15px; font-weight: 900; white-space: nowrap; }
.ltree-chip svg, .ltree-chip img { width: 26px; height: 26px; flex: 0 0 auto; }
.ltree-title { font-size: 17px; background: #ffd36b; }
.ltree-embers { font-size: 20px; font-variant-numeric: tabular-nums; }
.ltree-embers .lt-ember { width: 26px; height: 26px; }
.ltree-close { flex: 0 0 auto; margin-left: auto; display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 3px solid var(--ink); border-radius: 50%; background: #e05a45;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.35); cursor: pointer; }
.ltree-close svg { width: 18px; height: 18px; }
/* Re-light (Task 115c-3): in the top row once anything is lit, before the close; its card lists the
   branches lit, each with what it gives back, the one picked ringed in its colour. */
.ltree-relight { flex: 0 0 auto; margin-left: auto; padding: 0 12px 0 7px; background: #d4f4e6; color: var(--ink); font: inherit; font-size: 14px; font-weight: 900; cursor: pointer; }
.ltree-relight[hidden] { display: none; }
.ltree-relight svg { width: 22px; height: 22px; color: #17765a; }
.ltree-relight:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35); }
.ltree-relight:not([hidden]) + .ltree-close { margin-left: 0; }
.ltree-embers.pop { animation: lt-pop 0.42s ease-out; }
.lt-rl-list { display: flex; flex-direction: column; gap: 4px; }
.lt-rl-row { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 8px; border: 2.5px solid var(--ink); border-radius: 14px; background: #fffaf0; color: var(--ink);
  font: inherit; font-size: 13px; font-weight: 900; text-align: left; cursor: pointer; }
.lt-rl-row i { flex: 0 0 auto; width: 13px; height: 13px; border: 2px solid var(--ink); border-radius: 50%; background: var(--c); }
.lt-rl-row small { font-size: 11px; font-weight: 800; color: #6f5f84; }
.lt-rl-back { margin-left: auto; display: flex; align-items: center; gap: 2px; font-variant-numeric: tabular-nums; }
.lt-rl-back .lt-ember { width: 18px; height: 18px; }
.lt-rl-row.on { background: #fff1c4; box-shadow: 0 0 0 3px var(--c); }
.lt-card-body .lt-rl-done { display: flex; align-items: center; gap: 5px; color: #1f7a52; }
.lt-rl-done svg { width: 14px; height: 14px; flex: 0 0 auto; }
/* The branches, a tap gliding to each (the first, the whole tree). */
.ltree-branches { position: absolute; left: max(10px, var(--safe-left)); bottom: max(8px, var(--safe-bottom)); display: flex; flex-wrap: wrap; gap: 3px; max-width: calc(100% - 20px); }
.ltree:has(.ltree-card:not([hidden])) .ltree-branches { max-width: calc(100% - 304px); }
.lt-bchip { display: flex; align-items: center; gap: 3px; height: 28px; padding: 0 6px 0 4px; border: 2.5px solid var(--ink); border-radius: 12px; background: #e9e1cb; font: inherit; font-size: 11px; font-weight: 900;
  color: var(--ink); white-space: nowrap; cursor: pointer; }
.lt-bchip i { width: 13px; height: 13px; border: 2px solid var(--ink); border-radius: 50%; background: var(--c); }
.lt-bchip.on { background: var(--cream); box-shadow: 0 0 0 3px var(--c, var(--gold)); }
.lt-bchip.lt-all { padding: 0 4px; }
.lt-bchip.lt-all svg, .lt-bchip.lt-all img { width: 22px; height: 22px; display: block; }
/* A node's card: at the side in landscape, a sheet upright. */
.ltree-card { position: absolute; right: max(10px, var(--safe-right)); top: calc(max(8px, var(--safe-top)) + 46px); bottom: max(8px, var(--safe-bottom)); width: 276px; display: flex; flex-direction: column; gap: 5px;
  padding: 7px 11px 10px; border: 3px solid var(--ink); border-radius: 18px; background: var(--cream); box-shadow: 0 5px 0 rgba(0, 0, 0, 0.4); animation: panel-in-side 0.18s ease-out; }
.ltree-card[hidden] { display: none; }
.lt-card-head { display: flex; align-items: center; gap: 8px; }
.lt-card-pic { flex: 0 0 auto; display: grid; place-items: center; width: 44px; height: 44px; border: 3px solid var(--ink); border-radius: 50%; background: #fffaf0; box-shadow: 0 0 0 3px var(--c); }
.lt-card-pic img, .lt-card-pic svg, .lt-card-pic .lt-noart { display: block; width: 34px; height: 34px; }
.lt-card-pic.lt-rl-pic svg { width: 26px; height: 26px; color: #17765a; }
.lt-card-names { flex: 1; min-width: 0; }
.lt-card-name { font-size: 18px; font-weight: 900; line-height: 1.05; }
.lt-card-where { display: flex; align-items: center; gap: 5px; margin-top: 2px; font-size: 11px; font-weight: 800; color: #5a4a6e; white-space: nowrap; }
.lt-card-where i { width: 10px; height: 10px; border: 2px solid var(--ink); border-radius: 50%; background: var(--c); flex: 0 0 auto; }
.lt-lvl { padding: 0 7px 1px; border: 2px solid var(--ink); border-radius: 9px; background: var(--cobalt); color: var(--cream); font-size: 11px; font-weight: 900; }
.lt-lvl.lit { background: #2f9e6a; }
.lt-card-close { flex: 0 0 auto; align-self: flex-start; display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 3px solid var(--ink); border-radius: 50%; background: #e05a45; cursor: pointer; }
.lt-card-close svg { width: 16px; height: 16px; }
.lt-card-body { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 5px; }
.lt-card-body p { margin: 0; font-size: 12.5px; font-weight: 700; line-height: 1.25; }
.lt-card-body b { font-weight: 900; }
.lt-next { color: var(--cobalt); }
.lt-card-body .lt-then { color: #6f5f84; font-size: 11.5px; }
.lt-card-foot { flex: 0 0 auto; display: flex; flex-direction: column; gap: 5px; }
.lt-light { display: flex; align-items: center; justify-content: center; gap: 6px; height: 46px; border: 3px solid var(--ink); border-radius: 18px; background: #ffd36b; box-shadow: 0 4px 0 rgba(43, 29, 63, 0.5);
  font: inherit; font-size: 19px; font-weight: 900; color: var(--ink); cursor: pointer; }
.lt-light .lt-ember { width: 24px; height: 24px; }
.lt-light:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(43, 29, 63, 0.5); }
.lt-light[disabled] { background: #e6dfcb; color: #8b7f97; border-color: #8b7f97; box-shadow: none; cursor: default; }
.lt-why { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 30px; padding: 4px 10px; border: 2.5px solid var(--ink); border-radius: 14px; background: #fffaf0;
  font-size: 12.5px; font-weight: 900; line-height: 1.2; text-align: center; }
.lt-why svg { width: 15px; height: 15px; flex: 0 0 auto; }
.lt-why.lt-shut { background: #4a4572; color: #e6e0ff; border-color: #120e22; }
.lt-why.lt-done { background: #d9f6ea; color: #1f7a52; }
.lt-why.lt-soon { background: #efe8ff; color: #4a3a6e; font-weight: 800; }
/* Builders' Orders' settings (Task 115a-3): a switch, the share's slider, the order's chips (those
   More Orders opens shut, with a lock), in Clockwork's green. */
.lt-card-foot:empty { display: none; }
.lt-orders { display: flex; flex-direction: column; gap: 5px; margin-top: 2px; padding: 6px 8px 7px; border: 2.5px solid var(--ink); border-radius: 14px; background: #eefaf4; }
.lt-switch { align-self: flex-start; display: flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px 0 4px; border: 2.5px solid var(--ink); border-radius: 16px; background: #d4f4e6; color: var(--ink); font: inherit; font-size: 13px; font-weight: 900; cursor: pointer; }
.lt-knob { position: relative; flex: 0 0 auto; width: 38px; height: 20px; border: 2.5px solid var(--ink); border-radius: 10px; background: var(--c); transition: background 0.15s; }
.lt-knob::after { content: ''; position: absolute; top: 1px; left: 19px; width: 14px; height: 14px; border: 2px solid var(--ink); border-radius: 50%; background: #fffaf0; transition: left 0.15s; }
.lt-orders.off .lt-switch { background: #eee6dc; }
.lt-orders.off .lt-knob { background: #b9aec6; }
.lt-orders.off .lt-knob::after { left: 1px; }
.lt-orders.off .lt-share, .lt-orders.off .lt-order-pick { opacity: 0.5; }
.lt-share { display: flex; flex-direction: column; gap: 1px; font-size: 12.5px; font-weight: 800; }
.lt-share b { color: #17765a; font-weight: 900; }
.lt-share input { width: 100%; height: 24px; margin: 0; accent-color: #17765a; cursor: pointer; }
.lt-order-pick { display: flex; flex-wrap: wrap; gap: 4px; }
.lt-order { display: flex; align-items: center; gap: 3px; height: 28px; padding: 0 9px; border: 2.5px solid var(--ink); border-radius: 14px; background: #fffaf0; color: var(--ink); font: inherit; font-size: 12px; font-weight: 900; white-space: nowrap; cursor: pointer; }
.lt-order.on { background: var(--c); }
.lt-order[disabled] { border-color: #b9aec6; background: #efeaf3; color: #8b7f97; cursor: default; }
.lt-order svg { width: 11px; height: 11px; flex: 0 0 auto; }
/* What the order picked does, and One kind's kinds (Task 115b): smaller chips, the kind picked lit. */
.lt-order-says { margin: 0; font-size: 12px; font-weight: 800; color: #17765a; }
.lt-kind-pick { display: flex; flex-wrap: wrap; gap: 4px; }
.lt-kind { height: 24px; padding: 0 8px; border: 2px solid var(--ink); border-radius: 12px; background: #fffaf0; color: var(--ink); font: inherit; font-size: 11.5px; font-weight: 900; white-space: nowrap; cursor: pointer; }
.lt-kind.on { background: #ffd66b; }
.lt-orders.off .lt-kind-pick, .lt-orders.off .lt-order-says { opacity: 0.5; }
/* In landscape on a phone the side card is short: with the orders shown, their own last line says
   what the "Now:" line did (Task 115b: One kind's kinds made it run past the card's foot). */
@media (min-aspect-ratio: 1/1) and (max-height: 520px) {
  .lt-card-body > .lt-now:has(+ .lt-orders:not(.lt-mending):not(.lt-muster):not(.lt-grand):not(.lt-bell)) { display: none; }
  /* The switch and the share's words on one row, the slider under them; chips a little smaller. */
  .lt-orders { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 3px 8px; padding: 5px 7px 6px; }
  .lt-orders > :not(.lt-switch):not(.lt-share) { grid-column: 1 / -1; }
  .lt-share { display: contents; }
  .lt-share-words { font-size: 12px; line-height: 1.1; }
  .lt-share input { grid-column: 1 / -1; height: 20px; }
  .lt-order { height: 25px; padding: 0 7px; font-size: 11.5px; }
  .lt-kind { height: 22px; padding: 0 7px; font-size: 11px; }
}
@media (max-aspect-ratio: 1/1) {
  .ltree-title { display: none; }
  .ltree-fade { height: 104px; }
  .ltree-branches { top: calc(max(8px, var(--safe-top)) + 48px); bottom: auto; left: max(8px, var(--safe-left)); right: max(8px, var(--safe-right)); justify-content: center; }
  .ltree:has(.ltree-card:not([hidden])) .ltree-branches { max-width: none; }
  .ltree-card { left: max(8px, var(--safe-left)); right: max(8px, var(--safe-right)); top: auto; bottom: max(8px, var(--safe-bottom)); width: auto; max-height: 50%; border-radius: 22px; animation-name: panel-in-up; }
}

/* The tree's button in the top row (hud/lanterntree.js TreeButton): left of the Menu in landscape,
   under it upright; by day in walk view, once a first Ember is earned; the Embers on a coal-orange
   tag; glowing when something can be lit. */
.tree-button { position: absolute; right: 100px; top: 0; width: 42px; height: 42px; padding: 3px; border: 3px solid var(--ink); border-radius: 50%; background: var(--cream);
  box-shadow: 0 3px 0 rgba(43, 29, 63, 0.35); cursor: pointer; }
.tree-button[hidden] { display: none; }
.topbar > .tree-button { pointer-events: auto; }
.tree-button > img, .tree-button > svg { display: block; width: 100%; height: 100%; }
/* The art's tree (Task 115a-3) 34 px across, where its lamps read as lamps (its review's note; 28 px
   with the drawn one's padding). */
.tree-button:has(> img) { padding: 1px; }
.tree-button:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(43, 29, 63, 0.35); }
.building .tree-button { display: none; }
.tree-button-n { position: absolute; left: 50%; bottom: -9px; transform: translateX(-50%); min-width: 22px; padding: 0 5px 1px; border: 2px solid var(--ink); border-radius: 9px; background: #ff9a3c;
  color: var(--ink); font-size: 11.5px; font-weight: 900; line-height: 1.2; text-align: center; font-variant-numeric: tabular-nums; pointer-events: none; }
.tree-button.can { box-shadow: 0 3px 0 rgba(43, 29, 63, 0.35), 0 0 0 3px var(--gold); animation: tree-can 1.6s ease-in-out infinite; }
@keyframes tree-can { 50% { box-shadow: 0 3px 0 rgba(43, 29, 63, 0.35), 0 0 0 4px var(--gold), 0 0 16px 6px rgba(255, 198, 46, 0.7); } }
.tree-button.got .tree-button-n { animation: tree-got 0.5s ease-out; }
@keyframes tree-got { 40% { transform: translateX(-50%) scale(1.45); background: #ffd36b; } }
.tree-button.got::after { content: attr(data-got); position: absolute; left: 50%; top: 46px; transform: translateX(-50%); font-size: 17px; font-weight: 900; color: #ff9a3c; -webkit-text-stroke: 4px var(--ink);
  paint-order: stroke fill; white-space: nowrap; pointer-events: none; animation: tree-plus 1.3s ease-out forwards; }
@keyframes tree-plus { from { opacity: 1; transform: translate(-50%, 0); } to { opacity: 0; transform: translate(-50%, 16px); } }
.tree-tip { position: absolute; right: calc(100% + 8px); top: 50%; transform: translateY(-50%); padding: 4px 10px 5px; border: 2.5px solid var(--ink); border-radius: 12px; background: #ffe0c2;
  color: var(--ink); font-size: 12.5px; font-weight: 900; white-space: nowrap; box-shadow: 0 3px 0 rgba(43, 29, 63, 0.35); pointer-events: none; }
.tree-tip[hidden] { display: none; }
/* In landscape under the button (to its left it lay over the night chip's Start). */
@media (min-aspect-ratio: 1/1) {
  .tree-tip { right: -4px; top: calc(100% + 12px); transform: none; }
}
.tree-fly { position: absolute; z-index: 6; width: 26px; height: 26px; pointer-events: none; filter: drop-shadow(0 0 6px rgba(255, 140, 40, 0.9)); }
.tree-fly svg, .tree-fly img { display: block; width: 100%; height: 100%; }
@media (max-aspect-ratio: 1/1) {
  .topbar > .tree-button { right: 0; top: 150px; }
}

/* The title's Lantern Tree button, first in the row under Campaign and Sandbox, the Embers on it. */
.title-copies .title-tree { display: inline-flex; align-items: center; gap: 6px; padding-left: 6px; background: #ffe0c2; }
.title-tree > svg, .title-tree > img { display: block; width: 26px; height: 26px; flex: 0 0 auto; }
.title-tree-n { display: inline-flex; align-items: center; gap: 2px; padding: 0 6px 0 2px; border: 2px solid var(--ink); border-radius: 9px; background: #ff9a3c; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.title-tree-ember { display: block; width: 16px; height: 16px; }
.title-tree-ember svg, .title-tree-ember img { display: block; width: 100%; height: 100%; }
