:root {
  --bg: #091018;
  --panel: #111b27;
  --panel-alt: #162435;
  --line: #284260;
  --text: #dbe8f8;
  --muted: #8ea6c2;
  --accent: #65d5ff;
  --accent-2: #80ffb9;
  --danger: #ff7a7a;
  --warning: #ffd66b;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background:
    radial-gradient(circle at top, rgba(28, 62, 99, 0.45), transparent 50%),
    linear-gradient(180deg, #070d14 0%, #091018 100%);
  color: var(--text);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 1rem 1.4rem;
  border-bottom: 1px solid var(--line);
  background: rgba(9, 16, 24, 0.92);
  backdrop-filter: blur(10px);
}

.brand a {
  font-weight: 800;
  letter-spacing: 0.08em;
  color: white;
}
.brand .tag {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 0.15rem;
}

.nav {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
}

.page {
  width: min(1200px, calc(100vw - 2rem));
  margin: 0 auto;
  padding: 1.5rem 0 3rem;
}

.panel {
  background: linear-gradient(180deg, rgba(20, 31, 47, 0.98), rgba(14, 22, 34, 0.98));
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: 16px;
  padding: 1.25rem;
}

.hero {
  display: grid;
  gap: 1.4rem;
  grid-template-columns: 1.4fr 0.9fr;
  align-items: center;
  margin-bottom: 1.5rem;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.3rem);
  line-height: 1.05;
  margin: 0.25rem 0 0.75rem;
}

.hero-copy p { color: var(--muted); font-size: 1.05rem; }
.eyebrow {
  color: var(--accent-2);
  text-transform: uppercase;
  font-size: 0.82rem;
  letter-spacing: 0.12em;
}
.hero-actions, .button-row {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.btn, button, select, input {
  font: inherit;
}

.btn, button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 0.4rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel-alt);
  color: var(--text);
  padding: 0.72rem 1rem;
  cursor: pointer;
  transition: transform 0.08s ease, background 0.15s ease;
}
.btn:hover, button:hover {
  transform: translateY(-1px);
  text-decoration: none;
}
.btn-primary {
  background: linear-gradient(180deg, rgba(101, 213, 255, 0.24), rgba(31, 103, 145, 0.45));
  border-color: rgba(101, 213, 255, 0.35);
}
.btn-secondary {
  background: linear-gradient(180deg, rgba(128, 255, 185, 0.18), rgba(30, 88, 57, 0.4));
  border-color: rgba(128, 255, 185, 0.3);
}

.flash-wrap {
  width: min(1200px, calc(100vw - 2rem));
  margin: 1rem auto 0;
}
.flash {
  border-radius: 12px;
  padding: 0.85rem 1rem;
  margin-bottom: 0.7rem;
  border: 1px solid var(--line);
}
.flash-success { background: rgba(47, 111, 77, 0.35); color: #dffae8; }
.flash-error { background: rgba(135, 50, 50, 0.32); color: #ffe8e8; }

.split-grid, .lobby-grid {
  display: grid;
  gap: 1.2rem;
  grid-template-columns: 1.2fr 1fr;
}

.auth-grid {
  display: grid;
  place-items: center;
  min-height: 60vh;
}
.auth-panel {
  width: min(520px, 100%);
}

label {
  display: block;
  margin-bottom: 0.4rem;
  color: var(--muted);
}
input, select {
  width: 100%;
  background: rgba(8, 14, 22, 0.95);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.78rem 0.9rem;
  margin-bottom: 1rem;
}
.inline-form { display: inline-flex; gap: 0.65rem; align-items: center; }
.inline-form select { margin: 0; min-width: 150px; }

.table {
  width: 100%;
  border-collapse: collapse;
}
.table th, .table td {
  text-align: left;
  border-bottom: 1px solid rgba(40, 66, 96, 0.5);
  padding: 0.7rem 0.5rem;
}
.table th {
  color: var(--muted);
  font-weight: 600;
}

.feature-list, .ordered {
  color: var(--muted);
  line-height: 1.6;
}

.muted { color: var(--muted); }

.stats-grid {
  display: grid;
  gap: 0.8rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.stats-grid > div {
  padding: 0.85rem;
  border: 1px solid rgba(40, 66, 96, 0.5);
  border-radius: 12px;
  background: rgba(8, 13, 20, 0.55);
}
.stat-label {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  margin-bottom: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.prose p {
  color: var(--muted);
  line-height: 1.7;
}

.event-log {
  list-style: none;
  padding: 0;
  margin: 0;
}
.event-log li {
  padding: 0.55rem 0;
  border-bottom: 1px solid rgba(40, 66, 96, 0.38);
  font-size: 0.96rem;
}
.timestamp {
  color: var(--muted);
  margin-right: 0.45rem;
}

.selected-node.empty-card {
  color: var(--muted);
}

.result-banner {
  font-size: 1.15rem;
  padding: 0.9rem 1rem;
  background: rgba(8, 13, 20, 0.7);
  border: 1px solid var(--line);
  border-radius: 12px;
}

@media (max-width: 880px) {
  .hero, .split-grid, .lobby-grid {
    grid-template-columns: 1fr;
  }
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }
}
