/* Pip's Number Galaxy
   Layout: one column of big, touchable cards floating over a starfield. Questions sit on a warm
   paper card edged in the planet's own colour; answers are chunky candy buttons a small finger can hit.
   One deliberate night-sky look in every theme, so all colours are set here and nowhere else. */
:root {
  color-scheme: dark;
  --space: #0c1733;
  --space-2: #15244d;
  --space-3: #233670;
  --shadow: #050b1d;
  --text: #f6f3ff;
  --muted: #aab7df;
  --paper: #fff8ec;
  --paper-2: #f2e7d5;
  --ink: #1d2142;
  --ink-soft: #626788;
  --white: #ffffff;
  --gold: #ffcc33;
  --gold-deep: #c98f00;
  --cyan: #46c8f4;
  --cyan-deep: #1985b3;
  --lime: #7fdc63;
  --lime-deep: #3c9a2a;
  --lilac: #b5a0ff;
  --lilac-deep: #6f52d9;
  --orange: #ff9245;
  --orange-deep: #cc5f16;
  --pink: #ff6fa6;
  --pink-deep: #c93b74;
  --good: #3ccf73;
  --good-deep: #1f8a45;
  --oops: #ff7055;
  --silver: #cfd6ea;
  --pip: #62e6b8;
  --pip-deep: #239e77;
  --crust: #e2a14f;
  --crust-deep: #9c6324;
  --cheese: #ffd767;
  --pepperoni: #e04a3b;
  --plate: #f5ecdc;
  --face: #1d2142;

  --font-display: 'Baloo 2', 'Arial Rounded MT Bold', 'Trebuchet MS', system-ui, sans-serif;
  --font-body: 'Andika', 'Segoe UI', 'Trebuchet MS', system-ui, sans-serif;
  --r-lg: 28px;
  --r-md: 18px;
}

/* Each planet lends its colour to everything on its screens. */
.pc-num { --pc: var(--cyan); --pc-deep: var(--cyan-deep); }
.pc-add { --pc: var(--lime); --pc-deep: var(--lime-deep); }
.pc-sub { --pc: var(--lilac); --pc-deep: var(--lilac-deep); }
.pc-mul { --pc: var(--orange); --pc-deep: var(--orange-deep); }
.pc-frac { --pc: var(--pink); --pc-deep: var(--pink-deep); }

*, *::before, *::after { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background: var(--space);
  color: var(--text);
  font: 400 1.0625rem/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 4px solid var(--cyan); outline-offset: 3px; }
.noscript { padding: 24px; text-align: center; }

/* ---------- Sky ---------- */

.sky {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
  background-image:
    radial-gradient(1.6px 1.6px at 12% 18%, var(--text) 50%, transparent 55%),
    radial-gradient(1.2px 1.2px at 32% 62%, var(--text) 50%, transparent 55%),
    radial-gradient(2px 2px at 58% 28%, var(--text) 50%, transparent 55%),
    radial-gradient(1.2px 1.2px at 74% 84%, var(--text) 50%, transparent 55%),
    radial-gradient(1.6px 1.6px at 88% 46%, var(--text) 50%, transparent 55%),
    radial-gradient(1.2px 1.2px at 46% 92%, var(--text) 50%, transparent 55%),
    radial-gradient(1px 1px at 6% 76%, var(--text) 50%, transparent 55%);
  background-size: 420px 420px;
  opacity: 0.6;
}
.sky::before {
  content: "";
  position: absolute;
  width: 520px;
  height: 520px;
  right: -220px;
  bottom: -260px;
  border-radius: 50%;
  background: var(--space-2);
  box-shadow: 0 0 0 40px var(--space), 0 0 0 44px var(--space-2);
  opacity: 0.8;
}
.sky::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(2.4px 2.4px at 22% 34%, var(--gold) 50%, transparent 55%),
    radial-gradient(2px 2px at 68% 12%, var(--cyan) 50%, transparent 55%),
    radial-gradient(2.4px 2.4px at 84% 70%, var(--pink) 50%, transparent 55%),
    radial-gradient(1.8px 1.8px at 40% 80%, var(--gold) 50%, transparent 55%);
  background-size: 610px 610px;
  animation: twinkle 5s ease-in-out infinite alternate;
}

/* ---------- Layout ---------- */

.wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 12px 56px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.play, .race { padding-block-end: 210px; }

h1 { font: 800 clamp(1.8rem, 4.5vw, 2.6rem)/1.1 var(--font-display); margin: 0; text-wrap: balance; }
h2 { font: 700 1.3rem/1.2 var(--font-display); margin: 0 0 12px; display: flex; align-items: center; gap: 8px; text-wrap: balance; }
h2 .icon { color: var(--gold); }
p { margin: 0; }
.lead { color: var(--muted); font-size: 1.1rem; max-width: 60ch; }
.eyebrow { font: 700 0.85rem var(--font-body); text-transform: uppercase; letter-spacing: 0.08em; color: var(--pc, var(--muted)); margin-bottom: 4px; }
.note { color: var(--muted); font-size: 0.95rem; margin-top: 8px; }
.err { color: var(--oops); font-weight: 700; min-height: 1.5em; text-align: center; }
.loading, .empty { color: var(--muted); }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.row.center, .center { justify-content: center; text-align: center; }
.grow { flex: 1; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.panel {
  background: var(--space-2);
  border-radius: var(--r-lg);
  padding: 22px;
  box-shadow: 0 8px 0 var(--shadow);
  min-width: 0;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: 800 1.15rem/1 var(--font-display);
  padding: 14px 24px;
  min-height: 52px;
  border: 0;
  border-radius: var(--r-md);
  background: var(--gold);
  color: var(--ink);
  box-shadow: 0 6px 0 var(--gold-deep);
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.08s, box-shadow 0.08s;
}
.btn:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--gold-deep); }
.btn.big { font-size: 1.35rem; padding: 18px 34px; min-height: 64px; }
.btn.small { font-size: 1rem; padding: 10px 16px; min-height: 44px; box-shadow: 0 4px 0 var(--gold-deep); }
.btn.ghost { background: var(--space-3); color: var(--text); box-shadow: 0 6px 0 var(--shadow); }
.btn.small.ghost { box-shadow: 0 4px 0 var(--shadow); }
.btn.danger { background: transparent; color: var(--oops); box-shadow: inset 0 0 0 2px var(--oops); }
.btn:disabled { opacity: 0.5; cursor: default; transform: none; }
.link {
  background: none;
  border: 0;
  color: var(--cyan);
  font: 700 1rem var(--font-body);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  padding: 8px;
}

.icon { width: 24px; height: 24px; flex: none; }
.icon .fill { fill: currentColor; stroke: none; }

.icon-btn {
  width: 48px;
  height: 48px;
  flex: none;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 14px;
  background: var(--space-2);
  color: var(--text);
  cursor: pointer;
  box-shadow: 0 4px 0 var(--shadow);
}
.icon-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--shadow); }

.pill {
  font: 700 0.78rem var(--font-body);
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--pc, var(--gold));
  color: var(--ink);
  white-space: nowrap;
}
.pill.soft { background: var(--space-3); color: var(--muted); }

/* ---------- Top bar ---------- */

.topbar { display: flex; align-items: center; gap: 10px; }
.me {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 5px 14px 5px 5px;
  border: 0;
  border-radius: 999px;
  background: var(--space-2);
  cursor: pointer;
  box-shadow: 0 4px 0 var(--shadow);
}
.me-av { font-size: 1.6rem; width: 40px; height: 40px; flex: none; display: grid; place-items: center; background: var(--space-3); border-radius: 50%; }
.me-name { font: 700 1.05rem var(--font-display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-pet { font-size: 1.3rem; }
.star-count {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--space-2);
  color: var(--gold);
  font: 800 1.15rem var(--font-display);
  font-variant-numeric: tabular-nums;
}
.star-count .icon { width: 22px; height: 22px; }
.net {
  font: 700 0.78rem var(--font-body);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--muted);
  border: 2px solid var(--space-3);
}
.net.on { color: var(--lime); border-color: var(--lime-deep); }

/* ---------- Pip and speech bubbles ---------- */

.pip { display: block; }
.pip-body, .pip-arm { fill: var(--pip); }
.pip-foot { fill: var(--pip-deep); }
.pip-belly { fill: var(--white); opacity: 0.35; }
.pip-eye, .pip-shine { fill: var(--white); }
.pip-pupil, .pip-mouth { fill: var(--ink); }
.pip-lid, .pip-brow { fill: none; stroke: var(--ink); stroke-width: 5; stroke-linecap: round; }
.pip-stroke { fill: none; stroke: var(--ink); stroke-width: 4; stroke-linecap: round; }
.pip line.pip-stroke { stroke: var(--pip-deep); }
.pip-tip { fill: var(--gold); }
.pip-cheek { fill: var(--pink); opacity: 0.55; }
.pip-happy .pip-arm.r { transform-box: fill-box; transform-origin: 50% 90%; animation: wave 1.6s ease-in-out infinite; }

.hero-row { display: flex; align-items: center; gap: 14px; }
.hero-row .pip { width: 96px; height: 96px; flex: none; animation: bob 3.2s ease-in-out infinite; }
.bubble {
  position: relative;
  min-width: 0;
  max-width: 62ch;
  padding: 14px 18px;
  border-radius: 22px;
  background: var(--paper);
  color: var(--ink);
  font: 600 1.15rem/1.35 var(--font-display);
}
.bubble::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 50%;
  margin-top: -10px;
  border: 10px solid transparent;
  border-left: 0;
  border-right-color: var(--paper);
}

/* ---------- New player / who is playing ---------- */

.new { gap: 24px; }
.welcome { display: grid; gap: 14px; align-content: center; }
.logo { font: 800 clamp(2.6rem, 8vw, 4.6rem)/0.92 var(--font-display); letter-spacing: -0.01em; }
.logo span { display: block; color: var(--gold); }
.make { display: grid; gap: 14px; justify-items: start; }
.make h2 { margin: 0; }
@media (min-width: 900px) {
  .new { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; padding-top: 48px; }
}
.avatar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 10px; width: 100%; }
.av {
  aspect-ratio: 1;
  max-width: 100%;
  font-size: 2.2rem;
  border: 0;
  border-radius: 18px;
  background: var(--space-3);
  cursor: pointer;
  box-shadow: 0 4px 0 var(--shadow);
  transition: transform 0.12s;
}
.av.sel { background: var(--gold); box-shadow: 0 4px 0 var(--gold-deep); transform: scale(1.08); }
.name-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.name-box { font: 800 1.6rem var(--font-display); background: var(--paper); color: var(--ink); padding: 8px 20px; border-radius: 16px; }
.links { display: flex; gap: 6px; flex-wrap: wrap; }

.who-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 16px; }
.who-card {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 22px 12px;
  border: 0;
  border-radius: var(--r-lg);
  background: var(--space-2);
  box-shadow: 0 6px 0 var(--shadow);
  cursor: pointer;
}
.who-av { font-size: 3.2rem; width: 84px; height: 84px; display: grid; place-items: center; background: var(--space-3); border-radius: 50%; }
.who-card.add .who-av { font: 800 3rem var(--font-display); color: var(--gold); }
.who-name { font: 800 1.2rem var(--font-display); }
.who-stars { display: flex; align-items: center; gap: 4px; color: var(--gold); font-weight: 700; }
.who-card.add .who-stars { color: var(--muted); }
.who-stars .icon { width: 18px; height: 18px; }

.code-panel, .join-panel, .gate-panel { display: grid; gap: 12px; justify-items: center; text-align: center; max-width: 560px; width: 100%; margin: 0 auto; }
.code-panel > .pip { width: 110px; height: 110px; }
.code-panel p { color: var(--muted); }
.code-input {
  width: 100%;
  max-width: 440px;
  font: 800 1.5rem var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: center;
  padding: 12px 16px;
  border-radius: 14px;
  border: 3px solid var(--space-3);
  background: var(--paper);
  color: var(--ink);
}
.gate-words { font: 800 1.6rem var(--font-display); color: var(--gold); }

/* ---------- Galaxy map ---------- */

.planets { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; padding-bottom: 28px; }
.planet-card {
  flex: 1 1 160px;
  max-width: 216px;
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 14px 10px 16px;
  border: 0;
  border-radius: var(--r-lg);
  background: var(--space-2);
  box-shadow: 0 6px 0 var(--shadow);
  cursor: pointer;
  text-align: center;
  transition: transform 0.15s;
}
.planet-card:nth-child(even) { transform: translateY(28px); }
.planet-card:hover { transform: translateY(-4px); }
.planet-card:nth-child(even):hover { transform: translateY(24px); }
.planet-art { display: block; width: 100%; max-width: 150px; aspect-ratio: 1; }
.planet-art.big { width: 170px; max-width: 38vw; flex: none; }
.planet-svg { display: block; width: 100%; height: 100%; }
.planet-card .planet-svg { animation: bob 4s ease-in-out infinite; animation-delay: calc(var(--i, 0) * -0.7s); }
.planet-name { font: 800 1.25rem/1.1 var(--font-display); }
.planet-meta { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.meter { width: 80%; height: 8px; margin-top: 4px; border-radius: 99px; background: var(--space-3); overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--gold); border-radius: inherit; }
.planet-stars { display: inline-flex; align-items: center; gap: 4px; color: var(--gold); font: 700 1rem var(--font-display); }
.planet-stars .icon { width: 18px; height: 18px; }

.pl-glow { fill: var(--pc); opacity: 0.14; }
.pl-base { fill: var(--pc); }
.pl-band { fill: none; stroke: var(--white); stroke-opacity: 0.35; stroke-width: 10; stroke-linecap: round; }
.pl-ring { fill: none; stroke: var(--gold); stroke-width: 7; stroke-linecap: round; }
.pl-plus { fill: none; stroke: var(--pc-deep); stroke-width: 5; stroke-linecap: round; }
.pl-crater { fill: var(--pc-deep); opacity: 0.4; }
.pl-stripe { fill: var(--pc-deep); opacity: 0.35; }
.pl-eye { fill: var(--face); }
.pl-smile { fill: none; stroke: var(--face); stroke-width: 3.5; stroke-linecap: round; }
.pl-cheek { fill: var(--pink); opacity: 0.5; }
.pl-spark { fill: var(--gold); }

.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 860px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tile {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: 12px;
  align-items: center;
  text-align: left;
  padding: 16px 18px;
  border: 0;
  border-radius: var(--r-md);
  background: var(--space-2);
  box-shadow: 0 6px 0 var(--shadow);
  cursor: pointer;
}
.tile .icon { grid-row: 1 / 3; width: 46px; height: 46px; padding: 10px; border-radius: 14px; background: var(--tc); color: var(--ink); }
.tile b { font: 800 1.15rem/1.15 var(--font-display); }
.tile small { color: var(--muted); font-size: 0.92rem; line-height: 1.3; }
.tile:disabled { opacity: 0.6; cursor: default; }
.tile:not(:disabled):active { transform: translateY(4px); box-shadow: 0 2px 0 var(--shadow); }
.tile.big { padding: 26px 22px; }
.tile.big .icon { width: 66px; height: 66px; padding: 15px; }
.tile.big b { font-size: 1.5rem; }
.t-gold { --tc: var(--gold); }
.t-pink { --tc: var(--pink); }
.t-lime { --tc: var(--lime); }
.t-cyan { --tc: var(--cyan); }
.t-lilac { --tc: var(--lilac); }
/* Five tiles (with My class): one row when wide, then 3 + 2, then 2 + 2 + 1. */
.tiles.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1060px) {
  .tiles.five { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .tiles.five .tile { grid-column: span 2; }
  .tiles.five .tile:nth-child(n+4) { grid-column: span 3; }
}
@media (max-width: 860px) {
  .tiles.five { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tiles.five .tile, .tiles.five .tile:nth-child(n+4) { grid-column: auto; }
  .tiles.five .tile:last-child { grid-column: 1 / -1; }
}

.download { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 16px 18px; border-radius: var(--r-md); border: 2px dashed var(--space-3); }
.download > .icon { color: var(--gold); width: 32px; height: 32px; }
.download div { flex: 1 1 220px; display: grid; }
.download small { color: var(--muted); }

/* ---------- Planet and levels ---------- */

.planet-head { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.planet-head > div { flex: 1 1 260px; display: grid; gap: 6px; }
.levels { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.level {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas: "num text" "num stars";
  column-gap: 14px;
  row-gap: 4px;
  align-items: center;
  text-align: left;
  padding: 14px 16px;
  border: 0;
  border-radius: var(--r-md);
  background: var(--space-2);
  box-shadow: 0 6px 0 var(--shadow);
  cursor: pointer;
}
.level:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--shadow); }
.lv-num {
  grid-area: num;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--pc);
  color: var(--ink);
  font: 800 1.6rem var(--font-display);
  box-shadow: inset 0 -4px 0 var(--pc-deep);
}
.lv-text { grid-area: text; display: grid; }
.lv-title { font: 800 1.15rem/1.15 var(--font-display); }
.lv-sub { color: var(--muted); font-size: 0.92rem; }
.level .stars { grid-area: stars; }
.level.locked { opacity: 0.55; }
.level.locked .lv-num { background: var(--space-3); color: var(--muted); box-shadow: none; }
.stars { display: inline-flex; gap: 2px; }
.stars .st { color: var(--space-3); display: inline-flex; }
.stars .st.on { color: var(--gold); }
.stars .icon { width: 22px; height: 22px; }

/* ---------- Playing ---------- */

.play-bar { display: flex; align-items: center; gap: 12px; min-height: 48px; }
.progress { flex: 1; display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.pdot { width: 18px; height: 18px; border-radius: 50%; background: var(--space-3); }
.pdot.ok { background: var(--lime); }
.pdot.miss { background: var(--orange); }
.pdot.now { background: var(--white); box-shadow: 0 0 0 4px var(--pc); }

.play-grid { display: grid; gap: 18px; }
@media (min-width: 900px) {
  .play-grid { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); align-items: start; }
}

.qcard {
  display: grid;
  gap: 12px;
  justify-items: center;
  text-align: center;
  min-width: 0;
  padding: 16px 20px 22px;
  border-radius: var(--r-lg);
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 8px 0 var(--pc-deep, var(--gold-deep));
}
.q-top { width: 100%; display: flex; justify-content: space-between; gap: 8px; align-items: center; flex-wrap: wrap; }
.q-where { font: 700 0.8rem var(--font-body); text-transform: uppercase; letter-spacing: 0.07em; color: var(--ink-soft); }
.tag { background: var(--pink); color: var(--ink); font: 700 0.8rem var(--font-body); padding: 3px 10px; border-radius: 99px; }
.prompt { font: 700 clamp(1.25rem, 3vw, 1.6rem)/1.25 var(--font-display); text-wrap: balance; }
.qtext { font: 800 clamp(2.4rem, 8vw, 4.2rem)/1.15 var(--font-display); font-variant-numeric: tabular-nums; }
.blank {
  display: inline-block;
  min-width: 1.15em;
  padding: 0 0.12em;
  border-radius: 0.22em;
  background: var(--gold);
  color: var(--ink);
  line-height: 1.15;
  text-align: center;
}
.frac { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; font-size: 0.78em; line-height: 1.05; margin: 0 0.08em; }
.frac .fn { padding: 0 0.18em 0.06em; border-bottom: 0.08em solid currentColor; }
.frac .fd { padding: 0.06em 0.18em 0; }
.frac .blank { font-size: 0.95em; }
.visual { width: 100%; display: grid; place-items: center; overflow-x: auto; }
.v-svg { display: block; width: 100%; height: auto; }
.v-svg text { font-family: var(--font-display); }
.hint-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  border-radius: 999px;
  padding: 10px 18px;
  background: var(--paper-2);
  color: var(--ink);
  font: 700 1.05rem var(--font-display);
  cursor: pointer;
  box-shadow: 0 4px 0 var(--crust);
}
.hint-btn .icon { color: var(--gold-deep); }
.hint { padding: 12px; border-radius: var(--r-md); background: var(--paper-2); animation: pop 0.3s; }

/* Pictures of things to count */
.v-objects { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px 14px; }
.v-group { display: inline-grid; gap: 4px; padding: 10px 12px; border-radius: 18px; background: var(--paper-2); }
.v-row { display: flex; gap: 4px; }
.v-obj {
  position: relative;
  width: 1.2em;
  font-size: clamp(1.8rem, 5.5vw, 3rem);
  line-height: 1.15;
  text-align: center;
  animation: pop 0.35s backwards;
  animation-delay: calc(var(--i, 0) * 45ms);
}
.v-obj.gone { opacity: 0.4; filter: grayscale(1); }
.v-obj.gone::before, .v-obj.gone::after {
  content: "";
  position: absolute;
  left: 8%;
  right: 8%;
  top: 48%;
  height: 0.12em;
  border-radius: 99px;
  background: var(--oops);
  rotate: 40deg;
}
.v-obj.gone::after { rotate: -40deg; }
.v-op { font: 800 2.4rem var(--font-display); color: var(--ink-soft); }
.v-groups { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.v-bubble { display: inline-grid; gap: 2px; padding: 10px 16px; border-radius: 999px; border: 3px dashed var(--ink-soft); background: var(--white); }
.v-bubble .v-obj { font-size: clamp(1.4rem, 4vw, 2rem); }
.v-bubble.lit { border-style: solid; border-color: var(--pink-deep); background: var(--paper-2); }
.v-bubble.dim { opacity: 0.45; }
.v-compare { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: center; width: 100%; }
.v-fig { margin: 0; display: grid; gap: 6px; justify-items: center; min-width: 0; flex: 1 1 140px; max-width: 360px; }
.v-fig figcaption { font: 800 1.6rem var(--font-display); }
.v-columns {
  display: grid;
  grid-template-columns: repeat(4, 1.3em);
  justify-content: center;
  font: 800 clamp(2rem, 6vw, 2.8rem)/1.2 var(--font-display);
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.vc-head { font-size: 0.45em; color: var(--ink-soft); align-self: end; }
.vc-rule { grid-column: 1 / -1; height: 4px; margin: 4px 0; background: var(--ink); border-radius: 2px; }
.v-columns .blank { font-size: 0.7em; margin: 3px; }

/* Ten frames, number lines, blocks, arrays */
.tf-frame { fill: var(--white); stroke: var(--ink); stroke-width: 3; }
.tf-cell { fill: none; stroke: var(--ink-soft); stroke-width: 1.5; }
.tf-dot { fill: var(--orange); stroke: var(--orange-deep); stroke-width: 2; }
.tf-dot.b { fill: var(--cyan); stroke: var(--cyan-deep); }
.nl-line, .nl-tick { stroke: var(--ink); stroke-width: 3; stroke-linecap: round; }
.nl-tick { stroke-width: 2.5; }
.nl-end { fill: var(--ink); }
.nl-num { fill: var(--ink); font-size: 19px; font-weight: 700; text-anchor: middle; }
.nl-mark { fill: var(--cyan-deep); }
.nl-ring { fill: var(--gold); stroke: var(--ink); stroke-width: 2.5; }
.nl-q { fill: var(--ink); font-size: 22px; font-weight: 800; text-anchor: middle; }
.nl-hop { fill: none; stroke: var(--pink-deep); stroke-width: 3; stroke-linecap: round; }
.nl-arrow { fill: var(--pink-deep); }
.nl-hoplabel { fill: var(--pink-deep); font-size: 19px; font-weight: 800; text-anchor: middle; }
.bk-rod { fill: var(--lime); stroke: var(--lime-deep); stroke-width: 1.5; }
.bk-rod.gone { opacity: 0.35; }
.bk-x { stroke: var(--oops); stroke-width: 4; stroke-linecap: round; }
.bk-flat { fill: var(--cyan); stroke: var(--cyan-deep); stroke-width: 1.5; }
.bk-line { stroke: var(--ink); stroke-width: 1; opacity: 0.25; }
.bk-one { fill: var(--orange); stroke: var(--orange-deep); stroke-width: 1.5; }
.v-array { max-height: 260px; }
.ar-dot { fill: var(--orange); }
.ar-dot.b { fill: var(--pink); }

/* Pizzas and fraction bars */
.pz-crust { fill: var(--crust); }
.pz-slice { fill: var(--plate); }
.pz-slice.lit, .pz-cheese { fill: var(--cheese); }
.pz-pep { fill: var(--pepperoni); }
.pz-cut { stroke: var(--crust-deep); stroke-width: 3; stroke-linecap: round; }
.br-part { fill: var(--white); stroke: var(--ink-soft); stroke-width: 1.5; }
.br-part.lit { fill: var(--pink); }
.br-part.lit2 { fill: var(--cyan); }
.br-outline { fill: none; stroke: var(--ink); stroke-width: 3; }
.br-x { fill: none; stroke: var(--ink); stroke-width: 4; stroke-linecap: round; }
.am-a { fill: var(--cyan); stroke: var(--ink); stroke-width: 2.5; }
.am-b { fill: var(--pink); stroke: var(--ink); stroke-width: 2.5; }
.am-t, .am-in { fill: var(--ink); font-size: 20px; font-weight: 800; text-anchor: middle; }

/* Answers */
.answers { min-width: 0; }
.choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.choices.n3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.choice {
  display: grid;
  place-items: center;
  gap: 2px;
  min-height: 96px;
  padding: 12px;
  border: 0;
  border-radius: 22px;
  background: var(--cc);
  color: var(--ink);
  box-shadow: 0 7px 0 var(--cc-deep);
  font: 800 clamp(2rem, 6vw, 2.8rem)/1 var(--font-display);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: transform 0.08s, box-shadow 0.08s;
}
.choice:active { transform: translateY(5px); box-shadow: 0 2px 0 var(--cc-deep); }
.choice small { font: 700 0.95rem var(--font-body); }
.choice .frac { font-size: 0.85em; }
.c0 { --cc: var(--cyan); --cc-deep: var(--cyan-deep); }
.c1 { --cc: var(--lime); --cc-deep: var(--lime-deep); }
.c2 { --cc: var(--orange); --cc-deep: var(--orange-deep); }
.c3 { --cc: var(--pink); --cc-deep: var(--pink-deep); }
.choice.wrong { --cc: var(--space-3); --cc-deep: var(--shadow); color: var(--muted); }
.choice.right, .choice.reveal { --cc: var(--good); --cc-deep: var(--good-deep); outline: 5px solid var(--white); outline-offset: 3px; }
.choice:disabled { cursor: default; }
.choice:disabled:not(.right):not(.reveal):not(.wrong) { opacity: 0.5; }

.pad { display: grid; gap: 12px; width: 100%; max-width: 420px; margin: 0 auto; }
.pad-display {
  display: grid;
  place-items: center;
  min-height: 84px;
  border-radius: 20px;
  background: var(--paper);
  color: var(--ink);
  font: 800 3rem/1 var(--font-display);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  box-shadow: inset 0 -5px 0 var(--paper-2);
}
.pad-display.wrong { color: var(--oops); text-decoration: line-through; }
.pad-display.right, .pad-display.reveal { background: var(--good); }
.caret { width: 4px; height: 1em; background: var(--ink-soft); border-radius: 2px; animation: blink 1s steps(2) infinite; }
.pad-keys { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.key {
  display: grid;
  place-items: center;
  min-height: 64px;
  border: 0;
  border-radius: 18px;
  background: var(--space-3);
  color: var(--text);
  font: 800 1.9rem var(--font-display);
  box-shadow: 0 5px 0 var(--shadow);
  cursor: pointer;
}
.key:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--shadow); }
.key .icon { width: 30px; height: 30px; }
.key.go { background: var(--gold); color: var(--ink); box-shadow: 0 5px 0 var(--gold-deep); }
.key.del { color: var(--muted); }

/* Feedback sheet along the bottom of the screen */
.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  pointer-events: none;
  padding: 0 max(16px, env(safe-area-inset-right, 0px)) calc(16px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
}
.sheet-in {
  pointer-events: auto;
  max-width: 880px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 14px 18px;
  border-radius: 24px;
  background: var(--space-2);
  border: 3px solid var(--tone, var(--space-3));
  box-shadow: 0 10px 30px var(--shadow);
  animation: rise 0.25s ease-out;
}
.sheet.small .sheet-in { max-width: 560px; }
.sheet.good { --tone: var(--good); }
.sheet.try { --tone: var(--orange); }
.sheet.learn { --tone: var(--gold); }
.sheet-pip .pip { width: 64px; height: 64px; }
.sheet-text { flex: 1 1 240px; min-width: 0; }
.sheet-title { font: 800 1.5rem/1.2 var(--font-display); }
.sheet-explain { margin-top: 4px; font-size: 1.1rem; }
.sheet-actions { display: flex; gap: 10px; align-items: center; margin-left: auto; flex-wrap: wrap; }
.sheet-actions .icon-btn { background: var(--space-3); }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  z-index: 40;
  translate: -50% 0;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100vw - 32px);
  padding: 8px 18px 8px 8px;
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font: 700 1.05rem/1.25 var(--font-display);
  box-shadow: 0 8px 24px var(--shadow);
}
.toast.show { animation: rise 0.25s ease-out; }
.toast-pip .pip { width: 40px; height: 40px; }

/* ---------- Results ---------- */

.result-card {
  display: grid;
  justify-items: center;
  gap: 14px;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 28px 20px;
  text-align: center;
  background: var(--space-2);
  border-radius: var(--r-lg);
  box-shadow: 0 8px 0 var(--shadow);
}
.result-card > .pip { width: 120px; height: 120px; }
.big-stars { display: flex; gap: 10px; }
.bs { color: var(--space-3); display: inline-flex; }
.bs .icon { width: 72px; height: 72px; }
.bs.on { color: var(--gold); animation: starpop 0.5s backwards; animation-delay: calc(0.45s + var(--i) * 0.38s); }
.score { font: 700 1.3rem var(--font-display); }
.new-pet {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-radius: 18px;
  background: var(--paper);
  color: var(--ink);
  font: 700 1.15rem var(--font-display);
  animation: pop 0.5s 1.2s backwards;
}
.np-e { font-size: 2.4rem; }

/* ---------- Pets ---------- */

.pet-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; }
.pet {
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 18px 10px;
  border: 0;
  border-radius: var(--r-md);
  background: var(--space-2);
  box-shadow: 0 6px 0 var(--shadow);
  cursor: pointer;
}
.pet-e { font-size: 3.2rem; line-height: 1.1; }
.pet.locked .pet-e { filter: brightness(0) invert(1); opacity: 0.18; }
.pet-name { font: 800 1.1rem var(--font-display); }
.pet-need { display: inline-flex; gap: 4px; align-items: center; color: var(--muted); font-size: 0.9rem; }
.pet-need .icon { width: 16px; height: 16px; color: var(--gold); }
.pet.sel { background: var(--gold); color: var(--ink); box-shadow: 0 6px 0 var(--gold-deep); }
.pet.sel .pet-need { color: var(--ink); }

/* ---------- Leaderboard and race results ---------- */

.lb-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.lb { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; width: 100%; }
.lb li {
  display: grid;
  grid-template-columns: 36px 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 14px;
  background: var(--space-3);
  text-align: left;
}
.lb li.me { outline: 3px solid var(--gold); }
.rk { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--space-2); font: 800 1.05rem var(--font-display); }
.rk.r1 { background: var(--gold); color: var(--ink); }
.rk.r2 { background: var(--silver); color: var(--ink); }
.rk.r3 { background: var(--crust); color: var(--ink); }
.lp-av { font-size: 1.7rem; text-align: center; }
.lp-name { font: 700 1.05rem var(--font-display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rs { color: var(--muted); font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- Rocket Race ---------- */

.hub-btns { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  border: 0;
  border-radius: 999px;
  padding: 10px 18px;
  background: var(--space-2);
  color: var(--text);
  font: 700 1.05rem var(--font-display);
  cursor: pointer;
  box-shadow: inset 0 0 0 3px var(--pc);
}
.chip.sel { background: var(--pc); color: var(--ink); }
.race-levels { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.rl {
  display: flex;
  gap: 12px;
  align-items: center;
  text-align: left;
  padding: 12px 14px;
  border: 0;
  border-radius: 16px;
  background: var(--space-2);
  cursor: pointer;
  box-shadow: 0 4px 0 var(--shadow);
}
.rl b { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--space-3); font: 800 1.2rem var(--font-display); }
.rl span { display: grid; font: 700 1.05rem/1.2 var(--font-display); }
.rl small { font: 400 0.88rem var(--font-body); color: var(--muted); }
.rl.sel { box-shadow: inset 0 0 0 3px var(--pc), 0 4px 0 var(--shadow); }
.rl.sel b { background: var(--pc); color: var(--ink); }

.bar-title { flex: 1; text-align: center; font: 800 1.3rem var(--font-display); }
.race-note { color: var(--orange); font-weight: 700; }
.lobby { display: grid; gap: 18px; }
@media (min-width: 860px) { .lobby { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); align-items: start; } }
.code-card {
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 26px 18px;
  border-radius: var(--r-lg);
  background: var(--paper);
  color: var(--ink);
  text-align: center;
  box-shadow: 0 8px 0 var(--gold-deep);
}
.code-card span { font: 700 1rem var(--font-body); text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-soft); }
.race-code { font: 800 clamp(4rem, 16vw, 7rem)/1 var(--font-display); letter-spacing: 0.08em; font-variant-numeric: tabular-nums; }
.code-card small { color: var(--ink-soft); font-size: 1rem; }
.lobby-players { list-style: none; margin: 12px 0; padding: 0; display: grid; gap: 8px; }
.lobby-players li { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 14px; background: var(--space-3); }
.lobby-players li.me { outline: 3px solid var(--gold); }
.lobby-players li.away { opacity: 0.5; }
.lobby-players .lp-name { flex: 1; }
.lobby-info { color: var(--muted); }
.lobby-info b { color: var(--text); }
.waiting { display: flex; align-items: center; justify-content: center; gap: 12px; color: var(--muted); font: 700 1.1rem var(--font-display); }
.waiting .pip { width: 56px; height: 56px; flex: none; }

.race-score { display: inline-flex; align-items: center; gap: 6px; font: 800 1.3rem var(--font-display); color: var(--gold); font-variant-numeric: tabular-nums; }
.race-score .icon { width: 24px; height: 24px; }
.race-timer { margin-left: auto; padding: 6px 14px; border-radius: 999px; background: var(--space-2); font: 800 1.3rem var(--font-display); font-variant-numeric: tabular-nums; }
.track { display: grid; gap: 6px; padding: 12px; border-radius: var(--r-md); background: var(--space-2); }
.lane { display: grid; grid-template-columns: minmax(64px, 140px) minmax(0, 1fr) 46px; align-items: center; gap: 10px; }
.lane-name { display: flex; gap: 6px; align-items: center; min-width: 0; font: 700 0.95rem var(--font-display); white-space: nowrap; }
.lane-name span:last-child { overflow: hidden; text-overflow: ellipsis; }
.lane-track { position: relative; height: 40px; border-radius: 999px; background: var(--space-3); }
.lane.me .lane-track { box-shadow: inset 0 0 0 3px var(--gold); }
.lane.fin .lane-track { background: var(--good-deep); }
.lane-moon { position: absolute; right: 6px; top: 50%; translate: 0 -50%; font-size: 1.5rem; }
.racer {
  position: absolute;
  top: 50%;
  left: calc(var(--p, 0) * (100% - 46px));
  translate: 0 -50%;
  font-size: 1.7rem;
  transition: left 0.6s cubic-bezier(0.3, 1.4, 0.5, 1);
}
.ship { display: inline-block; rotate: 45deg; }
.lane-place { font: 800 1rem var(--font-display); text-align: right; font-variant-numeric: tabular-nums; }
.more { color: var(--muted); text-align: center; }
.countdown {
  position: fixed;
  inset: 0;
  z-index: 35;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--space) 78%, transparent);
}
.countdown span { font: 800 clamp(5rem, 22vw, 12rem)/1 var(--font-display); color: var(--gold); animation: zoom 0.9s ease-out; }
.finished { display: grid; justify-items: center; text-align: center; gap: 8px; }
.finished .pip { width: 100px; height: 100px; }
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 10px; width: 100%; }
.pod { display: grid; justify-items: center; gap: 4px; flex: 0 1 140px; min-width: 0; }
.pod-av { font-size: 2.6rem; }
.pod-name { max-width: 100%; font: 700 0.95rem var(--font-display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pod-block { width: 100%; display: grid; place-items: center; border-radius: 14px 14px 0 0; font: 800 2rem var(--font-display); color: var(--ink); }
.pod.p1 .pod-block { height: 110px; background: var(--gold); }
.pod.p2 .pod-block { height: 80px; background: var(--silver); }
.pod.p3 .pod-block { height: 60px; background: var(--crust); }
.race-results .lb { max-width: 560px; }

/* ---------- Grown-ups ---------- */

.g-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 720px) { .g-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.g-stat { display: grid; padding: 14px 16px; border-radius: var(--r-md); background: var(--space-2); }
.g-stat b { font: 800 2rem/1.1 var(--font-display); color: var(--gold); font-variant-numeric: tabular-nums; }
.g-stat span { color: var(--muted); }
.g-cols { display: grid; gap: 18px; }
@media (min-width: 900px) { .g-cols { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); align-items: start; } }
.g-cols .panel h2:not(:first-child) { margin-top: 18px; }
.g-row { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) 70px; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--space-3); }
.g-name { display: grid; font: 700 1.05rem var(--font-display); }
.g-name small, .g-pct small { font: 400 0.85rem var(--font-body); color: var(--muted); }
.g-bar { height: 12px; border-radius: 99px; background: var(--space-3); overflow: hidden; }
.g-bar span { display: block; height: 100%; background: var(--pc); border-radius: inherit; }
.g-pct { display: grid; text-align: right; font: 800 1.1rem var(--font-display); font-variant-numeric: tabular-nums; }
.g-tricky { list-style: none; padding: 0; margin: 0 0 8px; display: grid; gap: 6px; }
.g-tricky li { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 12px; border-radius: 12px; background: var(--space-3); }
.tq { font: 800 1.1rem var(--font-display); }
.g-tricky small { color: var(--muted); }
.settings { display: grid; gap: 4px; }
.settings h2 { margin: 0; }
.set-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 10px 20px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--space-3); }
@media (max-width: 720px) { .set-row { grid-template-columns: minmax(0, 1fr); } }
.set-label { display: grid; font: 700 1.05rem var(--font-display); }
.set-label small { font: 400 0.9rem var(--font-body); color: var(--muted); }
.set-control { min-width: 0; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 6px; padding: 4px; border-radius: 14px; background: var(--space-3); }
.seg button { border: 0; border-radius: 10px; padding: 8px 14px; background: transparent; color: var(--text); font: 700 0.98rem var(--font-display); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--gold); color: var(--ink); }
.server-row, .code-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.server-row { flex-wrap: nowrap; }
.server-row .note { flex: 1 1 auto; margin: 0; }
.server-row .btn { flex: none; white-space: nowrap; }
.server-dot { flex: none; width: 12px; height: 12px; border-radius: 50%; background: var(--oops, #ff7055); }
.server-dot.on { background: var(--good, #3ccf73); box-shadow: 0 0 0 4px rgba(60, 207, 115, 0.2); }
code { font: 700 1.1rem ui-monospace, "Cascadia Mono", Consolas, monospace; background: var(--space); padding: 8px 12px; border-radius: 10px; letter-spacing: 0.04em; overflow-wrap: anywhere; }
.settings > .row { padding-top: 16px; }

.offline { display: grid; justify-items: center; gap: 10px; text-align: center; }
.offline .pip { width: 110px; height: 110px; }
.offline h2 { margin: 0; }
.offline p { color: var(--muted); max-width: 52ch; }

.fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 50; }

/* ---------- Narrow screens ---------- */

@media (max-width: 560px) {
  .net { display: none; }
  .topbar { gap: 8px; }
  .icon-btn { width: 44px; height: 44px; }
  .me { padding-right: 10px; }
  .hero-row .pip { width: 72px; height: 72px; }
  .bubble { font-size: 1.02rem; padding: 12px 14px; }
  .tile { grid-template-columns: minmax(0, 1fr); row-gap: 4px; padding: 14px; }
  .tile .icon { grid-row: auto; margin-bottom: 4px; }
  .choice { min-height: 84px; }
  .progress { gap: 5px; }
  .pdot { width: 14px; height: 14px; }
  .key { min-height: 58px; }
  .sheet-title { font-size: 1.25rem; }
  .sheet-explain { font-size: 1rem; }
  .sheet-pip .pip { width: 48px; height: 48px; }
  .lane { grid-template-columns: minmax(48px, 80px) minmax(0, 1fr) 40px; gap: 6px; }
  .lane-name span:last-child { display: none; }
}

/* ---------- Motion ---------- */

@keyframes pop { from { transform: scale(0.4); opacity: 0; } 70% { transform: scale(1.08); opacity: 1; } to { transform: scale(1); } }
@keyframes bob { 50% { transform: translateY(-6px); } }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes starpop { from { transform: scale(0) rotate(-40deg); } 70% { transform: scale(1.25) rotate(8deg); } to { transform: scale(1); } }
@keyframes zoom { from { transform: scale(1.8); opacity: 0; } 30% { opacity: 1; } to { transform: scale(1); } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes twinkle { from { opacity: 0.3; } to { opacity: 1; } }
@keyframes wave { 50% { rotate: -25deg; } }
.shake { animation: shake 0.4s; }

/* ---------- Teachers and classes ---------- */

.teacher-me { cursor: default; }
.form { display: grid; gap: 14px; width: 100%; }
.form.inline { grid-template-columns: minmax(0, 1fr) auto; align-items: end; }
@media (max-width: 560px) { .form.inline { grid-template-columns: minmax(0, 1fr); } }
.field { display: grid; gap: 6px; text-align: left; min-width: 0; }
.field > span:not(.sr) { font: 700 1rem var(--font-display); }
.field input {
  width: 100%;
  min-width: 0;
  font: 600 1.1rem var(--font-body);
  padding: 12px 14px;
  border-radius: 14px;
  border: 3px solid var(--space-3);
  background: var(--paper);
  color: var(--ink);
}
.field input:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.form-panel { display: grid; gap: 12px; justify-items: center; text-align: center; max-width: 480px; width: 100%; margin: 0 auto; }
.form-panel > .pip { width: 96px; height: 96px; }
.form-panel > p { color: var(--muted); }
.form-panel .btn.big { width: 100%; }
.new-class h2 { margin-bottom: 12px; }

.class-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.class-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 2px 12px;
  align-items: center;
  text-align: left;
  padding: 16px 18px;
  border: 0;
  border-radius: var(--r-md);
  background: var(--space-2);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  box-shadow: 0 6px 0 var(--shadow);
}
.panel .class-card { background: var(--space-3); }
.class-card .icon { grid-row: 1 / 3; width: 44px; height: 44px; padding: 10px; border-radius: 14px; background: var(--lilac); color: var(--ink); }
.class-card b { font: 800 1.2rem/1.2 var(--font-display); overflow-wrap: anywhere; }
.class-card small { color: var(--muted); }
.class-card:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--shadow); }
.class-card:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

.class-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.passcode-panel { display: grid; gap: 14px; justify-items: center; text-align: center; }
.passcode-panel > p:last-child { color: var(--muted); max-width: 54ch; }
.passcode { display: flex; gap: clamp(8px, 2vw, 16px); }
.passcode span {
  display: grid;
  place-items: center;
  width: clamp(62px, 17vw, 110px);
  height: clamp(80px, 21vw, 140px);
  border-radius: 18px;
  background: var(--paper);
  color: var(--ink);
  font: 800 clamp(2.8rem, 11vw, 5.5rem)/1 var(--font-display);
  font-variant-numeric: tabular-nums;
  box-shadow: 0 6px 0 var(--paper-2);
}
.pc-timer { display: flex; align-items: center; gap: 12px; width: min(100%, 420px); color: var(--muted); font-weight: 700; font-variant-numeric: tabular-nums; }
.pc-bar { flex: 1; height: 10px; border-radius: 99px; background: var(--space-3); overflow: hidden; }
.pc-bar span { display: block; height: 100%; background: var(--gold); border-radius: inherit; transition: width 1s linear; }

.students h2 { display: flex; align-items: center; gap: 10px; }
.count { font: 800 0.95rem var(--font-display); padding: 2px 10px; border-radius: 99px; background: var(--space-3); color: var(--gold); }
.student { border-bottom: 1px solid var(--space-3); }
.student summary {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto auto 14px;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  cursor: pointer;
  list-style: none;
}
.student summary::-webkit-details-marker { display: none; }
.student summary::after { content: ''; width: 9px; height: 9px; border-right: 3px solid var(--muted); border-bottom: 3px solid var(--muted); transform: rotate(45deg); justify-self: center; }
.student[open] summary::after { transform: rotate(-135deg); }
.student summary:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 12px; }
.st-av { font-size: 1.7rem; width: 44px; height: 44px; display: grid; place-items: center; background: var(--space-3); border-radius: 50%; }
.st-name { display: grid; font: 700 1.1rem var(--font-display); overflow-wrap: anywhere; }
.st-name small, .st-num small { font: 400 0.85rem var(--font-body); color: var(--muted); }
.st-num { display: grid; justify-items: end; font: 800 1.15rem var(--font-display); font-variant-numeric: tabular-nums; }
.st-stars { display: flex; align-items: center; gap: 4px; }
.st-stars .icon { width: 20px; height: 20px; color: var(--gold); }
.st-body { display: grid; gap: 6px; padding: 0 0 18px; }
.st-body h3 { font: 800 1.05rem var(--font-display); margin: 10px 0 2px; }
.st-body .btn { justify-self: start; margin-top: 6px; }
.st-id { color: var(--muted); }
.st-id code { font-size: 1rem; color: var(--text); margin-left: 6px; }
@media (max-width: 560px) {
  .student summary { grid-template-columns: 40px minmax(0, 1fr) auto auto 12px; gap: 10px; }
  .st-num small { display: none; }
}

.my-classes { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.my-classes li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; border-radius: 14px; background: var(--space-3); }
.my-classes .icon { width: 22px; height: 22px; color: var(--lilac); }
.my-classes span { color: var(--muted); }
.my-class .panel h2 { margin-bottom: 12px; }

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