/* ===== base.css ===== */
/* ==========================================================================
   Touch Typing Quest - styles. Three pupil skins plus a light teacher theme.
   ========================================================================== */
:root {
  --emoji: 'Noto Color Emoji', 'Apple Color Emoji', 'Segoe UI Emoji', sans-serif;
  --font: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif, 'Noto Color Emoji';
  --display: 'Fredoka', 'Nunito', system-ui, sans-serif, 'Noto Color Emoji';
  --mono: 'Roboto Mono', ui-monospace, Consolas, monospace, 'Noto Color Emoji';
  --radius: 18px;
  --good: #4ade80;
  --bad: #f87171;
  --warn: #fbbf24;
  --star: #fcd34d;

  /* Depth. Light comes from above (and slightly from the left), so raised things
     have a bright top edge, a darker bottom edge and a shadow underneath. Every
     stylesheet uses these, so that the whole game looks lit the same way.
     Do not rename them. */
  --hi: rgba(255, 255, 255, .28);          /* a top edge catching the light */
  --hi-strong: rgba(255, 255, 255, .55);
  --lo: rgba(0, 0, 0, .28);                /* a bottom edge in shade */
  --shadow-1: 0 2px 4px rgba(0, 0, 0, .22), 0 8px 18px rgba(0, 0, 0, .24);    /* panels resting on the page */
  --shadow-2: 0 4px 8px rgba(0, 0, 0, .28), 0 14px 30px rgba(0, 0, 0, .34);   /* raised: buttons, stones, keys */
  --shadow-3: 0 10px 20px rgba(0, 0, 0, .34), 0 30px 70px rgba(0, 0, 0, .5);  /* floating: pop-ups, toasts */
  --wall: 5px;                              /* how thick a raised control's side is */

  /* More depth pieces, built from the ones above. */
  --bevel: inset 0 1px 0 var(--hi), inset 0 -2px 0 var(--lo);                      /* a lit top edge, a shaded bottom edge */
  --bevel-strong: inset 0 1.5px 0 var(--hi-strong), inset 0 -2px 0 var(--lo);
  --inset: inset 0 3px 7px rgba(0, 0, 0, .55), inset 0 1px 1px rgba(0, 0, 0, .4);  /* pressed into the surface */
  --sheen: linear-gradient(180deg, rgba(255, 255, 255, .14), rgba(255, 255, 255, .02) 55%, rgba(0, 0, 0, .12));   /* a curved, lit face */
  --cast: 0 calc(var(--wall) + 3px) 5px rgba(0, 0, 0, .28), 3px calc(var(--wall) + 12px) 24px rgba(0, 0, 0, .36); /* the shadow under a thick slab */
}

/* ---------- skins ----------
   Each pupil skin has an illustrated scene behind the page (#scene, drawn in
   art.js). Panels are tinted glass over it so text stays easy to read.
   --btn / --btn-wall: the face and side of a plain raised button.
   --slab: the side of a thick panel.  --accent-ts: a text shadow that suits --accent-text.
   --panel: the body of a panel on a pupil page. The same tint as --card but more
   solid, so that words on it never have to fight the scene behind. */
body[data-skin="space"] {
  --bg: #0b1030; --bg2: #24124f; --card: rgba(12, 18, 52, .78); --card2: rgba(255,255,255,.1);
  --line: rgba(165, 180, 252, .22); --text: #eef2ff; --muted: #a5b4fc; --accent: #22d3ee; --accent2: #a78bfa;
  --accent-text: #04121a; --field: #050818; --keycap: #26305e;
  --btn: #3a4a9c; --btn-wall: #171e52; --slab: #050822; --accent-ts: 0 1px 0 rgba(255, 255, 255, .45); --panel: rgba(13, 19, 56, .92);
}
body[data-skin="dragon"] {
  --bg: #0b1d33; --bg2: #3b1d12; --card: rgba(9, 28, 30, .8); --card2: rgba(255,255,255,.1);
  --line: rgba(253, 230, 196, .2); --text: #fef9ec; --muted: #e6d3a8; --accent: #ef4444; --accent2: #facc15;
  --accent-text: #fff; --field: #0b261c; --keycap: #24433d;
  --btn: #2f6a5d; --btn-wall: #10362d; --slab: #03120f; --accent-ts: 0 1px 1px rgba(90, 0, 0, .6); --panel: rgba(10, 31, 33, .93);
}
body[data-skin="pop"] {
  --bg: #1a0533; --bg2: #831843; --card: rgba(38, 6, 56, .8); --card2: rgba(255,255,255,.11);
  --line: rgba(249, 168, 212, .24); --text: #fff1f8; --muted: #f9a8d4; --accent: #f472b6; --accent2: #c084fc;
  --accent-text: #3b0a2a; --field: #2a0733; --keycap: #4a1a5e;
  --btn: #7d35a0; --btn-wall: #3d1355; --slab: #15031e; --accent-ts: 0 1px 0 rgba(255, 255, 255, .45); --panel: rgba(41, 8, 60, .94);
}
body[data-skin="teacher"] {
  --bg: #f4f6fb; --bg2: #f4f6fb; --card: #fff; --card2: #eef2f8; --line: #dde3ee; --text: #1e2433; --muted: #5d6b85;
  --accent: #2563eb; --accent2: #7c3aed; --accent-text: #fff; --field: #fff;
  background: var(--bg);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { font-family: var(--font); color: var(--text); font-size: 16px; line-height: 1.45; background-color: var(--bg); }
h1, h2, h3 { font-family: var(--display); font-weight: 600; margin: 0 0 .5em; line-height: 1.2; }
h2 small, h3 small { font-family: var(--font); font-weight: 600; font-size: .7em; color: var(--muted); margin-left: .4em; }
p { margin: 0 0 .8em; }
a { color: var(--accent); }
kbd { display: inline-block; min-width: 1.8em; padding: .1em .45em; border-radius: 6px; background: var(--card2); border: 1px solid var(--line);
  border-bottom-width: 3px; font-family: var(--mono); font-size: .9em; text-align: center; margin: 0 1px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.ok { color: var(--good); }
.error { color: var(--bad); font-weight: 700; }
.spacer { flex: 1; }

/* ---------- buttons and forms ----------
   These plain versions are what the teacher dashboard shows. The pupil pages
   turn them into chunky 3D controls further down. */
.btn { font: 700 15px var(--font); border: 0; border-radius: 12px; padding: .6em 1.1em; cursor: pointer; background: var(--card2);
  color: var(--text); transition: transform .08s, filter .15s; white-space: nowrap; }
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: translateY(1px) scale(.98); }
.btn:disabled { opacity: .6; cursor: default; }
.btn.primary { background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 75%, #000)); color: var(--accent-text);
  box-shadow: 0 4px 0 color-mix(in srgb, var(--accent) 55%, #000); }
.btn.ghost { background: transparent; border: 1.5px solid var(--line); }
.btn.danger { background: #dc2626; color: #fff; }
.btn.small { padding: .4em .8em; font-size: 13.5px; }
.btn.big { font-size: 18px; padding: .75em 1.5em; }
.btn.wide { width: 100%; }
/* the arrow on a "go" button, drawn so that it looks the same on every device */
.arr { display: inline-block; width: 0; height: 0; margin-left: .4em; vertical-align: -.06em; border-left: .62em solid currentColor;
  border-top: .4em solid transparent; border-bottom: .4em solid transparent; }
.linkbtn { background: none; border: 0; color: var(--accent); font: inherit; font-weight: 700; cursor: pointer; padding: 0; text-decoration: underline; }
label { display: flex; flex-direction: column; gap: 4px; font-weight: 700; font-size: 14px; color: var(--muted); }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-weight: 600; }
input, select { font: 600 16px var(--font); padding: .6em .75em; border-radius: 10px; border: 1.5px solid var(--line); background: var(--field);
  color: var(--text); min-width: 0; }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: 10px; }
.row.spread { justify-content: space-between; align-items: center; }
.label { font-weight: 700; color: var(--muted); font-size: 14px; margin: 6px 0; }

/* ---------- the pupil pages' 3D controls ----------
   Everything here is inside :where(), which adds no weight to the selector: a
   later stylesheet can still restyle its own buttons with a single class.

   A raised button is a lit face (a gradient, plus a glossy band across its top
   half) standing on a side wall --w thick, with a soft shadow under that. When
   it is pressed it sinks by the height of the wall. */
:where(body:not([data-skin="teacher"])) .btn {
  --w: var(--wall); --face: var(--btn); --side: var(--btn-wall);
  position: relative; isolation: isolate; border-radius: 14px; padding: .56em 1.15em .64em; color: #fff; text-shadow: 0 1px 1px rgba(0, 0, 0, .45);
  background: linear-gradient(180deg, rgba(255, 255, 255, .2), rgba(255, 255, 255, 0) 55%, rgba(0, 0, 0, .18)), var(--face);
  box-shadow: inset 0 1.5px 0 var(--hi-strong), inset 0 -2px 0 var(--lo), 0 var(--w) 0 var(--side),
    0 calc(var(--w) + 2px) 3px rgba(0, 0, 0, .32), 2px calc(var(--w) + 7px) 14px rgba(0, 0, 0, .34); }
/* the glossy band: behind the label, in front of the face */
:where(body:not([data-skin="teacher"])) .btn::before { content: ''; position: absolute; z-index: -1; left: 4px; right: 4px; top: 3px; height: 45%;
  border-radius: 10px 10px 50% 50% / 10px 10px 28% 28%; background: linear-gradient(180deg, rgba(255, 255, 255, .36), rgba(255, 255, 255, .04));
  pointer-events: none; }
:where(body:not([data-skin="teacher"])) .btn.small { --w: 4px; border-radius: 11px; }
:where(body:not([data-skin="teacher"])) .btn.big { --w: 6px; border-radius: 17px; padding: .68em 1.5em .76em; }
:where(body:not([data-skin="teacher"])) .btn.primary { --side: color-mix(in srgb, var(--accent) 50%, #000); color: var(--accent-text); text-shadow: var(--accent-ts);
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 74%, #fff), var(--accent) 50%, color-mix(in srgb, var(--accent) 78%, #000));
  box-shadow: inset 0 1.5px 0 rgba(255, 255, 255, .75), inset 0 -2px 0 rgba(0, 0, 0, .22), 0 var(--w) 0 var(--side),
    0 calc(var(--w) + 2px) 3px rgba(0, 0, 0, .32), 2px calc(var(--w) + 8px) 16px color-mix(in srgb, var(--accent) 34%, rgba(0, 0, 0, .55)); }
:where(body:not([data-skin="teacher"])) .btn.ghost { --w: 3px; --side: var(--slab); border: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, .17), rgba(255, 255, 255, .03) 60%, rgba(0, 0, 0, .12)), color-mix(in srgb, var(--btn) 52%, var(--slab)); }
:where(body:not([data-skin="teacher"])) .btn.ghost::before { opacity: .5; }
:where(body:not([data-skin="teacher"])) .btn.danger { --side: #6f1212; color: #fff; text-shadow: 0 1px 1px rgba(90, 0, 0, .6);
  background: linear-gradient(180deg, #f87171, #dc2626 50%, #b91c1c); }
:where(body:not([data-skin="teacher"])) .btn:hover { filter: brightness(1.1); transform: translateY(-1px); }
:where(body:not([data-skin="teacher"])) .btn:active { transform: translateY(calc(var(--w) - 1px)); filter: brightness(.97);
  box-shadow: inset 0 1.5px 0 var(--hi), inset 0 -2px 0 var(--lo), 0 1px 0 var(--side), 0 2px 3px rgba(0, 0, 0, .4); }
:where(body:not([data-skin="teacher"])) .btn:disabled { opacity: .55; filter: saturate(.45); transform: none; }
:where(body:not([data-skin="teacher"])) .btn:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }

/* a keyboard key in a sentence: a little keycap */
:where(body:not([data-skin="teacher"])) kbd { min-width: 1.9em; padding: .1em .5em .14em; border: 0; border-radius: 7px; margin: 0 2px 3px; color: var(--text);
  background: linear-gradient(180deg, rgba(255, 255, 255, .26), rgba(255, 255, 255, 0) 62%), var(--keycap);
  box-shadow: inset 0 1px 0 var(--hi-strong), inset 0 -1px 0 var(--lo), 0 3px 0 color-mix(in srgb, var(--keycap) 48%, #000), 0 5px 5px rgba(0, 0, 0, .35); }

/* boxes to type in are cut into the panel: dark at the top where the edge shades them */
:where(body:not([data-skin="teacher"])) input, :where(body:not([data-skin="teacher"])) select { border-radius: 12px; border: 1.5px solid;
  border-color: rgba(0, 0, 0, .6) color-mix(in srgb, var(--line) 70%, #000) var(--hi) color-mix(in srgb, var(--line) 70%, #000);
  box-shadow: inset 0 3px 7px rgba(0, 0, 0, .6), inset 0 1px 1px rgba(0, 0, 0, .45), 0 1px 0 rgba(255, 255, 255, .06); }
:where(body:not([data-skin="teacher"])) input::placeholder { color: color-mix(in srgb, var(--muted) 55%, transparent); }
:where(body:not([data-skin="teacher"])) input:focus, :where(body:not([data-skin="teacher"])) select:focus { outline: 0; border-color: var(--accent);
  box-shadow: inset 0 3px 7px rgba(0, 0, 0, .6), 0 0 0 3px color-mix(in srgb, var(--accent) 32%, transparent), 0 0 18px color-mix(in srgb, var(--accent) 45%, transparent); }

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

/* ===== ui.css ===== */
/* ==========================================================================
   Touch Typing Quest - pupil pages: layout, header, tabs, joining, the homework
   banner, pop-up panels, badges, leaderboard, stats, toasts and practice.

   The first part of each section is the plain version that the teacher
   dashboard shares (cards, tabs, tiles, pop-ups, toasts). The pupil pages then
   turn those into lit, thick, toy-like objects. Rules for the shared pieces sit
   inside :where(body:not([data-skin="teacher"])) so the dashboard stays plain.

   The light is above and a little to the left, the same as everywhere else:
   bright top edges, shaded bottom edges, side walls underneath, shadows that
   fall down and slightly right. See the depth tokens in base.css.
   ========================================================================== */
/* ---------- layout ---------- */
.page { max-width: 1100px; margin: 0 auto; padding: 14px 16px 30px; }
.page.narrow { max-width: 640px; padding-top: 30px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
body[data-skin="teacher"] .card { box-shadow: 0 1px 3px #0001; }
.loading { min-height: 70vh; display: grid; place-content: center; text-align: center; }
.spinner { font-size: 52px; animation: bob 1s ease-in-out infinite alternate; }
@keyframes bob { to { transform: translateY(-12px) rotate(-6deg); } }
.loading .logo-keys { margin-bottom: 18px; }
:where(body:not([data-skin="teacher"])) .loading p { font: 600 19px var(--display); text-shadow: 0 2px 0 rgba(0, 0, 0, .5), 0 3px 12px rgba(0, 0, 0, .75); }
.section-title { margin: 8px 0 14px; }
.year-title { margin: 22px 0 12px; font-size: 24px; }
/* a drawn icon from the sprite sheet, sized to the text around it */
.ico { display: inline-block; width: 1.2em; height: 1.2em; vertical-align: -.24em; }
.ico-txt { font-style: normal; color: rgba(255, 255, 255, .28); }
.ico-txt.on { color: var(--star); }

/* A panel is a slab of tinted glass: a lit top edge, a sheen that fades down
   the face, a dark side underneath and a soft shadow on the scene behind. No
   blur: a blur over an animated scene is redrawn every frame, which is hard
   work for a school Chromebook. */
:where(body:not([data-skin="teacher"])) .card { border-radius: 20px; border-top-color: var(--hi); margin-bottom: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .1), rgba(255, 255, 255, 0) 120px), var(--panel);
  box-shadow: var(--bevel), 0 var(--wall) 0 var(--slab), var(--cast); }
:where(body:not([data-skin="teacher"])) .card :is(h2, h3) { text-shadow: 0 2px 0 rgba(0, 0, 0, .3); }
/* headings stand straight on the scene, so they carry their own dark halo */
:where(body:not([data-skin="teacher"])) :is(.year-title, .section-title) { text-shadow: 0 2px 0 rgba(0, 0, 0, .5), 0 3px 12px rgba(0, 0, 0, .75); }
:where(body:not([data-skin="teacher"])) :is(.year-title, .section-title) small, :where(body:not([data-skin="teacher"])) .pc-level {
  color: color-mix(in srgb, var(--text) 88%, var(--muted)); text-shadow: 0 1px 2px rgba(0, 0, 0, .9), 0 0 10px rgba(0, 0, 0, .8); }

/* ---------- header ---------- */
.topbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 6px 0 12px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-icon { font-size: 34px; }
.brand b { font-family: var(--display); font-size: 21px; display: block; line-height: 1.1; }
.brand small { color: var(--muted); font-weight: 700; }
.top-actions { display: flex; gap: 8px; }
.tpage .top-actions { margin-left: auto; }

/* the pupil's header is a raised bar of glass */
:where(body:not([data-skin="teacher"])) .topbar { padding: 10px 16px 11px; margin-bottom: 18px; border: 1px solid var(--line); border-top-color: var(--hi-strong);
  border-radius: 22px; box-shadow: var(--bevel), 0 var(--wall) 0 var(--slab), var(--cast);
  /* glass: a band of gloss across the top half that stops at a hard edge, and a wash of the world's colour from the left */
  background: linear-gradient(180deg, rgba(255, 255, 255, .15), rgba(255, 255, 255, .05) 47%, rgba(255, 255, 255, 0) 48%, rgba(0, 0, 0, .16)),
    radial-gradient(55% 150% at 0% 0%, color-mix(in srgb, var(--accent2) 30%, transparent), transparent 72%), var(--panel); }
:where(body:not([data-skin="teacher"])) .brand { gap: 12px; }
/* round tokens: a domed face, a rim, and a side so they stand up off the bar */
:where(body:not([data-skin="teacher"])) .brand-icon, .me-hero { width: 50px; height: 50px; flex: none; display: grid; place-items: center; border-radius: 50%;
  font: 28px/1 var(--emoji); text-shadow: 0 2px 3px rgba(0, 0, 0, .35);
  background: radial-gradient(circle at 34% 26%, color-mix(in srgb, var(--accent2) 38%, #fff), var(--accent2) 52%, color-mix(in srgb, var(--accent2) 42%, #000));
  box-shadow: inset 0 2px 2px rgba(255, 255, 255, .6), inset 0 -5px 7px rgba(0, 0, 0, .3), 0 0 0 2px rgba(255, 255, 255, .7),
    0 3px 0 2px color-mix(in srgb, var(--accent2) 30%, #000), 0 7px 9px rgba(0, 0, 0, .45); }
:where(body:not([data-skin="teacher"])) .brand b { font-size: 22px; letter-spacing: .01em; text-shadow: 0 1px 0 color-mix(in srgb, var(--accent2) 55%, #000), 0 2px 0 color-mix(in srgb, var(--accent2) 35%, #000), 0 3px 0 rgba(0, 0, 0, .45), 0 5px 6px rgba(0, 0, 0, .4); }

/* the player chip: a well cut into the bar, holding the avatar and a glossy XP tube */
.topbar .me { display: flex; align-items: center; gap: 12px; margin-left: auto; padding: 6px 18px 7px 8px; border-radius: 40px;
  background: rgba(0, 0, 0, .3); border: 1px solid; border-color: rgba(0, 0, 0, .55) rgba(0, 0, 0, .25) var(--hi) rgba(0, 0, 0, .25); box-shadow: var(--inset); }
.me-hero { position: relative; width: 46px; height: 46px; font-size: 26px; }
.me-lvl { position: absolute; right: -7px; bottom: -5px; min-width: 22px; height: 22px; padding: 0 5px; display: grid; place-items: center; border-radius: 11px;
  font: 700 12.5px/1 var(--display); color: #5a3200; text-shadow: 0 1px 0 rgba(255, 255, 255, .6);
  background: radial-gradient(circle at 35% 25%, #fff7c2, #fbbf24 55%, #d97706);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8), 0 0 0 2px rgba(0, 0, 0, .55), 0 3px 4px rgba(0, 0, 0, .5); }
.me-info { min-width: 0; }
.topbar .me b { font-family: var(--display); font-size: 17px; line-height: 1.15; display: block; text-shadow: 0 1px 0 rgba(0, 0, 0, .4); }
.topbar .me small { display: block; color: var(--muted); font-weight: 700; font-size: 12px; line-height: 1.3; }
.xpbar { width: 168px; max-width: 100%; height: 13px; padding: 2px; margin: 3px 0; border-radius: 7px; overflow: hidden; background: rgba(0, 0, 0, .55);
  box-shadow: inset 0 2px 3px rgba(0, 0, 0, .75), 0 1px 0 rgba(255, 255, 255, .16); }
.xpbar i { position: relative; display: block; height: 100%; min-width: 9px; border-radius: 5px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .7), rgba(255, 255, 255, .14) 45%, rgba(0, 0, 0, 0) 55%, rgba(0, 0, 0, .25)), linear-gradient(90deg, var(--accent), var(--accent2)); }
.xpbar i::after { content: ''; position: absolute; right: 2px; top: 1px; width: 5px; height: 3px; border-radius: 50%; background: rgba(255, 255, 255, .95); }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.tab { font: 700 15px var(--font); background: none; border: 0; color: var(--muted); padding: 10px 14px; cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tab.on { color: var(--text); border-bottom-color: var(--accent); }
.tab-i { font-family: var(--emoji); }
/* A tray set into the page, holding a row of keys. The key for the page you
   are on is pushed in and lit from inside. */
:where(body:not([data-skin="teacher"])) .tabs { gap: 8px; padding: 8px 9px 12px; margin-bottom: 20px; border-radius: 18px; border: 1px solid;
  border-color: rgba(0, 0, 0, .6) rgba(0, 0, 0, .3) var(--hi) rgba(0, 0, 0, .3);
  background: linear-gradient(rgba(0, 0, 0, .42), rgba(0, 0, 0, .26)), var(--panel); box-shadow: var(--inset), 0 1px 0 rgba(255, 255, 255, .08); }
:where(body:not([data-skin="teacher"])) .tab { --w: 4px; margin: 0; padding: 8px 16px 9px; border: 0; border-radius: 12px; color: var(--text);
  text-shadow: 0 1px 1px rgba(0, 0, 0, .5);
  background: linear-gradient(180deg, rgba(255, 255, 255, .22), rgba(255, 255, 255, 0) 55%, rgba(0, 0, 0, .18)), var(--btn);
  box-shadow: inset 0 1.5px 0 var(--hi-strong), inset 0 -2px 0 var(--lo), 0 var(--w) 0 var(--btn-wall), 0 calc(var(--w) + 3px) 5px rgba(0, 0, 0, .45);
  transition: transform .08s, filter .15s; }
:where(body:not([data-skin="teacher"])) .tab:hover { filter: brightness(1.14); }
:where(body:not([data-skin="teacher"])) .tab:active { transform: translateY(3px); }
:where(body:not([data-skin="teacher"])) .tab.on { transform: translateY(3px); color: var(--accent-text); text-shadow: var(--accent-ts); filter: none;
  background: radial-gradient(120% 100% at 50% 0%, color-mix(in srgb, var(--accent) 58%, #fff), var(--accent) 62%, color-mix(in srgb, var(--accent) 82%, #000));
  box-shadow: inset 0 2px 4px color-mix(in srgb, var(--accent) 35%, #000), inset 0 -1px 0 rgba(255, 255, 255, .5), 0 1px 0 color-mix(in srgb, var(--accent) 45%, #000),
    0 0 4px var(--accent), 0 0 18px color-mix(in srgb, var(--accent) 60%, transparent); }
:where(body:not([data-skin="teacher"])) :is(.tab, .act, .skincard, .pk, .chip, .modal-x):focus-visible { outline: 3px solid #fff; outline-offset: 2px; }

.foot { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; color: var(--muted); font-size: 13px; margin-top: 26px; }
.savestate.ok { color: var(--good); }
.savestate.warn { color: var(--warn); }
:where(body:not([data-skin="teacher"])) .foot { padding: 8px 14px; border-radius: 12px; border: 1px solid var(--line); border-top-color: var(--hi);
  background: linear-gradient(rgba(0, 0, 0, .18), rgba(0, 0, 0, .18)), var(--panel); box-shadow: var(--shadow-1); }

/* ---------- joining ---------- */
.hero-title { text-align: center; margin-bottom: 22px; }
/* The title is extruded: the heading itself is the dark side, pushed down in
   steps by its text shadow, and ::after lays the lit face on top of it. */
.hero-title h1 { position: relative; display: inline-block; margin: 18px 0 14px; font: 700 48px/1.08 var(--display); letter-spacing: .01em;
  color: color-mix(in srgb, var(--accent) 62%, #000);
  text-shadow: 0 1px 0 color-mix(in srgb, var(--accent) 62%, #000), 0 2px 0 color-mix(in srgb, var(--accent) 58%, #000), 0 3px 0 color-mix(in srgb, var(--accent) 54%, #000),
    0 4px 0 color-mix(in srgb, var(--accent) 50%, #000), 0 5px 0 color-mix(in srgb, var(--accent) 46%, #000), 0 6px 0 color-mix(in srgb, var(--accent) 42%, #000),
    0 7px 0 color-mix(in srgb, var(--accent) 38%, #000), 0 9px 3px rgba(0, 0, 0, .5), 3px 16px 22px rgba(0, 0, 0, .6); }
.hero-title h1::after { content: attr(data-text); content: attr(data-text) / ''; position: absolute; left: 0; right: 0; top: 0; text-shadow: none;
  background: linear-gradient(180deg, #ffffff 18%, color-mix(in srgb, var(--accent) 30%, #fff) 55%, color-mix(in srgb, var(--accent) 70%, #fff) 90%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent; }
.hero-title p { font-weight: 700; text-shadow: 0 1px 2px rgba(0, 0, 0, .85), 0 0 14px rgba(0, 0, 0, .75); }
/* three keycaps: a sloped skirt with the top of the key sitting in it. Only the top moves when it is pressed. */
.logo-keys { display: flex; gap: 10px; justify-content: center; }
.logo-keys span { --kc: var(--accent); position: relative; width: 62px; height: 66px; border-radius: 14px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--kc) 70%, #000), color-mix(in srgb, var(--kc) 36%, #000));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 4px 5px rgba(0, 0, 0, .4), 3px 12px 18px rgba(0, 0, 0, .45); }
.logo-keys span:nth-child(2) { --kc: var(--accent2); }
.logo-keys span:nth-child(3) { --kc: #f59e0b; }
.logo-keys i { position: absolute; left: 5px; right: 5px; top: 1px; height: 52px; display: grid; place-items: center; border-radius: 11px;
  font: 700 31px/1 var(--display); color: #fff; text-shadow: 0 2px 0 color-mix(in srgb, var(--kc) 45%, #000);
  background: linear-gradient(165deg, color-mix(in srgb, var(--kc) 62%, #fff), var(--kc) 55%, color-mix(in srgb, var(--kc) 84%, #000));
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .65), inset 0 -2px 0 rgba(0, 0, 0, .18), 0 3px 3px rgba(0, 0, 0, .4); animation: keypop 2.4s ease-in-out infinite; }
.logo-keys span:nth-child(2) i { animation-delay: .2s; } .logo-keys span:nth-child(3) i { animation-delay: .4s; }
@keyframes keypop { 0%, 80%, 100% { transform: none; } 88% { transform: translateY(7px); } }
.join .card > .small { margin: 20px 0 0; }

/* The three worlds are game boxes: cover art on top, a title label under it,
   and a thick side. The one you have chosen stands forward and glows. */
.skinpick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 22px 0 28px; }
.modal .skinpick { margin: 26px 2px 14px; gap: 18px; }
.skincard { --w: 7px; --side: #0a0c26; position: relative; display: flex; flex-direction: column; padding: 0; border: 0; border-radius: 16px; cursor: pointer;
  color: #fff; font-family: var(--font); text-align: center; background: var(--side); filter: brightness(.86) saturate(.85);
  box-shadow: 0 var(--w) 0 var(--side), 0 calc(var(--w) + 3px) 5px rgba(0, 0, 0, .3), 3px calc(var(--w) + 12px) 22px rgba(0, 0, 0, .4);
  transition: transform .12s, filter .15s; }
.skincard:hover { transform: translateY(-3px); filter: none; }
.skincard.on { transform: translateY(-6px); filter: none;
  box-shadow: 0 0 0 3px #fff, 0 var(--w) 0 3px var(--side), 0 0 0 6px color-mix(in srgb, var(--accent) 80%, transparent), 0 0 30px 6px color-mix(in srgb, var(--accent) 55%, transparent),
    3px calc(var(--w) + 18px) 26px rgba(0, 0, 0, .5); }
.sc-art { position: relative; display: grid; place-items: center; height: 104px; overflow: hidden; border-radius: 16px 16px 0 0; box-shadow: inset 0 2px 0 rgba(255, 255, 255, .45), inset 0 -8px 12px rgba(0, 0, 0, .3); }
/* the spine: the rounded left edge of the box, catching the light */
.skincard::before { content: ''; position: absolute; z-index: 2; left: 0; top: 0; bottom: 0; width: 11px; border-radius: 16px 0 0 16px; pointer-events: none;
  background: linear-gradient(90deg, rgba(255, 255, 255, .5), rgba(255, 255, 255, .12) 30%, rgba(0, 0, 0, .12) 70%, rgba(0, 0, 0, .45) 92%, rgba(255, 255, 255, .25)); }
/* a streak of light across the cover, as on a shiny box */
.sc-art::after { content: ''; position: absolute; inset: 0; background: linear-gradient(118deg, rgba(255, 255, 255, .34), rgba(255, 255, 255, .06) 26%, transparent 27%, transparent 60%, rgba(255, 255, 255, .07) 61%, transparent 72%); }
.sc-icon { position: relative; z-index: 1; font: 50px/1 var(--emoji); text-shadow: 0 6px 5px rgba(0, 0, 0, .45); }
.sc-label { flex: 1; display: flex; flex-direction: column; gap: 2px; padding: 9px 10px 12px; border-radius: 0 0 16px 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .12), rgba(255, 255, 255, 0) 40%), var(--face, #1e1b4b); box-shadow: inset 0 2px 0 rgba(255, 255, 255, .28), inset 0 -2px 0 rgba(0, 0, 0, .3); }
.skincard b { font: 600 17.5px var(--display); text-shadow: 0 2px 0 rgba(0, 0, 0, .4); }
.skincard small { font-size: 12px; font-weight: 700; line-height: 1.3; opacity: .92; }
.sc-tick { position: absolute; z-index: 2; top: -12px; right: -10px; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%;
  font: 800 17px/1 var(--font); color: #053b18; text-shadow: 0 1px 0 rgba(255, 255, 255, .5);
  background: radial-gradient(circle at 35% 28%, #d9ffe6, #4ade80 55%, #16a34a);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, .8), 0 0 0 3px #fff, 0 3px 0 3px #0f6b32, 0 7px 8px rgba(0, 0, 0, .45); }
/* each cover is a tiny painting of its world (drawn in ui.js), with the world's hero standing in front of it */
.sc-paint { position: absolute; inset: 0; width: 100%; height: 100%; }
.sc-hero { position: relative; z-index: 1; height: 88px; width: auto; filter: drop-shadow(2px 5px 3px rgba(0, 0, 0, .45)); }
.sc-shadow { position: absolute; z-index: 1; left: 50%; bottom: 7px; width: 64px; height: 10px; margin-left: -32px; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(0, 0, 0, .55), rgba(0, 0, 0, 0)); }
.sk-space { --side: #080a24; --face: #1c1a55; }
.sk-space .sc-art { background: #1e1a5e; }
.sk-space .sc-hero { height: 84px; transform: rotate(14deg); }
.sk-space .sc-shadow { width: 90px; margin-left: -45px; opacity: .55; }
.sk-dragon { --side: #071a10; --face: #17432a; }
.sk-dragon .sc-art { background: #8a4a7c; }
.sk-pop { --side: #3a0440; --face: #8a1a86; }
.sk-pop .sc-art { background: #5b1477; }
.sk-pop .sc-hero { height: 90px; transform: rotate(-10deg); }
.sk-pop .sc-shadow { bottom: 9px; width: 44px; margin-left: -22px; }

/* ---------- the homework banner ----------
   A hero card: light streaming in from its top left corner, an icon on a big
   coin, and the Play button standing proud of it. --mc is the banner's colour. */
.mission { --mc: var(--accent); position: relative; overflow: hidden; display: flex; align-items: center; gap: 18px; padding: 16px 22px 18px;
  margin-bottom: 26px; border-radius: 22px; border: 1px solid var(--line); border-top-color: var(--hi-strong);
  background: linear-gradient(118deg, transparent 58%, rgba(255, 255, 255, .06) 58% 66%, transparent 66% 71%, rgba(255, 255, 255, .04) 71% 75%, transparent 75%),
    radial-gradient(70% 160% at 0% 0%, color-mix(in srgb, var(--mc) 46%, transparent), transparent 72%),
    linear-gradient(180deg, rgba(255, 255, 255, .1), rgba(255, 255, 255, 0) 55%, rgba(0, 0, 0, .16)), var(--panel);
  box-shadow: var(--bevel), 0 6px 0 var(--slab), 0 9px 6px rgba(0, 0, 0, .28), 3px 20px 30px rgba(0, 0, 0, .4); }
.mission.now { border-color: var(--accent); border-top-color: color-mix(in srgb, var(--accent) 55%, #fff);
  box-shadow: var(--bevel), 0 0 0 1px var(--accent), 0 6px 0 1px color-mix(in srgb, var(--accent) 38%, #000), 0 0 28px color-mix(in srgb, var(--accent) 38%, transparent),
    0 9px 6px rgba(0, 0, 0, .28), 3px 20px 30px rgba(0, 0, 0, .4); }
.mission.done { --mc: #22c55e; }
/* its icon again, huge and faint, like a mark pressed into the card */
.mission::after { content: attr(data-mark); content: attr(data-mark) / ''; position: absolute; right: 9%; top: 50%; font: 170px/1 var(--emoji); opacity: .09; transform: translateY(-52%) rotate(-14deg); pointer-events: none; }
.mission > * { position: relative; z-index: 1; }
/* a finished homework's mark is the drawn tick rather than a character: same place, same faintness */
.mission > .m-mark { position: absolute; z-index: 0; right: 9%; top: 50%; width: 170px; height: 170px; opacity: .09; transform: translateY(-52%) rotate(-14deg); pointer-events: none; }
.m-mark .spr { display: block; width: 100%; height: 100%; }
.mission > div:nth-child(2) { flex: 1; min-width: 0; }
/* the stars won on a finished homework, in a tray set into the card */
.m-tally { flex: none; display: inline-flex; align-items: center; gap: 4px; padding: 6px 18px 6px 9px; border-radius: 30px; font: 600 17px var(--display); color: color-mix(in srgb, var(--text) 80%, transparent);
  background: rgba(0, 0, 0, .42); border: 1px solid; border-color: rgba(0, 0, 0, .5) rgba(0, 0, 0, .2) var(--hi) rgba(0, 0, 0, .2); box-shadow: inset 0 3px 5px rgba(0, 0, 0, .55); }
.m-tally b { margin-left: 3px; font-size: 27px; line-height: 1; color: var(--star); text-shadow: 0 2px 0 rgba(0, 0, 0, .5); }
.m-tally .ico { width: 38px; height: 38px; }
.mission b { font-family: var(--display); font-size: 21px; font-weight: 600; text-shadow: 0 2px 0 rgba(0, 0, 0, .35); }
.mission p { margin: 2px 0 0; color: color-mix(in srgb, var(--text) 70%, var(--muted)); font-weight: 600; }
/* the coin: a pearl face (so any emoji shows up on it) in a thick coloured rim */
.m-icon { flex: none; width: 72px; height: 72px; display: grid; place-items: center; border-radius: 50%; border: 6px solid transparent;
  font: 36px/1 var(--emoji); text-shadow: 0 2px 2px rgba(0, 0, 0, .25);
  background: radial-gradient(circle at 34% 26%, #ffffff, #e9edf8 48%, #a9b3cf) padding-box,
    linear-gradient(160deg, color-mix(in srgb, var(--mc) 45%, #fff), var(--mc) 45%, color-mix(in srgb, var(--mc) 55%, #000)) border-box;
  box-shadow: inset 0 3px 4px rgba(0, 0, 0, .3), inset 0 -2px 2px rgba(255, 255, 255, .7), 0 5px 0 color-mix(in srgb, var(--mc) 34%, #000), 0 10px 12px rgba(0, 0, 0, .45); }
/* a glint that crosses the banner's Play button every few seconds, to catch the eye (it ends off the button, so "reduce motion" leaves nothing behind) */
.mission.now > .btn { overflow: hidden; }
.mission.now > .btn::after { content: ''; position: absolute; z-index: -1; top: 0; bottom: 0; left: 0; width: 44%; transform: translateX(-170%) skewX(-20deg); pointer-events: none;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, .6), rgba(255, 255, 255, 0)); animation: btnglint 4.6s ease-in-out 1.2s infinite; }
@keyframes btnglint { 0%, 72% { transform: translateX(-170%) skewX(-20deg); } 100% { transform: translateX(360%) skewX(-20deg); } }
.m-pips { display: flex; gap: 3px; margin-top: 7px; }
.m-pips .ico { width: 24px; height: 24px; }
.catchup { margin-top: 10px; padding-bottom: 4px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-weight: 700; color: var(--warn); }
.chip { font: 700 14px var(--font); border-radius: 20px; padding: 5px 12px; border: 1.5px solid var(--line); background: var(--card); color: var(--text); cursor: pointer; }
.chip.on { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.chip.warn { border-color: var(--warn); color: var(--warn); }
.chip small { opacity: .7; margin-left: 4px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
/* on the pupil pages a chip is a small raised pill; the chosen one is pushed in and lit */
:where(body:not([data-skin="teacher"])) .chip { --w: 3px; --side: var(--btn-wall); border: 0; padding: 5px 14px 6px; text-shadow: 0 1px 1px rgba(0, 0, 0, .45);
  background: linear-gradient(180deg, rgba(255, 255, 255, .22), rgba(255, 255, 255, 0) 58%, rgba(0, 0, 0, .16)), var(--btn);
  box-shadow: inset 0 1px 0 var(--hi-strong), inset 0 -1px 0 var(--lo), 0 var(--w) 0 var(--side), 0 calc(var(--w) + 2px) 5px rgba(0, 0, 0, .35); transition: transform .08s; }
:where(body:not([data-skin="teacher"])) .chip:active { transform: translateY(2px); }
:where(body:not([data-skin="teacher"])) .chip.on { transform: translateY(2px); color: var(--accent-text); text-shadow: var(--accent-ts);
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 62%, #fff), var(--accent) 60%, color-mix(in srgb, var(--accent) 84%, #000));
  box-shadow: inset 0 2px 3px color-mix(in srgb, var(--accent) 40%, #000), 0 1px 0 color-mix(in srgb, var(--accent) 45%, #000), 0 0 14px color-mix(in srgb, var(--accent) 60%, transparent); }
:where(body:not([data-skin="teacher"])) .chip.warn { --side: #8a4b06; color: #3b2500; text-shadow: 0 1px 0 rgba(255, 255, 255, .4);
  background: linear-gradient(180deg, #fde68a, var(--warn) 55%, #e39a0b); }

/* ---------- pop-up panels ---------- */
.modal-bg { position: fixed; inset: 0; background: #0009; display: grid; place-items: start center; padding: 40px 12px; overflow-y: auto; z-index: 50; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { position: relative; width: 100%; max-width: 620px; background: var(--bg); background-image: linear-gradient(var(--card), var(--card)); border: 1px solid var(--line);
  border-radius: 22px; padding: 24px; box-shadow: 0 20px 60px #0008; animation: pop .18s ease-out; }
.modal.wide { max-width: 940px; }
@keyframes pop { from { transform: scale(.94); opacity: 0; } }
.modal-x { position: absolute; top: 12px; right: 12px; border: 0; background: var(--card2); color: var(--text); width: 34px; height: 34px; border-radius: 50%; cursor: pointer; font-size: 15px; }
/* a pupil's pop-up floats well above the page: thick, with the widest, softest shadow */
:where(body:not([data-skin="teacher"])) .modal-bg { background: radial-gradient(circle at 50% 30%, rgba(0, 0, 0, .5), rgba(0, 0, 0, .8)); }
:where(body:not([data-skin="teacher"])) .modal { --mp: 24px; padding: var(--mp); border-radius: 24px; border-top-color: var(--hi-strong); margin-bottom: 20px;
  background-image: linear-gradient(180deg, rgba(255, 255, 255, .1), rgba(255, 255, 255, 0) 150px), linear-gradient(var(--card), var(--card));
  box-shadow: var(--bevel), 0 8px 0 var(--slab), 0 18px 20px rgba(0, 0, 0, .35), 4px 40px 70px rgba(0, 0, 0, .55); }
:where(body:not([data-skin="teacher"])) .modal > h2 { font-size: 27px; text-shadow: 0 2px 0 rgba(0, 0, 0, .35); }
:where(body:not([data-skin="teacher"])) .modal-x { z-index: 3; top: 14px; right: 14px; width: 36px; height: 36px; color: #fff; font-weight: 800; text-shadow: 0 1px 1px rgba(0, 0, 0, .5);
  background: radial-gradient(circle at 35% 28%, color-mix(in srgb, var(--btn) 55%, #fff), var(--btn) 60%, var(--btn-wall));
  box-shadow: inset 0 1.5px 1px rgba(255, 255, 255, .55), 0 0 0 2px rgba(255, 255, 255, .25), 0 3px 0 2px var(--slab), 0 6px 8px rgba(0, 0, 0, .45); transition: transform .08s; }
:where(body:not([data-skin="teacher"])) .modal-x:hover { filter: brightness(1.15); }
:where(body:not([data-skin="teacher"])) .modal-x:active { transform: translateY(2px); }

/* the stage panel: a header in its world's colours, standing up from the panel */
.stage-head { position: relative; overflow: hidden; display: flex; align-items: center; gap: 16px; margin: calc(-1 * var(--mp, 24px)) calc(-1 * var(--mp, 24px)) 18px; padding: 22px 24px 24px; border-radius: 23px 23px 0 0; color: #fff;
  background: radial-gradient(90% 150% at 0% 0%, rgba(255, 255, 255, .34), transparent 58%), radial-gradient(rgba(255, 255, 255, .13) 1.2px, transparent 1.7px) 0 0 / 22px 22px,
    linear-gradient(135deg, var(--w1, var(--accent)), var(--w2, var(--accent2)));
  box-shadow: inset 0 1.5px 0 var(--hi-strong), inset 0 -6px 0 rgba(0, 0, 0, .3), 0 6px 10px rgba(0, 0, 0, .4); }
.sh-mark { position: absolute; right: 70px; bottom: -44px; font: 150px/1 var(--emoji); opacity: .16; transform: rotate(-12deg); pointer-events: none; }
.stage-head .w-icon { position: relative; flex: none; width: 68px; height: 68px; display: grid; place-items: center; border-radius: 50%; font: 38px/1 var(--emoji); text-shadow: 0 3px 4px rgba(0, 0, 0, .4);
  background: radial-gradient(circle at 34% 26%, rgba(255, 255, 255, .62), rgba(255, 255, 255, .18) 55%, rgba(0, 0, 0, .25));
  box-shadow: inset 0 2px 2px rgba(255, 255, 255, .7), inset 0 -5px 8px rgba(0, 0, 0, .28), 0 0 0 3px rgba(255, 255, 255, .4), 0 5px 0 3px rgba(0, 0, 0, .32), 0 11px 14px rgba(0, 0, 0, .4); }
.stage-head > div { position: relative; flex: 1; min-width: 0; }
.stage-head small { display: block; color: rgba(255, 255, 255, .88); font-weight: 800; font-size: 12.5px; text-transform: uppercase; letter-spacing: .06em; text-shadow: 0 1px 2px rgba(0, 0, 0, .4); }
.stage-head h2 { margin: 0; font-size: 31px; text-shadow: 0 2px 0 rgba(0, 0, 0, .3), 0 5px 10px rgba(0, 0, 0, .35); }
.sh-total { position: relative; flex: none; align-self: flex-end; display: inline-flex; align-items: center; gap: 3px; padding: 3px 12px 3px 6px; border-radius: 20px;
  font: 600 14px var(--display); color: rgba(255, 255, 255, .85); background: rgba(0, 0, 0, .4); box-shadow: inset 0 2px 3px rgba(0, 0, 0, .55), 0 1px 0 rgba(255, 255, 255, .3); }
.sh-total b { font-size: 18px; color: var(--star); margin-left: 2px; }
.sh-total .ico { width: 22px; height: 22px; }
.newkeys { font-weight: 800; }
.newkeys kbd { font-size: 1.25em; padding: .16em .62em .2em; }
/* a note pressed into the panel */
p.tip { background: rgba(0, 0, 0, .26); border-radius: 13px; padding: 10px 14px; font-weight: 600; border: 1px solid; border-color: rgba(0, 0, 0, .45) rgba(0, 0, 0, .2) var(--hi) rgba(0, 0, 0, .2);
  box-shadow: inset 0 3px 6px rgba(0, 0, 0, .4); }
body[data-skin="teacher"] p.tip { background: var(--card2); border: 0; box-shadow: none; }
/* the four activities: long 3D buttons, each with a numbered stud, an icon tile, its stars and a round Go button */
.acts { display: flex; flex-direction: column; gap: 15px; margin: 18px 0 20px; }
.act { --w: 5px; position: relative; display: flex; align-items: center; gap: 12px; padding: 10px 14px 11px 12px; border: 0; border-radius: 18px; color: var(--text); cursor: pointer;
  text-align: left; font-family: var(--font);
  background: linear-gradient(180deg, rgba(255, 255, 255, .19), rgba(255, 255, 255, .03) 48%, rgba(0, 0, 0, .17)), var(--btn);
  box-shadow: inset 0 1.5px 0 var(--hi-strong), inset 0 -2px 0 var(--lo), 0 var(--w) 0 var(--btn-wall), 0 calc(var(--w) + 2px) 3px rgba(0, 0, 0, .32), 2px calc(var(--w) + 8px) 14px rgba(0, 0, 0, .34);
  transition: transform .08s, filter .15s; }
.act:hover { transform: translateY(-2px); filter: brightness(1.1); }
.act:active { transform: translateY(4px); filter: none; box-shadow: inset 0 1.5px 0 var(--hi), inset 0 -2px 0 var(--lo), 0 1px 0 var(--btn-wall), 0 2px 3px rgba(0, 0, 0, .4); }
.a-step { flex: none; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; font: 700 15px/1 var(--display); color: var(--text);
  background: rgba(0, 0, 0, .42); box-shadow: inset 0 2px 3px rgba(0, 0, 0, .65), 0 1px 0 rgba(255, 255, 255, .22); }
.act.done .a-step { color: #053b18; text-shadow: 0 1px 0 rgba(255, 255, 255, .5); background: radial-gradient(circle at 35% 28%, #d9ffe6, #4ade80 55%, #16a34a);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, .8), 0 2px 0 #0f6b32, 0 4px 4px rgba(0, 0, 0, .4); }
.a-icon { flex: none; width: 50px; height: 50px; display: grid; place-items: center; border-radius: 14px; font: 29px/1 var(--emoji); text-shadow: 0 2px 3px rgba(0, 0, 0, .4);
  background: linear-gradient(160deg, rgba(255, 255, 255, .34), rgba(255, 255, 255, .08) 60%, rgba(0, 0, 0, .1));
  box-shadow: inset 0 1.5px 0 rgba(255, 255, 255, .55), inset 0 -3px 5px rgba(0, 0, 0, .25), 0 3px 0 rgba(0, 0, 0, .28), 0 5px 6px rgba(0, 0, 0, .3); }
/* drawn activity icons: this skin's falling thing, finish flag and projectile, sized to sit in the tile */
.a-icon .a-spr { width: 40px; height: 40px; filter: drop-shadow(1px 2px 1.5px rgba(0, 0, 0, .4)); }
.a-icon .a-spr-rain { width: 40px; height: 52px; margin-top: -8px; }
.a-icon .a-spr-race { width: 34px; height: 44px; }
.a-icon .a-spr-boss { width: 50px; height: 34px; }
.m-icon .m-spr { width: 48px; height: 48px; }
.ok-tick { width: 24px; height: 24px; vertical-align: -6px; margin-right: 2px; }
.a-text { flex: 1; min-width: 0; }
.a-text b { font-family: var(--display); font-size: 18.5px; font-weight: 600; display: block; text-shadow: 0 2px 0 rgba(0, 0, 0, .3); }
.a-text small { color: color-mix(in srgb, var(--text) 84%, transparent); font-weight: 600; }
.a-stars { flex: none; text-align: right; }
.a-st { display: inline-flex; gap: 1px; }
.a-st .ico { width: 27px; height: 27px; }
.a-st .ico-txt { font-size: 22px; }
.a-stars small { display: block; color: color-mix(in srgb, var(--text) 78%, transparent); font-size: 11px; font-weight: 700; }
/* the Go button: its arrow is drawn, so it looks the same whatever fonts the device has */
.a-go { flex: none; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; font-size: 0;
  background: radial-gradient(circle at 35% 28%, color-mix(in srgb, var(--accent) 50%, #fff), var(--accent) 58%, color-mix(in srgb, var(--accent) 70%, #000));
  box-shadow: inset 0 1.5px 1px rgba(255, 255, 255, .75), 0 0 0 2px rgba(0, 0, 0, .22), 0 3px 0 2px color-mix(in srgb, var(--accent) 46%, #000), 0 7px 7px rgba(0, 0, 0, .35); }
.a-go::before { content: ''; margin-left: 4px; border-left: 12px solid var(--accent-text); border-top: 8px solid transparent; border-bottom: 8px solid transparent; }

/* ---------- badges ----------
   Each badge is a medal on a plaque: a striped ribbon hanging from a pin, a
   turned metal rim, and a struck disc sunk inside it. --m1 to --m4 are the
   metal, from its highlight to its darkest edge; --r1 to --r3 the ribbon. */
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 20px 14px; padding-bottom: 6px; }
.badge { --m1: #a3aec0; --m2: #717c90; --m3: #454f61; --m4: #252c38; --r1: #5b667a; --r2: #434d5e; --r3: #7b8699;
  position: relative; text-align: center; padding: 16px 12px 14px; border-radius: 18px; border: 1px solid var(--line); border-top-color: var(--hi);
  background: linear-gradient(180deg, rgba(255, 255, 255, .05), rgba(0, 0, 0, .16)), var(--panel); box-shadow: var(--bevel), 0 var(--wall) 0 var(--slab), var(--cast); }
.badge.got { --m1: #fff6c4; --m2: #f6c231; --m3: #b7791f; --m4: #6b3f06; --r1: #3b82f6; --r2: #1d4ed8; --r3: #fff;
  border-color: color-mix(in srgb, var(--star) 50%, transparent); border-top-color: color-mix(in srgb, var(--star) 60%, #fff);
  background: radial-gradient(90% 62% at 50% 0%, color-mix(in srgb, var(--star) 30%, transparent), transparent 76%), linear-gradient(180deg, rgba(255, 255, 255, .06), rgba(0, 0, 0, .12)), var(--panel); }
.badge.got.rb1 { --r1: #ef4444; --r2: #b91c1c; }
.badge.got.rb2 { --r1: #22c55e; --r2: #15803d; }
.badge.got.rb3 { --r1: #a855f7; --r2: #7e22ce; }
.badge.got.rb4 { --r1: #fb923c; --r2: #c2410c; }
.bmedal { position: relative; display: block; width: 84px; height: 106px; margin: 0 auto 8px; }
/* the pin the ribbon hangs from */
.bmedal::before { content: ''; position: absolute; z-index: 2; left: 0; right: 0; top: 0; height: 8px; border-radius: 4px;
  background: linear-gradient(180deg, var(--m1), var(--m2) 50%, var(--m3)); box-shadow: 0 1px 0 var(--m4), 0 3px 3px rgba(0, 0, 0, .4); }
/* two straps that lean in to meet behind the medal: the left one catches the light */
.m-rib::before, .m-rib::after { content: ''; position: absolute; top: 4px; width: 21px; height: 48px; transform-origin: 50% 100%;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 45%, rgba(0, 0, 0, .5)), linear-gradient(90deg, var(--r2) 0 20%, var(--r3) 20% 33%, var(--r1) 33% 67%, var(--r3) 67% 80%, var(--r2) 80%); }
.m-rib::before { left: 21px; transform: skewX(21deg); }
.m-rib::after { right: 21px; transform: skewX(-21deg);
  background: linear-gradient(180deg, rgba(0, 0, 0, .22) 45%, rgba(0, 0, 0, .6)), linear-gradient(90deg, var(--r2) 0 20%, var(--r3) 20% 33%, var(--r1) 33% 67%, var(--r3) 67% 80%, var(--r2) 80%); }
.m-disc { position: absolute; z-index: 1; left: 50%; bottom: 4px; width: 72px; height: 72px; margin-left: -36px; display: grid; place-items: center; border-radius: 50%;
  border: 7px solid transparent;
  background: radial-gradient(circle at 36% 28%, var(--m1), var(--m2) 52%, var(--m3)) padding-box,
    conic-gradient(from 205deg, var(--m3), var(--m1) 12%, var(--m2) 25%, var(--m3) 42%, var(--m1) 55%, var(--m2) 68%, var(--m3) 85%, var(--m1) 94%, var(--m3)) border-box;
  box-shadow: inset 0 3px 4px rgba(0, 0, 0, .38), inset 0 -2px 2px rgba(255, 255, 255, .55), 0 0 0 1px var(--m4), 0 4px 0 var(--m4), 2px 9px 10px rgba(0, 0, 0, .5); }
/* a medal that has been won has an enamel centre in its ribbon's colour, so the picture on it stands out from the gold */
.badge.got .m-disc { background: radial-gradient(circle at 36% 26%, color-mix(in srgb, var(--r1) 55%, #fff), var(--r1) 40%, var(--r2) 78%, color-mix(in srgb, var(--r2) 70%, #000)) padding-box,
    conic-gradient(from 205deg, var(--m3), var(--m1) 12%, var(--m2) 25%, var(--m3) 42%, var(--m1) 55%, var(--m2) 68%, var(--m3) 85%, var(--m1) 94%, var(--m3)) border-box;
  box-shadow: inset 0 3px 5px rgba(0, 0, 0, .5), inset 0 -2px 2px rgba(255, 255, 255, .35), 0 0 0 1px var(--m4), 0 4px 0 var(--m4), 2px 9px 10px rgba(0, 0, 0, .5); }
/* a glint on the rim, top left */
.badge.got .m-disc::after { content: ''; position: absolute; left: -3px; top: -5px; width: 34px; height: 20px; border-radius: 50%; transform: rotate(-34deg); pointer-events: none;
  background: radial-gradient(closest-side, rgba(255, 255, 255, .9), rgba(255, 255, 255, 0)); }
.b-icon { position: relative; display: block; font: 30px/1 var(--emoji); text-shadow: 0 2px 2px rgba(60, 30, 0, .4); }
.b-icon .spr { display: block; width: 30px; height: 30px; opacity: .75; }
.badge b { font: 600 16px var(--display); display: block; margin: 4px 0 2px; text-shadow: 0 1px 0 rgba(0, 0, 0, .4); }
.badge small { display: block; color: var(--muted); font-weight: 600; font-size: 13px; line-height: 1.35; }
.badge:not(.got) b { color: color-mix(in srgb, var(--text) 76%, transparent); }
.badge:not(.got) small { color: color-mix(in srgb, var(--muted) 84%, transparent); }
/* the date it was won, on a little engraved plate */
.badge em { display: inline-block; margin-top: 8px; padding: 1px 10px 2px; border-radius: 10px; font: 800 11px var(--font); color: #5a3200; text-shadow: 0 1px 0 rgba(255, 255, 255, .5);
  background: linear-gradient(180deg, #fff1b0, #f6c231 60%, #d99a17); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7), 0 2px 0 #8a5a12, 0 4px 4px rgba(0, 0, 0, .35); }

/* ---------- class leaderboard ----------
   Stacked plaques. First, second and third are bigger, edged in gold, silver
   and bronze, with a struck coin for the place number. */
.board-wrap { display: grid; grid-template-columns: minmax(0, 720px) minmax(280px, 1fr); gap: 26px; align-items: start; }
.board { display: flex; flex-direction: column; gap: 13px; max-width: 720px; padding-bottom: 6px; }

/* The winners' podium, beside the list. Three blocks seen from just above, so
   each shows its lit top (::before) as well as its front. The winner stands in
   the middle; two spotlights cross behind. --ph is a block's height. */
.podium { order: 2; position: relative; display: flex; align-items: flex-end; justify-content: center; height: 352px; padding: 0 16px 30px; overflow: hidden;
  border-radius: 20px; border: 1px solid var(--line); border-top-color: var(--hi);
  background: conic-gradient(from 146deg at 14% -8%, rgba(255, 255, 255, .11) 0 24deg, transparent 24deg),
    conic-gradient(from 190deg at 86% -8%, color-mix(in srgb, var(--accent) 20%, transparent) 0 24deg, transparent 24deg),
    linear-gradient(180deg, rgba(0, 0, 0, .36), rgba(0, 0, 0, .12) 72%, rgba(255, 255, 255, .06)), var(--panel);
  box-shadow: var(--bevel), 0 var(--wall) 0 var(--slab), var(--cast); }
/* the floor the blocks stand on, lit in the middle */
.podium::before { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 48px; border-top: 1px solid rgba(255, 255, 255, .2);
  background: radial-gradient(60% 100% at 50% 0%, rgba(255, 255, 255, .2), transparent 75%), linear-gradient(180deg, rgba(255, 255, 255, .1), rgba(0, 0, 0, .12)); }
.pod { --m1: #fff6c4; --m2: #f6c231; --m3: #b7791f; --m4: #6b3f06; --ph: 134px; --fc: #3b82f6;
  position: relative; flex: 1 1 0; min-width: 0; max-width: 126px; display: flex; flex-direction: column; align-items: center; }
.pod.p1 { z-index: 2; }
.pod.p2 { --m1: #ffffff; --m2: #cdd5e1; --m3: #6b7a90; --m4: #283445; --ph: 94px; --fc: #a855f7; }
.pod.p3 { --m1: #ffdfc0; --m2: #e08d4f; --m3: #8f4b1c; --m4: #4a2208; --ph: 64px; --fc: #10b981; }
.pod-who { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; max-width: 100%; margin-bottom: 4px; }
/* a name tag floating over each winner's head */
.pod-who b, .pod-who small { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; }
.pod-who b { order: -2; padding: 3px 10px 0; border-radius: 10px 10px 0 0; font: 600 15px/1.25 var(--display); background: rgba(0, 0, 0, .5); text-shadow: 0 1px 0 rgba(0, 0, 0, .5); }
.pod-who small { order: -1; min-width: 100%; margin-bottom: 9px; padding: 0 10px 3px; border-radius: 0 0 10px 10px; font: 700 12.5px/1.25 var(--display); color: var(--star); background: rgba(0, 0, 0, .5);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .14); }
.pod.p1 .pod-who small { margin-bottom: 30px; }
.pod.me .pod-who b { color: var(--accent); }
/* the winner: a domed counter with a metal rim, standing on the block */
.pod-face { position: relative; width: 54px; height: 54px; display: grid; place-items: center; border-radius: 50%; border: 5px solid transparent;
  font: 700 23px/1 var(--display); color: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, .35);
  background: radial-gradient(circle at 34% 26%, color-mix(in srgb, var(--fc) 42%, #fff), var(--fc) 52%, color-mix(in srgb, var(--fc) 46%, #000)) padding-box,
    conic-gradient(from 205deg, var(--m3), var(--m1) 12%, var(--m2) 25%, var(--m3) 42%, var(--m1) 55%, var(--m2) 68%, var(--m3) 85%, var(--m1) 94%, var(--m3)) border-box;
  box-shadow: inset 0 3px 4px rgba(0, 0, 0, .28), inset 0 -2px 2px rgba(255, 255, 255, .3), 0 0 0 1px var(--m4), 0 4px 0 var(--m4), 2px 8px 6px rgba(0, 0, 0, .45); }
.pod.p1 .pod-face { width: 68px; height: 68px; font-size: 30px; border-width: 6px; }
.pod.me .pod-face { box-shadow: inset 0 3px 4px rgba(0, 0, 0, .28), inset 0 -2px 2px rgba(255, 255, 255, .3), 0 0 0 1px var(--m4), 0 0 0 4px var(--accent), 0 0 16px 4px color-mix(in srgb, var(--accent) 70%, transparent),
    2px 8px 6px rgba(0, 0, 0, .45); }
.pod.p1 .pod-face::after { content: '👑'; position: absolute; left: 50%; top: -32px; margin-left: -15px; font: 30px/1 var(--emoji); text-shadow: 0 3px 3px rgba(0, 0, 0, .4);
  animation: crown 2.4s ease-in-out infinite alternate; }
@keyframes crown { to { transform: translateY(-4px) rotate(-7deg); } }
.pod-block { position: relative; width: 100%; height: var(--ph); margin-top: 13px; display: grid; place-items: center;
  background: linear-gradient(90deg, rgba(255, 255, 255, .34), rgba(255, 255, 255, 0) 24%, rgba(0, 0, 0, .05) 72%, rgba(0, 0, 0, .3)), linear-gradient(180deg, var(--m2), var(--m3));
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .6), inset 0 -4px 0 rgba(0, 0, 0, .22), 5px 10px 9px -5px rgba(0, 0, 0, .7); }
/* the top of the block, narrowing away from us, with the winner's shadow on it */
.pod-block::before { content: ''; position: absolute; left: 0; right: 0; bottom: 100%; height: 13px; clip-path: polygon(10px 0, calc(100% - 10px) 0, 100% 100%, 0 100%);
  background: radial-gradient(34% 70% at 52% 40%, rgba(0, 0, 0, .4), transparent), linear-gradient(180deg, var(--m2), var(--m1)); }
/* the tall block shades the one to its right */
.pod.p3 .pod-block { background: linear-gradient(90deg, rgba(0, 0, 0, .34), rgba(0, 0, 0, 0) 30%, rgba(0, 0, 0, .05) 72%, rgba(0, 0, 0, .3)), linear-gradient(180deg, var(--m2), var(--m3)); }
/* the place number, pressed into the front */
.pod-block i { font: 700 52px/1 var(--display); color: color-mix(in srgb, var(--m4) 72%, transparent); text-shadow: 0 2px 0 rgba(255, 255, 255, .42); }
.pod.p3 .pod-block i { font-size: 40px; }
.b-row { --w: 5px; --bc: var(--accent); position: relative; display: flex; align-items: center; gap: 14px; padding: 9px 16px 10px 11px; border-radius: 16px; font-weight: 700;
  border: 1px solid var(--line); border-top-color: var(--hi);
  background: linear-gradient(180deg, rgba(255, 255, 255, .1), rgba(255, 255, 255, 0) 60%, rgba(0, 0, 0, .14)), var(--panel);
  box-shadow: var(--bevel), 0 var(--w) 0 var(--slab), 0 calc(var(--w) + 3px) 5px rgba(0, 0, 0, .28), 3px calc(var(--w) + 10px) 18px rgba(0, 0, 0, .32); }
.b-rank { position: relative; flex: none; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; font: 700 18px/1 var(--display); color: var(--text);
  background: rgba(0, 0, 0, .42); box-shadow: inset 0 2px 4px rgba(0, 0, 0, .65), 0 1px 0 rgba(255, 255, 255, .2); }
.b-row.r1 { --m1: #fff6c4; --m2: #f6c231; --m3: #b7791f; --m4: #6b3f06; }
.b-row.r2 { --m1: #ffffff; --m2: #cdd5e1; --m3: #6b7a90; --m4: #283445; }
.b-row.r3 { --m1: #ffdfc0; --m2: #e08d4f; --m3: #8f4b1c; --m4: #4a2208; }
.b-row:is(.r1, .r2, .r3) { --bc: var(--m2); border-color: color-mix(in srgb, var(--m2) 55%, transparent); border-top-color: color-mix(in srgb, var(--m1) 80%, transparent);
  background: linear-gradient(100deg, color-mix(in srgb, var(--m2) 34%, transparent), transparent 46%), linear-gradient(180deg, rgba(255, 255, 255, .1), rgba(255, 255, 255, 0) 60%, rgba(0, 0, 0, .14)), var(--panel); }
.b-row:is(.r1, .r2, .r3) .b-rank { width: 44px; height: 44px; border: 5px solid transparent; color: var(--m4); font-size: 20px; text-shadow: 0 1px 0 rgba(255, 255, 255, .65);
  background: radial-gradient(circle at 36% 28%, var(--m1), var(--m2) 55%, var(--m3)) padding-box,
    conic-gradient(from 205deg, var(--m3), var(--m1) 12%, var(--m2) 25%, var(--m3) 42%, var(--m1) 55%, var(--m2) 68%, var(--m3) 85%, var(--m1) 94%, var(--m3)) border-box;
  box-shadow: inset 0 2px 3px rgba(0, 0, 0, .35), inset 0 -1px 1px rgba(255, 255, 255, .6), 0 0 0 1px var(--m4), 0 3px 0 var(--m4), 2px 7px 8px rgba(0, 0, 0, .45); }
.b-row.r1 { padding: 13px 18px 14px 13px; font-size: 19px; }
.b-row.r1 .b-rank { width: 54px; height: 54px; font-size: 25px; border-width: 6px; }
.b-row.r1 .b-rank::after { content: '👑'; position: absolute; left: -11px; top: -21px; font: 22px/1 var(--emoji); transform: rotate(-24deg); text-shadow: 0 2px 2px rgba(0, 0, 0, .4); }
.b-row.r2 { padding: 11px 17px 12px 12px; font-size: 17.5px; }
.b-row.r2 .b-rank { width: 48px; height: 48px; font-size: 22px; }
.b-row.me { border-color: var(--accent);
  box-shadow: var(--bevel), 0 0 0 2px var(--accent), 0 var(--w) 0 2px color-mix(in srgb, var(--accent) 40%, #000), 0 0 24px color-mix(in srgb, var(--accent) 45%, transparent),
    3px calc(var(--w) + 10px) 18px rgba(0, 0, 0, .32); }
.b-who { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.b-name { display: flex; align-items: center; gap: 8px; text-shadow: 0 1px 0 rgba(0, 0, 0, .4); }
.b-you { padding: 1px 8px 2px; border-radius: 9px; font: 800 10.5px var(--font); text-transform: uppercase; letter-spacing: .08em; color: var(--accent-text);
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 70%, #fff), var(--accent)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6), 0 2px 0 color-mix(in srgb, var(--accent) 50%, #000); }
/* how far each pupil is towards the leader's XP: a glossy tube in a groove */
.b-bar { display: block; height: 10px; padding: 2px; border-radius: 5px; background: rgba(0, 0, 0, .5); box-shadow: inset 0 2px 2px rgba(0, 0, 0, .7), 0 1px 0 rgba(255, 255, 255, .14); }
.b-bar i { display: block; height: 100%; min-width: 6px; border-radius: 3px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .7), rgba(255, 255, 255, .1) 50%, rgba(0, 0, 0, .25)), var(--bc); }
.b-lvl { flex: none; padding: 2px 10px; border-radius: 10px; color: var(--muted); font-size: 12.5px; background: rgba(0, 0, 0, .32); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .55), 0 1px 0 rgba(255, 255, 255, .12); }
.b-xp { flex: none; min-width: 84px; text-align: right; font: 700 20px var(--display); color: var(--star); text-shadow: 0 2px 0 rgba(0, 0, 0, .45); }
.b-xp small { font: 800 11px var(--font); opacity: .85; }

/* ---------- stats ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px; text-align: center; }
.tile span { font-size: 28px; display: block; }
.tile b { font: 600 24px var(--display); display: block; }
.tile small { color: var(--muted); font-weight: 700; }
.tiles.small .tile { padding: 10px; }
.tiles.small .tile b { font-size: 19px; }
/* a pupil's tile is a thick slab, lit from above in its own colour (--tc), with its icon on a domed token */
:where(body:not([data-skin="teacher"])) .tiles { gap: 16px 14px; margin-bottom: 26px; }
:where(body:not([data-skin="teacher"])) .tile { --tc: var(--accent2); border-radius: 18px; padding: 14px 10px 12px; border-top-color: var(--hi);
  background: radial-gradient(95% 72% at 50% 0%, color-mix(in srgb, var(--tc) 34%, transparent), transparent 76%), var(--sheen), var(--panel);
  box-shadow: var(--bevel), 0 var(--wall) 0 var(--slab), var(--cast); }
:where(body:not([data-skin="teacher"])) .tile span { width: 52px; height: 52px; margin: 0 auto 7px; display: grid; place-items: center; border-radius: 50%;
  font: 27px/1 var(--emoji); text-shadow: 0 2px 2px rgba(0, 0, 0, .35);
  background: radial-gradient(circle at 34% 26%, color-mix(in srgb, var(--tc) 28%, #fff), var(--tc) 55%, color-mix(in srgb, var(--tc) 45%, #000));
  box-shadow: inset 0 2px 2px rgba(255, 255, 255, .65), inset 0 -5px 7px rgba(0, 0, 0, .28), 0 0 0 2px rgba(255, 255, 255, .22), 0 4px 0 2px color-mix(in srgb, var(--tc) 32%, #000), 0 8px 9px rgba(0, 0, 0, .42); }
:where(body:not([data-skin="teacher"])) .tile b { font-size: 26px; line-height: 1.15; text-shadow: 0 2px 0 rgba(0, 0, 0, .4); }
.tc0 { --tc: #38bdf8; } .tc1 { --tc: #a78bfa; } .tc2 { --tc: #2dd4bf; } .tc3 { --tc: #4ade80; } .tc4 { --tc: #fbbf24; } .tc5 { --tc: #f472b6; } .tc6 { --tc: #fb923c; }

/* Minutes practised: blocks standing in a sunken tray. Each block has a front
   face, a lit top (::before) and a shaded right side (::after), both 8px deep. */
.bars { position: relative; display: flex; align-items: stretch; height: 210px; padding: 16px 8px 0 14px; border-radius: 14px; border: 1px solid;
  border-color: rgba(0, 0, 0, .5) rgba(0, 0, 0, .25) var(--hi) rgba(0, 0, 0, .25); background: rgba(0, 0, 0, .3); box-shadow: inset 0 3px 8px rgba(0, 0, 0, .5); }
/* faint height lines, and the floor the blocks stand on */
.bars::before { content: ''; position: absolute; left: 8px; right: 8px; top: 16px; bottom: 30px; border-bottom: 2px solid rgba(255, 255, 255, .28);
  background: repeating-linear-gradient(180deg, rgba(255, 255, 255, .09) 0 1px, transparent 1px 25%); pointer-events: none; }
.bar { position: relative; flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.bar em { flex: none; margin-bottom: 12px; font: 700 13px/1 var(--display); color: var(--text); text-shadow: 0 1px 2px #000; }
.bar i { position: relative; flex: 0 1 auto; display: block; width: 62%; max-width: 46px; min-height: 0; margin-right: 8px;
  background: linear-gradient(90deg, rgba(255, 255, 255, .28), rgba(255, 255, 255, 0) 30%, rgba(0, 0, 0, .12)), linear-gradient(180deg, var(--accent), var(--accent2));
  box-shadow: 9px 3px 7px -3px rgba(0, 0, 0, .55); }
.bar i::before { content: ''; position: absolute; left: 0; right: 0; bottom: 100%; height: 8px; transform-origin: 0 100%; transform: skewX(-45deg);
  background: color-mix(in srgb, var(--accent) 52%, #fff); }
.bar i::after { content: ''; position: absolute; top: 0; bottom: 0; left: 100%; width: 8px; transform-origin: 0 0; transform: skewY(-45deg);
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 50%, #000), color-mix(in srgb, var(--accent2) 42%, #000)); }
/* a day with nothing: just an empty tile on the floor */
.bar.zero i { box-shadow: none; }
.bar.zero i::before { background: rgba(255, 255, 255, .13); }
.bar.zero i::after { display: none; }
.bar small { flex: none; height: 30px; display: grid; place-items: center; color: var(--muted); font-size: 12px; font-weight: 800; }
.bar.today small { color: var(--text); }
.bar.today small::after { content: ''; position: absolute; bottom: 3px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 6px var(--accent); }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { padding: 7px 9px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.tbl th { color: var(--muted); font-size: 12.5px; font-weight: 800; }
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--card); margin-bottom: 10px; }
.tablewrap.short { max-height: 320px; overflow-y: auto; }
.st-tbl th { text-transform: uppercase; letter-spacing: .05em; font-size: 11.5px; }
.st-tbl td { font-weight: 700; }
.st-tbl tbody tr:nth-child(odd) td { background: rgba(255, 255, 255, .045); }
.st-stars .ico { width: 19px; height: 19px; margin-right: 5px; vertical-align: -4px; }
.st-n { display: inline-block; min-width: 3.3em; }
/* how many of a stage's twelve stars have been won: a gold tube in a groove */
.st-bar { display: inline-block; vertical-align: 0; width: 96px; height: 11px; padding: 2px; border-radius: 6px; background: rgba(0, 0, 0, .5); box-shadow: inset 0 2px 2px rgba(0, 0, 0, .7), 0 1px 0 rgba(255, 255, 255, .14); }
.st-bar i { display: block; height: 100%; min-width: 6px; border-radius: 4px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .75), rgba(255, 255, 255, .1) 50%, rgba(0, 0, 0, .22)), linear-gradient(90deg, #f59e0b, var(--star)); }

/* ---------- toasts ---------- */
#toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 100; align-items: center; }
.toast { background: #111827f0; color: #fff; padding: 10px 18px; border-radius: 30px; font-weight: 700; box-shadow: 0 8px 30px #0006; animation: up .25s ease-out;
  display: flex; align-items: center; gap: 8px; transition: opacity .4s, transform .4s; }
.toast.out { opacity: 0; transform: translateY(10px); }
.t-icon { font-size: 26px; }
@keyframes up { from { transform: translateY(16px); opacity: 0; } }
/* a pupil's toast is a glossy pill floating high over the page */
:where(body:not([data-skin="teacher"])) #toasts { bottom: 24px; gap: 14px; }
:where(body:not([data-skin="teacher"])) .toast { padding: 9px 22px 10px 16px; border: 1px solid rgba(255, 255, 255, .22); border-top-color: rgba(255, 255, 255, .6); text-shadow: 0 1px 1px rgba(0, 0, 0, .55);
  background: linear-gradient(180deg, rgba(255, 255, 255, .26), rgba(255, 255, 255, .04) 48%, rgba(0, 0, 0, .2)), color-mix(in srgb, var(--btn) 62%, #0a0f1f);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .3), 0 4px 0 var(--slab), 0 0 0 1px rgba(0, 0, 0, .45), 0 0 20px color-mix(in srgb, var(--accent) 30%, transparent), var(--shadow-3); }
:where(body:not([data-skin="teacher"])) .t-icon { width: 38px; height: 38px; margin: -2px 2px -2px -8px; display: grid; place-items: center; border-radius: 50%; font: 21px/1 var(--emoji);
  /* a pearl face, so that any badge's picture shows up on it, in a gold rim */
  border: 3px solid transparent; background: radial-gradient(circle at 34% 26%, #ffffff, #e9edf8 50%, #aab4cf) padding-box,
    conic-gradient(from 205deg, #b7791f, #fff6c4 12%, #f6c231 25%, #b7791f 42%, #fff6c4 55%, #f6c231 68%, #b7791f 85%, #fff6c4 94%, #b7791f) border-box;
  box-shadow: inset 0 2px 3px rgba(0, 0, 0, .3), 0 0 0 1px #6b3f06, 0 3px 0 #6b3f06, 0 5px 5px rgba(0, 0, 0, .45); }

/* ---------- practice ----------
   Arcade tiles: a lit sign across the top in the game's own colours (--c1 to
   --c2), the icon on a big token, and a wide start button. */
.pc-level { margin-top: -6px; }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 20px 16px; margin-bottom: 30px; }
.pcard { --c1: #22d3ee; --c2: #2563eb; position: relative; display: flex; flex-direction: column; gap: 6px; padding: 0 16px 22px; border-radius: 20px; border: 1px solid var(--line); border-top: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, .07), rgba(0, 0, 0, .12)), var(--panel);
  box-shadow: inset 0 -2px 0 var(--lo), 0 7px 0 var(--slab), 0 10px 6px rgba(0, 0, 0, .28), 3px 22px 28px rgba(0, 0, 0, .38); transition: transform .12s; }
.pcard:hover { transform: translateY(-3px); }
.pck-endless { --c1: #c084fc; --c2: #db2777; }
.pck-keys { --c1: #fbbf24; --c2: #dc2626; }
.pck-custom { --c1: #4ade80; --c2: #0d9488; }
.pc-top { position: relative; display: grid; place-items: center; height: 108px; margin: 0 -17px 10px; overflow: hidden; border-radius: 20px 20px 0 0;
  background: radial-gradient(75% 110% at 14% 0%, rgba(255, 255, 255, .55), transparent 62%), repeating-linear-gradient(118deg, rgba(255, 255, 255, .09) 0 14px, transparent 14px 28px),
    linear-gradient(135deg, var(--c1), var(--c2));
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .6), inset 0 -6px 0 rgba(0, 0, 0, .28), 0 5px 8px rgba(0, 0, 0, .4); }
.pc-icon { width: 70px; height: 70px; margin-top: -4px; display: grid; place-items: center; border-radius: 50%; font: 38px/1 var(--emoji); text-shadow: 0 2px 2px rgba(0, 0, 0, .25);
  background: radial-gradient(circle at 34% 26%, #ffffff, #e9edf8 48%, #a9b3cf);
  box-shadow: inset 0 -5px 8px rgba(0, 0, 0, .2), 0 0 0 4px rgba(255, 255, 255, .32), 0 5px 0 4px rgba(0, 0, 0, .26), 3px 13px 12px rgba(0, 0, 0, .4); }
.pcard > b { font: 600 21px var(--display); text-shadow: 0 2px 0 rgba(0, 0, 0, .35); }
.pcard p { color: color-mix(in srgb, var(--text) 62%, var(--muted)); font-weight: 600; font-size: 14px; flex: 1; margin: 0; }
.pcard .btn { align-self: stretch; margin-top: 10px; }
/* the best score, on a little display set into the tile */
.pc-best { padding: 7px 11px; border-radius: 10px; font-weight: 700; font-size: 14px; background: rgba(0, 0, 0, .34); border: 1px solid; border-color: rgba(0, 0, 0, .5) rgba(0, 0, 0, .2) var(--hi) rgba(0, 0, 0, .2);
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, .5); }
.pc-best b { font: inherit; color: var(--star); }
.pcard .pc-keys { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 0 2px; }
.pcard .pc-keys span { display: flex; flex-direction: column; align-items: center; }
.pcard .pc-keys small { font-size: 11px; color: var(--muted); font-weight: 700; }
.pcard .pc-keys kbd { font-size: 1.1em; }
.pc-tiles { max-width: 580px; }
/* the key picker: keycaps tinted in the colour of the finger that presses them (--fc), as on the on-screen keyboard */
/* --kw is the width of one key: 48px, or less when the widest row (11 keys, their gaps and its half-key shift) would not fit a narrow screen */
.picker { --kw: min(48px, calc((100vw - 64px) / 12.9)); display: flex; flex-direction: column; gap: calc(var(--kw) * .2); align-items: center; margin: 14px 0 12px; }
.pk-row { display: flex; gap: calc(var(--kw) * .14); }
.pk-row:nth-child(2) { margin-left: calc(var(--kw) * .46); } .pk-row:nth-child(3) { margin-left: calc(var(--kw) * .92); }
.pk, .pk-legend span { --fc: #94a3b8; }
.pk.f-lp, .pk.f-rp, .pk-legend .f-lp { --fc: #f472b6; } .pk.f-lr, .pk.f-rr, .pk-legend .f-lr { --fc: #fb923c; }
.pk.f-lm, .pk.f-rm, .pk-legend .f-lm { --fc: #facc15; } .pk.f-li, .pk-legend .f-li { --fc: #4ade80; } .pk.f-ri, .pk-legend .f-ri { --fc: #38bdf8; }
.pk { width: var(--kw); height: max(38px, calc(var(--kw) * .96)); padding: 0 0 3px; border: 0; border-radius: 10px; color: #fff; font: 700 18px var(--mono); cursor: pointer; text-shadow: 0 1px 1px rgba(0, 0, 0, .55);
  background: linear-gradient(180deg, rgba(255, 255, 255, .26), rgba(255, 255, 255, 0) 60%), color-mix(in oklab, var(--fc) 40%, var(--keycap));
  box-shadow: inset 0 1.5px 0 var(--hi-strong), inset 0 -4px 0 color-mix(in srgb, var(--fc) 85%, transparent), 0 5px 0 color-mix(in srgb, var(--fc) 34%, #05070f), 0 8px 7px rgba(0, 0, 0, .4);
  transition: transform .08s; }
.pk:hover { transform: translateY(-2px); }
/* a chosen key is pushed in and lit in its finger's colour */
.pk.on { transform: translateY(4px); color: #10131c; text-shadow: 0 1px 0 rgba(255, 255, 255, .5);
  background: linear-gradient(180deg, color-mix(in srgb, var(--fc) 45%, #fff), var(--fc) 62%, color-mix(in srgb, var(--fc) 85%, #000));
  box-shadow: inset 0 2px 3px color-mix(in srgb, var(--fc) 45%, #000), inset 0 -1px 0 rgba(255, 255, 255, .5), 0 1px 0 color-mix(in srgb, var(--fc) 40%, #000), 0 0 4px var(--fc), 0 0 16px var(--fc); }
.pk-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; justify-content: center; margin-bottom: 14px; color: var(--muted); font-size: 12px; font-weight: 800; }
.pk-legend span::before { content: ''; display: inline-block; width: 11px; height: 11px; margin-right: 5px; vertical-align: -1px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, var(--fc) 50%); box-shadow: 0 1px 2px rgba(0, 0, 0, .6); }
.pk-quick, .pk-games { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: center; margin-bottom: 16px; }
.ov-big { margin: 6px 0 4px; }
.ov-big b { display: block; font: 700 64px var(--display); line-height: 1; color: var(--star); }
.ov-big small { color: var(--muted); font-weight: 800; }
.speedtest .race-text { max-height: 46vh; min-height: 200px; font-size: 26px; }
.bigclock { text-align: center; font: 700 56px var(--display); color: var(--accent); }
.bigclock.low { color: var(--bad); animation: blink 1s steps(2) infinite; }
.bigclock.waiting { font-size: 20px; color: var(--muted); padding: 22px 0; }

/* ---------- "closed for now" (a school whose licence has run out) ---------- */
.lock-disc { width: 98px; height: 98px; margin: 0 auto 6px; display: grid; place-items: center; border-radius: 50%; border: 8px solid transparent;
  background: radial-gradient(circle at 36% 28%, #f1f5f9, #9aa7ba 55%, #55627a) padding-box,
    conic-gradient(from 205deg, #55627a, #f8fafc 12%, #a3aec0 25%, #55627a 42%, #f8fafc 55%, #a3aec0 68%, #55627a 85%, #f8fafc 94%, #55627a) border-box;
  box-shadow: inset 0 3px 5px rgba(0, 0, 0, .4), inset 0 -2px 2px rgba(255, 255, 255, .6), 0 0 0 1px #1e293b, 0 6px 0 #1e293b, 3px 14px 16px rgba(0, 0, 0, .5); }
.lock-disc .spr { display: block; width: 54px; height: 54px; }

/* ---------- smaller screens ---------- */
@media (max-width: 720px) {
  .topbar .me { margin-left: 0; order: 3; width: 100%; }
  .xpbar { width: 100%; }
  .me-info { flex: 1; }
  .grid2 { grid-template-columns: 1fr; }
  .hero-title h1 { font-size: 36px; }
  /* the game boxes lie on their sides: cover on the left, label on the right */
  .skinpick { grid-template-columns: 1fr; gap: 18px; }
  .skincard { flex-direction: row; }
  .sc-art { width: 104px; height: auto; min-height: 84px; flex: none; border-radius: 16px 0 0 16px; }
  .sc-label { justify-content: center; text-align: left; padding: 10px 14px; border-radius: 0 16px 16px 0; }
  .mission { flex-wrap: wrap; gap: 14px; padding: 14px 16px 18px; }
  .mission .m-icon { width: 60px; height: 60px; font-size: 30px; }
  .mission > .btn { width: 100%; }
  /* the words keep the first row to themselves; the star tally and the button drop below */
  .mission > div:nth-child(2) { flex-basis: calc(100% - 80px); }
  .mission::after { right: -4%; font-size: 130px; }
  .mission > .m-mark { right: -4%; width: 130px; height: 130px; }
  .m-tally { margin-left: 74px; padding: 4px 14px 4px 7px; font-size: 15px; }
  .m-tally b { font-size: 22px; }
  .m-tally .ico { width: 30px; height: 30px; }
  .stage-head { padding: 20px 18px 22px; gap: 12px; }
  .stage-head .w-icon { width: 56px; height: 56px; font-size: 31px; }
  .stage-head h2 { font-size: 25px; }
  .sh-total { position: absolute; right: 16px; bottom: 12px; }
  .act { gap: 9px; padding: 9px 10px 10px; }
  .a-step { display: none; }
  .a-icon { width: 42px; height: 42px; font-size: 24px; }
  .a-st .ico { width: 21px; height: 21px; }
  .a-go { width: 32px; height: 32px; }
  .b-row { gap: 10px; }
  .st-bar { display: none; }
  .b-lvl { display: none; }
  .b-xp { min-width: 0; }
  .bars { padding-left: 8px; }
  .bar i { margin-right: 6px; }
  .pk { font-size: 14px; border-radius: 8px; }
  :where(body:not([data-skin="teacher"])) .modal { --mp: 18px; }
  /* the tabs become one row of square buttons, icon over label, like an app's bar */
  :where(body:not([data-skin="teacher"])) .tabs { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; padding: 7px 7px 11px; }
  :where(body:not([data-skin="teacher"])) .tab { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 2px 7px; font-size: 12px; line-height: 1.2; white-space: nowrap; }
  :where(body:not([data-skin="teacher"])) .tab-i { font-size: 20px; line-height: 1.15; }
  /* an activity: icon, then its name and help with the stars under them, then Go */
  .act { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 5px 10px; padding: 10px 11px 11px; }
  .a-icon { grid-area: 1 / 1 / 3 / 2; }
  .a-text { grid-area: 1 / 2; }
  .a-stars { grid-area: 2 / 2; display: flex; align-items: center; gap: 8px; text-align: left; }
  .a-go { grid-area: 1 / 3 / 3 / 4; }
}
/* the podium moves above the list when there is no room beside it */
@media (max-width: 900px) {
  .board-wrap { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .board { max-width: none; }
  .podium { order: 0; height: 330px; }
}

/* phones: the star tally gets its own strip under the stage name instead of covering it */
@media (max-width: 720px) { .stage-head { padding-bottom: 50px; } }

/* phones: the Stages table fits its card instead of pushing the page sideways */
@media (max-width: 720px) { .st-tbl th, .st-tbl td { padding: 6px 4px; white-space: normal; font-size: 13px; } }

/* Chrome 110 and older (some school Chromebooks are frozen there) do not know color-mix():
   give the parts that must stay readable plain colours. Newer browsers skip this block. */
@supports not (color: color-mix(in srgb, #000, #fff)) {
  .btn.primary { background: var(--accent); }
  :where(body:not([data-skin="teacher"])) .tab.on { background: var(--accent); }
  .b-you { background: var(--accent); }
  .b-row.r1, .b-row.r2, .b-row.r3, .mission { background: var(--panel); }
  .n-flag b { background: var(--f); }
}
.modal:focus { outline: none; }

/* ---------- typing assessment ---------- */
/* a rank's emblem: a drawn badge, or a stand-in character */
.rank-em { flex: none; display: inline-grid; place-items: center; width: 58px; height: 58px; font: 40px/1 var(--emoji); }
.rank-em .spr { display: block; width: 100%; height: 100%; }
.rank-em.big { width: 112px; height: 112px; font-size: 78px; }
.rank-em.huge { width: 132px; height: 132px; font-size: 92px; }
.rank-em.empty { border-radius: 50%; border: 4px dashed rgba(255, 255, 255, .3); color: rgba(255, 255, 255, .45); font: 600 54px/1 var(--display); }
/* the pupil's rank across the top: the homework banner's card, with the emblem where its coin goes */
.as-hero { gap: 20px; padding: 16px 24px 18px; margin-bottom: 12px; }
.as-hero .as-rank { flex: none; display: grid; place-items: center; }
.as-hero .as-me { flex: 1; min-width: 0; }
.as-hero .as-me small { display: block; color: var(--muted); font-weight: 800; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.as-hero .as-me b { display: block; font-size: 30px; line-height: 1.15; }
.as-hero .as-me p { margin-top: 5px; }
.as-hero .as-me strong { color: var(--text); }
.as-go { flex: none; display: flex; flex-direction: column; align-items: center; gap: 7px; }
.as-go small { color: var(--muted); font-weight: 700; font-size: 12.5px; }
.as-note { margin: 0 4px 16px; max-width: 900px; }
/* the nine ranks, slowest on the left */
.as-card h3 { margin-bottom: 12px; }
.as-ladder { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 8px; }
.as-step { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 12px 4px 10px; border-radius: 16px; border: 2px solid transparent; text-align: center; }
.as-step b { font-size: 12.5px; line-height: 1.2; font-weight: 800; min-height: 2.4em; display: grid; place-items: center; }
.as-step small { color: var(--muted); font-weight: 700; font-size: 11px; }
.as-step.todo .rank-em { opacity: .4; }
.as-step.todo b { color: var(--muted); }
.as-step.got { background: rgba(255, 255, 255, .05); }
.as-step.me { border-color: var(--accent); background: rgba(255, 255, 255, .1); box-shadow: 0 0 18px rgba(0, 0, 0, .35), inset 0 0 0 1px rgba(255, 255, 255, .12); }
.as-step.me .rank-em { transform: scale(1.12); }
.as-step.next { border-color: rgba(255, 255, 255, .22); border-style: dashed; }
.as-step.next .rank-em { opacity: .7; }
.as-step em { margin-top: 3px; padding: 2px 8px 3px; border-radius: 10px; font: 800 10.5px/1.3 var(--font); font-style: normal; color: var(--accent-text, #04121a); background: var(--accent); white-space: nowrap; }
.as-step em.go { color: var(--text); background: rgba(255, 255, 255, .16); }
.as-hist .bars { height: 190px; }
.as-hist .bar small { font-size: 11px; white-space: nowrap; }
@media (max-width: 1180px) { .as-ladder { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); } }
@media (max-width: 720px) {
  .as-hero { flex-wrap: wrap; gap: 12px; padding: 14px 16px 16px; }
  .as-hero .as-me { flex-basis: calc(100% - 130px); }
  .as-hero .as-me b { font-size: 24px; }
  .as-go { width: 100%; }
  .as-go .btn { width: 100%; }
  .rank-em.big { width: 92px; height: 92px; font-size: 62px; }
}

/* ===== map.css ===== */
/* ==========================================================================
   Touch Typing Quest - the world map (see map.js)

   Each world is a little diorama: a thick card (.world) with a picture set
   into it (.w-art), a raised road (.wpath-svg) and the stage stones (.node)
   standing on the road. One light, from the upper left: bright top and left
   edges, shadows falling down and a little to the right.
   ========================================================================== */
.worlds { display: flex; flex-direction: column; gap: 30px; padding-bottom: 12px; }

/* ---------- the card ---------- */
.world { position: relative; border-radius: 26px; padding: 12px 18px 12px; color: #fff; border: 5px solid transparent;
  --wd: color-mix(in srgb, var(--w1) 58%, #000);      /* the card's side wall, in shade */
  --wl: color-mix(in srgb, var(--w2) 55%, #fff);      /* its rim, where the light catches it */
  background: linear-gradient(135deg, var(--w1), var(--w2)) padding-box,
    linear-gradient(165deg, var(--wl), color-mix(in srgb, var(--w2) 82%, #000) 42%, color-mix(in srgb, var(--w1) 80%, #000)) border-box;
  box-shadow: 0 1px 0 var(--wd), 0 9px 0 var(--wd), 0 10px 0 rgba(0,0,0,.45), 0 16px 14px rgba(0,0,0,.3), 6px 26px 36px rgba(0,0,0,.42); }
/* the picture, set into the card */
.w-art { position: absolute; inset: 0; border-radius: 21px; overflow: hidden; pointer-events: none; }
.w-art::before { content: ''; position: absolute; inset: 0;                   /* the light in the upper left */
  background: radial-gradient(90% 120% at 0% 0%, rgba(255,255,255,.26), transparent 60%); }
.w-scene { position: absolute; right: 0; bottom: 0; max-width: none; opacity: .92;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 46px); mask-image: linear-gradient(to bottom, transparent, #000 46px); }
.w-art::after { content: ''; position: absolute; inset: 0; border-radius: inherit;   /* the rim's shadow on the picture, and the corners falling away */
  background: radial-gradient(120% 130% at 28% 12%, transparent 52%, rgba(0,0,0,.34));
  box-shadow: inset 0 6px 9px rgba(0,0,0,.42), inset 6px 0 9px rgba(0,0,0,.2), inset 0 -2px 0 rgba(255,255,255,.16), inset -2px 0 0 rgba(255,255,255,.08); }

/* ---------- the title plate ---------- */
.world header { position: relative; display: flex; align-items: center; gap: 12px; z-index: 1; }
.world .w-icon { flex: none; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font: 25px/1 var(--emoji);
  background: radial-gradient(circle at 34% 24%, rgba(255,255,255,.62), rgba(255,255,255,.14) 50%, rgba(0,0,0,.3));
  box-shadow: inset 0 2px 1px rgba(255,255,255,.6), inset 0 -4px 6px rgba(0,0,0,.28), 0 3px 0 rgba(0,0,0,.36), 2px 8px 10px rgba(0,0,0,.34); }
.world header small { display: block; color: rgba(255,255,255,.86); font-weight: 800; font-size: 12px; text-transform: uppercase; letter-spacing: .08em;
  text-shadow: 0 1px 2px rgba(0,0,0,.5); }
.world header b { display: block; font: 600 22px/1.15 var(--display); text-shadow: 0 1px 0 rgba(0,0,0,.35), 0 3px 5px rgba(0,0,0,.4); }
.w-stars { margin-left: auto; display: flex; align-items: center; gap: 5px; white-space: nowrap; background: rgba(0,0,0,.36); padding: 5px 10px 5px 13px;
  border-radius: 20px; color: var(--star); font-weight: 800; font-size: 14px; box-shadow: inset 0 2px 4px rgba(0,0,0,.5), 0 1px 0 rgba(255,255,255,.2); }
.w-stars .spr { width: 18px; height: 18px; flex: none; }

/* ---------- the road ---------- */
.wpath { position: relative; height: 150px; margin-top: 16px; }
.wpath-svg { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.wpath-svg path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.rd-shade { stroke: rgba(0,0,0,.15); stroke-width: 27; }
.rd-shade2 { stroke: rgba(0,0,0,.22); stroke-width: 20; }
.rd-wall { stroke: color-mix(in srgb, var(--w1) 40%, #000); stroke-width: 19; }
.rd-rim { stroke: color-mix(in srgb, var(--w2) 35%, #fff); stroke-width: 19; stroke-opacity: .75; }
.rd-top { stroke: color-mix(in srgb, var(--w1) 45%, #1d2540); stroke-width: 19; }
.rd-dot-lo { stroke: rgba(0,0,0,.5); stroke-width: 6.5; stroke-dasharray: .1 13.5; }
.rd-dot { stroke: rgba(255,255,255,.88); stroke-width: 5.5; stroke-dasharray: .1 13.5; }
.rd-bed { stroke: #6a4410; stroke-width: 19; }                /* travelled: a bronze bed, inlaid with gold */
.rd-glow { stroke: rgba(255,221,120,.38); stroke-width: 16; }
.rd-gold-lo { stroke: #8a4a06; stroke-width: 12; }
.rd-gold { stroke: #fbbf24; stroke-width: 9; }
.rd-gold-hi { stroke: #fffbeb; stroke-width: 3; stroke-opacity: .95; }

/* ---------- the stage stones ----------
   A stone is a short cylinder seen from a little above: .n-stone is its side
   wall, .n-cap the domed top that sits on it. Its colours come from the --s-*
   variables, so each state (open, done, current, locked) only swaps colours. */
.node { position: absolute; transform: translate(-50%, -29px); width: 116px; display: flex; flex-direction: column; align-items: center;
  background: none; border: 0; padding: 0; cursor: pointer; font-family: var(--font); color: #fff; z-index: 1; -webkit-tap-highlight-color: transparent;
  --th: calc(var(--wall) + 4px);                      /* how thick the stone is */
  --s-hi: #ffffff; --s-1: #e6ecf8; --s-2: #9aa9c8; --s-rim1: #ffffff; --s-rim2: #7786a8;
  --s-wall1: #b9c4dc; --s-wall2: #7d8aa9; --s-wall3: #4b5674; --s-ink: #1e293b; --s-lit: rgba(255,255,255,.75); }
.node:focus { outline: none; }
/* the shadow the stone casts on the card */
.node::before { content: ''; position: absolute; left: 50%; top: 37px; width: 84px; height: 46px; margin-left: -36px; border-radius: 50%; z-index: -1;
  pointer-events: none; background: radial-gradient(closest-side, rgba(0,0,0,.7), rgba(0,0,0,.4) 55%, transparent);
  transition: transform .15s, opacity .15s; }
.n-stone { position: relative; flex: none; width: 58px; height: calc(58px + var(--th)); border-radius: 29px;
  background: linear-gradient(90deg, var(--s-wall1), var(--s-wall2) 38%, var(--s-wall3));
  box-shadow: inset 0 -2px 2px rgba(0,0,0,.3), 0 1px 0 rgba(0,0,0,.4); transition: transform .15s; }
.n-cap { position: relative; display: grid; place-items: center; width: 58px; height: 58px; border-radius: 50%; border: 4px solid transparent;
  background: radial-gradient(circle at 36% 26%, var(--s-hi), var(--s-1) 44%, var(--s-2)) padding-box,
    linear-gradient(155deg, var(--s-rim1), var(--s-rim2)) border-box;
  box-shadow: inset 0 2px 2px rgba(255,255,255,.65), inset 0 -5px 7px rgba(0,0,0,.2), inset -2px -2px 2px rgba(255,255,255,.22), 0 1px 0 rgba(0,0,0,.3);
  font: 700 25px/1 var(--display); color: var(--s-ink); text-shadow: 0 1px 0 var(--s-lit); }
/* a groove just inside the rim, as on a minted coin */
.n-cap::after { content: ''; position: absolute; inset: 2px; border-radius: 50%; pointer-events: none;
  box-shadow: inset 0 1.5px 1px rgba(0,0,0,.2), inset 0 -1.5px 1px var(--s-lit); }
/* the glint on the dome */
.n-cap::before { content: ''; position: absolute; left: 6px; top: 3px; width: 21px; height: 11px; border-radius: 50%; transform: rotate(-30deg);
  background: radial-gradient(closest-side, rgba(255,255,255,.98), rgba(255,255,255,.5) 55%, rgba(255,255,255,0)); pointer-events: none; }
.node:hover .n-stone, .node:focus-visible .n-stone { transform: translateY(-5px); }
.node:hover::before, .node:focus-visible::before { transform: translate(5px, 7px) scale(1.18); opacity: .72; }
.node:focus-visible .n-cap { outline: 3px solid #fff; outline-offset: 2px; }
/* pressed: the stone sinks into the card */
.node:active .n-stone { transform: translateY(calc(var(--th) - 2px)); height: 60px; margin-bottom: calc(var(--th) - 2px); transition-duration: .05s; }
.node:active::before { transform: scale(.9); opacity: 1; }

/* done: a gold coin */
.node.done { --s-hi: #fffbe6; --s-1: #fcd34d; --s-2: #e58e0a; --s-rim1: #fff3b0; --s-rim2: #b45309;
  --s-wall1: #e79a12; --s-wall2: #b45309; --s-wall3: #7a2e0c; --s-ink: #7c2d12; --s-lit: rgba(255,251,235,.8); }
/* current homework: a beacon in the skin's accent colour */
.node.current { --s-hi: color-mix(in srgb, var(--accent) 30%, #fff); --s-1: var(--accent); --s-2: color-mix(in srgb, var(--accent) 62%, #000);
  --s-rim1: color-mix(in srgb, var(--accent) 35%, #fff); --s-rim2: color-mix(in srgb, var(--accent) 58%, #000);
  --s-wall1: color-mix(in srgb, var(--accent) 78%, #000); --s-wall2: color-mix(in srgb, var(--accent) 55%, #000); --s-wall3: color-mix(in srgb, var(--accent) 36%, #000);
  --s-ink: var(--accent-text); --s-lit: color-mix(in srgb, var(--accent) 45%, transparent); z-index: 2; }
.node.current .n-cap { background: radial-gradient(circle at 36% 26%, var(--s-hi), var(--s-1) 34%, var(--s-2)) padding-box,
  linear-gradient(155deg, var(--s-rim1), var(--s-rim2)) border-box; }
/* its glow on the card, and a ring that spreads out from it */
.node.current::after { content: ''; position: absolute; left: 50%; top: -28px; width: 124px; height: 124px; margin-left: -62px; border-radius: 50%; z-index: -1;
  pointer-events: none; background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 75%, transparent), color-mix(in srgb, var(--accent) 30%, transparent) 55%, transparent); }
.node.current .n-stone::after { content: ''; position: absolute; left: -3px; top: -3px; width: 64px; height: 64px; border-radius: 50%;
  border: 3px solid color-mix(in srgb, var(--accent) 60%, #fff); opacity: 0; pointer-events: none; animation: beacon 1.6s ease-out infinite; }
@keyframes beacon { 0% { transform: scale(1); opacity: .95; } 80%, 100% { transform: scale(1.75); opacity: 0; } }
/* rays of light turning slowly behind it */
.n-rays { position: absolute; left: 50%; top: 29px; width: 156px; height: 156px; margin: -78px 0 0 -78px; border-radius: 50%; z-index: -1; pointer-events: none;
  background: repeating-conic-gradient(transparent 0deg, color-mix(in srgb, var(--accent) 62%, #fff) 7deg, transparent 14deg, transparent 30deg);
  -webkit-mask-image: radial-gradient(closest-side, #000 34%, rgba(0,0,0,.5) 62%, transparent); mask-image: radial-gradient(closest-side, #000 34%, rgba(0,0,0,.5) 62%, transparent);
  opacity: .75; animation: rays 18s linear infinite; }
@keyframes rays { to { transform: rotate(360deg); } }
/* overdue: a warning ring round the foot of the stone */
.node.overdue .n-stone { box-shadow: inset 0 -2px 2px rgba(0,0,0,.3), 0 0 0 3px var(--warn), 0 0 0 5px rgba(0,0,0,.35); }
.node.overdue::after { content: ''; position: absolute; left: 50%; top: -22px; width: 112px; height: 112px; margin-left: -56px; border-radius: 50%; z-index: -1;
  pointer-events: none; background: radial-gradient(closest-side, color-mix(in srgb, var(--warn) 60%, transparent), transparent); }
/* locked: dull stone with a padlock, and nothing to press */
.node.locked { cursor: not-allowed; --s-hi: #98a1b3; --s-1: #6f7789; --s-2: #454b5a; --s-rim1: #a9b1c2; --s-rim2: #343946;
  --s-wall1: #5a6172; --s-wall2: #3c4250; --s-wall3: #23262f; --s-ink: #cbd5e1; --s-lit: transparent; }
.node.locked .n-cap { box-shadow: inset 0 2px 2px rgba(255,255,255,.3), inset 0 -5px 7px rgba(0,0,0,.28), 0 1px 0 rgba(0,0,0,.3); }
.node.locked .n-cap::before { opacity: .3; }
.node.locked:hover .n-stone, .node.locked:active .n-stone { transform: none; height: calc(58px + var(--th)); margin-bottom: 0; }
.node.locked:hover::before, .node.locked:active::before { transform: none; opacity: 1; }
.n-lock { width: 30px; height: 30px; }
.n-glyph { font-style: normal; font-size: 20px; }

/* ---------- the playing piece: stands on the furthest stage that is finished ---------- */
.n-pawn { position: absolute; left: 33px; top: -20px; width: 30px; height: 43px; z-index: 3; pointer-events: none; }
.n-pawn::before { content: ''; position: absolute; left: 3px; bottom: -3px; width: 30px; height: 11px; border-radius: 50%;      /* its shadow on the stone */
  background: radial-gradient(closest-side, rgba(40,12,0,.6), rgba(40,12,0,.3) 60%, transparent); }
.n-pawn svg { position: relative; display: block; width: 100%; height: 100%; overflow: visible; transform-origin: 50% 100%;
  animation: pawnhop .95s ease-in-out infinite alternate; }
.n-pawn .pw { fill: var(--accent); stroke: color-mix(in srgb, var(--accent) 38%, #000); stroke-width: 1.1; }
.n-pawn .pw-lo { fill: color-mix(in srgb, var(--accent) 72%, #000); stroke: color-mix(in srgb, var(--accent) 38%, #000); stroke-width: 1.1; }
@keyframes pawnhop { to { transform: translateY(-4px); } }

/* ---------- stars and name under each stone ---------- */
.n-stars { position: relative; margin-top: 5px; display: flex; gap: 0; line-height: 1; }
.n-stars::before { content: ''; position: absolute; inset: -2px -9px -3px; border-radius: 50%; z-index: -1;                    /* a patch of shade, so that the stars show on any picture */
  background: radial-gradient(closest-side, rgba(6,9,26,.5), rgba(6,9,26,.3) 60%, transparent); }
.n-stars .spr { width: 19px; height: 19px; flex: none; }
.n-stars .spr:nth-child(1) { transform: translateY(-3px) rotate(-14deg); }
.n-stars .spr:nth-child(2) { transform: scale(1.12); }
.n-stars .spr:nth-child(3) { transform: translateY(-3px) rotate(14deg); }
.n-stars .n-glyph { font-size: 15px; color: rgba(0,0,0,.4); }
.n-stars .n-glyph.on { color: var(--star); }
.node.locked .n-stars { opacity: .6; }
.n-name { margin-top: 3px; max-width: 100%; padding: 2px 8px 3px; border-radius: 9px; font-weight: 800; font-size: 12.5px; line-height: 1.15; text-align: center;
  background: rgba(7,10,28,.66); box-shadow: inset 0 1px 2px rgba(0,0,0,.5), 0 1px 0 rgba(255,255,255,.16); text-shadow: 0 1px 2px rgba(0,0,0,.6); }
.node.locked .n-name { color: rgba(255,255,255,.88); }

/* ---------- the "Homework" and "Overdue" ribbons ----------
   .n-flag b is the band across the front; the two tails (::before, ::after) are
   the ends of the ribbon folded back behind it, a little lower and in shade. */
.n-flag { position: absolute; top: -32px; left: 50%; z-index: 2; white-space: nowrap; transform: translateX(-50%); color: var(--accent-text);
  --f: var(--accent); --fd: color-mix(in srgb, var(--f) 55%, #000);
  animation: flagbob .8s ease-in-out infinite alternate; }
.n-flag b { position: relative; z-index: 1; display: block; padding: 3px 11px 4px; border-radius: 5px; font-size: 11.5px; font-weight: 800; letter-spacing: .02em; line-height: 1.25;
  background: linear-gradient(180deg, color-mix(in srgb, var(--f) 52%, #fff), var(--f) 46%, color-mix(in srgb, var(--f) 82%, #000));
  box-shadow: inset 0 1.5px 0 rgba(255,255,255,.75), inset 0 -1.5px 0 rgba(0,0,0,.18), 0 3px 0 var(--fd), 2px 9px 9px rgba(0,0,0,.45);
  text-shadow: var(--accent-ts); }
.n-flag b::after { content: ''; position: absolute; left: 50%; bottom: -9px; margin-left: -6px; border: 6px solid transparent; border-bottom: 0; border-top-color: var(--fd); }
.n-flag::before, .n-flag::after { content: ''; position: absolute; top: 7px; bottom: -7px; width: 18px; background-repeat: no-repeat; background-size: 8px 4px, auto;
  box-shadow: 2px 6px 6px rgba(0,0,0,.3); }
.n-flag::before { left: -10px; clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 6px 50%); background-position: right bottom, 0 0;
  background-image: linear-gradient(to bottom left, color-mix(in srgb, var(--f) 30%, #000) 50%, transparent 52%),
    linear-gradient(90deg, color-mix(in srgb, var(--f) 84%, #000), color-mix(in srgb, var(--f) 62%, #000)); }
.n-flag::after { right: -10px; clip-path: polygon(0 0, 100% 0, calc(100% - 6px) 50%, 100% 100%, 0 100%); background-position: left bottom, 0 0;
  background-image: linear-gradient(to bottom right, color-mix(in srgb, var(--f) 30%, #000) 50%, transparent 52%),
    linear-gradient(90deg, color-mix(in srgb, var(--f) 58%, #000), color-mix(in srgb, var(--f) 72%, #000)); }
.n-flag.warn { --f: var(--warn); color: #3b2500; }
.n-flag.warn b { text-shadow: 0 1px 0 rgba(255,255,255,.45); }
@keyframes flagbob { to { transform: translateX(-50%) translateY(-3px); } }

@media (max-width: 720px) {
  .world { padding: 10px 14px 10px; border-width: 4px; border-radius: 22px; }
  .w-art { border-radius: 18px; }
  .world .w-icon { width: 40px; height: 40px; font-size: 22px; }
  .world header b { font-size: 19px; }
  .node { width: 96px; }
  .n-name { font-size: 11.5px; padding: 2px 6px 3px; }
}

/* A prop that map.js has slid along to keep it out from under a stage's name
   glides to its new place when the window changes size (not at all for anyone
   who has asked for less motion: base.css switches transitions off). */
.w-scene .w-prop { transition: translate .35s ease; }

/* ===== keyboard.css ===== */
/* ==========================================================================
   Touch Typing Quest - the on-screen keyboard and hands (see keyboard.js)

   Drawn as real objects under one light, above and slightly to the left:
   a keyboard case with a sunken well, sculpted keycaps that show their side
   walls, and two gloved hands that cast a shadow on the desk.

   Each keycap is one element. Its ::after is the body (the walls you can see
   round the sides and along the front), its ::before is the dished top face.
   Pressing a key moves only those with transform: the face slides down and the
   body squashes, so the front wall gets thinner, as on a real key.
   ========================================================================== */
.kbwrap {
  --kc: var(--keycap, #334155);   /* the plastic the keys are made of */
  --kh: 40px;                     /* keycap height */
  --kgap: 5px;                    /* gap between keys */
  --ws: 3px;                      /* side wall you can see */
  --wf: 7px;                      /* front wall you can see */
  --rb: 9px; --rf: 6px;           /* corner radius of a key's body and of its top face */
  isolation: isolate;             /* keeps the z-indexes in here from reaching the rest of the page */
  background:
    radial-gradient(62% 50% at 50% 100%, rgba(255,255,255,.17), rgba(255,255,255,0) 100%),   /* light pooling on the desk under the hands */
    var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px 7px;
  box-shadow: var(--shadow-1), inset 0 1px 0 var(--hi);
}

/* the colour of the finger that presses a key: used by the keys, the fingers and the hint */
.kbwrap .f-lp, .kbwrap .f-rp { --fc: #f472b6; }
.kbwrap .f-lr, .kbwrap .f-rr { --fc: #fb923c; }
.kbwrap .f-lm, .kbwrap .f-rm { --fc: #facc15; }
.kbwrap .f-li { --fc: #4ade80; }
.kbwrap .f-ri { --fc: #38bdf8; }
.kbwrap .f-th { --fc: #a78bfa; }

/* ---------- the case ---------- */
.kb { --case: color-mix(in srgb, var(--kc) 70%, #0a0c16);
  position: relative; z-index: 0; display: flex; flex-direction: column; gap: var(--kgap);
  max-width: 790px; margin: 0 auto 13px; padding: 10px 11px 10px; border-radius: 16px;
  background:
    linear-gradient(100deg, rgba(255,255,255,.12), rgba(255,255,255,0) 30%, rgba(255,255,255,0) 70%, rgba(0,0,0,.2)),
    linear-gradient(180deg, color-mix(in srgb, var(--case) 78%, #fff), var(--case) 16%, color-mix(in srgb, var(--case) 78%, #000));
  box-shadow:
    inset 0 1px 0 var(--hi-strong), inset 1px 0 0 rgba(255,255,255,.14), inset -1px 0 0 rgba(0,0,0,.3),
    /* the front of the case, with a light bar let into it in the skin's colour */
    0 2px 0 color-mix(in srgb, var(--case) 74%, #000),
    0 4px 0 color-mix(in srgb, var(--accent) 82%, #fff),
    0 5px 0 color-mix(in srgb, var(--accent) 70%, #000),
    0 8px 0 color-mix(in srgb, var(--case) 46%, #000),
    0 9px 0 rgba(255,255,255,.08),
    0 12px 14px -3px color-mix(in srgb, var(--accent) 42%, transparent),      /* the bar's light on the desk */
    0 14px 10px rgba(0,0,0,.5), 4px 20px 22px rgba(0,0,0,.34); }
/* the well the keys sit in */
.kb::before { content: ''; position: absolute; left: 6px; right: 6px; top: 5px; bottom: 5px; border-radius: 11px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--kc) 22%, #05060b), color-mix(in srgb, var(--kc) 40%, #05060b));
  box-shadow: inset 0 3px 6px rgba(0,0,0,.75), inset 2px 0 4px rgba(0,0,0,.4), inset 0 0 0 1px rgba(0,0,0,.45),
    0 1px 0 rgba(255,255,255,.2), 1px 0 0 rgba(255,255,255,.07); }
.kb-row { display: flex; gap: var(--kgap); }

/* ---------- the keycaps ---------- */
.kb-key { --tint: color-mix(in srgb, var(--fc, var(--kc)) 32%, color-mix(in srgb, var(--kc) 58%, #07080f));   /* the top: a deep shade of its finger's colour (mixed into a darkened keycap, or yellow and orange turn to grey) */
  --side: color-mix(in srgb, var(--fc, var(--kc)) 70%, var(--kc));               /* the walls, strongly in that colour */
  flex: 1 1 0; min-width: 0; height: var(--kh); padding-bottom: var(--wf); position: relative; z-index: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font: 700 15px var(--mono); color: var(--text); text-shadow: 0 1px 1px rgba(0,0,0,.55); }
/* the body: side walls and front wall, with the shadow it drops on the well */
.kb-key::after { content: ''; position: absolute; left: 0; right: 0; top: 0; bottom: 0; z-index: 0; border-radius: calc(var(--rb) - 2px) calc(var(--rb) - 2px) var(--rb) var(--rb);
  background:
    linear-gradient(90deg, rgba(255,255,255,.3), rgba(255,255,255,0) 9%, rgba(0,0,0,0) 90%, rgba(0,0,0,.34)),
    linear-gradient(180deg, color-mix(in srgb, var(--side) 70%, #fff), var(--side) 14%, color-mix(in srgb, var(--side) 90%, #000) 78%, color-mix(in srgb, var(--side) 58%, #000));
  box-shadow: 0 1px 0 rgba(0,0,0,.7), 1px 3px 4px rgba(0,0,0,.6), 0 2px 7px color-mix(in srgb, var(--fc, transparent) 34%, transparent);
  transform-origin: 50% 100%; transition: transform .07s; }
/* the top face: lit along its top edge, with a shallow dish in the middle */
.kb-key::before { content: ''; position: absolute; left: var(--ws); right: var(--ws); top: 1px; bottom: var(--wf); z-index: 1; border-radius: var(--rf);
  background:
    radial-gradient(90% 80% at 14% 0, rgba(255,255,255,.26), rgba(255,255,255,0) 60%),                  /* gloss in the lit corner */
    radial-gradient(75% 70% at 50% 56%, rgba(0,0,0,.22), rgba(0,0,0,0)),                                /* the dish */
    linear-gradient(180deg, color-mix(in srgb, var(--tint) 78%, #fff), var(--tint) 50%, color-mix(in srgb, var(--tint) 84%, #000));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5), inset 1px 0 0 rgba(255,255,255,.2), inset 0 -1px 0 rgba(0,0,0,.3), inset -1px 0 0 rgba(0,0,0,.2);
  transition: transform .07s; }
.kb-key span, .kb-key small { z-index: 2; transition: transform .07s; }
.kb-key span { position: relative; }
.kb-key small { position: absolute; top: 3px; left: calc(var(--ws) + 4px); font-size: 11px; font-weight: 800; line-height: 1; opacity: 1; text-shadow: 0 1px 1px rgba(0,0,0,.8); }
.kb-key.gap { visibility: hidden; }
/* The UK Enter key is one tall key that steps in at the bottom. It is two keycaps here:
   the lower one reaches up under the upper one, and their faces are shaded to run into each other. */
.kb-key.enter::before { background:
    radial-gradient(90% 80% at 14% 0, rgba(255,255,255,.26), rgba(255,255,255,0) 60%),
    linear-gradient(180deg, color-mix(in srgb, var(--tint) 78%, #fff), var(--tint) 50%); }
.kb-key.enter2::after { top: calc(-1 * (var(--kgap) + var(--wf))); border-radius: 0 0 var(--rb) var(--rb); }
.kb-key.enter2::before { top: calc(-1 * (var(--kgap) + var(--wf) + 8px)); border-radius: 0 0 var(--rf) var(--rf);
  background: linear-gradient(180deg, var(--tint) 58%, color-mix(in srgb, var(--tint) 84%, #000));
  box-shadow: inset 0 -1px 0 rgba(0,0,0,.3), inset -1px 0 0 rgba(0,0,0,.2); }
/* Ctrl and Alt: part of a real keyboard, but not part of the course, so they stay in the background */
.kb-key.dull { --tint: color-mix(in srgb, var(--kc) 62%, #090b14); --side: color-mix(in srgb, var(--kc) 46%, #090b14);
  font-size: 10.5px; font-family: var(--font); letter-spacing: .03em; color: color-mix(in srgb, var(--text) 46%, var(--kc)); text-shadow: none; }
/* the raised bumps that tell your index fingers they are home */
.kb-key.bump span::after { content: ''; position: absolute; left: 50%; bottom: -5px; width: 12px; height: 3px; margin-left: -6px; border-radius: 2px;
  background: linear-gradient(180deg, #fff, color-mix(in srgb, var(--fc) 60%, #fff));
  box-shadow: 0 1px 0 rgba(0,0,0,.6), 0 2px 2px rgba(0,0,0,.35); }

/* the key to press: lit from inside in its finger's colour, standing a little proud, glowing on to its neighbours */
.kb-key.lit { z-index: 2; color: #0b1020; text-shadow: 0 1px 0 rgba(255,255,255,.5); }
.kb-key.lit::after { transform: scaleY(1.05);
  background:
    linear-gradient(90deg, rgba(255,255,255,.5), rgba(255,255,255,0) 10%, rgba(0,0,0,0) 90%, rgba(0,0,0,.22)),
    linear-gradient(180deg, color-mix(in srgb, var(--fc) 55%, #fff), var(--fc) 30%, color-mix(in srgb, var(--fc) 80%, #000) 76%, color-mix(in srgb, var(--fc) 52%, #000));
  box-shadow: 0 0 9px 1px var(--fc), 0 0 20px 4px color-mix(in srgb, var(--fc) 50%, transparent), 2px 7px 8px rgba(0,0,0,.5); }
.kb-key.lit::before { transform: translateY(-2px);
  background: radial-gradient(85% 90% at 50% 42%, #fff, color-mix(in srgb, var(--fc) 42%, #fff) 40%, var(--fc) 100%);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.9), inset 0 -3px 5px color-mix(in srgb, var(--fc) 72%, #000), 0 1px 0 color-mix(in srgb, var(--fc) 40%, #000); }
/* the breathing glow that spills on to the neighbouring keys (keyboard.js moves this one element from key to key) */
.kb-glow { position: absolute; left: 0; right: 0; top: 0; bottom: 0; z-index: -1; border-radius: var(--rb); pointer-events: none;
  box-shadow: 0 0 26px 11px color-mix(in srgb, var(--fc) 62%, transparent); animation: kbGlow .9s ease-in-out infinite alternate; }
@keyframes kbGlow { from { opacity: 1; } to { opacity: .4; } }
.kb-key.lit span, .kb-key.lit small { transform: translateY(-2px); }
.kb-key.lit small { opacity: .8; }

/* a pressed key travels down: the face drops 4px and the front wall shrinks to match */
.kb-key.down::after { transform: scaleY(.9); }
.kb-key.down::before, .kb-key.down span, .kb-key.down small { transform: translateY(4px); }
.kb-key.down.good { z-index: 3; color: #052e16; text-shadow: none; }
.kb-key.down.good::after { background: linear-gradient(180deg, #86efac, #15803d 60%, #14532d);
  box-shadow: 0 0 14px 2px rgba(34,197,94,.8), 0 1px 2px rgba(0,0,0,.6); }
.kb-key.down.good::before { background: radial-gradient(85% 85% at 50% 40%, #dcfce7, #4ade80 55%, #22c55e);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.7), inset 0 -3px 5px #15803d; }
.kb-key.down.bad { z-index: 3; color: #fff; text-shadow: 0 1px 1px rgba(0,0,0,.5); }
.kb-key.down.bad::after { background: linear-gradient(180deg, #fca5a5, #b91c1c 60%, #7f1d1d);
  box-shadow: 0 0 16px 3px rgba(239,68,68,.9), 0 1px 2px rgba(0,0,0,.6); }
.kb-key.down.bad::before { background: radial-gradient(85% 85% at 50% 40%, #fca5a5, #ef4444 55%, #dc2626);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.55), inset 0 -3px 5px #991b1b; }

/* ---------- the hands ---------- */
/* above the keyboard, so a lifted fingertip passes over the front of the case, not under its shadow */
.hands { position: relative; z-index: 1; display: flex; justify-content: center; align-items: flex-end; gap: 10px; }
/* The glove is a pale tint of the skin's own colours (never a human skin tone), and is
   shaded with a deep version of the same colour, not with black. */
.hand { --glove: color-mix(in srgb, var(--text) 60%, var(--kc));
  --glove-sh: color-mix(in srgb, var(--kc) 62%, #000);
  --glove-line: color-mix(in srgb, var(--glove) 26%, var(--glove-sh));
  display: flex; flex-direction: column; align-items: center; gap: 1px; }
.hand-svg { display: block; width: 150px; height: auto; overflow: visible; }
.hand-label { font-size: 11px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.hand-svg stop.hi { stop-color: #fff; }
.hand-svg stop.sh { stop-color: var(--glove-sh); }
.hand-svg .hshadow { fill: #000; stroke: #000; stroke-width: 3; stroke-linejoin: round; opacity: .36; }
.hand-svg .hshadow.soft { stroke-width: 13; opacity: .16; }
/* every outline is drawn first, under all the bodies, so lines only show round the outside of the hand */
.hand-svg .fline path, .hand-svg .pline { fill: var(--glove-line); stroke: var(--glove-line); stroke-width: 2.8; stroke-linejoin: round; }
.hand-svg .fline .rim { fill: none; stroke: #fff; stroke-linecap: round; opacity: 0; }      /* the bright edge a lit finger gets, from its knuckle up */
.hand-svg .skin { fill: var(--glove); }
.hand-svg .form { pointer-events: none; }
.hand-svg .tip { fill: var(--fc); opacity: .46; }
.hand-svg .shine { fill: none; stroke: #fff; stroke-width: 2.6; stroke-linecap: round; opacity: .5; }
.hand-svg .fold { fill: none; stroke: color-mix(in srgb, var(--glove-sh) 55%, transparent); stroke-width: 1.6; stroke-linecap: round; }
.hand-svg .fold.lip { stroke: rgba(255,255,255,.38); stroke-width: 1.3; }
.hand-svg .fold.dip { stroke: color-mix(in srgb, var(--glove-sh) 32%, transparent); stroke-width: 1.6; }
.hand-svg .tendon { fill: none; stroke: color-mix(in srgb, var(--glove-sh) 16%, transparent); stroke-width: 3.6; stroke-linecap: round; }
.hand-svg .nail { fill: var(--fc); stroke: color-mix(in srgb, var(--fc) 45%, #000); stroke-width: 1.2; stroke-linejoin: round; }
.hand-svg .glint { fill: none; stroke: rgba(255,255,255,.9); stroke-width: 2; stroke-linecap: round; }
.hand-svg .cuff { fill: color-mix(in srgb, var(--accent) 66%, var(--kc)); stroke: color-mix(in srgb, var(--accent) 30%, #000); stroke-width: 2.2; stroke-linejoin: round; }
.hand-svg .cuff-lip { fill: none; stroke: rgba(255,255,255,.5); stroke-width: 1.6; stroke-linecap: round; }
.hand-svg .cuff-seam { fill: none; stroke: rgba(0,0,0,.3); stroke-width: 1.4; stroke-linecap: round; }
/* The finger to use reaches forward off the desk (its shadow stays behind) and lights up.
   Each finger sits in its own space with its knuckle at 0,0, so it moves along itself. */
.hand-svg .finger, .hand-svg .fline { transform-box: view-box; transform-origin: 0 0; transition: transform .15s ease-out; }
.hand-svg .finger.lit, .hand-svg .fline.lit { transform: translateY(-9px) scale(1.04); }
.hand-svg .finger.f-th.lit, .hand-svg .fline.f-th.lit { transform: rotate(6deg) scale(1.05); }     /* a thumb swings in towards the space bar instead */
.hand-svg .fline.lit { filter: drop-shadow(0 0 7px var(--fc)); }
.hand-svg .fline.lit path { fill: var(--fc); }
.hand-svg .fline.lit .rim { fill: none; opacity: 1; }
.hand-svg .finger.lit .skin { fill: var(--fc); }
.hand-svg .finger.lit .tip { opacity: 0; }
.hand-svg .finger.lit .nail { fill: #fff; stroke: rgba(255,255,255,.6); }
.hand-svg .finger.lit .shine { opacity: .7; }

/* ---------- the hint between the hands ---------- */
.kb-hint { min-width: 210px; text-align: center; font-weight: 700; color: var(--muted); padding-bottom: 14px; min-height: 48px; }
/* the key, as a little keycap in its finger's colour */
.kb-hint b { display: inline-block; min-width: 32px; padding: 0 8px; margin: 0 8px 7px 0; border-radius: 8px; vertical-align: middle;
  font: 700 20px/30px var(--mono); color: #0b1020; text-shadow: 0 1px 0 rgba(255,255,255,.45);
  background: radial-gradient(90% 90% at 50% 40%, #fff, color-mix(in srgb, var(--fc, #fff) 55%, #fff) 40%, var(--fc, #e2e8f0));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.8), 0 5px 0 color-mix(in srgb, var(--fc, #94a3b8) 58%, #000), 0 7px 8px rgba(0,0,0,.45), 0 0 14px color-mix(in srgb, var(--fc, #fff) 45%, transparent); }

@media (max-width: 720px) {
  .kbwrap { --kh: 32px; --kgap: 3px; --ws: 2px; --wf: 5px; --rb: 6px; --rf: 4px; padding: 8px 8px 6px; }
  .kb { padding: 7px 7px 7px; border-radius: 12px; margin-bottom: 12px; }
  .kb::before { left: 4px; right: 4px; top: 4px; bottom: 4px; border-radius: 9px; }
  .kb-key { font-size: 12px; }
  .kb-key small { font-size: 8px; top: 1px; left: calc(var(--ws) + 1px); }
  .kb-key.bump span::after { width: 8px; margin-left: -4px; height: 2px; bottom: -3px; }
  .hand-svg { width: 96px; }
  .kb-hint { min-width: 120px; }
  .kb-hint b { font-size: 17px; line-height: 26px; min-width: 28px; padding: 0 6px; margin-right: 6px; }
}
/* phones: the keys are very narrow, so the words on the wide keys shrink to stay on their keys,
   and a key with two legends stacks them instead of letting them collide */
@media (max-width: 520px) {
  .kb-key.word { font: 800 8.5px var(--font); letter-spacing: -.02em; }
  .kb-key.dull { font-size: 8px; }
  .kb-key small { left: 0; right: 0; top: 2px; text-align: center; font-size: 7.5px; }
  .kb-key.two span { top: 4px; font-size: 11px; }
}

/* finger and thumb roots fade back to the glove colour (without this they fell back to black) */
.hand-svg stop.gl { stop-color: var(--glove); }

/* the hint sits right under the keyboard */
.kb-hint { align-self: flex-start; padding: 4px 0 0; }
@media (min-width: 721px) and (max-height: 880px) { .kbwrap { --kh: 34px; } .hand-svg { width: 116px; } }

/* Chrome 110 and older (some school Chromebooks are frozen there) do not know color-mix():
   give the parts that must stay readable plain colours. Newer browsers skip this block. */
@supports not (color: color-mix(in srgb, #000, #fff)) {
  .kb { --case: var(--kc); background: var(--kc); }
  .kb::before { background: #05060b; }
  .kb-key { --tint: #1b2030; --side: var(--fc, var(--kc)); }
  .kb-key::after { background: var(--side); }
  .kb-key::before, .kb-key.enter::before, .kb-key.enter2::before { background: var(--tint); }
  .kb-key.dull { --side: var(--kc); color: var(--muted); }
  .kb-key.lit::after { background: var(--fc); }
  .kb-key.lit::before { background: #fff; }
  .kb-hint b { background: var(--fc, #e2e8f0); }
  .hand { --glove: #cbd5e1; --glove-sh: #334155; --glove-line: #475569; }
  .hand-svg .cuff { fill: var(--accent); }
}

/* the key to press is a shifted symbol: swap which legend is big */
.kb-key.lit.want-sub small { position: static; font-size: 15px; opacity: 1; }
.kb-key.lit.want-sub span { font-size: 10px; opacity: .55; }
@media (max-width: 520px) { .kb-key.lit.want-sub small { font-size: 11px; } .kb-key.lit.want-sub span { font-size: 8px; } }
.kb-hint b.punct { font-size: 28px; }

/* ===== games.css ===== */
/* ==========================================================================
   Touch Typing Quest - the activity screen, the four games and the results.

   Everything here is lit from above and slightly to the left (ART-GUIDE.md):
   raised things have a bright top edge, a darker bottom edge, a side wall and
   a shadow under them; screens are sunk into a thick frame; things that stand
   or float have a shadow on the ground beneath them.

   The games move things every frame, so only transform and opacity are ever
   animated here, and nothing that moves has a blur on it.
   ========================================================================== */
.play { position: relative; max-width: 1000px; margin: 0 auto; padding: 10px 14px 20px; min-height: 100vh; display: flex; flex-direction: column; min-width: 0;
  /* the colours of a raised panel in this skin: its lit top, its face, its shaded foot and its side wall */
  --face-hi: color-mix(in srgb, var(--keycap, #334155) 78%, #fff);
  --face: var(--keycap, #334155);
  --face-lo: color-mix(in srgb, var(--keycap, #334155) 68%, #000);
  --wall-c: color-mix(in srgb, var(--keycap, #334155) 42%, #000);
  --pit: color-mix(in srgb, var(--field, #050818) 60%, #000);          /* the bottom of a sunk screen */
  --acc-hi: color-mix(in srgb, var(--accent) 52%, #fff);
  --acc-lo: color-mix(in srgb, var(--accent) 60%, #000);
  /* the typing cursor */
  --cur: var(--accent); --cur-hi: var(--acc-hi); --cur-lo: var(--acc-lo); --cur-text: var(--accent-text);
  --ground: rgba(3, 4, 16, .8);                                         /* shadows cast on the ground */
  --e3-side: #17153a; }
/* in the dragon skin the accent is red, which would make the cursor look like a mistake: use its gold */
body[data-skin="pop"] .play { --cur: #22d3ee; --cur-hi: #a5f3fc; --cur-lo: #0e7490; --cur-text: #04121a; --e3-side: #2a0a3d; }
body[data-skin="dragon"] .play { --cur: #facc15; --cur-hi: #fef9c3; --cur-lo: #a16207; --cur-text: #3b2500; --e3-side: #1c1917; }
body[data-skin="pop"] .play { --e3-side: #2a0a3d; }
/* the page's scene is busy: dim it during play so that the arena is the star */
.play::before { content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(120% 85% at 50% 0%, color-mix(in srgb, var(--bg) 58%, transparent), color-mix(in srgb, var(--bg) 86%, #000) 72%); }
.play-main { flex: 1; display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.play-kb { margin-top: 14px; }
.kbtoggle { align-self: center; margin-top: 8px; }
.capswarn { color: #3b2500; font-weight: 800; padding: 8px 14px; border-radius: 14px; margin-bottom: 12px; text-align: center;
  background: linear-gradient(180deg, #fde68a, var(--warn) 55%, #d97706); border: 1px solid rgba(255,255,255,.5);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.55), 0 4px 0 #92400e, 0 9px 14px rgba(0,0,0,.35); }

/* ---------- the bar along the top ---------- */
.play-top { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.play-title { flex: 1; display: flex; align-items: center; gap: 11px; min-width: 0; }
/* the activity's icon, set in a round medallion */
.pt-ico { position: relative; flex: none; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-size: 23px; line-height: 1;
  background: radial-gradient(circle at 34% 26%, var(--acc-hi), var(--accent) 50%, var(--acc-lo));
  box-shadow: inset 0 2px 0 rgba(255,255,255,.6), inset 0 -3px 0 rgba(0,0,0,.25), 0 4px 0 color-mix(in srgb, var(--accent) 38%, #000), 0 9px 12px rgba(0,0,0,.45); }
.pt-ico::before { content: ''; position: absolute; inset: 5px; border-radius: 50%; background: radial-gradient(circle at 50% 25%, var(--face), var(--pit));
  box-shadow: inset 0 3px 5px rgba(0,0,0,.7), 0 1px 0 rgba(255,255,255,.45); }
.pt-ico .emo { position: relative; text-shadow: 0 2px 2px rgba(0,0,0,.45); }
.pt-text { display: flex; flex-direction: column; min-width: 0; }
.pt-act { font: 600 23px/1.15 var(--display); text-shadow: 0 2px 0 rgba(0,0,0,.45); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pt-stage { color: var(--muted); font-weight: 700; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* the chips: bevelled, with a side wall */
.hud { display: flex; gap: 10px; padding-bottom: 5px; }
.hud-item { position: relative; min-width: 84px; padding: 5px 13px 6px; border-radius: 14px; text-align: center;
  background: linear-gradient(180deg, var(--face-hi), var(--face) 46%, var(--face-lo));
  border: 1px solid; border-color: rgba(255,255,255,.4) rgba(255,255,255,.12) rgba(0,0,0,.35) rgba(255,255,255,.2);
  box-shadow: inset 0 1px 0 var(--hi), inset 0 -2px 0 var(--lo), 0 var(--wall) 0 var(--wall-c), 0 calc(var(--wall) + 1px) 0 rgba(0,0,0,.4), 0 11px 14px rgba(0,0,0,.4); }
/* a gloss across the top half */
.hud-item::before { content: ''; position: absolute; left: 3px; right: 3px; top: 2px; height: 46%; border-radius: 11px 11px 14px 14px / 11px 11px 8px 8px;
  background: linear-gradient(180deg, rgba(255,255,255,.2), rgba(255,255,255,.03)); pointer-events: none; }
.hud-item b { position: relative; display: block; font: 600 19px/1.25 var(--display); color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,.4); white-space: nowrap; }
.hud-item small { position: relative; display: block; color: var(--muted); font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; }
.heart { display: inline-block; width: 23px; height: 23px; margin: 0 1px -4px; font: 17px/23px var(--emoji); color: #f43f5e; }
.heart .spr { display: block; width: 100%; height: 100%; }
.heart.gone { color: #475569; }
/* the heart that has just been lost */
.heart:not(.gone) + .heart.gone, .heart.gone:first-child { animation: heartlost .55s ease-out; }
@keyframes heartlost { 0% { transform: scale(1.7); opacity: .2; } 45% { transform: scale(.8); opacity: 1; } 100% { transform: none; } }

/* ---------- a screen sunk into a thick frame (the typing boxes) ---------- */
.bezel { position: relative; padding: 12px; border-radius: 24px; margin-bottom: 9px;
  background: linear-gradient(180deg, var(--face-hi), var(--face) 34%, var(--face-lo));
  border: 1px solid; border-color: rgba(255,255,255,.4) rgba(255,255,255,.12) rgba(0,0,0,.4) rgba(255,255,255,.2);
  box-shadow: inset 0 2px 0 var(--hi), inset 0 -3px 0 var(--lo), 0 7px 0 var(--wall-c), 0 9px 0 rgba(0,0,0,.4), 0 22px 34px rgba(0,0,0,.45); }
.screen { position: relative; border-radius: 14px;
  /* a streak of light across the glass, then the dark of the screen */
  background: linear-gradient(118deg, rgba(255,255,255,.085) 0, rgba(255,255,255,.02) 24%, transparent 24.3%),
    radial-gradient(120% 90% at 50% 110%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 60%),
    linear-gradient(180deg, var(--pit), color-mix(in srgb, var(--field, #050818) 86%, #000));
  box-shadow: inset 0 6px 14px rgba(0,0,0,.85), inset 0 0 0 2px rgba(0,0,0,.6), 0 2px 0 var(--hi), 0 -1px 0 rgba(0,0,0,.45); }

/* ---------- typing text ---------- */
.typeline { font-family: var(--mono); font-size: 22px; line-height: 1.7; letter-spacing: .02em; white-space: pre-wrap; overflow-wrap: anywhere; color: #f8fafc; }
.typeline .c { padding: 2px 0; border-radius: 5px; }
.typeline .c.done { color: var(--good); }
.typeline .c.done.err { color: var(--bad); }
.typeline .c.sp.done.err { background: #f8717140; }
/* the character to type next: a raised key, with a ring that pulses round it */
.typeline .c.cur { position: relative; top: -3px; color: var(--cur-text); border-radius: 6px; background: linear-gradient(180deg, var(--cur-hi), var(--cur) 58%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.75), inset 0 0 0 1px var(--cur), 0 5px 0 var(--cur-lo), 0 12px 7px -7px rgba(0,0,0,.6); }
/* a bar under the letter that gently fades: it never crosses the letters either side */
.typeline .c.cur::after { content: ''; position: absolute; left: 0; right: 0; bottom: -10px; height: 3px; border-radius: 2px; background: var(--cur-hi);
  pointer-events: none; animation: curbar 1.1s ease-in-out infinite alternate; }
@keyframes curbar { to { opacity: .15; } }
@keyframes curpulse { 0% { opacity: .85; transform: scale(.8); } 100% { opacity: 0; transform: scale(1.12); } }
.typeline .c.cur.wrong { color: #450a0a; background: linear-gradient(180deg, #fecaca, var(--bad) 58%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.75), inset 0 0 0 1px var(--bad), 0 5px 0 #991b1b, 0 12px 7px -7px rgba(0,0,0,.6); }
.typeline .c.cur.wrong::after { background: var(--bad); animation: none; }
/* a small cross above a wrong key, so the mistake does not depend on colour alone */
.typeline .c.cur.wrong::before { content: '\00d7'; position: absolute; left: 50%; top: -13px; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%;
  background: #b91c1c; color: #fff; font: 800 12px/14px var(--font); text-align: center; }
/* other files flash things with this: it must keep its name */
@keyframes blink { 50% { opacity: .45; } }

/* ---------- learn ---------- */
.learn { text-align: center; padding-top: 6px; }
.learn .screen { padding: 26px 26px 18px; }
.learn .big { font-size: 40px; line-height: 1.6; min-height: 64px; word-break: normal; text-shadow: 0 2px 0 rgba(0,0,0,.55); }
.learn .big .c.cur { text-shadow: none; }
.nextline { color: var(--muted); font-size: 22px; opacity: .6; min-height: 36px; margin-top: 8px; }
/* one bead for each line, threaded on a rail along the top of the frame */
.learn-prog { position: relative; display: flex; justify-content: center; gap: 16px; padding: 9px 0 12px; }
.learn-prog i { position: relative; width: 18px; height: 18px; border-radius: 50%;
  background: radial-gradient(circle at 50% 28%, rgba(0,0,0,.35), rgba(0,0,0,.6));
  box-shadow: inset 0 2px 3px rgba(0,0,0,.75), 0 1px 0 rgba(255,255,255,.22); }
.learn-prog i + i::before { content: ''; position: absolute; right: 100%; top: 7px; width: 16px; height: 4px; background: rgba(0,0,0,.45); box-shadow: 0 1px 0 rgba(255,255,255,.14); }
.learn-prog i.done { background: radial-gradient(circle at 34% 28%, #f0fdf4 0, #86efac 18%, #22c55e 52%, #15803d 82%, #166534);
  box-shadow: 0 2px 0 #14532d, 0 4px 5px rgba(0,0,0,.5); }
.learn-prog i.done + i::before { background: linear-gradient(180deg, #4ade80, #16a34a); box-shadow: 0 1px 0 #14532d; }
.learn-prog i.cur { background: radial-gradient(circle at 34% 28%, #fff 0, var(--cur-hi) 20%, var(--cur) 55%, var(--cur-lo) 92%);
  box-shadow: 0 2px 0 color-mix(in srgb, var(--cur-lo) 70%, #000), 0 4px 5px rgba(0,0,0,.5); transform: scale(1.25); }
.learn-prog i.cur::after { content: ''; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid var(--cur); animation: curpulse 1.4s ease-out infinite; }

/* ---------- the three arenas: a scene set back inside a thick frame ---------- */
.rain, .track, .arena { position: relative; overflow: hidden; border-radius: 24px; border: 5px solid transparent; margin-bottom: 9px;
  background: linear-gradient(#050818, #050818) padding-box, linear-gradient(180deg, var(--face-hi), var(--face) 30%, var(--face-lo)) border-box;
  box-shadow: 0 -1px 0 rgba(255,255,255,.22), 0 7px 0 var(--wall-c), 0 9px 0 rgba(0,0,0,.4), 0 22px 34px rgba(0,0,0,.5); }
.rain > .scene, .track > .scene, .arena > .scene { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; }
/* the frame's lip throws a shadow onto the scene, which is what sets it back */
.rain::before, .track::before, .arena::before { content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none; border-radius: 19px;
  box-shadow: inset 0 14px 18px -9px rgba(0,0,8,.75), inset 0 0 0 1.5px rgba(0,0,0,.6), inset 0 -10px 18px -12px rgba(0,0,8,.5), inset 0 0 46px rgba(0,0,8,.3); }
.fx { position: absolute; left: 0; top: 0; pointer-events: none; z-index: 4; }
.rain.hurt::after, .arena.hurt::after { content: ''; position: absolute; inset: 0; z-index: 8; pointer-events: none; border-radius: 19px;
  box-shadow: inset 0 0 90px 14px rgba(239,68,68,.8); animation: hurtflash .45s ease-out forwards; }
@keyframes hurtflash { from { opacity: 1; } to { opacity: 0; } }
.shake, .drop-in.shake, .racer.shake { animation: shake .3s; }
@keyframes shake { 20% { translate: -6px 0; } 40% { translate: 6px 0; } 60% { translate: -4px 0; } 80% { translate: 4px 0; } }

/* Emoji characters are flat pictures. Two things make one look solid. It is
   given an edge: a sliver of light along the top-left and a dark side down the
   bottom-right, like a thick cut-out. And it is lit: a second copy of the same
   emoji (written in data-e by games.js) lies exactly over the first and is used
   only as a mask, through which a light shines from the upper left and a shade
   falls on the lower right. --sx is -1 for an emoji turned to face the other way. */
.e3 { --sx: 1; position: relative; display: inline-block;
  text-shadow: calc(var(--sx) * -.02em) -.022em 0 rgba(255,255,255,.7),
    calc(var(--sx) * .014em) .02em 0 var(--e3-side, #17153a), calc(var(--sx) * .028em) .04em 0 var(--e3-side, #17153a),
    calc(var(--sx) * .042em) .06em 0 var(--e3-side, #17153a), calc(var(--sx) * .054em) .08em 0 #07061a; }
.e3[data-e]::after { content: attr(data-e); position: absolute; left: 0; top: 0; pointer-events: none; text-shadow: none; color: transparent;
  background: radial-gradient(60% 55% at calc(50% - var(--sx) * 20%) 22%, rgba(255,255,255,.5), rgba(255,255,255,0) 70%),
    linear-gradient(calc(180deg - var(--sx) * 28deg), rgba(255,255,255,.12) 0, rgba(255,255,255,0) 40%, rgba(16,6,60,0) 54%, rgba(16,6,60,.5) 94%);
  -webkit-background-clip: text; background-clip: text; }
/* a shadow on the ground under something that stands or hovers */
.gshadow, .rshadow, .ship-shadow { position: absolute; left: 50%; border-radius: 50%; pointer-events: none;
  background: radial-gradient(closest-side, var(--ground), rgba(3,4,16,.45) 58%, rgba(3,4,16,0)); }

/* ---------- rain ---------- */
.rain { flex: 1; min-height: 380px; height: 52vh; }
.rain-shadows { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.rain-field { position: absolute; inset: 0; z-index: 6; pointer-events: none; }
/* the shadow of a falling thing: games.js slides it along the ground and grows and darkens it */
.dshadow { position: absolute; left: -62px; top: -13px; width: 124px; height: 26px; border-radius: 50%; opacity: 0; will-change: transform, opacity;
  background: radial-gradient(closest-side, var(--ground), rgba(3,4,16,.5) 55%, rgba(3,4,16,0)); }
.dshadow.active::after { content: ''; position: absolute; inset: -5px -10px; border-radius: 50%; border: 2.5px solid var(--cur); }
/* a falling thing hangs from the top of the field by its bottom edge; games.js moves it down */
.drop, .drop-gone { position: absolute; left: 0; bottom: 100%; will-change: transform; }
.drop.active { z-index: 2; }
.drop-in { display: flex; flex-direction: column; align-items: center; transform-origin: 50% 100%; animation: dropin .3s cubic-bezier(.3, 1.5, .5, 1) both; }
@keyframes dropin { from { transform: scale(.4); opacity: 0; } }
.drop-ico { position: relative; display: block; font: 46px/1.1 var(--emoji); }
.drop-spr { position: relative; display: block; }
.drop-in .spr-meteor { width: 62px; height: 101px; margin-bottom: -6px; }
.drop-in .spr-boulder { width: 62px; height: 70px; margin-bottom: -4px; }
.drop-in .spr-note { width: 60px; height: 69px; margin-bottom: -5px; }
/* the word: a glossy dark plaque. Large light letters on dark; the part typed so far turns green. */
.drop-txt { position: relative; z-index: 1; display: block; white-space: nowrap; font: 700 22px/1.25 var(--mono); letter-spacing: .04em; color: #fff;
  padding: 3px 12px 4px; border-radius: 11px; border: 2px solid; border-color: #e2e8f0 #64748b #475569 #cbd5e1;
  background: linear-gradient(180deg, #3b4a68 0, #1e2942 46%, #0d1326 54%, #060a17 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.4), 0 4px 0 #010409, 0 10px 12px rgba(0,0,8,.55);
  text-shadow: 0 1px 0 #000, 0 2px 3px rgba(0,0,0,.8); transition: transform .12s ease-out; }
.drop-txt b { font-weight: 700; color: #4ade80; }
.drop.active .drop-txt { transform: scale(1.14); border-color: #fff var(--cur) var(--cur-lo) var(--cur-hi);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5), 0 4px 0 var(--cur-lo), 0 0 0 3px color-mix(in srgb, var(--cur) 40%, transparent), 0 0 20px 2px var(--cur), 0 10px 12px rgba(0,0,8,.55); }
/* the lock-on ring round the one being typed */
.lock { position: absolute; left: 50%; bottom: -10px; width: 88px; height: 88px; margin-left: -44px; opacity: 0; pointer-events: none; }
.lock svg { display: block; width: 100%; height: 100%; overflow: visible; fill: none; stroke-linecap: round; }
.lock .lk-o { stroke: rgba(0,0,10,.75); stroke-width: 7; }
.lock .lk-i { stroke: var(--cur); stroke-width: 3.5; }
.lock circle { stroke-dasharray: 34 17.84; stroke-dashoffset: 17; }
.drop.active .lock { opacity: 1; animation: lockon .28s cubic-bezier(.3, 1.6, .5, 1); }
.drop.active .lock svg { animation: spin 5s linear infinite; }
@keyframes lockon { from { opacity: 0; transform: scale(1.9); } }
@keyframes spin { to { transform: rotate(360deg); } }
/* a miss: it squashes on the ground and fades */
.drop.landed .drop-in { animation: land .4s ease-out forwards; }
@keyframes land { 25% { transform: scale(1.3, .62); opacity: 1; } to { transform: scale(1.5, .3); opacity: 0; } }
/* a hit: it bursts */
.drop-gone .drop-in { transform-origin: 50% 40%; animation: dropburst .2s ease-out forwards; }
@keyframes dropburst { to { transform: scale(1.5); opacity: 0; } }
/* where a miss lands: a flash on the ground */
.impact { position: absolute; width: 200px; height: 48px; margin: -24px 0 0 -100px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(closest-side, rgba(255,255,255,.98), rgba(255,220,160,.8) 30%, rgba(255,120,60,.45) 55%, rgba(255,120,60,0) 80%);
  animation: impact .55s ease-out forwards; }
.impact::after { content: ''; position: absolute; inset: -8px -26px; border-radius: 50%; border: 3px solid rgba(255,255,255,.85); }
@keyframes impact { 0% { opacity: 1; transform: scale(.2); } 30% { opacity: 1; } 100% { opacity: 0; transform: scale(1.45); } }
/* the shooter: it hovers over its shadow, turns to aim (games.js), kicks back and flashes when it fires */
.rain-ship { position: absolute; left: 50%; bottom: 22px; z-index: 5; transform: translateX(-50%); pointer-events: none; }
.ship-shadow { bottom: -11px; width: 88px; height: 20px; margin-left: -44px; animation: shipshadow 2.2s ease-in-out infinite alternate; }
.ship-aim { position: relative; }
.ship-body { animation: shiphover 2.2s ease-in-out infinite alternate; }
@keyframes shiphover { to { transform: translateY(-7px); } }
@keyframes shipshadow { to { transform: scale(.8); opacity: .65; } }
.rain-ship .ship-spr { display: block; width: 54px; height: 84px; }
.rain-ship .emo.ship-spr { width: auto; height: auto; font-size: 60px; line-height: 1.15; }
.rain-ship.fire .ship-spr { animation: recoil .3s ease-out; }
@keyframes recoil { 22% { transform: translateY(11px) scale(1.07, .9); } 60% { transform: translateY(-3px); } }
.muzzle { position: absolute; left: 50%; top: -30px; width: 64px; height: 64px; margin-left: -32px; border-radius: 50%; opacity: 0; pointer-events: none;
  background: radial-gradient(closest-side, #fff 0, #fff 22%, var(--acc-hi) 40%, color-mix(in srgb, var(--accent) 55%, transparent) 62%, transparent 100%); }
.rain-ship.fire .muzzle { animation: muzzle .24s ease-out; }
@keyframes muzzle { 0% { opacity: 1; transform: scale(.35); } 100% { opacity: 0; transform: scale(1.5); } }
/* The beam runs from the shooter's nose to the target (games.js sets where it starts,
   how long it is and which way it points). A white-hot core inside a coloured glow. */
.beam { position: absolute; left: 0; top: 0; height: 0; z-index: 3; transform-origin: 0 0; pointer-events: none; }
.beam i { position: absolute; left: 0; right: 0; top: -11px; height: 22px; border-radius: 11px; --b: var(--accent);
  background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--b) 45%, transparent) 20%, var(--b) 36%, #fff 45%, #fff 55%, var(--b) 64%, color-mix(in srgb, var(--b) 45%, transparent) 80%, transparent);
  animation: beam .27s ease-out forwards; }
@keyframes beam { 0% { opacity: 1; transform: scaleY(1.7); } 40% { opacity: 1; transform: scaleY(1); } 100% { opacity: 0; transform: scaleY(.15); } }
.beam.still i { animation: none; }
/* a jet of flame that widens towards the target */
body[data-skin="dragon"] .beam i { top: -17px; height: 34px; border-radius: 17px; clip-path: polygon(0 34%, 100% 0, 100% 100%, 0 66%);
  background: linear-gradient(180deg, transparent, rgba(220,38,38,.75) 14%, #f97316 30%, #fde047 43%, #fffbeb 50%, #fde047 57%, #f97316 70%, rgba(220,38,38,.75) 86%, transparent); }
/* a ribbon of sound */
body[data-skin="pop"] .beam i { top: -12px; height: 24px; --b: #f472b6;
  background: repeating-linear-gradient(90deg, transparent 0 9px, rgba(255,255,255,.55) 9px 12px, transparent 12px 20px),
    linear-gradient(180deg, transparent, rgba(192,132,252,.6) 18%, #f472b6 36%, #fff 46%, #fff 54%, #f472b6 64%, rgba(192,132,252,.6) 82%, transparent); }
/* the flash where the beam strikes */
.zapflash { position: absolute; width: 140px; height: 140px; margin: -70px 0 0 -70px; border-radius: 50%; z-index: 3; pointer-events: none;
  background: radial-gradient(closest-side, #fff 0, #fff 16%, var(--acc-hi) 32%, color-mix(in srgb, var(--accent) 45%, transparent) 56%, transparent 100%);
  animation: zapflash .36s ease-out forwards; }
body[data-skin="dragon"] .zapflash { background: radial-gradient(closest-side, #fff 0, #fef9c3 16%, #fde047 30%, rgba(249,115,22,.6) 54%, transparent 100%); }
@keyframes zapflash { 0% { opacity: 1; transform: scale(.25); } 40% { opacity: .95; transform: scale(1); } 100% { opacity: 0; transform: scale(1.35); } }
.boom { position: absolute; font: 46px/1 var(--emoji); transform: translate(-50%, -50%); animation: boom .6s ease-out forwards; pointer-events: none; z-index: 4; }
@keyframes boom { from { transform: translate(-50%, -50%) scale(.3); } 60% { opacity: 1; } to { transform: translate(-50%, -50%) scale(1.8); opacity: 0; } }
/* "+1", "Combo x4": thick letters that rise and fade */
.floattext { position: absolute; z-index: 7; pointer-events: none; transform: translate(-50%, -50%); white-space: nowrap;
  font: 700 26px var(--display); color: #fff; animation: floatup 1.05s ease-out forwards;
  text-shadow: 0 1px 0 var(--acc-lo, #155e75), 0 2px 0 var(--acc-lo, #155e75), 0 3px 0 var(--acc-lo, #155e75), 0 4px 0 #020617, 0 7px 8px rgba(0,0,0,.6); }
.floattext.combo { color: #fef08a; font-size: 30px; text-shadow: 0 1px 0 #d97706, 0 2px 0 #b45309, 0 3px 0 #92400e, 0 4px 0 #451a03, 0 7px 8px rgba(0,0,0,.6); }
.floattext.dmg { color: #fff; font-size: 40px; text-shadow: 0 1px 0 #ef4444, 0 2px 0 #dc2626, 0 3px 0 #b91c1c, 0 4px 0 #7f1d1d, 0 5px 0 #450a0a, 0 9px 10px rgba(0,0,0,.6); }
@keyframes floatup { 0% { opacity: 0; transform: translate(-50%, -30%) scale(.5); } 18% { opacity: 1; transform: translate(-50%, -60%) scale(1.2); }
  100% { opacity: 0; transform: translate(-50%, -190%) scale(1); } }

/* ---------- race ---------- */
.race { display: flex; flex-direction: column; gap: 14px; position: relative; min-width: 0; }
/* The track is one flat road tipped back in perspective, so that it runs away
   from you: the far lanes are narrower, the markings bunch up with distance and
   the finish line leans in. --road-near and --road-far are its surface close to
   and far away (far things are paler). Only the road is tipped; the racers and
   finish posts stand upright on it, and games.js works out where. */
.track { height: 304px; --road-near: #151b4b; --road-mid: #2c3a8c; --road-far: #7c8fe0; --road-wall: #1b2260; --kerb: var(--accent); }
body[data-skin="dragon"] .track { --road-near: #5a4134; --road-mid: #93725a; --road-far: #e2c8a6; --road-wall: #6b5040; --kerb: #c9a27c; }
/* Dragon: the road is a stone causeway. Flagstones laid in courses, a low
   parapet of dressed blocks along each side instead of racing kerbs, and
   faint chalk dashes for the lanes. */
body[data-skin="dragon"] .road {
  background: radial-gradient(70% 90% at 22% 0%, rgba(255,240,215,.3), transparent 70%),
    repeating-linear-gradient(90deg, rgba(43,26,20,.28) 0 2px, transparent 2px 78px),
    repeating-linear-gradient(180deg, rgba(43,26,20,.3) 0 2px, transparent 2px 33px),
    repeating-linear-gradient(90deg, rgba(255,236,210,.07) 0 39px, rgba(40,24,18,.07) 39px 78px),
    linear-gradient(180deg, var(--road-far), var(--road-mid) 42%, var(--road-near)); }
body[data-skin="dragon"] .road::before, body[data-skin="dragon"] .road::after { height: 15px;
  background: repeating-linear-gradient(90deg, rgba(43,26,20,.75) 0 2px, transparent 2px 46px),
    linear-gradient(180deg, #f3dfc2 0, #c9a27c 35%, #8a6a52 80%, #5a4134); }
body[data-skin="dragon"] .road::before { opacity: 1; }
body[data-skin="dragon"] .road::after { box-shadow: 0 -3px 0 rgba(43,26,20,.35); }
body[data-skin="dragon"] .rlane + .rlane { box-shadow: inset 0 3px 0 rgba(255,236,210,.22); }
body[data-skin="dragon"] .lane-marks { background: repeating-linear-gradient(90deg, rgba(255,244,228,.24) 0 44px, transparent 44px 120px); }
body[data-skin="dragon"] .rlane.mine .lane-marks { background: repeating-linear-gradient(90deg, rgba(255,248,236,.6) 0 44px, transparent 44px 120px); }
body[data-skin="dragon"] .road-start { background: rgba(255,244,228,.55); }
body[data-skin="dragon"] .road-wall {
  background: repeating-linear-gradient(90deg, rgba(43,26,20,.45) 0 2px, transparent 2px 46px),
    linear-gradient(180deg, color-mix(in srgb, var(--road-wall) 60%, #fff) 0, var(--road-wall) 30%, color-mix(in srgb, var(--road-wall) 50%, #1d1226)); }
body[data-skin="pop"] .track { --road-near: #2a0a40; --road-mid: #5f2484; --road-far: #c06ad0; --road-wall: #3b1158; }
.road { position: absolute; z-index: 2; left: 16px; right: 16px; bottom: 36px; height: 400px; display: flex; flex-direction: column; overflow: hidden;
  border-radius: 16px 16px 0 0; transform-origin: 50% 100%; transform: perspective(900px) rotateX(52deg);
  /* a polished surface: light pooled on it from the upper left, a sheen across it, then its own colour, paler with distance */
  background: radial-gradient(70% 90% at 22% 0%, rgba(255,255,255,.3), transparent 70%),
    linear-gradient(104deg, transparent 30%, rgba(255,255,255,.13) 44%, rgba(255,255,255,.03) 52%, transparent 60%),
    linear-gradient(180deg, var(--road-far), var(--road-mid) 42%, var(--road-near)); }
/* striped kerbs along both long edges */
.road::before, .road::after { content: ''; position: absolute; z-index: 2; left: 0; right: 0; height: 13px;
  background: repeating-linear-gradient(90deg, #f8fafc 0 30px, var(--kerb) 30px 60px); }
.road::before { top: 0; opacity: .82; }
.road::after { bottom: 0; box-shadow: 0 -2px 0 rgba(0,0,0,.28); }
.rlane { position: relative; flex: 1; min-height: 0; overflow: hidden; }
.rlane + .rlane { box-shadow: inset 0 6px 0 rgba(255,255,255,.4); }
/* your lane is lit in your colour */
.rlane.mine { background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 30%, transparent), color-mix(in srgb, var(--accent) 52%, transparent));
  box-shadow: inset 0 5px 0 var(--acc-hi); }
/* the dashes down the middle of a lane; games.js slides them back as you type */
.lane-marks { position: absolute; left: 0; top: 50%; width: calc(100% + 120px); height: 12px; margin-top: -6px; will-change: transform;
  background: repeating-linear-gradient(90deg, rgba(255,255,255,.4) 0 56px, transparent 56px 120px); }
.rlane.mine .lane-marks { height: 14px; margin-top: -7px; background: repeating-linear-gradient(90deg, #fff 0 56px, transparent 56px 120px); }
/* never seen: games.js measures these to find where a lane starts and ends on screen */
.lane-ruler { position: absolute; left: 46px; right: 104px; top: 60%; height: 0; }
.post-mark { position: absolute; left: calc(100% - 62px); width: 100px; height: 0; }
.post-mark.far { top: 0; }
.post-mark.near { bottom: 0; }
.road-start { position: absolute; z-index: 1; left: 86px; top: 13px; bottom: 13px; width: 9px; background: rgba(255,255,255,.78); }
/* the finish line: chequers across the road and, darker, down its front wall */
.road-fin { position: absolute; z-index: 1; right: 44px; top: 13px; bottom: 13px; width: 36px;
  background: conic-gradient(#f8fafc 25%, #0f172a 0 50%, #f8fafc 0 75%, #0f172a 0) 0 0 / 36px 36px; box-shadow: -3px 0 0 rgba(0,0,0,.35), 3px 0 0 rgba(0,0,0,.35); }
/* the slab's front wall, with a strip of light under it */
.road-wall { position: absolute; z-index: 2; left: 16px; right: 16px; bottom: 12px; height: 24px; border-radius: 0 0 14px 14px;
  background: repeating-linear-gradient(90deg, rgba(0,0,0,.22) 0 2px, transparent 2px 60px),
    linear-gradient(180deg, color-mix(in srgb, var(--road-wall) 70%, #fff) 0, var(--road-wall) 30%, color-mix(in srgb, var(--road-wall) 45%, #000));
  box-shadow: inset 0 2px 0 rgba(255,255,255,.5), inset 0 -3px 0 rgba(0,0,0,.45), 0 13px 16px rgba(0,0,8,.6); }
.road-wall::before { content: ''; position: absolute; left: 14px; right: 14px; bottom: 5px; height: 4px; border-radius: 2px; background: var(--acc-hi); box-shadow: 0 0 10px 2px var(--accent); }
/* the finish line carries on down the front wall: the same chequers as on the road, in the wall's shade */
.road-wall::after { content: ''; position: absolute; right: 44px; top: 2px; bottom: 3px; width: 36px; border-radius: 0 0 3px 3px;
  background: linear-gradient(180deg, rgba(0,0,0,.08), rgba(0,0,0,.38)), conic-gradient(#f8fafc 25%, #0f172a 0 50%, #f8fafc 0 75%, #0f172a 0) 0 0 / 18px 18px; }
/* A racer is a point on the road (games.js moves it); its body stands on that
   point over its shadow, bobbing. Nearer lanes are drawn in front. */
.racer { position: absolute; left: 0; top: 0; width: 0; height: 0; z-index: 4; transform-origin: 0 0; will-change: transform; }
.track.racing .racer { transition: transform .15s linear; }
.racer.l2 { z-index: 5; }
.racer.l3 { z-index: 6; }
.racer.mine { z-index: 7; }
.rshadow { top: -8px; width: 60px; height: 16px; margin-left: -30px; animation: rshadow .62s ease-in-out infinite alternate; }
.rbody { position: absolute; left: -36px; bottom: -4px; width: 72px; display: grid; place-items: center; font: 46px/1.1 var(--emoji); animation: rbob .62s ease-in-out infinite alternate; }
@keyframes rbob { to { transform: translateY(-6px); } }
@keyframes rshadow { to { transform: scale(.78); opacity: .6; } }
.racer.l1 .rbody, .racer.l1 .rshadow { animation-delay: -.22s; }
.racer.l2 .rbody, .racer.l2 .rshadow { animation-delay: -.41s; }
.racer.l3 .rbody, .racer.l3 .rshadow { animation-delay: -.09s; }
.rbody svg.racer-spr { display: block; width: 38px; height: 59px; margin: -9px 0 -6px; transform: rotate(90deg); }
/* most emoji animals face left: turn them to face the way they are going */
body[data-skin="dragon"] .rbody .emo, body[data-skin="pop"] .rbody .emo { --sx: -1; transform: scaleX(-1); }
.racer.moving .rbody::before { content: ''; position: absolute; right: 80%; top: 50%; width: 50px; height: 18px; margin-top: -9px; opacity: .85;
  background: repeating-linear-gradient(180deg, rgba(255,255,255,.8) 0 2px, transparent 2px 6px);
  -webkit-mask: linear-gradient(90deg, transparent, #000); mask: linear-gradient(90deg, transparent, #000); }
.racer.winner .rbody { animation: winner .4s ease-in-out infinite alternate; }
@keyframes winner { to { transform: translateY(-14px) scale(1.15); } }
/* the tag over your racer */
.lane-label { position: absolute; left: 0; bottom: 58px; transform: translateX(-50%); white-space: nowrap; font: 800 11px/1 var(--font); letter-spacing: .07em; text-transform: uppercase;
  padding: 3px 8px 4px; border-radius: 7px; color: var(--accent-text); background: linear-gradient(180deg, var(--acc-hi), var(--accent));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.6), 0 2px 0 var(--acc-lo), 0 4px 5px rgba(0,0,0,.45); }
.lane-label::after { content: ''; position: absolute; left: 50%; top: 100%; margin: 2px 0 0 -5px; border: 5px solid transparent; border-bottom: 0; border-top-color: var(--acc-lo); }
/* a post at each end of the finish line: the far one small and behind everything, the near one in front */
.flag { position: absolute; left: 0; top: 0; width: 0; height: 0; z-index: 3; transform-origin: 0 0; font: 46px/1 var(--emoji); }
.flag.near { z-index: 8; }
.flag .rshadow { animation: none; top: -6px; width: 48px; height: 13px; margin-left: -24px; }
.flag .flag-spr { position: absolute; display: block; left: -25px; bottom: -3px; width: 50px; height: 70px; }
.flag .spr-checkered { left: -8px; }
.flag .spr-star { left: -27px; bottom: 8px; width: 54px; height: 54px; }
.flag .emo.flag-spr { width: auto; height: auto; left: -23px; }
/* the countdown: big thick numbers that drop in over the track */
.countdown { position: absolute; inset: 0; z-index: 6; display: grid; place-items: center; pointer-events: none;
  background: radial-gradient(closest-side, rgba(0,0,10,.62), rgba(0,0,10,.3) 60%, transparent); }
.cd-num { position: relative; font: 700 150px/1 var(--display); color: var(--acc-lo); -webkit-text-stroke: 10px color-mix(in srgb, var(--accent) 30%, #000);
  text-shadow: 0 3px 0 color-mix(in srgb, var(--accent) 30%, #000), 0 6px 0 color-mix(in srgb, var(--accent) 30%, #000), 0 9px 0 color-mix(in srgb, var(--accent) 24%, #000),
    0 12px 0 color-mix(in srgb, var(--accent) 24%, #000), 0 15px 0 #020617, 0 26px 22px rgba(0,0,0,.6);
  animation: cdpop .45s cubic-bezier(.25, 1.6, .45, 1) both; }
/* the lit face of the number, laid over its dark body */
.cd-num::after { content: attr(data-t); position: absolute; left: 0; top: 0; -webkit-text-stroke: 0; text-shadow: none; color: transparent;
  background: linear-gradient(180deg, #fff 18%, var(--acc-hi) 46%, var(--accent) 78%, var(--acc-lo)); -webkit-background-clip: text; background-clip: text; }
.cd-num.go { font-size: 132px; color: #166534; -webkit-text-stroke-color: #052e16;
  text-shadow: 0 3px 0 #052e16, 0 6px 0 #052e16, 0 9px 0 #03200f, 0 12px 0 #03200f, 0 15px 0 #020617, 0 26px 22px rgba(0,0,0,.6); }
.cd-num.go::after { background-image: linear-gradient(180deg, #fff 18%, #bbf7d0 46%, #4ade80 78%, #16a34a); }
@keyframes cdpop { from { transform: scale(2.2); opacity: 0; } }
/* the passage to type */
.textframe { margin-bottom: 9px; }
.race-text { padding: 14px 20px 16px; font-size: 24px; max-height: 190px; overflow-y: auto; }
.speedtest .race-text { max-height: 46vh; min-height: 200px; font-size: 26px; }
/* the speed test's clock: a display sunk into a frame */
.bigclock { align-self: center; min-width: 150px; text-align: center; padding: 6px 28px 9px; border-radius: 20px; border: 5px solid; border-color: var(--face-hi) var(--face) var(--face-lo) var(--face);
  font: 700 54px/1.1 var(--display); color: var(--cur-hi); text-shadow: 0 0 16px var(--cur), 0 3px 0 rgba(0,0,0,.6);
  background: linear-gradient(180deg, var(--pit), color-mix(in srgb, var(--field, #050818) 86%, #000));
  box-shadow: inset 0 5px 10px rgba(0,0,0,.85), 0 -1px 0 rgba(255,255,255,.3), 0 6px 0 var(--wall-c), 0 8px 0 rgba(0,0,0,.4), 0 16px 22px rgba(0,0,0,.45); margin-bottom: 6px; }
.bigclock.low { color: #fecaca; text-shadow: 0 0 16px #ef4444, 0 3px 0 rgba(0,0,0,.6); animation: blink 1s steps(2) infinite; }
.bigclock.waiting { font: 800 17px/1.4 var(--font); color: var(--muted); text-shadow: none; padding: 13px 24px; }

/* ---------- boss ---------- */
.boss { display: flex; flex-direction: column; gap: 14px; }
.arena { height: 320px; }
/* a burst of light over the arena when a shot lands */
.arena-light { position: absolute; inset: 0; z-index: 1; pointer-events: none; opacity: 0;
  background: radial-gradient(circle at 80% 48%, rgba(255,255,255,.9), color-mix(in srgb, var(--accent) 50%, transparent) 20%, transparent 56%); }
.arena.lit .arena-light { animation: arenalit .42s ease-out; }
@keyframes arenalit { from { opacity: 1; } to { opacity: 0; } }
.hero { position: absolute; left: 9%; bottom: 32px; z-index: 2; }
.hero-body { font: 100px/1.05 var(--emoji); transform-origin: 50% 100%; animation: breathe 2.4s ease-in-out infinite; }
@keyframes breathe { 50% { transform: translateY(-3px) scale(1.02, 1.035); } }
/* the emoji dragon faces left: turn it to face its foe */
body[data-skin="dragon"] .hero .emo { --sx: -1; transform: scaleX(-1); }
.hero .gshadow { bottom: -10px; width: 126px; height: 26px; margin-left: -63px; }
.hero.attack .hero-body { animation: lunge .3s ease-out; }
@keyframes lunge { 30% { transform: translateX(24px) rotate(7deg); } }
.hero.hit .hero-body { animation: knock .38s ease-out; }
@keyframes knock { 25% { transform: translateX(-18px) rotate(-11deg); } 60% { transform: translateX(6px); } }
.foe { position: absolute; right: 7%; top: 0; bottom: 0; width: 230px; z-index: 2; }
.foe-plate { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 8px; padding-top: 12px; }
.foe-name { font: 600 16px/1.2 var(--display); color: #fff; padding: 4px 14px 5px; border-radius: 11px; white-space: nowrap; text-shadow: 0 1px 0 #000;
  background: linear-gradient(180deg, #3b4a68 0, #1e2942 46%, #0d1326 54%, #060a17 100%); border: 1.5px solid; border-color: #e2e8f0 #64748b #475569 #cbd5e1;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 3px 0 #010409, 0 8px 10px rgba(0,0,8,.5); }
/* the boss's health: a glass gauge in a metal rim, with a notch for each hit it can take */
.hpbar { position: relative; width: 214px; height: 24px; border-radius: 12px; background: linear-gradient(180deg, #f1f5f9, #94a3b8 48%, #475569);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9), inset 0 -1px 0 rgba(0,0,0,.4), 0 3px 0 #1e293b, 0 8px 10px rgba(0,0,8,.5); }
.hp-in { position: absolute; inset: 4px; border-radius: 8px; overflow: hidden; background: linear-gradient(180deg, #020617, #1e293b); box-shadow: inset 0 2px 4px #000; }
.hp-in b, .hp-in i { position: absolute; inset: 0; border-radius: 8px; will-change: transform; }
.hp-in b { background: #fef3c7; transition: transform .7s .25s ease-out; }
.hp-in i { background: linear-gradient(180deg, #fb7185 0, #ef4444 40%, #dc2626 60%, #991b1b 100%); transition: transform .3s cubic-bezier(.3, 1.4, .6, 1); }
.hpbar.low .hp-in i { background: linear-gradient(180deg, #fdba74 0, #f97316 40%, #ea580c 60%, #9a3412 100%); }
.hpbar u { position: absolute; inset: 4px; border-radius: 8px; pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,.6) 0, rgba(255,255,255,.16) 36%, transparent 44%, transparent 70%, rgba(0,0,0,.28)),
    repeating-linear-gradient(90deg, transparent 0, transparent calc(100% / var(--n, 6) - 2px), rgba(2,6,23,.8) calc(100% / var(--n, 6) - 2px), rgba(2,6,23,.8) calc(100% / var(--n, 6))); }
/* the boss hovers; its shadow on the ground shrinks as it rises */
.foe-emoji { position: absolute; left: 0; right: 0; bottom: 60px; text-align: center; font: 118px/1.05 var(--emoji); animation: hover 1.7s ease-in-out infinite alternate; }
@keyframes hover { from { transform: translateY(0); } to { transform: translateY(-16px); } }
.foe .gshadow { bottom: 20px; width: 156px; height: 30px; margin-left: -78px; animation: hovershadow 1.7s ease-in-out infinite alternate; }
@keyframes hovershadow { to { transform: scale(.68); opacity: .5; } }
.foe-emoji .emo { position: relative; }
.foe-emoji .aura { position: absolute; left: 50%; top: 52%; width: 210px; height: 210px; margin: -105px 0 0 -105px; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent2) 55%, transparent), transparent 66%); animation: aura 2s ease-in-out infinite alternate; }
@keyframes aura { from { transform: scale(.85); opacity: .5; } to { transform: scale(1.12); opacity: .95; } }
/* struck: it is knocked back and lit up for a moment */
.foe-emoji::after { content: ''; position: absolute; left: 50%; top: 50%; width: 200px; height: 200px; margin: -100px 0 0 -100px; border-radius: 50%; opacity: 0; pointer-events: none;
  background: radial-gradient(closest-side, rgba(255,255,255,.95), rgba(255,255,255,.55) 42%, transparent 76%); }
.foe-emoji.hurt::after { animation: arenalit .32s ease-out; }
.foe-emoji.hurt .emo { animation: foehit .32s ease-out; }
@keyframes foehit { 30% { transform: translateX(18px) rotate(9deg) scale(.92); } 65% { transform: translateX(-5px); } }
.foe-emoji.attack .emo { animation: foeattack .38s ease-out; }
@keyframes foeattack { 30% { transform: translateX(-22px) rotate(-8deg) scale(1.08); } }
.defeated { animation: defeat .8s forwards !important; }
@keyframes defeat { to { transform: rotate(-90deg) scale(.3); opacity: 0; } }
.foe.ko .gshadow, .hero.ko .gshadow { animation: none; opacity: 0; transition: opacity .6s; }
.foe.ko .aura { display: none; }
.proj { position: absolute; font: 46px/0 var(--emoji); z-index: 5; pointer-events: none; filter: drop-shadow(0 0 10px rgba(255,255,255,.55)); }
.proj .proj-spr { display: block; }
.proj .spr-bolt { width: 90px; height: 30px; }
.proj .spr-fireball { width: 92px; height: 52px; }
.proj .spr-heart, .proj .spr-darkheart { width: 54px; height: 50px; }
.proj .spr-plasma { width: 58px; height: 58px; }
.proj .spr-iceshard { width: 78px; height: 40px; }
.proj .emo { font-size: 46px; line-height: 1; text-shadow: none; }
/* the word to type, on a screen sunk into a thick panel, with the timer as a glass tube below it */
.prompt { text-align: center; }
.prompt .screen { padding: 8px 16px 12px; }
.prompt-word { font: 700 46px/1.4 var(--mono); letter-spacing: .06em; min-height: 64px; color: #f8fafc; white-space: nowrap; text-shadow: 0 2px 0 rgba(0,0,0,.6); transition: opacity .15s; }
.prompt-word b { font-weight: 700; color: var(--good); }
.prompt-word u { position: relative; top: -4px; display: inline-block; text-decoration: none; text-shadow: none; color: var(--cur-text); padding: 0 .1em; margin: 0 .06em; border-radius: 9px;
  background: linear-gradient(180deg, var(--cur-hi), var(--cur) 58%); box-shadow: inset 0 2px 0 rgba(255,255,255,.75), 0 6px 0 var(--cur-lo), 0 12px 12px rgba(0,0,0,.6); }
.prompt-word u:empty { display: none; }
.prompt-word.gone { opacity: .2; }
.timer { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding: 0 2px 1px; }
.timer .emo { font-size: 22px; line-height: 1; text-shadow: 0 2px 2px rgba(0,0,0,.5); }
.timebar { position: relative; flex: 1; height: 20px; border-radius: 10px; overflow: hidden; background: linear-gradient(180deg, #020617, #1e293b);
  box-shadow: inset 0 3px 5px #000, 0 1px 0 var(--hi), 0 0 0 2px rgba(0,0,0,.35); }
.timebar i { position: absolute; inset: 0; border-radius: 10px; will-change: transform; background: linear-gradient(90deg, #15803d, #22c55e 40%, #86efac); }
.timebar.low i { background: linear-gradient(90deg, #b91c1c, #ef4444 40%, #fb923c); }
/* the glass: a bright streak along the top, shade along the bottom */
.timebar::after { content: ''; position: absolute; inset: 0; border-radius: 10px; pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,.6) 0, rgba(255,255,255,.16) 36%, transparent 46%, transparent 68%, rgba(0,0,0,.3));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.14); }

/* ---------- the start, pause and results panels ---------- */
.overlay { position: fixed; inset: 0; z-index: 20; display: flex; padding: 26px 14px; overflow-y: auto;
  background: radial-gradient(circle at 50% 38%, rgba(6,8,24,.74), rgba(2,3,10,.92)); animation: g-fade .18s ease-out; }
.overlay.ov-start, .overlay.ov-pause { padding-top: 72px; }
.overlay.ov-result { padding-top: 48px; }
@keyframes g-fade { from { opacity: 0; } }
@keyframes g-pop { from { transform: scale(.86); opacity: 0; } }
.overlay > .fx { z-index: 0; }
/* a thick slab: lit top edge, shaded foot, a side wall and a long shadow */
.overlay-box { position: relative; z-index: 1; margin: auto; width: 100%; max-width: 580px; text-align: center; padding: 26px 30px; border-radius: 30px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 20%, var(--face-hi)) 0, var(--face) 34%, var(--face-lo) 100%);
  border: 2px solid; border-color: rgba(255,255,255,.6) rgba(255,255,255,.16) rgba(0,0,0,.4) rgba(255,255,255,.26);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.22), inset 0 -4px 0 rgba(0,0,0,.24), 0 11px 0 var(--wall-c), 0 13px 0 rgba(0,0,0,.5), 0 34px 60px rgba(0,0,0,.6);
  animation: g-pop .32s cubic-bezier(.3, 1.5, .5, 1) both; }
.overlay-box h2 { font-size: 32px; text-shadow: 0 2px 0 rgba(0,0,0,.4); }
.overlay-box p { font-weight: 700; }
.btnrow { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 20px; }
/* the round badge that sits on the top edge of the start and pause panels */
.ov-start .overlay-box, .ov-pause .overlay-box { padding-top: 62px; }
.ov-icon { position: absolute; left: 50%; top: -50px; width: 100px; height: 100px; margin-left: -50px; border-radius: 50%; display: grid; place-items: center; font-size: 48px; line-height: 1;
  background: radial-gradient(circle at 34% 26%, var(--acc-hi), var(--accent) 50%, var(--acc-lo));
  box-shadow: inset 0 3px 0 rgba(255,255,255,.65), inset 0 -5px 0 rgba(0,0,0,.25), 0 6px 0 color-mix(in srgb, var(--accent) 36%, #000), 0 8px 0 rgba(0,0,0,.4), 0 18px 20px rgba(0,0,0,.5); }
.ov-icon::before { content: ''; position: absolute; inset: 10px; border-radius: 50%; background: radial-gradient(circle at 50% 22%, var(--face), var(--pit) 80%);
  box-shadow: inset 0 5px 9px rgba(0,0,0,.75), 0 1px 0 rgba(255,255,255,.5); }
.ov-icon .emo { position: relative; text-shadow: 0 4px 4px rgba(0,0,0,.45); }
.ov-help { font-size: 17px; }
/* the keys on the start panel are little keycaps */
.overlay-box kbd { min-width: 1.9em; padding: .12em .5em .16em; margin: 0 2px; border-radius: 7px; border: 0; color: #fff; font-weight: 700;
  background: linear-gradient(180deg, color-mix(in srgb, var(--face-hi) 80%, #fff), var(--face-hi) 40%, var(--face));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.55), 0 3px 0 var(--wall-c), 0 5px 5px rgba(0,0,0,.4); }
.overlay-box .newkeys kbd { font-size: 1.3em; padding: .15em .6em .2em; border-radius: 9px; color: var(--cur-text);
  background: linear-gradient(180deg, var(--cur-hi), var(--cur) 60%); box-shadow: inset 0 2px 0 rgba(255,255,255,.7), 0 4px 0 var(--cur-lo), 0 7px 8px rgba(0,0,0,.45); }
.overlay-box .tip { border-radius: 14px; padding: 11px 16px; font-weight: 700; background: linear-gradient(180deg, var(--pit), color-mix(in srgb, var(--field, #050818) 80%, #000));
  box-shadow: inset 0 4px 9px rgba(0,0,0,.7), inset 0 0 0 1px rgba(0,0,0,.5), 0 1px 0 var(--hi); }
.overlay-box .homerow { margin-bottom: 0; line-height: 2.1; }

/* results: the headline is a ribbon folded round the top of the panel */
.ov-result .overlay-box { padding-top: 60px; }
.ov-ribbon { position: absolute; left: -16px; right: -16px; top: -20px; height: 62px; margin: 0; display: grid; place-items: center; border-radius: 12px;
  color: var(--accent-text); background: linear-gradient(180deg, var(--acc-hi), var(--accent) 48%, color-mix(in srgb, var(--accent) 80%, #000));
  box-shadow: inset 0 2px 0 rgba(255,255,255,.6), inset 0 -3px 0 rgba(0,0,0,.2), 0 6px 0 var(--acc-lo), 0 16px 16px rgba(0,0,0,.4); }
.overlay-box .ov-ribbon { font-size: 34px; text-shadow: 0 1px 0 rgba(255,255,255,.3); }
.ov-ribbon span { position: relative; }
/* the folds where the ribbon tucks behind the panel */
.ov-ribbon::before, .ov-ribbon::after { content: ''; position: absolute; top: calc(100% + 6px); border-style: solid; border-color: color-mix(in srgb, var(--accent) 30%, #000) transparent transparent; }
.ov-ribbon::before { left: 0; border-width: 12px 0 0 14px; }
.ov-ribbon::after { right: 0; border-width: 12px 14px 0 0; }
.ov-lose .ov-ribbon { color: #fff; background: linear-gradient(180deg, #94a3b8, #64748b 48%, #475569); box-shadow: inset 0 2px 0 rgba(255,255,255,.5), inset 0 -3px 0 rgba(0,0,0,.2), 0 6px 0 #1e293b, 0 16px 16px rgba(0,0,0,.4); }
.overlay-box .ov-lose .ov-ribbon, .ov-lose .overlay-box .ov-ribbon { text-shadow: 0 2px 0 rgba(0,0,0,.35); }
.ov-lose .ov-ribbon::before, .ov-lose .ov-ribbon::after { border-top-color: #0f172a; }
.ov-why { margin: 2px 0 10px; }
/* three star slots; each star won drops into its slot with a bounce, then glints */
.stars3 { position: relative; isolation: isolate; display: flex; justify-content: center; align-items: flex-end; gap: 4px; height: 126px; margin: 2px 0 12px; }
.stars3.sunburst::before { content: ''; position: absolute; left: 50%; top: 50%; width: 360px; height: 360px; margin: -180px 0 0 -180px; z-index: -1; border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, rgba(253,224,71,.34) 0 10deg, transparent 10deg 20deg);
  -webkit-mask: radial-gradient(circle, #000 18%, transparent 68%); mask: radial-gradient(circle, #000 18%, transparent 68%); animation: spin 14s linear infinite; }
.bigstar { position: relative; flex: none; width: 92px; height: 92px; font: 80px/92px var(--display); color: #fcd34d; }
.bigstar.s1 { transform: rotate(-13deg); }
.bigstar.s2 { width: 116px; height: 116px; margin-bottom: 10px; font-size: 100px; line-height: 116px; }
.bigstar.s3 { transform: rotate(13deg); }
.st-slot, .st-won { position: absolute; inset: 0; }
.st-slot { color: #0006; }
.bigstar .spr { display: block; width: 100%; height: 100%; }
/* the two shadows make the star a thick gold piece: a dark gold edge under it, then its shadow on the panel */
.st-won { filter: drop-shadow(0 5px 0 #a16207) drop-shadow(0 11px 9px rgba(0,0,0,.5)); animation: starpop .6s cubic-bezier(.3, 1.7, .5, 1) var(--d, .3s) both; }
@keyframes starpop { 0% { transform: scale(0) rotate(-150deg); opacity: 0; } 55% { opacity: 1; } }
.st-glint { position: absolute; left: 12%; top: 8%; width: 40%; height: 40%; background: #fff; opacity: 0; pointer-events: none;
  clip-path: polygon(50% 0, 58% 42%, 100% 50%, 58% 58%, 50% 100%, 42% 58%, 0 50%, 42% 42%); animation: glint 2.8s ease-out calc(var(--d, .3s) + .45s) infinite; }
@keyframes glint { 0% { opacity: 0; transform: scale(0) rotate(0deg); } 12% { opacity: 1; transform: scale(1) rotate(40deg); } 28%, 100% { opacity: 0; transform: scale(.2) rotate(90deg); } }
/* the numbers: dark glossy tiles, each with a coloured tab */
.ov-stats { display: flex; justify-content: center; gap: 12px; margin: 14px 0 6px; }
.ov-stats > div { position: relative; flex: 1 1 0; max-width: 156px; min-width: 0; padding: 12px 6px 9px; border-radius: 16px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--face) 55%, var(--pit)), var(--pit));
  border: 1px solid; border-color: rgba(255,255,255,.3) rgba(255,255,255,.08) rgba(0,0,0,.5) rgba(255,255,255,.14);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.16), 0 5px 0 color-mix(in srgb, var(--pit) 60%, #000), 0 11px 12px rgba(0,0,0,.4); }
.ov-stats > div::before { content: ''; position: absolute; left: 22%; right: 22%; top: -1px; height: 6px; border-radius: 0 0 6px 6px; background: var(--tab, #22d3ee);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.6), 0 2px 8px var(--tab, #22d3ee); }
.ov-stats .st-acc { --tab: #4ade80; }
.ov-stats .st-time { --tab: #fbbf24; }
.ov-stats b { display: block; font: 600 28px/1.15 var(--display); color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,.5); }
.ov-stats small { display: block; color: var(--muted); font-weight: 800; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.ov-big { display: inline-flex; flex-direction: column; align-items: center; margin: 4px auto 8px; padding: 10px 40px 12px; border-radius: 20px;
  background: linear-gradient(180deg, var(--pit), color-mix(in srgb, var(--field, #050818) 86%, #000));
  box-shadow: inset 0 6px 12px rgba(0,0,0,.85), inset 0 0 0 2px rgba(0,0,0,.55), 0 2px 0 var(--hi); }
.ov-big b { font: 700 68px/1.05 var(--display); color: #fde68a; text-shadow: 0 2px 0 #d97706, 0 4px 0 #92400e, 0 6px 0 #451a03, 0 10px 12px rgba(0,0,0,.6); }
.ov-big small { color: var(--muted); font-weight: 800; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; }
.ov-banner { margin-top: 16px; padding: 10px 14px 11px; border-radius: 14px; font-weight: 800; color: #fff; text-shadow: 0 1px 0 rgba(0,0,0,.4);
  background: linear-gradient(180deg, #4ade80, #16a34a 55%, #15803d); border: 1px solid rgba(255,255,255,.4);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.45), 0 5px 0 #14532d, 0 11px 12px rgba(0,0,0,.35); animation: g-pop .4s .9s both; }
.ov-banner.best { margin: 0 0 14px; color: #3b2500; text-shadow: 0 1px 0 rgba(255,255,255,.4); background: linear-gradient(180deg, #fef08a, #facc15 55%, #eab308);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.6), 0 5px 0 #a16207, 0 11px 12px rgba(0,0,0,.35); animation-delay: .3s; }
/* a new badge: a gold medal on a gold-rimmed plaque */
.ov-badge { position: relative; isolation: isolate; display: flex; gap: 14px; align-items: center; text-align: left; margin-top: 16px; padding: 9px 16px 10px 12px; border-radius: 18px;
  background: linear-gradient(180deg, rgba(253,224,71,.24), rgba(253,224,71,.05) 60%), var(--pit); border: 2px solid; border-color: #fef08a #d97706 #92400e #fbbf24;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.3), 0 5px 0 #78350f, 0 11px 12px rgba(0,0,0,.4); animation: g-pop .4s both; }
.ov-badge b { display: block; font: 600 17px/1.25 var(--display); color: #fff; text-shadow: 0 1px 0 rgba(0,0,0,.5); }
.ov-badge small { display: block; color: var(--muted); font-weight: 700; }
.ov-medal { position: relative; flex: none; width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; font-size: 28px; line-height: 1;
  background: radial-gradient(circle at 34% 26%, #fffbeb, #fde047 32%, #f59e0b 70%, #b45309);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.85), inset 0 -4px 0 rgba(120,53,15,.45), 0 4px 0 #92400e, 0 9px 9px rgba(0,0,0,.45); }
.ov-medal::before { content: ''; position: absolute; inset: 7px; border-radius: 50%; background: radial-gradient(circle at 40% 28%, #fef3c7, #fbbf24 60%, #d97706);
  box-shadow: inset 0 3px 5px rgba(120,53,15,.7), 0 1px 0 rgba(255,255,255,.75); }
.ov-medal .emo { position: relative; text-shadow: 0 2px 2px rgba(120,53,15,.6); }

@media (max-width: 720px) {
  .play-top { flex-wrap: wrap; gap: 10px; }
  .hud { width: 100%; gap: 8px; }
  .hud-item { flex: 1 1 0; min-width: 0; padding-left: 6px; padding-right: 6px; }
  .pt-act { font-size: 20px; }
  .bezel { padding: 9px; border-radius: 20px; }
  .rain, .track, .arena { border-width: 4px; border-radius: 20px; }
  .learn .screen { padding: 18px 12px 12px; }
  .learn .big { font-size: 28px; }
  .learn-prog { gap: 12px; }
  .learn-prog i + i::before { width: 12px; }
  .race-text { font-size: 20px; padding: 10px 14px 12px; }
  .speedtest .race-text { font-size: 21px; }
  .arena { height: 260px; }
  .hero { left: 5%; bottom: 20px; }
  .hero-body { font-size: 64px; }
  .hero .gshadow { width: 84px; height: 18px; margin-left: -42px; bottom: -7px; }
  .foe { right: 3%; width: 170px; }
  .foe-name { font-size: 13.5px; white-space: normal; text-align: center; padding: 3px 10px 4px; }
  .hpbar { width: 160px; height: 20px; }
  .foe-emoji { font-size: 80px; bottom: 44px; }
  .foe-emoji .aura { width: 150px; height: 150px; margin: -75px 0 0 -75px; }
  .foe .gshadow { bottom: 12px; width: 110px; height: 22px; margin-left: -55px; }
  .prompt-word { font-size: 34px; min-height: 50px; }
  .cd-num { font-size: 110px; -webkit-text-stroke-width: 8px; }
  .cd-num.go { font-size: 92px; }
  .track { height: 270px; }
  .road { left: 8px; right: 8px; bottom: 29px; height: 360px; }
  .road-wall { left: 8px; right: 8px; bottom: 9px; height: 20px; }
  .lane-ruler { left: 30px; right: 88px; }
  .road-start { left: 62px; }
  .overlay-box { padding: 22px 16px; border-radius: 24px; }
  .ov-result .overlay-box { padding-top: 54px; }
  .ov-ribbon { left: -9px; right: -9px; height: 54px; }
  .ov-ribbon::before { border-width: 9px 0 0 9px; }
  .ov-ribbon::after { border-width: 9px 9px 0 0; }
  .overlay-box .ov-ribbon { font-size: 27px; }
  .overlay-box h2 { font-size: 27px; }
  .stars3 { height: 100px; }
  .bigstar { width: 70px; height: 70px; font-size: 60px; line-height: 70px; }
  .bigstar.s2 { width: 90px; height: 90px; font-size: 78px; line-height: 90px; }
  .ov-stats { gap: 8px; }
  .ov-stats b { font-size: 23px; }
  .ov-stats small { font-size: 9.5px; letter-spacing: 0; }
  .ov-badge { padding-right: 10px; }
}

/* reduced motion: keep the hit feedback visible instead of jumping straight to its faded end */
@media (prefers-reduced-motion: reduce) { .boom, .floattext { animation: none !important; } }
/* a landed word: its ground shadow fades with it */
.dshadow.gone { opacity: 0 !important; transition: opacity .25s ease-out; }
.dshadow.gone::after { display: none; }

/* short desktop windows (1280x800, Chromebooks): keep the whole keyboard and finger hint in view */
@media (min-width: 721px) and (max-height: 880px) {
  .track { height: 270px; } .road { height: 360px; } .arena { height: 270px; }
  .foe-emoji { font-size: 100px; bottom: 50px; } .bezel { padding: 9px; }
  .race, .boss { gap: 10px; } .play-top { margin-bottom: 8px; }
}

/* Chrome 110 and older (some school Chromebooks are frozen there) do not know color-mix():
   give the parts that must stay readable plain colours. Newer browsers skip this block. */
@supports not (color: color-mix(in srgb, #000, #fff)) {
  .play { --face-hi: #565e81; --face-lo: #1a2140; --wall-c: #101427; --pit: #03050e; --acc-hi: #8ce8f6; --acc-lo: #147f8f; }
  body[data-skin="dragon"] .play { --face-hi: #546c68; --face-lo: #182e29; --wall-c: #0f1c1a; --pit: #071711; --acc-hi: #f79e9e; --acc-lo: #8f2929; }
  body[data-skin="pop"] .play { --face-hi: #724c81; --face-lo: #321240; --wall-c: #1f0b27; --pit: #19041f; --acc-hi: #f9b6d9; --acc-lo: #92446d; }
  .play::before { background: rgba(4, 5, 16, .8); }
  .screen, .bigclock, .ov-big, .overlay-box .tip, .ov-stats > div { background: var(--pit); }
  .overlay-box { background: linear-gradient(180deg, var(--face-hi), var(--face) 34%, var(--face-lo)); }
  .overlay-box kbd { background: var(--face-hi); }
  .ov-ribbon { background: var(--accent); }
  .beam i { background: var(--b); }
  .rlane.mine { background: rgba(255, 255, 255, .18); }
}

/* drawn characters (art-chars-*.js); the emoji stays as the fallback when one is missing */
.rbody svg.racer-chr { display: block; width: 66px; height: 53px; margin: -8px 0 -3px; overflow: visible; }
.hero-body svg.hero-spr { display: block; width: 112px; height: 121px; overflow: visible; }
.foe-emoji svg.foe-spr { position: relative; display: inline-block; width: 150px; height: 150px; overflow: visible; vertical-align: bottom; }
@media (min-width: 721px) and (max-height: 880px) { .foe-emoji svg.foe-spr { width: 128px; height: 128px; } .hero-body svg.hero-spr { width: 98px; height: 106px; } }
@media (max-width: 720px) { .foe-emoji svg.foe-spr { width: 100px; height: 100px; } .hero-body svg.hero-spr { width: 80px; height: 87px; } }
.pt-ico svg.pt-spr { position: relative; width: 28px; height: 28px; filter: drop-shadow(0 2px 1px rgba(0,0,0,.45)); }

/* ---------- typing assessment ---------- */
/* a block of text several lines deep; with no keyboard below it, it can take more of the screen */
.assess .race-text { --rows: 8; height: calc(1.85em * var(--rows) + 30px); max-height: none; min-height: 0; line-height: 1.85; overflow: hidden; }
.assess .bigclock { min-width: 170px; }
/* Mistakes that have been left. They are underlined as well as red, so that they do not depend on colour alone:
   a solid line under a wrong letter, dots under one that was missed out, a bar where an extra one was typed, and a
   word that was nothing like it struck through. */
.assess .c.done.err, .assess .c.done.miss { text-decoration: underline; text-decoration-color: currentColor; text-decoration-thickness: 3px; text-underline-offset: 6px; }
.assess .c.done.miss { color: color-mix(in srgb, var(--bad) 72%, var(--muted)); text-decoration-style: dotted; }
.assess .c.done.ins { box-shadow: 3px 0 0 -1px var(--bad); border-radius: 0; }
.assess .c.done.err.junk { color: color-mix(in srgb, var(--bad) 70%, var(--muted)); text-decoration-line: line-through; text-decoration-thickness: 2px; }
.as-hint { text-align: center; margin: 12px 0 0; color: var(--muted); font-weight: 700; font-size: 15.5px; }
.as-slips { margin: 4px 0 6px; color: color-mix(in srgb, var(--text) 82%, var(--muted)); }
.as-slips b.bad { color: #fca5a5; }
.play.no-kb .play-main { margin-bottom: 0; }
/* the block is a whole number of lines deep, fewer on a short screen, so a line is never cut in half */
@media (max-height: 880px) { .assess .race-text { --rows: 7; font-size: 24px; } }
@media (max-height: 720px) { .assess .race-text { --rows: 5; font-size: 22px; } }
@media (max-width: 720px) { .assess .race-text { --rows: 7; font-size: 20px; } }
/* the results: the rank is the prize */
.ov-assess .as-res { display: flex; flex-direction: column; align-items: center; }
.ov-assess .rank-em.huge { margin: 2px 0 6px; animation: rankin .7s cubic-bezier(.2, 1.4, .4, 1) both; }
@keyframes rankin { from { transform: scale(.3) rotate(-14deg); opacity: 0; } to { transform: none; opacity: 1; } }
.as-res-name { margin-bottom: 4px; }
.as-res-name small { display: block; color: var(--muted); font-weight: 800; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.as-res-name b { display: block; font: 600 30px/1.15 var(--display); color: #fde68a; text-shadow: 0 2px 0 #92400e, 0 4px 0 #451a03, 0 7px 10px rgba(0, 0, 0, .55); }
.ov-assess .ov-stats { width: 100%; }
.ov-assess .ov-stats > div { max-width: 190px; }
.ov-assess .ov-stats .st-wpm b { font-size: 38px; color: #fde68a; }
.ov-assess .ov-stats .st-acc.low b { color: #fca5a5; }
.ov-stats .st-slips { --tab: #fbbf24; }
.ov-assess .ov-stats .st-slips em { display: block; font-style: normal; font-weight: 800; font-size: 13px; color: var(--good); }
.ov-assess .ov-why b { color: var(--text); }
@media (max-height: 700px) { .ov-assess .rank-em.huge { width: 92px; height: 92px; font-size: 64px; margin: 0 0 2px; } .as-res-name b { font-size: 25px; } .ov-assess .as-slips, .ov-assess .ov-why { margin: 2px 0 4px; } }

/* ===== scenes.css ===== */
/* ==========================================================================
   Touch Typing Quest - the illustrated scenes: where they sit, and the
   animation classes all three skins share. Each skin can add its own in
   scene-space.css, scene-dragon.css and scene-pop.css.
   ========================================================================== */
#scene { position: fixed; inset: 0; z-index: -1; pointer-events: none; }
#scene .scene { display: block; width: 100%; height: 100%; }
body[data-skin="teacher"] #scene { display: none; }
body.playing #scene * { animation-play-state: paused !important; }
.play:has(> .overlay) .scene * { animation-play-state: paused !important; }
.scene .tw { animation: twinkle 3.2s ease-in-out infinite; }
@keyframes twinkle { 50% { opacity: .2; } }
.scene .shoot { opacity: 0; animation: shoot 11s linear infinite; }
@keyframes shoot { 0% { opacity: 0; transform: translate(1350px, 70px) rotate(152deg); } 1.5% { opacity: 1; }
  7% { opacity: 0; transform: translate(760px, 380px) rotate(152deg); } 100% { opacity: 0; transform: translate(760px, 380px) rotate(152deg); } }
.scene .drift { animation: drift 90s ease-in-out infinite alternate; }
.scene .drift.slow { animation-duration: 40s; }
@keyframes drift { from { transform: translateX(-60px); } to { transform: translateX(60px); } }
.scene .spot { animation: sweep 8s ease-in-out infinite alternate; }
@keyframes sweep { from { transform: rotate(-16deg); } to { transform: rotate(16deg); } }
.scene .bulb { animation: bulb 1.2s steps(2) infinite; }
@keyframes bulb { 50% { opacity: .3; } }
.scene .flicker { animation: flicker 6s linear infinite; }
@keyframes flicker { 0%, 90%, 93%, 96%, 100% { opacity: 1; } 91.5%, 94.5% { opacity: .35; } }
.emo { font-family: var(--emoji); }
.spr { overflow: visible; }

/* parallax layers are moved by art.js; the transform must stay cheap */
.scene .plx { will-change: transform; }

/* ===== cert.css ===== */
/* ==========================================================================
   Touch Typing Quest - the certificate: its pop-up, its card on the badges
   page, its banners, and how it prints. The certificate itself is a drawing:
   see cert.js.
   ========================================================================== */

/* ---------- the pop-up ---------- */
.modal.cert-modal { max-width: 980px; }
.cert-bar { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: flex-end; margin: 0 0 14px; }
.cert-bar label { flex: 1 1 230px; max-width: 330px; }
.cert-modal .cert-note { flex: 1 1 280px; margin: 0; }
#certErr { margin: 0 0 8px; }
/* some browsers have to be told the shape of a drawing */
svg.cert { aspect-ratio: 1188 / 836; }
.cert-view { display: grid; gap: 18px; justify-items: center; }
.cert-view .cert { display: block; width: min(100%, max(480px, (100vh - 250px) * 1.42)); height: auto; border-radius: 5px; background: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .12), 0 4px 10px rgba(0, 0, 0, .28), 0 16px 34px rgba(0, 0, 0, .34); }

/* the buttons over a class list: they go on to a second line together, or not at all */
.hw-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
/* a whole class of them: smaller, side by side */
.cert-view.many { grid-template-columns: repeat(auto-fill, minmax(min(100%, 400px), 1fr)); }
.cert-view.many .cert { width: 100%; }

/* ---------- the card at the top of the badges ---------- */
.cert-card { display: flex; gap: 26px; align-items: center; }
.cert-thumb { position: relative; flex: 0 0 330px; display: block; margin: 0; padding: 0; border: 0; border-radius: 8px; overflow: hidden; background: #fff;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .3), 0 4px 10px rgba(0, 0, 0, .35), 0 12px 26px rgba(0, 0, 0, .35); }
.cert-thumb .cert { display: block; width: 100%; height: auto; }
button.cert-thumb { cursor: pointer; transition: transform .15s; }
button.cert-thumb:hover { transform: scale(1.02); }
button.cert-thumb:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
/* not earned yet: what it will look like, faint, behind a padlock */
div.cert-thumb { background: #1a1f36; }
div.cert-thumb .cert { opacity: .34; }
div.cert-thumb .lock-disc { position: absolute; left: 50%; top: 50%; margin: 0; width: 84px; height: 84px; transform: translate(-50%, -50%); }
div.cert-thumb .lock-disc .spr { width: 46px; height: 46px; }
.cert-side { flex: 1; min-width: 0; }
.cert-side h3 { margin: 0 0 .3em; font-size: 24px; }
.cert-side p { margin: 0 0 12px; font-weight: 600; }
.cert-steps { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 7px; font-weight: 700; }
.cert-steps li { display: flex; align-items: center; gap: 9px; color: var(--muted); }
.cert-steps li.on { color: var(--text); }
.cert-steps i { flex: none; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; font: 800 14px/1 var(--font); border: 2px solid var(--muted); opacity: .8; }
.cert-steps li.on i { color: #052e16; background: #4ade80; border-color: #4ade80; opacity: 1; }
/* words for screen readers only */
.cert-steps .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- the banners ---------- */
.mission.cert-now { --mc: #f5b722; }
.mission.cert-now strong { color: var(--text); }
.ov-banner.grad { color: #3b2500; text-shadow: 0 1px 0 rgba(255, 255, 255, .4); background: linear-gradient(180deg, #fef08a, #facc15 55%, #eab308);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .6), 0 5px 0 #a16207, 0 11px 12px rgba(0, 0, 0, .35); }

@media (max-width: 720px) {
  .cert-card { flex-wrap: wrap; gap: 16px; }
  .cert-thumb { flex: 1 1 100%; }
  .cert-bar .btn { flex: 1 1 100%; }
}

/* ---------- on paper ----------
   Only the copies that cert.js has put straight under <body>. The sprites stay
   as well: the certificate's pictures are drawn from them, and they take up no
   room. Each certificate is a millimetre shorter than its sheet, so there is
   never an empty sheet after it. */
#certprint { display: none; }
@media print {
  body.certing { margin: 0; min-height: 0; background: #fff !important; }
  body.certing > *:not(#certprint):not(#ttq-sprites) { display: none !important; }
  body.certing #certprint { display: block; }
  #certprint .cert { display: block; width: 100%; height: auto; break-inside: avoid; break-after: page; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  #certprint .cert:last-child { break-after: auto; }
}

/* ===== single.css ===== */
/* ==========================================================================
   Touch Typing Quest, home edition: the free trial's locks, the subscribe
   pop-up and the account pop-ups. Everything else is the school edition's
   styling, untouched. Loaded last, in the home edition only.
   ========================================================================== */

/* ---------- on the map ----------
   A stage that needs a subscription is a locked stone, but one you can press:
   pressing it says how to open it. A small gold star marks it out from a stage
   that is only waiting for the one before it. */
.node.pay { cursor: pointer; --s-hi: #b9b3a3; --s-1: #8d8674; --s-2: #57513f; --s-rim1: #e9d48a; --s-rim2: #7a5c12; }
.node.pay:hover .n-stone, .node.pay:focus-visible .n-stone { transform: translateY(-3px); }
.node.pay .n-stone::after { content: ''; position: absolute; right: -4px; top: -6px; width: 22px; height: 22px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff7c2, #fbbf24 55%, #b45309); box-shadow: 0 2px 4px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .7); }
.node.pay .n-stone::before { content: '★'; position: absolute; z-index: 1; right: -4px; top: -6px; width: 22px; height: 22px; display: grid; place-items: center;
  font: 700 13px/1 var(--font); color: #7c2d12; }

/* a padlock on the tabs that need a subscription */
.tab-lock { display: inline-block; width: 15px; height: 15px; margin-left: 3px; vertical-align: -2px; opacity: .85; font-size: 12px; }
.tab-lock .spr { display: block; width: 100%; height: 100%; }

/* the banner when the trial is over */
.mission.sub-due { --mc: #fbbf24; border-color: color-mix(in srgb, #fbbf24 60%, transparent); }
/* words picked out inside a banner's sentence stay the size of the sentence */
.mission p b { font: inherit; font-weight: 800; color: var(--text); text-shadow: none; }

/* a whole tab that needs a subscription */
.sub-lock { max-width: 640px; margin: 10px auto 30px; padding: 30px 26px 26px; }
.sub-lock h2 { font-size: 26px; }
.sub-lock p { max-width: 46ch; margin-left: auto; margin-right: auto; }
.sub-lock .btn { margin: 10px 0 14px; }

/* ---------- the subscribe pop-up ---------- */
.modal.sub-modal { max-width: 680px; }
.sub-top { display: flex; align-items: center; gap: 16px; margin: 0 34px 6px 0; }
.sub-top .lock-disc { flex: none; width: 66px; height: 66px; margin: 0; border-width: 6px; }
.sub-top .lock-disc .spr { width: 36px; height: 36px; }
.sub-top h2 { margin: 0 0 2px; font-size: 25px; }
.sub-top p { margin: 0; }
.sub-list { list-style: none; margin: 16px 0 18px; padding: 0; display: grid; gap: 7px; font-weight: 600; }
.sub-list li { position: relative; padding-left: 30px; }
.sub-list li::before { content: '✓'; position: absolute; left: 0; top: 1px; width: 21px; height: 21px; display: grid; place-items: center; border-radius: 50%;
  font: 800 13px/1 var(--font); color: #052e16; background: var(--good); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6), 0 2px 3px rgba(0, 0, 0, .35); }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; align-items: stretch; margin-bottom: 14px; }
.plans > p { grid-column: 1 / -1; margin: 6px 0; }
.plan { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 18px 18px 22px; border-radius: 18px; border: 1.5px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, .09), rgba(255, 255, 255, .02)), var(--panel); box-shadow: var(--bevel), var(--shadow-1); }
.plan.best { border-color: var(--star); box-shadow: var(--bevel), 0 0 0 2px color-mix(in srgb, var(--star) 45%, transparent), var(--shadow-2); }
.plan-flag { position: absolute; top: -12px; right: 14px; padding: 3px 12px; border-radius: 20px; font: 800 13px/1.4 var(--font); color: #422006;
  background: linear-gradient(180deg, #fde68a, #f59e0b); box-shadow: 0 2px 5px rgba(0, 0, 0, .4), inset 0 1px 0 rgba(255, 255, 255, .7); }
.plan-name { font: 600 19px var(--display); }
.plan-price strong { font: 700 34px/1.1 var(--display); color: var(--star); text-shadow: 0 2px 0 rgba(0, 0, 0, .45); }
.plan-price small { font-weight: 700; color: var(--muted); }
.plan-note { flex: 1; margin: 2px 0 12px; font-size: 14px; font-weight: 600; color: color-mix(in srgb, var(--text) 70%, var(--muted)); }
.sub-start { display: flex; gap: 10px; align-items: flex-start; margin: 0 0 18px; padding: 10px 14px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--card2); font-size: 14.5px; line-height: 1.4; cursor: pointer; }
.sub-start input { flex: none; width: 21px; height: 21px; margin: 0; padding: 0; accent-color: var(--accent); cursor: pointer; }
.sub-start:focus-within { border-color: var(--accent); }
.sub-closed { text-align: center; }
.sub-foot { margin: 6px 0 8px; }
.sub-wait { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 10px 0; font-weight: 700; }
.test-tag { display: inline-block; margin: 4px 0 8px; padding: 3px 12px; border-radius: 20px; font: 800 13px/1.5 var(--font); color: #422006; background: #fde68a; }

/* something is being fetched */
.spin { display: inline-block; flex: none; width: 20px; height: 20px; border-radius: 50%; border: 3px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-top-color: var(--accent); animation: ttqSpin .8s linear infinite; }
.spin.big { width: 46px; height: 46px; border-width: 5px; margin-bottom: 14px; }
@keyframes ttqSpin { to { transform: rotate(360deg); } }

/* ---------- the account pop-ups ---------- */
.modal.ac-modal { max-width: 500px; }
.ac-form { display: grid; gap: 14px; margin: 14px 0 12px; }
.ac-form label small { font-weight: 600; font-size: 12.5px; color: color-mix(in srgb, var(--muted) 80%, transparent); }
.ac-form label.check { align-items: flex-start; font-size: 14.5px; line-height: 1.4; }
.ac-form label.check input { flex: none; width: 20px; height: 20px; margin: 1px 0 0; padding: 0; accent-color: var(--accent); }
.ac-form .error { margin: 0; }
.ac-who { margin: -2px 0 12px; overflow-wrap: anywhere; }
.ac-plan { padding: 14px 16px 6px; margin-bottom: 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--card2); }
.ac-plan p { margin: 4px 0 10px; }
.ac-plan .btn { margin-bottom: 8px; }
.ac-state { font: 600 19px var(--display); }
.ac-state.on { color: var(--good); }
.ac-warn { color: var(--warn); font-weight: 700; }
.ac-name { margin: 0 0 14px; }
.ac-row { display: flex; gap: 8px; align-items: center; }
.ac-row input { flex: 1; }
.ac-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 6px 0 16px; }
.ac-danger { margin-top: 6px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 14.5px; }
.ac-danger summary { cursor: pointer; font-weight: 700; color: var(--muted); }
.ac-danger[open] summary { margin-bottom: 8px; }
.ac-danger .btn { justify-self: start; }
.pay-wait, .pay-done { padding: 14px 6px 6px; }
.pay-done .lock-disc { margin-bottom: 14px; }
.pay-done .lock-disc .spr { width: 58px; height: 58px; }
.pay-done .btn { margin-top: 8px; }

/* What is in the page before the game starts. The game replaces it at once, so
   it is only ever seen if the game cannot start (the page opened straight from
   a folder, where a browser will not run it). It waits four seconds to appear. */
.boot-wait { max-width: 560px; margin: 22vh auto 0; padding: 0 20px; text-align: center; font-weight: 700; opacity: 0; animation: ttqBootWait .4s 4s forwards; }
@keyframes ttqBootWait { to { opacity: 1; } }

/* ---------- the welcome page and the "you need a keyboard" page ---------- */
#startForm > label { margin-bottom: 16px; }
.legal { margin-top: 4px; text-shadow: 0 1px 2px rgba(0, 0, 0, .8); }
.nokb-acct { margin: 18px 0 8px; padding-top: 16px; border-top: 1px solid var(--line); }
.nokb-acct .btn { margin: 4px 4px 8px; }

@media (max-width: 560px) {
  .sub-top { flex-direction: column; align-items: flex-start; gap: 8px; margin-right: 30px; }
  .sub-top .lock-disc { display: none; }
  .plans { grid-template-columns: 1fr; }
}

/* ===== pro.css ===== */
/* ==========================================================================
   Touch Typing Quest, professional edition - its look.

   Loaded last, in the professional edition only (body has class "pro"). The
   children's editions are chunky and glossy; this keeps the same layout and
   calms it down: Inter in place of the rounded display font, flat panels with
   a soft shadow instead of thick slabs, flatter buttons and tabs, and three
   colour schemes of its own. Rules here only ever start with body.pro or one
   of its own three skins, so they cannot reach the other editions.
   ========================================================================== */
body.pro {
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif, 'Noto Color Emoji';
  --display: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif, 'Noto Color Emoji';
  --mono: 'JetBrains Mono', ui-monospace, Consolas, 'Roboto Mono', monospace, 'Noto Color Emoji';
  --radius: 14px;
  --wall: 2px;
  --good: #34d399;
  --bad: #fb7185;
  --star: #fbbf24;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .2), 0 6px 16px rgba(0, 0, 0, .22);
  --shadow-2: 0 2px 4px rgba(0, 0, 0, .22), 0 10px 24px rgba(0, 0, 0, .28);
  --cast: 0 10px 30px rgba(0, 0, 0, .32);
  -webkit-font-smoothing: antialiased;
}

/* ---------- the three styles ---------- */
body[data-skin="studio"] {
  --bg: #0d1218; --bg2: #18212b; --card: rgba(20, 26, 34, .84); --card2: rgba(255, 255, 255, .07);
  --line: rgba(148, 163, 184, .2); --text: #e8edf3; --muted: #9eabb9; --accent: #2dd4bf; --accent2: #7dd3fc;
  --accent-text: #032824; --field: #0a0f14; --keycap: #2a3440;
  --btn: #2b3744; --btn-wall: #141b23; --slab: #06090d; --accent-ts: none; --panel: rgba(19, 25, 33, .94);
}
body[data-skin="alpine"] {
  --bg: #13213a; --bg2: #3a2b4a; --card: rgba(18, 30, 52, .82); --card2: rgba(255, 255, 255, .08);
  --line: rgba(186, 210, 240, .22); --text: #f2f6fb; --muted: #b8c7da; --accent: #ff8a5b; --accent2: #93c5fd;
  --accent-text: #2b0f02; --field: #0c1628; --keycap: #2c3e5d;
  --btn: #33507a; --btn-wall: #172843; --slab: #070e1c; --accent-ts: none; --panel: rgba(17, 29, 52, .94);
}
body[data-skin="city"] {
  --bg: #0e1328; --bg2: #2a1b3d; --card: rgba(15, 20, 42, .84); --card2: rgba(255, 255, 255, .08);
  --line: rgba(199, 210, 254, .2); --text: #eef1fb; --muted: #aeb7d6; --accent: #f6c453; --accent2: #8ab4ff;
  --accent-text: #2a1c02; --field: #0a0e20; --keycap: #283056;
  --btn: #333d6b; --btn-wall: #161c3a; --slab: #060816; --accent-ts: none; --panel: rgba(16, 21, 44, .95);
}

/* ---------- type ---------- */
body.pro h1, body.pro h2, body.pro h3 { font-weight: 700; letter-spacing: -.012em; }
body.pro .card :is(h2, h3) { text-shadow: none; }
body.pro :is(.year-title, .section-title) { text-shadow: 0 1px 2px rgba(0, 0, 0, .55), 0 0 18px rgba(0, 0, 0, .5); }

/* ---------- panels: flat glass with a soft shadow ---------- */
body.pro .card { border-radius: 16px; border: 1px solid var(--line); border-top-color: color-mix(in srgb, var(--line) 60%, rgba(255, 255, 255, .25));
  background: linear-gradient(180deg, rgba(255, 255, 255, .045), rgba(255, 255, 255, 0) 140px), var(--panel);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, var(--cast); }

/* ---------- buttons: flat faces, a thin side, no gloss ---------- */
body.pro .btn { --w: 2px; border-radius: 10px; font-weight: 600; text-shadow: none; letter-spacing: .005em;
  background: linear-gradient(180deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, 0)), var(--face, var(--btn));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12), 0 var(--w) 0 var(--side, var(--btn-wall)), 0 6px 14px rgba(0, 0, 0, .25); }
body.pro .btn::before { display: none; }
body.pro .btn.small { --w: 2px; border-radius: 9px; }
body.pro .btn.big { --w: 3px; border-radius: 12px; }
body.pro .btn.primary { color: var(--accent-text); text-shadow: none;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 86%, #fff), var(--accent));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .4), 0 var(--w) 0 color-mix(in srgb, var(--accent) 45%, #000),
    0 8px 18px color-mix(in srgb, var(--accent) 22%, rgba(0, 0, 0, .45)); }
body.pro .btn.ghost { background: rgba(255, 255, 255, .06); box-shadow: inset 0 0 0 1px var(--line), 0 4px 10px rgba(0, 0, 0, .18); }
body.pro .btn:hover { transform: none; filter: brightness(1.08); }
body.pro .btn:active { transform: translateY(1px); }
body.pro .btn:disabled { transform: none; }

/* boxes to type in: a plain field with a clear focus ring */
body.pro input, body.pro select { border-radius: 10px; border: 1px solid var(--line); background: var(--field);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .35); font-weight: 500; }
body.pro input:focus, body.pro select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 28%, transparent); }
body.pro label { font-weight: 600; }

/* keys in a sentence */
body.pro kbd { border-radius: 6px; font-weight: 600; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2), 0 2px 0 color-mix(in srgb, var(--keycap) 45%, #000), 0 3px 5px rgba(0, 0, 0, .3); }

/* ---------- the welcome page ---------- */
body.pro .hero-title h1 { margin: 14px 0 6px; font: 800 46px/1.1 var(--display); letter-spacing: -.025em; color: var(--text);
  text-shadow: 0 2px 22px rgba(0, 0, 0, .55); }
body.pro .hero-title h1::after { display: none; }
body.pro .hero-title .pro-ed { margin: 0 0 14px; font: 700 13px/1 var(--font); letter-spacing: .34em; text-transform: uppercase; color: var(--accent);
  text-shadow: 0 1px 8px rgba(0, 0, 0, .6); }
body.pro .hero-title p:not(.pro-ed) { max-width: 560px; margin: 0 auto; font-weight: 500; font-size: 17px; color: color-mix(in srgb, var(--text) 88%, var(--muted));
  text-shadow: 0 1px 3px rgba(0, 0, 0, .8); }
body.pro .logo-keys { gap: 8px; }
body.pro .logo-keys span { --kc: #3a4757; width: 52px; height: 56px; border-radius: 11px; }
body.pro .logo-keys span:nth-child(2) { --kc: #3a4757; }
body.pro .logo-keys span:nth-child(3) { --kc: var(--accent); }
body.pro .logo-keys i { height: 45px; border-radius: 9px; font: 800 24px/1 var(--display); text-shadow: none; animation-duration: 4s; }
body.pro .logo-keys span:nth-child(3) i { color: var(--accent-text); }

/* ---------- the style cards: a picture over a plain label, no box sides ---------- */
body.pro .skincard { --w: 0px; border-radius: 14px; filter: brightness(.9) saturate(.92); background: var(--panel);
  box-shadow: 0 0 0 1px var(--line), 0 8px 20px rgba(0, 0, 0, .3); }
body.pro .skincard:hover { transform: translateY(-2px); filter: none; }
body.pro .skincard.on { transform: translateY(-3px); filter: none;
  box-shadow: 0 0 0 2px var(--accent), 0 10px 26px rgba(0, 0, 0, .4), 0 0 26px color-mix(in srgb, var(--accent) 28%, transparent); }
body.pro .skincard::before { display: none; }
body.pro .sc-art { border-radius: 14px 14px 0 0; box-shadow: none; }
body.pro .sc-art::after { background: linear-gradient(118deg, rgba(255, 255, 255, .1), transparent 32%); }
body.pro .sc-label { border-radius: 0 0 14px 14px; background: var(--panel); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06); }
body.pro .skincard b { font-size: 17px; font-weight: 700; text-shadow: none; }
body.pro .skincard small { font-weight: 500; color: var(--muted); opacity: 1; }
body.pro .sc-tick { color: var(--accent-text); text-shadow: none; background: var(--accent); box-shadow: 0 0 0 3px var(--panel), 0 4px 10px rgba(0, 0, 0, .4); }
body.pro .sk-studio .sc-hero { height: 70px; }
body.pro .sk-alpine .sc-hero, body.pro .sk-city .sc-hero { height: 84px; }

/* ---------- the header and tabs ---------- */
body.pro .topbar { border-radius: 16px; border: 1px solid var(--line); background: var(--panel);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), var(--cast); }
body.pro .brand b { font-size: 19px; font-weight: 800; letter-spacing: -.015em; text-shadow: none; }
body.pro .brand small { font-weight: 600; font-size: 13px; }
body.pro .brand-icon, body.pro .me-hero { font-size: 23px; text-shadow: none;
  background: color-mix(in srgb, var(--accent) 16%, var(--panel)); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 45%, transparent); }
body.pro .me-lvl { font: 700 11.5px/1 var(--font); color: var(--accent-text); text-shadow: none; background: var(--accent); box-shadow: 0 0 0 2px var(--panel); }
body.pro .topbar .me { background: rgba(0, 0, 0, .22); border: 1px solid var(--line); box-shadow: none; }
body.pro .topbar .me b { text-shadow: none; font-weight: 700; font-size: 16px; }
body.pro .xpbar { height: 8px; padding: 0; border-radius: 4px; background: rgba(255, 255, 255, .1); box-shadow: none; }
body.pro .xpbar i { border-radius: 4px; background: linear-gradient(90deg, var(--accent), var(--accent2)); }
body.pro .xpbar i::after { display: none; }

body.pro .tabs { gap: 4px; padding: 5px; border: 1px solid var(--line); border-radius: 14px; background: rgba(0, 0, 0, .28); box-shadow: none; }
body.pro .tab { padding: 8px 15px; border-radius: 10px; color: var(--muted); font-weight: 600; text-shadow: none; background: transparent; box-shadow: none; }
body.pro .tab:hover { color: var(--text); background: rgba(255, 255, 255, .06); filter: none; }
body.pro .tab:active { transform: none; }
body.pro .tab.on { transform: none; color: var(--accent-text); background: var(--accent); box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 28%, transparent); }
body.pro .tab-i svg { width: 17px; height: 17px; vertical-align: -3px; }
body.pro .foot { background: var(--panel); box-shadow: none; border-radius: 12px; }

/* ---------- the banner at the top of the map ---------- */
body.pro .mission { border-radius: 16px; border: 1px solid var(--line);
  background: radial-gradient(70% 170% at 0% 0%, color-mix(in srgb, var(--mc) 20%, transparent), transparent 72%), var(--panel);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05), var(--cast); }
body.pro .mission.now { border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent), 0 0 24px color-mix(in srgb, var(--accent) 14%, transparent), var(--cast); }
body.pro .mission::after, body.pro .mission > .m-mark { display: none; }
body.pro .mission b { font-size: 19px; font-weight: 700; text-shadow: none; }
body.pro .mission p { font-weight: 500; }
body.pro .m-icon { width: 54px; height: 54px; border: 0; font-size: 25px; text-shadow: none;
  background: color-mix(in srgb, var(--mc) 14%, var(--panel)); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--mc) 45%, transparent); }
body.pro .m-tally { box-shadow: none; background: rgba(0, 0, 0, .3); }

/* ---------- the course map's module cards ---------- */
body.pro .world { border-radius: 18px; border: 1px solid color-mix(in srgb, var(--w2) 45%, rgba(255, 255, 255, .18));
  background: linear-gradient(135deg, var(--w1), var(--w2)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07), var(--cast); }
body.pro .w-art { border-radius: 17px; }
body.pro .w-art::before { background: radial-gradient(90% 120% at 0% 0%, rgba(255, 255, 255, .08), transparent 60%); }
body.pro .w-art::after { background: none; box-shadow: none; }
body.pro .w-scene { opacity: 1; }
body.pro .world .w-icon { width: 40px; height: 40px; font-size: 20px; background: rgba(255, 255, 255, .09); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16); }
body.pro .world header small { font-weight: 700; letter-spacing: .14em; text-shadow: none; color: rgba(255, 255, 255, .7); }
body.pro .world header b { font-weight: 700; font-size: 21px; letter-spacing: -.01em; text-shadow: 0 1px 2px rgba(0, 0, 0, .35); }
body.pro .w-stars { box-shadow: none; background: rgba(0, 0, 0, .28); }

/* ---------- practice cards and stats tiles: one quiet colour, flat icons ---------- */
body.pro .pcard { border-radius: 16px; border: 1px solid var(--line); background: var(--panel); box-shadow: var(--cast); }
body.pro .pc-top { height: 84px; margin-bottom: 8px; border-radius: 16px 16px 0 0; border-bottom: 1px solid var(--line); box-shadow: none;
  background: radial-gradient(80% 130% at 18% 0%, color-mix(in srgb, var(--accent) 24%, transparent), transparent 70%), color-mix(in srgb, var(--accent) 8%, var(--panel)); }
body.pro .pc-icon { width: 54px; height: 54px; font-size: 26px; text-shadow: none; background: rgba(0, 0, 0, .25);
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 50%, transparent); }
body.pro .pcard > b { font-size: 19px; font-weight: 700; text-shadow: none; }
body.pro .pcard p { font-weight: 500; }
body.pro .tile { border-radius: 14px; border-top-color: var(--line); background: var(--panel); box-shadow: var(--cast); }
body.pro .tile span { width: 42px; height: 42px; font-size: 21px; text-shadow: none; background: color-mix(in srgb, var(--tc) 14%, var(--panel));
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--tc) 45%, transparent); }
body.pro .tile b { font-size: 24px; font-weight: 700; text-shadow: none; }
body.pro .tile small { font-weight: 600; }

/* ---------- the typing assessment: how each rank compares with everybody else ---------- */
body.pro .as-cmp { display: block; margin-top: 3px; font-size: 11.5px; line-height: 1.3; font-weight: 600; color: var(--muted); }
body.pro .as-me .as-cmp { margin: 1px 0 6px; font-size: 15px; color: var(--accent); }
body.pro .as-res-name .as-cmp { margin-top: 2px; font-size: 15px; font-weight: 500; color: color-mix(in srgb, var(--text) 82%, var(--muted)); }

/* ---------- the end of an activity: a plain heading, flat tiles, no ribbon or gold plaques ---------- */
body.pro .ov-result .overlay-box { padding-top: 26px; }
body.pro .ov-ribbon { position: static; height: auto; margin: 0 0 8px; display: block; border-radius: 0; color: var(--text); background: none; box-shadow: none; }
body.pro .overlay-box .ov-ribbon { font-size: 30px; font-weight: 800; letter-spacing: -.02em; text-shadow: none; }
body.pro .ov-ribbon::before, body.pro .ov-ribbon::after { display: none; }
body.pro .ov-lose .ov-ribbon { color: color-mix(in srgb, var(--text) 75%, var(--muted)); background: none; box-shadow: none; }
body.pro .stars3 { height: 92px; }
body.pro .stars3.sunburst::before { display: none; }
body.pro .bigstar { width: 70px; height: 70px; }
body.pro .bigstar.s2 { width: 86px; height: 86px; margin-bottom: 8px; }
body.pro .st-won { filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .35)); }
body.pro .st-glint { display: none; }
body.pro .ov-stats > div { border-radius: 12px; border: 1px solid var(--line); background: rgba(255, 255, 255, .05); box-shadow: none; }
body.pro .ov-stats > div::before { left: 32%; right: 32%; height: 3px; box-shadow: none; }
body.pro .ov-stats b { font-weight: 700; text-shadow: none; }
body.pro .ov-big { box-shadow: none; background: rgba(0, 0, 0, .25); border: 1px solid var(--line); }
body.pro .ov-big b { color: var(--text); font-weight: 800; text-shadow: none; }
body.pro .ov-banner { border: 0; text-shadow: none; color: #d1fae5; background: color-mix(in srgb, #10b981 24%, var(--panel)); box-shadow: inset 0 0 0 1px rgba(52, 211, 153, .45); }
body.pro .ov-banner:is(.best, .grad) { color: var(--text); background: color-mix(in srgb, var(--accent) 18%, var(--panel)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 50%, transparent); }
body.pro .ov-badge { margin-top: 10px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255, 255, 255, .04); box-shadow: none; }
body.pro .ov-badge b { font-size: 16px; font-weight: 700; text-shadow: none; }
body.pro .ov-medal { width: 44px; height: 44px; font-size: 22px; background: color-mix(in srgb, var(--accent) 16%, var(--panel));
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 50%, transparent); }
body.pro .ov-medal::before { display: none; }
body.pro .ov-medal .emo { text-shadow: none; }

/* ---------- the keyboard: the same finger colours, in quieter shades ---------- */
body.pro .kbwrap .f-lp, body.pro .kbwrap .f-rp { --fc: #e3a1c0; }
body.pro .kbwrap .f-lr, body.pro .kbwrap .f-rr { --fc: #eab27e; }
body.pro .kbwrap .f-lm, body.pro .kbwrap .f-rm { --fc: #e2cf7f; }
body.pro .kbwrap .f-li { --fc: #84cfa6; }
body.pro .kbwrap .f-ri { --fc: #86b9e3; }
body.pro .kbwrap .f-th { --fc: #b3a8e3; }
body.pro .kb-key { --tint: color-mix(in srgb, var(--fc, var(--kc)) 22%, color-mix(in srgb, var(--kc) 62%, #07080f));
  --side: color-mix(in srgb, var(--fc, var(--kc)) 45%, var(--kc)); }

/* ---------- game pieces drawn for these styles ---------- */
.drop-in .spr-pro-tile { width: 54px; height: 54px; margin-bottom: -4px; }
.drop-in .spr-pro-snowflake { width: 58px; height: 58px; margin-bottom: -3px; }
.drop-in .spr-pro-email { width: 68px; height: 52px; margin-bottom: -3px; }
body[data-skin="studio"] .track { --road-near: #10161d; --road-mid: #1d2732; --road-far: #3c4c5e; --road-wall: #0a0f14; --kerb: var(--accent); }
body[data-skin="alpine"] .track { --road-near: #3a4254; --road-mid: #66748c; --road-far: #c6d3e3; --road-wall: #262d3b; --kerb: #ff8a5b; }
body[data-skin="city"] .track { --road-near: #1a1e2b; --road-mid: #2f3548; --road-far: #5d6480; --road-wall: #11141e; --kerb: #f6c453; }

/* ===== teacher.css ===== */
/* ==========================================================================
   Teacher
   ========================================================================== */
body[data-skin="teacher"] .btn.ghost { color: var(--text); }
.hw-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 14px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 8px 16px; }
.kpi b { font: 600 22px var(--display); display: block; }
.kpi small { color: var(--muted); font-weight: 700; }
.notice { background: #fef3c7; color: #78350f; border-radius: 12px; padding: 10px 14px; font-weight: 600; }
.tbl.hw td, .tbl.hw th { padding: 6px 7px; }
.tbl.hw th.wk { text-align: center; min-width: 34px; }
.tbl.hw th.wk.cur { color: var(--accent); }
.tbl.hw tbody tr { cursor: pointer; }
.tbl.hw tbody tr:hover td { background: var(--card2); }
.sticky { position: sticky; left: 0; background: var(--card); z-index: 1; }
td.name { font-weight: 700; }
.cell { text-align: center; font-weight: 800; }
td.cell, i.cell, span.cell { display: table-cell; }
i.cell, span.cell { display: inline-grid; place-items: center; width: 26px; height: 22px; border-radius: 6px; font-style: normal; margin-right: 4px; }
.st-done { background: #dcfce7; color: #166534; }
.st-late { background: #fef3c7; color: #92400e; }
.st-missing { background: #fee2e2; color: #b91c1c; }
.st-now { background: #dbeafe; color: #1d4ed8; }
.st-future { background: transparent; color: var(--muted); }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--muted); font-weight: 600; margin: 6px 0; }
.joincard, .bigjoin { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.joincard div, .bigjoin div { background: var(--card2); border-radius: 14px; padding: 10px 24px; text-align: center; }
.joincard small, .bigjoin small { display: block; color: var(--muted); font-weight: 800; }
.joincard b { font: 700 30px var(--mono); letter-spacing: .1em; }
.bigjoin { padding: 20px 0; }
.bigjoin p { width: 100%; text-align: center; font-size: 22px; font-weight: 700; }
.bigjoin b { font: 700 80px var(--mono); letter-spacing: .12em; }
.sched { display: flex; flex-direction: column; gap: 4px; max-height: 460px; overflow-y: auto; }
.sw { display: flex; align-items: center; gap: 12px; padding: 6px 10px; border-radius: 10px; background: var(--card2); }
.sw.skip { background: #fef9c3; }
.sw.cur { outline: 2px solid var(--accent); }
.sw.cont { background: transparent; border: 1px dashed var(--line); }
.sw-date { width: 120px; color: var(--muted); font-weight: 700; font-size: 14px; }
.sw-stage { flex: 1; }
.stafflist { padding-left: 18px; }
.stafflist li { margin: 6px 0; }
.manage { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.minibadges { display: flex; flex-wrap: wrap; gap: 6px; }
.minibadges span { background: var(--card2); border-radius: 20px; padding: 3px 10px; font-size: 13px; font-weight: 700; }
.chart { background: var(--card2); border-radius: 12px; padding: 10px; margin-bottom: 10px; }
.chart svg { width: 100%; height: 140px; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2.5; vector-effect: non-scaling-stroke; }
.chart .axis { stroke: var(--line); }
.chart .lbl { font-size: 11px; fill: var(--muted); }

/* ---------- licence ---------- */
.lic-card { max-width: 760px; }
.lic-state { display: flex; flex-direction: column; gap: 4px; border-radius: 14px; padding: 14px 16px; margin-bottom: 14px; }
.lic-state b { font: 600 19px var(--display); }
.lic-state.none { background: #e0e7ff; color: #312e81; }
.lic-state.gone { background: #fee2e2; color: #991b1b; }
.lic-state.ok { background: #dcfce7; color: #14532d; }
.lic-state.wait { background: #fef3c7; color: #78350f; }
.lic-who { margin: -2px 0 14px; font-size: 15px; }
.lic-form .lic-f-holder { flex: 1 1 220px; }
.lic-form .lic-f-key { flex: 2 1 330px; }
.lic-form input { width: 100%; }
.lic-form .lic-input { min-width: 0; }
@media (max-width: 520px) { .lic-form .lic-input { font-size: 13px; letter-spacing: 0; padding-left: 8px; padding-right: 8px; } }
.lic-check { margin: 4px 0 14px; }
.lic-ok { color: #15803d; }
.lic-input { font-family: var(--mono); text-transform: uppercase; letter-spacing: .08em; min-width: 290px; }
.lic-warn { margin-bottom: 14px; }
.seat { margin: 8px 0 12px; max-width: 520px; }
.seat-top { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; margin-bottom: 4px; }
.seat-top span { color: var(--muted); font-weight: 700; }
.seat-bar { height: 12px; border-radius: 6px; background: var(--card2); overflow: hidden; }
.seat-bar i { display: block; height: 100%; background: var(--accent); border-radius: 6px; }
.seat-bar i.high { background: #f59e0b; } .seat-bar i.full { background: #dc2626; } .seat-bar i.unl { background: #22c55e; opacity: .5; }
.locked-card { padding: 34px 26px; }
.lock-icon { font-size: 60px; }

/* ===== panel.css ===== */
/* ==========================================================================
   Touch Typing Quest, all in one: the teacher and manager panel, and the pages
   for schools and companies. Used by the all-in-one edition only (gas-all).
   The tables, status cells and licence bars are in teacher.css.
   ========================================================================== */

/* ---------- the ways in, under the welcome page ---------- */
.org-ways { margin-top: 18px; }
.org-ways h2 { margin-bottom: .3em; }
.org-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0 6px; }
.org-row .btn { flex: 1 1 160px; }

/* ---------- forms in pop-ups ---------- */
.ac-form label.check.small { font-size: .85rem; margin-top: -4px; }

/* ---------- people ---------- */
.ppl-form textarea { width: 100%; font: 16px/1.4 var(--mono); padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--field, #fff); color: var(--text); resize: vertical; }
.ppl-form .row { align-items: flex-end; margin-top: 10px; }
.ppl-form select { max-width: 260px; }
.tbl.ppl td, .tbl.ppl th { padding: 6px 9px; }
.ppl-bulk { align-items: center; }
#pplList { margin-top: 8px; }
.row.spread > div { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
#pplFind { min-width: 220px; }

/* ---------- the licence sizes ---------- */
.tiers { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin: 10px 0 14px; }
.tier { border: 1.5px solid var(--line); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 4px; background: var(--card); text-align: center; align-items: center; }
.tier b { font: 600 19px var(--display); }
.tier span { font-weight: 800; }
.tier small { color: var(--muted); font-weight: 700; margin-bottom: 6px; }
.tier em { font-style: normal; font-weight: 800; color: #15803d; }
.tier.on { border-color: var(--good); background: #f0fdf4; }
.jlink { font-family: var(--mono); overflow-wrap: anywhere; }
.jlink.big { font-size: 22px; width: 100%; text-align: center; }

/* ---------- the manager panel ----------
   The professional app is dark and quiet (pro.css), which is right for learning
   and wrong for a page of tables. In the panel it is a plain, light office page.
   The rules below start with body.pro[data-skin="teacher"] so that they win
   over the ones in pro.css, and cannot reach the game itself. */
body.pro[data-skin="teacher"] {
  --bg: #f4f6fb; --bg2: #f4f6fb; --card: #fff; --card2: #eef2f8; --line: #dde3ee; --text: #1e2433; --muted: #56627a;
  --accent: #0f766e; --accent2: #0369a1; --accent-text: #fff; --field: #fff; --panel: #fff; --keycap: #eef2f8;
  --btn: #eef2f8; --btn-wall: #c9d3e3; --slab: #9aa8be; --good: #15803d; --bad: #c62828; --cast: 0 1px 3px #0001;
  --shadow-1: 0 1px 2px #0001; --shadow-2: 0 2px 6px #0002; color-scheme: light;
}
body.pro[data-skin="teacher"] .card { background: #fff; border-color: var(--line); box-shadow: 0 1px 3px #0001; }
body.pro[data-skin="teacher"] .card :is(h2, h3) { text-shadow: none; }
body.pro[data-skin="teacher"] .topbar { background: none; border: 0; box-shadow: none; padding-left: 0; padding-right: 0; }
body.pro[data-skin="teacher"] .tabs { background: none; border: 0; border-bottom: 2px solid var(--line); border-radius: 0; padding: 0; gap: 2px; box-shadow: none; }
body.pro[data-skin="teacher"] .tab { background: none; color: var(--muted); border-radius: 10px 10px 0 0; padding: 10px 16px; box-shadow: none; }
body.pro[data-skin="teacher"] .tab:hover { background: #e9eef6; color: var(--text); }
body.pro[data-skin="teacher"] .tab.on { background: none; color: var(--accent); box-shadow: inset 0 -3px 0 var(--accent); }
body.pro[data-skin="teacher"] .btn { background: #eef2f8; color: var(--text); box-shadow: 0 1px 0 #c9d3e3; font-weight: 700; text-shadow: none; }
body.pro[data-skin="teacher"] .btn.primary { background: var(--accent); color: #fff; box-shadow: 0 2px 0 #0b5d57; }
body.pro[data-skin="teacher"] .btn.danger { background: #dc2626; color: #fff; box-shadow: 0 2px 0 #991b1b; }
body.pro[data-skin="teacher"] .btn.ghost { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
body.pro[data-skin="teacher"] .btn:disabled { opacity: .55; }
body.pro[data-skin="teacher"] :is(input, select, textarea) { background: #fff; border: 1.5px solid #cfd6e6; color: var(--text); box-shadow: none; }
body.pro[data-skin="teacher"] :is(input, select, textarea):focus { border-color: var(--accent); box-shadow: 0 0 0 3px #ccefe9; }
body.pro[data-skin="teacher"] .chip { background: #fff; border: 1.5px solid var(--line); color: var(--text); box-shadow: none; }
body.pro[data-skin="teacher"] .chip.on { background: var(--accent); color: #fff; border-color: var(--accent); }
body.pro[data-skin="teacher"] .kpi { background: #fff; }
body.pro[data-skin="teacher"] .modal { background: #fff; color: var(--text); border-color: var(--line); }
body.pro[data-skin="teacher"] .tile { background: #fff; border: 1px solid var(--line); box-shadow: none; }
body.pro[data-skin="teacher"] kbd { background: #eef2f8; color: var(--text); box-shadow: none; border: 1px solid var(--line); }

/* ---------- printing the sign-in cards ---------- */
#printcards { display: none; }
@media print {
  body.printing { background: #fff !important; }
  body.printing > *:not(#printcards) { display: none !important; }
  body.printing #printcards { display: grid; grid-template-columns: 1fr 1fr; gap: 10mm 8mm; padding: 0; }
  #printcards .lcard { border: 1px dashed #666; border-radius: 8px; padding: 6mm; break-inside: avoid; color: #000; font: 12pt system-ui, sans-serif; }
  #printcards .lcard b { font-size: 15pt; }
  #printcards dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 8px 0 0; }
  #printcards dt { font-weight: 700; }
  #printcards dd { margin: 0; font-family: Consolas, monospace; }
}
@media (max-width: 600px) { .org-row .btn { flex-basis: 100%; } }

/* ---------- free licences: typing a code, and the pop-ups (the voucher is in voucher.css) ---------- */
input.code-in { font-family: var(--mono); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
input.code-in::placeholder { font-family: var(--font); font-weight: 600; letter-spacing: 0; text-transform: none; }
.code-show { font-family: var(--mono); white-space: nowrap; }
.gf-no { margin: 0 0 8px; }
.ac-modal .gf-under { margin: 18px 0 4px; }
.ac-modal .btn.wide { white-space: normal; }          /* on a very narrow screen the words go on to two lines, rather than off the side */
#licGift { align-items: center; }
#licGift input { flex: 1 1 260px; max-width: 380px; }

/* ===== voucher.css ===== */
/* ==========================================================================
   Touch Typing Quest, all in one: a free licence drawn as a voucher.
   Used by the landing page, both games and the owner's page, on light and dark
   pages alike, so it brings all its own colours. The markup is in gift-words.js.
   ========================================================================== */
.voucher { --v1: #2a0f6b; --v2: #6d28d9; --v3: #c2317f; max-width: 460px; margin: 6px auto 20px; text-align: center; color: #fff; filter: drop-shadow(0 8px 16px rgba(10, 10, 40, .28)); }
.voucher.v-pro { --v1: #123c46; --v2: #115e59; --v3: #0f766e; }
.voucher.v-any { --v1: #2a0f6b; --v2: #3b2fb0; --v3: #0f766e; }
.voucher .v-main, .voucher .v-foot { background: linear-gradient(100deg, var(--v1), var(--v2) 62%, var(--v3)); }
/* the two halves meet at a tear line, with a notch cut out of each end of it */
.voucher .v-main { padding: 20px 24px 16px; border-radius: 20px 20px 0 0; border-bottom: 2px dashed rgba(255, 255, 255, .5);
  -webkit-mask: radial-gradient(11px at 0 100%, transparent 96%, #000) 0 0 / 51% 100% no-repeat, radial-gradient(11px at 100% 100%, transparent 96%, #000) 100% 0 / 51% 100% no-repeat;
  mask: radial-gradient(11px at 0 100%, transparent 96%, #000) 0 0 / 51% 100% no-repeat, radial-gradient(11px at 100% 100%, transparent 96%, #000) 100% 0 / 51% 100% no-repeat; }
.voucher .v-foot { padding: 11px 24px 13px; border-radius: 0 0 20px 20px; font-size: 15px; font-weight: 700; color: #f3f1ff;
  -webkit-mask: radial-gradient(11px at 0 0, transparent 96%, #000) 0 0 / 51% 100% no-repeat, radial-gradient(11px at 100% 0, transparent 96%, #000) 100% 0 / 51% 100% no-repeat;
  mask: radial-gradient(11px at 0 0, transparent 96%, #000) 0 0 / 51% 100% no-repeat, radial-gradient(11px at 100% 0, transparent 96%, #000) 100% 0 / 51% 100% no-repeat; }
.voucher .v-top { display: block; font-size: 15px; font-weight: 700; color: #f0ecff; }
.voucher .v-long { display: block; font-family: var(--display, inherit); font-size: 40px; line-height: 1.15; font-weight: 700; color: #ffe08a; text-shadow: 0 2px 0 rgba(0, 0, 0, .3); margin: 2px 0 4px; }
.voucher .v-who { display: block; font-size: 16.5px; font-weight: 700; color: #fff; }
