/* =============================================
   BIBLE BOWL BONANZA — STYLES
   ============================================= */

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

:root {
  --purple:  #7c3aed;
  --purple2: #a855f7;
  --blue:    #2563eb;
  --blue2:   #60a5fa;
  --gold:    #f59e0b;
  --gold2:   #fcd34d;
  --green:   #16a34a;
  --green2:  #4ade80;
  --red:     #dc2626;
  --red2:    #f87171;
  --pink:    #ec4899;
  --orange:  #ea580c;
  --teal:    #0891b2;
  --bg:      #0f0a2e;
  --card:    rgba(255,255,255,0.07);
  --radius:  18px;
  --shadow:  0 8px 32px rgba(0,0,0,0.4);
}

html, body {
  height: 100%;
  font-family: 'Nunito', sans-serif;
  background: var(--bg);
  color: #fff;
  overflow: hidden;
}

/* Animated background gradient */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #0f0a2e 0%, #1e0a4e 40%, #0a1a3e 100%);
  z-index: -2;
}
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at 20% 20%, rgba(124,58,237,0.25) 0%, transparent 60%),
              radial-gradient(ellipse at 80% 80%, rgba(37,99,235,0.2) 0%, transparent 60%);
  z-index: -1;
  animation: bgPulse 8s ease-in-out infinite alternate;
}
@keyframes bgPulse {
  from { opacity: 0.6; }
  to   { opacity: 1; }
}

/* =============================================
   CONFETTI CANVAS
   ============================================= */
#confettiCanvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
}

/* =============================================
   SCREENS
   ============================================= */
.screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
  overflow-y: auto;
}
.screen.active {
  opacity: 1;
  pointer-events: all;
}
.screen.slide-out {
  animation: slideOut 0.35s ease forwards;
}
.screen.slide-in {
  animation: slideIn 0.35s ease forwards;
}
@keyframes slideOut {
  to { opacity: 0; transform: translateY(-40px) scale(0.96); }
}
@keyframes slideIn {
  from { opacity: 0; transform: translateY(40px) scale(0.96); }
  to   { opacity: 1; transform: none; }
}

/* =============================================
   WELCOME SCREEN
   ============================================= */
.welcome-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  max-width: 480px;
  width: 100%;
  text-align: center;
}

.logo-wrap {
  position: relative;
  margin-bottom: 8px;
}
.logo-title {
  font-family: 'Fredoka One', cursive;
  font-size: clamp(2.8rem, 10vw, 4.5rem);
  line-height: 1.1;
  background: linear-gradient(135deg, #fcd34d, #f59e0b, #ec4899, #a855f7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 2px 12px rgba(245,158,11,0.5));
  animation: logoFloat 3s ease-in-out infinite;
}
@keyframes logoFloat {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-8px); }
}
.logo-sub {
  font-size: clamp(3rem, 12vw, 5.5rem);
  display: block;
}
.logo-book {
  font-size: 3.5rem;
  margin-top: -8px;
  animation: bookBounce 2s ease-in-out infinite;
}
@keyframes bookBounce {
  0%, 100% { transform: rotate(-5deg) scale(1); }
  50%       { transform: rotate(5deg)  scale(1.1); }
}
.logo-star {
  position: absolute;
  font-size: 1.4rem;
  color: var(--gold2);
  animation: starSpin 4s linear infinite;
}
.star-1 { top: -10px; left: -20px; animation-duration: 3s; }
.star-2 { top: 10px;  right: -24px; animation-duration: 5s; color: var(--pink); }
.star-3 { bottom: -5px; left: 40px; animation-duration: 4s; color: var(--blue2); }
@keyframes starSpin {
  from { transform: rotate(0deg) scale(1); }
  50%  { transform: rotate(180deg) scale(1.4); }
  to   { transform: rotate(360deg) scale(1); }
}

.welcome-tagline {
  font-size: 1.15rem;
  font-weight: 700;
  color: rgba(255,255,255,0.75);
  line-height: 1.5;
}

.high-score-display {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 50px;
  padding: 8px 24px;
  font-size: 1rem;
  font-weight: 800;
  color: var(--gold2);
  min-height: 36px;
}

.btn-play {
  font-family: 'Fredoka One', cursive;
  font-size: clamp(1.4rem, 5vw, 1.8rem);
  padding: 16px 56px;
  border: none;
  border-radius: 50px;
  background: linear-gradient(135deg, var(--gold), var(--orange), var(--pink));
  color: #fff;
  cursor: pointer;
  box-shadow: 0 6px 30px rgba(245,158,11,0.5), 0 2px 0 rgba(0,0,0,0.3);
  transition: transform 0.15s, box-shadow 0.15s;
  letter-spacing: 1px;
}
.btn-play:hover  { transform: translateY(-3px) scale(1.03); box-shadow: 0 10px 40px rgba(245,158,11,0.6); }
.btn-play:active { transform: translateY(1px)  scale(0.98); }

.pulse-anim { animation: pulse 2s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 6px 30px rgba(245,158,11,0.5), 0 0 0 0 rgba(245,158,11,0.4); }
  50%       { box-shadow: 0 6px 30px rgba(245,158,11,0.6), 0 0 0 18px rgba(245,158,11,0); }
}

.question-count-note {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.4);
}

/* =============================================
   HUD
   ============================================= */
#screen-game {
  justify-content: flex-start;
  padding-top: 12px;
}

.hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 680px;
  padding: 10px 16px;
  background: rgba(255,255,255,0.06);
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,0.1);
  backdrop-filter: blur(8px);
}
.hud-label {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 2px;
  color: rgba(255,255,255,0.5);
  display: block;
}
.hud-value {
  font-family: 'Fredoka One', cursive;
  font-size: 1.5rem;
  color: var(--gold2);
  display: block;
  text-align: center;
}
.hud-score, .hud-progress { text-align: center; }

.hud-streak {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 80px;
  justify-content: center;
}
.streak-fire { font-size: 1.6rem; line-height: 1; }
.hud-streak-val {
  font-family: 'Fredoka One', cursive;
  font-size: 1.2rem;
  color: var(--gold2);
}

.progress-bar-wrap {
  width: 100%;
  max-width: 680px;
  height: 8px;
  background: rgba(255,255,255,0.1);
  border-radius: 50px;
  margin: 8px 0;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--purple2), var(--pink), var(--gold));
  border-radius: 50px;
  width: 0%;
  transition: width 0.5s ease;
}

/* =============================================
   QUESTION CARD
   ============================================= */
.question-card {
  width: 100%;
  max-width: 680px;
  background: var(--card);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin: 8px 0;
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
  transition: background 0.3s;
}
.question-card.flash-correct {
  animation: flashGreen 0.5s ease;
}
.question-card.flash-wrong {
  animation: flashOrange 0.5s ease;
}
@keyframes flashGreen {
  0%   { background: var(--card); }
  30%  { background: rgba(22,163,74,0.35); border-color: var(--green2); }
  100% { background: var(--card); }
}
@keyframes flashOrange {
  0%   { background: var(--card); }
  30%  { background: rgba(234,88,12,0.3); border-color: #fb923c; }
  100% { background: var(--card); }
}

.question-number {
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--purple2);
  text-transform: uppercase;
  margin-bottom: 8px;
}
.question-text {
  font-size: clamp(1rem, 3.5vw, 1.2rem);
  font-weight: 700;
  line-height: 1.5;
  color: #fff;
}

/* =============================================
   ANSWER BUTTONS
   ============================================= */
.answers-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
  max-width: 680px;
}

.answer-btn {
  font-family: 'Nunito', sans-serif;
  font-size: clamp(0.85rem, 2.8vw, 1rem);
  font-weight: 700;
  padding: 14px 16px;
  border: 2px solid rgba(255,255,255,0.15);
  border-radius: var(--radius);
  background: rgba(255,255,255,0.07);
  color: #fff;
  cursor: pointer;
  text-align: left;
  line-height: 1.35;
  transition: transform 0.15s, border-color 0.15s, background 0.15s, box-shadow 0.15s;
  min-height: 58px;
  position: relative;
  overflow: hidden;
}
.answer-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent, rgba(255,255,255,0.05));
  opacity: 0;
  transition: opacity 0.2s;
}
.answer-btn:hover:not(:disabled)::before { opacity: 1; }
.answer-btn:hover:not(:disabled) {
  transform: translateY(-2px) scale(1.01);
  border-color: var(--purple2);
  box-shadow: 0 6px 20px rgba(124,58,237,0.3);
}
.answer-btn:active:not(:disabled) { transform: scale(0.97); }

/* Answer states */
.answer-btn.correct {
  background: linear-gradient(135deg, rgba(22,163,74,0.5), rgba(74,222,128,0.3));
  border-color: var(--green2);
  box-shadow: 0 0 20px rgba(74,222,128,0.4);
  animation: correctBounce 0.4s ease;
}
@keyframes correctBounce {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.05); }
  70%  { transform: scale(0.97); }
  100% { transform: scale(1); }
}
.answer-btn.wrong {
  background: rgba(220,38,38,0.25);
  border-color: var(--red2);
  animation: wrongShake 0.4s ease;
}
@keyframes wrongShake {
  0%,100% { transform: translateX(0); }
  20%     { transform: translateX(-6px); }
  40%     { transform: translateX(6px); }
  60%     { transform: translateX(-4px); }
  80%     { transform: translateX(4px); }
}
.answer-btn.highlight-correct {
  background: linear-gradient(135deg, rgba(22,163,74,0.45), rgba(74,222,128,0.25));
  border-color: var(--green2);
  box-shadow: 0 0 18px rgba(74,222,128,0.35);
  animation: highlightPulse 0.8s ease infinite alternate;
}
@keyframes highlightPulse {
  from { box-shadow: 0 0 12px rgba(74,222,128,0.3); }
  to   { box-shadow: 0 0 28px rgba(74,222,128,0.6); }
}
.answer-btn:disabled { cursor: default; }

/* Answer letter badge */
.answer-btn .ans-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  font-size: 0.8rem;
  font-weight: 800;
  margin-right: 8px;
  flex-shrink: 0;
  vertical-align: middle;
}

/* =============================================
   FEEDBACK STRIP
   ============================================= */
.feedback-strip {
  width: 100%;
  max-width: 680px;
  min-height: 36px;
  border-radius: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 800;
  transition: all 0.3s;
  margin-top: 4px;
}
.feedback-strip.show-wrong {
  background: rgba(234,88,12,0.2);
  border: 1px solid #fb923c;
  color: #fed7aa;
  animation: feedbackSlide 0.3s ease;
}
.feedback-strip.show-correct {
  background: rgba(22,163,74,0.2);
  border: 1px solid var(--green2);
  color: #bbf7d0;
  animation: feedbackSlide 0.3s ease;
}
@keyframes feedbackSlide {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

/* =============================================
   SCORE POPUP
   ============================================= */
.score-popup {
  position: fixed;
  top: 40%;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Fredoka One', cursive;
  font-size: 2.5rem;
  color: var(--gold2);
  text-shadow: 0 2px 12px rgba(0,0,0,0.5);
  pointer-events: none;
  opacity: 0;
  z-index: 1000;
}
.score-popup.pop {
  animation: scorePopAnim 0.9s ease forwards;
}
@keyframes scorePopAnim {
  0%   { opacity: 0; transform: translateX(-50%) scale(0.5) translateY(0); }
  20%  { opacity: 1; transform: translateX(-50%) scale(1.2) translateY(-10px); }
  60%  { opacity: 1; transform: translateX(-50%) scale(1.0) translateY(-30px); }
  100% { opacity: 0; transform: translateX(-50%) scale(0.8) translateY(-60px); }
}

/* =============================================
   WHEEL SCREEN
   ============================================= */
.wheel-screen-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  max-width: 420px;
  width: 100%;
}

.wheel-title {
  font-family: 'Fredoka One', cursive;
  font-size: clamp(1.5rem, 5vw, 2rem);
  text-align: center;
  background: linear-gradient(135deg, var(--gold2), var(--pink));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.score-earned {
  font-family: 'Fredoka One', cursive;
  font-size: 1.3rem;
  color: var(--green2);
  background: rgba(22,163,74,0.15);
  border: 1px solid rgba(74,222,128,0.3);
  border-radius: 50px;
  padding: 6px 24px;
  min-height: 36px;
}

.wheel-wrap {
  position: relative;
  width: 340px;
  height: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.wheel-pointer {
  font-size: 2.2rem;
  color: var(--gold2);
  line-height: 1;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
  z-index: 10;
  position: relative;
  top: 6px;
  filter: drop-shadow(0 0 8px rgba(245,158,11,0.7));
}
#wheelCanvas {
  border-radius: 50%;
  box-shadow: 0 0 40px rgba(124,58,237,0.5), 0 0 80px rgba(236,72,153,0.2);
  border: 4px solid rgba(255,255,255,0.15);
}

.btn-spin {
  font-family: 'Fredoka One', cursive;
  font-size: 1.5rem;
  padding: 14px 48px;
  border: none;
  border-radius: 50px;
  background: linear-gradient(135deg, var(--purple), var(--pink));
  color: #fff;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(124,58,237,0.5);
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.2s;
  animation: pulse 2s ease-in-out infinite;
}
.btn-spin:hover  { transform: translateY(-2px) scale(1.04); }
.btn-spin:active { transform: scale(0.96); }
.btn-spin:disabled { opacity: 0.4; cursor: default; animation: none; }

.wheel-prize-display {
  font-family: 'Fredoka One', cursive;
  font-size: 1.8rem;
  min-height: 2.5rem;
  text-align: center;
  animation: prizeReveal 0.5s ease;
}
@keyframes prizeReveal {
  from { opacity: 0; transform: scale(0.5); }
  to   { opacity: 1; transform: scale(1); }
}

.btn-next {
  font-family: 'Fredoka One', cursive;
  font-size: 1.2rem;
  padding: 12px 40px;
  border: none;
  border-radius: 50px;
  background: linear-gradient(135deg, var(--blue), var(--teal));
  color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(37,99,235,0.4);
  transition: transform 0.15s, opacity 0.3s;
}
.btn-next:hover  { transform: translateY(-2px) scale(1.03); }
.btn-next:active { transform: scale(0.97); }
.btn-next.hidden { opacity: 0; pointer-events: none; }

/* =============================================
   RESULTS SCREEN
   ============================================= */
.results-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  max-width: 480px;
  width: 100%;
  text-align: center;
}
.results-trophy {
  font-size: 5rem;
  animation: trophySpin 1s ease;
  filter: drop-shadow(0 4px 20px rgba(245,158,11,0.6));
}
@keyframes trophySpin {
  from { transform: rotate(-20deg) scale(0.5); opacity: 0; }
  60%  { transform: rotate(10deg)  scale(1.2); }
  to   { transform: none; opacity: 1; }
}
.results-title {
  font-family: 'Fredoka One', cursive;
  font-size: clamp(2rem, 7vw, 3rem);
  background: linear-gradient(135deg, var(--gold2), var(--pink));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.results-score-wrap {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius);
  padding: 16px 48px;
}
.results-score {
  font-family: 'Fredoka One', cursive;
  font-size: clamp(3rem, 12vw, 5rem);
  color: var(--gold2);
  line-height: 1;
  text-shadow: 0 2px 20px rgba(245,158,11,0.5);
}
.results-label {
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 3px;
  color: rgba(255,255,255,0.5);
}
.results-stats {
  font-size: 1rem;
  font-weight: 700;
  color: rgba(255,255,255,0.7);
  line-height: 1.8;
}
.results-highscore {
  font-family: 'Fredoka One', cursive;
  font-size: 1.3rem;
  color: var(--gold2);
  min-height: 1.6rem;
}
.btn-play-again {
  margin-top: 4px;
}

/* =============================================
   STREAK LEVELS
   ============================================= */
.streak-lv1 { color: #fcd34d; }
.streak-lv2 { color: #fb923c; }
.streak-lv3 { color: #f87171; font-size: 1.9rem !important; }
.streak-lv4 { color: #c084fc; font-size: 2.1rem !important; animation: rainbowFire 0.5s linear infinite; }
@keyframes rainbowFire {
  0%   { filter: hue-rotate(0deg); }
  100% { filter: hue-rotate(360deg); }
}

/* =============================================
   UTILITIES
   ============================================= */
.hidden { display: none !important; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 3px; }

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-height: 700px) {
  .hud { padding: 6px 12px; }
  .question-card { padding: 12px 16px; }
  .answer-btn { min-height: 46px; padding: 10px 12px; }
  .logo-title { font-size: 2.4rem; }
  .logo-book  { font-size: 2.5rem; }
}
@media (max-width: 400px) {
  .answers-grid { grid-template-columns: 1fr; }
  .wheel-wrap, #wheelCanvas { width: 280px; height: 280px; }
  .wheel-wrap { height: 300px; }
}
