:root {
  --bg: #eef1f5;
  --bg-warm: #faf4ef;
  --card: #ffffff;
  --ink: #1e293b;
  --muted: #64748b;
  --primary: #1e3a5f;
  --primary-hover: #152a45;
  --gold: #c9a227;
  --rose: #b76e79;
  --rose-deep: #8e4a55;
  --ivory: #fff8f3;
  --correct: #16a34a;
  --incorrect: #dc2626;
  --radius: 18px;
  --shadow: 0 18px 50px rgba(15, 23, 42, 0.12);
  --font: "DM Sans", system-ui, sans-serif;
  --serif: "Cormorant Garamond", Georgia, serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

body[data-theme="romance"] {
  background: linear-gradient(165deg, #faf4ef 0%, #f3e4e8 45%, #efe8f5 100%);
}

body[data-theme="quiz"] {
  background: #0b0b0c;
  color: #f4f4f5;
}

.app {
  min-height: 100dvh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 16px 48px;
}

.stage {
  width: 100%;
  max-width: 440px;
  animation: fadeIn 0.45s ease;
}

.stage[hidden] {
  display: none !important;
}

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

@media (prefers-reduced-motion: reduce) {
  .stage,
  .btn-no,
  .toast {
    animation: none !important;
    transition: none !important;
  }
}

/* —— Cards —— */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px 24px 28px;
  text-align: center;
  position: relative;
  overflow: visible;
}

.warranty-card {
  border: 1px solid #dbe2ea;
  background:
    linear-gradient(#fff, #fff) padding-box,
    linear-gradient(145deg, #e8edf3, #f8fafc) border-box;
}

.warranty-card::before {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px dashed #c9d4e0;
  border-radius: 12px;
  pointer-events: none;
}

.romance-card {
  background: var(--ivory);
  border: 1px solid rgba(183, 110, 121, 0.28);
  box-shadow: 0 20px 50px rgba(142, 74, 85, 0.14);
}

.seal {
  margin: 0 auto 16px;
  position: relative;
  z-index: 1;
}

.eyebrow {
  position: relative;
  z-index: 1;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  margin: 0 0 10px;
}

.eyebrow.romantic {
  color: var(--rose);
  letter-spacing: 0.16em;
}

h1 {
  position: relative;
  z-index: 1;
  font-size: clamp(1.45rem, 5vw, 1.85rem);
  line-height: 1.25;
  margin: 0 0 14px;
  font-weight: 700;
}

.romance-card h1,
.prize-card h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.6rem, 5.5vw, 2.1rem);
  color: #3f2a2e;
}

.proposal-title {
  font-family: var(--serif);
  font-size: clamp(2rem, 8vw, 2.6rem);
  font-weight: 600;
  margin: 12px 0 8px;
}

.lede {
  position: relative;
  z-index: 1;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.55;
  margin: 0 0 22px;
}

.romance-card .lede {
  color: #6b5559;
}

.fine-print {
  position: relative;
  z-index: 1;
  margin: 18px 0 0;
  font-size: 0.75rem;
  color: #94a3b8;
}

/* —— Buttons —— */
.btn {
  position: relative;
  z-index: 1;
  appearance: none;
  border: none;
  border-radius: 999px;
  padding: 14px 28px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  width: 100%;
  max-width: 280px;
  box-shadow: 0 8px 20px rgba(30, 58, 95, 0.28);
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-romance {
  background: linear-gradient(135deg, var(--rose), var(--rose-deep));
  color: #fff;
  width: 100%;
  max-width: 340px;
  box-shadow: 0 10px 24px rgba(142, 74, 85, 0.3);
}

.btn-yes {
  background: linear-gradient(135deg, #16a34a, #15803d);
  color: #fff;
  min-width: 140px;
  min-height: 52px;
  font-size: 1.1rem;
  box-shadow: 0 8px 22px rgba(22, 163, 74, 0.35);
  z-index: 5;
}

.btn-no {
  background: #e2e8f0;
  color: #475569;
  min-width: 110px;
  min-height: 48px;
  z-index: 4;
  transition: left 0.18s ease, top 0.18s ease, transform 0.18s ease;
}

.btn-next {
  background: #27272a;
  color: #fff;
  width: 100%;
  margin-top: 20px;
  border-radius: 12px;
}

body[data-theme="quiz"] .btn-next {
  background: #f4f4f5;
  color: #18181b;
}

.btn-next:disabled {
  background: #3f3f46;
  color: #a1a1aa;
}

body[data-theme="quiz"] .btn-next:disabled {
  background: #3f3f46;
  color: #71717a;
}

/* —— Proposal —— */
.proposal-actions {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-height: 120px;
  margin-top: 8px;
}

.proposal-actions .btn-no.is-floating {
  position: fixed;
}

.no-caught {
  position: relative;
  z-index: 1;
  margin: 16px 0 0;
  color: var(--rose);
  font-weight: 500;
  font-style: italic;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  background: #1e293b;
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.9rem;
  z-index: 100;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  animation: toastIn 0.25s ease;
}

.toast[hidden] {
  display: none !important;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translate(-50%, 8px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

/* —— Success —— */
.hearts {
  font-size: 1.8rem;
  color: var(--rose);
  margin-bottom: 8px;
}

.reg-id {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0 auto 20px;
  padding: 16px;
  background: rgba(183, 110, 121, 0.1);
  border: 1px solid rgba(183, 110, 121, 0.25);
  border-radius: 14px;
  max-width: 280px;
}

.reg-id span {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--rose-deep);
}

.reg-id strong {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 1.35rem;
  color: #3f2a2e;
  letter-spacing: 0.04em;
}

/* —— Quiz —— */
.quiz-shell {
  background: #111113;
  border: 1px solid #27272a;
  border-radius: 20px;
  padding: 0 0 24px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.quiz-header {
  padding: 18px 18px 0;
}

.quiz-header h1 {
  font-size: 1.05rem;
  font-weight: 600;
  color: #fafafa;
  margin: 0;
  text-align: left;
  line-height: 1.35;
}

.quiz-banner {
  margin: 14px 0 0;
  height: 148px;
  overflow: hidden;
  border-radius: 0;
}

.banner-art {
  width: 100%;
  height: 100%;
  position: relative;
  background: #2a1f22;
}

.banner-art .cover-svg {
  display: block;
  width: 100%;
  height: 100%;
}

.cover-svg .draw {
  stroke-dasharray: 280;
  stroke-dashoffset: 280;
  animation: sketchDraw 1.4s ease forwards;
}

.cover-svg .float {
  animation: sketchFloat 3.2s ease-in-out infinite;
  transform-origin: center;
}

.cover-svg .pulse {
  animation: sketchPulse 2.4s ease-in-out infinite;
}

.cover-svg .steam {
  animation: sketchSteam 2.8s ease-in-out infinite;
  opacity: 0.75;
}

@keyframes sketchDraw {
  to {
    stroke-dashoffset: 0;
  }
}

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

@keyframes sketchPulse {
  0%,
  100% {
    opacity: 0.55;
  }
  50% {
    opacity: 1;
  }
}

@keyframes sketchSteam {
  0%,
  100% {
    transform: translateY(0);
    opacity: 0.35;
  }
  50% {
    transform: translateY(-6px);
    opacity: 0.9;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cover-svg .draw,
  .cover-svg .float,
  .cover-svg .pulse,
  .cover-svg .steam {
    animation: none !important;
    stroke-dashoffset: 0;
  }
}

.quiz-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid #27272a;
}

.progress {
  font-size: 0.85rem;
  color: #a1a1aa;
  min-width: 64px;
}

.quiz-tools {
  margin-left: auto;
}

.icon-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: #e4e4e7;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  font-size: 1.25rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:hover:not(:disabled) {
  background: #27272a;
}

.icon-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.hint-box {
  margin: 12px 16px 0;
  padding: 10px 12px;
  background: #1c1917;
  border: 1px solid #3f3f46;
  border-radius: 10px;
  color: #fde68a;
  font-size: 0.88rem;
  line-height: 1.45;
  text-align: left;
}

.hint-box[hidden] {
  display: none !important;
}

.quiz-prompt {
  margin: 16px 16px 12px;
  font-size: 1.02rem;
  line-height: 1.5;
  color: #fafafa;
  text-align: left;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 8px;
}

.option {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 10px 12px;
  align-items: start;
  width: 100%;
  text-align: left;
  appearance: none;
  border: none;
  background: transparent;
  color: #f4f4f5;
  padding: 12px 10px;
  border-radius: 12px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.4;
}

.option:hover:not(:disabled) {
  background: #1c1c1f;
}

.option:disabled {
  cursor: default;
}

.option-letter {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.5px solid #52525b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.9rem;
  color: #e4e4e7;
  flex-shrink: 0;
}

.option-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 6px;
}

.option-label {
  color: #f4f4f5;
}

.option-feedback {
  color: #a1a1aa;
  font-size: 0.86rem;
  line-height: 1.4;
}

.option-feedback[hidden] {
  display: none !important;
}

.option.is-correct .option-letter {
  background: var(--correct);
  border-color: var(--correct);
  color: #fff;
}

.option.is-incorrect .option-letter {
  background: var(--incorrect);
  border-color: var(--incorrect);
  color: #fff;
}

.option.is-revealed .option-letter {
  border-color: #71717a;
}

.stage-quiz .btn-next {
  margin: 20px 16px 0;
  width: calc(100% - 32px);
}

/* —— Scorecard —— */
.score-card {
  padding-top: 40px;
  padding-bottom: 36px;
}

.score-heading {
  margin-bottom: 8px;
}

.score-value {
  position: relative;
  z-index: 1;
  margin: 8px 0 18px;
  font-family: var(--serif);
  font-size: clamp(3rem, 14vw, 4rem);
  font-weight: 600;
  color: #3f2a2e;
  letter-spacing: 0.02em;
  line-height: 1;
}

.score-message {
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
}

.score-card .btn {
  margin-top: 4px;
}

.score-card .btn[hidden] {
  display: none !important;
}

.option.is-waiting .option-letter {
  border-color: #a1a1aa;
}

.option-nudge {
  margin: 8px 16px 0;
  font-size: 0.85rem;
  color: #fcd34d;
  text-align: left;
}

.option-nudge[hidden] {
  display: none !important;
}

/* —— Finale —— */
.prize-card {
  text-align: center;
}

.key-icon {
  font-size: 2.4rem;
  margin-bottom: 8px;
}

.key-location {
  position: relative;
  z-index: 1;
  margin-top: 8px;
  padding: 18px 16px;
  background: linear-gradient(145deg, #3f2a2e, #5c3a42);
  color: #fff8f3;
  border-radius: 16px;
  box-shadow: 0 12px 30px rgba(63, 42, 46, 0.35);
}

.key-label {
  margin: 0 0 10px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  opacity: 0.85;
}

.key-reveal {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.25rem;
  line-height: 1.4;
  font-weight: 600;
}

.key-reveal-follow {
  margin-top: 14px;
  font-size: 1.1rem;
  font-weight: 500;
}

.key-photo {
  margin: 14px 0 0;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 248, 243, 0.25);
  background: rgba(0, 0, 0, 0.15);
}

.key-photo img {
  display: block;
  width: 100%;
  height: auto;
  vertical-align: middle;
}

@media (min-width: 480px) {
  .app {
    align-items: center;
    padding: 40px 20px;
  }
}
