/*
 * css/app.css - all styles for the worker app (index.html), Clinic Teal day and night (docs/DESIGN.md).
 *
 * Purpose:    Every colour comes from the tokens in css/tokens.css (loaded first; day on :root, night on
 *             [data-theme="dark"]); the only colours written here are the "content colours" block below (the red
 *             chopping board drawn in one picture question). Then per-language fonts and line heights (Noto Sans
 *             for Latin scripts and the UI, Noto Sans Arabic, Noto Nastaliq Urdu with tall lines so it never clips,
 *             Noto Sans Devanagari for Hindi and Nepali, Noto Sans Bengali, Malayalam and Tamil), and the
 *             components in screen order: header (logo, language dropdown, moon/sun button), language picker, home
 *             rows with round icon badges, question type tags, question screen, timer pill, answers with letter
 *             tiles, order rows, clip questions (.clip video, poster + .vplay button, D31, D35), bottom bar,
 *             intro/learn, results ring, phone tap fixes, install card + sheet, code gate; the first screen without a
 *             code (free taster, Buy card, code box), the readiness ring, the "code ready" screen after paying and
 *             the footer (D38); the move prompt, Message us (WhatsApp) with email below, and "Screenshot this code"
 *             (D44); the failed-payment message, "Can't connect", "My code" and "Lost your code?" (D47, at the end).
 * Used by:    index.html (after css/fonts.css and css/tokens.css).
 * Notes:      Shape: 14px corners on buttons, options and rows, 20px on panels, pills fully rounded; soft --surface
 *             panels instead of borders; flat colours, no gradients or shadows. Green and red (--correct, --wrong)
 *             only ever mean right and wrong. Phone rule: hover effects only inside @media (hover: hover) and no
 *             text selection on buttons, otherwise taps look "stuck" or select text (decision D15). Kickers are
 *             uppercase with letter-spacing only in Latin-script languages (letter-spacing breaks Arabic joining).
 */
/* Layout: one phone-width column, content top-aligned and start-aligned, the main action pinned to a bottom bar within thumb reach. */
:root {
  --font-latin: "Noto Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-bn: "Noto Sans Bengali", "Noto Sans", system-ui, sans-serif;
  --font-hi: "Noto Sans Devanagari", "Noto Sans", system-ui, sans-serif;
  --font-ur: "Noto Nastaliq Urdu", "Jameel Noori Nastaleeq", "Urdu Typesetting", "Noto Sans", serif;
  --font-ar: "Noto Sans Arabic", "Noto Sans", "Geeza Pro", "Segoe UI", system-ui, sans-serif;
  --font-ml: "Noto Sans Malayalam", "Noto Sans", system-ui, sans-serif;
  --font-ta: "Noto Sans Tamil", "Noto Sans", system-ui, sans-serif;
  /* Content colours, not UI: the red chopping board (raw meat) in the picture question k017 (api/_questions.json,
     "vid" frames with <span class="bd">). The board's colour is part of the question, so it stays red in both themes. */
  --board-red: #C9472F;
  --board-dirt: #7A2414;
}

* { box-sizing: border-box; }
html, body { background: var(--bg); }
body {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-latin);
  font-size: 16px;
  line-height: 1.5;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 0 140px;
}
html[lang="bn"] body { font-family: var(--font-bn); line-height: 1.65; }
html[lang="hi"] body { font-family: var(--font-hi); line-height: 1.65; }
html[lang="ur"] body { font-family: var(--font-ur); line-height: 2; font-size: 16px; }
html[lang="ne"] body { font-family: var(--font-hi); line-height: 1.65; }
html[lang="ar"] body { font-family: var(--font-ar); line-height: 1.75; }
html[lang="ml"] body { font-family: var(--font-ml); line-height: 1.7; }
html[lang="ta"] body { font-family: var(--font-ta); line-height: 1.7; }
/* Malayalam and Tamil words are long: let them break instead of pushing the page wider than the phone. */
html[lang="ml"] main, html[lang="ta"] main { overflow-wrap: anywhere; }
button { font: inherit; color: inherit; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
a { color: var(--ink-soft); }

.page { max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }

/* Header: logo on the start side; language dropdown and the moon/sun button on the end side (mirrors in RTL). */
.top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-block: 10px 2px; }
.brand { flex: none; display: flex; align-items: center; gap: 8px; background: none; border: 0; padding: 4px 0; min-height: 44px; cursor: pointer; }
.brand svg { width: 30px; height: 30px; flex: none; }
.brand .lg-tile { fill: var(--primary); }
.brand .lg-tick { stroke: var(--on-primary); }
.brand b { font-family: var(--font-latin); font-weight: 800; font-size: 21px; line-height: 1.2; letter-spacing: -0.01em; color: var(--ink); }
.tools { display: flex; align-items: center; gap: 8px; min-width: 0; }
/* Language dropdown: the pill shows the current language; an invisible native <select> covers it, so a tap
   opens the phone's own list (easy to scroll with 11 languages, works with screen readers) and the pill stays
   as narrow as the current name instead of as wide as the longest option. */
.langsel { position: relative; display: inline-flex; align-items: center; gap: 6px; min-width: 0; background: var(--surface); border: 0; border-radius: 999px; min-height: 44px; padding-inline: 12px 10px; color: var(--ink); cursor: pointer; }
.langsel[hidden] { display: none; }
.langsel .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-weight: 700; font-size: 15px; line-height: 1.3; white-space: nowrap; font-family: var(--font-latin); }
.langsel .nm[lang="ur"] { font-family: var(--font-ur); line-height: 2; padding-block: 2px; }
.langsel .nm[lang="ar"] { font-family: var(--font-ar); line-height: 1.6; }
.langsel .nm[lang="hi"], .langsel .nm[lang="ne"] { font-family: var(--font-hi); line-height: 1.6; }
.langsel .nm[lang="bn"] { font-family: var(--font-bn); line-height: 1.6; }
.langsel .nm[lang="ml"] { font-family: var(--font-ml); line-height: 1.6; }
.langsel .nm[lang="ta"] { font-family: var(--font-ta); line-height: 1.6; }
.langsel svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.langsel .globe { color: var(--ink-soft); }
.langsel .chev { color: var(--muted); }
.langsel select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font-size: 16px; }
.langsel:focus-within { outline: 3px solid var(--accent); outline-offset: 2px; }
@media (hover: hover) { .langsel:hover { background: var(--border); } .theme-btn:hover { background: var(--border); } }
/* Small phones: the globe goes, so logo + language + moon fit on one line in every language. */
@media (max-width: 400px) {
  .langsel .globe { display: none; }
  .langsel { padding-inline: 10px 6px; gap: 4px; }
  .langsel .nm { font-size: 14px; }
  .top, .tools { gap: 6px; }
  .brand { gap: 6px; }
}

/* Kickers: small labels above panels (11px bold, uppercase only in Latin-script languages). */
.kick, .realtest .cap, .buy .cap, .ready .cap { font-size: 13px; font-weight: 700; line-height: 1.5; color: var(--ink-soft); }
html[lang="en"] :is(.kick, .realtest .cap, .buy .cap, .ready .cap),
html[lang="fil"] :is(.kick, .realtest .cap, .buy .cap, .ready .cap),
html[lang="id"] :is(.kick, .realtest .cap, .buy .cap, .ready .cap),
html[lang="tr"] :is(.kick, .realtest .cap, .buy .cap, .ready .cap) { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; }
html[lang="ur"] :is(.kick, .realtest .cap, .buy .cap, .ready .cap) { line-height: 2; }

/* Headings: H1 24/800, H2 18/700 (Urdu Nastaliq stays at 700, with tall lines). */
.pick h1, .hello h1, .intro h1, .learn h1, .gate h1, .paid h1, .results h2 { font-size: 24px; font-weight: 800; line-height: 1.25; margin: 6px 0 0; text-wrap: balance; }
.gate h2, .upsell .big, .lost h2, .sheet h2, .words .word h2 { font-size: 18px; font-weight: 700; line-height: 1.35; margin: 0; }
html[lang="ur"] :is(.pick h1, .hello h1, .intro h1, .learn h1, .gate h1, .paid h1, .results h2) { font-size: 22px; font-weight: 700; line-height: 2; }
html[lang="ur"] :is(.gate h2, .upsell .big, .lost h2, .sheet h2, .words .word h2) { font-size: 18px; line-height: 2; }
html[lang="ar"] :is(.pick h1, .hello h1, .intro h1, .learn h1, .gate h1, .paid h1, .results h2) { line-height: 1.6; }
html[lang="bn"] .hello h1, html[lang="hi"] .hello h1, html[lang="ne"] .hello h1 { line-height: 1.45; }
html[lang="ml"] .hello h1, html[lang="ta"] .hello h1 { font-size: 22px; line-height: 1.45; }

/* Language picker */
.pick { display: grid; gap: 12px; padding-top: 8px; }
.pick h1 { margin-bottom: 4px; }
.pick .lead { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.9; }
.pick .lead [lang="ar"] { font-family: var(--font-ar); }
.pick .lead [lang="ur"] { font-family: var(--font-ur); line-height: 2; }
.pick .lead [lang="hi"], .pick .lead [lang="ne"] { font-family: var(--font-hi); }
.pick .lead [lang="bn"] { font-family: var(--font-bn); }
.pick .tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.lang-tile {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px; text-align: start; width: 100%; cursor: pointer;
  background: var(--surface-2); border: 2px solid var(--border); border-radius: 14px; padding: 12px 14px; min-height: 80px; color: var(--ink);
}
/* English goes across the full width at the top, so the other ten pair up evenly. */
.pick .tiles .lang-tile:first-child { grid-column: 1 / -1; min-height: 60px; }
@media (hover: hover) { .lang-tile:hover { border-color: var(--primary); } }
.lang-tile .nm { font-size: 20px; font-weight: 700; line-height: 1.3; font-family: var(--font-latin); }
.lang-tile .nm[lang="ur"] { font-family: var(--font-ur); font-size: 20px; line-height: 2; }
.lang-tile .nm[lang="ar"] { font-family: var(--font-ar); font-size: 21px; line-height: 1.6; }
.lang-tile .nm[lang="bn"] { font-family: var(--font-bn); line-height: 1.5; }
.lang-tile .nm[lang="hi"], .lang-tile .nm[lang="ne"] { font-family: var(--font-hi); line-height: 1.5; }
.lang-tile .nm[lang="ml"] { font-family: var(--font-ml); font-size: 19px; line-height: 1.5; }
.lang-tile .nm[lang="ta"] { font-family: var(--font-ta); font-size: 19px; line-height: 1.5; }
.lang-tile .sub { color: var(--muted); font-family: var(--font-latin); font-size: 14px; }

/* Home */
.hello h1 { margin: 4px 0 6px; letter-spacing: -0.01em; }
html[lang="ar"] .hello h1, html[lang="ur"] .hello h1 { letter-spacing: 0; }
.hello p { margin: 0; color: var(--muted); max-width: 34em; }

.realtest { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--surface); border-radius: 20px; overflow: hidden; }
.realtest .cap { grid-column: 1 / -1; padding: 12px 16px 0; }
.realtest .f { padding: 8px 16px 14px; display: flex; flex-direction: column; }
.realtest .f + .f { border-inline-start: 2px solid var(--bg); }
.realtest strong { font-family: var(--font-latin); font-weight: 800; font-size: 24px; line-height: 1.15; font-variant-numeric: tabular-nums; color: var(--ink); }
.realtest small { color: var(--muted); font-size: 14px; }

/* Menu rows: soft row, round 34px icon badge, title and line below. */
.modes { display: grid; gap: 10px; }
.mode {
  display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 2px 14px; text-align: start; width: 100%; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; color: var(--ink);
}
@media (hover: hover) { .mode:hover { border-color: var(--primary); } }
.mode .ic { grid-row: 1 / span 2; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); color: var(--ink-soft); }
.mode .ic svg { width: 19px; height: 19px; }
.mode .t { font-size: 17px; font-weight: 700; line-height: 1.3; }
html[lang="ur"] .mode .t { font-size: 17px; line-height: 2; }
.mode .d { color: var(--muted); font-size: 14px; line-height: 1.4; }
html[lang="ur"] .mode .d { line-height: 2; }
.mode.main { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.mode.main .ic { background: var(--on-primary); color: var(--primary); }
.mode.main .d { color: var(--on-primary); }

.best { display: flex; justify-content: space-between; gap: 12px; font-size: 15px; color: var(--muted); padding: 2px 4px; }
.best b { color: var(--ink); font-variant-numeric: tabular-nums; font-family: var(--font-latin); }
.fine { font-size: 13px; color: var(--muted); margin: 0; padding: 0 4px; }

/* Question type tag: one quiet style for every type (green and red are kept for right and wrong). */
.tag { display: flex; align-items: flex-start; gap: 12px; background: var(--surface); border-radius: 14px; padding: 10px 14px; }
.tag svg { width: 22px; height: 22px; flex: none; color: var(--ink-soft); margin-top: 2px; }
.tag .tt { font-weight: 700; color: var(--ink-soft); line-height: 1.35; }
.tag .th { font-size: 14px; color: var(--ink); line-height: 1.4; }
html[lang="ur"] .tag .tt, html[lang="ur"] .tag .th { line-height: 2; }
.clip { display: grid; gap: 8px; }
.clip video { width: 100%; aspect-ratio: 16 / 9; display: block; border-radius: 14px; background: var(--night); }
.clip .vwrap { position: relative; }
.clip .vplay { position: absolute; inset: 0; margin: auto; width: 72px; height: 72px; border-radius: 50%; border: 0; background: var(--primary); color: var(--on-primary); font-size: 30px; cursor: pointer; -webkit-user-select: none; user-select: none; }
.clip .vplay[hidden] { display: none; }
.mini .mclip { display: grid; place-items: center; height: 56px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); }
.mini .mclip svg { width: 28px; height: 28px; }
.vid { display: grid; gap: 8px; background: var(--surface); border-radius: 20px; padding: 10px; }
.vgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.vp { position: relative; background: var(--surface-2); border-radius: 14px; min-height: 104px; display: grid; place-items: center; animation: vpop .45s ease-out both; }
.vp .vn { position: absolute; top: 6px; inset-inline-start: 6px; width: 22px; height: 22px; border-radius: 50%; background: var(--primary); color: var(--on-primary); display: grid; place-items: center; font: 700 12px var(--font-latin); }
.vp .sc { font-size: 40px; line-height: 1.1; text-align: center; direction: ltr; }
/* The chopping board (content colour). "dirty" = the same board with flat dark marks left by the raw chicken. */
.vp .bd { position: relative; display: block; width: 74px; height: 12px; margin: 2px auto 0; border-radius: 4px; background: var(--board-red); overflow: hidden; }
.vp .bd.dirty::before, .vp .bd.dirty::after { content: ""; position: absolute; top: 3px; height: 6px; border-radius: 3px; background: var(--board-dirt); }
.vp .bd.dirty::before { left: 10px; width: 16px; }
.vp .bd.dirty::after { left: 42px; width: 22px; }
.vbar { display: flex; justify-content: flex-end; }
@keyframes vpop { from { opacity: 0; transform: scale(.88); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .vp { animation: none; } }

/* Question screen */
.qhead { display: flex; align-items: center; gap: 14px; }
.qhead .pos { flex: 1; min-width: 0; display: grid; gap: 6px; }
.qhead .pos span { font-size: 15px; color: var(--muted); font-variant-numeric: tabular-nums; }
.track { display: flex; gap: 3px; }
.track i { flex: 1; height: 6px; border-radius: 999px; background: var(--surface); }
.track i.done { background: var(--primary); }
.track i.now { background: var(--primary); opacity: 0.4; }

/* Timer pill (the same time logic as before; no red or green when time is low). */
.dial { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 6px 14px; border-radius: 999px; background: var(--accent-bg); color: var(--accent-ink); direction: ltr; }
.dial .dic { display: grid; }
.dial .dic svg { width: 18px; height: 18px; }
.dial b { font-family: var(--font-latin); font-weight: 800; font-size: 17px; line-height: 1; font-variant-numeric: tabular-nums; }
.dial.low { outline: 2px solid var(--accent); outline-offset: -2px; }

.notice { background: var(--wrong-bg); color: var(--wrong-ink); border-radius: 14px; padding: 8px 14px; font-weight: 700; font-size: 15px; }

.qcard { display: grid; gap: 14px; }
.qrow { display: flex; align-items: flex-start; gap: 12px; }
.qtext { flex: 1; min-width: 0; margin: 0; font-size: 21px; line-height: 1.35; font-weight: 700; text-wrap: pretty; }
html[lang="ur"] .qtext { font-size: 19px; line-height: 2.1; font-weight: 700; }
html[lang="bn"] .qtext, html[lang="hi"] .qtext { font-size: 20px; line-height: 1.5; }
html[lang="ne"] .qtext { font-size: 20px; line-height: 1.5; }
html[lang="ar"] .qtext { font-size: 20px; line-height: 1.7; }
html[lang="ml"] .qtext, html[lang="ta"] .qtext { font-size: 18px; line-height: 1.6; }
.listen { flex: none; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; background: var(--surface); color: var(--ink-soft); border: 2px solid transparent; border-radius: 999px; padding: 4px 12px; min-height: 44px; font-size: 14px; font-weight: 700; }
.listen svg { width: 18px; height: 18px; }
.listen[aria-pressed="true"] { border-color: var(--primary); }

.pic { display: flex; align-items: center; justify-content: center; gap: 24px; background: var(--surface); border-radius: 20px; padding: 12px; }
.pic svg { width: 96px; height: auto; max-width: 100%; direction: ltr; } /* scale numbers like −5 stay left to right in Arabic and Urdu */
.pic .reading { display: grid; justify-items: center; gap: 2px; }
.pic .reading strong { font-family: var(--font-latin); font-weight: 800; font-size: 44px; line-height: 1; font-variant-numeric: tabular-nums; direction: ltr; }
.pic .reading small { color: var(--muted); font-size: 14px; text-align: center; max-width: 12em; }
.th-tube { fill: var(--surface-2); stroke: var(--ink); stroke-width: 2; }
.th-liquid { fill: var(--primary); }
.th-tick { stroke: var(--muted); stroke-width: 1.5; }
.th-lab { fill: var(--muted); font: 700 11px var(--font-latin); }

/* Answers: soft row with a rounded letter tile (round = one answer, rounded square = several). */
.opts { display: grid; gap: 10px; }
.opt {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: start; cursor: pointer; color: var(--ink);
  background: var(--surface-2); border: 2px solid var(--border); border-radius: 14px; padding: 10px 14px; min-height: 58px; font-size: 17px; line-height: 1.35;
}
html[lang="ur"] .opt { font-size: 17px; line-height: 2; }
.opt .mk { flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); color: var(--ink-soft); font: 700 15px/1 var(--font-latin); }
.opt.multi .mk { border-radius: 9px; }
@media (hover: hover) { .opt:not(:disabled):hover { border-color: var(--primary); } }
.opt[aria-pressed="true"] { border-color: var(--primary); }
.opt[aria-pressed="true"] .mk { background: var(--primary); color: var(--on-primary); }
.opt.tfb { justify-content: center; font-weight: 700; font-size: 19px; min-height: 64px; }
.opt.tfb .mk { display: none; }
.tfrow { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.opt.ok { border-color: var(--correct); background: var(--correct-bg); }
.opt.ok .mk { background: var(--correct); color: var(--on-primary); }
.opt.no { border-color: var(--wrong); background: var(--wrong-bg); }
.opt.no .mk { background: var(--wrong); color: var(--on-primary); }
.opt:disabled { cursor: default; }
.opt:disabled:not(.ok):not(.no) { opacity: 0.6; }

.ozone { display: grid; gap: 8px; }
.ozone .lb { font-size: 15px; color: var(--muted); }
.slot { display: flex; align-items: center; gap: 12px; width: 100%; text-align: start; min-height: 54px; padding: 8px 14px; border: 2px dashed var(--border); border-radius: 14px; background: transparent; color: var(--ink); cursor: pointer; font-size: 17px; line-height: 1.35; }
html[lang="ur"] .slot { line-height: 2; font-size: 16px; }
.slot .n { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-latin); font-weight: 700; font-size: 15px; background: var(--surface); }
.slot.full { border-style: solid; border-color: var(--primary); background: var(--surface-2); }
.slot.full .n { background: var(--primary); color: var(--on-primary); }
.slot.ok { border-color: var(--correct); background: var(--correct-bg); }
.slot.ok .n { background: var(--correct); color: var(--on-primary); }
.slot.no { border-color: var(--wrong); background: var(--wrong-bg); }
.slot.no .n { background: var(--wrong); color: var(--on-primary); }
.slot:disabled { cursor: default; }
.pool { display: grid; gap: 8px; }
.stepb { width: 100%; text-align: start; cursor: pointer; background: var(--surface-2); color: var(--ink); border: 2px solid var(--border); border-radius: 14px; padding: 10px 14px; min-height: 54px; font-size: 17px; line-height: 1.35; }
html[lang="ur"] .stepb { line-height: 2; font-size: 16px; }
@media (hover: hover) { .stepb:hover { border-color: var(--primary); } }
.olist { display: grid; gap: 8px; }
.orow { display: flex; align-items: center; gap: 10px; border: 2px solid var(--border); background: var(--surface-2); border-radius: 14px; padding-block: 6px; padding-inline: 12px 6px; min-height: 60px; }
/* Neutral until "Check my answer": a colour here looked like a wrong answer while the worker was still moving steps. */
.orow .n { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-latin); font-weight: 700; font-size: 15px; background: var(--surface); color: var(--ink-soft); }
.orow .tx { flex: 1; min-width: 0; font-size: 17px; line-height: 1.35; }
html[lang="ur"] .orow .tx { line-height: 2; font-size: 16px; }
.orow .arr { display: flex; gap: 6px; flex: none; }
.orow .arr button { width: 46px; height: 46px; border-radius: 14px; border: 0; background: var(--surface); cursor: pointer; display: grid; place-items: center; }
.orow .arr button svg { width: 22px; height: 22px; color: var(--ink-soft); }
.orow .arr button:disabled { opacity: 0.4; cursor: default; }
.orow.ok { border-color: var(--correct); background: var(--correct-bg); }
.orow.ok .n { background: var(--correct); color: var(--on-primary); }
.orow.no { border-color: var(--wrong); background: var(--wrong-bg); }
.orow.no .n { background: var(--wrong); color: var(--on-primary); }
.otools { display: flex; gap: 10px; flex-wrap: wrap; }
.small-btn { background: var(--surface); color: var(--ink-soft); border: 0; border-radius: 999px; padding: 6px 16px; min-height: 44px; cursor: pointer; font-size: 15px; font-weight: 700; }
@media (hover: hover) { .small-btn:hover, .cta.ghost:hover { background: var(--border); } }

/* Feedback after "Check my answer": tinted box, the word in ink, a coloured edge. */
.fb { border-radius: 14px; padding: 12px 16px; display: grid; gap: 4px; border-inline-start: 5px solid transparent; }
.fb.ok { background: var(--correct-bg); border-inline-start-color: var(--correct); }
.fb.no { background: var(--wrong-bg); border-inline-start-color: var(--wrong); }
.fb b { font-size: 19px; color: var(--ink); }
.fb p { margin: 0; }
.fb.no b { color: var(--wrong-ink); }

/* Bottom action bar */
.bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: var(--bg); border-top: 1px solid var(--border);
  padding-top: 12px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.bar:empty { display: none; }
.bar .in { max-width: 560px; margin: 0 auto; display: grid; grid-template-columns: 1fr; gap: 10px; }
.bar .in.two { grid-template-columns: 1fr 1fr; }
/* Buttons: primary (teal), secondary (.ghost, mint), WhatsApp (.wa); disabled = 40% opacity. */
.cta { width: 100%; min-height: 56px; border: 0; border-radius: 14px; cursor: pointer; background: var(--primary); color: var(--on-primary); font-weight: 700; font-size: 18px; line-height: 1.3; padding: 6px 14px; }
html[lang="ur"] .cta { font-size: 17px; line-height: 2; padding-block: 4px; }
.cta:disabled { opacity: 0.4; cursor: not-allowed; }
.cta.ghost { background: var(--surface); color: var(--ink-soft); }
/* Inside a mint (--surface) panel a mint button would vanish: there secondary buttons are page-coloured with a thin border. */
:is(#codeBox, .buy, .ready, .install, .score, .realtest, .rules, .ex, .vid, .pic, .words .word, .lost) :is(.cta.ghost, .small-btn, a.cta.wa.save) { background: var(--bg); border: 1px solid var(--border); border-radius: 14px; }
:is(#codeBox, .buy, .ready, .install, .score, .realtest, .rules, .ex, .vid, .pic, .words .word, .lost) a.cta.wa.save { border: 2px solid var(--whatsapp); }
@media (hover: hover) { :is(#codeBox, .buy, .ready, .install, .score, .realtest, .rules, .ex, .vid, .pic, .words .word, .lost) :is(.cta.ghost, .small-btn):hover { border-color: var(--primary); } }

/* Intro + learn */
.intro { display: grid; gap: 14px; }
.rules { display: grid; gap: 0; background: var(--surface); border-radius: 20px; overflow: hidden; }
.rule { display: flex; align-items: center; gap: 14px; padding: 14px 16px; }
.rule + .rule { border-top: 2px solid var(--bg); }
.rule .big { flex: none; width: 56px; text-align: center; font-family: var(--font-latin); font-weight: 800; font-size: 24px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.intro .note { margin: 0; color: var(--muted); }

.learn { display: grid; gap: 12px; }
.learn .lead { margin: 0; color: var(--muted); }
.ex { display: grid; gap: 10px; background: var(--surface); border-radius: 20px; padding: 12px; }
.ex .tag { background: var(--bg); }
.mini { display: grid; gap: 6px; pointer-events: none; }
.mini .r { display: flex; align-items: center; gap: 10px; border: 1.5px solid var(--border); background: var(--surface-2); border-radius: 10px; padding: 6px 10px; font-size: 15px; }
.mini .r .d { width: 18px; height: 18px; border: 2px solid var(--muted); border-radius: 50%; flex: none; }
.mini .r.sq .d { border-radius: 5px; }
.mini .r.on { border-color: var(--primary); }
.mini .r.on .d { background: var(--primary); border-color: var(--primary); }
.mini .two { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.mini .two span { border: 1.5px solid var(--border); background: var(--surface-2); border-radius: 10px; padding: 6px; text-align: center; font-weight: 700; font-size: 15px; }
.mini .two span.on { border-color: var(--primary); }
.mini .r .num { width: 22px; height: 22px; border-radius: 50%; background: var(--primary); color: var(--on-primary); display: grid; place-items: center; font-family: var(--font-latin); font-weight: 700; font-size: 13px; flex: none; }

/* Results */
.results { display: grid; gap: 14px; }
.results > h2 { margin-top: 6px; }
.score { display: grid; justify-items: center; gap: 6px; text-align: center; background: var(--surface); border-radius: 20px; padding: 20px 16px; }
.ring { width: 156px; height: 156px; direction: ltr; }
.ring .tr { fill: none; stroke: var(--track); stroke-width: 12; }
.ring .vl { fill: none; stroke-width: 12; stroke-linecap: round; transform: rotate(-90deg); transform-origin: 50% 50%; }
.ring .vl.pass { stroke: var(--correct); }
.ring .vl.fail { stroke: var(--wrong); }
.ring .pm { stroke: var(--accent); stroke-width: 4; stroke-linecap: round; transform-origin: 50% 50%; }
[dir="rtl"] .ring .vl { transform: scaleX(-1) rotate(-90deg); }
[dir="rtl"] .ring .pm { transform: scaleX(-1); }
.ring text { fill: var(--ink); font-family: var(--font-latin); font-weight: 800; font-size: 34px; }
.ring .sm { font-size: 14px; font-weight: 700; fill: var(--muted); }
/* Pass / not yet: a pill, tinted green or red, the words in dark ink. */
.verdict { margin: 0; font-size: 20px; font-weight: 800; line-height: 1.35; padding: 4px 16px; border-radius: 999px; }
html[lang="ur"] .verdict { font-size: 19px; font-weight: 700; line-height: 2; }
.verdict.pass { background: var(--correct-bg); color: var(--ink); }
.verdict.fail { background: var(--wrong-bg); color: var(--wrong-ink); }
.score p { margin: 0; color: var(--muted); max-width: 32em; }
.tally { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: 100%; margin-top: 6px; }
.tally div { background: var(--surface-2); border-radius: 14px; padding: 8px; display: grid; }
.tally b { font-family: var(--font-latin); font-weight: 800; font-size: 22px; font-variant-numeric: tabular-nums; }
.tally span { font-size: 13px; color: var(--muted); line-height: 1.3; }
html[lang="ur"] .tally span { line-height: 1.9; }
.tally .g b { color: var(--correct); }
.tally .x b { color: var(--wrong); }
.rv { background: var(--surface-2); border: 1px solid var(--border); border-inline-start: 5px solid var(--wrong); border-radius: 14px; padding: 12px 14px; display: grid; gap: 6px; }
.rv p { margin: 0; }
.rv .q { font-weight: 700; }
.rv .a { color: var(--ink); font-weight: 700; border-inline-start: 3px solid var(--correct); padding-inline-start: 8px; }
.rv .e { color: var(--muted); font-size: 15px; }
.rv .to { color: var(--wrong-ink); font-size: 14px; font-weight: 700; }
.rv ol { margin: 0; padding-inline-start: 22px; color: var(--ink); font-weight: 700; }
.rv ol li::marker { color: var(--correct); }


/* Phones: no text selection or grey flash when tapping, no double-tap zoom */
button, a, .opt, .orow, .lang-tile, .mode, .item, .card, .stats { -webkit-tap-highlight-color: transparent; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: manipulation; }
input, textarea { -webkit-user-select: text; user-select: text; }
/* Add to home screen */
.install { display: flex; align-items: center; gap: 12px; background: var(--surface); border-radius: 20px; padding: 12px 14px; }
.install img { width: 48px; height: 48px; border-radius: 12px; flex: none; }
.install .tx { flex: 1; min-width: 0; display: grid; }
.install .tx b { font-size: 16px; line-height: 1.3; }
.install .tx span { color: var(--muted); font-size: 14px; line-height: 1.4; }
html[lang="ur"] .install .tx b, html[lang="ur"] .install .tx span { line-height: 2; }
.install button { flex: none; min-height: 44px; border: 0; border-radius: 14px; background: var(--primary); color: var(--on-primary); font-weight: 700; padding: 0 16px; cursor: pointer; }
html[lang="ur"] .install button { line-height: 2; padding-block: 2px; }
/* The sheet sits over a dimmed layer (night teal at 60%, in both themes). */
.sheet-bg { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet-bg::before { content: ""; position: absolute; inset: 0; background: var(--night); opacity: 0.6; }
.sheet { position: relative; width: 100%; max-width: 560px; background: var(--bg); border-radius: 20px 20px 0 0; padding: 20px max(16px, env(safe-area-inset-right)) calc(20px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); display: grid; gap: 14px; max-height: 90vh; overflow: auto; }
.sheet ol { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; counter-reset: st; }
.sheet li { display: flex; gap: 12px; align-items: flex-start; counter-increment: st; font-size: 16px; line-height: 1.45; }
html[lang="ur"] .sheet li { line-height: 2; }
.sheet li::before { content: counter(st); flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--primary); color: var(--on-primary); display: grid; place-items: center; font: 700 15px var(--font-latin); margin-top: 2px; }
.sheet .note { background: var(--tip-bg); border-radius: 14px; padding: 10px 14px; color: var(--ink); font-size: 15px; }
.sheet .glyph { display: inline-grid; place-items: center; vertical-align: middle; width: 26px; height: 26px; border-radius: 8px; background: var(--surface); color: var(--ink-soft); margin: 0 2px; }
.sheet .glyph svg { width: 18px; height: 18px; }
/* Code gate */
.gate { display: grid; gap: 14px; padding-top: 8px; }
.gate p { margin: 0; color: var(--muted); }
.code-in { width: 100%; min-height: 60px; border: 2px solid var(--border); border-radius: 14px; background: var(--bg); color: var(--ink); font: 800 26px var(--font-latin); letter-spacing: 0.16em; text-align: center; text-transform: uppercase; direction: ltr; padding: 8px 12px; }
.code-in::placeholder, .mail-in::placeholder { color: var(--muted); opacity: 1; }
.code-in:focus { outline: 3px solid var(--accent); outline-offset: 2px; border-color: var(--primary); }
.gate .err { background: var(--wrong-bg); color: var(--wrong-ink); border-radius: 14px; padding: 10px 14px; font-weight: 700; }
@media (max-width: 370px) { .realtest strong { font-size: 21px; } .qtext { font-size: 19px; } }
.modes .small-btn { justify-self: start; min-height: 44px; }

/* Results screen: one quiet line saying results are saved for the seller (decision D26). */
.results .saved { color: var(--muted); font-size: 14px; margin: 8px 0 0; }

/* Key words (decision D27): one card per word, picture on the start side, text beside it; videos go full width. */
.words .word { display: grid; grid-template-columns: 96px 1fr; gap: 14px; align-items: start; background: var(--surface); border-radius: 20px; padding: 14px; }
.words .word.vid { grid-template-columns: 1fr; }
.words .word h2 { margin: 0 0 4px; }
.words .word p { margin: 0; color: var(--ink); }
.words .wpic { display: grid; justify-items: center; gap: 2px; }
.words .wpic svg { width: 76px; height: auto; }
.words .wpic b { font-size: 15px; font-family: var(--font-latin); font-variant-numeric: tabular-nums; }
.words .wpic.icon svg { width: 64px; height: 64px; fill: none; stroke: var(--ink-soft); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; background: var(--bg); border-radius: 50%; padding: 8px; box-sizing: content-box; }
.words video { width: 100%; border-radius: 14px; background: var(--night); aspect-ratio: 16 / 9; }
/* The danger zone (5-63°C) in the "wrong" red, the cold and hot safe zones in teal and the warm accent. */
.dz-bad { fill: var(--wrong); } .dz-cold { fill: var(--primary); } .dz-hot { fill: var(--accent); }


/* Free taster, buying, readiness and footer (decision D38). */
.upsell .big { margin: 0; }
#codeBox { background: var(--surface); border-radius: 20px; padding: 16px; }
.buy, .ready { display: grid; gap: 10px; background: var(--surface); border-radius: 20px; padding: 14px 16px 16px; overflow: hidden; }
.buy .cap, .ready .cap { margin: 0; padding: 0; }
.buy .price { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.buy .price b { font: 800 34px/1.1 var(--font-latin); font-variant-numeric: tabular-nums; color: var(--ink); }
.buy .price span { color: var(--muted); }
.buy .price .sar { font-size: 16px; font-weight: 700; color: var(--ink-soft); }
.buy .sarnote { margin-top: -4px; }
.cta .sar-in { display: block; font-size: 14px; font-weight: 600; line-height: 1.4; }
html[lang="ur"] .cta .sar-in { line-height: 1.8; }
.buy ul { margin: 0; padding-inline-start: 20px; display: grid; gap: 4px; }
.buy li::marker { color: var(--ink-soft); }
.buy .fine { padding: 0; }
/* Readiness ring: the current run out of 3 (conic fill in --primary on --track, inner circle --surface),
   and the readyYes / readyNo words as a tag. The three <i> are the gaps between the thirds. Mirrors in RTL. */
.ready .rrow { display: flex; align-items: center; gap: 14px; }
.ready .rring { position: relative; flex: none; width: 68px; height: 68px; }
.ready .dots { position: absolute; inset: 0; display: block; border-radius: 50%; direction: ltr;
  background: conic-gradient(var(--primary) 0 calc(var(--n, 0) * 120deg), var(--track) 0); }
.ready .dots::after { content: ""; position: absolute; inset: 9px; border-radius: 50%; background: var(--surface); }
.ready .dots i { position: absolute; left: 50%; top: 0; width: 4px; height: 50%; margin-left: -2px; background: var(--surface); transform-origin: 50% 100%; }
.ready .dots i:nth-child(2) { transform: rotate(120deg); }
.ready .dots i:nth-child(3) { transform: rotate(240deg); }
[dir="rtl"] .ready .dots { transform: scaleX(-1); }
.ready .rnum { position: absolute; inset: 0; display: grid; place-items: center; font: 800 17px/1 var(--font-latin); color: var(--ink); font-variant-numeric: tabular-nums; }
.ready .rtag { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; line-height: 1.35; padding: 6px 14px; border-radius: 999px; background: var(--accent-bg); color: var(--accent-ink); }
html[lang="ur"] .ready .rtag { line-height: 2; padding-block: 2px; }
/* Ready = the paid / done badge: a green-tint pill with a round green tick (the tick is drawn, not text). */
.ready.yes .rtag { position: relative; background: var(--correct-bg); color: var(--ink); }
.ready.yes .rtag::before { content: ""; flex: none; width: 20px; height: 20px; border-radius: 50%; background: var(--correct); }
.ready.yes .rtag::after { content: ""; position: absolute; inset-inline-start: 20px; top: 50%; width: 8px; height: 4px; margin-top: -4px; border: solid var(--on-primary); border-width: 0 0 2px 2px; transform: rotate(-45deg); }
.ready p { margin: 0; color: var(--muted); font-size: 15px; }
.ready .promise { color: var(--ink); }
.ready a, .foot a { color: var(--ink-soft); font-weight: 700; display: inline-block; min-height: 44px; line-height: 44px; }
.upsell { display: grid; gap: 12px; margin: 16px 0; }
.foot { margin-top: 8px; padding: 14px 4px 0; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; }
.foot p { margin: 0 0 6px; }
.foot nav { display: flex; flex-wrap: wrap; column-gap: 16px; }
.paid { display: grid; gap: 14px; padding-top: 8px; text-align: center; justify-items: center; }
.paid p { margin: 0; color: var(--muted); max-width: 30em; }
/* The code card: mint panel, big bold code. */
.code-show { font: 800 38px/1.2 var(--font-latin); letter-spacing: 0.12em; padding: 16px 24px; border-radius: 20px; background: var(--surface); color: var(--ink-soft); text-align: center; user-select: all; -webkit-user-select: all; }
/* Paid: a round green tick above "Your code is ready" (decoration, aria-hidden). */
.paid.done .tick { position: relative; display: block; width: 48px; height: 48px; border-radius: 50%; background: var(--correct); }
.paid.done .tick::after { content: ""; position: absolute; left: 15px; top: 15px; width: 17px; height: 9px; border: solid var(--on-primary); border-width: 0 0 3px 3px; transform: rotate(-45deg); }
.spin { width: 44px; height: 44px; border-radius: 50%; border: 4px solid var(--surface); border-top-color: var(--primary); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation: none; border-top-color: var(--surface); border-right-color: var(--primary); } }
@media (hover: hover) { .foot a:hover, .ready a:hover { text-decoration: underline; } }

/* Getting back in and getting help (D44): the move prompt, Message us on WhatsApp with email below, "Screenshot this code". */
.gate .move { background: var(--bg); border: 2px solid var(--primary); border-radius: 14px; padding: 12px 14px; display: grid; gap: 8px; }
.gate .move p { color: var(--ink); }
.help { display: grid; gap: 6px; justify-items: center; width: 100%; }
.help .wa { display: grid; place-items: center; text-decoration: none; padding: 0 16px; }
.help .mail { color: var(--ink-soft); font-size: 15px; min-height: 44px; line-height: 44px; overflow-wrap: anywhere; text-align: center; }
.paid .shot { color: var(--ink); font-weight: 700; font-size: 18px; margin: 0; }
/* Footer contact written out (D45). */
.foot .contact { margin-top: 4px; }
.foot .contact a { color: var(--ink-soft); font-weight: 700; display: inline-block; min-height: 44px; line-height: 44px; overflow-wrap: anywhere; }

/* Never stuck (D47): the failed-payment message and its WhatsApp button on the Buy card, the tip inside Facebook /
   Instagram / WhatsApp, "Can't connect", "My code" (code, days left, Copy, Save to WhatsApp) and "Lost your code?". */
.buy .err, .lost .err, .paid .err { background: var(--wrong-bg); color: var(--wrong-ink); border-radius: 14px; padding: 10px 14px; font-weight: 700; }
a.cta.wa { display: grid; place-items: center; text-decoration: none; text-align: center; background: var(--whatsapp); color: var(--on-whatsapp); padding: 6px 16px; }
a.cta.wa.save { background: var(--surface); color: var(--ink); border: 2px solid var(--whatsapp); }
.buy .tip { margin: 0; font-size: 15px; color: var(--ink); background: var(--tip-bg); border-radius: 14px; padding: 8px 12px; }
.conn { margin: 0; background: var(--accent-bg); color: var(--accent-ink); border-radius: 14px; padding: 8px 14px; font-weight: 700; font-size: 15px; }
.mycode-btn { display: inline-flex; align-items: center; gap: 8px; justify-self: start; min-height: 44px; padding: 6px 16px; -webkit-user-select: none; user-select: none; }
.mycode-btn svg { width: 20px; height: 20px; flex: none; }
.mycode .left { color: var(--ink); font-weight: 700; font-size: 17px; }
.link-btn { background: none; border: 0; padding: 0 4px; min-height: 44px; color: var(--ink-soft); font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; justify-self: center; -webkit-user-select: none; user-select: none; }
.lost { display: grid; gap: 12px; width: 100%; text-align: start; border-top: 2px solid var(--bg); padding-top: 14px; }
.paid .lost { border-top-color: var(--border); }
.lost p { margin: 0; color: var(--muted); }
.mail-in { width: 100%; min-height: 56px; border: 2px solid var(--border); border-radius: 14px; background: var(--bg); color: var(--ink); font: 400 17px var(--font-latin); direction: ltr; text-align: left; padding: 8px 14px; }
.mail-in:focus { outline: 3px solid var(--accent); outline-offset: 2px; border-color: var(--primary); }
.okmsg { background: var(--correct-bg); color: var(--ink); border-inline-start: 5px solid var(--correct); border-radius: 14px; padding: 10px 14px; font-weight: 700; }
