@font-face { font-family: "IBM Plex Sans"; src: url("../fonts/IBMPlexSans.woff2") format("woff2"); font-weight: 100 700; font-display: swap; }
@font-face { font-family: "Sora"; src: url("../fonts/Sora.woff2") format("woff2"); font-weight: 100 800; font-display: swap; }
/* Arvischool — ArvITP brand palette, blue/white look inspired by the DRPCIV exam PC */
:root {
  /* brand */
  /* ArvITP brand palette (DispatchOS/DESIGN.md) */
  --blue: #003b8e; --blue-d: #071b3a; --blue-l: #e8edf5; --blue-m: #dce6f2;
  --brand-cyan: #4fb3d9;
  --ink: #0a1d33; --muted: #53677d; --line: #dae3ee; --bg: #f5f8fc; --card: #ffffff;
  --font-ui: "IBM Plex Sans", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Sora", "IBM Plex Sans", "Segoe UI", Roboto, Arial, sans-serif;
  --ok: #1b6b45; --ok-bg: #dcefe5; --bad: #ba1a1a; --bad-bg: #ffdad6;
  --warn: #8a6209; --warn-bg: #fbf1d8; --sel: #ffe08a; --sel-bd: #e0a800;
  /* Spanish / helper layer */
  --es-ink: #7a3e00; --es-bg: #fff6ea; --es-bd: #f2c48a;
  /* key terms */
  --kt-ink: #5b21b6; --kt-bg: #f1eaff; --kt-bd: #c4b0f5;
  /* type scale */
  --fs-q: 1.375rem; --fs-a: 1.1875rem; --fs-tr: 1rem; --fs-ui: 1rem; --fs-small: .875rem;
  --lh: 1.5;
  --tap: 48px; --tap-sim: 56px;
  --radius: 10px;
  --tabbar-h: 0px; /* height of the mobile bottom tab bar; use for sticky bottom bars: bottom: var(--tabbar-h) */
  --shadow: 0 1px 3px rgba(16, 40, 80, .08), 0 4px 14px rgba(16, 40, 80, .06);
}
@media (max-width: 640px) { :root { --fs-q: 1.25rem; --fs-a: 1.0625rem; --fs-tr: .9375rem; } }
html.big { font-size: 112.5%; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 1.0625rem/var(--lh) var(--font-ui);
}
a { color: var(--blue); }
h1 { font-size: 1.6rem; margin: .4em 0 .6em; }
h2, h3 { margin: .3em 0 .6em; }
.sub { font-size: .6em; font-weight: 400; color: var(--muted); margin-left: .4em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.hidden { display: none !important; }
kbd { border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 .35em; background: #fff; font-size: .85em; }

/* ---------------------------------------------------------- header + nav + stage control */
.topnav {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  background: var(--blue); color: #fff; padding: 6px 16px; box-shadow: 0 2px 6px rgba(0, 0, 0, .15);
}
.brand { display: flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; font-weight: 700; flex: 0 0 auto; }
.brand-mark { height: 22px; width: auto; display: block; }
.brand-t { font-family: var(--font-display); font-weight: 700; letter-spacing: .14em; font-size: 1.05rem; }
.brand-t b { font-weight: 800; }
h1, h2, h3, .h-display { font-family: var(--font-display); letter-spacing: -.01em; }
.links { display: flex; gap: 2px; flex: 1; min-width: 0; }
.links a {
  color: #e3ecf8; text-decoration: none; padding: 4px 10px; border-radius: 8px; font-weight: 600; font-size: .95rem;
  display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; min-height: 44px;
  touch-action: manipulation;
}
.nav-ico { display: none; }
.links a .sub-tr { font-weight: 400; font-size: .7rem; opacity: .85; margin: 0; color: inherit; }
.links a:hover, .links a.on { background: rgba(255, 255, 255, .16); color: #fff; }
/* legacy page code may re-fill [data-t] with SF.t2 (inline helper): render it like the sublabel */
.links a .tr-inline { display: block; margin: 0; font-size: .7rem; opacity: .85; }
.links a .tr-inline::before { content: none; }
.hdr-tools { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.stagectl-l { display: none; color: #e3ecf8; font-size: .8rem; font-weight: 700; line-height: 1.1; text-align: right; }
.stagectl-l .sub-tr { font-size: .68rem; opacity: .85; }
@media (min-width: 1000px) { .stagectl-l { display: block; } }
.stagectl { display: inline-flex; background: rgba(255, 255, 255, .14); border-radius: 10px; padding: 3px; gap: 2px; }
.stagectl button {
  border: 0; background: transparent; color: #fff; font: inherit; font-size: .85rem; font-weight: 700; white-space: nowrap;
  min-height: 40px; min-width: 44px; padding: 0 10px; border-radius: 8px; cursor: pointer; touch-action: manipulation;
}
.stagectl button.active { background: #fff; color: var(--blue); }
.gear {
  border: 0; background: rgba(255, 255, 255, .14); color: #fff; font-size: 1.3rem; line-height: 1;
  width: 44px; height: 44px; border-radius: 10px; cursor: pointer; touch-action: manipulation;
}
.gear:hover, .stagectl button:not(.active):hover { background: rgba(255, 255, 255, .25); }
.topnav :focus-visible { outline: 3px solid #ffd54a; outline-offset: 1px; }
/* simulator: no chrome at all (common.js also removes [data-sim-remove] from the DOM) */
body.sim .topnav, body.sim .sheet-wrap { display: none !important; }

/* generic segmented control (settings sheet) */
.seg { display: inline-flex; align-items: center; background: var(--blue-l); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button {
  border: 0; background: transparent; color: var(--blue-d); font: inherit; font-weight: 700;
  min-height: 40px; min-width: 52px; padding: 0 12px; border-radius: 8px; cursor: pointer;
}
.seg button.active { background: var(--blue); color: #fff; }

/* ---------------------------------------------------------- settings sheet */
.sheet-wrap { position: fixed; inset: 0; z-index: 60; }
.sheet-wrap[hidden] { display: none; }
.sheet-bg { position: absolute; inset: 0; background: rgba(10, 25, 50, .45); }
.sheet {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(380px, 100%); background: #fff; color: var(--ink);
  overflow-y: auto; padding: 14px 18px 24px; box-shadow: -4px 0 20px rgba(0, 0, 0, .2);
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; }
.sheet-head h2 { margin: 0; font-size: 1.3rem; }
.sheet-x { border: 0; background: var(--blue-l); color: var(--blue-d); font-size: 1.5rem; width: 44px; height: 44px; border-radius: 10px; cursor: pointer; }
.set-group { margin-top: 18px; }
.set-group h3 { font-size: 1rem; margin: 0 0 8px; }
.set-group h3 .sub-tr { font-size: .8rem; }
.stage-opts { display: grid; gap: 8px; }
.stage-opt {
  text-align: left; font: inherit; color: var(--ink); background: #fff; border: 2px solid var(--line); border-radius: 10px;
  padding: 10px 12px; min-height: var(--tap); cursor: pointer; display: flex; flex-direction: column; gap: 2px;
}
.stage-opt span { color: var(--muted); font-size: var(--fs-small); }
.stage-opt.active { border-color: var(--blue); background: var(--blue-l); }
.warn-line { color: var(--warn); background: var(--warn-bg); border-radius: 8px; padding: 6px 10px; font-size: var(--fs-small); margin: 8px 0 0; }
.warn-line[hidden] { display: none; }
.chk-row { display: flex; align-items: center; gap: 10px; min-height: var(--tap); font-weight: 600; cursor: pointer; }
.chk-row input { width: 22px; height: 22px; }
.danger-link { color: var(--bad); border-color: var(--bad); }
html.sheet-open { overflow: hidden; }

/* ---------------------------------------------------------- layout */
.wrap { max-width: 980px; margin: 0 auto; padding: 16px; }
.wrap.wide { max-width: 1180px; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; margin-bottom: 16px; }

.btn {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 0;
  border: 1px solid var(--line); background: #fff; color: var(--ink); text-decoration: none;
  font: inherit; font-weight: 600; padding: 8px 16px; border-radius: 8px; cursor: pointer; line-height: 1.2; min-height: var(--tap);
}
.btn small { font-weight: 400; font-size: .72rem; opacity: .85; }
.btn, .dpb, .ans { touch-action: manipulation; }
.btn:hover { border-color: var(--blue); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--blue); color: #fff; border-color: var(--blue); }
.btn.primary:hover { background: var(--blue-d); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.bad { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.big { font-size: 1.15rem; padding: 12px 28px; }
.link-btn { background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; font: inherit; font-size: .85rem; }
.badge { display: inline-block; font-size: .75rem; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--blue-l); color: var(--blue); vertical-align: middle; }
.badge:empty { display: none; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.warn { background: var(--warn-bg); color: var(--warn); font-weight: 600; padding: 4px 10px; border-radius: 6px; }
.c-ok { color: var(--ok); font-weight: 700; }
.c-bad { color: var(--bad); font-weight: 700; }
.badge.multi { background: var(--warn-bg); color: var(--warn); }
.chip {
  display: inline-flex; align-items: center; gap: 4px; font: inherit; font-size: var(--fs-small); font-weight: 600;
  min-height: 36px; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--ink); cursor: pointer;
}
.chip.active { background: var(--blue); color: #fff; border-color: var(--blue); }

/* ---------------------------------------------------------- home */
.hero h1 { font-size: 1.9rem; margin-bottom: .2em; }
.lead { font-size: 1.1rem; margin: .3em 0; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin: 18px 0; }
.tile {
  display: block; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px 18px; text-decoration: none; color: var(--ink); border-top: 4px solid var(--blue-m); transition: transform .1s;
}
.tile:hover { transform: translateY(-2px); border-top-color: var(--blue); }
.tile h2 { font-size: 1.2rem; margin: .2em 0 0; }
.tile .es { margin: 0 0 .5em; color: var(--muted); }
.tile .d { margin: 0; font-size: .9rem; }
.tile-ico { font-size: 1.8rem; }
.tile-exam { background: var(--blue); color: #fff; border-top-color: #ffd54a; }
.tile-exam .es, .tile-exam .muted { color: var(--blue-m); }
.howto ul { padding-left: 1.2em; margin: 0; }
.howto li { margin-bottom: .6em; }

/* ---------------------------------------------------------- dual-language text + helper layer */
.tx { display: block; }
.tx-main { display: inline; }
.tx-tr {
  display: block; font-size: var(--fs-tr); color: var(--es-ink); font-style: normal; font-weight: 400;
  border-left: 3px solid var(--es-bd); padding-left: 8px; margin-top: 4px; line-height: 1.4;
}
.tx-tr[hidden] { display: none; }
.tr-pill {
  display: inline-flex; align-items: center; justify-content: center; vertical-align: middle;
  min-width: 32px; min-height: 32px; padding: 0 6px; margin-left: 6px; border-radius: 8px;
  background: var(--es-bg); color: var(--es-ink); border: 1px solid var(--es-bd);
  font: inherit; font-size: .78rem; font-weight: 800; letter-spacing: .5px; cursor: pointer; touch-action: manipulation;
}
.tr-pill[aria-expanded="true"] { background: var(--es-bd); }
/* P3-5: 32px visual, >= 44px tap area (the pseudo-element belongs to the button, so near-misses hit the pill) */
.tr-pill { position: relative; }
.tr-pill::after { content: ""; position: absolute; inset: -7px; border-radius: 12px; }
.stage-opt small.sub-tr { color: var(--es-ink); }
small.sub-tr { display: block; font-size: .75em; font-weight: 400; opacity: .9; margin-top: 1px; }
.tr-inline { font-size: .8em; color: inherit; opacity: .75; font-weight: 400; margin-left: .3em; }
.tr-inline::before { content: "· "; }
.see-tr {
  font: inherit; font-size: var(--fs-small); font-weight: 600; color: var(--es-ink); background: var(--es-bg);
  border: 1px solid var(--es-bd); border-radius: 8px; min-height: 36px; padding: 4px 12px; margin-top: 6px; cursor: pointer;
}
/* key terms */
.kt {
  font: inherit; color: var(--kt-ink); background: var(--kt-bg); border: 0; border-bottom: 2px dotted var(--kt-bd);
  border-radius: 3px; padding: 0 2px; margin: 0; cursor: help; line-height: inherit; text-align: inherit;
}
.kt:hover, .kt[aria-expanded="true"] { background: var(--kt-bd); }
.kt-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 12px; }
.kt-chips-h { font-size: var(--fs-small); font-weight: 700; color: var(--muted); margin-right: 4px; }
.kt-chips-h .sub-tr { display: inline; margin-left: 4px; }
.kt-chip { color: var(--kt-ink); background: var(--kt-bg); border-color: var(--kt-bd); }
.chip-tr { color: var(--es-ink); font-weight: 400; }
/* term popover / bottom sheet */
.term-pop {
  position: absolute; z-index: 70; width: 300px; max-width: calc(100vw - 16px); background: #fff; color: var(--ink);
  border: 1px solid var(--kt-bd); border-radius: 12px; box-shadow: 0 8px 28px rgba(16, 40, 80, .22); padding: 12px 14px;
}
.term-pop.term-sheet {
  position: fixed; left: 0; right: 0; bottom: 0; top: auto; width: auto; max-width: none;
  border-radius: 16px 16px 0 0; padding: 16px 18px calc(18px + env(safe-area-inset-bottom));
}
.term-x { position: absolute; top: 6px; right: 6px; width: 40px; height: 40px; border: 0; background: transparent; font-size: 1.5rem; color: var(--muted); cursor: pointer; border-radius: 8px; }
.term-head { display: flex; gap: 10px; align-items: flex-start; padding-right: 36px; }
.term-ico { font-size: 2rem; line-height: 1; width: 36px; text-align: center; }
.term-en { font-weight: 800; font-size: 1.15rem; }
.term-es { color: var(--es-ink); font-weight: 600; }
.term-ro { color: var(--muted); font-size: var(--fs-small); }
.term-def { margin: 8px 0 0; }
.term-def.tx-tr { margin-top: 4px; }
.term-more { display: inline-flex; align-items: center; min-height: 40px; margin-top: 8px; font-weight: 700; }

/* ---------------------------------------------------------- answers (shared) */
.answers, .dp-answers { display: flex; flex-direction: column; gap: 10px; }
.ans {
  display: flex; align-items: flex-start; gap: 12px; padding: 10px 14px; cursor: pointer; user-select: none; min-height: var(--tap);
  background: #fff; border: 2px solid var(--line); border-radius: 8px; transition: background .1s, border-color .1s;
  position: relative;
}
.ans:hover { border-color: var(--blue); }
.ans .letter {
  flex: 0 0 34px; height: 34px; display: grid; place-items: center; border-radius: 6px;
  background: var(--blue-l); color: var(--blue); font-weight: 800; font-size: 1.05rem;
}
.ans .ans-text { flex: 1; padding-top: 4px; font-size: var(--fs-a); min-width: 0; }
.ans:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
@media (hover: none) { .ans:hover { border-color: var(--line); } }
.ans.sel { background: #fff7d6; border-color: var(--sel-bd); }
.ans.sel .letter { background: var(--sel-bd); color: #fff; }
.answers.static .ans, .ans.ok, .ans.bad { cursor: default; }
.ans.ok { background: var(--ok-bg); border-color: var(--ok); }
.ans.ok .letter { background: var(--ok); color: #fff; }
.ans.bad { background: var(--bad-bg); border-color: var(--bad); }
.ans.bad .letter { background: var(--bad); color: #fff; }
.ans.missed { border-style: dashed; }
.ans.dim { opacity: .55; }
.mark { font-size: 1.3rem; font-weight: 800; padding-top: 2px; }
.ok-m { color: var(--ok); }
.bad-m { color: var(--bad); }
.shake { animation: shake .35s; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* feedback + explanation */
.feedback { margin-top: 14px; border-radius: 8px; padding: 12px 14px; border-left: 6px solid; }
.feedback.fb-ok { background: var(--ok-bg); border-color: var(--ok); }
.feedback.fb-bad { background: var(--bad-bg); border-color: var(--bad); }
.fb-title { font-weight: 800; font-size: 1.1rem; }
.fb-ok .fb-title { color: var(--ok); }
.fb-bad .fb-title { color: var(--bad); }
.fb-correct { font-weight: 600; color: var(--ink); margin-left: .5em; }
.explain { margin-top: 10px; background: #fff; border-radius: 6px; padding: 10px 12px; }
.explain-h { font-weight: 700; color: var(--blue); margin-bottom: 4px; }
.explain p { margin: .3em 0; }
.explain .ex-es { color: var(--es-ink); }
.explain .ex-main { font-size: var(--fs-a); }
/* feedback panel (SF.feedbackHtml) */
.fb-verdict { font-weight: 800; font-size: 1.15rem; display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; }
.fb-ok .fb-verdict { color: var(--ok); }
.fb-bad .fb-verdict { color: var(--bad); }
.fb-verdict .sub-tr { display: inline; margin-left: 4px; }
.fb-verdict .badge .sub-tr { display: inline; }
.fb-sec { margin-top: 10px; }
.fb-h { font-weight: 700; font-size: var(--fs-small); color: var(--ink); margin-bottom: 4px; }
.fb-h .sub-tr { display: inline; margin-left: 4px; color: var(--es-ink); }
.fb-line { display: flex; gap: 10px; align-items: flex-start; background: #fff; border-radius: 8px; padding: 8px 10px; margin-top: 4px; border-left: 4px solid var(--line); }
.fb-line.is-ok { border-left-color: var(--ok); }
.fb-line.is-bad { border-left-color: var(--bad); color: var(--bad); }
.fb-at { flex: 1; min-width: 0; }
.lchip { flex: 0 0 28px; height: 28px; display: grid; place-items: center; border-radius: 6px; font-weight: 800; background: var(--ok); color: #fff; }
.is-bad .lchip { background: var(--bad); }
/* compact feedback (persona P2-1): correct answer(s), "You chose: A ✘", then Why */
.fb-key { margin-top: 8px; }
.fb-key .fb-line { margin-top: 2px; }
.fb-chose { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 6px; font-weight: 600; font-size: var(--fs-small); }
.fb-chose .fb-k .sub-tr { display: inline; margin-left: 4px; color: var(--es-ink); font-weight: 400; }
.fb-pick { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; }
.fb-pick.is-bad { color: var(--bad); }
.fb-pick.is-ok { color: var(--ok); }
/* the Why block is the scroll target: keep it clear of the sticky header (top) and action bar + tab bar (bottom) */
.fb-why, .fb { scroll-margin-top: 72px; scroll-margin-bottom: calc(var(--tabbar-h) + 88px); }
/* one Next only: while a feedback panel with its own Next is shown, page-level Next buttons marked .sf-hide-on-fb hide */
:root:has(.fb.fb-has-next) .sf-hide-on-fb { display: none !important; }
/* readiness "Let's start" (fewer than 20 answers): neutral, not red (P3-6). Pages may use r.lvl -> .lvl-start. */
.meter-fill.lvl-start { background: var(--muted) !important; }
.meter-label.lvl-start { color: var(--muted) !important; }
.fb-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.fb-actions .btn { flex: 1 1 180px; }
.lang-tag { display: inline-block; font-size: .68rem; background: var(--blue-l); color: var(--blue); border-radius: 4px; padding: 0 5px; font-style: normal; margin-right: 4px; }

/* ---------------------------------------------------------- exam: start */
.start-card { max-width: 760px; margin: 0 auto; }
.rules li { margin-bottom: .45em; }
.opt-row { display: grid; gap: 10px; margin: 16px 0; }
.radio { display: flex; gap: 10px; align-items: flex-start; border: 2px solid var(--line); padding: 10px 12px; border-radius: 8px; cursor: pointer; }
.radio:has(input:checked) { border-color: var(--blue); background: var(--blue-l); }
.radio input { margin-top: 4px; }

/* ---------------------------------------------------------- exam: DRPCIV screen */
.drpciv { background: #fff; border: 1px solid var(--blue-m); border-radius: 8px; overflow: hidden; box-shadow: var(--shadow); }
.dp-top { display: flex; align-items: stretch; background: linear-gradient(#0d5bb3, var(--blue)); color: #fff; }
.dp-counters { display: grid; grid-template-columns: repeat(4, 1fr); flex: 1; }
.dp-c { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-right: 1px solid rgba(255, 255, 255, .2); }
.dp-n {
  min-width: 52px; text-align: center; background: #fff; color: var(--blue); font-weight: 800; font-size: 1.5rem;
  border-radius: 6px; padding: 2px 6px; font-variant-numeric: tabular-nums;
}
.c-ok .dp-n, .dp-c.ok .dp-n { color: var(--ok); }
.c-bad .dp-n, .dp-c.bad .dp-n { color: var(--bad); }
.dp-c, .dp-c.c-ok, .dp-c.c-bad, .dp-c .dp-l { color: #fff; }
.dp-l { font-size: .85rem; font-weight: 600; line-height: 1.15; color: #fff; }
.dp-l small { display: block; font-weight: 400; font-size: .72rem; opacity: .75; }
.dp-timer { display: flex; align-items: center; gap: 10px; padding: 10px 18px; background: var(--blue-d); }
.dp-time { font-size: 2rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: 1px; }
.dp-time.low { color: #ffd54a; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .55; } }
.dp-qbar { display: flex; justify-content: space-between; gap: 10px; background: var(--blue-l); color: var(--blue-d); padding: 6px 16px; font-weight: 700; border-bottom: 1px solid var(--blue-m); }
.dp-qbar small { font-weight: 400; }
.dp-chap { font-weight: 400; font-size: .85rem; color: var(--muted); }
.dp-question { padding: 16px 18px 6px; font-size: var(--fs-q); font-weight: 600; min-height: 3.2em; }
.dp-question .tx-tr { font-weight: 400; }
.dp-body { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 18px; padding: 10px 18px 6px; align-items: start; }
.drpciv.noimg .dp-body { grid-template-columns: 1fr; }
.dp-answers .ans { font-size: 1.08rem; min-height: 64px; }
.dp-image { background: #f7f9fc; border: 1px solid var(--line); border-radius: 8px; padding: 8px; display: grid; place-items: center; aspect-ratio: 4 / 3; max-height: 400px; width: 100%; }
.dp-image img { width: 100%; height: 100%; object-fit: contain; display: block; }
.drpciv .feedback { margin: 10px 18px 0; }
.dp-buttons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding: 16px 18px; }
#dpNext { grid-template-columns: 1fr; max-width: 420px; margin-left: auto; }
.dpb {
  font: inherit; font-weight: 700; font-size: 1.05rem; color: #fff; border: 0; border-radius: 8px; padding: 12px 10px;
  cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.2;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .18); min-height: var(--tap-sim);
}
.dpb small { display: block; font-weight: 400; font-size: .75rem; opacity: .85; }
.dpb:active { transform: translateY(1px); }
.dpb.later { background: #1a73c9; }
.dpb.clear { background: #d9534f; }
.dpb.submit { background: #2e9e48; }
.dp-foot { display: flex; justify-content: space-between; align-items: center; padding: 6px 18px 12px; gap: 10px; flex-wrap: wrap; }

/* ---------------------------------------------------------- exam: result */
.result { text-align: center; border-top: 8px solid; }
.res-ok { border-color: var(--ok); }
.res-bad { border-color: var(--bad); }
.res-big { font-size: 3rem; font-weight: 900; letter-spacing: 3px; }
.res-ok .res-big { color: var(--ok); }
.res-bad .res-big { color: var(--bad); }
.res-sub { font-weight: 700; color: var(--muted); }
.res-stats { display: flex; justify-content: center; gap: 22px; font-size: 1.4rem; margin: 10px 0; flex-wrap: wrap; }
#examEnd .center { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 16px; }
.review-title { margin-top: 24px; }
details.more { margin: 14px 0; }
details.more summary { cursor: pointer; font-weight: 700; padding: 8px 0; color: var(--blue); }

/* ---------------------------------------------------------- learn */
.setup-row { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
.setup-row label { display: flex; flex-direction: column; font-weight: 600; font-size: .9rem; gap: 4px; min-width: 0; flex: 1 1 220px; max-width: 100%; }
.setup-row label.chk { flex: 0 1 auto; }
.setup-row label small { font-weight: 400; color: var(--muted); }
.setup-row label.chk { flex-direction: row; align-items: center; gap: 6px; padding-bottom: 10px; }
select, input, textarea { max-width: 100%; }
select { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; width: 100%; min-width: 0; min-height: var(--tap); text-overflow: ellipsis; }
input[type="text"], input[type="search"] { font: inherit; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; min-height: var(--tap); width: 100%; }
.sessionbar { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; font-variant-numeric: tabular-nums; }
.pbar { flex: 1; height: 8px; background: var(--blue-m); border-radius: 99px; overflow: hidden; position: relative; min-width: 60px; }
.pbar > div { position: absolute; left: 0; top: 0; bottom: 0; background: var(--blue); border-radius: 99px; transition: width .2s; }
.pbar .pf-seen { background: var(--blue-m); filter: brightness(.85); }
.pbar .pf-ok { background: var(--ok); }
.qcard .qmeta { font-size: .82rem; color: var(--muted); margin-bottom: 8px; }
.qtext { font-size: var(--fs-q); font-weight: 600; margin-bottom: 14px; }
.qtext .tx-tr { font-weight: 400; }
.qlayout { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.qlayout.noimg { grid-template-columns: 1fr; }
.qimg { background: #f7f9fc; border: 1px solid var(--line); border-radius: 8px; padding: 8px; display: grid; place-items: center; aspect-ratio: 4 / 3; max-height: 380px; width: 100%; }
.qimg img { width: 100%; height: 100%; object-fit: contain; display: block; }
.qactions { display: flex; justify-content: space-between; gap: 10px; margin-top: 16px; }
.qactions .btn { flex: 1; max-width: 240px; }
.review-card .qtext { font-size: 1.1rem; }

/* ---------------------------------------------------------- flashcards */
.flashcard {
  background: #fff; border-radius: 14px; box-shadow: var(--shadow); padding: 16px; cursor: pointer;
  border: 3px solid var(--blue-m); outline: none; transition: border-color .15s;
}
.flashcard:focus-visible, .flashcard:hover { border-color: var(--blue); }
.flashcard.flipped { border-color: var(--ok); cursor: default; }
.fc-img { display: grid; place-items: center; background: #f7f9fc; border-radius: 10px; padding: 10px; width: 100%; overflow: hidden; --fc-img-h: 55vh; }
.fc-img img { max-width: 100%; max-height: var(--fc-img-h); width: auto; height: auto; object-fit: contain; display: block; }
.fc-q { font-size: var(--fs-q); font-weight: 600; margin: 14px 4px 6px; }
.fc-hint { color: var(--blue); font-weight: 600; text-align: center; padding: 10px; }
.fc-back { margin-top: 10px; }

/* ---------------------------------------------------------- stats */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; }
.kpi-v { font-size: 1.7rem; font-weight: 800; color: var(--blue); font-variant-numeric: tabular-nums; }
.kpi-l { font-size: .85rem; font-weight: 600; }
.kpi-l small { display: block; color: var(--muted); font-weight: 400; }
.table-wrap { overflow-x: auto; }
table.stats { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.stats th, table.stats td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
table.stats th { font-size: .78rem; color: var(--muted); font-weight: 600; }
table.stats td .pbar { height: 10px; }
.toplist { padding-left: 1.4em; color: var(--ink); }
.toplist li { margin-bottom: 8px; }
.toplist .badge { float: right; margin-left: 8px; }

/* ---------------------------------------------------------- responsive */
@media (max-width: 860px) {
  .dp-counters { grid-template-columns: repeat(2, 1fr); }
  .dp-c { padding: 6px 10px; border-bottom: 1px solid rgba(255, 255, 255, .15); }
  .dp-n { font-size: 1.2rem; min-width: 40px; }
}
/* keyboard hints: only for fine pointers */
@media (pointer: coarse) { .kbd-hint { display: none !important; } }
@media (hover: none) { .kbd-hint { display: none !important; } }

@media (max-width: 720px) {
  :root { --tabbar-h: calc(60px + env(safe-area-inset-bottom)); }
  body:not(.sim) { padding-bottom: var(--tabbar-h); }
  .topnav { padding: 4px 10px; gap: 6px; }
  .brand-t { display: none; }
  /* bottom tab bar */
  .links {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; gap: 0;
    background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -2px 10px rgba(16, 40, 80, .08);
    padding-bottom: env(safe-area-inset-bottom); height: var(--tabbar-h);
  }
  .links a { flex: 1; color: var(--muted); border-radius: 0; padding: 4px 2px; font-size: .74rem; min-height: 60px; gap: 2px; }
  .links a .sub-tr, .links a .tr-inline { display: none; }
  .links a.on { background: var(--blue-l); color: var(--blue); }
  .links a:hover { background: var(--blue-l); color: var(--blue); }
  .nav-ico { display: block; font-size: 1.25rem; line-height: 1; font-weight: 700; }
  .stagectl button { min-height: 44px; padding: 0 8px; }
  .chip, .seg button { min-height: 44px; } /* C9#9: touch targets >= 44px */
  .wrap { padding: 12px; }
  .card { padding: 14px; }
  .dp-top { flex-direction: column; }
  .dp-timer { justify-content: center; padding: 6px; }
  .dp-time { font-size: 1.6rem; }
  .dp-l small { display: none; }
  .dp-question { padding: 12px 12px 4px; }
  .dp-body, .qlayout { grid-template-columns: 1fr; gap: 12px; padding-left: 12px; padding-right: 12px; }
  .qlayout { padding: 0; }
  /* image above the answers on phones */
  .dp-image, .qimg { order: -1; max-height: 34vh; }
  .dp-answers .ans { min-height: var(--tap); }
  .dp-buttons { gap: 6px; padding: 12px; }
  .dpb { font-size: .88rem; padding: 10px 4px; }
  .drpciv .feedback { margin: 10px 12px 0; }
  .hero h1 { font-size: 1.45rem; }
  .hide-sm { display: none; }
  .setup-row > * { flex: 1 1 100%; }
  .setup-row .btn { width: 100%; }
  .sheet { top: auto; left: 0; width: 100%; max-height: 88vh; border-radius: 16px 16px 0 0; padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
}
@media (max-width: 380px) {
  .stagectl button { min-width: 40px; padding: 0 6px; font-size: .8rem; }
}
