:root {
  --pine: #14352c;
  --pine-deep: #10241f;
  --cream: #f3ecdf;
  --cream-2: #e7ddcc;
  --card: #fffaf3;
  --ink: #1c1915;
  --ink-soft: #4a433a;
  --line: #d9cdb8;
  --gold: #8a5a12;
  --speak: #7a2424;
  --read: #1d4e89;
  --prep: #0f5c4c;
  --focus: #8a5a12;
  --font: system-ui, -apple-system, "Segoe UI", Inter, "Noto Sans", "Noto Naskh Arabic", "Noto Sans Arabic", "Noto Sans Devanagari", "WenQuanYi Micro Hei", "Droid Sans Fallback", sans-serif;
  color-scheme: light;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.45;
  overscroll-behavior-y: none;
}

@media (min-width: 720px) {
  body { background: var(--pine-deep); }
}

.skip {
  position: absolute;
  inset-inline-start: 0.75rem;
  top: -4rem;
  z-index: 20;
  background: #fff;
  color: #000;
  padding: 0.55rem 0.8rem;
  border-radius: 8px;
}

.skip:focus { top: 0.5rem; }

.shell {
  width: min(560px, 100%);
  margin-inline: auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--cream);
}

.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  column-gap: 0.65rem;
  row-gap: 0.45rem;
  padding: calc(0.55rem + env(safe-area-inset-top)) 0.85rem 0.55rem;
  background: var(--pine);
  color: var(--cream);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex: 1 0 auto;
  min-width: max-content;
  max-width: 100%;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
}

.brand span {
  line-height: 1.15;
  white-space: nowrap;
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.4rem;
  flex: 1 0 auto;
  margin-inline-start: auto;
  max-width: 100%;
}

.top select {
  width: auto;
  max-width: 9.5rem;
}

.mark {
  width: 1.7rem;
  height: 1.7rem;
  flex: 0 0 auto;
  fill: currentColor;
}

.text-btn,
select,
.btn {
  font: inherit;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.text-btn {
  min-height: 44px;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  border: 1px solid rgba(243, 236, 223, 0.6);
  background: transparent;
  color: inherit;
  cursor: pointer;
  white-space: nowrap;
  flex: 0 0 auto;
}

@media (max-width: 480px) {
  .top { padding-inline: 0.65rem; }
  .brand { font-size: 1rem; }
  .text-btn { padding-inline: 0.65rem; }
  .top select { max-width: 7.25rem; }
}

select {
  min-height: 44px;
  max-width: 11.5rem;
  padding: 0.35rem 0.55rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1.15rem 1.1rem calc(1.25rem + env(safe-area-inset-bottom));
}

main > * { margin: 0; }

h1 {
  font-size: clamp(1.7rem, 6vw, 2.2rem);
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.02em;
}

h2, h3, h4 { font-size: 1.05rem; line-height: 1.3; }

.eyebrow {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--prep);
}

.legal {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.tagline,
.disclaimer {
  padding: 0.9rem 1rem;
  border: 2px solid var(--ink);
  border-radius: 16px;
  background: var(--card);
}

.tagline {
  font-size: 1.28rem;
  line-height: 1.35;
  font-weight: 700;
}

.disclaimer {
  font-size: 1.05rem;
  line-height: 1.4;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-weight: 700;
}

.field select { max-width: none; width: 100%; }

.count, .note, .hint, .saved, .part-name, .score {
  color: var(--ink-soft);
}

.note { font-size: 1rem; }

.dock { margin-top: auto; }

.actions, .q-row, .dialog-actions {
  display: grid;
  gap: 0.7rem;
}

.btn {
  min-height: 3.4rem;
  padding: 0.75rem 1rem;
  border-radius: 14px;
  border: 2px solid var(--pine);
  cursor: pointer;
  font-size: 1.08rem;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
}

.btn.primary {
  background: var(--pine);
  color: var(--cream);
}

.btn.secondary {
  background: transparent;
  color: var(--pine);
}

.btn.danger {
  background: var(--speak);
  border-color: var(--speak);
  color: #fff;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.part-card, .answer-card, .context, .passage, .alert {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0.9rem 1rem;
}

.part-card {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

@media (min-width: 560px) {
  .q-row { grid-template-columns: 1fr 1fr; }
  .actions.two, .dialog-actions { grid-template-columns: 1fr 1fr; }
}

.directions { font-size: 1.08rem; line-height: 1.5; }

.times {
  margin: 0;
  padding-inline-start: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.context h2 { margin: 0 0 0.35rem; }

.passage {
  font-size: 1.28rem;
  line-height: 1.45;
}

.ask {
  font-size: 1.35rem;
  line-height: 1.35;
  font-weight: 700;
}

.progress {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.pips { display: flex; flex-wrap: wrap; gap: 0.35rem; }

.pip {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  border: 2px solid var(--pine);
  background: transparent;
}

.pip.on { background: var(--gold); border-color: var(--gold); }
.pip.done { background: var(--pine); }

.timer-wrap {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--cream);
  padding-bottom: 0.2rem;
}

.timer-wrap.beside-picture { position: static; }

.timer-face {
  position: relative;
  width: min(230px, 64vw);
  margin-inline: auto;
}

.timer-wrap.compact .timer-face { width: min(148px, 40vw); }

.ring-svg { width: 100%; height: auto; display: block; }

.ring-track,
.ring-value { fill: none; stroke-width: 8; }

.ring-track { stroke: #e4d8c4; }

.phase-prepare .ring-value { stroke: var(--prep); }
.phase-speak .ring-value { stroke: var(--speak); }
.phase-reading .ring-value { stroke: var(--read); }

.timer-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.phase {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
}

.time-num {
  margin: 0;
  font-size: clamp(3.2rem, 15vw, 5rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
  line-height: 0.9;
  direction: ltr;
  unicode-bidi: isolate;
}

.timer-wrap.compact .time-num { font-size: clamp(2.4rem, 11vw, 3.2rem); }

.time-num.is-urgent,
.phase-speak .phase,
.rec { color: var(--speak); }

.rec {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  margin: 0.35rem 0 0;
  font-weight: 700;
}

.dot {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: var(--speak);
}

.hint, .no-pause { text-align: center; }

.timer-wrap .btn { margin-top: 0.75rem; }

.frame {
  aspect-ratio: 4 / 3;
  width: 100%;
  max-height: 70dvh;
  border-radius: 16px;
  overflow: hidden;
  background: #efe6d6;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
}

.frame img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  object-fit: contain;
  object-position: center;
  background: #efe6d6;
}

.frame.is-missing {
  color: var(--ink-soft);
  text-align: center;
  padding: 1rem;
  aspect-ratio: auto;
  min-height: 10rem;
}

.frame.is-missing svg { width: 4.5rem; height: auto; }
.frame.is-missing p { margin: 0.4rem 0 0; }

.document { display: flex; flex-direction: column; gap: 0.55rem; }

.doc-title { margin: 0; }

.sheet {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

table { border-collapse: collapse; width: 100%; }
table.grid { min-width: 22rem; }
table.pairs { min-width: 0; }
table.pairs th { width: 38%; background: var(--cream-2); font-weight: 700; }

th, td {
  padding: 0.55rem 0.7rem;
  text-align: start;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}

th { background: var(--cream-2); }

.prose { padding: 0.8rem 0.9rem; }
.prose p, .prose h4, .prose ul { margin: 0 0 0.55rem; }
.prose ul { padding-inline-start: 1.2rem; }
.prose li { margin: 0.2rem 0; }

.snippet {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.answers { display: flex; flex-direction: column; gap: 0.75rem; }

.answer-card { display: flex; flex-direction: column; gap: 0.55rem; }

.score { font-weight: 700; color: var(--ink); }

.stars {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.7rem;
}

.score-name { font-weight: 700; }

.star-row {
  color: var(--gold);
  font-size: 1.45rem;
  letter-spacing: 0.12em;
  line-height: 1;
}

.star-row .off { color: #c3b49a; }

.marked-line {
  margin: 0;
  line-height: 1.75;
}

.marked-line mark.weak,
.marked-line .band-red {
  background: rgba(255, 107, 122, 0.28);
  color: #a32018;
  font-weight: 700;
  border-radius: 0.25rem;
  padding: 0 0.12em;
}

.marked-line .band-green {
  background: rgba(61, 220, 151, 0.35);
  color: #146c43;
  border-radius: 0.25rem;
  padding: 0 0.12em;
}

.marked-line .band-yellow {
  background: rgba(255, 193, 7, 0.35);
  color: #8a5a12;
  border-radius: 0.25rem;
  padding: 0 0.12em;
}

.line-band.band-green { color: #146c43; }
.line-band.band-yellow { color: #8a5a12; }
.line-band.band-red { color: #a32018; }

.weak-list { margin: 0; color: var(--speak); font-weight: 700; }

.checking { font-weight: 700; }

.cloud {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0.9rem 1rem;
}

.cloud ul {
  margin: 0;
  padding-inline-start: 1.2rem;
}

.btn.is-saved { background: var(--cream-2); }

.alert {
  border-color: var(--speak);
  color: var(--speak);
  font-weight: 700;
}

dialog {
  width: min(28rem, calc(100vw - 2rem));
  border: none;
  border-radius: 18px;
  padding: 1.1rem;
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 16px 50px rgba(16, 36, 31, 0.28);
}

dialog::backdrop { background: rgba(16, 36, 31, 0.55); }

dialog h2 { margin: 0 0 0.4rem; font-size: 1.35rem; }
dialog p { margin: 0 0 1rem; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

:focus { outline: none; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.top :focus-visible { outline-color: #f3ecdf; }

@media (forced-colors: active) {
  .ring-value { stroke: CanvasText; }
  .btn { border: 1px solid ButtonText; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}

@media (max-width: 380px) {
  select { max-width: 9.5rem; }
}

@media (max-width: 340px) {
  .btn { font-size: 1rem; }
  .tagline { font-size: 1.12rem; }
}

.shell.exam {
  width: min(960px, 100%);
  height: 100dvh;
  min-height: 0;
  max-height: 100dvh;
  overflow: hidden;
  background: #fff;
  color: #172033;
}

.shell.exam main {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  background: #fff;
  padding-bottom: 0.85rem;
}

.exam-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.75rem;
  background: #0c2340;
  color: #fff;
  padding: calc(0.65rem + env(safe-area-inset-top)) 0.85rem 0.65rem;
}

.exam-brand {
  display: flex;
  flex-direction: column;
  font-weight: 800;
  line-height: 1.15;
}

.exam-brand small {
  font-weight: 600;
  font-size: 0.78rem;
  opacity: 0.88;
}

.exam-count {
  margin-inline-start: auto;
  font-weight: 700;
}

.exam-leave {
  min-height: 44px;
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  background: transparent;
  color: #fff;
  font-weight: 700;
}

.shell.exam .btn.primary {
  background: #0c2340;
  border-color: #0c2340;
  color: #fff;
}

.shell.exam .btn.secondary {
  color: #0c2340;
  border-color: #0c2340;
}

.exam-foot {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
  padding: 0.55rem 0.7rem 0.4rem;
  background: #eef0f4;
}

.clock-box {
  background: #e4e7ee;
  border: 2px solid transparent;
  border-radius: 4px;
  text-align: center;
  padding: 0.4rem 0.3rem 0.5rem;
}

.clock-box > span {
  display: block;
  font-size: clamp(0.62rem, 2.6vw, 0.78rem);
  font-weight: 800;
  letter-spacing: 0.04em;
}

.clock-box strong {
  display: block;
  margin-top: 0.15rem;
  font-family: ui-monospace, "Cascadia Mono", "Segoe UI Mono", monospace;
  font-size: clamp(1.05rem, 4.8vw, 1.75rem);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.clock-box.is-active {
  background: #fff;
  border-color: #0c2340;
}

.clock-box.is-live { border-color: #9d1c2a; }

.rec-dot {
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  margin-inline-end: 0.3rem;
  border-radius: 50%;
  background: #c42323;
  vertical-align: middle;
}

.exam-notice {
  margin: 0;
  padding: 0.3rem 0.85rem calc(0.45rem + env(safe-area-inset-bottom));
  background: #fff;
  color: #4c5566;
  font-size: 0.75rem;
}

.exam-script,
.mic-sentence {
  font-size: 1.15rem;
  font-weight: 700;
  text-align: center;
}

.meter {
  height: 0.85rem;
  background: #e6e8ed;
  border-radius: 999px;
  overflow: hidden;
}

.meter span {
  display: block;
  height: 100%;
  width: 0;
  background: #0c2340;
}

.countup { text-align: center; }

.count-num {
  margin: 0;
  font-family: ui-monospace, "Cascadia Mono", "Segoe UI Mono", monospace;
  font-size: clamp(2.4rem, 12vw, 4rem);
  font-variant-numeric: tabular-nums;
  line-height: 1.05;
}

.count-target { margin: 0.2rem 0 0; font-weight: 700; }

.countup.is-over .count-num {
  color: #8a5a12;
  background: #f8efd8;
  border-radius: 12px;
}

.estimate {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0.9rem 1rem;
}

.estimate-flag {
  display: inline-block;
  width: fit-content;
  margin: 0;
  padding: 0.12rem 0.45rem;
  border-radius: 6px;
  background: #0c2340;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.estimate-score {
  margin: 0.15rem 0 0;
  font-size: clamp(1.7rem, 7vw, 2.5rem);
  font-weight: 800;
  line-height: 1.1;
}

.estimate-level { margin: 0; font-size: 1.25rem; font-weight: 800; }

.can-do { margin: 0; }

.part-bars, .history-block { display: flex; flex-direction: column; gap: 0.4rem; }

.part-bars h2, .history-block h2, .compare h3, .model-answer h3, .facts h3 {
  margin: 0;
  font-size: 1rem;
}

.part-bar-label {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  font-weight: 700;
}

.part-bar-track {
  height: 0.7rem;
  background: #e6e8ed;
  border-radius: 999px;
  overflow: hidden;
}

.part-bar-track span {
  display: block;
  height: 100%;
  background: #0c2340;
}

.part-bar.is-fix .part-bar-track span { background: #9d1c2a; }

.fix-note {
  margin: 0.1rem 0 0.35rem;
  color: #9d1c2a;
  font-weight: 800;
}

.history { width: 100%; height: auto; }
.history line { stroke: #c5cad3; stroke-width: 1; }
.history polyline { fill: none; stroke: #0c2340; stroke-width: 2.5; }
.history circle { fill: #0c2340; }
.history text { font-size: 12px; fill: #0c2340; font-weight: 700; }

.compare {
  display: grid;
  gap: 0.7rem;
}

.checks {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.check.hit { color: #146c43; }
.check.miss.main strong { font-weight: 800; }

@media (min-width: 720px) {
  .compare { grid-template-columns: 1fr 1fr; }
  .shell:has(.estimate) { width: min(760px, 100%); }
}

@media (max-width: 380px) {
  .exam-count { margin-inline-start: 0; }
}

/* ---- Redesign: two modes, desktop first ---- */
.home-title { font-size: clamp(2rem, 4vw, 2.8rem); }
.lang-big select { font-size: 1.15rem; min-height: 3rem; }
.lang-big > span { font-weight: 700; font-size: 1.1rem; }
.home-fields { display: grid; gap: 0.85rem; }
.mode-pick { display: grid; gap: 0.85rem; }
.mode-btn { display: flex; flex-direction: column; align-items: center; gap: 0.3rem; min-height: 6.5rem; padding: 1rem 1.25rem; text-align: center; }
.mode-btn strong { font-size: 1.45rem; }
.mode-btn small { font-size: 1rem; font-weight: 500; opacity: 0.92; }
.mode-btn.alt { background: var(--prep, #b5542d); border-color: var(--prep, #b5542d); }
details.cloud { font-size: 0.95rem; }
details.cloud summary { cursor: pointer; }
details.cloud .details-link { text-decoration: underline; margin-inline-start: 0.4rem; }
.legal .disclaimer { font-size: 0.78rem; opacity: 0.8; }
.part-grid { display: grid; gap: 0.85rem; }
.pick-list { list-style: none; margin: 0.5rem 0 0; padding: 0; display: grid; gap: 0.5rem; }
.pick-row { display: grid; grid-template-columns: 1fr auto auto; gap: 0.5rem; align-items: center; }
.pick-row .btn { min-height: 2.6rem; padding-block: 0.4rem; width: auto; }
.pick-q { font-weight: 700; }
.tip { font-size: 0.95rem; margin: 0.35rem 0 0; }
.tips { border-inline-start: 4px solid var(--prep, #b5542d); padding: 0.4rem 0.8rem; background: rgba(181, 84, 45, 0.07); border-radius: 6px; }
.tips h3, .tips p { margin: 0.15rem 0; }
.lang-mini { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.9rem; }
.lang-mini select { font-size: 0.9rem; max-width: 9rem; padding: 0.2rem 0.3rem; }
.exam-top .lang-mini { margin-inline-start: auto; }
#lang-float { position: fixed; top: 0.75rem; inset-inline-end: 0.75rem; z-index: 2147483000; background: #fff; border-radius: 8px; padding: 0.35rem 0.55rem; box-shadow: 0 2px 8px rgba(0,0,0,0.2); }
#lang-float[hidden] { display: none; }

@media (min-width: 1000px) {
  body { font-size: 1.15rem; }
  .shell { width: min(1100px, 100%); }
  .shell.exam { width: min(1100px, 100%); }
  main { padding: 2rem 2.5rem 2.5rem; gap: 1.1rem; }
  .home-fields { grid-template-columns: 1fr 1fr; }
  .mode-pick { grid-template-columns: 1fr 1fr; }
  .part-grid { grid-template-columns: 1fr 1fr; }
  .compare { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
  .answers { display: grid; gap: 1rem; }
  .dock.actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }
  .dock.actions .btn { width: auto; flex: 1 1 14rem; }
  .lang-big { max-width: 26rem; }
}

/* Round 1023b: big score, picture beside the tick list */
.big-score { font-size: 2rem; margin: .5rem 0; display: flex; align-items: baseline; gap: .5rem; }
.big-score strong { font-size: 2.6rem; line-height: 1; }
.big-score-label { font-size: 1.1rem; font-weight: 600; opacity: .8; }
.pic-checks { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.pic-checks .frame { margin: 0; }
.pic-checks .checks { list-style: none; padding: 0; margin: 0; }
.pic-checks .check { display: flex; gap: .5rem; padding: .25rem 0; }
.pic-checks .check .tick { font-weight: 700; width: 1.2em; flex: none; }
.pic-checks .check.hit .tick { color: #1a7f37; }
.pic-checks .check.miss .tick { color: #c62828; }
@media (max-width: 720px) { .pic-checks { grid-template-columns: 1fr; } }

.dual-mark{display:grid;grid-template-columns:minmax(0,3fr) minmax(0,2fr);gap:1rem;align-items:start}
.mark-panel{border:1px solid #d8dde6;border-radius:12px;padding:.8rem}
.mark-panel>h3{margin:0 0 .4rem;font-size:1rem}
.ai-tip{margin:.5rem 0 0}
@media (max-width:760px){.dual-mark{grid-template-columns:1fr}}
