/* CCNA — network-console look: cool paper, cable-blue ink, link-light green / amber. M3-style tokens, light + dark. */
:root {
  color-scheme: light;
  --bg: #F2F4F7;
  --surface: #FFFFFF;
  --surface-2: #E8ECF1;
  --on-surface: #101820;   /* 16:1 on --bg */
  --on-v: #45505B;         /* 7.6:1 on --bg (AAA body) */
  --outline: #C3CBD4;
  --primary: #0B57A4;      /* 7.0:1 on white */
  --on-primary: #FFFFFF;
  --primary-c: #D5E6FA;
  --on-primary-c: #001C3A;
  --secondary: #8A5300;    /* amber link light, 5.6:1 on white */
  --secondary-c: #FFE1B8;
  --success: #1E6B33;      /* 6.6:1 on white */
  --success-c: #D4F0D9;
  --error: #B3261E;
  --error-c: #F9DEDC;
  --console-bg: #0D1620;
  --console-fg: #D6E4F0;   /* 13:1 on console */
  --console-dim: #8FA3B6;
  --shadow: 0 1px 2px rgba(16, 24, 32, .07), 0 6px 18px rgba(16, 24, 32, .06);
  --r-sm: 10px; --r-md: 16px; --r-lg: 24px;
  --ease: cubic-bezier(.2, 0, 0, 1);
  --font: "Inter", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0A1118; --surface: #121C26; --surface-2: #1A2733; --on-surface: #E2E9F0; --on-v: #A9B7C4;
  --outline: #2E3D4B; --primary: #8CC4FF; --on-primary: #00315C; --primary-c: #11406E; --on-primary-c: #D5E6FA;
  --secondary: #FFB95C; --secondary-c: #4A3000; --success: #84D99A; --success-c: #133A1F;
  --error: #FFB4AB; --error-c: #5C1712; --console-bg: #060B10;
  --shadow: 0 1px 2px rgba(0, 0, 0, .45), 0 8px 22px rgba(0, 0, 0, .3);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0A1118; --surface: #121C26; --surface-2: #1A2733; --on-surface: #E2E9F0; --on-v: #A9B7C4;
    --outline: #2E3D4B; --primary: #8CC4FF; --on-primary: #00315C; --primary-c: #11406E; --on-primary-c: #D5E6FA;
    --secondary: #FFB95C; --secondary-c: #4A3000; --success: #84D99A; --success-c: #133A1F;
    --error: #FFB4AB; --error-c: #5C1712; --console-bg: #060B10;
    --shadow: 0 1px 2px rgba(0, 0, 0, .45), 0 8px 22px rgba(0, 0, 0, .3);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font: 400 16px/1.6 var(--font); color: var(--on-surface); background: var(--bg);
  background-image: radial-gradient(var(--outline) .6px, transparent .6px); background-size: 22px 22px;
  background-attachment: fixed; min-height: 100vh;
}
a { color: var(--primary); }
h1, h2, h3 { line-height: 1.25; letter-spacing: -.01em; }
.mono { font-family: var(--mono); font-feature-settings: "zero"; }
.muted { color: var(--on-v); }
.small { font-size: 14px; }
.ms {
  font-family: "Material Symbols Rounded"; font-weight: normal; font-style: normal; font-size: 22px; line-height: 1;
  display: inline-block; white-space: nowrap; direction: ltr; -webkit-font-smoothing: antialiased;
  font-variation-settings: "FILL" 0, "wght" 450, "GRAD" 0, "opsz" 24; user-select: none;
}
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; border-radius: 6px; }

/* top bar */
.bar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px;
  padding: 10px max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--outline);
}
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; font-weight: 800; font-size: 18px; }
.brand small { font: 500 12px var(--mono); color: var(--on-v); }
.logo {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px;
  background: var(--primary); color: var(--on-primary);
}
.logo.big { width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 8px; }
.logo.big .ms { font-size: 32px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 99px; font-size: 13px;
  background: var(--secondary-c); color: var(--on-surface); font-weight: 500; white-space: nowrap;
}
.pill .ms { font-size: 17px; color: var(--secondary); }
.top-nav { margin-inline-start: auto; display: flex; align-items: center; gap: 2px; }
.top-nav form { margin: 0; }
.icon-btn {
  display: grid; place-items: center; width: 42px; height: 42px; border: 0; border-radius: 50%;
  background: transparent; color: var(--on-v); cursor: pointer; text-decoration: none;
  transition: background .2s var(--ease), color .2s var(--ease);
}
.icon-btn:hover { background: var(--surface-2); color: var(--on-surface); }

/* layout */
.wrap { max-width: 1040px; margin: 0 auto; padding: 24px max(16px, env(safe-area-inset-left)) 64px; }
.wrap.narrow { max-width: 760px; }
.card { background: var(--surface); border: 1px solid var(--outline); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.page-title { font-size: 28px; margin: 8px 0 4px; }
.section-title { font-size: 18px; margin: 32px 0 12px; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.section-title .muted { font-size: 13px; font-weight: 500; }
.eyebrow { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--secondary); margin: 0 0 6px; font-weight: 700; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 22px;
  border: 0; border-radius: 99px; background: var(--primary); color: var(--on-primary); font: 600 15px var(--font);
  text-decoration: none; cursor: pointer; transition: transform .15s var(--ease), box-shadow .2s var(--ease), filter .2s;
}
.btn:hover { box-shadow: 0 4px 14px color-mix(in srgb, var(--primary) 35%, transparent); filter: brightness(1.06); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; filter: none; }
.btn.tonal { background: var(--primary-c); color: var(--on-primary-c); }
.btn.wide { width: 100%; margin-top: 8px; }
.btn .ms { font-size: 20px; }
.text-btn { border: 0; background: none; color: var(--primary); font: 600 14px var(--font); cursor: pointer; padding: 8px; border-radius: 8px; }
.text-btn:hover { background: var(--surface-2); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 20px 0; }

/* sign in */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login .card { width: min(400px, 100%); padding: 32px 28px; text-align: center; }
.login h1 { margin: 4px 0 0; font-size: 26px; }
.login .muted { margin: 4px 0 20px; }
.field { display: block; text-align: start; margin-bottom: 14px; }
.field span { display: block; font-size: 13px; font-weight: 600; color: var(--on-v); margin-bottom: 6px; }
.field input {
  width: 100%; height: 48px; padding: 0 14px; border: 1px solid var(--outline); border-radius: var(--r-sm);
  background: var(--bg); color: var(--on-surface); font: 16px var(--font); transition: border-color .2s, box-shadow .2s;
}
.field input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 25%, transparent); }
.err { background: var(--error-c); color: var(--on-surface); border-inline-start: 4px solid var(--error); padding: 10px 14px; border-radius: var(--r-sm); margin: 12px 0; text-align: start; }

/* home */
.hero { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 28px; }
.hero h1 { margin: 0 0 6px; font-size: clamp(24px, 4vw, 34px); }
.hero h1 .mono { color: var(--primary); }
.hero p { margin: 0; }
.ring {
  --p: 0; flex: none; width: 128px; height: 128px; border-radius: 50%; display: grid; place-content: center; text-align: center;
  background: radial-gradient(closest-side, var(--surface) 78%, transparent 79% 100%),
              conic-gradient(var(--primary) calc(var(--p) * 1%), var(--surface-2) 0);
}
.ring.good { background: radial-gradient(closest-side, var(--surface) 78%, transparent 79% 100%),
                         conic-gradient(var(--success) calc(var(--p) * 1%), var(--surface-2) 0); }
.ring b { font-size: 30px; line-height: 1; }
.ring b small { font-size: 15px; }
.ring span { font-size: 12px; color: var(--on-v); text-transform: uppercase; letter-spacing: .06em; margin-top: 4px; }
.domains { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.domain {
  display: block; padding: 18px 20px; color: inherit; text-decoration: none;
  transition: transform .2s var(--ease), border-color .2s, box-shadow .2s;
  animation: rise .5s var(--ease) both; animation-delay: calc(var(--i) * 40ms);
}
.domain:hover { transform: translateY(-2px); border-color: var(--primary); }
.dom-head { display: flex; justify-content: space-between; font-size: 13px; }
.dom-num { color: var(--primary); font-weight: 700; }
.weight { color: var(--on-v); background: var(--surface-2); padding: 1px 8px; border-radius: 99px; }
.domain h3 { margin: 6px 0 14px; font-size: 17px; }
.meter { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--primary); border-radius: inherit; transition: width .6s var(--ease); }
.dom-foot { font-size: 12.5px; color: var(--on-v); margin: 10px 0 0; }
.dom-foot b { color: var(--on-surface); }

/* practice setup */
.setup { padding: 22px; margin-top: 18px; }
fieldset { border: 0; padding: 0; margin: 0 0 22px; }
legend { font-weight: 700; font-size: 14px; margin-bottom: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--on-v); }
.check { display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-radius: var(--r-sm); cursor: pointer; transition: background .15s; }
.check:hover { background: var(--surface-2); }
.check input { position: absolute; opacity: 0; pointer-events: none; }
.check .box {
  flex: none; width: 22px; height: 22px; border-radius: 6px; border: 2px solid var(--outline); display: grid; place-items: center;
  transition: background .15s, border-color .15s;
}
.check .box .ms { font-size: 17px; color: var(--on-primary); opacity: 0; transition: opacity .15s; }
.check input:checked + .box { background: var(--primary); border-color: var(--primary); }
.check input:checked + .box .ms { opacity: 1; }
.check input:focus-visible + .box { outline: 3px solid var(--primary); outline-offset: 2px; }
.check b { color: var(--primary); margin-inline-end: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: inline-flex; align-items: center; min-height: 40px; padding: 0 16px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--outline); font-weight: 500; font-size: 14px; transition: background .15s, border-color .15s, color .15s;
}
.chip span:hover { background: var(--surface-2); }
.chip input:checked + span { background: var(--primary-c); border-color: var(--primary); color: var(--on-primary-c); }
.chip input:focus-visible + span { outline: 3px solid var(--primary); outline-offset: 2px; }

.select { display: grid; gap: 6px; }
.select select {
  width: 100%; height: 48px; padding: 0 12px; border: 1px solid var(--outline); border-radius: var(--r-sm);
  background: var(--bg); color: var(--on-surface); font: 15px var(--font); cursor: pointer;
}
.select select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 25%, transparent); }

/* question */
.q-top { display: flex; align-items: center; gap: 14px; font-size: 14px; margin-bottom: 8px; }
.q-top form { margin-inline-start: auto; }
.progress { height: 4px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-bottom: 16px; }
.progress span { display: block; height: 100%; background: var(--primary); transition: width .4s var(--ease); }
.question { padding: 24px; }
.q-meta { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--on-v); margin: 0 0 12px; }
.lvl { padding: 1px 9px; border-radius: 99px; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; font-size: 11px; }
.lvl-easy { background: var(--success-c); color: var(--on-surface); }
.lvl-medium { background: var(--primary-c); color: var(--on-primary-c); }
.lvl-hard { background: var(--secondary-c); color: var(--on-surface); }
.stem { font-size: 17px; font-weight: 500; }
.stem p { margin: 0 0 8px; }
.exhibit { margin: 16px 0; border-radius: var(--r-md); overflow: hidden; background: var(--console-bg); border: 1px solid #1F2D3A; }
.exhibit figcaption {
  display: flex; align-items: center; gap: 8px; padding: 8px 14px; font-size: 12.5px; color: var(--console-dim);
  border-bottom: 1px solid #1F2D3A;
}
.exhibit figcaption .ms { font-size: 17px; color: #7FD99A; }
.exhibit pre, .exhibit-mini {
  margin: 0; padding: 14px; overflow-x: auto; font: 13px/1.55 var(--mono); color: var(--console-fg); white-space: pre;
}
.exhibit-mini { background: var(--console-bg); border-radius: var(--r-sm); font-size: 12px; }
.hint { font-size: 14px; margin: 18px 0 8px; }
.options { display: grid; gap: 10px; margin-bottom: 8px; }
.option {
  position: relative; display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; border-radius: var(--r-md);
  border: 1.5px solid var(--outline); background: var(--surface); cursor: pointer;
  transition: border-color .15s, background .15s, transform .15s var(--ease);
}
.option input { position: absolute; opacity: 0; pointer-events: none; }
.option:hover { border-color: var(--primary); }
.option:active { transform: scale(.995); }
.option .key {
  flex: none; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; font-size: 13px; font-weight: 700;
  background: var(--surface-2); color: var(--on-v); transition: background .15s, color .15s;
}
.option .txt { flex: 1; padding-top: 2px; }
.option:has(input:checked) { border-color: var(--primary); background: color-mix(in srgb, var(--primary-c) 45%, var(--surface)); }
.option:has(input:checked) .key { background: var(--primary); color: var(--on-primary); }
.option:has(input:focus-visible) { outline: 3px solid var(--primary); outline-offset: 2px; }
.options.done .option { cursor: default; }
.options.done .option:hover { border-color: var(--outline); }
.option.right { border-color: var(--success) !important; background: color-mix(in srgb, var(--success-c) 60%, var(--surface)); }
.option.right .key { background: var(--success); color: var(--surface); }
.option.wrong { border-color: var(--error) !important; background: color-mix(in srgb, var(--error-c) 55%, var(--surface)); }
.option.wrong .key { background: var(--error); color: var(--surface); }
.option .mark { font-size: 22px; }
.option.right .mark { color: var(--success); }
.option.wrong .mark { color: var(--error); }
.why { display: block; color: var(--on-v); font-size: 13.5px; margin-top: 4px; line-height: 1.5; }
.verdict {
  display: flex; gap: 12px; padding: 16px; border-radius: var(--r-md); margin: 16px 0 8px; animation: rise .35s var(--ease) both;
}
.verdict p { margin: 4px 0 0; }
.verdict .ms { font-size: 26px; }
.verdict.ok { background: var(--success-c); } .verdict.ok > .ms { color: var(--success); }
.verdict.no { background: var(--error-c); } .verdict.no > .ms { color: var(--error); }
.ref { font-size: 12px; color: var(--on-v); }
.kbd { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 12.5px; margin: 12px 0 0; }
.kbd .ms { font-size: 17px; }
@media (hover: none) { .kbd { display: none; } }

/* results */
.per { padding: 6px 18px; }
.per-row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--outline); }
.per-row:last-child { border-bottom: 0; }
.per-row b { color: var(--primary); }
.review { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.review li { padding: 0; border-inline-start: 4px solid var(--outline); }
.review li.ok { border-inline-start-color: var(--success); }
.review li.no { border-inline-start-color: var(--error); }
.review summary { display: flex; gap: 10px; align-items: center; padding: 14px 16px; cursor: pointer; list-style: none; }
.review summary::-webkit-details-marker { display: none; }
.review .ok summary .ms { color: var(--success); }
.review .no summary .ms { color: var(--error); }
.review .skip summary .ms { color: var(--on-v); }
.sum-txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.review details[open] .sum-txt { white-space: normal; }
.review details > :not(summary) { margin: 0 16px 12px; }

/* motion */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.rise { animation: rise .45s var(--ease) both; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (max-width: 560px) {
  .hero { flex-direction: column-reverse; align-items: flex-start; padding: 22px; }
  .question { padding: 18px; }
  .brand small { display: none; }
}
