:root {
  --navy: #003366;
  --navy-dark: #00264D;
  --navy-deeper: #001A33;
  --heritage-red: #C42032;
  --heritage-red-dark: #A01A28;
  --cream: #F5F0EB;
  --cream-dark: #E8E0D6;
  --warm-white: #FAF8F5;
  --white: #FFFFFF;
  --text-dark: #222222;
  --text-medium: #555555;
  --text-light: #888888;
  --border: #D6CFC6;
  --correct-green: #2E7D32;
  --correct-green-bg: #E8F5E9;
  --incorrect-red-bg: #FDEAEA;
  --gold: #C9A94E;
  --font-sans: 'Barlow', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-serif: 'Playfair Display', Georgia, 'Times New Roman', serif;
}

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

html {
  font-size: 16px;
}

body {
  font-family: var(--font-sans);
  background-color: var(--cream);
  color: var(--text-dark);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.screen {
  display: none;
  min-height: 100vh;
  padding: 2rem 1.5rem;
}

.screen.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.screen.fade-in {
  animation: fadeIn 0.5s ease;
}

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

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

/* ===== BOOK PAGE-TURN ===== */
.quiz-card,
.feedback-card {
  position: relative;
  perspective: 900px;
  overflow: visible;
}

.quiz-content,
.feedback-info-section {
  backface-visibility: hidden;
}

@keyframes panelTurnOut {
  0% {
    transform: rotateY(0deg);
    box-shadow: 0 0 0 rgba(0, 0, 0, 0);
  }
  40% {
    box-shadow: -6px 0 20px rgba(0, 0, 0, 0.15);
  }
  100% {
    transform: rotateY(-95deg);
    box-shadow: -4px 0 12px rgba(0, 0, 0, 0.1);
  }
}

@keyframes panelTurnIn {
  0% {
    transform: rotateY(95deg);
    box-shadow: 4px 0 12px rgba(0, 0, 0, 0.1);
  }
  60% {
    box-shadow: 6px 0 20px rgba(0, 0, 0, 0.15);
  }
  100% {
    transform: rotateY(0deg);
    box-shadow: 0 0 0 rgba(0, 0, 0, 0);
  }
}

.panel-turn-out {
  transform-origin: left center;
  animation: panelTurnOut 0.5s cubic-bezier(0.3, 0.0, 0.7, 1) forwards;
  z-index: 10;
  backface-visibility: hidden;
}

.panel-turn-in {
  transform-origin: left center;
  animation: panelTurnIn 0.45s cubic-bezier(0.1, 0.0, 0.3, 1) forwards;
  z-index: 10;
  backface-visibility: hidden;
}

/* ===== RED ACCENT BAR ===== */
.divider {
  width: 60px;
  height: 3px;
  background: var(--heritage-red);
  margin: 1.5rem auto;
}

/* ===== HERITAGE BADGE ===== */
.heritage-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  margin-top: 2.5rem;
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.badge-the,
.badge-foundation {
  color: var(--text-medium);
  font-weight: 600;
}

.badge-heritage {
  color: var(--heritage-red);
  font-weight: 800;
}

/* ===== LOGO ===== */
.logo-header {
  margin-bottom: 2rem;
}

.heritage-logo {
  max-width: 200px;
  height: auto;
}

/* ===== BUTTONS ===== */
.btn-primary {
  display: inline-block;
  background: var(--heritage-red);
  color: var(--white);
  border: none;
  padding: 0.875rem 2.5rem;
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
}

.btn-primary:hover {
  background: var(--heritage-red-dark);
  transform: translateY(-1px);
}

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

.btn-secondary {
  display: inline-block;
  background: transparent;
  color: var(--navy);
  border: 2px solid var(--navy);
  padding: 0.8rem 2.5rem;
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: var(--navy);
  color: var(--white);
}

/* ===== START SCREEN ===== */
.start-container {
  max-width: 540px;
  width: 100%;
  text-align: center;
}

.start-card {
  background: var(--white);
  padding: 3.5rem 3rem 3rem;
  border-top: 4px solid var(--heritage-red);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 8px 24px rgba(0, 0, 0, 0.04);
  position: relative;
}

.start-card::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 3rem;
  right: 3rem;
  height: 1px;
  border-bottom: 2px dotted var(--border);
}

.start-title {
  font-family: var(--font-serif);
  font-size: 2.25rem;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.15;
  margin-bottom: 0.5rem;
}

.start-subtitle {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.3em;
  color: var(--text-light);
  text-transform: uppercase;
}

.start-description {
  font-family: var(--font-serif);
  font-size: 1rem;
  line-height: 1.75;
  color: var(--text-medium);
  font-style: italic;
  margin-bottom: 0.75rem;
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
}

.start-instructions {
  font-size: 0.875rem;
  color: var(--text-dark);
  margin-bottom: 2rem;
  font-weight: 600;
}

/* ===== PROGRESS BAR ===== */
.progress-bar-container {
  width: 100%;
  max-width: 880px;
  height: 3px;
  background: var(--cream-dark);
  margin: 0 auto 0.75rem;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--heritage-red);
  width: 0%;
  transition: width 0.4s ease;
}

.progress-text {
  text-align: center;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--text-light);
  margin-bottom: 1.25rem;
  font-variant-numeric: tabular-nums;
}

/* ===== QUIZ CARD ===== */
.quiz-container {
  max-width: 880px;
  width: 100%;
  margin: 0 auto;
}

.quiz-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--white);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 8px 24px rgba(0, 0, 0, 0.04);
  overflow: hidden;
  animation: slideIn 0.35s ease;
  min-height: 520px;
  position: relative;
}

.portrait-container {
  position: relative;
  overflow: hidden;
  background: var(--navy-deeper);
  min-height: 420px;
}

.portrait-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
}

.portrait-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 40%;
  background: linear-gradient(to top, rgba(0,26,51,0.5), transparent);
  pointer-events: none;
}

.quiz-content {
  padding: 2.5rem 2.5rem 2.5rem 2rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-left: 3px dotted var(--cream-dark);
}

.quiz-question {
  font-family: var(--font-serif);
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 2rem;
  line-height: 1.3;
}

.options-grid {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.option-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.875rem 1.125rem;
  border: 1.5px solid var(--border);
  background: var(--white);
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-dark);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
  letter-spacing: 0.01em;
}

.option-btn::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  background: var(--navy);
  transition: width 0.2s ease;
}

.option-btn:hover:not(.disabled) {
  border-color: var(--navy);
  color: var(--navy);
  background: var(--warm-white);
  padding-left: 1.375rem;
}

.option-btn:hover:not(.disabled)::before {
  width: 3px;
}

.option-btn.correct {
  border-color: var(--correct-green);
  background: var(--correct-green-bg);
  color: var(--correct-green);
  padding-left: 1.375rem;
}

.option-btn.correct::before {
  width: 3px;
  background: var(--correct-green);
}

.option-btn.incorrect {
  border-color: var(--heritage-red);
  background: var(--incorrect-red-bg);
  color: var(--heritage-red);
  opacity: 0.85;
  padding-left: 1.375rem;
}

.option-btn.incorrect::before {
  width: 3px;
  background: var(--heritage-red);
}

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

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

/* ===== FEEDBACK SCREEN ===== */
.feedback-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--white);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 8px 24px rgba(0, 0, 0, 0.04);
  overflow: hidden;
  animation: slideIn 0.35s ease;
  min-height: 520px;
}

.feedback-portrait-section {
  position: relative;
  overflow: hidden;
  background: var(--navy-deeper);
}

.feedback-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
}

.feedback-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 2rem 1.75rem;
  background: linear-gradient(to top, rgba(0,26,51,0.85) 0%, rgba(0,26,51,0.5) 50%, transparent 100%);
}

.feedback-tagline {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.5rem;
  line-height: 1.25;
  color: var(--white);
  margin-bottom: 0.625rem;
  text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

.feedback-name-overlay {
  font-family: var(--font-sans);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.8);
}

.feedback-info-section {
  padding: 2.5rem 2.5rem 2.5rem 2rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-left: 3px dotted var(--cream-dark);
}

.feedback-result {
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  padding: 0.375rem 0.875rem;
  display: inline-block;
  margin-bottom: 1.25rem;
  width: fit-content;
}

.feedback-result.correct {
  background: var(--correct-green-bg);
  color: var(--correct-green);
}

.feedback-result.incorrect {
  background: var(--incorrect-red-bg);
  color: var(--heritage-red);
}

.feedback-divider {
  width: 50px;
  height: 2px;
  background: var(--heritage-red);
  margin-bottom: 1.25rem;
}

.feedback-founder-name {
  font-size: 1rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 1.25rem;
}

.founder-first {
  font-weight: 400;
  color: var(--text-medium);
}

.founder-last {
  font-weight: 800;
  color: var(--navy);
}

.feedback-bio {
  font-family: var(--font-serif);
  font-size: 0.9375rem;
  line-height: 1.75;
  color: var(--text-medium);
  margin-bottom: 2rem;
}

/* ===== RESULTS SCREEN ===== */
.results-container {
  max-width: 880px;
  width: 100%;
  text-align: center;
}

.results-card {
  background: var(--white);
  padding: 3rem 2.5rem;
  border-top: 4px solid var(--heritage-red);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 8px 24px rgba(0, 0, 0, 0.04);
  margin-bottom: 2rem;
  position: relative;
}

.results-title {
  font-family: var(--font-serif);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--navy);
}

.score-display {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.25rem;
  margin-bottom: 0.25rem;
}

.score-number {
  font-family: var(--font-serif);
  font-size: 4.5rem;
  font-weight: 700;
  color: var(--navy);
  line-height: 1;
}

.score-total {
  font-family: var(--font-serif);
  font-size: 1.75rem;
  color: var(--text-light);
}

.score-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-light);
  margin-bottom: 1.5rem;
}

.results-message {
  font-family: var(--font-serif);
  font-size: 1.0625rem;
  font-style: italic;
  line-height: 1.65;
  color: var(--text-medium);
  max-width: 440px;
  margin: 0 auto 2rem;
}

.results-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.875rem;
  margin-bottom: 1rem;
}

.result-card-mini {
  background: var(--white);
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  overflow: hidden;
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  border-bottom: 2px solid var(--cream-dark);
}

.result-card-mini:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.result-card-mini img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  object-position: center top;
  display: block;
}

.result-card-mini .mini-name {
  padding: 0.5rem 0.375rem;
  font-size: 0.6875rem;
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.03em;
  color: var(--text-dark);
}

.result-card-mini .mini-icon {
  position: absolute;
  top: 0.375rem;
  right: 0.375rem;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--white);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.mini-icon.correct {
  background: var(--correct-green);
}

.mini-icon.incorrect {
  background: var(--heritage-red);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .screen {
    padding: 1.25rem 1rem;
    align-items: flex-start;
    padding-top: 1.5rem;
  }

  .quiz-card,
  .feedback-card {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .portrait-container {
    min-height: 280px;
    max-height: 320px;
  }

  .quiz-content {
    padding: 1.5rem;
    border-left: none;
    border-top: 3px dotted var(--cream-dark);
  }

  .quiz-question {
    font-size: 1.125rem;
    margin-bottom: 1.25rem;
  }

  .feedback-portrait-section {
    min-height: 280px;
    max-height: 320px;
  }

  .feedback-tagline {
    font-size: 1.2rem;
  }

  .feedback-info-section {
    padding: 1.5rem;
    border-left: none;
    border-top: 3px dotted var(--cream-dark);
  }

  .start-card {
    padding: 2.5rem 1.75rem 2rem;
  }

  .start-card::after {
    left: 1.75rem;
    right: 1.75rem;
  }

  .start-title {
    font-size: 1.75rem;
  }

  .results-card {
    padding: 2rem 1.5rem;
  }

  .results-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
  }

  .score-number {
    font-size: 3.5rem;
  }

  .result-card-mini .mini-name {
    font-size: 0.6rem;
    padding: 0.35rem 0.25rem;
  }
}

@media (max-width: 480px) {
  .results-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 0.35rem;
  }

  .result-card-mini .mini-name {
    font-size: 0.5rem;
    padding: 0.25rem;
  }

  .mini-icon {
    width: 1rem;
    height: 1rem;
  }

  .mini-icon svg {
    width: 8px;
    height: 8px;
  }

  .option-btn {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
  }
}
