:root{color-scheme:dark;--background:#0b0d10;--foreground:#f5f4ef;--card:#14171b;--raised:#171a1f;--soft:#111419;--hover:#1d2127;--border:#2a3038;--text-soft:#b9bec6;--text-faint:#7f8792;--yellow:#ffd400;--yellow-soft:rgba(255,212,0,.11);--yellow-line:rgba(255,212,0,.47);--green:#67df90;--red:#ff7c7c;--red-soft:rgba(255,124,124,.09);--shadow:0 24px 70px rgba(0,0,0,.24);--sans:"Segoe UI Variable","Segoe UI",Arial,sans-serif;--mono:"Cascadia Code","SFMono-Regular",Consolas,monospace}
:root[data-theme="light"]{color-scheme:light;--background:#f4f4f0;--foreground:#17191c;--card:#fff;--raised:#fff;--soft:#ecece6;--hover:#e5e5df;--border:#d6d6cf;--text-soft:#4f5660;--text-faint:#747b84;--yellow:#e9b900;--yellow-soft:rgba(214,165,0,.12);--yellow-line:rgba(183,141,0,.48);--green:#158648;--red:#ba3f3f;--red-soft:rgba(186,63,63,.08);--shadow:0 22px 60px rgba(30,31,25,.09)}
*{box-sizing:border-box}html{background:var(--background)}body{min-width:320px;margin:0;background:linear-gradient(rgba(255,255,255,.017) 1px,transparent 1px),linear-gradient(90deg,rgba(255,255,255,.017) 1px,transparent 1px),var(--background);background-size:40px 40px;color:var(--foreground);font:1rem/1.6 var(--sans);text-rendering:optimizeLegibility}:root[data-theme="light"] body{background-image:linear-gradient(rgba(0,0,0,.018) 1px,transparent 1px),linear-gradient(90deg,rgba(0,0,0,.018) 1px,transparent 1px)}button,input,select,textarea{font:inherit}button{cursor:pointer}::selection{background:var(--yellow);color:#171500}
.topbar{position:sticky;top:0;z-index:10;min-height:70px;padding:10px max(24px,calc((100vw - 1510px)/2));display:flex;align-items:center;gap:18px;border-bottom:1px solid var(--border);background:color-mix(in srgb,var(--background) 89%,transparent);backdrop-filter:blur(14px)}.mark{display:grid;place-items:center;width:45px;height:45px;flex:none;border:1px solid var(--yellow-line);color:var(--yellow);background:var(--yellow-soft);font:700 15px var(--mono)}.brand{min-width:0}.brand small,.eyebrow,.micro,.badge,.flow-step span,.card small,.heading span,footer{font-family:var(--mono);letter-spacing:.09em}.brand small{display:block;color:var(--text-faint);font-size:10px;white-space:nowrap}.brand strong{display:block;font-size:17px;line-height:1.25;letter-spacing:-.03em}.brand strong span{color:var(--text-soft);font-weight:400}.top-actions{margin-left:auto;display:flex;align-items:center;gap:10px}.badge{color:var(--yellow);background:var(--yellow-soft);border:1px solid var(--yellow-line);padding:5px 9px;font-size:10px;white-space:nowrap}.theme-toggle{min-width:43px;height:40px;border:1px solid var(--border);background:var(--soft);color:var(--foreground);font-size:18px}.theme-toggle:hover{border-color:var(--yellow-line);background:var(--hover)}
.top-actions #installApp{white-space:nowrap}.install-hint{max-width:1510px;margin:0 auto;padding:10px 24px;background:var(--yellow-soft);color:var(--foreground);border-bottom:1px solid var(--yellow-line);font-size:13px}.install-hint[hidden]{display:none}
.shell{max-width:1510px;margin:auto;padding:0 24px 50px}.hero{padding:48px 0 35px;display:grid;grid-template-columns:minmax(0,1fr) auto;gap:30px;align-items:end;border-bottom:1px solid var(--border)}.eyebrow{color:var(--yellow);font-size:11px;font-weight:700}.hero h1{max-width:850px;margin:12px 0 15px;font-size:clamp(34px,4.6vw,62px);line-height:1.04;letter-spacing:-.055em}.hero p{margin:0;color:var(--text-soft);max-width:680px}.hero-status{border-left:2px solid var(--yellow);padding:5px 0 5px 18px;color:var(--text-soft);font:11px/1.7 var(--mono);white-space:nowrap}.hero-status b{display:block;color:var(--foreground);font-size:12px}
.flow{display:flex;align-items:stretch;gap:9px;overflow-x:auto;padding:20px 0 28px;border-bottom:1px solid var(--border)}.flow-step{flex:1 0 150px;min-width:0;border:1px solid var(--border);background:var(--soft);padding:13px 15px}.flow-step:first-child,.flow-step:last-child{border-top:2px solid var(--yellow)}.flow-step span{display:block;color:var(--yellow);font-size:10px}.flow-step strong{display:block;margin-top:3px;font-size:13px;font-weight:600}.flow-arrow{align-self:center;flex:none;color:var(--yellow);font:16px var(--mono)}
main{display:grid;grid-template-columns:minmax(250px,1fr) minmax(280px,1fr) minmax(360px,1.35fr);gap:16px;padding-top:28px;align-items:stretch}section{min-width:0;border:1px solid var(--border);border-radius:18px;background:linear-gradient(160deg,var(--raised),var(--card) 42%);box-shadow:var(--shadow);overflow:hidden}.section-head{border-top:2px solid var(--yellow);border-bottom:1px solid var(--border);padding:21px 22px 18px}.section-head .micro{color:var(--yellow);font-size:10px}.section-head h2{margin:6px 0 0;font-size:23px;line-height:1.2;letter-spacing:-.035em}.section-head p{margin:7px 0 0;color:var(--text-soft);font-size:13px}.section-body{padding:20px 22px 24px}.heading{display:flex;justify-content:space-between;align-items:center;gap:10px}.heading span{color:var(--text-faint);font-size:10px}
label{display:block;color:var(--text-soft);font-size:12px;margin:0 0 14px}input,select,textarea{display:block;width:100%;margin-top:6px;padding:10px 12px;border:1px solid var(--border);border-radius:9px;background:var(--soft);color:var(--foreground);outline:none}input::placeholder{color:var(--text-faint)}input:focus-visible,select:focus-visible,textarea:focus-visible,button:focus-visible,summary:focus-visible{outline:2px solid var(--yellow);outline-offset:2px}button{border:1px solid var(--yellow);border-radius:8px;background:var(--yellow);color:#171500;padding:9px 13px;font-weight:700;font-size:12px;transition:background .15s,border-color .15s,transform .15s}button:hover{transform:translateY(-2px);background:color-mix(in srgb,var(--yellow) 80%,white)}button.quiet{background:var(--soft);color:var(--text-soft);border-color:var(--border)}button.quiet:hover{background:var(--hover);color:var(--foreground)}
.card{padding:18px 0;border-bottom:1px solid var(--border)}.card:first-child{padding-top:4px}.card h3{margin:4px 0;font-size:16px;line-height:1.3}.card p{color:var(--text-soft);font-size:12px;line-height:1.6;margin:5px 0 9px}.card small{color:var(--text-faint);font-size:10px;letter-spacing:.04em}.card details{color:var(--text-soft);font-size:12px;margin:8px 0}.card summary{cursor:pointer}.card button{margin-top:5px}#library{max-height:660px;overflow:auto;padding-right:10px;scrollbar-color:var(--border) transparent}#selected:empty::after{content:'Добавьте блок из словаря или выберите пресет.';display:block;padding:28px 0;color:var(--text-faint);font-size:13px}.save{border-top:1px solid var(--border);margin-top:20px;padding-top:20px}.save button{margin:0 5px 12px 0}.preview textarea{min-height:560px;height:62vh;resize:vertical;font:12px/1.7 var(--mono);background:var(--soft)}.warning{padding:12px;margin-bottom:12px;border:1px solid var(--red);border-radius:8px;color:var(--red);background:var(--red-soft);font-size:12px}.note{color:var(--text-faint);font-size:12px;line-height:1.6}#message{color:var(--green);font-size:12px;min-height:18px}footer{padding:32px 0 10px;color:var(--text-faint);font-size:10px;letter-spacing:0;border-top:1px solid var(--border)}
.preview-tabs{display:flex;gap:8px;margin-bottom:14px}.preview-tabs button{flex:1;background:var(--soft);color:var(--text-soft);border-color:var(--border)}.preview-tabs button[aria-pressed="true"]{background:var(--yellow-soft);color:var(--yellow);border-color:var(--yellow-line)}.preview-tabs button:hover{background:var(--hover)}#translationNote[hidden]{display:none}
@media(max-width:1100px){main{grid-template-columns:1fr 1fr}.preview{grid-column:1/-1}.preview textarea{height:360px;min-height:360px}}@media(max-width:700px){.topbar{padding:10px 16px;flex-wrap:wrap}.brand small,.badge{display:none}.top-actions{gap:6px}.top-actions #installApp{padding:8px;font-size:11px}.install-hint{padding:10px 16px}.hero{display:block;padding:36px 0 26px}.hero-status{margin-top:22px}.shell{padding:0 16px 36px}main{display:block;padding-top:20px}section{margin-bottom:16px}.section-body{padding:18px}.flow{padding:16px 0 20px}.flow-step{flex-basis:130px}}@media(prefers-reduced-motion:reduce){button{transition:none}button:hover{transform:none}}

/* Stage 1 visual system: decorative map and shared line icons. */
.icon-sprite{position:absolute;width:0;height:0;overflow:hidden;pointer-events:none}
.ui-icon{width:22px;height:22px;flex:none;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round;vertical-align:middle}
.brand strong span{color:var(--yellow)}
.hero{padding:30px 0 26px}.hero h1{font-size:clamp(30px,3.7vw,52px);max-width:900px}.hero p{font-size:14px}.hero-status{font-size:10px}
.process-map{padding:20px 0 24px;border-bottom:1px solid var(--border)}
.process-caption{display:flex;justify-content:space-between;gap:12px;margin-bottom:12px;font:10px/1.5 var(--mono);letter-spacing:.08em;color:var(--text-faint)}
.process-caption span:first-child{color:var(--yellow)}
.process-steps{display:grid;grid-template-columns:repeat(7,minmax(0,1fr)) minmax(165px,1.3fr);gap:22px;list-style:none;padding:0;margin:0}
.process-steps li{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;min-height:110px;padding:14px 7px 12px;border:1px solid var(--yellow-line);border-radius:6px;background:linear-gradient(145deg,var(--raised),var(--soft));text-align:center}
.process-steps li:not(:last-child)::after{content:'→';position:absolute;right:-19px;top:42%;color:var(--yellow);font:20px var(--mono)}
.process-number{position:absolute;left:9px;top:7px;color:var(--yellow);font:10px var(--mono)}
.process-steps .ui-icon{width:28px;height:28px;color:var(--foreground);margin-bottom:3px}
.process-steps strong{font-size:11px;line-height:1.3;white-space:nowrap;letter-spacing:.01em}
.process-description{font-size:10px;color:var(--text-soft);line-height:1.4}
main{padding-top:24px;gap:14px;grid-template-columns:minmax(260px,1fr) minmax(300px,1.12fr) minmax(360px,1.35fr)}
main>section{border-radius:9px;box-shadow:0 12px 32px rgba(0,0,0,.12)}
.section-head{padding:18px 20px 16px;border-top:1px solid var(--yellow-line)}
.section-head h2{display:flex;align-items:center;gap:9px;font-size:22px}.section-head h2 .ui-icon{color:var(--yellow);width:20px;height:20px}.section-head p{font-size:12px;line-height:1.5}.section-body{padding:18px 20px 22px}
.field-heading{display:flex;align-items:center;gap:7px}.field-heading .ui-icon{width:17px;height:17px;color:var(--yellow)}
input,select,textarea{border-radius:5px;font-size:13px}button{border-radius:5px}button:hover{transform:none}
.card{position:relative;padding:15px 14px;margin:10px 0;border:1px solid var(--border);border-radius:6px;background:var(--soft);transition:border-color .15s,background .15s}.card:first-child{padding-top:15px}.card:hover{border-color:var(--yellow-line)}
.card h3{display:flex;align-items:flex-start;gap:9px;font-size:15px;overflow-wrap:anywhere}.card h3 .ui-icon{width:20px;height:20px;color:var(--yellow)}.card small{font-size:9px}.card p{font-size:12px;line-height:1.5}.card details p{overflow-wrap:anywhere}.card summary{color:var(--text-soft)}
#selected .card{border-left:2px solid var(--yellow-line);background:linear-gradient(110deg,var(--yellow-soft),var(--soft) 48%)}
#selected .card label{margin-top:12px}.card .quiet{padding:5px 10px;font-weight:500}.save{padding-top:18px}.save input[type=file]{font-size:11px;padding:9px 7px;min-width:0}
.preview textarea{line-height:1.85;border-color:var(--yellow-line);padding:16px;font-size:12px}.preview-tabs button{font-size:11px;padding:9px 7px}.preview-tabs button[aria-pressed=true]{box-shadow:inset 0 -2px var(--yellow)}
#count{white-space:nowrap}.heading{flex-wrap:wrap}.note{font-size:11px}
@media(max-width:1200px){.process-steps{gap:18px;grid-template-columns:repeat(7,minmax(0,1fr)) minmax(148px,1.3fr)}.process-steps li:not(:last-child)::after{right:-16px;font-size:17px}.process-description{font-size:9px}.process-steps strong{font-size:10px}}
@media(max-width:1100px){main{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}.process-steps{grid-template-columns:repeat(4,minmax(0,1fr));gap:14px 24px}.process-steps li:nth-child(4)::after{display:none}.process-steps li:not(:last-child)::after{right:-21px}.process-description{font-size:11px}.process-steps strong{font-size:11px}}
@media(max-width:700px){main{display:block}.hero{padding:26px 0 22px}.hero-status{white-space:normal}.process-caption{flex-wrap:wrap}.process-steps{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px 24px}.process-steps li{min-height:104px}.process-steps li:nth-child(even)::after{display:none}.section-body{padding:16px}.top-actions{flex-wrap:wrap}.brand small{display:none}.section-head{padding:16px}.preview-tabs{gap:6px}.preview-tabs button{font-size:10px}.process-steps strong{font-size:10px}}
@media(prefers-reduced-motion:reduce){.card{transition:none}}

/* Stage 2: a full-width library below the existing workspace. */
.prompt-library{margin:24px 0;border-radius:9px}.output-actions{display:flex;gap:8px;flex-wrap:wrap}#savedPrompts{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px}#savedPrompts .card{margin:0;min-width:0}.saved-prompt-card p{white-space:pre-wrap;overflow-wrap:anywhere}.saved-prompt-card time{display:block;font:10px var(--mono);color:var(--text-faint);margin:12px 0}.saved-prompt-actions{display:flex;flex-wrap:wrap;gap:8px}.saved-prompt-actions button{margin:0}#promptLibraryMessage{color:var(--text-soft);font-size:12px}#openedPromptNote[hidden]{display:none}@media(max-width:1100px){#savedPrompts{grid-template-columns:repeat(2,minmax(0,1fr))}}@media(max-width:700px){#savedPrompts{grid-template-columns:1fr}}


/* Stage 2 acceptance: bounded workspace and compact results footer. */
.shell{max-width:none;padding-inline:24px}.topbar{padding-inline:24px}
main>section{height:clamp(900px,85vh,1080px);display:flex;flex-direction:column}
main>section>.section-head{flex:none}
main>section>.section-body{display:flex;flex-direction:column;flex:1;min-height:0}
main .section-body>label,main .section-body>button,.save{flex:none}
#library,#selected{flex:1;min-height:0;max-height:none;overflow:auto;overscroll-behavior:contain;scrollbar-color:var(--border) transparent;padding-right:10px}
#selected{margin-top:12px}.save{margin-top:12px;padding-top:12px}
.preview #output{flex:1;min-height:0;height:auto;resize:none}
.preview #warnings{max-height:140px;overflow:auto;flex:none}
.preview .note,.preview #message{flex:none}
.footer-workspace{margin-top:22px;border-top:1px solid var(--border)}
.footer-workspace .prompt-library{margin:0;border:0;border-radius:0;background:none;box-shadow:none}
.prompt-library .section-head{padding:16px 0 10px;border:0}
.prompt-library .section-head h2{font-size:18px}.prompt-library .section-head p{margin-top:4px}
.prompt-library .section-body{padding:0 0 16px}
#promptLibraryMessage:empty{display:none}
#savedPrompts{grid-template-columns:repeat(auto-fit,minmax(min(100%,280px),1fr));gap:10px}
#savedPrompts .card{padding:12px;max-width:480px}
.saved-prompt-card p{display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}
.saved-prompt-card time{margin:8px 0}.saved-prompt-actions{gap:6px}.saved-prompt-actions button{padding:6px 9px;font-size:11px}
.footer-workspace footer{padding:14px 0 10px}
@media(max-width:1100px){.preview{height:640px}}
@media(max-width:700px){.shell{padding-inline:16px}.topbar{padding-inline:16px}main>section{height:auto}main>section>.section-body{display:block}#library,#selected{max-height:480px}#selected{margin-top:12px}.preview #output{height:360px;min-height:360px}.footer-workspace{margin-top:16px}#savedPrompts .card{max-width:none}}

.preview-tabs{flex:none}#translationNote[hidden]{display:none}


/* Desktop: grow the workspace to the viewport; keep results at the bottom. */
@media(min-width:1101px){
 body{height:100dvh;display:grid;grid-template-rows:auto minmax(0,1fr)}
 .shell{width:100%;min-height:0;margin:0;display:grid;grid-template-rows:auto auto minmax(620px,1fr) auto;padding-bottom:16px}
 main{min-height:0;grid-template-rows:minmax(0,1fr)}
 main>section{height:auto;min-height:0}
 .footer-workspace{align-self:end}
}
