@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600&display=swap");

:root {
  color-scheme: light;
  --ink: #0d1b2a;
  --sea: #4d9fc9;
  --sea-dark: #2e6f92;
  --panel: rgba(255, 255, 255, 0.8);
  --panel-border: rgba(13, 27, 42, 0.2);
  --accent: #f3b562;
  --accent-strong: #e38f2a;
}

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

body {
  font-family: "Space Grotesk", system-ui, sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 10% 10%, #e3f3ff, #b5d8ee 40%, #9cc5de 70%, #7caac8 100%);
  overflow: hidden;
}

#app {
  position: fixed;
  inset: 0;
}

canvas {
  display: block;
}

#start-screen {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.8), rgba(192, 220, 238, 0.9));
  z-index: 5;
}

#start-screen.hidden {
  display: none;
}

.start-card {
  width: min(92vw, 360px);
  padding: 24px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--panel-border);
  box-shadow: 0 20px 50px rgba(13, 27, 42, 0.18);
  display: grid;
  gap: 12px;
}

.start-card h1 {
  font-size: 28px;
  font-weight: 600;
}

.start-card p {
  font-size: 14px;
  line-height: 1.4;
  opacity: 0.75;
}

.start-card label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.6;
}

.start-card select,
.start-card input,
.start-card button {
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--panel-border);
  font-family: inherit;
  font-size: 14px;
}

.start-card select {
  padding: 0 12px;
  background: white;
}

.start-card input {
  padding: 0 12px;
  background: white;
}

.start-card input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid var(--panel-border);
  background: white;
  font-size: 14px;
}

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

.start-card button {
  background: var(--accent);
  border: none;
  color: var(--ink);
  font-weight: 600;
  cursor: pointer;
}

.start-card button:active {
  transform: translateY(1px);
}

.room-status {
  min-height: 18px;
  font-size: 12px;
  opacity: 0.7;
}

.room-code-hud {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--panel-border);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  z-index: 2;
}

.room-code-hud.hidden {
  display: none;
}

.speed-panel {
  position: absolute;
  top: 16px;
  min-width: 120px;
  padding: 12px 16px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  backdrop-filter: blur(6px);
  display: grid;
  gap: 6px;
}

.speed-left {
  left: 16px;
}

.speed-right {
  right: 16px;
  text-align: right;
}

.player-one {
  border-color: rgba(245, 158, 58, 0.7);
  box-shadow: 0 10px 30px rgba(245, 158, 58, 0.18);
}

.player-two {
  border-color: rgba(54, 208, 111, 0.7);
  box-shadow: 0 10px 30px rgba(54, 208, 111, 0.18);
}

.label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.7;
}

.speed-value {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

#controls {
  position: absolute;
  bottom: 24px;
  right: 24px;
  display: flex;
  gap: 12px;
}

#controls button {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  border: 1px solid var(--panel-border);
  background: var(--panel);
  font-size: 24px;
  font-weight: 600;
  color: var(--ink);
  box-shadow: 0 10px 30px rgba(13, 27, 42, 0.2);
  touch-action: none;
}

#controls button:active {
  transform: translateY(2px);
  background: rgba(243, 181, 98, 0.3);
}

@media (max-width: 768px) {
  .speed-panel {
    min-width: 100px;
    padding: 10px 12px;
  }

  .speed-value {
    font-size: 22px;
  }
}
