:root {
  --bg: #080b14;
  --bg-2: #0d1220;
  --surface: #121a2c;
  --surface-2: #18223a;
  --border: #233050;
  --text: #e8eef8;
  --muted: #8b97b0;
  --accent: #7cf3e0;
  --accent-ink: #052b26;
  --amber: #ffb454;
  --danger: #ff7a7a;
  --ok: #6ee7a8;
  --radius: 14px;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: radial-gradient(1200px 600px at 70% -10%, #13203d 0%, transparent 60%), var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}
main { flex: 1; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.15; margin: 0 0 .5em; letter-spacing: -.01em; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }

.wrap { width: min(1120px, 100% - 40px); margin-inline: auto; }
.section { padding: 72px 0 24px; }
.section__head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.section__head h2 { font-size: 1.6rem; margin: 0; }
.eyebrow {
  font: 600 .78rem/1 var(--mono);
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--amber);
  margin-bottom: 18px;
}

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: rgba(8, 11, 20, .78);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(35, 48, 80, .6);
}
.topbar__inner { display: flex; align-items: center; gap: 28px; height: 64px; }
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--text); font-weight: 700; letter-spacing: .02em;
}
.brand:hover { text-decoration: none; }
.brand__mark {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent), 0 0 26px rgba(124, 243, 224, .45);
}
.nav { display: flex; gap: 22px; margin-right: auto; }
.nav a { color: var(--muted); font-size: .95rem; }
.nav a:hover, .nav a.is-active { color: var(--text); text-decoration: none; }
.nav a.is-active { box-shadow: inset 0 -2px 0 var(--accent); padding-bottom: 4px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 46px; padding: 0 22px;
  border-radius: 999px; border: 1px solid transparent;
  font: 600 .95rem/1 var(--sans); cursor: pointer;
  transition: transform .12s ease, background .15s ease, border-color .15s ease, opacity .15s;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 0 24px rgba(124, 243, 224, .25); }
.btn--primary:hover { background: #9ff7ea; }
.btn--ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn--ghost:hover { border-color: var(--accent); }
.btn--sm { height: 36px; padding: 0 16px; font-size: .88rem; }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .6; cursor: progress; }
.btn .spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.link {
  background: none; border: 0; padding: 0;
  color: var(--accent); font: inherit; cursor: pointer;
}
.link:hover { text-decoration: underline; }

/* ---------- hero ---------- */
.hero { position: relative; overflow: hidden; border-bottom: 1px solid rgba(35, 48, 80, .5); }
.hero__bg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hero__content { position: relative; padding: 120px 0 96px; }
.hero__title { font-size: clamp(2.3rem, 5.2vw, 4.1rem); font-weight: 800; max-width: 14ch; }
.hero__title em { font-style: normal; color: var(--accent); text-shadow: 0 0 28px rgba(124, 243, 224, .45); }
.hero__lead { max-width: 56ch; color: #b9c4d9; font-size: 1.1rem; margin-bottom: 32px; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; }

.stats { display: flex; flex-wrap: wrap; gap: 36px; margin: 56px 0 0; }
.stats div { min-width: 120px; }
.stats dt { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; }
.stats dd { margin: 4px 0 0; font: 600 1.5rem/1.2 var(--mono); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); margin-right: 8px; vertical-align: middle; box-shadow: 0 0 8px var(--ok); }

/* ---------- cards ---------- */
.grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.card {
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg-2) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
}
.card h3 { font-size: 1.12rem; }
.card p { color: var(--muted); margin: 0; }
.card__icon {
  width: 40px; height: 40px; border-radius: 10px; margin-bottom: 18px;
  display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--border);
  font: 700 1rem/1 var(--mono); color: var(--accent);
}

.log { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }
.log li { display: grid; grid-template-columns: 120px 1fr; gap: 24px; padding: 22px 0; border-bottom: 1px solid var(--border); }
.log time { font: .85rem/1.6 var(--mono); color: var(--muted); }
.log h3 { font-size: 1.05rem; margin-bottom: .3em; }
.log p { color: var(--muted); margin: 0; }
.tag {
  display: inline-block; margin-left: 8px; padding: 2px 8px; border-radius: 999px;
  font: 600 .7rem/1.5 var(--mono); text-transform: uppercase; letter-spacing: .08em;
  background: rgba(255, 180, 84, .12); color: var(--amber); vertical-align: middle;
}

/* ---------- auth ---------- */
.auth { display: grid; place-items: center; padding: 64px 20px; }
.auth__card {
  width: min(420px, 100%);
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px;
  padding: 36px 32px 28px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .45), 0 0 0 1px rgba(124, 243, 224, .04);
}
.auth__card h1 { font-size: 1.7rem; }
.auth__foot { margin: 22px 0 0; text-align: center; color: var(--muted); font-size: .92rem; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 6px; }
.field input {
  width: 100%; height: 46px; padding: 0 14px;
  background: var(--bg-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  font: inherit; outline: none; transition: border-color .15s, box-shadow .15s;
}
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124, 243, 224, .15); }
.field.has-error input { border-color: var(--danger); }
.field__err { display: block; min-height: 0; color: var(--danger); font-size: .8rem; margin-top: 6px; }
.field__err:empty { display: none; }
.row { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 22px; font-size: .9rem; }
.check { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); cursor: pointer; }
.check input { accent-color: var(--accent); }
.back { display: inline-block; margin-bottom: 14px; font-size: .9rem; }

.alert {
  border-radius: 10px; padding: 12px 14px; margin-bottom: 18px; font-size: .9rem;
  border: 1px solid; line-height: 1.45;
}
.alert--error { background: rgba(255, 122, 122, .08); border-color: rgba(255, 122, 122, .35); color: #ffc2c2; }
.alert--warn { background: rgba(255, 180, 84, .08); border-color: rgba(255, 180, 84, .35); color: #ffd9a6; }
.alert--ok { background: rgba(110, 231, 168, .08); border-color: rgba(110, 231, 168, .35); color: #c4f5da; }

/* ---------- table ---------- */
.board { width: 100%; border-collapse: collapse; font-size: .95rem; }
.board th, .board td { padding: 14px 16px; text-align: left; border-bottom: 1px solid var(--border); }
.board th { color: var(--muted); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; }
.board td.num, .board th.num { text-align: right; font-family: var(--mono); }
.board tbody tr:hover { background: rgba(124, 243, 224, .03); }
.rank { font-family: var(--mono); color: var(--muted); width: 56px; }
.board tr:nth-child(1) .rank { color: var(--amber); }
.board tr:nth-child(2) .rank, .board tr:nth-child(3) .rank { color: var(--text); }
.board-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow-x: auto; }
.skeleton td { color: var(--muted); }
.me-box { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }

/* ---------- demo ---------- */
.game { position: relative; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: #05070d; }
.game canvas { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; touch-action: none; cursor: none; }
.game__bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; }
.game__msg { font-size: .9rem; color: var(--muted); }
.kbd {
  display: inline-block; padding: 1px 7px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--surface-2);
  font: .8rem/1.6 var(--mono); color: var(--text);
}

/* ---------- error pages ---------- */
.err { display: grid; place-items: center; text-align: center; padding: 96px 20px; }
.err__code {
  font: 800 clamp(5rem, 18vw, 9rem)/1 var(--mono);
  color: transparent; -webkit-text-stroke: 2px var(--accent);
  text-shadow: 0 0 40px rgba(124, 243, 224, .25);
  margin-bottom: 12px;
}
.err h1 { font-size: 1.6rem; }
.err p { color: var(--muted); max-width: 46ch; margin-inline: auto; }
.err .hero__actions { justify-content: center; margin-top: 28px; }

/* ---------- footer ---------- */
.footer { border-top: 1px solid var(--border); margin-top: 72px; }
.footer__inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; padding: 24px 0; color: var(--muted); font-size: .85rem; }
.footer__status { font-family: var(--mono); }

[hidden] { display: none !important; }

@media (max-width: 720px) {
  .nav { gap: 14px; }
  .nav a:nth-child(n+3) { display: none; }
  .hero__content { padding: 80px 0 64px; }
  .log li { grid-template-columns: 1fr; gap: 6px; }
  .topbar__inner { gap: 16px; }
}
