/* ==========================================================================
   Nebsur Design System
   Utility-first Silicon Valley + restrained retro Web3
   Accent: electric lime (flat). No neon glows, no soft glass blurs.
   ========================================================================== */

:root {
  --bg-deep: #0c1016;
  --bg-base: #121820;
  --bg-panel: #181f29;
  --bg-elevated: #1e2733;
  --bg-hover: #253040;
  --line: #2a3544;
  --line-strong: #3d4d62;
  --text: #e8edf2;
  --text-muted: #8b97a8;
  --text-dim: #5c6b7d;
  --lime: #c5e85a;
  --lime-ink: #0c1016;
  --lime-soft: rgba(197, 232, 90, 0.12);
  --lime-border: rgba(197, 232, 90, 0.35);
  --amber: #d4a574;
  --amber-soft: rgba(212, 165, 116, 0.14);
  --danger: #c45c5c;
  --danger-soft: rgba(196, 92, 92, 0.14);
  --ok: #6dbf8a;
  --ok-soft: rgba(109, 191, 138, 0.14);
  --font-sans: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "Cascadia Code", monospace;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4.5rem;
  --radius: 2px;
  --nav-h: 3.75rem;
  --max: 1120px;
  --ease: 160ms ease;
  --shadow-panel: 0 1px 0 rgba(255, 255, 255, 0.03) inset;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg-deep);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
  color: inherit;
  border: none;
  background: none;
}

button {
  cursor: pointer;
}

ul,
ol {
  list-style: none;
}

/* --------------------------------------------------------------------------
   Layout primitives
   -------------------------------------------------------------------------- */

.container {
  width: min(100% - 2rem, var(--max));
  margin-inline: auto;
}

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: -100px;
  z-index: 1000;
  padding: var(--space-2) var(--space-4);
  background: var(--lime);
  color: var(--lime-ink);
  font-weight: 600;
  font-size: 0.875rem;
  border-radius: var(--radius);
}

.skip-link:focus {
  top: var(--space-3);
}

/* --------------------------------------------------------------------------
   Typography
   -------------------------------------------------------------------------- */

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--lime);
}

.eyebrow::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  background: var(--lime);
  border-radius: 1px;
  flex-shrink: 0;
}

h1,
h2,
h3 {
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--text);
}

h1 {
  font-size: clamp(2.25rem, 5vw, 3.5rem);
}

h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
}

h3 {
  font-size: 1.125rem;
}

.lead {
  font-size: clamp(1.05rem, 2vw, 1.2rem);
  color: var(--text-muted);
  max-width: 36rem;
  line-height: 1.65;
}

.mono {
  font-family: var(--font-mono);
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 2.75rem;
  padding: 0.7rem 1.25rem;
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  border-radius: var(--radius);
  border: 1px solid transparent;
  transition: background var(--ease), border-color var(--ease), color var(--ease),
    transform var(--ease);
  white-space: nowrap;
  user-select: none;
}

.btn:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 2px;
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--lime);
  color: var(--lime-ink);
  border-color: var(--lime);
}

.btn-primary:hover:not(:disabled) {
  background: #d4f070;
  border-color: #d4f070;
}

.btn-secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--line-strong);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--text-dim);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
  min-height: 2.25rem;
  padding: 0.4rem 0.75rem;
}

.btn-ghost:hover:not(:disabled) {
  color: var(--text);
  background: var(--bg-hover);
}

.btn-block {
  width: 100%;
}

.btn-sm {
  min-height: 2.25rem;
  padding: 0.4rem 0.85rem;
  font-size: 0.8125rem;
}

/* --------------------------------------------------------------------------
   Navbar
   -------------------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  background: rgba(12, 16, 22, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: saturate(140%) blur(8px);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--nav-h);
  gap: var(--space-4);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: -0.03em;
  z-index: 110;
}

.brand-mark {
  width: 1.75rem;
  height: 1.75rem;
  display: block;
  object-fit: cover;
  border-radius: 2px;
  flex-shrink: 0;
  background: var(--lime);
}

.brand-text {
  color: var(--text);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.nav-links a {
  padding: 0.5rem 0.85rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  border-radius: var(--radius);
  transition: color var(--ease), background var(--ease);
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
  color: var(--text);
  background: var(--bg-hover);
}

.nav-toggle {
  display: none;
  width: 2.5rem;
  height: 2.5rem;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-panel);
  z-index: 110;
}

.nav-toggle-bars {
  display: block;
  width: 1rem;
  height: 1.5px;
  background: var(--text);
  position: relative;
  transition: background var(--ease);
}

.nav-toggle-bars::before,
.nav-toggle-bars::after {
  content: "";
  position: absolute;
  left: 0;
  width: 1rem;
  height: 1.5px;
  background: var(--text);
  transition: transform var(--ease), top var(--ease);
}

.nav-toggle-bars::before {
  top: -5px;
}

.nav-toggle-bars::after {
  top: 5px;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bars {
  background: transparent;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bars::before {
  top: 0;
  transform: rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bars::after {
  top: 0;
  transform: rotate(-45deg);
}

@media (max-width: 768px) {
  .nav-toggle {
    display: grid;
  }

  .nav-links {
    position: fixed;
    inset: 0;
    top: var(--nav-h);
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: var(--space-4);
    background: var(--bg-deep);
    border-top: 1px solid var(--line);
    transform: translateY(-0.5rem);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity var(--ease), visibility var(--ease), transform var(--ease);
  }

  .nav-links.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
  }

  .nav-links a {
    padding: 1rem;
    font-size: 1rem;
    border-bottom: 1px solid var(--line);
  }
}

/* --------------------------------------------------------------------------
   Landing: Hero
   -------------------------------------------------------------------------- */

.hero {
  padding: clamp(3rem, 8vw, 5.5rem) 0 clamp(3.5rem, 8vw, 5rem);
  border-bottom: 1px solid var(--line);
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 48px 48px;
  opacity: 0.35;
  mask-image: radial-gradient(ellipse 70% 60% at 70% 40%, black 20%, transparent 70%);
  pointer-events: none;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: var(--space-7);
  align-items: center;
  position: relative;
}

.hero-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-5);
}

.hero h1 {
  max-width: 14ch;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  padding-top: var(--space-2);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-dim);
  letter-spacing: 0.02em;
}

.hero-meta span {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.hero-meta span::before {
  content: "";
  width: 4px;
  height: 4px;
  background: var(--line-strong);
  border-radius: 1px;
}

/* Hero console preview */
.hero-console {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-panel);
  overflow: hidden;
}

.console-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--line);
  background: var(--bg-elevated);
}

.console-bar-title {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.console-status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--ok);
}

.console-status-dot {
  width: 6px;
  height: 6px;
  background: var(--ok);
  border-radius: 1px;
}

.console-body {
  padding: var(--space-4);
  display: grid;
  gap: var(--space-3);
}

.console-body-live {
  padding: 0;
  gap: 0;
}

.console-body-live .console-stats {
  padding: var(--space-3) var(--space-4) var(--space-4);
  gap: var(--space-2);
}

.hero-viewport {
  width: 100%;
  background: #0a0e14;
  border-bottom: 1px solid var(--line);
  line-height: 0;
  overflow: hidden;
}

#hero-canvas {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.console-grid-preview {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
  aspect-ratio: 6 / 4;
}

/* Whitelist form */
.wl-form {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.wl-form .btn {
  margin-top: 0.15rem;
}

.wl-msg:empty {
  display: none;
}

.wl-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.wl-input {
  width: 100%;
  min-height: 2.4rem;
  padding: 0.5rem 0.7rem;
  background: var(--bg-base);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.wl-input:focus {
  outline: none;
  border-color: var(--lime-border);
}

.wl-input:disabled {
  opacity: 0.7;
}

.wl-input::placeholder {
  color: var(--text-dim);
}

.wl-msg {
  font-size: 0.75rem;
  color: var(--text-dim);
  min-height: 1.1em;
  line-height: 1.4;
}

.wl-msg.is-ok {
  color: var(--ok);
}

.wl-msg.is-error {
  color: var(--danger);
}

.cell {
  border: 1px solid var(--line);
  background: var(--bg-base);
  border-radius: 1px;
  min-height: 0;
}

.cell.floor {
  background: #1a2430;
}

.cell.desk {
  background: #2a3340;
}

.cell.node {
  background: var(--lime-soft);
  border-color: var(--lime-border);
}

.cell.node-fail {
  background: var(--danger-soft);
  border-color: rgba(196, 92, 92, 0.4);
}

.cell.wall {
  background: #243040;
}

.console-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-2);
}

.stat-chip {
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--line);
  background: var(--bg-base);
  border-radius: var(--radius);
}

.stat-chip dt {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 0.2rem;
}

.stat-chip dd {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
}

@media (max-width: 900px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }

  .hero h1 {
    max-width: none;
  }
}

/* --------------------------------------------------------------------------
   Sections
   -------------------------------------------------------------------------- */

.section {
  padding: clamp(3.5rem, 8vw, 5.5rem) 0;
  border-bottom: 1px solid var(--line);
}

.section-head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
  max-width: 40rem;
}

.section-head p {
  color: var(--text-muted);
}

/* Features */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
}

.feature-card {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  transition: border-color var(--ease), background var(--ease);
}

.feature-card:hover {
  border-color: var(--line-strong);
  background: var(--bg-elevated);
}

.feature-index {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--lime);
  letter-spacing: 0.04em;
}

.feature-card h3 {
  font-size: 1.05rem;
}

.feature-card p {
  color: var(--text-muted);
  font-size: 0.9375rem;
  line-height: 1.6;
}

@media (max-width: 900px) {
  .feature-grid {
    grid-template-columns: 1fr;
  }
}

/* How it works / mechanics strip */
.mechanics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-5);
  align-items: start;
}

.mechanics-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-panel);
}

.mechanics-item {
  display: grid;
  grid-template-columns: 3.5rem 1fr;
  gap: var(--space-4);
  padding: var(--space-5);
  border-bottom: 1px solid var(--line);
}

.mechanics-item:last-child {
  border-bottom: none;
}

.mechanics-step {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--lime);
  padding-top: 0.15rem;
}

.mechanics-item h3 {
  margin-bottom: var(--space-2);
}

.mechanics-item p {
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.mechanics-panel {
  border: 1px solid var(--line);
  background: var(--bg-panel);
  border-radius: var(--radius);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.mechanics-panel h3 {
  font-size: 1rem;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.tag {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text-muted);
  background: var(--bg-base);
}

.tag-lime {
  color: var(--lime);
  border-color: var(--lime-border);
  background: var(--lime-soft);
}

@media (max-width: 800px) {
  .mechanics {
    grid-template-columns: 1fr;
  }
}

/* CTA band */
.cta-band {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(2rem, 5vw, 3rem);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
}

.cta-band h2 {
  font-size: clamp(1.35rem, 3vw, 1.75rem);
  margin-bottom: var(--space-2);
}

.cta-band p {
  color: var(--text-muted);
  max-width: 32rem;
}

/* Footer */
.site-footer {
  padding: var(--space-6) 0 var(--space-5);
  border-top: 1px solid var(--line);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.footer-copy {
  font-size: 0.85rem;
  color: var(--text-dim);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  font-size: 0.85rem;
  color: var(--text-muted);
}

.footer-links a:hover {
  color: var(--text);
}

.footer-credit {
  width: 100%;
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--line);
  font-size: 0.75rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.footer-credit a {
  color: var(--text-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.footer-credit a:hover {
  color: var(--lime);
}

/* --------------------------------------------------------------------------
   App shell
   -------------------------------------------------------------------------- */

body.app-body {
  background: var(--bg-deep);
}

.app-shell {
  min-height: calc(100vh - var(--nav-h));
  display: grid;
  grid-template-rows: auto 1fr;
}

.app-toolbar {
  border-bottom: 1px solid var(--line);
  background: var(--bg-base);
}

.app-toolbar-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) 0;
}

.app-title-block {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.app-title-block h1 {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.app-title-block p {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-dim);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.network-strip {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.network-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.65rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.03em;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-panel);
  color: var(--text-muted);
}

.network-pill .dot {
  width: 6px;
  height: 6px;
  border-radius: 1px;
  background: var(--text-dim);
  flex-shrink: 0;
}

.network-pill.is-live .dot {
  background: var(--ok);
}

.network-pill.is-warn .dot {
  background: var(--amber);
}

.network-pill.is-offline .dot {
  background: var(--danger);
}

.app-main {
  padding: var(--space-4) 0 var(--space-6);
}

.app-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: var(--space-4);
  align-items: stretch;
}

@media (max-width: 960px) {
  .app-layout {
    grid-template-columns: 1fr;
  }
}

/* Game panel */
.game-panel {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.game-hud {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  border-bottom: 1px solid var(--line);
  background: var(--bg-elevated);
}

.hud-item {
  padding: var(--space-3) var(--space-4);
  border-right: 1px solid var(--line);
}

.hud-item:last-child {
  border-right: none;
}

.hud-item dt {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 0.2rem;
}

.hud-item dd {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.hud-item dd.is-warn {
  color: var(--amber);
}

.hud-item dd.is-danger {
  color: var(--danger);
}

.hud-item dd.is-ok {
  color: var(--lime);
}

@media (max-width: 560px) {
  .game-hud {
    grid-template-columns: repeat(2, 1fr);
  }

  .hud-item:nth-child(2) {
    border-right: none;
  }

  .hud-item:nth-child(1),
  .hud-item:nth-child(2) {
    border-bottom: 1px solid var(--line);
  }
}

.game-viewport-wrap {
  position: relative;
  background: #0a0e14;
  aspect-ratio: 16 / 10;
  min-height: 260px;
  max-height: min(52vh, 520px);
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: default;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  touch-action: manipulation;
  pointer-events: none;
}

.game-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-5);
  background: rgba(12, 16, 22, 0.88);
  transition: opacity var(--ease), visibility var(--ease);
}

.game-overlay[hidden] {
  display: none;
}

.overlay-card {
  width: min(100%, 22rem);
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  text-align: center;
}

.overlay-card h2 {
  font-size: 1.25rem;
}

.overlay-card p {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.overlay-score {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 600;
  color: var(--lime);
  letter-spacing: -0.02em;
}

.overlay-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.score-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  text-align: left;
}

.score-form label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.score-form input {
  width: 100%;
  min-height: 2.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg-base);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

.score-form input:focus {
  outline: none;
  border-color: var(--lime-border);
}

.score-form input::placeholder {
  color: var(--text-dim);
}

.form-hint {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.form-msg {
  font-size: 0.8rem;
  color: var(--ok);
  min-height: 1.2em;
}

.form-msg.is-error {
  color: var(--danger);
}

.game-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--line);
  background: var(--bg-elevated);
}

.control-hint {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-dim);
  letter-spacing: 0.02em;
}

/* Side column: one shell, total height matches left panel */
.side-stack {
  display: flex;
  flex-direction: column;
  gap: 0;
  height: 100%;
  min-height: 0;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.side-card {
  background: transparent;
  border: none;
  border-radius: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.side-card + .side-card {
  border-top: 1px solid var(--line);
}

.side-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--line);
  background: var(--bg-elevated);
  flex-shrink: 0;
}

.side-card-head h2 {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.side-card-body {
  padding: 0.85rem 0.9rem;
}

/* Check access + bay status: natural height */
.side-card--access,
.side-card--status {
  flex: 0 0 auto;
}

.side-card--access .side-card-body {
  padding: 0.9rem;
}

/* Leaderboard: takes remaining height so sidebar matches left */
.side-card--board {
  flex: 1 1 auto;
  min-height: 0;
}

.side-card--board .side-card-body {
  padding: 0.45rem;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
}

.side-card--status .side-card-body {
  padding: 0.75rem 0.9rem 0.9rem;
}

.leaderboard {
  flex: 1;
  justify-content: space-evenly;
}

@media (max-width: 960px) {
  .side-stack {
    width: 100%;
    height: auto;
  }

  .side-card--board {
    flex: none;
  }

  .side-card--board .side-card-body {
    max-height: 220px;
  }

  .leaderboard {
    justify-content: flex-start;
  }
}

.leaderboard {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0;
}

.lb-row {
  display: grid;
  grid-template-columns: 1.75rem 1fr auto;
  gap: var(--space-2);
  align-items: center;
  padding: 0.55rem 0.65rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
}

.lb-row:nth-child(odd) {
  background: var(--bg-base);
}

.lb-rank {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-dim);
}

.lb-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.lb-score {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--lime);
  font-variant-numeric: tabular-nums;
}

.lb-row.is-you .lb-name {
  color: var(--lime);
}

.lb-empty {
  padding: var(--space-4);
  text-align: center;
  color: var(--text-dim);
  font-size: 0.85rem;
}

.status-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-base);
  font-size: 0.8rem;
}

.status-row .label {
  color: var(--text-muted);
}

.status-row .value {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text);
}

.status-row .value.ok {
  color: var(--ok);
}

.status-row .value.warn {
  color: var(--amber);
}

/* --------------------------------------------------------------------------
   404 page
   -------------------------------------------------------------------------- */

.page-404 {
  min-height: calc(100vh - var(--nav-h));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-7) var(--space-4);
  text-align: center;
}

.page-404-inner {
  max-width: 28rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
}

.page-404 .code {
  font-family: var(--font-mono);
  font-size: clamp(4rem, 12vw, 6rem);
  font-weight: 600;
  letter-spacing: -0.04em;
  color: var(--lime);
  line-height: 1;
}

.page-404 h1 {
  font-size: 1.5rem;
}

.page-404 p {
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   Utility
   -------------------------------------------------------------------------- */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
