* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(8, 11, 24, 0.55) 0%, rgba(8, 11, 24, 0.82) 55%, rgba(8, 11, 24, 0.92) 100%),
    url('./assets/bg-neon-city.png') center / cover no-repeat fixed;
  font-family: system-ui, -apple-system, 'Malgun Gothic', sans-serif;
  color: #e2e8f0;
}

.wrap {
  max-width: 520px;
  margin: 0 auto;
  padding: 20px 16px 32px;
  text-align: center;
}

.hint-popup {
  position: fixed;
  top: 14px;
  left: 50%;
  z-index: 1000;
  max-width: min(92vw, 440px);
  width: max-content;
  padding: 12px 20px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.96);
  border: 1px solid rgba(251, 191, 36, 0.55);
  color: #fff7cc;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.5), 0 0 22px rgba(251, 191, 36, 0.25);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -16px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.hint-popup.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.back-link {
  display: inline-block;
  margin-bottom: 8px;
  color: #94a3b8;
  text-decoration: none;
  font-size: 14px;
}

h1 {
  margin: 4px 0;
  color: #f8fafc;
  text-shadow: 0 0 18px rgba(45, 226, 230, 0.35);
}

.subtitle {
  color: #cbd5e1;
  margin: 0 0 12px;
}

.hud {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 14px;
  color: #e2e8f0;
}

.par-count {
  padding: 5px 8px;
  border: 1px solid rgba(45, 226, 230, 0.28);
  border-radius: 999px;
  background: rgba(8, 47, 73, 0.48);
  color: #a5f3fc;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.hud button {
  min-width: 44px;
  min-height: 44px;
  border: 1px solid rgba(226, 232, 240, 0.25);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.55);
  color: #e2e8f0;
  font-size: 18px;
  cursor: pointer;
}

.board-area {
  position: relative;
  width: 100%;
  max-width: 480px;
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  border-radius: 12px;
  box-shadow: 0 0 0 1px rgba(45, 226, 230, 0.15), 0 20px 60px rgba(0, 0, 0, 0.55);
}

#board {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  border-radius: 12px;
}

.overlay {
  position: absolute;
  inset: 0;
  background: rgba(8, 11, 24, 0.82);
  color: white;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  border-radius: 12px;
  font-size: 18px;
}

.overlay-kicker {
  margin: 0;
  color: #2de2e6;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.overlay-copy {
  max-width: 270px;
  margin: 0;
  color: #cbd5e1;
  font-size: 14px;
  line-height: 1.55;
}

.overlay.hidden {
  display: none;
}

.overlay button {
  min-width: 44px;
  min-height: 44px;
  padding: 10px 24px;
  font-size: 16px;
  border: none;
  border-radius: 8px;
  background: #fbbf24;
  cursor: pointer;
}

#stageIndicator {
  font-weight: 600;
  color: #2de2e6;
}

.controls {
  margin-top: 20px;
}

.dpad {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin: 0 auto 10px;
  width: max-content;
}

.dpad-row {
  display: flex;
  gap: 6px;
}

.dpad button {
  min-width: 48px;
  min-height: 48px;
  font-size: 18px;
  border: 1px solid rgba(226, 232, 240, 0.25);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.55);
  color: #e2e8f0;
  cursor: pointer;
}

.dpad button:active {
  background: rgba(45, 226, 230, 0.25);
}

.hint {
  color: #94a3b8;
  font-size: 13px;
  min-height: 18px;
}

.hint-btn {
  margin-top: 4px;
  min-height: 40px;
  padding: 6px 18px;
  border: 1px solid rgba(251, 191, 36, 0.45);
  border-radius: 999px;
  background: rgba(251, 191, 36, 0.12);
  color: #fbbf24;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.hint-btn:active {
  background: rgba(251, 191, 36, 0.3);
}

.bottom-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.reset {
  margin-top: 16px;
  min-height: 44px;
  padding: 8px 20px;
  border: none;
  border-radius: 8px;
  background: #fbbf24;
  color: #1e293b;
  font-weight: 600;
  cursor: pointer;
}

.reset-outline {
  background: transparent;
  color: #e2e8f0;
  border: 1px solid rgba(226, 232, 240, 0.35);
}

.stage-banner {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 50;
  opacity: 0;
  transform: scale(0.7);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.stage-banner.show {
  opacity: 1;
  transform: scale(1);
}

.stage-banner span {
  font-size: clamp(30px, 11vw, 52px);
  font-weight: 900;
  letter-spacing: 0.1em;
  color: #fff7cc;
  text-shadow: 0 0 18px rgba(45, 226, 230, 0.9), 0 0 44px rgba(251, 191, 36, 0.55);
}

#confetti {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 999;
}
