/* Network+ practice exam simulator. Neutral slate / teal palette, light and dark. */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #eef1f4;
  --chrome: #2f3640;
  --chrome-2: #3d4652;
  --chrome-text: #f2f4f7;
  --text: #1c1f24;
  --muted: #56606d;
  --border: #c5ccd6;
  --accent: #23695a;
  --accent-text: #ffffff;
  --accent-soft: #e2f1ed;
  --flag: #8a5a0f;
  --flag-soft: #fbefd6;
  --bad: #b42318;
  --bad-soft: #fde9e7;
  --good: #256b29;
  --good-soft: #e4f3e5;
  --highlight: #fff1a8;
  --highlight-text: #1c1f24;
  --timer-warn: #ffd27a;
  --timer-danger: #ffaba3;
  --focus: #23695a;
  --shadow: 0 1px 2px rgba(20, 22, 26, 0.08);
  --mono: ui-monospace, "Cascadia Mono", Consolas, "Liberation Mono", Menlo, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14161a;
    --surface: #1e2127;
    --surface-2: #272b33;
    --chrome: #0e1013;
    --chrome-2: #23272e;
    --chrome-text: #e6e8eb;
    --text: #e6e8eb;
    --muted: #a3acb8;
    --border: #414855;
    --accent: #4fb39b;
    --accent-text: #0e1013;
    --accent-soft: #1d3530;
    --flag: #e0a84a;
    --flag-soft: #3a2f17;
    --bad: #f97066;
    --bad-soft: #3d1f1c;
    --good: #6cc070;
    --good-soft: #1d3320;
    --highlight: #6b5e12;
    --highlight-text: #f3f4f6;
    --focus: #7fd4bf;
    --shadow: none;
  }
}

:root[data-theme="dark"] {
  --bg: #14161a;
  --surface: #1e2127;
  --surface-2: #272b33;
  --chrome: #0e1013;
  --chrome-2: #23272e;
  --chrome-text: #e6e8eb;
  --text: #e6e8eb;
  --muted: #a3acb8;
  --border: #414855;
  --accent: #4fb39b;
  --accent-text: #0e1013;
  --accent-soft: #1d3530;
  --flag: #e0a84a;
  --flag-soft: #3a2f17;
  --bad: #f97066;
  --bad-soft: #3d1f1c;
  --good: #6cc070;
  --good-soft: #1d3320;
  --highlight: #6b5e12;
  --highlight-text: #f3f4f6;
  --focus: #7fd4bf;
  --shadow: none;
}

:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

html { font-size: 100%; -webkit-text-size-adjust: 100%; }
html[data-fs="0"] { font-size: 90%; }
html[data-fs="2"] { font-size: 112.5%; }
html[data-fs="3"] { font-size: 125%; }
html[data-fs="4"] { font-size: 140%; }

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.55;
  overflow-wrap: anywhere;
}

#app { min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1 0 auto; width: 100%; max-width: 62rem; margin: 0 auto; padding: 1rem; }
main:focus { outline: none; }

h1 { font-size: 1.5rem; line-height: 1.25; margin: 0.5rem 0 0.75rem; }
h2 { font-size: 1.2rem; line-height: 1.3; margin: 1.25rem 0 0.5rem; }
h3 { font-size: 1.05rem; margin: 1rem 0 0.4rem; }
h1:focus, h2:focus { outline: none; }
p { margin: 0 0 0.75rem; }
a { color: var(--accent); }
code, kbd {
  font-family: var(--mono); font-size: 0.92em; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 4px; padding: 0.05em 0.3em;
}
.muted { color: var(--muted); }
.small { font-size: 0.9rem; }
.lead { font-size: 1.08rem; }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 0.5rem; top: -4rem; z-index: 50; background: var(--surface); color: var(--text);
  padding: 0.5rem 0.75rem; border: 2px solid var(--focus); border-radius: 6px;
}
.skip-link:focus { top: 0.5rem; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.topbar :focus-visible, .navbar :focus-visible { outline-color: #9fe3d2; }

/* ---------- chrome ---------- */

.topbar { background: var(--chrome); color: var(--chrome-text); position: sticky; top: 0; z-index: 20; }
.topbar-inner, .toolbar-inner, .navbar-inner {
  max-width: 62rem; margin: 0 auto; padding: 0.5rem 1rem; display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem;
}
.brand { margin: 0; font-weight: 700; display: flex; align-items: center; gap: 0.5rem; flex: 1 1 auto; min-width: 0; }
.brand-mark { width: 0.8rem; height: 0.8rem; border-radius: 2px; background: #4fb39b; flex: none; }
.site-nav, .session-status { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.75rem; }
.status-pos { margin: 0; font-weight: 600; }
.timer-box { display: flex; align-items: center; gap: 0.4rem; }
.timer-label { font-size: 0.85rem; }
.timer { font-family: var(--mono); font-weight: 700; font-size: 1.05rem; min-width: 5.2em; text-align: center; }
.timer.is-warn { color: var(--timer-warn); }
.timer.is-danger { color: var(--timer-danger); }

.chrome-btn {
  font: inherit; color: var(--chrome-text); background: var(--chrome-2); border: 1px solid #6b7684; border-radius: 6px;
  padding: 0.45rem 0.8rem; min-height: 2.5rem; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center;
}
.chrome-btn:hover { background: #4a5462; }
.chrome-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.chrome-btn-small { min-height: 2rem; padding: 0.2rem 0.6rem; font-size: 0.9rem; }
.chrome-btn-primary { background: #2e7d6b; border-color: #58b7a1; color: #ffffff; font-weight: 600; }
.chrome-btn-primary:hover { background: #256b5b; }

.toolbar { background: var(--surface-2); border-bottom: 1px solid var(--border); }
.tool-group { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tool-group-end { margin-left: auto; }
.tool-btn {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 6px;
  padding: 0.35rem 0.7rem; min-height: 2.5rem; cursor: pointer; display: inline-flex; align-items: center; gap: 0.4rem;
}
.tool-btn:hover { border-color: var(--accent); }
.tool-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.tool-btn[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
.flag-icon { width: 0.7rem; height: 0.8rem; border: 2px solid currentColor; border-radius: 1px; display: inline-block; }
#btn-flag[aria-pressed="true"] .flag-icon { background: currentColor; }

.navbar { background: var(--chrome); color: var(--chrome-text); position: sticky; bottom: 0; z-index: 20; }
.navbar-spacer { flex: 1 1 auto; }

.site-footer { border-top: 1px solid var(--border); color: var(--muted); font-size: 0.85rem; }
.site-footer p { max-width: 62rem; margin: 0 auto; padding: 0.75rem 1rem; }

/* ---------- generic blocks ---------- */

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 1rem;
  margin: 0 0 1rem; box-shadow: var(--shadow); min-width: 0;
}
.card > h2:first-child { margin-top: 0; }
.card-accent { border-left: 6px solid var(--accent); }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr)); gap: 1rem; align-items: start; }
.grid-2 > .card { margin: 0; }
.grid-2 { margin-bottom: 1rem; }
.plain-list { margin: 0 0 0.75rem; padding-left: 1.2rem; }
.plain-list li { margin-bottom: 0.4rem; }
.notice {
  background: var(--flag-soft); border: 1px solid var(--flag); border-left-width: 6px; border-radius: 6px;
  padding: 0.6rem 0.8rem; color: var(--text);
}

.btn-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.75rem 0; }
.btn-row-spread { justify-content: space-between; }
.btn {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 6px;
  padding: 0.5rem 1rem; min-height: 2.75rem; cursor: pointer;
}
.btn:hover { border-color: var(--accent); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
.btn-danger { border-color: var(--bad); color: var(--bad); font-weight: 600; }
.btn-toggle[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
.mini-btn {
  font: inherit; font-size: 0.9rem; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; padding: 0.3rem 0.6rem; min-height: 2.5rem; min-width: 2.75rem; cursor: pointer;
}
.mini-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.field { border: 0; padding: 0; margin: 0 0 0.75rem; min-width: 0; }
.field legend, .field > label, summary { font-weight: 600; padding: 0; }
summary { cursor: pointer; padding: 0.3rem 0; }
.field-inline { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.75rem; }
.check-list, .obj-group { display: flex; flex-direction: column; gap: 0.15rem; }
.obj-group { margin-top: 0.5rem; }
.check { display: flex; align-items: flex-start; gap: 0.5rem; padding: 0.3rem 0; font-weight: 400; cursor: pointer; }
.check input { margin-top: 0.3rem; flex: none; width: 1.1rem; height: 1.1rem; accent-color: var(--accent); }
select, input[type="number"], input[type="text"] {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 6px;
  padding: 0.4rem 0.5rem; min-height: 2.5rem; max-width: 100%;
}
input[type="number"] { width: 6rem; }

/* ---------- item ---------- */

.item-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-bottom: 0.75rem; }
.item-head h1, .item-head h2 { font-size: 1.05rem; margin: 0; color: var(--muted); }
.badge {
  font-size: 0.8rem; font-weight: 600; border: 1px solid var(--border); border-radius: 999px; padding: 0.1rem 0.6rem; color: var(--muted);
}
.badge-flag { border-color: var(--flag); color: var(--flag); background: var(--flag-soft); }
.stem { font-size: 1.05rem; margin-bottom: 1rem; }

.exhibit { margin: 0 0 1rem; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.exhibit figcaption { background: var(--surface-2); padding: 0.35rem 0.75rem; font-weight: 600; font-size: 0.9rem; border-bottom: 1px solid var(--border); }
.exhibit-pre {
  margin: 0; padding: 0.75rem; font-family: var(--mono); font-size: 0.88rem; line-height: 1.45; overflow-x: auto;
  white-space: pre; overflow-wrap: normal; background: var(--surface);
}

.options { border: 0; padding: 0; margin: 0; min-width: 0; }
.options legend { font-weight: 600; color: var(--muted); padding: 0; margin-bottom: 0.5rem; }
.opt {
  display: flex; align-items: flex-start; gap: 0.6rem; padding: 0.7rem 0.75rem; margin-bottom: 0.5rem; min-height: 2.75rem;
  border: 1px solid var(--border); border-radius: 8px; cursor: pointer; background: var(--surface);
}
.opt:hover { border-color: var(--accent); }
.opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 4px 0 0 var(--accent); }
.opt:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.opt input { margin-top: 0.3rem; flex: none; width: 1.15rem; height: 1.15rem; accent-color: var(--accent); }
.opt-letter { font-weight: 700; flex: none; }
.opt-text { min-width: 0; }
.opt.is-hl .opt-text { background: var(--highlight); color: var(--highlight-text); border-radius: 3px; padding: 0 0.2rem; }
.opt.is-st .opt-text { text-decoration: line-through; text-decoration-thickness: 2px; color: var(--muted); }
.item[data-tool="h"] .opt, .item[data-tool="s"] .opt { cursor: cell; }
.hint { color: var(--bad); font-weight: 600; min-height: 1.2rem; }

/* ---------- performance-based ---------- */

.pbq-prompt { font-weight: 600; }
.order-slots .match-row { grid-template-columns: 2.25rem minmax(0, 1fr) auto; }
.order-num {
  width: 2rem; height: 2rem; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center;
}

.match { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 1rem; align-items: start; }
.match-rows { list-style: none; margin: 0; padding: 0; }
.match-row {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 0.5rem; align-items: center;
  padding: 0.4rem 0; border-bottom: 1px solid var(--border);
}
.match-left { font-weight: 600; min-width: 0; }
.slot {
  font: inherit; color: var(--muted); background: var(--surface-2); border: 2px dashed var(--border); border-radius: 8px;
  padding: 0.4rem 0.6rem; min-height: 2.75rem; text-align: left; cursor: pointer; min-width: 0; width: 100%;
}
.slot.is-filled { color: var(--text); background: var(--accent-soft); border-style: solid; border-color: var(--accent); }
.match-pool {
  display: flex; flex-wrap: wrap; gap: 0.5rem; align-content: flex-start; padding: 0.6rem; border: 1px solid var(--border);
  border-radius: 8px; background: var(--surface-2); position: sticky; top: 4.5rem;
}
.chip {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 0.4rem 0.7rem; min-height: 2.75rem; cursor: grab; text-align: left; max-width: 100%;
}
.chip.is-selected { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
.chip.is-used { border-style: dashed; color: var(--muted); }
.chip.is-selected.is-used { color: var(--accent-text); }

.subnet-table { width: 100%; border-collapse: collapse; }
.subnet-table th, .subnet-table td { padding: 0.35rem; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--border); }
.subnet-table thead th { font-size: 0.85rem; color: var(--muted); }
.cell-input { width: 100%; min-width: 0; font-family: var(--mono) !important; font-size: 0.9rem !important; }
.cell-label { display: none; font-size: 0.8rem; color: var(--muted); }

/* ---------- solution ---------- */

.solution { margin-top: 0.5rem; }
#item-feedback:focus { outline: none; }
.verdict { padding: 0.5rem 0.75rem; border-radius: 6px; border: 1px solid var(--border); border-left-width: 6px; }
.verdict.is-correct { border-color: var(--good); background: var(--good-soft); }
.verdict.is-wrong { border-color: var(--bad); background: var(--bad-soft); }
.sol-options { list-style: none; margin: 0 0 1rem; padding: 0; }
.sol-opt { border: 1px solid var(--border); border-left-width: 6px; border-radius: 8px; padding: 0.6rem 0.75rem; margin-bottom: 0.5rem; }
.sol-opt.is-correct { border-color: var(--good); }
.sol-opt.is-wrong { border-color: var(--bad); }
.sol-opt-head { display: flex; flex-wrap: wrap; gap: 0.4rem 0.6rem; align-items: baseline; margin: 0 0 0.25rem; font-weight: 600; }
.sol-why { margin: 0; color: var(--muted); }
.tag { font-size: 0.78rem; font-weight: 700; border-radius: 999px; padding: 0.05rem 0.55rem; border: 1px solid currentColor; white-space: nowrap; }
.tag-correct { color: var(--good); background: var(--good-soft); }
.tag-wrong { color: var(--bad); background: var(--bad-soft); }
.tag-yours { color: var(--text); background: var(--surface-2); }
.explanation { border-top: 1px solid var(--border); margin-top: 1rem; }
.cell-mine { font-family: var(--mono); display: block; }
.cell-key { display: block; font-size: 0.85rem; color: var(--muted); font-family: var(--mono); }

.table-wrap { overflow-x: auto; margin: 0 0 1rem; border: 1px solid var(--border); border-radius: 8px; max-width: 100%; }
.data-table { border-collapse: collapse; width: 100%; overflow-wrap: normal; }
.data-table th, .data-table td { padding: 0.45rem 0.6rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
.data-table thead th { background: var(--surface-2); font-size: 0.88rem; }
.data-table tbody tr:last-child th, .data-table tbody tr:last-child td { border-bottom: 0; }

/* ---------- review grid ---------- */

.review-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); gap: 0.5rem; margin: 0.75rem 0; }
.review-cell {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-left-width: 6px; border-radius: 8px;
  padding: 0.5rem 0.6rem; min-height: 3.5rem; text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 0.1rem;
}
.review-cell:hover { border-color: var(--accent); }
.review-cell.is-answered { border-left-color: var(--accent); }
.review-cell.is-unanswered { border-left-color: var(--bad); }
.cell-num { font-weight: 700; }
.cell-state { font-size: 0.85rem; color: var(--muted); }
.review-cell.is-unanswered .cell-state { color: var(--bad); font-weight: 600; }
.cell-flag { font-size: 0.85rem; color: var(--flag); font-weight: 700; }

/* ---------- report and progress ---------- */

.score-label { color: var(--muted); margin-bottom: 0.25rem; }
.score-value { font-size: 3rem; font-weight: 800; line-height: 1.1; margin: 0 0 0.25rem; }
.result { font-weight: 700; }
.result.is-pass { color: var(--good); }
.result.is-fail { color: var(--bad); }
.scale { position: relative; height: 0.9rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; margin: 1rem 0.5rem 0.25rem; }
.scale-pass { position: absolute; top: -0.35rem; bottom: -0.35rem; width: 2px; background: var(--text); }
.scale-marker {
  position: absolute; top: 50%; width: 1.1rem; height: 1.1rem; margin: -0.55rem 0 0 -0.55rem; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--surface);
}
.scale-legend { display: flex; justify-content: space-between; margin: 0 0.5rem 0.75rem; }
.bar { display: inline-block; width: 100%; max-width: 12rem; height: 0.6rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; vertical-align: middle; }
.bar-fill { display: block; height: 100%; background: var(--accent); }
.bar.is-low .bar-fill { background: var(--bad); }
.bar-cell { min-width: 9rem; }
.bar-num { display: inline-block; min-width: 3.5rem; font-weight: 600; }
.obj-list { list-style: none; margin: 0 0 1rem; padding: 0; }
.obj-row {
  display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1.3fr) minmax(0, 1fr); gap: 0.25rem 0.75rem; align-items: center;
  padding: 0.45rem 0; border-bottom: 1px solid var(--border);
}

/* ---------- dialog ---------- */

.dialog-backdrop {
  position: fixed; inset: 0; z-index: 100; background: rgba(10, 12, 15, 0.6); display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.dialog {
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 12px; padding: 1.25rem;
  width: 100%; max-width: 30rem; max-height: 90vh; overflow-y: auto; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}
.dialog h2 { margin-top: 0; }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.5rem; margin-top: 1rem; }

.noscript { max-width: 62rem; margin: 1rem auto; padding: 0 1rem; font-weight: 600; }

/* ---------- landing pages ---------- */

.landing { max-width: 46rem; }
.exam-list { list-style: none; margin: 0; padding: 0; }
.exam-link { font-size: 1.15rem; font-weight: 700; }

/* ---------- small screens ---------- */

@media (max-width: 44rem) {
  main { padding: 0.75rem; }
  .topbar-inner, .toolbar-inner, .navbar-inner { padding: 0.4rem 0.75rem; }
  .brand-name { font-size: 0.95rem; }
  .timer-label { display: none; }
  .tool-btn, .chrome-btn { padding-left: 0.6rem; padding-right: 0.6rem; }
  .match { grid-template-columns: minmax(0, 1fr); }
  .match-pool { order: -1; top: 3.2rem; z-index: 5; max-height: 40vh; overflow-y: auto; }
  .match-row { grid-template-columns: minmax(0, 1fr) auto; }
  .match-left { grid-column: 1 / -1; }
  .subnet-table, .subnet-table tbody, .subnet-table tr, .subnet-table th, .subnet-table td { display: block; width: 100%; }
  .subnet-table thead { display: none; }
  .subnet-table tr { border: 1px solid var(--border); border-radius: 8px; padding: 0.5rem; margin-bottom: 0.75rem; }
  .subnet-table th, .subnet-table td { border-bottom: 0; padding: 0.2rem 0; }
  .cell-label { display: block; }
  .obj-row { grid-template-columns: minmax(0, 1fr); }
  .score-value { font-size: 2.4rem; }
}

@media (prefers-reduced-motion: no-preference) {
  .btn, .tool-btn, .chrome-btn, .opt, .review-cell { transition: border-color 0.12s ease, background-color 0.12s ease; }
}

@media print {
  .topbar, .toolbar, .navbar, .btn-row, .skip-link { display: none !important; }
  body { background: #ffffff; color: #000000; }
}

/* ---------- GitHub star and credit ---------- */

.gh-star { gap: 0.4rem; border-color: #58b7a1; color: #9fe3d2; white-space: nowrap; }
.gh-star svg { width: 1rem; height: 1rem; flex: none; }
.gh-star:hover { background: #2e7d6b; color: #ffffff; }
.site-footer .credit { padding-bottom: 0; }
@media (max-width: 560px) { .gh-star span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; } }

/* ---------- practice a whole domain ---------- */

.domain-quick { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr)); gap: 0.6rem; }
.domain-btn { display: flex; flex-direction: column; align-items: flex-start; gap: 0.15rem; text-align: left; margin: 0; height: 100%; }
.domain-btn-title { font-weight: 600; }
.domain-btn-count { font-size: 0.85rem; color: var(--muted); }
