/* ============================================================
   Dino Words — design system.

   Built for ages 10-14, not for infants: an arcade/quest look
   rather than a nursery one. Dark by default, high contrast,
   large touch targets, and type that stays readable for someone
   still decoding English.
   ============================================================ */

:root {
    --bg: #0E1130;
    --bg-2: #151A3D;
    --surface: #1C2250;
    --surface-2: #262D64;
    --line: #343C7E;
    --text: #F0F2FF;
    --text-dim: #A3AAD8;
    --brand: #7C5CFF;
    --brand-2: #00D4FF;
    --good: #2FD98B;
    --good-deep: #128A56;
    --warn: #FFC53D;
    --bad: #FF5C7A;
    --bad-deep: #A82B45;
    --gold: #FFB020;
    --radius: 18px;
    --radius-sm: 12px;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    --tap: 48px;
}

:root[data-theme="light"] {
    --bg: #F4F6FF;
    --bg-2: #E9EDFF;
    --surface: #FFFFFF;
    --surface-2: #EFF2FF;
    --line: #D3DAF5;
    --text: #17193A;
    --text-dim: #5C638F;
    --brand: #5B3BE8;
    --brand-2: #0092C7;
    --good: #12A566;
    --good-deep: #0B7A4A;
    --warn: #B97B00;
    --bad: #D6294C;
    --bad-deep: #A81F3B;
    --gold: #C67E00;
    --shadow: 0 10px 28px rgba(28, 34, 80, 0.12);
}

html {
    box-sizing: border-box;
    overflow-y: scroll;
    scrollbar-gutter: stable;
    -webkit-text-size-adjust: 100%;
}

*, *::before, *::after { box-sizing: inherit; }

/* An author display rule outranks the UA [hidden] rule, so make the
   attribute authoritative for every flex and grid container. */
[hidden] { display: none !important; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: Nunito, "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
    font-weight: 600;
    background: var(--bg);
    background-image:
        radial-gradient(900px 500px at 15% -10%, rgba(124, 92, 255, 0.22), transparent 60%),
        radial-gradient(700px 420px at 100% 0%, rgba(0, 212, 255, 0.14), transparent 55%);
    background-attachment: fixed;
    color: var(--text);
    overflow-x: hidden;
}

#app {
    max-width: 620px;
    margin: 0 auto;
    padding: 16px 16px 96px;
}

.screen { display: none; }
.screen.active { display: block; animation: rise 0.22s ease-out both; }

@keyframes rise {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: none; }
}

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

h1, h2, h3 { margin: 0; font-weight: 900; letter-spacing: -0.01em; }

.section-title {
    margin: 26px 0 12px;
    font-size: 15px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-dim);
}

.hint { color: var(--text-dim); font-size: 14px; margin: 6px 0; font-weight: 600; }
.muted { color: var(--text-dim); }

.status-text { min-height: 22px; margin: 10px 0 0; font-size: 15px; color: var(--text-dim); }
.status-text.error { color: var(--bad); font-weight: 700; }
.status-text.success { color: var(--good); font-weight: 700; }
.form-error { color: var(--bad); font-weight: 700; margin: 0 0 10px; }

/* ---------- buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: var(--tap);
    padding: 12px 20px;
    border: 0;
    border-radius: 999px;
    font: inherit;
    font-weight: 800;
    font-size: 16px;
    color: #fff;
    background: var(--surface-2);
    cursor: pointer;
    transition: transform 0.12s ease, filter 0.15s ease;
}

.btn:active:not(:disabled) { transform: translateY(2px) scale(0.99); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn:hover:not(:disabled) { filter: brightness(1.12); }

.btn-primary { background: linear-gradient(135deg, var(--brand), #A87BFF); box-shadow: 0 6px 18px rgba(124, 92, 255, 0.4); }
.btn-secondary { background: linear-gradient(135deg, #00A8CC, var(--brand-2)); color: #06263A; }
.btn-danger { background: linear-gradient(135deg, var(--bad-deep), var(--bad)); }
.btn-audio { background: linear-gradient(135deg, var(--good-deep), var(--good)); color: #04291A; }
.btn-ghost { background: var(--surface-2); color: var(--text); }
.btn-help { background: transparent; border: 2px dashed var(--line); color: var(--text-dim); font-size: 14px; min-height: 42px; padding: 8px 14px; }
.btn-help:hover:not(:disabled) { color: var(--text); border-color: var(--brand); }
.btn-block { display: flex; width: 100%; margin-top: 12px; }
.btn-lg { min-height: 58px; font-size: 18px; }
.btn-sm { min-height: 38px; padding: 8px 14px; font-size: 14px; }

.btn-hero {
    display: flex;
    width: 100%;
    min-height: 96px;
    font-size: 26px;
    background: linear-gradient(135deg, var(--good-deep), var(--good));
    color: #04291A;
    box-shadow: 0 10px 26px rgba(47, 217, 139, 0.3);
}

.icon-btn {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 14px;
    background: var(--surface-2);
    color: var(--text);
    font-size: 18px;
    cursor: pointer;
}
.icon-btn:hover { filter: brightness(1.15); }
.icon-danger { background: rgba(255, 92, 122, 0.18); }

:focus-visible { outline: 3px solid var(--brand-2); outline-offset: 2px; }

/* ---------- forms ---------- */

label { display: block; font-weight: 800; margin-bottom: 6px; font-size: 15px; }

input[type="text"], input[type="search"], input[type="email"], select, textarea {
    width: 100%;
    min-height: var(--tap);
    padding: 13px 16px;
    margin-bottom: 14px;
    border: 2px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 17px;
}

textarea { resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); outline: none; }
input::placeholder, textarea::placeholder { color: var(--text-dim); font-weight: 600; }
input[type="range"] { width: 100%; accent-color: var(--brand); min-height: auto; }

.switch { width: 52px; height: 30px; accent-color: var(--brand); margin: 0; min-height: auto; }

.sync-note {
    display: flex; align-items: center; gap: 8px;
    background: var(--surface); border: 2px solid var(--brand-2);
    border-radius: var(--radius); padding: 12px 14px; margin: 0 0 14px;
    font-size: 14px; color: var(--text-dim); line-height: 1.45;
}

.setting-block { background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.setting-block label { margin-bottom: 4px; }
.setting-row {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    background: var(--surface); border: 2px solid var(--line);
    border-radius: var(--radius); padding: 14px 16px; margin-bottom: 10px;
}
.setting-row label { margin: 0; }

.pill { background: var(--surface-2); border-radius: 999px; padding: 2px 10px; font-size: 13px; color: var(--text-dim); }

/* ---------- top bars and tabs ---------- */

.topbar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; min-height: 48px; }
.topbar-title { flex: 1; font-size: 24px; overflow-wrap: anywhere; }
.topbar-spacer { width: 44px; }

.streak-chip {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--surface); border: 2px solid var(--line);
    border-radius: 999px; padding: 8px 16px; font-weight: 900; font-size: 18px;
    flex: 1;
}
.streak-flame { font-size: 20px; }

.tabbar {
    position: fixed; left: 0; right: 0; bottom: 0;
    display: flex; justify-content: center; gap: 4px;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    backdrop-filter: blur(12px);
    border-top: 2px solid var(--line);
    z-index: 50;
}

.tab {
    flex: 1; max-width: 140px;
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    min-height: 56px; padding: 6px 4px;
    border: 0; border-radius: 14px;
    background: transparent; color: var(--text-dim);
    font: inherit; font-weight: 800; font-size: 12px; cursor: pointer;
}
.tab-icon { font-size: 22px; line-height: 1; }
.tab-active { color: var(--text); background: var(--surface); }

/* ---------- sign in ---------- */

.hero { text-align: center; padding: 28px 8px; }
.hero-mark { font-size: 76px; line-height: 1; }
.hero-title { font-size: 40px; margin: 10px 0 6px; background: linear-gradient(120deg, var(--brand-2), var(--brand)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-sub { color: var(--text-dim); font-size: 17px; margin: 0 0 24px; }
.hero-points { list-style: none; padding: 0; margin: 0 0 28px; text-align: left; display: flex; flex-direction: column; gap: 12px; }
.hero-points li {
    display: flex; align-items: center; gap: 12px;
    background: var(--surface); border: 2px solid var(--line);
    border-radius: var(--radius); padding: 14px 16px; font-size: 15px;
}
.hero-points span { font-size: 22px; }
.hero-points em { color: var(--brand-2); font-style: normal; font-weight: 900; }

/* ---------- home ---------- */

.level-card { background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 16px; }
.level-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.level-name { font-weight: 900; font-size: 17px; }
.level-xp { color: var(--text-dim); font-size: 14px; }
.xp-track { height: 12px; background: var(--bg-2); border-radius: 999px; overflow: hidden; }
.xp-fill { height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--gold), #FFD980); transition: width 0.5s ease; }

.practice-cta {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    width: 100%; padding: 26px 20px; margin-bottom: 8px;
    border: 0; border-radius: 26px; cursor: pointer;
    font: inherit; color: #fff;
    background: linear-gradient(135deg, var(--brand) 0%, #B06BFF 55%, var(--brand-2) 140%);
    box-shadow: 0 14px 34px rgba(124, 92, 255, 0.42);
    transition: transform 0.14s ease;
}
.practice-cta:active { transform: translateY(3px) scale(0.99); }
.cta-count { font-size: 56px; font-weight: 900; line-height: 1; }
.cta-label { font-size: 15px; opacity: 0.92; }
.cta-go { margin-top: 14px; font-size: 19px; font-weight: 900; letter-spacing: 0.06em; }

.mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mode-tile {
    display: flex; flex-direction: column; align-items: flex-start; gap: 3px;
    padding: 16px; border: 2px solid var(--line); border-radius: var(--radius);
    background: var(--surface); color: var(--text);
    font: inherit; text-align: left; cursor: pointer; min-height: 104px;
    transition: transform 0.12s ease, border-color 0.15s ease;
}
.mode-tile:hover { border-color: var(--brand); transform: translateY(-2px); }
.mode-emoji { font-size: 26px; }
.mode-name { font-weight: 900; font-size: 16px; }
.mode-hint { font-size: 13px; color: var(--text-dim); }

.stat-row { display: flex; gap: 10px; margin-top: 20px; }
.stat { flex: 1; background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); padding: 14px 8px; text-align: center; }
.stat-value { display: block; font-size: 26px; font-weight: 900; color: var(--brand-2); }
.stat-label { display: block; font-size: 12px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em; }

.empty-hero { text-align: center; background: var(--surface); border: 2px dashed var(--line); border-radius: var(--radius); padding: 32px 20px; }
.empty-emoji { font-size: 52px; }
.empty-hero h2 { margin: 10px 0 8px; font-size: 22px; }
.empty-hero p { color: var(--text-dim); margin: 0 0 18px; }
.empty-note { text-align: center; padding: 30px 16px; color: var(--text-dim); }

/* ---------- lists: the center of the app ---------- */

.list-hero {
    background: linear-gradient(150deg, var(--surface-2), var(--surface));
    border: 2px solid var(--brand);
    border-radius: 24px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 10px 28px rgba(124, 92, 255, 0.22);
}

.list-hero-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.list-hero-label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--brand-2); font-weight: 800; }
.list-hero-name { font-size: clamp(24px, 7vw, 32px); margin-bottom: 4px; overflow-wrap: anywhere; }
.list-hero-meta { color: var(--text-dim); font-size: 14px; margin: 0 0 12px; }
.list-hero-track { margin-bottom: 16px; }
.list-hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.list-hero-actions .btn { flex: 1 1 46%; margin-top: 0; }

.list-summary { margin-bottom: 16px; }

.lists-grid { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }

.list-card {
    background: var(--surface);
    border: 2px solid var(--line);
    border-radius: var(--radius);
    padding: 14px 16px;
}
.list-card-active { border-color: var(--brand); box-shadow: 0 6px 20px rgba(124, 92, 255, 0.18); }

.list-card-open {
    width: 100%; display: flex; flex-direction: column; gap: 8px;
    background: none; border: 0; padding: 0 0 12px; text-align: left;
    color: var(--text); font: inherit; cursor: pointer;
}
.list-card-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.list-card-name { font-size: 20px; font-weight: 900; overflow-wrap: anywhere; }
.list-card-badge {
    background: var(--brand); color: #fff; border-radius: 999px;
    padding: 2px 10px; font-size: 11px; font-weight: 800;
    text-transform: uppercase; letter-spacing: 0.05em;
}
.list-card-meta { font-size: 13px; color: var(--text-dim); }
.list-card-actions { display: flex; gap: 8px; }
.list-card-actions .btn { flex: 1; margin-top: 0; }

.skill-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }

.review-all {
    width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px;
    margin-top: 18px; padding: 16px;
    background: var(--surface); border: 2px dashed var(--line);
    border-radius: var(--radius); color: var(--text-dim);
    font: inherit; font-weight: 700; font-size: 15px; cursor: pointer;
}
.review-all:hover { border-color: var(--brand-2); color: var(--text); }
.review-all-count { font-size: 24px; font-weight: 900; color: var(--brand-2); }

/* ---------- sharing ---------- */

.inbox-banner {
    display: flex; align-items: center; gap: 12px; width: 100%;
    margin-bottom: 14px; padding: 14px 16px;
    background: var(--surface); border: 2px solid var(--brand-2);
    border-radius: var(--radius); color: var(--text);
    font: inherit; font-weight: 700; cursor: pointer; text-align: left;
}
.inbox-banner:hover { filter: brightness(1.08); }
.inbox-emoji { font-size: 24px; }
.inbox-text { flex: 1; font-size: 15px; }
.inbox-text strong { color: var(--brand-2); font-size: 18px; }
.inbox-go { font-size: 20px; color: var(--brand-2); }

/* ---------- Dino Dash ---------- */

.game-cta {
    display: flex; align-items: center; gap: 14px; width: 100%;
    margin-top: 18px; padding: 16px 18px;
    border: 2px solid var(--gold); border-radius: 22px;
    background: linear-gradient(135deg, rgba(255,176,32,0.18), rgba(255,92,122,0.16));
    color: var(--text); font: inherit; cursor: pointer; text-align: left;
    transition: transform 0.12s ease;
}
.game-cta:active { transform: translateY(2px); }
.game-emoji { font-size: 34px; }
.game-text { flex: 1; display: flex; flex-direction: column; }
.game-name { font-size: 19px; font-weight: 900; }
.game-hint { font-size: 13px; color: var(--text-dim); }
.game-go { font-size: 22px; color: var(--gold); }

.game-hud { flex: 1; display: flex; justify-content: center; gap: 18px; }
.hud-item { font-weight: 900; font-size: 15px; }
.hud-label {
    display: block; font-size: 10px; font-weight: 700; color: var(--text-dim);
    text-transform: uppercase; letter-spacing: 0.08em;
}

#game-canvas {
    display: block; width: 100%; height: 200px;
    border-radius: var(--radius); border: 2px solid var(--line);
    background: #1b1f4d; margin-bottom: 14px;
}

.game-panel { display: flex; flex-direction: column; }
.game-prompt-row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 12px; }
.game-prompt-row .btn { margin: 0; }
#game-form { margin: 0; }
#game-input { margin-bottom: 8px; }

.game-feedback {
    min-height: 34px; margin: 0; text-align: center;
    display: flex; align-items: center; justify-content: center; gap: 8px;
}
.game-feedback-label { font-size: 13px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.06em; }
.game-feedback-word { font-size: 22px; font-weight: 900; }
.game-feedback-good .game-feedback-word { color: var(--good); }
.game-feedback-bad .game-feedback-word { color: var(--bad); letter-spacing: 0.05em; }

/* ---------- weekly test readiness ---------- */

.readiness {
    margin: 0 0 14px; padding: 10px 14px;
    border-radius: var(--radius-sm); font-size: 14px; font-weight: 700;
    border: 2px solid var(--line); background: var(--surface);
}
.readiness-ready { border-color: var(--good); color: var(--text); }
.readiness-low { border-color: var(--warn); color: var(--text); }

.ready-tag {
    display: inline-block; align-self: flex-start;
    border-radius: 999px; padding: 2px 10px;
    font-size: 12px; font-weight: 800;
}
.ready-yes { background: rgba(47, 217, 139, 0.16); color: var(--good); }
.ready-no { background: rgba(255, 197, 61, 0.16); color: var(--warn); }

/* ---------- best runs ---------- */

.best-ribbon {
    display: inline-block; margin-bottom: 12px; padding: 8px 18px;
    background: linear-gradient(135deg, var(--gold), #FFD980);
    color: #3A2300; border-radius: 999px;
    font-weight: 900; font-size: 14px; letter-spacing: 0.06em;
    animation: ribbon-pop 0.5s cubic-bezier(0.2, 1.5, 0.4, 1) both;
}
@keyframes ribbon-pop { from { transform: scale(0.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.score-board {
    background: var(--surface); border: 2px solid var(--line);
    border-radius: var(--radius); padding: 14px; margin: 16px 0 8px; text-align: left;
}
.score-board h3 {
    font-size: 14px; text-transform: uppercase; letter-spacing: 0.07em;
    color: var(--text-dim); margin-bottom: 10px;
}
.score-row {
    display: flex; align-items: center; gap: 12px;
    padding: 8px 0; border-bottom: 1px solid var(--line);
}
.score-row:last-child { border-bottom: 0; }
.score-row-new {
    background: rgba(255, 176, 32, 0.12);
    border-radius: 10px; padding-left: 8px; padding-right: 8px;
}
.score-rank { font-size: 20px; min-width: 28px; text-align: center; font-weight: 900; color: var(--text-dim); }
.score-distance { font-size: 19px; font-weight: 900; color: var(--brand-2); }

/* ---------- manage a list ---------- */

.manage-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.manage-grid .btn { margin: 0; width: 100%; }

/* ---------- practice ---------- */

.screen-full { padding-bottom: 20px; }

.practice-top { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.practice-progress { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.practice-track { height: 12px; background: var(--surface); border-radius: 999px; overflow: hidden; }
.practice-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--good), var(--brand-2)); border-radius: 999px; transition: width 0.35s ease; }
.practice-count { font-size: 12px; color: var(--text-dim); text-align: center; }
.practice-xp { font-weight: 900; color: var(--gold); font-size: 15px; min-width: 62px; text-align: right; }

.loader { text-align: center; padding: 60px 20px; }
.loader-emoji { font-size: 46px; animation: bob 1.1s ease-in-out infinite alternate; }
@keyframes bob { from { transform: translateY(0); } to { transform: translateY(-10px); } }
.loader-track { height: 10px; background: var(--surface); border-radius: 999px; overflow: hidden; margin: 16px auto 8px; max-width: 260px; }
.loader-fill { height: 100%; width: 0; background: var(--brand); transition: width 0.3s ease; }
.loader-count { font-size: 13px; color: var(--text-dim); }

.prompt-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.prompt-emoji { font-size: 24px; }
.prompt-text { font-weight: 900; font-size: 18px; }

.study-card {
    background: var(--surface); border: 2px solid var(--line);
    border-radius: 24px; padding: 26px 20px; text-align: center; margin-bottom: 14px;
}
.study-card-sm { padding: 18px 16px; }
.study-word {
    font-size: clamp(30px, 9vw, 46px); font-weight: 900; line-height: 1.12;
    overflow-wrap: anywhere; letter-spacing: 0.01em;
}
.study-phonetic { color: var(--brand-2); font-size: 18px; margin-top: 4px; min-height: 22px; }

.syllable-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 12px; }
.syllable {
    background: var(--surface-2); border: 2px solid var(--line);
    border-radius: 10px; padding: 6px 12px; font-size: 17px; font-weight: 800;
    transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

/* Lit as the word is sounded out, so the learner sees which part is being said. */
.syllable-on {
    background: var(--brand);
    border-color: var(--brand-2);
    color: #fff;
    transform: translateY(-2px) scale(1.06);
}

.audio-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 14px; }
.help-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 14px; }

.clue { text-align: center; font-size: 17px; margin: 4px 0 14px; }
.clue-translation { color: var(--brand-2); font-weight: 800; }

.fact-list { background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 4px; }
.pos-chip {
    display: inline-block; background: var(--surface-2); color: var(--brand-2);
    border-radius: 999px; padding: 3px 12px; font-size: 13px; font-weight: 800;
    text-transform: lowercase; margin-bottom: 8px;
}
.fact-def { font-size: 17px; margin: 0 0 10px; line-height: 1.5; }
/*
 * The label is quieter than the translation itself: it supplies context,
 * the translated word is the thing being read.
 */
.fact-translation { font-size: 19px; font-weight: 800; color: var(--brand-2); margin: 0 0 10px; }
.translation-label {
    display: inline-block;
    margin-right: 8px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    opacity: 0.75;
}
.translation-value { font-weight: 800; }
.clue-translation .translation-label { text-transform: none; letter-spacing: 0; font-size: 14px; }
[dir="rtl"] .translation-label { margin-right: 0; margin-left: 8px; }
.detail-block[dir="rtl"] { text-align: right; }
.fact-example { font-style: italic; color: var(--text-dim); margin: 0 0 10px; line-height: 1.5; }
.fact-extra { font-size: 14px; color: var(--text-dim); margin: 0; }

.choice-list { display: flex; flex-direction: column; gap: 10px; }
.choice-inline { flex-direction: row; flex-wrap: wrap; }
.choice {
    width: 100%; min-height: 56px; padding: 14px 18px;
    border: 2px solid var(--line); border-radius: var(--radius);
    background: var(--surface); color: var(--text);
    font: inherit; font-size: 16px; text-align: left; cursor: pointer;
    line-height: 1.4; transition: border-color 0.14s ease, transform 0.12s ease;
}
.choice:hover:not(:disabled) { border-color: var(--brand); transform: translateX(3px); }
.choice-word { width: auto; flex: 1 1 42%; text-align: center; font-size: 19px; font-weight: 900; }
.choice-right { border-color: var(--good); background: rgba(47, 217, 139, 0.16); }
.choice-wrong { border-color: var(--bad); background: rgba(255, 92, 122, 0.16); }
.choice:disabled { opacity: 0.75; }

.sentence-card {
    background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius);
    padding: 22px 18px; font-size: 19px; line-height: 1.7; margin-bottom: 16px;
}
.blank { display: inline-block; border-bottom: 3px solid var(--brand-2); min-width: 72px; margin: 0 3px; vertical-align: baseline; }

.tile-answer {
    display: flex; flex-wrap: wrap; gap: 6px; justify-content: center;
    min-height: 62px; padding: 10px;
    border: 2px dashed var(--line); border-radius: var(--radius); margin-bottom: 14px;
}
.tile-bank { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.tile {
    min-width: 46px; min-height: 52px; padding: 8px 12px;
    border: 2px solid var(--line); border-radius: var(--radius-sm);
    background: var(--surface); color: var(--text);
    font: inherit; font-size: 24px; font-weight: 900; text-transform: lowercase;
    cursor: pointer; transition: transform 0.1s ease;
}
.tile:active { transform: translateY(2px); }
.tile-used { opacity: 0.25; }
.tile-placed { background: var(--surface-2); border-color: var(--brand); }

.answer-form { margin-top: 18px; }
.answer-input {
    text-align: center; font-size: 26px; font-weight: 800;
    letter-spacing: 0.06em; min-height: 66px;
}

/* ---------- feedback ---------- */

.feedback { border-radius: 24px; padding: 18px; border: 3px solid var(--line); }
.feedback-good { border-color: var(--good); background: rgba(47, 217, 139, 0.08); }
.feedback-bad { border-color: var(--bad); background: rgba(255, 92, 122, 0.08); }
.feedback-banner { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.feedback-icon { font-size: 30px; }
.feedback-title { font-size: 22px; font-weight: 900; }

.diff-row { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; margin-bottom: 8px; }
.diff-letter {
    min-width: 34px; padding: 7px 4px; text-align: center;
    border-radius: 9px; font-size: 21px; font-weight: 900; text-transform: lowercase;
}
.diff-ok { background: rgba(47, 217, 139, 0.2); color: var(--good); }
.diff-missing { background: rgba(255, 92, 122, 0.24); color: var(--bad); border: 2px dashed var(--bad); }
.diff-wrong { background: rgba(255, 197, 61, 0.2); color: var(--warn); }
.diff-note { text-align: center; color: var(--text-dim); font-size: 14px; margin: 0 0 14px; }

/* ---------- summary ---------- */

.summary-wrap { text-align: center; padding-top: 18px; }
.summary-headline { font-size: 30px; margin-bottom: 18px; }
.summary-score-row { display: flex; flex-direction: column; gap: 4px; margin-bottom: 16px; }
.summary-big { font-size: 56px; font-weight: 900; color: var(--brand-2); line-height: 1; }
.summary-xp { font-size: 22px; font-weight: 900; color: var(--gold); }
.summary-chips { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 16px; }
.summary-chip { background: var(--surface); border: 2px solid var(--line); border-radius: 999px; padding: 8px 16px; font-weight: 800; }
.summary-chip-gold { border-color: var(--gold); color: var(--gold); }

.badge-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 16px; }
.badge {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    background: var(--surface); border: 2px solid var(--line);
    border-radius: var(--radius); padding: 12px 10px; min-width: 92px;
}
.badge-new { border-color: var(--gold); animation: pop 0.45s ease-out both; }
@keyframes pop { from { transform: scale(0.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.badge-locked { opacity: 0.4; }
.badge-emoji { font-size: 28px; }
.badge-name { font-size: 12px; font-weight: 800; text-align: center; }
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }

.summary-missed { text-align: left; background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 8px; }
.summary-missed h3 { font-size: 15px; margin-bottom: 10px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.06em; }
.summary-row { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.summary-row:last-child { border-bottom: 0; }
.summary-word { font-weight: 900; }
.summary-given { color: var(--bad); font-size: 14px; }

/* ---------- word list ---------- */

.filter-row { margin-bottom: 12px; }
.filter-selects { display: flex; gap: 8px; }
.filter-selects select { flex: 1; margin-bottom: 0; }
.list-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }

.word-list { display: flex; flex-direction: column; gap: 8px; }
.word-row {
    display: flex; align-items: center; gap: 8px;
    background: var(--surface); border: 2px solid var(--line);
    border-radius: var(--radius); padding: 8px 10px 8px 14px;
}
/*
 * The stacked title/detail pair used by share, inbox and grade rows. It had
 * no rule at all, so those spans flowed inline and wrapped mid-phrase.
 */
.word-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.word-open {
    flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px;
    background: none; border: 0; padding: 8px 0; text-align: left;
    color: var(--text); font: inherit; cursor: pointer;
}
.word-text { font-size: 19px; font-weight: 900; overflow-wrap: anywhere; }
.word-meta { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.word-sub, .word-tag { font-size: 12px; color: var(--text-dim); }
.word-tag { background: var(--surface-2); border-radius: 999px; padding: 2px 9px; }
.word-actions { display: flex; gap: 5px; flex-shrink: 0; }

.mastery-dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.m-new { background: var(--text-dim); }
.m-learning { background: var(--bad); }
.m-getting { background: var(--warn); }
.m-strong { background: var(--brand-2); }
.m-mastered { background: var(--good); }

.mastery-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.mastery-pill { border-radius: 999px; padding: 6px 14px; font-weight: 800; font-size: 14px; color: #08122B; }
.mastery-pill.m-new { background: var(--text-dim); }
.mastery-pill.m-learning { background: var(--bad); color: #fff; }
.mastery-pill.m-getting { background: var(--warn); }
.mastery-pill.m-strong { background: var(--brand-2); }
.mastery-pill.m-mastered { background: var(--good); }
.mastery-meta { font-size: 13px; color: var(--text-dim); }

/* ---------- word card ---------- */

.detail-block { background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.detail-block h3 { font-size: 14px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-dim); margin-bottom: 10px; }
.detail-translation { border-color: var(--brand-2); }
.translation-text { font-size: 24px; font-weight: 900; margin: 0; color: var(--brand-2); }
.meaning-row { padding: 10px 0; border-bottom: 1px solid var(--line); }
.meaning-row:last-child { border-bottom: 0; }
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.card-actions .btn { flex: 1; min-width: 120px; }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-row-sm { margin-top: 8px; }
.chip {
    background: var(--surface-2); border: 2px solid var(--line);
    border-radius: 999px; padding: 8px 14px;
    color: var(--text); font: inherit; font-size: 15px; font-weight: 700; cursor: pointer;
}
.chip:hover { border-color: var(--brand); }
.chip-static { cursor: default; color: var(--text-dim); }
.chip-sm { font-size: 13px; padding: 5px 11px; min-height: auto; }

/* ---------- add / bulk ---------- */

.warn-panel { background: rgba(255, 197, 61, 0.1); border: 2px solid var(--warn); border-radius: var(--radius); padding: 16px; margin-top: 14px; }
.warn-panel p { margin: 0 0 10px; font-weight: 800; }
.warn-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

.bulk-row {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    background: var(--surface); border: 2px solid var(--line);
    border-left-width: 6px; border-radius: var(--radius-sm);
    padding: 10px 12px; margin-bottom: 8px;
}
.bulk-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.bulk-word { font-weight: 900; font-size: 17px; overflow-wrap: anywhere; }
.bulk-note { font-size: 12px; color: var(--text-dim); }
.bulk-ok { border-left-color: var(--good); }
.bulk-unknown { border-left-color: var(--warn); }
.bulk-bad, .bulk-dupe { border-left-color: var(--bad); }
.bulk-dropped { opacity: 0.45; }

/* ---------- progress ---------- */

.progress-hero { display: flex; gap: 10px; margin-bottom: 8px; }
.progress-tile { flex: 1; background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); padding: 16px 8px; text-align: center; }
.progress-tile-value { display: block; font-size: 30px; font-weight: 900; color: var(--brand-2); line-height: 1.1; }
.progress-tile-label { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-dim); }
.progress-tile-sub { display: block; font-size: 12px; color: var(--text-dim); margin-top: 3px; }

.mastery-chart { display: flex; flex-direction: column; gap: 8px; }
.mastery-bar-row { display: flex; align-items: center; gap: 10px; }
.mastery-bar-label { width: 96px; font-size: 13px; color: var(--text-dim); flex-shrink: 0; }
.mastery-track { flex: 1; height: 16px; background: var(--surface); border-radius: 999px; overflow: hidden; }
.mastery-fill { height: 100%; border-radius: 999px; transition: width 0.4s ease; min-width: 2px; }
.mastery-bar-count { width: 30px; text-align: right; font-weight: 900; font-size: 14px; }

.history-row { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 8px; }
.history-score { font-size: 20px; font-weight: 900; color: var(--brand-2); min-width: 56px; }
.history-meta { flex: 1; font-size: 13px; color: var(--text-dim); }
.history-xp { font-size: 13px; font-weight: 800; color: var(--gold); }

/* ---------- grades chart ---------- */

.chart-card {
    background: var(--surface); border: 2px solid var(--line);
    border-radius: var(--radius); padding: 14px 12px 10px; margin-bottom: 12px;
}
.chart-area { position: relative; color: var(--text-dim); }
.chart-area svg { display: block; overflow: visible; touch-action: pan-y; }
.chart-note { margin: 8px 4px 0; font-size: 13px; color: var(--text-dim); font-weight: 700; }
.chart-note-up { color: var(--good); }
.chart-note-down { color: var(--warn); }

.chart-tip {
    position: absolute; top: 0; transform: translateX(-50%);
    display: flex; flex-direction: column; gap: 1px;
    background: var(--surface-2); border: 2px solid var(--line);
    border-radius: 10px; padding: 6px 10px; pointer-events: none; white-space: nowrap;
}
.chart-tip-grade { font-size: 15px; font-weight: 900; color: var(--text); }
.chart-tip-list { font-size: 12px; color: var(--text); }
.chart-tip-date { font-size: 11px; color: var(--text-dim); }

.grade-row {
    display: flex; align-items: center; gap: 12px;
    background: var(--surface); border: 2px solid var(--line);
    border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 8px;
}
.grade-pill {
    min-width: 56px; text-align: center; border-radius: 999px;
    padding: 6px 10px; font-weight: 900; font-size: 15px; color: #08122B;
}
.grade-great { background: var(--good); }
.grade-ok { background: var(--warn); }
.grade-low { background: var(--bad); color: #fff; }

/* ---------- celebrations ---------- */

#celebration-canvas { position: fixed; inset: 0; pointer-events: none; z-index: 600; }

.celebration {
    position: fixed; inset: 0; z-index: 601;
    display: flex; align-items: center; justify-content: center; padding: 24px;
    pointer-events: none;
    /* A scrim, or the page behind reads straight through the message. */
    background: radial-gradient(circle at 50% 45%, rgba(10, 6, 30, 0.72), rgba(6, 8, 24, 0.92));
    backdrop-filter: blur(3px);
    animation: celebrate-fade 0.3s ease-out both;
}

@keyframes celebrate-fade { from { opacity: 0; } to { opacity: 1; } }
.celebrate-card { text-align: center; animation: celebrate-in 0.5s cubic-bezier(0.2, 1.4, 0.4, 1) both; }
@keyframes celebrate-in {
    from { opacity: 0; transform: scale(0.7); }
    to { opacity: 1; transform: scale(1); }
}

.celebrate-stars { font-size: 44px; letter-spacing: 6px; }
.celebrate-title {
    font-size: clamp(38px, 13vw, 76px); font-weight: 900; line-height: 1.05;
    letter-spacing: 0.01em; margin: 6px 0;
}
.celebrate-title-gold {
    color: var(--gold);
    text-shadow: 0 4px 0 rgba(0,0,0,0.35), 0 0 34px rgba(255,176,32,0.65);
}
.celebrate-title-perfect {
    background: linear-gradient(120deg, #FFD166, #FF8A3D 40%, #FFF3C4 70%, #FFB020);
    -webkit-background-clip: text; background-clip: text; color: transparent;
    text-shadow: 0 0 44px rgba(255,190,60,0.5);
}
.celebrate-score { font-size: 32px; font-weight: 900; color: var(--text); }
.celebrate-score-perfect { font-size: 44px; color: var(--gold); }
.celebrate-sub { margin-top: 8px; font-size: 16px; color: var(--text-dim); font-weight: 700; }

.celebrate-crown { font-size: 40px; animation: crown-bob 1.1s ease-in-out infinite alternate; }
.celebrate-dino { font-size: 84px; line-height: 1; animation: dino-dance 0.55s ease-in-out infinite alternate; }
.celebrate-stamp {
    display: inline-block; margin-top: 12px; padding: 8px 18px;
    border: 3px solid var(--gold); border-radius: 999px;
    color: var(--gold); font-weight: 900; font-size: 14px; letter-spacing: 0.08em;
    transform: rotate(-4deg);
}
@keyframes crown-bob { from { transform: translateY(0); } to { transform: translateY(-8px); } }
@keyframes dino-dance {
    from { transform: rotate(-7deg) scale(0.97); }
    to { transform: rotate(7deg) scale(1.05); }
}

/* ---------- toast, modal, confetti ---------- */

.toast {
    position: fixed; left: 50%; bottom: 92px; transform: translateX(-50%);
    max-width: min(540px, calc(100vw - 28px));
    background: var(--surface-2); color: var(--text);
    border: 2px solid var(--line); border-radius: 14px;
    padding: 13px 20px; font-weight: 700; font-size: 15px;
    box-shadow: var(--shadow); z-index: 300; text-align: center;
}
.toast-success { border-color: var(--good); }
.toast-error { border-color: var(--bad); }
.toast-warn { border-color: var(--warn); }
.toast-info { border-color: var(--brand-2); }

.modal-overlay {
    position: fixed; inset: 0; z-index: 400;
    display: flex; align-items: center; justify-content: center; padding: 20px;
    background: rgba(6, 8, 24, 0.72); backdrop-filter: blur(4px);
}
.modal {
    width: 100%; max-width: 420px;
    background: var(--surface); border: 2px solid var(--line);
    border-radius: 22px; padding: 24px; box-shadow: var(--shadow);
}
.modal h2 { font-size: 21px; margin-bottom: 10px; }
.modal p { margin: 0 0 16px; color: var(--text-dim); overflow-wrap: anywhere; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }

#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 500; }

/* ---------- small screens ---------- */

@media (max-width: 380px) {
    #app { padding: 12px 12px 92px; }
    .cta-count { font-size: 46px; }
    .mode-grid { grid-template-columns: 1fr; }
    .tab-label { font-size: 11px; }
}
