:root{color-scheme:dark;--bg:#111318;--panel:#171a21;--line:#252a35;--line2:#323848;--text:#e6e8ee;--muted:#8a92a6;--accent:#7de2b0;--accent2:#1d3a2e;--err:#ff9d8f}
*{box-sizing:border-box}
[hidden]{display:none!important}
html,body{height:100%}
body{margin:0;height:100dvh;background:var(--bg);color:var(--text);font:14px/1.45 ui-sans-serif,system-ui,'Segoe UI',sans-serif;display:flex;flex-direction:column}
button,input,select,textarea{font:inherit;color:inherit}
header{display:flex;flex-wrap:wrap;align-items:center;gap:10px 16px;padding:12px 16px;border-bottom:1px solid var(--line);background:var(--bg)}
h1{margin:0;font-size:15px;font-weight:600;white-space:nowrap}
#total{color:var(--muted);font-weight:400;margin-left:6px}
#q{flex:1 1 260px;min-width:0;max-width:460px;padding:8px 12px;border-radius:8px;border:1px solid var(--line2);background:var(--panel)}
#q:focus{outline:2px solid var(--accent);outline-offset:-1px}
#toggle{display:none}
.wrap{flex:1;display:flex;min-height:0}
aside{width:270px;flex-shrink:0;overflow:auto;border-right:1px solid var(--line);padding:8px 6px 24px}
aside ul{list-style:none;margin:0;padding:0}
aside ul ul{padding-left:12px}
.node{display:flex;align-items:center;gap:4px;width:100%;border:0;background:transparent;text-align:left;padding:4px 6px;border-radius:6px;cursor:pointer;color:var(--text);font-size:13px}
.node:hover{background:var(--panel)}
.node[aria-current=true]{background:var(--accent2);color:var(--accent)}
.node .car{width:12px;flex-shrink:0;color:var(--muted);font-size:10px}
.node .nm{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.node .ct{color:var(--muted);font-size:11px;font-variant-numeric:tabular-nums}
main{flex:1;min-width:0;overflow:auto;padding:14px 16px 40px}
main:focus{outline:none}
.banner{display:block;max-width:960px;margin:0 auto 14px;border-radius:8px;overflow:hidden}
.banner img{display:block;width:100%;height:auto;aspect-ratio:6/1}
.bar{display:flex;flex-wrap:wrap;align-items:baseline;gap:8px;margin-bottom:12px}
.crumbs{display:flex;flex-wrap:wrap;gap:4px;font-size:13px}
.crumbs button{border:0;background:transparent;padding:0;color:var(--accent);cursor:pointer}
.crumbs span{color:var(--muted)}
.count{color:var(--muted);font-size:12px}
.grid{display:grid;gap:8px;grid-template-columns:repeat(auto-fill,minmax(112px,1fr))}
figure{margin:0;min-width:0;background:var(--panel);border:1px solid var(--line);border-radius:10px;padding:8px 6px 6px;text-align:center;cursor:pointer;transition:border-color .12s}
figure:hover{border-color:var(--accent)}
figure:focus-visible{outline:2px solid var(--accent);outline-offset:1px}
figure img{display:block;width:100%;aspect-ratio:1;object-fit:contain}
figcaption{margin-top:6px;line-height:1.3}
figcaption b,figcaption small{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
figcaption b{font-weight:500;font-size:12px}
figcaption small{font-size:11px;color:var(--muted)}
.empty{color:var(--muted);padding:40px 0;text-align:center}
#more{height:1px}
dialog{width:min(560px,calc(100vw - 32px));max-height:calc(100vh - 32px);padding:0;border:1px solid var(--line2);border-radius:14px;background:var(--panel);color:var(--text)}
dialog::backdrop{background:#000b}
.dlg{display:flex;flex-direction:column;gap:12px;padding:16px}
.dlg-top{display:flex;align-items:center;gap:8px}
.dlg-top h2{flex:1;min-width:0;margin:0;font-size:15px;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.icon-btn{border:1px solid var(--line2);background:transparent;border-radius:8px;width:32px;height:32px;cursor:pointer;color:var(--muted);display:inline-flex;align-items:center;justify-content:center}
.icon-btn:hover{color:var(--text);border-color:var(--muted)}
.stage{position:relative;border-radius:10px;overflow:hidden;background:repeating-conic-gradient(#1c2029 0 25%,#151820 0 50%) 0 0/20px 20px}
.stage img{display:block;width:100%;max-height:min(420px,50vh);object-fit:contain;padding:16px}
.dim{position:absolute;right:8px;bottom:6px;font-size:11px;color:var(--muted)}
.rows{display:flex;flex-direction:column;gap:8px}
.row{display:flex;align-items:center;gap:8px}
.row label{width:48px;flex-shrink:0;font-size:12px;color:var(--muted)}
.row input{flex:1;min-width:0;padding:7px 10px;border-radius:8px;border:1px solid var(--line2);background:var(--bg);font:12px ui-monospace,Consolas,monospace}
.row button{flex-shrink:0;border:1px solid var(--line2);background:var(--bg);border-radius:8px;padding:6px 12px;cursor:pointer;font-size:13px;min-width:84px}
.row button:hover{border-color:var(--accent);color:var(--accent)}
.row button.ok{border-color:var(--accent);color:var(--accent)}
.dlg-foot{display:flex;justify-content:space-between;align-items:center;font-size:12px;color:var(--muted)}
.dlg-foot a{color:var(--accent);text-decoration:none}
@media (max-width:760px){
  aside{position:fixed;inset:0 30% 0 0;z-index:10;background:var(--bg);transform:translateX(-100%);transition:transform .2s;box-shadow:0 0 40px #000}
  body.nav aside{transform:none}
  .grid{grid-template-columns:repeat(auto-fill,minmax(88px,1fr))}
  .row label{display:none}
}
::-webkit-scrollbar{width:10px;height:10px}
::-webkit-scrollbar-track{background:transparent}
::-webkit-scrollbar-thumb{background:var(--line2);border-radius:999px;border:3px solid var(--bg)}
::-webkit-scrollbar-thumb:hover{background:var(--muted)}
::-webkit-scrollbar-thumb:active{background:var(--accent)}
::-webkit-scrollbar-corner{background:transparent}
aside::-webkit-scrollbar{width:8px}
aside::-webkit-scrollbar-thumb{border-width:2px}
dialog ::-webkit-scrollbar-thumb{border-color:var(--panel)}
@supports (-moz-appearance:none){*{scrollbar-width:thin;scrollbar-color:var(--line2) transparent}}
.contact{margin-left:auto;white-space:nowrap;font-size:13px;color:var(--muted);text-decoration:none;border:1px solid var(--line2);border-radius:8px;padding:6px 10px;transition:border-color .12s,color .12s}
.contact b{color:var(--text);font-weight:500}
.contact:hover{border-color:#5865f2;color:var(--text)}
.btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;border:1px solid var(--line2);background:var(--panel);color:var(--text);border-radius:8px;padding:6px 10px;font-size:13px;line-height:1.3;cursor:pointer;text-decoration:none;transition:border-color .12s,color .12s,background-color .12s}
.btn:hover{border-color:var(--accent);color:var(--accent)}
.btn.primary{background:var(--accent2);border-color:var(--accent2);color:var(--accent)}
.btn.primary:hover{border-color:var(--accent)}
.btn.quiet{background:transparent;color:var(--muted)}
.btn.danger,.btn.danger:hover{border-color:var(--err);color:var(--err)}
:focus-visible{outline:2px solid var(--accent);outline-offset:1px}
.skip{position:fixed;left:8px;top:8px;z-index:30;padding:8px 12px;border-radius:8px;background:var(--accent2);color:var(--accent);transform:translateY(-200%)}
.skip:focus{transform:none}
.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
.muted{color:var(--muted)}
.tools{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin-left:auto}
.tools + .contact{margin-left:-8px}
select{max-width:100%;border:1px solid var(--line2);background:var(--panel);border-radius:8px;padding:6px 8px;font-size:13px;cursor:pointer}
select:hover{border-color:var(--muted)}
.menu{position:relative;min-width:0}
.menu-btn{display:flex;align-items:center;gap:8px;width:100%;max-width:280px;min-height:32px;border:1px solid var(--line2);background:var(--panel);border-radius:8px;padding:5px 8px;font-size:13px;cursor:pointer;text-align:start}
.menu-btn:hover,.menu-btn[aria-expanded=true]{border-color:var(--muted)}
.menu-text{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.menu-car{color:var(--muted);font-size:10px}
.flag{flex-shrink:0;width:20px;height:15px;border-radius:2px;object-fit:cover;box-shadow:0 0 0 1px rgb(255 255 255 / .12)}
.menu-list{position:absolute;z-index:25;top:calc(100% + 4px);inset-inline-start:0;width:max-content;min-width:100%;max-width:min(320px,calc(100vw - 24px));max-height:min(528px,70dvh);overflow:auto;margin:0;padding:4px;list-style:none;border:1px solid var(--line2);background:var(--panel);border-radius:8px;box-shadow:0 12px 32px rgb(0 0 0 / .45)}
.menu.up .menu-list{top:auto;bottom:calc(100% + 4px)}
.menu-list:focus{outline:none}
.menu-row{display:flex;align-items:center;gap:8px;min-height:32px;padding:5px 8px;border-radius:6px;font-size:13px;cursor:pointer}
.menu-row.on{background:var(--line2)}
.menu-action.first{margin-top:4px;position:relative}
.menu-action.first::before{content:'';position:absolute;inset:-3px 0 auto;border-top:1px solid var(--line2)}
.menu-plus{flex-shrink:0;width:20px;text-align:center;color:var(--muted);font-size:15px;line-height:1}
.menu-row[aria-selected=true]{background:var(--accent2);color:var(--accent)}
.menu-row[aria-selected=true].on{outline:1px solid var(--accent);outline-offset:-1px}
.menu-list:focus-visible .menu-row.on{outline:2px solid var(--accent);outline-offset:-2px}
.unt{color:var(--muted);font-weight:400;font-size:.8em;margin-inline-end:4px}
.nm .unt{margin-inline:4px 0}
.legend{color:var(--muted);font-size:12px}
footer{display:flex;flex-wrap:wrap;gap:2px 16px;justify-content:space-between;padding:6px 16px;border-top:1px solid var(--line);color:var(--muted);font-size:12px}
footer .links{display:flex;gap:12px}
.note-short{display:none}
footer a{color:var(--muted)}
footer a:hover{color:var(--accent)}
.tbar{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:8px 16px;padding:8px 16px;border-bottom:1px solid var(--line);background:var(--panel)}
.tbar-state{display:flex;flex-wrap:wrap;align-items:center;gap:4px 12px;min-width:0;font-size:13px}
.tbar-state strong{font-weight:600}
.tbar-tools{display:flex;flex-wrap:wrap;align-items:center;gap:8px}
.tbar-note{flex-basis:100%;margin:0;font-size:12px;color:var(--muted)}
.check{display:inline-flex;align-items:center;gap:6px;font-size:13px;cursor:pointer}
.check input{accent-color:var(--accent);margin:0}
progress{width:120px;height:4px;appearance:none;border:0;border-radius:2px;overflow:hidden;background:var(--line2)}
progress::-webkit-progress-bar{background:var(--line2)}
progress::-webkit-progress-value{background:var(--accent)}
progress::-moz-progress-bar{background:var(--accent)}
.translating .grid{grid-template-columns:repeat(auto-fill,minmax(176px,1fr))}
figure.edit{cursor:default;display:flex;flex-direction:column;align-items:stretch;padding:8px}
figure.edit:hover{border-color:var(--line)}
figure.edit.drafted{border-color:var(--line2)}
figure.edit img{height:72px;width:100%;aspect-ratio:auto;cursor:zoom-in}
figure.edit figcaption{margin-top:8px;text-align:left}
.nm-in{width:100%;min-width:0;padding:6px 8px;border-radius:6px;border:1px solid var(--line2);background:var(--bg);font-size:13px}
.nm-in::placeholder{color:var(--muted);opacity:1;font-style:italic}
.nm-in.has-draft{border-color:var(--accent)}
.nm-in[aria-invalid=true]{border-color:var(--err)}
figure.edit figcaption small{white-space:normal;line-height:1.3;margin-top:4px;font-size:11px}
.src{display:flex;justify-content:space-between;gap:6px}
.src span:first-child{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.dr{display:none;color:var(--accent);flex-shrink:0}
.drafted .dr{display:inline}
.err{display:block;color:var(--err);font-size:11px}
figure.edit figcaption small.err{color:var(--err)}
.folder-edit{display:flex;align-items:baseline;gap:8px;flex-basis:100%;font-size:12px;color:var(--muted)}
.folder-edit label{flex-shrink:0}
.folder-in{flex:0 1 320px;min-width:0}
.text{gap:10px;overflow:auto;max-height:calc(100dvh - 34px)}
.text section{display:flex;flex-direction:column;gap:8px;padding-top:12px;border-top:1px solid var(--line)}
.text h3{margin:0;font-size:14px;font-weight:600}
.text p{margin:0;line-height:1.5;max-width:64ch;overflow-wrap:anywhere}
.steps{margin:0;padding-inline-start:20px;display:flex;flex-direction:column;gap:2px;line-height:1.5}
.actions{display:flex;flex-wrap:wrap;gap:8px}
.ai-text{font-size:12.5px;line-height:1.5;min-height:280px}
.actions.end{justify-content:flex-end;padding-top:4px}
.field{display:flex;flex-direction:column;gap:6px}
.field-top{display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:12px;color:var(--muted)}
textarea{width:100%;resize:vertical;padding:8px 10px;border-radius:8px;border:1px solid var(--line2);background:var(--bg);font:12px/1.4 ui-monospace,Consolas,monospace}
.problems,.parts{list-style:none;margin:0;padding:0;display:flex;flex-direction:column}
.problems li,.parts li{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:8px 0;border-top:1px solid var(--line)}
.problems li:first-child,.parts li:first-child{border-top:0}
.prob-text{display:flex;flex-direction:column;gap:2px;min-width:0}
.prob-text code{font:12px ui-monospace,Consolas,monospace;overflow-wrap:anywhere}
.prob-text small{color:var(--err)}
@media (max-width:760px){
  header{gap:8px;padding:10px 12px}
  h1{min-width:0;flex:1;overflow:hidden;text-overflow:ellipsis}
  #toggle{display:inline-flex}
  #q{flex:1 1 100%;max-width:none;order:3}
  .tools{order:4;margin-left:0;flex:1 1 100%}
  .tools .menu{flex:1 1 40%}
  .tools .menu-btn{max-width:none}
  .contact,.tools + .contact{order:2;margin-left:0}
  .contact span{display:none}
  aside{visibility:hidden;transition:transform .2s,visibility .2s}
  body.nav aside{visibility:visible}
  main{padding:10px 12px 24px}
  footer{padding:6px 12px}
  .note-long{display:none}
  .note-short{display:inline}
  .tbar{padding:8px 12px}
  .tbar-tools{width:100%}
  .tbar-tools .check{margin-right:auto}
  progress{display:none}
  .translating .grid{grid-template-columns:repeat(auto-fill,minmax(148px,1fr))}
  #q,select,.nm-in,textarea,.row input{font-size:16px}
  .translating h1,.translating .contact,.translating #add-icon,.translating footer{display:none}
  .translating #q{order:2;flex:1 1 40%}
  .row{flex-wrap:wrap}
  .row input{flex-basis:100%}
}
@media (pointer:coarse){
  .btn,select,#q,.row button,.nm-in,.row input,.menu-btn,.menu-row{min-height:44px}
  .icon-btn{width:44px;height:44px}
  .node{min-height:40px}
  .check{min-height:44px}
  .check input{width:20px;height:20px}
  .crumbs button{min-height:32px}
  footer a{display:inline-flex;align-items:center;min-height:32px}
}
@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{transition:none!important;animation:none!important;scroll-behavior:auto!important}
}
