/* =========================================================
   FORGE CTF v2 — minimal terminal
   Single mono font · flat · green/amber on near-black.

   NOTE: this file targets the class names the theme actually
   renders (board tiles from forge-challenges.js, the modal from
   challenge.html, the scoreboard table). The palette + fonts
   live in :root; innerpages.css / auth.css / forge-shim.css all
   consume these same variables. The legacy aliases keep older
   selectors resolving without a sweep.
========================================================= */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;700&display=swap');

:root {
  --bg: #060806;
  --panel: #0a0e0a;
  --line: #1d281d;
  --line-strong: #2e3e2e;
  --green: #00e53a;
  --green-bright: #5cff7d;
  --fg: #c6e6c6;
  --dim: #587858;
  --faint: #31452f;
  --amber: #ffb000;
  --red: #ff4455;

  /* legacy aliases — keep inner/auth pages + inline var() refs resolving */
  --border: #2e3e2e;
  --border-dim: #1d281d;
  --green-dim: #587858;
  --very-dim: #162016;
  --white: #c6e6c6;
  --panel-solid: #0a0e0a;
  --bg-2: #0a100a;
  --bg-3: #0d160d;
  --font-pixel: 'JetBrains Mono', monospace;
  --font-term: 'JetBrains Mono', monospace;
  --font-mono: 'JetBrains Mono', monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: 0;
}

/* v2 is flat — no CRT scanlines, vignette or glow. */

.green { color: var(--green); }
.amber { color: var(--amber); }
.dim   { color: var(--dim); }
.red   { color: var(--red); }
.white { color: var(--white); }
.sep   { color: var(--faint); margin: 0 8px; }
.small { font-size: 12px; }

.blink { animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

button {
  background: transparent;
  color: inherit;
  border: none;
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  letter-spacing: inherit;
}

a { color: var(--green); text-decoration: none; }
a:hover { color: var(--green-bright); }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--line); }
::-webkit-scrollbar-thumb:hover { background: var(--line-strong); }

/* =========================================================
   Challenges board (rendered by forge-challenges.js)
========================================================= */

.forge-chall-cat { margin-bottom: 8px; }
.forge-chall-cat .ip-page-sub {
  color: var(--amber);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.chall-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px;
}

.chall-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 120px;
  padding: 14px 14px 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  text-align: left;
  color: var(--fg);
}
.chall-card:hover {
  border-color: var(--green);
  background: rgba(0, 229, 58, 0.05);
}
.chall-card:hover .chall-title { color: var(--green-bright); }
.chall-card:hover .chall-corner { color: var(--green); }

.chall-card.solved { border-color: var(--line-strong); background: rgba(0, 229, 58, 0.04); }
.chall-card.solved .chall-title { color: var(--dim); text-decoration: line-through; text-decoration-color: var(--faint); }

/* The ASCII corners are pure decoration in v2 — keep them muted/subtle. */
.chall-corner {
  position: absolute;
  color: var(--faint);
  font-size: 12px;
  line-height: 1;
}
.chall-corner.tl { top: 3px; left: 5px; }
.chall-corner.tr { top: 3px; right: 5px; }
.chall-corner.bl { bottom: 3px; left: 5px; }
.chall-corner.br { bottom: 3px; right: 5px; }

.chall-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  letter-spacing: 0.06em;
}
.chall-cat { font-weight: 700; color: var(--dim); }
.cat-web        { color: var(--green); }
.cat-crypto     { color: var(--green-bright); }
.cat-pwn        { color: var(--amber); }
.cat-reverse    { color: #ff88cc; }
.cat-forensic, .cat-forensics { color: #88ccff; }
.cat-misc       { color: var(--dim); }

.chall-pts {
  font-size: 13px;
  font-weight: 700;
  color: var(--amber);
  font-variant-numeric: tabular-nums;
}

.chall-title {
  flex: 1;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--fg);
  word-break: break-word;
}

.chall-bottom {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--dim);
  border-top: 1px solid var(--line);
  padding-top: 8px;
}
.chall-bottom .dim { color: var(--faint); }

.chall-solved-stamp {
  position: absolute;
  top: 10px;
  right: -6px;
  background: var(--green);
  color: var(--bg);
  font-size: 9px;
  font-weight: 700;
  padding: 3px 7px;
  letter-spacing: 0.12em;
}
.chall-hard-stamp {
  position: absolute;
  top: 10px;
  right: -4px;
  background: transparent;
  color: var(--amber);
  border: 1px solid var(--amber);
  font-size: 9px;
  padding: 3px 5px;
  letter-spacing: 0.12em;
}

/* =========================================================
   Challenge modal (rendered by challenge.html into #challenge-window)
========================================================= */

.modal {
  width: min(680px, 94vw);
  max-height: 88vh;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-content { display: flex; flex-direction: column; min-height: 0; }

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
}
.modal-title { font-size: 14px; font-weight: 700; color: var(--fg); }
.modal-close { color: var(--dim); font-size: 12px; }
.modal-close:hover { color: var(--fg); }

.modal-ascii { padding: 8px 20px 0; }
.modal-ascii pre {
  margin: 0;
  font-size: 10px;
  line-height: 1.2;
  color: var(--faint);
  overflow: hidden;
}

.modal-body {
  padding: 16px 20px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-section { }
.section-label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--dim);
}
.section-content {
  font-size: 13px;
  line-height: 1.6;
  color: var(--fg);
  padding-left: 14px;
  border-left: 1px solid var(--line);
}

.file-list { display: flex; flex-direction: column; gap: 4px; padding-left: 14px; }
.file-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 3px 0;
  font-size: 13px;
}
.file-name { color: var(--fg); }
.file-dl {
  margin-left: auto;
  color: var(--amber);
  font-size: 11px;
  letter-spacing: 0.06em;
  cursor: pointer;
}
.file-dl:hover { text-decoration: underline; }

.remote-box {
  margin-left: 14px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--green);
  background: var(--bg);
  border: 1px solid var(--line-strong);
}

.hint-toggle {
  margin-left: 6px;
  color: var(--dim);
  font-size: 11px;
  letter-spacing: 0.06em;
}
.hint-toggle:hover { color: var(--amber); }
.hint-box {
  margin-left: 14px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--amber);
  background: rgba(255, 176, 0, 0.05);
  border-left: 2px solid var(--amber);
}
.hint-box summary { cursor: pointer; }

/* Flag submit row — preserves selectors instance.js / forge-challenges.js use. */
.submit-row { display: flex; flex-direction: column; }
.flag-input-row {
  display: flex;
  align-items: stretch;
  margin-left: 14px;
  border: 1px solid var(--line-strong);
}
.flag-input-row:focus-within { border-color: var(--green); }
.flag-prompt {
  align-self: center;
  padding: 8px 10px;
  font-size: 13px;
  color: var(--dim);
  border-right: 1px solid var(--line);
  white-space: nowrap;
}
.flag-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--fg);
  font-family: inherit;
  font-size: 13px;
  padding: 10px 12px;
  outline: none;
}
.flag-input::placeholder { color: var(--faint); }
.flag-input.status-wrong { color: var(--red); }
.flag-input.status-right { color: var(--green-bright); }
.submit-btn {
  padding: 0 18px;
  background: var(--green);
  color: var(--bg);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
}
.submit-btn:hover { background: var(--green-bright); }
.submit-btn:disabled { background: var(--very-dim); color: var(--dim); cursor: not-allowed; }

.flag-msg { margin: 8px 0 0 14px; font-size: 12px; }
.flag-msg.wrong { color: var(--red); }
.flag-msg.right { color: var(--green-bright); }
.flag-msg.checking { color: var(--amber); }

/* =========================================================
   Scoreboard (sb-table sits on .ip-table from innerpages.css)
========================================================= */

.scoreboard { display: flex; flex-direction: column; gap: 0; }
.sb-graph { border: 1px solid var(--line); padding: 12px; }
.sb-table tr.me td { background: rgba(255, 176, 0, 0.07); color: var(--amber); }

/* =========================================================
   Prose (challenge descriptions, static pages)
========================================================= */

.forge-prose { font-size: 13px; line-height: 1.7; color: var(--fg); }
.forge-prose h1, .forge-prose h2, .forge-prose h3 { color: var(--green); font-weight: 700; }
.forge-prose a { color: var(--green); }
.forge-prose code {
  font-family: var(--font-mono);
  background: var(--bg);
  border: 1px solid var(--line);
  padding: 1px 5px;
  font-size: 12px;
  color: var(--green-bright);
}
.forge-prose pre {
  background: var(--bg);
  border: 1px solid var(--line);
  padding: 12px 14px;
  overflow-x: auto;
}
.forge-prose pre code { border: none; padding: 0; background: none; }

/* =========================================================
   Tweaks panel + boot (not currently mounted — kept flat/minimal)
========================================================= */

.tweaks {
  position: fixed;
  bottom: 16px;
  right: 16px;
  width: 240px;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  z-index: 5000;
  font-size: 12px;
}
.tweaks-header, .tweaks-head {
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  font-weight: 700;
  color: var(--green);
  letter-spacing: 0.06em;
}
.tweaks-body { padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.tweak-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.tweak-row label { color: var(--dim); font-size: 11px; letter-spacing: 0.06em; }
.tweak-row button.on, .tweak-row .toggle.on { background: var(--green); color: var(--bg); }

.boot {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 11000;
  padding: 40px;
  font-size: 13px;
  color: var(--fg);
}
.boot pre { margin: 0; line-height: 1.6; font-family: inherit; }
.boot.fade { animation: bootfade 0.4s forwards; }
@keyframes bootfade { to { opacity: 0; pointer-events: none; } }
