/* Project Brainless — facility terminal theme */
:root {
  --bg: #0b0d10;
  --bg-2: #12161b;
  --panel: #161b22;
  --panel-2: #1c232c;
  --line: #2a323d;
  --text: #e6e9ee;
  --muted: #9aa4b2;
  --accent: #f2c230;      /* hazard yellow */
  --accent-ink: #1a1400;
  --danger: #e5484d;
  --ok: #3dd68c;
  --gold: #f2c230;
  --silver: #c4ccd8;
  --bronze: #d08b52;
  --radius: 10px;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --max: 1120px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}
body::before { /* faint scanlines */
  content: '';
  position: fixed; inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(255,255,255,.012) 0 1px, transparent 1px 3px);
  z-index: 0;
}
main, header, footer { position: relative; z-index: 1; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
h1, h2, h3 { font-family: var(--mono); letter-spacing: .02em; line-height: 1.2; margin: 0 0 .6em; }
h1 { font-size: clamp(2rem, 5vw, 3.4rem); }
h2 { font-size: clamp(1.4rem, 3vw, 2rem); }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }
.eyebrow {
  font-family: var(--mono); font-size: .8rem; text-transform: uppercase; letter-spacing: .18em;
  color: var(--accent); margin-bottom: .8em; display: inline-block;
}

/* ── Header / nav ── */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: rgba(11, 13, 16, .88);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.nav { display: flex; align-items: center; gap: 16px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-family: var(--mono); font-weight: 700; letter-spacing: .04em; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 6px; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: .95rem;
}
.nav-links { display: flex; gap: 4px; margin-left: auto; align-items: center; }
.nav-links a {
  color: var(--muted); padding: 8px 12px; border-radius: 8px; font-size: .95rem;
}
.nav-links a:hover { color: var(--text); background: var(--panel); text-decoration: none; }
.nav-links a[aria-current="page"] { color: var(--text); background: var(--panel-2); }
.nav-links a.btn-primary, .nav-links a.btn-primary:hover { color: var(--accent-ink); background: var(--accent); margin-left: 6px; }
.nav-links a.btn-primary:hover { background: #ffd34d; }
.nav-toggle {
  display: none; margin-left: auto; background: none; border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: 6px 10px; font: inherit; cursor: pointer;
}

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  padding: 12px 20px; border-radius: 8px; font-weight: 600; border: 1px solid transparent;
  cursor: pointer; font: 600 1rem var(--sans); transition: transform .08s ease, background .15s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: #ffd34d; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn-ghost:hover { background: var(--panel); }
.btn-sm { padding: 8px 14px; font-size: .9rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; }

/* ── Hero ── */
.hero {
  padding: 88px 0 72px;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(900px 400px at 85% -10%, rgba(242,194,48,.10), transparent 60%),
    radial-gradient(700px 400px at 0% 110%, rgba(229,72,77,.08), transparent 60%);
}
.hero p.lead { font-size: 1.15rem; color: var(--muted); max-width: 640px; }
.hazard {
  height: 8px; border-radius: 4px; margin: 28px 0 0; max-width: 280px;
  background: repeating-linear-gradient(-45deg, var(--accent) 0 12px, #111 12px 24px);
}
.connect {
  margin-top: 28px; display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px;
}
.connect code { font-family: var(--mono); color: var(--text); font-size: .95rem; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 10px var(--ok); }

/* ── Sections ── */
section.block { padding: 72px 0; border-bottom: 1px solid var(--line); }
section.block:last-of-type { border-bottom: 0; }
.section-head { max-width: 720px; margin-bottom: 32px; }
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; position: relative; overflow: hidden;
}
.card h3 { margin-bottom: .4em; }
.card p:last-child { margin-bottom: 0; }
.card .icon { font-size: 1.6rem; margin-bottom: 10px; display: block; }
.card.tag::after {
  content: attr(data-tag); position: absolute; top: 14px; right: 14px;
  font: 600 .7rem var(--mono); letter-spacing: .1em; color: var(--muted);
}
.stat { text-align: left; }
.stat b { display: block; font: 700 2.4rem var(--mono); color: var(--accent); line-height: 1.1; }
.stat span { color: var(--muted); font-size: .95rem; }
.list-clean { list-style: none; padding: 0; margin: 0; }
.list-clean li { padding: 6px 0; border-bottom: 1px dashed var(--line); }
.list-clean li:last-child { border-bottom: 0; }
.steps { counter-reset: step; list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.steps li {
  counter-increment: step; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 16px 16px 60px; position: relative;
}
.steps li::before {
  content: counter(step); position: absolute; left: 16px; top: 14px; width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; background: var(--panel-2); border: 1px solid var(--line);
  font: 700 .9rem var(--mono); color: var(--accent);
}
.cta {
  background: linear-gradient(135deg, var(--panel) 0%, var(--panel-2) 100%);
  border: 1px solid var(--line); border-radius: 14px; padding: 36px;
  display: flex; gap: 24px; align-items: center; justify-content: space-between; flex-wrap: wrap;
}
.cta h2 { margin-bottom: .3em; }
.cta p { margin: 0; color: var(--muted); }

/* ── Page header (inner pages) ── */
.page-head { padding: 56px 0 32px; border-bottom: 1px solid var(--line); }
.page-head p { color: var(--muted); max-width: 680px; margin: 0; }

/* ── Rules ── */
.rules { display: grid; gap: 14px; }
.rules details {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.rules summary {
  cursor: pointer; padding: 18px 20px; font: 700 1.05rem var(--mono); list-style: none;
  display: flex; align-items: center; gap: 12px;
}
.rules summary::-webkit-details-marker { display: none; }
.rules summary::after { content: '+'; margin-left: auto; color: var(--muted); font-size: 1.3rem; }
.rules details[open] summary::after { content: '−'; }
.rules summary .count { color: var(--muted); font-weight: 400; font-size: .85rem; }
.rules ol { margin: 0; padding: 0 20px 18px 48px; }
.rules ol li { padding: 6px 0; }
.rules ol li strong { color: var(--text); }
.rules ol li span { color: var(--muted); }
.notice {
  border-left: 3px solid var(--accent); background: var(--panel); padding: 16px 18px; border-radius: 0 var(--radius) var(--radius) 0;
}
.notice.danger { border-left-color: var(--danger); }

/* ── Leaderboard ── */
.lb-controls { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 16px; }
.seg { display: inline-flex; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 3px; }
.seg button {
  background: none; border: 0; color: var(--muted); font: 600 .9rem var(--sans); padding: 8px 14px; border-radius: 6px; cursor: pointer;
}
.seg button[aria-pressed="true"] { background: var(--panel-2); color: var(--text); }
.search {
  flex: 1 1 220px; max-width: 320px; background: var(--panel); border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: 10px 12px; font: inherit;
}
.search:focus, .seg button:focus-visible, .btn:focus-visible, .nav-links a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.lb-meta { margin-left: auto; color: var(--muted); font-size: .85rem; font-family: var(--mono); }
.podium { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 20px; }
.podium .card { text-align: center; padding: 26px 18px; }
.podium .medal { font: 800 1.1rem var(--mono); width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 12px; color: #111; }
.podium .p1 { border-color: rgba(242,194,48,.55); box-shadow: 0 0 0 1px rgba(242,194,48,.15), 0 10px 40px -20px rgba(242,194,48,.6); }
.podium .p1 .medal { background: var(--gold); }
.podium .p2 .medal { background: var(--silver); }
.podium .p3 .medal { background: var(--bronze); }
.podium .name { font: 700 1.1rem var(--mono); word-break: break-word; }
.podium .sub { color: var(--muted); font-size: .9rem; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; background: var(--panel); }
th, td { padding: 12px 16px; text-align: left; white-space: nowrap; }
th { font: 600 .75rem var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); background: var(--bg-2); border-bottom: 1px solid var(--line); }
td { border-bottom: 1px solid var(--line); }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-family: var(--mono); }
td.rank { font-family: var(--mono); color: var(--muted); width: 64px; }
tr.r1 td.rank { color: var(--gold); font-weight: 700; }
tr.r2 td.rank { color: var(--silver); font-weight: 700; }
tr.r3 td.rank { color: var(--bronze); font-weight: 700; }
.lvl { display: inline-block; font: 600 .8rem var(--mono); padding: 2px 8px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); }
.banner { margin-bottom: 16px; }
.empty { padding: 40px; text-align: center; color: var(--muted); }

/* ── Footer ── */
.site-footer { padding: 40px 0; color: var(--muted); font-size: .9rem; border-top: 1px solid var(--line); background: var(--bg-2); }
.foot { display: flex; flex-wrap: wrap; gap: 16px 32px; justify-content: space-between; align-items: center; }
.foot-links { display: flex; gap: 18px; flex-wrap: wrap; }
.foot-links a { color: var(--muted); }
.foot-links a:hover { color: var(--text); }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(20px); opacity: 0;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text); padding: 10px 16px; border-radius: 8px;
  transition: all .2s ease; z-index: 50; font-size: .9rem;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Responsive ── */
@media (max-width: 900px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 680px) {
  .nav-toggle { display: inline-block; }
  .nav-links {
    display: none; position: absolute; top: 64px; left: 0; right: 0; flex-direction: column; align-items: stretch;
    background: var(--bg-2); border-bottom: 1px solid var(--line); padding: 8px 16px 16px;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 12px; }
  .nav-links a.btn-primary { margin: 6px 0 0; }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .podium { grid-template-columns: 1fr; }
  .hero { padding: 56px 0 48px; }
  section.block { padding: 52px 0; }
  .cta { padding: 24px; }
  .lb-meta { margin-left: 0; width: 100%; }
  th, td { padding: 10px 12px; }
  .hide-sm { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn, .toast { transition: none; }
}
