:root {
  --bg: #050b1e;
  --panel: #0b1530;
  --cyan: #00f0ff;
  --cyan-dim: #00a8b5;
  --orange: #ff7a00;
  --orange-dim: #cc5f00;
  --yellow: #ffd166;
  --danger: #ff2a6d;
  --text: #e6f7ff;
  --muted: #8aa3c0;
  --shadow: rgba(0, 240, 255, 0.25);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  overflow: hidden;
}

#game-root {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

#game-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 50% 30%, #0c1b42 0%, #050b1e 70%);
}

#ui-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  padding: 24px;
  text-align: center;
}

.screen.active { display: flex; }

#screen-menu {
  background: url('keyvisual.png') center center / cover no-repeat;
}

#screen-menu::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(5, 11, 30, 0.72);
  pointer-events: none;
}

#screen-menu > * {
  position: relative;
  z-index: 1;
}

.logo {
  font-size: clamp(2.5rem, 8vw, 5rem);
  margin: 0 0 24px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
  text-shadow:
    0 0 10px var(--cyan),
    0 0 30px var(--cyan),
    0 0 60px rgba(0, 240, 255, 0.35);
}

h2 {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  margin: 0 0 22px;
  color: var(--cyan);
  text-shadow: 0 0 12px var(--cyan);
}

.menu-nav {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 220px;
  max-width: 420px;
  width: 100%;
}

.menu-nav.compact { max-width: 300px; }

.menu-btn {
  appearance: none;
  border: 2px solid var(--cyan);
  background: rgba(0, 240, 255, 0.08);
  color: var(--text);
  padding: 14px 22px;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 8px;
  box-shadow: 0 0 14px var(--shadow) inset, 0 0 10px rgba(0,0,0,0.4);
  transition: transform 0.08s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.menu-btn:hover, .menu-btn:focus-visible {
  background: rgba(0, 240, 255, 0.22);
  box-shadow: 0 0 24px var(--shadow) inset, 0 0 18px var(--shadow);
  outline: none;
}

.menu-btn:active { transform: scale(0.97); }

.menu-btn.selected {
  background: rgba(0, 240, 255, 0.32);
  box-shadow: 0 0 30px var(--cyan) inset, 0 0 20px var(--shadow);
}

.menu-btn.back {
  border-color: var(--muted);
  background: rgba(138, 163, 192, 0.08);
}

.menu-btn.back:hover, .menu-btn.back:focus-visible {
  background: rgba(138, 163, 192, 0.2);
}

.controls-hint {
  margin-top: 28px;
  color: var(--muted);
  font-size: 0.95rem;
}

kbd {
  display: inline-block;
  background: var(--panel);
  border: 1px solid var(--cyan-dim);
  color: var(--cyan);
  border-radius: 5px;
  padding: 2px 7px;
  font-size: 0.85em;
  margin: 0 2px;
  box-shadow: 0 2px 0 rgba(0,0,0,0.3);
}

#hud {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  text-shadow: 0 0 8px var(--cyan);
  pointer-events: none;
}

#hud-stage { opacity: 0; }
#hud-stage.visible { opacity: 1; }

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(5, 11, 30, 0.82);
  backdrop-filter: blur(3px);
  pointer-events: auto;
}

.overlay.hidden { display: none; }

#countdown {
  font-size: clamp(5rem, 18vw, 12rem);
  font-weight: 900;
  color: var(--cyan);
  text-shadow: 0 0 40px var(--cyan);
  animation: pulse 0.9s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.08); opacity: 0.85; }
}

#game-over h2, #level-complete h2 {
  margin-bottom: 12px;
}

#go-score, #go-distance, #lc-score {
  margin: 6px 0;
  font-size: 1.2rem;
  color: var(--yellow);
}

#ranking-list {
  list-style: none;
  padding: 0;
  margin: 0 0 24px;
  width: min(420px, 90%);
}

#ranking-list li {
  display: flex;
  justify-content: space-between;
  padding: 10px 14px;
  margin-bottom: 8px;
  background: rgba(0, 240, 255, 0.08);
  border: 1px solid rgba(0, 240, 255, 0.25);
  border-radius: 6px;
}

#ranking-list .rank { color: var(--cyan); font-weight: 800; }
#ranking-list .name { color: var(--text); }
#ranking-list .score { color: var(--yellow); font-weight: 700; }

#skin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 14px;
  width: min(520px, 92%);
  margin-bottom: 24px;
}

.skin-card {
  cursor: pointer;
  border: 2px solid var(--cyan-dim);
  border-radius: 10px;
  padding: 12px 8px;
  background: rgba(0, 240, 255, 0.06);
  transition: transform 0.1s ease, box-shadow 0.15s ease;
}

.skin-card:hover, .skin-card:focus-visible {
  background: rgba(0, 240, 255, 0.14);
  box-shadow: 0 0 16px var(--shadow);
  outline: none;
}

.skin-card.selected {
  border-color: var(--orange);
  box-shadow: 0 0 20px rgba(255, 122, 0, 0.35);
  background: rgba(255, 122, 0, 0.12);
}

.skin-swatch {
  width: 56px;
  height: 56px;
  margin: 0 auto 10px;
  border-radius: 50%;
  border: 3px solid var(--text);
  box-shadow: 0 0 12px currentColor;
}

.skin-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
}

@media (max-width: 640px) {
  .menu-nav { min-width: 180px; }
  #hud { font-size: 0.85rem; }
}
