:root {
  --bg: #060a09;
  --bg2: #0c1411;
  --emerald: #3dff8f;
  --emerald-dim: #1a9f55;
  --gold: #ffc44d;
  --lava: #ff5c3a;
  --text: #e8fff2;
  --muted: #7a9a88;
  --glass: rgba(12, 28, 22, 0.72);
  --border: rgba(61, 255, 143, 0.18);
  --glow: 0 0 40px rgba(61, 255, 143, 0.25);
  --font: "Syne", system-ui, sans-serif;
  --pixel: "Silkscreen", monospace;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
}

#blocks {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.55;
}

.scanlines {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.03) 2px,
    rgba(0, 0, 0, 0.03) 4px
  );
}

.vignette {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(0, 0, 0, 0.65) 100%);
}

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  background: linear-gradient(180deg, rgba(6, 10, 9, 0.95), transparent);
  backdrop-filter: blur(8px);
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: var(--text);
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
}

.logo em {
  color: var(--emerald);
  font-style: normal;
}

.logo-cube {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, var(--emerald), var(--emerald-dim));
  box-shadow: var(--glow);
  animation: cube-spin 6s linear infinite;
  clip-path: polygon(0 30%, 50% 0, 100% 30%, 100% 70%, 50% 100%, 0 70%);
}

@keyframes cube-spin {
  0%, 100% { filter: hue-rotate(0deg); transform: rotateY(0deg); }
  50% { filter: hue-rotate(20deg); transform: rotateY(180deg); }
}

.topbar nav {
  display: flex;
  gap: 1.5rem;
}

.topbar nav a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  transition: color 0.2s;
}

.topbar nav a:hover { color: var(--emerald); }

.pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--glass);
  color: var(--text);
  font-family: var(--pixel);
  font-size: 0.65rem;
  cursor: default;
}

.pill.online { border-color: rgba(61, 255, 143, 0.5); box-shadow: var(--glow); }
.pill.offline { border-color: rgba(255, 92, 58, 0.4); }

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}

.pill.online .pulse-dot {
  background: var(--emerald);
  animation: pulse 1.5s ease infinite;
}

.pill.offline .pulse-dot { background: var(--lava); }

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(61, 255, 143, 0.6); }
  50% { box-shadow: 0 0 0 8px rgba(61, 255, 143, 0); }
}

main {
  position: relative;
  z-index: 2;
  padding-top: 5rem;
}

.hero {
  min-height: 92vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  position: relative;
}

.hero::before {
  content: "";
  position: absolute;
  width: 60vmax;
  height: 60vmax;
  background: radial-gradient(circle, rgba(61, 255, 143, 0.12), transparent 65%);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -55%);
  pointer-events: none;
}

.hero-badge {
  font-family: var(--pixel);
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  color: var(--gold);
  border: 1px solid rgba(255, 196, 77, 0.35);
  padding: 0.4rem 1rem;
  border-radius: 4px;
  margin-bottom: 1.5rem;
  text-transform: uppercase;
}

.hero-title {
  font-size: clamp(2.5rem, 8vw, 5.5rem);
  font-weight: 800;
  line-height: 1.05;
  margin-bottom: 1rem;
}

.hero-title .line { display: block; }
.hero-title .accent { color: var(--emerald); }

.glitch {
  position: relative;
  display: inline-block;
}

.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  overflow: hidden;
}

.glitch::before {
  color: var(--lava);
  animation: glitch-1 3s infinite linear alternate-reverse;
  clip-path: polygon(0 0, 100% 0, 100% 35%, 0 35%);
}

.glitch::after {
  color: var(--gold);
  animation: glitch-2 2.5s infinite linear alternate-reverse;
  clip-path: polygon(0 65%, 100% 65%, 100% 100%, 0 100%);
}

@keyframes glitch-1 {
  0%, 90%, 100% { transform: translate(0); }
  92% { transform: translate(-3px, 2px); }
  94% { transform: translate(3px, -2px); }
}

@keyframes glitch-2 {
  0%, 88%, 100% { transform: translate(0); }
  90% { transform: translate(4px, -1px); }
  93% { transform: translate(-4px, 1px); }
}

.hero-sub {
  font-size: 1.15rem;
  color: var(--muted);
  max-width: 36rem;
  margin-bottom: 2rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 3rem;
}

.btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 1rem 1.75rem;
  border-radius: 8px;
  font-family: var(--font);
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, var(--emerald), var(--emerald-dim));
  color: #041008;
  box-shadow: 0 8px 32px rgba(61, 255, 143, 0.35);
}

.btn-primary:hover {
  box-shadow: 0 12px 48px rgba(61, 255, 143, 0.5);
  transform: translateY(-2px);
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-ghost:hover { border-color: var(--emerald); color: var(--emerald); }

.btn-icon { font-size: 1.2rem; }
.btn-label { font-family: var(--pixel); font-size: 0.85rem; }
.btn-hint { font-size: 0.7rem; opacity: 0.7; font-weight: 400; }
.btn-lg { padding: 1.1rem 2.5rem; font-size: 1rem; }

.hero-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(100px, 1fr));
  gap: 1rem;
  max-width: 720px;
  width: 100%;
}

.stat-card {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  backdrop-filter: blur(12px);
}

.stat-label {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--emerald);
}

.stat-value.small { font-size: 1rem; }
.stat-value .dim { color: var(--muted); font-weight: 400; }

.panel-section {
  padding: 5rem 2rem;
  max-width: 1100px;
  margin: 0 auto;
}

.section-head {
  text-align: center;
  margin-bottom: 3rem;
}

.section-head h2 {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 800;
  margin-bottom: 0.5rem;
}

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

.dashboard {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.dash-card {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem;
  backdrop-filter: blur(16px);
}

.status-card {
  grid-row: span 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.status-ring {
  position: relative;
  width: 140px;
  height: 140px;
}

.status-ring svg { transform: rotate(-90deg); width: 100%; height: 100%; }

.ring-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.06);
  stroke-width: 8;
}

.ring-fg {
  fill: none;
  stroke: var(--emerald);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 327;
  stroke-dashoffset: 327;
  transition: stroke-dashoffset 0.8s ease, stroke 0.4s;
}

.status-card.offline .ring-fg { stroke: var(--lava); }

.ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.ring-label {
  font-family: var(--pixel);
  font-size: 0.75rem;
  color: var(--emerald);
}

.status-card.offline .ring-label { color: var(--lava); }

.ring-sub { font-size: 0.8rem; color: var(--muted); margin-top: 0.25rem; }

.dash-meta {
  list-style: none;
  width: 100%;
}

.dash-meta li {
  display: flex;
  justify-content: space-between;
  padding: 0.6rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.9rem;
}

.dash-meta span { color: var(--muted); }

.chart-card h3,
.motd-card h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 1rem;
}

#sparkline { width: 100%; height: 80px; }

.chart-foot {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.5rem;
}

#motd-quote {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--gold);
  border-left: 3px solid var(--emerald);
  padding-left: 1rem;
  margin-bottom: 1.25rem;
  min-height: 3rem;
}

.latency-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.bar-track {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--emerald-dim), var(--emerald));
  border-radius: 3px;
  transition: width 0.5s ease;
}

.roster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
}

.roster-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem;
  border: 1px dashed var(--border);
  border-radius: 16px;
  color: var(--muted);
}

.empty-icon { font-size: 2.5rem; margin-bottom: 0.5rem; opacity: 0.5; }

.player-card {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  text-align: center;
  animation: fade-up 0.5s ease backwards;
}

.player-card img {
  width: 64px;
  height: 64px;
  image-rendering: pixelated;
  margin-bottom: 0.5rem;
  border-radius: 4px;
}

.player-card strong {
  display: block;
  font-family: var(--pixel);
  font-size: 0.7rem;
  color: var(--emerald);
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
}

.feature {
  padding: 1.5rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: linear-gradient(145deg, rgba(61, 255, 143, 0.04), transparent);
  transition: transform 0.25s, border-color 0.25s;
}

.feature:hover {
  transform: translateY(-4px);
  border-color: rgba(61, 255, 143, 0.4);
}

.feature-icon {
  font-size: 1.75rem;
  margin-bottom: 0.75rem;
}

.feature h3 { margin-bottom: 0.5rem; font-size: 1.1rem; }
.feature p { color: var(--muted); font-size: 0.9rem; }

.join-panel {
  max-width: 640px;
  margin: 0 auto;
  padding: 2.5rem;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: linear-gradient(160deg, rgba(61, 255, 143, 0.08), rgba(255, 92, 58, 0.04));
  text-align: center;
}

.join-panel h2 { margin-bottom: 2rem; font-size: 2rem; }

.steps {
  list-style: none;
  text-align: left;
  margin-bottom: 2rem;
}

.steps li {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.25rem;
  align-items: flex-start;
}

.steps li > span {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--emerald);
  color: #041008;
  font-family: var(--pixel);
  font-size: 0.75rem;
  border-radius: 6px;
}

.steps strong { display: block; margin-bottom: 0.2rem; }
.steps p { color: var(--muted); font-size: 0.9rem; }
.steps code {
  background: rgba(0, 0, 0, 0.35);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  color: var(--emerald);
  font-family: var(--pixel);
  font-size: 0.75rem;
}

footer {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 3rem 2rem;
  color: var(--muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
}

footer a { color: var(--emerald); text-decoration: none; }
.foot-meta { margin-top: 0.5rem; font-size: 0.75rem; opacity: 0.7; }

.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  z-index: 200;
  padding: 0.85rem 1.5rem;
  background: var(--emerald);
  color: #041008;
  font-weight: 700;
  border-radius: 8px;
  font-family: var(--pixel);
  font-size: 0.7rem;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: var(--glow);
}

.toast.show { transform: translateX(-50%) translateY(0); }

@media (max-width: 768px) {
  .topbar nav { display: none; }
  .hero-stats { grid-template-columns: repeat(2, 1fr); }
  .dashboard { grid-template-columns: 1fr; }
  .status-card { grid-row: auto; }
}
