/* ============================================================
   BINGUS NETWORK — design system
   vanilla CSS, zero dependencies, dark-first
   ============================================================ */

:root {
  --bg: #0a0e12;
  --bg-2: #0f151c;
  --bg-3: #141d26;
  --panel: #101820;
  --panel-2: #16202b;
  --line: #223140;
  --text: #dbe7f0;
  --muted: #7d93a6;
  --accent: #35e07f;
  --accent-2: #37c8f0;
  --accent-3: #ffd166;
  --danger: #ff5d6c;
  --shadow: 0 10px 30px rgba(0,0,0,.45);
  --radius: 14px;
  --radius-sm: 9px;
  --mono: ui-monospace, "JetBrains Mono", "Cascadia Code", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
}

[data-theme="light"] {
  --bg: #f4f6f8;
  --bg-2: #ffffff;
  --bg-3: #eef1f4;
  --panel: #ffffff;
  --panel-2: #f2f5f8;
  --line: #d5dde5;
  --text: #17222c;
  --muted: #5b6b7a;
  --accent: #0f9d58;
  --accent-2: #0b78a8;
  --accent-3: #b8860b;
  --shadow: 0 10px 24px rgba(20,40,60,.12);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 500px at 80% -10%, rgba(55,200,240,.08), transparent 60%),
    radial-gradient(900px 420px at -10% 10%, rgba(53,224,127,.07), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.55;
  min-height: 100vh;
}

body::before {
  /* subtle grid backdrop */
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 44px 44px;
  opacity: .12;
  pointer-events: none;
  z-index: 0;
}

main, header, footer { position: relative; z-index: 1; }

a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { line-height: 1.15; letter-spacing: -.02em; }
h1 { font-size: clamp(2rem, 5vw, 3.4rem); margin: .4em 0; }
h2 { font-size: clamp(1.4rem, 3vw, 2rem); margin: 1.4em 0 .5em; }
h3 { margin: 1em 0 .4em; }
p  { color: var(--text); }
.muted { color: var(--muted); }

.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 760px; }

/* ---------- header / nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(10px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom: 1px solid var(--line);
}
.nav {
  display: flex; align-items: center; gap: 18px;
  max-width: 1100px; margin: 0 auto; padding: 12px 20px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--mono); font-weight: 700; font-size: 1.05rem;
  color: var(--text); text-decoration: none; letter-spacing: .04em;
}
.brand:hover { text-decoration: none; }
.brand img { width: 26px; height: 26px; }
.nav-links { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.nav-links a {
  color: var(--muted); padding: 7px 11px; border-radius: 8px;
  font-size: .95rem;
}
.nav-links a:hover { color: var(--text); background: var(--bg-3); text-decoration: none; }
.nav-links a.active { color: var(--accent); background: rgba(53,224,127,.09); }

.nav-toggle { display: none; margin-left: auto; }

@media (max-width: 760px) {
  .nav-toggle { display: block; background: none; border: 1px solid var(--line);
    color: var(--text); border-radius: 8px; padding: 6px 12px; font-size: 1.1rem; cursor: pointer; }
  .nav-links { display: none; width: 100%; flex-direction: column; padding-top: 8px; }
  .nav-links.open { display: flex; }
  .nav { flex-wrap: wrap; }
}

/* ---------- buttons ---------- */
.btn {
  display: inline-block; cursor: pointer;
  background: var(--accent); color: #06130b;
  border: none; border-radius: 10px;
  font-weight: 700; font-family: var(--sans);
  padding: 11px 20px; font-size: 1rem;
  transition: transform .06s ease, filter .15s ease;
  text-decoration: none;
}
.btn:hover { filter: brightness(1.1); transform: translateY(-1px); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.secondary {
  background: transparent; color: var(--text);
  border: 1px solid var(--line);
}
.btn.secondary:hover { background: var(--bg-3); }
.btn.small { padding: 7px 13px; font-size: .88rem; }
.btn.danger { background: var(--danger); color: #1c0508; }

/* ---------- cards & grids ---------- */
.card {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; } }

.tile {
  display: flex; flex-direction: column; gap: 6px;
  padding: 18px; border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  color: var(--text); text-decoration: none;
  transition: transform .08s ease, border-color .15s ease;
}
.tile:hover { transform: translateY(-3px); border-color: var(--accent); text-decoration: none; }
.tile .icon { font-size: 1.9rem; line-height: 1; }
.tile b { font-size: 1.05rem; }
.tile span { color: var(--muted); font-size: .9rem; }

/* ---------- hero ---------- */
.hero { text-align: center; padding: 72px 20px 40px; }
.hero h1 {
  background: linear-gradient(92deg, var(--accent), var(--accent-2) 60%, var(--accent-3));
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  margin-bottom: 8px;
}
.hero p.lede { font-size: 1.15rem; color: var(--muted); max-width: 640px; margin: 0 auto 26px; }
.hero .cta-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.kicker {
  font-family: var(--mono); font-size: .78rem; letter-spacing: .22em;
  color: var(--accent); text-transform: uppercase;
}

/* ---------- status widgets ---------- */
.status-card { position: relative; overflow: hidden; }
.status-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.status-title { font-weight: 700; font-size: 1.05rem; }
.badge {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--mono); font-size: .74rem; letter-spacing: .08em;
  padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line);
  text-transform: uppercase;
}
.badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; }
.badge.online  { color: var(--accent); border-color: rgba(53,224,127,.4); }
.badge.online::before { background: var(--accent); animation: pulse 1.6s infinite; }
.badge.offline { color: var(--danger); border-color: rgba(255,93,108,.4); }
.badge.offline::before { background: var(--danger); }
.badge.unknown { color: var(--muted); }
.badge.unknown::before { background: var(--muted); }
@keyframes pulse { 0%{box-shadow:0 0 0 0 rgba(53,224,127,.5)} 70%{box-shadow:0 0 0 8px transparent} 100%{box-shadow:0 0 0 0 transparent} }

.status-kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin-top: 12px; }
.status-kv dt { color: var(--muted); font-size: .86rem; }
.status-kv dd { margin: 0; font-family: var(--mono); font-size: .9rem; word-break: break-all; }

.players-bar { height: 8px; border-radius: 999px; background: var(--bg-3); overflow: hidden; margin-top: 12px; }
.players-bar > div { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .4s ease; }

/* ---------- tables & code ---------- */
table.data { width: 100%; border-collapse: collapse; font-size: .95rem; }
table.data th, table.data td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); }
table.data th { color: var(--muted); font-weight: 600; font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; }
code, pre { font-family: var(--mono); font-size: .9em; }
code { background: var(--bg-3); padding: 2px 6px; border-radius: 6px; }
pre { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px; overflow-x: auto; }

.copyable { display: inline-flex; align-items: center; gap: 8px; }
.copyable button {
  all: unset; cursor: pointer; opacity: .6; font-size: .85rem;
}
.copyable button:hover { opacity: 1; }

/* ---------- forms ---------- */
input[type="text"], input[type="number"], input[type="password"], select, textarea {
  width: 100%;
  background: var(--bg-2); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 10px 12px; font-size: .95rem; font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-2); outline-offset: 1px; }
label { font-size: .88rem; color: var(--muted); display: block; margin: 10px 0 4px; }
.field-row { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.field-row > div { flex: 1; min-width: 130px; }
input[type="range"] { accent-color: var(--accent); width: 100%; }
input[type="color"] { width: 64px; height: 42px; border: 1px solid var(--line); border-radius: 8px; background: none; padding: 2px; cursor: pointer; }
output.mono { font-family: var(--mono); font-size: .85rem; color: var(--muted); }

/* ---------- arcade ---------- */
.game-shell { text-align: center; }
canvas.game {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  max-width: 100%;
  touch-action: none;
}
.hud {
  display: flex; gap: 18px; justify-content: center; flex-wrap: wrap;
  font-family: var(--mono); font-size: .92rem; margin: 12px 0;
}
.hud b { color: var(--accent); }
.overlay-msg {
  font-family: var(--mono); color: var(--muted); min-height: 1.4em; margin: 8px 0;
}
.keys-hint { color: var(--muted); font-size: .84rem; }
.best-tag { font-family: var(--mono); font-size: .82rem; color: var(--accent-3); }

/* minesweeper */
.ms-board { display: grid; gap: 3px; justify-content: center; user-select: none; }
.ms-cell {
  width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
  background: var(--bg-3); border: 1px solid var(--line); border-radius: 6px;
  font-family: var(--mono); font-weight: 700; cursor: pointer; font-size: 1rem;
}
.ms-cell:hover { border-color: var(--accent-2); }
.ms-cell.revealed { background: var(--bg-2); cursor: default; }
.ms-cell.boom { background: var(--danger); color: #fff; }
.ms-cell.flagged { color: var(--accent-3); }
.n1{color:#58a6ff}.n2{color:#3fb950}.n3{color:#ff7b72}.n4{color:#bc8cff}
.n5{color:#ffa657}.n6{color:#39c5cf}.n7{color:#dbe7f0}.n8{color:#7d93a6}

/* 2048 */
.g2048 { display: grid; grid-template-columns: repeat(4, 90px); gap: 10px; justify-content: center; user-select: none; }
.cell2048 {
  height: 90px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-weight: 800; font-size: 1.5rem;
  background: var(--bg-3); border: 1px solid var(--line); transition: transform .08s ease;
}
.cell2048.pop { animation: pop .12s ease; }
@keyframes pop { 50% { transform: scale(1.12); } }

/* tictactoe */
.ttt { display: grid; grid-template-columns: repeat(3, 96px); gap: 8px; justify-content: center; user-select: none; }
.ttt-cell {
  height: 96px; font-size: 2.6rem; font-family: var(--mono); font-weight: 700;
  display:flex;align-items:center;justify-content:center;
  background: var(--bg-3); border: 1px solid var(--line); border-radius: 12px; cursor: pointer; color: var(--text);
}
.ttt-cell:hover:enabled { border-color: var(--accent-2); }
.ttt-cell.x { color: var(--accent-2); }
.ttt-cell.o { color: var(--accent); }

/* memory */
.mem-grid { display: grid; grid-template-columns: repeat(4, 84px); gap: 10px; justify-content: center; }
.mem-card {
  height: 84px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--bg-3); font-size: 2rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform .15s ease, background .15s ease;
}
.mem-card.flip { background: var(--bg-2); transform: rotateY(180deg) scale(1.03); }
.mem-card.done { opacity: .45; cursor: default; }

/* reaction / aim */
.rt-stage {
  height: 300px; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--bg-2); position: relative; cursor: pointer; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); color: var(--muted); font-size: 1.1rem; text-align: center; padding: 20px;
}
.rt-stage.waiting { background: #3a2026; }
.rt-stage.go { background: rgba(53,224,127,.25); }
.rt-dot {
  position: absolute; width: 54px; height: 54px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, var(--accent-3), #b8860b);
  cursor: crosshair; box-shadow: 0 4px 14px rgba(0,0,0,.4);
}

/* flappy */
.flappy-wrap { position: relative; display: inline-block; }
.flappy-score-float {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  font-family: var(--mono); font-size: 2rem; font-weight: 800; color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,.6); pointer-events: none;
}

/* ---------- tools outputs ---------- */
.output-block {
  font-family: var(--mono); white-space: pre-wrap; word-break: break-all;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 14px; min-height: 3em; font-size: .92rem;
}
.swatches { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.swatch {
  width: 74px; height: 74px; border-radius: 10px; border: 1px solid var(--line);
  display: flex; align-items: end; justify-content: center; font-size: .68rem; font-family: var(--mono);
  color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.8); cursor: pointer; padding-bottom: 4px;
}

/* dice */
.dice-tray { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin: 14px 0; }
.die {
  width: 64px; height: 64px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--bg-2); display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 1.6rem; font-weight: 800;
}
.die.roll { animation: tumble .5s ease; }
@keyframes tumble {
  20% { transform: rotate(14deg) translateY(-6px); }
  45% { transform: rotate(-10deg); }
  70% { transform: rotate(6deg) translateY(2px); }
}

/* ---------- gallery ---------- */
.gallery-grid { columns: 3 260px; column-gap: 14px; }
.gallery-grid figure { margin: 0 0 14px; break-inside: avoid; }
.gallery-grid img {
  width: 100%; border-radius: var(--radius); border: 1px solid var(--line);
  display: block; transition: transform .1s ease;
}
.gallery-grid img:hover { transform: scale(1.015); }
.gallery-grid figcaption { color: var(--muted); font-size: .82rem; padding: 6px 2px; }

/* ---------- news ---------- */
article.post { margin-bottom: 34px; }
article.post time { font-family: var(--mono); font-size: .8rem; color: var(--muted); }
.tagchip {
  display: inline-block; font-family: var(--mono); font-size: .72rem;
  border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px;
  color: var(--accent-2); margin-right: 6px;
}

/* ---------- footer ---------- */
.site-footer {
  border-top: 1px solid var(--line); margin-top: 70px; padding: 30px 20px 44px;
  color: var(--muted); font-size: .88rem; text-align: center;
}
.site-footer .foot-links { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; margin-bottom: 8px; }

/* ---------- misc ---------- */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .5s ease, transform .5s ease; }
.reveal.in { opacity: 1; transform: none; }

#toTop {
  position: fixed; right: 18px; bottom: 18px; z-index: 60;
  opacity: 0; pointer-events: none; transition: opacity .25s ease;
  background: var(--panel); border: 1px solid var(--line); color: var(--text);
  border-radius: 999px; width: 42px; height: 42px; cursor: pointer; font-size: 1.05rem;
}
#toTop.show { opacity: 1; pointer-events: auto; }

/* konami easter egg */
body.bingus-mode { animation: hue 6s linear infinite; }
body.bingus-mode .hero h1 { animation: wiggle .6s ease-in-out infinite alternate; }
@keyframes hue { to { filter: hue-rotate(360deg); } }
@keyframes wiggle { from { transform: rotate(-1.2deg) scale(1);} to { transform: rotate(1.2deg) scale(1.02);} }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  background: var(--panel); color: var(--text); border: 1px solid var(--accent);
  padding: 10px 18px; border-radius: 999px; font-family: var(--mono); font-size: .85rem;
  opacity: 0; transition: all .25s ease; z-index: 100; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.section-split { border: none; border-top: 1px dashed var(--line); margin: 46px 0; }

.center { text-align: center; }
.mt0 { margin-top: 0; } .mb0 { margin-bottom: 0; }
