/* The hidden-object game's player (ADR 0171), in the game's look (docs/game-design/style.md):
   the drawing fills the screen like a sheet of paper, the buttons float over it as paper cut-outs
   with wobbly ink edges and hard ink shadows, and the things to find are tickets in a torn paper
   strip along the bottom. A find lands a mint stamp on its ticket and on the drawing. */
@font-face {
  font-family: "Shantell Sans"; src: url("fonts/ShantellSans.woff2") format("woff2");
  font-weight: 800; font-display: swap;
}
@font-face {
  font-family: "Nunito"; src: url("fonts/Nunito.woff2") format("woff2");
  font-weight: 200 1000; font-display: swap;
}
:root {
  --paper: #f0ebe0;
  --paper-hi: #faf6ec;
  --paper-lo: #e4dbc8;
  --ink: #211d18;
  --ink-2: #5c5448;
  --pencil: #a69d8e;
  --yellow: #ffd23f;
  --yellow-2: #e9b200;
  --coral: #ff6b4a;
  --coral-2: #d9472a;
  --mint: #2fb491;
  --sky: #4a9fe0;
  --display: "Shantell Sans", "Comic Neue", "Chalkboard SE", cursive;
  --body: "Nunito", ui-rounded, system-ui, sans-serif;
  --wob-r: 20px 24px 18px 26px / 24px 18px 26px 20px;
  --round: 50% 46% 52% 48% / 48% 52% 46% 50%;
  --pill: 18px 22px 17px 23px / 21px 17px 23px 18px;
  --grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='260' height='260'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .32  0 0 0 0 .25  0 0 0 0 .15  0 0 0 .10 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  /* How tall the tray is, for what sits just above it. */
  --tray: 116px;
  --above-tray: calc(var(--tray) + env(safe-area-inset-bottom) + 30px);
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; }
body {
  background: var(--paper); color: var(--ink); font: 16px/1.4 var(--body);
  -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--sky); outline-offset: 3px; }
svg { width: 22px; height: 22px; fill: currentColor; flex: none; }

/* Paper cut-outs: a wobbly ink edge round a fill (--fill), and under it a hard ink shadow
   (--lift). Each is a pseudo-element of its own, so the wobble never blurs the words. */
.icon, .readout, .title, .tools, .target button, .popover, .card, .primary, .secondary, .destructive,
.showing, .notice, .count, .tap span:not(:empty), .step-icon, .cover-targets li, .rank-pill, .hinted {
  position: relative; isolation: isolate; border: 0; background: none; color: var(--ink);
}
:is(.icon, .readout, .title, .tools, .target button, .popover, .card, .primary, .secondary, .destructive,
.showing, .notice, .count, .tap span:not(:empty), .step-icon, .cover-targets li, .rank-pill, .hinted)::before {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: var(--r, var(--wob-r));
  border: var(--bw, 2.5px) solid var(--line, var(--ink)); background: var(--fill, var(--paper-hi)); filter: url(#wob);
}
:is(.icon, .tools, .target button, .popover, .card, .primary, .secondary, .destructive, .showing, .title)::after {
  content: ""; position: absolute; inset: 0; z-index: -2; border-radius: var(--r, var(--wob-r));
  background: var(--ink); transform: translateY(var(--lift, 4px)); filter: url(#wob);
}

/* The HUD over the drawing: Close, the way out, back and the places at the left, the challenge's
   name in the middle, the clock and the menu at the right. */
.bar {
  position: absolute; z-index: 3; left: 0; right: 0; top: 0; pointer-events: none;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left));
}
.bar > * { pointer-events: auto; }
.group { display: flex; align-items: center; gap: 8px; min-width: 0; }
.group.end { justify-content: end; }
.title {
  margin: 0; padding: 6px 16px 8px; --r: var(--pill); --lift: 3px;
  font: 800 18px/1.2 var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 42vw;
}
.title:empty { visibility: hidden; }
.icon {
  display: grid; place-items: center; width: 46px; height: 46px; padding: 0; --r: var(--round);
  transition: transform 0.09s ease;
}
.icon svg { width: 24px; height: 24px; }
.icon:active:not(:disabled) { transform: translateY(3px); }
.icon:active:not(:disabled)::after { transform: translateY(1px); }
.icon:disabled { opacity: 0.4; cursor: default; }
.icon:disabled::after { transform: none; }
.icon[aria-expanded="true"] { --fill: var(--yellow); }
/* The way out, back and to the places say what they do where there is room (ADR 0175). */
.icon .word { display: none; }
@media (min-width: 1100px) {
  .icon.labeled { display: flex; gap: 6px; width: auto; padding: 0 16px 0 12px; --r: var(--pill); font: 800 16px var(--body); white-space: nowrap; }
  .icon.labeled .word { display: inline; }
}
.readout {
  display: inline-block; padding: 6px 12px 7px; --r: var(--pill); --bw: 2.2px;
  font: 900 16px var(--body); font-variant-numeric: tabular-nums; white-space: nowrap;
}
.readout.small { font-size: 12px; padding: 1px 8px 2px; --bw: 1.8px; }
.clock { min-width: 6ch; text-align: center; }
body:not([data-state="playing"]) .clock { color: var(--ink-2); }
body[data-state="loading"] .bar .group, body[data-state="failed"] .bar .group { visibility: hidden; }
/* Close is there from the first moment, even when the level can't open. */
#leave { visibility: visible; color: inherit; text-decoration: none; }
/* How far in the view is: a chip at the bottom left, over the tray. */
#depth { position: fixed; left: max(12px, env(safe-area-inset-left)); bottom: var(--above-tray); }
body:not([data-state="playing"]):not([data-state="browsing"]) #depth { display: none; }

/* The drawing. */
main { position: absolute; inset: 0; overflow: hidden; }
#canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; cursor: grab; }
#canvas:active { cursor: grabbing; }
body[data-mode="pen"] #canvas, body[data-mode="erase"] #canvas { cursor: crosshair; }

/* The stamps on the things found, and the ring on the one shown. */
.marks { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.mark { position: absolute; left: 0; top: 0; transform: translate(var(--x), var(--y)); }
.mark.found::before {
  content: ""; position: absolute; width: 32px; height: 32px; left: -16px; top: -16px; border-radius: 50%;
  background: var(--mint) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m6 12.5 4 4L18 8' fill='none' stroke='white' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 20px no-repeat;
  border: 2.5px solid var(--ink); box-shadow: 0 0 0 3px rgb(250 246 236 / 0.9);
  rotate: -10deg; animation: land 0.45s cubic-bezier(0.2, 1.6, 0.4, 1) both;
}
.mark.shown::after {
  content: ""; position: absolute; width: var(--across); height: var(--across);
  left: calc(var(--across) / -2); top: calc(var(--across) / -2); border-radius: 50%;
  border: 4px dashed var(--coral); box-shadow: 0 0 0 4px rgb(250 246 236 / 0.7);
  animation: turn 6s linear infinite;
}
/* A "Where?" circle: the thing is somewhere inside. */
.circle {
  position: absolute; left: 0; top: 0; width: calc(var(--radius) * 2); height: calc(var(--radius) * 2);
  transform: translate(calc(var(--x) - var(--radius)), calc(var(--y) - var(--radius)));
}
.circle::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: rgb(255 107 74 / 0.08); border: 3.5px dashed var(--coral); box-shadow: 0 0 0 3px rgb(250 246 236 / 0.5);
  filter: url(#wob); animation: appear 0.4s ease-out both, ring 2.2s 0.4s ease-in-out infinite;
}
@keyframes appear { from { opacity: 0; } }
@keyframes ring { 50% { scale: 1.04; } }
@keyframes land { from { scale: 2.4; opacity: 0; } to { scale: 1; opacity: 1; } }
@keyframes turn { to { rotate: 1turn; } }

/* A found thing bounces out as a sticker, with sparks. */
.sticker {
  position: fixed; z-index: 40; pointer-events: none; box-sizing: border-box; padding: 4px; border-radius: 50%; overflow: hidden;
  background: #fffdf6; border: 3px solid var(--ink); box-shadow: 0 0 0 5px var(--yellow), 0 10px 26px rgb(33 29 24 / 0.35);
}
.sticker canvas { display: block; width: 100%; height: 100%; object-fit: contain; border: 0; background: none; }
.spark {
  position: fixed; z-index: 39; pointer-events: none; width: 13px; height: 13px; background: var(--yellow);
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
}
.spark[data-tint="1"] { background: var(--coral); }
.spark[data-tint="2"] { background: var(--mint); }

/* What a tap did, where it landed. */
.tap { position: absolute; left: 0; top: 0; pointer-events: none; transform: translate(var(--x), var(--y)); }
.tap::before {
  content: ""; position: absolute; width: 44px; height: 44px; left: -22px; top: -22px; border-radius: 50%;
  border: 3px solid rgb(33 29 24 / 0.4);
}
.tap[data-kind="found"]::before { border-color: var(--mint); }
.tap[data-kind="closer"]::before { border-color: var(--ink); background: rgb(255 210 63 / 0.4); }
.tap.on[data-kind="found"]::before { animation: burst 0.6s ease-out both; }
.tap.on[data-kind="closer"]::before { animation: breathe 1.2s ease-in-out both; }
.tap.on[data-kind="miss"]::before { animation: shake 0.45s ease-in-out both; }
.tap span:not(:empty) {
  position: absolute; left: 0; top: 30px; translate: -50% 0; rotate: -3deg; white-space: nowrap;
  padding: 4px 12px 6px; --fill: var(--yellow); --bw: 2.2px; --r: var(--pill); font: 800 16px var(--display);
}
@keyframes burst { from { scale: 0.4; opacity: 1; } to { scale: 2.2; opacity: 0; } }
@keyframes breathe { 0% { scale: 0.6; } 35% { scale: 1.1; } 100% { scale: 1; opacity: 0.6; } }
@keyframes shake { 0%, 100% { translate: 0; } 20% { translate: -7px; } 40% { translate: 6px; } 60% { translate: -4px; } 80% { translate: 2px; } }

/* The tools, down the right. */
.tools {
  position: absolute; right: max(12px, env(safe-area-inset-right)); top: 50%; translate: 0 -50%;
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 7px;
  --r: 24px 26px 22px 28px / 26px 22px 28px 24px;
}
.tool { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: var(--round); background: none; color: var(--ink); }
.tool:hover { background: rgb(33 29 24 / 0.06); }
.tool[aria-pressed="true"] { background: var(--yellow); box-shadow: inset 0 0 0 2.2px var(--ink); }
#pen[aria-pressed="true"] { color: var(--color, var(--ink)); }
#pin::before { content: ""; position: absolute; top: -6px; left: 10px; right: 10px; height: 2px; border-radius: 1px; background: var(--paper-lo); }
#pin { position: relative; margin-top: 8px; }
.colors { display: grid; gap: 7px; padding: 6px 0; }
.colors[hidden] { display: none; }
.color {
  width: 28px; height: 28px; padding: 0; border-radius: 50%; border: 2.2px solid var(--ink);
  background: var(--color);
}
.color[aria-checked="true"] { box-shadow: 0 0 0 2.5px var(--paper-hi), 0 0 0 4.5px var(--ink); }
body:not([data-state="playing"]):not([data-state="browsing"]) .tools { display: none; }

/* The things to find: tickets in a torn paper strip along the bottom, a yellow tag above them
   counting. */
.tray {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
  display: flex; flex-direction: column; align-items: stretch;
  padding: 18px max(12px, env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
}
.tray::before {
  content: ""; position: absolute; inset: 0 -8px -8px; z-index: -1;
  background: var(--paper-hi) var(--grain); border-top: 2.5px solid var(--ink);
  box-shadow: 0 -10px 24px -14px rgb(33 29 24 / 0.5); filter: url(#wob-edge);
}
.count {
  position: absolute; left: max(16px, env(safe-area-inset-left)); top: -18px; margin: 0; z-index: 1;
  padding: 3px 14px 5px; --fill: var(--yellow); --bw: 2.2px; --r: var(--pill); rotate: -2deg;
  font: 800 17px var(--display); white-space: nowrap;
}
.count:empty { display: none; }
.targets {
  display: flex; justify-content: safe center; gap: 10px; max-width: 100%; margin: 0;
  padding: 14px 6px 8px; list-style: none; overflow-x: auto; scrollbar-width: none;
}
.targets::-webkit-scrollbar { display: none; }
.target { flex: none; }
.target button {
  display: block; width: 66px; height: 66px; padding: 5px; --bw: 2.2px; --lift: 3px;
  --r: 12px 14px 11px 15px / 14px 11px 15px 12px;
  transition: transform 0.15s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.target:nth-child(odd) button { rotate: -1.5deg; }
.target:nth-child(even) button { rotate: 1.5deg; }
.target button:hover { transform: translateY(-3px); }
.target button[aria-expanded="true"] { --fill: var(--yellow); transform: translateY(-10px) rotate(-3deg); }
.picture { display: block; width: 100%; height: 100%; border-radius: 6px; }
/* How far in a thing is, on its ticket. */
.depth {
  position: absolute; left: 50%; bottom: -9px; translate: -50% 0; padding: 0 6px; border-radius: 7px;
  background: var(--paper-hi); border: 1.8px solid var(--ink); color: var(--ink);
  font: 900 11px/15px var(--body); white-space: nowrap; pointer-events: none;
}
.target.found .depth { display: none; }
.cover-targets li { position: relative; }
.cover-targets .depth { font-size: 12px; line-height: 17px; }
.target.found .picture { opacity: 0.28; }
.stamp {
  position: absolute; left: 50%; top: 50%; margin: -17px 0 0 -17px; display: grid; place-items: center; width: 34px; height: 34px;
  border-radius: 50%; background: var(--mint); border: 2.5px solid var(--ink); color: #fff; rotate: -12deg;
}
.stamp svg { width: 20px; height: 20px; }
.target.just .stamp { animation: land 0.45s cubic-bezier(0.2, 1.6, 0.4, 1) both; }
.hinted {
  position: absolute; left: -6px; top: -9px; padding: 0 7px 1px; rotate: -6deg;
  --fill: var(--yellow); --bw: 1.8px; --r: 8px 10px 7px 11px / 10px 7px 11px 8px; font: 900 11px var(--body);
}
body[data-state="loading"] .tray, body[data-state="failed"] .tray, body[data-state="cover"] .tray { visibility: hidden; }

/* Popovers: a thing's hint, the places, the menu. */
.popover {
  position: fixed; z-index: 5; width: min(300px, calc(100vw - 16px)); padding: 16px;
  --r: 18px 24px 17px 23px / 22px 17px 23px 18px; --lift: 5px;
  user-select: text; -webkit-user-select: text;
}
.popover h3 { margin: 4px 0 6px; font: 900 12px var(--body); text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-2); }
.popover h3 + * { margin-top: 0; }
.popover ul { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 2px; max-height: 30vh; overflow: auto; }
.popover li button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border: 0; border-radius: 12px;
  background: none; color: inherit; font-weight: 800; text-align: left;
}
.popover li button:hover { background: var(--paper-lo); }
.popover li button span:first-of-type { flex: 1; }
.quiet { color: var(--ink-2); margin: 0 0 12px; font-size: 15px; }
.target-panel { display: grid; justify-items: center; gap: 10px; text-align: center; }
.target-panel .picture { width: 180px; height: 180px; background: var(--paper); border-radius: 14px; padding: 8px; box-shadow: inset 0 0 0 2px var(--paper-lo); }
.target-panel .label { margin: 0; font: 800 14px var(--body); color: var(--ink-2); }
.target-panel .hint { margin: 0; font: 800 19px/1.3 var(--display); }
.target-panel .quiet { margin: 0; }
.target-panel button { width: 100%; }
.target-panel .where { --fill: var(--coral); }
.found-note { display: flex; align-items: center; gap: 6px; margin: 0; color: var(--mint); font: 800 20px var(--display); }
.menu-panel { display: grid; gap: 12px; }
.menu-panel p { margin: 0 0 10px; font-size: 15px; color: var(--ink-2); }
.menu-panel .destructive { width: 100%; }
.menu-panel .report-open { margin-top: 2px; padding: 8px; border: 0; background: none; color: var(--ink-2); font: 800 14px var(--body); text-decoration: underline; cursor: pointer; }
.report-panel { display: grid; gap: 10px; }
.report-panel fieldset { display: grid; gap: 2px; margin: 0; padding: 0; border: 0; }
.report-panel legend { margin-bottom: 6px; font-size: 15px; color: var(--ink-2); }
.report-panel label { display: flex; align-items: center; gap: 10px; padding: 6px 4px; border-radius: 10px; font-size: 15px; font-weight: 700; cursor: pointer; }
.report-panel label:hover { background: var(--paper-lo); }
.report-panel input[type="radio"] { margin: 0; accent-color: var(--ink); }
.report-panel textarea {
  width: 100%; box-sizing: border-box; padding: 8px 10px; border: 2px solid var(--ink); border-radius: 12px;
  background: var(--paper); color: inherit; font: inherit; font-size: 15px; resize: vertical;
}
.report-panel .quiet { margin: 0; }

/* Buttons: the one to press yellow, the others paper, giving up coral. Pressed, they sink onto
   their shadow. */
.primary, .secondary, .destructive {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 20px 12px;
  --r: 22px 26px 20px 28px / 26px 20px 28px 22px; font: 800 19px/1.15 var(--display);
  text-decoration: none; text-align: center; transition: transform 0.09s ease;
}
.primary { --fill: var(--yellow); }
.destructive { --fill: var(--coral); }
:is(.primary, .secondary, .destructive):active:not(:disabled) { transform: translateY(3px); }
:is(.primary, .secondary, .destructive):active:not(:disabled)::after { transform: translateY(1px); }
:is(.primary, .secondary, .destructive):disabled { opacity: 0.5; cursor: default; }

.notice {
  position: absolute; left: 50%; top: calc(max(12px, env(safe-area-inset-top)) + 60px); translate: -50% 0; z-index: 4; pointer-events: none;
  padding: 6px 16px 8px; --fill: var(--ink); --line: var(--ink); --r: var(--pill); color: var(--paper-hi);
  font: 800 17px var(--display); white-space: nowrap;
}
.notice.on { animation: drop 0.3s ease-out both; }
@keyframes drop { from { translate: -50% -12px; opacity: 0; } }

/* After giving up: which thing the view shows, and on to the next. */
.showing {
  position: fixed; z-index: 4; left: 50%; bottom: var(--above-tray); translate: -50% 0;
  display: flex; align-items: center; gap: 14px; padding: 8px 8px 8px 18px; --lift: 5px;
  font: 800 18px var(--display); white-space: nowrap;
}
.showing .primary { min-height: 40px; padding: 6px 16px 8px; font-size: 17px; --lift: 3px; }

/* The cover, the end, and a challenge that can't open: a card on the paper. */
.sheet {
  position: fixed; inset: 0; z-index: 6; display: grid; place-items: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  background: rgb(240 235 224 / 0.6); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  overflow: auto;
}
.sheet[hidden] { display: none; }
.card {
  width: min(500px, 100%); padding: clamp(24px, 5vw, 36px) clamp(18px, 5vw, 36px); text-align: center;
  --r: 10px 18px 12px 22px / 18px 10px 22px 12px; --bw: 3px; --lift: 6px;
}
.card::before { background: var(--paper-hi) var(--grain); }
.card h2 { margin: 0; font: 800 clamp(32px, 8vw, 44px)/1.02 var(--display); text-wrap: balance; }
.kicker {
  display: inline-block; margin: 0 0 12px; padding: 2px 12px 3px; rotate: -2deg;
  background: rgb(255 107 74 / 0.6); mix-blend-mode: multiply;
  clip-path: polygon(3% 0, 97% 6%, 100% 30%, 96% 55%, 100% 100%, 4% 94%, 0 70%, 3% 42%);
  font: 900 12px var(--body); text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink);
}
.kicker:empty { display: none; }
.by { margin: 8px 0 0; color: var(--ink-2); font-weight: 700; }
.cover-targets {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin: 24px 0 26px; padding: 0; list-style: none;
}
.cover-targets li { width: 78px; height: 78px; padding: 6px; --bw: 2.2px; --r: 12px 14px 11px 15px / 14px 11px 15px 12px; }
.cover-targets li:nth-child(odd) { rotate: -3deg; }
.cover-targets li:nth-child(even) { rotate: 2deg; }
/* How to play, in three steps: zoom in, tap it, and the hint when stuck. */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0 0 26px; padding: 0; list-style: none; }
.steps li { display: grid; justify-items: center; align-content: start; gap: 2px; font-size: 14px; line-height: 1.3; color: var(--ink-2); text-wrap: balance; }
.steps b { color: var(--ink); font: 800 18px var(--display); }
.step-icon { display: grid; place-items: center; width: 46px; height: 46px; margin-bottom: 6px; --fill: var(--yellow); --bw: 2.2px; --r: var(--round); }
.steps li:nth-child(2) .step-icon { --fill: var(--mint); color: #fff; }
.steps li:nth-child(3) .step-icon { --fill: var(--coral); }
#start { min-width: 220px; min-height: 58px; font-size: 26px; --lift: 5px; }
.detail { margin: 12px 0 24px; color: var(--ink-2); font-weight: 700; }
.buttons { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
/* The end's one big next step, and maybe a second beside it (ADR 0175). */
.lead { margin-bottom: 22px; }
.lead > * { min-width: 180px; min-height: 56px; font-size: 22px; }
.lead + .board-status { margin: -12px 0 18px; }
/* The rest, quiet, below. */
.links { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 6px; }
.link {
  padding: 7px 8px; border: 0; border-radius: 10px; background: none; color: var(--ink-2); font: 800 15px var(--body);
  text-decoration: underline; text-decoration-color: var(--yellow-2); text-decoration-thickness: 2.5px; text-underline-offset: 4px;
}
.link:hover { color: var(--ink); background: rgb(255 210 63 / 0.2); }
.rank-pill {
  display: inline-block; margin: 14px 0 0; padding: 4px 16px 6px; --fill: var(--ink); --r: var(--pill); color: var(--paper-hi);
  font: 800 20px var(--display); font-variant-numeric: tabular-nums;
}
.rank-pill:not([hidden]) { animation: pop 0.3s ease-out both; }
/* A level's stars (ADR 0178), and what the next one asks. */
.end-stars { margin: 8px 0 0; display: grid; gap: 2px; justify-items: center; }
.end-stars[hidden] { display: none; }
#end-stars-row {
  font-size: 46px; line-height: 1.1; letter-spacing: 0.06em; color: var(--yellow);
  -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; text-shadow: 0 3px 0 var(--ink);
}
#end-stars-why { font-size: 15px; font-weight: 700; color: var(--ink-2); }
.end-stars:not([hidden]) #end-stars-row { animation: pop 0.35s cubic-bezier(0.2, 1.6, 0.4, 1) both; }
@keyframes pop { from { scale: 0.8; opacity: 0; } }
/* The replay moves the view alone: the stamps and circles would be ahead of it. */
body[data-state="replaying"] .marks { display: none; }
.message p { margin: 12px 0 0; color: var(--ink-2); }
.board { margin: 0 0 22px; text-align: start; }
.board[hidden], .board-form[hidden], .board-status[hidden] { display: none; }
.board h3 { margin: 0 0 10px; font: 800 20px var(--display); color: var(--ink); text-align: center; }
.board-form { display: flex; gap: 8px; margin-bottom: 10px; }
.board-form input {
  flex: 1; min-width: 0; min-height: 48px; padding: 0 14px; border: 2.5px solid var(--ink); border-radius: 14px 16px 13px 17px;
  background: var(--paper); font: 700 16px var(--body); color: var(--ink);
}
.board-form .primary { font-size: 17px; }
.board-status { margin: 0 0 8px; color: var(--ink-2); font-weight: 700; text-align: center; }
.board-status:empty { display: none; }
.board-list { margin: 0; padding: 0; list-style: none; max-height: 220px; overflow: auto; }
.board-list li { display: grid; grid-template-columns: 3.2em 1fr auto; gap: 8px; padding: 7px 10px; border-radius: 10px; font-weight: 700; }
.board-list li:nth-child(odd) { background: rgb(33 29 24 / 0.05); }
.board-list li.mine { background: rgb(255 210 63 / 0.5); font-weight: 900; }
.board-list .rank, .board-list .time { font-variant-numeric: tabular-nums; color: var(--ink-2); }
.board-list .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* A wider screen: the tray a strip of its own, floating above the bottom. */
@media (min-width: 700px) {
  :root { --tray: 132px; }
  .tray { left: 50%; right: auto; bottom: calc(14px + env(safe-area-inset-bottom)); translate: -50% 0; min-width: 320px; max-width: calc(100% - 140px); padding: 18px 16px 10px; }
  .tray::before { inset: 0; border: 2.5px solid var(--ink); border-radius: 26px 30px 24px 32px; filter: url(#wob); }
  .target button { width: 72px; height: 72px; }
}

/* A phone: the name under the buttons, the tools at the bottom right over the tray. */
@media (max-width: 599px) {
  :root { --tray: 108px; }
  .bar { grid-template-columns: 1fr auto; row-gap: 10px; }
  .title { grid-row: 2; grid-column: 1 / -1; justify-self: center; max-width: calc(100vw - 40px); font-size: 17px; }
  .icon { width: 44px; height: 44px; }
  .target button { width: 60px; height: 60px; padding: 4px; }
  .steps { gap: 6px; }
  .steps li { font-size: 13px; }
  .lead > * { flex: 1; min-width: 0; padding-inline: 10px; font-size: 19px; white-space: nowrap; }
  .tools { top: auto; bottom: var(--above-tray); translate: none; }
  .notice { top: calc(max(12px, env(safe-area-inset-top)) + 106px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}
