/* SpeakEasy web — same palette and shapes as ui/theme/Theme.kt. */
:root {
  --sky: #2b9fdb; --sky-l: #e3f4fd;
  --mint: #3cc497; --mint-l: #e2f8ef;
  --peach: #ff9466; --peach-l: #ffede4;
  --lavender: #8c73f0; --lavender-l: #efeafe;
  --sun: #ffc23d; --sun-l: #fff5db; --sun-soft: rgba(255, 194, 61, .35);
  --coral: #f2667a; --coral-l: rgba(242, 102, 122, .12);
  --ink: #1f2a44; --muted: #6b7590; --canvas: #f7fbff; --line: #e6ecf5; --surface: #fff;
  --xp-ink: #8a5a00;
  --white: #fff;
  --a: var(--sky); --al: var(--sky-l);
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--canvas); color: var(--ink);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased; overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-align: inherit; }
button:disabled { cursor: default; }
h1 { font-size: 24px; line-height: 1.25; margin: 0 0 2px; font-weight: 800; }
h2 { font-size: 19px; margin: 0; font-weight: 700; }
h3 { font-size: 19px; margin: 0 0 4px; font-weight: 700; }
p { margin: 0; }

#shell { height: 100vh; height: 100dvh; display: flex; flex-direction: column; max-width: 900px; margin: 0 auto; }
#view { flex: 1; min-height: 0; }

/* ---- Layout ---- */
.screen { height: 100%; display: flex; flex-direction: column; padding-top: var(--safe-t); }
.scroll { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; display: flex; flex-direction: column; gap: 12px; }
/* Scrolling columns must not squash their children to fit. */
.scroll > * { flex-shrink: 0; }
.pad { padding: 12px 20px 24px; }
.pad-x { padding-left: 20px; padding-right: 20px; }
.pad-v { padding: 18px 0; }
.bottom { padding: 14px 20px calc(16px + var(--safe-b)); display: flex; flex-direction: column; gap: 0; }
.bottom > .row { align-self: stretch; }
.btn.outline { white-space: nowrap; }
.row { display: flex; align-items: stretch; }
.row > .grow, .grow { flex: 1; min-width: 0; }
.center-v { align-items: center; }
.center-h { justify-content: center; align-items: center; }
.top { align-items: flex-start; }
.wrap { flex-wrap: wrap; }
.gap-xs { gap: 6px; } .gap-s { gap: 8px; } .gap { gap: 12px; } .gap-l { gap: 20px; } .gap-xl { gap: 28px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.center { text-align: center; align-items: center; }
.scroll.center { align-items: stretch; }
.mt-xs { margin-top: 4px; } .mt-s { margin-top: 8px; } .mt { margin-top: 14px; }
.grid2 { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 700px) {
  .grid2 { grid-template-columns: 1fr 1fr; }
  .pad { padding: 16px 28px 28px; }
  .pad-x { padding-left: 28px; padding-right: 28px; }
}

/* ---- Text ---- */
.muted { color: var(--muted); }
.small { font-size: 14px; line-height: 20px; }
.tiny { font-size: 12px; line-height: 16px; }
.micro { font-size: 10px; line-height: 13px; }
.bold { font-weight: 700; } .semi { font-weight: 600; }
.italic { font-style: italic; }
.strike { text-decoration: line-through; }
.one-line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-title { font-size: 19px; font-weight: 700; line-height: 25px; }
.t-sub { font-size: 16px; font-weight: 600; line-height: 22px; }
.h-sm { font-size: 22px; font-weight: 700; line-height: 28px; }
.h-md { font-size: 30px; font-weight: 800; line-height: 36px; }
.huge { font-size: 60px; line-height: 1.1; }
.emo { font-size: 22px; }
.emo-l { font-size: 30px; }
.o85 { opacity: .85; }
.link { color: var(--a); font-weight: 600; padding: 4px 0; text-align: left; }

/* ---- Top bar & tabs ---- */
.topbar { display: flex; align-items: center; gap: 4px; padding: 6px 12px 6px 6px; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; }
.icon-btn:active { background: var(--line); }
#tabs { display: flex; background: #fff; border-top: 1px solid var(--line); padding: 6px 4px calc(6px + var(--safe-b)); }
#tabs[hidden] { display: none; }
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 12px; font-weight: 600; color: var(--muted); padding: 2px 0; }
.tab-ico { width: 64px; height: 32px; border-radius: 16px; display: grid; place-items: center; }
.tab.on { color: var(--ink); }
.tab.on .tab-ico { background: var(--sky-l); }

/* ---- Cards ---- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 16px; display: flex; flex-direction: column; gap: 10px; text-align: left; }
button.card { width: 100%; transition: transform .12s; }
button.card:active { transform: scale(.98); }
.card.tile { flex-direction: row; align-items: center; gap: 14px; padding: 14px; }
.card.done { border-color: rgba(60, 196, 151, .5); }
.card[style*="background"] { border-color: transparent; }
.feature { flex: 1; gap: 2px; }
.quick { flex: 1; text-align: center; font-weight: 700; padding: 16px 8px; }
.badge { display: grid; place-items: center; flex: none; }
.pill { display: inline-block; border-radius: 99px; padding: 4px 10px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.note { display: block; width: 100%; border-radius: 16px; padding: 12px; text-align: left; }
.tip { border-radius: 12px; padding: 10px; font-size: 14px; }
.hero { border-radius: 28px; padding: 22px; }
.hero-emoji { font-size: 56px; margin: 12px 0 4px; }
.big-card { border-radius: 28px; padding: 24px; margin: 16px 0 12px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.section { display: flex; align-items: center; padding-top: 8px; }
.check { color: var(--mint); font-size: 22px; font-weight: 800; }
.empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 32px; text-align: center; }
.empty .btn { max-width: 360px; }

/* Home */
.streak { background: var(--sun-l); border-radius: 99px; padding: 8px 12px; font-size: 18px; color: #9a6200; white-space: nowrap; }
.streak b { font-weight: 800; }
.freeze { margin-left: 8px; color: var(--sky); font-size: 15px; font-weight: 700; }
.goal-card { display: flex; align-items: center; gap: 16px; border-radius: 24px; padding: 18px; color: #fff; background: linear-gradient(120deg, #4fb8ec, #55d3ae); }
.quest { display: flex; align-items: center; gap: 10px; }
.quest .bar { margin-top: 4px; }
.chest { background: var(--sun); color: #6b4500; font-weight: 800; border-radius: 99px; padding: 6px 10px; white-space: nowrap; }
.today { flex-direction: row; align-items: center; padding: 18px; }
.today-emoji { background: #fff; border-radius: 24px; padding: 14px; font-size: 44px; line-height: 1; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; margin: 0 -20px; padding-left: 20px; padding-right: 20px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.cat-chip { background: #fff; border-radius: 99px; padding: 9px 14px; font-weight: 600; white-space: nowrap; }
.cat-chip.on { background: var(--a); color: #fff; }

/* ---- Progress bits ---- */
.bar { height: 10px; border-radius: 99px; overflow: hidden; width: 100%; }
.bar i { display: block; height: 100%; border-radius: 99px; transition: width .3s; }
.ring { position: relative; flex: none; }
.ring svg { display: block; }
.ring-in { position: absolute; inset: 0; display: grid; place-items: center; }
.stat { flex: 1; border-radius: 20px; padding: 14px 4px; text-align: center; }
.stat b { display: block; font-size: 24px; font-weight: 800; }
.cat-row { padding: 2px 0; }
.badges { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.badge-cell { background: #f1f4f9; border-radius: 18px; padding: 12px 4px; text-align: center; opacity: .45; }
.badge-cell.earned { background: var(--sun-l); opacity: 1; }
.settings { gap: 8px; }
.range { width: 100%; accent-color: var(--sky); }

/* ---- Buttons ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px; border-radius: 16px; padding: 0 18px; background: var(--a); color: #fff; font-weight: 600; font-size: 15px; text-align: center; }
.btn.big { width: 100%; min-height: 54px; border-radius: 18px; }
.row > .btn.big { flex: 1; }
.btn:disabled { opacity: .45; }
.btn:active:not(:disabled) { filter: brightness(.93); }
.btn.outline { background: #fff; color: var(--a); border: 1.5px solid var(--line); flex: 1; }
.btn.ghost { background: rgba(255,255,255,.18); }
.btn.text { background: none; color: var(--a); }
.btn.small-btn { min-height: 44px; }
.sel-peach { border-color: var(--peach) !important; }
.sel-mint { border-color: var(--mint) !important; }
.btn.grade { flex-direction: column; gap: 0; padding: 8px 2px; border-color: var(--g); color: var(--g); min-height: 56px; }
.say { width: var(--s); height: var(--s); flex: none; border-radius: 50%; display: grid; place-items: center; color: var(--a); background: color-mix(in srgb, var(--a) 14%, transparent); transition: transform .2s; }
.say svg { width: calc(var(--s) * .5); height: calc(var(--s) * .5); }
.say.speaking { background: var(--a); color: #fff; animation: pulse .9s ease-in-out infinite; }
.mic { width: var(--s); height: var(--s); flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--coral); color: #fff; box-shadow: 0 6px 18px rgba(242, 102, 122, .35); margin: 0 auto; }
.mic svg { width: calc(var(--s) * .45); height: calc(var(--s) * .45); }
.mic:active { transform: scale(.94); }
.mic.hang { font-size: 28px; margin: 0; }
.row .mic { margin: 0; }
.chip-toggle { border: 1px solid var(--line); border-radius: 99px; padding: 6px 12px; font-weight: 700; color: var(--muted); white-space: nowrap; font-size: 15px; }
.chip-toggle.on { background: var(--al); color: var(--a); }
.filter { border: 1px solid var(--line); border-radius: 12px; padding: 8px 4px; text-align: center; font-size: 13px; font-weight: 600; background: #fff; }
.filter.on { background: var(--sky-l); border-color: var(--sky); color: var(--ink); }
.seg { display: flex; margin: 0 20px; padding: 4px; border-radius: 99px; background: var(--al); }
.seg button { flex: 1; border-radius: 99px; padding: 10px 2px; text-align: center; font-weight: 600; color: var(--muted); font-size: 15px; }
.seg button.on { background: #fff; color: var(--a); }
@media (min-width: 700px) { .seg { margin: 0 28px; } }

@keyframes pulse { 50% { transform: scale(1.15); } }

/* iPadOS before 16.2 has no color-mix(); fall back to the light accent tint. */
@supports not (color: color-mix(in srgb, red 50%, blue)) {
  .say, .word, .prompt, .question { background: var(--al); }
  .tray { background: var(--al); border-color: var(--line); }
  .match.sel { background: var(--al); }
}

/* ---- Fields ---- */
.field { width: 100%; font: inherit; font-size: 16px; color: var(--ink); background: #fff; border: 1.5px solid var(--line); border-radius: 16px; padding: 12px 14px; resize: none; outline: none; }
.field:focus { border-color: var(--a); }
textarea.field { min-height: 48px; }

/* ---- Flashcard ---- */
.flash-wrap { min-height: 0; }
.flip { flex: 1; min-height: 280px; max-height: 560px; perspective: 1200px; cursor: pointer; margin: 12px 0 4px; }
.flip-in { position: relative; width: 100%; height: 100%; min-height: 280px; transition: transform .4s; transform-style: preserve-3d; }
.flip.flipped .flip-in { transform: rotateY(180deg); }
.face { position: absolute; inset: 0; border-radius: 28px; padding: 24px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.face.back { background: #fff; border: 1px solid var(--line); transform: rotateY(180deg); }
.word-big { font-size: 36px; font-weight: 800; line-height: 1.2; }
.word-vi { font-size: 28px; font-weight: 700; line-height: 1.25; }
.ipa { font-size: 18px; margin-top: 6px; }

/* ---- Dialogue / chat ---- */
.chat { gap: 10px; padding-top: 8px; padding-bottom: 12px; }
.bubble-row { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; animation: rise .3s ease-out; }
.bubble-row.mine { align-items: flex-end; }
.who { font-size: 12px; font-weight: 500; color: var(--muted); padding: 0 6px; }
.bubble { max-width: min(78%, 520px); background: #fff; border: 1px solid var(--line); border-radius: 20px 20px 20px 6px; padding: 12px 14px; }
.mine .bubble { background: var(--al); border-radius: 20px 20px 6px 20px; }
.bubble.speaking { border: 2px solid var(--a); }
.bubble.awaiting { border: 2px solid var(--coral); }
.mine-bg { background: var(--sky-l) !important; border-color: transparent !important; }
.scored b { font-weight: 600; }
.scored .ok { color: var(--mint); }
.scored .bad { color: var(--coral); }
.stars { font-size: 34px; margin-top: 4px; }
.typing { align-self: flex-start; color: var(--muted); font-size: 20px; animation: blink 1.2s ease-in-out infinite; }
.fix { max-width: min(78%, 520px); background: var(--mint-l); border-radius: 16px; padding: 12px; }
.err { background: var(--coral-l); border-radius: 18px; padding: 14px; }
.suggest { display: flex; gap: 8px; overflow-x: auto; padding: 4px 16px; align-items: center; scrollbar-width: none; }
.suggest::-webkit-scrollbar { display: none; }
.sugg { background: var(--sky-l); border-radius: 99px; padding: 8px 12px; font-size: 14px; white-space: nowrap; }
.composer { display: flex; align-items: flex-end; gap: 10px; padding: 10px 12px calc(10px + var(--safe-b)); }
.composer .field { border-radius: 22px; max-height: 120px; }
.send { width: 48px; height: 48px; border-radius: 50%; background: var(--sky); color: #fff; display: grid; place-items: center; flex: none; }
.send:disabled { opacity: .4; }
.call { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 16px 24px calc(20px + var(--safe-b)); gap: 6px; min-height: 0; }
.avatar { width: 170px; height: 170px; border-radius: 50%; display: grid; place-items: center; font-size: 72px; background: linear-gradient(135deg, var(--sky-l), var(--mint-l)); margin-bottom: 8px; }
.avatar.speaking { animation: pulse 1.4s ease-in-out infinite; }
.call-body { flex: 1; width: 100%; max-width: 560px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; align-items: center; padding: 12px 0; }
.call-body .fix, .call-body .bubble { max-width: 100%; width: 100%; }

/* Stories */
.story-line { display: flex; flex-direction: column; gap: 2px; animation: rise .3s ease-out; }
.story-line .bubble { max-width: 100%; border-radius: 18px; }
.narration { padding: 4px; }
.question { background: color-mix(in srgb, var(--a) 8%, transparent); border-radius: 20px; padding: 16px; display: flex; flex-direction: column; gap: 8px; animation: rise .3s ease-out; }

/* ---- Games ---- */
.round { gap: 14px; }
.prompt { border-radius: 22px; padding: 20px; background: color-mix(in srgb, var(--a) 10%, transparent); font-size: 19px; font-weight: 700; text-align: center; }
.option { width: 100%; min-height: 56px; border-radius: 18px; background: #fff; border: 2px solid var(--line); padding: 14px 16px; font-weight: 600; text-align: left; transition: background .2s; }
.option.right { background: var(--mint-l); border-color: var(--mint); }
.option.wrong { background: var(--coral-l); border-color: var(--coral); }
.option:disabled { color: var(--ink); }
.small-opt { min-height: 48px; padding: 12px; border-width: 1.5px; font-weight: 400; border-radius: 14px; }
.pair-opt { text-align: center; font-size: 24px; font-weight: 700; min-height: 72px; border-radius: 20px; }
.pair { padding: 4px 0; }
.answer { border-radius: 20px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.answer.ok { background: var(--mint-l); }
.answer.bad { background: var(--coral-l); }
.answer-title { font-weight: 800; font-size: 18px; }
.answer.ok .answer-title { color: var(--mint); }
.answer.bad .answer-title { color: var(--coral); }
.match { width: 100%; min-height: 56px; border-radius: 16px; background: #fff; border: 2px solid var(--line); padding: 14px 10px; font-weight: 600; text-align: center; transition: background .2s; }
.match.sel { border-color: var(--a); background: color-mix(in srgb, var(--a) 15%, #fff); }
.match.solved { border-color: var(--mint); background: var(--mint-l); color: var(--mint); }
.match.wrong { border-color: var(--coral); background: var(--coral-l); }
.shake { animation: shake .4s; }
.tray { min-height: 120px; border-radius: 20px; background: color-mix(in srgb, var(--a) 8%, transparent); border: 2px solid color-mix(in srgb, var(--a) 30%, transparent); padding: 12px; display: flex; flex-wrap: wrap; gap: 8px; align-content: flex-start; }
.tiles { display: flex; flex-wrap: wrap; gap: 8px; }
.word { border-radius: 14px; background: color-mix(in srgb, var(--a) 12%, transparent); padding: 10px 14px; font-weight: 600; border: 1.5px solid transparent; }
.word.filled { background: #fff; border-color: var(--a); }
.combo { color: var(--peach); font-weight: 800; padding-right: 8px; }
.review-card { flex: 1; margin: 20px; border-radius: 28px; background: var(--lavender-l); padding: 24px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.sounds { margin-top: 8px; background: var(--sun-l); border-radius: 12px; padding: 6px 12px; font-weight: 600; }

@keyframes shake { 20% { transform: translateX(14px); } 40% { transform: translateX(-14px); } 60% { transform: translateX(8px); } 80% { transform: translateX(-8px); } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes blink { 50% { opacity: .3; } }

/* ---- Overlays ---- */
.dialog-back, .listen-sheet { position: fixed; inset: 0; background: rgba(20, 28, 48, .45); display: grid; place-items: center; padding: 24px; z-index: 50; animation: fade .2s; }
.dialog { width: 100%; max-width: 400px; background: #fff; border-radius: 28px; padding: 24px; display: flex; flex-direction: column; gap: 12px; text-align: center; animation: pop .25s ease-out; }
.dialog-icon { font-size: 44px; }
.dialog-title { font-size: 21px; font-weight: 700; }
.dialog-body { display: flex; flex-direction: column; gap: 12px; }
.dialog-body .field { text-align: left; }
.dialog-btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.listen-sheet { align-items: end; padding: 0; }
.listen-card { width: 100%; max-width: 560px; margin: 0 auto; background: var(--ink); color: #fff; border-radius: 28px 28px 0 0; padding: 28px 24px calc(24px + var(--safe-b)); display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; animation: up .25s ease-out; }
.listen-orb { width: 84px; height: 84px; border-radius: 50%; background: var(--coral); display: grid; place-items: center; font-size: 36px; animation: pulse 1.1s ease-in-out infinite; }
.listen-prompt { font-size: 18px; font-weight: 700; }
.listen-heard { opacity: .8; min-height: 24px; }
.listen-card .row { width: 100%; }
.listen-card .btn { flex: 1; }
.toast { position: fixed; left: 50%; bottom: calc(90px + var(--safe-b)); transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 16px; max-width: min(92vw, 520px); z-index: 60; font-size: 14px; text-align: center; transition: opacity .4s; animation: fade .2s; }
.toast.out { opacity: 0; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: scale(.92); opacity: 0; } }
@keyframes up { from { transform: translateY(40px); } }

/* ---- Vocabulary ---- */
.tiles4 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (min-width: 700px) { .tiles4 { grid-template-columns: repeat(4, 1fr); } }
.word-row { gap: 6px; padding: 12px 14px; }
.pos { font-size: 11px; font-weight: 700; color: var(--muted); background: var(--line); border-radius: 6px; padding: 1px 6px; }
.tick { width: 38px; height: 38px; border-radius: 50%; border: 2px solid var(--line); color: var(--line); font-weight: 800; flex: none; }
.tick.on { background: var(--mint); border-color: var(--mint); color: #fff; }
.hits { display: flex; flex-direction: column; gap: 10px; }
input[type=search].field { -webkit-appearance: none; }

/* ---- News ---- */
.news-head { padding-top: 12px; display: flex; flex-direction: column; gap: 2px; }
.news-head .chips { margin: 8px -20px 0; }
.news-card { flex-direction: row; gap: 12px; align-items: flex-start; }
.news-img { width: 96px; height: 64px; object-fit: cover; border-radius: 12px; flex: none; background: var(--line); }
.reader { gap: 14px; }
.article-title { font-size: 24px; line-height: 1.3; font-weight: 800; margin: 4px 0 0; }
.para { display: flex; flex-direction: column; gap: 4px; }
.reading { font-size: 18px; line-height: 1.65; margin: 0; }
.para-vi { margin: 0; color: var(--coral); font-size: 16px; line-height: 1.55; border-left: 3px solid var(--coral-l); padding-left: 10px; }
.w { cursor: pointer; border-radius: 4px; }
.w:active, .w:hover { background: var(--sun-l); }
a.btn { text-decoration: none; }
@media (min-width: 700px) { .reader { max-width: 720px; margin: 0 auto; width: 100%; } .reading { font-size: 19px; } }

/* Word sheet */
.sheet-back { position: fixed; inset: 0; background: rgba(20, 28, 48, .35); z-index: 55; display: flex; align-items: flex-end; animation: fade .2s; }
.sheet { width: 100%; max-width: 560px; margin: 0 auto; background: #fff; border-radius: 28px 28px 0 0; padding: 12px 20px calc(20px + var(--safe-b)); display: flex; flex-direction: column; gap: 12px; animation: up .25s ease-out; }
.sheet-grip { width: 44px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 4px; }
.sheet .word-big { font-size: 30px; }

/* Word status in the reader: new words stand out, words in review are tinted, known words are plain. */
.w.new { box-shadow: inset 0 -2px 0 rgba(43, 159, 219, .55); }
.w.learning { background: var(--sun-l); box-shadow: inset 0 -2px 0 rgba(255, 194, 61, .6); }
.legend .w { padding: 2px 8px; font-size: 13px; font-weight: 600; cursor: default; }
.legend .w.known { border: 1px solid var(--line); }
.known-card { gap: 10px; }
.known-pct { width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; font-size: 22px; font-weight: 800; color: var(--mint); background: var(--mint-l); flex: none; }

/* ---- Shadowing ---- */
.hint-pill { display: inline-block; background: #fff; color: var(--a); border-radius: 99px; padding: 6px 12px; font-weight: 600; font-size: 14px; }
.mic { font-size: calc(var(--s) * .38); }
.mic.recording { animation: pulse 1s ease-in-out infinite; background: var(--ink); }
.mic:disabled { opacity: .4; }
.rec-time { font-variant-numeric: tabular-nums; font-weight: 700; }
canvas.wave { width: 100%; height: 110px; display: block; background: var(--canvas); border-radius: 14px; --wave: #9ad3f2; --pitch: #f2667a; }
.voices { display: flex; flex-direction: column; gap: 6px; max-height: 360px; overflow-y: auto; }
.voice-row { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 14px; padding: 8px 10px; }
.voice-row.on { border-color: var(--sky); background: var(--sky-l); }
.voice-pick { text-align: left; }
.reading.speaking, .article-title.speaking { background: var(--sky-l); border-radius: 10px; box-shadow: 0 0 0 6px var(--sky-l); transition: background .3s; }

/* Banner for in-app browsers (Zalo, Facebook…) */
.inapp { display: flex; align-items: center; gap: 8px; background: var(--ink); color: #fff; padding: calc(8px + var(--safe-t)) 12px 8px; font-size: 14px; }
.inapp span { flex: 1; }
.inapp .btn { min-height: 36px; padding: 0 12px; font-size: 13px; --a: var(--mint); flex: none; }
.inapp [data-x=close] { width: 32px; height: 32px; flex: none; opacity: .8; }
.inapp ~ #view .screen { padding-top: 0; }
.chips.sections { margin-top: 6px; }
.sec-chip { border-radius: 99px; padding: 6px 12px; font-weight: 600; font-size: 14px; white-space: nowrap; color: var(--muted); border: 1px solid var(--line); background: #fff; }
.sec-chip.on { color: var(--a); border-color: var(--a); background: var(--al); }
.listen-help { background: rgba(255,255,255,.08); border-radius: 14px; padding: 12px; text-align: left; font-size: 14px; line-height: 1.55; width: 100%; }
.listen-orb.off { animation: none; background: var(--muted); }
/* `hidden` must win over component display rules such as .btn { display: inline-flex }. */
[hidden] { display: none !important; }

/* ---- Compact home & learning path ---- */
.goal-card.compact { padding: 14px 16px; gap: 14px; border-radius: 20px; }
.next-card { gap: 8px; border: 2px solid var(--al); background: #fff; }
.next-card .go { background: var(--a); color: #fff; border-radius: 99px; padding: 8px 14px; font-weight: 700; font-size: 14px; white-space: nowrap; }
.shortcuts { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.shortcut { position: relative; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 10px 2px 8px; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 12px; font-weight: 600; text-align: center; }
.shortcut:active { transform: scale(.96); }
.shortcut .due { position: absolute; top: 4px; right: 6px; background: var(--coral); color: #fff; font-style: normal; font-size: 10px; font-weight: 800; border-radius: 99px; padding: 1px 5px; }
.quests { padding: 12px 16px; gap: 8px; }
.quest-head { width: 100%; text-align: left; }
.chest-dot { animation: pulse 1.2s ease-in-out infinite; }
.home-seg { margin: 4px 0 0; }
.stage { padding: 0; gap: 0; overflow: hidden; }
.stage.current { border: 2px solid var(--a); }
.stage-head { display: flex; align-items: center; gap: 12px; padding: 14px; width: 100%; text-align: left; }
.stage-no { width: 36px; height: 36px; border-radius: 12px; background: var(--al); color: var(--a); font-weight: 800; display: grid; place-items: center; flex: none; }
.stage-topics { border-top: 1px solid var(--line); display: flex; flex-direction: column; }
.path-topic { display: flex; align-items: center; gap: 12px; padding: 10px 14px; text-align: left; width: 100%; }
.path-topic + .path-topic { border-top: 1px solid var(--line); }
.path-topic:active { background: var(--canvas); }
.dots { display: flex; gap: 3px; flex: none; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.dots i.on { background: var(--a); }
.wrap { flex-wrap: wrap; }
@media (min-width: 700px) { .shortcut { font-size: 13px; padding: 12px 4px; } }

/* ---- Picture books ---- */
.books { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 700px) { .books { grid-template-columns: repeat(4, 1fr); } }
.book { background: #fff; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; text-align: left; display: flex; flex-direction: column; }
.book img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--mint-l); display: block; }
.book-info { padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 2px; }
.book:active { transform: scale(.98); }
.book-page { gap: 14px; }
.page-img { width: 100%; max-height: 45vh; object-fit: contain; border-radius: 18px; background: var(--mint-l); }
.page-en { font-size: 21px; line-height: 1.6; font-weight: 500; margin: 0; }
.page-dots { display: flex; justify-content: center; gap: 4px; flex-wrap: wrap; margin-bottom: 10px; }
.page-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.page-dots i.past { background: var(--mint-l); }
.page-dots i.on { background: var(--mint); width: 18px; border-radius: 4px; }
.credits { gap: 12px; }
@media (min-width: 700px) { .book-page { max-width: 760px; margin: 0 auto; width: 100%; } .page-en { font-size: 24px; } }
.no-cover { aspect-ratio: 4 / 3; display: grid; place-items: center; font-size: 44px; background: var(--mint-l); }
.typing-row { display: flex; align-items: center; gap: 10px; }

/* ---- Videos ---- */
@media (max-width: 400px) { .shortcut { font-size: 11px; padding: 8px 0 6px; } .shortcut .emo { font-size: 20px; } }
.videos { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 700px) { .videos { grid-template-columns: repeat(3, 1fr); } }
.video-card { display: flex; flex-direction: column; gap: 6px; text-align: left; }
.thumb { position: relative; border-radius: 14px; overflow: hidden; aspect-ratio: 16 / 9; background: var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .play { position: absolute; inset: auto 8px 8px auto; background: rgba(0,0,0,.65); color: #fff; border-radius: 99px; padding: 2px 9px; font-size: 12px; }
.thumb .seen { position: absolute; top: 6px; right: 6px; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.player { position: relative; aspect-ratio: 16 / 9; border-radius: 16px; overflow: hidden; background: #000; }
.player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
@media (min-width: 700px) { .video-page { max-width: 820px; margin: 0 auto; width: 100%; } }
.card-nav { align-items: center; margin-bottom: 10px; }
.card-nav .btn { flex: none; min-height: 40px; padding: 0 12px; font-size: 14px; }
.review-card { cursor: pointer; }

/* ---- Vocabulary challenges ---- */
.timebar { height: 12px; border-radius: 99px; background: var(--line); overflow: hidden; }
.timebar i { display: block; height: 100%; background: var(--a); border-radius: 99px; transition: width .1s linear; }
.time-left { font-variant-numeric: tabular-nums; min-width: 40px; text-align: right; }
.tf-meaning { font-size: 24px; font-weight: 700; color: var(--a); }
.btn.tf { font-size: 18px; }
.memory { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (min-width: 700px) { .memory { grid-template-columns: repeat(4, 1fr); } }
.mem-card { aspect-ratio: 4 / 3; border-radius: 16px; background: var(--lavender); color: #fff; font-size: 28px; font-weight: 800; display: grid; place-items: center; padding: 6px; transition: transform .2s; }
.mem-card.up { background: #fff; color: var(--ink); border: 2px solid var(--lavender); font-size: 15px; font-weight: 700; text-align: center; transform: rotateY(0); }
.mem-card.up.vi { color: var(--lavender); }
.mem-card.done { border-color: var(--mint); background: var(--mint-l); }
.mem-card:disabled { opacity: 1; }
.lives { font-size: 22px; letter-spacing: 2px; }
.mask { font-size: 34px; font-weight: 800; letter-spacing: 4px; font-family: ui-monospace, Menlo, Consolas, monospace; }
.keys { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.key { min-height: 44px; border-radius: 12px; background: #fff; border: 1.5px solid var(--line); font-size: 18px; font-weight: 700; text-transform: uppercase; }
.key.hit { background: var(--mint-l); border-color: var(--mint); color: var(--mint); }
.key.miss { background: var(--coral-l); border-color: var(--coral); color: var(--coral); }

/* ---- Study plan: calendar, warnings, word challenges ---- */
.heatmap { display: grid; grid-template-rows: repeat(7, 18px); grid-auto-flow: column; grid-auto-columns: 18px; gap: 4px; justify-content: center; }
.heatmap i, .hm { display: block; border-radius: 4px; background: var(--line); }
.hm { height: 10px; }
.hm { display: inline-block; width: 10px; margin: 0 1px; vertical-align: middle; }
.heatmap .h1, .hm.h1 { background: color-mix(in srgb, var(--mint) 30%, var(--line)); }
.heatmap .h2, .hm.h2 { background: color-mix(in srgb, var(--mint) 55%, var(--line)); }
.heatmap .h3, .hm.h3 { background: color-mix(in srgb, var(--mint) 80%, var(--line)); }
.heatmap .h4, .hm.h4 { background: var(--mint); }
.heatmap .today { outline: 2px solid var(--peach); outline-offset: 1px; }
.note.warn { background: var(--peach-l); border: 1.5px solid var(--peach); }
.placement-card .emo-l { font-size: 34px; }
.prompt.cloze { font-size: 20px; line-height: 1.5; }
.letters { justify-content: center; }
.word.letter { min-width: 46px; font-size: 22px; font-weight: 800; text-transform: lowercase; }
.field.spell { font-size: 22px; text-align: center; margin: 12px 0; }
.field.time { width: auto; flex: 0 0 auto; }
.diag { width: 100%; font-size: 12px; border-collapse: collapse; margin-top: 8px; text-align: left; }
.diag td { padding: 4px 6px; border-top: 1px solid var(--line); vertical-align: top; word-break: break-word; }
.check-list { text-align: left; padding-left: 18px; margin: 6px 0; }
