:root {
  --bg: #f4f1ea;
  --panel: #fbfaf6;
  --ink: #111111;
  --ink-soft: #5b5750;
  --chip: #fbfaf6;
  --chip-hover: #efebe2;
  --chip-ink: #111111;
  --accent: #c8102e;
  --accent-ink: #ffffff;
  --wrong: #c8102e;
  --dot: #cfc9bd;
  --band-green: #2e9e4f;
  --band-yellow: #f2c230;
  --band-orange: #f08a24;
  --band-red: #db3a2f;
  --shadow: 4px 4px 0 #111111;
  --border: 1.5px solid #111111;
  --radius: 2px;
  --radius-button: 2px;
  --font: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --display-weight: 700;
  --display-tracking: -0.01em;
  --button-depth: 0 0 transparent;
  --gap: 12px;
  --width: 560px;
  --attribution: 26px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

[data-theme="natt"] {
  --bg: #12151a;
  --panel: #1c2027;
  --ink: #eceff3;
  --ink-soft: #97a2b1;
  --chip: #262b34;
  --chip-hover: #2f3540;
  --chip-ink: #eceff3;
  --accent: #5fd3a5;
  --accent-ink: #0b1a14;
  --wrong: #ff7a59;
  --dot: #343a45;
  --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 10px 30px rgb(0 0 0 / 45%);
  --border: 1px solid #2a3039;
  color-scheme: dark;
}

[data-theme="papper"] {
  --bg: #f3eee7;
  --panel: #fffdf9;
  --ink: #201d19;
  --ink-soft: #6d665e;
  --chip: #f1ebe2;
  --chip-hover: #e9e1d5;
  --chip-ink: #201d19;
  --accent: #1f6f5c;
  --accent-ink: #ffffff;
  --wrong: #b4442a;
  --dot: #ddd4c7;
  --shadow: 0 1px 2px rgb(32 29 25 / 10%), 0 8px 24px rgb(32 29 25 / 10%);
  --border: 0 solid transparent;
  --radius: 16px;
  --radius-button: 999px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: var(--font);
  --display-weight: 700;
  --display-tracking: -0.015em;
}

[data-theme="klar"] {
  --bg: #f7f4ec;
  --panel: #ffffff;
  --ink: #1b1b1f;
  --ink-soft: #6a6a75;
  --chip: #eef1ff;
  --chip-hover: #e2e7ff;
  --chip-ink: #1b2a7a;
  --accent: #2b59ff;
  --accent-ink: #ffffff;
  --wrong: #e8462f;
  --dot: #dfe3f0;
  --shadow: 0 2px 0 rgb(27 27 31 / 8%), 0 12px 28px rgb(43 89 255 / 14%);
  --radius: 22px;
  --radius-button: 16px;
  --font: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, sans-serif;
  --display-weight: 800;
  --display-tracking: -0.02em;
  --button-depth: 0 3px 0 rgb(27 27 31 / 14%);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

#map { position: absolute; inset: 0; background: var(--bg); }
#aim, #aimhint { display: none; position: absolute; pointer-events: none; }
body[data-pointing]:has(.maplibregl-canvas:focus-visible) :is(#aim, #aimhint) { display: block; }
#aim { z-index: 2; left: 50%; top: 50%; width: 32px; height: 32px; margin: -16px 0 0 -16px; background: linear-gradient(var(--ink), var(--ink)) center / 2px 100% no-repeat, linear-gradient(var(--ink), var(--ink)) center / 100% 2px no-repeat; filter: drop-shadow(0 0 1.5px var(--bg)) drop-shadow(0 0 1.5px var(--bg)); }
#aimhint { z-index: 3; left: 50%; bottom: calc(var(--safe-bottom) + var(--attribution) + 12px); width: max-content; max-width: calc(100vw - 2 * var(--gap)); margin: 0; padding: 8px 12px; transform: translateX(-50%); font-size: 14px; line-height: 1.4; color: var(--ink); background: var(--panel); border: var(--border); border-radius: var(--radius); box-shadow: 0 2px 8px rgb(0 0 0 / 15%); }

[hidden] { display: none !important; }

h1, h2, .total strong, .score strong { font-family: var(--font-display); }

button {
  font: inherit;
  color: var(--chip-ink);
  min-height: 46px;
  padding: 10px 16px;
  border: var(--border);
  border-radius: var(--radius-button);
  background: var(--chip);
  box-shadow: var(--button-depth);
  cursor: pointer;
  transition: background-color .15s ease, transform .1s ease;
}
button:hover { background: var(--chip-hover); }
button:active { transform: translateY(1px); }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
button.primary { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
button.primary:hover { filter: brightness(1.06); }

.panel {
  position: absolute;
  z-index: 3;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 2 * var(--gap));
  max-width: var(--width);
  margin: 0;
  background: var(--panel);
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel[data-edge="top"] { top: calc(var(--safe-top) + var(--gap)); animation: drop .28s ease-out; }
.panel[data-edge="bottom"] { bottom: calc(var(--safe-bottom) + var(--attribution)); animation: rise .28s ease-out; }

@keyframes rise {
  from { opacity: 0; transform: translate(-50%, 14px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
@keyframes drop {
  from { opacity: 0; transform: translate(-50%, -10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.row { display: flex; justify-content: space-between; align-items: center; gap: var(--gap); }

#question { padding: 10px 16px 12px; pointer-events: none; }
#dots { display: flex; gap: 5px; margin: 0; padding: 0; list-style: none; }
#dots li { width: 9px; height: 9px; border-radius: 50%; background: var(--dot); transition: background-color .2s ease, transform .2s ease; }
[data-theme="tidning"] #dots li { border-radius: 0; }
#dots li[data-current] { background: var(--ink); transform: scale(1.25); }
#dots li[data-band="green"] { background: var(--band-green); }
#dots li[data-band="yellow"] { background: var(--band-yellow); }
#dots li[data-band="orange"] { background: var(--band-orange); }
#dots li[data-band="red"] { background: var(--band-red); }
#detail {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
#prompt {
  margin: 8px 0 0;
  font-size: clamp(20px, 2.2vw + 12px, 26px);
  font-weight: var(--display-weight);
  line-height: 1.2;
  letter-spacing: var(--display-tracking);
  text-wrap: balance;
}

#choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 12px;
}
#choices button { line-height: 1.2; padding: 10px 12px; }
#choices[data-count="2"] button { min-height: 56px; font-size: 18px; font-weight: 600; }

#result { padding: 14px 18px 14px; }
#result .score { display: flex; align-items: baseline; gap: 6px; margin: 0; }
#points { padding: 4px 12px; font-size: 36px; line-height: 1; font-weight: var(--display-weight); font-variant-numeric: tabular-nums; letter-spacing: var(--display-tracking); }
#result .score span { font-size: 14px; color: var(--ink-soft); }
#verdict { margin: 0; font-size: 16px; font-weight: 600; text-align: right; }
#explain { margin: 8px 0 0; font-size: 15px; line-height: 1.45; }
#explain:empty { display: none; }
#next { width: 100%; margin-top: 12px; }

#info {
  top: calc(var(--safe-top) + var(--gap));
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 12px;
  padding: 10px;
  animation: drop .28s ease-out;
}
body[data-answered] #question { display: none; }
#infophoto { position: relative; margin: 0; aspect-ratio: 1; overflow: hidden; border-radius: var(--radius); background: var(--bg); }
#infophoto img { display: block; width: 100%; height: 100%; object-fit: cover; }
#infophoto figcaption { display: none; }
#infophoto[hidden] { display: none; }
#info:has(#infophoto[hidden]) { grid-template-columns: 1fr; }
#info .text { min-width: 0; align-self: center; }
#infolabel { margin: 0; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); }
#infoname { margin: 1px 0 0; font-size: 18px; font-weight: var(--display-weight); letter-spacing: var(--display-tracking); }
#infoabout { margin: 4px 0 0; font-size: 14px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
#infoabout:empty { display: none; }
#infolinks { display: flex; gap: 16px; margin: 4px 0 0; font-size: 14px; }
#infolinks a { color: var(--ink-soft); }

#end {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  --veil-strong: color-mix(in srgb, var(--bg) 97%, transparent);
  --veil-light: color-mix(in srgb, var(--bg) 20%, transparent);
  --rule: 1px solid color-mix(in srgb, var(--ink) 18%, transparent);
  animation: fade .3s ease-out;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
#end .sheet {
  pointer-events: auto;
  max-width: var(--width);
  max-height: 100%;
  margin: 0 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: calc(var(--safe-top) + 20px) 16px 16px;
  background: var(--veil-strong);
  border-bottom: var(--rule);
}
#end header { text-align: center; }
#end .masthead { margin: 0 0 10px; font: var(--display-weight) 24px/1 var(--font-display); letter-spacing: var(--display-tracking); }
#enddate { margin: 0; padding: 7px 0; border-top: var(--rule); border-bottom: var(--rule); font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-soft); }
.total { display: flex; justify-content: center; align-items: baseline; gap: 8px; margin: 18px 0 0; }
.total strong { font-size: 64px; line-height: 1; font-weight: var(--display-weight); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.total span { font-size: 16px; color: var(--ink-soft); }
#endverdict { margin: 8px 0 0; font-size: 18px; font-family: var(--font-display); }
#elsewhere { margin: 10px 0 0; font-size: 15px; color: var(--ink-soft); }
#elsewherelink { color: var(--accent); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
#elsewherelink:hover { text-decoration-thickness: 2.5px; }
.round { margin: 28px 0 0; padding: 12px 0 0; border-top: var(--rule); }
.squares { display: flex; gap: 4px; margin: 0 0 10px; }
.squares .sq { flex: 1; min-height: 0; height: 28px; padding: 7px 0; background: color-mix(in srgb, var(--band) 55%, var(--bg)); background-clip: content-box; border: 0; border-radius: 1px; box-shadow: none; transition: background-color .15s ease; }
.squares .sq:hover, .squares .sq[aria-current] { background-color: var(--band); }
.squares .sq:active { transform: none; }
.sq[data-band="green"] { --band: var(--band-green); }
.sq[data-band="yellow"] { --band: var(--band-yellow); }
.sq[data-band="orange"] { --band: var(--band-orange); }
.sq[data-band="red"] { --band: var(--band-red); }
.shareactions { display: flex; gap: 8px; }
.shareactions button { min-height: 52px; font-size: 17px; }
#share { flex: 1; }
#share[data-state="done"] { background: var(--ink); color: var(--bg); }
#share[data-state="failed"] { background: var(--chip); color: var(--wrong); }
#sharenative { flex: 0 0 auto; padding: 10px 22px; font-weight: 600; }
#end .actions { display: grid; grid-template-columns: 1fr 1fr; margin: 14px 0 28px; }
#end .actions button { background: none; border: 0; box-shadow: none; font-weight: 600; color: var(--ink-soft); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
#end .actions button:hover, #practise[aria-expanded="true"] { color: var(--ink); }
.kinds { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin: -16px 0 28px; animation: fade .2s ease-out; }
.kinds button { min-height: 44px; padding: 8px 12px; font-size: 15px; }
#practise::after { content: " ▾"; }
#practise[aria-expanded="true"]::after { content: " ▴"; }
#report { display: none; position: absolute; z-index: 6; right: calc(var(--gap) + 44px); bottom: calc(var(--safe-bottom) + var(--attribution) + 11px); padding: 4px 10px; font-size: 13px; color: var(--ink-soft); background: color-mix(in srgb, var(--panel) 85%, transparent); border-radius: var(--radius-button); }
body[data-ended] #report { display: block; }
#info:not([hidden]) ~ #report { display: none; }
#maptip { display: none; position: absolute; z-index: 6; right: var(--gap); bottom: calc(var(--safe-bottom) + var(--attribution) + 6px); }
body[data-ended] #maptip { display: block; }
#info:not([hidden]) ~ #maptip { display: none; }
#maptipbutton { width: 36px; min-height: 36px; padding: 0; border-radius: 50%; font: 600 italic 18px/1 var(--font-display); background: var(--panel); color: var(--ink); box-shadow: 0 1px 4px rgb(0 0 0 / 20%); }
#maptiptext { display: none; position: absolute; right: 0; bottom: 44px; width: max-content; max-width: min(260px, calc(100vw - 2 * var(--gap))); padding: 8px 12px; font-size: 14px; line-height: 1.4; color: var(--ink); background: var(--panel); border: var(--border); border-radius: var(--radius); box-shadow: 0 2px 8px rgb(0 0 0 / 15%); }
#maptip:hover #maptiptext, #maptip:focus-within #maptiptext, #maptipbutton[aria-expanded="true"] + #maptiptext { display: block; }
#endmap { width: 100%; font-weight: 600; }
#endmap::after { content: " ↓"; }
body[data-mapview] #endmap::after { content: " ↑"; }
body[data-mapview] #end .sheet > :not(header):not(#endmap) { display: none; }
body[data-mapview] #endverdict, body[data-mapview] #elsewhere { display: none; }
#end[data-crowd] #endverdict, #end[data-crowd] #elsewhere { display: none; }
body:not([data-mapview]) #end[data-crowd="asking"] .total { visibility: hidden; }
body:not([data-mapview]) #end:has(#crowd:not([hidden]) .graph:not([data-waiting])) .total { display: none; }
body[data-mapview] #end .total { margin-top: 4px; }
body[data-mapview] #end .total strong { font-size: 36px; }
body[data-mapview] #endmap { margin-top: 12px; }
.install { display: flex; align-items: center; gap: 12px; margin: 16px 0 0; padding: 12px 14px; background: var(--panel); border: var(--border); border-radius: var(--radius); }
#installtext { flex: 1; margin: 0; font-size: 15px; line-height: 1.4; }
#installbutton { flex: 0 0 auto; min-height: 44px; padding: 8px 18px; font-weight: 600; }

.crowd { margin: 22px 0 0; }
#end button:focus-visible { outline-color: var(--ink); }
.crowd .standing { min-height: 50px; }
.crowd:has(.graph[data-waiting]) .standing { min-height: 0; }
.crowd .head { margin: 0; font: var(--display-weight) 24px/1.15 var(--font-display); letter-spacing: var(--display-tracking); }
.crowd .dek { margin: 4px 0 0; font-size: 14px; line-height: 1.4; color: var(--ink-soft); }
.graph { position: relative; margin: 6px 0 0; touch-action: pan-y; cursor: crosshair; border-radius: var(--radius); }
.graph:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }
.graph .plot { position: relative; padding-top: 60px; }
.graph svg { display: block; width: 100%; height: 80px; overflow: visible; transition: filter .7s ease-out, opacity .7s ease-out; }
.graph .behind { fill: color-mix(in srgb, var(--accent) 45%, var(--dot)); transition: fill .5s; }
.graph .ahead { fill: var(--dot); transition: fill .5s; }
.graph .stroke { fill: none; stroke: var(--ink-soft); stroke-width: 1.5; stroke-linejoin: round; }
.graph .line { stroke: var(--accent); stroke-width: 2; }
.graph .tries .try { stroke: var(--ink); stroke-width: 1; stroke-dasharray: 3 3; opacity: .45; }
.graph span.try { position: absolute; top: 46px; left: 0; transform: translateX(-50%); font: 600 10px/1 var(--font); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); white-space: nowrap; }
.graph span.try[data-edge="left"] { transform: none; }
.graph span.try[data-edge="right"] { transform: translateX(-100%); }
.graph[data-waiting] :is(.tries, span.try) { opacity: 0; }
.graph .you { position: absolute; top: 0; left: 0; display: flex; flex-direction: column; align-items: center; gap: 3px; transform: translateX(-50%); font: 700 11px/1 var(--font); letter-spacing: .12em; text-transform: uppercase; white-space: nowrap; }
.graph .you[data-edge="left"] { align-items: flex-start; }
.graph .you[data-edge="right"] { align-items: flex-end; }
.graph .you .sep { display: none; }
.graph .you .mine { font: var(--display-weight) 44px/0.9 var(--font-display); letter-spacing: -0.02em; text-transform: none; font-variant-numeric: tabular-nums; }
.graph .rank { position: absolute; top: 0; left: 0; transform: translateX(-50%); font: 700 11px/1 var(--font); letter-spacing: .12em; text-transform: uppercase; white-space: nowrap; font-variant-numeric: tabular-nums; opacity: 0; }
.graph[data-hover="you"] .rank { opacity: 1; }
.graph[data-hover="you"] .you .who { visibility: hidden; }
.graph [data-edge="left"] { transform: none; }
.graph [data-edge="right"] { transform: translateX(-100%); }
.graph .split { position: relative; display: flex; height: 8px; margin: 6px 0 0; }
.graph .split .behind { width: var(--at); background: color-mix(in srgb, var(--accent) 45%, var(--dot)); transition: background .5s; }
.graph .split .ahead { flex: 1; background: var(--dot); transition: background .5s; }
.graph .tick { position: absolute; top: -3px; bottom: -3px; width: 1.5px; margin-left: -0.75px; background: var(--ink); opacity: .55; }
.graph .split .mark { position: absolute; left: var(--at); top: -6px; bottom: -4px; width: 2px; margin-left: -1px; background: var(--accent); }
.graph .numbers { display: flex; flex-wrap: wrap; gap: 0 8px; align-items: baseline; min-height: 17px; margin: 7px 0 0; font: 700 12px/1.4 var(--font); letter-spacing: .1em; text-transform: uppercase; font-variant-numeric: tabular-nums; }
.graph .beaten { color: var(--accent); }
.graph .sep { color: var(--ink-soft); }
.graph .aside { font: italic 14px/1.2 var(--font-display); letter-spacing: 0; text-transform: none; color: var(--ink-soft); }
.graph .cursor, .graph .cursor-score, .graph .cursor-share { display: none; position: absolute; pointer-events: none; }
.graph[data-hover] .cursor, .graph[data-hover] .cursor-score, .graph[data-hover] .cursor-share { display: block; }
.graph[data-hover="you"] :is(.cursor, .cursor-score, .cursor-share) { display: none; }
.graph .cursor { top: 60px; bottom: 24px; width: 0; border-left: 1px solid color-mix(in srgb, var(--ink) 60%, transparent); }
.graph .cursor-score { top: 0; transform: translateX(-50%); padding: 0 2px; font: 700 13px/1 var(--font); color: var(--ink); background: var(--bg); white-space: nowrap; }
.graph .cursor-share { bottom: 0; transform: translateX(-50%); padding: 0 2px; font: 700 13px/1.3 var(--font); color: var(--ink); background: var(--bg); white-space: nowrap; }
.graph .faded { opacity: .15; transition: opacity .1s; }
.graph .wait { position: absolute; inset: 0 0 40px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 0 16px; text-align: center; opacity: 0; visibility: hidden; transition: opacity .4s, visibility .4s; }
.graph .wait p { margin: 0; font: italic 16px/1.45 var(--font-display); color: var(--ink-soft); white-space: pre-line; }
.graph .wait .invite { min-height: 0; padding: 4px 2px; font: 700 11px/1.4 var(--font); letter-spacing: .12em; text-transform: uppercase; color: var(--accent); background: none; border: 0; border-bottom: 1.5px solid currentColor; border-radius: 0; box-shadow: none; cursor: pointer; }
.graph .wait .invite:hover { color: var(--ink); }
.graph .wait .peek { white-space: nowrap; }
.graph .wait [hidden] { display: none; }
.graph[data-waiting], .graph[data-paused] { cursor: default; }
.graph[data-waiting] .wait, .graph[data-paused] .wait { opacity: 1; visibility: visible; }
.graph[data-paused]:not([data-waiting]) :is(svg, .split, .numbers, .you) { opacity: .2; }
.graph[data-paused]:not([data-waiting]) .wait p { color: var(--ink); }
.graph[data-waiting] svg { filter: blur(6px); opacity: .55; animation: breathe 1.6s ease-in-out infinite alternate; }
.graph[data-waiting] .behind, .graph[data-waiting] .ahead { fill: color-mix(in srgb, var(--accent) 25%, var(--dot)); }
.graph[data-waiting] .split .behind, .graph[data-waiting] .split .ahead { background: color-mix(in srgb, var(--accent) 25%, var(--dot)); }
.graph .stroke, .graph .line, .graph .you, .graph .numbers, .graph .split .mark, .graph .ticks { transition: opacity .5s ease-out .2s; }
.graph[data-waiting] .stroke, .graph[data-waiting] .line, .graph[data-waiting] .you, .graph[data-waiting] .numbers, .graph[data-waiting] .split .mark, .graph[data-waiting] .ticks { opacity: 0; }
.graph .spoken { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@keyframes breathe { from { opacity: .35; } to { opacity: .6; } }
.crowd .best { min-height: 76px; margin: 18px 0 0; padding: 12px 0 0; border-top: 1px solid color-mix(in srgb, var(--ink) 20%, transparent); }
.crowd .kicker { margin: 0; font: 700 11px/1.2 var(--font); letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.crowd .text { margin: 4px 0 0; font: 17px/1.35 var(--font-display); }
.crowd .inline { display: inline; min-height: 0; margin: 0; padding: 0; font: inherit; color: var(--accent); background: none; border: 0; border-radius: 0; box-shadow: none; text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 3px; cursor: pointer; }
.crowd .inline:hover { text-decoration-thickness: 2.5px; }
.crowd .detail { margin: 3px 0 0; font-size: 13px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.crowd .bone { display: block; height: 12px; margin: 4px 0 10px; border-radius: 2px; background: color-mix(in srgb, var(--accent) 18%, var(--dot)); filter: blur(3px); opacity: .5; animation: breathe 1.6s ease-in-out infinite alternate; }
.crowd .bone:first-child { width: 22%; height: 9px; }
.crowd .bone + .bone { width: 78%; }
.crowd .best[data-state="empty"] .bone { visibility: hidden; animation: none; }
@media (prefers-reduced-motion: reduce) {
  .graph *, .graph svg, .crowd .bone { transition: none !important; animation: none !important; }
}

.band { min-width: 44px; padding: 3px 10px; font-weight: 700; font-variant-numeric: tabular-nums; text-align: center; border-radius: var(--radius-button); }
.band[data-band="green"] { background: var(--band-green); color: #ffffff; }
.band[data-band="yellow"] { background: var(--band-yellow); color: #1a1a1a; }
.band[data-band="orange"] { background: var(--band-orange); color: #1a1a1a; }
.band[data-band="red"] { background: var(--band-red); color: #ffffff; }
#infoscore { display: flex; align-items: center; gap: 8px; margin: 6px 0 0; font-size: 14px; color: var(--ink-soft); }
#infoscore[hidden] { display: none; }
#infoclose { display: none; position: absolute; z-index: 1; top: 6px; right: 6px; width: 36px; min-height: 36px; padding: 0; font-size: 22px; line-height: 1; border: 0; box-shadow: none; background: var(--panel); color: var(--ink-soft); border-radius: 50%; }
body[data-ended] #infoclose { display: block; }
body[data-ended] #info { z-index: 6; top: auto; bottom: calc(var(--safe-bottom) + var(--attribution)); animation: rise .28s ease-out; }


#boot {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 22px;
  padding: 24px;
  background: var(--bg);
  transition: opacity .45s ease, visibility .45s;
}
#boot.done { opacity: 0; visibility: hidden; pointer-events: none; }
#boot .brand { text-align: center; }
#boot .mark { display: block; width: 64px; height: 64px; margin: 0 auto 14px; }
#boot h1 { margin: 0; font-size: 30px; font-weight: var(--display-weight); letter-spacing: var(--display-tracking); }
#boot .brand p { margin: 6px 0 0; color: var(--ink-soft); }
#boot .bar { width: 180px; height: 4px; border-radius: 2px; background: var(--dot); overflow: hidden; }
#bootbar { display: block; height: 100%; background: var(--accent); transform-origin: left; transform: scaleX(0.04); transition: transform .2s ease; }
#bootmsg { margin: 0; min-height: 1em; font-size: 14px; color: var(--ink-soft); }
#boot.failed #bootmsg { color: var(--wrong); max-width: 32ch; text-align: center; line-height: 1.5; }
#boot.failed .bar { display: none; }

.maplibregl-ctrl-attrib {
  font-size: 11px !important;
  background: color-mix(in srgb, var(--panel) 85%, transparent) !important;
  color: var(--ink-soft);
}
.maplibregl-ctrl-attrib a { color: var(--ink-soft); }

@media (min-width: 760px) {
  #question { padding: 16px 22px 20px; }
  #result, #choices { padding: 16px 18px; }
}

@media (max-width: 759px) {
  body:not([data-mapview]) :is(#report, #maptip) { z-index: 4; }
}

@media (max-width: 759px) and (max-height: 720px) {
  #end .sheet { padding-top: calc(var(--safe-top) + 12px); padding-bottom: 8px; }
  .total { margin-top: 10px; }
  .total strong { font-size: 52px; }
  .crowd { margin-top: 8px; }
  .crowd .best { margin-top: 10px; padding-top: 8px; }
  .round { margin-top: 14px; padding-top: 10px; }
  #end .actions { margin: 4px 0 8px; }
}

@media (max-height: 520px) and (min-width: 600px) {
  #question { padding: 8px 16px 10px; }
  #prompt { margin-top: 4px; font-size: 20px; }
  #choices { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; padding: 8px; }
  #choices button { min-height: 38px; padding: 6px 8px; font-size: 14px; }
  #choices[data-count="2"] button { min-height: 44px; }
  #result { padding: 8px 14px; }
  #points { font-size: 26px; }
  #explain { margin-top: 2px; font-size: 14px; }
  #next { margin-top: 6px; min-height: 40px; }
  #info { grid-template-columns: 1fr; padding: 8px 14px; }
  #infophoto { display: none; }
  #infoname { font-size: 16px; }
  #infoabout { -webkit-line-clamp: 1; font-size: 13px; }
}

@media (min-width: 760px) {
  #end {
    --sheet: min(var(--width), calc(100vw - 340px - 32px - 3 * var(--gap)));
    background: linear-gradient(to right,
      var(--veil-strong) calc(var(--sheet) + 64px), var(--veil-light) calc(var(--sheet) + 130px));
  }
  #end .sheet { display: flex; flex-direction: column; max-width: var(--sheet); height: 100%; margin: 0 0 0 32px; padding-top: calc(var(--safe-top) + 32px); padding-bottom: calc(var(--safe-bottom) + 28px); background: none; border-bottom: 0; }
  #end #crowd { margin: clamp(22px, 5vh, 56px) 0 28px; }
  #end .graph { margin-top: clamp(6px, 2.5vh, 28px); }
  #end .crowd .best { margin-top: clamp(18px, 4vh, 44px); padding-top: clamp(12px, 2.5vh, 24px); }
  #end .round { margin-top: auto; }
  #end .actions { margin-bottom: 0; }
  #end .kinds { margin: 12px 0 0; }
  #endmap { display: none; }
  body[data-ended] #info {
    top: var(--gap);
    bottom: auto;
    left: auto;
    right: var(--gap);
    transform: none;
    width: 340px;
    max-height: calc(100% - 2 * var(--gap) - var(--safe-top) - var(--attribution));
    overflow-y: auto;
    animation: slide .28s ease-out;
  }
}

@media (min-width: 1000px) {
  body[data-answered] #question { display: block; }
  body[data-answered] #question, body[data-answered] #result { left: calc((100% - 340px - var(--gap)) / 2); }
  #info {
    left: auto;
    right: var(--gap);
    transform: none;
    width: 340px;
    max-height: calc(100% - 2 * var(--gap) - var(--safe-top) - var(--attribution));
    overflow-y: auto;
    display: block;
    padding: 0;
    animation: slide .28s ease-out;
  }
  #infophoto { aspect-ratio: 4 / 3; border-radius: 0; }
  #infophoto figcaption { display: block; position: absolute; right: 0; bottom: 0; padding: 3px 8px; font-size: 11px; background: color-mix(in srgb, var(--panel) 85%, transparent); }
  #infophoto figcaption a { color: var(--ink-soft); }
  #info .text { padding: 14px 18px 18px; }
  #infoname { font-size: 24px; }
  #infoabout { font-size: 15px; line-height: 1.5; display: block; margin-top: 8px; }
  #infolinks { margin-top: 10px; }
}

@keyframes slide {
  from { opacity: 0; transform: translateX(14px); }
  to { opacity: 1; transform: none; }
}

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