/* Network+ Adaptive Practice Exam — dark, technical, restrained.
   Graphite surfaces; bright blue drives action, bright green means correct. */

:root {
  color-scheme: dark;

  /* surfaces: near-black → graphite, each step one notch lighter */
  --bg:        #0c0f14;
  --bg-2:      #10141b;
  --panel:     #151a23;
  --panel-2:   #1b212c;
  --raised:    #222937;
  --line:      #262e3c;
  --line-soft: #1e2532;

  /* type: white → silver → slate */
  --ink:       #eef2f7;
  --ink-2:     #c2cbd8;
  --muted:     #8492a6;
  --faint:     #5d687a;

  /* accents */
  --blue:      #3d9bff;
  --blue-hi:   #66b2ff;
  --blue-dim:  rgba(61, 155, 255, .13);
  --green:     #2fe08a;
  --green-dim: rgba(47, 224, 138, .12);
  --red:       #ff6b72;
  --red-dim:   rgba(255, 107, 114, .12);

  --r-sm: 8px;
  --r:    12px;
  --r-lg: 16px;

  --shadow:    0 1px 0 rgba(255,255,255,.03) inset, 0 8px 28px rgba(0,0,0,.45);
  --shadow-sm: 0 2px 10px rgba(0,0,0,.35);
  --ease: cubic-bezier(.22,.61,.36,1);

  --ui:   "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

/* `display` on .modal/.view would otherwise beat the hidden attribute
   and leave an invisible overlay eating every click. */
[hidden] { display: none !important; }

body {
  min-height: 100vh;
  background: var(--bg);
  /* two faint pools of colour so the page isn't a flat slab */
  background-image:
    radial-gradient(900px 520px at 12% -8%,  rgba(61,155,255,.10), transparent 60%),
    radial-gradient(760px 480px at 92% 4%,   rgba(47,224,138,.055), transparent 62%);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--ui);
  font-size: 16px;
  line-height: 1.55;
  font-feature-settings: "cv05" 1, "ss01" 1;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

h1, h2, h3 { letter-spacing: -.02em; line-height: 1.25; }
h1 { font-size: 1.6rem; font-weight: 700; margin: 0 0 .35em; }
h2 { font-size: 1.05rem; font-weight: 650; margin: 0 0 .7em; }
h3 { font-size: .8rem; font-weight: 650; text-transform: uppercase; letter-spacing: .09em;
     color: var(--muted); margin: 1.4em 0 .6em; }
p  { margin: 0 0 .85em; }
b, strong { font-weight: 650; }

.muted { color: var(--muted); }
.hint  { font-size: .82rem; line-height: 1.5; color: var(--muted); }
.lede  { color: var(--ink-2); max-width: 64ch; }

:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 4px; }
::selection { background: rgba(61,155,255,.32); }

/* scrollbars inside panels */
* { scrollbar-width: thin; scrollbar-color: var(--raised) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: var(--raised); border-radius: 9px; }

/* ─── top bar ─────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 13px 22px;
  background: rgba(12,15,20,.82);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  border-bottom: 1px solid var(--line-soft);
}
.brand {
  display: flex; align-items: baseline; gap: .45em;
  font-weight: 750; font-size: 1.02rem; letter-spacing: -.025em;
}
.brand::before {
  content: ""; width: 9px; height: 9px; border-radius: 2px; align-self: center;
  background: var(--green); box-shadow: 0 0 10px rgba(47,224,138,.75);
}
.brand span { font-weight: 450; font-size: .95rem; color: var(--muted); letter-spacing: -.01em; }

.topbar-right { display: flex; align-items: center; gap: 16px; }
.who { font-size: .8rem; color: var(--muted); }

.timer {
  font-family: var(--mono); font-weight: 700; font-size: 1.06rem;
  font-variant-numeric: tabular-nums; letter-spacing: .02em;
  padding: 5px 15px; border-radius: 999px;
  color: var(--ink); background: var(--panel-2);
  border: 1px solid var(--line);
  transition: color .3s var(--ease), border-color .3s var(--ease), background .3s var(--ease);
}
.timer.warn { color: #ffd166; border-color: rgba(255,209,102,.5); background: rgba(255,209,102,.08); }
.timer.crit {
  color: var(--red); border-color: rgba(255,107,114,.55); background: var(--red-dim);
  animation: pulse 1.1s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: .5; } }

/* ─── layout ──────────────────────────────────────────────── */
.view { max-width: 1120px; margin: 0 auto; padding: 30px 22px 72px; }
#view-home, #view-results { max-width: 920px; }
@media (max-width: 620px) {
  .view { padding: 20px 16px 56px; }
  .topbar { padding: 11px 16px; }
  .brand span, .who { display: none; }   /* keep the bar to one line on a phone */
  .qnav { gap: 8px; }
  .qnav .btn { padding: 10px 13px; }
  .qtext { font-size: 1.04rem; }
}

.card {
  background: linear-gradient(180deg, var(--panel) 0%, var(--bg-2) 100%);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 26px;
  margin-bottom: 20px;
}
@media (max-width: 560px) { .card { padding: 20px 17px; border-radius: var(--r); } }

.exam-layout {
  display: grid; grid-template-columns: minmax(0,1fr) 300px;
  gap: 20px; align-items: start;
}
.side { position: sticky; top: 78px; }
@media (max-width: 900px) {
  .exam-layout { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; order: 2; }
}

/* ─── buttons & fields ────────────────────────────────────── */
.btn {
  font: inherit; font-weight: 600; font-size: .92rem; cursor: pointer;
  display: inline-flex; align-items: center; gap: .5em; white-space: nowrap;
  padding: 10px 17px; border-radius: 10px;
  color: var(--ink-2);
  background: var(--panel-2);
  border: 1px solid var(--line);
  transition: background .16s var(--ease), border-color .16s var(--ease),
              color .16s var(--ease), transform .08s var(--ease);
}
.btn:hover:not(:disabled) { background: var(--raised); border-color: #33405a; color: var(--ink); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .32; cursor: not-allowed; }

.btn.primary {
  color: #041225; border-color: transparent;
  background: linear-gradient(180deg, var(--blue-hi), var(--blue));
  box-shadow: 0 1px 0 rgba(255,255,255,.22) inset, 0 4px 16px rgba(61,155,255,.28);
}
.btn.primary:hover:not(:disabled) {
  color: #041225; background: linear-gradient(180deg, #82c2ff, #4aa4ff);
  box-shadow: 0 1px 0 rgba(255,255,255,.28) inset, 0 6px 22px rgba(61,155,255,.4);
}
.btn.small { padding: 7px 13px; font-size: .84rem; border-radius: 9px; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover:not(:disabled) { background: var(--panel-2); color: var(--ink-2); }
.btn.danger:hover:not(:disabled) { color: var(--red); border-color: rgba(255,107,114,.45); background: var(--red-dim); }
.btn.wide { width: 100%; justify-content: center; margin-top: 14px; }

.actions { display: flex; flex-wrap: wrap; gap: 11px; margin-top: 20px; }
.actions.secondary { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line-soft); }

/* spec strip under the intro copy */
.specs {
  list-style: none; display: flex; flex-wrap: wrap; gap: 10px;
  padding: 0; margin: 22px 0 4px;
}
.specs li {
  display: flex; align-items: baseline; gap: .45em;
  padding: 9px 15px; border-radius: 999px;
  background: var(--bg-2); border: 1px solid var(--line);
}
.specs b {
  font-family: var(--mono); font-size: .95rem; font-weight: 700;
  color: var(--blue-hi); letter-spacing: -.01em;
}
.specs li:last-child b { color: var(--green); font-family: var(--ui); font-size: .88rem; }
.specs span { font-size: .82rem; color: var(--muted); }

.field { display: block; margin: 24px 0 8px; max-width: 360px; }
.field span {
  display: block; font-size: .74rem; font-weight: 650; text-transform: uppercase;
  letter-spacing: .09em; color: var(--muted); margin-bottom: 7px;
}
.field input {
  font: inherit; width: 100%; padding: 11px 14px;
  border-radius: 10px; color: var(--ink);
  background: var(--bg); border: 1px solid var(--line);
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease);
}
.field input::placeholder { color: var(--faint); }
.field input:focus {
  outline: none; border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-dim);
}

.check { display: flex; align-items: flex-start; gap: 10px; font-size: .88rem;
         color: var(--ink-2); margin: 16px 0; cursor: pointer; }
.check input { margin-top: 2px; }

kbd {
  font-family: var(--mono); font-size: .74em; font-weight: 500;
  padding: 2px 6px; border-radius: 5px; color: var(--ink-2);
  background: var(--raised); border: 1px solid var(--line); border-bottom-width: 2px;
}

/* ─── question ────────────────────────────────────────────── */
.qhead { display: flex; align-items: center; gap: 13px; flex-wrap: wrap; margin-bottom: 18px; }
.qcount {
  font-family: var(--mono); font-size: .78rem; font-weight: 500;
  letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
}
.qcount b { color: var(--ink); font-weight: 700; }

.badge {
  font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em;
  padding: 4px 10px; border-radius: 999px;
  color: var(--green); background: var(--green-dim);
  border: 1px solid rgba(47,224,138,.35);
}

.btn.flag { margin-left: auto; padding: 7px 13px; font-size: .82rem; }
.btn.flag .flag-icon { font-size: .95em; line-height: 1; }
.btn.flag[aria-pressed="true"] {
  color: var(--blue); background: var(--blue-dim); border-color: rgba(61,155,255,.5);
}

.qtext {
  font-size: 1.1rem; line-height: 1.62; color: var(--ink);
  letter-spacing: -.008em; margin-bottom: 22px; white-space: pre-wrap;
}

/* a table / command output that belongs to the question */
.exhibit {
  margin: 12px 0; padding: 12px 14px; overflow-x: auto; max-width: 100%;
  font-family: var(--mono); font-size: .8rem; line-height: 1.5; white-space: pre;
  color: var(--ink-2); background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px;
}

.options { display: flex; flex-direction: column; gap: 10px; }
.opt {
  display: flex; gap: 13px; align-items: flex-start; cursor: pointer;
  padding: 14px 16px; border-radius: 11px;
  color: var(--ink-2);
  background: var(--bg-2); border: 1px solid var(--line);
  transition: background .14s var(--ease), border-color .14s var(--ease), color .14s var(--ease);
}
.opt:hover { background: var(--panel-2); border-color: #33405a; color: var(--ink); }
.opt input, .check input {
  appearance: none; -webkit-appearance: none; flex: none; cursor: pointer;
  width: 17px; height: 17px; margin: 0; position: relative;
  background: var(--bg); border: 1.5px solid #3a465c;
  transition: border-color .14s var(--ease), background .14s var(--ease), box-shadow .14s var(--ease);
}
.opt input { margin-top: 2px; }
.opt input[type=radio],    .check input[type=radio]    { border-radius: 50%; }
.opt input[type=checkbox], .check input[type=checkbox] { border-radius: 5px; }
.opt:hover input { border-color: #4d5c78; }

.opt input:checked, .check input:checked { border-color: var(--blue); background: var(--blue); }
.opt input:checked::after, .check input:checked::after {
  content: ""; position: absolute; inset: 0; margin: auto;
}
.opt input[type=radio]:checked::after, .check input[type=radio]:checked::after {
  width: 6px; height: 6px; border-radius: 50%; background: #06182c;
}
.opt input[type=checkbox]:checked::after, .check input[type=checkbox]:checked::after {
  width: 5px; height: 9px; margin-top: -1px;
  border: solid #06182c; border-width: 0 2px 2px 0; transform: rotate(42deg);
}
.opt .letter {
  font-family: var(--mono); font-weight: 700; font-size: .84rem;
  color: var(--faint); flex: none; min-width: 1.15em; padding-top: .12em;
}
.opt.sel {
  color: var(--ink);
  background: var(--blue-dim);
  border-color: rgba(61,155,255,.55);
  box-shadow: 0 0 0 1px rgba(61,155,255,.18), 0 4px 16px rgba(61,155,255,.1);
}
.opt.sel .letter { color: var(--blue-hi); }

.qnav {
  display: flex; gap: 11px; align-items: center;
  margin-top: 24px; padding-top: 19px; border-top: 1px solid var(--line-soft);
}
.qnav #btn-next { margin-left: auto; }

/* ─── navigator ───────────────────────────────────────────── */
.grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.grid button {
  position: relative; font-family: var(--mono); font-size: .76rem; font-weight: 500;
  cursor: pointer; aspect-ratio: 1; padding: 0;
  color: var(--muted); background: var(--bg-2);
  border: 1px solid var(--line); border-radius: 7px;
  transition: background .14s var(--ease), color .14s var(--ease),
              border-color .14s var(--ease), transform .1s var(--ease);
}
.grid button:hover { transform: translateY(-1px); border-color: #3a4763; color: var(--ink); }

/* answered → green fill */
.grid button.answered {
  color: var(--green); background: var(--green-dim);
  border-color: rgba(47,224,138,.42); font-weight: 700;
}
/* flagged → blue border plus a corner marker, so it reads even next to green */
.grid button.flagged { border-color: var(--blue); color: var(--blue-hi); }
.grid button.flagged::after {
  content: ""; position: absolute; top: 3px; right: 3px;
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--blue-hi); box-shadow: 0 0 6px rgba(102,178,255,.8);
}
.grid button.flagged.answered { background: var(--green-dim); color: var(--green); }
/* current → silver ring */
.grid button.current {
  box-shadow: 0 0 0 2px var(--ink-2); border-color: transparent; color: var(--ink);
}

.legend {
  list-style: none; display: flex; flex-wrap: wrap; gap: 13px;
  padding: 0; margin: 13px 0 0; font-size: .72rem; color: var(--muted);
}
.legend li { display: flex; align-items: center; gap: 6px; }
.sw {
  width: 11px; height: 11px; border-radius: 3px; display: inline-block;
  background: var(--bg-2); border: 1px solid var(--line);
}
.sw.answered { background: var(--green-dim); border-color: rgba(47,224,138,.42); }
.sw.flagged { background: transparent; border-color: var(--blue); position: relative; }
.sw.flagged::after {
  content: ""; position: absolute; top: 1px; right: 1px;
  width: 3px; height: 3px; border-radius: 50%; background: var(--blue-hi);
}

.flagged-block { margin-top: 4px; }
.flag-list { list-style: none; padding: 0; margin: 0; max-height: 196px; overflow-y: auto; }
.flag-list li { margin-bottom: 5px; }
.flag-list li.empty { font-size: .82rem; color: var(--faint); padding: 2px 0; }
.flag-list button {
  font: inherit; font-size: .82rem; text-align: left; cursor: pointer; width: 100%;
  display: flex; gap: 9px; align-items: baseline;
  padding: 8px 10px; border-radius: 8px; color: var(--ink-2);
  background: var(--blue-dim); border: 1px solid rgba(61,155,255,.32);
  transition: background .14s var(--ease), border-color .14s var(--ease);
}
.flag-list button:hover { background: rgba(61,155,255,.22); border-color: var(--blue); color: var(--ink); }
.flag-list b { font-family: var(--mono); font-size: .76rem; color: var(--blue-hi); flex: none; }
.flag-list span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.progress-line {
  margin: 17px 0 0; font-size: .8rem; color: var(--muted);
  padding-top: 15px; border-top: 1px solid var(--line-soft);
}
#answered-count { font-family: var(--mono); font-weight: 700; color: var(--ink); }
.kbd { margin-top: 12px; line-height: 2; }

/* ─── progress card ───────────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(126px, 1fr)); gap: 11px; }
.stat {
  position: relative; overflow: hidden;
  background: var(--bg-2);
  border: 1px solid var(--line); border-left: 2px solid rgba(61,155,255,.55);
  border-radius: var(--r); padding: 15px 16px;
}
.stat b {
  display: block; font-family: var(--mono); font-size: 1.6rem; font-weight: 700;
  line-height: 1.15; letter-spacing: -.02em; color: var(--ink);
}
.stat span { font-size: .75rem; color: var(--muted); }
.stat i { font-style: normal; color: var(--ink-2); }
#st-weak     { color: var(--red); }
.stat:nth-child(3) { border-left-color: rgba(255,107,114,.55); }
.stat:nth-child(4) { border-left-color: rgba(47,224,138,.55); }
#st-mastered { color: var(--green); }

.history {
  display: flex; align-items: flex-end; gap: 6px; height: 64px;
  margin: 6px 0 4px; padding: 0 1px 7px;
  border-bottom: 1px solid var(--line);
}
.hist-title { margin: 24px 0 0; }
.history i {
  flex: 1; max-width: 22px; min-height: 3px; border-radius: 4px 4px 1px 1px;
  background: linear-gradient(180deg, var(--blue-hi), rgba(61,155,255,.35));
}
.history i:last-child { background: linear-gradient(180deg, var(--green), rgba(47,224,138,.3)); }

.weak-list { margin-top: 18px; font-size: .88rem; }
.weak-list summary {
  cursor: pointer; font-weight: 600; color: var(--ink-2);
  padding: 11px 0; list-style: none;
}
.weak-list summary::-webkit-details-marker { display: none; }
.weak-list summary::before {
  content: "▸"; display: inline-block; margin-right: .5em;
  color: var(--blue); font-size: .85em;
  transition: transform .15s var(--ease);
}
.weak-list[open] summary::before { transform: rotate(90deg); }
.weak-list summary:hover { color: var(--ink); }
.weak-list ol { max-height: 320px; overflow-y: auto; padding-left: 1.5em; margin: 4px 0 0; }
.weak-list li { margin: .65em 0; color: var(--muted); line-height: 1.5; }
.weak-list .misses { font-family: var(--mono); font-size: .8em; font-weight: 700; color: var(--red); }

/* ─── results ─────────────────────────────────────────────── */
.score-row { display: flex; align-items: center; gap: 26px; flex-wrap: wrap; }
.ring {
  --pct: 0; width: 124px; height: 124px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: conic-gradient(var(--blue) 0deg, var(--green) calc(var(--pct) * 3.6deg),
                             var(--line-soft) calc(var(--pct) * 3.6deg));
}
.ring b {
  width: 96px; height: 96px; border-radius: 50%; display: grid; place-items: center;
  background: var(--panel); color: var(--ink);
  font-family: var(--mono); font-size: 1.45rem; font-weight: 700; letter-spacing: -.02em;
}
.score-facts p { margin: 0 0 .35em; color: var(--muted); font-size: .92rem; }
.score-facts b { font-family: var(--mono); font-size: 1.2rem; color: var(--ink); }

/* ─── review list ─────────────────────────────────────────── */
.review-filter { margin-bottom: 10px; }
.review { list-style: none; padding: 0; margin: 0; }
.review > li { padding: 19px 0; border-top: 1px solid var(--line-soft); }
.review > li:first-child { border-top: 0; padding-top: 4px; }

.review .rq { display: flex; gap: 11px; align-items: baseline; }
.review .rn { font-family: var(--mono); font-size: .85rem; color: var(--faint); flex: none; }
.review .rtext { flex: 1; min-width: 0; color: var(--ink); line-height: 1.55; white-space: pre-line; }

.review .tag {
  font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .09em;
  padding: 4px 9px; border-radius: 999px; flex: none; align-self: flex-start;
}
.review .tag.ok   { color: var(--green); background: var(--green-dim); border: 1px solid rgba(47,224,138,.32); }
.review .tag.no   { color: var(--red);   background: var(--red-dim);   border: 1px solid rgba(255,107,114,.32); }
.review .tag.skip { color: var(--muted); background: var(--raised);    border: 1px solid var(--line); }

.review ul { list-style: none; padding: 0; margin: 13px 0 0 2.1em; font-size: .9rem; }
.review ul li {
  display: flex; gap: .5em; padding: 8px 12px; margin-bottom: 5px;
  border-radius: 8px; border: 1px solid transparent; color: var(--muted);
}
.review li.correct {
  color: var(--green); background: var(--green-dim);
  border-color: rgba(47,224,138,.35); font-weight: 600;
}
.review li.chosen-wrong {
  color: var(--red); background: var(--red-dim);
  border-color: rgba(255,107,114,.35); text-decoration: line-through;
  text-decoration-color: rgba(255,107,114,.45);
}
.review .mark { font-family: var(--mono); font-weight: 700; flex: none; width: 1em; }
.review .why {
  margin: 10px 0 0 2.1em; padding: 10px 14px; font-size: .9rem; line-height: 1.6;
  color: var(--ink-2); background: var(--panel-2); border-left: 2px solid var(--line);
  border-radius: 0 8px 8px 0;
}
.review .why-label {
  display: block; margin-bottom: 3px; font-family: var(--mono); font-size: .7rem;
  letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}

/* ─── modal ───────────────────────────────────────────────── */
.modal {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 18px;
  background: rgba(6,8,12,.72);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  animation: fade .16s var(--ease);
}
@keyframes fade { from { opacity: 0; } }
.modal-box {
  max-width: 440px; padding: 26px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: 0 24px 60px rgba(0,0,0,.6);
  animation: rise .2s var(--ease);
}
@keyframes rise { from { opacity: 0; transform: translateY(10px) scale(.985); } }
.modal-box p { color: var(--ink-2); }

/* ─── footer ──────────────────────────────────────────────── */
.foot {
  text-align: center; font-size: .76rem; color: var(--faint);
  padding: 0 22px 36px;
}
#foot-count { font-family: var(--mono); color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ─── performance-based questions (js/pbq.js, js/pbq-ui.js) ─────────── */
.pbq { display: flex; flex-direction: column; gap: 14px; overflow-wrap: anywhere; }
.pbq-head { display: flex; align-items: center; gap: 10px; }
.pbq-badge { color: var(--blue); background: var(--blue-dim); border-color: rgba(61,155,255,.45); }
.pbq-title { margin: 0; font-size: 1.12rem; }
.pbq-scenario p { margin: 0 0 8px; color: var(--ink); line-height: 1.6; }
.pbq-req { margin: 4px 0 8px 1.2em; padding: 0; color: var(--ink-2); line-height: 1.55; }
.pbq-req li { margin: 3px 0; }
.pbq-instr { font-size: .92rem; color: var(--ink-2) !important; }
.pbq-instr b { color: var(--blue); margin-right: 4px; font-weight: 650; }

.pbq-vtabs, .pbq-wtabs, .pbq-ptabs { display: flex; gap: 6px; flex-wrap: wrap; }
.pbq-vtabs button, .pbq-wtabs button, .pbq-ptabs button {
  font: inherit; font-size: .85rem; padding: 6px 12px; border-radius: 8px; cursor: pointer;
  color: var(--ink-2); background: var(--panel-2); border: 1px solid var(--line);
}
.pbq-vtabs button.on, .pbq-wtabs button.on, .pbq-ptabs button.on { color: var(--ink); border-color: var(--blue); background: var(--blue-dim); }

.pbq-diagram { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-2); }
.pbq-svg { display: block; width: 100%; min-width: 560px; height: auto; font-family: var(--sans, Inter, sans-serif); }
.pbq-zone rect { stroke: var(--line); stroke-width: 1; }
.pbq-zone.tone-a rect { fill: rgba(61,155,255,.06); } .pbq-zone.tone-b rect { fill: rgba(47,224,138,.06); }
.pbq-zone.tone-c rect { fill: rgba(255,184,77,.07); } .pbq-zone.tone-d rect { fill: rgba(194,203,216,.05); }
.pbq-zone text { fill: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .02em; }
.pbq-link { stroke: #3a4558; stroke-width: 2; }
.pbq-llabel { fill: var(--muted); font-size: 10.5px; font-family: var(--mono); }
.pbq-node rect { fill: var(--panel-2); stroke: var(--line); stroke-width: 1.2; }
.pbq-node .pbq-nico { fill: none; stroke: var(--ink-2); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.pbq-nlabel { fill: var(--ink); font-size: 11.5px; font-weight: 600; text-anchor: middle; }
.pbq-nsub { fill: var(--muted); font-size: 10.5px; font-family: var(--mono); text-anchor: middle; }
.pbq-node.clickable { cursor: pointer; }
.pbq-node.clickable rect { stroke: var(--blue); stroke-width: 1.6; }
.pbq-node.clickable .pbq-nico { stroke: var(--blue-hi); }
.pbq-node.clickable:hover rect, .pbq-node.clickable:focus rect { fill: var(--blue-dim); }
.pbq-node:focus, .pbq-slot:focus { outline: none; }
.pbq-node:focus-visible rect, .pbq-slot:focus-visible rect { stroke-width: 3; }
.pbq-note { fill: var(--ink-2); font-size: 11.5px; } .pbq-note.mono { font-family: var(--mono); font-size: 10.5px; }
.pbq-slot { cursor: pointer; }
.pbq-slot rect { fill: rgba(61,155,255,.05); stroke: var(--blue); stroke-dasharray: 5 4; stroke-width: 1.4; }
.pbq-slot text { fill: var(--ink); font-size: 10.5px; text-anchor: middle; font-weight: 600; }
.pbq-slot text.q { fill: var(--blue); font-size: 15px; }
.pbq-slot.filled rect { fill: var(--green-dim); stroke: var(--green); stroke-dasharray: none; }

.pbq-palette { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: var(--panel); display: flex; flex-direction: column; gap: 10px; }
.pbq-phint { font-size: .82rem; color: var(--muted); }
.pbq-tokens { display: flex; flex-wrap: wrap; gap: 8px; }
.pbq-token { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: .85rem; padding: 6px 10px;
  border-radius: 8px; cursor: grab; color: var(--ink); background: var(--panel-2); border: 1px solid var(--line); }
.pbq-token.sel { border-color: var(--blue); background: var(--blue-dim); box-shadow: 0 0 0 2px var(--blue-dim); }
.pbq-ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.pbq-widgets { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.pbq-widget { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: var(--panel); display: flex; flex-direction: column; gap: 8px; }
.pbq-widget.wide { grid-column: 1 / -1; }
.pbq-fig { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.pbq-fig figcaption { font-size: .78rem; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.pbq-pre { margin: 0; padding: 10px 12px; overflow-x: auto; white-space: pre; font-family: var(--mono); font-size: .76rem; line-height: 1.5;
  color: var(--ink-2); background: #0a0d12; border: 1px solid var(--line); border-radius: 8px; max-height: 360px; }
.pbq-tablewrap { overflow-x: auto; }
.pbq-table { width: 100%; border-collapse: collapse; font-size: .84rem; }
.pbq-table th { text-align: left; font-size: .74rem; letter-spacing: .03em; color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.pbq-table td { padding: 6px 8px; border-bottom: 1px solid var(--line-soft); color: var(--ink-2); font-variant-numeric: tabular-nums; vertical-align: middle; }
.pbq-kv { display: grid; grid-template-columns: max-content 1fr; gap: 3px 14px; margin: 0; font-size: .84rem; }
.pbq-kv dt { color: var(--muted); } .pbq-kv dd { margin: 0; color: var(--ink); font-family: var(--mono); font-size: .8rem; }
.pbq-bars { display: flex; flex-direction: column; gap: 6px; font-size: .82rem; }
.pbq-bars .bar { display: grid; grid-template-columns: minmax(70px, 30%) 1fr auto; align-items: center; gap: 8px; }
.pbq-bars .bl { color: var(--ink-2); } .pbq-bars .bv { color: var(--ink); font-family: var(--mono); font-size: .78rem; }
.pbq-bars .bt { height: 10px; background: var(--panel-2); border-radius: 6px; overflow: hidden; }
.pbq-bars .bt i { display: block; height: 100%; background: var(--blue); }
.pbq-bars .bt i.tone-b { background: var(--green); } .pbq-bars .bt i.tone-c { background: #ffb84d; } .pbq-bars .bt i.tone-r { background: var(--red); }
.pbq-wiresvg svg { width: 100%; max-width: 320px; height: auto; }
.pbq-wiresvg text { fill: var(--ink-2); font-size: 11px; text-anchor: middle; font-family: var(--mono); }
.pbq-wiresvg text.open { fill: var(--red); }
.pbq-wiresvg line { stroke: var(--ink-2); stroke-width: 2; }
.pbq-wiresvg .short { fill: none; stroke: var(--red); stroke-width: 2.5; }
.pbq-p { margin: 0; color: var(--ink-2); line-height: 1.55; } .pbq-p.small { font-size: .8rem; color: var(--muted); }

.pbq-form { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px 12px; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.pbq-form legend { padding: 0 6px; font-size: .8rem; color: var(--muted); font-weight: 600; }
.pbq-row { display: grid; grid-template-columns: minmax(120px, 40%) 1fr; align-items: center; gap: 10px; }
.pbq-flabel { color: var(--ink-2); font-size: .88rem; }
.pbq-in, .pbq-sel { font: inherit; font-size: .88rem; color: var(--ink); background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 8px; padding: 6px 9px; min-width: 0; max-width: 100%; }
.pbq-in { font-family: var(--mono); font-size: .82rem; }
.pbq-in.w-s, .pbq-sel.w-s { width: 9.5em; } .pbq-in.w-m, .pbq-sel.w-m { width: 100%; max-width: 16em; } .pbq-in.w-l, .pbq-sel.w-l { width: 100%; }
.pbq-in:focus, .pbq-sel:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 3px var(--blue-dim); }
.pbq-seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; width: max-content; }
.pbq-seg button { font: inherit; font-size: .85rem; padding: 5px 12px; border: 0; background: var(--bg-2); color: var(--ink-2); cursor: pointer; }
.pbq-seg button + button { border-left: 1px solid var(--line); }
.pbq-seg button[aria-checked="true"] { background: var(--blue); color: #06111f; font-weight: 650; }
.pbq-checks { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: .84rem; color: var(--ink-2); }
.pbq-checks label { display: inline-flex; gap: 4px; align-items: center; cursor: pointer; }
.pbq-grid td { white-space: nowrap; }
/* port tables: size to their content and scroll sideways inside the window, never squeeze a column */
.pbq-grid { width: max-content; min-width: 100%; }
.pbq-grid th { white-space: nowrap; }
.pbq-grid td, .pbq-grid th { padding: 5px 6px; }
.pbq-grid .pbq-sel.w-s { width: auto; min-width: 5.5em; }
.pbq-grid .pbq-checks { flex-wrap: nowrap; }
.pbq-win:has(.pbq-grid) { width: min(1120px, 100%); }
.pbq-grid td:first-child, .pbq-grid th:first-child { position: sticky; left: 0; z-index: 1; background: var(--panel); }

.pbq-term { border: 1px solid var(--line); border-radius: 8px; background: #07090d; font-family: var(--mono); font-size: .78rem; }
.pbq-tout { margin: 0; padding: 10px 12px; height: 260px; overflow: auto; white-space: pre; color: #b9f5cf; }
.pbq-tline { display: flex; gap: 6px; align-items: center; padding: 6px 12px; border-top: 1px solid var(--line); color: #b9f5cf; }
.pbq-tline input { flex: 1; min-width: 0; font: inherit; color: #eafff1; background: transparent; border: 0; outline: none; }

.pbq-questions { display: flex; flex-direction: column; gap: 10px; }

.pbq-overlay { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px;
  background: rgba(5,7,10,.72); backdrop-filter: blur(2px); }
.pbq-win { width: min(720px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.5); overflow: hidden; }
.pbq-win header { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--panel-2); }
.pbq-win header h3 { margin: 0; font-size: 1rem; }
.pbq-x { font: inherit; background: none; border: 0; color: var(--ink-2); font-size: 1.05rem; cursor: pointer; padding: 4px 8px; border-radius: 6px; }
.pbq-x:hover { background: var(--line); }
.pbq-wtabs { padding: 10px 16px 0; }
.pbq-wbody { padding: 14px 16px; overflow: auto; display: flex; flex-direction: column; gap: 12px; overflow-wrap: anywhere; }
.pbq-win footer { padding: 10px 16px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; }

.pbq-review { margin: 12px 0 0 2.1em; display: flex; flex-direction: column; gap: 8px; }
.pbq-review tr.ok td { color: var(--ink-2); } .pbq-review tr.no td:nth-child(3) { color: var(--red); }
.pbq-review tr.part td:nth-child(3) { color: #ffb84d; }
.pbq-review td.m { font-family: var(--mono); font-weight: 700; text-align: center; }
.pbq-review tr.ok td.m { color: var(--green); } .pbq-review tr.no td.m { color: var(--red); } .pbq-review tr.part td.m { color: #ffb84d; }
.grid button.pbq-cell { box-shadow: inset 0 -3px 0 var(--blue); }
.question-card.is-pbq .options { display: none; }

@media (max-width: 560px) {
  .pbq-row { grid-template-columns: 1fr; gap: 4px; }
  .pbq-review { margin-left: 0; }
  .pbq-overlay { padding: 0; }
  .pbq-win { max-height: 100vh; height: 100%; border-radius: 0; }
}
.pbq-title, .pbq-win header h3 { text-transform: none; letter-spacing: -.01em; color: var(--ink); font-weight: 650; }
