/* style.css — Super Pop Bros */
:root {
  color-scheme: dark;
  --bg: #0a0a1a;
  --panel: #14142a;
  --panel-2: #1d1d3a;
  --ink: #f0f0ff;
  --ink-dim: #a0a0c8;
  --accent: #ffd84d;
  --accent-2: #ff5a5a;
  --good: #4dd0a0;
  --btn-primary-bg: linear-gradient(180deg, #ff7a3a 0%, #e8501a 100%);
  --btn-primary-border: #b03810;
  --btn-secondary-bg: linear-gradient(180deg, #3a3a6a 0%, #2a2a4a 100%);
  --btn-secondary-border: #20203a;
  --shadow: 0 6px 20px rgba(0,0,0,0.5);
}
@media (prefers-color-scheme: light) {
  :root { color-scheme: light; }
}
html[data-theme="light"] {
  color-scheme: light;
  --bg: #e8e8f0;
  --panel: #ffffff;
  --panel-2: #f0f0fa;
  --ink: #1a1a2a;
  --ink-dim: #505070;
  --accent: #e0a020;
  --accent-2: #d04040;
  --btn-secondary-bg: linear-gradient(180deg, #d0d0e8 0%, #b0b0d0 100%);
  --btn-secondary-border: #9090b0;
  --shadow: 0 6px 18px rgba(0,0,0,0.2);
}
html[data-theme="dark"] {
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: ui-monospace, "SF Mono", "Cascadia Code", "Roboto Mono", Menlo, Consolas, monospace;
  overflow: hidden;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

#game-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  overflow: hidden;
}

#game-canvas {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: #5c94fc;
}

#ui-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
}

/* HUD */
#hud-top {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: linear-gradient(180deg, rgba(0,0,0,0.55), rgba(0,0,0,0));
  color: #fff;
  text-shadow: 0 1px 0 #000, 1px 1px 0 #000;
  flex-wrap: wrap;
}
.hud-item { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.hud-label { color: #ffd84d; font-size: 10px; }
#score-display, #level-display, #lives-display, #coins-display { color: #fff; }

/* Screens */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 14px;
  padding: 24px;
  pointer-events: auto;
  background: radial-gradient(ellipse at center, rgba(20,20,42,0.85) 0%, rgba(10,10,26,0.95) 100%);
  backdrop-filter: blur(2px);
  animation: fadeIn 0.25s ease;
}
html[data-theme="light"] .screen {
  background: radial-gradient(ellipse at center, rgba(240,240,250,0.9) 0%, rgba(220,220,235,0.95) 100%);
  color: var(--ink);
}
.screen.hidden { display: none; }

.screen h1 {
  margin: 0;
  font-size: clamp(24px, 7vw, 48px);
  letter-spacing: 2px;
  text-shadow: 3px 3px 0 #c01010, 6px 6px 0 rgba(0,0,0,0.4);
}
.title-pop {
  background: linear-gradient(180deg, #ffe070 0%, #ff9020 60%, #e04010 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(2px 2px 0 #b02010);
}
.screen h2 {
  margin: 0;
  font-size: clamp(22px, 6vw, 38px);
  text-shadow: 2px 2px 0 rgba(0,0,0,0.5);
}
.subtitle {
  margin: 0;
  color: var(--ink-dim);
  font-size: clamp(12px, 3vw, 16px);
  letter-spacing: 1px;
}
#controls-hint {
  font-size: 12px;
  line-height: 1.7;
  color: var(--ink-dim);
  background: var(--panel-2);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px;
  padding: 10px 16px;
  max-width: 420px;
}
#controls-hint b { color: var(--accent); }
#controls-hint small { color: var(--ink-dim); display: block; margin-top: 4px; }

#level-score-display, #final-score, #win-score {
  font-size: 14px;
  color: var(--ink);
  margin: 0;
  background: var(--panel-2);
  padding: 8px 18px;
  border-radius: 8px;
}

.btn-row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }

.btn-primary, .btn-secondary {
  pointer-events: auto;
  border: 2px solid var(--btn-primary-border);
  background: var(--btn-primary-bg);
  color: #fff;
  font-family: inherit;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 1px;
  padding: 12px 22px;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: var(--shadow), inset 0 2px 0 rgba(255,255,255,0.25);
  transition: transform 0.08s ease, box-shadow 0.15s ease, filter 0.15s ease;
  min-height: 44px;
}
.btn-secondary {
  background: var(--btn-secondary-bg);
  border-color: var(--btn-secondary-border);
  color: var(--ink);
}
.btn-primary:hover { transform: translateY(-1px); filter: brightness(1.08); }
.btn-secondary:hover { transform: translateY(-1px); filter: brightness(1.1); }
.btn-primary:active, .btn-secondary:active { transform: translateY(1px); box-shadow: inset 0 2px 6px rgba(0,0,0,0.4); }
.btn-primary:focus-visible, .btn-secondary:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

#progress-hint {
  font-size: 12px;
  color: var(--good);
  margin-top: 4px;
}
#progress-hint.hidden { display: none; }
.hidden { display: none !important; }

/* Touch controls */
#touch-controls {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 14px 16px env(safe-area-inset-bottom, 10px);
  pointer-events: none;
  gap: 10px;
}
#touch-controls.hidden { display: none; }

.touch-btn {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  border-radius: 16px;
  background: rgba(30,30,55,0.7);
  border: 2px solid rgba(255,255,255,0.18);
  color: #fff;
  font-size: 24px;
  font-weight: 800;
  backdrop-filter: blur(6px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.4), inset 0 2px 0 rgba(255,255,255,0.1);
  touch-action: none;
  transition: transform 0.06s, background 0.1s;
  user-select: none;
}
.touch-btn.active {
  background: rgba(255,120,60,0.85);
  transform: scale(0.94);
}
.touch-btn.jump-btn {
  width: 72px; height: 72px;
  background: rgba(255,120,60,0.55);
}
.touch-btn.jump-btn.active { background: rgba(255,160,80,0.95); }
.touch-btn.run-btn { font-size: 22px; }

.touch-btn.left, .touch-btn.right {
  /* grouped left */
}
#touch-left, #touch-right { margin-right: 4px; }
#touch-jump, #touch-run { margin-left: 4px; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Responsive */
@media (max-width: 560px) {
  #hud-top { font-size: 11px; padding: 6px 8px; gap: 4px; }
  .hud-label { font-size: 9px; }
  .touch-btn { width: 52px; height: 52px; font-size: 20px; }
  .touch-btn.jump-btn { width: 64px; height: 64px; }
}
@media (min-width: 900px) {
  #game-canvas {
    width: auto;
    height: 100%;
    max-width: 100%;
    aspect-ratio: 16 / 9;
    margin: 0 auto;
    image-rendering: pixelated;
  }
}
