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

:root {
  --bg: #020617;
  --panel: #0b1224;
  --canvas: #0b1224;
  --wall: #0f172a;
  --text: #e5e7eb;
  --muted: rgba(229, 231, 235, 0.7);
  --accent: #fbbf24;
}

:root.light {
  --bg: #f7f8fb;
  --panel: #ffffff;
  --canvas: #eef2ff;
  --wall: #cbd5f5;
  --text: #0f172a;
  --muted: #475569;
  --accent: #f59e0b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 20% 20%, rgba(15, 23, 42, 0.7), var(--bg) 60%);
  color: var(--text);
  font-family: 'Space Grotesk', 'JetBrains Mono', system-ui, -apple-system, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 16px 40px;
}

.hud {
  width: min(900px, 100%);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.85), rgba(2, 6, 23, 0.9));
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(8px);
}

:root.light body {
  background: radial-gradient(circle at 20% 20%, rgba(226, 232, 240, 0.8), var(--bg) 60%);
}

.light .hud {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.9));
  border: 1px solid rgba(15, 23, 42, 0.06);
  box-shadow: 0 14px 40px rgba(15, 23, 42, 0.08);
}

.title {
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--accent);
}

.scores {
  display: flex;
  gap: 18px;
  font-weight: 600;
}

.scores span {
  color: rgba(229, 231, 235, 0.9);
}

.controls {
  display: flex;
  gap: 10px;
  align-items: center;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.light .icon-btn {
  border-color: rgba(15, 23, 42, 0.08);
  background: rgba(15, 23, 42, 0.03);
}

.icon-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(251, 191, 36, 0.6);
}

.icon-btn:active {
  transform: translateY(0);
}

.game-container {
  width: min(900px, 100%);
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

#game-canvas {
  width: 100%;
  max-width: 720px;
  aspect-ratio: 9 / 16;
  background: var(--canvas);
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  touch-action: none;
}

.slider-wrap {
  width: 100%;
  max-width: 720px;
  padding: 8px 4px 4px;
}

#control-slider {
  width: 100%;
  appearance: none;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(251, 191, 36, 0.7), rgba(251, 191, 36, 0.35));
  outline: none;
  border: 1px solid rgba(255, 255, 255, 0.08);
  touch-action: pan-x;
}

#control-slider::-webkit-slider-thumb {
  appearance: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #fff3;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

#control-slider::-moz-range-thumb {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #fff3;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.tip {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  text-align: center;
  max-width: 640px;
  line-height: 1.4;
}

@media (max-width: 540px) {
  .hud {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .scores {
    width: 100%;
    justify-content: space-between;
  }
  .controls {
    width: 100%;
    justify-content: flex-end;
  }
  #game-canvas {
    border-radius: 14px;
  }
}
