/* NIDSARK CTF — paper/black with a single burgundy accent, hairline borders, no gradients or glows.
   The assessment console is dark; everything else is paper. */

@font-face { font-family: "Instrument Serif"; src: url("/assets/fonts/InstrumentSerif_400Regular.ttf") format("truetype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Instrument Serif"; src: url("/assets/fonts/InstrumentSerif_400Regular_Italic.ttf") format("truetype"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Instrument Sans"; src: url("/assets/fonts/InstrumentSans_400Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Instrument Sans"; src: url("/assets/fonts/InstrumentSans_600SemiBold.ttf") format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Instrument Sans"; src: url("/assets/fonts/InstrumentSans_700Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("/assets/fonts/JetBrainsMono_400Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("/assets/fonts/JetBrainsMono_600SemiBold.ttf") format("truetype"); font-weight: 600; font-display: swap; }

:root {
  --bg: #ffffff; --well: #f7f6f3; --ink: #141414; --ink2: rgba(0,0,0,.62); --ink3: rgba(0,0,0,.42);
  --line: rgba(0,0,0,.10); --line2: rgba(0,0,0,.18); --acc: #cd0019; --acc-ink: #cd0019; --acc-soft: rgba(205,0,25,.06);
  --ok: #0f7a4a; --warn: #9a5b00;
  --serif: "Instrument Serif", Georgia, "Times New Roman", serif;
  --sans: "Instrument Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --r: 10px; --pill: 999px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.55 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--ink); }
a:hover { color: var(--acc); }
::selection { background: rgba(205,0,25,.18); }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; letter-spacing: -0.015em; margin: 0; }
h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); line-height: 1.04; }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); line-height: 1.1; }
h3 { font-size: 1.3rem; line-height: 1.2; }
p { margin: 0; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.eyebrow { font: 700 11px/1.2 var(--sans); letter-spacing: .09em; text-transform: uppercase; color: var(--ink3); }
.eyebrow.acc { color: var(--acc); }
.muted { color: var(--ink2); }
.faint { color: var(--ink3); }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.narrow { max-width: 560px; margin: 0 auto; padding: 0 24px; }
.hide { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Top bar */
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 24px; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 10px; font: 700 15px/1 var(--sans); letter-spacing: .08em; text-decoration: none; color: var(--ink); }
.brand img { width: 26px; height: 26px; }
.brand small { font: 400 12px/1 var(--mono); letter-spacing: .04em; color: var(--ink3); text-transform: none; }

/* Cards, forms, buttons */
.card { background: var(--bg); border: 1px solid var(--line); border-radius: var(--r); }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-b { padding: 18px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: 14px; }
label.f { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; }
label.f span.h { font-weight: 400; color: var(--ink3); font-size: 12px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=datetime-local], select, textarea {
  font: 15px/1.4 var(--sans); color: var(--ink); background: var(--bg); border: 1px solid var(--line2); border-radius: 8px; padding: 10px 12px; min-height: 44px; width: 100%;
}
textarea { min-height: 220px; resize: vertical; line-height: 1.55; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--acc); outline-offset: 1px; border-color: transparent; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: 600 14px/1 var(--sans); padding: 12px 20px; min-height: 44px; border-radius: var(--pill); border: 1px solid var(--line2); background: transparent; color: var(--ink); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--well); color: var(--ink); }
.btn:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
.btn.solid { background: var(--acc); border-color: var(--acc); color: #fff; }
.btn.solid:hover { background: #a30014; color: #fff; }
.btn.small { padding: 7px 13px; min-height: 34px; font-size: 12.5px; }
.btn.danger { border-color: rgba(205,0,25,.45); color: var(--acc); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.msg { font-size: 13.5px; padding: 10px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--well); }
.msg.err { border-color: rgba(205,0,25,.4); color: var(--acc); background: var(--acc-soft); }
.msg.ok { border-color: rgba(15,122,74,.35); color: var(--ok); background: rgba(15,122,74,.05); }
.chip { display: inline-flex; align-items: center; gap: 6px; font: 700 10.5px/1 var(--sans); letter-spacing: .07em; text-transform: uppercase; padding: 5px 10px; border-radius: var(--pill); border: 1px solid var(--line2); color: var(--ink2); white-space: nowrap; }
.chip.acc { border-color: rgba(205,0,25,.45); color: var(--acc); }
.chip.ok { border-color: rgba(15,122,74,.4); color: var(--ok); }
.chip.solid { background: var(--acc); border-color: var(--acc); color: #fff; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; }
.rule { border-top: 1px solid var(--line); margin: 6px 0; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.5; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--acc); flex-shrink: 0; }
ul.rules { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; color: var(--ink2); }
ul.rules b { color: var(--ink); }

/* Tables */
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.t th { text-align: left; font: 700 10.5px/1.2 var(--sans); letter-spacing: .07em; text-transform: uppercase; color: var(--ink3); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t tr.pick { cursor: pointer; }
table.t tr.pick:hover td { background: var(--well); }
.scroll { overflow-x: auto; }

/* Stat tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.tile { border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }
.tile .v { font: 400 2rem/1 var(--serif); }
.tile .v.acc { color: var(--acc); }

/* Drawer (recruiter detail) */
.veil { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 40; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(760px, 100%); background: var(--bg); border-left: 1px solid var(--line); z-index: 41; overflow-y: auto; }
.drawer .card-h { position: sticky; top: 0; background: var(--bg); z-index: 1; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 14px; font-size: 13.5px; }
.kv dt { color: var(--ink3); font-weight: 600; }
.kv dd { margin: 0; }
.timeline { display: flex; flex-direction: column; }
.timeline div { display: grid; grid-template-columns: 150px 1fr; gap: 12px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 13px; }
.timeline .integrity { color: var(--acc); }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 90px; }
.bars i { flex: 1; background: var(--line2); display: block; min-height: 2px; border-radius: 2px 2px 0 0; position: relative; }
.bars i.hot { background: var(--acc); }

/* ---------------- Assessment console (dark) ---------------- */
body.console { --bg: #0b0b10; --well: #12121a; --ink: rgba(255,255,255,.93); --ink2: rgba(255,255,255,.66); --ink3: rgba(255,255,255,.42); --line: rgba(255,255,255,.10); --line2: rgba(255,255,255,.18); --acc-ink: #ff4d5e; --acc-soft: rgba(255,77,94,.08); --ok: #3ccf8e; }
body.console .chip.acc, body.console .eyebrow.acc, body.console .msg.err { color: var(--acc-ink); }
body.console .btn.danger { color: var(--acc-ink); }
body.console a:hover { color: var(--acc-ink); }
.c-top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 20px; border-bottom: 1px solid var(--line); background: var(--bg); }
.timer { font: 600 20px/1 var(--mono); letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.timer.low { color: var(--acc-ink); }
.c-grid { display: grid; grid-template-columns: 240px minmax(0, 1fr) 340px; min-height: calc(100vh - 62px); }
.c-nav { border-right: 1px solid var(--line); padding: 16px 10px; display: flex; flex-direction: column; gap: 4px; }
.c-nav button { all: unset; display: grid; grid-template-columns: 28px 1fr auto; gap: 8px; align-items: center; padding: 10px; border-radius: 8px; cursor: pointer; font-size: 13.5px; color: var(--ink2); }
.c-nav button:hover { background: var(--well); color: var(--ink); }
.c-nav button.on { background: var(--well); color: var(--ink); outline: 1px solid var(--line2); }
.c-nav button:focus-visible { outline: 2px solid var(--acc-ink); }
.c-nav button.locked { opacity: .45; cursor: not-allowed; }
.c-nav .n { font: 600 11px/1 var(--mono); color: var(--ink3); }
.c-main { padding: 26px clamp(18px, 3vw, 40px); display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.c-side { border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.finding { border: 1px solid var(--line); border-radius: var(--r); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.finding.solved { border-color: rgba(60,207,142,.4); }
.finding.exhausted { opacity: .7; }
.opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px; max-height: 220px; overflow-y: auto; padding: 2px; }
.opts label { display: flex; gap: 8px; align-items: center; font: 12.5px/1.3 var(--mono); padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; }
.opts input { accent-color: var(--acc); }
.oria-log { flex: 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; min-height: 240px; }
.bubble { font-size: 13.5px; line-height: 1.55; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); white-space: pre-wrap; }
.bubble.me { align-self: flex-end; background: var(--well); max-width: 90%; }
.bubble.oria { align-self: flex-start; max-width: 95%; }
.oria-in { border-top: 1px solid var(--line); padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.oria-in textarea { min-height: 72px; font-size: 14px; }
.banner { position: sticky; top: 61px; z-index: 19; padding: 10px 20px; border-bottom: 1px solid rgba(255,77,94,.4); background: #1e1016; color: var(--acc-ink); font-size: 13.5px; font-weight: 600; }
.modal-veil { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 60; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal { max-width: 520px; width: 100%; background: var(--bg); border: 1px solid var(--acc-ink); border-radius: var(--r); padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.center-screen { min-height: calc(100vh - 70px); display: flex; align-items: center; justify-content: center; padding: 40px 20px; }
.center-screen .box { max-width: 560px; display: flex; flex-direction: column; gap: 14px; text-align: left; }
.center-screen .box > .chip, .center-screen .box > .eyebrow, .modal > .chip { align-self: flex-start; }

@media (max-width: 1100px) { .c-grid { grid-template-columns: 210px minmax(0, 1fr); } .c-side { grid-column: 1 / -1; border-left: none; border-top: 1px solid var(--line); } }
@media (max-width: 760px) {
  .c-grid { grid-template-columns: 1fr; }
  .c-nav { flex-direction: row; overflow-x: auto; border-right: none; border-bottom: 1px solid var(--line); }
  .c-nav button { grid-template-columns: auto; white-space: nowrap; }
  .c-nav button .t, .c-nav button .s { display: none; }
  .kv { grid-template-columns: 1fr; }
  .timeline div { grid-template-columns: 1fr; gap: 2px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* Printable scorecard */
@media print {
  @page { margin: 16mm 14mm; }
  body { background: #fff !important; color: #111 !important; }
  .no-print, .veil, .top { display: none !important; }
  .drawer { position: static; width: auto; border: none; overflow: visible; }
  .card { border-color: #d4d4d4; }
}

/* The NIDSARK mark is black ink; flip it on the dark console. */
body.console .brand img { filter: invert(1); }
