/* ===== Reset & Canvas ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

.potato-home-link {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 1000;
  padding: 8px 11px;
  border-radius: 999px;
  color: #fff7e8;
  background: rgba(15, 15, 15, 0.78);
  border: 1px solid rgba(255, 247, 232, 0.18);
  font: 700 13px system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  text-decoration: none;
  backdrop-filter: blur(10px);
  touch-action: manipulation;
}

.potato-home-link:hover {
  background: rgba(242, 184, 75, 0.22);
}

.potato-home-link:focus-visible,
button:focus-visible {
  outline: 3px solid rgba(242, 184, 75, 0.78);
  outline-offset: 3px;
}

body {
  overflow: hidden;
  touch-action: none;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

html, body {
  width: 100%;
  height: 100%;
}

canvas {
  display: block;
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
}

/* ===== Light Theme (default) ===== */
html[data-theme="light"] {
  --bg: #f8f8f8;
  --surface: rgba(255,255,255,0.94);
  --text: #1a1a1a;
  --text-dim: #666;
  --border: #ddd;
  --title: #222;
  --subtitle: #777;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --shadow: rgba(0,0,0,0.12);
  --btn-text: #fff;
  --canvas-bg: #e8e8e8;
  --paddle: #3b82f6;
  --ball: #2563eb;
  --ball-glow: rgba(59,130,246,0.4);
  --pu-bg: rgba(59,130,246,0.1);
}

/* ===== Dark Theme ===== */
html[data-theme="dark"] {
  --bg: #0f0f0f;
  --surface: rgba(20,20,20,0.94);
  --text: #e0e0e0;
  --text-dim: #888;
  --border: #333;
  --title: #f0f0f0;
  --subtitle: #aaa;
  --accent: #60a5fa;
  --accent-hover: #93bbfd;
  --shadow: rgba(0,0,0,0.4);
  --btn-text: #0f0f0f;
  --canvas-bg: #1a1a1a;
  --paddle: #60a5fa;
  --ball: #93bbfd;
  --ball-glow: rgba(96,165,250,0.4);
  --pu-bg: rgba(96,165,250,0.1);
}

/* ===== Stats Bar ===== */
#stats-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 12px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 10;
  transition: background 0.3s, border-color 0.3s;
}

#stats-bar .label {
  color: var(--text-dim);
  margin-right: 4px;
}

#score, #level {
  font-weight: 700;
  color: var(--accent);
  transition: color 0.3s;
}

/* Lives as dots */
#lives {
  display: flex;
  gap: 4px;
  font-size: 16px;
}

#pause-btn, #theme-btn {
  margin-left: auto;
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  transition: background 0.2s;
}

#pause-btn:hover, #theme-btn:hover {
  background: var(--pu-bg);
}

/* ===== Overlays ===== */
.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  color: var(--text);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 20;
}

.overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

/* ===== Title ===== */
.title {
  font-size: clamp(36px, 8vw, 72px);
  font-weight: 800;
  letter-spacing: -2px;
  color: var(--title);
  margin-bottom: 8px;
  transition: color 0.3s;
}

.subtitle {
  font-size: clamp(14px, 2.5vw, 20px);
  color: var(--subtitle);
  margin-bottom: 32px;
  transition: color 0.3s;
}

/* ===== Power-Up Preview ===== */
.powerup-preview {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  max-width: 500px;
  margin-bottom: 24px;
}

.powerup-preview .pu {
  padding: 10px 16px;
  background: var(--pu-bg);
  border-radius: 10px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.3s;
}

.powerup-preview .pu span {
  font-size: 18px;
}

/* ===== Hint ===== */
.hint {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 32px;
  transition: color 0.3s;
}

/* ===== Buttons ===== */
.btn-play {
  background: var(--accent);
  color: var(--btn-text);
  border: none;
  border-radius: 12px;
  padding: 14px 40px;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s, background 0.2s;
}

.btn-play:hover {
  background: var(--accent-hover);
  transform: scale(1.05);
}

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

/* ===== Game Over / Win ===== */
.gameover h2 {
  color: #ef4444;
}

.gameover .title {
  color: #ef4444;
}

.win .title {
  color: #22c55e;
}

#gameover-score, #win-score {
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 24px;
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
  #stats-bar {
    padding: 8px 12px;
    gap: 12px;
    font-size: 13px;
  }

  .powerup-preview .pu {
    padding: 8px 12px;
    font-size: 12px;
  }

  .hint {
    font-size: 12px;
    text-align: center;
    padding: 0 16px;
  }
}

/* ===== Transitions ===== */
html {
  transition: background-color 0.3s;
}
