:root{font-family:Inter,system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;color:#e8edf3;background:#0b0f14;line-height:1.45}
*{box-sizing:border-box}body{margin:0;min-height:100vh;background:radial-gradient(circle at 20% 0%,#17202c 0,#0b0f14 42%,#080b0f 100%)}
button,input,textarea{font:inherit}button,.filebtn{border:1px solid #2d3744;background:#151c25;color:#e8edf3;border-radius:10px;padding:10px 14px;cursor:pointer}
button:hover,.filebtn:hover{background:#1c2632}button:disabled,input:disabled,textarea:disabled{opacity:.5;cursor:not-allowed}
.topbar{position:sticky;top:0;z-index:5;display:flex;justify-content:space-between;align-items:center;padding:14px 18px;border-bottom:1px solid #202a35;background:rgba(9,13,18,.88);backdrop-filter:blur(14px)}
.brand{font-size:20px;font-weight:800;letter-spacing:.2px}.subtitle{font-size:12px;color:#8e9baa}.iconbtn{padding:8px 11px}
.app{max-width:1500px;margin:auto;padding:14px}.card{background:rgba(16,22,29,.94);border:1px solid #26313d;border-radius:14px;box-shadow:0 12px 30px rgba(0,0,0,.18)}
.toolbar{padding:12px;margin-bottom:14px}.toolbar-row{display:flex;gap:8px;flex-wrap:wrap}.filebtn{display:inline-flex;align-items:center;gap:6px}.filebtn input{display:none}.filebtn{background:#1b5f9e;border-color:#2875bd}.filebtn:hover{background:#216eae}.fileinfo{margin-top:9px;color:#91a0af;font-size:12px;word-break:break-word}
.workspace{display:grid;grid-template-columns:minmax(280px,360px) 1fr;gap:14px;min-height:calc(100vh - 150px)}
.sidebar,.editor{min-height:600px}.sidebar{display:flex;flex-direction:column;overflow:hidden}.searchrow{display:flex;padding:12px 12px 8px;gap:6px}.searchrow input{min-width:0;flex:1;background:#0c1117;color:#e8edf3;border:1px solid #2b3744;border-radius:9px;padding:10px}.filters{display:flex;gap:10px;padding:0 12px 10px;color:#95a2af;font-size:12px;flex-wrap:wrap}.resultinfo{padding:8px 12px;border-top:1px solid #202a35;border-bottom:1px solid #202a35;color:#8997a6;font-size:12px}.results{overflow:auto;flex:1}.result{padding:11px 12px;border-bottom:1px solid #1f2933;cursor:pointer}.result:hover{background:#141d27}.result.active{background:#17334d;border-left:3px solid #4aa3ff;padding-left:9px}.result-title{font-size:12px;color:#5db0ff;margin-bottom:4px}.result-text{font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:#d4dce5}.result-dirty{font-size:10px;color:#f5c36b;margin-left:6px}
.editor{padding:14px;display:flex;flex-direction:column}.editor-head{display:flex;justify-content:space-between;align-items:center;gap:10px;font-weight:700}.badge{font-size:10px;background:#76571a;color:#ffd979;border-radius:999px;padding:3px 7px;margin-left:6px}.hidden{display:none!important}.navbuttons{display:flex;gap:6px}.navbuttons button{padding:7px 12px}
.meta-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:8px;margin:12px 0}.meta-grid>div{background:#0c1117;border:1px solid #202b36;border-radius:9px;padding:8px;min-width:0}.meta-grid span{display:block;font-size:10px;text-transform:uppercase;color:#738192;margin-bottom:3px}.meta-grid code{font-size:11px;word-break:break-all;color:#b9c7d6}
.warning{border:1px solid #76571a;background:#30250f;color:#ffd979;padding:9px 10px;border-radius:9px;font-size:12px;margin-bottom:10px}
#editorText{width:100%;flex:1;min-height:380px;resize:vertical;background:#090e13;color:#e8edf3;border:1px solid #2b3744;border-radius:10px;padding:14px;font-family:ui-monospace,SFMono-Regular,Consolas,monospace;font-size:14px;line-height:1.55;outline:none}
#editorText:focus{border-color:#3d86c6;box-shadow:0 0 0 2px rgba(61,134,198,.12)}.editor-foot{display:flex;justify-content:space-between;align-items:center;gap:10px;margin-top:10px;color:#8391a0;font-size:12px}.editor-foot button{background:#17683d;border-color:#258d58}.editor-foot button:hover{background:#1e7b49}
.toast{position:fixed;left:50%;bottom:22px;transform:translate(-50%,20px);opacity:0;pointer-events:none;background:#e8edf3;color:#0b0f14;padding:10px 14px;border-radius:10px;font-size:13px;transition:.2s;z-index:20;box-shadow:0 10px 30px #0008}.toast.show{opacity:1;transform:translate(-50%,0)}
body.light{color:#17202a;background:#f4f7fa}body.light .topbar{background:#fffffff0;border-color:#dbe2e8}body.light .card{background:#fff;border-color:#dce3e9}body.light button,body.light .filebtn{background:#f4f7fa;color:#17202a;border-color:#cdd7df}body.light .searchrow input,body.light #editorText,body.light .meta-grid>div{background:#f8fafc;color:#17202a;border-color:#cdd7df}body.light .result:hover{background:#f4f8fb}body.light .result.active{background:#e5f2ff}
@media(max-width:900px){.workspace{grid-template-columns:1fr;min-height:auto}.sidebar{min-height:360px}.editor{min-height:600px}.meta-grid{grid-template-columns:repeat(2,1fr)}}
.progress-wrap{margin-top:9px}.progress-track{height:6px;background:#202a35;border-radius:999px;overflow:hidden}.progress-bar{height:100%;width:0;background:#4aa3ff;transition:width .08s}.progress-text{font-size:11px;color:#91a0af;margin-top:5px}
.result{display:block;width:100%;text-align:left;border:0;border-bottom:1px solid #1f2933;border-radius:0;padding:11px 12px;background:transparent;color:inherit}.result-text-full{font-size:13px;line-height:1.5;color:#d4dce5;white-space:pre-wrap;overflow-wrap:anywhere;word-break:break-word}.result:hover{background:#141d27}.result.active{background:#17334d;border-left:3px solid #4aa3ff;padding-left:9px}
@media(max-width:900px){.topbar{padding:12px}.app{padding:9px}.toolbar{margin-bottom:9px}.workspace{gap:9px}.sidebar{min-height:300px;max-height:46vh}.editor{min-height:520px}.result-text-full{font-size:12px}.editor-head{font-size:14px}#editorText{min-height:300px;font-size:13px}.toolbar-row button,.filebtn{padding:9px 10px}}
/* v3 mobile stability: keep the result viewport finite and avoid giant compositing layers */
.results{contain:strict;content-visibility:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;}
.result{contain:content;content-visibility:auto;}
@media(max-width:900px){
  body{overflow-x:hidden}
  .results{max-height:42vh;min-height:120px}
  .result-text-full{max-height:7.2em;overflow:auto;-webkit-overflow-scrolling:touch;overscroll-behavior:contain;}
  .workspace{display:flex;flex-direction:column}
  .sidebar{order:1;max-height:none;min-height:0}
  .editor{order:2;min-height:0}
  #editorText{min-height:260px;height:42vh;}
}

.pagebar{display:flex;align-items:center;justify-content:space-between;gap:8px;margin:8px 0;}
.pagebar button{flex:1;min-width:0;}
.pagebar span{font-size:.82rem;white-space:nowrap;color:var(--muted);text-align:center;}
.page-options{display:flex;align-items:center;gap:8px;margin:6px 0 8px;flex-wrap:wrap;font-size:.82rem;color:var(--muted);}
.page-options select,.page-options input{background:var(--panel2);color:var(--text);border:1px solid var(--border);border-radius:8px;padding:7px 8px;}
.page-options input{width:70px;}
.page-options button{padding:7px 10px;}
.jump-label{display:flex;align-items:center;gap:5px;}
.results{contain:content;}
.result{contain:layout paint;}
@media (max-width:700px){
  .workspace{display:flex;flex-direction:column;}
  .sidebar{max-height:none;}
  .results{max-height:48vh;overflow:auto;-webkit-overflow-scrolling:touch;}
  .editor{min-height:0;}
  .pagebar button{font-size:.78rem;padding:8px 6px;}
  .page-options{justify-content:space-between;}
}
.translator{padding:12px;margin-bottom:14px}.translator-head{display:flex;justify-content:space-between;align-items:flex-start;gap:10px}.muted{color:#91a0af}.small{font-size:11px;margin-top:2px}.translator-grid{display:grid;grid-template-columns:1.5fr .8fr .9fr 1.1fr;gap:8px;margin-top:10px}.translator-grid label{display:flex;flex-direction:column;gap:5px;color:#8f9dad;font-size:11px}.translator-grid select,.settings-row input{background:#0c1117;color:#e8edf3;border:1px solid #2b3744;border-radius:9px;padding:9px}.settings-row{display:flex;gap:8px;margin-top:8px}.settings-row input{flex:1;min-width:0}.translator-actions{display:flex;gap:7px;flex-wrap:wrap;margin-top:9px}.translator-actions button{font-size:12px}.translate-stats{margin-top:8px;color:#8997a6;font-size:11px;line-height:1.5}.progress-wrap.hidden{display:none!important}
body.light .translator-grid select,body.light .settings-row input{background:#f8fafc;color:#17202a;border-color:#cdd7df}
@media(max-width:700px){.translator-grid{grid-template-columns:1fr}.settings-row{flex-direction:column}.translator-head{align-items:flex-start}.translator-actions button{flex:1}}
.checkline{display:flex;align-items:center;gap:7px;color:#8f9dad;font-size:11px}.checkline input{accent-color:#6ea8fe}.translator .progress-wrap{margin-top:9px}.translator .progress-track{height:8px}.translator .progress-text{white-space:pre-line}

.bulk-tools{margin:4px 10px 8px;border:1px solid #26313d;border-radius:10px;padding:9px;background:rgba(10,15,21,.55);font-size:12px}
.bulk-tools summary{cursor:pointer;font-weight:700;color:#b8c9da;padding:2px 0 6px}
.bulk-grid{display:grid;grid-template-columns:1fr;gap:7px}
.bulk-grid label,.bulk-tools>label{display:flex;flex-direction:column;gap:4px;color:#91a0af}
.bulk-grid input,.bulk-tools textarea{width:100%;min-width:0;background:#0c1117;color:#e8edf3;border:1px solid #2b3744;border-radius:8px;padding:8px}
.bulk-grid button{width:100%;font-size:12px;padding:8px}
#bulkProgress{line-height:1.5;overflow-wrap:anywhere;margin-top:8px}
#headerReadable{resize:vertical;font-family:ui-monospace,SFMono-Regular,Consolas,monospace;font-size:11px;min-height:80px}
body.light .bulk-tools{background:#f8fafc;border-color:#dce3e9}body.light .bulk-grid input,body.light .bulk-tools textarea{background:#fff;color:#17202a;border-color:#cdd7df}
