@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=Inter:wght@400;600;700&display=swap');

:root {
  --bg: #0C1222;
  --ground: #1A2332;
  --accent: #C4622D;
  --gold: #FFD700;
  --shield: #00E5FF;
  --slow: #A78BFA;
  --magnet: #F472B6;
  --text: #F6FCFF;
  --text-muted: rgba(246,252,255,0.55);
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
}

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

html, body {
  width: 100%; height: 100%;
  background: var(--bg);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-family: 'Inter', sans-serif;
  touch-action: none;
  user-select: none;
}

#game-wrapper {
  position: relative;
  width: 100vw; height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#gameCanvas {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* ── UI OVERLAY ── */
#ui-overlay {
  position: absolute;
  top: var(--space-lg);
  left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  padding: 0 var(--space-xl);
  pointer-events: none;
  z-index: 10;
}

#score-display, #best-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: rgba(12,18,34,0.70);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255,215,0,0.15);
  border-radius: var(--radius-md);
  padding: 10px 20px;
}

#score-label, #best-label {
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  color: var(--gold);
  letter-spacing: 0.15em;
}

#score-value, #best-value {
  font-family: 'Press Start 2P', monospace;
  font-size: 18px;
  color: var(--text);
  letter-spacing: 0.05em;
}

/* ── SCREENS ── */
#start-screen, #gameover-screen {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(12,18,34,0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 20;
  transition: opacity 0.4s ease;
}

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

.screen-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
  text-align: center;
  padding: var(--space-xl) var(--space-2xl);
  max-width: 460px;
  width: 92%;
  background: rgba(26,35,50,0.80);
  border: 1px solid rgba(255,215,0,0.12);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 64px rgba(0,0,0,0.6), 0 0 80px rgba(196,98,45,0.08);
}

.logo-octopus, .go-icon {
  font-size: 56px;
  animation: floatIcon 3s ease-in-out infinite;
}

@keyframes floatIcon {
  0%, 100% { transform: translateY(0px); }
  50%       { transform: translateY(-10px); }
}

.screen-inner h1 {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(16px, 3.5vw, 26px);
  color: var(--text);
  line-height: 1.4;
  letter-spacing: 0.05em;
}
.screen-inner h1 span { color: var(--gold); }

.screen-inner h2 {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(18px, 3.5vw, 28px);
  color: #EF4444;
  letter-spacing: 0.08em;
}

.subtitle {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
}

.controls-hint {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.hint-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 12px;
  color: var(--text-muted);
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-md);
  padding: 8px 14px;
}

.powerup-hint { font-size: 11px; }
.shield-hint  { border-color: rgba(0,229,255,0.20); color: rgba(0,229,255,0.80); }
.slow-hint    { border-color: rgba(167,139,250,0.20); color: rgba(167,139,250,0.80); }
.magnet-hint  { border-color: rgba(244,114,182,0.20); color: rgba(244,114,182,0.80); }

.night-hint {
  font-size: 11px;
  color: rgba(167,139,250,0.70);
  background: rgba(167,139,250,0.06);
  border: 1px solid rgba(167,139,250,0.15);
  border-radius: var(--radius-md);
  padding: 8px 16px;
  width: 100%;
  text-align: center;
}

kbd {
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  background: rgba(255,215,0,0.12);
  border: 1px solid rgba(255,215,0,0.30);
  border-radius: 6px;
  padding: 4px 10px;
  color: var(--gold);
}

/* ── BUTTON ── */
.game-btn {
  font-family: 'Press Start 2P', monospace;
  font-size: 13px;
  color: #0C1222;
  background: var(--gold);
  border: none;
  border-radius: var(--radius-full);
  padding: 16px 40px;
  cursor: pointer;
  letter-spacing: 0.08em;
  margin-top: var(--space-sm);
  transition: all 0.25s cubic-bezier(0.4,0,0.2,1);
  box-shadow: 0 4px 16px rgba(255,215,0,0.35), 0 1px 2px rgba(0,0,0,0.3), inset 0 2px 4px rgba(255,255,255,0.4);
}
.game-btn:hover  { transform: translateY(-3px); box-shadow: 0 8px 32px rgba(255,215,0,0.50), 0 2px 4px rgba(0,0,0,0.3), inset 0 2px 4px rgba(255,255,255,0.4); }
.game-btn:active { transform: translateY(1px) scale(0.97); box-shadow: 0 2px 8px rgba(255,215,0,0.25); }
.game-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

/* ── GO SCORES ── */
.go-scores {
  display: flex;
  align-items: center;
  gap: var(--space-xl);
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,215,0,0.10);
  border-radius: var(--radius-lg);
  padding: var(--space-lg) var(--space-xl);
  width: 100%;
  justify-content: center;
}
.go-score-item { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.go-label { font-family: 'Press Start 2P', monospace; font-size: 8px; color: var(--gold); letter-spacing: 0.15em; }
.go-value { font-family: 'Press Start 2P', monospace; font-size: 22px; color: var(--text); }
.go-divider { width: 1px; height: 48px; background: rgba(255,215,0,0.15); }

.go-coins-line {
  font-size: 12px;
  color: rgba(255,215,0,0.75);
  background: rgba(255,215,0,0.06);
  border: 1px solid rgba(255,215,0,0.12);
  border-radius: var(--radius-md);
  padding: 8px 16px;
  width: 100%;
  text-align: center;
  min-height: 36px;
}

/* ── POWERED ── */
#powered {
  position: absolute;
  bottom: 12px; left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: rgba(246,252,255,0.25);
  letter-spacing: 0.08em;
  pointer-events: none;
  z-index: 5;
  white-space: nowrap;
}
#powered strong { color: rgba(196,98,45,0.60); }

/* ── MOBILE ── */
@media (max-width: 768px) {
  #ui-overlay { padding: 0 var(--space-md); top: var(--space-md); }
  #score-value, #best-value { font-size: 14px; }
  .screen-inner { padding: var(--space-lg) var(--space-md); gap: 10px; max-width: 98vw; }
  .logo-octopus, .go-icon { font-size: 40px; }
  .game-btn { font-size: 11px; padding: 14px 32px; }
  .go-value { font-size: 18px; }
  .controls-hint { gap: 4px; }
  .hint-item { font-size: 10px; padding: 6px 10px; }
}