:root {
  color-scheme: light;
  --paper: #f8f5ee;
  --panel: #fffdf8;
  --ink: #28241f;
  --muted: #675e54;
  --line: #ded5c7;
  --accent: #a43826;
  --accent-dark: #872c1d;
  font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
button, select, input { font: inherit; }
button, select { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
p, h1, h2 { margin: 0; }

.frame { width: min(1120px, calc(100% - 72px)); margin-inline: auto; }
.topbar { border-bottom: 1px solid var(--line); }
.header-inner { height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.wordmark { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: inherit; font-weight: 850; font-size: 1.35rem; line-height: 1; letter-spacing: -.09em; }
.period { color: var(--accent); margin-left: -6px; }
.mark { width: 20px; height: 17px; position: relative; margin-right: 3px; }
.mark::before { content: ""; position: absolute; width: 15px; height: 12px; border: 2px solid var(--accent); border-radius: 4px; transform: rotate(-30deg); top: 3px; left: 1px; }
.mark::after { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); position: absolute; top: 1px; right: 0; }
.service { color: var(--muted); display: flex; gap: 8px; align-items: center; font-size: .875rem; }
.status-dot { height: 8px; width: 8px; border-radius: 50%; background: #9e8974; }
.status-dot.ready { background: #4d714b; }

.intro { padding: 45px 0 32px; }
.intro h1 { font-size: clamp(2.3rem, 5vw, 4.12rem); line-height: 1.14; letter-spacing: -.086em; font-weight: 850; word-break: keep-all; }
.intro h1 em { font-style: normal; color: var(--accent); }
.intro p { font-size: 1.045rem; line-height: 1.55; margin-top: 13px; color: var(--muted); word-break: keep-all; }

.studio { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.12fr); gap: 20px; align-items: start; }
.panel { border: 1px solid var(--line); border-radius: 19px; padding: 23px; background: var(--panel); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; min-height: 38px; gap: 8px; margin-bottom: 14px; }
.panel-heading h2 { font-size: 1.38rem; letter-spacing: -.065em; line-height: 1.2; }
.text-button { background: none; border: 0; color: var(--accent); padding: 9px 3px; margin-left: auto; font-size: .875rem; font-weight: 750; text-underline-offset: 4px; text-decoration: underline; }
.text-button:disabled { opacity: .52; cursor: wait; }

fieldset { padding: 0; margin: 0; border: 0; min-width: 0; }
.uploads, .options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.field-title, .options label { font-size: .94rem; font-weight: 750; }
.field-title { display: inline-block; margin-bottom: 8px; }
.drop { position: relative; overflow: hidden; height: 161px; display: grid; place-items: center; text-align: center; background: #f7f1e7; border: 1px dashed #ac9c89; border-radius: 12px; }
.drop:hover, .drop.drag-active { background: #f1e4d7; border-color: var(--accent); }
.drop:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.drop img { width: 100%; height: 100%; position: absolute; inset: 0; object-fit: contain; }
.file-input { cursor: pointer; opacity: 0; position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; }
.drop-copy { display: grid; place-items: center; gap: 7px; z-index: 1; padding: 8px; }
.plus { display: grid; place-items: center; width: 43px; height: 43px; border-radius: 50%; background: #fffdf9; font-size: 1.65rem; line-height: 1; color: var(--accent); }
.drop-label { color: #524439; font-weight: 700; font-size: .875rem; overflow-wrap: anywhere; }
.change { display: none; position: absolute; bottom: 8px; right: 8px; z-index: 1; background: #fffdf7; padding: 5px 8px; border-radius: 5px; color: var(--ink); font-size: .8125rem; }
.drop.has-preview .drop-copy { visibility: hidden; }
.drop.has-preview .change { display: block; }
.tip { display: block; color: var(--muted); font-size: .875rem; margin-top: 7px; }
.options { margin-top: 21px; }
.options label { display: grid; gap: 8px; }
select { appearance: none; color: var(--ink); border: 1px solid var(--line); border-radius: 9px; width: 100%; height: 45px; padding: 0 36px 0 10px; font-size: .875rem; background: linear-gradient(45deg, transparent 52%, var(--muted) 52%) calc(100% - 15px) center / 6px 5px no-repeat, linear-gradient(135deg, var(--muted) 52%, transparent 52%) calc(100% - 9px) center / 6px 5px no-repeat, #fffdf8; }
.primary { display: block; min-height: 51px; margin-top: 20px; width: 100%; padding: 10px; background: var(--accent); color: white; border: 0; border-radius: 9px; font-weight: 800; letter-spacing: -.04em; }
.primary:hover:not(:disabled) { background: var(--accent-dark); }
.primary:disabled { background: #e6c8bb; color: #573c31; cursor: default; }
fieldset:disabled .drop { opacity: .8; }
fieldset:disabled .file-input, fieldset:disabled select { cursor: default; }
.form-message { margin-top: 12px; color: var(--accent-dark); font-size: .9rem; line-height: 1.5; }
.form-message.success { color: #416347; }
.privacy { color: var(--muted); font-size: .875rem; line-height: 1.6; padding-top: 13px; }

.output { background: #fefbf5; }
.sample-label { color: #6d5546; font-size: .85rem; padding: 5px 8px; border: 1px solid var(--line); border-radius: 5px; }
.viewer { position: relative; display: grid; place-items: center; overflow: hidden; background: #ede5d8; border: 1px solid #e2d8ca; border-radius: 12px; height: clamp(320px, 43vw, 420px); }
.comparison { --split: 50%; position: absolute; inset: 0; }
.comparison img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: contain; }
#after { clip-path: inset(0 0 0 var(--split)); }
.divider { position: absolute; z-index: 1; pointer-events: none; left: var(--split); inset-block: 0; border-left: 2px solid white; transform: translateX(-1px); }
.divider span { position: absolute; top: 50%; left: -1px; transform: translate(-50%, -50%); display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; box-shadow: 0 2px 12px #2f251d40; background: #fffdf7; color: #3c3024; font-size: 1.4rem; letter-spacing: .02em; }
.split { position: absolute; inset: 0; margin: 0; width: 100%; height: 100%; opacity: 0; cursor: ew-resize; z-index: 2; }
.comparison:focus-within { outline: 2px solid var(--accent); outline-offset: -3px; }
.photo-label { position: absolute; top: 10px; z-index: 1; background: #28221e; color: #fff; font-size: .875rem; padding: 4px 7px; border-radius: 4px; pointer-events: none; }
.label-before { left: 10px; }
.label-after { right: 10px; }
.busy-panel { position: absolute; inset: 0; display: grid; align-content: center; justify-items: center; gap: 10px; text-align: center; padding: 18px; background: #f1e9df; z-index: 3; }
.busy-panel p { font-size: 1.18rem; font-weight: 800; }
.busy-panel span { color: var(--muted); font-size: .9rem; }
.spinner { width: 33px; height: 33px; margin-bottom: 4px; border: 3px solid #d7baab; border-top-color: var(--accent); border-radius: 50%; animation: rotation 850ms linear infinite; }
@keyframes rotation { to { transform: rotate(360deg); } }
.result-footer { display: flex; gap: 10px; align-items: center; justify-content: space-between; min-height: 24px; margin-top: 12px; }
.result-footer p { color: var(--muted); font-size: .875rem; }
.download { color: var(--accent); font-weight: 800; text-underline-offset: 4px; font-size: .875rem; min-width: max-content; }
.footer { margin-top: 27px; padding: 15px 0 23px; border-top: 1px solid var(--line); color: var(--muted); font-size: .875rem; line-height: 1.55; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (max-width: 800px) {
  .frame { width: min(620px, calc(100% - 34px)); }
  .studio { grid-template-columns: 1fr; gap: 14px; }
  .intro { padding: 31px 0 21px; }
  .header-inner { height: 58px; }
  .viewer { height: clamp(330px, 85vw, 450px); }
}
@media (max-width: 400px) {
  .panel { padding: 15px; }
  .intro h1 { font-size: 2.15rem; }
  .intro p { font-size: .975rem; }
  .drop { height: 145px; }
}
@media (prefers-reduced-motion: reduce) {
  .spinner { animation: none; }
}

