/* CyberGhost Lab — unslop pass.
   Direction: practice CTF lab for the CyberGhost team. Character: quiet,
   exact, terminal-like. World: night SOC / terminal, light surfaces.
   Moments: the challenge grid itself. Signature: small mono status dot
   + tabular-nums attempt counts.
   One neutral ramp, one accent per status, no gradients, no glows,
   no emoji, sentence case, 4px spacing, system font + mono for numbers. */
:root {
  --bg: #f4f4f5;
  --surface: #ffffff;
  --surface-muted: #fafafa;
  --border: #e4e4e7;
  --text: #18181b;
  --text-secondary: #52525b;
  --text-muted: #a1a1aa;
  --nav-bg: #111827;
  --nav-text: #e4e4e7;
  --nav-muted: #9ca3af;
  --green: #15803d;
  --green-dark: #166534;
  --orange: #ea580c;
  --red: #dc2626;
  --dark: #111827;
  --blue: #2563eb;
  --yellow: #eab308;
  --yellow-text: #18181b;
  --radius-control: 8px;
  --radius-card: 12px;
  --radius-panel: 16px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
}

a { color: var(--green-dark); }
button { font-family: var(--font); }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

/* ---------- shared ---------- */
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--text-muted); }
.small { font-size: 12px; }
.page { max-width: 1120px; margin: 0 auto; padding: 24px; }
.section-title { font-size: 16px; font-weight: 600; margin: 32px 0 12px; }
.section-title:first-child { margin-top: 0; }

.btn {
  display: inline-block;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease;
}
.btn-green { background: var(--green); color: #fff; }
.btn-green:hover { background: var(--green-dark); }
.btn-yellow { background: var(--yellow); color: var(--yellow-text); }
.btn-yellow:hover { background: #ca8a04; }
.btn-blue { background: var(--blue); color: #fff; }
.btn-blue:hover { background: #1d4ed8; }
.btn-outline { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-outline:hover { background: var(--surface-muted); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- login ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-brand { text-align: center; margin-bottom: 24px; }
.login-brand h1 { font-size: 20px; font-weight: 600; margin: 0 0 4px; }
.login-brand p { margin: 0; color: var(--text-secondary); }
.login-card {
  width: 100%;
  max-width: 640px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-panel);
  padding: 24px 32px 32px;
}
.login-card h2 {
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 24px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.field { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.field label { flex: 0 0 160px; font-weight: 500; }
.field input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  padding: 8px 12px;
  font-size: 14px;
  font-family: var(--font);
  background: var(--surface);
}
.field input:focus { outline: 2px solid var(--green); outline-offset: 1px; border-color: var(--green); }
.login-actions { display: flex; justify-content: center; gap: 8px; margin-top: 24px; flex-wrap: wrap; }
.login-divider {
  display: flex; align-items: center; gap: 12px;
  color: var(--text-muted); font-size: 12px; margin: 24px 0 16px;
}
.login-divider::before, .login-divider::after {
  content: ""; flex: 1; height: 1px; background: var(--border);
}
.google-btn {
  width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 120ms ease;
}
.google-btn:hover:not(:disabled) { background: var(--surface-muted); }
.google-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.login-note { text-align: center; color: var(--text-secondary); margin: 16px 0 0; }
.login-error { color: var(--red); font-size: 13px; text-align: center; margin: 12px 0 0; min-height: 20px; }
.login-footer { margin-top: 32px; color: var(--text-muted); font-size: 12px; text-align: center; }

/* ---------- top nav ---------- */
.topnav { background: var(--nav-bg); color: var(--nav-text); }
.topnav-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 36px;
  flex-wrap: wrap;
}
.topnav .brand { font-weight: 600; color: #fff; margin-right: 16px; white-space: nowrap; }
.topnav .brand span { color: var(--nav-muted); font-weight: 400; }
.nav-link {
  background: none; border: 0; color: var(--nav-text);
  font-size: 13px; padding: 8px 10px; min-height: 36px;
  cursor: pointer; border-radius: var(--radius-control);
  transition: background-color 120ms ease;
}
.nav-link:hover { background: #1f2937; }
.nav-link.active { background: #1f2937; color: #fff; }
.nav-spacer { flex: 1; }
.nav-user { color: var(--nav-muted); font-size: 13px; padding: 8px 4px; }

/* ---------- challenge grid ---------- */
.status-line { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px; }
.dot-available { background: var(--green); }
.dot-in-progress { background: var(--orange); }
.dot-exhausted { background: var(--red); }
.dot-locked { background: var(--dark); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; color: var(--text-secondary); font-size: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
@media (max-width: 860px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) {
  .grid { grid-template-columns: 1fr; }
  .field { flex-direction: column; align-items: stretch; gap: 4px; }
  .field label { flex: none; }
  .login-card { padding: 20px; }
}

.card {
  border: 0;
  border-radius: var(--radius-card);
  padding: 16px;
  text-align: left;
  cursor: pointer;
  color: #fff;
  font-size: 14px;
  transition: filter 120ms ease;
}
.card:hover:not(:disabled) { filter: brightness(1.08); }
.card:disabled { cursor: not-allowed; opacity: 0.9; }
.card h3 { margin: 0 0 8px; font-size: 14px; font-weight: 600; }
.card p { margin: 0 0 12px; font-size: 12px; color: rgba(255, 255, 255, 0.85); font-family: var(--mono); font-variant-numeric: tabular-nums; }
.card-available { background: var(--green); }
.card-in-progress { background: var(--orange); }
.card-exhausted { background: var(--red); }
.card-locked { background: var(--dark); }
.card .desc-btn {
  display: inline-block;
  background: var(--blue);
  color: #fff;
  border: 0;
  border-radius: 6px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}
.card .desc-btn:hover { background: #1d4ed8; }

.instructions {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 16px 20px;
  margin-bottom: 16px;
}
.instructions h3 { margin: 0 0 8px; font-size: 14px; font-weight: 600; }
.instructions ul { margin: 0; padding-left: 20px; color: var(--text-secondary); }
.instructions a { word-break: break-all; }
.empty-state {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 20px;
  color: var(--text-secondary);
}

/* ---------- stats / tables ---------- */
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 8px; }
@media (max-width: 860px) { .stat-row { grid-template-columns: repeat(2, 1fr); } }
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 16px 20px;
}
.stat .label { color: var(--text-secondary); font-size: 13px; margin-bottom: 4px; }
.stat .value { font-size: 24px; font-weight: 600; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.stat .sub { color: var(--text-muted); font-size: 12px; margin-top: 4px; }

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  overflow: hidden;
}
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 16px; text-align: left; border-bottom: 1px solid var(--border); }
th { color: var(--text-secondary); font-weight: 500; font-size: 13px; background: var(--surface-muted); }
tr:last-child td { border-bottom: 0; }
td.num, th.num { font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right; }
.member-list { display: grid; gap: 12px; }
.member {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 16px 20px;
  display: flex; justify-content: space-between; gap: 16px; align-items: center; flex-wrap: wrap;
}
.member .name { font-weight: 600; }
.member .role { color: var(--text-secondary); font-size: 13px; }
.view { display: none; }
.view.active { display: block; }
.logout-row { margin-top: 16px; }
.rules-list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 16px 20px; }
.rules-list li { margin-bottom: 8px; color: var(--text-secondary); }

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(17, 24, 39, 0.5);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 64px 16px 16px;
  z-index: 50;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--surface);
  border-radius: var(--radius-panel);
  width: 100%;
  max-width: 520px;
  padding: 24px;
}
.modal h2 { margin: 0 0 4px; font-size: 18px; font-weight: 600; }
.modal .meta { color: var(--text-secondary); font-size: 13px; margin-bottom: 16px; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.modal label { display: block; font-weight: 500; margin: 16px 0 4px; }
.modal input[type="text"] {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  padding: 8px 12px;
  font-size: 14px;
  font-family: var(--mono);
}
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.modal-msg { font-size: 13px; margin-top: 12px; min-height: 20px; }
.modal-msg.ok { color: var(--green-dark); }
.modal-msg.err { color: var(--red); }

.footer {
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px;
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
}
