:root {
  --ink: #20312f;
  --muted: #61706b;
  --accent: #df6f53;
  --accent-deep: #a74732;
  --paper: #fffaf0;
  --mint: #2f756b;
  --sage: #dce9df;
  --plum: #34413e;
  --gold: #d9a94c;
  --shadow: rgba(31, 52, 48, 0.18);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    linear-gradient(rgba(255, 255, 255, 0.42) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.36) 1px, transparent 1px),
    linear-gradient(135deg, #f7efe0 0%, #dce9df 47%, #f6c7a8 100%);
  background-size: 2.25rem 2.25rem, 2.25rem 2.25rem, auto;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button {
  font: inherit;
}

#effects {
  position: fixed;
  inset: 0;
  z-index: 8;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.ambient,
.fireflies {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.glow {
  position: absolute;
  width: min(46vw, 34rem);
  aspect-ratio: 1;
  border-radius: 28% 72% 62% 38%;
  filter: blur(4rem);
  opacity: 0.34;
  animation: drift 20s ease-in-out infinite alternate;
}

.glow-a {
  left: -8rem;
  top: 10%;
  background: rgba(223, 111, 83, 0.42);
}

.glow-b {
  right: -9rem;
  top: 4%;
  background: rgba(47, 117, 107, 0.32);
  animation-delay: -4s;
}

.glow-c {
  bottom: -14rem;
  left: 30%;
  background: rgba(217, 169, 76, 0.32);
  animation-delay: -9s;
}

.firefly {
  position: absolute;
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 999px;
  background: rgba(255, 250, 230, 0.92);
  box-shadow: 0 0 1rem rgba(217, 169, 76, 0.76);
  animation: float var(--duration) linear infinite;
  animation-delay: var(--delay);
  opacity: 0;
}

.page {
  position: relative;
  z-index: 1;
  display: grid;
  min-height: 100svh;
  place-items: center;
  padding: clamp(1rem, 2vw, 2rem);
  transition: transform 900ms ease, filter 900ms ease;
}

.page.celebrating {
  filter: saturate(1.04);
  transform: scale(1.012);
}

.proposal {
  width: min(42rem, 100%);
  padding: clamp(1.4rem, 5vw, 3.2rem) clamp(1.2rem, 5vw, 3.6rem);
  text-align: center;
  border: 1px solid rgba(47, 117, 107, 0.18);
  border-radius: 0.9rem;
  background:
    linear-gradient(180deg, rgba(255, 250, 240, 0.94), rgba(255, 255, 255, 0.82)),
    var(--paper);
  box-shadow: 0 1.25rem 3rem var(--shadow);
  backdrop-filter: blur(0.9rem);
}

.eyebrow {
  margin: 0 0 1rem;
  color: var(--accent-deep);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  font-family: Inter, system-ui, sans-serif;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(2.25rem, 7vw, 4.7rem);
  text-wrap: balance;
}

.subtitle,
.final-subtitle {
  max-width: 36rem;
  margin: 1.2rem auto 0;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.18rem);
  line-height: 1.7;
}

.answer-row {
  position: relative;
  display: flex;
  min-height: 5.5rem;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: clamp(1.5rem, 4vw, 2.3rem);
}

.answer,
.again {
  position: relative;
  min-width: 8.75rem;
  min-height: 3.5rem;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 800;
  letter-spacing: 0.01em;
  transition:
    transform 220ms ease,
    box-shadow 220ms ease,
    background 220ms ease,
    opacity 220ms ease;
  touch-action: manipulation;
}

.answer:focus-visible,
.again:focus-visible {
  outline: 3px solid rgba(47, 117, 107, 0.85);
  outline-offset: 4px;
}

.yes {
  z-index: 2;
  color: white;
  background: linear-gradient(135deg, #df6f53, #2f756b);
  box-shadow:
    0 1rem 2rem rgba(47, 117, 107, var(--yes-glow, 0.28)),
    0 0 0 rgba(255, 232, 198, 0);
  transform: scale(var(--yes-scale, 1));
}

.yes:hover {
  box-shadow:
    0 1.2rem 2.4rem rgba(47, 117, 107, 0.34),
    0 0 2rem rgba(255, 232, 198, 0.36);
  transform: scale(calc(var(--yes-scale, 1) * 1.04));
}

.no {
  z-index: 4;
  color: var(--accent-deep);
  background: rgba(255, 255, 255, 0.74);
  box-shadow: inset 0 0 0 1px rgba(167, 71, 50, 0.2), 0 0.7rem 1.5rem rgba(31, 52, 48, 0.12);
  opacity: var(--no-opacity, 1);
  transform: scale(var(--no-scale, 1));
}

.no:hover {
  background: rgba(255, 250, 244, 0.92);
  transform: scale(calc(var(--no-scale, 1) * 0.98));
}

.no.is-doubtful {
  animation: doubtful 340ms ease both;
}

.status {
  min-height: 2.6rem;
  margin-top: 1.3rem;
  color: var(--muted);
}

.status p {
  margin: 0.25rem 0;
}

#tease {
  color: var(--accent-deep);
  font-weight: 800;
}

.planner {
  position: fixed;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  padding: clamp(1rem, 3vw, 2rem);
  overflow-y: auto;
  background:
    linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(140deg, #1f3531, #2f756b 45%, #df6f53);
  background-size: 2rem 2rem, 2rem 2rem, auto;
  opacity: 0;
  pointer-events: none;
  transform: scale(1.04);
  transition:
    opacity 700ms ease,
    transform 900ms ease;
}

.planner.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

.planner-content {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(18rem, 24rem);
  align-items: start;
  gap: clamp(1rem, 3vw, 1.6rem);
  width: min(64rem, 100%);
  text-align: left;
  color: white;
}

h2 {
  grid-column: 1;
  font-size: clamp(2.25rem, 6vw, 4.4rem);
  text-shadow: 0 0.7rem 2rem rgba(0, 0, 0, 0.14);
  opacity: 0;
  transform: translateY(0.5rem);
}

.is-sequencing h2 {
  animation: titleBloom 780ms cubic-bezier(0.2, 0.85, 0.22, 1.15) 860ms forwards;
}

.planner-eyebrow {
  grid-column: 1;
  margin-top: 0;
  margin-bottom: 0.65rem;
  color: #ffe2be;
}

.planner-subtitle {
  grid-column: 1;
  max-width: 36rem;
  margin: 0.8rem 0 0;
  color: rgba(255, 249, 238, 0.88);
  font-size: clamp(1rem, 2vw, 1.14rem);
  line-height: 1.65;
  opacity: 0;
  transform: translateY(0.7rem);
}

.is-sequencing .planner-subtitle {
  animation: softRise 680ms ease 1.38s forwards;
}

.date-form,
.sent-state {
  grid-column: 1;
  width: min(52rem, 100%);
  margin: clamp(1.2rem, 3vw, 1.7rem) 0 0;
  padding: clamp(1rem, 2.6vw, 1.6rem);
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 0.8rem;
  background: rgba(255, 250, 240, 0.96);
  box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.2);
  color: var(--ink);
  text-align: left;
  opacity: 0;
  transform: translateY(0.8rem);
}

.is-sequencing .date-form,
.is-sequencing .sent-state {
  animation: softRise 680ms ease 1.62s forwards;
}

.field {
  display: grid;
  gap: 0.45rem;
}

.date-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(10rem, 0.55fr);
  gap: 0.75rem;
}

.field + .choice-group,
.choice-group + .choice-group,
.choice-group + .field,
.date-fields + .choice-group,
.field + .summary,
.summary + .form-error {
  margin-top: 1rem;
}

.field span,
.choice-group legend,
.summary span {
  color: var(--mint);
  font-weight: 900;
  letter-spacing: 0.01em;
}

input,
textarea {
  width: 100%;
  border: 1px solid rgba(47, 117, 107, 0.2);
  border-radius: 0.6rem;
  background: white;
  color: var(--ink);
  font: inherit;
  font-weight: 650;
  outline: none;
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease;
}

input {
  min-height: 3.2rem;
  padding: 0 0.9rem;
}

textarea {
  min-height: 5.7rem;
  resize: vertical;
  padding: 0.85rem 0.9rem;
}

input:focus,
textarea:focus {
  border-color: rgba(47, 117, 107, 0.62);
  box-shadow: 0 0 0 4px rgba(47, 117, 107, 0.14);
}

.choice-group {
  min-width: 0;
  padding: 0;
  border: 0;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
  margin-top: 0.6rem;
}

.detail-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.choice-button {
  min-height: 3.15rem;
  padding: 0.58rem 0.7rem;
  border: 1px solid rgba(47, 117, 107, 0.16);
  border-radius: 0.65rem;
  color: var(--plum);
  background: rgba(255, 255, 255, 0.82);
  cursor: pointer;
  font-weight: 850;
  line-height: 1.2;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

.choice-button:hover {
  transform: translateY(-1px);
  border-color: rgba(223, 111, 83, 0.48);
  background: white;
}

.choice-button.is-selected {
  color: white;
  border-color: transparent;
  background: linear-gradient(135deg, #2f756b, #df6f53);
  box-shadow: 0 0.8rem 1.7rem rgba(47, 117, 107, 0.22);
}

.summary {
  padding: 0.9rem 1rem;
  border-radius: 0.65rem;
  background: linear-gradient(135deg, rgba(220, 233, 223, 0.92), rgba(255, 238, 218, 0.9));
}

.summary p {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-weight: 750;
  line-height: 1.55;
}

.form-error {
  min-height: 1.35rem;
  margin-bottom: 0;
  color: var(--accent-deep);
  font-weight: 850;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.submit-date,
.ghost-button {
  min-height: 3.25rem;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 900;
}

.submit-date {
  flex: 1 1 15rem;
  color: white;
  background: linear-gradient(135deg, #df6f53, #2f756b);
  box-shadow: 0 1rem 2rem rgba(61, 25, 44, 0.18);
}

.ghost-button {
  flex: 0 1 11rem;
  color: var(--mint);
  background: rgba(47, 117, 107, 0.12);
}

.sent-state {
  text-align: center;
}

.date-form[hidden],
.sent-state[hidden] {
  display: none;
}

.planner.is-submitted .sent-state:not([hidden]) {
  animation: none;
  opacity: 1;
  transform: none;
}

.sent-state h3 {
  margin: 0;
  color: var(--mint);
  font-family: Inter, system-ui, sans-serif;
  font-weight: 900;
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1;
}

.sent-state p {
  margin: 0.8rem auto 0;
  max-width: 38rem;
  color: var(--muted);
  font-weight: 750;
  line-height: 1.6;
}

.sent-state .mail-note {
  color: var(--mint);
}

.photo-frame {
  position: relative;
  grid-column: 2;
  grid-row: 1 / span 5;
  width: 100%;
  margin: 0;
  padding: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 0.85rem;
  background: rgba(255, 250, 240, 0.92);
  box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.2);
  opacity: 0;
  transform: translateY(0.8rem);
}

.is-sequencing .photo-frame {
  animation: softRise 700ms ease 1.78s forwards;
}

.photo-frame::before {
  content: "Tu wstaw public/us.jpg";
  position: absolute;
  inset: clamp(0.65rem, 2vw, 0.9rem) clamp(0.65rem, 2vw, 0.9rem) auto;
  display: grid;
  aspect-ratio: 4 / 3;
  place-items: center;
  border-radius: 0.85rem;
  color: rgba(255, 255, 255, 0.86);
  background:
    linear-gradient(135deg, rgba(95, 38, 70, 0.56), rgba(200, 79, 116, 0.4)),
    radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.22), transparent 18rem);
  font-weight: 800;
}

.photo-frame.has-photo::before {
  display: none;
}

.photo-frame img {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 0.55rem;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.16);
}

.photo-frame:not(.has-photo) img {
  opacity: 0;
}

.photo-frame figcaption {
  position: relative;
  z-index: 1;
  margin: 0.95rem 0 0.2rem;
  color: var(--plum);
  font-weight: 800;
  font-size: clamp(0.92rem, 1.6vw, 1.04rem);
  line-height: 1.45;
  opacity: 0;
  transform: translateY(0.5rem);
}

.is-sequencing .photo-frame figcaption {
  animation: softRise 620ms ease 2.48s forwards;
}

.again {
  min-width: 10rem;
  margin-top: 1.2rem;
  color: white;
  background: var(--mint);
  opacity: 0;
  transform: translateY(0.6rem);
}

.is-sequencing .again {
  animation: softRise 620ms ease 2.78s forwards;
}

.planner.is-submitted .sent-state .again {
  animation: none;
  opacity: 1;
  transform: none;
}

.again:hover {
  transform: translateY(-2px);
  box-shadow: 0 1rem 2rem rgba(0, 0, 0, 0.18);
}

@keyframes drift {
  to {
    transform: translate3d(4rem, -2rem, 0) scale(1.1);
  }
}

@keyframes float {
  0% {
    opacity: 0;
    transform: translate3d(0, 8vh, 0) scale(0.7);
  }
  12%,
  85% {
    opacity: 0.85;
  }
  100% {
    opacity: 0;
    transform: translate3d(var(--shift), -108vh, 0) scale(1);
  }
}

@keyframes doubtful {
  0%,
  100% {
    transform: scale(var(--no-scale, 1)) rotate(0deg);
  }
  35% {
    transform: scale(calc(var(--no-scale, 1) * 0.96)) rotate(-1.8deg);
  }
  70% {
    transform: scale(calc(var(--no-scale, 1) * 1.02)) rotate(1.4deg);
  }
}

@keyframes softRise {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes titleBloom {
  65% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 640px) {
  .proposal {
    min-height: min(43rem, calc(100svh - 2rem));
    display: grid;
    align-content: center;
    border-radius: 1rem;
  }

  .answer-row {
    min-height: 8rem;
    flex-direction: column;
  }

  .answer {
    min-width: min(12rem, 72vw);
  }

  .status {
    min-height: 5.4rem;
  }

  .planner {
    align-items: start;
  }

  .planner-content {
    display: block;
    padding-top: 0.5rem;
    text-align: left;
  }

  h2 {
    font-size: clamp(2.25rem, 12vw, 3.7rem);
  }

  .choice-grid,
  .detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .date-fields {
    grid-template-columns: 1fr;
  }

  .choice-button {
    min-height: 3rem;
    padding-inline: 0.45rem;
    font-size: 0.92rem;
  }

  .ghost-button {
    flex: 1 1 100%;
  }

  .photo-frame {
    width: min(24rem, 100%);
    margin: 1rem 0 0;
  }
}

@media (max-height: 760px) and (min-width: 700px) {
  h2 {
    font-size: 3.8rem;
  }

  .planner-subtitle {
    margin-top: 0.5rem;
  }

  .photo-frame {
    width: min(24rem, 100%);
    margin-top: 1rem;
  }

  .again {
    margin-top: 0.75rem;
  }
}

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