:root {
  color-scheme: dark;
  --bg: #0a0a0f;
  --surface: #131316;
  --surface-soft: #101015;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --border: rgba(255, 255, 255, 0.08);
  --border-soft: rgba(255, 255, 255, 0.05);
  --accent: #6366f1;
  --accent-soft: #818cf8;
  --maxw: 1100px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  color: var(--text);
  background: #0a0a0f;
}

.demo-page {
  min-height: 100vh;
  background-image:
    linear-gradient(rgba(99, 102, 241, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(99, 102, 241, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
}

.demo-page::before {
  content: "";
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(99, 102, 241, 0.08) 0%, transparent 70%);
  pointer-events: none;
}

.page-shell {
  position: relative;
  z-index: 1;
  width: min(var(--maxw), 94vw);
  margin: 0 auto;
  padding: 32px 0 64px;
}

.top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.25);
  color: #a5b4fc;
  font-size: 0.72rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  font-weight: 700;
}

.eyebrow-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #818cf8;
  animation: pulse 1.8s infinite ease-in-out;
}

.back-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
  transition: border-color 0.2s ease, color 0.2s ease, background-color 0.2s ease;
}

.back-link:hover {
  border-color: rgba(99, 102, 241, 0.5);
  color: #c7d2fe;
  background: rgba(99, 102, 241, 0.1);
}

.back-link-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  line-height: 1;
  font-size: 1rem;
}

.hero-panel,
.game-panel,
.info-panel,
.legal-panel {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 20px;
  padding: 28px;
}

.hero-panel {
  position: relative;
  overflow: hidden;
  margin-bottom: 20px;
}

.hero-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.55), rgba(168, 85, 247, 0.3), rgba(34, 211, 238, 0.25));
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  -webkit-mask-composite: xor;
  pointer-events: none;
}

.hero-panel > * {
  position: relative;
  z-index: 1;
}

h1 {
  margin: 0 0 16px;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.08;
  font-weight: 700;
}

.hero-lead {
  margin: 0;
  color: #cbd5e1;
  font-size: 1.1rem;
  max-width: 76ch;
  line-height: 1.65;
}

.game-panel {
  margin-bottom: 20px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.panel-head h2 {
  margin: 0;
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #a5b4fc;
}

.toggle-help {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.92rem;
  color: var(--muted);
  user-select: none;
}

.toggle-help input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

#help {
  display: none;
  margin: 0 0 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  background: var(--surface-soft);
  color: var(--muted);
  line-height: 1.5;
  font-size: 0.95rem;
}

#help b {
  color: var(--text);
}

.status-row {
  display: grid;
  justify-items: center;
  gap: 8px;
  margin: 0 0 12px;
}

.spinner {
  width: 22px;
  height: 22px;
  border: 3px solid rgba(255, 255, 255, 0.22);
  border-top-color: var(--accent-soft);
  border-radius: 999px;
  animation: spin 0.8s linear infinite;
}

#status {
  color: var(--text);
  font-weight: 600;
  font-size: 0.95rem;
  text-align: center;
}

#progress {
  width: min(460px, 100%);
  height: 13px;
}

.canvas-shell {
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  background: #000;
}

canvas.emscripten {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 2;
  background: #000;
  border: 0;
  padding: 0;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.info-panel h3,
.legal-panel h3 {
  margin: 0 0 14px;
  font-size: 1.05rem;
  color: #c7d2fe;
}

.info-panel ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.info-panel li {
  color: #cbd5e1;
  line-height: 1.5;
  position: relative;
  padding-left: 16px;
}

.info-panel li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--accent-soft);
}

#infos,
#disclaimer {
  display: none;
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
  font-size: 0.94rem;
}

a {
  color: #a5b4fc;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.footer-note {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border-soft);
  color: var(--muted);
  font-size: 0.88rem;
  text-align: center;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.5;
  }
  50% {
    opacity: 1;
  }
}

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

@media (max-width: 680px) {
  .page-shell {
    width: min(var(--maxw), 95vw);
    padding-top: 22px;
  }

  .top-row {
    align-items: flex-start;
    flex-direction: column;
    margin-bottom: 18px;
  }

  .hero-panel,
  .game-panel,
  .info-panel,
  .legal-panel {
    border-radius: 16px;
    padding: 20px;
  }

  h1 {
    font-size: 1.85rem;
  }

  .hero-lead {
    font-size: 1rem;
  }

  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }
}
