:root {
  color-scheme: light;
  font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  color: #182b24; background: #f5f1e7; font-synthesis: none;
  --ink: #182b24; --muted: #52645a; --paper: #fcf9f0; --line: #d6d8c9;
  --dark: #1e342a; --light: #f3f1dc; --mint: #e2e9d4; --orange: #a53c11;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, input:focus-visible, canvas:focus-visible, summary:focus-visible {
  outline: 2px solid #ad4c23; outline-offset: 3px;
}
.masthead { border-bottom: 1px solid var(--line); }
.masthead-inner, main { width: min(1168px, calc(100% - 64px)); margin-inline: auto; }
.masthead-inner { min-height: 67px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.masthead p { margin: 0; font-size: .81rem; color: var(--muted); }
.brand { display: flex; align-items: center; gap: 11px; font-size: 1.12rem; font-weight: 850; letter-spacing: -.06em; white-space: nowrap; }
.brand-mark { position: relative; display: block; width: 26px; height: 24px; }
.brand-mark i, .viewfinder i { position: absolute; width: 27%; height: 29%; border: solid currentColor; border-width: 0; }
.brand-mark i:first-child, .viewfinder i:first-child { top: 0; left: 0; border-width: 2px 0 0 2px; }
.brand-mark i:nth-child(2), .viewfinder i:nth-child(2) { top: 0; right: 0; border-width: 2px 2px 0 0; }
.brand-mark i:nth-child(3), .viewfinder i:nth-child(3) { bottom: 0; right: 0; border-width: 0 2px 2px 0; }
.brand-mark i:nth-child(4), .viewfinder i:nth-child(4) { bottom: 0; left: 0; border-width: 0 0 2px 2px; }
.brand-mark::after { position: absolute; content: ''; width: 9px; height: 9px; border-radius: 50%; background: #b64e27; inset: 0; margin: auto; }
.intro { margin: 39px 0 32px; }
h1 { margin: 0; font-weight: 820; font-size: clamp(35px, 5vw, 62px); letter-spacing: -.08em; line-height: 1.05; }
h1 span { color: var(--orange); }
.intro p { margin: 14px 0 0; font-size: clamp(14px, 2vw, 17px); color: var(--muted); }
.studio { display: grid; align-items: start; grid-template-columns: minmax(285px, 365px) minmax(0, 1fr); grid-template-rows: auto 1fr; gap: 14px 20px; padding-bottom: 32px; }
.inputs, .adjust { min-width: 0; border: 1px solid var(--line); background: var(--paper); padding: 18px; border-radius: 12px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; min-height: 24px; gap: 10px; margin-bottom: 12px; }
h2 { margin: 0; font-size: 16px; letter-spacing: -.04em; }
.upload { position: relative; min-width: 0; display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; gap: 10px; align-items: center; min-height: 71px; border-top: 1px solid #e2e2d7; padding-block: 8px; }
.upload strong, .upload small { display: block; }
.upload strong { font-size: 14px; }
.upload small { margin-top: 3px; font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-thumb { display: grid; place-items: center; width: 42px; height: 42px; overflow: hidden; background: #e9ecde; border-radius: 6px; font-size: 19px; color: #526553; }
.upload-thumb canvas { display: block; max-width: 100%; max-height: 100%; object-fit: contain; }
.file-button, .button, .text-button {
  display: inline-flex; align-items: center; justify-content: center; min-height: 37px; padding: 0 10px;
  color: var(--ink); background: transparent; border: 1px solid #bac5b7; border-radius: 6px; font-size: 12px; font-weight: 730;
  white-space: nowrap; cursor: pointer;
}
.file-button:hover, .button:hover { background: #e9edde; }
.file-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.upload:has(input:focus-visible) .file-button { outline: 2px solid #ad4c23; outline-offset: 3px; }
.search-box { border-top: 1px solid #e2e2d7; }
.search-box summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; cursor: pointer; color: #2f4a3c; font-weight: 760; font-size: 13px; list-style: none; }
.search-box summary::-webkit-details-marker { display: none; }
.search-box[open] summary { margin-bottom: 3px; }
.search-box label { display: block; font-size: 12px; font-weight: 700; margin-bottom: 6px; }
.search-row { display: flex; gap: 5px; }
.search-row input { min-width: 0; flex: 1; color: var(--ink); padding: 7px 9px; border: 1px solid #bac5b7; border-radius: 6px; background: #fffdf7; font-size: 16px; }
.search-row input::placeholder { font-size: 12px; }
.search-row button { background: var(--mint); }
.search-box p, .message { font-size: 12px; color: var(--muted); line-height: 1.5; margin: 8px 0; }
.search-box .paste-button { min-height: 34px; font-size: 11px; }
.adjust { grid-column: 1; }
.text-button { padding: 0 4px; min-height: 28px; color: var(--muted); border: 0; }
.text-button:disabled { opacity: .52; }
fieldset { border: 0; min-width: 0; padding: 0; margin: 0; }
fieldset:disabled { opacity: .5; }
.placement { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-bottom: 14px; }
.layer-button[aria-pressed=true] { background: var(--mint); border-color: #789581; }
.sliders { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 15px; }
.sliders label { display: flex; justify-content: space-between; align-items: center; font-size: 12px; font-weight: 680; gap: 5px; }
.sliders label:nth-of-type(even) { grid-column: 2; }
.sliders label:nth-of-type(2) { grid-row: 1; }
.sliders label:nth-of-type(4) { grid-row: 3; }
.sliders input { grid-row: 2; width: 100%; margin: 0; min-height: 20px; accent-color: #366850; }
.sliders input:nth-of-type(n+3) { grid-row: 4; }
.sliders output { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 11px; }
.options { display: flex; flex-wrap: wrap; gap: 7px 15px; margin-top: 12px; }
.options label { display: flex; gap: 5px; align-items: center; min-height: 26px; font-size: 12px; }
.options input { margin: 0; accent-color: #366850; }
.preview { grid-column: 2; grid-row: 1 / span 2; overflow: hidden; border-radius: 14px; border: 1px solid #253f35; background: var(--dark); color: var(--light); box-shadow: 0 12px 30px #192c2118; }
.preview header, .preview footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; }
.preview header { border-bottom: 1px solid #496054; }
.preview header span { font-size: 11px; color: #d6dfc9; font-variant-numeric: tabular-nums; }
.preview footer { flex-wrap: wrap; min-height: 75px; }
.preview footer p { margin: 0; color: #d6dfc9; font-size: 12px; }
.stage { height: clamp(335px, 48dvh, 550px); display: grid; place-items: center; overflow: hidden; background: #263f34; position: relative; }
.stage:has(canvas[hidden]) {
  background-image: linear-gradient(#f2f1dd15 1px, transparent 1px), linear-gradient(90deg, #f2f1dd15 1px, transparent 1px);
  background-size: 38px 38px; background-position: center;
}
.placeholder { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; padding: 20px; }
.placeholder p { margin: 0; color: #f0efdb; font-size: 14px; }
.viewfinder { width: 116px; height: 85px; position: relative; display: grid; place-items: center; color: #dce6cd; }
.viewfinder span { font-size: 31px; font-weight: 300; color: #dce6cd; }
.choose-from-stage, .save {
  min-height: 43px; padding: 0 14px; border: 1px solid #a5b39a; border-radius: 7px;
  background: #f1eddd; color: #23382c; font-weight: 810; font-size: 13px;
}
.choose-from-stage:hover, .save:not(:disabled):hover { background: #fffcee; }
.save:disabled { background: #40574c; color: #d7dfce; border-color: #65786b; }
.save span { margin-left: 5px; }
.preview .message { color: #d6dfc9; margin: -5px 18px 13px; }
.stage > canvas { position: absolute; inset: 0; margin: auto; max-width: 100%; max-height: 100%; display: block; }
.stage canvas.editable { cursor: grab; touch-action: none; }
.stage canvas.dragging { cursor: grabbing; }
.drop-target { outline: 2px dashed #7aa98a; outline-offset: -3px; }
@media (max-width: 795px) {
  .masthead-inner, main { width: calc(100% - 32px); }
  .masthead-inner { min-height: 55px; }
  .intro { margin: 28px 0 23px; }
  .studio { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto; }
  .preview, .adjust { grid-row: auto; grid-column: 1; }
  .stage { height: clamp(270px, 46dvh, 490px); }
  .inputs, .adjust { padding: 14px; }
  .upload { min-height: 68px; }
  .file-button, .button { min-height: 44px; }
}
@media (max-width: 375px) {
  .masthead p { font-size: 11px; }
  .upload { gap: 7px; grid-template-columns: 34px minmax(0, 1fr) auto; }
  .upload-thumb { width: 34px; height: 38px; }
  .preview header, .preview footer { padding: 13px; }
}
