:root {
  --brand: #1d4ed8;
  --brand-ink: #1e3a8a;
  --ink: #0f172a;
  --muted: #5b6577;
  --line: #e3e7ee;
  --bg: #f5f7fb;
  --card: #fff;
  --good: #15803d; --good-bg: #e8f6ee;
  --bad: #b42318; --bad-bg: #fdecea;
  --warn: #b45309; --warn-bg: #fff4e5;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15,23,42,.06), 0 4px 16px rgba(15,23,42,.05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --brand: #6b8cff; --brand-ink: #a9bcff; --ink: #e7ebf3; --muted: #9aa4b5; --line: #273043;
    --bg: #0d1220; --card: #151c2e; --good: #4ade80; --good-bg: #12301f; --bad: #f87171; --bad-bg: #3a1717;
    --warn: #fbbf24; --warn-bg: #3a2b0e; --shadow: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--brand); }
h1 { font-size: clamp(1.5rem, 4vw, 2.1rem); line-height: 1.2; margin: .2em 0 .3em; }
h2 { font-size: 1.2rem; margin: 1.4em 0 .6em; }
.card h2 { margin-top: 0; }
h3 { font-size: 1.02rem; margin: .2em 0; }
code { font: .92em ui-monospace, SFMono-Regular, Menlo, monospace; background: color-mix(in srgb, var(--brand) 10%, transparent); padding: .05em .35em; border-radius: 5px; }
.wrap { max-width: 1060px; margin: 0 auto; padding: 16px 16px 64px; }
.muted { color: var(--muted); }
.tiny { font-size: .84rem; }
.center { text-align: center; }
.loading { padding: 40px; text-align: center; color: var(--muted); }
.plain { padding-left: 1.1em; margin: 0; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.row.center { justify-content: center; }
.narrow { max-width: 520px; }
.back { display: inline-block; margin: 6px 0 4px; text-decoration: none; color: var(--muted); }
.back:hover { color: var(--ink); }

/* header */
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--ink); text-decoration: none; }
.top nav { display: flex; gap: 4px; align-items: center; }
.top nav a, .top nav .link { color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: 8px; font: inherit; font-size: .95rem; }
.top nav a.on, .top nav a:hover, .top nav .link:hover { color: var(--ink); background: var(--bg); }
.link { background: none; border: 0; cursor: pointer; }
.guest-banner { background: var(--warn-bg); color: var(--warn); text-align: center; font-size: .85rem; padding: 6px; }

/* cards & grids */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
a.card { color: inherit; text-decoration: none; transition: transform .12s, border-color .12s; display: block; }
a.card:hover { border-color: var(--brand); transform: translateY(-1px); }
.grid { display: grid; gap: 14px; }
.certs { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.modes { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.stats { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); margin-bottom: 14px; }
.card + .card, section.card { margin-bottom: 14px; }
.cert .badge { display: inline-grid; place-items: center; min-width: 54px; height: 40px; padding: 0 10px; border-radius: 10px; background: var(--brand); color: #fff; font-weight: 800; }
.cert.soon { opacity: .6; }
.cert.soon .badge { background: var(--muted); }
.cert .prog { margin-top: 10px; }
.mode .mi { font-size: 1.6rem; }
.mode.off { opacity: .55; pointer-events: none; }
.stat .big { font-size: 1.7rem; font-weight: 800; }
.stat .big.sm { font-size: 1rem; padding: .45em 0; }
.hero { margin: 8px 0 16px; }
.pill { display: inline-block; font-size: .78rem; padding: 2px 9px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); color: var(--muted); font-weight: 600; vertical-align: middle; }
.pill.sm { font-size: .7rem; padding: 0 7px; }
.pill.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.pill.good { background: var(--good-bg); color: var(--good); border-color: transparent; }
.pill.bad { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.alert { background: var(--bad-bg); color: var(--bad); padding: 10px 14px; border-radius: 10px; }
.success { background: var(--good-bg); color: var(--good); padding: 10px 14px; border-radius: 10px; }

/* tabs */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 14px; }
.tabs a { padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink); text-decoration: none; }
.tabs a.on { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); font-weight: 600; }

/* progress bar */
.bar { height: 10px; background: color-mix(in srgb, var(--muted) 18%, transparent); border-radius: 999px; overflow: hidden; margin: 8px 0 4px; }
.bar span { display: block; height: 100%; background: var(--brand); border-radius: 999px; transition: width .3s; }
.bar.thin { height: 5px; margin: 6px 0 12px; }
.bar.good span { background: var(--good); } .bar.warn span { background: var(--warn); } .bar.bad span { background: var(--bad); }

/* domains & levels */
.domains { display: grid; gap: 12px; }
.dtop { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.levels { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin-bottom: 12px; }
.lvl { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: inherit; text-decoration: none; }
.lvl .lnum { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: var(--bg); flex: none; }
.lvl.open { border-color: var(--brand); }
.lvl.open .lnum { background: var(--brand); color: #fff; }
.lvl.done .lnum { background: var(--good); color: #fff; }
.lvl.locked { opacity: .55; }
a.lvl:hover { transform: translateY(-1px); }

/* buttons & forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 11px 18px; min-height: 44px; border-radius: 10px; border: 1px solid var(--brand);
  background: var(--brand); color: #fff; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn:hover { filter: brightness(1.07); }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.btn.ghost { background: transparent; color: var(--brand); }
.btn.sm { padding: 6px 12px; min-height: 34px; font-size: .9rem; }
.btn.on { background: var(--warn-bg); color: var(--warn); border-color: var(--warn); }
input[type=email], input:not([type]), select { font: inherit; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink); min-height: 44px; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 700; margin-bottom: 6px; }
.opt { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; }
.opt input { width: 18px; height: 18px; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 2px; }
.login { max-width: 440px; margin: 7vh auto 0; }

/* questions */
.runner.with-side { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
@media (max-width: 900px) { .runner.with-side { grid-template-columns: 1fr; } }
.qhead { display: flex; justify-content: space-between; gap: 10px; align-items: end; }
.q { margin-bottom: 12px; }
.q-stem { font-size: 1.08rem; margin-bottom: 12px; }
.hint { font-size: .85rem; color: var(--muted); font-weight: 600; margin: -4px 0 10px; }
.choices { display: flex; flex-direction: column; gap: 8px; }
.choice { display: flex; gap: 12px; text-align: left; align-items: flex-start; width: 100%; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 12px;
  background: var(--card); color: var(--ink); font: inherit; cursor: pointer; }
.choice:hover:not(:disabled) { border-color: var(--brand); }
.choice .key { flex: none; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--bg); font-weight: 700; font-size: .85rem; }
.choice.sel { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 8%, var(--card)); }
.choice.sel .key { background: var(--brand); color: #fff; }
.choice:disabled { cursor: default; }
.choice.right { border-color: var(--good); background: var(--good-bg); }
.choice.right .key { background: var(--good); color: #fff; }
.choice.wrong { border-color: var(--bad); background: var(--bad-bg); }
.choice.wrong .key { background: var(--bad); color: #fff; }
.choice.dim { opacity: .8; }
.why { font-size: .86rem; color: var(--muted); margin-top: 4px; }
.explain { margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: var(--bg); border-left: 4px solid var(--brand); }
.explain.good { border-left-color: var(--good); }
.explain.bad { border-left-color: var(--bad); }
.verdict { font-weight: 800; margin-bottom: 4px; }
.explain.good .verdict { color: var(--good); } .explain.bad .verdict { color: var(--bad); }
.order { list-style: none; padding: 0; margin: 0 0 10px; display: flex; flex-direction: column; gap: 8px; }
.ord { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--card); }
.ord .num { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--bg); font-weight: 700; }
.ord .txt { flex: 1; }
.ord .mv { display: flex; gap: 4px; }
.ord.right { border-color: var(--good); background: var(--good-bg); } .ord.wrong { border-color: var(--bad); background: var(--bad-bg); }
.icon { width: 40px; height: 40px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); cursor: pointer; }
.icon:disabled { opacity: .3; }
.match { display: flex; flex-direction: column; gap: 8px; }
.mrow { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: center; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 12px; }
.mrow select { width: 100%; }
.mrow.right { border-color: var(--good); background: var(--good-bg); } .mrow.wrong { border-color: var(--bad); background: var(--bad-bg); }
@media (max-width: 560px) { .mrow { grid-template-columns: 1fr; } }

/* side resources */
.side details > summary { cursor: pointer; font-weight: 700; padding: 4px 0; }
.side { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; position: sticky; top: 70px; max-height: calc(100vh - 90px); overflow: auto; }
.res { list-style: none; padding: 0; margin: 8px 0; display: flex; flex-direction: column; gap: 10px; }
.res a { font-weight: 600; }

/* results / review */
.result-head { font-weight: 800; font-size: 1.1rem; margin: 10px 0 14px; }
.result-head.good { color: var(--good); } .result-head.bad { color: var(--bad); }
.review { display: flex; flex-direction: column; gap: 8px; }
.rv { padding: 12px 14px; margin: 0 !important; }
.rv summary { cursor: pointer; display: flex; gap: 8px; align-items: baseline; }
.rv .dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--good); transform: translateY(1px); }
.rv.bad .dot { background: var(--bad); }
.rvbody { margin-top: 12px; }

/* exam */
.exambar { position: sticky; top: 57px; z-index: 5; display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 10px 14px; margin: 8px 0 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; flex-wrap: wrap; }
.clock { font-variant-numeric: tabular-nums; font-weight: 800; }
.clock.low { color: var(--bad); }
.qgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; margin: 12px 0; }
.qgrid button { height: 44px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; cursor: pointer; }
.qgrid button.ans { background: color-mix(in srgb, var(--brand) 14%, var(--card)); border-color: var(--brand); }
.qgrid button.flg { box-shadow: inset 0 -4px 0 var(--warn); }
.qgrid button.cur { outline: 2px solid var(--ink); }
.drow { display: grid; grid-template-columns: 1fr auto; gap: 0 10px; margin-bottom: 10px; }
.drow .bar { grid-column: 1 / -1; margin: 4px 0 0; }

/* tables */
.scroll { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tbl th, .tbl td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl th { color: var(--muted); font-weight: 600; font-size: .8rem; }
.acc.good { color: var(--good); font-weight: 700; } .acc.warn { color: var(--warn); font-weight: 700; } .acc.bad { color: var(--bad); font-weight: 700; }

/* activity chart */
.chart { display: grid; grid-template-columns: repeat(14, 1fr); gap: 6px; height: 140px; align-items: end; }
.chart .col { display: flex; flex-direction: column; align-items: stretch; justify-content: flex-end; height: 100%; }
.stack-bar { background: color-mix(in srgb, var(--bad) 70%, transparent); border-radius: 5px 5px 2px 2px; display: flex; flex-direction: column; justify-content: flex-end; overflow: hidden; min-height: 2px; }
.stack-bar .ok { background: var(--good); display: block; }
.chart .lbl { text-align: center; font-size: .72rem; color: var(--muted); margin-top: 4px; }
.legend { display: flex; gap: 14px; margin-top: 8px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; }
.legend i.ok { background: var(--good); } .legend i.no { background: color-mix(in srgb, var(--bad) 70%, transparent); }

/* modal & toast */
.modal-wrap { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: var(--card); border-radius: var(--radius); padding: 20px; max-width: 420px; width: 100%; }
#toast { position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, 140%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; transition: transform .25s; z-index: 60; max-width: 90vw; }
#toast.show { transform: translate(-50%, 0); }
#toast.bad { background: var(--bad); color: #fff; }

@media (max-width: 560px) {
  .wrap { padding: 12px 12px 64px; }
  .card { padding: 14px; }
  .top nav a, .top nav .link { padding: 6px 7px; font-size: .88rem; }
  .logo span { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* grid spacing fixes */
.grid > .card, .domains > .card, .levels > * { margin: 0 !important; }
@media (max-width: 560px) {
  .modes { grid-template-columns: 1fr 1fr; gap: 10px; }
  .mode p { display: none; }
  .mode h3 { font-size: .95rem; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
}

/* ---- CISSP learning features ---- */
.choice.trapc { border-color: var(--warn); border-style: dashed; }
.tag { display: inline-block; font-size: .7rem; font-weight: 700; color: var(--warn); background: var(--warn-bg); border-radius: 6px; padding: 0 6px; margin-right: 4px; }
.mindset { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); font-size: .92rem; }
.notebox { margin: 0 0 12px; padding: 12px 14px; }
.notebox input { flex: 1; min-width: 200px; }
.prevnote { margin: 4px 0 10px; font-style: italic; }
.conf-label { margin-right: auto; }
.btn.conf { min-width: 84px; }
.mode.hl { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.feat { margin-bottom: 14px; }
.result-big { font-size: 2.6rem; font-weight: 900; letter-spacing: .04em; }
.result-big.good { color: var(--good); } .result-big.bad { color: var(--bad); }

.lesson { max-width: 760px; margin: 0 auto 16px; }
.lesson h1 { margin-bottom: 14px; }
.lesson h2 { font-size: 1.08rem; margin: 1.3em 0 .4em; }
.lesson p, .lesson li { font-size: 1.02rem; line-height: 1.7; }
.lesson .card h2 { margin-top: 0; }
.keypts { border-left: 4px solid var(--brand); }
.lens { border-left: 4px solid var(--warn); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-block; padding: 6px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-size: .85rem; text-decoration: none; cursor: pointer; }
.chip:hover { border-color: var(--brand); }
.termcard { margin-top: 10px; }
.lessonlist { margin: 0; padding-left: 1.3em; }
.lessonlist li { margin: 6px 0; }
.lessonlist li.done::marker { color: var(--good); }
.lessonlist li.done a { color: var(--muted); }
.lessonlist li.done a::after { content: ' ✓'; color: var(--good); }
.tbl.wrap td { white-space: normal; vertical-align: top; }

.glist { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.glist .term { margin: 0 !important; }
.glist .term p { margin: 6px 0; }
.flash { min-height: 220px; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; cursor: pointer; margin-bottom: 12px; }
.flash .fterm { font-size: 1.5rem; font-weight: 800; margin: 10px 0; }
.flash.back { border-color: var(--brand); }

.tasks { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.tasks li { display: flex; gap: 10px; align-items: baseline; }
.tasks .ck { flex: none; width: 22px; text-align: center; font-weight: 800; color: var(--muted); }
.tasks li.done .ck { color: var(--good); }
.tasks li.done a { color: var(--muted); text-decoration: line-through; }
.tasks li.info a { color: var(--ink); }
input[type=date] { font: inherit; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink); min-height: 44px; }
@media (max-width: 560px) { .conf-label { width: 100%; } .btn.conf { flex: 1; min-width: 0; } }
