:root {
  --red: rgb(120,49,77);
  --red-dark: rgb(90,35,57);
  --red-light: rgb(160,70,105);
  --cream: rgb(225,225,225);
  --warm-white: rgb(235,235,235);
  --brown: #5d3a1a;
  --brown-light: #8B5E3C;
  --green: #27ae60;
  --green-light: #2ecc71;
  --orange: #e67e22;
  --text: #2c1810;
  --text-light: #7f5c4a;
  --shadow: 0 8px 32px rgba(120,49,77,0.13);
  --shadow-sm: 0 2px 12px rgba(0,0,0,0.08);
}

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

body {
  font-family: 'Lato', sans-serif;
  background: var(--cream);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Paw print background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='80' height='80' viewBox='0 0 80 80' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23783149' fill-opacity='0.07'%3E%3Cellipse cx='25' cy='20' rx='7' ry='5'/%3E%3Cellipse cx='42' cy='16' rx='5' ry='7'/%3E%3Cellipse cx='14' cy='35' rx='5' ry='7'/%3E%3Cellipse cx='55' cy='30' rx='7' ry='5'/%3E%3Cpath d='M34 38 C28 38 22 44 22 52 C22 60 28 66 34 66 C38 66 40 64 40 64 C40 64 42 66 46 66 C52 66 58 60 58 52 C58 44 52 38 46 38 Z'/%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

.container {
  max-width: 780px;
  margin: 0 auto;
  padding: 20px 16px 60px;
  position: relative;
  z-index: 1;
}

/* HEADER */
.header {
  text-align: center;
  padding: 36px 0 24px;
}

.header .logo-area {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 8px;
}

.paw-logo {
  font-size: 2.2rem;
  animation: waggle 2s ease-in-out infinite;
}

@keyframes waggle {
  0%, 100% { transform: rotate(-10deg); }
  50% { transform: rotate(10deg); }
}

.header h1 {
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.6rem, 5vw, 2.6rem);
  color: var(--red);
  line-height: 1.15;
  font-weight: 900;
}

.header .subtitle {
  font-size: 0.95rem;
  color: var(--text-light);
  margin-top: 6px;
  font-weight: 300;
  letter-spacing: 0.5px;
}

.divider {
  width: 60px;
  height: 3px;
  background: var(--red);
  border-radius: 2px;
  margin: 14px auto 0;
}

/* CARD BASE */
.card {
  background: var(--warm-white);
  border-radius: 20px;
  padding: 32px 28px;
  box-shadow: var(--shadow);
  border: 1.5px solid rgba(120,49,77,0.1);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--red), var(--red-light), var(--orange));
}

/* START SCREEN */
#start-screen { text-align: center; margin-top: 10px; }

.start-icon {
  font-size: 4rem;
  margin-bottom: 16px;
  display: block;
  animation: bounce 1.5s ease-in-out infinite;
}

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

.start-screen-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.8rem;
  color: var(--brown);
  margin-bottom: 12px;
}

.start-screen-desc {
  color: var(--text-light);
  font-size: 0.95rem;
  line-height: 1.7;
  margin-bottom: 28px;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

.stats-row {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.stat-pill {
  background: rgba(120,49,77,0.08);
  border: 1.5px solid rgba(120,49,77,0.2);
  border-radius: 50px;
  padding: 10px 20px;
  font-size: 0.88rem;
  color: var(--red-dark);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 32px;
  border-radius: 50px;
  font-family: 'Lato', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: all 0.22s ease;
  letter-spacing: 0.3px;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--red), var(--red-light));
  color: white;
  box-shadow: 0 4px 18px rgba(120,49,77,0.38);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(120,49,77,0.45);
}

.btn-primary:active { transform: translateY(0); }

.btn-outline {
  background: transparent;
  color: var(--red);
  border: 2px solid var(--red);
}

.btn-outline:hover {
  background: var(--red);
  color: white;
  transform: translateY(-2px);
}

/* PROGRESS BAR */
.progress-wrapper {
  margin-bottom: 24px;
}

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

.progress-label {
  font-size: 0.82rem;
  color: var(--text-light);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.progress-count {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  color: var(--red);
  font-weight: 700;
}

.progress-bar-bg {
  height: 10px;
  background: rgba(120,49,77,0.12);
  border-radius: 10px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--red), var(--red-light));
  border-radius: 10px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.progress-bar-fill::after {
  content: '';
  position: absolute;
  right: 0; top: 0; bottom: 0;
  width: 20px;
  background: rgba(255,255,255,0.3);
  border-radius: 10px;
}

/* XP BAR */
.xp-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  background: rgba(120,49,77,0.05);
  border-radius: 12px;
  padding: 10px 16px;
}

.xp-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--orange);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  white-space: nowrap;
}

.xp-bar-bg {
  flex: 1;
  height: 8px;
  background: rgba(230,126,34,0.15);
  border-radius: 8px;
  overflow: hidden;
}

.xp-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--orange), #f1c40f);
  border-radius: 8px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.xp-value {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--orange);
  white-space: nowrap;
  min-width: 50px;
  text-align: right;
}

/* STREAK */
.streak-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: linear-gradient(135deg, #ff6b35, #f7b731);
  color: white;
  padding: 4px 12px;
  border-radius: 50px;
  font-size: 0.78rem;
  font-weight: 700;
  margin-bottom: 16px;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(255,107,53,0.3);
}

.streak-badge.hidden { opacity: 0; transform: scale(0.8); }

/* QUESTION */
.category-tag {
  display: inline-block;
  background: rgba(120,49,77,0.1);
  color: var(--red-dark);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 4px 12px;
  border-radius: 50px;
  margin-bottom: 14px;
  border: 1px solid rgba(120,49,77,0.2);
}

.question-text {
  font-family: 'Playfair Display', serif;
  font-size: clamp(1rem, 3vw, 1.2rem);
  color: var(--brown);
  line-height: 1.55;
  margin-bottom: 24px;
  font-weight: 700;
}

/* ANSWER OPTIONS */
.options-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.option-btn {
  width: 100%;
  text-align: left;
  padding: 14px 18px;
  background: white;
  border: 2px solid rgba(120,49,77,0.15);
  border-radius: 14px;
  cursor: pointer;
  font-family: 'Lato', sans-serif;
  font-size: 0.93rem;
  color: var(--text);
  line-height: 1.5;
  transition: all 0.18s ease;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  box-shadow: var(--shadow-sm);
}

.option-btn:hover:not(:disabled) {
  border-color: var(--red);
  background: rgba(120,49,77,0.04);
  transform: translateX(4px);
  box-shadow: 0 4px 14px rgba(120,49,77,0.15);
}

.option-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(120,49,77,0.1);
  color: var(--red);
  font-weight: 700;
  font-size: 0.82rem;
  flex-shrink: 0;
  transition: all 0.18s ease;
}

.option-btn:hover:not(:disabled) .option-letter {
  background: var(--red);
  color: white;
}

.option-btn.correct {
  border-color: var(--green);
  background: rgba(39,174,96,0.08);
  animation: correctPulse 0.4s ease;
}

.option-btn.correct .option-letter {
  background: var(--green);
  color: white;
}

.option-btn.wrong {
  border-color: var(--red-light);
  background: rgba(231,76,60,0.08);
  animation: wrongShake 0.4s ease;
}

.option-btn.wrong .option-letter {
  background: var(--red-light);
  color: white;
}

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

@keyframes correctPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

@keyframes wrongShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* FEEDBACK */
.feedback-box {
  border-radius: 14px;
  padding: 14px 18px;
  margin-bottom: 18px;
  font-size: 0.9rem;
  line-height: 1.55;
  display: none;
  align-items: flex-start;
  gap: 10px;
  animation: fadeIn 0.3s ease;
}

.feedback-box.show { display: flex; }

.feedback-box.correct-feedback {
  background: rgba(39,174,96,0.1);
  border: 1.5px solid rgba(39,174,96,0.3);
  color: #1a6b3f;
}

.feedback-box.wrong-feedback {
  background: rgba(231,76,60,0.08);
  border: 1.5px solid rgba(231,76,60,0.3);
  color: #7b1e1e;
}

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

/* FLOATING SCORE */
.floating-score {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--warm-white);
  border: 1.5px solid rgba(120,49,77,0.2);
  border-radius: 16px;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-sm);
  z-index: 100;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--brown);
  backdrop-filter: blur(10px);
}

.score-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px rgba(39,174,96,0.5);
}

/* TOAST NOTIFICATION */
.toast {
  position: fixed;
  top: 80px;
  right: 20px;
  background: var(--brown);
  color: white;
  padding: 10px 20px;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 700;
  z-index: 200;
  transform: translateX(120%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}

.toast.show { transform: translateX(0); }
.toast.xp-toast { background: linear-gradient(135deg, var(--orange), #f1c40f); color: var(--brown); }
.toast.streak-toast { background: linear-gradient(135deg, #ff6b35, #a04669); }

/* RESULTS */
#result-screen { text-align: center; }

.result-icon {
  font-size: 4.5rem;
  display: block;
  margin-bottom: 12px;
  animation: celebrate 0.8s ease forwards;
}

@keyframes celebrate {
  0% { transform: scale(0) rotate(-20deg); }
  70% { transform: scale(1.15) rotate(5deg); }
  100% { transform: scale(1) rotate(0deg); }
}

.result-title {
  font-family: 'Playfair Display', serif;
  font-size: 2rem;
  color: var(--brown);
  margin-bottom: 8px;
  font-weight: 900;
}

.result-subtitle {
  color: var(--text-light);
  font-size: 0.95rem;
  margin-bottom: 28px;
}

.result-score-big {
  font-family: 'Playfair Display', serif;
  font-size: 4.5rem;
  font-weight: 900;
  line-height: 1;
  margin-bottom: 4px;
}

.result-score-big.passed { color: var(--green); }
.result-score-big.failed { color: var(--red); }

.result-score-label {
  font-size: 0.85rem;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 28px;
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}

.result-stat {
  background: rgba(120,49,77,0.05);
  border-radius: 14px;
  padding: 16px 10px;
  border: 1.5px solid rgba(120,49,77,0.1);
}

.result-stat-num {
  font-family: 'Playfair Display', serif;
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--red);
  display: block;
}

.result-stat-label {
  font-size: 0.75rem;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: block;
  margin-top: 3px;
}

/* BADGES */
.badges-section {
  margin: 24px 0;
}

.badges-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  color: var(--brown);
  margin-bottom: 14px;
  text-align: left;
}

.badges-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.badge {
  background: white;
  border: 2px solid rgba(120,49,77,0.15);
  border-radius: 14px;
  padding: 12px 16px;
  text-align: center;
  min-width: 90px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease;
  animation: badgePop 0.5s ease backwards;
}

.badge:hover { transform: scale(1.05); }

.badge.locked {
  opacity: 0.4;
  filter: grayscale(0.8);
}

.badge-icon { font-size: 1.8rem; display: block; margin-bottom: 4px; }
.badge-name { font-size: 0.72rem; font-weight: 700; color: var(--text-light); display: block; }

@keyframes badgePop {
  from { transform: scale(0); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* REVIEW SECTION */
.review-section {
  margin-top: 28px;
  text-align: left;
}

.review-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.2rem;
  color: var(--brown);
  margin-bottom: 16px;
}

.review-item {
  background: white;
  border-radius: 14px;
  padding: 16px 18px;
  margin-bottom: 10px;
  border-left: 4px solid transparent;
  box-shadow: var(--shadow-sm);
  font-size: 0.88rem;
}

.review-item.review-correct { border-left-color: var(--green); }
.review-item.review-wrong { border-left-color: var(--red-light); }

.review-q {
  font-weight: 700;
  color: var(--brown);
  margin-bottom: 6px;
  line-height: 1.45;
}

.review-a {
  color: var(--text-light);
  font-size: 0.82rem;
  line-height: 1.45;
}

.review-a .correct-ans { color: var(--green); font-weight: 700; }
.review-a .wrong-ans { color: var(--red); text-decoration: line-through; }

/* NEXT BUTTON */
.next-btn-wrap {
  text-align: right;
  margin-top: 4px;
}

/* RESULT ACTIONS */
.result-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 24px;
}

/* LAW TAG */
.law-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(52,73,94,0.08);
  color: #2c3e50;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 50px;
  margin-left: 8px;
  border: 1px solid rgba(52,73,94,0.15);
  vertical-align: middle;
}

/* TIMER */
.timer-display {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--text-light);
  font-weight: 700;
}

.timer-ring {
  width: 34px;
  height: 34px;
  position: relative;
}

.timer-ring svg {
  transform: rotate(-90deg);
}

.timer-ring .bg { fill: none; stroke: rgba(120,49,77,0.12); stroke-width: 3; }
.timer-ring .fill { fill: none; stroke: var(--red); stroke-width: 3; stroke-dasharray: 88; stroke-dashoffset: 0; transition: stroke-dashoffset 1s linear, stroke 0.5s; stroke-linecap: round; }
.timer-ring .fill.warning { stroke: var(--orange); }
.timer-ring .fill.danger { stroke: var(--red-light); }

.timer-num {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 900;
  color: var(--red);
}

.quiz-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

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

/* RESPONSIVE */
@media (max-width: 540px) {
  .card { padding: 22px 16px; }
  .result-stats { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .result-stat-num { font-size: 1.4rem; }
  .floating-score { top: 12px; right: 12px; font-size: 0.78rem; padding: 8px 12px; }
}
