:root{--paper:#f8f6f1;--surface:#fffefa;--ink:#272923;--muted:#75776e;--line:#dfdfd5;--accent:#ad462f;--accent-dark:#913923;--accent-pale:#f5e5dc;--green:#466956;--canvas:#e9e9e0;--shadow:0 10px 36px #24271b17;--r:12px;font-family:system-ui,-apple-system,"Noto Sans JP","Noto Sans CJK JP",sans-serif;color:var(--ink);background:var(--paper);font-size:14px;-webkit-tap-highlight-color:transparent}
*{box-sizing:border-box}body{margin:0;height:100vh;height:100dvh;display:flex;flex-direction:column;overflow:hidden}button,input,textarea,select{font:inherit}button{cursor:pointer;color:inherit;border:1px solid var(--line);border-radius:9px;background:var(--surface);min-height:42px;padding:9px 12px;display:inline-flex;justify-content:center;align-items:center;gap:7px;font-weight:550;line-height:1.25}button:hover{background:#f0f0e8}button:active{transform:translateY(1px)}button:disabled{opacity:.35;cursor:not-allowed;transform:none}button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible{outline:3px solid #ad462f88;outline-offset:2px}.primary{background:var(--accent);color:white;border-color:var(--accent)}.primary:hover{background:var(--accent-dark)}.danger{color:#aa3629}.quiet{background:transparent}.icon-btn{width:40px;min-width:40px;height:40px;min-height:40px;border:0;background:transparent;padding:9px}.icon{width:20px;height:20px;display:block;flex-shrink:0;stroke-width:1.8}.icon-btn[aria-pressed=true]{background:var(--accent-pale);color:var(--accent)}button .icon{pointer-events:none}.app-header{height:78px;min-height:78px;padding:0 26px;display:flex;align-items:center;gap:36px;border-bottom:1px solid var(--line);background:var(--paper);z-index:4}.brand{display:flex;gap:10px;align-items:center;text-decoration:none;color:var(--ink);letter-spacing:-1.5px;font-size:27px;font-weight:850;line-height:1}.brand-sub{display:block;font-size:9px;letter-spacing:3.8px;font-weight:650;margin-top:5px;margin-left:2px}.brand-symbol{display:grid;grid-template-columns:19px 12px;grid-template-rows:13px 19px;gap:3px;width:34px;height:35px;transform:rotate(-5deg)}.brand-symbol i{background:var(--ink);border-radius:1px}.brand-symbol i:first-child{grid-column:span 2;background:var(--accent)}.doc-heading{display:flex;flex-direction:column;gap:3px;min-width:0;flex:1}.doc-heading input{font-weight:650;font-size:15px;max-width:460px;padding:2px 0;background:transparent;border:0;color:var(--ink);width:100%;min-width:0}.save-status{font-size:10px;color:var(--green);letter-spacing:.2px}.header-actions{display:flex;gap:12px;align-items:center}.export-top{padding:11px 18px;min-height:44px}.workspace{display:grid;grid-template-columns:234px minmax(0,1fr) 306px;flex:1;min-height:0}.preset-sidebar{display:flex;flex-direction:column;border-right:1px solid var(--line);min-height:0;background:var(--paper)}.sidebar-head{padding:26px 20px 18px}.eyebrow{font-size:9px;letter-spacing:1.8px;font-weight:700;color:var(--muted);line-height:1.5}.sidebar-head h1{font-size:21px;letter-spacing:-1px;margin:8px 0}.sidebar-head p{font-size:11px;color:var(--muted);margin:0}.filter-row{display:flex;flex-wrap:wrap;gap:5px;padding:0 14px 16px}.filter-row button{font-size:10px;min-height:30px;padding:6px 9px;border-radius:20px;background:transparent;border-color:transparent}.filter-row button.active{color:var(--accent);border-color:#dbb7a5;background:var(--accent-pale)}.preset-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px 12px;overflow-y:auto;align-content:start;min-height:0;padding:0 16px 24px}.preset-card{display:flex;flex-direction:column;gap:8px;min-width:0;background:transparent;padding:0;border:0;text-align:left;justify-content:flex-start;position:relative;align-items:stretch}.preset-card:hover{background:transparent}.preset-card svg{display:block;width:100%;height:124px;background:#fffdf7;padding:10px;border:1px solid var(--line);border-radius:7px;transition:border-color .15s,box-shadow .15s}.preset-card:hover svg{border-color:var(--accent)}.preset-card.active svg{border:2px solid var(--accent);box-shadow:0 0 0 3px var(--accent-pale)}.preset-name{font-size:10px;font-weight:600;line-height:1.5}.preset-sub{font-size:9px;color:var(--muted);font-weight:400}.preset-card.active:after{content:'✓';position:absolute;top:5px;right:5px;display:grid;place-items:center;border-radius:50%;height:17px;width:17px;background:var(--accent);color:white;font-size:11px}.sidebar-footer{margin-top:auto;border-top:1px solid var(--line);display:flex;align-items:center;gap:5px;font-size:9px;color:var(--muted);padding:8px 12px;min-height:45px}.status-dot{width:5px;height:5px;border-radius:50%;background:var(--green);flex-shrink:0}.sidebar-footer button{margin-left:auto;border-radius:50%;width:25px;min-height:25px;height:25px;padding:0;background:transparent}.canvas-section{display:flex;flex-direction:column;position:relative;min-width:0;min-height:0;background:var(--canvas);background-image:radial-gradient(#afb29f55 .6px,transparent .6px);background-size:12px 12px}.canvas-toolbar{height:55px;min-height:55px;display:flex;align-items:center;justify-content:space-between;padding:0 15px;border-bottom:1px solid #d9dace;background:#eeeee6}.tool-group{display:flex;align-items:center;gap:3px}.tool-separator{width:1px;height:20px;background:#d0d2c4;margin:0 7px}.page-meta{font-size:9px;letter-spacing:1px;font-weight:650;color:#757868}.meta-divider{margin:0 7px;color:#a0a391}.canvas-viewport{flex:1;min-height:0;min-width:0;overflow:auto;overscroll-behavior:contain;position:relative;padding:24px;display:block;touch-action:pan-x pan-y}.page-holder{margin:auto;background:white;box-shadow:var(--shadow);position:relative;flex-shrink:0}.page-holder svg{display:block;width:100%;height:100%;touch-action:none;user-select:none;-webkit-user-select:none}.page-holder svg.pan-mode{touch-action:pan-x pan-y}.canvas-bottom{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:7px 20px 12px;min-height:48px}.canvas-hint{font-size:10px;color:#636856;line-height:1.5}.zoom-bar{display:flex;align-items:center;background:var(--paper);border-radius:8px;box-shadow:0 2px 8px #24271b0c}.zoom-bar button{border:0;background:transparent;border-radius:7px;min-width:34px;min-height:33px;padding:4px;font-size:14px}.zoom-bar #zoomFit{font-size:10px;min-width:45px}.inspector{background:var(--surface);border-left:1px solid var(--line);min-height:0;display:flex;flex-direction:column;min-width:0}.inspector-head{padding:25px 22px 12px}.inspector-heading{display:flex;align-items:center;justify-content:space-between;margin-top:5px}.inspector h2{font-size:18px;letter-spacing:-.5px;margin:0}.pill{padding:4px 9px;border:1px solid #d9c3b7;color:var(--accent);background:#fbf1e8;font-size:12px;font-weight:700;border-radius:6px;font-variant-numeric:tabular-nums}.inspector-scroll{padding:5px 22px 24px;overflow-y:auto;min-height:0;overscroll-behavior:contain}.field{margin:16px 0}.field label,.field-label{display:flex;align-items:center;justify-content:space-between;margin-bottom:8px;font-size:11px;font-weight:650;gap:8px}.field small,.helper{font-size:10px;line-height:1.75;color:var(--muted)}.helper{margin:10px 0}.field input:not([type=range]):not([type=checkbox]):not([type=color]),.field select,.field textarea{width:100%;border:1px solid var(--line);border-radius:8px;background:#fffefa;padding:9px 10px;color:var(--ink);min-height:42px}.field textarea{resize:vertical;min-height:100px;font-size:13px;line-height:1.7}.field input[type=range]{width:100%;accent-color:var(--accent);height:26px;margin:1px 0}.field output{color:var(--accent);font-variant-numeric:tabular-nums;font-weight:650;font-size:11px}.field-inline{display:grid;grid-template-columns:1fr 1fr;gap:10px}.field-inline .field{margin:10px 0}.segmented{display:flex;padding:3px;background:#eeeee6;border-radius:9px;gap:3px}.segmented button{flex:1;min-width:0;border:0;background:transparent;font-size:11px;padding:8px 5px;min-height:37px}.segmented button.active{background:var(--surface);box-shadow:0 1px 4px #0000000c;color:var(--accent)}.button-row{display:flex;gap:8px;flex-wrap:wrap}.button-row>*{flex:1;white-space:nowrap;font-size:11px;min-width:66px}.section-rule{border:0;height:1px;background:var(--line);margin:20px 0}.section-caption{font-size:11px;font-weight:700;margin:15px 0 10px;display:flex;align-items:center;justify-content:space-between}.wide{width:100%}.subtle-card{border:1px solid var(--line);background:#f7f7f0;border-radius:9px;padding:12px;font-size:10px;line-height:1.8}.vertex-grid{display:grid;grid-template-columns:30px 1fr 1fr;gap:6px;align-items:center;margin:7px 0}.vertex-grid label{font-size:10px;color:var(--muted)}.vertex-grid input{width:100%;min-width:0;padding:7px 5px;border:1px solid var(--line);border-radius:6px;font-size:11px;min-height:36px;background:white}.vertex-grid .vertex-label{color:var(--accent);font-weight:700}.check-field{display:flex;align-items:center;gap:9px;font-size:11px;min-height:38px;cursor:pointer}.check-field input{width:18px;height:18px;accent-color:var(--accent)}.mode-nav{height:63px;min-height:63px;background:var(--paper);border-top:1px solid var(--line);display:flex;justify-content:center;gap:8px;padding:4px 20px max(4px,env(safe-area-inset-bottom));z-index:4}.mode-nav button{display:flex;flex-direction:column;gap:4px;min-width:100px;padding:6px 14px;border:0;background:transparent;color:#74776c;font-size:9px;border-radius:9px;min-height:50px}.mode-nav button .icon{width:20px;height:20px}.mode-nav button.active{color:var(--accent);background:var(--accent-pale)}.mobile-only{display:none}.panel-hit{cursor:pointer}.vertex-handle{cursor:crosshair}.edge-handle{cursor:move}.mode-draw .panel-hit{cursor:crosshair}.mode-move .panel-hit{cursor:move}.mode-split .panel-hit{cursor:crosshair}.order-list{display:flex;gap:5px;flex-wrap:wrap;margin:12px 0}.order-list button{font-size:11px;min-height:34px;min-width:35px;padding:6px}.order-list button.active{background:var(--accent-pale);border-color:var(--accent);color:var(--accent)}.drawing-colors{display:flex;gap:10px}.swatch{width:34px;min-height:34px;height:34px;border-radius:50%;padding:0;background:var(--swatch)!important;border:3px solid white;box-shadow:0 0 0 1px var(--line)}.swatch.active{box-shadow:0 0 0 2px var(--accent)}.swatch[aria-pressed=true]:after{content:'✓';color:white;text-shadow:0 1px 2px #000}.brush-toolbar{display:flex;gap:7px}.brush-toolbar button{flex:1;font-size:11px}.brush-toolbar .active{border-color:var(--accent);background:var(--accent-pale);color:var(--accent)}.warning-note{color:#8b452a;background:#fff4df;border:1px solid #edce99;padding:10px;border-radius:8px;font-size:10px;line-height:1.7}.empty-note{text-align:center;padding:24px 8px;font-size:12px;line-height:1.8;color:var(--muted)}.count-label{font-size:10px;color:var(--muted);text-align:right;margin-top:4px;font-variant-numeric:tabular-nums}.toast{position:fixed;bottom:82px;left:50%;transform:translate(-50%,15px);background:#292e27;color:#fffdf6;padding:12px 18px;border-radius:12px;font-size:12px;line-height:1.6;box-shadow:0 8px 30px #0002;z-index:80;max-width:min(90vw,480px);width:max-content;pointer-events:none;opacity:0;transition:.15s}.toast.show{opacity:1;transform:translate(-50%,0)}.storage-warning{background:#fff0d2;color:#713d21;padding:8px 16px;font-size:11px;line-height:1.6;z-index:3}.storage-warning[hidden]{display:none}dialog{border:1px solid var(--line);border-radius:18px;padding:0;background:var(--surface);color:var(--ink);width:min(660px,calc(100vw - 28px));max-height:min(87dvh,850px);box-shadow:0 24px 100px #0003;overflow:hidden}dialog::backdrop{background:#22281d66;backdrop-filter:blur(3px)}.modal-head{padding:22px 24px 16px;border-bottom:1px solid var(--line);display:flex;align-items:center;justify-content:space-between;gap:12px}.modal-head h2{margin:5px 0 0;font-size:21px}.modal-body{padding:20px 24px 28px;overflow-y:auto;max-height:calc(87dvh - 95px)}.modal-body .filter-row{padding:0 0 20px}.modal-body .preset-grid{grid-template-columns:repeat(4,minmax(0,1fr));padding:0 3px 15px;overflow:visible}.modal-body .preset-card svg{height:150px}.modal-body .preset-name{font-size:11px}.confirm-inner{padding:24px}.confirm-inner h2{font-size:19px;margin-top:0}.confirm-inner p{font-size:13px;line-height:1.8;white-space:pre-line;margin-bottom:24px}#confirmModal{width:min(420px,calc(100vw - 32px));z-index:100}.export-card{display:grid;grid-template-columns:72px 1fr;gap:16px;border:1px solid var(--line);border-radius:12px;padding:14px;margin-bottom:12px;align-items:center}.export-card .icon{width:28px;height:28px}.export-card h3{font-size:13px;margin:0 0 6px}.export-card p{font-size:11px;line-height:1.7;color:var(--muted);margin:0}.export-sample{height:95px;border:1px solid var(--line);background:white;border-radius:3px;padding:5px;display:flex;align-items:center;justify-content:center}.export-sample svg{width:100%;height:100%}.export-options{display:grid;grid-template-columns:1fr 1fr;gap:14px}.export-footer{display:flex;gap:8px;position:sticky;bottom:-28px;background:var(--surface);border-top:1px solid var(--line);margin:18px -24px -28px;padding:16px 24px}.export-footer button{flex:1}.export-preview{background:var(--canvas);padding:18px;border-radius:10px;display:flex;justify-content:center;margin-bottom:16px}.export-preview img{max-width:100%;max-height:230px;object-fit:contain;box-shadow:0 3px 15px #0002}.project-row{display:flex;align-items:center;gap:10px;border-bottom:1px solid var(--line);padding:12px 0}.project-thumb{width:44px;height:62px;background:white;border:1px solid var(--line);padding:4px;flex-shrink:0}.project-thumb svg{width:100%;height:100%}.project-info{flex:1;min-width:0}.project-info strong{font-size:13px;display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.project-info small{display:block;margin-top:5px;font-size:10px;color:var(--muted)}.project-row button{font-size:11px;min-width:40px}.help-step{display:grid;grid-template-columns:30px 1fr;gap:12px;margin:20px 0}.help-step>span{font-size:12px;font-weight:700;color:var(--accent);background:var(--accent-pale);height:28px;border-radius:50%;display:grid;place-items:center}.help-step h3{margin:3px 0 6px;font-size:14px}.help-step p{font-size:12px;line-height:1.9;margin:0;color:#63665c}.prompt-box{width:100%;min-height:260px;resize:vertical;border:1px solid var(--line);padding:12px;line-height:1.8;font-size:12px;background:#faf9f4;color:var(--ink);border-radius:8px}.custom-delete{font-size:10px;color:var(--accent);min-height:30px;padding:5px 10px;margin:4px 0}.select-row{display:flex;gap:6px;align-items:center}.select-row select{min-width:0}.control-note{font-size:9px;color:var(--muted);line-height:1.65}.no-select{user-select:none}
@media (min-width:1500px){.workspace{grid-template-columns:264px minmax(0,1fr) 330px}.sidebar-head{padding-left:25px}.preset-grid{padding-left:22px;padding-right:22px;gap:20px 18px}.preset-card svg{height:145px}}
@media (max-width:1050px) and (min-width:761px){.workspace{grid-template-columns:180px minmax(0,1fr) 266px}.sidebar-head{padding:23px 14px 17px}.sidebar-head h1{font-size:17px}.sidebar-head p{font-size:10px}.preset-grid{padding:0 12px 20px;gap:14px 8px}.preset-card svg{height:96px;padding:6px}.preset-name{font-size:9px}.filter-row{padding-left:10px;padding-right:10px}.inspector-scroll{padding-left:16px;padding-right:16px}.inspector-head{padding-left:16px;padding-right:16px}.page-meta{display:none}.canvas-viewport{padding:20px}.canvas-hint{max-width:140px;font-size:9px}.app-header{padding:0 20px;gap:26px}}
@media(max-width:760px){
 .app-header{height:66px;min-height:66px;padding:0 14px;gap:16px}.brand{font-size:22px;gap:6px}.brand-sub{font-size:7px;letter-spacing:3px}.brand-symbol{width:26px;height:29px;grid-template-columns:14px 9px;grid-template-rows:11px 15px;gap:3px}.doc-heading input{font-size:12px}.save-status{font-size:9px}.header-actions{gap:2px}.header-actions .icon-btn{width:35px;min-width:35px}.export-top{font-size:11px;min-height:38px;padding:9px 10px;gap:5px}.export-top .icon{width:16px;height:16px}.workspace{display:flex;flex-direction:column}.preset-sidebar{display:none}.canvas-section{flex:1;min-height:160px}.canvas-toolbar{height:44px;min-height:44px;padding:0 10px}.canvas-toolbar .icon-btn{width:36px;min-width:36px;height:36px;min-height:36px;padding:8px}.tool-group{gap:0}.tool-separator{margin:0 5px;height:18px}.page-meta{font-size:8px;margin-left:auto;letter-spacing:.6px;margin-right:7px}.meta-divider{margin:0 4px}.mobile-only{display:inline-flex}.canvas-viewport{padding:16px 20px 12px}.canvas-bottom{padding:3px 12px 7px;min-height:39px}.canvas-hint{font-size:9px;max-width:65%;line-height:1.6}.zoom-bar button{min-height:30px;height:30px;min-width:31px}.zoom-bar #zoomFit{min-width:40px}.inspector{border-left:0;border-top:1px solid var(--line);height:254px;max-height:38dvh;min-height:110px;flex-shrink:0;transition:height .16s ease}.inspector-head{padding:12px 18px 6px;display:flex;gap:12px;align-items:center;justify-content:space-between}.inspector-head .eyebrow{display:none}.inspector-heading{margin:0;flex:1}.inspector h2{font-size:14px}.pill{font-size:10px;padding:3px 8px}.inspector-scroll{padding:3px 18px 15px;flex:1}.inspector .field{margin:11px 0}.inspector .field-inline .field{margin:5px 0}.section-rule{margin:15px 0}.section-caption{margin:12px 0 8px}.mode-nav{height:65px;min-height:65px;justify-content:space-around;gap:0;padding-left:5px;padding-right:5px}.mode-nav button{min-width:0;flex:1;padding:5px 3px;max-width:90px;font-size:9px;gap:4px}.mode-nav button .icon{width:21px;height:21px}body.inspector-collapsed .inspector{height:0;min-height:0;border:0;overflow:hidden}body.inspector-collapsed #collapseBtn .icon{transform:rotate(180deg)}.modal-head{padding:17px 18px 14px}.modal-head h2{font-size:18px}.modal-body{padding:16px 18px 22px}.modal-body .preset-grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:16px 12px}.modal-body .preset-card svg{height:132px;padding:9px}.modal-body .preset-name{font-size:10px}.modal-body .filter-row button{font-size:11px;min-height:35px}.export-footer{margin:18px -18px -22px;bottom:-22px;padding:14px 18px}.export-options{gap:10px}.export-card{grid-template-columns:60px 1fr;padding:12px;gap:12px}.field textarea{font-size:16px}.prompt-box{font-size:13px}dialog{max-height:90dvh}.modal-body{max-height:calc(90dvh - 87px)}.button-row>*{min-height:40px}.swatch{min-height:36px;height:36px;width:36px}.vertex-grid input{min-height:40px;font-size:13px}.field-label,.field label{font-size:12px}.helper{font-size:11px}.order-list button{min-height:40px;min-width:40px}.segmented button{min-height:40px;font-size:12px}.check-field{font-size:12px;min-height:42px}
}
@media(max-width:370px){.app-header{padding:0 9px;gap:9px}.brand{font-size:20px}.brand-symbol{display:none}.doc-heading input{font-size:11px}.header-actions{gap:0}.export-top{padding:9px 8px}.page-meta{font-size:7px}.canvas-hint{max-width:57%}.modal-body .preset-card svg{height:110px}.mode-nav button{font-size:8px}}
@media(max-height:650px) and (max-width:760px){.inspector{height:185px;max-height:32dvh}.canvas-viewport{padding:9px 15px}.app-header{height:57px;min-height:57px}.mode-nav{height:59px;min-height:59px}.canvas-bottom{min-height:32px;padding-bottom:4px}.canvas-toolbar{height:39px;min-height:39px}.inspector-head{padding-top:8px}.modal-body{max-height:calc(90dvh - 76px)}}
@media(max-height:500px) and (min-width:600px){.app-header{height:54px;min-height:54px}.preset-sidebar{display:none}.workspace{display:grid;grid-template-columns:minmax(0,1fr) 290px}.inspector{height:auto;max-height:none;border-left:1px solid var(--line)}.inspector-head{padding:12px 16px 8px}.inspector .eyebrow{display:none}.inspector-scroll{padding:0 16px 20px}.canvas-section{min-height:0}.mode-nav{height:52px;min-height:52px}.mode-nav button{min-height:43px;gap:1px}.mode-nav button .icon{width:18px;height:18px}.canvas-viewport{padding:10px}.mobile-only{display:none}body.inspector-collapsed .inspector{height:auto;min-height:0;border-left:1px solid var(--line)}.canvas-toolbar{height:40px;min-height:40px}.canvas-bottom{min-height:36px;padding-bottom:6px}}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{transition:none!important;scroll-behavior:auto!important}}

/* Keep preset thumbnails at their intrinsic height when the sidebar overflows. */
.preset-grid{grid-auto-rows:max-content;align-items:start}.preset-sidebar>.preset-grid{flex:1}.preset-card svg{flex-shrink:0}.save-status{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
