/* =============================================
   Quiz Gumbo – Global Styles
   ============================================= */
:root {
  --rose: #c8566a;
  --rose-light: #f4d6dc;
  --rose-dark: #9e3d52;
  --gold: #c9a84c;
  --gold-light: #f5efd4;
  --cream: #faf8f5;
  --white: #ffffff;
  --text: #2d2d2d;
  --text-muted: #6b6b6b;
  --border: #e5ddd8;
  --shadow: 0 4px 20px rgba(0,0,0,0.08);
  --radius: 12px;
  --font: 'Georgia', serif;
  --font-ui: 'Segoe UI', system-ui, sans-serif;
}

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

body {
  font-family: var(--font-ui);
  background: var(--cream);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* Typography */
h1, h2, h3 { font-family: var(--font); font-weight: normal; }
h1 { font-size: 2.4rem; color: var(--rose-dark); }
h2 { font-size: 1.8rem; color: var(--rose-dark); }
h3 { font-size: 1.3rem; color: var(--text); }

/* Layout */
.container { max-width: 900px; margin: 0 auto; padding: 0 20px; }
.container-sm { max-width: 520px; margin: 0 auto; padding: 0 20px; }
.container-lg { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

/* Nav */
nav {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}
.nav-brand {
  font-family: var(--font);
  font-size: 1.5rem;
  color: var(--rose);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-brand span { font-size: 1.3rem; }
.nav-links { display: flex; gap: 12px; align-items: center; }
.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 6px 12px;
  border-radius: 6px;
  transition: all 0.2s;
}
.nav-links a:hover { background: var(--rose-light); color: var(--rose-dark); }

/* Cards */
.card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.card-sm { padding: 20px 24px; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  border: none;
  transition: all 0.2s;
  font-family: var(--font-ui);
}
.btn-primary { background: var(--rose); color: var(--white); }
.btn-primary:hover { background: var(--rose-dark); }
.btn-secondary { background: var(--white); color: var(--rose); border: 2px solid var(--rose); }
.btn-secondary:hover { background: var(--rose-light); }
.btn-gold { background: var(--gold); color: var(--white); }
.btn-gold:hover { background: #b08c38; }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--rose-light); color: var(--rose-dark); }
.btn-danger { background: #dc2626; color: var(--white); }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 7px 14px; font-size: 0.85rem; }
.btn-lg { padding: 14px 32px; font-size: 1.05rem; }
.btn-full { width: 100%; justify-content: center; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Forms */
.form-group { margin-bottom: 20px; }
.form-group label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: var(--font-ui);
  background: var(--white);
  color: var(--text);
  transition: border-color 0.2s;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--rose);
  box-shadow: 0 0 0 3px var(--rose-light);
}
.form-group textarea { resize: vertical; min-height: 80px; }
.form-hint { font-size: 0.82rem; color: var(--text-muted); margin-top: 4px; }

/* Alerts */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-bottom: 16px;
}
.alert-error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.alert-info { background: var(--gold-light); color: #7c5c00; border: 1px solid var(--gold); }

/* Hero */
.hero {
  background: linear-gradient(135deg, var(--rose-dark) 0%, #7b2538 100%);
  color: var(--white);
  padding: 80px 24px;
  text-align: center;
}
.hero h1 { color: var(--white); font-size: 3rem; margin-bottom: 16px; }
.hero p { font-size: 1.2rem; opacity: 0.9; max-width: 560px; margin: 0 auto 32px; }
.hero-icons { font-size: 2rem; margin-bottom: 16px; }
.hero-hearts { font-size: 2rem; margin-bottom: 16px; }

/* Page header */
.page-header { padding: 40px 0 24px; border-bottom: 1px solid var(--border); margin-bottom: 32px; }
.page-header h1 { font-size: 2rem; margin-bottom: 6px; }
.page-header p { color: var(--text-muted); }

/* Badge */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge-open { background: #dcfce7; color: #166534; }
.badge-closed { background: #f1f5f9; color: #475569; }

/* Quiz list */
.quiz-grid { display: grid; gap: 16px; }
.quiz-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  transition: box-shadow 0.2s;
}
.quiz-card:hover { box-shadow: var(--shadow); }
.quiz-card-info h3 { margin-bottom: 4px; }
.quiz-card-meta { font-size: 0.83rem; color: var(--text-muted); display: flex; gap: 12px; flex-wrap: wrap; }
.quiz-card-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* Question builder */
.question-block {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
  position: relative;
}
.question-block.has-error { border-color: #fca5a5; }
.question-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--rose);
  color: var(--white);
  border-radius: 50%;
  font-size: 0.82rem;
  font-weight: 700;
  margin-bottom: 12px;
}
.answer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.answer-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--cream);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  transition: all 0.2s;
}
.answer-item.correct { border-color: #16a34a; background: #f0fdf4; }
.answer-item input[type="radio"] { accent-color: var(--rose); }
.answer-item input[type="text"] {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 0.9rem;
  color: var(--text);
  outline: none;
  padding: 0;
}
.answer-label {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--rose);
  min-width: 18px;
}
.question-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.remove-question {
  background: none;
  border: none;
  color: #dc2626;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 4px;
  border-radius: 4px;
  line-height: 1;
}
.remove-question:hover { background: #fef2f2; }

/* Image upload */
.image-upload-area {
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 8px;
}
.image-upload-area:hover { border-color: var(--rose); background: var(--rose-light); }
.image-preview { max-width: 100%; max-height: 200px; border-radius: 6px; margin-top: 8px; }
.image-remove {
  background: #dc2626;
  color: var(--white);
  border: none;
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 0.78rem;
  cursor: pointer;
  margin-top: 6px;
}

/* Quiz taking */
.quiz-progress {
  background: var(--border);
  height: 6px;
  border-radius: 3px;
  margin-bottom: 32px;
  overflow: hidden;
}
.quiz-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--rose), var(--gold));
  border-radius: 3px;
  transition: width 0.4s;
}
.question-slide { display: none; }
.question-slide.active { display: block; }
.question-text {
  font-family: var(--font);
  font-size: 1.3rem;
  margin-bottom: 24px;
  line-height: 1.5;
}
.question-image { max-width: 100%; border-radius: 8px; margin-bottom: 16px; }
.answer-option {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border: 2px solid var(--border);
  border-radius: 10px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--white);
}
.answer-option:hover { border-color: var(--rose); background: var(--rose-light); }
.answer-option.selected { border-color: var(--rose); background: var(--rose-light); }
.answer-option.correct-reveal { border-color: #16a34a; background: #f0fdf4; }
.answer-option.wrong-reveal { border-color: #dc2626; background: #fef2f2; }
.answer-option-label {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--rose);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--rose);
  flex-shrink: 0;
}
.answer-option.selected .answer-option-label { background: var(--rose); color: var(--white); }

/* Leaderboard */
.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
}
.leaderboard-table th, .leaderboard-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.leaderboard-table th { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.rank-1 td:first-child { font-size: 1.3rem; }
.rank-2 td:first-child { font-size: 1.1rem; }
.rank-3 td:first-child { font-size: 1rem; }
.podium { display: flex; justify-content: center; gap: 16px; margin-bottom: 40px; flex-wrap: wrap; }
.podium-item {
  text-align: center;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  min-width: 150px;
}
.podium-item.first { border-color: var(--gold); background: var(--gold-light); order: 2; }
.podium-item.second { order: 1; }
.podium-item.third { order: 3; }
.podium-trophy { font-size: 2rem; display: block; margin-bottom: 8px; }
.podium-name { font-weight: 600; font-size: 1rem; margin-bottom: 4px; }
.podium-score { font-size: 0.9rem; color: var(--text-muted); }

/* Stripe */
#payment-element { margin-bottom: 20px; }
.StripeElement {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
}

/* Score result */
.score-ring {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--rose), var(--gold));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
  color: var(--white);
  font-family: var(--font);
}
.score-ring .score-num { font-size: 2.8rem; line-height: 1; }
.score-ring .score-total { font-size: 1rem; opacity: 0.85; }

/* Utility */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mb-32 { margin-bottom: 32px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.divider { border: none; border-top: 1px solid var(--border); margin: 24px 0; }
.hidden { display: none !important; }

/* Responsive */
@media (max-width: 600px) {
  .hero h1 { font-size: 2rem; }
  .answer-grid { grid-template-columns: 1fr; }
  .quiz-card { flex-direction: column; align-items: flex-start; }
  .podium { flex-direction: column; align-items: center; }
  .podium-item { order: unset !important; }
}
