:root{--bg:#090c1e;--bg2:#10142c;--glass:#111630;--stroke:#27304e;--muted:#9faecd;--text:#eef2ff;--accent:#8d68ff;--cyan:#45cdf2;--shadow:0 24px 70px rgba(0,0,0,.32)}
*{box-sizing:border-box}html,body{margin:0;min-height:100%;background:var(--bg);color:var(--text);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif}body{min-height:100dvh}button,select{font:inherit}button{cursor:pointer}button:disabled{opacity:.45;cursor:not-allowed}button:focus-visible,select:focus-visible,a:focus-visible{outline:2px solid #77e1ff;outline-offset:3px}svg{height:18px;width:18px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}[hidden]{display:none!important}
.app{min-height:100dvh;display:flex;flex-direction:column;background:radial-gradient(70% 60% at 3% -14%,rgba(64,60,161,.21),transparent 72%),var(--bg)}
.topbar{height:86px;flex:none;display:flex;align-items:center;justify-content:space-between;gap:20px;padding:14px clamp(15px,3.6vw,50px);border-bottom:1px solid var(--stroke);background:rgba(8,11,26,.95)}.identity{display:flex;align-items:center;gap:13px}.brand-icon{width:52px;height:52px;object-fit:contain;border-radius:15px;box-shadow:0 5px 20px rgba(53,67,173,.15)}.app-title{font-weight:750;font-size:20px;line-height:1.1;letter-spacing:.01em}.app-title span{color:#a9b7dc;font-weight:450}.app-subtitle{margin-top:6px;color:var(--muted);font-size:12px}.toolbar{display:flex;align-items:center;gap:9px;flex-wrap:wrap}.btn{border:1px solid var(--stroke);color:var(--text);background:#1b2343;padding:11px 15px;border-radius:11px;display:inline-flex;justify-content:center;align-items:center;gap:9px;font-size:13px;font-weight:650;white-space:nowrap;min-height:42px;transition:background .16s}.btn:hover:not(:disabled){background:#242e54}.btn-accent{background:linear-gradient(112deg,#7251d8,#8854d9);border-color:#9677ea;color:#fff}.btn-accent:hover:not(:disabled){background:#8c69e7}.btn-outline{border-color:#495172;background:#161e37}.btn.full{width:100%;padding:13px}
.workspace{flex:1;min-height:0;display:flex;justify-content:center;padding:20px clamp(15px,3.6vw,50px) 24px}.document-space{display:flex;flex-direction:column;width:min(100%,1190px);min-height:calc(100dvh - 132px);border:1px solid #252e4d;border-radius:18px;background:#10162d;box-shadow:var(--shadow);overflow:hidden}.document-space.dragging{outline:2px dashed var(--cyan)}.document-bar{padding:12px 20px;min-height:62px;display:flex;justify-content:space-between;align-items:center;gap:12px;border-bottom:1px solid var(--stroke);background:#151b34}.document-name-group{display:flex;align-items:center;gap:10px;min-width:0}.document-name-group strong{font-size:13px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.format-pill{flex:none;font-size:10px;color:#cebbff;background:#34265c;border:1px solid #5d477f;padding:5px 7px;border-radius:6px;font-weight:800}.doc-meta{font-size:12px;color:#9ca9c2;white-space:nowrap}.document-bar-actions{display:flex;flex:none;align-items:center;gap:5px}.text-button,.icon-button{font-size:12px;border:0;background:transparent;color:var(--muted);padding:8px 10px;border-radius:8px}.text-button.selected,.text-button:hover,.icon-button:hover{background:#293253;color:var(--text)}.icon-button{font-size:21px;line-height:15px}.canvas-stage{flex:1;min-height:410px;overflow:auto;display:flex;justify-content:center;align-items:flex-start;background:radial-gradient(circle at 50% 35%,#202747 0,#10172f 70%);padding:clamp(18px,3vw,34px);position:relative}.empty-state{margin:auto;max-width:460px;display:flex;flex-direction:column;align-items:center;text-align:center;padding:26px 8px}.empty-symbol{width:112px;height:112px;border-radius:26px;box-shadow:0 0 44px rgba(110,80,225,.16);margin-bottom:16px}.empty-symbol img{border-radius:26px}.empty-state h1{font-size:clamp(26px,4vw,34px);margin:12px 0 8px;letter-spacing:-.03em}.empty-state p{color:#acb9d4;line-height:1.6;font-size:14px;margin:0 0 22px}.format-hint{font-size:11px;letter-spacing:.14em;color:#8997b5;margin-top:23px}.view-surface{width:100%;max-width:920px;min-height:100%;display:flex;align-items:flex-start;justify-content:center}.pdf-surface{width:100%;display:flex;align-items:center;justify-content:center}.paper-frame{display:flex;justify-content:center;width:100%}.paper-frame canvas{width:auto;max-width:100%;height:auto;display:block;box-shadow:0 22px 40px rgba(0,0,0,.28);background:white}.text-paper{width:min(100%,760px);min-height:850px;background:#fff;color:#1e2433;border-radius:2px;box-shadow:0 20px 50px rgba(0,0,0,.28);padding:clamp(26px,5vw,62px);font-family:Georgia,"Times New Roman",serif;font-size:16px;line-height:1.55;overflow-wrap:anywhere}.text-paper h1,.text-paper h2,.text-paper h3{line-height:1.25;margin:1em 0 .45em}.text-paper h1{font-size:1.85em}.text-paper h2{font-size:1.42em}.text-paper h3{font-size:1.18em}.text-paper p{margin:0 0 1.05em}.text-paper ul,.text-paper ol{padding-left:1.5em}.text-paper pre{white-space:pre-wrap;overflow-wrap:anywhere;background:#f0f2f7;padding:14px;border-radius:7px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.85em}.text-paper code{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;background:#eef0f5;border-radius:3px;padding:1px 3px}.text-paper pre code{background:transparent;padding:0}.text-paper blockquote{border-left:3px solid #8a79ce;padding-left:15px;margin-left:0;color:#41485b}.text-paper table{border-collapse:collapse;max-width:100%;display:block;overflow:auto}.text-paper td,.text-paper th{border:1px solid #cfd3e0;padding:6px}.text-paper a{color:#3057a1}.text-paper.txt{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;white-space:pre-wrap;tab-size:4}.text-paper.rtf{font-family:Arial,sans-serif}.text-paper.rtf div{max-width:100%}.text-paper.rtf img{max-width:100%;height:auto}.fallback{border:1px solid #59627b;border-radius:10px;padding:24px;text-align:center}.fallback p{line-height:1.5}
.page-toolbar{border-top:1px solid var(--stroke);display:flex;gap:16px;justify-content:center;align-items:center;min-height:56px;background:#121a33;font-size:12px;color:#bac7e0}.nav-button{background:#263052;border:1px solid #465278;color:#fff;border-radius:8px;height:33px;width:38px;font-size:24px;line-height:23px}.nav-button:disabled{opacity:.3}
.scrim{position:fixed;inset:0;background:rgba(0,0,0,.56);z-index:9}.print-panel{position:fixed;top:0;right:0;bottom:0;height:100dvh;width:min(400px,100vw);z-index:10;background:#11162d;border-left:1px solid #414466;box-shadow:-22px 0 60px rgba(0,0,0,.4);display:flex;flex-direction:column}.panel-header{display:flex;align-items:center;justify-content:space-between;padding:30px 28px 22px;border-bottom:1px solid var(--stroke)}.panel-header h2{font-size:24px;margin:5px 0 0;letter-spacing:-.025em}.overline{font-size:10px;letter-spacing:.16em;color:#a4b2d0;font-weight:750}.close-button{background:#252e4c;color:#f1f2fa;border:1px solid #3d4867;border-radius:10px;width:36px;height:36px;font-size:25px;line-height:22px}.panel-scroll{flex:1;overflow:auto;padding:26px 28px 46px}.field{margin-bottom:24px}.field-label{display:block;font-size:12px;color:#d2daeb;font-weight:700;margin-bottom:11px}.choices{display:grid;gap:7px}.choices.two{grid-template-columns:repeat(2,1fr)}.choices.four{grid-template-columns:repeat(4,1fr)}.choices.five{grid-template-columns:repeat(5,1fr)}.choice{padding:11px 5px;border-radius:8px;border:1px solid #42496b;background:#202642;color:#d3daed;font-size:13px}.choice.selected{background:#453376;color:#fff;border-color:#ac86ff;box-shadow:inset 0 0 0 1px #ac86ff}.field select{width:100%;background:#202642;color:#eff3ff;border:1px solid #42496b;border-radius:9px;padding:12px;min-height:43px}.field-note{display:block;color:var(--muted);font-size:11px;margin-top:8px}.panel-divider{height:1px;background:var(--stroke);margin:24px 0}.prepared-actions{margin-top:22px}.result-line{display:flex;align-items:center;gap:8px;font-size:12px;color:#e5f1ff;line-height:1.4}.result-check{display:grid;place-items:center;color:#b9ffe6;background:#1c5b4a;border-radius:50%;width:25px;height:25px}.result-buttons{display:grid;grid-template-columns:repeat(2,1fr);gap:8px;margin-top:16px}.download-link{display:block;color:#b1c4ff;text-align:center;padding:13px;font-size:12px;text-decoration:underline}.toast{position:fixed;left:50%;bottom:26px;transform:translateX(-50%);max-width:min(90vw,650px);z-index:11;border:1px solid #4c5f80;border-radius:12px;padding:12px 18px;background:#1c2946;box-shadow:0 9px 34px #0008;font-size:13px;text-align:center;line-height:1.4}.toast.error{border-color:#a65c67;background:#3e2035}
@media(max-width:680px){.topbar{height:auto;padding:12px 13px;gap:11px;flex-wrap:wrap}.brand-icon{width:43px;height:43px;border-radius:13px}.app-title{font-size:18px}.app-subtitle{font-size:11px;margin-top:3px}.toolbar{width:100%;justify-content:space-between}.toolbar .btn{flex:1;padding:9px 10px;font-size:12px}.workspace{padding:10px;min-height:0}.document-space{min-height:calc(100dvh - 142px);border-radius:13px}.document-bar{padding:10px;flex-wrap:wrap;gap:8px}.document-name-group{width:100%}.doc-meta{font-size:11px}.document-bar-actions{margin-left:auto}.canvas-stage{padding:15px;min-height:390px}.text-paper{min-height:530px;font-size:14px;padding:24px}.empty-symbol{width:95px;height:95px}.empty-symbol img{height:95px;width:95px}.empty-state h1{font-size:25px}.panel-header{padding:24px}.panel-scroll{padding:24px 24px 38px}}
@media(prefers-reduced-motion:reduce){*{transition:none!important;scroll-behavior:auto!important}}

/* Clear actions: separate document lifecycle from print layout settings. */
.btn-clear-document{background:transparent;border-color:#4b5577;color:#d3dbef;font-size:12px;min-height:36px;padding:7px 10px}
.clear-print-row{display:flex;justify-content:flex-end;margin:0 0 12px}
.btn-clear-print{background:transparent;border-color:#4b5577;color:#d3dbef;font-size:12px;min-height:37px;padding:8px 13px}
@media(max-width:680px){.document-bar-actions{width:100%;flex-wrap:wrap;justify-content:flex-end}.btn-clear-document{margin-left:auto}}
