/* TalkReady Canada — adult, calm, high-contrast. Touch targets ≥ 56px. */
:root {
  --bg: #f6f4ef; --surface: #fff; --ink: #14213d; --ink-2: #3d4a63; --muted: #66708a;
  --line: #e3e0d8; --brand: #14213d; --accent: #d62828; --accent-ink: #fff;
  --good: #1f7a4d; --good-bg: #e3f4ea; --try: #9a5b00; --try-bg: #fdf0dc;
  --focus: #2b6cb0; --radius: 20px; --tap: 56px;
  --shadow: 0 1px 2px rgba(20,33,61,.06), 0 6px 18px rgba(20,33,61,.06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 19px/1.45 var(--font); min-height: 100vh; -webkit-tap-highlight-color: transparent; }
h1, h2, h3 { line-height: 1.2; margin: .2em 0 .5em; letter-spacing: -.01em; }
h1 { font-size: 1.75rem; } h2 { font-size: 1.4rem; } h3 { font-size: 1.1rem; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.vi { display: block; font-size: .78em; font-weight: 400; color: var(--muted); letter-spacing: 0; }
.muted { color: var(--ink-2); } .tiny { font-size: .82rem; } .center { text-align: center; }

/* Top bar and tabs */
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 8px; min-height: 60px; padding: env(safe-area-inset-top, 0) 12px 0; background: var(--bg); border-bottom: 1px solid var(--line); }
.brand { font-weight: 800; font-size: 1.1rem; display: flex; align-items: center; gap: 6px; }
.brand-sub { font-weight: 500; color: var(--accent); }
.icon-btn { min-width: var(--tap); min-height: var(--tap); border: 0; background: transparent; font-size: 1.8rem; line-height: 1; border-radius: 16px; cursor: pointer; color: var(--ink); }
.icon-btn:active { background: var(--line); }
.view { max-width: 560px; margin: 0 auto; padding: 16px 16px calc(110px + var(--safe-b)); }
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: grid; grid-template-columns: repeat(4, 1fr); background: var(--surface); border-top: 1px solid var(--line); padding-bottom: var(--safe-b); }
.tabs a { min-height: 64px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-decoration: none; color: var(--muted); font-size: .8rem; font-weight: 600; }
.tabs a span[aria-hidden] { font-size: 1.35rem; }
.tabs a .vi { font-size: .68rem; }
.tabs a.on { color: var(--ink); } .tabs a.on .vi { color: var(--ink-2); }
body.in-lesson .tabs, body.no-tabs .tabs, body.in-lesson .top { display: none; }
body.in-lesson .view { padding-top: 0; }

/* Buttons */
.btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: var(--tap); padding: 12px 18px; margin: 10px 0; border-radius: var(--radius); border: 2px solid transparent; font-weight: 700; font-size: 1.1rem; text-align: center; cursor: pointer; transition: transform .08s, background .15s; }
.btn:active { transform: scale(.98); }
.btn .vi { font-size: .78rem; }
.btn.primary { background: var(--accent); color: var(--accent-ink); min-height: 64px; box-shadow: 0 4px 12px rgba(214,40,40,.25); }
.btn.primary .vi { color: rgba(255,255,255,.85); }
.btn.secondary { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn.danger { background: transparent; border-color: #e8b4b4; color: var(--accent); }
.btn.listen { width: auto; min-width: var(--tap); flex: 1; margin: 0; background: #eef1f7; color: var(--ink); font-size: 1.05rem; }
.btn.listen span { font-size: .9rem; font-weight: 700; }
.btn-ico { font-size: 1.3em; }
.btn.sticky { position: sticky; bottom: calc(14px + var(--safe-b)); margin-top: 20px; z-index: 5; }
.btn.mic { min-height: 88px; font-size: 1.25rem; }
.btn.mic.listening, .btn.recording { background: var(--ink); box-shadow: 0 0 0 6px rgba(214,40,40,.25); }
.pulse { animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.link { display: block; width: 100%; min-height: var(--tap); background: none; border: 0; color: var(--focus); font-weight: 600; text-decoration: underline; cursor: pointer; padding: 8px; }
.link .vi { color: var(--muted); text-decoration: none; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; } .row2 .btn { margin: 6px 0; }
.play-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.listen-row { display: flex; gap: 10px; margin-top: 14px; }
.grades { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; } .grades .btn { margin: 4px 0; padding: 10px 6px; }

/* Cards */
.card { background: var(--surface); border-radius: var(--radius); padding: 18px; margin: 12px 0; box-shadow: var(--shadow); }
.card .label { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 6px; }
.card .en { font-weight: 600; }
.phrase .num { font-size: .85rem; font-weight: 700; color: var(--muted); }
.big-en { font-size: 1.45rem; font-weight: 700; line-height: 1.3; }
.phrase .vi { font-size: 1.02rem; margin-top: 6px; }
.phrase.hero { padding: 26px 20px; } .phrase.hero .big-en { font-size: 1.7rem; }
.prompt-vi { font-size: 1.35rem; font-weight: 600; text-align: center; padding: 24px 18px; color: var(--ink); background: #fffaf0; border: 2px dashed #ead9b8; box-shadow: none; }
.cando { border-left: 6px solid var(--good); }
.goal { border-left: 6px solid var(--accent); } .goal.done { border-left-color: var(--good); }
.hint { background: #fffaf0; box-shadow: none; border: 1px solid #ead9b8; }
.note { border-left: 6px solid var(--accent); }
.counter { font-size: .9rem; font-weight: 700; color: var(--muted); margin: 6px 0; }
.eyebrow { font-size: .8rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); }
.section-h { margin-top: 28px; }
.big-emoji { font-size: 4rem; text-align: center; margin: 18px 0 4px; }
.center-screen { text-align: center; padding-top: 10vh; }
.screen > h1:first-child { margin-top: 8px; }

/* Lesson */
.lesson-top { position: sticky; top: 0; z-index: 6; display: flex; align-items: center; gap: 10px; padding: calc(6px + env(safe-area-inset-top, 0px)) 0 8px; background: var(--bg); }
.lesson-meta { flex: 1; }
.bar { height: 10px; background: var(--line); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--good); border-radius: 99px; transition: width .3s; }
.step-name { font-size: .9rem; font-weight: 700; margin-top: 6px; } .step-name .vi { display: inline; margin-left: 6px; }
.chat { display: flex; flex-direction: column; gap: 10px; margin: 16px 0; }
.bubble { display: block; text-align: left; max-width: 88%; padding: 14px 16px; border-radius: 22px; border: 2px solid transparent; background: var(--surface); box-shadow: var(--shadow); cursor: pointer; min-height: var(--tap); }
.bubble.other { align-self: flex-start; border-bottom-left-radius: 6px; }
.bubble.you { align-self: flex-end; background: #e8eef9; border-bottom-right-radius: 6px; }
.bubble.static { max-width: 100%; cursor: default; margin: 12px 0; }
.bubble.active { border-color: var(--accent); }
.bubble .who { display: block; font-size: .75rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.bubble .line { display: block; font-size: 1.2rem; font-weight: 600; margin-top: 4px; }
.bubble .vi { font-size: .95rem; }
.options { display: flex; flex-direction: column; gap: 10px; margin: 16px 0; }
.option { min-height: 64px; padding: 14px 16px; border-radius: var(--radius); border: 2px solid var(--line); background: var(--surface); text-align: left; font-size: 1.15rem; font-weight: 600; cursor: pointer; }
.option.correct { border-color: var(--good); background: var(--good-bg); }
.option.wrong { border-color: var(--accent); background: #fde8e8; }
.option:disabled { color: var(--ink); opacity: 1; }
.play-big { min-height: 72px; }
.feedback { padding: 12px 16px; border-radius: 16px; font-weight: 700; background: #eef1f7; }
.feedback.good { background: var(--good-bg); color: var(--good); }
.feedback.try { background: var(--try-bg); color: var(--try); }
.model { font-size: 1.3rem; font-weight: 700; text-align: center; }
.answer-line { min-height: 84px; display: flex; flex-wrap: wrap; gap: 8px; align-content: flex-start; padding: 12px; border-radius: var(--radius); border: 2px dashed var(--line); background: var(--surface); margin: 14px 0; }
.answer-line.right { border: 2px solid var(--good); background: var(--good-bg); }
.answer-line.wrong { border: 2px solid var(--accent); }
.placeholder { color: var(--muted); font-size: .95rem; }
.tiles { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.tile { min-height: var(--tap); min-width: var(--tap); padding: 8px 16px; border-radius: 16px; border: 2px solid var(--line); background: var(--surface); font-size: 1.2rem; font-weight: 700; cursor: pointer; box-shadow: 0 2px 0 var(--line); }
.tile.placed { background: #e8eef9; border-color: #c9d5ec; }
.tile:disabled { visibility: hidden; }
.actions { margin-top: 10px; }
.finish, .rp-intro { text-align: center; } .finish .card, .rp-intro .card { text-align: left; }

/* Speak check */
.speak { margin-top: 14px; }
.heard { background: #eef1f7; border-radius: 16px; padding: 14px 16px; margin: 12px 0; }
.heard-label { font-size: .85rem; font-weight: 700; color: var(--muted); }
.heard-text { font-size: 1.25rem; font-weight: 600; margin-top: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.chip { padding: 6px 12px; border-radius: 99px; font-weight: 700; font-size: .95rem; }
.chip.ok { background: var(--good-bg); color: var(--good); }
.chip.miss { background: #eceef2; color: var(--muted); text-decoration: line-through; }
.note-line { color: var(--try); font-weight: 600; }

/* SOS */
.sos-card { background: #fff5f5; border: 3px solid var(--accent); border-radius: 24px; padding: 14px; margin: 10px 0; }
.sos-head { font-size: 1.3rem; font-weight: 800; color: var(--accent); padding: 4px 6px 8px; }
.sos-card .card { margin: 10px 0; }

/* Home */
.today-card, .next-card { background: var(--surface); border-radius: 24px; padding: 20px; margin: 8px 0 14px; box-shadow: var(--shadow); }
.today-card { display: grid; grid-template-columns: 120px 1fr; gap: 16px; align-items: center; }
.ring-wrap { position: relative; width: 120px; height: 120px; }
.ring { width: 120px; height: 120px; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 12; }
.ring-bg { stroke: var(--line); } .ring-fg { stroke: var(--good); stroke-linecap: round; transition: stroke-dashoffset .5s; }
.ring-label { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 1rem; }
.ring-label b { font-size: 1.8rem; line-height: 1; }
.today-text h2 { font-size: 1.15rem; margin: 0 0 8px; }
.streak, .freeze { font-size: 1rem; } .streak .vi, .freeze .vi { display: inline; margin-left: 4px; }
.week { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; margin: 8px 0; }
.day .dn { display: block; font-size: .75rem; color: var(--muted); font-weight: 700; }
.day .dot { display: flex; align-items: center; justify-content: center; width: 34px; height: 34px; margin: 4px auto 0; border-radius: 50%; background: var(--line); font-size: .9rem; font-weight: 800; }
.day.done .dot { background: var(--good); color: #fff; }
.day.frozen .dot { background: #d7e7f7; }
.day.partial .dot { background: #cfe7da; }
.day.now .dot { box-shadow: 0 0 0 3px var(--ink); }
.next-icon { font-size: 2.6rem; }
.next-card h2 { margin: 4px 0 6px; }

/* Packs */
.pack-list { display: flex; flex-direction: column; gap: 10px; }
.pack-item { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 76px; padding: 12px 16px; border: 0; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); text-align: left; cursor: pointer; }
.pack-item.small { min-height: 64px; }
.pack-ico { font-size: 2rem; width: 48px; text-align: center; flex: none; }
.pack-ico.big { font-size: 3rem; width: auto; }
.pack-txt { flex: 1; display: flex; flex-direction: column; } .pack-txt b { font-size: 1.1rem; }
.tags { display: flex; gap: 6px; margin-top: 6px; }
.tag { font-size: .72rem; font-weight: 700; padding: 3px 9px; border-radius: 99px; background: #e8eef9; } .tag .vi { display: inline; margin-left: 4px; font-size: 1em; }
.tag.soft { background: #f1efe9; } .tag.ok { background: var(--good-bg); color: var(--good); }
.chev { font-size: 1.8rem; color: var(--muted); } .tick { font-size: 1.3rem; color: var(--good); font-weight: 800; }
.pack-hero { display: flex; align-items: center; gap: 14px; }
.pb-item { position: relative; } .pb-item .card { padding-right: 76px; }
.add-srs { position: absolute; top: 14px; right: 14px; width: var(--tap); height: var(--tap); border-radius: 50%; border: 2px solid var(--line); background: var(--surface); font-size: 1.5rem; font-weight: 800; cursor: pointer; }
.add-srs.on { background: var(--good); border-color: var(--good); color: #fff; }

/* Onboarding + goal */
.hook h1 { font-size: 1.9rem; }
.goal-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 12px 0; }
.goal-opt { min-height: 84px; border-radius: var(--radius); border: 2px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 600; }
.goal-opt b { display: block; font-size: 1.7rem; }
.goal-opt.on { border-color: var(--ink); background: var(--ink); color: #fff; } .goal-opt.on .vi { color: #c9d1e3; }

/* Me */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: var(--surface); border-radius: 18px; padding: 12px 8px; text-align: center; box-shadow: var(--shadow); font-size: .82rem; font-weight: 600; }
.stat b { display: block; font-size: 1.6rem; } .stat-ico { font-size: 1.3rem; }
.toggle { display: flex; align-items: center; gap: 14px; min-height: var(--tap); background: var(--surface); padding: 10px 16px; border-radius: var(--radius); font-weight: 600; cursor: pointer; }
.toggle input { width: 28px; height: 28px; accent-color: var(--good); }

.toast { position: fixed; left: 50%; bottom: calc(90px + var(--safe-b)); transform: translateX(-50%); z-index: 50; background: var(--ink); color: #fff; padding: 14px 22px; border-radius: 99px; font-weight: 700; box-shadow: var(--shadow); text-align: center; }
.toast .vi { color: #c9d1e3; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media (min-width: 700px) { body { font-size: 20px; } }

/* Characters */
.char { display: flex; align-items: center; gap: 12px; margin: 8px 0; }
.char-art { flex: none; width: 112px; height: 112px; border-radius: 50%; background: radial-gradient(circle at 50% 40%, #fff 0, #e9edf5 70%); overflow: hidden; box-shadow: var(--shadow); }
.char-art svg { width: 100%; height: 100%; display: block; }
.char.lg .char-art { width: 168px; height: 168px; }
.char.sm .char-art { width: 64px; height: 64px; }
.char.center { flex-direction: column; text-align: center; }
.char-name { font-weight: 700; } .char-name .vi { font-weight: 500; }
.char-say { position: relative; background: var(--surface); border-radius: 18px; padding: 12px 14px; box-shadow: var(--shadow); font-weight: 600; flex: 1; }
.char-say::before { content: ""; position: absolute; left: -8px; top: 50%; margin-top: -8px; border: 8px solid transparent; border-left: 0; border-right-color: var(--surface); }
.char.center .char-say::before { left: 50%; top: -8px; margin: 0 0 0 -8px; border: 8px solid transparent; border-top: 0; border-bottom-color: var(--surface); }
.char.bump .char-art { animation: bump .35s ease; }
@keyframes bump { 40% { transform: scale(1.06) rotate(-2deg); } }
.scene { display: flex; justify-content: center; margin: 4px 0 0; }
.fb ul { margin: 6px 0 0; padding-left: 20px; } .fb li { margin: 8px 0; }
.fb li b { display: block; font-size: 1.1rem; } .fb .listen-row { margin-top: 8px; }
.good-list { border-left: 6px solid var(--good); } .practice-list { border-left: 6px solid #e0a100; }

/* Landing + dashboard */
.landing .hero h1 { font-size: 2rem; line-height: 1.15; margin: 8px 0 12px; }
.landing .hero .vi { font-size: .62em; margin-top: 6px; }
.landing .hero .char-say .vi, .dash .char-say .vi { font-size: .8em; }
.ticks { list-style: none; padding: 0; margin: 0; } .ticks li { padding: 8px 0 8px 32px; position: relative; }
.ticks li::before { content: "✓"; position: absolute; left: 4px; top: 8px; color: var(--good); font-weight: 800; }
.steps { padding-left: 22px; margin: 0; } .steps li { margin: 10px 0; } .steps b { display: inline; }
.steps b .vi { display: inline; } .steps b .vi::before { content: " · "; }
.cast { display: flex; justify-content: space-between; gap: 6px; }
.cast-face { width: 19%; aspect-ratio: 1; border-radius: 50%; overflow: hidden; background: #e9edf5; }
.cast-face svg { width: 100%; height: 100%; display: block; }
.sit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sit { display: flex; gap: 8px; align-items: flex-start; font-weight: 600; font-size: .95rem; line-height: 1.25; } .sit .vi { margin-top: 2px; } .sit > span:first-child { font-size: 1.5rem; }
.trust p { margin: 0; }
.pbar { display: block; height: 10px; background: #e9edf5; border-radius: 99px; overflow: hidden; margin: 10px 0 4px; }
.pbar > span { display: block; height: 100%; background: var(--good); border-radius: 99px; }
.pbar.thin { height: 6px; margin: 6px 0 0; }
.pack-txt { flex: 1; min-width: 0; }
