/*
 * lingo-theme.css — Lingo Premium override layer for Bé Vui Học Toán & Tin Học
 * Maps Lingo Premium design tokens onto the app's real CSS classes.
 * Source order: loads after lingo-premium.css → wins on all visual properties.
 * NEVER overrides: display/flex/grid/position/width/height/JS-state transforms/keyframes.
 * ALL colors via var(--token); raw hex only inside rgba() scrims.
 */

/* ============================================================
   1. GLOBAL / BODY
   ============================================================ */

body {
  font-family: var(--font-nunito);
  background: var(--neutral-secondary-medium);
  color: var(--body);
}

/* Clouds — keep decoration, tint softly to light palette */
.cloud,
.cloud::before,
.cloud::after {
  background: rgba(255,255,255,0.7);
}

.container {
  /* structural rules untouched — only ensure text inherits */
  color: inherit;
}


/* ============================================================
   2. MAIN HEADER (hero card)
   ============================================================ */

.main-header {
  background: var(--neutral-primary-soft);
  border: 2px solid var(--border-default);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
}

/* Replace old pink/orange gradient rainbow bar with brand palette */
.main-header::before {
  background: linear-gradient(90deg,
    var(--brand) 0%,
    var(--sky) 25%,
    var(--purple) 50%,
    var(--orange) 75%,
    var(--warning) 100%
  );
  height: 6px;
}

.main-header h1 {
  font-family: var(--font-nunito);
  font-weight: 900;
  background: linear-gradient(135deg, var(--brand-strong), var(--sky));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.4px;
}

.main-header p {
  color: var(--body-subtle);
  font-family: var(--font-nunito);
}


/* ============================================================
   3. SECTION CARDS
   ============================================================ */

.section-card {
  background: var(--neutral-primary-soft);
  border: 2px solid var(--border-default);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  transition: background-color .1s ease-out, border-color .1s ease-out,
              transform .1s ease-out, box-shadow .1s ease-out;
}

.section-card:hover {
  background: var(--brand-softer);
  border-color: var(--border-brand-subtle);
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}

.section-card:active {
  transform: translateY(1px);
  box-shadow: var(--shadow-xs);
}

/* Keep color bottom bar — remap to Lingo accents */
.section-card::after { height: 4px; border-radius: 0 0 14px 14px; }
.section-card:nth-child(1)::after { background: linear-gradient(90deg, var(--brand), var(--sky)); }
.section-card:nth-child(2)::after { background: linear-gradient(90deg, var(--sky), var(--teal)); }
.section-card:nth-child(3)::after { background: linear-gradient(90deg, var(--purple), var(--pink)); }
.section-card:nth-child(4)::after { background: linear-gradient(90deg, var(--orange), var(--warning)); }
.section-card:nth-child(5)::after { background: linear-gradient(90deg, var(--indigo), var(--purple)); }

.section-card .sc-title {
  font-family: var(--font-nunito);
  font-weight: 800;
  color: var(--heading);
}

.section-card .sc-desc {
  color: var(--body-subtle);
  font-family: var(--font-nunito);
}


/* ============================================================
   4. GAME AREA & TOPBAR
   ============================================================ */

.game-area {
  background: var(--neutral-primary-soft);
  border: 2px solid var(--border-default);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
}

.game-topbar {
  border-bottom: 1px solid var(--border-default);
  padding-bottom: 12px;
  margin-bottom: 16px;
}

.game-title {
  font-family: var(--font-nunito);
  font-weight: 800;
  color: var(--heading);
}

.game-score {
  background: var(--warning);
  color: var(--shadow-dark);
  border-radius: 9999px;
  font-family: var(--font-nunito);
  font-weight: 800;
  box-shadow: 0 2px 0 var(--shadow-warning);
  border: none;
}


/* ============================================================
   5. 3D TACTILE BUTTONS — base mixin (reused per class)
   ============================================================ */

/* Shared tactile transition — applies to all button targets */
.mode-btn,
.option-btn,
.cmp-btn,
.calc-key,
.kb-key,
.lu-btn,
.retry-btn,
.next-game-btn,
.story-cta,
.world-intro-btn,
.home-btn2,
.game-back,
.hud-shop-btn,
.rw-buy,
.dl-btn,
.sort-check,
.cb-submit,
.turtle-run,
.turtle-clear,
.turtle-step,
.btn-row button,
.arc-opt {
  transition: background-color .1s ease-out, transform .1s ease-out,
              box-shadow .1s ease-out, color .1s ease-out,
              border-color .1s ease-out;
  font-family: var(--font-nunito);
  font-weight: 800;
  letter-spacing: .5px;
}


/* ── mode-btn (game type selection) ── */
.mode-btn {
  background: var(--neutral-primary-soft);
  border: 2px solid var(--border-default);
  border-radius: 14px;
  box-shadow: 0 4px 0 var(--shadow-secondary);
  color: var(--heading);
}
.mode-btn:hover {
  background: var(--brand-softer);
  border-color: var(--border-brand-subtle);
  transform: none;
}
.mode-btn:active {
  box-shadow: 0 2px 0 var(--shadow-secondary);
  transform: translateY(2px);
}
.mode-btn .mb-title {
  font-family: var(--font-nunito);
  color: var(--heading);
}


/* ── option-btn (MCQ answers) ── */
.option-btn {
  background: var(--neutral-primary-soft);
  border: 2px solid var(--border-default);
  border-radius: 14px;
  box-shadow: 0 4px 0 var(--shadow-secondary);
  color: var(--heading);
}
.option-btn:hover:not(.disabled) {
  background: var(--brand-softer);
  border-color: var(--border-brand-subtle);
  transform: none;
}
.option-btn:active:not(.disabled) {
  box-shadow: 0 2px 0 var(--shadow-secondary);
  transform: translateY(2px);
}
.option-btn .opt-label {
  background: var(--neutral-tertiary-medium);
  color: var(--body);
  border-radius: 50%;
}


/* ── game-back button ── */
.game-back {
  background: var(--neutral-primary-soft);
  border: 2px solid var(--border-default);
  border-radius: 10px;
  color: var(--body);
  box-shadow: 0 3px 0 var(--shadow-secondary);
  font-family: var(--font-nunito);
  font-weight: 700;
}
.game-back:hover {
  border-color: var(--border-brand-subtle);
  color: var(--fg-brand);
  background: var(--brand-softer);
}
.game-back:active {
  box-shadow: 0 1px 0 var(--shadow-secondary);
  transform: translateY(2px);
}


/* ── next-game-btn / retry-btn ── brand green primary ── */
.next-game-btn,
.retry-btn,
.lu-btn,
.sort-check,
.cb-submit {
  background: var(--brand);
  color: #fff;
  border: 2px solid transparent;
  border-radius: 12px;
  box-shadow: 0 4px 0 var(--shadow-brand);
}
.next-game-btn:hover,
.retry-btn:hover,
.lu-btn:hover,
.sort-check:hover,
.cb-submit:hover {
  background: var(--brand-medium);
  transform: none;
}
.next-game-btn:active,
.retry-btn:active,
.lu-btn:active,
.sort-check:active,
.cb-submit:active {
  box-shadow: 0 2px 0 var(--shadow-brand);
  transform: translateY(2px);
}


/* ── home-btn2 / story-cta ── orange/purple accent ── */
.home-btn2,
.story-cta {
  background: var(--orange);
  color: #fff;
  border: 2px solid transparent;
  border-radius: 12px;
  box-shadow: 0 4px 0 var(--shadow-warning);
}
.home-btn2:hover,
.story-cta:hover {
  background: var(--warning);
  transform: none;
}
.home-btn2:active,
.story-cta:active {
  box-shadow: 0 2px 0 var(--shadow-warning);
  transform: translateY(2px);
}


/* ── world-intro-btn ── secondary style ── */
.world-intro-btn {
  background: var(--neutral-primary-soft);
  border: 2px solid var(--border-default);
  border-radius: 12px;
  color: var(--fg-brand);
  box-shadow: 0 3px 0 var(--shadow-secondary);
  font-family: var(--font-nunito);
  font-weight: 700;
}
.world-intro-btn:hover {
  background: var(--brand-softer);
  border-color: var(--border-brand-subtle);
}
.world-intro-btn:active {
  box-shadow: 0 1px 0 var(--shadow-secondary);
  transform: translateY(2px);
}


/* ── hud-shop-btn ── icon accent (sky) ── */
.hud-shop-btn {
  background: var(--sky);
  border: 2px solid transparent;
  border-radius: 10px;
  color: #fff;
  box-shadow: 0 3px 0 rgba(20,144,196,0.9);
}
.hud-shop-btn:hover {
  background: var(--cyan);
  transform: scale(1.08) rotate(-5deg);
  box-shadow: 0 3px 0 rgba(20,144,196,0.9);
}
.hud-shop-btn:active {
  box-shadow: 0 1px 0 rgba(20,144,196,0.9);
  transform: translateY(2px) scale(1);
}


/* ── rw-buy (shop rewards) ── brand ── */
.rw-buy {
  background: var(--brand);
  color: #fff;
  border: 2px solid transparent;
  border-radius: 10px;
  box-shadow: 0 3px 0 var(--shadow-brand);
}
.rw-buy:hover:not(:disabled) {
  background: var(--brand-medium);
  transform: none;
}
.rw-buy:active:not(:disabled) {
  box-shadow: 0 1px 0 var(--shadow-brand);
  transform: translateY(2px);
}
.rw-buy:disabled {
  background: var(--neutral-tertiary-medium);
  color: var(--body-subtle);
  box-shadow: none;
}


/* ── dl-btn (download results) ── teal/brand ── */
.dl-btn {
  background: var(--teal);
  color: #fff;
  border: 2px solid transparent;
  border-radius: 14px;
  box-shadow: 0 4px 0 rgba(0,158,121,0.9);
}
.dl-btn:hover {
  background: var(--brand);
  box-shadow: 0 4px 0 var(--shadow-brand);
  transform: none;
}
.dl-btn:active {
  box-shadow: 0 2px 0 rgba(0,158,121,0.9);
  transform: translateY(2px);
}


/* ── cmp-btn (compare >, <, =) ── */
.cmp-btn {
  border-radius: 14px;
  border: 2px solid transparent;
  box-shadow: 0 4px 0 rgba(0,0,0,0.18);
  color: #fff;
}
.cmp-btn.lt { background: var(--sky); box-shadow: 0 4px 0 rgba(20,144,196,0.9); }
.cmp-btn.eq { background: var(--warning); color: var(--shadow-dark); box-shadow: 0 4px 0 var(--shadow-warning); }
.cmp-btn.gt { background: var(--purple); box-shadow: 0 4px 0 var(--indigo); }
.cmp-btn:hover { transform: none; filter: brightness(1.08); }
.cmp-btn.lt:active { box-shadow: 0 2px 0 rgba(20,144,196,0.9); transform: translateY(2px); }
.cmp-btn.eq:active { box-shadow: 0 2px 0 var(--shadow-warning); transform: translateY(2px); }
.cmp-btn.gt:active { box-shadow: 0 2px 0 var(--indigo); transform: translateY(2px); }


/* ── calc-key ── */
.calc-key {
  border-radius: 12px;
  border: 2px solid transparent;
  box-shadow: 0 3px 0 rgba(0,0,0,0.25);
}
.calc-key:hover { transform: none; filter: brightness(1.1); }
.calc-key:active {
  box-shadow: 0 1px 0 rgba(0,0,0,0.25);
  transform: translateY(2px);
}
.calc-key.num {
  background: var(--neutral-tertiary);
  color: var(--heading);
  box-shadow: 0 3px 0 var(--shadow-secondary);
}
.calc-key.op {
  background: var(--orange);
  color: #fff;
  box-shadow: 0 3px 0 var(--shadow-warning);
}
.calc-key.eq {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 3px 0 var(--shadow-brand);
}
.calc-key.clr {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 3px 0 var(--shadow-danger);
}
.calc-key.back {
  background: var(--purple);
  color: #fff;
  box-shadow: 0 3px 0 var(--indigo);
}


/* ── kb-key ── */
.kb-key {
  background: var(--neutral-primary-soft);
  border: 2px solid var(--border-default);
  border-radius: 8px;
  color: var(--heading);
  box-shadow: 0 2px 0 var(--shadow-secondary);
  font-family: var(--font-nunito);
}
.kb-key:active {
  box-shadow: 0 1px 0 var(--shadow-secondary);
  transform: translateY(1px);
}
.kb-key.highlight {
  background: var(--brand-softer);
  border-color: var(--border-brand);
  color: var(--fg-brand-strong);
}
.kb-key.pressed {
  background: var(--brand);
  border-color: var(--brand-strong);
  color: #fff;
}


/* ── turtle buttons ── */
.turtle-run {
  background: var(--sky);
  color: #fff;
  border: 2px solid transparent;
  border-radius: 10px;
  box-shadow: 0 3px 0 rgba(20,144,196,0.9);
}
.turtle-run:hover { background: var(--cyan); transform: none; }
.turtle-run:active { box-shadow: 0 1px 0 rgba(20,144,196,0.9); transform: translateY(2px); }

.turtle-clear {
  background: var(--neutral-tertiary-medium);
  color: var(--body);
  border: 2px solid transparent;
  border-radius: 10px;
  box-shadow: 0 3px 0 var(--shadow-secondary);
}
.turtle-clear:hover { background: var(--neutral-quaternary); transform: none; }
.turtle-clear:active { box-shadow: 0 1px 0 var(--shadow-secondary); transform: translateY(2px); }

.turtle-step {
  border-radius: 8px;
  border: 1px solid transparent;
  box-shadow: 0 2px 0 rgba(0,0,0,0.2);
}
.turtle-step:hover { filter: brightness(0.9); }
.turtle-step:active { box-shadow: 0 1px 0 rgba(0,0,0,0.2); transform: translateY(1px); }

/* turtle blocks recolored with Lingo tokens */
.turtle-block.fwd { background: var(--brand); box-shadow: 0 2px 0 var(--shadow-brand); }
.turtle-block.left { background: var(--orange); box-shadow: 0 2px 0 var(--shadow-warning); }
.turtle-block.right { background: var(--pink); box-shadow: 0 2px 0 rgba(196,0,107,0.9); }
.turtle-block:hover { transform: none; filter: brightness(1.08); }


/* ── btn-row buttons (generic) ── */
.btn-row button {
  background: var(--neutral-primary-soft);
  border: 2px solid var(--border-default);
  border-radius: 12px;
  color: var(--heading);
  box-shadow: 0 3px 0 var(--shadow-secondary);
  font-family: var(--font-nunito);
  font-weight: 800;
}
.btn-row button:hover {
  background: var(--brand-softer);
  border-color: var(--border-brand-subtle);
}
.btn-row button:active {
  box-shadow: 0 1px 0 var(--shadow-secondary);
  transform: translateY(2px);
}

/* ── arc-opt (arcade bubbles) ── */
.arc-opt {
  background: var(--sky);
  color: #fff;
  border: 2px solid transparent;
  border-radius: 14px;
  box-shadow: 0 4px 0 rgba(20,144,196,0.9);
}
.arc-opt:active {
  box-shadow: 0 2px 0 rgba(20,144,196,0.9);
  transform: translateY(2px) scale(1);
}
.arc-opt-wrong {
  background: var(--danger) !important;
  box-shadow: 0 4px 0 var(--shadow-danger) !important;
}


/* ============================================================
   6. 3D TACTILE CARDS
   ============================================================ */

.section-card,
.island-card,
.level-card,
.pet-card,
.reward-card,
.result-card,
.story-card,
.modal-box,
.player-hud,
.quest-banner,
.pc-info-item {
  border: 2px solid var(--border-default);
  box-shadow: var(--shadow-sm);
  border-radius: 16px;
}


/* island-card — keep colorful gradients but add Lingo border/shadow */
.island-card {
  border: 2px solid transparent;
  box-shadow: var(--shadow-md);
  transition: transform .1s ease-out, box-shadow .1s ease-out;
}
.island-card:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: var(--shadow-lg);
}
.island-card:active {
  transform: translateY(1px);
  box-shadow: var(--shadow-xs);
}
.island-card.locked {
  filter: grayscale(0.7) brightness(0.93);
}


/* level-card */
.level-card {
  border: 2px solid transparent;
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  transition: transform .1s ease-out, box-shadow .1s ease-out;
}
.level-card:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: var(--shadow-lg);
}
.level-card:active {
  transform: translateY(1px);
  box-shadow: var(--shadow-xs);
}
.level-card.easy  { background: var(--brand); border-color: var(--brand-strong); box-shadow: 0 4px 0 var(--shadow-brand); }
.level-card.medium { background: var(--orange); border-color: var(--shadow-warning); box-shadow: 0 4px 0 var(--shadow-warning); }
.level-card.hard  { background: var(--purple); border-color: var(--indigo); box-shadow: 0 4px 0 var(--indigo); }


/* pet-card */
.pet-card {
  background: var(--neutral-primary-soft);
  border: 2px solid var(--border-default);
  border-radius: 14px;
  box-shadow: var(--shadow-xs);
}
.pet-card .pt-name { color: var(--fg-brand); font-family: var(--font-nunito); }
.pet-card.locked { background: var(--disabled); border-color: var(--border-default); }
.pet-card.locked .pt-name { color: var(--body-subtle); }


/* reward-card */
.reward-card {
  background: var(--neutral-primary-soft);
  border: 2px solid var(--border-default);
  border-radius: 14px;
  box-shadow: var(--shadow-xs);
}
.reward-card.affordable { border-color: var(--border-brand); box-shadow: 0 4px 0 var(--shadow-brand); }
.reward-card.locked { opacity: 0.55; }
.reward-card .rw-cost { color: var(--fg-warning); font-family: var(--font-nunito); }


/* result-card */
.result-card .r-score { color: var(--brand-strong); font-family: var(--font-nunito); font-weight: 900; }
.result-card .r-msg   { color: var(--body); font-family: var(--font-nunito); }


/* story-card */
.story-card {
  background: var(--neutral-primary-soft);
  border: 2px solid var(--border-default);
  border-radius: 20px;
  box-shadow: var(--shadow-xl);
}
.story-card-title { color: var(--heading); font-family: var(--font-nunito); font-weight: 900; }
.story-text { color: var(--body); font-family: var(--font-nunito); }


/* player-hud */
.player-hud {
  background: var(--neutral-primary-soft);
  border: 2px solid var(--border-default);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
}
.hud-name  { color: var(--body-subtle); font-family: var(--font-nunito); }
.hud-level { background: var(--brand-softer); color: var(--fg-brand-strong); font-family: var(--font-nunito); font-weight: 800; border-radius: 9999px; }
.hud-stat  { background: var(--neutral-primary-soft); border: 2px solid var(--border-default); border-radius: 10px; }
.hud-stat-val { color: var(--heading); font-family: var(--font-nunito); font-weight: 800; }


/* quest-banner */
.quest-banner {
  background: var(--warning-soft);
  border: 2px solid var(--border-warning);
  border-radius: 14px;
  box-shadow: var(--shadow-xs);
}
.quest-text { color: var(--body); font-family: var(--font-nunito); }
.quest-text strong { color: var(--fg-warning); }


/* modal-box */
.modal-box {
  background: var(--neutral-primary-soft);
  border: 2px solid var(--border-default);
  border-radius: 20px;
  box-shadow: var(--shadow-xl);
}
.modal-header {
  background: linear-gradient(135deg, var(--indigo), var(--purple));
  border-radius: 18px 18px 0 0;
}
.modal-title { font-family: var(--font-nunito); font-weight: 900; }
.modal-close { background: rgba(255,255,255,0.2); border-radius: 50%; }
.modal-close:hover { background: rgba(255,255,255,0.35); }


/* pc-info-item */
.pc-info-item {
  border: 2px solid var(--border-default);
  border-radius: 12px;
  background: var(--neutral-primary-soft);
  padding: 8px 12px;
}
.pc-info-label { color: var(--body-subtle); font-family: var(--font-nunito); }
.pc-info-val   { color: var(--indigo); font-family: var(--font-nunito); font-weight: 800; }


/* download-section */
.download-section {
  background: var(--brand-softer);
  border: 2px dashed var(--border-brand-subtle);
  border-radius: 16px;
}
.download-section .dl-title { color: var(--fg-brand-strong); font-family: var(--font-nunito); font-weight: 800; }
.download-section .dl-desc  { color: var(--body-subtle); font-family: var(--font-nunito); }


/* ============================================================
   7. STATE CLASSES — correct / wrong / selected / locked
   ============================================================ */

/* correct variants → brand/success green */
.correct,
.correct-click,
.correct-fb,
.correct-input,
.correct-rc {
  background: var(--success-soft) !important;
  border-color: var(--success) !important;
  color: var(--success-strong) !important;
}
.correct-char,
.correct-cell {
  background: var(--success-soft) !important;
  border-color: var(--success) !important;
  color: var(--success-strong) !important;
}

.dd-target.correct { border-color: var(--success) !important; background: var(--success-soft) !important; border-style: solid; }
.option-btn.correct  { border-color: var(--success) !important; background: var(--success-soft) !important; }
.option-btn.correct .opt-label { background: var(--brand); color: #fff; }
.match-item.linked   { border-color: var(--success) !important; background: var(--success-soft) !important; color: var(--success-strong) !important; }
.cond-cell.cond-correct { background: var(--success-soft) !important; border-color: var(--success) !important; color: var(--success-strong) !important; }
.chick-wrap.chick-correct .chick-answer { background: var(--brand); color: #fff; border-color: var(--brand-strong); }

/* wrong variants → danger red */
.wrong,
.wrong-click,
.wrong-fb,
.wrong-input,
.wrong-rc,
.wrong-flash,
.mt-item.wrong-flash {
  background: var(--danger-soft) !important;
  border-color: var(--danger) !important;
  color: var(--fg-danger) !important;
}
.wrong-char,
.wrong-cell {
  background: var(--danger-soft) !important;
  border-color: var(--danger) !important;
  color: var(--fg-danger) !important;
}
.dd-target.wrong     { border-color: var(--danger) !important; background: var(--danger-soft) !important; }
.option-btn.wrong    { border-color: var(--danger) !important; background: var(--danger-soft) !important; }
.option-btn.wrong .opt-label { background: var(--danger); color: #fff; }
.cond-cell.cond-wrong { background: var(--danger-soft) !important; border-color: var(--danger) !important; color: var(--fg-danger) !important; }
.chick-wrap.chick-wrong .chick-answer { background: var(--danger-soft); color: var(--fg-danger); border-color: var(--danger); }


/* selected / picked / matched / filled / highlight → brand soft */
.selected,
.match-item.selected,
.mt-item.selected,
.cb-item.checked,
.sheet-cell.selected,
.order-chip,
.word-char.filled,
.word-char.active-char {
  background: var(--brand-softer) !important;
  border-color: var(--border-brand) !important;
  color: var(--fg-brand) !important;
}
.order-item.picked {
  opacity: 0.45;
  border-color: var(--success) !important;
}
.p-dot.done    { background: var(--success); }
.p-dot.current { background: var(--sky); }


/* locked / disabled / faded → muted neutral */
.locked,
.disabled,
.faded,
.click-item.faded,
.chick-wrap.faded {
  opacity: 0.38;
}
.island-card.locked { filter: grayscale(0.7) brightness(0.93); }
.match-item.locked  { cursor: default; pointer-events: none; }
.order-item.locked  { cursor: default; pointer-events: none; }


/* ============================================================
   8. PILLS / BADGES
   ============================================================ */

.grade-badge {
  background: var(--indigo);
  color: #fff;
  border: 2px solid var(--indigo);
  border-radius: 9999px;
  font-family: var(--font-nunito);
  font-weight: 800;
  letter-spacing: .4px;
  text-transform: uppercase;
  box-shadow: 0 2px 0 var(--shadow-dark);
}

.streak-badge {
  background: var(--warning);
  color: var(--shadow-dark);
  border: 2px solid var(--border-warning);
  border-radius: 9999px;
  font-family: var(--font-nunito);
  font-weight: 800;
  letter-spacing: .4px;
}

.lvl-badge {
  border-radius: 9999px;
  font-family: var(--font-nunito);
  font-weight: 800;
  letter-spacing: .4px;
  border: 2px solid transparent;
}
.lvl-badge.easy   { background: var(--brand);  border-color: var(--brand-strong); color: #fff; }
.lvl-badge.medium { background: var(--orange); border-color: var(--shadow-warning); color: #fff; }
.lvl-badge.hard   { background: var(--purple); border-color: var(--indigo); color: #fff; }

.match-badge {
  color: var(--sky);
  font-family: var(--font-nunito);
  font-weight: 800;
}


/* ============================================================
   9. HUD / XP BAR / TIMER
   ============================================================ */

.hud-xp-bar {
  background: var(--neutral-tertiary-medium);
  border-radius: 7px;
}
.hud-xp-fill {
  background: linear-gradient(90deg, var(--brand), var(--brand-medium), var(--warning));
  border-radius: 7px;
}
.hud-xp-text { color: var(--heading); font-family: var(--font-nunito); font-weight: 700; }

.timer-bar  { background: var(--neutral-tertiary-medium); border-radius: 4px; }
.timer-fill { background: linear-gradient(90deg, var(--brand), var(--warning), var(--orange), var(--danger)); }


/* ============================================================
   10. MODALS / OVERLAYS
   ============================================================ */

.modal-overlay {
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
}
.levelup-overlay,
.story-overlay {
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(6px);
}

/* levelup-box */
.levelup-box {
  background: var(--neutral-primary-soft);
  border: 2px solid var(--border-default);
  border-radius: 28px;
  box-shadow: var(--shadow-xl);
}
.levelup-box::before {
  background: conic-gradient(from 0deg,
    var(--warning),var(--orange),var(--pink),var(--purple),var(--sky),var(--brand),var(--warning));
  opacity: 0.12;
}
.lu-title  { color: var(--orange); font-family: var(--font-nunito); font-weight: 900; }
.lu-level  {
  font-family: var(--font-nunito); font-weight: 900;
  background: linear-gradient(135deg, var(--orange), var(--pink), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.lu-pet-name { color: var(--indigo); font-family: var(--font-nunito); font-weight: 800; }
.lu-pet-desc { color: var(--body); font-family: var(--font-nunito); }


/* modal-tabs */
.modal-tabs { background: var(--neutral-secondary-medium); border-radius: 12px; padding: 4px; }
.modal-tab  { font-family: var(--font-nunito); font-weight: 700; color: var(--body-subtle); border-radius: 8px; border: none; }
.modal-tab.active {
  background: var(--neutral-primary-soft);
  color: var(--fg-brand);
  box-shadow: var(--shadow-xs);
}

/* context-menu */
.context-menu {
  background: var(--neutral-primary-soft);
  border: 2px solid var(--border-default);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
}
.context-menu .cm-item { color: var(--body); font-family: var(--font-nunito); }
.context-menu .cm-item:hover {
  background: var(--brand-softer);
  color: var(--fg-brand);
}

/* dc-popup */
.dc-popup {
  background: var(--neutral-primary-soft);
  border: 2px solid var(--border-default);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
}
.dc-popup-text { color: var(--indigo); font-family: var(--font-nunito); font-weight: 800; }

/* ticket-pop toast */
.ticket-pop {
  background: linear-gradient(135deg, var(--warning), var(--orange));
  color: var(--shadow-dark);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  font-family: var(--font-nunito);
  font-weight: 800;
}


/* ============================================================
   11. SHOP / CURRENCY
   ============================================================ */

.shop-currency {
  background: var(--neutral-secondary-medium);
  border: 2px solid var(--border-default);
  border-radius: 14px;
}
.shop-currency-item { font-family: var(--font-nunito); font-weight: 800; }
.shop-currency-item .sc-val { color: var(--indigo); }

.result-reward {
  background: var(--warning-soft);
  border: 2px dashed var(--border-warning);
  border-radius: 12px;
  color: var(--fg-warning);
  font-family: var(--font-nunito);
  font-weight: 800;
}


/* ============================================================
   12. WORLD HEADER
   ============================================================ */

.world-header {
  border: 2px solid var(--border-default);
  border-radius: 16px;
  background: var(--neutral-primary-soft);
  box-shadow: var(--shadow-xs);
}
.world-title { font-family: var(--font-nunito); font-weight: 900; color: var(--heading); }
.world-hero  { color: var(--body-subtle); font-family: var(--font-nunito); }
.world-intro { font-family: var(--font-nunito); color: var(--body); }
.world-note  {
  font-family: var(--font-nunito);
  color: var(--fg-warning);
  background: var(--warning-soft);
  border-radius: 10px;
}


/* ============================================================
   13. MISC GAME COMPONENTS
   ============================================================ */

/* feedback */
.game-feedback.correct-fb { background: var(--success-soft); color: var(--success-strong); border: 2px solid var(--success-medium); }
.game-feedback.wrong-fb   { background: var(--danger-soft);  color: var(--fg-danger); border: 2px solid var(--danger-medium); }

/* speed-math stats */
.sm-stats { background: linear-gradient(135deg, var(--heading), var(--body)); border-radius: 14px; }
.sm-stat-lbl { color: rgba(255,255,255,0.7); font-family: var(--font-nunito); }
.sm-stat-val { font-family: var(--font-nunito); font-weight: 900; }
.sm-stat-val.warn   { color: var(--warning); }
.sm-stat-val.danger { color: var(--danger); }

/* chick answer balloon — remap nth-child border colors to Lingo tokens */
.chick-wrap:nth-child(4n+1) .chick-answer { border-color: var(--pink);   color: var(--pink); }
.chick-wrap:nth-child(4n+2) .chick-answer { border-color: var(--sky);    color: var(--sky); }
.chick-wrap:nth-child(4n+3) .chick-answer { border-color: var(--orange); color: var(--orange); }
.chick-wrap:nth-child(4n)   .chick-answer { border-color: var(--brand);  color: var(--brand); }
.chick-answer { font-family: var(--font-nunito); font-weight: 800; color: var(--heading); }

/* order-chip */
.order-chip {
  background: var(--brand-softer);
  border: 2px solid var(--border-brand-subtle);
  color: var(--fg-brand-strong);
  font-family: var(--font-nunito);
  font-weight: 700;
}

/* mt-item */
.mt-item {
  background: var(--neutral-primary-soft);
  border: 2px solid var(--border-default);
  border-radius: 12px;
  color: var(--heading);
  font-family: var(--font-nunito);
  font-weight: 700;
  box-shadow: var(--shadow-xs);
}
.mt-item:hover  { border-color: var(--sky); }
.mt-item.selected { border-color: var(--orange); background: var(--warning-soft); box-shadow: 0 0 0 3px rgba(255,150,0,0.15); }
.mt-item.matched  { border-color: var(--success); background: var(--success-soft); color: var(--success-strong); }

/* match-item (ordering game) */
.match-item {
  background: var(--neutral-primary-soft);
  border: 2px solid var(--border-default);
  color: var(--heading);
  font-family: var(--font-nunito);
  font-weight: 700;
  box-shadow: var(--shadow-xs);
}
.match-item:hover  { border-color: var(--sky); }
.match-item.selected { border-color: var(--orange); background: var(--warning-soft); }
.match-item.linked   { border-color: var(--success); background: var(--success-soft); color: var(--success-strong); }

/* type input */
.type-input {
  font-family: var(--font-nunito);
  border: 2px solid var(--border-default);
  border-radius: 14px;
  background: var(--neutral-secondary-medium);
  color: var(--heading);
}
.type-input:focus { border-color: var(--sky); background: var(--neutral-primary-soft); }

/* word-char */
.word-char {
  font-family: var(--font-nunito);
  border: 2px solid var(--border-default);
  background: var(--neutral-secondary-medium);
  color: var(--heading);
}

/* progress dots already handled in state section above */

/* arcade */
.arc-hud   { font-family: var(--font-nunito); }
.arc-eq    { color: var(--indigo); }
.arc-eq-big { color: var(--indigo); font-family: var(--font-nunito); }
.arc-over-score { color: var(--indigo); font-family: var(--font-nunito); font-weight: 900; }

/* info text blocks */
.dd-instruction,
.mode-grid-label,
.turtle-task-goal,
.calc-task-q,
.calc-task-expr {
  font-family: var(--font-nunito);
  color: var(--body);
}
.calc-task-expr { color: var(--indigo); font-weight: 900; }

/* calc-task border */
.calc-task {
  background: var(--warning-soft);
  border: 2px dashed var(--border-warning);
  border-radius: 14px;
}

/* sheet task */
.sheet-task {
  background: var(--brand-softer);
  border: 2px dashed var(--border-brand-subtle);
  border-radius: 14px;
  color: var(--body);
  font-family: var(--font-nunito);
}

/* fe-task / cond-task / sort-task / turtle-task */
.fe-task, .cond-task, .sort-task, .turtle-task {
  font-family: var(--font-nunito);
  color: var(--body);
  border-radius: 14px;
}
.fe-task   { background: var(--brand-softer);  border: 2px dashed var(--border-brand-subtle); }
.cond-task { background: var(--danger-soft);   border: 2px dashed var(--danger-medium); }
.sort-task { background: var(--brand-softer);  border: 2px dashed var(--border-brand-subtle); }

/* sort-dir chip */
.sort-dir { background: var(--sky); color: #fff; border-radius: 9999px; }

/* cond-cell */
.cond-cell {
  background: var(--neutral-primary-soft);
  border: 2px solid var(--border-default);
  border-radius: 12px;
  color: var(--heading);
  font-family: var(--font-nunito);
  font-weight: 800;
}
.cond-cell:hover { border-color: var(--pink); transform: scale(1.05); }
.cond-cell.selected { background: var(--sky); color: #fff; border-color: transparent; }

/* owned-item */
.owned-item {
  background: var(--neutral-secondary-medium);
  border-radius: 12px;
}
.owned-item .oi-name { color: var(--heading); font-family: var(--font-nunito); font-weight: 700; }
.owned-item .oi-date { color: var(--body-subtle); }


/* ============================================================
   14. TYPOGRAPHY — headings globally
   ============================================================ */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-nunito);
  color: var(--heading);
  font-weight: 800;
}

/* Baloo 2 headings inside game areas still inherit Nunito stack */
.game-area h3,
.level-picker h3 {
  font-family: var(--font-nunito);
  color: var(--heading);
  font-weight: 800;
}

/* Generic Baloo2 references → Nunito stack */
.dd-char-name,
.grade-review {
  font-family: var(--font-nunito);
  color: var(--body-subtle);
}
.grade-review select {
  font-family: var(--font-nunito);
  border: 2px solid var(--border-default);
  border-radius: 10px;
  background: var(--neutral-primary-soft);
  color: var(--heading);
}


/* ============================================================
   15. REDUCE MOTION OVERRIDES
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .mode-btn, .section-card, .island-card, .level-card,
  .next-game-btn, .retry-btn, .home-btn2, .game-back,
  .option-btn, .cmp-btn, .calc-key, .kb-key,
  .sort-check, .cb-submit, .turtle-run, .turtle-clear, .rw-buy, .dl-btn,
  .story-cta, .world-intro-btn, .lu-btn, .hud-shop-btn {
    transition: none;
  }
  .story-cta:hover { transform: none; }
}


/* ============================================================
   HOME / GRADE SESSIONS — polished 2026-05-30 (P1–P8)
   Duolingo × Lingo claymorphism, light mode only.
   IDs: #homeHero, #homeSessions, #homeCollection, #homeHowto, #homeFooter
   ============================================================ */

/* ── P7: Section headings — unified rhythm, accent underline ── */
.home-section-heading {
  font-family: var(--font-nunito);
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--heading);
  letter-spacing: -0.3px;
  margin: 36px 0 16px;
  line-height: 1.15;
  display: flex;
  align-items: center;
  gap: 6px;
}
.home-section-heading::after {
  content: "";
  display: block;
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--border-brand-subtle), transparent);
  margin-left: 8px;
}

/* ── P1: Hero ── 2-col desktop, stacked+centred mobile ── */
#homeHero {
  position: relative;
  background: linear-gradient(145deg, var(--brand-softer) 0%, var(--neutral-primary-soft) 60%);
  border: 2px solid var(--border-brand-subtle);
  border-radius: 24px;
  /* double shadow: colored tactile edge + soft ambient */
  box-shadow:
    0 6px 0 var(--border-brand-subtle),
    0 12px 28px -6px rgba(88,204,3,0.12);
  padding: 36px 32px 32px;
  margin-bottom: 28px;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 28px;
}

/* Decorative blob — bigger, more prominent */
.home-blob {
  position: absolute;
  top: -50px;
  right: -50px;
  width: 280px;
  height: 280px;
  border-radius: 62% 38% 72% 28% / 46% 58% 42% 54%;
  background: radial-gradient(circle at 40% 40%, var(--brand-soft), var(--brand-softer));
  opacity: 0.5;
  pointer-events: none;
  animation: blobPulse 8s ease-in-out infinite;
}
/* secondary small blob top-left */
.home-blob::before {
  content: "";
  position: absolute;
  bottom: -60px;
  left: -80px;
  width: 180px;
  height: 180px;
  border-radius: 50% 30% 60% 40% / 40% 50% 50% 60%;
  background: radial-gradient(circle, var(--sky), transparent 70%);
  opacity: 0.18;
}
@keyframes blobPulse {
  0%, 100% { transform: scale(1) rotate(0deg); }
  50%       { transform: scale(1.05) rotate(6deg); }
}

.home-hero-content {
  position: relative;
  z-index: 1;
  min-width: 0;
}

/* P1: bold friendly headline */
.home-hero-title {
  font-family: var(--font-nunito);
  font-size: clamp(1.6rem, 3.5vw, 2.2rem);
  font-weight: 900;
  color: var(--heading);
  letter-spacing: -0.5px;
  line-height: 1.1;
  margin-bottom: 8px;
}

.home-hero-sub {
  font-family: var(--font-nunito);
  color: var(--body);
  font-size: 0.95rem;
  line-height: 1.55;
  margin-bottom: 16px;
}

.home-benefit-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 22px;
}

/* P1: benefit pills — clay chip style */
.home-pill {
  background: var(--neutral-primary-soft);
  border: 2px solid var(--border-brand-subtle);
  border-radius: 9999px;
  padding: 5px 14px;
  font-family: var(--font-nunito);
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--fg-brand);
  box-shadow: 0 3px 0 var(--border-brand-subtle);
}

.home-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* P1: chunky pill CTAs */
.home-cta-primary,
.home-cta-secondary {
  border-radius: 9999px;
  font-family: var(--font-nunito);
  font-weight: 900;
  cursor: pointer;
  letter-spacing: .5px;
  text-transform: uppercase;
  min-height: 52px;
  display: inline-flex;
  align-items: center;
  padding: 0 28px;
  font-size: 0.9rem;
  transition: background-color .2s ease-out, transform .2s ease-out,
              box-shadow .2s ease-out, color .2s ease-out;
}

/* green 3D primary */
.home-cta-primary {
  background: var(--brand);
  color: #fff;
  border: 2px solid var(--brand-strong);
  box-shadow: 0 5px 0 var(--shadow-brand);
}
.home-cta-primary:hover  { background: var(--brand-medium); }
.home-cta-primary:active { box-shadow: 0 2px 0 var(--shadow-brand); transform: translateY(3px); }
.home-cta-primary:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 3px;
}

/* white-outline secondary */
.home-cta-secondary {
  background: var(--neutral-primary-soft);
  color: var(--fg-brand);
  border: 2px solid var(--border-brand-subtle);
  box-shadow: 0 5px 0 var(--border-brand-subtle);
}
.home-cta-secondary:hover  { background: var(--brand-softer); border-color: var(--border-brand); }
.home-cta-secondary:active { box-shadow: 0 2px 0 var(--border-brand-subtle); transform: translateY(3px); }
.home-cta-secondary:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 3px;
}

/* P1: floating mascot in soft blob container */
.home-hero-mascot {
  position: relative;
  z-index: 1;
  font-size: 5.5rem;
  flex-shrink: 0;
  width: 130px;
  height: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 40% 35%, var(--brand-softer) 40%, var(--neutral-primary-soft) 100%);
  border: 2px solid var(--border-brand-subtle);
  border-radius: 50% 42% 56% 44% / 48% 54% 46% 52%;
  box-shadow: 0 6px 0 var(--border-brand-subtle), 0 10px 24px -6px rgba(88,204,3,0.18);
  animation: floatMascot 3.2s ease-in-out infinite;
  user-select: none;
}
@keyframes floatMascot {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50%       { transform: translateY(-10px) rotate(1deg); }
}


/* ── P2: Grade selector — horizontal pill strip ── */
.home-gradetabs {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 24px;
  padding: 12px 16px;
  background: var(--neutral-primary-soft);
  border: 2px solid var(--border-default);
  border-radius: 9999px;
  box-shadow: 0 4px 0 var(--border-default), 0 6px 14px -4px rgba(0,0,0,0.06);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.home-gradetabs::-webkit-scrollbar { display: none; }

.home-gradetabs-label {
  font-family: var(--font-nunito);
  font-weight: 800;
  font-size: 0.88rem;
  color: var(--body-subtle);
  white-space: nowrap;
  flex-shrink: 0;
  padding-right: 4px;
}

.home-gradetab {
  font-family: var(--font-nunito);
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--body);
  background: var(--neutral-secondary-medium);
  border: 2px solid var(--border-default);
  border-radius: 9999px;
  padding: 0 20px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: 0 4px 0 var(--shadow-secondary);
  transition: background-color .18s ease-out, color .18s ease-out,
              transform .18s ease-out, box-shadow .18s ease-out, border-color .18s ease-out;
}
.home-gradetab:hover {
  background: var(--brand-softer);
  color: var(--fg-brand-strong);
  border-color: var(--border-brand-subtle);
}
.home-gradetab:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 var(--shadow-secondary);
}
.home-gradetab.active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand-strong);
  box-shadow: 0 4px 0 var(--shadow-brand);
}
.home-gradetab.active:active { box-shadow: 0 2px 0 var(--shadow-brand); }
.home-gradetab:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}


/* ── P3: Zone cards (section-card) — full claymorphism upgrade ── */
.section-card {
  background: var(--neutral-primary-soft);
  border: 2px solid var(--border-default);
  border-radius: 20px;
  /* double shadow */
  box-shadow:
    0 5px 0 var(--border-default),
    0 8px 20px -6px rgba(0,0,0,0.07);
  transition: background-color .2s ease-out, border-color .2s ease-out,
              transform .2s ease-out, box-shadow .2s ease-out;
  cursor: pointer;
}
.section-card:hover {
  background: var(--brand-softer);
  border-color: var(--border-brand-subtle);
  box-shadow:
    0 7px 0 var(--border-brand-subtle),
    0 14px 28px -8px rgba(88,204,3,0.14);
  transform: translateY(-4px);
}
.section-card:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 var(--border-default);
}
.section-card:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 3px;
}

/* colored accent bar (bottom) */
.section-card::after { height: 4px; border-radius: 0 0 18px 18px; }

/* icon consistent size */
.section-card .sc-icon {
  font-size: 2.2rem;
  line-height: 1;
  margin-bottom: 6px;
  display: block;
}
.section-card .sc-title {
  font-family: var(--font-nunito);
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--heading);
  line-height: 1.2;
}
.section-card .sc-desc {
  color: var(--body-subtle);
  font-family: var(--font-nunito);
  font-size: 0.75rem;
}


/* ── P4: Grade grid — clay cards ── */
#homeGradeGrid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.home-grade-card {
  position: relative;
  background: var(--neutral-primary-soft);
  border: 2px solid var(--border-default);
  border-radius: 20px;
  box-shadow: 0 5px 0 var(--border-default), 0 8px 18px -6px rgba(0,0,0,0.06);
  padding: 18px 12px 14px;
  text-align: center;
  cursor: pointer;
  font-family: var(--font-nunito);
  transition: transform .2s ease-out, box-shadow .2s ease-out,
              border-color .2s ease-out, background .2s ease-out;
}
.home-grade-card:hover {
  background: var(--brand-softer);
  border-color: var(--border-brand-subtle);
  transform: translateY(-4px);
  box-shadow: 0 7px 0 var(--border-brand-subtle), 0 14px 26px -6px rgba(88,204,3,0.13);
}
.home-grade-card:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 var(--border-default);
}
.home-grade-card.mine {
  border-color: var(--brand);
  box-shadow: 0 5px 0 var(--shadow-brand), 0 10px 20px -6px rgba(88,204,3,0.18);
  background: var(--brand-softer);
}
.home-grade-card:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 3px;
}

/* P4: "Lớp của bé" badge — green pill top-right */
.home-mine-pill {
  position: absolute;
  top: -11px;
  right: 10px;
  left: auto;
  transform: none;
  background: var(--brand);
  color: #fff;
  border-radius: 9999px;
  font-size: 0.62rem;
  font-weight: 900;
  padding: 3px 10px;
  white-space: nowrap;
  box-shadow: 0 3px 0 var(--shadow-brand);
  letter-spacing: .3px;
}

.home-grade-mascot {
  font-size: 2.4rem;
  margin-bottom: 6px;
  line-height: 1;
}
.home-grade-num {
  font-weight: 900;
  font-size: 0.68rem;
  color: var(--brand-strong);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 2px;
}
.home-grade-title {
  font-weight: 800;
  font-size: 0.8rem;
  color: var(--heading);
  margin-top: 2px;
  line-height: 1.2;
}
.home-grade-hero {
  font-size: 0.65rem;
  color: var(--body-subtle);
  margin-top: 3px;
}
.home-grade-islands {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--body);
  margin-top: 6px;
}


/* ── P4: Session panel — clay card ── */
#homeSessionPanel {
  margin-bottom: 28px;
}

.home-session-hero {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  border: 2px solid var(--border-default);
  border-radius: 20px;
  box-shadow: 0 5px 0 var(--border-default), 0 8px 20px -6px rgba(0,0,0,0.07);
  padding: 20px 20px 18px;
  margin-bottom: 14px;
}
.home-session-mascot {
  font-size: 3.5rem;
  flex-shrink: 0;
  line-height: 1;
}
.home-session-body { flex: 1; min-width: 0; }
.home-session-title {
  font-family: var(--font-nunito);
  font-size: 1.15rem;
  font-weight: 900;
  line-height: 1.15;
}
.home-session-sub {
  font-family: var(--font-nunito);
  font-size: 0.8rem;
  color: var(--body-subtle);
  margin: 4px 0 8px;
}
.home-session-intro {
  font-family: var(--font-nunito);
  font-size: 0.84rem;
  color: var(--body);
  line-height: 1.55;
}

.home-island-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.home-island-chip {
  background: var(--brand-softer);
  border: 2px solid var(--border-brand-subtle);
  border-radius: 9999px;
  font-family: var(--font-nunito);
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--fg-brand-strong);
  padding: 5px 14px;
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  box-shadow: 0 3px 0 var(--border-brand-subtle);
}
.home-island-chip.locked {
  background: var(--neutral-tertiary);
  border-color: var(--border-default);
  color: var(--body-subtle);
  box-shadow: none;
  opacity: 0.7;
}

/* P4: session CTA — chunky full-width pill */
.home-session-cta {
  background: var(--brand);
  color: #fff;
  border: 2px solid var(--brand-strong);
  border-radius: 9999px;
  box-shadow: 0 5px 0 var(--shadow-brand);
  font-family: var(--font-nunito);
  font-weight: 900;
  font-size: 0.95rem;
  letter-spacing: .4px;
  text-transform: uppercase;
  padding: 0 28px;
  min-height: 52px;
  cursor: pointer;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color .2s ease-out, transform .2s ease-out, box-shadow .2s ease-out;
}
.home-session-cta:hover  { background: var(--brand-medium); }
.home-session-cta:active { box-shadow: 0 2px 0 var(--shadow-brand); transform: translateY(3px); }
.home-session-cta:focus-visible {
  outline: 3px solid var(--brand-strong);
  outline-offset: 3px;
}


/* ── P5: Collection section — soft card wrapper ── */
#homeCollection {
  background: var(--neutral-primary-soft);
  border: 2px solid var(--border-default);
  border-radius: 20px;
  box-shadow: 0 5px 0 var(--border-default), 0 8px 20px -6px rgba(0,0,0,0.06);
  padding: 4px 20px 20px;
  margin-bottom: 28px;
}
#homeCollection .home-section-heading {
  margin-top: 20px;
}

/* P5: marquee with fade-out edges */
.home-marquee-wrap {
  position: relative;
  overflow: hidden;
  border: 2px solid var(--border-brand-subtle);
  border-radius: 16px;
  background: var(--brand-softer);
  box-shadow: 0 4px 0 var(--border-brand-subtle);
  padding: 12px 0;
  margin-bottom: 16px;
  /* fade edges with mask */
  -webkit-mask-image: linear-gradient(
    to right,
    transparent 0%,
    #000 10%,
    #000 90%,
    transparent 100%
  );
  mask-image: linear-gradient(
    to right,
    transparent 0%,
    #000 10%,
    #000 90%,
    transparent 100%
  );
}

.marquee-track {
  display: flex;
  gap: 20px;
  width: max-content;
  animation: marqueeScroll 32s linear infinite;
  padding: 0 16px;
}
@keyframes marqueeScroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* P5: pets as clay chips */
.home-pet-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 64px;
  background: var(--neutral-primary-soft);
  border: 2px solid var(--border-brand-subtle);
  border-radius: 14px;
  padding: 8px 10px 6px;
  box-shadow: 0 3px 0 var(--border-brand-subtle);
}
.home-pet-icon { font-size: 1.7rem; line-height: 1; }
.home-pet-name {
  font-family: var(--font-nunito);
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--fg-brand);
  white-space: nowrap;
  text-align: center;
}

/* P5: reward chips as rounded pills */
.home-rewards-preview {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.home-reward-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  background: var(--neutral-primary-soft);
  border: 2px solid var(--border-default);
  border-radius: 16px;
  padding: 12px 8px;
  box-shadow: 0 4px 0 var(--border-default);
  text-align: center;
  font-size: 1.5rem;
  line-height: 1;
  transition: transform .2s ease-out, box-shadow .2s ease-out;
}
.home-reward-chip:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 0 var(--border-brand-subtle);
}
.home-reward-name {
  font-family: var(--font-nunito);
  font-size: 0.66rem;
  font-weight: 700;
  color: var(--body-subtle);
  line-height: 1.2;
}


/* ── P6: How-to — numbered clay step cards ── */
#homeHowto {
  margin-bottom: 28px;
}

.home-howto-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 4px;
}

.home-step-card {
  background: var(--neutral-primary-soft);
  border: 2px solid var(--border-default);
  border-radius: 20px;
  box-shadow: 0 5px 0 var(--border-default), 0 8px 20px -6px rgba(0,0,0,0.06);
  padding: 28px 14px 18px;
  text-align: center;
  position: relative;
  font-family: var(--font-nunito);
  transition: transform .2s ease-out, box-shadow .2s ease-out;
}
.home-step-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 0 var(--border-brand-subtle), 0 14px 28px -6px rgba(88,204,3,0.12);
}

/* P6: big circular number badge */
.home-step-badge {
  position: absolute;
  top: -16px;
  left: 50%;
  transform: translateX(-50%);
  width: 36px;
  height: 36px;
  background: var(--brand);
  color: #fff;
  border-radius: 50%;
  font-family: var(--font-nunito);
  font-weight: 900;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 0 var(--shadow-brand);
  border: 2px solid var(--brand-strong);
}

.home-step-icon {
  font-size: 2.2rem;
  margin: 4px 0 6px;
  line-height: 1;
}
.home-step-title {
  font-weight: 900;
  font-size: 0.88rem;
  color: var(--heading);
  margin-bottom: 6px;
}
.home-step-desc {
  font-size: 0.74rem;
  color: var(--body-subtle);
  line-height: 1.45;
}


/* ── P7: Footer — polished ── */
#homeFooter {
  text-align: center;
  padding: 28px 16px 24px;
  margin-top: 4px;
  border-top: 2px solid var(--border-default);
}

.home-footer-name {
  font-family: var(--font-nunito);
  font-size: 1.05rem;
  font-weight: 900;
  color: var(--heading);
  margin-bottom: 5px;
}
.home-footer-sub {
  font-family: var(--font-nunito);
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--brand-strong);
  margin-bottom: 5px;
  letter-spacing: .3px;
}
.home-footer-tagline {
  font-family: var(--font-nunito);
  font-size: 0.76rem;
  color: var(--body-subtle);
  line-height: 1.5;
}


/* ── P8: Focus rings on .section-card (zone cards) ── */
.section-card:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 3px;
}


/* ── Responsive — mobile-first collapses ── */
@media (max-width: 768px) {
  #homeGradeGrid { grid-template-columns: repeat(3, 1fr); }
  .home-howto-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  #homeHero {
    grid-template-columns: 1fr;
    text-align: center;
    padding: 28px 20px 24px;
    gap: 20px;
  }
  .home-hero-content { order: 2; }
  .home-hero-mascot {
    order: 1;
    margin: 0 auto;
    font-size: 3.8rem;
    width: 100px;
    height: 100px;
  }
  .home-benefit-pills { justify-content: center; }
  .home-cta-row { justify-content: center; }
  .home-gradetabs { border-radius: 16px; }
  .home-rewards-preview { grid-template-columns: repeat(2, 1fr); }
  #homeCollection { padding: 4px 14px 16px; }
}
@media (max-width: 420px) {
  #homeGradeGrid { grid-template-columns: repeat(2, 1fr); }
  .home-howto-grid { grid-template-columns: 1fr 1fr; gap: 14px; }
}


/* ── P8: Reduce motion — disable float / marquee / press transforms ── */
@media (prefers-reduced-motion: reduce) {
  .home-hero-mascot { animation: none; }
  .home-blob { animation: none; }
  .marquee-track { animation: none; }
  .home-cta-primary:active,
  .home-cta-secondary:active,
  .home-gradetab:active,
  .home-grade-card:active,
  .home-session-cta:active,
  .home-step-card:hover,
  .home-reward-chip:hover,
  .section-card:hover,
  .section-card:active {
    transform: none;
  }
}
/* END HOME / GRADE SESSIONS */

/* ============================================================
   HOME GRADE SELECTOR (always-visible "chọn lớp bên ngoài")
   Styles merged into the P2 .home-gradetabs block above.
   ============================================================ */

/* Park hub host fills width like the math arcade host */
#parkHost { margin-top: 8px; min-height: 200px; }
/* END HOME GRADE SELECTOR */
