:root {
  /* One marquee bulb, tiled along an edge. */
  --bulb: radial-gradient(circle, rgba(255, 240, 190, .95) 32%,
                          rgba(255, 240, 190, 0) 40%);
  --bg: #12141b;
  --ink: #e8eaf2;
  --poster-red: #9b141c;
  --poster-deep: #5c0a10;
  --poster-gold: #f0c84a;
  --poster-cream: #fff3c4;
  --poster-blue: #2a7ec8;
  /* Local stacks only — Android WebView has no INTERNET permission. */
  --display: "Arial Black", "Helvetica Black", Impact, sans-serif;
  /* SHOWBILL. The fat slab serif of a circus poster - Rockwell and Clarendon
     are the real thing, Bookman is the classic American showbill, and Georgia
     is the fallback that still has proper bracketed serifs.
     No webfont: check_project.py forbids external URLs and the APK ships with
     no network permission, so every face here has to already be on the
     machine. Used for the big type only; small UI stays on --display, which
     is far more legible at 9-11px. */
  --showbill: "Rockwell", "Rockwell Extra Bold", "Clarendon",
              "Bookman Old Style", Bookman, "Georgia", serif;
  --poster-body: Georgia, "Palatino Linotype", "Book Antiqua", serif;

  /* One gold five-pointed star, inline so the border needs no network and no
     extra file. `#` must be written %23 - a raw hash starts a fragment and the
     whole url() silently fails to parse. */
  --star: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 1.6 14.94 9.1h7.86l-6.4 4.63 2.44 7.67L12 16.6l-6.84 4.8 2.44-7.67L1.2 9.1h7.86z' fill='%23f0c84a'/%3E%3C/svg%3E");
  --star-band: 26px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--poster-body);
  /* stop the browser hijacking drags/double-taps as scroll or zoom */
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

#game {
  display: block;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  image-rendering: pixelated;
}

/* ---- dev panel --------------------------------------------------------- */
/* Sits along the top, clear of the HUD on the left and the sound/fullscreen
   buttons on the right. Deliberately plain: this never ships to a player, so
   legibility beats looking like the rest of the game. */

#devpanel {
  position: fixed;
  top: max(4px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: min(1080px, calc(100vw - 140px));
  max-height: 74vh;
  overflow-y: auto;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(8, 10, 16, .92);
  border: 1px solid rgba(127, 196, 255, .34);
  box-shadow: 0 14px 40px rgba(0, 0, 0, .45);
  font-family: ui-monospace, Menlo, Consolas, monospace;
  pointer-events: auto;
}

#devpanel[hidden] { display: none; }

.dev-mini { display: none; }

#devpanel.minimized {
  left: max(10px, env(safe-area-inset-left));
  width: auto;
  transform: none;
  padding: 4px;
  overflow: visible;
}

#devpanel.minimized > :not(.dev-mini) { display: none; }
#devpanel.minimized .dev-mini {
  display: block;
  border-color: #7fc4ff;
  color: #bde2ff;
  background: rgba(8, 10, 16, .82);
}

.dev-row {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: center;
}

.dev-palette {
  justify-content: flex-start;
  padding-bottom: 3px;
  border-bottom: 1px solid rgba(255, 255, 255, .1);
}

.dev-palette-btn {
  appearance: none;
  min-width: 55px;
  padding: 6px 8px;
  border: 1px solid color-mix(in srgb, var(--brick-color) 75%, white 10%);
  border-radius: 5px;
  background: color-mix(in srgb, var(--brick-color) 24%, #111722);
  color: #f4f7ff;
  font: 700 10px/1 ui-monospace, Menlo, Consolas, monospace;
  cursor: grab;
  box-shadow: inset 0 -3px 0 color-mix(in srgb, var(--brick-color) 65%, transparent);
}

.dev-palette-btn:active { cursor: grabbing; transform: translateY(1px); }
.dev-palette-btn.dragging { opacity: .4; }
.dev-empty-btn { background-image: repeating-linear-gradient(135deg,
  transparent 0 6px, rgba(255,255,255,.1) 6px 9px); }
.dev-pickup-btn { margin-left: auto; }

.dev-label {
  font-size: 9px;
  letter-spacing: .08em;
  color: #7c8296;
  width: 38px;
}

.dev-btn {
  appearance: none;
  font: inherit;
  font-size: 11px;
  line-height: 1;
  padding: 5px 8px;
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, .22);
  background: rgba(255, 255, 255, .06);
  color: #cdd3e2;
  cursor: pointer;
  touch-action: manipulation;
}

.dev-btn:active { transform: scale(.94); }

.dev-btn.on {
  background: rgba(255, 226, 109, .18);
  border-color: rgba(255, 226, 109, .8);
  color: #ffe26d;
}

.dev-range {
  width: 88px;
  height: 14px;
  accent-color: #ffe26d;
  cursor: pointer;
}

.dev-val {
  font-size: 10px;
  color: #ffe26d;
  min-width: 26px;
  text-align: left;
}

.dev-compose-head {
  border-top: 1px solid rgba(255, 255, 255, .12);
  padding-top: 5px;
}

.dev-library {
  justify-content: flex-start;
  padding: 4px 0;
  border-top: 1px solid rgba(255, 255, 255, .08);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.dev-text,
.dev-select {
  height: 25px;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 5px;
  background: #171b25;
  color: #eef2fb;
  font: 10px/1 ui-monospace, Menlo, Consolas, monospace;
}

.dev-text {
  width: min(180px, 28vw);
  padding: 4px 7px;
  user-select: text;
}

.dev-select {
  width: min(190px, 30vw);
  padding: 3px 5px;
}

.dev-btn:disabled,
.dev-select:disabled {
  cursor: default;
  opacity: .35;
}

#dev-overwrite {
  max-width: min(240px, 38vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dev-grid-badge {
  padding: 4px 6px;
  border-radius: 4px;
  background: rgba(127, 196, 255, .14);
  color: #7fc4ff;
  font-size: 9px;
  letter-spacing: .05em;
}

.dev-feel {
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
}

.dev-feel-who {
  color: #ffd36a;
  font-size: 10px;
  min-width: 4.5em;
}

.dev-feel-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #9ab;
  font-size: 10px;
}

.dev-feel-item .dev-range {
  width: 72px;
}

.dev-feel-item .dev-val {
  min-width: 2.4em;
  text-align: right;
  color: #cde;
}

.dev-start {
  margin-left: auto;
  border-color: #75e5aa;
  background: linear-gradient(180deg, rgba(68, 197, 130, .35), rgba(31, 113, 78, .35));
  color: #a7ffd0;
  font-weight: 800;
  box-shadow: 0 0 14px rgba(117, 229, 170, .16);
}

.dev-pseudo.on {
  border-color: #7fc4ff;
  background: rgba(127, 196, 255, .18);
  color: #bde2ff;
}

/* Level list on the title screen. One row per level: tick, name, length and
   your best score, in a monospace grid so the columns line up. */
/* On the level step the poster type has done its job. Shrinking it - and
   dropping the control blurb entirely - is what buys the rows their room,
   instead of making the list scroll. */
.picking-level #ov-title {
  font-size: clamp(.9rem, 3.2vw, 1.5rem);
  margin-bottom: 0;
}

/* Below this the game's name costs more than it is worth: the level heading
   above the rows already says where you are, and those five rows plus the
   back button need every pixel. */
@media (max-height: 420px) {
  .picking-level #ov-title { display: none; }
}

.picking-level .title-tag,
.picking-level #ov-body,
.picking-level #ov-hint,
.picking-level #ov-landscape { display: none; }

/* THE LEVEL STEP IS ITS OWN SCREEN, not the title screen with a list laid on
   top of it. It used to keep the whole poster: the couple, the wreath, and
   their shadow - and the shadow is drawn at TWICE their height, reaching 210px
   past the bottom of the viewport. That is what made this step scroll, which
   is also what made it read as "still the title screen, keep going down"
   rather than as somewhere new.
   All of it goes, and the overlay stops scrolling here.

   Both selectors carry .title-screen as well, because the rules that turn the
   poster ON further down this file are `.title-screen .poster-*` - equal
   specificity and later in the file, so a plain `.picking-level` rule here
   loses to them silently. */
.title-screen.picking-level .poster-pair,
.title-screen.picking-level .poster-shade { display: none; }
.picking-level .title-badge { display: none; }

#overlay.picking-level {
  overflow: hidden;
  place-items: center;
}

/* With the poster gone the panel has the whole viewport, so it takes it: the
   heading at the top, the level card centred in what is left, the back button
   at the bottom. Nothing to scroll to. */
.picking-level .panel {
  height: 100%;
  max-height: 100%;
  justify-content: center;
}

/* The level screen. Its own step, so it has the width and the height that the
   title screen could not spare. */
/* A class that sets `display` beats the plain [hidden] attribute, so hiding it
   from JS silently did nothing - the heading and the back button sat on the
   title screen under the era buttons. */
.level-screen[hidden] { display: none; }

.level-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
  width: 100%;
  min-height: 0;
}

/* ONE level at a time, as big as the screen allows: the word LEVEL, the
   number under it at poster scale, an arrow either side. Built for a landscape
   phone first - that is the shape this is played in - so the number is sized
   off the VIEWPORT HEIGHT and the whole row is centred in what is left after
   the heading. */
.level-pick {
  position: relative;            /* GO ! hangs off this */
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 4vw, 40px);
  width: 100%;
}

.lv-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: clamp(120px, 34vw, 260px);
  padding: clamp(6px, 1.8vh, 16px) clamp(12px, 3.4vw, 30px);
  color: var(--poster-cream);
  cursor: pointer;
  transition: transform .12s, filter .12s;
}

.lv-card:hover { transform: scale(1.04); filter: brightness(1.06); }
.lv-card:active { transform: scale(.98); }

.lv-word {
  font: 800 clamp(9px, 2.2vh, 15px)/1 ui-monospace, Menlo, Consolas, monospace;
  letter-spacing: .34em;
  text-indent: .34em;              /* letter-spacing pads the right; recentre */
  color: rgba(255, 243, 196, .72);
}

/* The number is the whole screen. Sized off vh so a landscape phone gets the
   biggest one - there is no vertical competition on that shape. */
.lv-num {
  font-family: var(--display);
  font-size: clamp(46px, 19vh, 150px);
  line-height: .92;
  color: var(--poster-cream);
  text-shadow: 0 3px 0 rgba(0, 0, 0, .45);
}

.lv-card .lv-len {
  font: 700 clamp(9px, 2vh, 14px)/1 ui-monospace, Menlo, Consolas, monospace;
  color: rgba(255, 255, 255, .62);
}

.lv-status {
  min-height: 1em;
  font: 700 clamp(10px, 2.2vh, 15px)/1 ui-monospace, Menlo, Consolas, monospace;
  color: #75e5aa;
}

/* The number alone. The green disc that used to sit behind it is gone: GO !
   is the button now, and two play affordances on one screen is one too many. */
.lv-card { position: relative; }

.lv-card .lv-num {
  font-size: clamp(46px, 19vh, 150px);
  text-shadow: 0 3px 0 rgba(0, 0, 0, .5);
}

.lv-card.cleared { border-color: #6ef0a8; }

/* Cleared reads from across the room: a tick the size of the card corner, in
   the same green as the disc, with a dark rim so it survives any backdrop. */
.lv-tick {
  position: absolute;
  top: -6px;
  right: -10px;
  font: 700 clamp(38px, 12vh, 96px)/1 ui-monospace, Menlo, Consolas, monospace;
  color: #6ef0a8;
  text-shadow: 0 0 3px #06331d, 0 3px 0 rgba(0, 0, 0, .55), 0 0 22px rgba(110, 240, 168, .5);
  pointer-events: none;
}

.lv-arrow {
  flex: 0 0 auto;
  width: clamp(38px, 9vh, 68px);
  height: clamp(38px, 9vh, 68px);
  color: var(--poster-gold);
  font-size: clamp(16px, 4vh, 30px);
  line-height: 1;
  cursor: pointer;
  transition: transform .1s, opacity .1s;
}

/* The commitment button. The card says WHICH level, this says GO - so the
   choice and the start are two different taps and neither is ambiguous. */
.lv-go {
  /* EXACTLY WHERE START SITS ON THE TITLE SCREEN. The two are the same
     promise - "begin" - so they are in the same place, and moving between the
     year screen and the level screen never moves the button under your thumb.
     Same anchors as #ov-quickstart: fixed to the viewport's right edge, and
     centred with AUTO MARGINS rather than translateY(-50%), because the pulse
     animation below sets `transform` and would otherwise wipe the centring
     out on its first frame. */
  position: fixed;
  right: max(.9rem, calc(env(safe-area-inset-right) + .5rem));
  top: 0;
  bottom: 0;
  height: fit-content;
  margin-block: auto;
  z-index: 46;
  /* ROUND, and smaller than it was: a circle reads as one tap rather than as
     a banner, and the level number beside it is what the screen is about. */
  display: grid;
  place-items: center;
  width: clamp(3.4rem, 13vw, 5.2rem);
  aspect-ratio: 1;
  padding: 0;
  /* Poster gold on green, the same rim the year card and the arrows wear, with
     a bulb ring around it - a fairground button rather than a web one. */
  border: 3px solid var(--poster-gold);
  border-radius: 999px;
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 255, 255, .34), rgba(255, 255, 255, 0) 58%),
    linear-gradient(180deg, #47d488, #1c9553 68%, #10643a);
  color: var(--poster-cream);
  font-family: var(--display);
  font-size: clamp(14px, 4.2vh, 24px);
  letter-spacing: .1em;
  text-indent: .1em;                /* letter-spacing pads the right */
  line-height: 1;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .5), 0 0 14px rgba(255, 236, 170, .45);
  box-shadow:
    0 6px 0 #0b4728,                              /* the bevel it sits on */
    0 0 0 6px rgba(120, 12, 18, .55),             /* the poster's red band */
    0 0 0 8px rgba(240, 200, 74, .45),            /* a second gold hoop */
    0 10px 26px rgba(0, 0, 0, .45);
  cursor: pointer;
  animation: lv-go-pulse 1.6s ease-in-out infinite;
  transition: filter .12s;
}

@keyframes lv-go-bulbs {
  0%   { opacity: .25; }
  100% { opacity: .7; }
}

/* It breathes, so the eye finds it without it shouting. */
@keyframes lv-go-pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.045); }
}

.lv-go:hover { filter: brightness(1.1) saturate(1.1); }
.lv-go:active {
  animation: none;
  transform: translateY(3px);
  box-shadow: 0 3px 0 #0b4728, 0 0 0 6px rgba(120, 12, 18, .55),
              0 0 0 8px rgba(240, 200, 74, .45);
}
.lv-go:disabled {
  filter: grayscale(1) brightness(.6);
  box-shadow: none;
  cursor: default;
  animation: none;
}
.lv-go:disabled::before { display: none; }

/* A locked level is still browsable - you can see what is coming - but the
   green goes grey and a lock sits over the number. */
.lv-card.locked { border-color: rgba(255, 255, 255, .28); cursor: default; }
.lv-card.locked::before { opacity: .12; animation: none; }
.lv-card.locked .lv-num { opacity: .3; }
.lv-card.locked:hover { transform: none; }

.lv-lock {
  position: absolute;
  left: 50%;
  top: 46%;
  transform: translate(-50%, -50%);
  font-size: clamp(28px, 9vh, 70px);
  filter: drop-shadow(0 3px 0 rgba(0, 0, 0, .5));
  pointer-events: none;
}

.lv-arrow:hover { transform: scale(1.1); }
.lv-arrow:disabled { opacity: .18; cursor: default; transform: none; }

/*
 * THE BOOTH.
 *
 * The year card, the level card and the two arrows are all the same object as
 * the GO button: a gold-rimmed panel on the poster's deep red, ringed by the
 * red band and a second gold hoop, with marquee bulbs around the outside. One
 * rule rather than four, so the whole menu reads as one fairground front
 * rather than as buttons that happen to be near each other.
 */
.era-card,
.lv-card,
.lv-arrow {
  border: 3px solid var(--poster-gold);
  border-radius: 16px;
  background:
    radial-gradient(circle at 50% 12%, rgba(255, 235, 180, .16), rgba(255, 235, 180, 0) 62%),
    linear-gradient(180deg, rgba(96, 10, 16, .92), rgba(38, 4, 8, .95));
  box-shadow:
    0 5px 0 rgba(0, 0, 0, .45),
    0 0 0 5px rgba(120, 12, 18, .5),
    0 0 0 7px rgba(240, 200, 74, .38),
    0 10px 26px rgba(0, 0, 0, .4);
}

.lv-arrow { border-radius: 50%; }

/* The bulbs. FOUR strips - one per edge - rather than one field masked to a
   ring: a radial mask is an ellipse, and on anything that is not square it
   leaves dots across the middle of the panel. This is the same four-layer
   trick the poster's star border already uses, and it lands a whole bulb in
   each corner instead of a sliced one. */
.era-card::before,
.lv-card::before,
.lv-go::before {
  content: "";
  position: absolute;
  inset: -13px;
  border-radius: inherit;
  background-image: var(--bulb), var(--bulb), var(--bulb), var(--bulb);
  background-repeat: repeat-x, repeat-x, repeat-y, repeat-y;
  background-position: top left, bottom left, left top, right top;
  background-size: 14px 14px;
  opacity: .55;
  pointer-events: none;
  animation: lv-go-bulbs 1.1s steps(2) infinite;
}

/* The two cards run their bulbs on the OFF beat of the GO button's, so the
   whole row blinks in alternation the way a real marquee does. */
.era-card::before { animation-delay: .55s; }

.lv-card { position: relative; }

/* Where you are in the set, and which ones are behind you. */
.level-dots {
  display: flex;
  gap: 6px;
  justify-content: center;
}

.lv-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .22);
}

.lv-dot.done { background: rgba(117, 229, 170, .55); }
.lv-dot.on {
  background: var(--poster-gold);
  transform: scale(1.35);
}

/* The two small controls under the picker, on one line. */
.level-foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Quiet until it is armed, then unmistakably a warning. */
.level-reset {
  /* Was 10px type in 5px of padding - a 22px tall target, half what a thumb
     needs, on the one control in the game that cannot be undone. */
  min-height: 42px;
  padding: 10px 20px;
  border: 2px solid rgba(255, 255, 255, .28);
  border-radius: 999px;
  background: rgba(0, 0, 0, .28);
  color: rgba(255, 255, 255, .72);
  font: 800 13px/1 ui-monospace, Menlo, Consolas, monospace;
  letter-spacing: .06em;
  cursor: pointer;
  transition: transform .1s, filter .1s, background .12s, color .12s;
}

.level-reset:hover { color: #fff; background: rgba(0, 0, 0, .45); }
.level-reset:active { transform: translateY(2px) scale(.97); }

.level-reset.armed {
  border-color: #ff6b74;
  background: rgba(255, 107, 116, .16);
  color: #ff9aa0;
}

.level-back {
  margin-top: .3rem;
  min-height: 42px;
  padding: 10px 22px;
  border: 2px solid rgba(255, 255, 255, .34);
  border-radius: 999px;
  background: rgba(0, 0, 0, .32);
  color: #fff;
  font: 800 13px/1 ui-monospace, Menlo, Consolas, monospace;
  letter-spacing: .06em;
  cursor: pointer;
  transition: transform .1s, filter .1s, background .12s;
}

.level-back:active { transform: translateY(2px) scale(.97); }

.level-back:hover {
  border-color: rgba(255, 243, 196, .6);
  color: #fff3c4;
}

.level-row {
  display: grid;
  grid-template-columns: 16px 1fr auto 46px;
  align-items: baseline;
  gap: 8px;
  padding: 5px 10px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 6px;
  background: rgba(0, 0, 0, .28);
  color: rgba(255, 255, 255, .86);
  font: 600 11px/1.4 ui-monospace, Menlo, Consolas, monospace;
  text-align: left;
  cursor: pointer;
}

.level-row:hover {
  border-color: rgba(255, 243, 196, .55);
  background: rgba(255, 243, 196, .12);
}

/* Where you left off, so the obvious next tap is obvious. */
.level-row.current {
  border-color: rgba(255, 243, 196, .7);
}

.level-row.cleared .lv-name { color: #9fe8b8; }
.lv-tick { color: #75e5aa; }
.lv-len { color: rgba(255, 255, 255, .5); }
.lv-score { color: #ffd97a; text-align: right; }

/* Why you went down. Only appears from the SECOND fall on the same level, so
   it has to read as help arriving rather than as part of the furniture: a
   warm rule down the side, and big enough to be read on a phone at arm's
   length without being mistaken for the joke above it. */
.why {
  display: block;
  max-width: 380px;
  margin: 8px auto 0;
  padding: 9px 12px;
  border-left: 3px solid #ffd97a;
  border-radius: 0 8px 8px 0;
  background: rgba(255, 217, 122, .12);
  color: #ffe9b0;
  font: 600 clamp(13px, 3.4vw, 15px)/1.4 inherit;
  text-align: left;
  text-shadow: none;
}

/* One of Malte's own lines under the finish board. The showbill face, because
   it is him talking rather than the game reporting - the scoreboard above it
   is monospace for exactly the opposite reason. */
.malte {
  display: block;
  max-width: 420px;
  margin: 10px auto 0;
  color: var(--poster-cream);
  font: 400 clamp(14px, 3.6vw, 17px)/1.35 var(--showbill);
  font-style: italic;
  opacity: .92;
}

/* End-of-run scoreboard. Monospace so the points column lines up without a
   table, and the whole block scrolls if a long run earns every line. */
.scoreboard {
  /* Wide enough for the longest bilingual label - "Passerade hinder /
     Obstacles cleared" - to stay on one line beside its points column. */
  max-width: 380px;
  width: 100%;
  flex: 0 0 auto;
  margin: 10px auto 4px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 243, 196, .22);
  border-radius: 8px;
  background: rgba(0, 0, 0, .3);
  font: 400 11px/1.5 ui-monospace, Menlo, Consolas, monospace;
  text-align: left;
}

.sb-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 243, 196, .18);
  color: #fff3c4;
  letter-spacing: .08em;
}

.sb-total b { font-size: 22px; }

.sb-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  color: rgba(255, 255, 255, .82);
  white-space: nowrap;
}

.sb-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sb-note {
  color: rgba(255, 255, 255, .42);
  font-size: 10px;
}

.sb-points {
  min-width: 46px;
  color: #ffd97a;
  text-align: right;
}

.sb-best {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, .12);
  color: rgba(255, 255, 255, .5);
  font-size: 10px;
  text-align: right;
}

/* Title-screen entry to the builder. Deliberately quiet next to the era
   buttons: it is a tool, not a way to play. */
.dev-entry {
  display: block;
  /* Well clear of the level list above it: a mis-tap here used to drop you
     into the builder instead of into a level. */
  margin: 22px auto 0;
  padding: 6px 14px;
  opacity: .72;
  border: 1px solid rgba(127, 196, 255, .38);
  border-radius: 6px;
  background: rgba(127, 196, 255, .1);
  color: #9dc9f0;
  font: 700 11px/1 ui-monospace, Menlo, Consolas, monospace;
  letter-spacing: .08em;
  cursor: pointer;
}

.dev-entry:hover {
  border-color: rgba(127, 196, 255, .7);
  background: rgba(127, 196, 255, .2);
  color: #dff0ff;
}

.dev-timeline {
  display: grid;
  gap: 4px;
}

.dev-timeline.off {
  opacity: .48;
}

.dev-lane {
  display: flex;
  align-items: stretch;
  min-width: 0;
  gap: 5px;
}

.dev-lane-label {
  display: grid;
  place-items: center;
  flex: 0 0 24px;
  border-radius: 5px;
  background: rgba(127, 196, 255, .14);
  color: #7fc4ff;
  font: 800 11px/1 ui-monospace, Menlo, Consolas, monospace;
}

.dev-track {
  display: block;
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 42px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 0;
  border: 1px solid rgba(255, 255, 255, .11);
  border-radius: 5px;
  background-color: rgba(255, 255, 255, .025);
  background-image:
    linear-gradient(90deg, rgba(127, 196, 255, .17) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255, 255, 255, .04) 1px, transparent 1px);
  background-size: var(--dev-grid-px, 18px) 100%, 100% 18px;
  scroll-snap-type: x proximity;
  scroll-behavior: smooth;
}

.dev-grid-spacer {
  display: block;
  height: 1px;
  pointer-events: none;
}

.dev-track.is-empty::after {
  content: "empty — add a block";
  display: grid;
  position: absolute;
  left: 0;
  top: 4px;
  height: 32px;
  place-items: center;
  min-width: calc(var(--dev-grid-px, 18px) * 8);
  padding: 7px 12px;
  border: 1px dashed rgba(255, 255, 255, .16);
  border-radius: 5px;
  color: #707789;
  font-size: 9px;
}

.dev-block {
  flex: 0 0 var(--dev-block-width, 280px);
  width: var(--dev-block-width, 280px);
  position: absolute;
  top: 4px;
  min-width: 0;
  height: 32px;
  overflow: hidden;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--brick-color) 48%, #657086);
  border-radius: 4px;
  background: linear-gradient(180deg, #1b2230, #10151f);
  box-shadow: inset 0 -2px 0 color-mix(in srgb, var(--brick-color) 26%, transparent);
  scroll-snap-align: start;
  cursor: grab;
}

.dev-block:hover {
  border-color: color-mix(in srgb, var(--brick-color) 78%, #ffffff);
  filter: brightness(1.16);
}

/* A one-object block is only a couple of grid cells wide: symbol only, with
   the intensity carried by the top edge instead of a dot that would sit on
   top of it. The length handle stays - it is how you grow the block. */
.dev-block.narrow .dev-block-name,
.dev-block.narrow .dev-intensity,
.dev-block.narrow .dev-block-count { display: none; }

.dev-block.narrow {
  border-top: 2px solid var(--intensity-color);
}

.dev-block.narrow .dev-symbol {
  left: 0;
  right: 9px;
  width: auto;
  font-size: 15px;
}

.dev-block.dragging {
  opacity: .28;
  filter: grayscale(.6);
}

.dev-block:active { cursor: grabbing; }

/* Where the dragged block will land. Green outline when the slot is free,
   red when the lane is the wrong kind or something is already there - the
   answer has to be visible BEFORE the pointer is released, or every move is
   a guess followed by an undo. */
.dev-ghost {
  position: absolute;
  top: 4px;
  height: 32px;
  border: 2px dashed color-mix(in srgb, var(--brick-color) 70%, #ffffff);
  border-radius: 4px;
  background: color-mix(in srgb, var(--brick-color) 18%, transparent);
  pointer-events: none;
  z-index: 3;
}

.dev-ghost.bad {
  border-color: #ff6b74;
  background: rgba(255, 107, 116, .16);
}

.dev-track.drop-lane {
  border-color: rgba(127, 196, 255, .55);
  background-color: rgba(127, 196, 255, .07);
}

/* Drag a block back onto the shelf it came from to delete it. */
.dev-palette.drop-delete {
  outline: 2px dashed #ff6b74;
  outline-offset: 2px;
  background: rgba(255, 107, 116, .1);
}

.dev-palette.drop-delete .dev-label::after {
  content: " — release to delete";
  color: #ff9aa0;
}

/* The length handle: the last few pixels of a block, repeating it 1-3x. */
.dev-block::after {
  content: "";
  position: absolute;
  right: 0;
  top: 0;
  width: 9px;
  height: 100%;
  border-left: 1px solid rgba(255, 255, 255, .12);
  background: linear-gradient(90deg, transparent,
              color-mix(in srgb, var(--brick-color) 30%, transparent));
  cursor: ew-resize;
}

.dev-block:hover::after {
  border-left-color: rgba(255, 255, 255, .4);
  background: linear-gradient(90deg, transparent,
              color-mix(in srgb, var(--brick-color) 62%, transparent));
}

.dev-block.selected {
  z-index: 2;
  outline: 2px solid #fff3c4;
  outline-offset: -2px;
  box-shadow: 0 0 0 2px rgba(240, 200, 74, .55),
              inset 0 -2px 0 var(--brick-color);
}

.dev-symbol {
  display: grid;
  position: absolute;
  left: 7px;
  top: 4px;
  width: 25px;
  height: 22px;
  place-items: center;
  color: var(--brick-color);
  font: 900 17px/1 ui-monospace, Menlo, Consolas, monospace;
  text-shadow: 0 0 8px color-mix(in srgb, var(--brick-color) 70%, transparent);
}

.dev-intensity {
  position: absolute;
  right: 7px;
  top: 11px;
  width: 8px;
  height: 8px;
  border: 1px solid rgba(255,255,255,.65);
  border-radius: 50%;
  background: var(--intensity-color);
  box-shadow: 0 0 8px var(--intensity-color);
}

.dev-block-count {
  position: absolute;
  right: 21px;
  top: 10px;
  color: rgba(255,255,255,.7);
  font-size: 9px;
}

.dev-drag {
  position: absolute;
  left: 4px;
  top: 16px;
  color: color-mix(in srgb, var(--brick-color) 75%, white);
  cursor: grab;
  touch-action: none;
}

.dev-drag:active { cursor: grabbing; }

.dev-duration {
  position: absolute;
  right: 48px;
  top: 6px;
  color: rgba(255,255,255,.62);
  font-size: 8px;
}

.dev-block-tag {
  display: none;
}

/* Sits between the symbol and the intensity dot, and simply runs out of room
   on a narrow block rather than wrapping or pushing anything around. */
.dev-block-name {
  display: block;
  position: absolute;
  left: 34px;
  right: 20px;
  top: 9px;
  overflow: hidden;
  color: rgba(255, 255, 255, .88);
  font: 700 9px/14px ui-monospace, Menlo, Consolas, monospace;
  letter-spacing: .04em;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-transform: uppercase;
  pointer-events: none;
}

.dev-block-summary {
  display: block;
  overflow: hidden;
  color: rgba(255,255,255,.68);
  font-size: 8px;
  line-height: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dev-block .dev-mult {
  position: absolute;
  right: 24px;
  top: 18px;
  width: 23px;
  padding: 4px 0;
  font-size: 9px;
}

.dev-block .dev-icon {
  position: absolute;
  right: 2px;
  top: 18px;
  width: 23px;
  padding: 4px 0;
  font-size: 9px;
}

.dev-block[data-type="empty"] {
  padding: 5px 24px 4px 5px;
  background-image: repeating-linear-gradient(135deg,
    rgba(255,255,255,.04) 0 7px, rgba(255,255,255,.13) 7px 10px);
}

.dev-block[data-type="empty"] .dev-drag,
.dev-block[data-type="empty"] .dev-duration,
.dev-block[data-type="empty"] .dev-block-summary,
.dev-block[data-type="empty"] .dev-mult { display: none; }

.dev-block[data-type="empty"] .dev-icon { top: 11px; }
.dev-block[data-type="empty"] .dev-block-name { font-size: 8px; }

.dev-pickup-lane .dev-lane-label {
  background: rgba(79, 208, 138, .14);
  color: #75e5aa;
}

.dev-inspector {
  padding: 6px 7px;
  border: 1px solid color-mix(in srgb, var(--inspector-color) 70%, white 8%);
  border-radius: 6px;
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--inspector-color) 17%, #0d111a),
    rgba(13, 17, 26, .96));
  box-shadow: inset 4px 0 0 var(--inspector-color);
}

.dev-inspector[hidden] { display: none; }

.dev-inspector-title,
.dev-inspector-fields,
.dev-inspector-field {
  display: flex;
  align-items: center;
}

.dev-inspector-title { gap: 7px; }
.dev-inspector-title > span { color: #9aa2b5; font-size: 9px; }
.dev-inspector-title .dev-danger { margin-left: auto; }

.dev-inspector-level {
  padding: 3px 6px;
  border: 1px solid color-mix(in srgb, var(--intensity-color) 72%, white 8%);
  border-radius: 999px;
  background: color-mix(in srgb, var(--intensity-color) 14%, #111722);
  color: var(--intensity-color) !important;
  box-shadow: 0 0 9px color-mix(in srgb, var(--intensity-color) 38%, transparent);
  font-weight: 800;
  letter-spacing: .05em;
}

.dev-inspector-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--brick-color);
  box-shadow: 0 0 8px color-mix(in srgb, var(--brick-color) 65%, transparent);
}

.dev-inspector-kicker {
  margin: 0 0 4px 16px;
  color: var(--inspector-color);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .16em;
}

.dev-inspector-fields {
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.dev-inspector-field {
  gap: 5px;
  min-width: 150px;
  color: #9aa2b5;
  font-size: 9px;
}

.dev-inspector-field > span { min-width: 52px; }
.dev-inspector-field input[type="range"] {
  width: 90px;
  accent-color: #f0c84a;
}

.dev-inspector-field select {
  width: 118px;
  height: 24px;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 4px;
  background: #171b25;
  color: #eef2fb;
  font: 9px/1 ui-monospace, Menlo, Consolas, monospace;
}

.dev-inspector-field output {
  min-width: 42px;
  color: #fff3c4;
  font-size: 9px;
}

.dev-danger {
  border-color: rgba(255, 102, 138, .6);
  color: #ff91aa;
}

.dev-scrub-row {
  border-top: 1px solid rgba(255, 255, 255, .1);
  padding-top: 4px;
}

.dev-scrub {
  flex: 1;
  min-width: 160px;
  height: 15px;
  accent-color: #7fc4ff;
  cursor: ew-resize;
}

/* Portrait phone: the top strip belongs to the distance readout, the ball pips
   and the TITEL button, and the panel wraps to four rows at this width. Drop it
   into the sky band under the HUD, where it covers nothing that matters and
   still sits well above the rider. */
@media (orientation: portrait) {
  #devpanel {
    top: max(150px, calc(env(safe-area-inset-top) + 146px));
    left: max(6px, env(safe-area-inset-left));
    right: max(6px, env(safe-area-inset-right));
    width: auto;
    max-height: calc(100vh - 158px);
    transform: none;
  }

  .dev-btn { padding: 6px 7px; }

  /* The row labels cost a whole column of a 375px screen and the buttons say
     what they are. */
  .dev-label { display: none; }
}

/* ---- touch controls ---------------------------------------------------- */

#touch {
  position: fixed;
  inset: auto 0 0 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding:
    0
    max(16px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom))
    max(16px, env(safe-area-inset-left));
  pointer-events: none;
}

#touch[hidden] { display: none; }

.right-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}

.left-controls {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  pointer-events: none;
}

.pad {
  appearance: none;
  /* Low on purpose: these sit ON the road, and the obstacle you are reading is
     often directly behind them. Pressed and armed states below are what make a
     pad legible - at rest it only has to be findable, not readable. */
  opacity: .34;
  pointer-events: auto;
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: 104px;
  height: 104px;
  border-radius: 50%;
  border: 3px solid #ffd85c;
  background:
    radial-gradient(circle at 34% 25%, rgba(255,255,255,.30), transparent 30%),
    linear-gradient(150deg, #c82a38 0%, #8b101d 52%, #530710 100%);
  color: #fff4c6;
  box-shadow:
    0 0 0 3px #6d0b15,
    0 0 0 5px rgba(255,216,92,.92),
    0 8px 0 #43060d,
    0 13px 22px rgba(0,0,0,.42),
    inset 0 2px 4px rgba(255,255,255,.25),
    inset 0 -8px 12px rgba(35,0,6,.38);
  font-family: var(--display);
  line-height: 1;
  text-shadow: 0 2px 0 rgba(55,0,8,.9);
  backdrop-filter: blur(4px);
  transition: filter .08s, transform .08s, box-shadow .08s, opacity .08s;
  touch-action: none;
}

.pad::before {
  content: "";
  position: absolute;
  inset: 7px;
  z-index: -1;
  border: 2px dotted rgba(255,230,137,.82);
  border-radius: 50%;
  pointer-events: none;
}

.pad::after {
  content: "";
  position: absolute;
  inset: 5px 13px 52%;
  z-index: -1;
  border-radius: 50%;
  background: linear-gradient(rgba(255,255,255,.20), transparent);
  pointer-events: none;
}

.pad-icon {
  font: 900 34px/.85 var(--display);
  letter-spacing: -.08em;
}

.pad-label {
  font: 800 11px/1 var(--display);
  letter-spacing: .09em;
}

.pad:active, .pad.on {
  opacity: .8;
  filter: brightness(1.22) saturate(1.12);
  transform: translateY(5px) scale(.96);
  box-shadow:
    0 0 0 3px #6d0b15,
    0 0 0 5px #ffe47c,
    0 3px 0 #43060d,
    0 7px 13px rgba(0,0,0,.38),
    inset 0 2px 5px rgba(255,255,255,.32);
}

.pad-duck {
  width: 82px;
  height: 82px;
  background:
    radial-gradient(circle at 34% 25%, rgba(255,255,255,.25), transparent 30%),
    linear-gradient(150deg, #31495f, #172735 58%, #0a1118);
}

/* Backwards is a correction, not a way to play — smaller and quieter than
   forward so the two are never confused under the thumb. Must come AFTER
   .pad, which sets width/height at the same specificity. */
.pad-back {
  width: 84px;
  height: 84px;
  background:
    radial-gradient(circle at 34% 25%, rgba(255,255,255,.25), transparent 30%),
    linear-gradient(150deg, #4b6074, #243646 58%, #111b24);
}

.pad-back .pad-icon,
.pad-duck .pad-icon {
  font-size: 27px;
}

.pad-jump {
  background:
    radial-gradient(circle at 34% 25%, rgba(255,255,255,.28), transparent 30%),
    linear-gradient(150deg, #168f92, #086265 55%, #043b3e);
}

/* Throw. Present but clearly inert until he has three balls, so the player
   learns what it is for before it ever does anything. `.armed` is set by
   main.js from world.juggling. */
.pad-throw {
  width: 94px;
  height: 94px;
  opacity: .14;
  background:
    radial-gradient(circle at 34% 25%, rgba(255,255,255,.28), transparent 30%),
    linear-gradient(150deg, #8541a8, #592472 58%, #32113f);
  transition: filter .08s, transform .08s, box-shadow .08s, opacity .12s;
}

.pad-throw.armed {
  opacity: .38;
  border-color: #fff09b;
  color: #fff8d8;
  filter: drop-shadow(0 0 12px rgba(255,216,92,.72));
}

.pad-throw.armed:active,
.pad-throw.armed.on {
  opacity: .8;
}

#btn-title {
  appearance: none;
  position: fixed;
  z-index: 3;
  top: max(8px, env(safe-area-inset-top));
  left: max(8px, env(safe-area-inset-left));
  min-width: 108px;
  min-height: 42px;
  padding: 8px 11px;
  border: 1px solid rgba(232, 234, 242, .45);
  border-radius: 8px;
  background: rgba(12, 14, 20, .72);
  color: var(--ink);
  font: 700 11px/1 var(--display);
  letter-spacing: .04em;
  text-transform: uppercase;
  touch-action: manipulation;
}

#btn-title:active {
  background: rgba(232, 234, 242, .25);
}

#btn-title[hidden] { display: none; }

/* ---- overlay ----------------------------------------------------------- */

#overlay {
  position: fixed;
  inset: 0;
  display: grid;
  /* `safe` centring: once the panel is taller than the viewport, centring
     would cut off its TOP as well as its bottom and there would be no way to
     scroll back up to it. */
  place-items: safe center;
  background: rgba(10, 11, 15, .82);
  text-align: center;
  padding: 20px;
  /* THE OVERLAY IS NOT THE SCROLLER - .panel is, and it caps itself to the
     viewport so its buttons are always reachable. This used to be
     `overflow-y: auto`, and because the decoration (the couple, their
     stretched shadow, the confetti canvas) reports a scroll extent far past
     the viewport, one swipe on a landscape phone slid the entire title screen
     out of frame - the year card measured 400px off the top. */
  overflow: hidden;
}

#overlay[hidden] { display: none; }

/* The game-over panel. THE BUTTONS MUST ALWAYS BE REACHABLE - this is a
   landscape phone game, the viewport is short, and the scoreboard made the
   panel taller than the screen so Try again sat below the bottom edge. The
   panel is capped to the viewport and the scoreboard gives up height first. */
.panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
  max-width: 30rem;
  max-height: calc(100dvh - 40px);
  min-height: 0;
}

.panel > * { flex: 0 0 auto; }

/* The scoreboard is nested inside #ov-body, so the shrinking has to be handed
   down: a rigid wrapper would keep the panel tall no matter how much the board
   itself is willing to give up. */
#ov-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 0 1 auto;
  min-height: 0;
  width: 100%;
}

/* LANDSCAPE GAME OVER - the shape this game is actually played in.
   Stacked, the scoreboard eats the height and squeezes the buttons against
   the bottom edge. Landscape has width to spare and none to waste, so the
   board sits BESIDE the buttons instead of above them. */
@media (orientation: landscape) and (max-height: 560px) {
  #overlay:not(.title-screen) .panel {
    display: grid;
    /* A FIXED track, not `auto`. The primary button's label changes between
       "Try again", "Next: Level 4" and "On to 2027", and an auto track resized
       with it - so the scoreboard beside it jumped sideways every time the
       wording changed. */
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "title    title"
      "body     body"
      "hint     hint";
    align-content: center;
    justify-items: center;
    column-gap: 1.2rem;
    row-gap: .4rem;
    max-width: 46rem;
  }

  #overlay:not(.title-screen) #ov-title { grid-area: title; }
  #overlay:not(.title-screen) #ov-body  { grid-area: body; align-self: start; }

  #overlay:not(.title-screen) #ov-hint  { grid-area: hint; }

  /* Tighter rows so the whole board fits without scrolling at 360px. */
  #overlay:not(.title-screen) .scoreboard {
    margin: 4px 0 0;
    padding: 7px 10px;
    font-size: 10px;
    line-height: 1.35;
  }
  #overlay:not(.title-screen) .sb-total { margin-bottom: 5px; padding-bottom: 4px; }
  #overlay:not(.title-screen) .sb-total b { font-size: 17px; }
  #overlay:not(.title-screen) h1 { font-size: clamp(1rem, 3.4vw, 1.4rem); }
}

h1 {
  margin: 0 0 .4rem;
  font-size: clamp(1.3rem, 5vw, 2rem);
  letter-spacing: .06em;
}

/* Fullscreen affisch / poster title.
   Modelled directly on 1000X700_Affisch.jpg: a hard-edged red sunburst, a
   border of gold five-pointed stars, and blue chrome lettering inside a fat
   gold outline. Everything here is drawn in CSS - the only image on the
   screen is the pair of stilt-walkers in the middle. */
#overlay.title-screen {
  place-items: stretch;
  padding: 0;
  overflow: hidden;
  isolation: isolate;
  /* Under the rays, so the centre reads bright and the corners fall away. */
  background: radial-gradient(circle at 50% 44%,
    #e0333c 0%, #b81b24 34%, #7d0f16 70%, #3d070b 100%);
  animation: poster-pulse 7s ease-in-out infinite;
}

#overlay.title-screen::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 46%;
  /* A viewport-sized rectangle exposes its corners as soon as it rotates.
     This disc is larger than the diagonal of every viewport, so its circular
     edge always stays beyond the clipped poster. */
  width: 150vmax;
  height: 150vmax;
  border-radius: 50%;
  /* The poster's rays are opaque alternating reds, not a wash - they are the
     loudest thing on it after the title, so a 14%-alpha tint reads as a
     smudge where the real thing reads as a circus. Held at .55 only so the
     era buttons stay legible on top. */
  background: repeating-conic-gradient(
    from 0deg at 50% 50%,
    rgba(255, 92, 86, .55) 0deg 4.5deg,
    rgba(96, 8, 14, .45) 4.5deg 9deg
  );
  transform: translate(-50%, -50%) rotate(0deg);
  transform-origin: center;
  pointer-events: none;
  will-change: transform;
  animation: sunburst-spin 80s linear infinite;
}

/* Star border. The stars are one inline SVG tiled along each edge; four
   background layers rather than a repeating-linear trick, because the corners
   have to land on a whole star and not a sliced one. */
#overlay.title-screen::after {
  content: "";
  position: absolute;
  inset: max(6px, env(safe-area-inset-top)) max(6px, env(safe-area-inset-right))
         max(6px, env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left));
  border: 3px solid var(--poster-gold);
  box-shadow: inset 0 0 0 var(--star-band) rgba(120, 12, 18, .55);
  background-image:
    var(--star), var(--star), var(--star), var(--star);
  background-repeat: repeat-x, repeat-x, repeat-y, repeat-y;
  background-position: top left, bottom left, left top, right top;
  background-size: var(--star-band) var(--star-band);
  pointer-events: none;
  z-index: 1;
}

@keyframes sunburst-spin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes poster-pulse {
  0%, 100% { filter: saturate(1); }
  50% { filter: saturate(1.08) brightness(1.03); }
}

@media (prefers-reduced-motion: reduce) {
  #overlay.title-screen,
  #overlay.title-screen::before {
    animation: none;
  }

  #overlay.title-screen::before {
    will-change: auto;
  }
}

.title-screen .panel {
  position: relative;
  z-index: 2;
  /* Two scrims, top and bottom, so the lettering and the control blurb stay
     readable over the couple - and the band BETWEEN them stays completely
     clear, which is where the couple actually are. A single centred vignette
     did the opposite: it darkened the middle and left the type unbacked.
     Painted on the panel rather than as another overlay layer because it has
     to sit ABOVE the figure and BELOW the text, and the panel is already
     exactly that plane. */
  background:
    linear-gradient(180deg, rgba(46, 5, 10, .72) 0%, rgba(46, 5, 10, .34) 20%,
                    rgba(46, 5, 10, 0) 33%),
    linear-gradient(0deg, rgba(46, 5, 10, .78) 0%, rgba(46, 5, 10, .40) 24%,
                    rgba(46, 5, 10, 0) 38%);
  width: 100%;
  height: 100%;
  max-width: none;
  margin: 0;
  padding:
    max(1.4rem, calc(env(safe-area-inset-top) + 1.2rem))
    max(1.2rem, env(safe-area-inset-right))
    max(1.6rem, calc(env(safe-area-inset-bottom) + 1.2rem))
    max(1.2rem, env(safe-area-inset-left));
  transform: none;
  border: none;
  border-radius: 0;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  /* Top-aligned, NOT centred. Centring stacked the lettering, the blurb and the
     era buttons as one block down the middle of the screen, which is exactly
     where the couple's heads and torsos are. Pinning the type to the top and
     pushing the controls to the bottom (see #ov-body's auto margin) opens the
     middle band up for them. */
  justify-content: flex-start;
  gap: .55rem;
  /* A short viewport - a landscape phone, or a small browser pane - used to
     push the level list and the buttons under it clean off the bottom, where
     they could not be reached at all. The panel scrolls instead, and the
     bottom padding above already clears the home indicator. */
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* Flex children default to min-height:auto, which refuses to shrink and would
   make the panel itself overflow rather than scroll. */
.title-screen .panel > * { flex: 0 0 auto; }

/* Everything from the control blurb down is the bottom group. `auto` eats all
   the slack in one place, so the gap lands between the title and the blurb -
   over the couple - instead of being shared out between every row. */
.title-screen #ov-body { margin-top: auto; }

.title-tag {
  margin: 0;
  color: var(--poster-gold);
  font-family: var(--display);
  font-size: clamp(.62rem, 2.4vw, .85rem);
  letter-spacing: .22em;
  text-transform: uppercase;
}

.title-screen h1 {
  /* Room above the lettering: it is the poster's headline, and a headline
     jammed against the star border reads as a header bar. Scales with the
     viewport so a landscape phone does not pay for it. */
  margin: clamp(.5rem, 3.5vh, 2.4rem) 0 0;
  text-transform: uppercase;
  line-height: .88;
}

.title-big {
  display: block;
  font-family: var(--display);
  letter-spacing: .02em;
  /* HOLLOW LETTERS. It used to be filled with the affisch's blue chrome ramp;
     now the glyphs are see-through, so the sunburst behind the title reads
     straight through them and only the gold outline draws the word.
     `color: transparent` with no background is the whole trick - the outline
     is a separate layer (::before below) and is untouched by this. */
  background: none;
  color: transparent;
  position: relative;
}

/* The gold outline. `-webkit-text-stroke` on the element itself would be
   clipped away by `background-clip: text`, so the stroke is painted by a
   duplicate sitting behind - hence data-text on the spans in main.js. */
.title-big::before {
  content: attr(data-text);
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  z-index: -1;
  color: transparent;
  -webkit-text-stroke: var(--stroke-w) var(--poster-gold);
  text-shadow: 0 4px 0 rgba(20, 6, 10, .85);
}

/* Sized off vw AND vh. A landscape phone is wide and short, so a vw-only
   clamp gives the title a 120px cap height on a 375px-tall screen and pushes
   the era buttons off the bottom - the one thing on this screen that has to
   stay reachable. Two words at 13vw do not fit a portrait phone on one line,
   and they are not meant to: they wrap to a stacked MALTE / KNAPP, which is
   the affisch's own two-tier lockup. */
.title-big {
  /* 4px, not 8. The stroke is centred on the glyph edge, so half of it eats
     inward - at 8px it closed up the counters of the A and the P, which is
     the one thing hollow letters cannot afford. */
  --stroke-w: 4px;
  font-size: clamp(2.1rem, min(13vw, 15vh), 5.6rem);
  letter-spacing: .01em;
}

/* The subtitle takes the place of the poster's SHOW / CIRKUSSKOLA /
   CIRKUSUTSTÄLLNIG line: white, wide-tracked, small under the big word. */
.title-role {
  display: block;
  margin: .5rem 0 0;
  font-family: var(--display);
  color: #fff;
  font-size: clamp(.7rem, 2.9vw, 1.05rem);
  letter-spacing: .3em;
  text-transform: uppercase;
  text-shadow: 0 2px 0 rgba(20, 6, 10, .8);
}


/* Only the poster screen has a poster on it. */
.poster-pair,
.poster-shade { display: none; }

/*
 * The couple's shadow, thrown at the viewer.
 *
 * The light is the sunburst behind them, so the shadow comes forward and down:
 * the same artwork, blackened, mirrored about their feet and stretched to
 * TWICE their height, the way a low light behind a figure throws a long one.
 *
 * Its lean tracks the rays. The burst turns once every 80s, and this leans on
 * the same clock and the same easing, so at any moment the shadow lies along
 * the bars rather than across them. It only ever leans - a shadow that went
 * all the way round would be a blade sweeping the poster, not a shadow.
 *
 * It fades out along its length, because the far end of a long shadow is
 * always the soft end.
 */
.title-screen .poster-shade {
  display: block;
  /* FIXED, not absolute. The shadow is mirrored and stretched to twice the
     couple's height, and a transform counts toward an ancestor's scroll
     extent - so on a 390px landscape phone this one element reached y=756 and
     made the whole title screen scrollable. A fixed element contributes
     nothing to #overlay's scrollHeight. The overlay is itself fixed at
     inset:0, so the percentages below resolve against the same box and it
     lands exactly where it did. */
  position: fixed;
  left: 50%;
  /* Same box as the figures, and both are pinned to the BOTTOM of it. With
     `contain`, a box wider than the art letterboxes it vertically, which left
     the shadow starting a band-height below their boots; `object-position:
     bottom` puts the art's own bottom edge on the box's bottom edge, which is
     the line the mirror pivots about - so shadow and feet meet exactly. */
  top: 21%;
  height: min(59%, 24rem);
  width: auto;
  max-width: 64vw;
  object-fit: contain;
  object-position: bottom;
  image-rendering: pixelated;
  z-index: 0;
  pointer-events: none;
  /* Strong enough to survive the panel's bottom scrim, which is exactly the
     band the far end of the shadow falls into. */
  opacity: .5;
  filter: brightness(0) blur(1.5px);
  /*
   * The light is close and behind them, so the shadow SPLAYS: life-size where
   * it leaves their feet and wider the further it runs. That is a projection,
   * not a scale, so it is done in 3D - the plane is tilted away under
   * perspective, which leaves the near edge alone and opens up the far one.
   * `scaleY(-2)` mirrors it about the feet and runs it to twice their height.
   */
  transform-origin: 50% 100%;
  /* Lifted before the mirror, or the shadow starts in mid-air under their
     boots: a plane rotated under perspective pushes its near edge DOWN. The
     three numbers were measured together rather than guessed - at 1200px of
     perspective and 10deg the shadow runs 2.5x the figure and ends 1.3x as
     wide as it starts, and 18% of its own height pulls its near edge back up
     INTO their boots - a shadow that merely touches the feet still reads as a
     separate object, one that overlaps them reads as attached. Written as a
     percentage so it holds as the poster scales. */
  transform: translateX(-50%) translateY(-18%) perspective(1200px) rotateX(10deg) scaleY(-2);
  animation: poster-shade-lean 80s linear infinite;
  -webkit-mask-image: linear-gradient(to top, rgba(0, 0, 0, .95) 0%, rgba(0, 0, 0, 0) 82%);
  mask-image: linear-gradient(to top, rgba(0, 0, 0, .95) 0%, rgba(0, 0, 0, 0) 82%);
}

/* The lean tracks the sunburst: same 80s clock, so the shadow lies ALONG the
   rays rather than across them. */
@keyframes poster-shade-lean {
  0%   { transform: translateX(-50%) translateY(-18%) perspective(1200px) rotateX(10deg) scaleY(-2) skewX(-4deg); }
  25%  { transform: translateX(-50%) translateY(-18%) perspective(1200px) rotateX(10deg) scaleY(-2) skewX(0deg); }
  50%  { transform: translateX(-50%) translateY(-18%) perspective(1200px) rotateX(10deg) scaleY(-2) skewX(4deg); }
  75%  { transform: translateX(-50%) translateY(-18%) perspective(1200px) rotateX(10deg) scaleY(-2) skewX(0deg); }
  100% { transform: translateX(-50%) translateY(-18%) perspective(1200px) rotateX(10deg) scaleY(-2) skewX(-4deg); }
}

.title-screen .poster-pair {
  display: block;
  /*
   * A backdrop, behind the lettering, the way the affisch stands its Vegas
   * sign behind its own type.
   *
   * Out of the flow on purpose. As a flex item between the title and the era
   * buttons it was the only elastic thing in a column that already wanted
   * ~400px, so on a landscape phone - the orientation this game is played in -
   * it got squeezed to a 40px smudge. Absolute means its size is set by the
   * viewport, never by what is left over.
   *
   * Legibility comes from the scrim on .title-screen .panel rather than from
   * dimming the art, so the couple stay full-strength pixel art.
   */
  position: absolute;
  left: 50%;
  /* Hung from the TOP, not stood on the floor: their heads sit just under
     "MASTER OF THE UNICYCLE" whatever the viewport height does to the rest of
     the column, and the year card still crosses their middle with the faces
     clear above it. */
  top: 21%;
  bottom: auto;
  transform: translateX(-50%);
  z-index: 0;
  /* 30% down from the sizes that filled the frame. Two reasons, and the second
     is the one that matters: they read as figures on a poster rather than as a
     wallpaper, and their heads clear the lettering. The two sheets do not have
     the same headroom - the cute pair's shoulders start at 15% of the image
     height against the stilt pair's 20% - so at full height the cute variant
     put a face behind "MALTE KNAPP" while the stilt one sat correctly. */
  height: min(59%, 24rem);
  width: auto;
  max-width: 64vw;
  object-fit: contain;
  /* Bottom-anchored, so their feet land on the same line the shadow pivots
     about however the box is clamped. */
  object-position: bottom;
  image-rendering: pixelated;
  pointer-events: none;
  filter: drop-shadow(0 10px 22px rgba(30, 4, 8, .55));
}

/* 40th-anniversary wreath. Right of the couple, below the chrome row, so it
   does not cover the pair or the year booth. Language-correct src comes from
   main.js; this only places it on the title proper. Sized ~2× the first
   placement: shifted up rather than shrunk if the box would hit GO. */
.title-badge { display: none; }
.title-screen .title-badge {
  display: block;
  position: absolute;
  /* LEFT and vertically centred, with its own margin off the star border.
     It used to be an upper-right stamp, which fought the play button that now
     lives on the right. Centring on Y rather than pinning to a corner keeps
     the margins even whatever the viewport does. */
  top: 50%;
  left: max(calc(var(--star-band) + 40px), calc(env(safe-area-inset-left) + 40px));
  transform: translateY(-50%);
  height: min(84vh, 27rem);
  width: auto;
  max-width: 46vw;
  object-fit: contain;
  image-rendering: pixelated;
  z-index: 1;
  pointer-events: none;
  /* A slow warm shine on top of the drop shadow - just enough that the gold
     looks lit rather than printed. */
  filter: drop-shadow(0 8px 16px rgba(20, 4, 8, .55))
          drop-shadow(0 0 10px rgba(255, 214, 120, .35));
  animation: badge-shine 4.2s ease-in-out infinite;
}

@keyframes badge-shine {
  0%, 100% {
    filter: drop-shadow(0 8px 16px rgba(20, 4, 8, .55))
            drop-shadow(0 0 8px rgba(255, 214, 120, .28));
  }
  50% {
    filter: drop-shadow(0 8px 16px rgba(20, 4, 8, .55))
            drop-shadow(0 0 20px rgba(255, 232, 160, .6));
  }
}

@media (prefers-reduced-motion: reduce) {
  .title-screen .title-badge { animation: none; }
}
.title-screen.picking-level .title-badge { display: none; }

.title-screen #ov-body {
  max-width: 28rem;
  color: #fff0dd;
  font-size: clamp(.72rem, 2.6vw, .95rem);
}

.title-screen #ov-start {
  margin-top: .35rem;
  border-color: var(--poster-gold);
  border-radius: 4px;
  background: linear-gradient(180deg, #1f4f7a, #162f4d);
  color: var(--poster-cream);
  box-shadow: 0 4px 0 #09192a;
  font-family: var(--display);
  font-size: clamp(1.05rem, 3.5vw, 1.35rem);
  letter-spacing: .14em;
  padding: .75rem 1.8rem;
  min-width: min(16rem, 80vw);
}

.title-screen #ov-start:disabled {
  opacity: .45;
  box-shadow: none;
}

.title-screen #ov-start:not(:disabled):active {
  background: #20466f;
  transform: translateY(2px);
  box-shadow: 0 1px 0 #09192a;
}

/* "Tap a year to start" is dropped on the poster: four big year buttons under
   a VÄLJ ÅR heading do not need to be explained, and the two lines it took
   were coming straight out of the figure's height. It still appears on the
   game-over screen, where "Try again" and "Title screen" sit side by side and
   the wording actually distinguishes them. */
.title-screen .hint { display: none; }

/* ---- era picker -------------------------------------------------------- */

.era-pick {
  width: min(34rem, 94vw);
  margin: .35rem 0 .15rem;
}

.era-pick[hidden] { display: none; }

.era-label {
  margin: 0 0 .55rem;
  font-family: var(--display);
  color: var(--poster-gold);
  letter-spacing: .18em;
  /* The lower bound was .75rem and the cap .95rem, so this stayed tiny on
     every screen - it is the heading that says what the card below is FOR. */
  font-size: clamp(.95rem, 2.8vw, 1.5rem);
  text-transform: uppercase;
  /* It now crosses the figures' costumes rather than empty backdrop, so it
     carries its own dark edge instead of relying on what is behind it. */
  text-shadow: 0 2px 3px rgba(0, 0, 0, .85), 0 0 10px rgba(0, 0, 0, .7);
}

.era-row {
  display: grid;
  /* Four eras. Kept on one row - wrapping put a lone button on its own line. */
  grid-template-columns: repeat(4, 1fr);
  gap: .4rem;
}

.era-btn {
  appearance: none;
  border: 2px solid rgba(240, 200, 74, .55);
  border-radius: 6px;
  background: rgba(20, 6, 10, .42);
  color: var(--poster-cream);
  padding: .5rem .3rem .45rem;
  min-height: 2.9rem;
  cursor: pointer;
  font: inherit;
  transition: transform .08s, background .12s, border-color .12s, box-shadow .12s;
}

.era-btn:active { transform: scale(.97); }

.era-btn.selected {
  border-color: var(--poster-gold);
  background: linear-gradient(180deg, rgba(42, 126, 200, .55), rgba(20, 50, 80, .72));
  box-shadow:
    0 0 0 2px rgba(240, 200, 74, .35),
    0 8px 22px rgba(0, 0, 0, .35);
}

.era-year {
  display: block;
  font-family: var(--display);
  font-size: clamp(1.05rem, 4vw, 1.5rem);
  letter-spacing: .08em;
  line-height: 1;
}

.era-name {
  display: block;
  margin-top: .28rem;
  font-size: clamp(.62rem, 2.2vw, .78rem);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #f0d9ca;
  opacity: .9;
}

#ov-body {
  margin: 0 0 1.1rem;
  line-height: 1.5;
  font-size: clamp(.8rem, 3.4vw, 1rem);
  color: #b9bece;
}

#ov-start {
  font: inherit;
  font-size: 1rem;
  padding: .7rem 1.5rem;
  border-radius: 999px;
  border: 2px solid #6f7ea8;
  background: #202638;
  color: var(--ink);
}

#ov-start:active { background: #2b3350; }

#overlay:not(.title-screen) #ov-start {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  top: 50%;
  transform: translateY(-50%);
  margin: 0;
  z-index: 6;
  background: #1c9a45;
  border: 2px solid #5dff88;
  color: #f4fff6;
  box-shadow: 0 4px 0 #0d5c28;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}

#overlay:not(.title-screen) #ov-start:active {
  background: #157a36;
  transform: translateY(calc(-50% + 3px));
  box-shadow: 0 1px 0 #0d5c28;
}

#ov-back {
  display: block;
  margin: .7rem auto 0;
  padding: .55rem 1rem;
  border: 1px solid #6f7ea8;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: inherit;
}

#ov-back[hidden] { display: none; }

/* The way out. Amber rather than the blue of "try again": it is the option
   you take when trying again has stopped working, so it must not read as the
   default. */
#ov-skip {
  display: block;
  margin: .7rem auto 0;
  padding: .55rem 1.1rem;
  border: 1px solid #e8b23c;
  border-radius: 999px;
  background: rgba(232, 178, 60, .14);
  color: #ffd77a;
  font: inherit;
  cursor: pointer;
}

#ov-skip:hover { background: rgba(232, 178, 60, .26); }
#ov-skip:active { background: rgba(232, 178, 60, .36); }
#ov-skip[hidden] { display: none; }

/* Why the finish screen says where the career went next. */
.ov-note {
  display: inline-block;
  margin-top: .3rem;
  color: #ffd77a;
  font-size: .82em;
}

/* A locked year browses like a locked level: greyed, with the lock over it
   and the billing line replaced by what has to be cleared first. */
.era-card.locked { cursor: default; }
.era-card.locked .era-year-big,
.era-card.locked .era-place { opacity: .32; }
.era-card.locked:hover { transform: none; filter: none; }
.era-card.locked::before { opacity: .12; animation: none; }
.era-card .lv-lock { top: 50%; }

.hint {
  margin: 1rem 0 0;
  font-size: .72rem;
  color: #7c8296;
  line-height: 1.6;
}

@media (max-width: 520px), (max-height: 420px) {
  .pad {
    width: 88px;
    height: 88px;
  }

  .pad-icon { font-size: 29px; }
  .pad-label { font-size: 9px; }

  .pad-duck {
    width: 68px;
    height: 68px;
  }

  /* Three stacked pads at 72px would eat 232px of a 420px-tall landscape
     phone. Throw is the optional verb, so it is the one that shrinks. */
  .pad-throw {
    width: 76px;
    height: 76px;
  }

  .pad-back {
    width: 70px;
    height: 70px;
  }

  .right-controls { gap: 8px; }
  .left-controls { gap: 8px; }

  .title-screen .panel {
    gap: .35rem;
    padding-top: max(1.6rem, calc(env(safe-area-inset-top) + 1.2rem));
  }

  .title-screen #ov-body {
    font-size: .68rem;
    line-height: 1.35;
    margin-bottom: .2rem;
  }

  .era-btn {
    min-height: 3.6rem;
    padding: .55rem .25rem;
  }
}

/*
 * LANDSCAPE - the orientation this game is actually played in, and the one the
 * poster is tuned for. Height is the scarce axis: the lettering, blurb and era
 * buttons want ~400px of column and a landscape phone has 375px in total. The
 * figure is a backdrop rather than a column item precisely so that squeeze
 * never reaches it, but the TEXT still has to be trimmed to fit.
 */
@media (orientation: landscape) {
  .title-screen .panel { gap: .25rem; }

  /* The control blurb is five lines (year, then Swedish/English for riding and
     for juggling) and it is the only thing standing between the couple and the
     era buttons. Tightened hard here: every line it gives back is a line of
     them you can see. The English rows shrink further than the Swedish - they
     are the gloss, not the instruction. */
  .title-screen #ov-body {
    font-size: clamp(.62rem, 1.55vw, .78rem);
    line-height: 1.18;
    margin-bottom: 0;
  }

  .title-screen #ov-body .en { font-size: .88em; opacity: .82; }

  .title-screen .era-label {
    margin-bottom: .3rem;
    font-size: clamp(.66rem, 1.6vw, .8rem);
  }

  .title-screen .era-pick { margin: .1rem 0 0; }

  .title-screen .era-btn { min-height: 2.4rem; padding: .35rem .3rem; }

  /* Everything above bought roughly 40px of column, and it all goes here. The
     cap is 100% rather than a rem value because on a landscape phone height is
     the only axis that binds - these sheets are wider than they are tall, and
     there is width to spare on every screen this runs on. */
  .title-screen .poster-pair {
    height: min(70%, 21rem);
    bottom: 0;
  }

  /* Landscape in general - a desktop window included - has room for the
     wreath at a size worth looking at. The phone-shaped rule further down
     cuts it back; this is not that rule. */
  .title-screen .title-badge {
    height: min(72vh, 18rem);
    max-width: 34vw;
  }

  /* With the wreath pulled in, the free strip between it and START is about
     445px at 844 wide. The row is trimmed to fit INSIDE it rather than the
     type being shrunk - the arrows and the card keep their tap sizes, the
     air between them goes. */
  .title-screen .level-pick { gap: clamp(6px, 1.6vw, 14px); }
  .title-screen .era-card { min-width: clamp(120px, 26vw, 220px); }
}

/* Short AND narrow - a portrait phone held sideways-ish, or a tiny window.
   The landscape rule above already gives the figure its own column, so all
   that is needed here is to tighten the text column so it still fits. */
@media (max-height: 430px) {
  .title-screen .panel {
    gap: .25rem;
    padding-bottom: max(1rem, calc(env(safe-area-inset-bottom) + .6rem));
  }

  .title-screen .title-role { margin-top: .25rem; }
}

/* Offline / file:// fallback if Google Fonts blocked */
/* The fill is gone, so there is nothing left for this to fall back to: the
   letters are transparent everywhere, and the outline does the drawing. */
@supports not (background-clip: text) {
  .title-big { color: transparent; }
}


/* Sound + fullscreen — top-right, clear of the debug corner-tap zone. */
#btn-sound,
#btn-music,
#btn-fullscreen {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  z-index: 40;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .25);
  background: rgba(0, 0, 0, .38);
  color: #fff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  opacity: .55;
  transition: opacity .15s;
  touch-action: manipulation;
}
#btn-sound {
  right: max(10px, env(safe-area-inset-right));
}
/* The level-edit star. Half the size of its neighbours and barely lit, sitting
   inboard of them - findable if you know it is there, invisible if you do
   not, and impossible to hit by reaching for fullscreen. */
#btn-edit {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  right: calc(10px + env(safe-area-inset-right, 0px) + 142px);
  z-index: 40;
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: #fff;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  opacity: .22;
  transition: opacity .15s;
  touch-action: manipulation;
}

#btn-edit:hover { opacity: .85; }
#btn-edit[hidden] { display: none; }

#btn-fullscreen {
  right: calc(10px + env(safe-area-inset-right, 0px) + 92px);
  font-size: 16px;
}

/* The music switch: same row, immediately left of the speaker, and smaller -
   it is the quieter of the two decisions. Sits at 96px so the three buttons
   read as one group (sound 0, music 48, fullscreen 96 would collide, so the
   music one takes the middle slot and fullscreen moves out). */
#btn-music {
  right: calc(10px + env(safe-area-inset-right, 0px) + 48px);
  width: 34px;
  height: 34px;
  margin-top: 3px;
  font-size: 17px;
}

#btn-sound:hover,
#btn-sound:focus-visible,
#btn-music:hover,
#btn-music:focus-visible,
#btn-fullscreen:hover,
#btn-fullscreen:focus-visible { opacity: 1; }
#btn-sound.muted,
#btn-music.muted { opacity: .3; }

/* A line through the note says OFF at a glance - an emoji has no muted twin
   the way the speaker does. */
#btn-music.muted::after {
  content: "";
  position: absolute;
  left: 20%;
  right: 20%;
  top: 50%;
  height: 2px;
  background: currentColor;
  transform: rotate(-35deg);
}
#btn-fullscreen[hidden] { display: none; }

/* Bilingual text: Swedish leads, English sits under it a shade quieter so a
   two-language string still reads as one message rather than two. */
.en {
  opacity: .62;
  font-size: .84em;
  font-style: italic;
}

/* The couple, standing under the lettering while you turn the phone. */
.rotate-pair {
  width: min(42vw, 170px);
  height: auto;
  margin: 4px 0 2px;
  object-fit: contain;
  image-rendering: pixelated;
  filter: drop-shadow(0 10px 22px rgba(30, 4, 8, .55));
  flex: 0 1 auto;
}

/* English wreath on the portrait lock — always EN, readable while you turn.
   Aimed at ~2× the old 240px cap; on a phone the width bound wins first, so
   it grows as far as the overlay allows without sitting on the rotate copy. */
.rotate-badge {
  width: min(88vw, 48vh, 480px);
  height: auto;
  max-height: 38vh;
  margin: 2px 0;
  object-fit: contain;
  image-rendering: pixelated;
  filter: drop-shadow(0 8px 16px rgba(30, 4, 8, .5));
  flex: 0 1 auto;
  min-height: 0;
}

/* ---- portrait lock ------------------------------------------------------ */
/* The game is a landscape side-scroller: in portrait the road becomes a
   letterbox and the touch pads crowd the middle of it. So ask for the turn
   instead of squeezing the game into a shape it was never drawn for.
   Touch devices only - `pointer: coarse` - because a narrow desktop window is
   a choice the person made and none of our business. */
#rotate { display: none; }

@media (orientation: portrait) and (pointer: coarse) {
  #rotate {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.9rem;
    padding: 5vw;
    text-align: center;
    background:
      radial-gradient(circle at 50% 42%,
        #e0333c 0%, #b81b24 34%, #7d0f16 70%, #3d070b 100%);
  }

  /* Everything else stays put and simply waits behind it. */
  #rotate .title-big {
    --stroke-w: 3px;
    font-size: clamp(2rem, 14vw, 4rem);
  }

  .rotate-icon {
    font-size: clamp(2.4rem, 16vw, 5.5rem);
    line-height: 1;
    color: var(--poster-gold);
    /* Tips over and back: the gesture being asked for, on a loop. */
    animation: rotate-hint 2.4s ease-in-out infinite;
    flex-shrink: 0;
  }

  .rotate-ask {
    margin: 0;
    color: var(--poster-cream);
    font-family: var(--poster-body);
    font-size: clamp(.95rem, 4.6vw, 1.4rem);
    line-height: 1.5;
    flex-shrink: 0;
  }

  .rotate-ask em {
    display: inline-block;
    margin-top: .35rem;
    opacity: .72;
    font-size: .85em;
  }
}

@keyframes rotate-hint {
  0%, 100% { transform: rotate(0deg); }
  45%, 75% { transform: rotate(90deg); }
}

/* ---- era stepper -------------------------------------------------------- */
/* Same gesture as the level picker: one year at a time, arrows either side,
   swipeable. The year is the big thing; the place and the billing are what
   tell you which chapter of his career you are about to ride. */
.era-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 4vw, 40px);
  width: 100%;
}

.era-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  min-width: clamp(150px, 46vw, 340px);
  padding: clamp(4px, 1.4vh, 14px) clamp(12px, 4vw, 30px);
  cursor: pointer;
  transition: transform .12s, filter .12s;
}

.era-card:hover { transform: scale(1.03); filter: brightness(1.06); }
.era-card:active { transform: scale(.98); }

.era-place {
  font: 800 clamp(10px, 2.4vh, 16px)/1.1 ui-monospace, Menlo, Consolas, monospace;
  letter-spacing: .18em;
  text-indent: .18em;
  color: var(--poster-gold);
  text-transform: uppercase;
}

.era-year-big {
  font-family: var(--display);
  font-size: clamp(38px, 15vh, 116px);
  line-height: .95;
  color: var(--poster-cream);
  text-shadow: 0 3px 0 rgba(0, 0, 0, .45);
}

.era-billing {
  font-family: var(--poster-body);
  font-size: clamp(10px, 2.3vh, 16px);
  font-style: italic;
  color: rgba(255, 255, 255, .78);
}

/* The language flag, in the same corner family as sound and fullscreen. */
/* The language flag is a CHOICE, not chrome: it is the one control on the
   title screen a player is meant to notice, so it is sized and framed like the
   poster rather than tucked in with the mute button. */
#btn-lang {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  right: calc(10px + env(safe-area-inset-right, 0px) + 104px);
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 62px;
  height: 44px;
  padding: 0;
  border-radius: 8px;
  border: 2px solid var(--poster-gold, #f0c84a);
  background: rgba(0, 0, 0, .5);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .45);
  line-height: 1;
  cursor: pointer;
  opacity: 1;
  transition: transform .15s, box-shadow .15s;
  touch-action: manipulation;
}

#btn-lang:hover {
  transform: scale(1.06);
  box-shadow: 0 0 0 3px rgba(240, 200, 74, .35), 0 2px 12px rgba(0, 0, 0, .5);
}
#btn-lang:active { transform: scale(.96); }
#btn-lang[hidden] { display: none; }
/* The flag fills the button, with a hair of the rim showing around it. */
#btn-lang svg {
  display: block;
  width: 46px;
  height: 29px;
  border-radius: 3px;
}

/* On a landscape phone the title screen has room for the poster and the year
   card - and nothing else. The control blurb is the first thing to go: it
   overlapped the card, and the same instructions are on the game-over screen
   where there is time to read them. */
@media (orientation: landscape) and (max-height: 560px) {
  .title-screen #ov-body,
  .title-screen #ov-hint { display: none; }
  .title-screen .title-role { font-size: clamp(.6rem, 2.2vw, .85rem); }
  .title-screen .title-big { --stroke-w: 3px; font-size: clamp(1.6rem, 9vh, 3rem); }
}

/* ---- how to play -------------------------------------------------------- */
/* Sits over the live game: the rider behind this card is really riding, and
   really doing the thing being named. */
#howto[hidden] { display: none; }

#howto {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: .6rem;
  padding: max(10px, env(safe-area-inset-top)) 12px 12px;
  pointer-events: none;             /* the game shows through; only the button takes taps */
}

.howto-card {
  display: flex;
  align-items: center;
  gap: clamp(10px, 3vw, 20px);
  max-width: min(560px, 92vw);
  padding: clamp(6px, 1.6vh, 14px) clamp(12px, 3vw, 22px);
  border: 2px solid rgba(240, 200, 74, .5);
  border-radius: 14px;
  background: rgba(10, 11, 15, .72);
}

/* The pad, drawn like the real one so the eye can match them up. */
.howto-pad {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  min-width: clamp(46px, 11vh, 74px);
  height: clamp(46px, 11vh, 74px);
  padding: 0 8px;
  border: 2px solid rgba(255, 255, 255, .55);
  border-radius: 50px;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  font: 800 clamp(13px, 3.2vh, 20px)/1 ui-monospace, Menlo, Consolas, monospace;
  animation: howto-pulse 1.1s ease-in-out infinite;
}

@keyframes howto-pulse {
  0%, 100% { transform: scale(1); border-color: rgba(255, 255, 255, .55); }
  50% { transform: scale(1.09); border-color: var(--poster-gold); }
}

.howto-text { display: flex; flex-direction: column; gap: 2px; text-align: left; }

.howto-text strong {
  color: var(--poster-gold);
  font: 800 clamp(14px, 3.4vh, 22px)/1.1 var(--display);
  letter-spacing: .06em;
}

.howto-text span {
  color: rgba(255, 255, 255, .85);
  font: 400 clamp(10px, 2.4vh, 15px)/1.35 var(--poster-body);
}

.howto-dots { display: flex; gap: 6px; }

#howto .level-back {
  pointer-events: auto;
  margin-top: auto;
  margin-bottom: max(6px, env(safe-area-inset-bottom));
}

/* The "?" that opens it, beside the Years button. */
#ov-howto {
  font-size: 13px;
  letter-spacing: .06em;
}

/* The year card sits low, under their faces. `auto` above it eats all the
   slack in one place, so the poster type stays at the top, the couple stand in
   the middle, and the thing you actually tap is within thumb reach. */
.title-screen #era-pick {
  margin-top: auto;
  padding-bottom: clamp(4px, 2vh, 18px);
}

/* THE YEAR PICKER IS CENTRED ON THE VIEWPORT, full stop.
   It briefly carried a gutter on each side so its arrows would clear the
   wreath and the START button. That worked, and it was wrong: it shifted the
   year card, HOW TO PLAY and the YEAR/ALL/RESET row all visibly to the right,
   so the whole screen leaned. The wreath is DECORATION - it gets out of the
   way instead (see the short-landscape rule further down), and the controls
   sit where the eye expects them. */
.title-screen #era-pick {
  box-sizing: border-box;
  margin-left: auto;
  margin-right: auto;
}

/* The pointer: a big fat red arrow that slides from the middle of the screen
   toward the pad it is naming, over and over. JS sets the position and the
   angle on the wrapper; the animation lives on the inner run, so the slide
   happens ALONG the arrow's own axis whichever way it is pointing. */
.howto-arrow {
  position: fixed;
  z-index: 61;
  pointer-events: none;
}

.howto-arrow[hidden] { display: none; }

.howto-arrow-run {
  display: flex;
  align-items: center;
  animation: howto-arrow-run 1.15s ease-in-out infinite;
}

/* Shaft and head, sized off viewport height so it stays big on a short
   landscape phone. */
.ha-shaft {
  display: block;
  width: clamp(52px, 13vh, 120px);
  height: clamp(16px, 4vh, 34px);
  background: #ff2b2b;
  border: 3px solid rgba(60, 0, 0, .55);
  border-right: none;
  border-radius: 3px 0 0 3px;
}

.ha-head {
  display: block;
  width: 0;
  height: 0;
  border-top: clamp(18px, 4.6vh, 40px) solid transparent;
  border-bottom: clamp(18px, 4.6vh, 40px) solid transparent;
  border-left: clamp(26px, 6.5vh, 56px) solid #ff2b2b;
  filter: drop-shadow(2px 0 0 rgba(60, 0, 0, .55));
}

@keyframes howto-arrow-run {
  0%   { transform: translateX(-14%); opacity: .55; }
  55%  { transform: translateX(14%);  opacity: 1; }
  100% { transform: translateX(-14%); opacity: .55; }
}
}

/* The card carries the year, the place and the billing, and the arrows say it
   can be changed - a "choose era" heading over the top of the couple only
   competed with them. Kept for tall screens, gone where space is tight. */
@media (orientation: landscape) and (max-height: 560px) {
  .title-screen .era-label { display: none; }
}

/* The card's own scrim, so the place and the billing stay readable against
   whatever is standing behind them. */
.era-card {
  background: rgba(10, 11, 15, .62);
  backdrop-filter: blur(1px);
}

/* The year wheel. Stepping swaps the card's contents outright, so the roll
   has to be an entry animation: the new year slides in from the side you
   swiped from, overshoots a hair, and settles - a detent, like a real wheel. */
@keyframes era-roll-left {
  0%   { opacity: 0; transform: translateX(60%) scale(.9); }
  62%  { opacity: 1; transform: translateX(-8%) scale(1.02); }
  100% { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes era-roll-right {
  0%   { opacity: 0; transform: translateX(-60%) scale(.9); }
  62%  { opacity: 1; transform: translateX(8%) scale(1.02); }
  100% { opacity: 1; transform: translateX(0) scale(1); }
}
.era-card.spin-up   { animation: era-roll-left .34s cubic-bezier(.22,.9,.3,1); }
.era-card.spin-down { animation: era-roll-right .34s cubic-bezier(.22,.9,.3,1); }
/* The year itself travels a touch further than the card around it. */
.era-card.spin-up .era-year-big,
.era-card.spin-down .era-year-big { animation: inherit; animation-duration: .42s; }

/* HOW TO PLAY: the pad the lesson is about wears the same red as the arrow,
   so the thing being pointed at is unmistakable even mid-swing. */
.pad.howto-target {
  border-color: #e0231c;
  box-shadow: 0 0 0 4px rgba(224, 35, 28, .55), 0 0 26px rgba(224, 35, 28, .55);
  animation: howto-target-pulse 1.15s ease-in-out infinite;
}
@keyframes howto-target-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(224, 35, 28, .45), 0 0 18px rgba(224, 35, 28, .4); }
  50%      { box-shadow: 0 0 0 7px rgba(224, 35, 28, .7),  0 0 34px rgba(224, 35, 28, .7); }
}

/* ---- backdrop editor ---------------------------------------------------- */

/* Small and dim, in the corner opposite the level-builder star: it is a tool,
   and it must not read as part of the game. Sits under the TITLE button, which
   owns the very corner during a run. */
#btn-bg {
  position: fixed;
  z-index: 41;
  top: calc(max(8px, env(safe-area-inset-top)) + 48px);
  left: max(8px, env(safe-area-inset-left));
  min-width: 30px;
  height: 22px;
  padding: 0 6px;
  border: 1px solid rgba(255, 255, 255, .3);
  border-radius: 5px;
  background: rgba(12, 14, 20, .55);
  color: #fff;
  font: 700 10px/1 ui-monospace, Menlo, Consolas, monospace;
  letter-spacing: .08em;
  cursor: pointer;
  opacity: .3;
  transition: opacity .15s;
  touch-action: manipulation;
}

#btn-bg:hover { opacity: .95; }
#btn-bg.on { opacity: .95; border-color: var(--poster-gold, #f0c84a); }
#btn-bg[hidden] { display: none; }

#bgpanel {
  position: fixed;
  z-index: 42;
  top: max(8px, env(safe-area-inset-top));
  left: calc(max(8px, env(safe-area-inset-left)) + 46px);
  width: min(430px, calc(100vw - 70px));
  max-height: calc(100dvh - 24px);
  display: flex;
  flex-direction: column;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 8px;
  background: rgba(10, 12, 18, .93);
  color: #e8eaf2;
  font: 11px/1.3 ui-monospace, Menlo, Consolas, monospace;
}

#bgpanel[hidden] { display: none; }

.bg-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, .14);
}

.bg-head strong { letter-spacing: .1em; }
.bg-scene { flex: 1; opacity: .6; }

.bg-btn {
  padding: 3px 7px;
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 4px;
  background: rgba(255, 255, 255, .07);
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.bg-btn:hover { background: rgba(255, 255, 255, .18); }
.bg-btn.on {
  border-color: var(--poster-gold, #f0c84a);
  background: rgba(240, 200, 74, .22);
}

#bg-save {
  border-color: var(--poster-gold, #f0c84a);
  font-weight: 700;
}

/* The list is the only thing that scrolls, so the header and the note
   stay put however many layers a scene has. */
.bg-rows { flex: 1; min-height: 0; overflow-y: auto; }

/* One row per layer: name and depth on top, then x / y / spd / scl / rpt.
   Back-to-front order, so the list reads the way the scene is stacked. */
.bg-row {
  display: grid;
  grid-template-columns: 16px 62px 1fr 58px;
  align-items: center;
  gap: 3px 6px;
  padding: 5px 0;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}

.bg-row.sel { background: rgba(240, 200, 74, .1); }

/* ONLY this starts a reorder. The row is not draggable until the pointer goes
   down on the handle, or dragging a slider would fling the layer somewhere
   else instead of setting a value - the bug the composer tool had. */
.bg-handle {
  grid-column: 1;
  grid-row: 1 / span 6;
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  opacity: .45;
  user-select: none;
}

.bg-handle:hover { opacity: 1; }
.bg-row.dragging { opacity: .4; }
.bg-row.over-before { box-shadow: inset 0 2px 0 var(--poster-gold, #f0c84a); }
.bg-row.over-after { box-shadow: inset 0 -2px 0 var(--poster-gold, #f0c84a); }

.bg-name { font-weight: 700; }
.bg-depth { grid-column: 3 / span 2; text-align: right; opacity: .55; }
.bg-key { opacity: .6; }

.bg-row input[type="range"] {
  width: 100%;
  height: 14px;
  accent-color: var(--poster-gold, #f0c84a);
}

.bg-row input[type="number"] {
  width: 100%;
  padding: 2px 3px;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 3px;
  background: rgba(0, 0, 0, .4);
  color: inherit;
  font: inherit;
  text-align: right;
}

.bg-note {
  margin: 6px 0 0;
  opacity: .5;
  line-height: 1.35;
}

/* ------------------------------------------------- title-screen quick start
   The green button on the left of the title screen: one tap back into the
   career at the furthest level reached, without walking the year and level
   carousels first.

   Absolutely placed rather than added to the panel column on purpose. The
   column already carries the lettering, the year card and the how-to link, and
   on a landscape phone that column is the axis with nothing to spare - while
   the left band is empty backdrop on every screen the game runs on. */
#ov-quickstart {
  /* FIXED, not absolute: absolute resolves against .panel, and the panel's
     own bottom padding (the safe-area inset) pushed its content box up, so
     "centred" landed 27px above the middle of the screen. Fixed centres it on
     the viewport, which is what the eye actually measures it against. */
  position: fixed;
  right: max(.9rem, calc(env(safe-area-inset-right) + .5rem));
  /* Centred with AUTO MARGINS, not translateY(-50%).
     It used to use the transform, and then circus-breathe was added - whose
     keyframes are plain `transform: scale() rotate()`. An animation replaces
     the property outright, so from the first frame the button lost its
     centring and sat half its own height too low, drifting into whatever was
     beside it. Auto margins centre the box in the layout instead, which
     leaves `transform` entirely to the animation. */
  top: 0;
  bottom: 0;
  height: fit-content;
  margin-block: auto;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .1rem;
  /* Comfortably past the 44px tap minimum in both axes, on the smallest
     screen this has to work on. */
  min-width: clamp(5.4rem, 20vw, 8.5rem);
  min-height: clamp(3.4rem, 13vh, 5rem);
  padding: clamp(.5rem, 1.6vh, .9rem) clamp(.6rem, 2.4vw, 1.1rem);
  border: 2px solid #7dffb4;
  border-radius: 999px;
  background: linear-gradient(180deg, #2fd07a 0%, #16a055 100%);
  color: #052a17;
  cursor: pointer;
  box-shadow: 0 6px 0 #0c6b39, 0 10px 22px rgba(0, 0, 0, .45);
  transition: transform .1s, filter .1s, box-shadow .1s;
}

#ov-quickstart[hidden] { display: none; }
/* It lives inside the shared panel, which the game-over screen reuses. Only
   the title screen should ever show it. */
#overlay:not(.title-screen) #ov-quickstart { display: none; }
#ov-quickstart:hover { filter: brightness(1.07); }
#ov-quickstart:active {
  transform: translateY(calc(-50% + 3px));
  box-shadow: 0 3px 0 #0c6b39, 0 6px 14px rgba(0, 0, 0, .45);
}

.qs-word {
  font-family: var(--display);
  font-size: clamp(.95rem, 3.4vh, 1.5rem);
  letter-spacing: .1em;
  line-height: 1;
}

/* Which year and level the button actually resumes. Small, because the green
   is what carries the button - this line only has to answer "where to?". */
.qs-where {
  font-size: clamp(.5rem, 1.6vh, .7rem);
  letter-spacing: .06em;
  opacity: .82;
  white-space: nowrap;
}

/* The level carousel is itself a "which level" screen, so the shortcut past it
   would only be in the way. */
.title-screen.picking-level #ov-quickstart { display: none; }

/* Portrait phones have height to spare and less width: sitting it beside the
   year card would crowd both, so it drops to the bottom-left corner instead. */
@media (orientation: portrait) and (max-width: 560px) {
  #ov-quickstart {
    top: auto;
    bottom: max(1rem, calc(env(safe-area-inset-bottom) + .6rem));
    transform: none;
  }
  #ov-quickstart:active { transform: translateY(3px); }
}

/* ------------------------------------------------- landscape thumb layout
   The play orientation. A column of pads up the right edge measures well on
   paper and badly under a thumb: on a 375px-tall phone it put throw 187px from
   the thumb's pivot while duck sat 17px away, so one pad needed a full stretch
   and another a full curl. And forward - the pad held for most of a run - sat
   94px out while back, a correction, had the resting position.

   So both clusters are placed on an ARC around where the thumb actually
   pivots, primary verb nearest the rest position and the optional one furthest
   out. Absolute rather than flex because an arc is what this is; the flex
   stacking above still serves portrait and desktop. */
@media (orientation: landscape) and (max-height: 560px) {
  .left-controls,
  .right-controls {
    position: relative;
    width: 250px;
    height: 208px;
  }

  .left-controls > .pad,
  .right-controls > .pad { position: absolute; }

  /* Under the resting thumb: the one he holds almost the whole run. */
  .pad-forward { left: 30px; bottom: 30px; width: 98px; height: 98px; }
  /* Outboard and smaller - a correction, never confused with forward. */
  .pad-back { left: 146px; bottom: 20px; width: 76px; height: 76px; }

  .pad-jump { right: 16px; bottom: 26px; width: 98px; height: 98px; }
  .pad-duck { right: 126px; bottom: 12px; width: 82px; height: 82px; }
  /* Optional verb, so it takes the longest reach of the three. Three pads of
     this size cannot all sit inside a comfortable arc on a 375px-tall screen;
     throw is the one the game can afford to put furthest out. */
  .pad-throw { right: 22px; bottom: 148px; width: 74px; height: 74px; }

  .pad-icon { font-size: 31px; }
  .pad-back .pad-icon,
  .pad-duck .pad-icon,
  .pad-throw .pad-icon { font-size: 26px; }
}


/* --------------------------------------------------- title-screen reset row
   The one control in the game with no undo, so it is deliberately quieter
   than the play button beside it - and the scope switch is set before the
   button is ever armed, never after. */
.reset-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: .5rem;
  flex-wrap: wrap;
}

.reset-scope {
  display: inline-flex;
  border: 2px solid rgba(255, 255, 255, .26);
  border-radius: 999px;
  overflow: hidden;
  background: rgba(0, 0, 0, .3);
}

.reset-scope button {
  appearance: none;
  border: 0;
  min-height: 40px;
  padding: 8px 16px;
  background: transparent;
  color: rgba(255, 255, 255, .58);
  font: 800 12px/1 ui-monospace, Menlo, Consolas, monospace;
  letter-spacing: .06em;
  cursor: pointer;
  transition: background .12s, color .12s;
}

.reset-scope button:active { transform: translateY(1px); }

/* The chosen half carries the poster gold, so which one is armed is readable
   at a glance rather than by comparing two greys. */
.reset-scope button.on {
  background: var(--poster-gold);
  color: #2b1206;
}

/* Armed. Nothing subtle about it - the next press cannot be taken back. */
.level-reset.armed {
  border-color: #ff6b74;
  background: rgba(255, 107, 116, .22);
  color: #ffd0d3;
  animation: reset-pulse .7s ease-in-out infinite;
}

@keyframes reset-pulse {
  50% { background: rgba(255, 107, 116, .38); }
}

@media (prefers-reduced-motion: reduce) {
  .level-reset.armed { animation: none; }
}


/* ------------------------------------------------ title-screen confetti fx
   Between the starburst and the figures. `pointer-events: none` because every
   control on this screen sits on top of it. Only painted while the title is
   up - main.js stops the loop the moment a run starts. */
#title-fx {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}

#overlay:not(.title-screen) #title-fx { display: none; }

/* =================================================== playful circus buttons
   Rubbery rather than rigid: everything on the title uses one squash-and-
   stretch curve on press, so the whole screen reacts the same way. The
   overshoot in the cubic-bezier is what makes it feel like rubber instead of
   a CSS transition - it goes slightly past and settles back. */
:root {
  --rubber: cubic-bezier(.34, 1.8, .5, 1);
  --bulb-gold: radial-gradient(circle, #fff3b0 0 38%, #f0c84a 39% 62%, transparent 63%);
}

/* Idle breathing, so the screen is never completely still. Paused on press so
   the squash reads cleanly against it. */
@keyframes circus-breathe {
  0%, 100% { transform: scale(1) rotate(0deg); }
  50%      { transform: scale(1.035) rotate(-.5deg); }
}

/* The bulb ring is an EDGE, not a chase. It used to sweep, which pulled the
   eye around the rim instead of to the label inside it - and on a screen with
   three of them the whole thing crawled. */

/* --- the year arrows: fat rubber buttons with a bulb ring ---------------- */
.lv-arrow {
  position: relative;
  transition: transform .16s var(--rubber), filter .12s;
}

.lv-arrow:hover { transform: scale(1.14) rotate(-3deg); }
.lv-arrow:active { transform: scale(.86) rotate(2deg); }

/* --- the era card: rubbery, with bunting and a chasing bulb ring --------- */
.era-card {
  transition: transform .18s var(--rubber), filter .12s;
  animation: circus-breathe 3.4s ease-in-out infinite;
}

.era-card:hover { transform: scale(1.05) rotate(-.6deg); animation-play-state: paused; }
.era-card:active {
  transform: scale(.93) rotate(1deg);
  animation-play-state: paused;
}

/* Little flags strung over the card. Drawn with gradients rather than art so
   they cost nothing and recolour with the theme. */
.era-card::after {
  content: "";
  position: absolute;
  left: 6%;
  right: 6%;
  top: -13px;
  height: 14px;
  pointer-events: none;
  background:
    linear-gradient(135deg, transparent 50%, #ff4f5a 50%) 0 0 / 18px 14px repeat-x,
    linear-gradient(225deg, transparent 50%, #ffd34e 50%) 9px 0 / 18px 14px repeat-x;
  opacity: .9;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .35));
}

.era-card.locked::after { filter: grayscale(1) brightness(.7); opacity: .4; }

/* --- the play button: the loudest thing on the screen -------------------- */
#ov-quickstart {
  animation: circus-breathe 2.6s ease-in-out infinite;
  transition: transform .16s var(--rubber), filter .12s, box-shadow .12s;
}

/* No centring translate to preserve any more - the box centres itself - so
   these are just the press states. */
#ov-quickstart:hover {
  animation-play-state: paused;
  transform: scale(1.07) rotate(-1.5deg);
}

#ov-quickstart:active {
  animation-play-state: paused;
  transform: scale(.9) rotate(1.5deg);
}

/* A ring of bulbs that chases around it, like a fairground sign. */
#ov-quickstart::after {
  content: "";
  position: absolute;
  inset: -11px;
  border-radius: inherit;
  pointer-events: none;
  background-image: var(--bulb-gold), var(--bulb-gold), var(--bulb-gold), var(--bulb-gold);
  background-repeat: repeat-x, repeat-x, repeat-y, repeat-y;
  background-position: top left, bottom left, left top, right top;
  background-size: 14px 14px;
  opacity: .75;
}

/* --- the small pill controls: same rubber, quieter ----------------------- */
.level-back,
.level-reset,
.reset-scope button,
#ov-howto {
  transition: transform .16s var(--rubber), background .14s, color .14s,
              border-color .14s;
}

.level-back:hover,
.level-reset:hover,
#ov-howto:hover { transform: scale(1.07) rotate(-1deg); }

.level-back:active,
.level-reset:active,
.reset-scope button:active,
#ov-howto:active { transform: scale(.9) rotate(1deg); }

/* A sparkle that pops out of a pill when it is pressed. */
.level-back::after,
.level-reset::after,
#ov-howto::after {
  content: "\2726";
  position: absolute;
  top: -6px;
  right: -2px;
  font-size: 13px;
  color: var(--poster-gold);
  opacity: 0;
  transform: scale(.4) rotate(-30deg);
  pointer-events: none;
  transition: opacity .18s, transform .28s var(--rubber);
}

.level-back, .level-reset, #ov-howto { position: relative; }

.level-back:active::after,
.level-reset:active::after,
#ov-howto:active::after {
  opacity: 1;
  transform: scale(1.25) rotate(12deg) translate(3px, -5px);
}

/* --- the level card and GO! --------------------------------------------- */
.lv-card {
  transition: transform .18s var(--rubber), filter .12s;
}

.lv-card:hover { transform: scale(1.06) rotate(-.6deg); }
.lv-card:active { transform: scale(.93) rotate(1deg); }

.lv-go { transition: transform .16s var(--rubber), filter .12s, box-shadow .12s; }
.lv-go:hover { transform: scale(1.07) rotate(-1.5deg); }
.lv-go:active { transform: scale(.9) rotate(1.5deg); }

@media (prefers-reduced-motion: reduce) {
  .era-card,
  #ov-quickstart { animation: none; }
  .lv-arrow, .era-card, .lv-card, .lv-go,
  .level-back, .level-reset, #ov-howto { transition: none; }
}

/* ------------------------------------------------------- GO, with smoke
   Two wisps drifting up off the button, offset in time and size so they never
   pulse together. Behind it in z, so the smoke rises from BEHIND the button
   rather than across its lettering - and pointer-events stay off it, because
   GO is the one thing on this screen that must always be pressable. */
.lv-go::after {
  content: "";
  position: absolute;
  left: 18%;
  bottom: 62%;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.5) 0 40%,
                              rgba(220,235,225,.22) 60%, transparent 72%);
  pointer-events: none;
  z-index: -1;
  animation: go-smoke 2.6s ease-out infinite;
}

.lv-go .lv-go-puff {
  position: absolute;
  right: 20%;
  bottom: 58%;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.42) 0 40%,
                              rgba(220,235,225,.18) 60%, transparent 72%);
  pointer-events: none;
  z-index: -1;
  animation: go-smoke 2.6s ease-out infinite 1.15s;
}

@keyframes go-smoke {
  0%   { opacity: 0;   transform: translate(0, 6px) scale(.5); }
  22%  { opacity: .85; }
  100% { opacity: 0;   transform: translate(-14px, -54px) scale(2.1); }
}

@media (prefers-reduced-motion: reduce) {
  .lv-go::after, .lv-go .lv-go-puff { animation: none; opacity: 0; }
}

/* ============================================ how-to, dressed for the circus
   The card was a dark rounded box with small type - correct, and completely
   anonymous. It is the first thing a new player reads, so it now looks like
   part of the same show as the title screen: a bulb-edged board with big
   poster lettering. */
.howto-card {
  position: relative;
  max-width: min(680px, 94vw);
  padding: clamp(10px, 2.4vh, 20px) clamp(18px, 4vw, 32px);
  border: 3px solid var(--poster-gold);
  border-radius: 20px;
  background:
    radial-gradient(120% 140% at 50% 0%, rgba(120, 16, 24, .96), rgba(46, 6, 12, .97));
  box-shadow:
    0 0 0 4px rgba(120, 12, 18, .8),
    0 12px 26px rgba(0, 0, 0, .5),
    inset 0 2px 0 rgba(255, 236, 180, .3);
}

/* A ring of bulbs, same trick as the play button. */
.howto-card::before {
  content: "";
  position: absolute;
  inset: -12px;
  border-radius: inherit;
  pointer-events: none;
  background-image: var(--bulb-gold), var(--bulb-gold), var(--bulb-gold), var(--bulb-gold);
  background-repeat: repeat-x, repeat-x, repeat-y, repeat-y;
  background-position: top left, bottom left, left top, right top;
  background-size: 15px 15px;
  opacity: .62;
}

.howto-text strong {
  font: 800 clamp(19px, 4.6vh, 32px)/1.05 var(--display);
  letter-spacing: .07em;
  color: #ffe9a8;
  text-shadow: 0 2px 0 #7a1018, 0 0 14px rgba(255, 210, 110, .5);
}

.howto-text span {
  font: 500 clamp(13px, 3vh, 18px)/1.4 var(--poster-body);
  color: #fff6e2;
}

/* The pad gets the same rubber and the same gold as everything else. */
.howto-pad {
  min-width: clamp(56px, 13vh, 88px);
  height: clamp(56px, 13vh, 88px);
  border: 3px solid var(--poster-gold);
  background: linear-gradient(180deg, rgba(255, 236, 180, .22), rgba(0, 0, 0, .28));
  font: 900 clamp(16px, 3.8vh, 25px)/1 var(--display);
  text-shadow: 0 2px 0 rgba(60, 4, 10, .8);
}

#howto .level-back {
  min-height: 48px;
  padding: 12px 28px;
  font: 800 15px/1 var(--display);
  letter-spacing: .1em;
  border-color: var(--poster-gold);
  color: #ffe9a8;
}

.howto-dots { gap: 8px; }

@media (prefers-reduced-motion: reduce) {
}

/* ------------------------------------------------------ dev row on the title
   Two lines: what you can switch, and where you can jump. Deliberately plain
   next to the circus dressing around it - this is a tool, and it should never
   be mistaken for something a player is meant to press. */
#devtitle {
  position: absolute;
  /* Bottom, not top. At the top it sat across the MALTE KNAPP lettering and
     read as a rendering glitch rather than as a toolbar. Down here it is out
     of the poster entirely and still the first thing you see is that it is
     NOT part of the game. */
  bottom: max(4px, env(safe-area-inset-bottom));
  /* left:50% + translateX(-50%) centred it but left it only HALF the viewport
     to lay out in, so 22 buttons wrapped into eleven rows and the panel
     swallowed the title screen. Anchoring both edges and letting the margin
     centre it gives it the full width. */
  left: 0;
  right: 0;
  margin: 0 auto;
  width: fit-content;
  z-index: 7;
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: center;
  padding: 8px 12px;
  border: 2px solid #59d2ff;
  border-radius: 12px;
  /* Opaque and cold blue: nothing else in this game is either, so it cannot
     be mistaken for something a player is meant to press. */
  background: #0a0f18;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, .5), 0 8px 22px rgba(0, 0, 0, .6);
  max-width: 96vw;
}

/* Says what it is, once, at the left of the first line. */
#devtitle::before {
  content: "DEV";
  position: absolute;
  top: -11px;
  left: 12px;
  padding: 1px 8px;
  border-radius: 6px;
  background: #59d2ff;
  color: #05121c;
  font: 900 11px/1.5 ui-monospace, Menlo, Consolas, monospace;
  letter-spacing: .14em;
}

#devtitle[hidden] { display: none; }

.devtitle-line {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  justify-content: center;
}

/* The two that actually do something big. */
#devtitle .dev-btn-loud {
  border-color: #6ef0a8;
  color: #b9ffd8;
  font-weight: 800;
}

/* Level numbers: square and evenly sized, so a row of ten reads as a row of
   ten rather than as ten differently-shaped words. */
#devtitle .dev-btn-lvl {
  min-width: 32px;
  padding: 6px 0;
  text-align: center;
}

/* Readable without being loud - the row is a tool, but a tool you have to be
   able to hit. */
#devtitle .dev-btn {
  min-height: 28px;
  padding: 5px 9px;
  font-size: 11px;
  letter-spacing: .02em;
  white-space: nowrap;
}

#devtitle .dev-btn-loud {
  min-height: 30px;
  padding: 6px 12px;
  font-size: 12px;
  background: rgba(89, 210, 255, .16);
}

#devtitle .dev-sep {
  color: rgba(255, 255, 255, .3);
  padding: 0 2px;
}

/* ======================================= finish / game-over screen buttons
   These were the last plain controls in the game: a flat blue-grey primary
   and a small grey "Title screen" that read as a footnote. They now carry the
   same fairground dressing as the title, with a clear order of loudness -
   the thing you almost always want is the loud one, and going back is a real
   button rather than a link. */

/* --- primary: NEXT / TRY AGAIN / ON TO <year> --------------------------- */
#overlay:not(.title-screen) #ov-start {
  position: relative;
  min-height: 56px;
  padding: 14px clamp(20px, 5vw, 40px);
  border: 3px solid var(--poster-gold);
  border-radius: 999px;
  background: linear-gradient(180deg, #2fd07a 0%, #16a055 100%);
  color: #05270f;
  font: 900 clamp(15px, 2.6vh, 21px)/1 var(--display);
  letter-spacing: .08em;
  text-transform: uppercase;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .35);
  box-shadow:
    0 6px 0 #0c6b39,
    0 12px 24px rgba(0, 0, 0, .48),
    inset 0 2px 0 rgba(255, 255, 255, .4);
  cursor: pointer;
  transition: transform .16s var(--rubber), filter .12s, box-shadow .12s;
}

#overlay:not(.title-screen) #ov-start:hover {
  filter: brightness(1.07);
  transform: scale(1.05) rotate(-1deg);
}

#overlay:not(.title-screen) #ov-start:active {
  transform: translateY(4px) scale(.96);
  box-shadow: 0 2px 0 #0c6b39, 0 6px 12px rgba(0, 0, 0, .45),
              inset 0 2px 0 rgba(255, 255, 255, .4);
}

/* Bulb ring, so the primary action is unmistakably the one to press. */
#overlay:not(.title-screen) #ov-start::after {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: inherit;
  pointer-events: none;
  background-image: var(--bulb-gold), var(--bulb-gold), var(--bulb-gold), var(--bulb-gold);
  background-repeat: repeat-x, repeat-x, repeat-y, repeat-y;
  background-position: top left, bottom left, left top, right top;
  background-size: 13px 13px;
  opacity: .7;
}

/* --- secondary: back to the title --------------------------------------- */
#ov-back {
  position: relative;
  min-height: 46px;
  margin: .8rem auto 0;
  padding: 11px 26px;
  border: 2px solid rgba(255, 226, 150, .55);
  border-radius: 999px;
  background: rgba(46, 8, 14, .72);
  color: #ffe9a8;
  font: 800 13px/1 var(--display);
  letter-spacing: .1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform .16s var(--rubber), background .14s, border-color .14s;
}

#ov-back:hover {
  background: rgba(90, 14, 22, .85);
  border-color: var(--poster-gold);
  transform: scale(1.06) rotate(-1deg);
}

#ov-back:active { transform: scale(.93) rotate(1deg); }

/* --- the skip, between the two in weight --------------------------------- */
#ov-skip {
  min-height: 46px;
  padding: 11px 24px;
  border-width: 2px;
  font: 800 13px/1 var(--display);
  letter-spacing: .08em;
  text-transform: uppercase;
  transition: transform .16s var(--rubber), background .14s;
}

#ov-skip:hover { transform: scale(1.06) rotate(-1deg); }
#ov-skip:active { transform: scale(.93) rotate(1deg); }

@media (prefers-reduced-motion: reduce) {
  #overlay:not(.title-screen) #ov-start,
  #ov-back, #ov-skip { transition: none; }
}

/* ===================================== the remaining buttons, brought in line
   Everything else on screen now wears a gold rim and the same rubber press.
   These three were the last plain rectangles: the in-game TITLE button, the
   two chrome toggles, and the carousel arrows. */

/* --- in-game TITLE, top left -------------------------------------------- */
#btn-title {
  min-height: 44px;
  padding: 10px 16px;
  border: 2px solid rgba(255, 226, 150, .5);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(120, 16, 24, .88), rgba(46, 6, 12, .92));
  color: #ffe9a8;
  font: 800 12px/1 var(--display);
  letter-spacing: .1em;
  box-shadow: 0 3px 0 rgba(60, 4, 10, .8), 0 6px 14px rgba(0, 0, 0, .35);
  transition: transform .16s var(--rubber), border-color .14s, filter .12s;
}

#btn-title:hover {
  border-color: var(--poster-gold);
  transform: scale(1.06) rotate(-1.5deg);
}

#btn-title:active {
  transform: translateY(3px) scale(.94);
  box-shadow: 0 1px 0 rgba(60, 4, 10, .8);
}

/* --- sound and fullscreen ------------------------------------------------ */
#btn-sound,
#btn-fullscreen {
  border: 2px solid rgba(255, 226, 150, .45);
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(120, 16, 24, .85), rgba(46, 6, 12, .9));
  color: #ffe9a8;
  box-shadow: 0 3px 0 rgba(60, 4, 10, .75), 0 6px 14px rgba(0, 0, 0, .32);
  transition: transform .16s var(--rubber), border-color .14s;
}

#btn-sound:hover,
#btn-fullscreen:hover {
  border-color: var(--poster-gold);
  transform: scale(1.12) rotate(-4deg);
}

#btn-sound:active,
#btn-fullscreen:active {
  transform: translateY(2px) scale(.9);
  box-shadow: 0 1px 0 rgba(60, 4, 10, .75);
}

/* --- carousel arrows: round fairground knobs ---------------------------- */
.lv-arrow {
  min-width: 52px;
  min-height: 52px;
  border: 3px solid var(--poster-gold);
  border-radius: 50%;
  background: radial-gradient(circle at 36% 28%, rgba(255, 236, 180, .35), transparent 42%),
              linear-gradient(180deg, #a4141f, #5d0a12);
  color: #ffe9a8;
  font-size: 20px;
  line-height: 1;
  box-shadow: 0 4px 0 rgba(50, 4, 10, .85), 0 8px 16px rgba(0, 0, 0, .38),
              inset 0 2px 0 rgba(255, 236, 180, .3);
}

.lv-arrow:active {
  box-shadow: 0 1px 0 rgba(50, 4, 10, .85), 0 4px 8px rgba(0, 0, 0, .38);
}

.lv-arrow:disabled {
  filter: grayscale(.8) brightness(.6);
  box-shadow: none;
  cursor: default;
}

/* --- the "Years" back link on the level screen -------------------------- */
#ov-eras {
  border-color: rgba(255, 226, 150, .5);
  color: #ffe9a8;
}


/* ============================================ showbill type on the big words
   Circus posters are set in fat slab serifs, not in Arial Black. Applied only
   where the type is large enough to carry the serifs - the pads, the HUD and
   the dev row keep --display. */
.era-year-big,
.lv-num,
.lv-word,
.qs-word,
.howto-text strong,
#overlay:not(.title-screen) h1 {
  font-family: var(--showbill);
}

/* Button labels: showbill, with the letterspacing a poster gives them. */
#overlay:not(.title-screen) #ov-start,
#ov-back,
#ov-skip,
.lv-go,
.level-back,
.level-reset,
.reset-scope button,
#btn-title,
#ov-eras,
#ov-howto {
  font-family: var(--showbill);
  font-weight: 700;
  letter-spacing: .11em;
}

/* The era year is the biggest word on the screen, so it gets the full poster
   treatment: a gold face over a dark cut, the way lettering is printed. */
.era-year-big {
  letter-spacing: .03em;
  text-shadow:
    0 2px 0 #7a1018,
    0 4px 0 rgba(40, 2, 8, .55),
    0 0 18px rgba(255, 208, 110, .35);
}

.lv-num {
  letter-spacing: .02em;
  text-shadow: 0 3px 0 rgba(20, 40, 26, .6), 0 0 16px rgba(120, 255, 180, .3);
}

/* The finish/game-over heading, previously plain white sans. */
#overlay:not(.title-screen) h1 {
  letter-spacing: .07em;
  color: #ffe9a8;
  text-shadow: 0 3px 0 #7a1018, 0 0 20px rgba(255, 210, 110, .45);
}

/* ============================== how to play / reset / years, same fairground
   These were still pale outlines on a dark fill while everything around them
   had been dressed. They now share the exact recipe used by the in-game TITLE
   button and the game-over back button: a red booth face, a gold rim, a solid
   drop that collapses on press. Loudness is set by SIZE and rim opacity, not
   by giving one of them a different language of its own. */
#ov-howto,
.level-back,
.level-reset,
#ov-eras {
  min-height: 46px;
  padding: 12px 24px;
  border: 2px solid rgba(255, 226, 150, .5);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(120, 16, 24, .9), rgba(46, 6, 12, .94));
  color: #ffe9a8;
  font-size: 13px;
  text-transform: uppercase;
  box-shadow: 0 4px 0 rgba(50, 4, 10, .8), 0 7px 15px rgba(0, 0, 0, .34);
  cursor: pointer;
}

#ov-howto:hover,
.level-back:hover,
.level-reset:hover,
#ov-eras:hover {
  border-color: var(--poster-gold);
  filter: brightness(1.12);
}

#ov-howto:active,
.level-back:active,
.level-reset:active,
#ov-eras:active {
  transform: translateY(3px) scale(.96);
  box-shadow: 0 1px 0 rgba(50, 4, 10, .8), 0 3px 7px rgba(0, 0, 0, .34);
}

/* HOW TO PLAY is the one a new player needs, so it is the widest of them. */
#ov-howto {
  padding: 13px 32px;
  border-color: rgba(255, 226, 150, .72);
  font-size: 14px;
}

/* Reset stays the quietest until it is armed - see .level-reset.armed, which
   overrides the face below with the warning red. */
.level-reset {
  border-color: rgba(255, 255, 255, .24);
  color: rgba(255, 236, 200, .7);
  background: linear-gradient(180deg, rgba(60, 12, 18, .85), rgba(28, 4, 8, .9));
  box-shadow: 0 3px 0 rgba(30, 2, 6, .8);
}

.level-reset.armed {
  border-color: #ff6b74;
  background: linear-gradient(180deg, rgba(180, 40, 48, .95), rgba(96, 10, 18, .95));
  color: #fff0f1;
  box-shadow: 0 4px 0 #6b0a12, 0 8px 18px rgba(255, 60, 70, .3);
}

/* The Year / All switch: one booth split in two, gold on the chosen half. */
.reset-scope {
  border: 2px solid rgba(255, 226, 150, .5);
  background: linear-gradient(180deg, rgba(60, 12, 18, .85), rgba(28, 4, 8, .9));
  box-shadow: 0 4px 0 rgba(50, 4, 10, .8);
}

.reset-scope button {
  min-height: 42px;
  padding: 10px 20px;
  font-size: 13px;
  text-transform: uppercase;
  color: rgba(255, 236, 200, .62);
}

.reset-scope button.on {
  background: linear-gradient(180deg, #ffe07a, #e8b53c);
  color: #3a1606;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .4);
}

/* ================================================ phone-first button sizing
   Everything above was written at 12-14px, which is fine on a desktop and too
   small on the device this is actually played on. One pass, all of it: never
   below 14px, bold, and clamped so it grows on a big screen instead of
   stranding at a fixed pixel size. Heights go with it, so every target stays
   comfortably past the 44px minimum. */
#ov-howto,
.level-back,
.level-reset,
#ov-eras,
#ov-back,
#ov-skip,
#btn-title {
  min-height: 52px;
  font-size: clamp(15px, 3.6vh, 19px);
  font-weight: 800;
  padding-left: clamp(20px, 5vw, 32px);
  padding-right: clamp(20px, 5vw, 32px);
}

#ov-howto {
  min-height: 56px;
  font-size: clamp(16px, 4vh, 21px);
}

.reset-scope button {
  min-height: 50px;
  font-size: clamp(14px, 3.4vh, 18px);
  font-weight: 800;
  padding: 12px clamp(18px, 4.5vw, 26px);
}

/* The primary action is the biggest word on the screen after the heading. */
#overlay:not(.title-screen) #ov-start {
  min-height: 62px;
  font-size: clamp(17px, 4.2vh, 24px);
}

/* The quick-start's second line said where it goes in 8px type. */
.qs-where { font-size: clamp(10px, 2.2vh, 13px); font-weight: 700; }
.qs-word { font-size: clamp(17px, 4.4vh, 26px); }

/* Level-screen heading and the year label above the card. */
.era-label { font-weight: 800; }

/* Touch pad captions: these sit under a thumb mid-run and were 9-11px. */
.pad-label { font-size: clamp(10px, 2.2vh, 13px); font-weight: 900; }

/* ==================================== landscape phone: fit, without shrinking
   The bigger type above is right for a thumb and wrong for 375px of height if
   everything keeps stacking. So on a short landscape screen the controls go
   side by side instead of in a column, and the badge gets out of their way -
   the text itself stays big, which was the point. */
@media (orientation: landscape) and (max-height: 560px) {
  /* One row: how-to, then the reset group.
     `:not([hidden])` is not decoration. A bare `.title-screen .era-pick` sets
     `display` from two classes, which ties with `.era-pick[hidden]` and wins
     on source order - so on exactly this shape, the landscape phone, the year
     buttons stayed on screen after the level step had hidden them. */
  .title-screen .era-pick:not([hidden]) {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .3rem;
  }

  .title-screen .reset-row {
    margin-top: .25rem;
    gap: 8px;
  }

  #ov-howto,
  .level-back,
  .level-reset,
  #ov-eras,
  .reset-scope button {
    min-height: 44px;
    padding-top: 9px;
    padding-bottom: 9px;
    padding-left: clamp(14px, 3vw, 22px);
    padding-right: clamp(14px, 3vw, 22px);
    font-size: clamp(13px, 3.4vh, 16px);
  }

  #ov-howto { min-height: 46px; font-size: clamp(14px, 3.8vh, 17px); }

  /* The badge is decoration: it yields to the controls rather than sitting on
     top of them. Pinned to the left edge, sized off the height it actually
     has, and pushed behind everything. */
  /* On a landscape PHONE the wreath and the controls want the same band, and
     the controls win: it shrinks to something that clears a centred row and
     hugs the left edge. Measured at 844x390 the centred row runs 253..644,
     so the wreath has to end before ~250. */
  .title-screen .title-badge {
    height: min(34vh, 9rem);
    max-width: 15vw;
    left: max(calc(var(--star-band) + 6px), calc(env(safe-area-inset-left) + 6px));
    opacity: .9;
    z-index: 0;
  }

  /* The year card is CENTRED, not nudged aside. `margin-left: 8vw` used to
     shove it clear of the wreath, which tilted the whole screen right - the
     card, the how-to button and the reset row all sat off-centre together. */
  .title-screen .era-row { margin-left: auto; margin-right: auto; }

  /* And the play button clear of the right star band. */
  #ov-quickstart {
    min-width: clamp(4.8rem, 17vw, 7rem);
    min-height: clamp(3rem, 11vh, 4.2rem);
  }
}

/* The dev row sits at the bottom of the title, so the title's own controls
   need to get out from under it. :has() rather than a class toggled in JS,
   because the row's own [hidden] attribute is already the single source of
   truth for whether it is there. */
#overlay.title-screen:has(#devtitle:not([hidden])) .panel {
  padding-bottom: 8.5rem;
}

@media (orientation: landscape) and (max-height: 560px) {
  #overlay.title-screen:has(#devtitle:not([hidden])) .panel {
    padding-bottom: 7rem;
  }
}


/* ================================ finish / game-over: a column that holds still
   All three buttons share one width and one centre line, so swapping a label
   moves nothing. Stacked in order of how often they are wanted: the primary
   action, then the skip if it is offered, then the way back. */
#overlay:not(.title-screen) #ov-start,
#ov-skip,
#ov-back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 17rem;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
  /* Long labels wrap rather than widening the button. */
  white-space: normal;
  line-height: 1.15;
}

#overlay:not(.title-screen) #ov-start { min-height: 62px; }
#ov-skip, #ov-back { min-height: 50px; }

/* Even spacing down the column, whichever of them are showing. */
#overlay:not(.title-screen) #ov-skip { margin-top: .55rem; }
#overlay:not(.title-screen) #ov-back { margin-top: .55rem; }

/* Portrait and desktop keep the buttons under the board rather than beside
   it, so they centre on the panel instead of on a column. */
@media not all and (orientation: landscape) and (max-height: 560px) {
  #overlay:not(.title-screen) #ov-start,
  #ov-skip,
  #ov-back { max-width: 20rem; }
}

/* ============================ finish / game-over: group the actions, breathe
   Two things were wrong on a phone. The heading sat hard against the top edge
   and ran under the sound and fullscreen controls, and the three buttons were
   spread down the right column because the grid rows stretched to match the
   scoreboard beside them - so "play again" and "title screen" ended up at
   opposite corners instead of under the thumb together. */
@media (orientation: landscape) and (max-height: 560px) {
  #overlay:not(.title-screen) .panel {
    /* Clear of the chrome buttons, which are fixed at the top right. */
    padding-top: max(1rem, calc(env(safe-area-inset-top) + .6rem));
    padding-right: max(3.6rem, calc(env(safe-area-inset-right) + 3.2rem));
    row-gap: .3rem;
  }

  /* The heading is the one thing allowed to use the full width. */
  #overlay:not(.title-screen) #ov-title {
    margin: 0 0 .2rem;
    padding-right: 0;
  }
}


/* One stack for the three actions, so they sit together under the thumb and a
   label change cannot move any of them. */
.ov-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .55rem;
  width: 100%;
}

.title-screen .ov-actions { display: contents; }

.ov-actions > button[hidden] { display: none; }

#overlay:not(.title-screen) #ov-start,
#ov-skip,
#ov-back { margin-top: 0; }

/* Hidden means hidden. The display:flex given to these buttons above outranks
   the browser's own [hidden] rule (an id beats an attribute selector), so the
   skip button kept occupying a slot in the stack while invisible - which is
   what was still pushing "title screen" away from "play again". */
#ov-start[hidden],
#ov-skip[hidden],
#ov-back[hidden] { display: none !important; }

/* One spacing rule for the stack, from the flex gap, not from per-button
   margins that then have to be undone. */
#overlay:not(.title-screen) #ov-start,
#overlay:not(.title-screen) #ov-skip,
#overlay:not(.title-screen) #ov-back {
  margin: 0;
  width: 100%;
}

/* The primary button used to be pinned `position: fixed; right: 16px;
   top: 50%; transform: translateY(-50%)` - anchored to the middle of the
   VIEWPORT rather than to the panel. That is why it appeared to jump: it moved
   with the viewport and with its own changing label, and it could never line
   up with the other two. It is a normal item in the action stack now, so the
   leftover offsets have to go with it. */
#overlay:not(.title-screen) #ov-start,
#overlay:not(.title-screen) #ov-start:active {
  position: relative;
  top: auto;
  right: auto;
  bottom: auto;
  left: auto;
  transform: none;
}

#overlay:not(.title-screen) #ov-start:hover {
  transform: scale(1.04) rotate(-1deg);
}

#overlay:not(.title-screen) #ov-start:active {
  transform: translateY(3px) scale(.97);
}

/* A FIXED height, not just a minimum. "Vidare till 2027" wraps to two lines
   where "Try again" does not, and a growing button pushed the one below it
   down - the last way a label change could still move something. The box stays
   the same size and the text centres inside it, wrapped or not. */
#overlay:not(.title-screen) #ov-start { height: 62px; min-height: 62px; }
#overlay:not(.title-screen) #ov-skip,
#overlay:not(.title-screen) #ov-back { height: 50px; min-height: 50px; }

/* The box is a fixed width, so generous side padding only steals room from
   the label - and the longest one ("Nästa: Bana 10") was wrapping with the
   number alone on the second line. Tighter padding and spacing keep every
   label on one line without changing the button's size. */
#overlay:not(.title-screen) #ov-start {
  padding-left: 12px;
  padding-right: 12px;
  letter-spacing: .04em;
  white-space: nowrap;
}

/* Measured, not guessed: at 17px with .04em the longest label ("Nästa: Bana
   10") rendered 222px into a 212px box and clipped. 16px with .02em brings it
   under, and the clamp still grows it on a wider screen. */
#overlay:not(.title-screen) #ov-start {
  font-size: clamp(16px, 4vh, 24px);
  letter-spacing: .02em;
}


/* ================================ the two actions, side by side across the foot
   Title screen on the LEFT, the next level on the RIGHT - the way out on the
   hand you are not about to press with, and the thing you almost always want
   under the thumb that is already there.

   row-reverse rather than reordering the DOM: the markup keeps the primary
   action first, which is what a screen reader and a keyboard tab should meet
   first, while the layout puts it at the right-hand end. */
#overlay:not(.title-screen) .ov-actions {
  flex-direction: row-reverse;
  justify-content: space-between;
  align-items: center;
  gap: .6rem;
  width: 100%;
  max-width: 34rem;
  margin: 0 auto;
}

/* Sized to their content now they sit beside each other, not stretched. */
#overlay:not(.title-screen) #ov-start {
  width: auto;
  min-width: clamp(9rem, 30vw, 13rem);
  max-width: none;
}

#overlay:not(.title-screen) #ov-back,
#overlay:not(.title-screen) #ov-skip {
  width: auto;
  min-width: clamp(8rem, 26vw, 11rem);
  max-width: none;
}

/* The skip belongs with the primary action, not with the way out, so it sits
   between them rather than at either end. */
#overlay:not(.title-screen) #ov-skip { margin: 0 auto; }

/* ==================== short landscape: make the foot row fit above the edge
   With the actions moved to a full-width row the panel became a three-deck
   stack, and on a 360px-tall phone the buttons fell off the bottom (measured:
   371px of content in 360px of screen). The scoreboard is not the fat part -
   the three big lines above it were 124px on their own, repeating a distance
   the board already itemises. They tighten; the board and the buttons do not,
   because those are what you actually read and press. */
@media (orientation: landscape) and (max-height: 560px) {
  #overlay:not(.title-screen) .panel {
    padding-top: max(.5rem, env(safe-area-inset-top));
    padding-bottom: max(.5rem, env(safe-area-inset-bottom));
    row-gap: .2rem;
  }

  #overlay:not(.title-screen) #ov-title {
    font-size: clamp(.95rem, 3.2vh, 1.25rem);
    margin: 0;
  }

  #overlay:not(.title-screen) #ov-body {
    font-size: .78rem;
    line-height: 1.15;
  }

  /* The metre count and the year are already in the board below; up here they
     only have to caption it. */
  #overlay:not(.title-screen) #ov-body b { font-size: .95rem; }

  #overlay:not(.title-screen) .scoreboard {
    margin-top: .25rem;
    padding: 5px 9px;
    font-size: 9.5px;
    line-height: 1.3;
  }

  #overlay:not(.title-screen) .ov-actions { margin-top: .15rem; }
}

/* ============================================ round actions: TITLE and AGAIN
   Circles, so the two read as fairground buttons rather than as web pills -
   which is only possible because the labels are now one word. Equal diameter
   for all three, so the row stays symmetrical whichever of them is showing,
   and the size is driven by the short viewport axis rather than a fixed px. */
#overlay:not(.title-screen) .ov-actions {
  --act: clamp(76px, 21vh, 116px);
}

#overlay:not(.title-screen) #ov-start,
#overlay:not(.title-screen) #ov-skip,
#overlay:not(.title-screen) #ov-back {
  width: var(--act);
  min-width: var(--act);
  max-width: var(--act);
  height: var(--act);
  min-height: var(--act);
  padding: 6px;
  border-radius: 50%;
  /* One word, centred, allowed to wrap rather than spill out of the circle. */
  white-space: normal;
  word-break: break-word;
  letter-spacing: .04em;
  font-size: clamp(13px, 3.4vh, 19px);
  line-height: 1.05;
}

/* The primary keeps its extra weight through colour and the bulb ring, not
   through being a different shape. */
#overlay:not(.title-screen) #ov-start {
  --act: clamp(86px, 24vh, 132px);
  font-size: clamp(14px, 3.8vh, 22px);
}

#overlay:not(.title-screen) #ov-start::after { inset: -8px; }

/* Round means the press has to stay round too. */
#overlay:not(.title-screen) #ov-start:active,
#ov-skip:active,
#ov-back:active { transform: translateY(3px) scale(.94); }


/* ================================== the actions live in the bottom corners
   Where the thumbs already are. Holding a phone in landscape puts them at the
   bottom-left and bottom-right - the same pivots the GO and JUMP pads are
   arranged around - so the two buttons go there rather than into a centred
   row the thumbs have to travel to.

   Taken OUT of the panel's grid: as a row in the stack they cost the
   scoreboard a whole deck of height on a 360px screen, and they do not need
   it. Anchored to the overlay, which is the element that actually spans the
   viewport. */
#overlay:not(.title-screen) .ov-actions {
  position: absolute;
  left: max(12px, env(safe-area-inset-left));
  right: max(12px, env(safe-area-inset-right));
  /* Lifted off the very edge: a thumb curls to a button sitting a little way
     up from the corner far more comfortably than to one jammed against it,
     and it keeps them clear of a phone's home indicator. */
  bottom: max(34px, calc(env(safe-area-inset-bottom) + 26px));
  width: auto;
  max-width: none;
  margin: 0;
  /* row-reverse keeps the primary action first in the DOM while putting it at
     the right-hand end; space-between pins the pair to the two corners. */
  flex-direction: row-reverse;
  justify-content: space-between;
  align-items: flex-end;
  pointer-events: none;   /* the strip is only a ruler; the buttons are live */
  z-index: 6;
}

#overlay:not(.title-screen) .ov-actions > button { pointer-events: auto; }

/* The skip sits between them, clear of both thumbs, because it is the one you
   should have to reach for. */
#overlay:not(.title-screen) #ov-skip { align-self: center; }

/* The panel now ends above them, so its content never runs underneath. */
#overlay:not(.title-screen) .panel {
  padding-bottom: clamp(118px, 30vh, 168px);
}

/* With the actions lifted off the edge the panel's content no longer fits its
   centred box, and centring pushed the heading off the TOP of the screen
   (measured: title at y -12). Start-aligned instead, so any overflow goes
   downward into the padding that is already reserved for the buttons rather
   than upward past the edge. */
@media (orientation: landscape) and (max-height: 560px) {
  #overlay:not(.title-screen) .panel {
    align-content: start;
    padding-bottom: clamp(100px, 27vh, 140px);
  }
}

/* ============================================ in-game TITLE: small and clear
   This one sits ON the running game, so it is the opposite case to every
   other button: it must be findable and otherwise invisible. No fill, no rim,
   no drop - just small type with enough shadow to stay legible over whatever
   scrolls past underneath.

   The PADDING stays generous even though the text is small: the visible label
   is 12px, the thing you can actually hit is still over 44px tall. Those are
   different problems and only one of them is about looks. */
#btn-title {
  min-width: 0;
  min-height: 0;
  /* 12px of type in 16px of padding is a 44px target - the visible label is
     small, the thing a thumb has to find is not. */
  padding: 16px 18px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  box-shadow: none;
  color: rgba(255, 240, 210, .8);
  font: 800 12px/1 var(--display);
  letter-spacing: .14em;
  text-transform: uppercase;
  /* Two shadows: a hard dark edge for contrast on light backdrops, a soft one
     so it does not disappear against a busy sprite. */
  text-shadow: 0 2px 0 rgba(20, 2, 6, .85), 0 0 8px rgba(0, 0, 0, .6);
  transition: color .12s, transform .12s var(--rubber);
}

#btn-title:hover {
  color: #fff;
  background: transparent;
  transform: scale(1.06);
}

#btn-title:active {
  color: var(--poster-gold);
  transform: scale(.94);
  box-shadow: none;
}


/* ================================ dev bar on a short screen: the tool wins
   Title, year card, how-to and reset come to 249px, and the dev bar wants
   another 159 - on a 360px phone that does not fit however it is arranged.
   The how-to is a demo you would not be watching while testing, so it is the
   one that yields; the reset stays, because wiping progress is exactly the
   kind of thing you do from here. */
@media (orientation: landscape) and (max-height: 560px) {
  #overlay.title-screen:has(#devtitle:not([hidden])) #ov-howto { display: none; }

  #overlay.title-screen:has(#devtitle:not([hidden])) .panel {
    padding-bottom: 9.5rem;
  }

  /* Tighter still: two lines rather than three at this width. */
  #devtitle { gap: 3px; padding: 6px 9px; }
  #devtitle .devtitle-line { gap: 3px; }
  #devtitle .dev-btn { min-height: 26px; padding: 4px 7px; font-size: 10.5px; }
  #devtitle .dev-btn-loud { min-height: 28px; padding: 5px 10px; font-size: 11.5px; }
  #devtitle .dev-btn-lvl { min-width: 26px; }
}

/* The lettering is 109px of poster above the year card. On a short screen with
   the dev bar up that is 109px spent on decoration while the reset row is
   still hidden behind the tool, so in dev - and only in dev - the poster type
   gives way to the controls. */
@media (orientation: landscape) and (max-height: 560px) {
  #overlay.title-screen:has(#devtitle:not([hidden])) h1 .title-big {
    font-size: clamp(1.1rem, 5vh, 1.8rem);
  }

  #overlay.title-screen:has(#devtitle:not([hidden])) h1 .title-role {
    font-size: .58rem;
  }

  #overlay.title-screen:has(#devtitle:not([hidden])) .era-label {
    font-size: .7rem;
    margin-bottom: .15rem;
  }

  #overlay.title-screen:has(#devtitle:not([hidden])) .panel {
    gap: .15rem;
    padding-top: .35rem;
  }

  /* The couple and the wreath are the other half of the poster; they can sit
     this one out too. */
  #overlay.title-screen:has(#devtitle:not([hidden])) ~ .title-badge,
  .title-screen:has(#devtitle:not([hidden])) .title-badge { opacity: .35; }
}

/* Last 17px: the year card is 91px of that stack, and the number inside it is
   sized for a poster. In dev on a short screen it only has to be readable. */
@media (orientation: landscape) and (max-height: 560px) {
  #overlay.title-screen:has(#devtitle:not([hidden])) .era-year-big {
    font-size: clamp(1.5rem, 8vh, 2.4rem);
  }

  #overlay.title-screen:has(#devtitle:not([hidden])) .era-card {
    padding-top: 2px;
    padding-bottom: 2px;
  }

  #overlay.title-screen:has(#devtitle:not([hidden])) .era-place,
  #overlay.title-screen:has(#devtitle:not([hidden])) .era-billing {
    font-size: .55rem;
  }
}

/* ================================== builder: which level, and is it saved
   The two questions the builder never answered. Big enough and coloured
   strongly enough to be read at a glance from across the panel, because the
   whole point is that you should not have to go looking for it. */
.dev-editing {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  padding: 4px 12px;
  border: 2px solid currentColor;
  border-radius: 999px;
  font: 800 11.5px/1 ui-monospace, Menlo, Consolas, monospace;
  letter-spacing: .06em;
  white-space: nowrap;
}

/* Green: on disk exactly as you see it. */
.dev-editing.is-clean { color: #6ef0a8; background: rgba(110, 240, 168, .12); }

/* Amber and pulsing: there are edits that a reload would lose. The pulse is
   the point - a static warning is one you stop seeing. */
.dev-editing.is-dirty {
  color: #ffc44d;
  background: rgba(255, 196, 77, .16);
  animation: dev-dirty 1.4s ease-in-out infinite;
}

/* Never saved under any name at all. */
.dev-editing.is-new { color: #8fb6d8; background: rgba(143, 182, 216, .12); }

@keyframes dev-dirty {
  50% { background: rgba(255, 196, 77, .34); }
}

@media (prefers-reduced-motion: reduce) {
  .dev-editing.is-dirty { animation: none; }
}

/* The status badge is pinned to the top of the panel rather than left in the
   SAVES row. On a short screen that row falls off the bottom - the panel is
   taller than the viewport - so the one thing you need at a glance was the
   one thing you had to scroll to find. */
#devpanel { position: relative; }

#devpanel .dev-editing {
  position: absolute;
  top: 6px;
  right: 10px;
  z-index: 2;
  min-height: 30px;
  padding: 6px 14px;
  font-size: 12.5px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, .5);
}

/* The mini header sits left of it, so they never collide. */
#devpanel .dev-mini { margin-right: 12rem; }

/* Reserve a strip for the pinned badge instead of letting it sit on top of
   the palette. A right-padding on the first row would depend on the level
   name's length; a top strip does not. */
#devpanel { padding-top: 44px; }
#devpanel .dev-editing { top: 8px; right: 12px; }
#devpanel .dev-mini { margin-right: 0; }

/* ---- end-of-career slideshow -------------------------------------------- */
/* Above the overlay: this REPLACES the screen rather than decorating it, and
   it is the last thing the game shows before the title. */
#slideshow[hidden] { display: none; }

#slideshow {
  position: fixed;
  inset: 0;
  z-index: 90;
  overflow: hidden;
  background: #07040a;
  opacity: 0;
  transition: opacity .5s ease;
}

#slideshow.on { opacity: 1; }

/* The panes sit side by side and share the width. `data-panes` is set by the
   slideshow itself, because whether two portrait pictures fit is a question
   about the viewport, not about the art. */
#slideshow { display: flex; gap: 4px; }

.slide-pane {
  position: relative;
  flex: 1 1 0;
  height: 100%;
  overflow: hidden;
}

/* The divider: the 4px gap above shows the black behind, and a thin gold rule
   down each inner edge stops three pictures reading as one wide one. */
.slide-pane + .slide-pane { box-shadow: inset 1px 0 0 rgba(240, 200, 74, .38); }
.slide-pane { box-shadow: inset -1px 0 0 rgba(240, 200, 74, .38); }
.slide-pane:last-child { box-shadow: none; }
.slide-pane + .slide-pane:last-child {
  box-shadow: inset 1px 0 0 rgba(240, 200, 74, .38);
}

/* Portrait keeps a single picture: a third of a 390px-wide screen is 130px,
   which is no way to show a 1200px-tall drawing. */
#slideshow[data-panes="1"] .slide-pane + .slide-pane { display: none; }
#slideshow[data-panes="1"] { gap: 0; }
#slideshow[data-panes="1"] .slide-pane { box-shadow: none; }

/* Layers fill their pane and are cropped to it - `cover` is what lets a
   1086x1448 portrait picture sit in a half-width frame without letterboxing.
   The transform on top is the Ken Burns move; `will-change` keeps each layer
   on its own compositor surface so the pan never repaints the page. */
.slide-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  will-change: transform, opacity;
  /* No smoothing on the way up: this is pixel art, and a blurred edge is
     exactly what it must not have. */
  image-rendering: pixelated;
}

.slide-hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: max(.7rem, env(safe-area-inset-bottom));
  margin: 0;
  text-align: center;
  color: rgba(255, 243, 196, .62);
  font: 700 clamp(10px, 2.6vw, 13px)/1.3 var(--display);
  letter-spacing: .08em;
  text-shadow: 0 2px 6px rgba(0, 0, 0, .9);
  pointer-events: none;
  animation: slide-hint-out 1s ease 5s forwards;
}

/* It has done its job after a few seconds; the pictures are the point. */
@keyframes slide-hint-out { to { opacity: 0; } }

/* ---- centring, and what was breaking it --------------------------------- */
/* THE PANEL'S SCROLLBAR WAS OFF-CENTRING EVERY BUTTON.
   .panel is overflow-y:auto so its controls can always be reached, and its
   content ran 12px past its height on a landscape phone - enough to show a
   classic 15px scrollbar. That scrollbar comes out of the content box on the
   RIGHT ONLY, so every centred child sat 7.5px left of the real middle: the
   title, the year card, HOW TO PLAY and the reset row all leaned together.
   Hiding the scrollbar does not stop it scrolling - wheel, drag and touch all
   still work - it just stops it stealing width from one side. */
.panel { scrollbar-width: none; }
.panel::-webkit-scrollbar { width: 0; height: 0; }

@media (orientation: landscape) and (max-height: 560px) {
  /* The couple's shadow is stretched to twice their height. On a 390px-tall
     screen that puts its far end at y=756 - almost entirely off screen, while
     still forcing the overlay to be scrollable. It buys nothing here. */
  .title-screen .poster-shade { display: none; }

  /* The couple become BACKDROP on this shape. Measured at 844x390 the space
     either side of the centred controls is 68px and 92px, and they are 296px
     wide - so there is nowhere for them to stand. Behind the year card at
     full strength their heads and arms poke out around it and read as
     clutter; at this weight they read as part of the poster, which is what
     they are. They keep their full presence in portrait and on desktop. */
  .title-screen .poster-pair {
    opacity: .34;
    filter: saturate(.85);
  }
}

/* ---- the hidden cheats -------------------------------------------------- */
/* Nine taps on the 40-year wreath. The wreath is decoration and was
   pointer-events:none, so it could not be tapped at all - it takes taps now
   but keeps the ordinary cursor, because it is still not a button. */
.title-screen .title-badge { pointer-events: auto; cursor: default; }

#cheats[hidden] { display: none; }

/* ON TOP OF THE WREATH - the thing you tapped nine times to get here, so the
   panel appears where you were already looking. Its left/top are set from JS
   against the wreath's measured box (see placeCheatPanel), because the wreath
   itself moves with the viewport; the values here are only a sane fallback
   for the frame before that runs. */
#cheats {
  position: fixed;
  left: max(.4rem, calc(env(safe-area-inset-left) + .2rem));
  top: 40%;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 5px 8px 6px;
  border: 2px solid var(--poster-gold);
  border-radius: 12px;
  background: rgba(28, 6, 10, .88);
  box-shadow: 0 8px 22px rgba(0, 0, 0, .5);
}

/* THE LEVEL SCREEN'S CONTROLS SIT ABOVE THE PANEL.
   The cheats stay reachable on the level step - "unlock all levels" is
   exactly what you want to reach while looking at the level picker - but
   nothing there may end up underneath them. The panel is z-index 40, so the
   level screen takes 45 and its back button, GO and arrows are always on top
   whatever the viewport does to the layout.
   (A previous attempt used `.picking-level ~ #cheats`, which matched nothing:
   #cheats is a CHILD of #overlay, not a sibling of it.) */
.level-screen {
  position: relative;
  z-index: 45;
}

.cheat-head {
  margin: 0;
  color: var(--poster-gold);
  font: 800 8px/1.2 var(--display);
  letter-spacing: .18em;
  text-transform: uppercase;
}

.cheat-row {
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  /* Still a real thumb target; the row is wider than it is tall, so the whole
     strip is tappable rather than just the switch. */
  min-height: 28px;
}

.cheat-row input { position: absolute; opacity: 0; pointer-events: none; }

/* The switch itself: a track with a knob that slides. */
.cheat-switch {
  position: relative;
  flex: 0 0 auto;
  width: 32px;
  height: 18px;
  border: 2px solid var(--poster-gold);
  border-radius: 999px;
  background: rgba(0, 0, 0, .55);
  transition: background .15s;
}

.cheat-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--poster-gold);
  transition: transform .15s;
}

.cheat-row input:checked + .cheat-switch { background: #2fd07a; }
.cheat-row input:checked + .cheat-switch::after { transform: translateX(14px); }
.cheat-row input:focus-visible + .cheat-switch { outline: 2px solid #fff; outline-offset: 2px; }

.cheat-label {
  color: var(--poster-cream);
  font: 700 clamp(9px, 2vw, 11px)/1.2 var(--display);
  white-space: nowrap;
}

/* ---- level select, under START ------------------------------------------ */
/* The quiet sibling of START: same column, same right edge, one step down.
   START is the loud green promise ("carry on where you were"); this is the
   ghost version ("show me this year"), so it borrows the poster's gold rim
   without the green. Positioned from JS - see placeLevelsButton. */
#ov-levelselect[hidden] { display: none; }

#ov-levelselect {
  position: fixed;
  right: max(.9rem, calc(env(safe-area-inset-right) + .5rem));
  z-index: 4;
  min-width: clamp(5.4rem, 20vw, 8.5rem);
  min-height: clamp(2rem, 7vh, 2.8rem);
  padding: clamp(.3rem, 1vh, .5rem) clamp(.5rem, 2vw, .9rem);
  border: 2px solid var(--poster-gold);
  border-radius: 999px;
  background: rgba(28, 6, 10, .82);
  color: var(--poster-cream);
  font: 800 clamp(9px, 2.2vw, 12px)/1.1 var(--display);
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(0, 0, 0, .45), 0 6px 16px rgba(0, 0, 0, .4);
  transition: filter .12s, transform .1s;
}

#ov-levelselect:hover { filter: brightness(1.15); }
#ov-levelselect:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(0, 0, 0, .45); }

/* A locked year has no level list to show. */
#ov-levelselect:disabled {
  filter: grayscale(1) brightness(.6);
  cursor: default;
  box-shadow: none;
}

/* Same rule as START: it belongs to the year screen only. */
#overlay:not(.title-screen) #ov-levelselect,
.title-screen.picking-level #ov-levelselect { display: none; }

/* iPhone Safari has a moving visual viewport when its browser bars collapse.
   Renderer already fits the canvas to that box; these overrides put the game
   controls in the identical box. Other browsers never receive this class. */
.iphone-safari #touch {
  inset: auto;
  left: var(--vv-left, 0px);
  top: var(--vv-top, 0px);
  width: var(--vv-width, 100vw);
  height: var(--vv-height, 100dvh);
}

.iphone-safari #btn-title,
.iphone-safari #btn-lang,
.iphone-safari #btn-sound,
.iphone-safari #btn-music,
.iphone-safari #btn-fullscreen,
.iphone-safari #btn-edit {
  top: calc(var(--vv-top, 0px) + max(10px, env(safe-area-inset-top)));
}

.iphone-safari #btn-bg {
  top: calc(var(--vv-top, 0px) + max(8px, env(safe-area-inset-top)) + 48px);
}

.iphone-safari #btn-title,
.iphone-safari #btn-bg {
  left: calc(var(--vv-left, 0px) + max(8px, env(safe-area-inset-left)));
}

.iphone-safari #btn-sound {
  right: calc(100vw - var(--vv-left, 0px) - var(--vv-width, 100vw) + max(10px, env(safe-area-inset-right)));
}

.iphone-safari #btn-music {
  right: calc(100vw - var(--vv-left, 0px) - var(--vv-width, 100vw) + 58px + env(safe-area-inset-right, 0px));
}

.iphone-safari #btn-fullscreen,
.iphone-safari #btn-lang {
  right: calc(100vw - var(--vv-left, 0px) - var(--vv-width, 100vw) + 114px + env(safe-area-inset-right, 0px));
}

.iphone-safari #btn-edit {
  right: calc(100vw - var(--vv-left, 0px) - var(--vv-width, 100vw) + 152px + env(safe-area-inset-right, 0px));
}
