/* Học cùng RongLeo — CSS dùng chung. Mobile-first, không phụ thuộc mạng. */
:root {
  --bg: #fff8ef;
  --bg-2: #fff3e2;
  --ink: #20232a;
  --muted: #616979;
  --card: #ffffff;
  --line: #ecdfcc;
  --shadow: 0 12px 32px rgba(80, 52, 20, 0.12);
  --shadow-sm: 0 4px 14px rgba(80, 52, 20, 0.10);
  --radius: 26px;
  --radius-sm: 16px;
  --orange: #ff8a3d;
  --orange-dark: #d95f12;
  --orange-soft: #fff0e2;
  --teal: #1fbf9c;
  --teal-dark: #087f65;
  --teal-soft: #e5fbf4;
  --blue: #4f8ef7;
  --blue-dark: #2c66c9;
  --blue-soft: #eaf2ff;
  --pink: #ff5d8f;
  --purple: #a77bff;
  --yellow: #ffc93c;
  --ok: #2fb344;
  --ok-soft: #e6f8e9;
  --warn: #f0a04b;
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-round: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, #ffe8c9 0%, transparent 55%),
    radial-gradient(900px 500px at 90% 0%, #dff7ef 0%, transparent 50%),
    var(--bg);
  -webkit-text-size-adjust: 100%;
  line-height: 1.45;
}

img { max-width: 100%; display: block; }

button, a { font-family: inherit; }

button { cursor: pointer; }

:focus-visible {
  outline: 3px solid #1a73e8;
  outline-offset: 3px;
}

.wrap {
  width: min(100% - 28px, 760px);
  margin: 0 auto;
  padding-bottom: calc(116px + env(safe-area-inset-bottom));
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------------- Hub ---------------- */
.hub-hero {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 132px;
  gap: 10px;
  align-items: center;
  padding: 26px 0 10px;
}
.hub-hero .hero-text { padding: 4px 0; }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--orange-dark);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  box-shadow: var(--shadow-sm);
}
h1, h2, h3 { font-family: var(--font-round); line-height: 1.12; }
.hub-hero h1 {
  margin: 12px 0 8px;
  font-size: clamp(2rem, 8vw, 3.1rem);
  letter-spacing: -0.02em;
}
.hub-hero p {
  margin: 0;
  max-width: 46ch;
  color: var(--muted);
  font-size: 1.02rem;
}
.hero-mascot {
  width: 100%;
  filter: drop-shadow(0 18px 22px rgba(60, 40, 10, 0.18));
  animation: bob 4.5s ease-in-out infinite;
}
@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(-7px) rotate(1deg); }
}

.game-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin: 18px 0 26px;
}
@media (min-width: 760px) {
  .game-grid { grid-template-columns: repeat(3, 1fr); }
}
.game-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 22px 20px 18px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  min-height: 210px;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.game-card::after {
  content: "";
  position: absolute;
  inset: auto -30px -46px auto;
  width: 150px; height: 150px;
  border-radius: 50%;
  background: var(--tint, var(--orange-soft));
  opacity: 0.55;
  z-index: 0;
}
.game-card h2,
.game-card p,
.game-card .game-emoji,
.game-card .game-meta { position: relative; z-index: 1; }
.game-card:hover { transform: translateY(-4px); box-shadow: 0 18px 40px rgba(80,52,20,.16); }
.game-card:active { transform: scale(0.99); }
.game-emoji {
  width: 58px; height: 58px;
  display: grid; place-items: center;
  font-size: 2rem;
  border-radius: 18px;
  background: var(--tint, var(--orange-soft));
  border: 1px solid rgba(0,0,0,0.04);
}
.game-card h2 { margin: 2px 0 0; font-size: 1.35rem; }
.game-card p { margin: 0; color: var(--muted); font-size: 0.95rem; }
.game-meta {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--tint-ink, var(--orange-dark));
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}
.game-card .go {
  position: absolute;
  right: 18px; top: 18px;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--tint, var(--orange-soft));
  color: var(--tint-ink, var(--orange-dark));
  font-size: 1.2rem;
  font-weight: 900;
  z-index: 1;
}

.parent-note, .privacy-note {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}
.parent-note h2 { margin: 0 0 8px; font-size: 1.1rem; }
.parent-note ul { margin: 8px 0 0; padding-left: 20px; color: var(--muted); }
.parent-note li { margin: 4px 0; }
.privacy-note { font-size: 0.88rem; color: var(--muted); }
.privacy-note strong { color: var(--ink); }
.footer {
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
  padding: 12px 0 4px;
}
.footer a { color: var(--blue-dark); }

/* ---------------- Khung game ---------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  background: linear-gradient(to bottom, rgba(255,248,239,0.96), rgba(255,248,239,0.88), transparent);
  backdrop-filter: blur(6px);
}
.back-btn {
  flex: 0 0 auto;
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow-sm);
  font-size: 1.2rem;
  font-weight: 900;
  color: var(--ink);
}
.topbar-title { min-width: 0; }
.topbar-title h1 { margin: 0; font-size: 1.12rem; }
.topbar-title p { margin: 0; font-size: 0.8rem; color: var(--muted); }
.spacer { flex: 1; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  font-weight: 800;
  font-size: 0.82rem;
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
}
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }

.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}
.panel h2 { margin: 0 0 6px; font-size: 1.35rem; }
.panel .lead { margin: 0 0 14px; color: var(--muted); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
  padding: 12px 20px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 800;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--accent, var(--orange)); border-color: transparent; color: #fff; box-shadow: 0 10px 22px rgba(255, 138, 61, 0.32); }
.btn-primary:active { filter: brightness(0.97); }
.btn-ghost { background: var(--accent-soft, var(--orange-soft)); border-color: transparent; color: var(--accent-ink, var(--orange-dark)); }
.btn-big { width: 100%; min-height: 58px; font-size: 1.08rem; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row .btn { flex: 1 1 140px; }

.hidden { display: none !important; }

/* ---------------- Mascot + bubble ---------------- */
.rl-buddy {
  position: fixed;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 40;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
  max-width: calc(100vw - 24px);
}
.rl-buddy img {
  width: 78px;
  height: 78px;
  object-fit: contain;
  border-radius: 50%;
  background: #fff;
  border: 3px solid #fff;
  box-shadow: var(--shadow);
  pointer-events: auto;
}
.rl-say {
  max-width: min(240px, 62vw);
  padding: 10px 14px;
  border-radius: 18px 18px 4px 18px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  font-weight: 700;
  font-size: 0.9rem;
  opacity: 0;
  transform: translateY(6px) scale(0.96);
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.rl-say:empty { display: none; }
.rl-say.show { opacity: 1; transform: none; }
.rl-say::after {
  content: "";
  position: absolute;
}
@media (max-width: 420px) {
  .rl-buddy img { width: 62px; height: 62px; }
  .rl-say { font-size: 0.82rem; padding: 8px 11px; }
}

/* ---------------- Home chọn chế độ ---------------- */
.mode-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 560px) { .mode-grid { grid-template-columns: 1fr 1fr; } }
.mode-card {
  display: flex;
  gap: 14px;
  align-items: center;
  text-align: left;
  padding: 18px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow-sm);
  font-size: 1rem;
  color: var(--ink);
}
.mode-card:active { transform: scale(0.99); }
.mode-ico {
  flex: 0 0 auto;
  width: 52px; height: 52px;
  display: grid; place-items: center;
  border-radius: 16px;
  background: var(--accent-soft, var(--orange-soft));
  font-size: 1.6rem;
}
.mode-card strong { display: block; font-size: 1.08rem; }
.mode-card span { color: var(--muted); font-size: 0.86rem; }

.progress-line {
  display: flex; align-items: center; gap: 10px;
  margin: 14px 0 4px;
}
.progress-track {
  flex: 1;
  height: 12px;
  border-radius: 999px;
  background: var(--accent-soft, var(--orange-soft));
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: var(--accent, var(--orange));
  transition: width 0.35s ease;
}
.progress-text { font-weight: 800; font-size: 0.85rem; color: var(--accent-ink, var(--orange-dark)); white-space: nowrap; }

/* ---------------- Lưới chữ cái ---------------- */
.letter-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}
@media (min-width: 560px) { .letter-grid { grid-template-columns: repeat(7, 1fr); gap: 10px; } }
.letter-tile {
  position: relative;
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  border-radius: 18px;
  border: 2px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow-sm);
  font-family: var(--font-round);
  font-size: clamp(1.35rem, 5.5vw, 1.8rem);
  font-weight: 900;
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}
.letter-tile small { font-size: 0.58rem; font-weight: 700; color: var(--muted); font-family: var(--font); }
.letter-tile .sticker {
  position: absolute;
  right: 3px; bottom: 2px;
  font-size: 0.56rem;
  line-height: 1;
  opacity: 0.9;
}
.letter-tile.seen { border-color: #ffd15c; background: #fffdf2; }
.letter-tile.seen::after {
  content: "★"; position: absolute; left: 5px; top: 3px; font-size: 0.66rem; color: #f4a800;
}
.letter-tile:active { transform: scale(0.96); }

/* ---------------- Hộp chữ cái (dialog) ---------------- */
dialog.letter-dialog {
  width: min(100% - 20px, 520px);
  max-height: calc(100% - 20px);
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 28px;
  background: #fff;
  box-shadow: 0 30px 80px rgba(40, 24, 8, 0.30);
  overflow: hidden;
}
dialog.letter-dialog::backdrop { background: rgba(32, 24, 12, 0.42); backdrop-filter: blur(2px); }
.letter-card { padding: 20px; }
.letter-close {
  position: absolute;
  top: 10px; right: 10px;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 1.1rem;
  font-weight: 900;
}
.letter-big {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 12px;
  margin: 12px 0 2px;
  font-family: var(--font-round);
}
.letter-big .up { font-size: 4.4rem; line-height: 1; }
.letter-big .lo { font-size: 3.4rem; line-height: 1; color: var(--accent, var(--orange)); }
.letter-word {
  text-align: center;
  margin: 2px 0 12px;
  font-size: 1.4rem;
  font-weight: 900;
}
.letter-word .hl { color: var(--accent, var(--orange)); text-decoration: underline wavy rgba(255,138,61,.35); }
.letter-emoji { text-align: center; font-size: 4.4rem; line-height: 1.1; margin: 2px 0 6px; }
.letter-note { text-align: center; color: var(--muted); font-size: 0.86rem; min-height: 1.2em; margin: 0 0 12px; }
.letter-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.letter-actions .btn { min-height: 46px; padding: 8px 10px; font-size: 0.9rem; }
.dialog-nav { display: flex; gap: 8px; justify-content: space-between; margin-top: 10px; }
.dialog-nav .btn { flex: 1; }

/* ---------------- Quiz ---------------- */
.quiz-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.quiz-stars { font-size: 1.15rem; letter-spacing: 2px; color: #f4a800; white-space: nowrap; }
.quiz-count { color: var(--muted); font-size: 0.85rem; font-weight: 700; }
.quiz-prompt {
  text-align: center;
  font-size: 1.05rem;
  font-weight: 800;
  margin: 4px 0 10px;
}
.sound-orb {
  display: grid;
  place-items: center;
  width: 132px; height: 132px;
  margin: 6px auto 14px;
  border-radius: 50%;
  border: 0;
  background: radial-gradient(circle at 35% 30%, #ffd2a8, var(--accent, var(--orange)));
  color: #fff;
  font-size: 3rem;
  box-shadow: 0 16px 34px rgba(255, 138, 61, 0.35);
  -webkit-tap-highlight-color: transparent;
}
.sound-orb:active { transform: scale(0.96); }
.sound-orb.playing { animation: pulse 0.9s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 16px 34px rgba(255,138,61,.35), 0 0 0 0 rgba(255,138,61,.35); }
  50% { box-shadow: 0 16px 34px rgba(255,138,61,.35), 0 0 0 16px rgba(255,138,61,0); }
}

.options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 12px;
}
.option {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 104px;
  padding: 10px 6px;
  border-radius: 22px;
  border: 2px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow-sm);
  font-family: var(--font-round);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.1s ease, border-color 0.15s ease, background 0.15s ease;
}
.option .glyph { font-size: clamp(2rem, 9vw, 2.9rem); font-weight: 900; line-height: 1; }
.option .sub { font-size: 0.62rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.option:active { transform: scale(0.97); }
.option.is-correct { border-color: var(--ok); background: var(--ok-soft); }
.option.glow { animation: glow 0.9s ease-in-out infinite; }
@keyframes glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(47,179,68,.0); }
  50% { box-shadow: 0 0 0 8px rgba(47,179,68,.20); }
}
.option.is-wrong { border-color: var(--warn); background: #fff6ea; }
.shake { animation: shake 0.36s ease; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}
.hint {
  margin-top: 12px;
  min-height: 2.6em;
  text-align: center;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.95rem;
}
.hint strong { color: var(--accent-ink, var(--orange-dark)); }

/* ---------------- Ghép vần ---------------- */
.target-card { text-align: center; }
.target-emoji { font-size: 4.6rem; line-height: 1.1; }
.target-meaning { font-size: 1.35rem; font-weight: 900; margin: 0 0 2px; }
.target-sub { color: var(--muted); font-size: 0.86rem; margin: 0; }
.blend-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: nowrap;
  margin: 16px 0 6px;
}
.slot {
  min-width: 74px;
  min-height: 74px;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  border: 3px dashed #d9cbb6;
  background: #fffdf8;
  font-family: var(--font-round);
  font-size: 2rem;
  font-weight: 900;
  color: var(--ink);
}
.slot .placeholder { font-size: 0.72rem; color: #a89b88; font-weight: 700; font-family: var(--font); }
.slot.filled { border-style: solid; border-color: var(--accent, var(--teal)); background: var(--accent-soft, var(--teal-soft)); }
.slot.ok { border-color: var(--ok); background: var(--ok-soft); }
.slot.bad { border-color: var(--warn); background: #fff6ea; }
.blend-sign { font-size: 1.6rem; color: var(--muted); font-weight: 900; }
.blend-result {
  min-width: 74px;
  min-height: 74px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: #fff;
  border: 3px solid var(--line);
  font-family: var(--font-round);
  font-size: 2rem;
  font-weight: 900;
  color: var(--muted);
}
.blend-result.done { color: var(--accent-ink, var(--teal-dark)); border-color: var(--accent, var(--teal)); background: var(--accent-soft, var(--teal-soft)); }

.tile-group { margin-top: 14px; }
.tile-group h3 { margin: 0 0 8px; font-size: 0.82rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.tile-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.tile {
  min-height: 56px;
  border-radius: 16px;
  border: 2px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow-sm);
  font-family: var(--font-round);
  font-size: 1.35rem;
  font-weight: 900;
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}
.tile:active { transform: scale(0.96); }
.tile.used { opacity: 0.35; }
.tile.pulse { animation: glow 0.9s ease-in-out infinite; }
.tile.selected { border-color: var(--accent, var(--teal)); background: var(--accent-soft, var(--teal-soft)); }

/* ---------------- Số ---------------- */
.level-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 420px) { .level-grid { grid-template-columns: 1fr; } }
.level-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow-sm);
  text-align: left;
  color: var(--ink);
}
.level-card:active { transform: scale(0.99); }
.level-card .lv-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.level-card .lv-num {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: var(--accent-soft, var(--blue-soft));
  color: var(--accent-ink, var(--blue-dark));
  font-weight: 900;
}
.level-card h3 { margin: 0; font-size: 1rem; }
.level-card p { margin: 0; color: var(--muted); font-size: 0.84rem; }
.level-card.locked { opacity: 0.55; filter: saturate(0.6); }
.level-card .lock {
  font-size: 1.1rem;
}
.level-card .lv-stars { color: #f4a800; letter-spacing: 1px; font-size: 0.95rem; }
.tabs { display: flex; gap: 6px; padding: 5px; border-radius: 999px; background: var(--accent-soft, var(--blue-soft)); margin-bottom: 14px; }
.tab {
  flex: 1;
  min-height: 42px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  font-weight: 800;
  color: var(--accent-ink, var(--blue-dark));
  font-size: 0.92rem;
}
.tab.active { background: #fff; box-shadow: var(--shadow-sm); color: var(--ink); }
.level-stats { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 12px; }

.ladder { display: grid; gap: 10px; }
.ladder-group h3 { margin: 12px 0 6px; font-size: 0.88rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.rung-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 8px; }
.rung {
  position: relative;
  min-height: 64px;
  padding: 7px 6px;
  border-radius: 14px;
  border: 2px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow-sm);
  text-align: center;
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}
.rung .num { display: block; font-family: var(--font-round); font-size: 1.3rem; font-weight: 900; line-height: 1.05; }
.rung .read { display: block; font-size: 0.62rem; color: var(--muted); font-weight: 700; line-height: 1.15; margin-top: 2px; }
.rung.heard { border-color: #ffd15c; background: #fffdf2; }
.rung.heard::after { content: "★"; position: absolute; right: 4px; top: 2px; color: #f4a800; font-size: 0.7rem; }
.rung:active { transform: scale(0.96); }

.tenframe {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  max-width: 320px;
  margin: 6px auto 10px;
  padding: 10px;
  border-radius: 18px;
  background: #fff;
  border: 2px solid var(--line);
}
.thing {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--accent-soft, var(--blue-soft));
  font-size: clamp(1.35rem, 7vw, 2rem);
  border: 0;
  -webkit-tap-highlight-color: transparent;
}
.thing.counted { background: #fff2c8; transform: scale(1.04); }
.thing:active { transform: scale(0.94); }
.big-number {
  text-align: center;
  font-family: var(--font-round);
  font-size: clamp(4rem, 22vw, 7rem);
  font-weight: 900;
  line-height: 1;
  color: var(--accent-ink, var(--blue-dark));
  margin: 4px 0 0;
}
.big-read { text-align: center; font-size: 1.2rem; font-weight: 800; color: var(--muted); margin: 2px 0 10px; min-height: 1.4em; }
.rule-box {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
  margin: 10px 0;
  font-size: 0.9rem;
  color: var(--muted);
}
.rule-box strong { color: var(--ink); }
.rule-box ul { margin: 6px 0 0; padding-left: 18px; }

/* ---------------- Kết thúc phiên ---------------- */
.end-card { text-align: center; padding: 8px 4px 4px; }
.end-emoji { font-size: 4rem; line-height: 1.1; }
.end-stars { font-size: 2rem; letter-spacing: 4px; color: #f4a800; margin: 6px 0; }
.end-title { margin: 4px 0 6px; font-size: 1.5rem; }
.end-sub { color: var(--muted); margin: 0 0 14px; }
.end-actions { display: grid; gap: 8px; max-width: 360px; margin: 0 auto; }

/* ---------------- Confetti ---------------- */
#confetti {
  position: fixed;
  inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 80;
}

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