:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  color: #22271f;
  background: #f4f4ee;
  --muted: #5a6254;
  --border: #dce0d6;
  --navy: #1c2c46;
}

* { box-sizing: border-box; }
body { margin: 0; }
button, input { font: inherit; }
button { color: inherit; cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
button:focus-visible, input:focus-visible, canvas:focus-visible { outline: 2px solid #a63d28; outline-offset: 3px; }
[hidden] { display: none !important; }

.shell { width: min(100% - 64px, 1320px); margin-inline: auto; }
.site-header { border-bottom: 1px solid var(--border); }
.header-inner { min-height: 64px; display: flex; align-items: center; gap: 18px; }
.header-divider { height: 17px; width: 1px; background: #cdd3c9; }
.app-name { color: var(--muted); font-size: 14px; }
main { padding-block: 34px 36px; }

.intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 25px; }
.intro h1 { margin: 0; font-size: clamp(1.95rem, 3.6vw, 3.2rem); line-height: 1.12; letter-spacing: -.075em; }
.intro p { margin: 10px 0 0; color: var(--muted); line-height: 1.55; }
.export { display: inline-flex; flex-shrink: 0; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 19px; border: 0; border-radius: 8px; background: var(--navy); color: #fff; font-size: 15px; font-weight: 750; }
.export:not(:disabled):hover { background: #2c4365; }
.export svg { width: 19px; height: 19px; }

.workspace { display: grid; grid-template-columns: minmax(286px, 360px) minmax(0, 1fr); overflow: hidden; border: 1px solid var(--border); border-radius: 13px; background: #fffefa; }
.controls { min-width: 0; padding: 23px; border-right: 1px solid var(--border); }
.controls h2, .fields label { margin: 0; font-size: 15px; font-weight: 750; letter-spacing: -.025em; }
.source-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; margin: 12px 0 15px; padding: 4px; border: 1px solid var(--border); border-radius: 9px; background: #f0f2ec; }
.source-options button { min-height: 38px; padding: 5px 4px; border: 1px solid transparent; border-radius: 6px; background: transparent; font-size: 14px; font-weight: 700; }
.source-options button:hover { border-color: #b7c0b0; }
.source-options button[aria-pressed=true] { background: var(--navy); color: #fff; }
.source-panel { min-width: 0; }
#sample-panel, .upload { display: flex; align-items: center; gap: 11px; width: 100%; padding: 11px; border-radius: 8px; background: #f2f5f0; }
.source-icon { display: grid; flex: 0 0 36px; width: 36px; height: 36px; place-items: center; border-radius: 6px; background: #e2e8e1; color: #3d564a; }
.source-icon svg { width: 20px; height: 20px; }
.source-panel strong { font-size: 14px; }
.source-panel p, .source-panel small, .draw-controls { color: var(--muted); font-size: 13px; line-height: 1.45; }
#sample-panel p { margin: 2px 0 0; }
.upload { border: 1px dashed #a4b0aa; text-align: left; }
.upload:hover, .upload.is-dragging { border-color: var(--navy); background: #e9eeea; }
.upload small { display: block; margin-top: 2px; }
.file-name { margin: 7px 0 0; overflow-wrap: anywhere; }
.draw-help { margin: 0 0 7px; }
#draw-keys { margin: 5px 0 0; }
#draw-pad { display: block; width: 100%; height: auto; border: 1px solid #ccd6cf; border-radius: 8px; background: #f5f8f4; cursor: crosshair; touch-action: manipulation; }
.draw-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.draw-controls output { margin-right: auto; }
.draw-controls button { min-height: 32px; padding: 3px 6px; border: 1px solid var(--border); border-radius: 5px; background: #fff; font-size: 13px; }
.draw-controls button:not(:disabled):hover { border-color: #8b9a8c; }
.notice { margin: 9px 0 0; color: #9c3826; font-size: 13px; line-height: 1.5; }

.fields { display: grid; gap: 8px; padding-top: 19px; margin-top: 20px; border-top: 1px solid var(--border); }
.fields label:not(:first-child) { margin-top: 5px; }
.fields input { width: 100%; min-width: 0; height: 42px; padding: 0 10px; border: 1px solid var(--border); border-radius: 6px; background: #fff; color: inherit; font-size: 15px; }
.fields input:hover { border-color: #a7b2a9; }

.preview { display: grid; grid-template-rows: auto 1fr auto; min-width: 0; background-color: #e7eae4; background-image: radial-gradient(#6c827c45 .8px, transparent .8px); background-size: 16px 16px; }
.preview-header { min-height: 51px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 17px; border-bottom: 1px solid #dce2d9; background: #edf1eb; }
.preview-header h2 { margin: 0; font-size: 14px; font-weight: 750; }
.dimensions { color: #48544d; font-size: 12px; white-space: nowrap; }
.stage { display: grid; min-width: 0; place-items: center; padding: 22px; }
#poster { display: block; width: min(100%, 380px); height: auto; aspect-ratio: 4 / 5; background: var(--navy); box-shadow: 0 18px 37px #27342936, 0 2px 5px #27342929; }
.preview-note { margin: 0; padding: 0 12px 15px; color: #4d5a53; font-size: 13px; text-align: center; }

@media (max-width: 740px) {
  .shell { width: min(100% - 32px, 520px); }
  .header-inner { min-height: 53px; gap: 12px; }
  main { padding-top: 24px; }
  .intro { flex-wrap: wrap; align-items: flex-start; gap: 13px; margin-bottom: 17px; }
  .intro p { margin-top: 7px; }
  .export { min-height: 42px; padding-inline: 14px; }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .controls { padding: 17px; border: 0; border-bottom: 1px solid var(--border); }
  .stage { padding: 16px; }
  #poster { width: min(100%, 272px); }
}
