/* Hallmark · v2.0.0 · depth: restyle · genre: playful · theme: custom (the project's own clay system, kept as the brand: the teacher chose clay) · job: start a speaking round · nav: corner settings chip, no bar · footer: one credit line · copy: verbatim */
/* Hallmark · pre-emit critique: P4 H4 E4 S4 R3 V3 · weakest: R, the drifting blobs and glass bars stay because they are the clay look the teacher asked for; controls now speak one icon set instead of emoji */
/* Hallmark · dismissed 29 · the two drifting pastel blobs and the frosted action bar are the clay look the teacher chose for this game; content sits on solid clay cards above them */
/* Hallmark · dismissed 49 · the mode cards and two-line pop-up buttons are meant to wrap: a name over one short line telling students what the choice does */
/* Hallmark · dismissed 40 · the 1.77:1 reading is a used word tile in the order game, disabled on purpose so students see which words they already placed */
/* Hallmark · waive 12 · overshoot kept only on entrance keyframes (pop, rise, bounce) that give the clay its squish · state changes and hovers use the ease-out token instead */

/* Claymorphism: soft pastel blobs, big radii, an outer drop shadow plus inner light/dark edges. Every colour lives here. */
:root {
  --bg: #efe9ff;
  --bg-rgb: 239, 233, 255;
  --surface: #fbf9ff;
  --surface-rgb: 251, 249, 255;
  --paper: #fdfbff;          /* the lightest surface; never pure white */
  --hi: 253, 251, 255;       /* rgb of the clay highlight */
  --ink: #3b2f63;
  --ink-rgb: 59, 47, 99;
  --muted: #6b6090;          /* 5.4:1 on surface */
  --primary: #6e4fe6;        /* 5.2:1 under --primary-ink, 4.5:1 as text on --bg */
  --primary-rgb: 110, 79, 230;
  --primary-soft: #8b6cff;   /* decoration only: rings, bars, icons that float */
  --primary-pale: #a990ff;
  --primary-ink: var(--paper);
  --deep: 40, 10, 120;       /* rgb of the inner shade on filled buttons */
  --warn: #ff6b8b;           /* fills only */
  --warn-ink: #c2255c;       /* red text and the recording fill: 5.5:1 */
  --good: #146b43;           /* 6.3:1 under paper, 5.4:1 on mint */
  --shade: 107, 84, 180;     /* rgb of the shadow tint */
  --lilac-1: #f4f0ff;        /* wells */
  --lilac-2: #e3dbff;        /* selected */
  --lilac-3: #ece6ff;        /* tracks, idle chips */
  --lilac-4: #f1ecff;        /* picture frames */
  --lilac-5: #e8e1ff;        /* score ring track */
  --lilac-line: #e2d9fb;
  --lilac-slot: #cfc3f5;
  --dot-idle: #d9d0f5;
  --dot-done: #b7a6f5;
  --blob-pink: #ffd9ec;
  --blob-sky: #d4f3ff;
  --pink-soft: #ffd6e7;
  --title-pink: #ff7aa8;
  --mint: #c9f2dc;
  --mint-pale: #d8f7e6;
  --mint-strong: #06d6a0;
  --amber: #ff9f1c;
  --gold: #ffb703;
  --gold-pale: #fff1c2;
  --gold-ink: #8a5a00;
  --orange-ink: #b45309;
  --highlight: #ffe58a;
  --tint-win: #fff6d6;
  --tint-good: #e0fbef;
  --tint-meh: #fff1e0;
  --tint-angry: #ffe0e8;
  --clay:
    10px 12px 24px rgba(var(--shade), .22),
    inset -6px -6px 12px rgba(var(--shade), .14),
    inset 6px 6px 12px rgba(var(--hi), .9);
  --clay-pressed:
    4px 4px 10px rgba(var(--shade), .18),
    inset 6px 6px 12px rgba(var(--shade), .2),
    inset -4px -4px 10px rgba(var(--hi), .7);
  --clay-filled:
    10px 12px 24px rgba(var(--shade), .35),
    inset -6px -6px 12px rgba(var(--deep), .3),
    inset 6px 6px 12px rgba(var(--hi), .35);
  --spring: cubic-bezier(.34, 1.56, .64, 1);   /* entrances only */
  --ease-out: cubic-bezier(.16, 1, .3, 1);     /* state changes */
  --font: "Nunito", system-ui, sans-serif;
  font-family: var(--font);
  font-size: 17px;
  color: var(--ink);
}
* { box-sizing: border-box; }
.ico { width: 1.15em; height: 1.15em; flex: none; vertical-align: -.2em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
svg.ico:has(use[href="#i-wait"]) { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.step-icon .ico, .logo .ico { width: 1em; height: 1em; vertical-align: 0; }
.floaties .ico { width: 1em; height: 1em; color: var(--primary-soft); }

[hidden] { display: none !important; }
html, body { overflow-x: clip; }
body { margin: 0; min-height: 100dvh; background: var(--bg); }
::selection { background: var(--lilac-2); color: var(--ink); }
html { caret-color: var(--primary); scrollbar-color: var(--dot-done) var(--bg); }
body.projector { font-size: 26px; }

/* Drifting pastel blobs behind everything */
body::before, body::after {
  content: ""; position: fixed; z-index: -1; border-radius: 50%; filter: blur(60px); opacity: .75;
  animation: drift 18s ease-in-out infinite alternate;
}
body::before { width: 55vmax; height: 55vmax; background: var(--blob-pink); top: -20vmax; left: -15vmax; }
body::after { width: 45vmax; height: 45vmax; background: var(--blob-sky); bottom: -18vmax; right: -12vmax; animation-duration: 22s; animation-direction: alternate-reverse; }
@keyframes drift { to { transform: translate(8vmax, 6vmax) scale(1.15); } }

/* bottom padding leaves room for the sticky action bar */
.screen { max-width: 980px; margin: 0 auto; padding: 24px 16px 152px; }
h1 { font-size: 2.4em; font-weight: 900; margin: 12px 0 4px; letter-spacing: -.5px; }
h2 { font-size: 1.25em; font-weight: 800; margin: 28px 0 16px; }
h3 { font-size: 1em; font-weight: 800; margin: 20px 0 8px; }
h1, h2, h3, .title, .task-title { text-wrap: balance; overflow-wrap: break-word; min-width: 0; }
p, .bubble { text-wrap: pretty; }
.countdown, .lesson-count, .timer, .score-ring, .round-score, .dot, .pts { font-variant-numeric: tabular-nums; }
.center { text-align: center; justify-content: center; }
.muted { color: var(--muted); }

/* ---- clay building blocks ---- */
.clay { background: var(--surface); border-radius: 28px; box-shadow: var(--clay); }
.clay-chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 999px; border: 0;
  background: var(--surface); box-shadow: var(--clay); font: inherit; font-weight: 700; font-size: .9em; color: var(--ink);
}
button.clay-chip { cursor: pointer; transition: transform .2s var(--ease-out); }
button.clay-chip:hover { transform: translateY(-2px); }
.clay-btn {
  font: inherit; font-weight: 800; color: var(--ink); background: var(--surface);
  border: 0; border-radius: 20px; padding: 12px 24px; cursor: pointer;
  box-shadow: var(--clay); transition: transform .25s var(--ease-out), box-shadow .15s var(--ease-out);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.clay-btn:hover:not(:disabled) { transform: translateY(-3px); }
.clay-btn:active:not(:disabled) { transform: translateY(1px) scale(.96, .92); box-shadow: var(--clay-pressed); transition-duration: .08s; }
.clay-btn:focus-visible, .card:focus-visible, .topic:focus-visible, .clay-chip:focus-visible, .link-btn:focus-visible, .menu-item:focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; }
.clay-btn.primary {
  background: var(--primary); color: var(--primary-ink);
  box-shadow: var(--clay-filled);
}
.clay-btn.big { font-size: 1.15em; padding: 16px 28px; border-radius: 24px; }
.clay-btn.small { padding: 8px 12px; border-radius: 14px; }
.clay-btn:disabled { background: var(--lilac-3); color: var(--muted); box-shadow: none; cursor: not-allowed; }
.clay-btn.two-line { flex-direction: column; gap: 0; line-height: 1.2; }
.clay-btn.two-line small { font-weight: 600; color: var(--muted); font-size: .75em; }
.link-btn { background: none; border: 0; padding: 8px 4px; font: inherit; font-weight: 700; font-size: .9em; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.link-btn:disabled { color: var(--dot-done); text-decoration: none; cursor: not-allowed; }
#record:not(:disabled):not(.recording) { animation: breathe 2.4s ease-in-out infinite; }
.clay-btn.recording { background: var(--warn-ink); color: var(--paper); animation: pulse 1s infinite; }
@keyframes breathe { 50% { box-shadow: 10px 12px 30px rgba(var(--primary-rgb), .55), inset -6px -6px 12px rgba(var(--deep), .3), inset 6px 6px 12px rgba(var(--hi), .35); } }
@keyframes pulse { 50% { transform: scale(1.05); } }

/* ---- top-right: install + settings ---- */
.toggles { position: fixed; top: 12px; right: 12px; z-index: 20; display: flex; gap: 8px; align-items: flex-start; }
.clay-chip.install {
  background: var(--primary); color: var(--paper);
  box-shadow: 6px 8px 16px rgba(var(--shade), .35), inset -4px -4px 8px rgba(var(--deep), .3), inset 4px 4px 8px rgba(var(--hi), .35);
}
body:not(.on-home) .install { display: none; } /* keep the game screen uncluttered */
#settings-btn { font-size: 1.1em; padding: 8px 12px; }
.settings { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 8px); padding: 8px; display: grid; gap: 4px; min-width: 230px; border-radius: 18px; animation: pop .3s var(--spring); }
.menu-item { display: flex; align-items: center; gap: 8px; padding: 12px 12px; border-radius: 12px; border: 0; background: none; font: inherit; font-size: .95em; font-weight: 700; color: var(--ink); cursor: pointer; text-align: left; }
.menu-item:hover { background: var(--bg); }
.menu-item input { accent-color: var(--primary); width: 18px; height: 18px; }

/* ---- sticky action bar (home + game) ---- */
.actionbar {
  position: fixed; left: 12px; right: 12px; bottom: 12px; margin: 0 auto; max-width: 948px; z-index: 15;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px 12px 20px; border-radius: 26px;
  background: rgba(var(--surface-rgb), .94); backdrop-filter: blur(10px); animation: barIn .5s var(--spring) both;
}
@keyframes barIn { from { opacity: 0; transform: translateY(40px); } }
.bar-status { flex: 1 1 220px; margin: 0; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.bar-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }

/* ---- reusable animations ---- */
.enter { animation: rise .55s var(--spring) both; }
.enter .stagger > * { animation: pop .6s var(--spring) both; animation-delay: calc(var(--n, 0) * 70ms + 120ms); }
.stagger > :nth-child(1) { --n: 1; } .stagger > :nth-child(2) { --n: 2; } .stagger > :nth-child(3) { --n: 3; }
.stagger > :nth-child(4) { --n: 4; } .stagger > :nth-child(5) { --n: 5; } .stagger > :nth-child(6) { --n: 6; }
.pop-in { animation: pop .6s var(--spring) both; }
.fade-in { animation: fade .4s ease both; }
.jelly { animation: jelly .7s both; }
.shake { animation: shake .5s both; }
@keyframes rise { from { opacity: 0; transform: translateY(24px); } }
@keyframes pop { from { opacity: 0; transform: scale(.6) translateY(16px); } }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } }
@keyframes jelly { 30% { transform: scale(1.12, .88); } 50% { transform: scale(.92, 1.08); } 70% { transform: scale(1.04, .96); } }
@keyframes shake { 20%, 60% { transform: translateX(-10px) rotate(-2deg); } 40%, 80% { transform: translateX(10px) rotate(2deg); } }
@keyframes bob { 50% { transform: translateY(-8px) rotate(-3deg); } }

/* ---- home ---- */
.hero { text-align: center; padding-top: 12px; }
.logo {
  width: 88px; height: 88px; margin: 0 auto; display: grid; place-items: center; font-size: 44px; color: var(--primary);
  border-radius: 30px; background: var(--pink-soft); cursor: pointer; animation: bob 3s ease-in-out infinite;
}
.tagline { color: var(--muted); font-size: 1.1em; margin: 0 auto; max-width: 520px; }
.help-chip { margin-top: 16px; padding: 8px 16px; }
.card { padding: 20px 20px; display: flex; flex-direction: column; gap: 4px; text-align: left; border: 0; font: inherit; color: inherit; }
.card b { font-size: 1.15em; font-weight: 800; }
.card span:last-child { color: var(--muted); }
.step-icon { font-size: 2em; color: var(--primary); display: inline-block; transition: transform .3s var(--ease-out); }
.card:hover .step-icon, .topic:hover .emoji { transform: scale(1.25) rotate(-8deg); }
.hint { margin: 16px 0 0; color: var(--muted); }

.modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.mode { cursor: pointer; transition: transform .25s var(--ease-out), box-shadow .2s var(--ease-out), background-color .2s var(--ease-out); }
.mode:hover { transform: translateY(-4px); }
.mode[aria-checked="true"], .topic[aria-checked="true"], .time[aria-checked="true"] {
  background: var(--lilac-2); box-shadow: var(--clay-pressed), 0 0 0 3px var(--primary); transform: scale(.98);
}
.mode[aria-checked="true"] b::after, .topic[aria-checked="true"]::after { content: " ✓"; color: var(--primary); }
.topic[aria-checked="true"] .emoji { animation: bob 1.2s ease-in-out infinite; }
.time-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 16px; font-weight: 700; animation: pop .45s var(--spring); scroll-margin-top: 80px; }
.time { padding: 12px 20px; font-size: 1em; }
#topics-title { scroll-margin-top: 70px; }
.topics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.topic {
  font: inherit; font-weight: 800; color: var(--ink); border: 0; cursor: pointer;
  border-radius: 24px; padding: 20px 12px; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center;
  box-shadow: var(--clay); transition: transform .25s var(--ease-out), box-shadow .2s var(--ease-out);
}
.topic .emoji { font-size: 2.2em; display: inline-block; transition: transform .3s var(--ease-out); }
.topic:hover { transform: translateY(-4px); }
.topic-hint { display: none; font-weight: 600; font-size: .78em; opacity: .85; }
#topics.judge .topic-hint { display: block; }

/* help pop-up */
.help-steps { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 12px; text-align: left; }
.help-steps li { display: flex; gap: 16px; align-items: center; padding: 12px 16px; border-radius: 18px; background: var(--lilac-1); }
.help-steps li > span { font-size: 1.8em; }

/* ---- game ---- */
.topbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 16px; padding-right: 64px; }
.left-chip { color: var(--muted); font-variant-numeric: tabular-nums; }
.left-chip.low { color: var(--warn-ink); }
.dots { display: flex; gap: 8px; margin-left: auto; }
.dot {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  font-size: .7em; font-weight: 800; background: var(--surface); box-shadow: var(--clay); color: var(--muted);
  transition: background .3s, transform .3s var(--spring);
}
.dot.now { background: var(--primary); color: var(--paper); animation: pulse 1.6s ease-in-out infinite; }
.dot.done { background: var(--mint); color: var(--good); }

.task { padding: 16px 24px; margin-bottom: 20px; }
.task-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.task-title { font-weight: 800; font-size: 1.15em; margin: 0; }
.task-head .link-btn { white-space: nowrap; flex-shrink: 0; }
.banned { color: var(--warn-ink); font-weight: 700; margin: 8px 0 0; }
.banned:empty { display: none; }
.judge-steps { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.judge-steps li { padding: 8px 16px; border-radius: 999px; font-weight: 800; font-size: .9em; background: var(--lilac-3); color: var(--muted); transition: background .3s, color .3s, transform .3s var(--spring); }
.judge-steps li.now { background: var(--primary); color: var(--paper); transform: scale(1.06); }
.judge-steps li.done { background: var(--mint); color: var(--good); }
.judge-steps li.done::after { content: " ✓"; }

.stage { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }
.frame-wrap { margin: 0; padding: 16px; display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 470px; justify-self: center; animation: pop .5s var(--spring) both; transition: transform .3s var(--ease-out); }
figcaption { font-weight: 800; padding-left: 8px; }
.frame {
  aspect-ratio: 1; border-radius: 20px; overflow: hidden; display: grid; place-items: center;
  background: var(--lilac-4); box-shadow: inset 6px 6px 12px rgba(var(--shade), .15), inset -6px -6px 12px rgba(var(--hi), .8);
}
.frame img { width: 100%; height: 100%; object-fit: contain; } /* never crop: students must see the whole target */
.placeholder { color: var(--muted); padding: 20px; text-align: center; font-weight: 700; animation: fade .4s ease both; }
.placeholder .big-emoji { display: block; font-size: 2.6em; margin-bottom: 8px; animation: bob 3s ease-in-out infinite; }
.loading .big-emoji { animation: squish 1s ease-in-out infinite; }
@keyframes squish { 0%, 100% { transform: scale(1, 1) translateY(0); } 30% { transform: scale(1.2, .8) translateY(6px); } 60% { transform: scale(.9, 1.1) translateY(-14px); } }

.timer { display: flex; align-items: center; gap: 12px; padding: 12px 20px; margin-top: 20px; font-weight: 900; font-size: 1.6em; animation: pop .4s var(--spring); }
.timer small { font-size: .5em; color: var(--muted); }
.timer-bar { flex: 1; height: 16px; border-radius: 999px; background: var(--lilac-3); box-shadow: inset 2px 2px 4px rgba(var(--shade), .2); overflow: hidden; }
.timer-bar i { display: block; height: 100%; width: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--mint-strong), var(--primary-soft)); transform: translateX(calc(var(--fill, 1) * 100% - 100%)); transition: transform 1s linear; }
.timer.danger { color: var(--warn-ink); animation: pulse .5s ease-in-out infinite; }
.timer.danger .timer-bar i { background: linear-gradient(90deg, var(--amber), var(--warn)); }

.countdown {
  position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; pointer-events: none;
  font-size: 9em; font-weight: 900; color: var(--primary); font-variant-numeric: tabular-nums; text-shadow: 6px 8px 0 rgba(var(--shade), .18);
  background: rgba(var(--bg-rgb), .55); backdrop-filter: blur(3px);
}
.count-pop { animation: countPop .75s var(--spring) both; }
@keyframes countPop { from { transform: scale(2.4); opacity: 0; } 60% { transform: scale(.9); opacity: 1; } to { transform: scale(1); } }

.controls { display: flex; flex-wrap: wrap; gap: 16px; margin: 28px 0 12px; }
.transcript { margin: 20px 0 0; padding: 16px 20px; font-weight: 600; }

.result { padding: 24px 24px; margin-top: 20px; scroll-margin-top: 16px; }
.score-ring {
  width: 120px; height: 120px; border-radius: 50%; margin: 0 auto 12px; display: grid; place-content: center; grid-auto-flow: column; align-items: baseline;
  background: conic-gradient(var(--primary) calc(var(--p, 0) * 1%), var(--lilac-5) 0);
  box-shadow: var(--clay); position: relative; font-weight: 900; font-size: 2em;
}
.score-ring::before { content: ""; position: absolute; inset: 14px; border-radius: 50%; background: var(--surface); box-shadow: inset 4px 4px 8px rgba(var(--shade), .15); }
.score-ring > * { position: relative; }
.score-ring small { font-size: .5em; }
.score-ring.big { width: 160px; height: 160px; font-size: 2.6em; margin-top: 16px; }
.rows { display: grid; gap: 12px; margin-top: 12px; }
.row { display: grid; grid-template-columns: 130px 1fr; gap: 4px 16px; align-items: center; animation: rise .5s var(--spring) both; animation-delay: calc(var(--i, 0) * 90ms); }
.row .label { font-weight: 800; }
.bar { height: 14px; border-radius: 999px; background: var(--lilac-3); box-shadow: inset 2px 2px 4px rgba(var(--shade), .2); overflow: hidden; }
.bar i { display: block; height: 100%; width: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary-pale), var(--primary)); transform: translateX(calc(var(--fill, 0) * 100% - 100%)); transition: transform 1.1s var(--ease-out); }
.row .why { grid-column: 2; color: var(--muted); font-size: .9em; }
.row .pts { font-size: .85em; color: var(--muted); font-weight: 700; }
.row.penalty .label, .row.penalty .pts { color: var(--warn-ink); font-weight: 800; font-size: 1em; }
ul { margin: 0; padding-left: 24px; }
li { margin: 4px 0; }
del { color: var(--warn-ink); }
ins { color: var(--good); text-decoration: none; font-weight: 800; }
.encouragement { font-weight: 700; color: var(--primary); margin: 20px 0 0; }

/* ---- pop-ups ---- */
.modal {
  position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 16px;
  background: rgba(var(--ink-rgb), .35); backdrop-filter: blur(4px); animation: fade .3s ease both;
}
.modal-card { width: min(440px, 100%); padding: 28px 24px 20px; text-align: center; border-radius: 36px; max-height: 100%; overflow: auto; animation: bounceIn .6s var(--spring) both; }
.modal-card h2 { margin: 8px 0 0; font-size: 1.7em; font-weight: 900; }
.modal-card .score-ring { margin: 16px auto 8px; }
.modal-card > p { margin: 8px 0; }
.modal-learn { text-align: left; background: var(--lilac-1); border-radius: 18px; padding: 12px 16px; margin-top: 12px; font-weight: 600; font-size: .92em; }
.modal-learn p { margin: 4px 0; }
.modal-learn p:empty { display: none; }
.tier-win .modal-card { background: linear-gradient(160deg, var(--tint-win), var(--surface) 55%); }
.tier-good .modal-card { background: linear-gradient(160deg, var(--tint-good), var(--surface) 55%); }
.tier-meh .modal-card { background: linear-gradient(160deg, var(--tint-meh), var(--surface) 55%); }
.tier-angry .modal-card { background: linear-gradient(160deg, var(--tint-angry), var(--surface) 55%); }
.tier-angry .score-ring { background: conic-gradient(var(--warn) calc(var(--p, 0) * 1%), var(--tint-angry) 0); }
.tier-win .score-ring { background: conic-gradient(var(--gold) calc(var(--p, 0) * 1%), var(--gold-pale) 0); }
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.modal-actions .primary, .modal-actions .link-btn { grid-column: 1 / -1; }
.modal-actions .clay-btn:only-child { grid-column: 1 / -1; }
.bounce-in { animation: bounceIn .7s var(--spring) both; }
.bounce-shake { animation: bounceIn .5s var(--spring) both, shake .6s .5s both; }
@keyframes bounceIn { from { opacity: 0; transform: scale(.4) translateY(60px); } }

.emote { font-size: 4.2em; line-height: 1.1; display: inline-block; }
.emote .pose { display: block; height: 150px; width: auto; margin: 0 auto; filter: drop-shadow(0 10px 10px rgba(var(--shade), .28)); }
#summary-emoji .pose { height: 190px; }
.emote-win { animation: spinPop 1s var(--spring) both, bob 1.4s 1s ease-in-out infinite; }
.emote-good { animation: pop .6s var(--spring) both, jelly 1s .6s both; }
.emote-meh { animation: pop .6s var(--spring) both, tilt 1.6s .6s ease-in-out infinite; }
.emote-angry { animation: pop .5s var(--spring) both, rage .4s .5s 4 both; }
@keyframes spinPop { from { transform: scale(0) rotate(-540deg); } }
@keyframes tilt { 25% { transform: rotate(-14deg); } 75% { transform: rotate(14deg); } }
@keyframes rage { 25% { transform: translateX(-6px) scale(1.1); filter: hue-rotate(-20deg) saturate(1.6); } 75% { transform: translateX(6px) scale(1.1); } }

/* confetti + floating emoji particles (created by fx.js) */
.confetti {
  position: fixed; top: 38%; left: 50%; width: 10px; height: 14px; z-index: 50; pointer-events: none;
  animation: confetti var(--d) cubic-bezier(.15, .7, .35, 1) forwards;
}
@keyframes confetti {
  30% { transform: translate(calc(var(--x) * .7), var(--up)) rotate(calc(var(--r) * .4)); opacity: 1; }
  to { transform: translate(var(--x), var(--down)) rotate(var(--r)); opacity: 0; }
}
.particle { position: fixed; z-index: 45; pointer-events: none; animation: var(--d) ease-in var(--delay) both; }
.particle.up { bottom: -60px; animation-name: floatUp; }
.particle.down { top: -60px; animation-name: fallDown; }
@keyframes floatUp { from { opacity: 0; } 15% { opacity: 1; } to { transform: translate(var(--drift), -110vh) rotate(20deg); opacity: 0; } }
@keyframes fallDown { from { opacity: 0; } 10% { opacity: .9; } to { transform: translate(var(--drift), 110vh); opacity: 0; } }

/* ---- summary ---- */
.round-list { display: grid; gap: 12px; }
.round { display: grid; grid-template-columns: auto auto 1fr; gap: 16px; align-items: center; padding: 12px 16px; border-radius: 22px; transition: transform .3s var(--ease-out); }
.round:hover { transform: translateX(4px); }
.round-num { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; background: var(--lilac-3); color: var(--muted); }
.round-pics { display: flex; gap: 8px; }
.round-pics img, .round-pics .noimg { width: 76px; height: 76px; object-fit: cover; border-radius: 14px; background: var(--lilac-4); display: grid; place-items: center; color: var(--muted); }
.round-info { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.round-score { font-size: 1.35em; font-weight: 900; color: var(--muted); }
.round-score.tier-win { color: var(--gold-ink); } .round-score.tier-good { color: var(--good); }
.round-score.tier-meh { color: var(--orange-ink); } .round-score.tier-angry { color: var(--warn-ink); }
.round-label { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.round-tip { color: var(--muted); font-weight: 600; }

footer { text-align: center; color: var(--muted); font-size: .85em; padding: 28px 16px 0; }
footer p { margin: 4px 0; }
.credit { font-size: 1.1em; color: var(--ink); margin: 0 0 8px; }
.credit b { color: var(--primary); font-weight: 900; }

/* ---- lesson ---- */
.lesson-top { display: flex; align-items: center; gap: 12px; padding-right: 56px; }
.lesson-dots { display: flex; gap: 8px; flex: 1; justify-content: center; }
.lesson-dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--dot-idle); transition: background-color .3s var(--ease-out), transform .3s var(--ease-out); }
.lesson-dots i.done { background: var(--dot-done); }
.lesson-dots i.on { background: var(--primary); transform: scale(1.5); }
.lesson-count { font-weight: 800; font-size: .9em; white-space: nowrap; font-variant-numeric: tabular-nums; }
.guide { display: flex; align-items: center; gap: 8px; margin: 8px 0 12px; }
.avatar { height: 170px; width: auto; flex: none; filter: drop-shadow(0 10px 10px rgba(var(--shade), .28)); animation: bob 3s ease-in-out infinite; transform-origin: 50% 100%; }
.avatar.jelly { animation: jelly .7s both, bob 3s ease-in-out .7s infinite; } /* bounce on a new pose, then keep bobbing */
.bubble { position: relative; margin: 0; padding: 16px 20px; border-radius: 22px; font-weight: 800; font-size: 1.05em; line-height: 1.35; }
.bubble::before { content: ""; position: absolute; left: -12px; top: 50%; margin-top: -12px; border: 12px solid transparent; border-left: 0; border-right-color: var(--surface); }

/* ---- welcome ---- */
.welcome { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding-bottom: 24px; position: relative; overflow: hidden; }
.welcome { padding-top: 64px; } /* clear the settings button */
.welcome > :not(.floaties) { position: relative; z-index: 1; }
.title { font-size: clamp(2.1em, 9vw, 5em); margin: 0; line-height: 1.05; white-space: nowrap; color: var(--primary); text-shadow: 0 6px 0 var(--title-pink), 0 12px 22px rgba(var(--shade), .35); }
.title span { display: inline-block;
  animation: dropIn .7s var(--spring) both, wiggle 3.5s ease-in-out infinite; animation-delay: calc(var(--i) * 70ms), calc(1s + var(--i) * 120ms); }
.title .gap { width: .35em; }
@keyframes dropIn { from { opacity: 0; transform: translateY(-120px) rotate(-20deg) scale(.5); } }
@keyframes wiggle { 0%, 80%, 100% { transform: none; } 88% { transform: translateY(-10px) rotate(-6deg); } 94% { transform: translateY(0) rotate(4deg); } }
.welcome .tagline { font-weight: 700; color: var(--muted); margin: 12px 0 0; animation: rise .6s ease 1s both; }
.stand { display: flex; align-items: center; justify-content: center; gap: 4px; margin: 12px 0 8px; animation: rise .7s var(--spring) 1.2s both; }
.welcome-avatar { height: min(40svh, 330px); width: auto; filter: drop-shadow(0 14px 14px rgba(var(--shade), .3)); animation: bob 3s ease-in-out infinite; transform-origin: 50% 100%; }
.welcome-bubble { max-width: 200px; text-align: left; animation: pop .6s var(--spring) 1.8s both; }
.start-btn { font-size: 1.35em; padding: 16px 40px; animation: pop .6s var(--spring) 2s both, breathe 2.4s ease-in-out 2.6s infinite; }
.welcome footer { padding-top: 20px; }
.floaties span { position: absolute; left: var(--x); top: var(--y); font-size: 2.2em; opacity: .6; animation: floaty 5s ease-in-out var(--d) infinite; pointer-events: none; }
@keyframes floaty { 50% { transform: translateY(-18px) rotate(10deg) scale(1.1); } }
.lesson-card { padding: 20px 24px 24px; }
.lesson-card h2 { margin: 0 0 16px; font-size: 1.45em; font-weight: 900; }
.lesson-card h3 { margin: 20px 0 8px; }
.lesson-text { line-height: 1.5; margin: 12px 0 0; }
.lesson-text.example { background: var(--lilac-1); border-radius: 16px; padding: 12px 16px; font-weight: 700; }
.lesson-text small, .fixes small { color: var(--muted); font-weight: 600; }
mark.adj { background: var(--highlight); color: var(--ink); border-radius: 6px; padding: 0 4px; font-weight: 800; }
.pic-pair, .pic-trio { display: grid; gap: 12px; }
.pic-pair { grid-template-columns: 1fr 1fr; }
.pic-trio { grid-template-columns: repeat(3, 1fr); margin-top: 16px; }
.lesson-pic { position: relative; margin: 0; background: var(--paper); border-radius: 20px; padding: 8px; box-shadow: var(--clay); }
.lesson-pic img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 14px; display: block; }
.lesson-pic figcaption { font-weight: 700; font-size: .9em; padding: 8px 4px 4px; line-height: 1.35; }
.score-badge { position: absolute; top: 14px; right: 14px; padding: 4px 12px; border-radius: 999px; font-weight: 900; color: var(--paper); animation: pop .6s var(--spring) .4s both; }
.score-badge.good { background: var(--good); }
.score-badge.bad { background: var(--warn-ink); }
.rule-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.rule { background: var(--lilac-1); border-radius: 18px; padding: 12px 16px; }
.rule p { margin: 8px 0 0; font-size: 1.1em; line-height: 1.6; }
.fixes { padding-left: 20px; margin: 0; line-height: 1.8; }
.fixes del { color: var(--warn-ink); }
.fixes ins { color: var(--good); text-decoration: none; font-weight: 800; }
.order-row { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px; counter-reset: o; }
.order-row li { background: var(--lilac-1); border-radius: 14px; padding: 8px 4px; text-align: center; display: grid; gap: 4px; font-size: .85em; }
.order-row li b { color: var(--primary); font-size: .85em; }
.order-row li span { font-weight: 800; }
.senses { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.sense { background: var(--lilac-1); border-radius: 18px; padding: 12px 12px; display: grid; gap: 4px; text-align: center; font-size: .9em; }
.sense-emoji { font-size: 1.8em; }
.checklist { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.checklist li { display: grid; grid-template-columns: 2em 8em 1fr; align-items: center; background: var(--lilac-1); border-radius: 14px; padding: 8px 12px; }
.checklist li > span:first-child { font-size: 1.3em; }
.checklist li > span:last-child { color: var(--muted); font-weight: 600; }
.lesson-q { margin-top: 20px; padding-top: 16px; border-top: 2px dashed var(--lilac-line); }
.lesson-q .q { font-weight: 800; margin: 0 0 12px; }
.choices { display: flex; flex-wrap: wrap; gap: 12px; }
.clay-btn.choice { flex: 1 1 160px; }
.clay-btn.choice.right { background: var(--mint-pale); color: var(--good); opacity: 1; }
.clay-btn.choice.wrong { background: var(--tint-angry); }
.clay-chip.word { font-size: 1em; padding: 12px 20px; }
.clay-chip.word:disabled { background: var(--lilac-3); color: var(--dot-done); box-shadow: none; cursor: not-allowed; }
.sentence { font-size: 1.15em; }
.slots { display: inline-flex; gap: 8px; flex-wrap: wrap; }
.slot { min-width: 64px; text-align: center; border-bottom: 3px solid var(--lilac-slot); color: var(--muted); }
.slot.filled { color: var(--ink); border-color: var(--primary); animation: pop .4s var(--spring) both; }
.lesson-feedback { min-height: 1.4em; margin: 12px 0 0; font-weight: 700; }
.help-steps.mini { margin-top: 20px; }

@media (max-width: 720px) {
  h1 { font-size: 1.9em; }
  .lesson-top > .clay-chip { display: none; }
  .avatar { height: 128px; }
  .welcome-avatar { height: min(36svh, 260px); }
  .welcome-bubble { max-width: 150px; font-size: .92em; }
  .floaties span { font-size: 1.6em; }
  .bubble { font-size: .98em; padding: 12px 16px; }
  .lesson-card { padding: 16px 16px 20px; }
  .pic-trio { grid-template-columns: 1fr 1fr; }
  .pic-trio .lesson-pic:first-child { grid-column: 1 / -1; width: 70%; justify-self: center; }
  .rule-grid { grid-template-columns: 1fr; }
  .order-row { grid-template-columns: repeat(4, 1fr); }
  .senses { grid-template-columns: repeat(2, 1fr); }
  .senses .sense:last-child { grid-column: 1 / -1; }
  .checklist li { grid-template-columns: 2em 1fr; }
  .checklist li > span:last-child { grid-column: 2; font-size: .9em; }
  .modes { grid-template-columns: 1fr; gap: 12px; }
  .modes .card { display: grid; grid-template-columns: auto 1fr; column-gap: 16px; row-gap: 0; padding: 12px 16px; align-items: center; }
  .modes .step-icon { grid-row: span 2; font-size: 1.7em; }
  .logo { width: 64px; height: 64px; font-size: 32px; border-radius: 22px; }
  .topics { grid-template-columns: repeat(2, 1fr); }
  .row { grid-template-columns: 1fr; }
  .row .why { grid-column: 1; }
  .countdown { font-size: 6em; }
  .emote { font-size: 3.4em; }
  .bar-status { flex-basis: 100%; font-size: .9em; }
  .bar-actions { width: 100%; }
  .bar-actions > * { flex: 1; }
  .actionbar { padding: 12px 12px; gap: 8px; }
  .clay-btn.big { padding: 12px 20px; font-size: 1.05em; }
  .clay-btn.two-line { padding: 12px 8px; font-size: .95em; }
  .round { grid-template-columns: auto 1fr; }
  .round-num { display: none; }
  .round-pics img, .round-pics .noimg { width: 56px; height: 56px; }
  .screen { padding-bottom: 172px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
