* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: #0a0812;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Orbitron', monospace;
  overflow: hidden;
}

.back-link {
  position: fixed;
  top: 16px;
  left: 16px;
  color: rgba(200, 160, 220, 0.6);
  font-size: 0.7rem;
  text-decoration: none;
  letter-spacing: 0.05em;
  z-index: 100;
  transition: color 0.2s;
}

.back-link:hover {
  color: #f472b6;
}

#game-container {
  position: relative;
  width: min(100vw, 440px);
  padding: 20px;
  border-radius: 16px;
  background: linear-gradient(160deg, #12081a 0%, #0d1020 50%, #081018 100%);
  border: 1px solid rgba(200, 120, 180, 0.2);
  box-shadow:
    0 0 60px rgba(200, 80, 160, 0.15),
    0 0 100px rgba(100, 60, 200, 0.1);
}

#header h1 {
  font-size: 0.85rem;
  letter-spacing: 0.2em;
  text-align: center;
  background: linear-gradient(90deg, #f472b6, #c084fc, #38bdf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 16px;
}

#stats {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.stat .label {
  font-size: 0.5rem;
  letter-spacing: 0.12em;
  color: rgba(180, 150, 200, 0.5);
}

.stat span:last-child {
  font-size: 0.9rem;
  font-weight: 700;
  color: #f0e0ff;
  text-shadow: 0 0 8px rgba(200, 120, 255, 0.5);
}

#stage {
  color: #f472b6;
  text-shadow: 0 0 8px rgba(244, 114, 182, 0.6);
}

#progress-bar {
  height: 4px;
  background: rgba(100, 60, 140, 0.3);
  border-radius: 2px;
  margin-bottom: 10px;
  overflow: hidden;
}

#progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #c084fc, #f472b6);
  border-radius: 2px;
  transition: width 0.3s ease;
  box-shadow: 0 0 8px rgba(200, 120, 255, 0.6);
}

#moves.low {
  color: #f87171 !important;
  text-shadow: 0 0 10px rgba(248, 113, 113, 0.6) !important;
}

#combo-bar {
  text-align: center;
  margin-bottom: 8px;
  height: 24px;
  transition: opacity 0.3s;
}

#combo-bar.hidden {
  opacity: 0;
}

#combo-text {
  font-size: 0.75rem;
  font-weight: 700;
  color: #fbbf24;
  text-shadow: 0 0 12px rgba(251, 191, 36, 0.8);
  letter-spacing: 0.1em;
  animation: pulse 0.4s ease infinite alternate;
}

@keyframes pulse {
  from { transform: scale(1); }
  to { transform: scale(1.08); }
}

#board {
  display: block;
  width: 100%;
  border-radius: 10px;
  cursor: pointer;
  touch-action: none;
}

#overlay, #result, #stage-clear {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(8, 6, 16, 0.9);
  backdrop-filter: blur(8px);
  border-radius: 16px;
  z-index: 20;
  text-align: center;
  padding: 24px;
  transition: opacity 0.35s ease;
}

#overlay.hidden, #result.hidden, #stage-clear.hidden {
  opacity: 0;
  pointer-events: none;
}

#overlay h2, #result h2 {
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  margin-bottom: 10px;
}

#overlay h2 {
  background: linear-gradient(135deg, #f472b6, #c084fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

#result h2.win {
  color: #4ade80;
  text-shadow: 0 0 20px rgba(74, 222, 128, 0.5);
}

#result h2.lose {
  color: #f87171;
  text-shadow: 0 0 20px rgba(248, 113, 113, 0.5);
}

#stage-clear h2 {
  color: #4ade80;
  text-shadow: 0 0 20px rgba(74, 222, 128, 0.5);
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  margin-bottom: 10px;
}

.stage-clear-msg,
.stage-clear-score {
  color: rgba(200, 200, 255, 0.75);
  font-size: 0.8rem;
  margin-bottom: 8px;
}

.next-stage-hint {
  color: rgba(180, 160, 210, 0.6);
  font-size: 0.65rem;
  margin-bottom: 24px;
}

#cleared-stage,
#stage-clear-score {
  color: #e9d5ff;
  font-weight: 700;
}

.subtitle {
  color: rgba(200, 180, 220, 0.65);
  font-size: 0.7rem;
  margin-bottom: 20px;
}

.rules {
  list-style: none;
  color: rgba(180, 160, 210, 0.6);
  font-size: 0.65rem;
  line-height: 2;
  margin-bottom: 28px;
}

.rules strong {
  color: #e9d5ff;
}

#result p {
  color: rgba(200, 200, 255, 0.75);
  font-size: 0.85rem;
  margin-bottom: 24px;
}

button {
  font-family: 'Orbitron', monospace;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  padding: 14px 40px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  background: linear-gradient(135deg, #db2777, #7c3aed);
  color: white;
  box-shadow: 0 0 30px rgba(219, 39, 119, 0.4);
  transition: transform 0.15s, box-shadow 0.15s;
}

button:hover {
  transform: scale(1.05);
  box-shadow: 0 0 40px rgba(219, 39, 119, 0.6);
}

button:active {
  transform: scale(0.97);
}
