/* Guess the Sound — Styles */

:root {
  --theater-bg: #2d132c;
  --stage-floor: #801336;
  --curtain-red: #c72c41;
  --curtain-shadow: #871025;
  --gold-accent: #f8b500;
  --card-bg: #ffffff;
  --card-border: #f0e6d6;
  --accent-green: #2ecc71;
  --accent-orange: #f39c12;
}

body {
  background: radial-gradient(circle at 50% 20%, #44173d 0%, #1f0b24 100%);
  margin: 0;
  padding: 0;
  color: #fff;
  font-family: inherit;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  overflow-x: hidden;
}

.game-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  min-height: 100vh;
  min-height: 100dvh;
  max-width: 840px;
  margin: 0 auto;
  padding: 8px 16px 16px;
  padding-top: max(8px, env(safe-area-inset-top));
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
  box-sizing: border-box;
  overflow-y: auto;
}

.game-header {
  width: 100%;
  box-sizing: border-box;
}

.status-bar {
  display: flex;
  justify-content: flex-end;
  width: 100%;
  margin-bottom: 4px;
}

.score-badge {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 1.1rem;
  font-weight: 800;
  color: #ffe066;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.instruction-banner {
  margin: 4px 0 10px;
  font-size: 1.15rem;
  font-weight: 700;
  text-align: center;
  color: #fff8e7;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

/* Theater Stage */
.theater-stage {
  position: relative;
  width: 100%;
  height: 230px;
  max-width: 580px;
  background: linear-gradient(180deg, #1b0a2a 0%, #3a1532 80%, #681d33 100%);
  border: 8px solid #f8b500;
  border-bottom: 12px solid #5a1224;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5), inset 0 0 40px rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

/* Revealed Content */
.backstage-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1;
  text-align: center;
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 0.35s ease 0.2s, transform 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275) 0.2s;
  pointer-events: none;
  max-width: 90%;
  padding: 0 12px;
  box-sizing: border-box;
}

.stage-open .backstage-content {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
  cursor: pointer;
}

.character-avatar {
  font-family: var(--font-emoji);
  font-variant-emoji: emoji;
  font-size: 5rem;
  line-height: 1;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.4));
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.stage-open .character-avatar {
  animation: happyJump 1s infinite alternate ease-in-out;
}

.character-title {
  margin-top: 8px;
  font-size: 1.25rem;
  font-weight: 800;
  color: #ffeaa7;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
  word-break: break-word;
  overflow-wrap: break-word;
}

/* Red Velvet Curtains */
.curtain {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 52%;
  z-index: 2;
  background: repeating-linear-gradient(
    90deg,
    #b81b34 0px,
    #991429 20px,
    #d12743 35px,
    #8f1025 50px
  );
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.6);
  transition: transform 0.75s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}

.curtain-left {
  left: 0;
  transform-origin: left center;
  border-right: 2px solid rgba(248, 181, 0, 0.4);
}

.curtain-right {
  right: 0;
  transform-origin: right center;
  border-left: 2px solid rgba(248, 181, 0, 0.4);
}

.stage-open .curtain-left {
  transform: translateX(-90%) scaleX(0.4);
}

.stage-open .curtain-right {
  transform: translateX(90%) scaleX(0.4);
}

/* Listen Button in Center */
.listen-btn {
  position: absolute;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f8b500 0%, #f39c12 100%);
  border: 4px solid #fff;
  border-radius: 50px;
  padding: 12px 26px;
  max-width: 90%;
  box-sizing: border-box;
  color: #4a2300;
  font-family: inherit;
  font-weight: 800;
  font-size: 1.15rem;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(248, 181, 0, 0.5), 0 3px 0 #b37400;
  transition: transform 0.2s, opacity 0.3s;
  animation: pulseGlow 2.5s infinite ease-in-out;
}

.listen-btn:disabled {
  pointer-events: none;
}

.listen-btn:hover {
  transform: scale(1.06);
}

.listen-btn:active {
  transform: scale(0.96) translateY(2px);
  box-shadow: 0 4px 12px rgba(248, 181, 0, 0.4);
}

.stage-open .listen-btn {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.6);
}

.listen-icon {
  font-size: 2.2rem;
  line-height: 1;
  margin-bottom: 2px;
}

.listen-text {
  font-size: 1.05rem;
  text-align: center;
  word-break: break-word;
}

/* Sound Waves Ripple */
.sound-ripple {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  border: 3px solid rgba(248, 181, 0, 0.7);
  border-radius: 50px;
  transform: translate(-50%, -50%) scale(1);
  pointer-events: none;
  opacity: 0;
}

.is-playing .ripple-1 {
  animation: rippleFx 1.2s infinite ease-out;
}

.is-playing .ripple-2 {
  animation: rippleFx 1.2s infinite ease-out 0.4s;
}

/* Options Grid */
.options-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  width: 100%;
  max-width: 680px;
  margin: 6px 0 12px;
}

.option-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--card-bg);
  border: 4px solid var(--card-border);
  border-radius: 20px;
  padding: 16px 8px;
  min-height: 120px;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.2s, box-shadow 0.2s;
  color: #2c3e50;
  font-family: inherit;
  font-weight: 700;
  position: relative;
  outline: none;
}

.option-card:hover:not(:disabled) {
  transform: translateY(-4px) scale(1.03);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.35);
  border-color: #f8b500;
}

.option-card:active:not(:disabled) {
  transform: scale(0.96);
}

.option-card:disabled {
  cursor: default;
}

.option-card:disabled:not(.correct) {
  opacity: 0.55;
  filter: grayscale(0.25);
}

.option-card.correct {
  border-color: #2ecc71;
  background: #eafaf1;
  animation: popSuccess 0.5s ease-out;
}

.option-card.wrong {
  border-color: #e67e22;
  background: #fdf2e9;
  animation: cardWobble 0.45s ease-in-out;
}

.card-emoji {
  font-size: 3.2rem;
  line-height: 1;
  margin-bottom: 8px;
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.15));
}

.card-label {
  font-size: 0.95rem;
  text-align: center;
  line-height: 1.2;
  word-break: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

/* Bottom Actions and Feedback */
.bottom-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60px;
  width: 100%;
}

.feedback-msg {
  font-size: 1.15rem;
  font-weight: 800;
  text-align: center;
  color: #ffeaa7;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
  min-height: 28px;
}

.action-btn {
  background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
  border: 3px solid #fff;
  border-radius: 40px;
  color: #fff;
  font-family: inherit;
  font-weight: 800;
  font-size: 1.2rem;
  padding: 12px 32px;
  margin-top: 8px;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(46, 204, 113, 0.4), 0 3px 0 #1e8449;
  transition: transform 0.2s, box-shadow 0.2s;
  animation: popIn 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.action-btn:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 8px 22px rgba(46, 204, 113, 0.6);
}

.action-btn:active {
  transform: translateY(2px) scale(0.97);
}

/* Accessibility Focus Visible */
.option-card:focus-visible,
.listen-btn:focus-visible,
.action-btn:focus-visible,
.backstage-content:focus-visible {
  outline: 4px solid var(--gold-accent, #f8b500);
  outline-offset: 3px;
}

/* Particle FX Overlay */
.fx-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 10;
  overflow: hidden;
}

.sparkle-particle {
  position: absolute;
  font-size: 1.8rem;
  animation: floatFade 1.2s forwards ease-out;
}

/* Keyframes */
@keyframes pulseGlow {
  0%, 100% {
    box-shadow: 0 8px 24px rgba(248, 181, 0, 0.5), 0 3px 0 #b37400;
  }
  50% {
    box-shadow: 0 10px 32px rgba(248, 181, 0, 0.8), 0 3px 0 #b37400;
  }
}

@keyframes rippleFx {
  0% {
    transform: translate(-50%, -50%) scale(0.9);
    opacity: 0.8;
  }
  100% {
    transform: translate(-50%, -50%) scale(1.6);
    opacity: 0;
  }
}

@keyframes happyJump {
  0% {
    transform: translateY(0) scale(1);
  }
  100% {
    transform: translateY(-16px) scale(1.08);
  }
}

@keyframes cardWobble {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px) rotate(-2deg); }
  75% { transform: translateX(6px) rotate(2deg); }
}

@keyframes popSuccess {
  0% { transform: scale(0.9); }
  50% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

@keyframes popIn {
  0% { transform: scale(0.6); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes floatFade {
  0% {
    transform: translateY(0) scale(0.6) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(-80px) scale(1.3) rotate(45deg);
    opacity: 0;
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .curtain, .character-avatar, .listen-btn, .option-card, .sound-ripple, .action-btn, .sparkle-particle, .backstage-content {
    animation: none !important;
    transition: none !important;
  }
}

/* Mobile responsive */
@media (max-width: 540px) {
  .theater-stage {
    height: 190px;
  }
  .character-avatar {
    font-size: 3.8rem;
  }
  .card-emoji {
    font-size: 2.5rem;
  }
  .card-label {
    font-size: 0.85rem;
  }
  .listen-btn {
    padding: 10px 18px;
  }
  .listen-icon {
    font-size: 1.8rem;
  }
  .listen-text {
    font-size: 0.95rem;
  }
}

/* Landscape / compact height */
@media (max-height: 520px) and (orientation: landscape) {
  .game-container {
    padding: 4px 12px 8px;
    justify-content: flex-start;
  }
  .status-bar {
    margin-bottom: 2px;
  }
  .instruction-banner {
    margin: 2px 0 6px;
    font-size: 0.95rem;
  }
  .theater-stage {
    height: 135px;
    max-width: 440px;
    margin-bottom: 6px;
  }
  .character-avatar {
    font-size: 2.8rem;
  }
  .character-title {
    font-size: 0.95rem;
    margin-top: 4px;
  }
  .listen-btn {
    padding: 8px 16px;
    font-size: 0.95rem;
  }
  .listen-icon {
    font-size: 1.4rem;
  }
  .options-grid {
    gap: 8px;
    margin: 4px 0 6px;
    max-width: 520px;
  }
  .option-card {
    min-height: 75px;
    padding: 8px 4px;
  }
  .card-emoji {
    font-size: 1.8rem;
    margin-bottom: 2px;
  }
  .card-label {
    font-size: 0.78rem;
  }
  .bottom-actions {
    min-height: 40px;
  }
  .action-btn {
    padding: 6px 22px;
    font-size: 1rem;
    margin-top: 4px;
  }
}
