/* ============================================================
   PlayVidya — Game UI CSS (shared across all games)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&family=Fredoka+One&display=swap');

:root {
  --game-primary:   #FF6B35;
  --game-secondary: #FFB347;
  --game-accent:    #4ECDC4;
  --game-green:     #2ECC71;
  --game-red:       #E74C3C;
  --game-purple:    #9B59B6;
  --game-blue:      #3498DB;
  --game-bg:        #1A1A2E;
  --game-bg2:       #16213E;
  --game-card:      #0F3460;
  --game-text:      #FFFFFF;
  --game-muted:     rgba(255,255,255,0.6);
  --game-border:    rgba(255,255,255,0.12);
  --radius:         14px;
  --radius-sm:      8px;
  --radius-lg:      20px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Nunito', sans-serif;
  background: var(--game-bg);
  color: var(--game-text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── GAME HEADER ── */
.game-header {
  background: var(--game-bg2);
  border-bottom: 2px solid var(--game-border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.game-back-btn {
  background: rgba(255,255,255,0.1);
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  padding: 7px 14px;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.game-back-btn:hover { background: rgba(255,255,255,0.18); }

.game-title-bar {
  font-family: 'Fredoka One', sans-serif;
  font-size: 20px;
  color: var(--game-secondary);
  flex: 1;
}

/* ── HUD (score / timer / lives) ── */
.game-hud {
  display: flex;
  align-items: center;
  gap: 12px;
}
.hud-item {
  background: rgba(255,255,255,0.08);
  border: 1.5px solid var(--game-border);
  border-radius: 25px;
  padding: 6px 16px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 800;
}
.hud-item .hud-icon { font-size: 16px; }
.hud-score  { color: var(--game-secondary); }
.hud-timer  { color: var(--game-accent); }
.hud-lives  { color: var(--game-red); }
.hud-xp     { color: #C39BD3; }
.hud-combo  { color: var(--game-green); }

/* ── TIMER BAR ── */
.timer-bar-wrap {
  width: 100%;
  height: 8px;
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 18px;
}
.timer-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--game-accent), var(--game-green));
  border-radius: 4px;
  transition: width 0.1s linear, background 0.5s;
}
.timer-bar-fill.warning { background: linear-gradient(90deg, var(--game-secondary), var(--game-primary)); }
.timer-bar-fill.danger  { background: linear-gradient(90deg, var(--game-red), #C0392B); }

/* ── GAME ARENA ── */
.game-arena {
  max-width: 780px;
  margin: 0 auto;
  padding: 28px 20px;
}

/* ── QUESTION CARD ── */
.question-card {
  background: var(--game-bg2);
  border: 2px solid var(--game-border);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 22px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.question-card::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 140px; height: 140px;
  background: radial-gradient(circle, rgba(255,179,71,0.12) 0%, transparent 70%);
  pointer-events: none;
}
.q-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--game-muted);
  margin-bottom: 12px;
}
.q-text {
  font-family: 'Fredoka One', sans-serif;
  font-size: 32px;
  color: #fff;
  line-height: 1.2;
}
.q-sub {
  font-size: 14px;
  color: var(--game-muted);
  margin-top: 8px;
}

/* ── ANSWER OPTIONS ── */
.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 22px;
}
.option-btn {
  background: var(--game-bg2);
  border: 2px solid var(--game-border);
  border-radius: var(--radius);
  padding: 18px;
  font-family: 'Fredoka One', sans-serif;
  font-size: 22px;
  color: #fff;
  cursor: pointer;
  transition: all 0.18s;
  position: relative;
  overflow: hidden;
}
.option-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.06), transparent);
  opacity: 0;
  transition: opacity 0.2s;
}
.option-btn:hover:not(:disabled) {
  border-color: var(--game-secondary);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255,179,71,0.2);
}
.option-btn:hover::before { opacity: 1; }
.option-btn:disabled { cursor: not-allowed; }
.option-btn.correct {
  background: rgba(46,204,113,0.18);
  border-color: var(--game-green);
  color: var(--game-green);
  animation: correctPulse 0.4s ease;
}
.option-btn.wrong {
  background: rgba(231,76,60,0.15);
  border-color: var(--game-red);
  color: var(--game-red);
  animation: shake 0.4s ease;
}
.option-btn .opt-letter {
  position: absolute;
  top: 8px; left: 12px;
  font-size: 11px;
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  color: var(--game-muted);
}

/* ── FEEDBACK ── */
.feedback-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  pointer-events: none;
}
.feedback-text {
  font-family: 'Fredoka One', sans-serif;
  font-size: 52px;
  animation: feedbackPop 0.6s ease forwards;
}
.feedback-text.correct-fb { color: var(--game-green); }
.feedback-text.wrong-fb   { color: var(--game-red); }

/* ── PROGRESS ── */
.q-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}
.q-progress-bar {
  flex: 1;
  height: 6px;
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
  overflow: hidden;
}
.q-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--game-primary), var(--game-secondary));
  border-radius: 3px;
  transition: width 0.4s ease;
}
.q-progress-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--game-muted);
  white-space: nowrap;
}

/* ── COMBO INDICATOR ── */
.combo-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(46,204,113,0.15);
  border: 1.5px solid var(--game-green);
  border-radius: 25px;
  padding: 4px 14px;
  font-size: 13px;
  font-weight: 800;
  color: var(--game-green);
  margin-bottom: 14px;
  animation: fadeUp 0.3s ease;
}

/* ── GAME SCREEN STATES ── */
.screen {
  display: none;
  min-height: calc(100vh - 60px);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
  padding: 28px;
}
.screen.active { display: flex; }

/* START SCREEN */
.start-card {
  background: var(--game-bg2);
  border: 2px solid var(--game-border);
  border-radius: var(--radius-lg);
  padding: 48px 40px;
  max-width: 480px;
  width: 100%;
}
.game-emoji { font-size: 72px; margin-bottom: 16px; animation: float 3s ease-in-out infinite; }
.start-title { font-family: 'Fredoka One', sans-serif; font-size: 32px; color: var(--game-secondary); margin-bottom: 8px; }
.start-desc  { font-size: 14px; color: var(--game-muted); margin-bottom: 28px; line-height: 1.6; }
.difficulty-select {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 24px;
}
.diff-btn {
  padding: 8px 20px;
  border-radius: 25px;
  border: 2px solid var(--game-border);
  background: transparent;
  color: var(--game-muted);
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}
.diff-btn.active, .diff-btn:hover {
  border-color: var(--game-secondary);
  color: var(--game-secondary);
  background: rgba(255,179,71,0.1);
}

/* END SCREEN */
.end-card {
  background: var(--game-bg2);
  border: 2px solid var(--game-border);
  border-radius: var(--radius-lg);
  padding: 48px 40px;
  max-width: 500px;
  width: 100%;
}
.end-score { font-family: 'Fredoka One', sans-serif; font-size: 64px; color: var(--game-secondary); }
.end-label { font-size: 14px; color: var(--game-muted); margin-bottom: 24px; }
.end-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
  margin-bottom: 28px;
}
.end-stat {
  background: rgba(255,255,255,0.05);
  border-radius: var(--radius-sm);
  padding: 14px;
}
.end-stat-val { font-size: 22px; font-weight: 900; }
.end-stat-lbl { font-size: 11px; color: var(--game-muted); font-weight: 700; margin-top: 2px; }
.xp-earned-banner {
  background: linear-gradient(135deg, rgba(255,107,53,0.2), rgba(255,179,71,0.2));
  border: 2px solid var(--game-secondary);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 22px;
  font-size: 18px;
  font-weight: 800;
  color: var(--game-secondary);
}

/* ── BUTTONS ── */
.game-btn {
  padding: 14px 32px;
  border-radius: 25px;
  border: none;
  font-family: 'Fredoka One', sans-serif;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.game-btn-primary {
  background: linear-gradient(135deg, var(--game-primary), #E55A25);
  color: #fff;
  box-shadow: 0 6px 20px rgba(255,107,53,0.35);
}
.game-btn-primary:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(255,107,53,0.5); }
.game-btn-secondary {
  background: rgba(255,255,255,0.1);
  color: #fff;
  border: 2px solid var(--game-border);
}
.game-btn-secondary:hover { background: rgba(255,255,255,0.18); }

/* ── STARS RATING ── */
.stars { font-size: 36px; margin-bottom: 8px; }

/* ── ANIMATIONS ── */
@keyframes correctPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.04); }
  100% { transform: scale(1); }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}
@keyframes feedbackPop {
  0%   { transform: scale(0.5); opacity: 0; }
  50%  { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(1) translateY(-40px); opacity: 0; }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-10px); }
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes starPop {
  0% { transform: scale(0) rotate(-30deg); opacity: 0; }
  70% { transform: scale(1.3) rotate(5deg); }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}
.star-anim { display: inline-block; animation: starPop 0.4s ease both; }
.star-anim:nth-child(2) { animation-delay: 0.15s; }
.star-anim:nth-child(3) { animation-delay: 0.3s; }

/* ── PARTICLES ── */
.particle-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 300;
  overflow: hidden;
}
.particle {
  position: absolute;
  font-size: 20px;
  animation: particleFall 1.2s ease forwards;
}
@keyframes particleFall {
  0%   { transform: translateY(-20px) rotate(0); opacity: 1; }
  100% { transform: translateY(120vh) rotate(360deg); opacity: 0; }
}

/* ── INPUT STYLE (for fill-in games) ── */
.answer-input {
  background: rgba(255,255,255,0.08);
  border: 2px solid var(--game-border);
  border-radius: var(--radius);
  padding: 16px 24px;
  font-family: 'Fredoka One', sans-serif;
  font-size: 28px;
  color: #fff;
  text-align: center;
  width: 100%;
  outline: none;
  transition: border-color 0.2s;
  margin-bottom: 14px;
}
.answer-input:focus { border-color: var(--game-secondary); }
.answer-input.correct-input { border-color: var(--game-green); background: rgba(46,204,113,0.12); }
.answer-input.wrong-input   { border-color: var(--game-red);   background: rgba(231,76,60,0.12); animation: shake 0.4s; }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--game-border); border-radius: 3px; }