/* Layout: the garden canvas fills the screen like the painted cover of the invitation;
   ivory-paper chips with gold hairlines float on top, the chat dock floats at the bottom,
   sheets rise from the bottom edge. One deliberate light theme, as on the invitation. */
:root {
  --maroon: #5c0b19;
  --maroon-deep: #420712;
  --wine: #7d1b2c;
  --gold: #b08a3e;
  --gold-light: #d9be7c;
  --gold-dark: #8a6a2e;
  --ivory: #f8f2e8;
  --paper: #fcf8f1;
  --card: #fffaf2;
  --sky: #f4f4ee;
  --ink: #33201b;
  --muted: #7a6158;
  --glass: rgba(252, 248, 241, 0.9);
  --hair: rgba(176, 138, 62, 0.5);
  --line: rgba(92, 11, 25, 0.14);
  --scrim: rgba(51, 32, 27, 0.34);
  --ok: #3f7d4f;
  --wait: #b9852a;
  --off: #9a837b;
  --shadow: 0 10px 28px rgba(66, 7, 18, 0.14);
  --script: "Italianno", "Brush Script MT", cursive;
  --caps: "Cinzel", "Times New Roman", serif;
  --body: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}

[hidden] { display: none !important; }
html, body { height: 100%; }
/* Pinch zoom stays available for reading; double-tap zoom is off so quick taps stay taps. The garden
   itself (#stage) handles every touch. */
html { touch-action: manipulation; }
body {
  margin: 0;
  overflow: hidden;
  background: var(--sky);
  color: var(--ink);
  font-family: var(--body);
  font-size: 14px;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }

#app {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: linear-gradient(180deg, var(--sky) 0%, var(--paper) 60%, var(--ivory) 100%);
}
#stage { position: absolute; inset: 0; touch-action: none; }
#stage canvas { display: block; }

.kicker {
  margin: 0;
  font-family: var(--caps);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold-dark);
}

/* ---------- HUD ---------- */
.hud {
  position: absolute;
  inset: 0 0 auto 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  padding-top: calc(10px + env(safe-area-inset-top, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  pointer-events: none;
}
.hud > * { pointer-events: auto; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 6px 12px;
  border: 1px solid var(--hair);
  border-radius: 999px;
  background: var(--glass);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: var(--shadow);
}
.brand { padding: 4px 14px 4px 5px; min-width: 0; cursor: pointer; text-align: left; }
.mono { flex: none; width: 38px; height: 38px; color: var(--gold); }
.mono text { font-family: var(--script); fill: var(--maroon); }
.brand-text { display: grid; line-height: 1.05; min-width: 0; }
.brand-text strong {
  font-family: var(--script);
  font-weight: 400;
  font-size: 27px;
  color: var(--maroon);
  white-space: nowrap;
}
.brand-text small {
  font-family: var(--caps);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hud-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.status { font-size: 12px; font-weight: 700; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--off); }
.status[data-state="online"] .dot { background: var(--ok); box-shadow: 0 0 0 3px rgba(63, 125, 79, 0.2); }
.status[data-state="connecting"] .dot { background: var(--wait); animation: pulse 1s infinite; }
.view-btn {
  white-space: nowrap;
  min-height: 32px;
  padding: 4px 12px;
  cursor: pointer;
  font-family: var(--caps);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--maroon);
}
.counter {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  min-height: 28px;
  padding: 4px 10px;
  font-variant-numeric: tabular-nums;
}
.counter b { color: var(--ink); }

/* ---------- Dock ---------- */
.dock {
  position: absolute;
  inset: auto 0 0 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  gap: 8px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  pointer-events: none;
}
.dock > * { pointer-events: auto; }
.emotes {
  display: flex;
  gap: 6px;
  padding: 6px;
  border-radius: 999px;
  border: 1px solid var(--hair);
  background: var(--glass);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: var(--shadow);
  animation: pop 0.2s ease-out both;
}
.emote {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 20px;
  cursor: pointer;
  transition: transform 0.15s ease;
}
.emote:active { transform: scale(0.9); }
.chat {
  display: flex;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
  max-width: 560px;
  padding: 6px;
  border-radius: 999px;
  border: 1px solid var(--hair);
  background: var(--glass);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: var(--shadow);
}
.chat input {
  flex: 1;
  width: 0;
  min-width: 0;
  border: 0;
  padding: 8px 12px;
  border-radius: 999px;
  background: transparent;
  font-size: 16px;
  outline: none;
}
.chat input::placeholder { color: var(--muted); }
.chat-tool {
  flex: none;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--hair);
  background: var(--card);
  color: var(--maroon);
  cursor: pointer;
}
.chat-tool[aria-expanded="true"] { background: var(--maroon); color: var(--ivory); border-color: var(--maroon); }
.chat-tool svg, .menu svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.chat-tool svg .fill, .menu svg .fill { fill: currentColor; stroke: none; }
.menu {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  width: 100%;
  max-width: 560px;
  box-sizing: border-box;
  padding: 4px;
  border-radius: 20px;
  border: 1px solid var(--hair);
  background: var(--glass);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: var(--shadow);
}
.menu button {
  display: grid;
  justify-items: center;
  gap: 2px;
  min-width: 0;
  padding: 6px 0 5px;
  border: 0;
  border-radius: 16px;
  background: transparent;
  color: var(--maroon);
  cursor: pointer;
}
.menu button span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink);
}
.menu button:active { background: rgba(217, 190, 124, 0.22); }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  padding: 10px 18px;
  background: var(--maroon);
  color: var(--ivory);
  font-family: var(--caps);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-decoration: none;
  cursor: pointer;
  box-shadow: inset 0 0 0 1.5px var(--gold-light);
}
.btn:disabled { opacity: 0.6; cursor: progress; }

/* ---------- Join sheet ---------- */
.sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0 auto;
  width: 100%;
  max-width: 460px;
  max-height: calc(100% - 24px);
  overflow-y: auto;
  box-sizing: border-box;
  display: grid;
  gap: 12px;
  padding-top: 18px;
  padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  padding-left: max(18px, env(safe-area-inset-left, 0px));
  padding-right: max(18px, env(safe-area-inset-right, 0px));
  border-radius: 24px 24px 0 0;
  background: var(--paper);
  border: 1px solid var(--hair);
  border-bottom: 0;
  box-shadow: 0 -12px 40px rgba(66, 7, 18, 0.18);
  animation: rise 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}
.sheet-head { display: grid; justify-items: center; gap: 2px; text-align: center; }
.flourish { width: 150px; max-width: 60%; height: auto; }
.sheet h1 {
  margin: 0;
  font-family: var(--script);
  font-weight: 400;
  font-size: 50px;
  line-height: 1;
  color: var(--maroon);
  text-wrap: balance;
}
.sheet p { margin: 0; color: var(--muted); line-height: 1.55; }
.sheet .intro { text-align: center; text-wrap: balance; }
.guest { display: grid; gap: 2px; margin-top: 6px; }
.sheet .guest-to { font-size: 13px; }
.sheet .link-notice {
  margin-top: 6px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px dashed var(--hair);
  background: rgba(217, 190, 124, 0.14);
  color: var(--wine);
  font-size: 13.5px;
  text-wrap: balance;
}
.sheet .guest-name {
  font-family: var(--caps);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--maroon);
  text-wrap: balance;
}
.field-label {
  font-family: var(--caps);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-dark);
}
.sheet input[type="text"], .panel-card input[type="text"], .panel-card select, .panel-card textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--hair);
  background: var(--card);
  font-size: 16px;
}
.panel-card textarea { resize: vertical; min-height: 84px; line-height: 1.5; }
.panel-card select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--maroon) 50%), linear-gradient(135deg, var(--maroon) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat; }

/* ---------- Wardrobe ---------- */
.wardrobe { display: grid; gap: 10px; }
.wr-top { display: grid; grid-template-columns: 116px minmax(0, 1fr); gap: 14px; align-items: center; }
.wr-preview {
  display: block;
  width: 116px;
  height: auto;
  border-radius: 58px 58px 16px 16px;
  border: 1px solid var(--hair);
  background:
    radial-gradient(ellipse 60% 22% at 50% 92%, rgba(122, 140, 74, 0.28), transparent 70%),
    linear-gradient(180deg, #fbf1df 0%, var(--card) 70%);
  box-shadow: 0 0 0 4px var(--card), 0 0 0 5px var(--hair);
}
.wr-side { display: grid; gap: 8px; min-width: 0; }
.field { display: grid; gap: 6px; text-align: left; }
.skins { display: flex; gap: 10px; }
.skin {
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid var(--card);
  background: var(--swatch);
  box-shadow: 0 0 0 1px var(--hair);
  cursor: pointer;
}
.skin[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--gold), 0 0 0 4px rgba(217, 190, 124, 0.35); }
.chip-btn {
  justify-self: start;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--hair);
  background: var(--card);
  color: var(--maroon);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.wr-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  border: 1px solid var(--hair);
  background: var(--card);
}
.wr-tab {
  min-width: 0;
  padding: 7px 2px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
}
.wr-tab[aria-selected="true"] { background: var(--maroon); color: var(--ivory); }
.wr-items { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; }
.wr-item {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 4px;
  min-width: 0;
  padding: 6px 3px 7px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--card);
  cursor: pointer;
}
.wr-item canvas { width: 100%; max-width: 64px; height: auto; border-radius: 12px; background: linear-gradient(180deg, #fbf1df, var(--card)); }
.wr-item span { font-size: 11px; font-weight: 700; line-height: 1.2; text-align: center; text-wrap: balance; }
.wr-item[aria-pressed="true"] {
  border-color: var(--gold);
  background: linear-gradient(180deg, rgba(217, 190, 124, 0.26), rgba(217, 190, 124, 0.06));
  box-shadow: inset 0 0 0 1px var(--gold-light);
}
.wr-item:disabled { opacity: 0.4; cursor: not-allowed; }
.sheet .mode-note { font-size: 13px; text-align: center; text-wrap: balance; }
.sheet .btn, .panel-card form .btn, .panel-card > #panelBody > .btn { padding: 14px 18px; font-size: 13px; }

/* ---------- Booth panel ---------- */
.panel {
  position: absolute;
  inset: 0;
  display: grid;
  align-items: end;
  justify-items: center;
  background: var(--scrim);
}
.panel-card {
  position: relative;
  width: 100%;
  max-width: 460px;
  max-height: calc(100% - 24px);
  overflow-y: auto;
  box-sizing: border-box;
  padding-top: 22px;
  padding-bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  padding-left: max(20px, env(safe-area-inset-left, 0px));
  padding-right: max(20px, env(safe-area-inset-right, 0px));
  border-radius: 24px 24px 0 0;
  border: 1px solid var(--hair);
  border-bottom: 0;
  background: var(--paper);
  box-shadow: var(--shadow);
  text-align: center;
  animation: rise 0.35s ease-out both;
}
#panelBody { display: grid; gap: 10px; justify-items: center; }
.panel-card h2 {
  margin: 4px 0 0;
  font-family: var(--script);
  font-weight: 400;
  font-size: 46px;
  line-height: 1;
  color: var(--maroon);
  text-wrap: balance;
}
.panel-card p { margin: 0; line-height: 1.55; }
.panel-card h2.date { font-size: 38px; }
.couple-art {
  margin: 4px 0 0;
  width: 150px;
  max-width: 50%;
  aspect-ratio: 420 / 562;
  border-radius: 75px 75px 10px 10px;
  overflow: hidden;
  border: 1px solid var(--hair);
  box-shadow: 0 0 0 4px var(--card), 0 0 0 5px var(--hair);
}
.couple-art img { display: block; width: 100%; height: 100%; object-fit: cover; }
.person { display: grid; gap: 2px; max-width: 34ch; }
.fullname { font-family: var(--caps); font-size: 15px; font-weight: 600; color: var(--ink); text-wrap: balance; }
.parents { font-size: 14px; color: var(--muted); }
.amp { font-family: var(--script); font-size: 34px; line-height: 0.8; color: var(--gold); }
.events { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; width: 100%; margin: 4px 0 0; }
.events div { display: grid; gap: 2px; padding: 12px 8px; border: 1px solid var(--hair); border-radius: 14px; background: var(--card); }
.events dt { font-family: var(--caps); font-size: 13px; font-weight: 700; letter-spacing: 0.06em; color: var(--maroon); }
.events dd { margin: 0; font-size: 13px; color: var(--ink); font-variant-numeric: tabular-nums; }
.venue { display: grid; gap: 2px; max-width: 36ch; }
.venue b { font-family: var(--caps); font-size: 13px; letter-spacing: 0.04em; color: var(--ink); }
.venue span { font-size: 14px; color: var(--muted); }
.panel-note { font-size: 13.5px; color: var(--muted); }
.lead { color: var(--muted); max-width: 36ch; }
.notice {
  max-width: 36ch;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px dashed var(--hair);
  background: rgba(217, 190, 124, 0.14);
  color: var(--ink);
  font-size: 13px;
}
.countdown {
  font-family: var(--caps);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-dark);
}
.events dd { display: grid; gap: 6px; justify-items: center; }
.cal-link { font-size: 13.5px; font-weight: 700; color: var(--wine); text-underline-offset: 3px; }
.rsvp-form, .wish-form { display: grid; gap: 12px; width: 100%; text-align: left; }
.rsvp-form fieldset { display: grid; gap: 8px; margin: 0; padding: 0; border: 0; min-width: 0; }
.rsvp-form legend { padding: 0; margin-bottom: 8px; }
.choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.choice {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 48px;
  padding: 10px 8px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--card);
  font-weight: 700;
  text-align: center;
  cursor: pointer;
}
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice:has(input:checked) {
  border-color: var(--gold);
  background: linear-gradient(180deg, rgba(217, 190, 124, 0.26), rgba(217, 190, 124, 0.06));
  box-shadow: inset 0 0 0 1px var(--gold-light);
  color: var(--maroon);
}
.choice:has(input:focus-visible) { outline: 2px solid var(--gold); outline-offset: 2px; }
.form-status { min-height: 1.4em; font-size: 13px; font-weight: 600; color: var(--wine); text-align: center; }
.form-status:empty { display: none; }
.list-box { display: grid; justify-items: center; width: 100%; }
.gallery { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; width: 100%; margin-top: 4px; }
.frame {
  position: relative;
  margin: 0;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid var(--hair);
  background: var(--card);
}
.frame img { display: block; width: 100%; height: 100%; object-fit: cover; }
.frame.empty {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b08a3e' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 8.5c0-1.1.9-2 2-2h1.6l1.2-1.8h6.4l1.2 1.8H18c1.1 0 2 .9 2 2V17c0 1.1-.9 2-2 2H6c-1.1 0-2-.9-2-2z'/%3E%3Ccircle cx='12' cy='12.6' r='3.4'/%3E%3C/svg%3E") center / 26px no-repeat,
    linear-gradient(160deg, var(--tint-a), var(--tint-b));
}
.frame[data-tint="0"] { --tint-a: #f6ead2; --tint-b: #ead7b1; }
.frame[data-tint="1"] { --tint-a: #f5e1df; --tint-b: #e7c3c0; }
.frame[data-tint="2"] { --tint-a: #e6ecdc; --tint-b: #cbd8bd; }
.frame[data-tint="3"] { --tint-a: #f3ebdf; --tint-b: #dfcfb6; }
.story { list-style: none; margin: 4px 0 0; padding: 0 0 0 8px; width: 100%; max-width: 34ch; text-align: left; }
.story li { position: relative; display: grid; gap: 2px; padding: 0 0 16px 22px; border-left: 1px solid var(--hair); }
.story li:last-child { border-left-color: transparent; padding-bottom: 0; }
.story li::before {
  content: "";
  position: absolute;
  left: -6px;
  top: 3px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--maroon);
  box-shadow: 0 0 0 2px var(--paper), 0 0 0 3px var(--gold);
}
.story-title { font-family: var(--caps); font-size: 13px; font-weight: 700; letter-spacing: 0.04em; color: var(--maroon); }
.story-when { font-size: 13px; font-weight: 600; color: var(--gold-dark); }
.story-text { font-size: 13px; color: var(--ink); }
.story-text.pending { font-style: italic; color: var(--muted); }
.panel[data-kind="busana"] .wardrobe { width: 100%; text-align: left; }
.ucapan {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
  width: 100%;
  max-height: 40vh;
  overflow-y: auto;
  text-align: left;
}
.ucapan li { display: grid; gap: 2px; padding: 10px 12px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); }
.ucapan li b { font-size: 13px; color: var(--wine); }
.ucapan li.empty { color: var(--muted); }
.close {
  position: absolute;
  top: 14px;
  right: max(14px, env(safe-area-inset-right, 0px));
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--hair);
  background: var(--card);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

/* ---------- Toast ---------- */
.toast {
  position: absolute;
  top: calc(112px + env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translateX(-50%);
  max-width: min(420px, calc(100% - 32px));
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--maroon-deep);
  color: var(--ivory);
  font-weight: 600;
  font-size: 13px;
  line-height: 1.4;
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(217, 190, 124, 0.5);
  text-align: center;
}

:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

@keyframes rise { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes pop { from { transform: translateY(8px) scale(0.96); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes pulse { 50% { opacity: 0.35; } }

@media (min-width: 720px) {
  .sheet { bottom: 28px; border-radius: 24px; border-bottom: 1px solid var(--hair); }
  .panel { align-items: center; }
  .panel-card { border-radius: 24px; border-bottom: 1px solid var(--hair); }
}
@media (max-width: 360px) {
  .wr-item span, .menu button span { font-size: 10px; }
  .emote { width: 38px; height: 38px; }
  .brand-text strong { font-size: 24px; }
  .wr-top { grid-template-columns: 100px minmax(0, 1fr); }
  .wr-preview { width: 100px; }
}
@media (max-height: 700px) {
  .sheet { gap: 10px; padding-top: 14px; }
  .sheet h1 { font-size: 42px; }
  .flourish { width: 120px; }
}
@media (prefers-reduced-motion: reduce) {
  .sheet, .panel-card, .emotes { animation: none; }
  .status[data-state="connecting"] .dot { animation: none; }
}
