/* game.css — Kid-friendly Flag Quiz Game styling */

:root {
  --bg-gradient: radial-gradient(circle at 50% 20%, rgba(30, 27, 75, 0.85) 0%, rgba(9, 9, 11, 0.95) 100%);
  --accent-purple: #8b5cf6;
  --accent-blue: #3b82f6;
  --accent-green: #22c55e;
  --accent-red: #ef4444;
  --accent-gold: #fbbf24;
}

body {
  background: #09090b url('assets/bg-space-globe.jpg') no-repeat center center / cover;
  color: #fff;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  position: relative;
}

/* Background overlay for high contrast and readability */
body::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 30%, rgba(15, 12, 41, 0.7) 0%, rgba(5, 4, 15, 0.88) 100%);
  pointer-events: none;
  z-index: 0;
}

#stage {
  position: relative;
  z-index: 1;
}

/* Base Screen Overlays */
.screen {
  padding: 1.25rem;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  max-width: 440px;
  margin: 0 auto;
}

/* START SCREEN */
.logo-wrap {
  margin-bottom: 0.2rem;
  animation: floatEmoji 2.5s ease-in-out infinite alternate;
}

.logo-image {
  width: 90px;
  height: 90px;
  object-fit: contain;
  filter: drop-shadow(0 6px 16px rgba(139, 92, 246, 0.45));
}

@keyframes floatEmoji {
  0% { transform: translateY(0px) scale(1); }
  100% { transform: translateY(-6px) scale(1.04); }
}

#title {
  font-size: 2.5rem;
  font-weight: 900;
  margin: 0;
  background: linear-gradient(135deg, #fef08a, #f59e0b, #ef4444);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 4px 20px rgba(245, 158, 11, 0.3);
}

#tagline {
  margin: 0.2rem 0 1.2rem;
  color: #c4b5fd;
  font-size: 1rem;
  font-weight: 600;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
}

.mode-select-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  width: 100%;
  max-width: 360px;
}

.mode-btn {
  background: rgba(26, 21, 65, 0.88);
  backdrop-filter: blur(8px);
  border: 2px solid rgba(139, 92, 246, 0.35);
  border-radius: 18px;
  padding: 0.75rem 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.2s, background 0.2s;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
}

.mode-btn:active {
  transform: scale(0.95);
  background: rgba(139, 92, 246, 0.35);
}

.mode-btn.hard-mode {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.35), rgba(245, 158, 11, 0.35));
  border-color: rgba(239, 68, 68, 0.6);
}

.mode-icon-img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.4));
}

.mode-name {
  font-size: 1.05rem;
  font-weight: 800;
  color: #f4f4f5;
}

.mode-sub {
  font-size: 0.72rem;
  color: #a1a1aa;
  font-weight: 600;
}

/* QUIZ PLAY SCREEN */
.quiz-container {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
}

.quiz-hud {
  display: flex;
  justify-content: space-between;
  width: 100%;
  background: rgba(24, 24, 27, 0.75);
  backdrop-filter: blur(8px);
  padding: 0.45rem 0.85rem;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-sizing: border-box;
}

.hud-item {
  font-size: 0.95rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.streak-box {
  color: #fbbf24;
}

.score-box {
  color: #38bdf8;
}

.progress-wrap {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.progress-bar-bg {
  flex: 1;
  height: 10px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  width: 10%;
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #8b5cf6, #ec4899);
  border-radius: 999px;
  transition: width 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.progress-text {
  font-size: 0.8rem;
  font-weight: 700;
  color: #d4d4d8;
  min-width: 48px;
  text-align: right;
}

/* Flag Card */
.flag-card {
  width: 100%;
  background: linear-gradient(180deg, rgba(39, 39, 42, 0.85), rgba(24, 24, 27, 0.9));
  border: 2px solid rgba(139, 92, 246, 0.4);
  border-radius: 24px;
  padding: 1.1rem 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), inset 0 1px 1px rgba(255, 255, 255, 0.2);
  position: relative;
  overflow: hidden;
  min-height: 130px;
}

.flag-emoji {
  font-size: 5.2rem;
  line-height: 1.1;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.6));
  animation: flagPop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  user-select: none;
}

@keyframes flagPop {
  0% { transform: scale(0.6) rotate(-5deg); opacity: 0; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

.flag-mode-tag {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 800;
  color: #a78bfa;
  background: rgba(139, 92, 246, 0.2);
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  margin-top: 0.4rem;
}

/* Option Buttons Grid */
.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  width: 100%;
}

.opt-btn {
  background: #18181b;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: 18px;
  padding: 0.85rem 0.6rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: #f4f4f5;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 64px;
  line-height: 1.25;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  transition: transform 0.1s ease, background-color 0.2s, border-color 0.2s, color 0.2s;
  box-sizing: border-box;
}

.opt-btn:active {
  transform: scale(0.96);
}

.opt-btn.correct {
  background: #15803d !important;
  border-color: #4ade80 !important;
  color: #ffffff !important;
  box-shadow: 0 0 16px rgba(74, 222, 128, 0.6) !important;
  transform: scale(1.02);
}

.opt-btn.wrong {
  background: #b91c1c !important;
  border-color: #f87171 !important;
  color: #ffffff !important;
  box-shadow: 0 0 16px rgba(248, 113, 113, 0.6) !important;
}

/* RESULTS / GAMEOVER SCREEN */
.results-card {
  width: 100%;
  max-width: 360px;
  background: rgba(24, 24, 27, 0.9);
  border: 2px solid rgba(139, 92, 246, 0.35);
  border-radius: 28px;
  padding: 1.5rem 1.2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6);
  box-sizing: border-box;
}

.results-badge-wrap {
  margin-bottom: 0.4rem;
  animation: floatEmoji 2s ease-in-out infinite alternate;
}

.results-trophy-img {
  width: 100px;
  height: 100px;
  object-fit: contain;
  filter: drop-shadow(0 8px 20px rgba(251, 191, 36, 0.4));
}

#res-title {
  font-size: 1.8rem;
  font-weight: 900;
  margin: 0;
  color: #f4f4f5;
}

#res-msg {
  color: #a1a1aa;
  font-size: 0.95rem;
  margin: 0.3rem 0 1rem;
}

.res-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  width: 100%;
  margin-bottom: 1.2rem;
}

.res-stat-card {
  background: rgba(39, 39, 42, 0.7);
  border-radius: 14px;
  padding: 0.65rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.stat-lbl {
  font-size: 0.72rem;
  color: #a1a1aa;
  text-transform: uppercase;
  font-weight: 700;
}

.stat-val {
  font-size: 1.25rem;
  font-weight: 900;
  color: #f4f4f5;
}

.stat-val.highlight {
  color: #fbbf24;
}

.action-btn {
  width: 100%;
  padding: 0.85rem;
  border-radius: 16px;
  font-size: 1.1rem;
  font-weight: 800;
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  color: white;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(124, 58, 237, 0.4);
  margin-bottom: 0.5rem;
}

.action-btn-secondary {
  width: 100%;
  padding: 0.7rem;
  border-radius: 16px;
  font-size: 0.95rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.1);
  color: #d4d4d8;
  border: 1px solid rgba(255, 255, 255, 0.15);
  cursor: pointer;
}
