/* ============================================
   Century Birthday - Drum Game Styles
   ============================================ */

/* --- Story Dialog --- */
#story-dialog {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 8, 24, 0.9);
  backdrop-filter: blur(6px);
  transition: opacity 0.5s ease-out;
}

#story-dialog.hidden {
  opacity: 0;
  pointer-events: none;
}

.story-card {
  text-align: center;
  animation: storyIn 0.6s ease-out;
}

@keyframes storyIn {
  from { transform: translateY(30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.story-icon {
  font-size: 4rem;
  margin-bottom: 16px;
  animation: storyBounce 1.5s ease-in-out infinite;
}

@keyframes storyBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.story-text {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--color-gold-light);
  line-height: 1.8;
  letter-spacing: 0.06em;
  margin-bottom: 32px;
  text-shadow: 0 0 20px rgba(240, 215, 140, 0.3);
}

/* --- Game Container --- */
#game-container {
  position: relative;
  width: 100vw; height: 100vh; height: 100dvh;
  overflow: hidden; background: #080818;
  touch-action: none;
}
#drum-canvas { touch-action: none; }

#drum-canvas {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
}

/* --- Touch Zones --- */
.touch-zone {
  position: absolute;
  top: 0; bottom: 0;
  width: 45%;
  z-index: 10;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  opacity: 0.06;
  transition: opacity 0.08s;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  color: rgba(255,255,255,0.25);
  pointer-events: none;
}

.touch-zone::after {
  content: '';
  pointer-events: auto;
  position: absolute;
  inset: 0;
}

.touch-zone:active,
.touch-zone.flash {
  opacity: 0.2;
}

.touch-don {
  left: 0;
  background: radial-gradient(circle at 18% 52%, rgba(255,80,60,0.8), transparent 55%);
}

.touch-ka {
  right: 0;
  background: radial-gradient(circle at 82% 52%, rgba(60,140,255,0.8), transparent 55%);
}

/* --- HUD --- */
#hud {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  z-index: 20;
  pointer-events: none;
  font-family: var(--font-display);
}

#hud-score {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-gold-light);
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

#hud-combo {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-lavender);
  opacity: 0;
  transition: opacity 0.2s;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

#hud-combo.active {
  opacity: 1;
}

#hud-accuracy {
  font-size: 1rem;
  color: var(--color-text-dim);
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

/* --- Countdown --- */
#countdown {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-display);
  font-size: 6rem;
  font-weight: 900;
  color: var(--color-gold-light);
  z-index: 30;
  pointer-events: none;
  text-shadow: 0 0 40px rgba(240,215,140,0.6);
  opacity: 0;
  transition: all 0.3s ease-out;
}

#countdown.show {
  opacity: 1;
}

/* --- Judgment Popup --- */
#judgment-popup {
  position: absolute;
  top: 35%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  z-index: 25;
  pointer-events: none;
  opacity: 0;
  transition: none;
}

/* --- Results --- */
#results {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  background: rgba(8, 8, 24, 0.85);
  backdrop-filter: blur(8px);
}

#results.hidden {
  display: none;
}

.results-card {
  background: linear-gradient(145deg, #1a1640, #0f0d28);
  border: 2px solid var(--color-gold-dark);
  border-radius: 20px;
  padding: 40px 48px;
  text-align: center;
  max-width: 420px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5),
              0 0 80px rgba(212,168,83,0.15);
  animation: cardAppear 0.5s ease-out;
}

@keyframes cardAppear {
  from { transform: scale(0.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.results-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--color-text-dim);
  margin-bottom: 8px;
  letter-spacing: 0.1em;
}

.results-grade {
  font-family: var(--font-display);
  font-size: 5rem;
  font-weight: 900;
  color: var(--color-gold-light);
  text-shadow: 0 0 40px rgba(240,215,140,0.5);
  line-height: 1;
}

.results-title-text {
  font-family: var(--font-body);
  font-size: 1.1rem;
  color: var(--color-lavender);
  margin-bottom: 20px;
  font-style: italic;
  letter-spacing: 0.05em;
}

.results-stats {
  margin-bottom: 32px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-size: 1rem;
}

.stat-label {
  color: var(--color-text-dim);
}

.stat-value {
  color: var(--color-text);
  font-weight: 600;
}

.stat-breakdown {
  font-size: 0.85rem;
  padding-left: 16px;
}

.perfect-color { color: #f0d78c; }
.good-color { color: #7eb8da; }
.ok-color { color: #b39dda; }
.miss-color { color: #db5a5a; }

.results-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* --- Keyboard hints (desktop only) --- */
@media (hover: hover) and (pointer: fine) {
  .touch-zone {
    display: none;
  }
}

@media (max-width: 768px) {
  .results-card {
    padding: 28px 24px;
  }
  .results-grade {
    font-size: 3.5rem;
  }
  #hud-score {
    font-size: 1.2rem;
  }
}
