:root {
  color-scheme: light;
  --ink: #3e2530;
  --muted: #806a72;
  --paper: rgba(255, 251, 247, 0.94);
  --cream: #f8eee8;
  --rose: #9e3f5f;
  --rose-dark: #6f2946;
  --rose-soft: #f4d9dc;
  --gold: #c99a4a;
  --line: rgba(111, 41, 70, 0.14);
  --shadow: 0 24px 70px rgba(87, 40, 57, 0.17);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--cream);
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 12%, rgba(239, 182, 174, 0.48), transparent 34%),
    radial-gradient(circle at 88% 86%, rgba(201, 154, 74, 0.22), transparent 32%),
    linear-gradient(145deg, #fff9f4 0%, #f7e5e4 52%, #f3e8dd 100%);
}

body::before,
body::after {
  position: fixed;
  z-index: 0;
  color: rgba(158, 63, 95, 0.075);
  font-family: Georgia, serif;
  font-size: clamp(8rem, 36vw, 22rem);
  line-height: 1;
  content: "♥";
  pointer-events: none;
}

body::before {
  top: -0.28em;
  right: -0.22em;
  transform: rotate(18deg);
}

body::after {
  bottom: -0.32em;
  left: -0.22em;
  transform: rotate(-16deg);
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(201, 154, 74, 0.72);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.app-shell,
.login-shell {
  position: relative;
  z-index: 1;
  display: grid;
  min-height: 100vh;
  min-height: 100svh;
  place-items: center;
  padding:
    max(24px, env(safe-area-inset-top))
    max(18px, env(safe-area-inset-right))
    max(24px, env(safe-area-inset-bottom))
    max(18px, env(safe-area-inset-left));
}

.card {
  width: min(100%, 620px);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.86);
  border-radius: 30px;
  background: var(--paper);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.login-card,
.intro-card,
.final-card,
.error-card {
  padding: clamp(32px, 8vw, 64px) clamp(24px, 7vw, 56px);
  text-align: center;
}

.heart-mark {
  display: grid;
  width: 68px;
  height: 68px;
  margin: 0 auto 24px;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: linear-gradient(145deg, #b95670, var(--rose-dark));
  box-shadow: 0 14px 30px rgba(111, 41, 70, 0.26);
  font-family: Georgia, serif;
  font-size: 34px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--rose);
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: break-word;
}

h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.35rem, 11vw, 4.5rem);
  font-weight: 600;
  line-height: 0.98;
  letter-spacing: -0.045em;
}

.subtitle {
  margin: 14px 0 0;
  color: var(--gold);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.18rem, 5vw, 1.55rem);
  font-style: italic;
}

.intro-copy,
.roulette-copy,
.error-card p {
  max-width: 36ch;
  margin: 28px auto;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.6;
}

.login-form {
  display: grid;
  gap: 14px;
  margin-top: 34px;
  text-align: left;
}

.login-form label {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 650;
}

input {
  width: 100%;
  min-height: 54px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: inset 0 1px 1px rgba(62, 37, 48, 0.04);
  font-size: 16px;
}

input::placeholder {
  color: #aa979e;
}

.form-error {
  margin: 0;
  padding: 12px 14px;
  border-radius: 12px;
  color: #7b243f;
  background: #fbe2e5;
  font-size: 0.9rem;
  line-height: 1.4;
}

.primary-button,
.secondary-button,
.answer-button,
.icon-button {
  min-height: 48px;
  border: 0;
  cursor: pointer;
}

.primary-button,
.secondary-button {
  width: 100%;
  border-radius: 16px;
  font-weight: 750;
}

.primary-button {
  min-height: 56px;
  padding: 15px 22px;
  color: white;
  background: linear-gradient(135deg, #aa4967, var(--rose-dark));
  box-shadow: 0 12px 24px rgba(111, 41, 70, 0.24);
}

.primary-button:active {
  transform: translateY(1px);
  box-shadow: 0 7px 16px rgba(111, 41, 70, 0.22);
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.secondary-button {
  min-height: 52px;
  padding: 13px 20px;
  border: 1px solid rgba(111, 41, 70, 0.22);
  color: var(--rose-dark);
  background: rgba(255, 255, 255, 0.72);
}

.quiz-card {
  min-height: min(760px, calc(100svh - 36px));
  padding: 18px;
}

.quiz-header {
  display: grid;
  grid-template-columns: 48px 1fr 48px;
  align-items: center;
  gap: 12px;
}

.icon-button {
  display: grid;
  width: 48px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--rose-dark);
  background: rgba(255, 255, 255, 0.7);
  font-size: 1.35rem;
}

.progress-copy {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 650;
  text-align: center;
}

progress {
  width: 100%;
  height: 7px;
  margin: 18px 0 0;
  overflow: hidden;
  border: 0;
  border-radius: 99px;
  background: #eadcdd;
  appearance: none;
  -webkit-appearance: none;
}

progress::-webkit-progress-bar {
  border-radius: 99px;
  background: #eadcdd;
}

progress::-webkit-progress-value {
  border-radius: 99px;
  background: linear-gradient(90deg, var(--gold), var(--rose));
}

progress::-moz-progress-bar {
  border-radius: 99px;
  background: linear-gradient(90deg, var(--gold), var(--rose));
}

.question-body {
  padding: clamp(30px, 7vw, 52px) clamp(6px, 4vw, 24px) 24px;
}

.question-body h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.85rem, 8vw, 3rem);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.028em;
}

.answers {
  display: grid;
  gap: 11px;
  margin-top: 30px;
}

.answer-button {
  width: 100%;
  min-height: 56px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.76);
  font-weight: 620;
  line-height: 1.35;
  text-align: left;
}

.answer-button:active,
.answer-button.selected {
  border-color: rgba(158, 63, 95, 0.58);
  color: var(--rose-dark);
  background: var(--rose-soft);
}

.answer-button.selected::before {
  margin-right: 8px;
  content: "♥";
}

.text-answer {
  display: grid;
  gap: 12px;
  margin-top: 30px;
}

.feedback {
  display: grid;
  gap: 14px;
  margin-top: 22px;
  padding: 18px;
  border: 1px solid rgba(158, 63, 95, 0.16);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(244, 217, 220, 0.86), rgba(255, 250, 246, 0.9));
  animation: reveal 280ms ease-out both;
}

.feedback.incorrect {
  border-color: rgba(201, 154, 74, 0.24);
  background: linear-gradient(135deg, rgba(246, 226, 190, 0.72), rgba(255, 250, 246, 0.9));
}

.feedback.special {
  border-color: rgba(201, 154, 74, 0.38);
  background: linear-gradient(135deg, rgba(247, 221, 213, 0.9), rgba(250, 234, 195, 0.74));
}

.feedback-media {
  overflow: hidden;
  border-radius: 14px;
  background: rgba(62, 37, 48, 0.08);
  box-shadow: 0 12px 28px rgba(62, 37, 48, 0.14);
  animation: reveal 480ms cubic-bezier(0.22, 1, 0.36, 1) 80ms both;
}

.feedback-media img,
.feedback-media video {
  display: block;
  width: 100%;
  max-height: min(46vh, 360px);
  object-fit: cover;
}

.feedback h3 {
  margin: 0 0 5px;
  color: var(--rose-dark);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.35rem;
}

.feedback p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.next-button {
  margin-top: 10px;
}

.final-card h1 {
  font-size: clamp(2.7rem, 12vw, 4.5rem);
}

.score {
  margin: 24px 0 6px;
  color: var(--rose);
  font-size: clamp(2rem, 9vw, 3.25rem);
  font-weight: 800;
  letter-spacing: -0.04em;
}

.score-title {
  max-width: 24ch;
  margin: 0 auto;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.25rem, 5.5vw, 1.75rem);
  font-weight: 600;
  line-height: 1.2;
}

.wheel-wrap {
  position: relative;
  width: min(100%, 360px);
  margin: 20px auto 24px;
  aspect-ratio: 1;
}

#wheel {
  display: block;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 18px 24px rgba(62, 37, 48, 0.2));
}

.wheel-pointer {
  position: absolute;
  z-index: 2;
  top: -2px;
  left: 50%;
  width: 0;
  height: 0;
  border-top: 28px solid var(--ink);
  border-right: 16px solid transparent;
  border-left: 16px solid transparent;
  transform: translateX(-50%);
  filter: drop-shadow(0 3px 2px rgba(62, 37, 48, 0.18));
}

.wheel-result {
  display: grid;
  gap: 4px;
  margin: 22px 0;
  padding: 18px;
  border-radius: 18px;
  background: var(--rose-soft);
  animation: reveal 350ms ease-out both;
}

.wheel-result span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.wheel-result strong {
  color: var(--rose-dark);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2rem;
}

.repeat-button {
  margin-top: 10px;
}

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

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

@media (min-width: 700px) {
  .quiz-card {
    padding: 24px;
  }

  .text-answer {
    grid-template-columns: 1fr auto;
  }

  .text-answer .secondary-button {
    width: auto;
    min-width: 150px;
  }
}

@media (max-width: 420px) {
  .app-shell,
  .login-shell {
    padding-right: max(10px, env(safe-area-inset-right));
    padding-left: max(10px, env(safe-area-inset-left));
  }

  .card {
    border-radius: 24px;
  }

  .quiz-card {
    min-height: calc(100svh - 20px);
    padding: 14px;
  }

  .question-body {
    padding-top: 26px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}
