:root {
  color-scheme: dark;
  --bg: #08111a;
  --panel: rgba(8, 22, 34, 0.92);
  --card: rgba(15, 34, 49, 0.88);
  --line: rgba(151, 210, 255, 0.18);
  --text: #edf7ff;
  --muted: #9db7cb;
  --accent: #58d4ff;
  --accent-2: #ff8a5b;
  --danger: #ff5d73;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(88, 212, 255, 0.18), transparent 34%),
    radial-gradient(circle at bottom right, rgba(255, 138, 91, 0.16), transparent 28%),
    linear-gradient(135deg, #02060a, var(--bg));
}

.protocol-warning {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255, 93, 115, 0.28);
  background: rgba(69, 11, 20, 0.96);
  color: #ffd7df;
  text-align: center;
}

.protocol-warning code {
  color: #fff3c7;
}

.app-shell {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  min-height: 100vh;
}

.panel {
  display: grid;
  gap: 18px;
  padding: 24px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 2rem;
  line-height: 1;
  margin-bottom: 10px;
}

h2 {
  font-size: 1rem;
  margin-bottom: 14px;
}

.lead {
  color: var(--muted);
  line-height: 1.5;
}

.card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
}

label,
.stage-header {
  color: var(--muted);
}

select,
button {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--line);
  font: inherit;
}

select {
  margin-top: 8px;
  padding: 12px;
  color: var(--text);
  background: rgba(6, 17, 26, 0.92);
}

.actions {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

button {
  padding: 12px 14px;
  color: #041017;
  background: linear-gradient(135deg, var(--accent), #94f0ff);
  cursor: pointer;
  font-weight: 700;
}

button.ghost {
  color: var(--text);
  background: rgba(6, 17, 26, 0.45);
}

.stats {
  display: grid;
  gap: 8px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(151, 210, 255, 0.08);
}

.stat-row:last-child {
  border-bottom: 0;
}

.leaderboard {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  display: grid;
  gap: 10px;
}

.leaderboard li {
  padding-left: 4px;
}

.stage-wrap {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 12px;
  padding: 18px;
}

.stage-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
}

.game-over-message {
  color: var(--danger);
  font-weight: 700;
}

canvas {
  width: 100%;
  height: calc(100vh - 66px);
  display: block;
  border-radius: 24px;
  border: 1px solid var(--line);
  background:
    radial-gradient(circle at center, rgba(82, 153, 204, 0.09), transparent 45%),
    linear-gradient(180deg, rgba(7, 20, 31, 0.92), rgba(3, 9, 14, 0.98));
}

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

  .panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  canvas {
    height: min(64vh, 520px);
  }

  .stage-header {
    flex-direction: column;
    align-items: flex-start;
  }
}
