/* ============================================================
   Blingo design system — "friendly word playground"
   Fonts: Fredoka (display) + Nunito (body), system fallbacks.
   ============================================================ */

:root {
    --cream: #FFF9F0;
    --ink: #3D3A4B;
    --ink-soft: #6E6A80;
    --coral: #FF7A59;
    --coral-deep: #E85F3E;
    --sunshine: #FFC93C;
    --sunshine-deep: #E8AE1B;
    --teal: #2EC4B6;
    --teal-deep: #1FA396;
    --plum: #A06CD5;
    --sky: #89D2FF;
    --soft-red: #FF5D5D;
    --card: #FFFFFF;
    --line: #EFE4D5;
    --shadow: 0 4px 0 rgba(61, 58, 75, 0.10);
    --radius: 22px;
    --font-display: 'Fredoka', 'Comic Sans MS', 'Segoe UI', system-ui, sans-serif;
    --font-body: 'Nunito', 'Segoe UI', system-ui, sans-serif;
    --nav-active-bg: #FFF1EC;
    --skin-bg-img: none;
}

/* ============ SKINS (themed worlds) — applied via <body data-skin> ============ */
/* sunny = the base :root palette (default, no override). Each skin retints the
   primary (--coral), surfaces (--card/--line), and ink so the whole UI follows. */
body[data-skin="ocean"] {
    --cream: #EAF6FB; --ink: #173E54; --ink-soft: #4E7088; --card: #FFFFFF; --line: #CFE6F0;
    --coral: #1CA7C4; --coral-deep: #1483A0; --sunshine: #FFD15C; --sunshine-deep: #E8B53C;
    --teal: #2EC4B6; --teal-deep: #1FA396; --plum: #5B8DEF; --sky: #89D2FF; --nav-active-bg: #E2F2F8;
}
body[data-skin="bubblegum"] {
    --cream: #FFF0F7; --ink: #5A2A4E; --ink-soft: #8A5A78; --card: #FFFFFF; --line: #F6D9EA;
    --coral: #FF6FB5; --coral-deep: #E84F9C; --sunshine: #FFC93C; --sunshine-deep: #E8AE1B;
    --teal: #A06CD5; --teal-deep: #8A52C0; --plum: #C77DFF; --sky: #FFA8D8; --nav-active-bg: #FCE3F0;
}
body[data-skin="forest"] {
    --cream: #EEF6E9; --ink: #243F23; --ink-soft: #52704F; --card: #FFFFFF; --line: #D5E7CC;
    --coral: #4CAF50; --coral-deep: #3A8C3E; --sunshine: #E0A93C; --sunshine-deep: #C7902A;
    --teal: #2E9E8F; --teal-deep: #237A6E; --plum: #7BA05B; --sky: #9CCC65; --nav-active-bg: #E4F1DC;
}
body[data-skin="mint"] {
    --cream: #E9FBF5; --ink: #114B45; --ink-soft: #3E7A72; --card: #FFFFFF; --line: #C9EFE4;
    --coral: #16C79A; --coral-deep: #11A07C; --sunshine: #FFD15C; --sunshine-deep: #E8B53C;
    --teal: #2EC4B6; --teal-deep: #1FA396; --plum: #5FBDB0; --sky: #7EE8C8; --nav-active-bg: #D9F6EC;
}
body[data-skin="sunset"] {
    --cream: #FFF1E6; --ink: #4A2545; --ink-soft: #86566E; --card: #FFFFFF; --line: #F7D9C8;
    --coral: #FF6B5C; --coral-deep: #E8503F; --sunshine: #FFAA4C; --sunshine-deep: #E8902B;
    --teal: #C2548E; --teal-deep: #A53F75; --plum: #9B5DE5; --sky: #FF9E80; --nav-active-bg: #FCE2D2;
    --skin-bg-img: linear-gradient(180deg, #FFF1E6 0%, #FFE3D0 60%, #FFD7C0 100%);
}
body[data-skin="galaxy"] {
    --cream: #1B1736; --ink: #F3EEFF; --ink-soft: #B7AEE0; --card: #2A2350; --line: #3D3470;
    --coral: #8B7CF0; --coral-deep: #6F5FD6; --sunshine: #FFD15C; --sunshine-deep: #E8B53C;
    --teal: #36D6C3; --teal-deep: #28B6A4; --plum: #C77DFF; --sky: #6CA8FF; --nav-active-bg: rgba(255,255,255,0.10);
    --skin-bg-img: radial-gradient(1px 1px at 20% 30%, #fff 50%, transparent), radial-gradient(1px 1px at 70% 60%, #cfc7ff 50%, transparent), radial-gradient(1.5px 1.5px at 45% 80%, #fff 50%, transparent), radial-gradient(1px 1px at 85% 25%, #fff 50%, transparent);
}
body[data-skin="dragon"] {
    --cream: #241318; --ink: #FFEFE6; --ink-soft: #E2B3A0; --card: #36201F; --line: #5A2E28;
    --coral: #FF6B3D; --coral-deep: #E8502A; --sunshine: #FFC23C; --sunshine-deep: #E8A41B;
    --teal: #E0533D; --teal-deep: #C23A26; --plum: #FF8A5B; --sky: #FFB077; --nav-active-bg: rgba(255,255,255,0.08);
}
body[data-skin] { background-image: var(--skin-bg-img); background-attachment: fixed; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { margin: 0; padding: 0; }

body {
    background: var(--cream);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 17px;
    line-height: 1.45;
    min-height: 100dvh;
}

h1, h2, h3, .display { font-family: var(--font-display); font-weight: 600; letter-spacing: 0.01em; }

button { font-family: inherit; cursor: pointer; }

/* ---------- layout shell ---------- */
.shell {
    max-width: 560px;
    margin: 0 auto;
    padding: 16px 16px 96px;
    min-height: 100dvh;
}

.screen { display: none; animation: screenIn 0.25s ease; }
.screen.active { display: block; }
@keyframes screenIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- top bar (home) ---------- */
.topbar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 10px; padding: 6px 2px 14px;
}
.topbar .brand {
    font-family: var(--font-display); font-size: 1.5rem; color: var(--coral);
    display: flex; align-items: center; gap: 8px;
}
.topbar .brand img { width: 38px; height: 38px; }

.chip {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--card); border: 2px solid var(--line);
    border-radius: 999px; padding: 6px 12px;
    font-weight: 800; font-size: 0.95rem;
}
.chip.streak-lit { border-color: var(--sunshine); color: var(--sunshine-deep); }
.chip.streak-paused { color: var(--ink-soft); filter: grayscale(1); }
.chip.xp { border-color: var(--teal); color: var(--teal-deep); }

/* ---------- cards & buttons ---------- */
.card {
    background: var(--card); border: 2px solid var(--line);
    border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
}

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 52px; padding: 12px 24px;
    border-radius: 18px; border: none;
    font-family: var(--font-display); font-size: 1.1rem; font-weight: 600;
    color: #fff; background: var(--coral);
    box-shadow: 0 4px 0 var(--coral-deep);
    transition: transform 0.06s ease, box-shadow 0.06s ease, filter 0.15s ease;
    user-select: none;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--coral-deep); }
.btn:disabled { filter: grayscale(0.6) opacity(0.6); pointer-events: none; }
.btn.teal { background: var(--teal); box-shadow: 0 4px 0 var(--teal-deep); }
.btn.teal:active { box-shadow: 0 1px 0 var(--teal-deep); }
.btn.sun { background: var(--sunshine); box-shadow: 0 4px 0 var(--sunshine-deep); color: var(--ink); }
.btn.sun:active { box-shadow: 0 1px 0 var(--sunshine-deep); }
.btn.plum { background: var(--plum); box-shadow: 0 4px 0 #7d51b0; }
.btn.plum:active { box-shadow: 0 1px 0 #7d51b0; }
.btn.ghost {
    background: var(--card); color: var(--ink-soft);
    border: 2px solid var(--line); box-shadow: none; font-weight: 500;
}
.btn.big { width: 100%; min-height: 60px; font-size: 1.25rem; }

/* ---------- onboarding ---------- */
.ob-hero { text-align: center; padding: 28px 8px 8px; }
.ob-hero img { width: 170px; height: 170px; }
.ob-hero h1 { font-size: 2rem; margin: 14px 0 6px; }
.ob-hero p { color: var(--ink-soft); margin: 0 0 22px; font-size: 1.05rem; }

.avatar-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 18px 0; }
.avatar-pick {
    background: var(--card); border: 3px solid var(--line); border-radius: 20px;
    padding: 10px; transition: border-color 0.12s, transform 0.12s;
}
.avatar-pick img { width: 100%; aspect-ratio: 1; }
.avatar-pick.selected { border-color: var(--coral); transform: scale(1.05); }

.name-input {
    width: 100%; min-height: 56px; border-radius: 18px;
    border: 2px solid var(--line); background: var(--card);
    font-family: var(--font-display); font-size: 1.3rem; text-align: center;
    color: var(--ink); padding: 8px 16px; outline: none;
}
.name-input:focus { border-color: var(--coral); }

.goal-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 16px 0; }
.goal-pick {
    background: var(--card); border: 3px solid var(--line); border-radius: 18px;
    padding: 14px 8px; text-align: center; font-weight: 800;
}
.goal-pick .display { font-size: 1.5rem; display: block; }
.goal-pick small { color: var(--ink-soft); }
.goal-pick.selected { border-color: var(--teal); }

.pin-row { display: flex; gap: 10px; justify-content: center; margin: 18px 0; }
.pin-digit {
    width: 56px; height: 64px; text-align: center;
    font-family: var(--font-display); font-size: 1.7rem;
    border: 2px solid var(--line); border-radius: 16px; background: var(--card);
    color: var(--ink); outline: none;
}
.pin-digit:focus { border-color: var(--plum); }

/* ---------- home: unit path ---------- */
.unit-block { margin-bottom: 22px; }
.unit-head {
    display: flex; align-items: center; gap: 12px; margin: 8px 0 12px;
}
.unit-head img { width: 52px; height: 52px; }
.unit-head h2 { margin: 0; font-size: 1.25rem; }
.unit-head .sub { color: var(--ink-soft); font-size: 0.9rem; font-weight: 700; }

.path { display: flex; flex-wrap: wrap; gap: 10px; }
.lesson-node {
    width: 64px; height: 64px; border-radius: 50%;
    border: 3px solid var(--line); background: var(--card);
    font-family: var(--font-display); font-size: 1.15rem; color: var(--ink-soft);
    display: flex; align-items: center; justify-content: center;
    position: relative;
}
.lesson-node.done { background: var(--teal); border-color: var(--teal-deep); color: #fff; }
.lesson-node.current {
    background: var(--coral); border-color: var(--coral-deep); color: #fff;
    transform: scale(1.12); box-shadow: 0 4px 0 var(--coral-deep);
    animation: bob 1.6s ease-in-out infinite;
}
.lesson-node.locked { opacity: 0.45; }
@keyframes bob { 0%,100% { transform: scale(1.12) translateY(0); } 50% { transform: scale(1.12) translateY(-4px); } }

/* ---------- lesson screen ---------- */
.lesson-top { display: flex; align-items: center; gap: 12px; padding: 4px 0 14px; }
.lesson-quit { background: none; border: none; font-size: 1.5rem; color: var(--ink-soft); padding: 6px; }
.progress-track {
    flex: 1; height: 16px; border-radius: 999px; background: #F0E7D8; overflow: hidden;
}
.progress-fill {
    height: 100%; width: 0%; border-radius: 999px;
    background: linear-gradient(90deg, var(--sunshine), var(--coral));
    transition: width 0.3s ease;
}
.lesson-count { font-family: var(--font-display); font-weight: 700; color: var(--ink-soft); font-size: 0.9rem; min-width: 48px; text-align: right; }

/* Multiple-choice questions float their content in the vertical centre so the
   screen doesn't look half-empty. Spelling Bee stays top-aligned (soft keyboard). */
#screen-lesson.lesson-centered #question-area {
    min-height: calc(100dvh - 150px);
    display: flex; flex-direction: column; justify-content: center;
    padding-bottom: 12vh;
}

.q-title { color: var(--ink-soft); font-weight: 800; font-size: 0.95rem; text-transform: uppercase; letter-spacing: 0.06em; margin: 4px 0 10px; }
.q-review-tag {
    display: inline-block; background: var(--plum); color: #fff;
    border-radius: 999px; font-size: 0.75rem; font-weight: 800;
    padding: 3px 10px; margin-bottom: 8px;
}

.q-big {
    font-family: var(--font-display); font-size: 1.7rem; line-height: 1.3;
    margin: 0 0 6px; min-height: 60px;
}
.q-big.sentence { font-size: 1.35rem; }

.speak-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 64px; height: 64px; border-radius: 50%;
    background: var(--sky); border: none; font-size: 1.8rem;
    box-shadow: 0 4px 0 #5FB7EF; margin: 6px 0 10px;
}
.speak-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #5FB7EF; }
.speak-btn.small { width: 44px; height: 44px; font-size: 1.2rem; vertical-align: middle; }

.choices { display: grid; gap: 12px; margin-top: 16px; }
.choice {
    min-height: 56px; padding: 14px 16px; text-align: left;
    border-radius: 18px; border: 2px solid var(--line); background: var(--card);
    font-size: 1.05rem; font-weight: 700; color: var(--ink);
    transition: transform 0.06s, border-color 0.1s, background 0.1s;
}
.choice:active { transform: scale(0.985); }
.choice.picked-correct { background: #E2F8F0; border-color: var(--teal); color: var(--teal-deep); }
.choice.picked-wrong { background: #FFEDED; border-color: var(--soft-red); color: var(--soft-red); animation: wiggle 0.3s ease; }
.choice.reveal-correct { border-color: var(--teal); }
.choice:disabled { pointer-events: none; }
/* State markers so right/wrong never relies on colour alone (colour-blind + clarity). */
.choice.picked-correct::after, .choice.reveal-correct::after { content: " ✓"; font-weight: 800; color: var(--teal); }
.choice.picked-wrong::after { content: " ✗"; font-weight: 800; color: var(--soft-red); }
@keyframes wiggle { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

/* Visually-hidden, screen-reader-only (used by #sr-announce live region). */
.sr-only {
    position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Spelling-bee (type-what-you-hear) */
.spell-card { text-align: center; }
.spell-context { margin: 14px 0 6px; }
.spell-def { color: var(--ink-soft); font-weight: 600; margin-bottom: 10px; }
.spell-sentence-btn { display: inline-flex; width: auto; min-height: 0; padding: 8px 16px; font-size: 0.95rem; }
.spell-input {
    width: 100%; box-sizing: border-box; margin: 16px 0 14px;
    padding: 16px; border: 2px solid var(--line); border-radius: 18px;
    font-family: inherit; font-size: 1.5rem; font-weight: 700; text-align: center;
    color: var(--ink); background: var(--card); letter-spacing: 0.5px;
}
.spell-input:focus { outline: none; border-color: var(--coral); }
.spell-input.wrong { border-color: var(--soft-red); background: #FFEDED; }
.spell-check { width: 100%; }

/* Clear keyboard focus ring for sighted keyboard users (mouse/touch unaffected). */
.choice:focus-visible, .btn:focus-visible, .nav-btn:focus-visible,
.profile-card:focus-visible, .speak-btn:focus-visible, .goal-pick:focus-visible,
.avatar-pick:focus-visible, .lesson-quit:focus-visible {
    outline: 3px solid var(--plum); outline-offset: 2px;
}

.feedback-bar {
    position: fixed; left: 0; right: 0; bottom: 0;
    padding: 16px; transform: translateY(110%);
    transition: transform 0.22s ease;
    z-index: 50;
}
.feedback-bar.show { transform: none; }
.feedback-inner {
    max-width: 560px; margin: 0 auto; border-radius: var(--radius);
    padding: 16px; display: flex; flex-direction: column; gap: 10px;
}
.feedback-inner.good { background: #DFF6EE; border: 2px solid var(--teal); }
.feedback-inner.bad { background: #FFEDED; border: 2px solid var(--soft-red); }
.feedback-inner.hint { background: #FFF6DE; border: 2px solid var(--sunshine); }
.feedback-actions { display: flex; gap: 10px; }
.feedback-actions .btn { flex: 1; min-height: 48px; }
.choice:disabled { opacity: 0.55; }
.choice.picked-wrong, .choice.picked-correct, .choice.reveal-correct { opacity: 1; }
.feedback-line { display: flex; align-items: center; gap: 10px; font-weight: 800; }
.feedback-line .display { font-size: 1.2rem; }
.feedback-sentence { font-size: 0.98rem; color: var(--ink-soft); font-weight: 600; }

/* ---------- lesson complete ---------- */
.complete-hero { text-align: center; padding: 24px 8px; }
.complete-hero img { width: 160px; height: 160px; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 18px 0; }
.stat-box { background: var(--card); border: 2px solid var(--line); border-radius: 18px; padding: 12px; text-align: center; }
.stat-box .display { font-size: 1.45rem; color: var(--coral); display: block; }
.stat-box small { color: var(--ink-soft); font-weight: 800; }

.badge-pop {
    display: flex; align-items: center; gap: 12px;
    background: #FFF4D6; border: 2px solid var(--sunshine);
    border-radius: 18px; padding: 12px 14px; margin: 10px 0;
    font-weight: 800;
}
.badge-pop img { width: 44px; height: 44px; }
.badge-pop small { display: block; color: var(--ink-soft); font-weight: 700; }

/* ---------- word peek modal ---------- */
.modal-veil {
    position: fixed; inset: 0; background: rgba(61,58,75,0.45);
    display: none; align-items: flex-end; justify-content: center; z-index: 80;
}
.modal-veil.open { display: flex; }
.modal-card {
    background: var(--card); border-radius: 26px 26px 0 0;
    width: 100%; max-width: 560px; padding: 22px 20px 30px;
    max-height: 80dvh; overflow: auto;
}

/* ---------- bottom nav ---------- */
.bottom-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: var(--card); border-top: 2px solid var(--line);
    display: flex; justify-content: space-around; padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
}
.nav-btn {
    background: none; border: none; display: flex; flex-direction: column;
    align-items: center; gap: 2px; font-size: 1.4rem;
    color: var(--ink-soft); font-weight: 800; min-width: 72px; padding: 6px;
    border-radius: 14px;
}
.nav-btn small { font-size: 0.7rem; font-family: var(--font-body); }
.nav-btn.active { color: var(--coral); background: var(--nav-active-bg); }

/* ---------- Me tab (trophy room) ---------- */
.me-header { display: flex; align-items: center; gap: 16px; }
.me-id { flex: 1; min-width: 0; }
.me-id h2 { margin: 0 0 2px; }
.level-line { color: var(--ink-soft); font-weight: 800; font-size: 0.9rem; }
.level-bar { margin-top: 8px; height: 12px; border-radius: 99px; background: var(--line); overflow: hidden; }
.level-bar-fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--sunshine), var(--coral)); transition: width 0.5s ease; }

.streak-card { text-align: center; }
.streak-big { font-family: var(--font-display); font-size: 2.6rem; font-weight: 700; color: var(--coral); display: flex; align-items: center; justify-content: center; gap: 8px; }
.streak-flame { font-size: 2.2rem; }
.streak-unit { font-family: var(--font-body); font-size: 1rem; font-weight: 800; color: var(--ink-soft); align-self: flex-end; margin-bottom: 8px; }
.week-note { margin-top: 10px; color: var(--ink-soft); font-weight: 700; font-size: 0.78rem; }
.streak-say { color: var(--ink-soft); font-weight: 700; margin-top: 2px; }
.week-strip { display: flex; justify-content: space-between; gap: 4px; margin-top: 14px; }
.week-day { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: 1; }
.week-day small { color: var(--ink-soft); font-weight: 800; font-size: 0.7rem; }
.week-dot { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line); display: flex; align-items: center; justify-content: center; font-size: 0.95rem; background: var(--card); }
.week-dot.lit { border-color: var(--sunshine); background: var(--sunshine); }
.week-dot.today { box-shadow: 0 0 0 2px var(--coral); }
.week-dot.future { opacity: 0.4; }

/* sound toggle now lives in the Me header (was a fake 4th nav tab) */
.sound-toggle { background: var(--card); border: 2px solid var(--line); border-radius: 100px; color: var(--ink-soft); font-weight: 800; font-size: 1.1rem; display: flex; align-items: center; gap: 6px; padding: 6px 14px; cursor: pointer; }
.sound-toggle small { font-family: var(--font-body); font-size: 0.78rem; }

/* warm empty state for a brand-new player */
.me-empty { background: linear-gradient(120deg, var(--sunshine), var(--coral)); color: #fff; border-radius: 18px; padding: 16px 18px; font-weight: 800; font-family: var(--font-display); text-align: center; margin-bottom: 4px; }

.me-hint { color: var(--ink-soft); font-weight: 700; font-size: 0.82rem; margin: -4px 4px 10px; }

/* collapsible trophy case */
.badges-grid.is-collapsed { max-height: 210px; overflow: hidden; -webkit-mask-image: linear-gradient(180deg, #000 70%, transparent); mask-image: linear-gradient(180deg, #000 70%, transparent); }
.badges-toggle { display: block; margin: 12px auto 0; background: none; border: 2px solid var(--line); color: var(--coral); font-weight: 800; font-family: var(--font-display); border-radius: 100px; padding: 8px 20px; cursor: pointer; }

/* grammar continue hero (mirrors the Words home hero) */
.hero-card { display: flex; flex-direction: column; gap: 12px; }
.hero-card .hero-text h2 { margin: 0 0 2px; }
.hero-card .hero-sub { margin: 0; color: var(--ink-soft); font-weight: 700; }
.hero-card .btn { width: 100%; }
.maps-or { margin: 18px 4px 8px; }

.me-h { margin: 22px 4px 10px; font-family: var(--font-display); }
.me-h-note { font-family: var(--font-body); font-weight: 700; font-size: 0.8rem; color: var(--ink-soft); }
.completions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.comp-tile { background: var(--card); border: 2px solid var(--line); border-radius: 18px; padding: 14px; text-align: center; }
.comp-ico { font-size: 1.6rem; display: block; }
.comp-tile b { display: block; font-family: var(--font-display); font-size: 1.4rem; color: var(--ink); margin-top: 2px; }
.comp-of { color: var(--ink-soft); font-size: 0.9rem; font-weight: 700; }
.comp-tile small { color: var(--ink-soft); font-weight: 700; }

/* word-map rosettes */
.rosette-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 10px; }
.rosette-cell { text-align: center; background: none; border: none; font: inherit; cursor: pointer; padding: 6px 2px; border-radius: 16px; transition: transform 0.12s, background 0.12s; }
.rosette-cell:hover { background: var(--nav-active-bg); }
.rosette-cell:active { transform: scale(0.94); }
.rosette-cell:focus-visible { outline: 3px solid var(--coral); outline-offset: 2px; }
.rosette { width: 100%; max-width: 92px; aspect-ratio: 1; display: block; margin: 0 auto; }
.rose-star { fill: var(--line); transition: fill 0.3s; }
.rose-star.on { fill: var(--sunshine); }
.rose-complete .rose-star.on { fill: var(--sunshine-deep); }
.rose-glow { fill: none; stroke: var(--sunshine); stroke-width: 2.5; opacity: 0.55; }
.rose-center { font-family: var(--font-display); font-weight: 800; font-size: 26px; fill: var(--ink-soft); }
.rose-complete .rose-center { fill: var(--coral-deep); }
.rose-check { font-family: var(--font-body); font-weight: 800; font-size: 20px; fill: #1a8a3c; }
.rose-title { display: block; font-family: var(--font-display); font-size: 0.8rem; color: var(--ink); margin-top: 2px; }
.rose-frac { color: var(--ink-soft); font-weight: 700; font-size: 0.72rem; }
.rosette-cell.is-complete .rose-title { color: var(--coral); }

.skin-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.skin-swatch { position: relative; border: 3px solid transparent; border-radius: 18px; padding: 12px 4px 8px; cursor: pointer; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,0.35); font-family: var(--font-display); min-height: 78px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.skin-emoji { font-size: 1.5rem; text-shadow: none; }
.skin-name { font-size: 0.78rem; font-weight: 700; }
.skin-swatch.active { border-color: var(--ink); box-shadow: var(--shadow); }
.skin-check { position: absolute; top: 4px; right: 6px; font-size: 0.9rem; background: rgba(255,255,255,0.9); color: #1a8a3c; width: 18px; height: 18px; border-radius: 50%; display: flex; align-items: center; justify-content: center; text-shadow: none; }
.skin-swatch.locked { filter: grayscale(0.7) brightness(0.92); }
.skin-goal { position: absolute; inset: 0; background: rgba(20,16,30,0.62); border-radius: 15px; color: #fff; font-family: var(--font-body); font-weight: 700; font-size: 0.62rem; line-height: 1.2; display: flex; align-items: center; justify-content: center; text-align: center; padding: 4px; text-shadow: none; }
.skin-swatch.shake { animation: skinShake 0.4s; }
@keyframes skinShake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-5px)} 75%{transform:translateX(5px)} }
.skin-pop { background: linear-gradient(90deg, var(--plum), var(--coral)) !important; color: #fff; }
.group-pop { background: linear-gradient(90deg, var(--sunshine-deep), var(--coral)) !important; color: #fff; }
.group-pop small { color: rgba(255,255,255,0.85); }
.badge-pop-ico { font-size: 1.8rem; }

/* ---------- badges screen ---------- */
.badges-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.badge-tile { background: var(--card); border: 2px solid var(--line); border-radius: 18px; padding: 14px; text-align: center; }
.badge-tile img { width: 56px; height: 56px; }
.badge-tile .badge-ico { font-size: 2.4rem; display: block; line-height: 1.1; }
.badge-tile.locked { opacity: 0.5; }
.badge-tile.locked .badge-ico { filter: grayscale(1); opacity: 0.7; }
.badge-tile b { display: block; font-family: var(--font-display); }
.badge-tile small { color: var(--ink-soft); }

/* ---------- confetti ---------- */
.confetti-host { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 100; }
.confetti-piece {
    position: absolute; top: -16px; width: 10px; height: 14px;
    animation: confettiFall linear forwards;
}
@keyframes confettiFall {
    to { transform: translateY(105vh) rotate(660deg); opacity: 0.7; }
}

/* ---------- misc ---------- */
.center { text-align: center; }
.mt { margin-top: 16px; }
.muted { color: var(--ink-soft); }
.spacer { height: 16px; }

/* ---------- profile picker ---------- */
.profile-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin: 14px 0 18px; }
.profile-card {
    background: var(--card); border: 3px solid var(--line); border-radius: 22px;
    padding: 16px 10px; text-align: center; box-shadow: var(--shadow);
    transition: transform 0.08s, border-color 0.12s;
}
.profile-card:active { transform: scale(0.97); }
.profile-card:hover { border-color: var(--coral); }
.profile-card img { width: 72px; height: 72px; }
.profile-card b { display: block; font-family: var(--font-display); font-size: 1.15rem; margin-top: 6px; }
.profile-card small { color: var(--ink-soft); font-weight: 700; }

.avatar-switch {
    background: none; border: none; padding: 0; border-radius: 50%;
    position: relative;
}
.avatar-switch::after {
    content: '⇄'; position: absolute; right: -4px; bottom: -2px;
    background: var(--sunshine); border-radius: 50%; width: 22px; height: 22px;
    font-size: 0.8rem; display: flex; align-items: center; justify-content: center;
    border: 2px solid var(--card);
}
.gate-error { color: var(--soft-red); font-weight: 800; min-height: 24px; }

/* ---------- track toggle (4th / 5th grade words) ---------- */
.track-toggle { display: flex; gap: 10px; margin: 16px 0; }
.track-chip {
    flex: 1; min-height: 48px; border-radius: 999px;
    border: 2px solid var(--line); background: var(--card);
    font-family: var(--font-display); font-size: 1rem; color: var(--ink-soft);
}
.track-chip.active { border-color: var(--plum); background: #F3ECFB; color: var(--plum); }

/* ---------- grammar ---------- */
.grammar-icon {
    width: 52px; height: 52px; border-radius: 16px; background: #F3ECFB;
    display: inline-flex; align-items: center; justify-content: center; font-size: 1.6rem;
}

/* ---------- age picker ---------- */
.age-row { grid-template-columns: repeat(5, 1fr); }
.age-row .goal-pick { padding: 10px 4px; }
.age-row .goal-pick .display { font-size: 1.2rem; }
.age-row .goal-pick.selected { border-color: var(--coral); }

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