:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  color: #232620;
  background: #f8f7f2;
  font-synthesis: none;
  --ink: #232620;
  --muted: #606459;
  --line: #e0e1d7;
  --accent: #a63d28;
  --panel: #fffefa;
}

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

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

main { padding-block: 34px 36px; }
.intro { display: flex; justify-content: space-between; gap: 24px; align-items: flex-end; 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; line-height: 1.55; color: var(--muted); }
.export { display: inline-flex; align-items: center; justify-content: center; gap: 8px; flex-shrink: 0; min-height: 47px; padding: 0 20px; border: 0; border-radius: 8px; background: #29362e; color: #fff; font-size: 15px; font-weight: 700; }
.export:not(:disabled):hover { background: #3c4f42; }
.export svg { width: 19px; height: 19px; }

.editor { display: grid; grid-template-columns: minmax(280px, 326px) minmax(0, 1fr); border: 1px solid var(--line); border-radius: 13px; overflow: hidden; background: var(--panel); }
.controls { min-width: 0; padding: 23px; border-right: 1px solid var(--line); }
.control-group + .control-group { border-top: 1px solid var(--line); margin-top: 20px; padding-top: 19px; }
.control-group h2, .fields label { margin: 0; font-size: 15px; font-weight: 750; letter-spacing: -.025em; }
.group-heading { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 11px; }
.text-button { padding: 3px 0; border: 0; background: transparent; color: var(--muted); font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }
.text-button:not(:disabled):hover { color: var(--accent); }
.upload { display: flex; width: 100%; gap: 11px; align-items: center; padding: 11px; text-align: left; border: 1px dashed #bbbfb0; border-radius: 8px; background: #f7f7f0; }
.upload:hover, .upload.is-dragging { background: #eef0e7; border-color: #677763; }
.upload-icon { display: grid; place-items: center; width: 37px; height: 37px; flex: 0 0 37px; border-radius: 6px; background: #e6e9dc; color: #39473a; }
.upload-icon svg { width: 20px; height: 20px; }
.upload strong, .upload small { display: block; }
.upload strong { font-size: 14px; }
.upload small, .photo-name { color: var(--muted); font-size: 13px; }
.upload small { margin-top: 3px; }
.photo-name { margin: 8px 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.layouts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.layout { padding: 5px 5px 8px; min-width: 0; border: 1px solid var(--line); border-radius: 7px; background: #faf9f5; font-size: 13px; font-weight: 650; }
.layout:hover { border-color: #7f887a; }
.layout[aria-pressed=true] { border-color: #536752; background: #ebefe6; box-shadow: inset 0 0 0 1px #536752; }
.layout-art { position: relative; display: block; height: 45px; margin-bottom: 6px; border-radius: 3px; overflow: hidden; background: #e8e5d9; }
.layout-art::before, .layout-art::after { position: absolute; content: ''; }
.layout-art::before { background: center / cover url('./dolomites.jpg'); }
.layout-art::after { height: 2px; border-radius: 1px; }
.gallery::before { inset: 5px 11px 14px; }
.gallery::after { background: #565b4b; inset: auto 50% 9px 11px; }
.cinema::before { inset: 0; background-image: linear-gradient(transparent 40%, #1d2923), url('./dolomites.jpg'); }
.cinema::after { background: #f0e8d4; inset: auto 43% 8px 7px; }
.color { background: #afbd9d; }
.color::before { inset: 20px 7px 5px 23px; }
.color::after { background: #344736; inset: 9px 38% auto 8px; }

#color-value { font: 12px ui-monospace, SFMono-Regular, Consolas, monospace; color: var(--muted); }
.swatches { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; min-height: 34px; }
.swatch { height: 34px; border: 1px solid #0003; border-radius: 6px; position: relative; background: var(--swatch); color: var(--swatch-ink); }
.swatch[aria-pressed=true] { outline: 1px solid var(--ink); outline-offset: 2px; }
.swatch[aria-pressed=true]::after { content: '✓'; font-size: 15px; font-weight: 800; }

.fields { display: grid; gap: 8px; }
.fields label:not(:first-child) { margin-top: 4px; }
.fields input { min-width: 0; height: 40px; border: 1px solid var(--line); border-radius: 6px; padding: 0 10px; background: #fff; color: var(--ink); font-size: 15px; }
.fields input:hover { border-color: #abb0a1; }

.preview { display: grid; grid-template-rows: auto 1fr auto; min-width: 0; background-color: #e7e9df; background-image: radial-gradient(#747b644a .8px, transparent .8px); background-size: 16px 16px; }
.preview-header { display: flex; min-height: 51px; justify-content: space-between; align-items: center; gap: 12px; padding: 0 19px; background: #f1f2e9; border-bottom: 1px solid #dce0d1; }
.preview-header h2 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 14px; font-weight: 750; }
.preview-header h2 span { width: 7px; aspect-ratio: 1; border-radius: 50%; background: #526a50; }
.dimensions { font-size: 12px; color: #50584b; font-variant-numeric: tabular-nums; }
.dimensions span { margin-inline: 2px; }
.stage { display: grid; place-items: center; padding: 25px; min-width: 0; }
#poster { display: block; width: min(100%, 392px); height: auto; aspect-ratio: 4 / 5; background: #eee6d7; box-shadow: 0 18px 38px #27342b33, 0 2px 5px #27342b2b; }
.preview-note { margin: 0; padding: 0 16px 16px; text-align: center; font-size: 13px; color: #4d584b; }
.notice { position: fixed; z-index: 2; bottom: 14px; right: 14px; max-width: min(400px, calc(100vw - 28px)); margin: 0; padding: 12px 15px; border-radius: 8px; background: #28362e; color: white; font-size: 14px; box-shadow: 0 4px 20px #24302726; }

@media (max-width: 760px) {
  .header-inner, main { 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; }
  .editor { grid-template-columns: minmax(0, 1fr); }
  .preview { grid-row: 1; }
  .stage { padding: 16px; }
  #poster { width: min(100%, 258px); }
  .controls { border-right: 0; border-top: 1px solid var(--line); padding: 19px; }
}
