/* Lex — English vocab PWA */
:root {
  --bg: #0E1726;
  --bg-2: #162033;
  --bg-3: #101a2c;
  --line: rgba(255,255,255,0.08);
  --line-strong: rgba(255,255,255,0.14);
  --fg: #ffffff;
  --fg-2: rgba(255,255,255,0.7);
  --fg-3: rgba(255,255,255,0.5);
  --fg-4: rgba(255,255,255,0.3);
  --primary: #7C5CFF;
  --teal: #3DDBD9;
  --pink: #FF6B9D;
  --orange: #FFB454;
  --green: #5EE7B7;
  --red: #F45B69;
  --radius: 22px;
  --radius-sm: 14px;
  --safe-top: env(safe-area-inset-top);
  --safe-bot: env(safe-area-inset-bottom);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; background: var(--bg); color: var(--fg); font-family: 'Inter', system-ui, sans-serif; overscroll-behavior-y: none; }
body { font-size: 15px; line-height: 1.4; }

#app { min-height: 100dvh; padding-top: var(--safe-top); padding-bottom: calc(86px + var(--safe-bot)); }
#app.no-bottom-nav { padding-bottom: var(--safe-bot); }

button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, textarea { font: inherit; color: inherit; background: none; border: 0; outline: none; }
a { color: inherit; text-decoration: none; }

/* Screen shell */
.screen { padding: 0 20px; max-width: 480px; margin: 0 auto; }
.screen-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 0 10px; }
.screen-title { font-size: 22px; font-weight: 800; letter-spacing: -0.4px; }
.screen-sub { font-size: 12px; color: var(--fg-3); font-weight: 600; letter-spacing: 0.3px; text-transform: uppercase; margin-top: 2px; }

/* Cards */
.card { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card-sm { border-radius: var(--radius-sm); padding: 12px 14px; }

/* Eyebrow chip */
.eyebrow { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 10px; font-weight: 800; letter-spacing: 0.5px; text-transform: uppercase; background: rgba(124,92,255,0.14); color: var(--primary); }
.eyebrow .dot { width: 6px; height: 6px; border-radius: 3px; background: currentColor; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 13px 16px; border-radius: 16px; font-weight: 800; font-size: 14px; letter-spacing: -0.1px; transition: transform 0.06s ease, opacity 0.15s ease; }
.btn svg { font-size: 16px; }
.btn-sm svg { font-size: 14px; }
.btn-lg svg { font-size: 18px; }
.chip svg { font-size: 14px; }
.qa-icon svg, .cat-icon svg { font-size: 18px; }
.eyebrow svg { font-size: 12px; }
.feedback svg { font-size: 14px; }
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-ghost { background: var(--bg-2); color: var(--fg); border: 1px solid var(--line-strong); }
.btn-teal { background: var(--teal); color: var(--bg); }
.btn-block { width: 100%; }
.btn-lg { padding: 16px 18px; font-size: 15px; }
.btn-sm { padding: 8px 12px; font-size: 12px; border-radius: 12px; }
.btn-icon { width: 40px; height: 40px; padding: 0; border-radius: 14px; flex-shrink: 0; }
.btn-icon svg { font-size: 18px; }
.header-spacer { width: 40px; flex-shrink: 0; }
.btn[disabled] { opacity: 0.4; pointer-events: none; }
.btn.is-disabled { opacity: 0.4; pointer-events: none; }
.btn-orange { background: var(--orange); color: var(--bg); }

/* Pill chip */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--bg-2); border: 1px solid var(--line); font-size: 12px; font-weight: 700; }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* Bottom nav */
.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; padding-bottom: var(--safe-bot); background: rgba(14,23,38,0.92); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line); z-index: 50; }
.bottom-nav-inner { display: grid; grid-template-columns: repeat(5, 1fr); max-width: 480px; margin: 0 auto; padding: 8px 6px 6px; }
.nav-btn { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 7px 4px; border-radius: 10px; color: var(--fg-3); font-size: 10px; font-weight: 700; letter-spacing: 0.2px; }
.nav-btn.active { color: var(--primary); }
.nav-btn .icon { width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; font-size: 20px; }
.nav-btn.fab { color: #fff; }
.nav-btn.fab .icon { background: var(--primary); width: 38px; height: 38px; border-radius: 50%; box-shadow: 0 6px 18px -4px rgba(124,92,255,0.5); font-size: 18px; }
.nav-btn.fab .icon svg { stroke: #fff; }
.nav-btn .icon svg { width: 1em; height: 1em; }

/* Top nav (in-session) */
.top-nav { display: flex; align-items: center; gap: 12px; padding: 8px 16px 4px; }
.top-nav .top-nav .x-btn { width: 38px; height: 38px; border-radius: 19px; background: var(--bg-2); display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 16px; font-weight: 700; flex-shrink: 0; }
.top-nav .x-btn svg { font-size: 16px; }
.top-nav .progress { flex: 1; height: 8px; background: var(--bg-2); border-radius: 4px; overflow: hidden; display: flex; gap: 2px; }
.top-nav .progress span { flex: 1; background: rgba(255,255,255,0.06); border-radius: 2px; }
.top-nav .progress span.done { background: rgba(124,92,255,0.66); }
.top-nav .progress span.active { background: var(--primary); }
.top-nav .count { padding: 4px 10px; border-radius: 999px; background: var(--bg-2); font-size: 11px; font-weight: 800; letter-spacing: 0.5px; display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.top-nav .count .dot { width: 6px; height: 6px; border-radius: 3px; background: var(--teal); }

/* Streak strip */
.streak-strip { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: center; padding: 14px 16px; background: linear-gradient(135deg, rgba(124,92,255,0.18), rgba(255,107,157,0.12)); border: 1px solid rgba(124,92,255,0.28); border-radius: var(--radius); }
.streak-flame { font-size: 26px; line-height: 1; }
.streak-meta { display: flex; flex-direction: column; gap: 4px; }
.streak-num { font-size: 18px; font-weight: 900; letter-spacing: -0.4px; }
.streak-label { font-size: 11px; font-weight: 700; color: var(--fg-3); letter-spacing: 0.4px; text-transform: uppercase; }
.streak-bar { margin-top: 4px; height: 5px; background: rgba(0,0,0,0.25); border-radius: 3px; overflow: hidden; }
.streak-bar > span { display: block; height: 100%; background: var(--teal); border-radius: 3px; }

/* Quick actions */
.quick-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.qa { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; padding: 12px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-sm); transition: transform 0.06s; text-align: left; }
.qa:active { transform: scale(0.98); }
.qa-icon { width: 32px; height: 32px; border-radius: 10px; background: rgba(255,255,255,0.06); display: flex; align-items: center; justify-content: center; font-size: 16px; }
.qa-label { font-size: 12px; font-weight: 800; letter-spacing: -0.1px; }
.qa-sub { font-size: 10px; color: var(--fg-3); font-weight: 600; }

/* Categories grid */
.cats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cat { padding: 16px; border-radius: var(--radius-sm); background: var(--bg-2); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; align-items: flex-start; text-align: left; min-height: 116px; justify-content: space-between; }
.cat:active { transform: scale(0.98); }
.cat-icon { width: 36px; height: 36px; border-radius: 12px; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 18px; }
.cat-icon.vocab { background: var(--primary); }
.cat-icon.grammar { background: var(--orange); color: var(--bg); }
.cat-icon.pron { background: var(--pink); }
.cat-icon.errors { background: var(--red); }
.cat-icon.match { background: var(--teal); color: var(--bg); }
.cat-icon.test { background: var(--orange); color: var(--bg); }
.cat-name { font-size: 15px; font-weight: 800; letter-spacing: -0.2px; }
.cat-meta { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; color: var(--fg-3); }
.cat-due { color: var(--teal); }

/* Featured Learn card (Train hub) */
.learn-feature { display: flex; align-items: center; gap: 14px; padding: 18px; border-radius: var(--radius); background: linear-gradient(135deg, var(--primary), #5a3fd6); box-shadow: 0 16px 30px -18px var(--primary); margin-bottom: 18px; }
.learn-feature:active { transform: scale(0.99); }
.learn-feature-icon { width: 48px; height: 48px; border-radius: 14px; background: rgba(255,255,255,0.2); display: flex; align-items: center; justify-content: center; font-size: 24px; color: #fff; flex-shrink: 0; }
.learn-feature-title { font-size: 18px; font-weight: 900; letter-spacing: -0.4px; color: #fff; }
.learn-feature-sub { font-size: 12px; font-weight: 600; color: rgba(255,255,255,0.82); margin-top: 2px; }
.learn-feature-go { color: #fff; font-size: 20px; display: flex; flex-shrink: 0; }

/* Match game */
.match-head { display: flex; align-items: baseline; justify-content: space-between; margin: 12px 0 2px; }
.match-time { font-size: 40px; font-weight: 900; letter-spacing: -1.5px; font-variant-numeric: tabular-nums; line-height: 1; }
.match-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 10px; }
.match-tile { aspect-ratio: 1 / 1.06; border-radius: 16px; background: var(--bg-2); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; text-align: center; padding: 6px 8px; font-size: 15px; font-weight: 800; letter-spacing: -0.3px; line-height: 1.1; color: var(--fg); word-break: break-word; transition: opacity 0.22s ease, transform 0.22s ease, border-color 0.15s ease, background 0.15s ease; }
.match-tile.en { font-family: 'Fraunces', serif; }
.match-tile.sel { border: 2px solid var(--primary); background: rgba(124,92,255,0.14); box-shadow: 0 0 0 4px rgba(124,92,255,0.18); }
.match-tile.wrong { border: 2px solid var(--red); background: rgba(244,91,105,0.14); color: #FF9AA4; }
.match-tile.cleared { opacity: 0; transform: scale(0.85); pointer-events: none; }

/* Test */
.test-q { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 16px; margin-bottom: 14px; }
.test-q-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.test-q-num { width: 24px; height: 24px; border-radius: 8px; background: rgba(255,255,255,0.06); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 900; color: var(--fg-2); flex-shrink: 0; }
.test-q-type { font-size: 10px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--fg-3); }
.test-q-prompt { font-size: 17px; font-weight: 800; letter-spacing: -0.3px; line-height: 1.25; margin-bottom: 14px; }
.qcm-opt.sel { border-color: var(--primary); background: rgba(124,92,255,0.12); }
.tf-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tf-btn { padding: 13px; text-align: center; border-radius: 14px; background: var(--bg); border: 1px solid var(--line); font-size: 15px; font-weight: 800; color: var(--fg-2); }
.tf-btn.sel { border: 2px solid var(--primary); background: rgba(124,92,255,0.12); color: var(--fg); }
.test-submit-bar { position: fixed; left: 0; right: 0; bottom: 0; max-width: 480px; margin: 0 auto; display: flex; align-items: center; gap: 12px; padding: 12px 20px calc(18px + var(--safe-bot)); background: linear-gradient(to bottom, rgba(14,23,38,0), var(--bg) 30%); }
.score-ring { width: 116px; height: 116px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.score-ring-inner { width: 92px; height: 92px; border-radius: 50%; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; }

/* Vocab list */
.vocab-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--bg-2); border: 1px solid var(--line); align-items: center; margin-bottom: 8px; transition: transform 0.06s; }
.vocab-row:active { transform: scale(0.99); }
.vocab-word { font-size: 16px; font-weight: 800; font-family: 'Fraunces', serif; letter-spacing: -0.3px; }
.vocab-trans { font-size: 12px; color: var(--fg-3); font-weight: 600; margin-top: 2px; }
.vocab-mastery { width: 56px; }
.mastery-bar { height: 5px; background: rgba(255,255,255,0.06); border-radius: 3px; overflow: hidden; }
.mastery-bar > span { display: block; height: 100%; background: var(--teal); border-radius: 3px; }
.mastery-label { font-size: 9px; font-weight: 800; letter-spacing: 0.4px; text-transform: uppercase; color: var(--fg-3); margin-top: 4px; text-align: right; }

/* Search */
.search { display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px; margin-bottom: 12px; }
.search input { flex: 1; font-size: 14px; }
.search input::placeholder { color: var(--fg-4); }

/* Filters */
.filters { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 12px; padding-bottom: 4px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filters .chip { white-space: nowrap; flex-shrink: 0; }

/* Word detail */
.detail-hero { padding: 24px; border-radius: var(--radius); background: linear-gradient(160deg, var(--primary), rgba(124,92,255,0.5)); display: flex; flex-direction: column; gap: 8px; }
.detail-word { font-size: 44px; font-weight: 900; font-family: 'Fraunces', serif; letter-spacing: -1.5px; line-height: 1; }
.detail-phon { font-size: 13px; font-family: monospace; opacity: 0.8; }
.detail-pos { font-size: 10px; font-weight: 800; letter-spacing: 0.6px; text-transform: uppercase; opacity: 0.8; }
.detail-section-title { font-size: 11px; font-weight: 800; letter-spacing: 0.5px; text-transform: uppercase; color: var(--fg-3); margin: 18px 0 8px; }
.detail-text { font-size: 15px; font-weight: 500; line-height: 1.5; }
.detail-example { font-style: italic; font-family: 'Fraunces', serif; padding: 12px 14px; background: var(--bg-2); border-left: 3px solid var(--primary); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

/* Add form */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field-label { font-size: 11px; font-weight: 800; letter-spacing: 0.5px; text-transform: uppercase; color: var(--fg-3); }
.field-input { padding: 14px 16px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px; font-size: 16px; font-weight: 600; }
.field-input:focus { border-color: var(--primary); }
.field-input.large { font-family: 'Fraunces', serif; font-size: 22px; font-weight: 700; }
select.field-input {
  -webkit-appearance: none; appearance: none; cursor: pointer;
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round' opacity='0.55'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}

/* Train cards */
.train-stage { padding: 8px 8px 0; }
.train-card { background: var(--bg-2); border: 1px solid var(--line); border-radius: 26px; padding: 28px; min-height: 460px; display: flex; flex-direction: column; justify-content: space-between; box-shadow: 0 20px 40px -20px rgba(0,0,0,0.5); transition: all 0.3s ease; }
.train-card.flipped { background: linear-gradient(160deg, var(--primary), rgba(124,92,255,0.7)); }
.train-card.correct { background: linear-gradient(160deg, var(--teal), #2a8a87); color: var(--bg); }
.train-card.wrong { background: linear-gradient(160deg, var(--red), #a83840); }
.train-eyebrow { font-size: 10px; font-weight: 800; letter-spacing: 1.5px; text-transform: uppercase; opacity: 0.5; }
.train-word { font-size: 48px; font-weight: 900; font-family: 'Fraunces', serif; letter-spacing: -2px; line-height: 1; margin-top: 14px; }
.train-translation { font-size: 36px; font-weight: 900; letter-spacing: -1.2px; line-height: 1.1; }
.train-defn { font-size: 14px; opacity: 0.9; line-height: 1.5; margin-top: 14px; }
.train-example { font-size: 13px; font-style: italic; font-family: 'Fraunces', serif; padding: 10px 12px; background: rgba(0,0,0,0.2); border-radius: 12px; margin-top: 12px; line-height: 1.4; }

.rate-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; padding: 14px 8px 0; }
.rate { background: var(--bg-2); border: 1.5px solid var(--line); border-radius: 14px; padding: 12px 8px; text-align: center; }
.rate.hard { border-color: var(--red); }
.rate.ok { border-color: var(--orange); }
.rate.easy { border-color: var(--teal); }
.rate-icon { width: 26px; height: 26px; border-radius: 13px; margin: 0 auto 6px; display: flex; align-items: center; justify-content: center; color: var(--bg); font-weight: 900; font-size: 13px; }
.rate-icon.hard { background: var(--red); }
.rate-icon.ok { background: var(--orange); }
.rate-icon.easy { background: var(--teal); }
.rate-label { font-size: 12px; font-weight: 800; }
.rate-sub { font-size: 10px; opacity: 0.5; font-weight: 600; margin-top: 1px; }

/* QCM options */
.qcm-card { padding: 22px; }
.qcm-rule { font-size: 12px; font-weight: 700; color: var(--fg-3); margin-top: 14px; letter-spacing: 0.3px; text-transform: uppercase; }
.qcm-sentence { font-size: 22px; font-weight: 700; line-height: 1.4; margin-top: 12px; font-family: 'Fraunces', serif; letter-spacing: -0.4px; }
.blank { display: inline-block; min-width: 80px; text-align: center; padding: 2px 12px; margin: 0 4px; background: rgba(255,255,255,0.06); border-bottom: 2px dashed var(--line-strong); border-radius: 4px; color: var(--fg-4); }
.blank.filled { background: rgba(124,92,255,0.16); color: #fff; border-bottom-style: solid; border-bottom-color: var(--primary); font-style: italic; }
.blank.correct { background: rgba(61,219,217,0.18); color: var(--teal); border-bottom-color: var(--teal); }
.blank.wrong { background: rgba(244,91,105,0.18); color: var(--red); border-bottom-color: var(--red); }

.qcm-opts { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.qcm-opt { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 16px; background: var(--bg-2); border: 1px solid var(--line); cursor: pointer; transition: all 0.15s ease; }
.qcm-opt:active { transform: scale(0.99); }
.qcm-opt.correct { background: rgba(61,219,217,0.12); border-color: var(--teal); }
.qcm-opt.wrong { background: rgba(244,91,105,0.12); border-color: var(--red); }
.qcm-opt.dim { color: var(--fg-3); }
.qcm-letter { width: 28px; height: 28px; border-radius: 14px; background: rgba(255,255,255,0.08); color: var(--fg-2); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 900; flex-shrink: 0; }
.qcm-letter.correct { background: var(--teal); color: var(--bg); }
.qcm-letter.wrong { background: var(--red); color: #fff; }
.qcm-text { flex: 1; font-size: 15px; font-weight: 600; line-height: 1.35; }

/* Feedback panel */
.feedback { padding: 12px 14px; border-radius: 16px; display: flex; gap: 10px; align-items: flex-start; margin-top: 14px; }
.feedback.correct { background: rgba(61,219,217,0.08); border: 1px solid rgba(61,219,217,0.2); }
.feedback.wrong { background: rgba(244,91,105,0.08); border: 1px solid rgba(244,91,105,0.2); }
.feedback-tag { font-size: 11px; font-weight: 900; letter-spacing: 0.5px; text-transform: uppercase; flex-shrink: 0; }
.feedback.correct .feedback-tag { color: var(--teal); }
.feedback.wrong .feedback-tag { color: var(--red); }
.feedback-text { flex: 1; font-size: 12px; line-height: 1.5; color: var(--fg-2); }

/* Pronunciation */
.pron-syllables { display: flex; gap: 6px; justify-content: center; margin-top: 14px; }
.pron-syl { padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 800; letter-spacing: 0.6px; text-transform: uppercase; }
.pron-syl.stress { background: rgba(255,107,157,0.2); color: var(--pink); border: 1px solid rgba(255,107,157,0.4); }
.pron-syl.unstress { background: rgba(255,255,255,0.06); color: var(--fg-2); border: 1px solid var(--line); }

.wave { display: flex; align-items: flex-end; gap: 2px; height: 40px; }
.wave-bar { flex: 1; background: var(--fg-2); border-radius: 2px; min-width: 2px; }

.mic-btn { background: var(--pink); color: var(--bg); padding: 16px; border-radius: 16px; font-size: 15px; font-weight: 900; display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; }
.mic-btn.recording { background: var(--red); color: #fff; animation: pulse 1.2s ease infinite; }

/* Word bank (fill) */
.bank { display: flex; flex-wrap: wrap; gap: 6px; }
.bank-word { padding: 8px 14px; border-radius: 999px; background: var(--bg-2); border: 1.5px solid var(--line-strong); font-size: 14px; font-weight: 700; font-family: 'Fraunces', serif; cursor: pointer; transition: transform 0.08s ease; }
.bank-word:active { transform: scale(0.95); }
.bank-word.used { background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.04); color: var(--fg-4); text-decoration: line-through; }

/* Stats */
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.stat-card { padding: 14px 16px; border-radius: var(--radius-sm); background: var(--bg-2); border: 1px solid var(--line); }
.stat-num { font-size: 26px; font-weight: 900; letter-spacing: -0.6px; line-height: 1; font-family: 'Fraunces', serif; }
.stat-label { font-size: 10px; font-weight: 700; letter-spacing: 0.4px; text-transform: uppercase; color: var(--fg-3); margin-top: 6px; }

.bar-chart { display: flex; align-items: flex-end; gap: 6px; height: 110px; padding: 8px 0; }
.bar { flex: 1; background: var(--primary); border-radius: 4px 4px 0 0; min-height: 4px; opacity: 0.7; }
.bar.today { opacity: 1; background: var(--teal); }
.bar-day { font-size: 9px; font-weight: 800; text-align: center; color: var(--fg-3); margin-top: 4px; letter-spacing: 0.3px; text-transform: uppercase; }

/* Empty states */
.empty { padding: 32px 20px; text-align: center; }
.empty-emoji { font-size: 36px; }
.empty-title { font-size: 16px; font-weight: 800; margin-top: 8px; }
.empty-sub { font-size: 13px; color: var(--fg-3); margin-top: 6px; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: calc(100px + var(--safe-bot)); transform: translateX(-50%); padding: 12px 18px; background: var(--bg-2); border: 1px solid var(--line-strong); border-radius: 14px; font-size: 13px; font-weight: 700; z-index: 100; animation: toast-in 0.2s ease; }

/* Settings rows */
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.setting-row:last-child { border-bottom: 0; }
.setting-label { font-size: 13px; font-weight: 700; color: var(--fg-2); }
.setting-input { background: transparent; color: var(--fg); font-size: 14px; font-weight: 700; text-align: right; min-width: 120px; padding: 4px 0; }
.setting-input::placeholder { color: var(--fg-4); }
select.setting-input { -webkit-appearance: none; appearance: none; cursor: pointer; }
.setting-action { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; width: 100%; font-size: 14px; font-weight: 700; text-align: left; }

/* Toggle switch */
.switch { position: relative; display: inline-block; width: 44px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider { position: absolute; cursor: pointer; inset: 0; background: var(--line-strong); border-radius: 13px; transition: 0.2s; }
.switch .slider::before { position: absolute; content: ''; height: 20px; width: 20px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: 0.2s; }
.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider::before { transform: translateX(18px); }

/* Onboarding */
.onb { min-height: 100dvh; padding: 32px 24px; display: flex; flex-direction: column; justify-content: space-between; }
.onb-logo { font-size: 40px; font-weight: 900; font-family: 'Fraunces', serif; letter-spacing: -1.5px; }
.onb-title { font-size: 32px; font-weight: 900; font-family: 'Fraunces', serif; letter-spacing: -1px; line-height: 1.1; margin-top: 14px; }
.onb-sub { font-size: 15px; color: var(--fg-2); margin-top: 14px; line-height: 1.5; }
.onb-target { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 18px; }
.onb-target .qa-label { font-size: 14px; }

/* Animations */
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
@keyframes toast-in { from { transform: translate(-50%, 8px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
@keyframes flash-correct { 0% { background: rgba(61,219,217,0.2); } 100% { background: transparent; } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.shake { animation: shake 0.4s ease; }

/* Utility */
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.row { display: flex; align-items: center; }
.row-between { display: flex; align-items: center; justify-content: space-between; }
.col { display: flex; flex-direction: column; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; }
.text-fg-3 { color: var(--fg-3); }
.text-center { text-align: center; }
.font-serif { font-family: 'Fraunces', serif; }
.hidden { display: none !important; }

/* ── Collaborative / teacher mode ── */
.role-tag { display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px; border-radius: 999px; font-size: 10px; font-weight: 900; letter-spacing: 0.8px; align-self: flex-start; }
.role-tag .dot { width: 6px; height: 6px; border-radius: 3px; background: currentColor; }
.role-tag.teacher { background: rgba(255,180,84,0.14); color: var(--orange); border: 1px solid rgba(255,180,84,0.40); }
.role-tag.learner { background: rgba(124,92,255,0.14); color: var(--primary); border: 1px solid rgba(124,92,255,0.40); }

.avatar { display: flex; align-items: center; justify-content: center; font-weight: 900; flex-shrink: 0; }
.student-card { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.student-card:active { transform: scale(0.99); }
.add-pill { width: 30px; height: 30px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }

.teacher-banner { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; border-color: rgba(255,180,84,0.34); background: rgba(255,180,84,0.08); }
.teacher-banner:active { transform: scale(0.99); }

.tag-teacher { display: inline-flex; align-items: center; gap: 3px; font-size: 9px; font-weight: 900; letter-spacing: 0.3px; color: var(--bg); background: var(--orange); padding: 2px 6px; border-radius: 5px; vertical-align: middle; }
.vocab-row.teacher-row { border-left: 3px solid var(--orange); padding-left: 11px; }

.badge-new { padding: 2px 8px; border-radius: 999px; background: var(--orange); color: var(--bg); font-size: 9px; font-weight: 900; letter-spacing: 0.5px; }
.card.unseen { box-shadow: 0 0 0 1px rgba(255,180,84,0.2); }

.checkbox { width: 22px; height: 22px; border-radius: 7px; border: 2px solid var(--line-strong); display: flex; align-items: center; justify-content: center; font-size: 12px; color: var(--bg); flex-shrink: 0; cursor: pointer; }
.checkbox.on { background: var(--orange); border-color: var(--orange); }

.role-opt { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px; border-radius: var(--radius-sm); background: var(--bg-3); border: 1.5px solid transparent; }
.role-opt.active { border-color: var(--primary); background: rgba(124,92,255,0.08); }
.role-opt.active.teacher { border-color: var(--orange); background: rgba(255,180,84,0.08); }
.role-ic { width: 38px; height: 38px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }

.bottom-nav.is-teacher .nav-btn.active { color: var(--orange); }
.bottom-nav.is-teacher .nav-btn.fab .icon { background: var(--orange); box-shadow: 0 6px 18px -4px rgba(255,180,84,0.5); }
.bottom-nav.is-teacher .bottom-nav-inner { grid-template-columns: repeat(3, 1fr); }

/* ── Class connection (join / invite) ── */
.qr-wrap { width: 108px; height: 108px; border-radius: 14px; background: #fff; padding: 9px; flex-shrink: 0; }
.qr { display: grid; width: 100%; height: 100%; gap: 1px; }
.qr i { background: var(--bg); border-radius: 1px; }
.class-code { font-size: 30px; font-weight: 900; letter-spacing: 2px; line-height: 1; font-family: 'Inter', monospace; margin-top: 4px; }

.code-cells { display: flex; gap: 7px; }
.code-cell {
  flex: 1; aspect-ratio: 1 / 1.15; border-radius: 12px;
  background: rgba(22,32,51,0.4); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 900; font-family: 'Inter', monospace; color: #fff;
}
.code-cell.filled { background: var(--bg-2); border-color: rgba(255,180,84,0.5); }
.code-cell.active { border: 2px solid var(--orange); }
.code-cell .caret { width: 2px; height: 26px; background: var(--orange); border-radius: 1px; animation: pulse 1.1s ease-in-out infinite; }

/* Live sync indicator (home) */
.sync-chip {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 9px 14px; border-radius: 999px;
  background: var(--bg-2); border: 1px solid rgba(94,231,183,0.22);
  background: rgba(94,231,183,0.07); border: 1px solid rgba(94,231,183,0.22);
  font-size: 12px; font-weight: 600; color: var(--fg-2); text-align: left;
}
.sync-chip:active { transform: scale(0.99); }
.sync-chip .sync-dot { width: 7px; height: 7px; border-radius: 4px; background: var(--green); flex-shrink: 0; box-shadow: 0 0 0 0 rgba(94,231,183,0.5); animation: sync-pulse 2.4s ease-out infinite; }
.sync-chip .sync-text { color: var(--fg-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sync-chip .sync-text b { color: var(--fg); font-weight: 800; }
.sync-chip .sync-ago { margin-left: auto; color: var(--fg-4); font-weight: 700; white-space: nowrap; }
.sync-chip .sync-refresh { color: var(--green); font-size: 14px; display: inline-flex; flex-shrink: 0; }
.sync-chip.syncing { color: var(--green); }
.sync-chip .sync-refresh.spin { animation: spin 0.85s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes sync-pulse { 0% { box-shadow: 0 0 0 0 rgba(94,231,183,0.45); } 70% { box-shadow: 0 0 0 6px rgba(94,231,183,0); } 100% { box-shadow: 0 0 0 0 rgba(94,231,183,0); } }
