@font-face {
  font-family: "Pixelify Sans";
  src: url("/fonts/pixelify-sans.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

:root {
  color-scheme: light;
  --ink: #452c40;
  --muted: #715363;
  --edge: #503343;
  --letter-edge: #352331;
  --wine: #783e59;
  --rose: #dfa2a1;
  --paper: #fff1db;
  --scene-dots-bottom: max(.375rem, env(safe-area-inset-bottom));
  --scene-dots-clearance: calc(2.875rem + var(--scene-dots-bottom));
  --pixel-type: "Pixelify Sans", ui-monospace, monospace;
  font: 100%/1.4 var(--pixel-type);
  color: var(--ink);
  background: #d8b8b2;
}

* { box-sizing: border-box }
body { margin: 0; font-size: 1.125rem }
.scene-viewport {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}
.scene-layer {
  position: absolute;
  inset: 0;
  background: center/cover no-repeat;
}
.scene-current {
  background: var(--scene) var(--crop, 50%) center/cover no-repeat;
}
.scene-dots {
  position: fixed;
  inset-inline: 0;
  bottom: var(--scene-dots-bottom);
  display: flex;
  width: max-content;
  margin-inline: auto;
}
.scene-dot {
  display: grid;
  place-items: center;
  width: clamp(32px, 12vw, 44px);
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  filter: drop-shadow(0 1px 1px #342235);
}
.scene-dot::before {
  content: "";
  width: 10px;
  height: 10px;
  clip-path: polygon(20% 0, 80% 0, 80% 20%, 100% 20%, 100% 80%, 80% 80%, 80% 100%, 20% 100%, 20% 80%, 0 80%, 0 20%, 20% 20%);
  background: #d3a9ad;
}
.scene-dot[aria-current=true]::before { background: var(--paper); transform: scale(1.4) }
[hidden] { display: none !important }
button, input, textarea { font: inherit; color: inherit }
button { cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent }
button:disabled { cursor: default }
button:focus-visible, input:focus-visible, textarea:focus-visible, .choice-dropdown summary:focus-visible {
  outline: 3px dashed var(--wine);
  outline-offset: 3px;
}
h1:focus, h2:focus { outline: none }

.stage {
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100svh;
  padding: 16px;
  touch-action: pan-y pinch-zoom;
}
.shell { position: relative; z-index: 1; width: min(100%, 38rem) }
.shell, #picker { isolation: isolate; background: transparent; border: 0 }

/* Keep corners at 2x their native size. Only the plain center and edges stretch. */
.shell::before, #picker::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  border-image: url("/ui/window.webp") 15 fill / 30px / 0 stretch;
  image-rendering: pixelated;
  filter: drop-shadow(2px 4px 0 #39263766);
}
.shell.closed { width: 13.75rem; height: 4.5rem }
.shell.closed::before {
  border-image: none;
  background: url("/ui/start.webp") center / 100% 100% no-repeat;
}
#start {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 0 0 6px;
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
  font-weight: 700;
  font-size: 2.5rem;
  line-height: 1;
}
#start, h1:not(.step-heading) {
  color: #fff9e9;
  -webkit-text-stroke: 3px var(--letter-edge);
  paint-order: stroke fill;
  text-shadow: 0 2px var(--letter-edge), 2px 2px var(--letter-edge), 2px 4px var(--letter-edge);
}
.shell.closed:active { transform: translateY(2px) }
@media (hover: hover) {
  .shell.closed:hover::before { filter: brightness(1.055) drop-shadow(2px 4px 0 #39263766) }
}

/* A seven-pixel sparkle, with two inks for its lit and shaded sides. */
.gem {
  display: block;
  width: 14px;
  height: 14px;
  flex: none;
  clip-path: polygon(6px 0,8px 0,8px 4px,10px 4px,10px 6px,14px 6px,14px 8px,10px 8px,10px 10px,8px 10px,8px 14px,6px 14px,6px 10px,4px 10px,4px 8px,0 8px,0 6px,4px 6px,4px 4px,6px 4px);
  background: linear-gradient(90deg, #b57883 0 6px, #855265 6px);
}
#contents { padding: 10px }
.scroll {
  overflow: auto;
  max-height: calc(100vh - 2 * var(--scene-dots-clearance) - 20px);
  max-height: calc(100dvh - 2 * var(--scene-dots-clearance) - 20px);
  padding: clamp(1.3rem, 3.8vw, 2.25rem);
  scrollbar-width: thin;
  scrollbar-color: #b9858c #f0d7c6;
  overscroll-behavior: contain;
  touch-action: pan-y pinch-zoom;
}
.ornament { display: flex; justify-content: center; align-items: center; gap: 8px; margin: 0 auto 1rem }
.ornament::before, .ornament::after { content: ""; height: 2px; width: 30px; background: #d5afa1 }
h1 {
  margin: 0;
  font-size: clamp(1.875rem, 4vw, 2.25rem);
  font-weight: 700;
  line-height: 1.15;
  text-align: center;
  text-wrap: balance;
}
h1 em { font-style: normal; color: #ffddd5 }
.intro { text-align: center; color: var(--muted); max-width: 39ch; margin: 1rem auto 1.7rem; text-wrap: pretty }
h2 {
  display: block;
  font-size: 1.375rem;
  font-weight: 650;
  line-height: 1.2;
  margin: 0;
  padding: 0;
}
.hint { color: var(--muted); font-size: 1rem; margin: .4rem 0 .85rem }
.step-heading { font-size: clamp(1.5rem, 3.8vw, 2rem); line-height: 1.2; letter-spacing: 0 }
.question-progress { color: var(--wine); text-align: center; font-size: 1rem; font-weight: 600; margin: 0 0 .5rem }
#question-answer:not(:empty), #form input { margin-top: 1.15rem }

.add-date, .choice, .primary, .choice-dropdown summary {
  --tile-edge: #986e75;
  --tile-light: #fffaf0;
  --tile-shade: #e8c9b6;
  border: 0;
  background: #fff4e3;
  box-shadow: inset 2px 2px var(--tile-light), inset -2px -2px var(--tile-shade),
    -2px 0 var(--tile-edge), 2px 0 var(--tile-edge), 0 -2px var(--tile-edge), 0 2px var(--tile-edge);
}
.add-date {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 54px;
  padding: .65rem 1rem;
  gap: .75rem;
  text-align: left;
  font-weight: 600;
}
.add-date-mark { margin-left: auto; font-size: 1.4rem; color: var(--wine) }
.calendar-icon {
  flex: none;
  width: 18px;
  height: 16px;
  border: 2px solid var(--wine);
  position: relative;
  background: linear-gradient(transparent 3px, var(--wine) 3px 5px, transparent 5px);
}
.calendar-icon::before {
  content: "";
  position: absolute;
  left: 2px;
  top: -4px;
  width: 2px;
  height: 5px;
  background: var(--wine);
  box-shadow: 8px 0 var(--wine);
}
.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 1.5rem;
  border-top: 2px solid #e8cbba;
  padding-top: 1.1rem;
}
.footer.right { justify-content: flex-end }
.primary, .secondary { min-height: 44px; padding: .55rem 1.3rem; font-weight: 600 }
.primary {
  --tile-edge: var(--edge);
  --tile-light: #c78895;
  --tile-shade: #743e59;
  color: #fff8e6;
  background: #96566d;
  text-shadow: 1px 2px #4e3041;
}
.primary:disabled { opacity: .65 }
.secondary, .icon-button { border: 0; background: transparent; color: var(--wine) }
.secondary { padding-inline: .5rem }
@media (hover: hover) {
  :is(.choice,.day,.add-date,.secondary,.icon-button,.choice-dropdown summary):not(:disabled):hover { background-color: #f7dbc9 }
  .primary:not(:disabled):hover { background-color: #a3637a }
}
#times { margin-top: 1.65rem }
.time-day {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, min(48%, 11rem));
  align-items: start;
  gap: .75rem;
  padding: .6rem 0;
}
.time-day + .time-day { border-top: 2px solid #e8cbba }
.time-date { color: var(--wine); padding: .65rem 0; line-height: 1.25 }
.choice-dropdown summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: .4rem;
  min-height: 44px;
  list-style: none;
  padding: .5rem .65rem;
  font-size: 1rem;
  line-height: 1.25;
  cursor: pointer;
}
.choice-dropdown summary::-webkit-details-marker { display: none }
.choice-dropdown summary::after {
  content: "";
  width: 10px;
  height: 6px;
  flex: none;
  background: var(--wine);
  clip-path: polygon(0 0,10px 0,10px 2px,8px 2px,8px 4px,6px 4px,6px 6px,4px 6px,4px 4px,2px 4px,2px 2px,0 2px);
}
.choice-dropdown[open] summary::after { transform: rotate(180deg) }
.choice-options {
  position: fixed;
  z-index: 2;
  display: grid;
  padding: 2px;
  border: 2px solid #986e75;
  background: #fff4e3;
  overflow: auto;
  overscroll-behavior: contain;
  box-shadow: 2px 3px #50334340;
}
.choice-options .choice {
  padding: .4rem .35rem;
  gap: .35rem;
  font-size: 1rem;
  box-shadow: none;
}
.icon-button { display: grid; place-items: center; min-width: 44px; min-height: 44px; font-size: 1.6rem; line-height: 1; padding: 0 }

.choice {
  display: flex;
  align-items: center;
  text-align: left;
  gap: .65rem;
  padding: .55rem .8rem;
  min-height: 44px;
  max-width: 100%;
  line-height: 1.25;
}
.choice::before {
  content: "";
  flex: 0 0 12px;
  width: 12px;
  height: 12px;
  border: 2px solid #ae8384;
}
.choice[aria-pressed=true] {
  --tile-light: #fae0ca;
  --tile-shade: #cb9098;
  --tile-edge: #865569;
  background: #f0c7bf;
}
.choice[aria-pressed=true]::before {
  height: 10px;
  border: 0;
  background: var(--wine);
  clip-path: polygon(0 4px,2px 4px,2px 6px,4px 6px,4px 4px,6px 4px,6px 2px,8px 2px,8px 0,12px 0,12px 2px,10px 2px,10px 4px,8px 4px,8px 6px,6px 6px,6px 8px,4px 8px,4px 10px,2px 10px,2px 8px,0 8px);
}
textarea, input {
  display: block;
  width: 100%;
  margin-top: .7rem;
  padding: .7rem .85rem;
  border: 2px solid #ab8284;
  border-radius: 0;
  background: #fff8e9;
  box-shadow: inset 2px 2px #eed8c7;
}
textarea { resize: vertical; min-height: 5rem }
textarea::placeholder { color: var(--muted) }
#error:empty { display: none }
.error { color: #822c45 }
#thanks { text-align: center; padding: .5rem 0 1.3rem }
#thanks p { margin: .7rem 0 0; font-size: 1.25rem }

#picker {
  position: fixed;
  inset: 0;
  margin: auto;
  padding: 8px;
  color: var(--ink);
  width: min(23rem, calc(100% - 24px));
  overflow: visible;
}
#picker::backdrop { background: #34233566 }
.dialog-body { padding: 1rem; overflow: auto; max-height: calc(100dvh - 44px) }
.dialog-head, .month-nav { display: flex; align-items: center; justify-content: space-between; gap: .3rem }
.month-nav { margin: .4rem 0 }
.weekdays, .days { display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); gap: 3px; text-align: center }
.weekdays { font-size: 1rem; color: var(--muted); margin: .5rem 0 }
.day { border: 2px solid transparent; border-radius: 0; padding: 0; min-height: 42px; background: #fffaeb }
.day:disabled { color: #ac9390; background: transparent }
.day[aria-current=date] { border-color: #aa747f; font-weight: 700 }
#picker .day[aria-pressed=true] {
  background: #ebc0b9;
  color: #65394e;
  border-color: #aa747f;
  box-shadow: inset 0 -3px #c28992;
  font-weight: 700;
}
#picker .footer { margin-top: 1rem }
#selected-days { font-size: 1rem; color: var(--muted) }
@media (max-width: 440px) {
  .stage { padding: 12px }
  .scroll { padding: 1.25rem 1rem }
  .intro { margin-bottom: 1.45rem }
}
