@import url('https://fonts.googleapis.com/css2?family=Caveat:wght@500;600&family=Libre+Baskerville:wght@400;700&display=swap');

:root {
  --paper: #f7f0e3;
  --paper-deep: #efe2cf;
  --ink: #3d342d;
  --muted: #8c7f72;
  --pink: #e9b6b8;
  --pink-deep: #d99599;
  --sage: #c8d2c2;
  --tape: rgba(216, 197, 158, 0.65);
  --shadow: 0 12px 30px rgba(83, 65, 47, 0.12);
  --serif: "Libre Baskerville", Georgia, serif;
  --hand: "Caveat", "Segoe Print", cursive;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
}

body {
  font-family: var(--serif);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

button { font: inherit; }

.app-shell {
  position: relative;
  width: 100%;
  min-height: 100svh;
  background:
    radial-gradient(circle at 18% 10%, rgba(255,255,255,.6), transparent 20%),
    linear-gradient(180deg, #faf5ec 0%, var(--paper) 100%);
  overflow: hidden;
}

.paper-noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .18;
  z-index: 20;
  background-image:
    radial-gradient(circle at 10% 20%, rgba(72,56,41,.15) 0 .5px, transparent .7px),
    radial-gradient(circle at 70% 60%, rgba(72,56,41,.1) 0 .5px, transparent .7px);
  background-size: 11px 13px, 17px 19px;
  mix-blend-mode: multiply;
}

.screen {
  display: none;
  min-height: 100svh;
  padding:
    max(28px, env(safe-area-inset-top))
    18px
    max(24px, env(safe-area-inset-bottom));
  position: relative;
  z-index: 1;
}

.screen.is-active {
  display: block;
  animation: screenIn .55s cubic-bezier(.2,.8,.2,1);
}

.screen-inner {
  width: min(100%, 420px);
  min-height: calc(100svh - 56px);
  margin: 0 auto;
  position: relative;
}

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

.eyebrow {
  margin: 0;
  text-align: center;
  font-family: var(--hand);
  font-size: 22px;
  color: var(--muted);
}

.password-layout {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 30px;
  text-align: center;
}

.password-copy {
  width: min(100%, 350px);
}

.password-copy h1 {
  margin: 0 0 16px;
  font-family: var(--hand);
  font-size: clamp(42px, 12vw, 58px);
  font-weight: 600;
  line-height: 1;
}

.password-copy p {
  margin: 0;
  color: var(--pink-deep);
  font-size: 15px;
  line-height: 1.6;
}

.password-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.date-password {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 12px;
}

.date-password label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  color: var(--muted);
  font-family: var(--hand);
  font-size: 17px;
}

.date-password input {
  width: 78px;
  border: 0;
  border-bottom: 2px solid rgba(217, 149, 153, .65);
  border-radius: 3px 3px 0 0;
  padding: 10px 8px 7px;
  background: rgba(255, 250, 240, .72);
  color: var(--ink);
  font-family: var(--hand);
  font-size: 34px;
  line-height: 1;
  text-align: center;
  outline: none;
  box-shadow: 0 7px 18px rgba(83, 65, 47, .07);
}

.date-password input:focus {
  border-color: var(--pink-deep);
  box-shadow: 0 8px 22px rgba(217, 149, 153, .18);
}

.date-divider {
  padding-bottom: 9px;
  color: var(--pink-deep);
  font-family: var(--hand);
  font-size: 35px;
}

.password-error {
  min-height: 20px;
  margin: -6px 0 -4px;
  color: #b56f73;
  font-family: var(--hand);
  font-size: 18px;
}

.password-form.is-wrong {
  animation: password-shake .38s ease-in-out;
}

@keyframes password-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-7px); }
  50% { transform: translateX(7px); }
  75% { transform: translateX(-4px); }
}

.intro-layout {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 28px;
  text-align: center;
}

.intro-copy {
  width: min(100%, 330px);
}

.intro-copy h1 {
  margin: 0 0 22px;
  font-family: var(--hand);
  font-weight: 600;
  font-size: clamp(56px, 16vw, 76px);
  line-height: .95;
}

.intro-copy p {
  margin: 0;
  font-size: 18px;
  line-height: 1.7;
}

.tiny-note {
  font-family: var(--hand);
  color: var(--muted);
  font-size: 18px;
  transform: rotate(-2deg);
}

.decor {
  position: absolute;
  font-family: var(--hand);
  color: var(--pink-deep);
  opacity: .72;
  pointer-events: none;
}

.decor-heart {
  top: 13%;
  right: 12%;
  font-size: 31px;
  transform: rotate(10deg);
}

.decor-petal {
  bottom: 18%;
  left: 9%;
  font-size: 28px;
  transform: rotate(-14deg);
}

.paper-button {
  border: 0;
  border-radius: 4px;
  padding: 13px 28px 11px;
  background: #efc4c4;
  color: #4a3935;
  font-family: var(--hand);
  font-size: 24px;
  cursor: pointer;
  box-shadow:
    0 6px 15px rgba(117, 76, 64, .10),
    inset 0 0 0 1px rgba(118, 84, 72, .08);
  transform: rotate(-1.5deg);
  transition: transform .16s ease, box-shadow .16s ease;
  position: relative;
}

.paper-button::before,
.paper-button::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 3px;
  pointer-events: none;
}

.paper-button::before {
  clip-path: polygon(0 5%, 8% 0, 16% 4%, 26% 0, 35% 3%, 44% 0, 55% 4%, 65% 0, 78% 4%, 88% 0, 100% 5%, 100% 95%, 91% 100%, 82% 96%, 72% 100%, 62% 97%, 49% 100%, 37% 97%, 27% 100%, 15% 96%, 0 100%);
  box-shadow: inset 0 0 0 999px rgba(255,255,255,.05);
}

.paper-button:active { transform: rotate(-1.5deg) scale(.97); }
.paper-button.wide { width: 100%; }

.quiz-layout {
  display: flex;
  flex-direction: column;
  padding-top: 6px;
}

.quiz-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.question-count {
  font-family: var(--hand);
  font-size: 24px;
  color: var(--pink-deep);
}

.mini-heart {
  font-family: var(--hand);
  font-size: 25px;
  color: var(--pink-deep);
}

.question-block {
  text-align: center;
  padding: 26px 8px 18px;
}

.question-block h2 {
  margin: 0;
  font-family: var(--hand);
  font-size: clamp(31px, 8.6vw, 42px);
  line-height: 1.05;
  font-weight: 600;
}

.question-subtitle {
  margin: 12px auto 0;
  max-width: 310px;
  color: var(--pink-deep);
  line-height: 1.55;
  font-size: 14px;
}

.answers-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
  margin-top: 14px;
}

.answer-card {
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  min-width: 0;
  transition: transform .18s ease, opacity .18s ease;
}

.answer-card:nth-child(odd) { transform: rotate(-1.2deg); }
.answer-card:nth-child(even) { transform: rotate(1.1deg); }

.answer-card:active {
  transform: scale(.97) rotate(0deg);
}

.answer-card.is-selected {
  transform: scale(1.025) rotate(0deg);
}

.answer-card.is-dimmed {
  opacity: .45;
}

.answer-card.is-wrong {
  animation: wrong-answer-move .42s ease-in-out;
}

@keyframes wrong-answer-move {
  0%, 100% { transform: rotate(-1.2deg) translateX(0); }
  25% { transform: rotate(-4deg) translateX(-10px); }
  55% { transform: rotate(3deg) translateX(10px); }
  80% { transform: rotate(-2deg) translateX(-5px); }
}

@media (prefers-reduced-motion: reduce) {
  .answer-card.is-wrong {
    animation-duration: .01ms;
  }
}

.polaroid {
  position: relative;
  background: #fffaf0;
  padding: 7px 7px 14px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(110, 91, 71, .08);
}

.polaroid img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: #e8dfd2;
}

.polaroid-caption {
  padding-top: 9px;
  font-family: var(--hand);
  font-size: 20px;
  line-height: 1.05;
  color: #4d4037;
  text-align: center;
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.answer-card .polaroid::before {
  content: "";
  position: absolute;
  top: -10px;
  left: 50%;
  width: 56px;
  height: 20px;
  background: var(--tape);
  transform: translateX(-50%) rotate(-2deg);
  backdrop-filter: blur(1px);
}

.quiz-footer {
  margin-top: auto;
  padding-top: 36px;
  padding-bottom: 8px;
}

.progress-dots {
  display: flex;
  justify-content: center;
  gap: 9px;
}

.progress-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ded3c3;
  transition: .2s ease;
}

.progress-dots span.is-done { background: var(--pink-deep); }
.progress-dots span.is-current {
  transform: scale(1.22);
  background: #8f7d6d;
}

.checking-layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.checking-copy h2 {
  font-family: var(--hand);
  font-size: clamp(44px, 12vw, 62px);
  line-height: 1.08;
  margin: 0;
}

.loading-dots {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 30px;
}

.loading-dots span {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--pink);
  animation: bounce 1s infinite ease-in-out;
}

.loading-dots span:nth-child(2) { animation-delay: .12s; }
.loading-dots span:nth-child(3) { animation-delay: .24s; }

@keyframes bounce {
  0%, 100% { transform: translateY(0); opacity: .45; }
  50% { transform: translateY(-7px); opacity: 1; }
}

.film-doodle {
  width: 145px;
  margin-top: 50px;
  color: #7c6d61;
  opacity: .76;
}

.result-layout {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 26px;
}

.result-score {
  font-family: var(--hand);
  font-size: 48px;
  margin-bottom: 6px;
}

.result-layout h2 {
  font-family: var(--hand);
  font-size: 38px;
  line-height: 1.05;
  margin: 0 0 14px;
}

.result-layout p {
  margin: 0;
  line-height: 1.65;
  font-size: 16px;
}

.polaroid-result {
  width: min(78vw, 300px);
  margin: 0 auto;
  transform: rotate(-1.8deg);
}

.polaroid-result img {
  aspect-ratio: 4 / 3;
}

.tape {
  position: absolute;
  z-index: 3;
  background: var(--tape);
  width: 64px;
  height: 22px;
}

.tape-top {
  top: -9px;
  left: 50%;
  transform: translateX(-50%) rotate(2deg);
}

.card-layout {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 20px;
}

.gift-card {
  position: relative;
  background: rgba(255, 250, 240, .74);
  border: 1px solid rgba(105, 87, 69, .13);
  box-shadow: var(--shadow);
  padding: 24px 18px 20px;
  border-radius: 3px;
}

.tape-card-left {
  top: -9px;
  left: 18px;
  transform: rotate(-8deg);
}

.tape-card-right {
  top: -8px;
  right: 18px;
  transform: rotate(6deg);
}

.book-cover {
  display: block;
  width: min(44vw, 180px);
  aspect-ratio: 2 / 3;
  object-fit: cover;
  margin: 0 auto 24px;
  box-shadow: 0 12px 26px rgba(64, 49, 37, .22);
  border-radius: 2px;
}

.quote-card {
  border-top: 1px solid rgba(82, 64, 49, .16);
  border-bottom: 1px solid rgba(82, 64, 49, .16);
  padding: 24px 6px 20px;
  text-align: left;
}

.quote-mark {
  font-size: 54px;
  font-family: Georgia, serif;
  line-height: .5;
  color: var(--pink-deep);
}

blockquote {
  margin: 12px 0 18px;
  font-size: 19px;
  line-height: 1.55;
}

.quote-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--muted);
  font-size: 13px;
}

.personal-message {
  margin: 20px 4px 0;
  font-family: var(--hand);
  font-size: 23px;
  line-height: 1.25;
  color: #7f5d58;
  transform: rotate(-1deg);
}

.ghost-button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: var(--hand);
  font-size: 19px;
  padding: 10px 16px;
  cursor: pointer;
}

@media (max-width: 360px) {
  .screen { padding-left: 14px; padding-right: 14px; }
  .answers-grid { gap: 10px; }
  .polaroid-caption { font-size: 18px; }
}

@media (min-width: 700px) {
  .app-shell {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100svh;
    box-shadow: 0 0 60px rgba(55, 44, 33, .12);
  }
}
