:root {
  --bg: #F3F8FC;
  --card: #FFFFFF;
  --fg: #24364B;
  --muted: #71839A;
  --accent: #6EA8D7;
  --accent2: #A9D2F2;
  --border: #DCEAF5;
  --shadow: 0 18px 45px rgba(56, 92, 120, 0.10);
  --danger: #D77B86;
  --transition: 0.25s ease;
}

[data-theme="dark"] {
  --bg: #111821;
  --card: #1A2430;
  --fg: #EAF2F8;
  --muted: #9BAABA;
  --accent: #83BCE8;
  --accent2: #5D8DB7;
  --border: #2C3A49;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.28);
  --danger: #E18A96;
  --transition: 0.25s ease;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--fg);
  transition: background var(--transition), color var(--transition);
  overflow-x: hidden;
}

.corner-btn {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 20;
  border: none;
  background: var(--card);
  color: var(--fg);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  box-shadow: 0 4px 12px var(--shadow);
  transition: transform 0.2s ease;
}
.corner-btn:hover { transform: scale(1.1) rotate(15deg); }

.wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 48px 20px 80px;
  text-align: center;
}

h1 {
  font-size: 2.4rem;
  margin-bottom: 4px;
  letter-spacing: -0.5px;
}

.subtitle {
  margin-top: 0;
  color: #71839A;
  font-size: 1rem;
  line-height: 1.7;
}

.hud {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin-bottom: 24px;
}

.stat {
  background: var(--card);
  padding: 10px 20px;
  border-radius: 14px;
  box-shadow: 0 4px 14px var(--shadow);
  min-width: 110px;
}

.stat .label {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.stat .value {
  display: block;
  font-size: 1.6rem;
  font-weight: 700;
  margin-top: 2px;
}

.stage {
  position: relative;
  height: 260px;
  background: var(--card);
  border-radius: 24px;
  box-shadow: 0 8px 30px var(--shadow);
  overflow: hidden;
  margin-bottom: 20px;
}

.useless-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border: none;
  padding: 16px 28px;
  border-radius: 14px;
  font-size: 1.05rem;
  font-weight: 700;
  color: white;
  background: linear-gradient(135deg, #667eea, #f5576c);
  box-shadow: 0 8px 20px var(--shadow);
  cursor: pointer;
  transition: top 0.18s ease, left 0.18s ease, background 0.2s ease, transform 0.12s ease;
  white-space: nowrap;
}

.useless-btn.wobble {
  animation: wobble 0.4s ease;
}

@keyframes wobble {
  0% { transform: translate(-50%, -50%) rotate(0deg) scale(1); }
  30% { transform: translate(-50%, -50%) rotate(-8deg) scale(1.08); }
  60% { transform: translate(-50%, -50%) rotate(8deg) scale(1.08); }
  100% { transform: translate(-50%, -50%) rotate(0deg) scale(1); }
}

.useless-btn.caught {
  animation: pulseGlow 0.6s ease infinite alternate;
}

@keyframes pulseGlow {
  from { box-shadow: 0 0 0 0 rgba(255,255,255,0.5); }
  to { box-shadow: 0 0 0 14px rgba(255,255,255,0); }
}

.message {
  color: var(--muted);
  font-size: 1rem;
  min-height: 24px;
  transition: color 0.2s ease;
}

.controls {
  margin-top: 8px;
  margin-bottom: 16px;
}

.ghost-btn {
  border: 2px solid var(--muted);
  background: transparent;
  color: var(--fg);
  padding: 12px 20px;
  border-radius: 14px;
  cursor: pointer;
  font-weight: 600;
  transition: background var(--transition);
}
.ghost-btn:hover { background: var(--card); }

.hint {
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.6;
  margin-top: 20px;
}

#confettiLayer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 30;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  top: -20px;
  width: 8px;
  height: 14px;
  opacity: 0.9;
  border-radius: 2px;
  animation-name: fall;
  animation-timing-function: ease-in;
}

@keyframes fall {
  to {
    transform: translateY(110vh) rotate(720deg);
    opacity: 0.3;
  }
}

@media (max-width: 480px) {
  h1 { font-size: 1.9rem; }
  .stage { height: 220px; }
}

.title { margin-top:-18px; margin-bottom:12px; font-size:clamp(2.35rem,5vw,4rem); font-weight:800; letter-spacing:-0.045em; color:#24364B; }

