:root {
  color-scheme: light;
  --paper: #f7f0e6;
  --cream: #fffbf4;
  --ink: #312322;
  --muted: #6e5650;
  --wine: #701d32;
  --wine-dark: #37111d;
  --gold: #d5aa72;
  --line: #decec0;
  --serif: 'Songti SC', 'Noto Serif CJK SC', 'SimSun', Georgia, serif;
  --sans: 'PingFang SC', 'Microsoft YaHei', 'Noto Sans CJK SC', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 280px; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.65 var(--sans); }
body:has(dialog[open]) { overflow: hidden; }
button, input, textarea { font: inherit; color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, .upload:focus-within {
  outline: 2px solid #a34b59;
  outline-offset: 3px;
}
h1, h2, h3, p, figure { margin: 0; }
img { display: block; max-width: 100%; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.site-header {
  width: min(100% - 112px, 1344px);
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 23px 0 21px;
  border-bottom: 1px solid var(--line);
}
.wordmark {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  font: bold italic 31px/.9 Georgia, serif;
  letter-spacing: -.055em;
  color: var(--wine-dark);
  text-decoration: none;
}
.brand-mark { display: inline-grid; place-items: center; width: 35px; height: 35px; border: 1px solid; border-radius: 50%; font: normal 19px/1 Georgia, serif; letter-spacing: 0; }
.wordmark .brand-mark { color: var(--wine); }
.header-note { font-size: 12px; color: var(--muted); letter-spacing: .12em; }

.workbench {
  width: min(100% - 144px, 1200px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(315px, .85fr);
  column-gap: clamp(34px, 6vw, 98px);
  align-items: start;
  padding: clamp(44px, 6vw, 84px) 0 76px;
}
.editor { min-width: 0; }
.intro { margin-bottom: 42px; }
.intro h1 {
  color: var(--wine-dark);
  font: 600 clamp(39px, 4.2vw, 66px)/1.13 var(--serif);
  letter-spacing: -.065em;
  text-wrap: balance;
}
.intro h1 em { color: var(--wine); font-style: normal; }
.intro p { margin-top: 17px; color: var(--muted); }
fieldset { border: 0; padding: 0; margin: 0; min-inline-size: 0; }
.editor-section { padding: 24px 0 27px; border-top: 1px solid var(--line); }
.section-heading { display: flex; align-items: start; gap: 13px; margin-bottom: 18px; }
.section-heading h2 { font: 600 23px/1.25 var(--serif); }
.section-heading p { margin-top: 6px; font-size: 13px; color: var(--muted); }
.section-number { color: var(--wine); padding-top: 3px; font: italic 18px/1.15 Georgia, serif; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field { display: grid; gap: 6px; color: var(--ink); font-size: 13px; }
.fields .field:first-child { display: block; }
.fields .field:first-child input { display: block; margin-top: 6px; }
.mandatory { color: var(--wine); }
.date-field { width: min(100%, 225px); }
input:not([type='checkbox'], [type='file']), textarea {
  min-width: 0;
  min-height: 46px;
  width: 100%;
  color: var(--ink);
  background: #fffaf1;
  border: 1px solid #d8c5b5;
  border-radius: 5px;
  padding: 10px 12px;
  font-size: 16px;
}
input::placeholder, textarea::placeholder { color: #796963; opacity: 1; font-size: 14px; }
textarea { resize: vertical; }
.upload {
  display: grid;
  justify-items: center;
  text-align: center;
  padding: 19px 12px 21px;
  gap: 3px;
  background: rgba(255,251,244,.5);
  border: 1px dashed #aa8273;
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  transition: background .2s, border-color .2s;
}
.upload:is(:hover, .is-over) { background: #f4e6da; border-color: var(--wine); }
.upload:has(input:disabled) { cursor: default; }
.upload input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; cursor: inherit; }
.upload-icon { width: 32px; height: 32px; border-radius: 50%; background: #ead9ce; color: var(--wine); font-size: 21px; line-height: 32px; margin-bottom: 3px; }
.upload strong { color: var(--wine); }
.upload strong span { font-size: 13px; font-weight: normal; color: var(--muted); margin-left: 3px; }
.upload small { color: var(--muted); font-size: 12px; }
.feedback { color: var(--wine); font-size: 13px; overflow-wrap: anywhere; }
.feedback:not(:empty) { margin-top: 9px; }
.photo-editor { margin: 0; padding: 0; display: grid; row-gap: 8px; list-style: none; }
.photo-editor:not(:empty) { margin-top: 12px; }
.editable-photo { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.editable-photo img { width: 56px; height: 49px; border-radius: 4px; object-fit: cover; cursor: grab; }
.photo-tools { display: flex; gap: 4px; }
.icon-button { width: 34px; height: 38px; border: 1px solid var(--line); border-radius: 4px; background: var(--cream); color: var(--wine); }
.icon-button:hover:enabled { border-color: var(--wine); }
.toggle { position: relative; display: inline-flex; gap: 10px; align-items: center; cursor: pointer; }
.toggle input { position: absolute; width: 40px; height: 23px; opacity: 0; left: 0; margin: 0; }
.switch { width: 40px; height: 23px; border-radius: 20px; background: #8c776b; padding: 3px; transition: background .2s; }
.switch::after { content: ''; display: block; height: 17px; width: 17px; background: var(--cream); border-radius: 50%; transition: translate .2s; }
.toggle input:checked + .switch { background: var(--wine); }
.toggle input:checked + .switch::after { translate: 17px; }
.toggle input:focus-visible + .switch { outline: 2px solid var(--wine); outline-offset: 3px; }
.pass-field { margin-top: 13px; max-width: 330px; }

.actions { border-top: 1px solid var(--line); padding-top: 19px; }
.actions .feedback:not(:empty) { margin: 0 0 10px; }
.action-buttons { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 9px; }
.primary, .secondary, .text-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  padding: 10px 16px; min-height: 44px; border-radius: 4px; line-height: 1.35;
  border: 1px solid transparent; text-decoration: none; text-align: center; white-space: nowrap;
  transition: background .2s, color .2s, border-color .2s;
}
.primary { background: var(--wine); color: var(--cream); border-color: var(--wine); }
.primary:is(button:hover:enabled, a:hover) { background: var(--wine-dark); border-color: var(--wine-dark); }
.secondary { background: var(--cream); color: var(--wine); border-color: #c8a99b; }
.secondary:is(button:hover:enabled, a:hover) { background: #f0e0d4; }
.text-button { border: 0; color: var(--wine); background: transparent; text-decoration: underline; text-underline-offset: 4px; }
.share-panel { scroll-margin-top: 16px; border: 1px solid #c9a18a; border-radius: 7px; padding: 20px; margin-bottom: 26px; background: #f1e1d3; }
.link-line { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 5px; align-items: center; }
.link-line + .link-line { margin-top: 12px; }
.link-line label { grid-column: 1 / -1; font-size: 13px; }
.link-line input { text-overflow: ellipsis; }
.link-line .secondary { min-height: 46px; padding-inline: 11px; }

.preview-column { position: sticky; top: 26px; min-width: 0; }
.preview-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 13px; }
.preview-head h2 { color: var(--wine-dark); font: 600 20px/1.2 var(--serif); }
.preview-head > span { color: var(--muted); font-size: 12px; }
.preview-stage, .gift-gate {
  isolation: isolate;
  position: relative;
  color: var(--cream);
  background: radial-gradient(ellipse at 50% -10%, #ab5862 0%, transparent 71%), linear-gradient(150deg, #632136, #2b101c 83%);
}
.preview-stage::before, .gift-gate::before {
  content: '';
  z-index: -1;
  position: absolute;
  inset: 14px;
  border: 1px solid rgba(230,188,136,.45);
  background: repeating-linear-gradient(111deg, #fff0de09 0 1px, transparent 1px 7px);
  pointer-events: none;
}
.preview-stage { overflow: hidden; width: 100%; min-height: 420px; aspect-ratio: 1.04; padding: 39px 37px 21px; display: grid; place-items: center; align-content: center; gap: 21px; border-radius: 8px; }
.preview-frames { display: flex; gap: 10px; width: min(74%, 255px); align-items: center; justify-content: center; }
.preview-frames > div {
  width: 28%; aspect-ratio: .85; border: 1px solid #d9af7c; padding: 3px;
  background: linear-gradient(145deg, #d3ae7655, transparent), #411729; box-shadow: 0 4px 9px #190a12a0;
}
.preview-frames > div:first-child { transform: rotate(-8deg) translateY(6px); }
.preview-frames > div:last-child { transform: rotate(8deg) translateY(6px); }
.preview-frames img { width: 100%; height: 100%; object-fit: cover; }
.preview-tip { margin-top: 11px; font-size: 12px; color: var(--muted); }

.ticket { --pull: 0px; position: relative; z-index: 1; width: 100%; color: #4e1e2d; text-align: center; }
.mini-ticket { max-width: 295px; rotate: -4deg; }
.ticket-main, .ticket-stub { background: linear-gradient(110deg, #f2e0c5, #fff7e4 49%, #efdab7); }
.ticket-main { padding: 23px 15px 21px; position: relative; box-shadow: 0 12px 37px #220b17b0; border-radius: 6px 6px 2px 2px; }
.ticket-main::after { content: ''; position: absolute; border: 1px solid #c5a171; inset: 8px 8px 0; border-bottom: 0; pointer-events: none; }
.ticket-top { display: flex; align-items: center; justify-content: space-between; padding: 0 6px; color: #7c4e35; line-height: 1; margin-bottom: 20px; font: italic bold 18px/1 Georgia, serif; }
.ticket-top .brand-mark { width: 28px; height: 28px; font-size: 14px; }
.ticket-title { font: 600 clamp(24px, 3vw, 41px)/1.23 var(--serif); letter-spacing: .015em; }
.ticket-guest { font-size: 14px; margin: 9px auto 0; letter-spacing: .08em; overflow-wrap: anywhere; }
.ticket-date { display: block; margin-top: 8px; color: #795745; font: 12px Georgia, serif; letter-spacing: .16em; }
.ticket-stub { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; padding: 15px 17px; border: 0; border-top: 1px dashed #9b7459; border-radius: 2px 2px 8px 8px; color: #694333; font-size: 12px; letter-spacing: .06em; }
.ticket-bars { display: block; height: 16px; width: 57px; flex: none; opacity: .75; background: repeating-linear-gradient(90deg,#67422e 0 1px,transparent 1px 3px,#67422e 3px 5px,transparent 5px 6px,#67422e 6px 7px,transparent 7px 10px); }

dialog { border: 0; color: var(--ink); padding: 0; }
dialog::backdrop { background: #271019ba; }
.preview-dialog { width: min(1400px, calc(100vw - 20px)); max-width: none; max-height: 96dvh; overflow: hidden; background: var(--wine-dark); }
.dialog-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 52px; padding: 5px 12px; background: var(--paper); color: var(--wine-dark); }
.dialog-bar .secondary { min-height: 39px; }
.museum-frame { display: block; border: 0; width: 100%; height: calc(94dvh - 52px); }
.confirm-dialog { width: min(calc(100vw - 28px), 480px); background: var(--cream); border: 1px solid var(--line); border-radius: 7px; padding: 24px; }
.confirm-dialog h2 { font: 600 25px var(--serif); }
.confirm-dialog p { margin: 10px 0 20px; color: var(--muted); }
.copy-group { border-bottom: 1px solid var(--line); }
.copy-group:first-child { border-top: 1px solid var(--line); }
.copy-group summary { cursor: pointer; color: var(--wine); padding: 11px 4px; }
.copy-fields { display: grid; gap: 11px; grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr)); padding: 3px 4px 14px; }
.copy-fields .field:has(textarea) { grid-column: 1 / -1; }
.photo-fields { display: grid; gap: 5px; min-width: 0; }
.photo-chapter { width: 100%; background: var(--cream); border: 1px solid var(--line); border-radius: 4px; padding: 4px 7px; color: var(--ink); font: inherit; font-size: 13px; }
.status-card { width: min(100% - 32px, 490px); margin: min(18vh, 160px) auto 30px; padding: 34px; text-align: center; border: 1px solid #cfa681; border-radius: 6px; background: var(--cream); }
.status-card .brand-mark { margin-bottom: 15px; color: var(--wine); }
.status-card h1 { color: var(--wine-dark); font: 600 clamp(25px, 6vw, 36px)/1.2 var(--serif); }
.status-card p { margin-top: 9px; }
.status-card > .primary { margin-top: 18px; }
.unlock-form { display: grid; gap: 10px; text-align: left; margin-top: 17px; }
.unlock-form .feedback { text-align: center; margin: 0; }

@media (max-width: 1040px) {
  .site-header { width: calc(100% - 64px); }
  .workbench { width: calc(100% - 80px); column-gap: 35px; }
  .preview-stage { min-height: 345px; padding: 32px 25px 22px; }
}
@media (max-width: 760px) {
  .site-header { width: calc(100% - 34px); padding: 14px 0; }
  .wordmark { font-size: 26px; gap: 7px; }
  .wordmark .brand-mark { width: 29px; height: 29px; font-size: 15px; }
  .header-note { font-size: 11px; }
  .workbench { width: min(100% - 34px, 570px); display: flex; flex-direction: column; gap: 24px; padding: 34px 0 38px; }
  .editor, .preview-column { width: 100%; }
  .intro { margin-bottom: 26px; }
  .intro h1 { font-size: clamp(31px, 7.8vw, 47px); }
  .intro p { margin-top: 12px; font-size: 14px; }
  .preview-column { position: static; }
  .preview-stage { min-height: 320px; aspect-ratio: 1.15; }
}
@media (max-width: 375px) {
  .workbench, .site-header { width: calc(100% - 24px); }
  .section-heading { gap: 8px; }
  .fields { gap: 8px; }
  .editable-photo { grid-template-columns: 43px minmax(0, 1fr) auto; gap: 4px; }
  .editable-photo img { width: 43px; }
  .icon-button { width: 29px; }
  .action-buttons { gap: 5px; }
  .action-buttons button { padding-inline: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::after, *::before { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
