:root {
  --paper: #fff9f3;
  --ink: #20201e;
  --red: #e84b3c;
  --red-dark: #c9362a;
  --pink: #f8c9c1;
  --yellow: #f4c95d;
  --muted: #77736d;
  --line: rgba(32, 32, 30, 0.14);
  --shadow: 0 20px 60px rgba(80, 45, 35, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--paper);
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100dvh;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 15%, rgba(248, 201, 193, 0.45), transparent 24rem),
    radial-gradient(circle at 90% 86%, rgba(244, 201, 93, 0.2), transparent 20rem),
    var(--paper);
  font-family: "DM Sans", sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

.app-shell {
  position: relative;
  min-height: 100dvh;
  overflow: hidden;
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 20;
  opacity: 0.08;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.45'/%3E%3C/svg%3E");
}

.reaction-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  padding: 22px;
  place-items: center;
  visibility: hidden;
  opacity: 0;
  background: rgba(32, 25, 23, 0.68);
  backdrop-filter: blur(8px);
  transition: opacity 0.25s ease, visibility 0.25s;
  pointer-events: none;
}

.reaction-overlay.showing {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.reaction-overlay.leaving {
  opacity: 0;
}

.reaction-card {
  width: min(100%, 360px);
  overflow: hidden;
  border: 4px solid white;
  border-radius: 28px;
  background: var(--paper);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.34);
  text-align: center;
  transform: scale(0.72) rotate(-5deg);
}

.reaction-overlay.showing .reaction-card {
  animation: reaction-arrive 0.45s cubic-bezier(.2, .9, .2, 1.3) forwards;
}

.reaction-correct .reaction-card {
  transform: scale(0.72) rotate(5deg);
}

.reaction-card img {
  display: block;
  width: 100%;
  max-height: 54dvh;
  object-fit: cover;
  background: #18130f;
}

.reaction-card p {
  margin: 0;
  padding: 18px 18px 14px;
  font-family: "Playfair Display", serif;
  font-size: 1.2rem;
  font-weight: 700;
}

.reaction-timer {
  height: 5px;
  margin: 0 18px 18px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(32, 32, 30, 0.1);
}

.reaction-timer span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: var(--red);
  transform-origin: left center;
}

.reaction-overlay.showing .reaction-timer span {
  animation: reaction-timer 2.2s linear forwards;
}

.reaction-correct.showing .reaction-timer span {
  animation-duration: 2.4s;
}

.screen {
  position: absolute;
  inset: 0;
  display: grid;
  min-height: 100dvh;
  padding: max(28px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
  overflow-y: auto;
  visibility: hidden;
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.45s ease, transform 0.45s ease, visibility 0.45s;
  pointer-events: none;
}

.screen.active {
  position: relative;
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.invite-screen {
  place-items: center;
}

.invite-card,
.survey-card,
.schedule-card,
.done-card {
  position: relative;
  width: min(100%, 480px);
  margin: auto;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: clamp(32px, 9vh, 72px);
  color: var(--red);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.eyebrow span {
  display: block;
  width: 28px;
  height: 2px;
  background: currentColor;
}

.tiny-note {
  margin: 0 0 13px;
  color: var(--red);
  font-family: "Playfair Display", serif;
  font-size: 1rem;
  font-style: italic;
}

h1,
h2 {
  margin: 0;
  max-width: 470px;
  font-family: "Playfair Display", serif;
  font-size: clamp(3rem, 13vw, 5rem);
  line-height: 0.98;
  letter-spacing: -0.045em;
}

h1 em,
h2 em {
  position: relative;
  color: var(--red);
  font-weight: 700;
}

h1 em::after {
  content: "";
  position: absolute;
  right: -3px;
  bottom: -5px;
  left: 2px;
  height: 7px;
  border-top: 2px solid var(--red);
  border-radius: 50%;
  transform: rotate(-2deg);
}

.subtitle {
  max-width: 390px;
  margin: 24px 0 34px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.65;
}

.button-zone {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
}

.btn {
  min-height: 58px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 700;
}

.btn-yes {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: space-between;
  max-width: 290px;
  padding: 0 18px 0 24px;
  color: white;
  background: var(--red);
  box-shadow: 0 9px 24px rgba(232, 75, 60, 0.25);
  transform: scale(var(--yes-scale, 1));
  transform-origin: left center;
  transition: transform 0.3s cubic-bezier(.2, .8, .2, 1), background 0.2s ease;
}

.btn-yes:active {
  transform: scale(calc(var(--yes-scale, 1) * 0.97));
  background: var(--red-dark);
}

.arrow {
  display: grid;
  width: 35px;
  height: 35px;
  place-items: center;
  border-radius: 50%;
  color: var(--red);
  background: white;
  font-size: 1.1rem;
}

.btn-no {
  position: relative;
  z-index: 10;
  width: 118px;
  min-width: 118px;
  padding: 0 10px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.62);
  font-size: 0.76rem;
  line-height: 1.12;
  transition: left 0.2s cubic-bezier(.2, .9, .3, 1.15), top 0.2s cubic-bezier(.2, .9, .3, 1.15);
  touch-action: manipulation;
}

.btn-no.is-escaping {
  position: fixed;
  margin: 0;
  border: 2px solid #fff4b8;
  color: white;
  background: #63304d;
  box-shadow:
    0 8px 24px rgba(75, 31, 57, 0.35),
    0 0 0 5px rgba(244, 201, 93, 0.42);
  transform: rotate(var(--turn, 0deg)) scale(var(--no-scale, 1));
}

.btn-no.is-escaping::after {
  content: "";
  position: absolute;
  inset: -10px;
  border: 3px solid rgba(244, 201, 93, 0.8);
  border-radius: inherit;
  pointer-events: none;
  animation: no-locator 1.1s ease-out infinite;
}

.no-spin { animation: no-spin 0.42s ease; }
.no-shake { animation: no-shake 0.34s linear; }
.no-bounce { animation: no-bounce 0.45s ease; }
.no-flip { animation: no-flip 0.48s ease; }
.no-tiny { filter: saturate(0.5); }

.no-particle {
  position: fixed;
  z-index: 30;
  color: var(--red);
  font-size: 0.7rem;
  font-weight: 700;
  pointer-events: none;
  animation: no-particle 0.85s ease-out forwards;
}

.screen-wobble .invite-card {
  animation: screen-wobble 0.35s ease;
}

.fine-print {
  margin: 17px 0 0 4px;
  color: #a09a92;
  font-size: 0.72rem;
}

.stamp {
  position: absolute;
  top: -13px;
  right: 4px;
  display: grid;
  width: 87px;
  height: 87px;
  place-content: center;
  border: 2px solid rgba(232, 75, 60, 0.5);
  border-radius: 50%;
  color: var(--red);
  text-align: center;
  transform: rotate(10deg);
}

.stamp::after {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px dashed rgba(232, 75, 60, 0.5);
  border-radius: inherit;
}

.stamp span {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.stamp small {
  display: block;
  margin-top: 3px;
  font-size: 0.48rem;
  letter-spacing: 0.1em;
}

.doodle {
  position: absolute;
  color: var(--red);
  font-family: "Playfair Display", serif;
  pointer-events: none;
}

.doodle-heart {
  top: 12%;
  left: 7%;
  font-size: 3rem;
  transform: rotate(-14deg);
}

.doodle-star {
  right: 8%;
  bottom: 12%;
  color: var(--yellow);
  font-size: 3rem;
  transform: rotate(12deg);
}

.schedule-screen {
  align-items: center;
}

.survey-screen {
  align-items: center;
}

.step-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.survey-hero {
  display: grid;
  width: 76px;
  height: 76px;
  margin-bottom: 22px;
  place-items: center;
  border-radius: 24px;
  background: rgba(248, 201, 193, 0.4);
  font-size: 2.4rem;
  transform: rotate(-4deg);
}

.survey-hero.pop {
  animation: survey-pop 0.45s cubic-bezier(.2, .9, .2, 1.3);
}

.survey-card h2 {
  font-size: clamp(2.5rem, 11vw, 4.2rem);
}

.survey-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.survey-option {
  min-height: 122px;
  padding: 14px 10px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.62);
  cursor: pointer;
  text-align: center;
  transition: transform 0.2s ease, border 0.2s ease, background 0.2s ease;
}

.survey-option .option-emoji,
.survey-option strong,
.survey-option small {
  display: block;
}

.survey-option .option-emoji {
  margin-bottom: 7px;
  font-size: 1.7rem;
}

.survey-option strong {
  font-size: 0.82rem;
}

.survey-option small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.62rem;
  line-height: 1.35;
}

.survey-option.selected {
  border: 2px solid var(--red);
  background: rgba(248, 201, 193, 0.34);
  transform: translateY(-3px) rotate(-1deg);
}

.note-field {
  display: block;
  margin-top: 18px;
}

.note-field > span,
.admin-login label > span {
  display: block;
  margin: 0 0 8px 4px;
  font-size: 0.72rem;
  font-weight: 700;
}

.note-field textarea,
.admin-login input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 17px;
  outline: none;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.7);
  font: inherit;
}

.note-field textarea {
  min-height: 90px;
  padding: 14px;
  resize: vertical;
}

.hidden {
  display: none !important;
}

.schedule-card {
  padding: 8px 0;
}

.back-button {
  display: grid;
  width: 42px;
  height: 42px;
  margin-bottom: 28px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  font-size: 1.25rem;
}

.success-badge {
  display: inline-block;
  margin-bottom: 13px;
  padding: 7px 11px;
  border-radius: 999px;
  color: var(--red);
  background: rgba(248, 201, 193, 0.45);
  font-size: 0.69rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.schedule-card h2,
.done-card h2 {
  font-size: clamp(2.7rem, 12vw, 4.5rem);
}

.schedule-intro {
  margin: 14px 0 32px;
  color: var(--muted);
}

.picker-section {
  margin-top: 28px;
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 13px;
}

.section-heading h3 {
  margin: 0;
  font-family: "Playfair Display", serif;
  font-size: 1.15rem;
}

.section-heading span {
  color: #99928a;
  font-size: 0.7rem;
}

.time-option {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.64);
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.time-option.selected {
  border-color: var(--red);
  color: white;
  background: var(--red);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(232, 75, 60, 0.2);
}

.date-input-shell {
  display: flex;
  min-height: 60px;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.7);
}

.date-icon {
  font-size: 1.2rem;
}

.date-input-shell input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font: inherit;
  font-size: 1rem;
}

.time-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  margin-top: 10px;
}

.time-option {
  min-height: 48px;
  border-radius: 14px;
  font-size: 0.8rem;
  font-weight: 600;
}

.confirm-button {
  display: flex;
  width: 100%;
  margin-top: 32px;
  padding: 0 25px;
  align-items: center;
  justify-content: space-between;
  color: white;
  background: var(--ink);
}

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

.done-screen {
  place-items: center;
  text-align: center;
}

.done-card {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.big-heart {
  display: grid;
  width: 76px;
  height: 76px;
  margin-bottom: 26px;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: var(--red);
  box-shadow: 0 0 0 12px rgba(232, 75, 60, 0.1);
  font-size: 2rem;
  animation: heartbeat 1.7s ease-in-out infinite;
}

.done-copy {
  margin: 15px 0 27px;
  color: var(--muted);
}

.date-ticket {
  position: relative;
  display: grid;
  width: 100%;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.7);
  text-align: left;
  box-shadow: var(--shadow);
}

.ticket-label {
  padding: 29px 14px;
  color: var(--red);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.17em;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

.ticket-details {
  padding: 22px 16px;
  border-right: 1px dashed var(--line);
  border-left: 1px dashed var(--line);
}

.ticket-details strong,
.ticket-details span {
  display: block;
}

.ticket-details strong {
  font-family: "Playfair Display", serif;
  font-size: 1.15rem;
}

.ticket-details span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.83rem;
}

.ticket-stub {
  padding: 20px;
  color: var(--red);
  font-size: 1.7rem;
}

.plan-summary {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
  margin-top: 20px;
}

.plan-summary span {
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(248, 201, 193, 0.35);
  font-size: 0.68rem;
  font-weight: 600;
}

.save-status {
  min-height: 1.2em;
  margin: 17px 0 0;
  color: var(--muted);
  font-size: 0.7rem;
}

.share-button {
  width: 100%;
  min-height: 56px;
  margin-top: 28px;
  border: 0;
  border-radius: 999px;
  color: white;
  background: var(--red);
  cursor: pointer;
  font-weight: 700;
}

.start-over {
  margin-top: 17px;
  border: 0;
  color: var(--muted);
  background: none;
  cursor: pointer;
  font-size: 0.78rem;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.confetti i {
  position: absolute;
  top: -20px;
  width: 8px;
  height: 16px;
  border-radius: 2px;
  background: var(--red);
  animation: fall 3.4s ease-in infinite;
}

.confetti i:nth-child(1) { left: 8%; animation-delay: 0.2s; }
.confetti i:nth-child(2) { left: 20%; background: var(--yellow); animation-delay: 1.5s; }
.confetti i:nth-child(3) { left: 34%; background: var(--pink); animation-delay: 0.7s; }
.confetti i:nth-child(4) { left: 48%; animation-delay: 2.2s; }
.confetti i:nth-child(5) { left: 61%; background: var(--yellow); animation-delay: 1s; }
.confetti i:nth-child(6) { left: 73%; background: var(--pink); animation-delay: 2.7s; }
.confetti i:nth-child(7) { left: 86%; animation-delay: 1.8s; }
.confetti i:nth-child(8) { left: 94%; background: var(--yellow); animation-delay: 0.4s; }

@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  12% { transform: scale(1.08); }
  24% { transform: scale(1); }
}

@keyframes fall {
  0% { transform: translateY(-20px) rotate(0); opacity: 0; }
  10% { opacity: 1; }
  100% { transform: translateY(105dvh) rotate(420deg); opacity: 0.8; }
}

@keyframes no-particle {
  to {
    opacity: 0;
    transform: translate(var(--x), var(--y)) rotate(var(--r)) scale(1.25);
  }
}

@keyframes no-locator {
  0% { opacity: 0.95; transform: scale(0.82); }
  75%, 100% { opacity: 0; transform: scale(1.28); }
}

@keyframes no-spin {
  50% { transform: rotate(190deg) scale(var(--no-scale, 1)); }
}

@keyframes no-shake {
  25% { transform: translateX(-8px) rotate(-8deg) scale(var(--no-scale, 1)); }
  75% { transform: translateX(8px) rotate(8deg) scale(var(--no-scale, 1)); }
}

@keyframes no-bounce {
  50% { transform: translateY(-22px) scale(var(--no-scale, 1)); }
}

@keyframes no-flip {
  50% { transform: perspective(300px) rotateY(180deg) scale(var(--no-scale, 1)); }
}

@keyframes screen-wobble {
  25% { transform: rotate(-0.6deg); }
  75% { transform: rotate(0.6deg); }
}

@keyframes survey-pop {
  0% { opacity: 0; transform: scale(0.5) rotate(-16deg); }
  100% { opacity: 1; transform: scale(1) rotate(-4deg); }
}

@keyframes reaction-arrive {
  0% { opacity: 0; transform: scale(0.72) rotate(-7deg) translateY(30px); }
  100% { opacity: 1; transform: scale(1) rotate(-1deg) translateY(0); }
}

@keyframes reaction-timer {
  to { transform: scaleX(0); }
}

.admin-page {
  overflow-y: auto;
}

.admin-shell {
  width: min(100% - 32px, 850px);
  margin: 0 auto;
  padding: 48px 0;
}

.admin-header,
.response-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-header h1 {
  font-size: clamp(2.5rem, 8vw, 4rem);
}

.admin-login {
  max-width: 480px;
  margin: 36px 0;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.55);
}

.admin-login input {
  min-height: 52px;
  padding: 0 14px;
}

.response-list {
  display: grid;
  gap: 16px;
}

.response-card {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.65);
  box-shadow: var(--shadow);
}

.response-card h2 {
  margin: 17px 0;
  font-size: clamp(1.7rem, 6vw, 2.5rem);
}

.response-card small {
  color: var(--muted);
}

.response-card dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
}

.response-card dl div {
  padding: 12px;
  border-radius: 14px;
  background: rgba(248, 201, 193, 0.2);
}

.response-card dt {
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
}

.response-card dd {
  margin: 5px 0 0;
  font-size: 0.86rem;
}

.delete-response {
  width: 100%;
  min-height: 44px;
  margin-top: 18px;
  border: 1px solid rgba(201, 54, 42, 0.3);
  border-radius: 14px;
  color: var(--red-dark);
  background: rgba(232, 75, 60, 0.08);
  cursor: pointer;
  font-weight: 700;
}

.delete-response:hover {
  color: white;
  background: var(--red-dark);
}

.delete-response:disabled {
  cursor: wait;
  opacity: 0.55;
}

.empty-state {
  color: var(--muted);
  text-align: center;
}

@media (min-width: 700px) {
  .screen {
    padding-right: 32px;
    padding-left: 32px;
  }

  .invite-card,
  .survey-card,
  .schedule-card,
  .done-card {
    padding: 48px;
    border: 1px solid rgba(32, 32, 30, 0.08);
    border-radius: 32px;
    background: rgba(255, 255, 255, 0.3);
    box-shadow: var(--shadow);
  }

  .stamp {
    top: 34px;
    right: 38px;
  }
}

@media (max-height: 700px) {
  .eyebrow {
    margin-bottom: 28px;
  }

  .subtitle {
    margin: 17px 0 24px;
  }
}

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