/* Meter CTF: the dark palette from the mockup (docs/design/canvas/Main.dc.html). */

:root {
  --bg: #131317;
  --surface: #21222c;
  --surface-2: #282a3a;
  --border: #363a5b;
  --text: #dfe1f0;
  --text-2: #c8cae0;
  --muted: #a6aabf;
  --accent: #5461c8;
  --accent-hover: #4a52b5;
  --accent-text: #e8eaff;
  --link: #8da0f0;
  --ok-bg: #173b24;
  --ok-text: #c5f5d0;
  --bad-bg: #3d1717;
  --bad-text: #ffe6e6;
  --bad: #8a1a1a;
  --warn-bg: #3a3317;
  --warn-text: #f5e7b0;
  --radius: 10px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 Inter, system-ui, sans-serif;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 26px; line-height: 1.25; margin: 4px 0 6px; font-weight: 700; }
h2 { font-size: 17px; margin: 28px 0 10px; font-weight: 600; }
h3 { font-size: 15px; margin: 0 0 6px; font-weight: 600; }
p { margin: 0 0 10px; }
code, .mono { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 12px; }

.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
  padding: 12px 24px;
  background: var(--bg); border-bottom: 1px solid #282a3a;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); }
.brand:hover { text-decoration: none; }
.wordmark { font-size: 20px; font-weight: 500; letter-spacing: -0.5px; }
.badge { background: #2b2f6b; color: var(--accent-text); border-radius: 999px; padding: 1px 9px; font-size: 11px; font-weight: 600; }
#nav { display: flex; align-items: center; gap: 18px; flex: 1; flex-wrap: wrap; }
#nav a { color: var(--muted); }
#nav a.active, #nav a:hover { color: var(--text); text-decoration: none; }
#nav .who { margin-left: auto; color: var(--muted); font-size: 13px; }

main { max-width: 1120px; margin: 0 auto; padding: 24px 24px 64px; }
.narrow { max-width: 480px; margin: 40px auto; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.pre { white-space: pre-wrap; }
.nowrap { white-space: nowrap; }
.crumbs { color: var(--muted); font-size: 13px; margin-bottom: 4px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.cols { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.cols-3 { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.two-col { display: grid; gap: 18px; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); align-items: start; }
@media (max-width: 860px) { .two-col { grid-template-columns: 1fr; } }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; margin-bottom: 14px;
}
a.card { display: block; color: var(--text); }
a.card:hover { border-color: #5461c8; text-decoration: none; }
.card.disabled { opacity: 0.6; }
.event-card h3, .scenario-card h3 { margin: 0; }
.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.pill {
  display: inline-block; border-radius: 999px; padding: 1px 9px; font-size: 11px; font-weight: 600;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); vertical-align: middle; white-space: nowrap;
}
.pill-open { background: var(--ok-bg); color: var(--ok-text); border-color: #2c6b40; }
.pill-upcoming { background: #23295e; color: var(--accent-text); border-color: #3c45a0; }
.pill-closed, .pill-archived { color: var(--muted); }
.pill-locked { background: var(--bad-bg); color: var(--bad-text); border-color: var(--bad); }
.pill-admin { background: #23295e; color: var(--accent-text); }
.pill-system { color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 600; font-size: 13px; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 14px; cursor: pointer;
}
.btn:hover { border-color: #5461c8; text-decoration: none; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: transparent; }
.btn-danger { background: transparent; border-color: var(--bad); color: var(--bad-text); }
.btn-danger:hover { background: var(--bad-bg); border-color: var(--bad); }
.btn-sm { padding: 4px 10px; font-size: 12px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.label { font-size: 12px; font-weight: 600; color: var(--text-2); }
.help { font-size: 12px; color: var(--muted); }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
input[type='checkbox'] { width: auto; }
textarea { resize: vertical; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; margin: 0; display: flex; flex-direction: column; gap: 8px; }
legend { padding: 0 6px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.check { display: flex; align-items: center; gap: 8px; }

.alert { border: 1px solid var(--border); background: var(--surface-2); border-radius: 8px; padding: 10px 12px; margin: 10px 0; color: var(--text-2); }
.alert-error { background: var(--bad-bg); border-color: var(--bad); color: var(--bad-text); }
.alert-ok { background: var(--ok-bg); border-color: #2c6b40; color: var(--ok-text); }

.stats { display: flex; gap: 12px; flex-wrap: wrap; align-items: stretch; margin: 16px 0; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 16px; min-width: 120px; display: flex; flex-direction: column; }
.stat .label { color: var(--muted); font-weight: 500; }
.stat .value { font-size: 22px; font-weight: 700; }
.stats .btn { align-self: center; }

.progress { height: 6px; background: var(--bg); border-radius: 999px; overflow: hidden; margin: 10px 0 6px; }
.progress > div { height: 100%; background: var(--accent); }

.rules { margin: 0; padding-left: 18px; color: var(--text-2); }
.rules li { margin: 3px 0; }

.flags { display: flex; flex-direction: column; gap: 8px; }
.flag { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.flag[open] { border-color: #5461c8; }
.flag.done { border-left: 3px solid #2c6b40; }
.flag.locked { border-left: 3px solid var(--bad); }
.flag summary { display: flex; align-items: center; gap: 10px; padding: 12px 14px; cursor: pointer; list-style: none; }
.flag summary::-webkit-details-marker { display: none; }
.flag .num { color: var(--muted); font-variant-numeric: tabular-nums; width: 20px; text-align: right; }
.flag .title { flex: 1; font-weight: 600; }
.flag-body { padding: 0 14px 14px 44px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.flag-body .prompt { white-space: pre-wrap; margin: 0; }
.hint { background: var(--surface-2); border-radius: 8px; padding: 8px 10px; width: 100%; }
.answer { display: flex; gap: 8px; width: 100%; }
.answer input { font-family: 'JetBrains Mono', ui-monospace, monospace; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 14px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid #2c2e40; vertical-align: top; }
th { font-size: 12px; font-weight: 600; color: var(--muted); }
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: 0; }
tr.me td { background: #23295e; }
tr.selected td { background: var(--surface-2); }
tr.group td { background: var(--surface-2); font-weight: 600; font-size: 12px; color: var(--text-2); }
.detail { display: block; max-width: 420px; white-space: pre-wrap; word-break: break-word; color: var(--text-2); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 18px 0 16px; flex-wrap: wrap; }
.tabs a { padding: 8px 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.active { color: var(--text); border-bottom-color: var(--accent); }
.tabs a:hover { color: var(--text); text-decoration: none; }

@media (max-width: 600px) {
  .top { padding: 10px 16px; gap: 12px; }
  main { padding: 16px 16px 48px; }
  .flag-body { padding-left: 14px; }
  #nav .who { display: none; }
}
