:root {
  --bg: #fcf7f1;
  --bg-deep: #f4ece3;
  --surface: rgba(255, 252, 248, 0.84);
  --surface-strong: #fffaf5;
  --surface-soft: #f8f0e8;
  --text: #241b1d;
  --muted: #6d5b5f;
  --line: rgba(133, 104, 108, 0.2);
  --line-strong: rgba(133, 104, 108, 0.36);
  --accent: #a34b61;
  --accent-deep: #7a3045;
  --accent-soft: #f5d8de;
  --gold: #d4b063;
  --success: #2f7a60;
  --danger: #b04356;
  --shadow: 0 24px 60px rgba(123, 71, 78, 0.13);
  --shadow-soft: 0 10px 30px rgba(123, 71, 78, 0.08);
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 14px;
  --content-width: 1180px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at top left, rgba(250, 230, 219, 0.6), transparent 25%),
    radial-gradient(circle at bottom right, rgba(232, 198, 178, 0.4), transparent 24%),
    linear-gradient(180deg, #fffaf6 0%, var(--bg) 42%, var(--bg-deep) 100%);
  color: var(--text);
  font-family: "Manrope", sans-serif;
}

button,
input {
  font: inherit;
}

.page-shell {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
}

.hero-hearts,
.answer-burst {
  pointer-events: none;
}

.hero-hearts {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.hero-heart {
  position: absolute;
  bottom: -2rem;
  color: rgba(163, 75, 97, 0.16);
  animation: float-heart linear forwards;
  user-select: none;
}

@keyframes float-heart {
  0% {
    transform: translate3d(0, 0, 0) scale(0.9) rotate(0deg);
    opacity: 0;
  }
  12% {
    opacity: 1;
  }
  100% {
    transform: translate3d(var(--drift, 0px), -110vh, 0) scale(1.15) rotate(18deg);
    opacity: 0;
  }
}

.answer-burst {
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: 60;
}

.burst-heart {
  position: fixed;
  left: 0;
  top: 0;
  color: var(--burst-color, var(--accent));
  font-size: var(--burst-size, 1.25rem);
  text-shadow: 0 0 14px rgba(255, 255, 255, 0.35);
  will-change: transform, opacity;
  animation: burst-heart var(--burst-duration, 1100ms) cubic-bezier(0.16, 0.84, 0.22, 1) forwards;
  user-select: none;
}

@keyframes burst-heart {
  0% {
    transform:
      translate3d(var(--origin-x, 0px), var(--origin-y, 0px), 0)
      scale(0.35)
      rotate(0deg);
    opacity: 0;
  }
  12% {
    opacity: 1;
  }
  72% {
    opacity: 1;
  }
  100% {
    transform:
      translate3d(
        calc(var(--origin-x, 0px) + var(--x, 0px)),
        calc(var(--origin-y, 0px) + var(--y, -120px)),
        0
      )
      scale(var(--burst-scale, 1.15))
      rotate(var(--rotate, 12deg));
    opacity: 0;
  }
}

.ambient,
.spark {
  position: absolute;
  pointer-events: none;
}

.ambient {
  width: 36rem;
  height: 36rem;
  border-radius: 999px;
  filter: blur(18px);
  opacity: 0.6;
}

.ambient-left {
  top: 8rem;
  left: -12rem;
  background: radial-gradient(circle, rgba(249, 213, 220, 0.8), transparent 70%);
}

.ambient-right {
  right: -8rem;
  bottom: 4rem;
  background: radial-gradient(circle, rgba(229, 202, 173, 0.65), transparent 68%);
}

.spark {
  width: 10rem;
  height: 10rem;
  opacity: 0.25;
  background:
    linear-gradient(45deg, transparent 40%, rgba(255, 255, 255, 0.9) 50%, transparent 60%),
    linear-gradient(-45deg, transparent 40%, rgba(255, 255, 255, 0.9) 50%, transparent 60%);
}

.spark-a {
  top: 9rem;
  left: -1.5rem;
  transform: rotate(6deg);
}

.spark-b {
  right: 4rem;
  bottom: 8rem;
  transform: scale(1.3) rotate(-12deg);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem clamp(1rem, 2vw, 2rem);
  background: transparent;
}

.brand-lockup {
  display: grid;
  gap: 0.25rem;
}

.eyebrow,
.question-index,
.question-subtitle,
.helper-text,
.stat-label,
.meta-label,
.summary-label {
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.eyebrow,
.helper-text,
.stat-label,
.meta-label,
.summary-label,
.question-index,
.question-subtitle {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.brand-title {
  color: var(--accent-deep);
  text-decoration: none;
  font-family: "Playfair Display", serif;
  font-size: clamp(2rem, 4vw, 3.25rem);
  line-height: 0.94;
  font-weight: 700;
}

.app {
  width: min(100%, var(--content-width));
  margin: 0 auto;
  padding: clamp(1.25rem, 2vw, 2rem);
  padding-bottom: 4rem;
}

.screen {
  display: none;
}

.screen-active {
  display: block;
}

.hero-screen,
.result-screen {
  padding-top: clamp(0.5rem, 3vw, 2rem);
}

.hero-card,
.result-card,
.question-card,
.quiz-sidebar {
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-xl);
  background: var(--surface);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.hero-card,
.result-card {
  max-width: 940px;
  margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 3rem);
}

.hero-card::before,
.result-card::before,
.question-card::before,
.quiz-sidebar::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(212, 176, 99, 0.65), rgba(255, 255, 255, 0.2));
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.hero-card {
  text-align: center;
}

.hero-card-unlock {
  max-width: 640px;
  padding-top: 4rem;
  padding-bottom: 2rem;
  background: transparent;
  border: 0;
  box-shadow: none;
  backdrop-filter: none;
}

.hero-card-unlock::before {
  display: none;
}

.hero-corner {
  position: fixed;
  width: 11rem;
  height: 11rem;
  border: 2px solid rgba(133, 104, 108, 0.12);
  pointer-events: none;
}

.hero-corner-left {
  top: 3rem;
  left: 2rem;
  border-right: 0;
  border-bottom: 0;
  border-top-left-radius: 9rem;
}

.hero-corner-right {
  right: 2rem;
  bottom: 3rem;
  border-left: 0;
  border-top: 0;
  border-bottom-right-radius: 9rem;
}

.hero-emblem {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 2rem;
}

.hero-avatar-ring {
  width: clamp(8rem, 18vw, 14rem);
  height: clamp(8rem, 18vw, 14rem);
  padding: 0.45rem;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(212, 176, 99, 0.95), rgba(154, 112, 38, 0.7));
  box-shadow: 0 20px 36px rgba(123, 71, 78, 0.16);
}

.hero-avatar-core {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  overflow: hidden;
  background: #f5dcc8;
  border: 4px solid rgba(255, 255, 255, 0.9);
}

.hero-avatar-core img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-heart-badge {
  position: absolute;
  right: -0.25rem;
  bottom: 0.35rem;
  width: 3.3rem;
  height: 3.3rem;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #8d5562;
  color: #fff;
  box-shadow: 0 10px 24px rgba(123, 71, 78, 0.24);
  font-size: 1.6rem;
}

h1,
h2,
.sidebar-title,
.question-text,
.result-score {
  margin: 0;
  font-family: "Playfair Display", serif;
}

h1 {
  font-size: clamp(2.7rem, 6vw, 4.8rem);
  line-height: 0.98;
  max-width: 12ch;
  margin: 0 auto;
}

.hero-copy,
.sidebar-copy,
.question-hint,
.feedback-text,
.result-copy {
  color: var(--muted);
  line-height: 1.72;
  font-size: 1.05rem;
}

.hero-copy {
  max-width: 28rem;
  margin: 0.8rem auto 0;
  font-family: "Playfair Display", serif;
  font-size: 1.1rem;
  line-height: 1.5;
}

.hero-stats,
.result-summary,
.meta-panel {
  display: grid;
  gap: 1rem;
}

.hero-stats {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 1.5rem;
}

.stat-card,
.summary-tile,
.meta-card {
  padding: 1rem 1.1rem;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.52);
  border: 1px solid rgba(133, 104, 108, 0.12);
}

.stat-value,
.summary-value,
.meta-value {
  display: block;
  margin-top: 0.35rem;
  color: var(--text);
  font-weight: 800;
  font-size: 1rem;
}

.hero-actions,
.result-actions,
.question-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
}

.hero-actions,
.result-actions {
  justify-content: center;
  margin-top: 1rem;
}

.button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 1rem 1.5rem;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    border-color 180ms ease,
    background-color 180ms ease,
    color 180ms ease,
    opacity 180ms ease;
  cursor: pointer;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.button-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: #fff7fa;
  box-shadow: 0 18px 36px rgba(163, 75, 97, 0.24);
}

.button-secondary,
.button-ghost {
  background: rgba(255, 255, 255, 0.5);
  color: var(--accent-deep);
  border: 1px solid rgba(163, 75, 97, 0.18);
}

.button-ghost {
  box-shadow: none;
}

.helper-text {
  margin-top: 1rem;
}

.helper-text code {
  font-family: inherit;
  color: var(--accent-deep);
}

.file-loader {
  margin-top: 1rem;
}

.unlock-card {
  width: min(100%, 24rem);
  margin: 2rem auto 0;
  padding: 2rem 1.8rem 1.8rem;
  border-radius: 20px;
  background: rgba(255, 253, 249, 0.78);
  border: 1px solid rgba(133, 104, 108, 0.12);
  box-shadow: var(--shadow-soft);
}

.unlock-label {
  margin: 0 0 1rem;
  color: var(--accent-deep);
  font-family: "Playfair Display", serif;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.phrase-input {
  width: 100%;
  padding: 0.9rem 0.1rem 0.7rem;
  border: 0;
  border-bottom: 1px solid rgba(133, 104, 108, 0.22);
  background: transparent;
  color: var(--text);
  text-align: center;
  font-family: "Playfair Display", serif;
  font-size: 1.95rem;
  font-weight: 600;
  outline: none;
}

.phrase-input::placeholder {
  color: rgba(109, 91, 95, 0.32);
}

.unlock-hint,
.phrase-error {
  margin: 0.85rem 0 0;
  color: var(--muted);
  font-family: "Playfair Display", serif;
  font-size: 0.95rem;
  line-height: 1.4;
}

.phrase-error {
  color: var(--danger);
}

.unlock-button {
  width: 100%;
  margin-top: 1.4rem;
}

.hero-monogram {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 2rem;
  color: rgba(133, 104, 108, 0.42);
}

.hero-monogram span {
  width: 3rem;
  height: 1px;
  background: rgba(133, 104, 108, 0.18);
}

.hero-monogram strong {
  font-size: 2rem;
  font-weight: 300;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.file-trigger {
  display: inline-flex;
}

#fileInput {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.quiz-frame {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}

.quiz-sidebar,
.question-card {
  padding: clamp(1.2rem, 3vw, 2rem);
}

.quiz-sidebar {
  position: sticky;
  top: 6rem;
}

.sidebar-title {
  margin-top: 0.6rem;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 0.96;
}

.sidebar-copy {
  margin: 1rem 0 0;
}

.progress-panel {
  margin-top: 1.75rem;
  padding: 1rem;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.44);
  border: 1px solid rgba(133, 104, 108, 0.12);
}

.progress-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 700;
}

.progress-track {
  height: 0.65rem;
  margin-top: 0.9rem;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(163, 75, 97, 0.1);
}

.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), var(--accent));
  transition: width 240ms ease;
}

.heart-meter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 1rem;
}

.heart-chip {
  color: rgba(163, 75, 97, 0.22);
  font-size: 1rem;
}

.heart-chip.filled {
  color: var(--accent);
}

.meta-panel {
  grid-template-columns: 1fr 1fr;
  margin-top: 1rem;
}

.question-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.question-text {
  font-size: clamp(2rem, 4vw, 3.35rem);
  line-height: 1.02;
  max-width: 16ch;
}

.question-hint {
  margin: 1rem 0 0;
}

.options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
  margin-top: 2rem;
}

.media-frame {
  margin-top: 1.5rem;
  overflow: hidden;
  border-radius: 28px;
  border: 1px solid rgba(133, 104, 108, 0.18);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(248, 240, 232, 0.96));
  box-shadow: var(--shadow-soft);
}

.question-image {
  display: block;
  width: 100%;
  max-height: min(70vh, 720px);
  object-fit: contain;
  object-position: center;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.9), rgba(244, 236, 227, 0.95));
}

.media-caption {
  padding: 0.9rem 1rem 1rem;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.option-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 5.5rem;
  padding: 1.15rem 1.2rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.56);
  color: var(--text);
  text-align: left;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.option-card:hover:not([disabled]) {
  border-color: rgba(163, 75, 97, 0.34);
  background: rgba(255, 255, 255, 0.78);
}

.option-card.selected {
  border-color: rgba(163, 75, 97, 0.48);
  background: linear-gradient(180deg, rgba(255, 244, 246, 0.95), rgba(247, 230, 235, 0.95));
  transform: translateY(-1px);
}

.option-card.correct {
  border-color: rgba(47, 122, 96, 0.36);
  background: linear-gradient(180deg, rgba(240, 253, 247, 0.96), rgba(227, 247, 237, 0.96));
}

.option-card.incorrect {
  border-color: rgba(176, 67, 86, 0.36);
  background: linear-gradient(180deg, rgba(255, 245, 246, 0.96), rgba(250, 226, 231, 0.96));
}

.option-copy {
  display: block;
  font-size: clamp(1rem, 1.5vw, 1.12rem);
  line-height: 1.45;
  font-weight: 700;
}

.option-mark {
  flex: 0 0 auto;
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid rgba(163, 75, 97, 0.2);
  color: var(--accent);
  background: rgba(255, 255, 255, 0.75);
  font-size: 0.95rem;
}

.feedback-card {
  margin-top: 1.25rem;
  padding: 1rem 1.1rem;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(255, 252, 247, 0.95), rgba(249, 240, 233, 0.98));
  border: 1px solid rgba(212, 176, 99, 0.28);
}

.feedback-state {
  margin: 0 0 0.35rem;
  color: var(--accent-deep);
  font-weight: 800;
}

.feedback-text {
  margin: 0;
}

.question-actions {
  justify-content: space-between;
  margin-top: 1.5rem;
}

.result-card {
  text-align: center;
}

.result-score {
  margin-top: 0.9rem;
  font-size: clamp(3rem, 8vw, 6rem);
  line-height: 0.92;
  color: var(--accent-deep);
}

.result-copy {
  max-width: 42rem;
  margin: 1rem auto 0;
}

.result-summary {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 2rem;
}

.is-hidden {
  display: none !important;
}

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

  .quiz-sidebar {
    position: static;
  }
}

@media (max-width: 760px) {
  .app {
    padding-inline: 1rem;
  }

  .hero-stats,
  .result-summary,
  .meta-panel,
  .options {
    grid-template-columns: 1fr;
  }

  .hero-corner {
    width: 6rem;
    height: 6rem;
  }

  .question-text {
    max-width: none;
  }

  .question-actions {
    flex-direction: column-reverse;
  }

  .question-actions .button,
  .hero-actions .button,
  .result-actions .button {
    width: 100%;
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
