:root {
  color-scheme: light;
  --ink: #35231e;
  --muted: #6c574b;
  --red: #662c34;
  --red-dark: #4f1e28;
  --gold: #926638;
  --line: #d9c6ad;
  --paper: #fffaf0;
  --page: #f5eddf;
  --heading: 'Cormorant Garamond', 'STKaiti', 'KaiTi', 'Kaiti SC', 'Noto Serif CJK SC', 'Songti SC', serif;
  --sans: 'DM Sans', 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-width: 0;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 5% -12%, #fffaf1 4%, transparent 62%),
    repeating-linear-gradient(115deg, transparent 0 7px, #794f2c04 7px 8px),
    var(--page);
  font: 14px/1.55 var(--sans);
}
button, input, select, textarea { font: inherit; color: inherit; }
button, summary { cursor: pointer; }
button:disabled { cursor: wait; opacity: .62; }
a { color: var(--red-dark); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.page-width { width: min(1330px, calc(100% - 88px)); margin-inline: auto; }

.masthead { border-bottom: 1px solid var(--line); }
.masthead-inner { min-height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wordmark, .showcase-link { text-decoration: none; }
.wordmark { display: inline-flex; align-items: center; gap: 11px; font: 600 16px/1.1 var(--heading); letter-spacing: .09em; }
.wax-mark {
  width: 29px;
  height: 29px;
  display: grid;
  place-items: center;
  border-radius: 44% 52% 47% 48%;
  border: 1px solid #842f3e;
  background: radial-gradient(circle at 36% 20%, #aa5f61, #7e3742 46%, #47202a);
  box-shadow: inset 0 0 0 3px #4f1e2866, inset 0 1px 3px #e49b92b3, 0 1px 2px #391d3044;
  color: #f8d6a1;
  font: 15px Georgia, serif;
  text-shadow: 0 1px #843744;
}
.showcase-link { position: relative; padding-block: 10px; color: var(--muted); }
.showcase-link span { margin-left: 4px; color: var(--gold); }
.showcase-link:hover { color: var(--red-dark); text-decoration: underline; text-underline-offset: 4px; }
.hero { padding: clamp(27px, 3.35vw, 48px) 0 clamp(23px, 2.3vw, 35px); }
.hero h1 { margin: 0; font: 600 clamp(32px, 4.1vw, 57px)/1.13 var(--heading); letter-spacing: .027em; }
.hero p { margin: 11px 0 0; color: var(--muted); }

.workbench { display: grid; grid-template-columns: minmax(350px, .84fr) minmax(0, 1.16fr); gap: 26px; align-items: start; padding-bottom: 56px; }
.editor { grid-column: 1; grid-row: 1; min-width: 0; scroll-margin-top: 16px; border: 1px solid var(--line); background: var(--paper); box-shadow: 0 14px 45px #57321d0d; }
.view { grid-column: 2; grid-row: 1; position: sticky; top: 16px; min-width: 0; border: 1px solid var(--line); background: var(--paper); box-shadow: 0 14px 45px #57321d17; }
.view-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  min-height: 57px;
  padding: 8px 15px;
}
.view-bar h2 { margin: 0 auto 0 0; white-space: nowrap; color: var(--red-dark); font: 600 18px/1.1 var(--heading); }
.view-controls { display: inline-flex; gap: 2px; padding: 2px; border: 1px solid var(--line); border-radius: 4px; }
.view-controls button, .quiet { min-height: 32px; padding: 4px 9px; border: 0; border-radius: 2px; background: transparent; white-space: nowrap; font-size: 12px; }
.view-controls button[aria-pressed="true"] { background: #eee0cc; color: var(--red-dark); font-weight: 650; }
.quiet { color: var(--muted); }
.quiet:hover { background: #f2e7d6; color: var(--red-dark); }
.record-button { border: 1px solid var(--line); }
.record-button span { color: var(--red); }
iframe { display: block; width: 100%; height: clamp(432px, calc(100dvh - 328px), 690px); border: 0; background: #180a0e; }
.view-caption { display: flex; align-items: center; gap: 9px; min-height: 42px; padding: 7px 15px; font-size: 12px; color: var(--muted); }
.caption-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: #a27144; }
.view .notice { padding: 0 15px 12px; }

.steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: #f7eede; border-bottom: 1px solid var(--line); }
.steps button {
  min-height: 56px;
  min-width: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 7px;
  padding: 7px 3px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
}
.steps button span { color: #8b6444; font: 13px Georgia, serif; font-variant-numeric: tabular-nums; }
.steps button:hover { color: var(--red-dark); }
.steps button[aria-current="step"] { border-color: var(--red); background: var(--paper); color: var(--red-dark); font-weight: 700; }
.sheet { padding: 23px clamp(17px, 2.3vw, 31px) 0; }
.sheet h2 { margin: 0 0 22px; color: var(--red-dark); font: 600 30px/1.2 var(--heading); }
.sheet h2:focus { outline: none; }
fieldset { min-width: 0; margin: 0 0 17px; padding: 0; border: 0; }
label, legend { font-weight: 570; }
legend { padding: 0; margin-bottom: 8px; color: var(--ink); }
.themes, .covers, .choices { display: grid; gap: 7px; }
.themes { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.choices { display: flex; flex-wrap: wrap; }
.covers { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.choice { position: relative; min-width: 0; cursor: pointer; font-size: 12px; font-weight: 560; }
.choice input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
}
.choice span {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 5px;
  min-height: 35px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #fffdf7;
}
.choice:hover span { border-color: var(--gold); }
.choice :checked + span { color: var(--red-dark); border-color: #9b6360; background: #f8ece5; }
.choice :focus-visible + span { outline: 2px solid var(--gold); outline-offset: 2px; }
.themes .choice span, .covers .choice span { display: grid; justify-content: stretch; justify-items: center; padding: 4px; text-align: center; }
.covers .choice span { height: 100%; align-content: start; }
.swatch { width: 100%; height: 29px; display: grid; place-items: center; border-radius: 2px; background: var(--swatch); color: #ffe2ad; font: 600 15px/1 var(--heading); }
.covers img { width: 100%; height: auto; aspect-ratio: 5 / 7; object-fit: cover; border-radius: 1px; background: #e1c9af; }
.covers b { min-width: 0; font-weight: inherit; }

.field { display: grid; gap: 6px; margin: 0 0 13px; min-width: 0; }
.field-pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(92px, .35fr); gap: 12px; }
.optional { font: 400 11px var(--sans); color: var(--muted); margin-left: 4px; }
input:not([type="checkbox"], [type="radio"], [type="file"]), select, textarea {
  width: 100%;
  min-height: 41px;
  min-width: 0;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #fffdf8;
}
textarea { resize: vertical; }
#message, #burn-intro { font: 500 17px/1.54 var(--heading); }
.control-row { display: flex; align-items: stretch; min-width: 0; gap: 8px; }
.control-row .button { flex: none; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  min-height: 41px;
  padding: 7px 13px;
  border: 1px solid #aa8a6a;
  border-radius: 3px;
  font-size: 13px;
  font-weight: 610;
  white-space: nowrap;
}
.secondary { background: transparent; color: var(--red-dark); }
.secondary:hover { background: #f7ecdd; }
.primary { color: #fff9ed; border-color: var(--red-dark); background: linear-gradient(155deg, #773d43, var(--red-dark)); }
.primary:hover { background: var(--red-dark); }
.step-actions { display: flex; justify-content: space-between; gap: 10px; padding: 12px clamp(17px, 2.3vw, 31px) 23px; }
#next-step { margin-left: auto; min-width: 110px; }
small, .notice { color: var(--muted); font-size: 12px; }
.notice { margin: 7px 0 0; }
.notice.error { color: #832e38; }

.drop-area {
  position: relative;
  min-height: 86px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border: 1px dashed #a68566;
  border-radius: 3px;
  background: #fbf3e5;
  cursor: pointer;
}
.drop-area small { display: block; margin-top: 3px; font-weight: 400; }
.drop-area input { width: 1px; height: 1px; position: absolute; opacity: 0; }
.drop-area:focus-within, .drop-area.dragging { outline: 2px solid var(--gold); outline-offset: 2px; }
.upload-mark { display: grid; place-items: center; width: 33px; aspect-ratio: 1; border: 1px solid var(--line); color: var(--gold); border-radius: 50%; }
#photo-thumb { width: 40px; height: 56px; object-fit: cover; box-shadow: 0 1px 5px #57321d40; }
.photo-options { margin-top: 16px; }

details { margin: 0 0 12px; border-block: 1px solid var(--line); }
summary { padding: 10px 0; color: var(--red-dark); font-weight: 570; }
.message-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 8px; padding-bottom: 12px; }
.message-options p { margin: 0 0 4px; color: var(--muted); font-size: 11px; }
.text-option { display: inline-grid; padding: 4px 6px; min-height: 30px; margin: 0 3px 3px 0; border: 1px solid var(--line); border-radius: 3px; background: #fffdf7; font-size: 12px; text-align: left; }
.text-option:hover { background: #f7ede0; }
.setting { border-bottom: 1px solid var(--line); }
.settings { margin-bottom: 12px; }
.settings + details { border-top: 0; }
.switch { display: flex; align-items: center; gap: 8px; width: fit-content; min-height: 41px; cursor: pointer; }
.switch input { width: 17px; height: 17px; margin: 0; accent-color: var(--red); }
.advanced .switch { margin-bottom: 6px; }
.preset-buttons { display: flex; flex-wrap: wrap; gap: 4px; }
.preset-buttons small { font: 11px/1.4 var(--sans); margin-top: 1px; }

.trial { display: flex; flex-wrap: wrap; gap: 7px; padding-bottom: 15px; border-bottom: 1px solid var(--line); }
.trial p { flex-basis: 100%; margin: 0; color: var(--muted); font-size: 12px; }
.delivery { padding: 14px 0; }
.export { width: 100%; }
.delivery > .notice:not([hidden]) { margin-bottom: 12px; }
.purchase + .export { margin-top: 10px; }
.purchase[hidden] + .export { margin-top: 0; }
.purchase {
  min-width: 0;
  padding: 15px;
  border: 1px solid #d8c3a8;
  border-radius: 3px;
  background: linear-gradient(148deg, #fffdf6, #f6ead7);
  box-shadow: inset 0 0 0 3px #fffaf0, 0 4px 12px #57321d0a;
  overflow-wrap: anywhere;
}
.purchase h3 { margin: 0 0 9px; color: var(--red-dark); font: 600 22px/1.2 var(--heading); }
.purchase-tiers { display: grid; gap: 5px; margin: 0; padding: 0; list-style: none; }
.purchase-tier { min-width: 0; padding: 6px 9px; border: 1px solid #e4d4bf; border-radius: 2px; background: #fffdf7; }
.purchase-tier[data-featured] { border-color: #ba9872; background: #f3e5d1; }
.purchase-tier:focus { outline: 2px solid #926638; outline-offset: 2px; background: #efddc4; }
.tier-heading { display: flex; flex-wrap: wrap; align-items: baseline; gap: 1px 7px; color: var(--red-dark); }
.tier-heading b { font-weight: 650; }
.tier-price { font: 600 17px/1.1 Georgia, serif; }
.tier-featured { color: #735133; }
.tier-summary, .purchase-hint { color: var(--muted); font-size: 12px; }
.tier-summary { margin: 1px 0 0; }
.purchase-hint { margin: 8px 0; }
.shop-action { width: 100%; white-space: normal; text-align: center; text-wrap: balance; text-decoration: none; }
.delivery-result { display: grid; grid-template-columns: 90px minmax(0, 1fr); align-items: center; gap: 12px; padding: 12px; background: #f8efe1; border: 1px solid var(--line); }
.qr { background: white; aspect-ratio: 1; }
.qr svg { display: block; width: 100%; }
.qr-title { margin: 0 0 4px; font-weight: 700; }
.qr-description { margin: 0; color: var(--muted); font-size: 12px; }
#share-url { display: block; overflow-wrap: anywhere; margin: 5px 0; }
#copy-link { min-height: 31px; }

@media (max-width: 1040px) {
  .page-width { width: calc(100% - 44px); }
  .workbench { gap: 17px; }
  .view-bar { gap: 6px; padding-inline: 9px; }
  .view-controls button, .quiet { padding-inline: 6px; }
}
@media (max-width: 760px) {
  .page-width { width: calc(100% - 32px); }
  .masthead-inner { min-height: 51px; }
  .wordmark { font-size: 15px; }
  .showcase-link { font-size: 12px; }
  .hero { padding: 23px 0 18px; }
  .hero h1 { font-size: clamp(25px, 7.4vw, 40px); }
  .hero p { font-size: 12px; margin-top: 6px; }
  .workbench { display: flex; flex-direction: column; gap: 16px; padding-bottom: 27px; }
  .view, .editor { position: static; width: 100%; scroll-margin-top: 9px; }
  .view-bar { min-height: 46px; padding: 4px 6px; gap: 4px; }
  .view-bar h2 { font-size: 15px; }
  .view-controls button, .quiet { min-height: 31px; padding-inline: 6px; font-size: 11px; }
  .view-caption { min-height: 32px; padding: 4px 9px; }
  iframe { height: clamp(310px, 41dvh, 405px); }
  .steps button { min-height: 47px; }
  .sheet h2 { font-size: 26px; margin-bottom: 15px; }
  .sheet { padding-top: 16px; }
  input:not([type="checkbox"], [type="radio"], [type="file"]), select, textarea { font-size: 16px; }
}
@media (max-width: 370px) {
  .page-width { width: calc(100% - 22px); }
  .record-button span { display: none; }
  .view-bar h2 { font-size: 13px; }
  .covers { gap: 4px; }
  .covers .choice span { padding-inline: 2px; }
}
