:root {
  --bg: #0a0e17;
  --panel: rgba(10, 14, 23, 0.72);
  --border: rgba(255, 255, 255, 0.12);
  --text: #eef2ff;
  --muted: #9aa6c2;
  --accent: #ff4d6d;
  --accent-2: #4cc9f0;
  --good: #80ed99;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
}

#c {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

/* On-ride photo flash (Space Mountain etc.) */
#photo-flash {
  position: fixed;
  inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
  z-index: 50;
  transition: none;
}

#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.brand h1 {
  font-size: 1.35rem;
  letter-spacing: 0.28em;
  font-weight: 700;
  color: var(--text);
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.55);
}

.brand .tag {
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 2px;
  letter-spacing: 0.08em;
}

#stats {
  position: absolute;
  top: 20px;
  right: 24px;
  display: flex;
  gap: 10px;
  pointer-events: none;
}

.stat {
  background: var(--panel);
  border: 1px solid var(--border);
  backdrop-filter: blur(12px);
  border-radius: 12px;
  padding: 10px 14px;
  min-width: 88px;
  text-align: right;
}

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

.stat #speed,
.stat #height,
.stat #gforce {
  font-size: 1.35rem;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.stat .unit {
  font-size: 0.7rem;
  color: var(--muted);
  margin-left: 3px;
}

#controls-panel {
  pointer-events: auto;
  align-self: flex-start;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--border);
  backdrop-filter: blur(14px);
  border-radius: 16px;
  padding: 12px 14px;
  max-width: min(520px, 100%);
}

button {
  font: inherit;
  cursor: pointer;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 16px;
  transition: background 0.15s, transform 0.1s, border-color 0.15s;
}

button:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.22);
}

button:active {
  transform: scale(0.98);
}

button.primary {
  background: linear-gradient(135deg, var(--accent), #c9184a);
  border-color: transparent;
  font-weight: 600;
}

button.primary:hover {
  filter: brightness(1.08);
  background: linear-gradient(135deg, var(--accent), #c9184a);
}

button.large {
  padding: 14px 28px;
  font-size: 1.05rem;
  width: 100%;
}

.slider-row,
.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--muted);
}

.slider-row input[type="range"] {
  width: 100px;
  accent-color: var(--accent-2);
}

.check-row input {
  accent-color: var(--accent-2);
}

#hint {
  position: absolute;
  bottom: 20px;
  right: 24px;
  font-size: 0.75rem;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--border);
  backdrop-filter: blur(10px);
  border-radius: 10px;
  padding: 8px 12px;
}

kbd {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.72rem;
  color: var(--text);
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(76, 201, 240, 0.18), transparent 45%),
    radial-gradient(ellipse at 70% 80%, rgba(255, 77, 109, 0.16), transparent 40%),
    rgba(6, 8, 14, 0.78);
  backdrop-filter: blur(6px);
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.overlay-card {
  width: min(440px, calc(100% - 40px));
  background: rgba(14, 18, 30, 0.92);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px 28px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  text-align: center;
}

.overlay-card h2 {
  font-size: 1.75rem;
  margin-bottom: 12px;
  letter-spacing: 0.02em;
}

.overlay-card p {
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: 20px;
  font-size: 0.95rem;
}

.overlay-card .fine {
  margin-top: 14px;
  margin-bottom: 0;
  font-size: 0.78rem;
}

#hud.hud-hidden {
  opacity: 0;
  pointer-events: none;
}

button.ghost {
  background: transparent;
  margin-top: 10px;
  width: 100%;
  color: var(--muted);
}

button.ghost:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.7rem !important;
  color: var(--accent-2) !important;
  margin-bottom: 6px !important;
}

.theme-card {
  width: min(640px, calc(100% - 40px)) !important;
  text-align: left;
}

.theme-card h2 {
  text-align: center;
  letter-spacing: 0.12em;
}

.theme-card .lead {
  text-align: center;
  margin-bottom: 22px !important;
}

.theme-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 8px;
}

.theme-option {
  text-align: left;
  padding: 16px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.12s;
  width: 100%;
  color: var(--text);
  font: inherit;
}

.theme-option:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.28);
  transform: translateY(-1px);
}

.theme-option.selected {
  border-color: var(--accent);
  background: rgba(255, 77, 109, 0.12);
  box-shadow: 0 0 0 1px rgba(255, 77, 109, 0.35);
}

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

.theme-option .emoji {
  font-size: 1.6rem;
  display: block;
  margin-bottom: 6px;
}

.theme-option .t-name {
  font-weight: 700;
  font-size: 0.98rem;
  display: block;
}

.theme-option .t-tag {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 4px;
  display: block;
  line-height: 1.35;
}

.theme-option .t-badge {
  display: inline-block;
  margin-top: 8px;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
}

.theme-option.selected .t-badge {
  background: rgba(255, 77, 109, 0.25);
  color: #ffb3c1;
}

.theme-option .t-badge.soon {
  color: #9aa6c2;
}

@media (max-width: 720px) {
  #stats {
    top: auto;
    bottom: 90px;
    right: 12px;
    left: 12px;
    justify-content: stretch;
  }

  .stat {
    flex: 1;
    min-width: 0;
    text-align: center;
  }

  #hint {
    display: none;
  }

  #controls-panel {
    max-width: 100%;
  }

  .theme-grid {
    grid-template-columns: 1fr;
  }
}
