:root{color-scheme:light;--bg:#f5f5f4;--surface:#fff;--ink:#1d1d1d;--muted:#626262;--line:#d7d7d4;--soft:#efefed;--hover:#e8e8e5;--button:#1d1d1d;--button-ink:#fff;--error:#a32c32;--error-bg:#fbefef;--warning:#805310;--warning-bg:#faf3e5;font-family:Arial,Helvetica,sans-serif;font-size:16px}
:root[data-theme=dark]{color-scheme:dark;--bg:#111;--surface:#191919;--ink:#ededeb;--muted:#aaa;--line:#393939;--soft:#232323;--hover:#2d2d2d;--button:#e9e9e7;--button-ink:#161616;--error:#f0a4a8;--error-bg:#302024;--warning:#e4c28b;--warning-bg:#2c261c}
*{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--ink);line-height:1.5}button,input,select{font:inherit;color:inherit}button,a,label{touch-action:manipulation}button{cursor:pointer}button:disabled{cursor:default;opacity:.4}a{color:inherit;text-underline-offset:4px}svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round;flex-shrink:0}[hidden]{display:none!important}:focus-visible{outline:2px solid var(--ink);outline-offset:3px}.skip{position:absolute;left:20px;top:-60px;background:var(--surface);padding:10px;z-index:10}.skip:focus{top:12px}
.header,main,footer{max-width:1400px;margin:auto}.header{display:flex;align-items:center;justify-content:space-between;padding:20px 40px;border-bottom:1px solid var(--line);gap:16px}.brand{display:flex;align-items:center;gap:10px;font-size:1.25rem;font-weight:700;letter-spacing:-.04em;text-decoration:none}.brand-copy{display:flex;flex-direction:column;gap:2px}.brand-name{line-height:1.1;white-space:nowrap}.brand-name>span{font-weight:400}.brand-workspace{font-size:.6875rem;font-weight:400;letter-spacing:.07em;line-height:1.2;color:var(--muted)}.header-right{display:flex;align-items:center;gap:8px}.icon-button{border:0;background:transparent;width:44px;min-height:44px;padding:10px;border-radius:4px;display:inline-flex;align-items:center;justify-content:center;flex-shrink:0}.icon-button:hover{background:var(--hover)}.danger{color:var(--error)}.sun,[data-theme=dark] .moon{display:none}[data-theme=dark] .sun{display:block}
main{padding:28px 40px 0}.intro{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:24px;flex-wrap:wrap}h1{font-size:clamp(1.7rem,3vw,2.4rem);font-weight:500;letter-spacing:-.045em;line-height:1.2;margin:0}h2{font-size:1.25rem;letter-spacing:-.025em;line-height:1.3;margin:0 0 12px;font-weight:500}p{margin:0 0 16px}.subtle{color:var(--muted);margin:0}.small{font-size:.875rem}.eyebrow{font-size:.75rem;color:var(--muted);margin:0 0 8px;font-weight:600}.tools{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));border:1px solid var(--line);border-radius:6px;overflow:hidden;margin-bottom:20px;background:var(--surface)}.tools button{min-height:60px;display:flex;gap:9px;align-items:center;justify-content:center;border:0;border-right:1px solid var(--line);background:transparent;font-size:.875rem;padding:10px;min-width:0;overflow-wrap:anywhere}.tools button:last-child{border-right:0}.tools button:hover{background:var(--soft)}.tools button[aria-pressed=true]{background:var(--button);color:var(--button-ink)}.tool-symbol{display:flex;user-select:none;flex-shrink:0}.tool-symbol svg{width:20px;height:20px}
.workbench{display:grid;grid-template-columns:260px minmax(0,1fr);border:1px solid var(--line);border-radius:7px;background:var(--surface);height:clamp(460px,calc(100dvh - 275px),850px);overflow:hidden}.sidebar{min-width:0;min-height:0;overflow:auto;overscroll-behavior:contain;scrollbar-gutter:stable;border-right:1px solid var(--line);padding:22px 18px;display:flex;flex-direction:column;gap:18px}.section-label{display:flex;align-items:center;justify-content:space-between}.section-label h2{font-size:.875rem;font-weight:600;margin:0}.section-label span{color:var(--muted);font-size:.75rem;font-variant-numeric:tabular-nums}.drop{border:1px dashed #999;min-height:170px;padding:20px 10px;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;border-radius:4px;cursor:pointer;position:relative;gap:5px;flex-shrink:0}.drop:hover,.drop.drag-over{background:var(--soft)}.drop:focus-within,.button-label:focus-within{outline:2px solid var(--ink);outline-offset:3px}.drop svg{width:30px;height:30px;margin-bottom:9px}.drop strong{font-weight:500;font-size:.875rem}.drop>span{font-size:.875rem;color:var(--muted)}.drop .limit{font-size:.75rem;margin-top:8px}.drop input,.button-label input{position:absolute;width:1px;height:1px;opacity:0;overflow:hidden}.sources{display:flex;flex-direction:column;gap:12px}.source{display:grid;grid-template-columns:36px minmax(0,1fr) 44px;align-items:center;gap:8px}.source img{width:36px;height:48px;object-fit:contain;background:#fff;border:1px solid var(--line);border-radius:2px}.source-name{font-size:.8125rem;overflow-wrap:anywhere;line-height:1.35;margin:0 0 4px}.source-meta{font-size:.75rem;color:var(--muted);margin:0}.source .icon-button svg{width:18px;height:18px}.sidebar-note{font-size:.75rem;color:var(--muted);margin:0;line-height:1.65}
.main-panel{min-width:0;min-height:0;display:flex;flex-direction:column;overflow:hidden}.panel-scroll{padding:24px;flex:1;min-height:0;overflow:auto;scrollbar-gutter:stable;scroll-padding:16px}.panel-header{display:flex;justify-content:space-between;gap:18px;align-items:flex-start;margin-bottom:18px}.panel-header .subtle{font-size:.875rem;max-width:540px}.page-count{font-size:.75rem;color:var(--muted);white-space:nowrap;padding-top:2px;font-variant-numeric:tabular-nums}.quiet,.button-label{background:transparent;border:1px solid var(--line);border-radius:4px;min-height:44px;padding:8px 12px;font-size:.875rem;display:inline-flex;align-items:center;justify-content:center}.quiet:hover,.button-label:hover{background:var(--hover)}.primary{background:var(--button);color:var(--button-ink);border:1px solid var(--button);border-radius:4px;min-height:44px;padding:10px 18px;font-size:.875rem}.primary:hover{opacity:.84}.controls{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:16px}.selection-tools{display:flex;align-items:center;gap:10px;flex-wrap:wrap}.selection-tools>span{font-size:.75rem;color:var(--muted)}.history{display:flex;margin-left:auto}.options{display:flex;flex-wrap:wrap;align-items:end;gap:14px;padding:16px;background:var(--soft);border-radius:4px;margin-bottom:20px}.options label{display:flex;flex-direction:column;font-size:.75rem;gap:6px;min-width:0;flex:1 1 150px}.options p{width:100%;font-size:.75rem;line-height:1.7}input:not([type=file]):not([type=color]),select{background:var(--surface);color:var(--ink);border:1px solid var(--line);border-radius:4px;padding:8px 10px;min-height:44px;font-size:.875rem;max-width:100%;min-width:0}
.empty{min-height:280px;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;padding:24px}.empty p{font-size:.875rem;color:var(--muted);line-height:1.8;max-width:270px;margin:0}.empty-sheet{width:58px;height:74px;border:1px solid var(--line);border-radius:3px;padding:16px 12px;transform:rotate(-5deg);margin:0 0 22px;display:flex;flex-direction:column;gap:8px}.empty-sheet span{height:1px;background:var(--line)}.empty-sheet span:last-child{width:60%}.pages{display:grid;grid-template-columns:repeat(auto-fill,minmax(176px,1fr));gap:24px 18px;align-content:start}.page-card{position:relative;min-width:0;align-self:start}.page-preview{position:relative;background:var(--soft);border:1px solid var(--line);border-radius:4px;padding:13px;aspect-ratio:3/4;display:flex;align-items:center;justify-content:center;overflow:hidden;cursor:pointer}.page-preview[role=img]{cursor:grab}.page-card.selected .page-preview{outline:2px solid var(--ink);outline-offset:2px}.page-card.drag-target .page-preview{outline:2px dashed var(--muted)}.page-placeholder{width:100%;height:100%;display:flex;align-items:center;justify-content:center;color:var(--muted);font-size:.75rem;text-align:center}.page-preview img{max-height:100%;max-width:100%;background:white;object-fit:contain}.page-check{position:absolute;top:8px;left:8px;width:20px;height:20px;accent-color:var(--ink);margin:0;cursor:pointer;z-index:1}.page-meta{display:flex;align-items:center;justify-content:space-between;gap:4px;padding-top:10px;font-size:.75rem;color:var(--muted)}.page-meta strong{color:var(--ink);font-weight:500}.page-source{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin-top:3px;color:var(--muted);font-size:.75rem}.page-actions{display:flex;justify-content:space-between;margin-top:6px;gap:0}.page-actions svg{width:18px;height:18px}.edited{font-size:.75rem;border:1px solid var(--line);padding:1px 4px;border-radius:3px}.export-dock{flex-shrink:0;border-top:1px solid var(--line);background:var(--surface);padding:16px 24px}.export-bar{display:flex;align-items:end;justify-content:space-between;gap:16px}.export-bar>div{flex:1;max-width:350px;min-width:0}.export-bar input{width:100%}.filename-label{display:block;font-size:.75rem;color:var(--muted);margin-bottom:6px}.notice{border:1px solid var(--line);border-radius:4px;background:var(--soft);padding:12px 14px;font-size:.875rem;margin-bottom:18px;overflow-wrap:anywhere}.notice[data-kind=error]{background:var(--error-bg);border-color:var(--error)}.notice[data-kind=warning]{background:var(--warning-bg);border-color:var(--warning)}.notice-item{display:flex;flex-direction:column;gap:3px;line-height:1.65}.notice-item+.notice-item{margin-top:12px;padding-top:12px;border-top:1px solid var(--line)}.notice-file{font-weight:600;color:var(--ink)}.notice-reason{color:var(--muted)}.notice-item.error .notice-reason{color:var(--error)}.notice-item.warning .notice-reason{color:var(--warning)}.progress-row{display:flex;gap:12px;align-items:center;flex-wrap:wrap;margin-top:12px}.progress-row progress{width:120px;height:6px;accent-color:var(--ink)}.progress-row span{font-size:.75rem;color:var(--muted);flex:1;min-width:100px}
footer{padding:16px 40px 22px;display:flex;align-items:center;justify-content:space-between;gap:12px;font-size:.75rem;color:var(--muted)}footer>div{display:flex;gap:18px;align-items:center}footer a{display:inline-flex;align-items:center;min-height:44px;text-decoration:none}footer a:hover{text-decoration:underline}.footer-brand{flex-wrap:wrap;gap:8px 18px}.copyright{white-space:nowrap}.app-version{font-family:ui-monospace,SFMono-Regular,Consolas,monospace;font-size:.6875rem;font-weight:400;white-space:nowrap;margin-left:8px;color:var(--muted)}dialog{background:var(--surface);color:var(--ink);border:1px solid var(--line);border-radius:7px;padding:24px;width:min(480px,calc(100vw - 32px));max-height:calc(100dvh - 32px);box-shadow:0 20px 80px #0004;overflow:auto}dialog::backdrop{background:#0006}dialog p{color:var(--muted);font-size:.875rem;line-height:1.75}.dialog-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:12px}.dialog-heading h2{margin:0}.dialog-actions{display:flex;justify-content:end;gap:12px;margin-top:24px}.tooltip{position:fixed;z-index:1000;max-width:min(300px,calc(100vw - 20px));padding:7px 10px;background:var(--ink);color:var(--surface);border-radius:4px;font-size:.75rem;line-height:1.5;pointer-events:none}
.editor{width:min(1120px,calc(100vw - 32px));padding:22px}.editor-top{display:flex;justify-content:space-between;align-items:center;gap:14px}.editor-top h2{margin:0}.editor>.subtle{margin-top:14px}.editor-tools{display:flex;align-items:end;gap:10px;flex-wrap:wrap;margin:18px 0 8px}.editor-tools label{font-size:.75rem;display:flex;flex-direction:column;gap:5px;min-width:0}.editor-tools .button-label{position:relative;font-size:.875rem;flex-direction:row;margin:0}.editor-tools input[type=number]{width:95px}.editor-tools input[type=color]{height:44px;width:52px;padding:3px;border:1px solid var(--line);background:var(--surface);border-radius:4px}.editor-tools input[type=text]{max-width:180px}.editor-scroll{max-height:60dvh;overflow:auto;background:var(--soft);border:1px solid var(--line);padding:20px}.stage{position:relative;margin:auto;background:white;width:100%;touch-action:none}.stage canvas{display:block;width:100%;height:100%}.layers{position:absolute;inset:0;pointer-events:none}.layer{position:absolute;pointer-events:auto;cursor:move;touch-action:none;white-space:pre;line-height:1.2;border:1px dashed transparent;padding:0;background:transparent;color:#171717;font-family:Helvetica,Arial,sans-serif;min-width:10px;min-height:10px}.layer.active{border-color:#555;outline:1px solid white}.layer img{width:100%;height:100%;display:block;pointer-events:none}.legal{max-width:850px;padding-top:40px;padding-bottom:30px}.legal h1{margin-bottom:16px}.legal h2{margin-top:28px;font-weight:600}.legal p,.legal li{font-size:1rem;line-height:1.8;overflow-wrap:anywhere}.legal .updated{font-size:.875rem;color:var(--muted)}.legal ul{padding-left:24px}.back-link{display:inline-flex;align-items:center;gap:10px;min-height:44px}.missing{max-width:650px;min-height:75dvh;display:flex;flex-direction:column;justify-content:center;align-items:flex-start;gap:18px}.missing h1,.missing p{margin:0}.missing-art{width:150px;height:160px;color:var(--muted);stroke-width:1.2}
@media(max-width:1050px){.tools button{flex-direction:column;gap:5px}.workbench{grid-template-columns:230px minmax(0,1fr)}.header{padding:18px 28px}main{padding:24px 28px 0}footer{padding:14px 28px 20px}.panel-scroll{padding:20px}.export-dock{padding:16px 20px}}
@media(max-width:700px){.header{padding:16px 18px}main{padding:22px 18px 0}.intro{margin-bottom:18px}.intro .quiet{font-size:.75rem}.tools{grid-template-columns:repeat(3,minmax(0,1fr));margin-bottom:16px}.tools button{min-height:64px;gap:4px;font-size:.8125rem}.tools button:nth-child(3){border-right:0}.tools button:nth-child(-n+3){border-bottom:1px solid var(--line)}.workbench{grid-template-columns:1fr;height:auto}.sidebar{max-height:240px;border-right:0;border-bottom:1px solid var(--line);padding:16px;gap:12px}.drop{min-height:112px;padding:12px}.drop svg{display:none}.sidebar-note{display:none}.main-panel{height:clamp(440px,75dvh,850px)}.panel-scroll{padding:18px 14px}.panel-header{gap:10px}.panel-header .subtle{font-size:.8125rem}.pages{grid-template-columns:repeat(2,minmax(0,1fr));gap:20px 12px}.page-actions{flex-wrap:wrap;justify-content:flex-start}.page-actions .icon-button{width:25%;min-width:32px;padding:8px}.export-dock{padding:14px}.export-bar{gap:10px;flex-wrap:wrap}.export-bar .primary{padding:10px 12px}.export-bar>div{flex-basis:150px}.empty{min-height:240px}.options{padding:12px}.controls{align-items:flex-start}.selection-tools{gap:6px}.selection-tools>span{width:100%}footer{padding:14px 18px 22px;align-items:flex-start;flex-wrap:wrap}.editor{padding:16px;width:calc(100vw - 16px);max-height:calc(100dvh - 16px)}.editor-scroll{padding:8px;max-height:55dvh}.editor-tools{gap:8px}.editor-tools label:has(#layer-text){flex:1}.editor-tools input[type=text]{width:100%;max-width:none}.legal{padding-top:30px}.missing{min-height:80dvh}}
@media(max-width:360px){.pages{grid-template-columns:1fr}.page-actions{justify-content:space-between}.page-actions .icon-button{width:44px;min-width:44px}.export-bar>div,.export-bar .primary{flex-basis:100%;max-width:none}.brand{font-size:1.1rem}.header-right{gap:0}}
@media(prefers-reduced-motion:reduce){*{transition:none!important;scroll-behavior:auto!important}}
.tool-symbol{width:20px;height:20px}
.page-actions .icon-button{width:44px;min-width:44px}
@media(min-width:361px) and (max-width:700px){.page-actions{display:grid;grid-template-columns:repeat(2,44px);justify-content:space-between}}

@media (max-width:700px) {
  .workbench:has(#empty:not([hidden])) .main-panel {height:auto}
  .workbench:has(#empty:not([hidden])) .empty {min-height:80px}
  .workbench:has(#empty:not([hidden])) .empty-sheet {display:none}
  .sidebar:focus-within {outline-offset:-3px}
}

.tool-short {display:none}
.empty {padding:0;min-height:0;align-items:stretch}
.empty .drop {min-height:150px}
.panel-scroll.drag-over {outline:2px dashed var(--muted);outline-offset:-4px}
.panel-header .subtle {flex:1}
#add-next {white-space:nowrap}
@media (min-width:701px) {
  body:has(#workspace) {min-height:100dvh;display:grid;grid-template-rows:auto 1fr auto}
  body:has(#workspace) > :is(header,main,footer) {width:100%;margin:0 auto}
  #workspace {display:flex;flex-direction:column;min-height:0}
  #workspace .workbench {height:auto;min-height:330px;flex:1;grid-template-rows:minmax(0,1fr)}
  #workspace .panel-scroll,#workspace .sidebar {height:0;min-height:0}
  #workspace .sidebar {height:auto}
}
@media (max-width:700px) {
  .tools {display:flex;overflow-x:auto}
  .tools button {flex:1 0 auto;padding:6px 4px;min-height:52px;font-size:.75rem;white-space:nowrap}
  .tools button:nth-child(3) {border-right:1px solid var(--line)}
  .tools button:nth-child(-n+3) {border-bottom:0}
  .tool-short {display:inline}
  .tool-full {display:none}
}

.workbench:has(#sources:empty) {grid-template-columns:minmax(0,1fr)}
.sidebar:has(#sources:empty) {display:none}
.panel-scroll:has(> #empty:not([hidden])) {display:flex;flex-direction:column}
.panel-scroll:has(> #empty:not([hidden])) > * {flex-shrink:0}
#empty {flex:1 0 auto}
#empty .drop {flex:1 0 auto}
#pages:empty {display:none}
