:root {
  /* ---- Dawn Climb palette ---- */
  --dusk:        #1a1140;   /* deep night indigo — high altitude sky */
  --twilight:    #5b3286;   /* mid climb */
  --coral:       #ff8f6b;   /* horizon warmth */
  --glow:        #ffd479;   /* low-altitude ground glow */
  --lime:        #c6ff3d;   /* primary accent — score, CTA */
  --lime-ink:    #274a00;   /* text on lime */
  --magenta:     #ff3d84;   /* danger / game-over accent */
  --cloud:       #fff8ec;
  --ink:         #1b1030;
  --ink-soft:    rgba(255,255,255,0.72);

  --font-display: "Baloo 2", system-ui, sans-serif;
  --font-body: "Nunito", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--dusk);
  font-family: var(--font-body);
  color: var(--cloud);
  -webkit-tap-highlight-color: transparent;
}

#app {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  background: radial-gradient(120% 90% at 50% 0%, #2a1a5e 0%, #150c34 55%, #0c0720 100%);
}

/* ---------- Below-game SEO content ---------- */
.info-page {
  max-width: 760px;
  margin: 0 auto;
  padding: 28px 20px 40px;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.7;
  background: var(--dusk);
}
.info-page h1 { font-size: 22px; color: var(--cloud); margin: 0 0 10px; font-family: var(--font-display); }
.info-page h2 { font-size: 16px; color: var(--cloud); margin: 20px 0 6px; font-family: var(--font-display); }
.info-page strong { color: var(--cloud); }

#stage {
  position: relative;
  height: 100%;
  aspect-ratio: 400 / 700;
  max-width: 100%;
  max-height: 100%;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 30px 80px -20px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.06);
}

@media (min-width: 560px) {
  #stage { height: min(94vh, 900px); }
}

canvas#board {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

/* ===================== HUD ===================== */
#hud {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 14px 14px 0;
  pointer-events: none;
  z-index: 5;
}

.hud-left, .hud-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hud-label {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--lime);
  background: rgba(0,0,0,0.28);
  padding: 5px 8px 4px;
  border-radius: 8px;
  backdrop-filter: blur(6px);
}

.hud-value {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 800;
  color: var(--cloud);
  text-shadow: 0 2px 10px rgba(0,0,0,0.35);
  line-height: 1;
}
.hud-value.small { font-size: 16px; }

.hud-coins {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(0,0,0,0.28);
  padding: 6px 10px;
  border-radius: 999px;
  backdrop-filter: blur(6px);
}

.icon-btn {
  pointer-events: all;
  width: 38px; height: 38px;
  border-radius: 12px;
  border: none;
  background: rgba(0,0,0,0.28);
  color: var(--cloud);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: transform 0.15s ease, background 0.15s ease;
}
.icon-btn:hover { background: rgba(0,0,0,0.42); }
.icon-btn:active { transform: scale(0.9); }

/* ===================== touch zones ===================== */
.touch-zone {
  position: absolute;
  top: 0; bottom: 0;
  width: 50%;
  z-index: 4;
}
#touchLeft { left: 0; }
#touchRight { right: 0; }

/* ===================== screens ===================== */
.screen {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(180deg, rgba(10,6,26,0.55), rgba(10,6,26,0.8));
  transition: opacity 0.25s ease;
}
.screen.hidden { display: none; }

.panel {
  width: 100%;
  max-width: 300px;
  background: rgba(255,255,255,0.09);
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 22px;
  padding: 28px 24px 26px;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 20px 50px -15px rgba(0,0,0,0.5);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}

.logo {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 800;
  margin: 0 0 2px;
  color: var(--cloud);
  letter-spacing: -0.01em;
}
.logo span { color: var(--lime); }

.subtitle {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 6px;
}

.tagline {
  margin: 0 0 14px;
  color: var(--ink-soft);
  font-weight: 700;
  font-size: 14px;
}

.dim { color: var(--ink-soft); font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }

.best-row {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  margin-bottom: 16px;
}
.best-row strong {
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--lime);
}

.btn {
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 16px;
  border: none;
  border-radius: 14px;
  padding: 14px 18px;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease, background 0.12s ease;
}
.btn:active { transform: scale(0.96); }

.btn-primary {
  background: var(--lime);
  color: var(--lime-ink);
  box-shadow: 0 8px 20px -6px rgba(198,255,61,0.6);
}
.btn-primary:hover { filter: brightness(1.06); }

.btn-ghost {
  background: rgba(255,255,255,0.1);
  color: var(--cloud);
  border: 1px solid rgba(255,255,255,0.2);
}
.btn-ghost:hover { background: rgba(255,255,255,0.16); }

.btn-text {
  background: transparent;
  color: var(--ink-soft);
  font-size: 13px;
  padding: 8px;
}
.btn-text:hover { color: var(--cloud); }

.row-buttons {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}
.row-buttons .btn { flex: 1; padding: 11px 6px; font-size: 12.5px; }

.icon-with-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.hint {
  margin: 14px 0 0;
  font-size: 12px;
  color: var(--ink-soft);
  font-weight: 700;
}

/* ---- loading ---- */
.loading-panel { align-items: center; }
.progress-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.14);
  overflow: hidden;
  margin: 6px 0 4px;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--lime), var(--glow));
  border-radius: 999px;
  transition: width 0.2s ease;
}

/* ---- game over ---- */
.score-summary {
  background: rgba(0,0,0,0.2);
  border-radius: 14px;
  padding: 10px 16px;
  margin: 6px 0 4px;
}
.score-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 6px 0;
}
.score-row:not(:last-child) { border-bottom: 1px solid rgba(255,255,255,0.08); }
.score-row strong { font-family: var(--font-display); font-size: 18px; color: var(--cloud); }

.new-record {
  margin: 0 0 4px;
  color: var(--lime);
  font-weight: 800;
  font-size: 13px;
}

.hidden { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

@media (max-width: 380px) {
  .logo { font-size: 28px; }
  .panel { padding: 22px 18px 20px; }
}
