:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #eef2f7;
  --text: #13202f;
  --muted: #5b6878;
  --line: #d9e0e8;
  --brand: #0f2a4a;
  --brand-text: #ffffff;
  --accent: #ffc928;
  --primary: #1f5fae;
  --primary-text: #ffffff;
  --ok: #1d7a46;
  --ok-bg: #e3f4ea;
  --ko: #b42318;
  --ko-bg: #fde8e6;
  --warn-bg: #fff6d6;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 32, 48, .06), 0 4px 14px rgba(16, 32, 48, .05);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1520;
    --surface: #152131;
    --surface-2: #1c2b3e;
    --text: #e6edf5;
    --muted: #9aa8b9;
    --line: #2a3b51;
    --brand: #0a1a2e;
    --primary: #4c8fe0;
    --primary-text: #08121e;
    --ok: #4cc283;
    --ok-bg: #12301f;
    --ko: #ff7a6e;
    --ko-bg: #3a1714;
    --warn-bg: #3a3214;
    --shadow: none;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0d1520;
  --surface: #152131;
  --surface-2: #1c2b3e;
  --text: #e6edf5;
  --muted: #9aa8b9;
  --line: #2a3b51;
  --brand: #0a1a2e;
  --primary: #4c8fe0;
  --primary-text: #08121e;
  --ok: #4cc283;
  --ok-bg: #12301f;
  --ko: #ff7a6e;
  --ko-bg: #3a1714;
  --warn-bg: #3a3214;
  --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--primary); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
p { margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.wrap { width: 100%; max-width: 780px; margin: 0 auto; padding: 0 16px; }
main.wrap { flex: 1; padding-top: 20px; padding-bottom: 32px; outline: none; }

/* antet */
.top { background: var(--brand); color: var(--brand-text); position: sticky; top: 0; z-index: 10; }
.top-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; font-size: 1.05rem; }
.brand svg { color: #1e4a7d; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { color: #d6e2f0; text-decoration: none; padding: 8px 10px; border-radius: 8px; font-size: .95rem; }
.nav a:hover, .nav a.on { background: rgba(255, 255, 255, .12); color: #fff; }
.pill[hidden] { display: none; }
.pill { display: inline-block; min-width: 1.4em; padding: 0 6px; border-radius: 999px; background: var(--accent); color: #2b2100; font-size: .75rem; font-weight: 700; text-align: center; }

/* subsol */
.foot { border-top: 1px solid var(--line); padding: 18px 0 28px; font-size: .85rem; color: var(--muted); }
.foot p { margin-bottom: .5rem; }
button.link { background: none; border: 0; padding: 0; color: var(--primary); cursor: pointer; font: inherit; text-decoration: underline; }

/* elemente comune */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 14px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 10px; padding: 11px 18px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; background: var(--primary); color: var(--primary-text); min-height: 44px; }
.btn:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn.ghost:hover { background: var(--surface-2); }
.btn[disabled] { opacity: .5; cursor: default; filter: none; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }

/* acasă */
.hero { background: var(--brand); color: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 20px; margin-bottom: 16px; }
.hero h1 { color: #fff; }
.hero p { color: #c9d7e8; max-width: 52ch; }
.hero .btn { background: var(--accent); color: #2b2100; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.stat b { display: block; font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: .85rem; }
.modes { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.mode { display: block; text-decoration: none; color: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.mode:hover { border-color: var(--primary); }
.mode h2 { margin-bottom: .25rem; }
.mode p { color: var(--muted); margin: 0; font-size: .92rem; }

/* capitole */
.cat-title { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 0 8px; }
.chapter { display: flex; align-items: center; gap: 14px; text-decoration: none; color: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 8px; }
.chapter:hover { border-color: var(--primary); }
.chapter .grow { flex: 1; min-width: 0; }
.chapter h3 { font-size: 1rem; margin: 0 0 6px; }
.bar { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; display: flex; }
.bar i { display: block; height: 100%; }
.bar .b-ok { background: var(--ok); }
.bar .b-seen { background: var(--primary); opacity: .45; }
.chapter small { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* întrebare */
.qhead { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; color: var(--muted); font-size: .9rem; flex-wrap: wrap; }
.timer { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--text); background: var(--surface-2); padding: 4px 10px; border-radius: 8px; }
.timer.low { color: var(--ko); }
.progress { height: 4px; background: var(--surface-2); border-radius: 99px; margin-bottom: 14px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--primary); transition: width .2s; }
.qtext { font-size: 1.12rem; font-weight: 600; margin-bottom: 14px; }
.tag { display: inline-block; font-size: .78rem; font-weight: 600; padding: 2px 8px; border-radius: 6px; background: var(--warn-bg); color: var(--text); margin-bottom: 10px; }
.opts { display: grid; gap: 8px; margin-bottom: 14px; }
.opt { display: flex; gap: 12px; align-items: flex-start; width: 100%; text-align: left; background: var(--surface); color: var(--text); border: 1.5px solid var(--line); border-radius: 10px; padding: 12px 14px; font: inherit; cursor: pointer; min-height: 48px; }
@media (hover: hover) { .opt:hover:not([disabled]):not(.sel) { border-color: color-mix(in srgb, var(--primary) 55%, var(--line)); } }
.opt .k { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--surface-2); text-transform: lowercase; }
.opt.sel { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, var(--surface)); }
.opt.sel .k { background: var(--primary); color: var(--primary-text); }
.opt.right { border-color: var(--ok); background: var(--ok-bg); }
.opt.right .k { background: var(--ok); color: #fff; }
.opt.wrong { border-color: var(--ko); background: var(--ko-bg); }
.opt.wrong .k { background: var(--ko); color: #fff; }
.opt[disabled] { cursor: default; }
.feedback { border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; border-left: 4px solid; }
.feedback.ok { background: var(--ok-bg); border-color: var(--ok); }
.feedback.ko { background: var(--ko-bg); border-color: var(--ko); }
.feedback b { display: block; margin-bottom: 4px; }
.feedback p { margin: 0 0 6px; }
.src { font-size: .85rem; color: var(--muted); }

/* grila de navigare în simulare */
.grid-nav { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 6px; margin-top: 14px; }
.grid-nav button { height: 38px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-size: .9rem; cursor: pointer; font-variant-numeric: tabular-nums; }
.grid-nav button.done { background: color-mix(in srgb, var(--primary) 18%, var(--surface)); border-color: var(--primary); }
.grid-nav button.cur { outline: 2px solid var(--primary); outline-offset: 1px; }

/* rezultat */
.score { text-align: center; padding: 26px 18px; }
.score .big { font-size: 3rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; }
.score.pass .big { color: var(--ok); }
.score.fail .big { color: var(--ko); }
.verdict { font-size: 1.2rem; font-weight: 700; margin: 10px 0 4px; }
.review-item { border-top: 1px solid var(--line); padding: 14px 0; }
.review-item:first-child { border-top: 0; padding-top: 0; }
.review-item .qtext { font-size: 1rem; }
.ans { font-size: .93rem; margin: 2px 0; }
.ans.ko { color: var(--ko); }
.ans.ok { color: var(--ok); }
.empty { text-align: center; padding: 30px 16px; color: var(--muted); }
.ad-wrap { margin: 14px 0; min-height: 100px; }

/* pagini de text (confidențialitate, termeni, despre) */
.doc { max-width: 720px; }
.doc h2 { margin-top: 1.6rem; }
.doc ul { padding-left: 1.2rem; }
.doc li { margin-bottom: .4rem; }
.table-wrap { overflow-x: auto; margin: 0 0 1rem; }
.doc table { width: 100%; border-collapse: collapse; font-size: .9rem; min-width: 520px; }
.doc th, .doc td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
.doc th { background: var(--surface-2); }
.foot a { color: var(--muted); }

/* paginile statice cu întrebări (invata/) */
.doc.wide { max-width: 780px; }
.crumbs { font-size: .88rem; color: var(--muted); margin-bottom: .75rem; }
.crumbs a { color: var(--muted); }
.qlist { list-style: none; padding: 0; margin: 18px 0; counter-reset: none; }
.qitem { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 12px; }
.qitem::before { content: "Întrebarea " attr(value); display: block; font-size: .78rem; color: var(--muted); margin-bottom: 4px; }
.qitem .qtext { font-size: 1.02rem; margin-bottom: 8px; }
.qopts { margin: 0 0 10px; padding-left: 1.6rem; }
.qopts li { margin-bottom: 4px; }
.qopts li::marker { font-weight: 700; }
.qitem details { border-top: 1px dashed var(--line); padding-top: 8px; }
.qitem summary { cursor: pointer; color: var(--primary); font-weight: 600; min-height: 32px; display: flex; align-items: center; }
.qitem details[open] summary { margin-bottom: 6px; }
.qitem details p { margin-bottom: 6px; }
.ad-li { list-style: none; }
.pager { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 14px 0; }
.pager a, .pager span { padding: 6px 11px; border-radius: 8px; border: 1px solid var(--line); text-decoration: none; font-variant-numeric: tabular-nums; }
.pager .cur { background: var(--primary); color: var(--primary-text); border-color: var(--primary); }
.chap-links { padding-left: 1.2rem; }
.chap-links li { margin-bottom: .45rem; }
.btn.small { padding: 6px 12px; min-height: 36px; font-size: .9rem; }

kbd { font: .8rem ui-monospace, monospace; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 4px; background: var(--surface-2); }

@media (max-width: 520px) {
  h1 { font-size: 1.35rem; }
  .brand span { font-size: .95rem; }
  .nav a { padding: 6px 8px; font-size: .88rem; }
  .qtext { font-size: 1.04rem; }
  .card { padding: 14px; }
  .hide-sm { display: none; }
}
