/* ========================================
   Mottes Abenteuer — Main Stylesheet
   Secret-agent mission theme for kids
   ======================================== */

/* --- Custom Properties --- */
:root {
  --bg: #1a1a2e;
  --accent: #e94560;
  --text: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.7);
  --radius: 20px;
  --transition: 0.3s ease;
}

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

body {
  font-family: 'Nunito', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  transition: background 0.5s ease;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

#app {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  position: relative;
}

/* --- Typography --- */
.headline {
  font-size: clamp(2rem, 8vw, 4rem);
  font-weight: 900;
  line-height: 1.2;
  margin-bottom: 16px;
}

.body-text {
  font-size: clamp(1.2rem, 4vw, 1.8rem);
  font-weight: 700;
  color: var(--text-secondary);
  line-height: 1.5;
  max-width: 600px;
}

.question-text {
  font-size: clamp(1.4rem, 5vw, 2rem);
  font-weight: 700;
  color: var(--text);
  line-height: 1.5;
  max-width: 600px;
}

/* --- Icon --- */
.step-icon {
  font-size: clamp(4rem, 15vw, 8rem);
  display: block;
  margin-bottom: 24px;
}

/* --- Step Image --- */
.step-image {
  width: clamp(160px, 40vw, 280px);
  height: auto;
  border-radius: 20px;
  margin-bottom: 16px;
  filter: drop-shadow(0 0 20px rgba(233, 69, 96, 0.3));
}

/* --- Buttons --- */
.btn {
  display: block;
  width: 100%;
  max-width: 400px;
  padding: 24px 32px;
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: clamp(1.4rem, 5vw, 2rem);
  font-weight: 900;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  margin: 8px auto;
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: scale(0.95);
}

.btn-primary {
  background: var(--accent);
  color: white;
  box-shadow: 0 0 30px color-mix(in srgb, var(--accent) 40%, transparent);
  animation: pulse 2s infinite;
}

.btn-success {
  background: #16c79a;
  color: white;
}

.btn-danger {
  background: #e94560;
  color: white;
}

.btn-retry {
  background: rgba(255, 255, 255, 0.15);
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

/* --- Quiz --- */
.quiz-answers {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: 400px;
  margin-top: 32px;
}

/* --- Step Content --- */
.step-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
}

/* --- Celebration --- */
.celebration {
  text-align: center;
}

.celebration .headline {
  color: #f5c518;
  text-shadow: 0 0 20px rgba(245, 197, 24, 0.5);
}

/* --- Animations --- */
@keyframes bounceIn {
  0% { transform: scale(0); opacity: 0; }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); opacity: 1; }
}

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

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 20px rgba(233, 69, 96, 0.4); }
  50% { box-shadow: 0 0 40px rgba(233, 69, 96, 0.8); }
}

@keyframes glow {
  0%, 100% { text-shadow: 0 0 10px currentColor; }
  50% { text-shadow: 0 0 30px currentColor, 0 0 60px currentColor; }
}

@keyframes swooshIn {
  from { transform: scale(0) rotate(-10deg); opacity: 0; }
  to { transform: scale(1) rotate(0); opacity: 1; }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* --- Utility Classes --- */
.fade-in { animation: fadeInUp 0.5s ease-out both; }
.fade-in-delay-1 { animation: fadeInUp 0.5s ease-out 0.3s both; }
.fade-in-delay-2 { animation: fadeInUp 0.5s ease-out 0.6s both; }
.fade-in-delay-3 { animation: fadeInUp 0.5s ease-out 0.9s both; }
.swoosh-in { animation: swooshIn 0.5s ease-out both; }
.glow { animation: glow 2s ease-in-out infinite; }
.bounce-in { animation: bounceIn 0.6s ease-out both; }

/* --- Player Bar (bottom, MiRA-style) --- */
#player-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 900;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
}

.player-progress {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: rgba(255, 255, 255, 0.15);
}

.player-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.2s linear;
}

.player-btn {
  width: 64px;
  height: 64px;
  min-width: 64px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  animation: pulse 2s infinite;
}

.player-btn:active {
  transform: scale(0.92);
}

.player-icon {
  font-size: 28px;
  line-height: 1;
}

.player-label {
  color: rgba(255, 255, 255, 0.8);
  font-size: 1rem;
  font-weight: 700;
}

/* Add bottom padding to #app when player is visible */
body.has-player #app {
  padding-bottom: 100px;
}

/* --- Message Overlay --- */
.message-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 998;
}

.message-overlay .message-text {
  font-size: clamp(2rem, 8vw, 3.5rem);
  font-weight: 900;
  color: var(--accent);
  animation: swooshIn 0.5s ease-out;
}

/* --- Loading --- */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  font-size: 4rem;
  animation: bounceIn 1s ease-out;
}

/* --- Error --- */
.error {
  text-align: center;
  padding: 48px;
}

.error-emoji {
  font-size: 4rem;
  margin-bottom: 16px;
  display: block;
}

.error-text {
  font-size: 1.5rem;
  color: var(--text-secondary);
}
