/* style.css — Bouncy Bloom */
:root {
  --bg-0: #140a2e;
  --bg-1: #1f1244;
  --panel: rgba(28, 18, 58, 0.86);
  --panel-border: rgba(255, 255, 255, 0.12);
  --ink: #f4ecff;
  --ink-dim: #b9a8e0;
  --accent: #ff8a4a;
  --accent-2: #ffd84d;
  --pink: #ff7ab8;
  --green: #8ad36a;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  color-scheme: dark;
}

html[data-theme="light"] {
  --bg-0: #b8e3f7;
  --bg-1: #e7f7c8;
  --panel: rgba(255, 255, 255, 0.92);
  --panel-border: rgba(20, 20, 50, 0.12);
  --ink: #2a1a4a;
  --ink-dim: #5a4a78;
  --accent: #f56a2a;
  --accent-2: #f0b400;
  --pink: #e85aa0;
  --shadow: 0 10px 30px rgba(60, 40, 90, 0.18);
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: linear-gradient(160deg, var(--bg-0), var(--bg-1));
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.app {
  height: 100%;
  display: flex;
  flex-direction: column;
  max-width: 1100px;
  margin: 0 auto;
  padding: 8px;
  gap: 8px;
}

/* HUD */
.hud {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}
.hud-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  padding: 8px 14px;
  border-radius: 999px;
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow);
  min-width: 96px;
  justify-content: center;
}
.hud-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--ink-dim);
}
.hud-value {
  font-weight: 800;
  font-size: 18px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.hud-item.coin .hud-coin {
  color: var(--accent-2);
  font-size: 16px;
  text-shadow: 0 0 8px rgba(255, 216, 77, 0.6);
}
.hud-item.coin .hud-value { color: var(--accent-2); }

/* Stage */
.stage {
  position: relative;
  flex: 1;
  min-height: 0;
  border-radius: 22px;
  overflow: hidden;
  box-shadow: var(--shadow), inset 0 0 0 1px var(--panel-border);
  background: #2a1d5e;
}
#game {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

/* Overlays */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(circle at center, rgba(20, 10, 46, 0.55), rgba(20, 10, 46, 0.85));
  backdrop-filter: blur(4px);
  animation: fadeIn 0.3s ease;
  z-index: 5;
}
.overlay.hidden { display: none; }

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  padding: 28px 26px;
  text-align: center;
  box-shadow: var(--shadow);
  max-width: 380px;
  width: 100%;
}

.title {
  font-size: 44px;
  font-weight: 900;
  letter-spacing: -1px;
  margin: 0 0 4px;
  color: var(--accent);
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.25), 0 0 22px rgba(255, 138, 74, 0.45);
}
.title.small { font-size: 36px; color: var(--pink); text-shadow: 0 3px 0 rgba(0,0,0,0.25), 0 0 22px rgba(255,122,184,0.5); }
.subtitle { color: var(--ink-dim); margin: 0 0 16px; font-size: 14px; }

.title-bounce {
  display: inline-block;
  animation: hop 1.6s ease-in-out infinite;
}
.title-bounce.d1 { animation-delay: 0.08s; color: var(--accent-2); }
.title-bounce.d2 { animation-delay: 0.16s; color: var(--pink); }
.title-bounce.d3 { animation-delay: 0.24s; color: var(--green); }
.title-bounce.d4 { animation-delay: 0.32s; color: var(--accent-2); }
.title-bounce.d5 { animation-delay: 0.40s; color: var(--pink); }

@keyframes hop {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.howto {
  list-style: none;
  padding: 0;
  margin: 0 0 20px;
  text-align: left;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.9;
}
.howto li { padding-left: 22px; position: relative; }
.howto li::before { content: "✦"; position: absolute; left: 0; color: var(--accent-2); }
.howto b {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  padding: 1px 7px;
  font-size: 12px;
  color: var(--ink);
}

.btn {
  font: inherit;
  font-weight: 800;
  border: none;
  border-radius: 999px;
  padding: 13px 28px;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
  font-size: 16px;
}
.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #3a1a00;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.25), 0 8px 20px rgba(255, 138, 74, 0.4);
}
.btn.primary:hover { transform: translateY(-2px); filter: brightness(1.05); }
.btn.primary:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.25); }

.result {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 14px 0 10px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.18);
  border-radius: 14px;
  border: 1px solid var(--panel-border);
}
.result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 15px;
  color: var(--ink-dim);
}
.result-row b { color: var(--ink); font-size: 18px; font-variant-numeric: tabular-nums; }
.best-line { color: var(--accent-2); font-weight: 700; margin: 6px 0 18px; }

/* Touch controls */
.touch-controls {
  display: none;
  gap: 10px;
  justify-content: space-between;
  align-items: center;
  padding: 4px 6px;
}
.touch-controls.show { display: flex; }
.tbtn {
  flex: 1;
  font: inherit;
  font-weight: 800;
  font-size: 18px;
  border: 1px solid var(--panel-border);
  background: var(--panel);
  color: var(--ink);
  border-radius: 18px;
  padding: 16px 0;
  cursor: pointer;
  box-shadow: var(--shadow);
  touch-action: none;
  transition: transform 0.08s ease, background 0.1s ease;
}
.tbtn:active { transform: scale(0.95); background: rgba(255, 138, 74, 0.3); }
.tbtn.jump {
  flex: 1.4;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #3a1a00;
}

@media (max-width: 540px) {
  .title { font-size: 36px; }
  .panel { padding: 22px 18px; }
  .hud-value { font-size: 16px; }
  .hud-item { padding: 7px 11px; min-width: 80px; }
}

@media (prefers-reduced-motion: reduce) {
  .title-bounce { animation: none; }
  .overlay { animation: none; }
}
