/* ============================================
   Quiz Immersive UX — Full-screen, animated
   ============================================ */

/* ---- Reset / Base ---- */
.quiz-body {
  margin: 0;
  background: #FAF6EF;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: 'DM Sans', system-ui, sans-serif;
  color: #1a1a1a;
  overflow-x: hidden;
}

/* ---- Top bar ---- */
.quiz-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  height: 56px;
  background: rgba(250, 246, 239, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(27,67,50,0.08);
}

.quiz-topbar-brand {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: #1B4332;
  text-decoration: none;
  letter-spacing: -0.02em;
}

.quiz-topbar-brand span {
  color: #C9763A;
}

.quiz-progress-text {
  font-size: 0.8rem;
  color: #888;
  font-weight: 500;
  letter-spacing: 0.05em;
}

.quiz-topbar-back {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: none;
  border: 1px solid rgba(27,67,50,0.2);
  border-radius: 8px;
  padding: 0.35rem 0.85rem;
  font-size: 0.82rem;
  color: #555;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  font-family: 'DM Sans', system-ui, sans-serif;
  text-decoration: none;
  font-weight: 500;
}

.quiz-topbar-back:hover {
  color: #1B4332;
  border-color: #1B4332;
  background: rgba(27,67,50,0.04);
}

.quiz-topbar-back svg {
  width: 14px;
  height: 14px;
}

/* ---- Progress bar (thin, forest green) ---- */
.quiz-progress-track {
  position: fixed;
  top: 56px;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(27,67,50,0.12);
  z-index: 49;
}

.quiz-progress-fill {
  height: 100%;
  background: #1B4332;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 0 2px 2px 0;
}

/* ---- Main content area ---- */
.quiz-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 1.5rem 2rem;
  min-height: 100dvh;
}

/* ---- Goal Selector ---- */
.quiz-goal-hero {
  text-align: center;
  max-width: 580px;
  margin: 0 auto 3rem;
}

.quiz-goal-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #C9763A;
  background: rgba(201,118,58,0.1);
  border: 1px solid rgba(201,118,58,0.25);
  border-radius: 99px;
  padding: 0.25rem 0.85rem;
  margin-bottom: 1.25rem;
}

.quiz-goal-hero h1 {
  font-family: 'Fraunces', Georgia, serif;
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  color: #1B4332;
  line-height: 1.1;
  margin: 0 0 0.75rem;
  letter-spacing: -0.03em;
}

.quiz-goal-hero p {
  font-size: 1rem;
  color: #666;
  line-height: 1.6;
  margin: 0;
}

.quiz-goal-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  max-width: 580px;
  width: 100%;
}

@media (max-width: 500px) {
  .quiz-goal-grid { grid-template-columns: 1fr; }
}

.quiz-goal-card {
  background: #fff;
  border: 2px solid rgba(27,67,50,0.12);
  border-radius: 16px;
  padding: 1.5rem 1.25rem;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
  text-decoration: none;
  display: block;
  text-align: left;
  position: relative;
  overflow: hidden;
}

.quiz-goal-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(27,67,50,0.03) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.2s;
}

.quiz-goal-card:hover {
  border-color: #1B4332;
  box-shadow: 0 6px 28px rgba(27,67,50,0.12);
  transform: translateY(-2px);
}

.quiz-goal-card:hover::before { opacity: 1; }

.quiz-goal-icon {
  font-size: 2rem;
  margin-bottom: 0.85rem;
  display: block;
}

.quiz-goal-card h2 {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: #1B4332;
  margin: 0 0 0.5rem;
  letter-spacing: -0.02em;
}

.quiz-goal-card p {
  font-size: 0.82rem;
  color: #777;
  line-height: 1.5;
  margin: 0 0 0.85rem;
}

.quiz-goal-tag {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #1B4332;
  background: rgba(27,67,50,0.08);
  border-radius: 4px;
  padding: 0.2rem 0.6rem;
}

/* ---- Question Panel ---- */
.quiz-panel {
  width: 100%;
  max-width: 640px;
  position: relative;
}

/* Question transition container */
.quiz-question-container {
  position: relative;
}

/* Slide animations */
@keyframes slideFromRight {
  from { opacity: 0; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes slideFromLeft {
  from { opacity: 0; transform: translateX(-40px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes slideToLeft {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(-40px); }
}

@keyframes slideToRight {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(40px); }
}

.anim-slide-in-right { animation: slideFromRight 0.35s cubic-bezier(0.22, 1, 0.36, 1) forwards; }
.anim-slide-in-left  { animation: slideFromLeft  0.35s cubic-bezier(0.22, 1, 0.36, 1) forwards; }

/* Question text */
.quiz-question-text {
  font-family: 'Fraunces', Georgia, serif;
  font-size: clamp(1.5rem, 4vw, 2.1rem);
  font-weight: 800;
  color: #1B4332;
  line-height: 1.2;
  margin: 0 0 0.5rem;
  letter-spacing: -0.03em;
}

.quiz-question-meta {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #C9763A;
  margin-bottom: 2rem;
}

/* Answer grid — single-column full-width cards */
.quiz-options-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

/* Large answer cards */
.quiz-option-card {
  background: #fff;
  border: 2px solid rgba(27,67,50,0.12);
  border-radius: 12px;
  padding: 1.1rem 1.25rem;
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s, box-shadow 0.18s, transform 0.15s;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  user-select: none;
}

.quiz-option-card:hover {
  border-color: #1B4332;
  box-shadow: 0 4px 16px rgba(27,67,50,0.1);
  transform: translateY(-1px);
}

.quiz-option-card.selected {
  border-color: #1B4332;
  background: #1B4332;
  color: #fff;
}

.quiz-option-card.selected .quiz-option-key {
  background: rgba(255,255,255,0.2);
  color: #fff;
}

.quiz-option-card.selected .quiz-option-text {
  color: #fff;
}

.quiz-option-key {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(27,67,50,0.06);
  color: #1B4332;
  font-size: 0.78rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.18s, color 0.18s;
}

.quiz-option-text {
  font-size: 0.95rem;
  font-weight: 500;
  color: #1a1a1a;
  transition: color 0.18s;
  line-height: 1.35;
}

/* Multi-select variant */
.quiz-option-card.multi-selected {
  border-color: #1B4332;
  background: rgba(27,67,50,0.06);
}

.quiz-option-card.multi-selected .quiz-option-key {
  background: #1B4332;
  color: #fff;
}

/* Keyboard hint */
.quiz-key-hint {
  font-size: 0.68rem;
  color: #aaa;
  font-weight: 500;
  margin-top: 1.5rem;
  text-align: center;
  letter-spacing: 0.04em;
}

.quiz-key-hint kbd {
  display: inline-block;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 5px;
  padding: 0.1rem 0.45rem;
  font-family: monospace;
  font-size: 0.72rem;
  color: #555;
  box-shadow: 0 1px 0 #ccc;
}

/* Text input options */
.quiz-text-input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.9rem 1.1rem;
  border: 2px solid rgba(27,67,50,0.15);
  border-radius: 12px;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 1rem;
  color: #1a1a1a;
  background: #fff;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.quiz-text-input:focus {
  border-color: #1B4332;
  box-shadow: 0 0 0 3px rgba(27,67,50,0.08);
}

/* Continue button (for text inputs) */
.quiz-continue-btn {
  margin-top: 1rem;
  background: #1B4332;
  color: #fff;
  border: none;
  padding: 0.85rem 2.25rem;
  border-radius: 10px;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s, transform 0.15s;
  width: 100%;
}

.quiz-continue-btn:hover { background: #2a5a44; transform: translateY(-1px); }
.quiz-continue-btn:active { transform: translateY(0); }

/* Auto-advance indicator */
.quiz-advancing-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  background: rgba(250,246,239,0.6);
  opacity: 0;
  transition: opacity 0.2s;
}

.quiz-advancing-overlay.active {
  opacity: 1;
}

/* Spinner for advancing */
@keyframes quiz-spin {
  to { transform: rotate(360deg); }
}

.quiz-advancing-overlay .spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 28px;
  height: 28px;
  border: 3px solid rgba(27,67,50,0.15);
  border-top-color: #1B4332;
  border-radius: 50%;
  animation: quiz-spin 0.6s linear infinite;
  display: none;
}

.quiz-advancing-overlay.active .spinner { display: block; }

/* Hidden form (used for server post) */
.quiz-hidden-form { display: none; }

/* Mobile tweaks */
@media (max-width: 500px) {
  .quiz-topbar { padding: 0 1rem; }
  .quiz-content { padding: 76px 1rem 1.5rem; }
  .quiz-question-text { font-size: 1.4rem; }
}