/* ============================================
   Century Birthday - Haircut 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.2rem;
  color: var(--color-gold-light);
  line-height: 2;
  letter-spacing: 0.05em;
  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: linear-gradient(180deg, #1a1640 0%, #0f0d28 50%, #0a0820 100%);
  touch-action: none;
}
#haircut-canvas {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  touch-action: none;
}

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

#hud-round {
  font-size: 1rem;
  color: var(--color-lavender);
}

#hud-score {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--color-gold-light);
}

/* --- Target Hint --- */
#target-hint {
  position: absolute;
  top: 8%;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--color-text-dim);
  z-index: 20;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s;
}

#target-hint.show { opacity: 1; }

/* --- Speech Bubble --- */
#speech-bubble {
  position: absolute;
  top: 12%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(40, 20, 20, 0.92);
  color: #ff8a80;
  font-family: var(--font-body);
  font-size: 1.1rem;
  padding: 12px 24px;
  border-radius: 16px;
  border: 1px solid rgba(255, 100, 80, 0.4);
  z-index: 30;
  pointer-events: none;
  text-align: center;
  white-space: nowrap;
  animation: bubbleIn 0.3s ease-out;
}

#speech-bubble::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 10px solid rgba(40, 20, 20, 0.92);
}

#speech-bubble.hidden { display: none; }

@keyframes bubbleIn {
  from { transform: translateX(-50%) translateY(10px); opacity: 0; }
  to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

/* --- Cut Button --- */
#cut-btn {
  position: absolute;
  bottom: 36px;
  left: 50%;
  transform: translateX(-50%);
  padding: 16px 48px;
  border-radius: 30px;
  background: linear-gradient(135deg, #d4a853, #f0d78c);
  border: 3px solid #a67c30;
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  color: #3a2a10;
  letter-spacing: 0.08em;
  z-index: 25;
  cursor: pointer;
  box-shadow: 0 6px 30px rgba(212, 168, 83, 0.4);
  transition: all 0.1s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

#cut-btn:hover {
  box-shadow: 0 8px 40px rgba(212, 168, 83, 0.6);
  background: linear-gradient(135deg, #e8b860, #f8e8a0);
}

#cut-btn:active {
  transform: translateX(-50%) scale(0.93);
  box-shadow: 0 2px 10px rgba(212, 168, 83, 0.3);
}

#cut-btn.disabled {
  opacity: 0.35;
  pointer-events: none;
}

/* --- Round Popup --- */
#round-popup {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  z-index: 30;
  pointer-events: none;
  text-shadow: 0 0 20px rgba(240,215,140,0.5);
  text-align: center;
}

#round-popup.hidden { display: 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: 36px 44px;
  text-align: center;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  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.2rem;
  color: var(--color-text-dim);
  margin-bottom: 4px;
  letter-spacing: 0.1em;
}

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

.results-comment {
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--color-lavender);
  margin-bottom: 20px;
  font-style: italic;
}

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

.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; }

.perfect-color { color: #f0d78c; }
.miss-color { color: #db5a5a; }

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

/* --- Responsive --- */
@media (max-width: 768px) {
  #cut-btn { padding: 14px 36px; font-size: 1.1rem; bottom: 28px; }
  .story-text { font-size: 1rem; }
}

@media (max-width: 480px) {
  #cut-btn { padding: 12px 28px; font-size: 1rem; bottom: 20px; }
}
