/* === Quiz Battle - Cartoon Theme === */
/* Theme: Playful cartoon with bold borders, 3D shadows, warm colors */

/* === CSS Variables === */
:root {
  --bg: #4CAF50;
  --surface: #F5E6D0;
  --surface-dark: #E8D5BE;
  --surface-darker: #DBBFA5;

  --primary: #FF5722;
  --primary-dark: #E64A19;
  --primary-shadow: #BF360C;

  --accent: #FF9800;
  --accent-dark: #F57C00;

  --correct: #43A047;
  --correct-light: #C8E6C9;
  --wrong: #E53935;
  --wrong-light: #FFCDD2;

  --border-color: #8D6E63;
  --border-dark: #5D4037;

  --on-surface: #3E2723;
  --on-surface-variant: #6D4C41;
  --on-primary: #fff;

  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 20px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* === Reset & Base === */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  background: var(--bg);
  color: var(--on-surface);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  letter-spacing: 0.01em;
}

/* === Topbar === */
.topbar {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 3px solid var(--border-color);
  box-shadow: 0 4px 0 var(--border-dark);
}

.btn-back {
  color: var(--on-surface-variant);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 800;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  border: 3px solid var(--border-color);
  background: var(--surface-dark);
  box-shadow: 0 3px 0 var(--border-dark);
  transition: var(--transition);
  white-space: nowrap;
}

.btn-back:hover {
  background: var(--accent);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 5px 0 var(--border-dark);
}

.game-title {
  font-size: clamp(1rem, 3vw, 1.3rem);
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--primary);
  text-shadow: 2px 2px 0 var(--primary-shadow);
}

.title-icon {
  font-size: 1.1em;
}

/* === Game Container === */
.game-container {
  position: relative;
  z-index: 1;
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
  padding: 20px 16px 40px;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* === Category Selector === */
.category-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 20px;
  width: 100%;
}

.cat-btn {
  font-family: 'Nunito', sans-serif;
  font-size: 0.85rem;
  font-weight: 800;
  padding: 8px 16px;
  border: 3px solid var(--border-color);
  border-radius: 50px;
  background: var(--surface);
  color: var(--on-surface-variant);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  box-shadow: 0 3px 0 var(--border-dark);
}

.cat-btn:hover {
  border-color: var(--accent-dark);
  color: var(--primary);
  background: var(--surface-dark);
  transform: translateY(-2px);
  box-shadow: 0 5px 0 var(--border-dark);
}

.cat-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent-dark);
  box-shadow: 0 4px 0 var(--primary-shadow);
  text-shadow: 1px 1px 0 rgba(0,0,0,0.2);
}

/* === Start Screen === */
.start-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 40px 20px;
  text-align: center;
  background: var(--surface);
  border: 3px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 6px 0 var(--border-dark);
  width: 100%;
}

.start-icon {
  font-size: 4rem;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.start-screen h2 {
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary);
  text-shadow: 2px 2px 0 var(--primary-shadow);
}

.start-screen p {
  color: var(--on-surface-variant);
  font-size: 1rem;
  font-weight: 700;
}

.start-subtitle {
  font-size: 0.85rem !important;
  opacity: 0.7;
}

/* === Buttons === */
.btn {
  font-family: 'Nunito', sans-serif;
  font-size: 1rem;
  font-weight: 800;
  padding: 14px 36px;
  border: 3px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary-dark);
  box-shadow: 0 4px 0 var(--primary-shadow);
  text-shadow: 1px 1px 0 rgba(0,0,0,0.2);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 var(--primary-shadow);
  background: #FF6E40;
}

.btn-primary:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--primary-shadow);
}

.btn-whatsapp {
  background: #25d366;
  color: #fff;
  border-color: #1DA851;
  box-shadow: 0 4px 0 #15803d;
  text-shadow: 1px 1px 0 rgba(0,0,0,0.2);
}

.btn-whatsapp:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 #15803d;
}

/* === Question Area === */
.question-area {
  width: 100%;
  animation: fadeIn 0.4s ease;
}

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

.question-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.progress {
  font-size: 0.9rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 1px 1px 0 rgba(0,0,0,0.3);
}

.category-badge {
  font-size: 0.75rem;
  font-weight: 800;
  padding: 4px 12px;
  border-radius: 50px;
  background: var(--surface);
  color: var(--primary);
  border: 3px solid var(--border-color);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  box-shadow: 0 2px 0 var(--border-dark);
}

/* === Timer Bar === */
.timer-bar {
  width: 100%;
  height: 10px;
  background: var(--surface-dark);
  border-radius: 5px;
  margin-bottom: 24px;
  overflow: hidden;
  border: 2px solid var(--border-color);
}

.timer-fill {
  height: 100%;
  width: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--accent), var(--primary));
  transition: width 0.3s linear;
}

.timer-fill.warning {
  background: linear-gradient(90deg, var(--wrong), #FF9800);
}

/* === Question Text === */
.question-text {
  font-size: clamp(1.05rem, 3.5vw, 1.3rem);
  font-weight: 800;
  line-height: 1.5;
  color: var(--on-surface);
  padding: 24px;
  background: var(--surface);
  border: 3px solid var(--border-color);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
  text-align: center;
  box-shadow: 0 4px 0 var(--border-dark);
}

/* === Options === */
.options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.option-btn {
  font-family: 'Nunito', sans-serif;
  font-size: clamp(0.88rem, 2.5vw, 1rem);
  font-weight: 700;
  padding: 16px 14px;
  border: 3px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--on-surface);
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
  line-height: 1.3;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 0 var(--border-dark);
}

.option-btn:hover:not(.disabled) {
  border-color: var(--accent-dark);
  background: var(--surface-dark);
  transform: translateY(-3px);
  box-shadow: 0 7px 0 var(--border-dark);
}

.option-btn:active:not(.disabled) {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--border-dark);
}

.option-btn .option-letter {
  display: inline-block;
  width: 26px;
  height: 26px;
  line-height: 26px;
  border-radius: 50%;
  background: var(--surface-darker);
  color: var(--on-surface-variant);
  font-size: 0.75rem;
  font-weight: 800;
  margin-right: 8px;
  text-align: center;
  vertical-align: middle;
  border: 2px solid var(--border-color);
}

.option-btn.correct {
  border-color: var(--correct);
  background: var(--correct-light);
  color: #2E7D32;
  animation: pulseCorrect 0.5s ease;
  box-shadow: 0 4px 0 #2E7D32;
}

.option-btn.correct .option-letter {
  background: var(--correct);
  color: #fff;
  border-color: #2E7D32;
}

.option-btn.wrong {
  border-color: var(--wrong);
  background: var(--wrong-light);
  color: #C62828;
  animation: shakeWrong 0.5s ease;
  box-shadow: 0 4px 0 #C62828;
}

.option-btn.wrong .option-letter {
  background: var(--wrong);
  color: #fff;
  border-color: #C62828;
}

.option-btn.disabled {
  cursor: default;
  opacity: 0.5;
}

.option-btn.correct.disabled,
.option-btn.wrong.disabled {
  opacity: 1;
}

@keyframes pulseCorrect {
  0% { box-shadow: 0 4px 0 #2E7D32, 0 0 0 0 rgba(67, 160, 71, 0.5); }
  50% { box-shadow: 0 4px 0 #2E7D32, 0 0 0 14px transparent; }
  100% { box-shadow: 0 4px 0 #2E7D32, 0 0 0 0 transparent; }
}

@keyframes shakeWrong {
  0%, 100% { transform: translateX(0); }
  15% { transform: translateX(-6px); }
  30% { transform: translateX(6px); }
  45% { transform: translateX(-4px); }
  60% { transform: translateX(4px); }
  75% { transform: translateX(-2px); }
  90% { transform: translateX(2px); }
}

/* === Score Display === */
.score-display {
  text-align: center;
  font-size: 1.1rem;
  color: #fff;
  text-shadow: 1px 1px 0 rgba(0,0,0,0.3);
  font-weight: 800;
}

.score-display strong {
  color: #FFEB3B;
  font-weight: 800;
  font-size: 1.3rem;
  text-shadow: 2px 2px 0 rgba(0,0,0,0.3);
}

/* === Modal === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(46, 30, 18, 0.8);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
  animation: fadeIn 0.3s ease;
}

.modal-overlay.hidden {
  display: none;
}

.modal {
  background: var(--surface);
  border: 3px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 36px 28px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 6px 0 var(--border-dark), 0 20px 40px rgba(0, 0, 0, 0.3);
}

.modal-icon {
  font-size: 3.5rem;
}

.modal-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
  text-shadow: 2px 2px 0 var(--primary-shadow);
}

.modal-msg {
  font-size: 1rem;
  color: var(--on-surface-variant);
  line-height: 1.5;
  font-weight: 700;
}

.modal-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 8px 0;
}

.stat-item {
  background: var(--surface-dark);
  border-radius: var(--radius-sm);
  border: 3px solid var(--border-color);
  box-shadow: 0 3px 0 var(--border-dark);
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--on-surface-variant);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 800;
}

.stat-value {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--primary);
  text-shadow: 1px 1px 0 rgba(0,0,0,0.15);
}

.stat-value.accent {
  color: var(--accent);
}

/* === Game Info Section === */
.game-info {
  position: relative;
  z-index: 1;
  max-width: 640px;
  margin: 0 auto;
  padding: 40px 20px 60px;
  color: var(--on-surface-variant);
  line-height: 1.7;
}

.game-info h2 {
  font-size: 1.3rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 12px;
  text-shadow: 1px 1px 0 rgba(0,0,0,0.3);
}

.game-info h3 {
  font-size: 1.05rem;
  font-weight: 800;
  color: #fff;
  margin: 20px 0 8px;
  text-shadow: 1px 1px 0 rgba(0,0,0,0.3);
}

.game-info p {
  margin-bottom: 12px;
  color: rgba(255,255,255,0.85);
}

.game-info ul {
  padding-left: 24px;
  color: rgba(255,255,255,0.85);
}

.game-info li {
  margin-bottom: 6px;
}

/* === Responsive === */
@media (max-width: 500px) {
  .options {
    grid-template-columns: 1fr;
  }

  .modal-stats {
    grid-template-columns: 1fr 1fr;
  }

  .category-selector {
    gap: 6px;
  }

  .cat-btn {
    font-size: 0.78rem;
    padding: 6px 12px;
  }

  .question-text {
    padding: 18px;
  }
}
