/* RAID Open Water oefenexamens — mobile-first */
:root {
  color-scheme: light dark;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #eaf1f9;
  --ink: #0b1526;
  --ink-2: #4c5a6e;
  --ink-3: #8691a1;
  --line: #dde5ee;
  --brand: #0d366b;
  --brand-2: #1c5cab;
  --accent: #2a78d6;
  --accent-soft: #cde2fb;
  --good: #0ca30c;
  --good-text: #006300;
  --good-soft: #e2f4e2;
  --bad: #d03b3b;
  --bad-soft: #fbe7e7;
  --gold: #eda100;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(11,21,38,.06), 0 4px 16px rgba(11,21,38,.07);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117;
    --surface: #161d27;
    --surface-2: #1d2735;
    --ink: #f2f5f9;
    --ink-2: #aeb9c8;
    --ink-3: #77828f;
    --line: #2a3442;
    --brand: #9ec5f4;
    --brand-2: #6da7ec;
    --accent: #3987e5;
    --accent-soft: #17304f;
    --good: #0ca30c;
    --good-text: #4fc24f;
    --good-soft: #12290f;
    --bad: #e66767;
    --bad-soft: #331414;
    --shadow: 0 1px 2px rgba(0,0,0,.4);
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { height: 100%; }
body {
  margin: 0; min-height: 100%;
  background: var(--bg); color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
#app { max-width: 640px; margin: 0 auto; padding: 0 16px 32px; }

/* ---------- header ---------- */
.top {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 0 10px; position: sticky; top: 0; z-index: 10;
  background: var(--bg);
}
.top h1 { font-size: 18px; margin: 0; flex: 1; font-weight: 700; letter-spacing: -.01em; }
.top .sub { color: var(--ink-3); font-size: 12px; margin-top: 1px; }
.backbtn {
  width: 40px; height: 40px; border-radius: 12px; flex: none;
  background: var(--surface); box-shadow: var(--shadow);
  display: grid; place-items: center; font-size: 18px;
}
.langbtn {
  flex: none; border-radius: 999px; padding: 7px 13px; font-weight: 700; font-size: 13px;
  background: var(--surface); box-shadow: var(--shadow); color: var(--brand-2);
}
.langbtn small { color: var(--ink-3); font-weight: 600; }

/* ---------- home ---------- */
.hero {
  background: linear-gradient(145deg, #0d366b, #1c5cab 55%, #2a78d6);
  border-radius: 20px; color: #fff; padding: 20px 18px; margin: 6px 0 18px;
  box-shadow: var(--shadow);
}
.hero h2 { margin: 0 0 2px; font-size: 21px; letter-spacing: -.02em; }
.hero p { margin: 0; opacity: .85; font-size: 13.5px; }
.hero .stats { display: flex; gap: 10px; margin-top: 16px; }
.stat {
  flex: 1; background: rgba(255,255,255,.12); border-radius: 12px; padding: 9px 6px 7px;
  text-align: center; backdrop-filter: blur(4px);
}
.stat b { display: block; font-size: 19px; }
.stat span { font-size: 11px; opacity: .8; }

.sect { margin: 22px 0 10px; display: flex; align-items: baseline; gap: 8px; }
.sect h3 { margin: 0; font-size: 15px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); }
.sect span { color: var(--ink-3); font-size: 12.5px; }

.examgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (min-width: 480px) { .examgrid { grid-template-columns: repeat(5, 1fr); } }
.examtile {
  background: var(--surface); border-radius: 14px; box-shadow: var(--shadow);
  padding: 10px 4px 8px; text-align: center; position: relative;
  border: 2px solid transparent; transition: transform .06s;
}
.examtile:active { transform: scale(.95); }
.examtile b { display: block; font-size: 17px; }
.examtile small { font-size: 10.5px; color: var(--ink-3); display: block; margin-top: 1px; }
.examtile.pass { border-color: var(--good); }
.examtile.pass small { color: var(--good-text); font-weight: 700; }
.examtile.fail small { color: var(--bad); font-weight: 700; }

.cardlist { display: flex; flex-direction: column; gap: 10px; }
.rowcard {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 13px 14px; display: flex; align-items: center; gap: 12px; text-align: left;
  width: 100%; transition: transform .06s;
}
.rowcard:active { transform: scale(.98); }
.rowcard .ic {
  width: 42px; height: 42px; flex: none; border-radius: 12px; background: var(--surface-2);
  display: grid; place-items: center; font-size: 21px;
}
.rowcard .tx { flex: 1; min-width: 0; }
.rowcard .tx b { display: block; font-size: 15px; }
.rowcard .tx small { color: var(--ink-3); font-size: 12px; }
.rowcard .meter { height: 5px; border-radius: 3px; background: var(--surface-2); margin-top: 7px; overflow: hidden; }
.rowcard .meter i { display: block; height: 100%; border-radius: 3px; background: var(--accent); }
.rowcard .pct { flex: none; font-size: 13px; font-weight: 700; color: var(--ink-2); min-width: 38px; text-align: right; }
.rowcard.primary { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; }
.rowcard.primary .ic { background: rgba(255,255,255,.15); }
.rowcard.primary .tx small { color: rgba(255,255,255,.75); }

/* ---------- quiz ---------- */
.qbar { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; margin: 2px 0 14px; }
.qbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand-2), var(--accent)); border-radius: 3px; transition: width .25s; }
.qmeta { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.chip {
  font-size: 12px; font-weight: 700; color: var(--brand-2);
  background: var(--accent-soft); border-radius: 999px; padding: 4px 11px;
}
.qscore { margin-left: auto; font-size: 12.5px; color: var(--ink-3); font-weight: 600; }
.qscore b.ok { color: var(--good-text); } .qscore b.nok { color: var(--bad); }
.qcard {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px 16px; margin-bottom: 14px;
}
.qcard h2 { margin: 0; font-size: 18px; line-height: 1.45; letter-spacing: -.01em; }
.opts { display: flex; flex-direction: column; gap: 10px; }
.opt {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: var(--surface); border: 2px solid var(--line); border-radius: 14px;
  padding: 13px 13px; font-size: 15.5px; line-height: 1.4; transition: transform .06s, border-color .12s;
}
.opt:active { transform: scale(.985); }
.opt .k {
  width: 28px; height: 28px; flex: none; border-radius: 9px; background: var(--surface-2);
  display: grid; place-items: center; font-weight: 800; font-size: 13px; color: var(--ink-2);
}
.opt.correct { border-color: var(--good); background: var(--good-soft); }
.opt.correct .k { background: var(--good); color: #fff; }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); }
.opt.wrong .k { background: var(--bad); color: #fff; }
.opt.dim { opacity: .55; }
.opt:disabled { cursor: default; }

.verdict { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 16px; margin: 16px 0 8px; }
.verdict.ok { color: var(--good-text); } .verdict.nok { color: var(--bad); }
.explain {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px 16px; font-size: 14.5px; color: var(--ink-2);
  border-left: 4px solid var(--accent); animation: pop .18s ease-out;
}
.explain .src { display: block; margin-top: 8px; font-size: 12px; color: var(--ink-3); }
@keyframes pop { from { opacity: 0; transform: translateY(6px); } }

.nextwrap { position: sticky; bottom: 0; padding: 12px 0 8px; background: linear-gradient(transparent, var(--bg) 35%); }
.bigbtn {
  width: 100%; border-radius: 14px; padding: 15px; font-size: 16px; font-weight: 800;
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; box-shadow: var(--shadow);
  transition: transform .06s;
}
.bigbtn:active { transform: scale(.98); }
.bigbtn.ghost { background: var(--surface); color: var(--brand-2); }

/* ---------- result ---------- */
.res {
  text-align: center; background: var(--surface); border-radius: 20px; box-shadow: var(--shadow);
  padding: 26px 18px 22px; margin: 8px 0 14px;
}
.ring { width: 132px; height: 132px; margin: 0 auto 10px; position: relative; }
.ring svg { transform: rotate(-90deg); }
.ring .val { position: absolute; inset: 0; display: grid; place-items: center; font-size: 30px; font-weight: 800; }
.res .badge {
  display: inline-flex; align-items: center; gap: 7px; font-weight: 800; border-radius: 999px;
  padding: 7px 16px; font-size: 14.5px;
}
.res .badge.ok { background: var(--good-soft); color: var(--good-text); }
.res .badge.nok { background: var(--bad-soft); color: var(--bad); }
.res p { color: var(--ink-3); font-size: 13px; margin: 10px 0 0; }
.brk { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; margin-bottom: 14px; }
.brk h4 { margin: 0 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); }
.brow { display: flex; align-items: center; gap: 10px; margin: 7px 0; font-size: 13px; }
.brow .nm { width: 40%; flex: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-2); }
.brow .bar { flex: 1; height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.brow .bar i { display: block; height: 100%; border-radius: 4px; }
.brow .v { flex: none; width: 44px; text-align: right; font-weight: 700; font-size: 12.5px; color: var(--ink-2); }
.mist { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px 16px; margin-bottom: 14px; }
.mist details { border-bottom: 1px solid var(--line); padding: 10px 0; }
.mist details:last-child { border-bottom: 0; }
.mist summary { font-size: 14px; font-weight: 600; cursor: pointer; color: var(--bad); }
.mist .ans { margin: 8px 0 0; font-size: 13.5px; color: var(--ink-2); }
.mist .ans b { color: var(--good-text); }
.btncol { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }

.empty { text-align: center; color: var(--ink-3); padding: 40px 20px; font-size: 14px; }
.footer { text-align: center; color: var(--ink-3); font-size: 11.5px; margin-top: 28px; }
