/* ═══════════════════════════════════════════════════════════════════════════
   CTF page. Same light world as the home page - the identity here comes from
   the pixel flag, the HUD strip and the board, NOT from going dark.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── HERO ──────────────────────────────────────────────────────────────── */
.ctf-hero {
  position: relative; overflow: hidden;
  border-bottom: 1px solid var(--rule);
  padding: clamp(34px, 5vw, 70px) 0 clamp(40px, 5vw, 76px);
}
.ctf-hero .hero-scene img { animation-duration: 110s; }

.ctf-grid {
  position: relative; z-index: 2;
  display: grid; grid-template-columns: 1.05fr 0.95fr;
  gap: clamp(22px, 3vw, 46px); align-items: center;
}

.ctf-kicker {
  font-family: 'Silkscreen', monospace; font-size: 10px;
  letter-spacing: 0.16em; color: var(--blue);
  display: flex; align-items: center; gap: 9px; margin-bottom: 14px;
}
.ctf-kicker::after {
  content: ""; height: 1px; flex: 1; background: var(--blue-soft);
}
.ctf-title {
  font-family: 'Fraunces', Georgia, serif; font-weight: 700;
  font-variation-settings: 'opsz' 144, 'SOFT' 40, 'WONK' 1;
  font-size: clamp(54px, 9vw, 112px); line-height: 0.88;
  letter-spacing: 0.03em; color: var(--ink); margin: 0 0 16px;
}
.ctf-sub {
  font-size: clamp(15px, 1.5vw, 18px); color: var(--ink-soft);
  max-width: 46ch; line-height: 1.55;
}
.ctf-sub b { color: var(--ink); font-weight: 600; }

/* The waving pixel flag, drawn on canvas the same way the world map is. */
/* The copy needs its own ground; the pixel city eats dark text alive. */
.ctf-copy {
  background: rgba(255, 255, 255, 0.70);
  backdrop-filter: saturate(150%) blur(13px);
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 26px;
  box-shadow: 0 18px 50px rgba(14, 50, 85, 0.10);
  padding: clamp(22px, 2.8vw, 34px);
}

#flagArt {
  display: block; image-rendering: pixelated;
  width: clamp(190px, 26vw, 300px); height: auto;
  margin-bottom: clamp(14px, 2vw, 26px);
}

/* ── THE GATE (sign in) ────────────────────────────────────────────────── */
.gate {
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: saturate(150%) blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 26px;
  box-shadow: 0 20px 60px rgba(14, 50, 85, 0.14);
  padding: clamp(24px, 3vw, 34px);
}
.gate-h {
  font-family: 'Silkscreen', monospace; font-size: 10px;
  letter-spacing: 0.14em; color: var(--ink-faint); margin-bottom: 16px;
}
.gate h2 { font-size: 23px; margin: 0 0 6px; }
.gate .gate-p { font-size: 14px; color: var(--ink-soft); margin: 0 0 20px; line-height: 1.5; }

.field { margin-bottom: 14px; }
.field label {
  display: block; font-size: 12.5px; font-weight: 600;
  color: var(--ink-soft); margin-bottom: 6px;
}
.field input {
  width: 100%; font: inherit; font-size: 15px; color: var(--ink);
  background: #fff; border: 1.5px solid var(--rule); border-radius: 13px;
  padding: 12px 14px; transition: border-color .15s, box-shadow .15s;
}
.field input:focus {
  outline: none; border-color: var(--blue);
  box-shadow: 0 0 0 4px var(--blue-soft);
}
.gate .btn { width: 100%; justify-content: center; margin-top: 4px; }

.gate-msg {
  font-size: 13.5px; line-height: 1.5; margin-top: 14px;
  padding: 11px 13px; border-radius: 12px; display: none;
}
.gate-msg.show { display: block; }
.gate-msg.bad  { background: var(--signal-soft); color: #9c2a25; }
.gate-msg.ok   { background: var(--grass-soft);  color: #276834; }
.gate-msg.info { background: var(--wash-deep);   color: var(--ink-soft); }

.gate-foot {
  margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--rule);
  font-size: 12px; color: var(--ink-faint); line-height: 1.55;
}

/* Signed-in face of the same card. */
.gate-in { display: none; }
.gate.in .gate-out { display: none; }
.gate.in .gate-in  { display: block; }
.who {
  display: flex; align-items: center; gap: 13px; margin-bottom: 18px;
}
.who-pip {
  width: 42px; height: 42px; flex: none; border-radius: 12px;
  background: var(--ink); color: #fff;
  font-family: 'Silkscreen', monospace; font-size: 15px;
  display: grid; place-items: center;
}
.who-n { font-weight: 700; font-size: 17px; }
.who-r { font-size: 12.5px; color: var(--ink-soft); }

/* ── HUD STRIP ─────────────────────────────────────────────────────────── */
.hud { background: #fff; border-bottom: 1px solid var(--rule); }
.hud-inner {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 1px; background: var(--rule);
}
.hud-cell { background: #fff; padding: 20px var(--gutter); }
.hud-k {
  font-family: 'Silkscreen', monospace; font-size: 9px;
  letter-spacing: 0.12em; color: var(--ink-faint); margin-bottom: 8px;
}
.hud-v {
  font-family: 'Fraunces', Georgia, serif; font-weight: 700;
  font-variation-settings: 'opsz' 144, 'SOFT' 40, 'WONK' 1;
  font-size: 32px; line-height: 1; color: var(--ink);
}
.hud-v em { font-style: normal; color: var(--blue); }

/* ── BOARD ─────────────────────────────────────────────────────────────── */
.board { padding: clamp(50px, 6vw, 88px) 0; }
.cats { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 26px; }
.cat {
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  background: #fff; color: var(--ink-soft);
  border: 1.5px solid var(--rule); border-radius: var(--r-pill);
  padding: 7px 15px; transition: all .15s;
}
.cat:hover { border-color: var(--sky); color: var(--ink); }
.cat.on { background: var(--ink); border-color: var(--ink); color: #fff; }

.chals {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
  gap: 14px;
}
.chal {
  position: relative; text-align: left; font: inherit; cursor: pointer;
  background: #fff; border: 1.5px solid var(--rule);
  border-radius: 18px; padding: 18px 18px 16px;
  display: flex; flex-direction: column; gap: 10px;
  transition: transform .16s, box-shadow .16s, border-color .16s;
}
.chal:hover {
  transform: translateY(-3px); border-color: var(--sky);
  box-shadow: 0 14px 34px rgba(14, 50, 85, 0.11);
}
.chal-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.chal-cat {
  font-family: 'Silkscreen', monospace; font-size: 8.5px;
  letter-spacing: 0.1em; padding: 5px 8px; border-radius: 6px;
  background: var(--wash-deep); color: var(--blue);
}
.chal-pts {
  font-family: 'Fraunces', Georgia, serif; font-weight: 700;
  font-variation-settings: 'opsz' 144, 'SOFT' 40, 'WONK' 1;
  font-size: 23px; line-height: 1; color: var(--ink);
}
.chal-t { font-size: 16.5px; font-weight: 700; line-height: 1.3; }
.chal-m {
  display: flex; align-items: center; gap: 12px;
  font-size: 12px; color: var(--ink-faint); margin-top: auto;
}
.pips { display: inline-flex; gap: 3px; }
.pip { width: 6px; height: 6px; background: var(--rule); }
.pip.on { background: var(--signal); }

.chal.locked { cursor: not-allowed; opacity: 0.62; }
.chal.locked:hover { transform: none; box-shadow: none; border-color: var(--rule); }
.chal.done { border-color: var(--grass); background: #fafdfb; }
.chal-flagged {
  position: absolute; top: -8px; right: -8px;
  width: 24px; height: 24px; border-radius: 7px; background: var(--grass);
  color: #fff; font-size: 13px; display: grid; place-items: center;
}

/* ── CHALLENGE PANEL ───────────────────────────────────────────────────── */
.panel {
  border: 1.5px solid var(--ink); border-radius: 20px; background: #fff;
  padding: clamp(20px, 2.6vw, 30px); margin-bottom: 20px; display: none;
}
.panel.show { display: block; }
.panel-top {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 14px;
}
.panel h3 { font-size: clamp(21px, 2.4vw, 27px); margin: 0 0 6px; }
.panel-x {
  font: inherit; cursor: pointer; background: none; border: none;
  color: var(--ink-faint); font-size: 22px; line-height: 1; padding: 2px 6px;
}
.panel-x:hover { color: var(--ink); }
.panel-body { font-size: 15px; color: var(--ink-soft); line-height: 1.6; max-width: 66ch; }
.panel-body code {
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-size: 13px;
  background: var(--wash); padding: 2px 6px; border-radius: 5px; color: var(--ink);
}
.submit-row { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.submit-row input {
  flex: 1; min-width: 220px; font-size: 15px;
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; letter-spacing: 0.01em;
  background: var(--wash); border: 1.5px solid var(--rule);
  border-radius: 13px; padding: 13px 15px; color: var(--ink);
}
.submit-row input:focus {
  outline: none; border-color: var(--blue); box-shadow: 0 0 0 4px var(--blue-soft);
}

/* ── SCOREBOARD ────────────────────────────────────────────────────────── */
.scores { background: var(--wash); padding: clamp(50px, 6vw, 88px) 0; border-top: 1px solid var(--rule); }
.table { background: #fff; border: 1px solid var(--rule); border-radius: var(--r-card); overflow: hidden; }
.trow {
  display: grid; grid-template-columns: 58px 1fr 92px 86px;
  align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--rule);
  font-size: 14.5px;
}
.trow:last-child { border-bottom: none; }
.trow.th {
  font-family: 'Silkscreen', monospace; font-size: 9px;
  letter-spacing: 0.1em; color: var(--ink-faint); background: #fcfdff;
}
.trow.me { background: var(--blue-soft); }
.rank {
  font-family: 'Fraunces', Georgia, serif; font-weight: 700;
  font-variation-settings: 'opsz' 144, 'SOFT' 40, 'WONK' 1; font-size: 19px;
}
.rank.r1 { color: #c79a2e; } .rank.r2 { color: #8795a3; } .rank.r3 { color: #b07a4e; }
.tname { font-weight: 600; }
.tsolved, .tscore { text-align: right; color: var(--ink-soft); }
.tscore { font-weight: 700; color: var(--ink); }

.empty {
  text-align: center; padding: 44px 20px; color: var(--ink-faint); font-size: 14.5px;
}

@media (max-width: 900px) {
  .ctf-grid { grid-template-columns: 1fr; }
  .hud-inner { grid-template-columns: repeat(2, 1fr); }
  .trow { grid-template-columns: 44px 1fr 72px; }
  .trow .tsolved { display: none; }
}

/* "optional" sits beside a field label without competing with it. */
.field label .opt {
  font-family: 'Silkscreen', monospace; font-size: 8px;
  letter-spacing: 0.08em; color: var(--ink-faint);
  border: 1px solid var(--rule); border-radius: 5px;
  padding: 2px 5px; margin-left: 6px; vertical-align: 1px;
}

/* ── The resume code, handed over once ─────────────────────────────────── */
.codebox {
  border: 1.5px dashed var(--blue); border-radius: 15px;
  background: var(--wash); padding: 15px 16px; margin-bottom: 18px;
}
.codebox-k {
  font-family: 'Silkscreen', monospace; font-size: 8.5px;
  letter-spacing: 0.1em; color: var(--blue); margin-bottom: 9px;
}
.codebox-v {
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 19px; font-weight: 600; letter-spacing: 0.06em;
  color: var(--ink); word-break: break-all; margin-bottom: 11px;
}
.codebox .btn { width: 100%; justify-content: center; }
.codebox p {
  font-size: 12px; color: var(--ink-soft); line-height: 1.5; margin: 11px 0 0;
}

.linkish {
  font: inherit; font-size: 13px; cursor: pointer; background: none;
  border: none; padding: 10px 0 0; color: var(--blue);
  text-decoration: underline; text-underline-offset: 3px;
}
.linkish:hover { color: var(--ink); }

/* ── A challenge that ships a file (the APK, the binary, the capture) ───── */
.dl {
  display: inline-flex; align-items: center; gap: 13px;
  margin-top: 18px; padding: 13px 18px 13px 14px;
  border: 1.5px solid var(--rule); border-radius: 14px;
  background: #fff; color: inherit; text-decoration: none;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.dl:hover {
  text-decoration: none; border-color: var(--blue);
  box-shadow: 0 10px 26px rgba(14, 50, 85, 0.10); transform: translateY(-2px);
}
.dl-i {
  width: 34px; height: 34px; flex: none; border-radius: 10px;
  background: var(--blue-soft); color: var(--blue);
  display: grid; place-items: center; font-size: 17px;
}
.dl b { display: block; font-size: 14.5px; }
.dl-s {
  display: block; font-family: 'Silkscreen', monospace;
  font-size: 8.5px; letter-spacing: 0.08em; color: var(--ink-faint); margin-top: 3px;
}
