/* English Saathi - student app styles. System fonts only: nothing extra to download. */
:root {
  --bg: #F6F3EC;
  --card: #FFFFFF;
  --line: #E4DED2;
  --line-soft: #EFEBE3;
  --ink: #1D2B36;
  --muted: #5A6670;
  --accent: #0E6B5E;
  --accent-ink: #0B5247;
  --accent-soft: #E3F1EC;
  --warn-soft: #FBEBD3;
  --warn-ink: #7A4306;
  --bad-soft: #FBE9E7;
  --bad-ink: #8A2A1B;
  --soft: #F1EEE7;
  --dark: #1D2B36;
  --radius: 16px;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Devanagari", sans-serif;
  --serif: ui-serif, Georgia, "Noto Serif", "Times New Roman", serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--sans); }
[lang="hi"] { line-height: 1.7; }
a { color: var(--accent); }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #F2B84B; outline-offset: 2px; }

/* ---------- Shell ---------- */
.shell { min-height: 100vh; min-height: 100dvh; }
.page { max-width: 720px; margin: 0 auto; padding: 16px 16px calc(96px + env(safe-area-inset-bottom)); outline: none; }
.shell.bare .page { padding-bottom: 32px; }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--card); border-top: 1px solid var(--line);
  padding: 4px 4px calc(6px + env(safe-area-inset-bottom));
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 52px; text-decoration: none; color: var(--muted); font-size: 12px; border-radius: 12px;
}
.tab[aria-current="page"] { color: var(--accent); font-weight: 600; }
.sidebar { display: none; }
.ic { display: inline-flex; flex: none; }
.ic svg { display: block; }

@media (min-width: 900px) {
  .shell:not(.bare) { display: grid; grid-template-columns: 240px 1fr; }
  .tabbar { display: none; }
  .sidebar {
    display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh;
    padding: 20px 14px; border-right: 1px solid var(--line); background: var(--card);
  }
  .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; margin: 0 6px 18px; }
  .side {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px;
    color: var(--ink); text-decoration: none; font-weight: 500;
  }
  .side:hover { background: var(--soft); }
  .side[aria-current="page"] { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
  .page { padding: 32px 32px 48px; }
}

/* ---------- Type ---------- */
h1 { font-family: var(--serif); font-size: 26px; line-height: 1.2; margin: 0; font-weight: 700; }
h2 { font-size: 18px; margin: 0 0 8px; }
.section-title { font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 22px 0 10px; }
.card-title { font-size: 16px; margin: 0 0 6px; }
.kicker { margin: 0; font-size: 13px; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.strong { font-weight: 600; }
.block { display: block; }
.center { text-align: center; }
.ok-text { color: var(--accent-ink); font-weight: 600; margin: 8px 0 0; }
.note { background: var(--warn-soft); color: var(--warn-ink); border-radius: 12px; padding: 10px 14px; font-size: 14px; }
p { margin: 0 0 8px; }

/* ---------- Headers ---------- */
.page-head { display: flex; align-items: flex-start; gap: 12px; margin: 4px 0 16px; }
.head-text { flex: 1; min-width: 0; }
.home-head { margin: 8px 0 14px; }
.icon-btn {
  width: 44px; height: 44px; flex: none; border-radius: 22px; border: 1px solid var(--line);
  background: var(--card); display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.icon-btn.small { width: 36px; height: 36px; }

/* ---------- Cards, rows ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin: 0 0 12px; }
.card.list { padding: 4px 16px; }
.stack > * + * { margin-top: 10px; }
.stack > .card { margin-bottom: 0; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.grow { flex: 1; }
.row-link {
  display: flex; align-items: center; gap: 12px; padding: 12px 0; color: inherit; text-decoration: none;
  border-top: 1px solid var(--line-soft); min-height: 64px;
}
.card.list > .row-link:first-child, .card.list > h2 + .row-link { border-top: 0; }
.card.row-link { border: 1px solid var(--line); padding: 12px 16px; }
.row-link.disabled { opacity: .75; }
.row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row-title { font-weight: 600; margin: 0; }
.row-meta { font-size: 13px; color: var(--muted); margin: 0; }
.row-actions { display: flex; gap: 8px; }
.thumb {
  position: relative; width: 64px; height: 48px; flex: none; border-radius: 8px; overflow: hidden;
  background: var(--dark); color: #fff; display: flex; align-items: center; justify-content: center;
}
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .75; }
.thumb-ic { position: relative; display: flex; }
.thumb.test { background: var(--accent-soft); color: var(--accent-ink); }
.thumb.locked { background: var(--soft); color: var(--muted); }
.chip { font-size: 13px; font-weight: 600; border-radius: 12px; padding: 3px 10px; white-space: nowrap; background: var(--soft); color: var(--muted); }
.chip.ok { background: var(--accent-soft); color: var(--accent-ink); }
.chip.warn { background: var(--warn-soft); color: var(--warn-ink); }
.bar { height: 6px; border-radius: 3px; background: #ECE7DC; overflow: hidden; margin-top: 6px; }
.bar > div { height: 100%; background: var(--accent); border-radius: 3px; }
.empty { text-align: center; padding: 32px 16px; }
.empty-title { font-weight: 600; font-size: 17px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px;
  border-radius: 24px; border: 1px solid var(--line); background: var(--card); color: var(--ink);
  font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn.small { min-height: 38px; padding: 0 14px; font-size: 14px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.block { display: flex; width: 100%; }
.btn:disabled { opacity: .6; cursor: default; }
.btn + .btn.block, .btn.block + .btn.block { margin-top: 10px; }

/* ---------- Home ---------- */
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0 0 12px; }
@media (min-width: 600px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; display: flex; flex-direction: column; }
.stat-label { font-size: 13px; color: var(--muted); }
.stat-num { font-size: 20px; font-weight: 700; }
.continue { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tile {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px;
  display: flex; flex-direction: column; gap: 2px; color: var(--ink); text-decoration: none; min-height: 96px;
}
.tile .ic { color: var(--accent); margin-bottom: 6px; }
.tile-title { font-weight: 600; }
.tile-sub { font-size: 13px; color: var(--muted); }
.grid2 + p { margin-top: 16px; }

/* ---------- Learn ---------- */
.section-card { display: flex; align-items: center; gap: 14px; color: inherit; text-decoration: none; }
.section-ic { width: 44px; height: 44px; flex: none; border-radius: 22px; background: var(--accent-soft); color: var(--accent-ink); display: flex; align-items: center; justify-content: center; }
.topic-card { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.num { width: 40px; height: 40px; flex: none; border-radius: 20px; background: var(--soft); display: flex; align-items: center; justify-content: center; font-weight: 700; }
.num.done { background: var(--accent-soft); color: var(--accent-ink); }
.seg { display: flex; gap: 6px; padding: 4px; background: #ECE7DC; border-radius: 24px; margin: 0 0 14px; overflow-x: auto; }
.seg button { flex: 1; min-height: 40px; border: 0; border-radius: 20px; background: transparent; cursor: pointer; white-space: nowrap; padding: 0 14px; }
.seg button.on { background: var(--card); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.08); }

/* ---------- Video ---------- */
.player { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #0B141A; border-radius: 14px; overflow: hidden; }
.player iframe, .player > div { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.player-cover { position: absolute; inset: 0; border: 0; padding: 0; background: #0B141A; cursor: pointer; width: 100%; height: 100%; }
.player-cover img { width: 100%; height: 100%; object-fit: cover; opacity: .85; }
.play-circle {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 68px; height: 68px; border-radius: 34px;
  background: #fff; color: var(--ink); display: flex; align-items: center; justify-content: center;
}
.loading-cover .play-circle { animation: pulse 1s infinite alternate; }
@keyframes pulse { to { opacity: .5; } }
.duration { position: absolute; right: 10px; bottom: 10px; background: rgba(0,0,0,.75); color: #fff; font-size: 12px; font-weight: 600; border-radius: 6px; padding: 2px 6px; }
.watch-line { display: flex; align-items: center; gap: 10px; margin: 8px 0 14px; }
.watch-line .bar { margin: 0; }
.disclosure { width: 100%; display: flex; justify-content: space-between; align-items: center; background: none; border: 0; padding: 4px 0; font-weight: 600; font-size: 17px; cursor: pointer; min-height: 44px; text-align: left; }
.hindi-text { white-space: pre-line; margin: 8px 0 0; font-size: 16px; background: var(--bg); border-radius: 10px; padding: 10px 12px; }
.word-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line-soft); }
.word { flex: 1; font-weight: 600; }
.meaning { color: var(--muted); }
.quiz-card.open { background: var(--accent-soft); border: 2px solid var(--accent); }
.quiz-card.open h2, .quiz-card.open .spread { color: var(--accent-ink); }
.quiz-line { display: flex; align-items: center; gap: 8px; }
.next-link { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; margin-top: 12px; text-decoration: none; color: var(--ink); }

/* ---------- Quiz ---------- */
.quiz-page { max-width: 640px; margin: 0 auto; }
.quiz-head { display: flex; align-items: flex-start; gap: 12px; margin: 4px 0 14px; }
.quiz-head h1 { font-size: 20px; }
.timer-box { display: inline-flex; align-items: center; gap: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 6px 10px; font-weight: 700; font-variant-numeric: tabular-nums; }
.timer.low { color: var(--bad-ink); }
.q-body { margin: 10px 0 16px; }
.q-prompt { font-size: 19px; font-weight: 600; line-height: 1.45; margin: 0 0 16px; white-space: pre-line; }
.small-prompt { font-size: 16px; margin-bottom: 8px; }
.options { display: flex; flex-direction: column; gap: 10px; }
.option {
  display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 10px 14px; background: var(--card);
  border: 1px solid var(--line); border-radius: 14px; cursor: pointer; font-size: 17px;
}
.option input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.option:focus-within { outline: 3px solid #F2B84B; outline-offset: 2px; }
.opt-letter { width: 32px; height: 32px; flex: none; border-radius: 16px; border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; }
.option.chosen { border: 2px solid var(--accent); background: var(--accent-soft); }
.option.chosen .opt-letter { background: var(--accent); border-color: var(--accent); color: #fff; }
.fill { width: 100%; min-height: 56px; border: 1px solid #CFC8BA; border-radius: 14px; padding: 10px 14px; font-size: 18px; background: #fff; }
.q-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dots { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; justify-content: center; }
.dot { width: 40px; height: 40px; border-radius: 20px; border: 1px solid var(--line); background: var(--card); font-weight: 600; cursor: pointer; }
.dot.done { background: var(--accent-soft); border-color: var(--accent-soft); color: var(--accent-ink); }
.dot.current { border: 2px solid var(--ink); }
.result-top { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 22px 16px; }
.score-ring {
  --p: 0; width: 132px; height: 132px; border-radius: 50%;
  background: conic-gradient(var(--accent) calc(var(--p) * 1%), #ECE7DC 0);
  display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative;
}
.score-ring::before { content: ""; position: absolute; inset: 10px; background: var(--card); border-radius: 50%; }
.score-ring > * { position: relative; }
.score-big { font-family: var(--serif); font-size: 32px; font-weight: 700; line-height: 1; }
.result-msg { font-size: 18px; font-weight: 700; margin: 10px 0 0; }
.review.wrong { border-left: 4px solid var(--bad-ink); }
.review.right { border-left: 4px solid var(--accent); }
.ans { display: flex; align-items: flex-start; gap: 8px; padding: 8px 10px; border-radius: 10px; font-size: 15px; margin: 0 0 6px; }
.ans .ic { margin-top: 3px; }
.ans.wrong { background: var(--bad-soft); color: var(--bad-ink); }
.ans.right { background: var(--accent-soft); color: var(--accent-ink); }
.test-card .btn { margin-top: 8px; }

/* ---------- Forms ---------- */
.auth { max-width: 460px; margin: 0 auto; padding-top: 12px; }
.auth-head { text-align: center; margin: 10px 0 18px; }
.auth-head h1 { margin-top: 10px; }
.logo { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 10px; background: var(--accent); color: #fff; font-weight: 800; font-size: 14px; letter-spacing: .02em; }
.logo.big { width: 64px; height: 64px; border-radius: 18px; font-size: 22px; }
.logo-img { width: 36px; height: 36px; display: inline-block; }
.logo-img.big { width: 64px; height: 64px; }
.welcome-points { list-style: none; padding: 0; margin: 0 0 24px; }
.welcome-points li { display: flex; gap: 10px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-bottom: 8px; }
.welcome-points .ic { color: var(--accent); }
.form .field { margin: 0 0 14px; }
.field label { display: block; font-weight: 600; font-size: 15px; margin-bottom: 4px; }
.field input, .field select, .field textarea {
  width: 100%; min-height: 48px; border: 1px solid #CFC8BA; border-radius: 12px; padding: 10px 12px; background: #fff; font-size: 16px;
}
.field input[aria-invalid="true"] { border-color: var(--bad-ink); }
.field.with-button { display: grid; grid-template-columns: 1fr auto; column-gap: 8px; }
.field.with-button label, .field.with-button .err, .field.with-button .hint { grid-column: 1 / -1; }
.hint { font-size: 13px; color: var(--muted); margin: 4px 0 0; }
.err { color: var(--bad-ink); font-size: 14px; margin: 4px 0 0; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; margin: 0 0 12px; font-size: 15px; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--accent); }
.row2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 10px; }
.fee-card { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; background: var(--bg); border: 1px dashed #CFC8BA; border-radius: 14px; padding: 12px 14px; margin: 0 0 16px; }
.card.fee-card { background: var(--card); border-style: solid; }
.fee-card > p { grid-column: 1 / -1; margin: 0; }
.fee-right { text-align: right; display: flex; flex-direction: column; align-items: flex-end; }
.price { font-family: var(--serif); font-size: 24px; font-weight: 700; }
.price-old { color: var(--muted); }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; text-align: left; margin: 12px 0 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; }
.wa-card { text-align: center; }
.big-number { font-size: 26px; font-weight: 700; letter-spacing: .03em; margin: 4px 0; }
.profile-top { display: flex; align-items: center; gap: 14px; }
.avatar { width: 56px; height: 56px; border-radius: 28px; background: var(--accent); color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; font-size: 20px; flex: none; }
.plain { list-style: none; padding: 0; margin: 0; }
.plain li { padding: 6px 0; border-top: 1px solid var(--line-soft); }
.plain li:first-child { border-top: 0; }

/* ---------- Status ---------- */
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 48px 0; color: var(--muted); }
.spin { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.error-card { background: var(--bad-soft); border-color: #F2CFC9; color: var(--bad-ink); }
.toast {
  position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px);
  background: var(--dark); color: #fff; padding: 10px 16px; border-radius: 12px; max-width: calc(100% - 32px);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 50; font-size: 15px;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.ok { background: var(--accent-ink); }
.toast.bad { background: var(--bad-ink); }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
