/* ================================================================
   CUSTOMIZE COLORS HERE
   The rose, blush, cream, and gold palette lives in these variables.
   ================================================================ */
:root {
  --rose-dark: #6f2439;
  --rose: #ad4865;
  --rose-mid: #cf7088;
  --rose-soft: #e9a6b5;
  --blush: #f8dce0;
  --cream: #fff8f1;
  --gold: #c49a5a;
  --green-dark: #405f48;
  --green: #6f8f70;
  --ink: #5c2939;
  --serif: Georgia, "Times New Roman", serif;
  --sans: "Avenir Next", Avenir, "Segoe UI", sans-serif;
  --script: "Snell Roundhand", "Segoe Script", "Bradley Hand", cursive;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-width: 320px;
  min-height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  color: var(--ink);
  font-family: var(--sans);
  background: var(--cream);
}

button,
input {
  font: inherit;
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid var(--rose-dark);
  outline-offset: 4px;
}

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

/* Passcode opening screen — intentionally no card. */
.lock-screen {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100svh;
  padding: 2rem 1.2rem;
  overflow: hidden;
  text-align: center;
  background:
    radial-gradient(circle at 50% 20%, rgba(255, 255, 255, 0.98), transparent 33%),
    radial-gradient(circle at 10% 90%, rgba(233, 166, 181, 0.3), transparent 32%),
    radial-gradient(circle at 90% 85%, rgba(196, 154, 90, 0.12), transparent 28%),
    linear-gradient(145deg, #fffaf5, #f9e4e5);
  transition: opacity 900ms ease, visibility 0s 900ms;
}

.lock-screen::before,
.lock-screen::after {
  content: "";
  position: absolute;
  width: clamp(15rem, 32vw, 31rem);
  aspect-ratio: 1;
  border: 1px solid rgba(173, 72, 101, 0.09);
  border-radius: 50%;
}

.lock-screen::before {
  top: -15%;
  left: -8%;
  box-shadow: 0 0 0 55px rgba(255, 255, 255, 0.12), 0 0 0 110px rgba(173, 72, 101, 0.025);
}

.lock-screen::after {
  right: -10%;
  bottom: -20%;
  box-shadow: 0 0 0 55px rgba(255, 255, 255, 0.12), 0 0 0 110px rgba(173, 72, 101, 0.025);
}

body.is-unlocked .lock-screen {
  opacity: 0;
  visibility: hidden;
}

.lock-screen__content {
  position: relative;
  z-index: 2;
  width: min(100%, 470px);
  animation: intro-arrives 900ms cubic-bezier(0.22, 0.8, 0.26, 1) both;
}

.rosebud {
  position: relative;
  width: 56px;
  height: 64px;
  margin: 0 auto 1.25rem;
  filter: drop-shadow(0 8px 12px rgba(111, 36, 57, 0.18));
}

.rosebud span {
  position: absolute;
  bottom: 12px;
  left: 50%;
  width: 32px;
  height: 42px;
  border-radius: 60% 60% 42% 42% / 76% 76% 30% 30%;
  background: linear-gradient(145deg, var(--rose-soft), var(--rose));
  transform-origin: bottom center;
}

.rosebud span:first-child { transform: translateX(-78%) rotate(-28deg); }
.rosebud span:nth-child(2) { z-index: 2; transform: translateX(-50%) scale(0.88); background: linear-gradient(145deg, #efb7c3, var(--rose-mid)); }
.rosebud span:last-child { transform: translateX(-22%) rotate(28deg); }

.rosebud::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 3px;
  height: 22px;
  border-radius: 99px;
  background: var(--green);
  transform: translateX(-50%);
}

.eyebrow {
  margin: 0 0 0.9rem;
  color: var(--rose);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.lock-screen h1 {
  margin: 0;
  color: var(--rose-dark);
  font-family: var(--serif);
  font-size: clamp(2.25rem, 8vw, 4.4rem);
  font-weight: 400;
  letter-spacing: -0.045em;
  line-height: 1.02;
  text-wrap: balance;
}

.passcode-form {
  width: min(100%, 340px);
  margin: 2rem auto 0;
}

.passcode-form label {
  display: block;
  margin-bottom: 0.65rem;
  color: #754555;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.passcode-form input {
  width: 100%;
  height: 68px;
  padding: 0.2rem 0.6rem 0.2rem 1.45rem;
  color: var(--rose-dark);
  font-family: var(--serif);
  font-size: 2rem;
  letter-spacing: 0.65em;
  text-align: center;
  border: 0;
  border-bottom: 2px solid rgba(111, 36, 57, 0.32);
  border-radius: 0;
  background: transparent;
  caret-color: var(--rose);
  transition: border-color 220ms ease;
}

.passcode-form input:hover,
.passcode-form input:focus {
  border-color: var(--rose);
}

.passcode-hint,
.passcode-error {
  min-height: 1.25rem;
  margin: 0.55rem 0 0;
  font-size: 0.78rem;
}

.passcode-hint {
  color: #8e6873;
}

.passcode-error {
  margin-top: 0.1rem;
  color: #8a213a;
  font-weight: 700;
}

.passcode-form button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  min-height: 52px;
  margin-top: 0.85rem;
  padding: 0.85rem 1.3rem 0.85rem 1.55rem;
  color: #fff;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.035em;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--rose-dark), var(--rose));
  box-shadow: 0 14px 32px rgba(111, 36, 57, 0.23);
  cursor: pointer;
  transition: transform 220ms ease, box-shadow 220ms ease;
}

.passcode-form button span:last-child {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  color: #111;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
}

.passcode-form button:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 38px rgba(111, 36, 57, 0.29);
}

.passcode-form.is-wrong {
  animation: gentle-shake 430ms ease;
}

/* Revealed garden */
.garden-view {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100svh;
  overflow: hidden;
  isolation: isolate;
  opacity: 0;
  visibility: hidden;
  background:
    radial-gradient(circle at 50% 26%, rgba(255, 255, 255, 0.92), transparent 34%),
    linear-gradient(165deg, #fff9f2 0%, #f8e1e3 56%, #efc9d0 100%);
  transition: opacity 1s 350ms ease, visibility 0s 350ms;
}

body.is-unlocked .garden-view {
  opacity: 1;
  visibility: visible;
}

.garden-view::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0.32;
  background-image: radial-gradient(circle, rgba(173, 72, 101, 0.24) 0 1px, transparent 1.4px);
  background-size: 38px 38px;
  mask-image: linear-gradient(to bottom, black, transparent 78%);
}

.light {
  position: absolute;
  width: 55vmax;
  aspect-ratio: 1;
  z-index: -1;
  border-radius: 50%;
  filter: blur(10px);
  opacity: 0.32;
}

.light--one {
  top: -38vmax;
  left: -23vmax;
  background: rgba(255, 255, 255, 0.9);
}

.light--two {
  right: -34vmax;
  bottom: -38vmax;
  background: rgba(173, 72, 101, 0.3);
}

.love-message {
  position: relative;
  z-index: 8;
  width: min(760px, calc(100% - 2rem));
  margin-bottom: clamp(14rem, 32vh, 22rem);
  padding: 0 1rem;
  text-align: center;
  opacity: 0;
  transform: translateY(22px);
}

body.is-unlocked .love-message {
  animation: message-arrives 1.2s 1.25s cubic-bezier(0.22, 0.8, 0.26, 1) forwards;
}

.love-message__small {
  margin: 0 0 0.85rem !important;
  color: var(--rose) !important;
  font-family: var(--sans) !important;
  font-size: 0.72rem !important;
  font-style: normal !important;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.love-message h2 {
  max-width: 820px;
  margin: 0 auto;
  color: var(--rose-dark);
  font-family: var(--serif);
  font-size: clamp(1.65rem, 4.2vw, 3.4rem);
  font-weight: 400;
  letter-spacing: -0.035em;
  line-height: 1.08;
  text-wrap: balance;
  text-shadow: 0 4px 28px rgba(255, 255, 255, 0.94);
}

.love-message h2 span {
  display: inline-block;
  color: #111;
  font-family: var(--sans);
  font-size: 0.7em;
  animation: heartbeat 2.4s 2.8s ease-in-out infinite;
}

.love-message > p:last-child {
  max-width: 590px;
  margin: 1.25rem auto 0;
  color: #724253;
  font-family: var(--serif);
  font-size: clamp(1rem, 2vw, 1.25rem);
  font-style: italic;
  line-height: 1.65;
  text-wrap: balance;
}

/* The five large CSS roses */
.flower-field {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}

.flower {
  --flower-size: calc(170px * var(--scale));
  position: absolute;
  bottom: -12px;
  left: var(--x);
  width: var(--flower-size);
  height: calc(440px * var(--scale));
  transform: translateX(-10%) rotate(var(--lean));
  transform-origin: bottom center;
}

.stem {
  position: absolute;
  bottom: 0;
  left: 50%;
  width: max(5px, calc(8px * var(--scale)));
  height: 77%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--green-dark), #89a785 60%, #52715a);
  box-shadow: 2px 0 4px rgba(48, 81, 54, 0.16);
  transform: translateX(-50%) scaleY(0);
  transform-origin: bottom center;
}

body.is-unlocked .stem {
  animation: stem-grows 1.45s var(--delay) cubic-bezier(0.15, 0.72, 0.18, 1) forwards;
}

.stem i {
  position: absolute;
  width: calc(65px * var(--scale));
  height: calc(34px * var(--scale));
  border-radius: 100% 0 100% 0;
  background: linear-gradient(140deg, #8ca889, var(--green-dark));
  opacity: 0;
  box-shadow: 0 5px 8px rgba(53, 81, 59, 0.12);
}

.stem i:first-child {
  top: 40%;
  right: 4px;
  transform: rotate(-16deg);
  transform-origin: right bottom;
}

.stem i:last-child {
  top: 63%;
  left: 4px;
  transform: scaleX(-1) rotate(-20deg);
  transform-origin: left bottom;
}

body.is-unlocked .stem i {
  animation: leaf-opens 700ms calc(var(--delay) + 0.72s) ease forwards;
}

.rose {
  position: absolute;
  top: 0;
  left: 50%;
  width: var(--flower-size);
  aspect-ratio: 1;
  opacity: 0;
  filter: drop-shadow(0 18px 16px rgba(111, 36, 57, 0.2));
  transform: translateX(-50%) scale(0.02) rotate(-18deg);
}

body.is-unlocked .rose {
  animation:
    rose-blooms 1.6s calc(var(--delay) + 0.72s) cubic-bezier(0.13, 0.85, 0.18, 1.18) forwards,
    rose-sways 5s calc(var(--delay) + 2.4s) ease-in-out infinite alternate;
}

.rose i {
  position: absolute;
  left: 34%;
  top: 2%;
  width: 32%;
  height: 57%;
  border-radius: 66% 66% 48% 48% / 76% 76% 36% 36%;
  background: linear-gradient(155deg, #f2b3c1 0%, var(--rose-mid) 58%, var(--rose-dark) 100%);
  box-shadow: 0 -2px 0 rgba(255, 255, 255, 0.25) inset, 0 8px 10px rgba(111, 36, 57, 0.09);
  transform-origin: 50% 86%;
}

.rose i:nth-child(1) { transform: rotate(0deg) translateY(-5%); }
.rose i:nth-child(2) { transform: rotate(45deg) translateY(-5%); }
.rose i:nth-child(3) { transform: rotate(90deg) translateY(-5%); }
.rose i:nth-child(4) { transform: rotate(135deg) translateY(-5%); }
.rose i:nth-child(5) { transform: rotate(180deg) translateY(-5%); }
.rose i:nth-child(6) { transform: rotate(225deg) translateY(-5%); }
.rose i:nth-child(7) { transform: rotate(270deg) translateY(-5%); }
.rose i:nth-child(8) { transform: rotate(315deg) translateY(-5%); }

.rose i:nth-child(9),
.rose i:nth-child(10) {
  z-index: 2;
  left: 38%;
  top: 21%;
  width: 24%;
  height: 39%;
  background: linear-gradient(155deg, #eaa2b3, var(--rose) 62%, var(--rose-dark));
}

.rose i:nth-child(9) { transform: rotate(-27deg); }
.rose i:nth-child(10) { transform: rotate(27deg); }

.rose b {
  position: absolute;
  top: 39%;
  left: 40%;
  z-index: 4;
  width: 20%;
  height: 20%;
  border-radius: 48% 52% 47% 53%;
  background: radial-gradient(circle at 38% 32%, #dc7890, var(--rose-dark) 72%);
  box-shadow: 0 0 18px rgba(111, 36, 57, 0.34);
}

.rose--blush i {
  background: linear-gradient(155deg, #fff1ef, #e9a6b5 58%, #c6607b 100%);
}

.rose--blush i:nth-child(9),
.rose--blush i:nth-child(10) {
  background: linear-gradient(155deg, #f8ccd3, #cf7088 66%, #9f3c58);
}

.rose--velvet i {
  background: linear-gradient(155deg, #df899e, #a83f5d 58%, #681e34 100%);
}

.rose--velvet i:nth-child(9),
.rose--velvet i:nth-child(10) {
  background: linear-gradient(155deg, #c95e79, #852d48 68%, #551326);
}

.rose--hero {
  filter: drop-shadow(0 20px 20px rgba(111, 36, 57, 0.24)) drop-shadow(0 0 24px rgba(233, 166, 181, 0.35));
}

/* Falling petals start only after the code is accepted. */
.petal-layer {
  position: absolute;
  inset: -12vh 0 0;
  z-index: 6;
  overflow: hidden;
  pointer-events: none;
}

.falling-petal {
  position: absolute;
  top: -10vh;
  left: var(--left);
  width: var(--size);
  height: calc(var(--size) * 0.65);
  border-radius: 80% 12% 74% 20%;
  background: linear-gradient(145deg, rgba(255, 226, 231, 0.95), rgba(190, 76, 104, 0.78));
  box-shadow: 0 3px 5px rgba(111, 36, 57, 0.1);
  opacity: var(--opacity);
  animation: petal-falls var(--duration) var(--delay) linear infinite;
}

.music-toggle {
  position: absolute;
  top: clamp(1rem, 3vw, 1.5rem);
  right: clamp(1rem, 3vw, 1.5rem);
  z-index: 12;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 44px;
  padding: 0.45rem 0.9rem;
  color: var(--rose-dark);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  border: 1px solid rgba(111, 36, 57, 0.18);
  border-radius: 999px;
  background: rgba(255, 249, 243, 0.74);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  cursor: pointer;
  opacity: 0;
  transition: transform 220ms ease, background 220ms ease;
}

body.is-unlocked .music-toggle {
  animation: control-arrives 700ms 1.7s ease forwards;
}

.music-toggle:hover {
  transform: translateY(-2px);
  background: rgba(255, 249, 243, 0.95);
}

.bars {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 19px;
}

.bars i {
  display: block;
  width: 3px;
  height: 55%;
  border-radius: 99px;
  background: var(--rose);
  animation: sound-bar 800ms ease-in-out infinite alternate;
}

.bars i:nth-child(2) { height: 100%; animation-delay: -300ms; }
.bars i:nth-child(3) { height: 72%; animation-delay: -550ms; }

.music-toggle[aria-pressed="false"] .bars i {
  height: 3px;
  animation: none;
}

.garden-view footer {
  position: absolute;
  bottom: clamp(0.7rem, 2vh, 1.2rem);
  left: 50%;
  z-index: 10;
  color: rgba(111, 36, 57, 0.86);
  font-family: var(--script);
  font-size: clamp(1rem, 2.6vw, 1.3rem);
  white-space: nowrap;
  opacity: 0;
  transform: translateX(-50%);
}

body.is-unlocked .garden-view footer {
  animation: control-arrives 900ms 2.3s ease forwards;
}

@keyframes intro-arrives {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes gentle-shake {
  20% { transform: translateX(-8px); }
  40% { transform: translateX(7px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(3px); }
}

@keyframes message-arrives {
  to { opacity: 1; transform: translateY(0); }
}

@keyframes stem-grows {
  to { transform: translateX(-50%) scaleY(1); }
}

@keyframes leaf-opens {
  from { opacity: 0; scale: 0.15; }
  to { opacity: 0.88; scale: 1; }
}

@keyframes rose-blooms {
  0% { opacity: 0; transform: translateX(-50%) scale(0.02) rotate(-18deg); }
  42% { opacity: 1; }
  78% { transform: translateX(-50%) scale(1.08) rotate(2deg); }
  100% { opacity: 1; transform: translateX(-50%) scale(1) rotate(0); }
}

@keyframes rose-sways {
  from { rotate: -1.4deg; }
  to { rotate: 1.4deg; }
}

@keyframes heartbeat {
  0%, 40%, 100% { transform: scale(1); }
  48% { transform: scale(1.16); }
  56% { transform: scale(1); }
  64% { transform: scale(1.1); }
}

@keyframes petal-falls {
  0% { transform: translate3d(0, -10vh, 0) rotate(0); }
  30% { transform: translate3d(var(--drift-a), 38vh, 0) rotate(150deg); }
  65% { transform: translate3d(var(--drift-b), 82vh, 0) rotate(310deg); }
  100% { transform: translate3d(var(--drift-c), 125vh, 0) rotate(520deg); }
}

@keyframes control-arrives {
  to { opacity: 1; }
}

@keyframes sound-bar {
  to { height: 25%; }
}

@media (max-width: 720px) {
  .love-message {
    align-self: flex-start;
    width: min(100%, 600px);
    margin: max(10vh, 5.5rem) auto 0;
  }

  .love-message h2 {
    font-size: clamp(1.5rem, 7vw, 2.5rem);
  }

  .love-message > p:last-child {
    max-width: 450px;
    font-size: 1rem;
  }

  .flower {
    --flower-size: calc(125px * var(--scale));
    height: calc(350px * var(--scale));
  }

  .flower--one { left: -5% !important; }
  .flower--two { left: 12% !important; }
  .flower--three { left: 37% !important; }
  .flower--four { left: 67% !important; }
  .flower--five { left: 87% !important; }

  .music-label {
    display: none;
  }

  .music-toggle {
    padding: 0.55rem 0.75rem;
  }
}

@media (max-width: 430px) {
  .lock-screen__content {
    transform: translateY(-2vh);
  }

  .flower {
    --flower-size: calc(105px * var(--scale));
    height: calc(305px * var(--scale));
  }

  .flower--one,
  .flower--five {
    display: none;
  }

  .flower--two { left: -3% !important; }
  .flower--three { left: 33% !important; }
  .flower--four { left: 76% !important; }

  .love-message {
    margin-top: max(9vh, 4.7rem);
    padding: 0 0.3rem;
  }

  .love-message__small {
    letter-spacing: 0.15em;
  }
}

/* Accessibility: remove long motion for visitors who request it. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
  }

  .petal-layer {
    display: none;
  }
}

@media (prefers-contrast: more) {
  :root {
    --rose-dark: #521326;
    --ink: #411322;
  }

  .passcode-form input,
  .music-toggle {
    border-color: var(--rose-dark);
  }
}
