:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  color: #482b3d;
  background: #f5dce7;
  --ink: #482b3d;
  --soft-ink: #694758;
  --accent: #88405e;
  --accent-deep: #72314d;
  --surface: #fff8fc;
  --blush: #f9ebf2;
  --rose: #f3dbe7;
  --border: #e7bfd0;
  --focus: #98446a;
  --shade: #7634551f;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

* { box-sizing: border-box; }
[hidden], dialog:not([open]) { display: none !important; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  background: radial-gradient(ellipse at 42% 3%, #fff5fa 0%, #fae7ef 38%, #eed0df 100%);
}
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
::selection { color: var(--ink); background: #efc4d7; }
a { color: var(--accent-deep); }

.scene {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr;
  justify-items: center;
  align-items: center;
  gap: 16px;
  gap: clamp(12px, 3svh, 24px);
  padding: 18px 16px 24px;
  padding: max(18px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
    max(24px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
.topline {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: .55rem;
  color: var(--soft-ink);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: .13em;
  font-size: .75rem;
  font-weight: 750;
}
.topline span { color: #ac6481; letter-spacing: 0; }
.floating-decor { position: absolute; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.floating-decor i { position: absolute; color: #b8618b66; font-style: normal; animation: drift 9s ease-in-out infinite alternate; }
.floating-decor i:nth-child(1) { left: 9%; top: 21%; font-size: 1.55rem; }
.floating-decor i:nth-child(2) { right: 12%; top: 18%; font-size: .9rem; animation-delay: -3s; }
.floating-decor i:nth-child(3) { right: 10%; bottom: 17%; font-size: 1.35rem; animation-delay: -5s; }
.floating-decor i:nth-child(4) { left: 12%; bottom: 13%; font-size: 1.1rem; animation-delay: -2s; }
.floating-decor i:nth-child(5) { right: 6%; top: 53%; font-size: 2rem; animation-delay: -6s; }
@keyframes drift { to { transform: translate(9px, -12px) rotate(15deg); } }

.invitation {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: min(100%, 28rem);
  min-width: 0;
  min-height: 24rem;
  padding: clamp(1.25rem, 5vw, 2rem);
  border: 1px solid #fff9fc;
  border-radius: clamp(23px, 7vw, 34px);
  background: linear-gradient(152deg, #fffafd 0%, #fcedf4 57%, #f8e1eb 100%);
  box-shadow: 0 22px 58px #97516e27, 0 2px 6px #b4648b14;
  text-align: center;
}
.invitation[data-stage="fog"] { padding-block: clamp(1.6rem, 6vw, 2.5rem); }
.invitation:is([data-stage="date"], [data-stage="activity"], [data-stage="final"]) { padding-top: 2.4rem; }
h1 {
  margin: 0 0 1.12rem;
  color: var(--ink);
  font-size: clamp(1.75rem, 7.4vw, 2.3rem);
  font-weight: 820;
  letter-spacing: -.042em;
  line-height: 1.12;
  overflow-wrap: anywhere;
}
.stage {
  position: relative;
  min-width: 0;
  width: 100%;
  animation: arrive .38s var(--ease) backwards;
}
.stage h1:focus { outline: none; }
@keyframes arrive { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: none; } }
.progress { position: absolute; top: 1rem; display: flex; gap: 5px; }
.progress-dot { width: .66rem; height: .3rem; border-radius: 999px; background: #e7bfd0; }
.progress-dot.active { width: 1.2rem; background: #995472; }

.art {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(100%, 15rem);
  height: clamp(106px, 32vw, 142px);
  margin: 0 0 .45rem;
  pointer-events: none;
}
.invitation:is([data-stage="date"], [data-stage="activity"], [data-stage="final"]) .art {
  height: clamp(88px, 26vw, 119px);
}
.pug {
  display: none;
  width: auto;
  height: 100%;
  max-width: 100%;
  object-fit: contain;
  filter: drop-shadow(0 5px 8px #8e45622c);
  animation: arrive .42s var(--ease) backwards, var(--pug-motion);
}
.art[data-pose="pair"] .pug-pair,
.art[data-pose="hat"] .pug-hat,
.art[data-pose="pals"] .pug-pals,
.art[data-pose="party"] .pug-party,
.art[data-pose="heart"] .pug-heart { display: block; }
.pug-pair, .pug-hat, .pug-heart { --pug-motion: pug-sway 5s .45s ease-in-out infinite; }
.pug-pals { --pug-motion: pug-breathe 3.8s .45s ease-in-out infinite; }
.pug-party { --pug-motion: pug-hop 3.6s .45s ease-in-out infinite; }
.art .pug-pals { position: relative; aspect-ratio: 420 / 349; }
.pals-base, .pals-heart { position: absolute; inset: 0; width: 100%; height: 100%; }
.pals-base { clip-path: polygon(evenodd, 0 0, 100% 0, 100% 100%, 0 100%, 0 0, 59% 21%, 59% 26%, 61% 40%, 68% 41%, 76% 32%, 76% 21%, 59% 21%, 0 0); }
.pals-heart { clip-path: polygon(59% 21%, 76% 21%, 76% 32%, 68% 41%, 61% 40%, 59% 26%); transform-origin: 66% 33%; animation: heart-bob 2.8s ease-in-out infinite; }
@keyframes pug-sway { 0%, 100% { transform: none; } 45% { transform: translateY(-2px) rotate(-4deg); } 75% { transform: rotate(2deg); } }
@keyframes pug-breathe { 0%, 100% { transform: none; } 50% { transform: scale(1.025, 1.04); } }
@keyframes pug-hop { 0%, 100% { transform: none; } 12% { transform: translateY(-7px) rotate(-4deg); } 30% { transform: translateY(-2px) rotate(2deg); } }
@keyframes heart-bob { 0%, 100% { transform: none; } 45% { transform: translate(2px, -7px) rotate(9deg) scale(1.09); } }

.dedication {
  margin: 0 auto .65rem;
  color: var(--accent-deep);
  font: italic 500 clamp(1.55rem, 6.2vw, 2.1rem) / 1.12 Georgia, "Times New Roman", serif;
  text-wrap: balance;
}
.glass-title { margin: 0 0 .9rem; color: var(--ink); font-size: 1.06rem; font-weight: 800; }
.glass-wrap {
  position: relative;
  isolation: isolate;
  width: min(100%, clamp(170px, 63vw, 270px));
  margin-inline: auto;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid #fff9fc;
  border-radius: 22px;
  background: #edccdb;
  box-shadow: 0 10px 24px #a5597940;
}
.fog-message {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  padding: 1rem;
  background: radial-gradient(at 25% 20%, #f9e5ee, #eac1d4);
  color: var(--accent-deep);
  font-size: 1.25rem;
  font-weight: 825;
  line-height: 1.25;
}
.glass-wrap canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
  transition: opacity .48s ease;
}
.glass-wrap canvas.cleared { opacity: 0; pointer-events: none; }
.glass-wrap:focus-within { outline: 3px solid var(--focus); outline-offset: 4px; }
.hint { margin: .85rem 0 0; color: var(--soft-ink); font-size: .9rem; line-height: 1.4; }
.keyboard-hint {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.stage-fog:has(canvas:focus-visible) .keyboard-hint {
  position: static;
  width: auto;
  height: auto;
  clip-path: none;
  white-space: normal;
}

.button, .slot, .choice, .picker-toggle, .dropdown-option, .station-option, .map-open,
.icon-button, .metro-line-button, .metro-stop {
  min-height: 44px;
  min-width: 44px;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: #b5567c29;
}
.button {
  padding: .68rem 1.15rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 760;
  line-height: 1.25;
  transition: background .18s ease, box-shadow .18s ease;
}
.button-primary, .button-yes {
  border-color: #924765;
  background: var(--accent);
  color: #fffafd;
  box-shadow: 0 5px 14px #8b3c5a2c;
}
.button-primary { width: 100%; margin-top: 1rem; }
.button-no { border-color: var(--border); background: var(--surface); color: var(--accent-deep); }
.button-no.escape { position: fixed; z-index: 20; box-shadow: 0 5px 18px var(--shade); white-space: nowrap; }
button:disabled { cursor: default; }
.button:disabled, .picker-toggle:disabled, .icon-button:disabled {
  border-color: var(--border);
  background: #f0dbe6;
  color: #775669;
  box-shadow: none;
}
@media (hover: hover) {
  .button-primary:hover:not(:disabled), .button-yes:hover:not(:disabled) { background: var(--accent-deep); }
  .button-no:hover { background: var(--blush); }
}
.answer-row { display: flex; justify-content: center; align-items: center; gap: .65rem; }
.answer-row .button { padding-inline: 1.3rem; }
.no-slot { display: inline-flex; min-width: 5rem; min-height: 44px; align-items: center; }
.stage-refusal h1 { margin-bottom: .35rem; font-size: clamp(1.48rem, 5.3vw, 1.92rem); line-height: 1.2; }

.fields, .station-picker, .dropdown, .custom-activity { display: grid; min-width: 0; gap: .55rem; text-align: left; }
.fields { gap: .8rem; }
.fields fieldset { min-width: 0; padding: 0; margin: 0; border: 0; }
.fields legend, .field-label { color: var(--soft-ink); font-size: .88rem; font-weight: 750; }
.fields legend { margin-bottom: .45rem; }
.slots, .custom-slot-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .45rem; }
.slot, .choice {
  padding: .62rem .4rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  font-size: .86rem;
  font-weight: 650;
}
.slot strong { display: block; margin-top: .13rem; font-size: 1.02rem; }
.slot-custom, .choice-custom { grid-column: 1 / -1; }
.slot[aria-pressed="true"], .choice[aria-expanded="true"] { border-color: #b56386; background: var(--rose); color: var(--accent-deep); }
.custom-slot-fields { margin-top: .7rem; }
.picker-anchor { position: relative; min-width: 0; }
.picker-anchor:focus-within { z-index: 4; }
.picker-toggle, .fields input, .custom-activity input {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  padding: .6rem .72rem;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface);
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.25;
}
.picker-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .44rem;
  text-align: left;
  font-weight: 650;
}
.picker-toggle span { min-width: 0; overflow-wrap: anywhere; }
.picker-toggle::after {
  content: '';
  width: .45rem;
  height: .45rem;
  flex: 0 0 auto;
  margin: -3px 2px 0 0;
  border: solid var(--accent);
  border-width: 0 2px 2px 0;
  transform: rotate(225deg);
}
.picker-toggle[aria-expanded="true"]::after { margin-top: 4px; transform: rotate(45deg); }
.dropdown-menu, .station-options {
  position: absolute;
  z-index: 4;
  bottom: calc(100% + .35rem);
  inset-inline: 0;
  max-height: var(--menu-height, 15rem);
  overflow: auto;
  overscroll-behavior: contain;
  padding: .35rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 8px 18px var(--shade);
}
.station-options { display: grid; grid-template-rows: auto minmax(0, 1fr); gap: .35rem; }
.station-options input { background: var(--blush); }
.station-list { max-height: 11.5rem; overflow: auto; overscroll-behavior: contain; margin: 0; padding: 0; list-style: none; }
.dropdown-option, .station-option {
  display: flex;
  align-items: center;
  gap: .45rem;
  width: 100%;
  padding: .52rem .55rem;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink);
  font-size: .94rem;
  font-weight: 650;
  text-align: left;
}
.dropdown-option[aria-pressed="true"], .dropdown-option:focus-visible, .station-option:focus-visible {
  background: var(--rose);
  outline-offset: -2px;
}
@media (hover: hover) {
  .slot:hover, .choice:hover, .picker-toggle:hover:not(:disabled),
  .dropdown-option:hover, .station-option:hover, .map-open:hover, .icon-button:hover:not(:disabled) { background: var(--blush); }
}
#station-value { display: flex; align-items: center; gap: .5rem; }
.station-line, .map-symbol {
  display: inline-grid;
  place-items: center;
  flex: 0 0 1.45rem;
  height: 1.45rem;
  border-radius: 50%;
  color: #fff;
  background: var(--line-color, var(--accent));
  font-size: .77rem;
  font-weight: 850;
  overflow-wrap: normal;
}
.station-empty { margin: .3rem .6rem .5rem; color: var(--soft-ink); font-size: .94rem; }
.map-open {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .48rem;
  padding: .5rem .76rem;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: #f7e4ee;
  color: var(--accent-deep);
  font-weight: 750;
}

.choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
.activity-hint { margin: -.55rem 0 .85rem; color: var(--soft-ink); font-size: .9rem; line-height: 1.4; }
.choice {
  display: grid;
  gap: .14rem;
  justify-items: center;
  align-content: center;
  min-height: 60px;
  padding: .38rem .25rem;
}
.choice span { font-size: 1.36rem; line-height: 1.2; }
.choice small { font-size: .94rem; line-height: 1.15; overflow-wrap: anywhere; }
.choice-custom { display: flex; align-items: center; justify-content: center; gap: .42rem; min-height: 46px; }
.custom-activity { margin-top: .65rem; }
.custom-activity .button { margin-top: .15rem; }
.final-copy { max-width: 34ch; margin: -.25rem auto 1rem; color: var(--soft-ink); font-size: .96rem; line-height: 1.42; }
.countdown { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .38rem; margin-bottom: .8rem; }
.countdown div { display: grid; gap: .14rem; padding: .55rem .1rem; border-radius: 12px; background: var(--rose); }
.countdown b { color: var(--accent-deep); font-size: 1.25rem; font-variant-numeric: tabular-nums; line-height: 1; }
.countdown small { color: var(--soft-ink); font-size: .73rem; font-weight: 720; overflow-wrap: anywhere; }
.summary { display: grid; gap: .37rem; margin: 0; text-align: left; }
.summary div { display: flex; justify-content: space-between; align-items: first baseline; gap: .55rem; padding: .56rem .66rem; border-radius: 11px; background: var(--surface); font-size: .88rem; line-height: 1.3; }
.summary dt { color: var(--soft-ink); font-weight: 750; flex-shrink: 0; }
.summary dd { min-width: 0; margin: 0; overflow-wrap: anywhere; text-align: right; }
.saved { margin: .7rem 0 0; color: var(--soft-ink); font-size: .87rem; line-height: 1.4; }
.saved:empty { margin: 0; }
.confetti { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 8; pointer-events: none; }

.metro-open { overflow: hidden; }
.metro-dialog {
  position: fixed;
  inset: 0;
  width: min(510px, calc(100% - 24px));
  width: min(510px, calc(100% - max(12px, env(safe-area-inset-left)) - max(12px, env(safe-area-inset-right))));
  max-width: none;
  max-height: calc(100vh - 24px);
  max-height: calc(100dvh - 24px);
  margin: auto;
  padding: 1rem;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 18px 55px #4d263e39;
}
.metro-dialog[open] { display: grid; gap: .65rem; }
.metro-dialog::backdrop { background: #4a293e72; }
.metro-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.metro-head h2 { margin: 0; font-size: clamp(1.13rem, 5.2vw, 1.55rem); letter-spacing: -.02em; }
.icon-button {
  display: grid;
  flex: 0 0 44px;
  width: 44px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--accent-deep);
  font-size: 1.35rem;
  line-height: 1;
}
.metro-lines { display: grid; grid-template-columns: repeat(6, minmax(44px, 1fr)); gap: .35rem; }
.metro-line-button {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--blush);
  color: var(--line-color);
  font-weight: 850;
}
.metro-line-button[aria-pressed="true"] { border-color: var(--line-color); background: var(--line-color); color: #fff; }
.metro-viewport {
  position: relative;
  min-width: 0;
  max-height: min(64vh, 570px);
  max-height: min(64dvh, 570px);
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: #fdf2f7;
  -webkit-overflow-scrolling: touch;
}
.metro-stations {
  position: relative;
  margin: 0;
  padding: .28rem .4rem;
  list-style: none;
}
.metro-stations::before {
  content: '';
  position: absolute;
  top: calc(.28rem + 22px);
  bottom: calc(.28rem + 22px);
  left: 1.65rem;
  width: 4px;
  transform: translateX(-50%);
  border-radius: 3px;
  background: var(--line-color);
  pointer-events: none;
}
.metro-stop {
  position: relative;
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr);
  align-items: center;
  width: 100%;
  padding: .48rem .6rem .48rem .25rem;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 660;
  text-align: left;
  overflow-wrap: anywhere;
}
.metro-stop::before {
  content: '';
  width: 13px;
  height: 13px;
  justify-self: center;
  border: 3px solid var(--line-color);
  border-radius: 50%;
  background: var(--surface);
}
.metro-stop[aria-pressed="true"] { background: var(--rose); }
.metro-stop[aria-pressed="true"]::before { background: var(--line-color); }
.metro-stop:focus-visible { outline-offset: -2px; }
@media (hover: hover) { .metro-stop:hover { background: #e6a9c22d; } }

@media (max-width: 640px) {
  .metro-dialog {
    inset: auto 0 0;
    width: 100%;
    margin: 0;
    max-height: calc(100vh - 12px);
    max-height: calc(100dvh - max(12px, env(safe-area-inset-top)));
    padding-inline: max(12px, env(safe-area-inset-left)) max(12px, env(safe-area-inset-right));
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    border-radius: 22px 22px 0 0;
  }
}
@media (max-width: 480px) {
  .invitation { max-width: 26rem; }
  .invitation:is([data-stage="activity"], [data-stage="final"]) { min-height: 0; }
}
@media (max-height: 520px) {
  .scene { align-items: start; gap: .65rem; }
  .invitation { min-height: 0; }
  .art { max-height: 114px; }
  .metro-viewport { max-height: min(46vh, 300px); max-height: min(46dvh, 300px); }
}
@media (max-width: 340px) {
  .custom-slot-fields { grid-template-columns: 1fr; }
  .metro-lines { grid-template-columns: repeat(3, minmax(44px, 1fr)); }
  .invitation { padding-inline: 1rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

