:root {
  color-scheme: dark;
  font-family: "Space Grotesk", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bg: #05070f;
  --panel: #101529;
  --panel-alt: #171d37;
  --text: #f4f6ff;
  --muted: #9ea7c6;
  --accent: #ffb347;
  --runner: #4ae5c2;
  --tank: #ff5757;
  --accent-warm: #ffbd59;
  --accent-cool: #42d9ff;
  --focus: #f7f372;
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
  --border: rgba(255, 255, 255, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: radial-gradient(circle at top, rgba(74, 229, 194, 0.3), transparent 60%), var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding: 2rem clamp(1rem, 5vw, 4rem);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Site Navigation */
.site-nav {
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(14, 18, 43, 0.9);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 0.65rem 1rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  gap: 1rem;
}

.nav-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.nav-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-warm), var(--accent-cool));
  box-shadow: 0 0 14px rgba(255, 189, 89, 0.7);
}

.nav-title {
  color: #fff;
}

.site-nav nav {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}

.nav-link {
  color: var(--text);
  text-decoration: none;
  padding: 0.55rem 0.9rem;
  border-radius: 12px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.03);
  font-weight: 600;
  cursor: pointer;
}

.nav-link:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.08);
}

.btn.ghost {
  border-color: rgba(255, 255, 255, 0.3);
  color: var(--text);
  background: transparent;
}

.btn.ghost:hover {
  background: rgba(255, 255, 255, 0.08);
}

.btn.patreon {
  border: none;
  background: linear-gradient(120deg, #ff4e6a, #ff9557);
  color: #fff8f3;
  box-shadow: 0 20px 35px rgba(255, 115, 123, 0.35);
  position: relative;
  overflow: hidden;
  gap: 0.35rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-weight: 600;
  padding: 0.6rem 1.1rem;
  transition: transform 150ms ease, box-shadow 150ms ease;
  cursor: pointer;
}

.btn.patreon::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.35), transparent 60%);
  opacity: 0;
  transition: opacity 200ms ease;
}

.btn.patreon:hover::after,
.btn.patreon:focus-visible::after {
  opacity: 1;
}

.btn.patreon:hover {
  transform: translateY(-3px) scale(1.02);
}

.nav-patreon {
  box-shadow: 0 14px 26px rgba(255, 115, 123, 0.3);
}

.nav-patreon:hover {
  transform: translateY(-2px);
}

.game-header {
  background: var(--panel);
  padding: 1.5rem;
  border-radius: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.45);
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.75rem;
  color: var(--muted);
  margin: 0 0 0.5rem;
}

.summary {
  margin: 0.5rem 0 0;
  color: var(--muted);
}

.back-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.feedback-button {
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: transparent;
  color: var(--text);
  font-weight: 600;
  padding: 0.5rem 1.2rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background 150ms ease, transform 150ms ease;
}

.feedback-button:hover,
.feedback-button:focus-visible {
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 1.5rem;
}

.canvas-shell {
  background: var(--panel);
  border-radius: 18px;
  padding: 1rem;
  position: relative;
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.45);
}

canvas {
  width: 100%;
  height: auto;
  border-radius: 12px;
  background: #070a14;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.overlay {
  position: absolute;
  inset: 1rem;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  background: rgba(5, 7, 15, 0.75);
  color: white;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
}

.overlay.visible {
  opacity: 1;
}

.control-panel {
  background: var(--panel-alt);
  border-radius: 18px;
  padding: 1.5rem;
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.stats p {
  margin: 0.2rem 0;
}

.buttons {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.buttons h2 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: 0.05em;
  color: var(--muted);
}

button {
  appearance: none;
  border: none;
  border-radius: 999px;
  padding: 0.75rem 1.25rem;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  transition: transform 120ms ease, background 120ms ease;
}

button:hover,
button:focus-visible {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.2);
}

button.secondary {
  background: rgba(255, 179, 71, 0.15);
}

button.denied {
  animation: pulse-denied 0.3s;
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.notes {
  font-size: 0.9rem;
  color: var(--muted);
}

.feedback-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(5, 7, 15, 0.8);
  z-index: 30;
}

.feedback-modal.open {
  display: flex;
}

.feedback-modal .modal-panel {
  background: var(--panel);
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 1.25rem;
  width: min(420px, calc(100% - 2rem));
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 1.1rem;
  cursor: pointer;
}

.feedback-modal form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.feedback-modal label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-weight: 600;
  color: var(--muted);
}

.feedback-modal input,
.feedback-modal textarea {
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(7, 10, 20, 0.85);
  color: var(--text);
  padding: 0.65rem 0.9rem;
  font: inherit;
}

.feedback-modal button[type="submit"] {
  border: none;
  background: linear-gradient(120deg, var(--accent), #ff914d);
  color: #211b0e;
  font-weight: 700;
  padding: 0.7rem 1.5rem;
  border-radius: 999px;
  cursor: pointer;
  align-self: flex-start;
}

.feedback-modal button[type="submit"]:hover,
.feedback-modal button[type="submit"]:focus-visible {
  transform: translateY(-1px);
}

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

@media (max-width: 600px) {
  body {
    padding: 1.25rem;
  }

  button {
    width: 100%;
  }
}

@keyframes pulse-denied {
  0% {
    transform: translateY(0);
    background: rgba(255, 87, 87, 0.4);
  }
  50% {
    transform: translateY(-3px);
  }
  100% {
    transform: translateY(0);
  }
}
