:root {
  color-scheme: dark;
  --ink: #0b0b0b;
  --ivory: #f7f3eb;
  --muted: #bdb3a6;
  --gold: #d7b773;
  --rule: #3b322a;
  --error: #ffaaa2;
  background: var(--ink);
  color: var(--ivory);
  font: 16px / 1.5 "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--ink); }
body:has(dialog[open]) { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

.invitation {
  min-height: 100vh;
  min-height: 100dvh;
  max-width: 520px;
  margin: auto;
  padding-bottom: max(28px, env(safe-area-inset-bottom, 0px));
}

.cover { position: relative; }
.cover img, .poster { display: block; width: 100%; height: auto; }
.cover::after {
  position: absolute;
  inset: 48% 0 0;
  background: linear-gradient(transparent, #0b0b0b);
  content: "";
  pointer-events: none;
}

.content {
  padding-inline: max(24px, env(safe-area-inset-left, 0px)) max(24px, env(safe-area-inset-right, 0px));
}
.event { position: relative; margin-top: -14px; padding-bottom: 24px; }
p, h1, h2 { margin: 0; }
.eyebrow { color: var(--gold); font-size: 13px; font-weight: 650; letter-spacing: .25em; }
.event h1 {
  margin: 5px 0 4px;
  font-family: "Songti SC", "Noto Serif CJK SC", SimSun, serif;
  font-size: clamp(38px, 10.5vw, 54px);
  line-height: 1.17;
  letter-spacing: .05em;
}
.subtitle { font-size: 17px; font-weight: 650; }
.event-details { margin-top: 9px; color: var(--muted); font-size: 15px; line-height: 1.75; }
h2 { font-size: 20px; line-height: 1.35; }
#form-title, .ended { border-top: 1px solid var(--rule); padding-top: 20px; }
#load-state, .ended p { margin-top: 8px; color: var(--muted); }
.ended .brand-link { margin-top: 10px; }

.field { padding: 13px 0 4px; border-bottom: 1px solid var(--rule); }
.field > label, .field-label, legend { display: block; font-size: 15px; font-weight: 650; }
.required { color: var(--gold); }
.optional { color: var(--muted); font-size: 13px; font-weight: 400; }
input:not([type="checkbox"]), select, textarea, .picker-trigger {
  width: 100%;
  min-height: 44px;
  min-width: 0;
  border: 0;
  border-radius: 0;
  padding: 7px 0;
  background: transparent;
  text-align: left;
}

input::placeholder, textarea::placeholder, select:invalid, select:disabled, .picker-trigger { color: var(--muted); }
select {
  appearance: none;
  padding-right: 20px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='m4 2 4 4-4 4' stroke='%23d7b773' stroke-width='1.4' fill='none'/%3E%3C/svg%3E") right center / 12px no-repeat;
}
option { background: #181512; color: var(--ivory); }
textarea { resize: vertical; display: block; }
input[type="date"] { display: block; }
.residence { margin: 13px 0 0; padding: 0 0 4px; min-width: 0; border: 0; border-bottom: 1px solid var(--rule); }
.residence legend { padding: 0; }
.region-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.picker-trigger { display: flex; align-items: center; justify-content: space-between; }
.picker-trigger i { margin-right: 4px; width: 7px; height: 7px; border: solid var(--gold); border-width: 1.5px 1.5px 0 0; transform: rotate(45deg); }
.selected-tags { display: flex; flex-wrap: wrap; gap: 7px; margin: 9px 0 0; padding: 0; list-style: none; }
.selected-tags button { display: flex; align-items: center; gap: 8px; border: 1px solid var(--rule); border-radius: 4px; padding: 6px 9px; background: #191611; font-size: 13px; }
.selected-tags button span { color: var(--gold); font-size: 18px; line-height: 1; }
.secondary, .preview-note { color: var(--muted); font-size: 14px; }
.birth-derived { min-height: 44px; padding-top: 8px; }
.error { margin: 3px 0 7px; color: var(--error); font-size: 14px; }
.consents { display: grid; gap: 8px; margin-top: 17px; }
.consent-line { display: flex; flex-wrap: wrap; align-items: center; }
.consent-line label { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; font-size: 14px; cursor: pointer; }
input[type="checkbox"] { width: 18px; height: 18px; margin: 0; accent-color: #b68b4a; flex: none; }
.text-button { border: 0; min-height: 36px; padding: 0; color: var(--gold); background: transparent; font-size: 14px; }
.primary, .secondary-button {
  min-height: 48px;
  border: 1px solid transparent;
  border-radius: 3px;
  padding: 9px 16px;
  font-weight: 650;
}
.primary { color: #fff; border-color: #b29563; background: #765a31; }
.primary:hover:not(:disabled) { background: #82623a; }
.primary:disabled { opacity: .65; }
.submit { width: 100%; min-height: 52px; margin-top: 15px; }
.preview-note { margin-top: 11px; font-size: 13px; }
.submit-error { margin-top: 9px; }

.sheet {
  position: fixed;
  inset: auto 0 0;
  width: min(100%, 520px);
  max-width: none;
  max-height: min(78dvh, 620px);
  margin: 0 auto;
  border: solid #4a3e32;
  border-width: 1px 0 0;
  border-radius: 14px 14px 0 0;
  padding: 0;
  background: #191612;
  color: var(--ivory);
  overflow: auto;
}
.sheet[open] { display: flex; flex-direction: column; }
.sheet::backdrop { background: #000b; }
.sheet-heading { flex: none; padding: 19px 24px 10px; }
.sheet-heading p { margin-top: 6px; }
.interest-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; overflow: auto; overscroll-behavior: contain; padding: 4px 24px 8px; }
.interest-options button {
  min-height: 44px;
  padding: 8px 5px;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--ink);
  font-size: 14px;
}
.interest-options [aria-pressed="true"] { border-color: #ad884e; color: var(--gold); background: #322719; }
.sheet-warning { margin: 0; padding: 0 24px 8px; }
.sheet-actions {
  flex: none;
  display: flex;
  gap: 8px;
  border-top: 1px solid var(--rule);
  padding: 12px 24px calc(12px + env(safe-area-inset-bottom, 0px));
}
.sheet-actions button { flex: 1; }
.secondary-button { background: transparent; border-color: #665541; }
#notice-copy { color: var(--muted); line-height: 1.75; }
.notice .sheet-heading { padding-bottom: 16px; }

.success-header { text-align: center; padding: max(27px, env(safe-area-inset-top, 0px)) 24px 22px; }
.success-header h1 { font-size: 28px; }
.success-header p { margin-top: 5px; color: var(--muted); }
.success-footer { padding: 13px 24px 0; text-align: center; }
.brand-link { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; color: var(--gold); text-underline-offset: .25em; }

@media (max-width: 360px) {
  .content { padding-inline: 19px; }
  .interest-options, .sheet-actions, .sheet-heading { padding-inline: 19px; }
}
