/* =========================================================
   Capture the Flag — hand-in bar, results image, save panel

   Linked by each level in /public/ctf/level-N/. Those pages keep their own
   look and do not load the site stylesheet, so everything here is drawn
   from the level's own :root colours (--bg, --panel, --text, --text-dim)
   with one accent: --ice on Level 3, --green on Levels 1 and 2.
   ========================================================= */

:root {
  --ctf-accent: var(--ice, var(--green, #00ff9c));
}

/* ---- Link home --------------------------------------------------------- */

.ctf-home {
  display: inline-block;
  margin-bottom: 14px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  text-decoration: none;
  position: relative;
  z-index: 5;
}
.ctf-home:hover,
.ctf-home:focus-visible { color: var(--ctf-accent); text-decoration: underline; }

/* ---- Hand-in bar: name, Submit Results, status ------------------------- */

.ctf-handin {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  margin: 0 0 24px;
  padding: 14px 16px;
  background: var(--panel);
  border: 1px solid var(--text-dim);
  border-left: 3px solid var(--ctf-accent);
  position: relative;
  z-index: 5;
}

.ctf-name {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 260px;
  min-width: 0;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.ctf-name input {
  flex: 1;
  min-width: 0;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 1rem;
  letter-spacing: normal;
  text-transform: none;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--text-dim);
  padding: 9px 12px;
  caret-color: var(--ctf-accent);
}
.ctf-name input:focus { outline: 2px solid var(--ctf-accent); outline-offset: 1px; }
.ctf-handin.is-named .ctf-name input {
  border-color: transparent;
  background: transparent;
  color: var(--ctf-accent);
  font-weight: 700;
}

.ctf-handin .btn:disabled { opacity: 0.45; cursor: default; }

.ctf-handin__status {
  flex: 1 1 100%;
  margin: 0;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.85rem;
  color: var(--text-dim);
}
.ctf-handin__status.is-ok   { color: var(--ctf-accent); }
.ctf-handin__status.is-warn { color: var(--amber, #ffb000); }
.ctf-handin__status.is-bad  { color: var(--red, #ff3b5c); }

.ctf-win-note { margin-top: 8px; }

/* After Submit Results: the flag box and checklist stay visible but
   plainly finished. */
body.ctf-submitted #flag-input { opacity: 0.5; }

/* ---- The results image ------------------------------------------------- */
/* Built off screen by ctf-session.js, rendered to PNG, then removed. Only
   the inner .ctf-shot is rendered, so the holder's position never reaches
   the image. */

.ctf-shot-holder {
  position: fixed;
  left: -10000px;
  top: 0;
  pointer-events: none;
}

.ctf-shot {
  box-sizing: border-box;
  width: 680px;
  padding: 36px 40px 28px;
  background: var(--bg);
  color: var(--text);
  border: 2px solid var(--ctf-accent);
  font-family: 'Outfit', system-ui, sans-serif;
  text-align: left;
}

.ctf-shot__kicker {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ctf-accent);
}

.ctf-shot__title {
  margin-top: 6px;
  font-size: 30px;
  font-weight: 800;
  line-height: 1.15;
  color: var(--text);
}

.ctf-shot__name {
  margin-top: 22px;
  padding: 12px 16px;
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  background: var(--panel);
  border-left: 4px solid var(--ctf-accent);
  word-break: break-word;
}

.ctf-shot__stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 18px 0 0;
}

.ctf-shot__stat {
  padding: 14px 16px;
  background: var(--panel);
  border: 1px solid var(--text-dim);
}
.ctf-shot__stat dt {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.ctf-shot__stat dd {
  margin: 6px 0 0;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 30px;
  font-weight: 800;
  color: var(--text);
}
.ctf-shot__stat.is-complete { border-color: var(--ctf-accent); }
.ctf-shot__stat.is-complete dd { color: var(--ctf-accent); }

.ctf-shot__note {
  margin: 14px 0 0;
  font-size: 14px;
  color: var(--text-dim);
}

.ctf-shot__foot {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 22px;
  padding-top: 12px;
  border-top: 1px solid var(--text-dim);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 13px;
  color: var(--text-dim);
}

/* ---- The shared save panel (/css/submission.css) ----------------------- */
/* That file is written against the site's design tokens; supply them from
   the level's palette, and sit above the games' scanline and boot layers
   (z-index 999-1000). */

.submit-save {
  z-index: 3000;
  --color-surface: var(--panel);
  --color-bg: var(--bg);
  --color-border: var(--text-dim);
  --color-ink-muted: var(--text-dim);
  --color-accent: var(--ctf-accent);
  --color-accent-soft: rgba(127, 127, 127, 0.18);
  --radius-lg: 0;
  --radius-md: 0;
  --shadow-md: 0 10px 40px rgba(0, 0, 0, 0.6);
  color: var(--text);
  font-family: 'Outfit', system-ui, sans-serif;
}
.submit-save__download { color: var(--bg); }
