:root {
  color-scheme: light;
  --paper: #f4f6f3; --ink: #1c2b27; --muted: #53645c; --pine: #205245;
  --line: #cbd6ce; --gold: #f0cf8b; --red: #9b382f; --night: #141719;
  font: 15px/1.55 "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink); background: var(--paper);
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
button, input, textarea { font: inherit; }
button, a, input, textarea, label { -webkit-tap-highlight-color: transparent; }
a { color: var(--pine); text-underline-offset: 4px; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .55; }
:focus-visible, .add-photo:focus-within { outline: 2px solid #a56323; outline-offset: 3px; }
h1, h2, p { margin: 0; }
h1, .letter h2 { font-family: "Songti SC", "Noto Serif CJK SC", SimSun, Georgia, serif; font-weight: 700; }
.shell { width: min(1110px, calc(100% - 68px)); margin: 0 auto; }
.icon { display: block; flex: 0 0 auto; width: 19px; height: 19px; }
.station-header { border-bottom: 1px solid var(--line); }
.station-bar { display: flex; min-height: 70px; align-items: center; justify-content: space-between; gap: 16px; }
.brand { color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; gap: 9px; font-size: 20px; font-weight: 750; }
.brand .icon, .music-row .icon { filter: invert(31%) sepia(32%) saturate(688%) hue-rotate(112deg); }
.button, .icon-button {
  display: inline-flex; justify-content: center; align-items: center; gap: 9px;
  border: 1px solid transparent; border-radius: 6px; min-height: 45px;
  padding: 8px 15px; color: var(--ink); background: transparent; text-decoration: none; font-weight: 650;
}
.button:hover, .icon-button:hover { background: #e7ede8; }
.icon-button { width: 44px; height: 44px; padding: 0; }
.quiet { color: var(--pine); padding-inline: 8px; }
.outline { border-color: #a9bcb0; color: var(--pine); }
.primary { background: var(--pine); color: white; border-color: var(--pine); }
.primary:hover { background: #183f35; }
.primary .icon, .danger-fill .icon { filter: invert(1); }
.editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(270px, .83fr); gap: clamp(34px, 7vw, 116px); padding-block: 42px 50px; align-items: start; }
.editor { min-width: 0; }
.kicker { display: flex; align-items: center; gap: 9px; color: var(--pine); font-size: 12px; font-weight: 700; }
.kicker > span, .mode-note > span { width: 7px; height: 7px; flex: 0 0 7px; background: #bb7b3c; transform: rotate(45deg); }
.kicker b { color: #a35d3a; }
.editor h1, .order-layout h1 { font-size: 44px; line-height: 1.18; margin: 12px 0 28px; overflow-wrap: anywhere; }
.form-section { padding: 15px 0 16px; border-top: 1px solid var(--line); }
.first-section { position: relative; padding-bottom: 27px; }
.section-label { display: flex; min-height: 24px; gap: 10px; align-items: center; }
.section-label > span:first-child { color: var(--pine); font: 700 12px/1.2 ui-monospace, monospace; }
.section-label h2 { font-size: 17px; font-weight: 720; }
.section-label .count { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; }
.names { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 13px 0 10px; }
label { font-size: 13px; font-weight: 650; }
.optional, .message-count { color: var(--muted); font-weight: 400; font-size: 12px; }
.optional { margin-left: 4px; }
input:not([type=checkbox], [type=file]), textarea {
  display: block; width: 100%; min-width: 0; margin-top: 5px; border: 1px solid #bfcfc4; border-radius: 5px;
  background: #fbfdfb; color: var(--ink); padding: 9px 11px; font-size: 16px; font-weight: 400;
}
input::placeholder, textarea::placeholder { color: #62746a; font-size: 13px; }
textarea { min-height: 82px; resize: vertical; }
.message-count { position: absolute; right: 1px; bottom: 6px; }
.photo-strip { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 12px; }
.photo-strip > * { flex: 0 0 79px; height: 74px; position: relative; border-radius: 5px; }
.add-photo { border: 1px dashed #7b9b89; display: grid; align-content: center; justify-items: center; gap: 4px; color: var(--pine); font-size: 12px; cursor: pointer; }
.add-photo:hover { background: #e6efe8; }
.add-photo input { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; }
.photo-thumb > img { display: block; width: 100%; height: 100%; border-radius: 5px; object-fit: cover; }
.photo-thumb button { position: absolute; right: 3px; top: 3px; width: 30px; height: 30px; min-height: 30px; background: var(--night); }
.photo-thumb button .icon { width: 16px; height: 16px; }
.music-row { display: flex; align-items: center; justify-content: space-between; padding-block: 13px; }
.switch { display: inline-grid; align-items: center; position: relative; width: 44px; height: 44px; cursor: pointer; }
.switch input { opacity: 0; position: absolute; inset: 0; margin: 0; cursor: pointer; }
.switch span { height: 24px; background: #818e86; border-radius: 17px; pointer-events: none; }
.switch span::before { content: ""; display: block; width: 18px; height: 18px; margin: 3px; background: white; border-radius: 100%; transition: transform 180ms; }
.switch input:checked + span { background: var(--pine); }
.switch input:checked + span::before { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 2px solid #a56323; outline-offset: 4px; }
.editor-actions { display: grid; grid-template-columns: 1fr 1.2fr; gap: 10px; }
.editor-actions .button { min-height: 51px; }
.mode-note { display: flex; align-items: center; gap: 8px; margin-top: 13px; font-size: 12px; color: var(--muted); }
.field-error { color: #90352f; margin: 8px 0; font-size: 13px; }
.postcard-preview { min-width: 0; background: #181d1a; color: #f3ead3; border: 1px solid #38493f; border-radius: 7px; overflow: hidden; position: sticky; top: 24px; }
.postcard-top, .postcard-foot { display: flex; min-height: 60px; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 18px; }
.postcard-top { border-bottom: 1px solid #3a473f; font-size: 13px; }
.postmark { display: grid; place-items: center; height: 32px; width: 36px; border: 1px dashed #d3aa62; border-radius: 2px; }
.postmark .icon, .order-stamp .icon { filter: invert(83%) sepia(30%) saturate(693%) hue-rotate(338deg); }
.postcard-tree { display: block; width: 100%; height: auto; aspect-ratio: 680 / 920; object-fit: contain; }
.postcard-foot { border-top: 1px solid #3a473f; font-size: 12px; }
.postcard-foot > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.postcard-foot > span:last-child { flex: none; color: #c2cfc5; }
.postcard-foot i { color: var(--gold); font: italic 21px Georgia, serif; margin-right: 5px; }
dialog { color: var(--ink); }
dialog::backdrop { background: #0b1410a6; }
.surface-dialog, .letter { width: min(480px, calc(100% - 32px)); border: 1px solid var(--line); border-radius: 8px; padding: 22px; background: var(--paper); }
.dialog-heading, .letter-header { display: flex; gap: 16px; align-items: start; justify-content: space-between; margin-bottom: 12px; }
.dialog-heading h2 { font-size: 20px; }
.history-link { display: flex; justify-content: space-between; gap: 12px; padding-block: 12px; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.history-link span { white-space: nowrap; font-size: 12px; }
.preview-dialog { inset: 0; width: 100%; max-width: none; height: 100%; max-height: none; padding: 0; margin: 0; border: 0; }
.preview-dialog[open] { display: grid; grid-template-rows: auto minmax(0, 1fr); }
.preview-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 4px; padding: 4px max(11px, env(safe-area-inset-right)); color: var(--muted); font-size: 12px; }
.preview-dialog iframe { width: 100%; height: 100%; border: 0; background: var(--night); }
.order-layout { width: min(540px, calc(100% - 44px)); margin-block: 58px; }
.order-layout .kicker { margin-top: 22px; }
.order-layout h1 { margin-bottom: 12px; }
.order-stamp { display: grid; place-items: center; width: 58px; height: 58px; border: 1px dashed #9e7f4f; border-radius: 5px; background: #244a40; }
.order-stamp .icon { width: 28px; height: 28px; }
.order-actions, .order-links { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; margin-top: 18px; }
.order-layout > a.button { margin-top: 18px; }
.share-line { display: flex; gap: 9px; margin-top: 22px; }
.share-line input:not([type]) { margin: 0; }
.order-links a, .text-button { font-size: 13px; }
.text-button { border: 0; background: transparent; color: var(--pine); padding: 7px 0; text-decoration: underline; text-underline-offset: 4px; }
.danger { color: var(--red); }
.danger-fill { background: var(--red); color: white; }
.danger-fill:hover { background: #792b24; }
.gift-page { color: #faefd7; background: var(--night); overflow: hidden; color-scheme: dark; }
.gift-stage { position: fixed; inset: 0; isolation: isolate; background: var(--night); }
.gift-stage > iframe, .gift-poster { display: block; position: absolute; inset: 0; z-index: -1; width: 100%; height: 100%; border: 0; }
.gift-poster img { width: 100%; height: 100%; display: block; object-fit: cover; opacity: .76; }
.gift-poster::after { content: ""; position: absolute; inset: 0; background: linear-gradient(0deg, #111617 1%, #111617bb 13%, transparent 60%); }
.start-gift { position: absolute; inset-inline: 16px; bottom: max(8%, env(safe-area-inset-bottom)); max-width: 550px; margin-inline: auto; text-align: center; }
.gift-kicker { font-size: 12px; color: #e3c688; font-weight: 650; }
.gift-kicker span { color: #f1d999; padding-inline: 5px; }
.start-gift h1 { font-size: 46px; line-height: 1.17; margin: 7px 0; text-shadow: 0 2px 14px #15231b; }
.start-gift > p:not(.gift-kicker) { color: #f7eccf; overflow-wrap: anywhere; text-shadow: 0 2px 4px #111; }
.glow-button { color: #20261d; background: #efd296; border-color: #f2dab1; padding-inline: 18px; margin-top: 17px; }
.glow-button:hover { background: #fae3b7; }
.gift-tools { position: absolute; right: max(14px, env(safe-area-inset-right)); top: max(14px, env(safe-area-inset-top)); display: flex; gap: 7px; }
.gift-tools button, .letter button, .unwrap { touch-action: manipulation; }
.dark { background: #171a1ded; border: 1px solid #8c805e; color: #ffecc3; }
.dark:hover, .dark[aria-pressed=true] { background: #4b402b; }
.dark .icon, .unwrap .icon, .photo-thumb button .icon { filter: invert(95%) sepia(25%) saturate(590%) hue-rotate(316deg); }
.stage-status { width: min(390px, calc(100% - 32px)); position: absolute; right: 14px; top: 66px; text-align: right; font-size: 13px; color: #fae5b4; text-shadow: 0 2px 5px #111; pointer-events: none; }
.gift-stage:has(.gesture-preview:not([hidden])) .stage-status { width: min(390px, calc(100% - 174px)); }
.gesture-preview { position: absolute; left: max(14px, env(safe-area-inset-left)); top: max(14px, env(safe-area-inset-top)); width: 147px; padding: 6px; border: 1px solid #8c805e; border-radius: 6px; background: #191c1de8; }
.camera-image { position: relative; aspect-ratio: 4 / 3; background: #2a2f2e; border-radius: 3px; overflow: hidden; }
.camera-image video { width: 100%; height: 100%; display: block; object-fit: cover; transform: scaleX(-1); }
.camera-corner { position: absolute; right: 7px; top: 7px; width: 7px; height: 7px; border-radius: 50%; background: #93cea8; }
.gesture-preview p { font-size: 11px; margin-block: 4px; min-height: 17px; }
.gesture-legend { display: grid; grid-template-columns: 1fr 1fr; gap: 1px 3px; font-size: 9px; color: #d8c69b; }
.unwrap { position: absolute; left: 50%; top: 78%; transform: translate(-50%, -50%); display: inline-flex; gap: 8px; align-items: center; border: 0; border-radius: 4px; min-height: 44px; padding: 4px 11px; background: #141918e8; color: #fff0c7; font-weight: 700; white-space: nowrap; }
.unwrap span { display: grid; place-items: center; width: 31px; height: 31px; background: #694635; border: 1px solid #bd9255; border-radius: 4px; }
.unwrap:hover { background: #403522; }
.gift-demo { position: absolute; bottom: max(9px, env(safe-area-inset-bottom)); left: 13px; color: #ebd7ac; font-size: 11px; text-shadow: 0 2px 5px #111; pointer-events: none; }
.letter { color-scheme: light; color: #292f27; width: min(490px, calc(100% - 30px)); max-height: calc(100% - 34px); background: #fcfbf4; border-color: #cab483; padding: 23px 24px; overflow: auto; }
.letter[open] { animation: unfold 260ms ease-out; }
@keyframes unfold { from { opacity: 0; transform: translateY(16px) scale(.98); } }
.letter h2 { font-size: 27px; overflow-wrap: anywhere; margin-top: 5px; }
.letter-header .icon-button { flex: 0 0 44px; }
.letter[data-photos-only] :is(#letter-message, #letter-sender) { display: none; }
#letter-message { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 16px; line-height: 1.8; }
#letter-sender { text-align: right; margin: 9px 0 13px; color: #58674b; overflow-wrap: anywhere; }
.album-photo { position: relative; background: #eeeae0; height: min(38dvh, 340px); border: 1px solid #dad1bb; border-radius: 4px; overflow: hidden; touch-action: pan-y; }
.album-photo img { display: block; width: 100%; height: 100%; object-fit: contain; }
.album-photo p { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 12px; }
.album-photo span { position: absolute; bottom: 7px; right: 8px; color: white; background: #1c2422e8; font-size: 11px; padding: 2px 7px; border-radius: 3px; }
.album-nav { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; align-items: center; gap: 4px; padding-top: 7px; }
.album-thumbs { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; }
.album-thumbs button { position: relative; width: 44px; height: 44px; padding: 2px; border: 1px solid transparent; border-radius: 4px; background: #e8e6dc; }
.album-thumbs img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 2px; }
.album-thumbs span { position: absolute; bottom: 3px; right: 3px; min-width: 15px; padding-inline: 2px; border-radius: 2px; background: #202824e8; color: white; font-size: 10px; line-height: 15px; }
.album-thumbs button:hover { border-color: #82937c; }
.album-thumbs button[aria-current=true] { background: var(--pine); border-color: var(--pine); }
.surface-dialog > input + .button { margin-top: 12px; }
@media (min-width: 900px) and (min-aspect-ratio: 4/3) {
  .unwrap { top: 74%; left: calc(50% + min(17vw, 210px)); }
  .start-gift { bottom: 12%; }
}
@media (max-width: 760px) {
  .shell { width: calc(100% - 38px); }
  .station-bar { min-height: 60px; }
  .editor-grid { grid-template-columns: minmax(0, 1fr); gap: 24px; padding-block: 27px 36px; }
  .editor h1, .order-layout h1 { font-size: 36px; margin-bottom: 22px; }
  .postcard-preview { position: static; width: min(100%, 440px); margin-inline: auto; }
  .postcard-top, .postcard-foot { min-height: 46px; padding-inline: 13px; }
  .start-gift h1 { font-size: 36px; }
}
@media (max-width: 365px) {
  .editor h1, .order-layout h1 { font-size: 30px; }
  .editor-actions .button { padding-inline: 7px; }
  .gift-tools { gap: 4px; right: 8px; }
  .gesture-preview { width: 126px; left: 8px; }
}
@media (max-height: 550px) {
  .unwrap { top: 69%; left: calc(50% + min(23vw, 160px)); }
  .start-gift { bottom: 7%; }
  .start-gift h1 { font-size: 32px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before { animation: none !important; transition: none !important; }
}
