:root {
  color-scheme: light;
  --ink: #271d1c;
  --muted: #695957;
  --paper: #fcf7f3;
  --white: #fffdfb;
  --line: #eedfdb;
  --red: #bf263c;
  --dark-red: #a8172e;
  --rose: #fcebed;
  font: 16px/1.5 "Be Vietnam Pro", "Segoe UI", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid var(--dark-red); outline-offset: 3px; }
[hidden] { display: none !important; }
svg { width: 1.15rem; height: 1.15rem; display: block; }

.site-header { background: var(--white); border-bottom: 1px solid var(--line); }
.header-inner, .page { width: min(1160px, calc(100% - 80px)); margin-inline: auto; }
.header-inner { min-height: 72px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; color: var(--ink); font-size: 1.8rem; font-weight: 850; line-height: 1; letter-spacing: -.075em; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: white; background: var(--red); transform: rotate(-7deg); }
.brand-mark svg { width: 21px; height: 21px; }
.brand-bang, .footer-brand span { color: var(--red); }
.help-button { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 100px; background: transparent; padding: 8px 14px; font-size: .875rem; font-weight: 650; color: var(--muted); }
.help-button:hover { color: var(--dark-red); border-color: #e5b4ba; }

.intro { position: relative; padding: 34px 0 29px; }
.eyebrow { display: flex; align-items: center; gap: 9px; margin: 0 0 6px; color: var(--dark-red); font-size: .76rem; font-weight: 750; letter-spacing: .16em; }
.eyebrow span { width: 19px; border-top: 2px solid currentColor; }
.intro h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-weight: 700; font-size: clamp(4rem, 8vw, 6.3rem); line-height: .98; letter-spacing: -.086em; }
.intro h1 span { color: var(--red); }
.intro-copy { font-size: 1.03rem; color: var(--muted); margin: 15px 0 0; max-width: 34rem; }
.intro-art { position: absolute; bottom: 27px; right: 28px; color: var(--red); width: 95px; height: 108px; pointer-events: none; }
.intro-art span { position: absolute; display: block; font: 4.9rem/1 Georgia, serif; transform: rotate(-11deg); }
.intro-art span:nth-child(2) { top: -2px; right: 2px; font-size: 2.2rem; color: #e88391; }
.intro-art span:nth-child(3) { bottom: -2px; right: 3px; font-size: 2.1rem; }

.studio { display: grid; grid-template-columns: minmax(305px, 365px) minmax(0, 1fr); grid-template-areas: "setup preview" "style preview"; column-gap: 21px; align-items: start; }
.settings, .preview { background: var(--white); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 3px 19px #4f221308; min-width: 0; }
.studio > aside { grid-area: setup; border-radius: 18px 18px 0 0; }
.style-setting { grid-area: style; border-radius: 0 0 18px 18px; border-top: 0; }
.preview-jump { display: none; }
.setting { padding: 19px; }
.setting + .setting { border-top: 1px solid var(--line); }
.section-heading { display: flex; align-items: center; gap: 9px; min-height: 29px; }
.section-heading h2 { margin: 0; font-size: .99rem; font-weight: 750; }
.section-icon, .output-icon { display: grid; place-items: center; width: 29px; height: 29px; border-radius: 8px; color: var(--dark-red); background: var(--rose); flex: 0 0 auto; }
.section-icon svg { width: 16px; height: 16px; }
.layouts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; margin-top: 12px; }
.layout { display: grid; justify-items: center; align-content: center; gap: 5px; min-height: 64px; padding: 5px 2px; border: 1px solid var(--line); border-radius: 9px; background: transparent; color: var(--muted); font-size: .875rem; font-weight: 700; }
.layout:hover { border-color: #de9aa5; }
.layout[aria-pressed="true"] { color: var(--dark-red); background: var(--rose); border-color: #d84d61; }
.layout-icon { width: 21px; height: 20px; display: grid; grid-template-columns: repeat(var(--columns), minmax(0, 1fr)); grid-template-rows: repeat(var(--rows), minmax(0, 1fr)); gap: 2px; }
.layout-icon[data-strip] { width: 10px; height: 22px; }
.layout-icon i { border: 1px solid currentColor; border-radius: 1px; }

.count { white-space: nowrap; margin-left: auto; background: var(--rose); color: var(--dark-red); border-radius: 100px; padding: 3px 8px; font-size: .77rem; font-weight: 700; }
.drop-zone { display: grid; justify-items: center; align-content: center; gap: 1px; width: 100%; min-height: 109px; margin-top: 12px; padding: 10px; border: 1.5px dashed #e0a9af; border-radius: 10px; background: #fff6f6; color: var(--muted); font-size: .875rem; }
.drop-zone strong { color: var(--dark-red); font-weight: 750; }
.drop-zone:not(:disabled):hover, .drop-zone.dragging { background: #fae4e8; border-color: var(--red); }
.drop-zone:disabled { background: #faf5f2; border-color: var(--line); }
.drop-zone:disabled strong { color: var(--muted); }
.upload-icon { padding: 6px; display: grid; place-items: center; border-radius: 8px; margin-bottom: 3px; background: #f9e0e4; color: var(--dark-red); }
.upload-note { margin: 8px 0 0; text-align: center; color: var(--muted); font-size: .77rem; }
.feedback { margin: 8px 0 0; color: var(--dark-red); font-size: .875rem; overflow-wrap: anywhere; }
.thumbnails { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 7px; margin: 11px 0 0; }
.thumbnail { display: block; position: relative; width: 100%; min-width: 0; aspect-ratio: 1; padding: 2px; border-radius: 8px; border: 1px solid var(--line); background: var(--white); }
.thumbnail[aria-pressed="true"] { border-color: var(--dark-red); box-shadow: 0 0 0 1px var(--dark-red); }
.thumbnail img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 5px; }
.thumbnail span { position: absolute; bottom: 4px; left: 4px; color: white; background: #1d1010dd; border-radius: 4px; padding: 0 4px; font-size: .75rem; }
.photo-actions { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }
.mini-button { border: 1px solid var(--line); border-radius: 7px; color: var(--muted); background: var(--white); padding: 5px 8px; font-size: .875rem; font-weight: 650; }
.mini-button:disabled { opacity: .45; }
.mini-button:not(:disabled):hover { border-color: #de9aa5; }
.remove-button { color: var(--dark-red); }

.field-label { display: block; margin: 12px 0 7px; color: var(--muted); font-size: .875rem; font-weight: 650; }
.swatches { display: flex; flex-wrap: wrap; gap: 7px; }
.swatch { position: relative; width: 34px; height: 34px; background: var(--swatch); color: var(--mark); border: 1px solid #4c292027; border-radius: 50%; display: grid; place-items: center; }
.swatch[aria-pressed="true"] { outline: 1.5px solid var(--dark-red); outline-offset: 2px; }
.swatch[aria-pressed="true"] svg { width: 17px; height: 17px; }
.swatch:not([aria-pressed="true"]) svg { visibility: hidden; }
.swatch:focus-visible { outline-width: 3px; }
.caption { width: 100%; min-height: 39px; border: 1px solid var(--line); border-radius: 8px; background: #fffaf8; color: var(--ink); padding: 6px 10px; font-size: .9rem; }
.theme-gallery, .filter-gallery { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.theme-card, .filter-card { display: grid; justify-items: center; align-content: start; gap: 4px; padding: 5px 4px; border-radius: 9px; border: 1px solid var(--line); background: var(--white); color: var(--muted); font-size: .82rem; font-weight: 700; line-height: 1.28; }
.theme-card canvas { width: 53px; height: 48px; border-radius: 3px; }
.filter-card canvas { width: 100%; aspect-ratio: 1.65; border-radius: 5px; object-fit: cover; background: #eddfdd; }
.theme-card:hover, .filter-card:hover { border-color: #de9aa5; }
.theme-card[aria-pressed="true"], .filter-card[aria-pressed="true"], .mini-button[aria-pressed="true"] { background: var(--rose); color: var(--dark-red); border-color: #d24b61; }

.preview { grid-area: preview; overflow: hidden; scroll-margin-top: 12px; }
.preview-header, .preview-footer { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 13px 17px; }
.preview-mode { background: var(--rose); color: var(--dark-red); border-radius: 100px; padding: 4px 10px; font-size: .75rem; font-weight: 750; }
.stage { position: relative; isolation: isolate; display: grid; place-items: center; height: 489px; overflow: hidden; background-color: #f7e9e7; background-image: radial-gradient(#d6959b6e 1px, transparent 1px), radial-gradient(ellipse, #fdeeee, transparent 75%); background-size: 19px 19px, auto; border-block: 1px solid #f0d9d7; }
.stage-corner { position: absolute; color: #b7616b; font: 400 1.4rem/1 ui-monospace, monospace; }
.corner-top { top: 13px; left: 15px; }
.corner-bottom { bottom: 14px; right: 17px; }
.stage-star { position: absolute; color: #c8485c; left: 11%; top: 22%; font: 3.3rem/1 Georgia, serif; transform: rotate(-9deg); }
.stage-star span { position: absolute; top: -8px; right: -21px; font-size: 1.65rem; }
.star-bottom { left: auto; right: 11%; top: auto; bottom: 17%; color: #bc5e6d; font-size: 2.6rem; transform: rotate(12deg); }
.print-stack { position: relative; width: var(--print-width, 310px); transform: rotate(-5deg); }
.print-stack::before { content: ""; position: absolute; z-index: -1; inset: 0; background: #fff8f0; border: 1px solid #ebc8bc; transform: translate(12px, 1px) rotate(11deg); box-shadow: 0 13px 24px #4d282f29; }
.print-stack canvas { display: block; width: 100%; height: auto; background: var(--red); box-shadow: 0 13px 24px #4d282f45; }
.print-stack.is-editable { transform: none; }
.crop-slots { position: absolute; inset: 0; pointer-events: none; }
.crop-slot { position: absolute; padding: 0; border: 0; border-radius: 0; background: transparent; pointer-events: auto; touch-action: none; cursor: grab; }
.crop-slot:not(:disabled):hover { box-shadow: inset 0 0 0 2px #fff9ef, inset 0 0 0 4px #7d1239b0; }
.crop-slot[aria-pressed="true"] { box-shadow: inset 0 0 0 2px #fff9ef, inset 0 0 0 5px #991b4e; }
.crop-slot.is-dragging { cursor: grabbing; }
.crop-slot:focus-visible { outline: 3px solid var(--dark-red); outline-offset: 2px; }
.crop-editor { padding: 10px 17px 12px; border-bottom: 1px solid var(--line); background: #fff9f7; }
.crop-header { display: flex; align-items: baseline; flex-wrap: wrap; gap: 3px 12px; }
.crop-header h3 { margin: 0; font-size: .95rem; }
.crop-header p { margin: 0; font-size: .83rem; color: var(--muted); }
.crop-tools, .fit-options, .zoom-control { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.crop-tools { margin-top: 8px; gap: 8px 14px; }
.zoom-control { flex-wrap: nowrap; font-size: .86rem; font-weight: 650; color: var(--muted); }
.zoom-control input { width: clamp(66px, 9vw, 120px); min-height: 26px; margin: 0; accent-color: var(--red); }
.zoom-control output { min-width: 2.8rem; font-variant-numeric: tabular-nums; }
.preview-footer { min-height: 72px; }
.output-meta { display: flex; align-items: center; gap: 9px; min-width: 0; }
.output-icon { width: 36px; height: 36px; }
.output-meta strong, .output-meta div > span { display: block; }
.output-meta strong { font-size: .895rem; }
.output-meta div > span { color: var(--muted); font-size: .76rem; }
.download { min-height: 42px; display: flex; justify-content: center; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 8px; border: 1px solid transparent; background: var(--red); color: #fff; font-weight: 750; box-shadow: 0 2px 0 #972038; white-space: nowrap; }
.download:not(:disabled):hover { background: var(--dark-red); }
.download:disabled { opacity: .64; box-shadow: none; }
.download-feedback { margin: 0 17px 12px; }

.site-footer { border-top: 1px solid var(--line); margin: 29px 0 0; min-height: 68px; display: flex; justify-content: space-between; align-items: center; gap: 10px; color: var(--muted); }
.footer-brand { color: var(--ink); font-size: 1.25rem; font-weight: 850; letter-spacing: -.075em; }
.site-footer p { display: flex; align-items: center; gap: 6px; margin: 0; font-size: .875rem; }
.site-footer svg { width: 15px; height: 15px; }
.help-dialog { border: 1px solid var(--line); border-radius: 17px; background: var(--white); color: var(--ink); width: min(480px, calc(100% - 24px)); padding: 22px; box-shadow: 0 15px 65px #3115194d; }
.help-dialog::backdrop { background: #3115198c; }
.dialog-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.dialog-top h2 { font-size: 1.3rem; margin: 0; }
.dialog-close { border: none; padding: 6px; background: var(--rose); color: var(--dark-red); border-radius: 7px; }
.help-dialog ol { padding-inline-start: 23px; }
.help-dialog li + li { margin-top: 8px; }
.help-dialog p { color: var(--muted); margin-bottom: 0; }

@media (min-width: 901px) { .preview { position: sticky; top: 12px; } }
@media (max-width: 900px) {
  .header-inner, .page { width: calc(100% - 40px); }
  .studio { grid-template-columns: minmax(260px, 305px) minmax(0, 1fr); column-gap: 14px; }
  .setting { padding: 14px; }
  .stage { height: 425px; }
  .stage-star { left: 7%; top: 17%; font-size: 2.2rem; }
  .star-bottom { left: auto; top: auto; right: 7%; bottom: 13%; }
}
@media (max-width: 680px) {
  .header-inner, .page { width: calc(100% - 28px); }
  .header-inner { min-height: 58px; }
  .intro { padding: 25px 0 22px; }
  .intro h1 { font-size: clamp(3.2rem, 13vw, 5rem); }
  .intro-copy { margin-top: 10px; }
  .intro-art { display: none; }
  .studio { grid-template-columns: minmax(0, 1fr); grid-template-areas: "setup" "preview" "style"; gap: 14px; }
  .studio > aside, .style-setting { border-radius: 18px; }
  .style-setting { border-top: 1px solid var(--line); }
  .preview-jump { display: inline; margin-left: auto; color: var(--dark-red); font-weight: 700; font-size: .875rem; }
  .stage { height: 390px; }
  .preview-header, .preview-footer, .crop-editor { padding-inline: 12px; }
  .download { padding-inline: 10px; font-size: .9rem; }
}
@media (min-width: 681px) and (max-height: 870px) {
  .stage { height: clamp(310px, calc(100vh - 248px), 489px); }
}
@media (max-width: 360px) {
  .output-icon { display: none; }
  .stage { height: 345px; }
  .site-footer { align-items: flex-start; padding-top: 13px; }
}
