:root {
  --font: "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, "SF Pro Text", Inter, system-ui, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: "Cascadia Code", "SF Mono", ui-monospace, Menlo, Consolas, "Liberation Mono", monospace;
  --fs: 15px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --sidebar-w: 272px;
  --radius: 14px;
}
[data-theme="dark"] {
  --bg: #212121; --bg-2: #262626; --sidebar: #181818; --elev: #2d2d2d; --elev-2: #353535;
  --border: rgba(255,255,255,.075); --border-2: rgba(255,255,255,.13);
  --text: #f3f3f3; --text-2: #b4b4be; --muted: #7d7d89; --hover: rgba(255,255,255,.055); --active: rgba(255,255,255,.09);
  --shadow: 0 20px 60px rgba(0,0,0,.55); --glow: .35; --ok: #3ccf7e; --warn: #f5b942; --err: #ff6b6b;
  --c0: #7cb7ff; --c1: #ff8a7a; --c2: #7ddc9b; --c3: #c792ea; --c4: #f5c76b; --c5: #5fd4d4; --c6: #ff9fc7; --c7: #a9b8ff; --c8: #b5e068; --c9: #ffa86b; --c10: #8fd3ff; --c11: #d4a5ff;
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #ffffff; --bg-2: #f7f7f8; --sidebar: #f4f4f5; --elev: #ffffff; --elev-2: #f0f0f2;
  --border: rgba(0,0,0,.08); --border-2: rgba(0,0,0,.15);
  --text: #18181b; --text-2: #3f3f46; --muted: #8a8a94; --hover: rgba(0,0,0,.05); --active: rgba(0,0,0,.08);
  --shadow: 0 20px 60px rgba(20,20,40,.18); --glow: .22; --ok: #1a9d5c; --warn: #b87a00; --err: #d33;
  --c0: #3b82f6; --c1: #ef5b4a; --c2: #1fa463; --c3: #8b5cf6; --c4: #d9a01e; --c5: #0e9f9f; --c6: #e0408a; --c7: #5468e8; --c8: #6a9a1a; --c9: #e8731f; --c10: #1a8fd6; --c11: #a855d8;
  color-scheme: light;
}
[data-theme="dark"][data-accent="mono"] { --accent: #f4f4f6; --on-accent: #212121; --accent-soft: rgba(255,255,255,.12); }
[data-theme="light"][data-accent="mono"] { --accent: #18181b; --on-accent: #ffffff; --accent-soft: rgba(0,0,0,.08); }
[data-accent="blue"]   { --accent: #4c8dff; --on-accent: #fff; --accent-soft: rgba(76,141,255,.18); }
[data-accent="violet"] { --accent: #8b6cff; --on-accent: #fff; --accent-soft: rgba(139,108,255,.18); }
[data-accent="green"]  { --accent: #2fbf71; --on-accent: #04130a; --accent-soft: rgba(47,191,113,.18); }
[data-accent="orange"] { --accent: #ff8a3d; --on-accent: #1a0c02; --accent-soft: rgba(255,138,61,.18); }
[data-accent="rose"]   { --accent: #ff5c8a; --on-accent: #fff; --accent-soft: rgba(255,92,138,.18); }

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { font-family: var(--font); font-size: var(--fs); color: var(--text); background: var(--bg); overflow: hidden; -webkit-font-smoothing: antialiased; transition: background .35s var(--ease), color .35s var(--ease); }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
textarea, input { font: inherit; color: inherit; }
::selection { background: var(--accent-soft); }
[hidden], .hidden { display: none !important; }
svg.lucide { width: 18px; height: 18px; stroke-width: 1.9; flex: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); background-clip: padding-box; border: 3px solid transparent; }
.num { font-variant-numeric: tabular-nums; }

#app { display: flex; height: 100vh; height: 100dvh; }

/* ───────── Sidebar ───────── */
#sidebar { width: var(--sidebar-w); flex: none; background: var(--sidebar); border-right: 1px solid var(--border); display: flex; flex-direction: column; transition: margin-left .38s var(--ease), opacity .3s; overflow: hidden; font-size: 13.5px; }
body.side-closed #sidebar { margin-left: calc(var(--sidebar-w) * -1); opacity: 0; pointer-events: none; }
.side-top { height: 52px; display: flex; align-items: center; justify-content: space-between; padding: 0 10px 0 18px; flex: none; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 15px; letter-spacing: -.01em; }
.brand b { font-weight: 640; }
.brand-logo { display: grid; place-items: center; width: 24px; height: 24px; color: var(--text); }
.brand-logo svg, .logo svg { width: 100%; height: 100%; }
.side-actions { padding: 4px 10px 8px; display: flex; flex-direction: column; gap: 2px; }
.side-btn { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 11px; border-radius: 9px; color: var(--text-2); text-align: left; transition: background .15s, color .15s, transform .15s var(--ease); }
.side-btn svg { width: 16px; height: 16px; }
.side-btn:hover { background: var(--hover); color: var(--text); }
.side-btn:active { transform: scale(.98); }
.side-btn.primary { color: var(--text); font-weight: 560; }
.side-btn span { flex: 1; }
kbd { font-family: var(--font); font-size: 11px; color: var(--muted); letter-spacing: .02em; opacity: 0; transition: opacity .2s; }
.side-btn:hover kbd { opacity: 1; }
.side-label { padding: 14px 20px 6px; font-size: 13px; color: var(--muted); }
#history { flex: 1; overflow-y: auto; padding: 0 10px 10px; }
.h-item { position: relative; display: flex; align-items: center; gap: 8px; padding: 7px 8px 7px 11px; border-radius: 9px; color: var(--text-2); cursor: pointer; animation: slideIn .4s var(--ease) both; transition: background .15s, color .15s; width: 100%; text-align: left; }
.h-item:hover { background: var(--hover); color: var(--text); }
.h-item.active { background: var(--active); color: var(--text); }
.h-item .h-t { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.h-item .h-t b { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.h-item .h-t small { color: var(--muted); font-size: 11.5px; }
.h-item .h-x { display: none; padding: 4px; border-radius: 6px; color: var(--muted); }
.h-item:hover .h-x { display: grid; }
.h-item .h-x:hover { background: var(--active); color: var(--text); }
.h-item .h-x svg { width: 14px; height: 14px; }
.h-run { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: pulse 1.2s ease-in-out infinite; flex: none; }
.empty-list { padding: 18px 14px; color: var(--muted); font-size: 13px; line-height: 1.55; text-align: center; }
.side-bottom { padding: 8px 10px 12px; border-top: 1px solid var(--border); }
.privacy { display: flex; align-items: center; gap: 8px; padding: 8px 11px 0; font-size: 12px; color: var(--muted); }
.privacy svg { width: 14px; height: 14px; color: var(--ok); }

.icon-btn { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; color: var(--text-2); transition: background .15s, color .15s, transform .2s var(--spring); flex: none; }
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn:active { transform: scale(.88); }
.icon-btn svg { width: 18px; height: 18px; }

/* ───────── Main ───────── */
#main { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; background: var(--bg); }
.topbar { height: 52px; display: flex; align-items: center; gap: 8px; padding: 0 14px; flex: none; position: relative; z-index: 6; }
#btn-expand { display: none; }
body.side-closed #btn-expand { display: grid; animation: pop .35s var(--spring); }
.title { font-weight: 500; font-size: 13.5px; color: var(--text); padding: 0 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 50vw; }
.spacer { flex: 1; }
.tb-btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-width: 32px; height: 30px; border-radius: 8px; border: 1px solid var(--border-2); color: var(--text-2); transition: background .15s, color .15s, transform .2s var(--spring); font-size: 13px; padding: 0 8px; }
.tb-btn.wide { padding: 0 12px; }
.tb-btn:hover { background: var(--hover); color: var(--text); }
.tb-btn:active { transform: scale(.94); }
.tb-btn svg { width: 15px; height: 15px; }
.proj-wrap { position: relative; }
.menu { position: absolute; min-width: 220px; background: var(--elev); border: 1px solid var(--border-2); border-radius: 14px; padding: 6px; box-shadow: var(--shadow); animation: pop .2s var(--ease); z-index: 30; }
.menu.down { top: calc(100% + 8px); left: 0; transform-origin: top left; }
.menu.down.right { left: auto; right: 0; transform-origin: top right; }
.menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: 9px; font-size: 14px; color: var(--text-2); text-align: left; }
.menu button:hover { background: var(--hover); color: var(--text); }
.menu button svg { width: 16px; height: 16px; }
.menu small { margin-left: auto; color: var(--muted); font-size: 12px; }

#scroll { flex: 1; overflow-y: auto; position: relative; scroll-behavior: smooth; }

/* empty state */
#empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 0 24px 130px; overflow: hidden; transition: opacity .3s, transform .4s var(--ease); }
body.has-analysis #empty { opacity: 0; transform: translateY(-14px) scale(.98); pointer-events: none; }
.glow { position: absolute; width: 520px; height: 520px; border-radius: 50%; filter: blur(110px); pointer-events: none; animation: drift 14s ease-in-out infinite alternate; }
.g1 { background: radial-gradient(circle, var(--accent) 0%, transparent 70%); top: -8%; left: 8%; opacity: calc(var(--glow) * .3); }
.g2 { background: radial-gradient(circle, #6a7cff 0%, transparent 70%); bottom: -22%; right: 6%; animation-delay: -6s; opacity: calc(var(--glow) * .5); }
#empty .logo { position: relative; width: 54px; height: 54px; margin-bottom: 18px; color: var(--text); animation: float 5s ease-in-out infinite; }
#empty h1 { position: relative; font-size: 30px; line-height: 1.2; font-weight: 620; letter-spacing: -.025em; margin-bottom: 12px; animation: rise .6s .05s var(--ease) both; }
#empty .lede { position: relative; color: var(--muted); max-width: 520px; line-height: 1.6; margin-bottom: 26px; font-size: 14.5px; animation: rise .6s .12s var(--ease) both; }
.dropzone { position: relative; display: flex; align-items: center; gap: 16px; width: min(520px, 100%); padding: 18px 22px; border: 1.5px dashed var(--border-2); border-radius: 18px; background: color-mix(in srgb, var(--elev) 70%, transparent); backdrop-filter: blur(10px); text-align: left; transition: transform .3s var(--ease), border-color .2s, background .2s, box-shadow .3s; animation: rise .6s .18s var(--ease) both; }
.dropzone:hover, .dropzone.over { transform: translateY(-3px); border-color: var(--accent); background: var(--elev); box-shadow: 0 14px 40px rgba(0,0,0,.22); }
.dropzone:active { transform: scale(.985); }
.dz-ic { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; background: var(--active); color: var(--text); flex: none; transition: transform .4s var(--spring); }
.dropzone:hover .dz-ic { transform: translateY(-3px) rotate(-6deg); }
.dz-ic svg { width: 22px; height: 22px; }
.dz-t { display: flex; flex-direction: column; gap: 3px; }
.dz-t b { font-weight: 600; font-size: 15px; } .dz-t small { color: var(--muted); font-size: 13px; }
.fmt-chips { position: relative; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; max-width: 560px; margin: 18px 0 14px; animation: rise .6s .24s var(--ease) both; }
.fmt { font-family: var(--mono); font-size: 11.5px; color: var(--muted); padding: 3px 8px; border-radius: 6px; border: 1px solid var(--border); background: transparent; }
.empty-actions { position: relative; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; animation: rise .6s .3s var(--ease) both; }
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--border-2); color: var(--text-2); font-size: 13px; background: var(--bg); transition: background .15s, color .15s, transform .2s var(--spring); }
.chip svg { width: 14px; height: 14px; }
.chip:hover { background: var(--hover); color: var(--text); transform: translateY(-2px); }
.chip:active { transform: scale(.95); }

/* ───────── Results ───────── */
#results { max-width: 860px; margin: 0 auto; padding: 8px 24px 48px; }
.summary { animation: rise .5s var(--ease) both; margin-bottom: 22px; }
.sum-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.sum-num { font-size: 52px; line-height: 1; font-weight: 650; letter-spacing: -.035em; }
.sum-lbl { color: var(--text-2); font-size: 14px; margin-top: 8px; }
.sum-lbl span { color: var(--muted); }
.stats { display: flex; gap: 8px; flex-wrap: wrap; }
.stat { padding: 8px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg-2); min-width: 92px; }
.stat b { display: block; font-size: 17px; font-weight: 600; } .stat small { color: var(--muted); font-size: 12px; }
.splitbar { display: flex; height: 12px; border-radius: 999px; overflow: hidden; background: var(--active); margin: 20px 0 6px; gap: 2px; }
.splitbar i { display: block; height: 100%; min-width: 3px; transition: flex-grow .7s var(--ease); transform-origin: left; animation: grow .8s var(--ease) both; border-radius: 2px; }
.progress-line { height: 2px; border-radius: 2px; background: var(--active); overflow: hidden; margin: 12px 0 0; }
.progress-line i { display: block; height: 100%; background: var(--accent); transition: width .3s var(--ease); }

.toolbar { display: flex; align-items: center; gap: 10px; margin: 26px 0 10px; flex-wrap: wrap; }
.toolbar h2 { font-size: 15px; font-weight: 600; flex: 1; letter-spacing: -.01em; }
.toolbar h2 small { color: var(--muted); font-weight: 400; margin-left: 6px; }
.search { display: flex; align-items: center; gap: 8px; padding: 0 10px; height: 32px; border-radius: 9px; border: 1px solid var(--border-2); background: var(--bg); color: var(--muted); min-width: 180px; transition: border-color .2s, box-shadow .2s; }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search svg { width: 14px; height: 14px; }
.search input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; font-size: 13.5px; color: var(--text); }
.seg { display: inline-flex; background: var(--sidebar); border: 1px solid var(--border); border-radius: 10px; padding: 3px; }
.seg button { padding: 4px 11px; border-radius: 7px; font-size: 13px; color: var(--text-2); display: flex; align-items: center; gap: 6px; transition: background .2s, color .2s; }
.seg button.on { background: var(--active); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.2); }

.lang { position: relative; border-radius: 12px; border: 1px solid transparent; transition: background .15s, border-color .2s; animation: rise .45s var(--ease) both; }
.lang:hover { background: var(--hover); }
.lang.open { background: var(--bg-2); border-color: var(--border); }
.lang-main { display: grid; grid-template-columns: 26px minmax(0, 1.25fr) minmax(60px, 2fr) auto auto; align-items: center; gap: 14px; width: 100%; padding: 11px 14px; text-align: left; }
.rank { color: var(--muted); font-size: 12.5px; text-align: right; }
.lname { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.lname b { font-weight: 560; display: flex; align-items: center; gap: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lname b i { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.lname small { color: var(--muted); font-size: 12px; padding-left: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lbar { height: 8px; border-radius: 999px; background: var(--active); overflow: hidden; }
.lbar i { display: block; height: 100%; border-radius: inherit; transform-origin: left; animation: grow .8s var(--ease) both; transition: width .6s var(--ease); }
.lcount { font-weight: 600; font-size: 15px; min-width: 70px; text-align: right; }
.lpct { color: var(--muted); font-size: 13px; width: 52px; text-align: right; }
.lang-more { display: none; padding: 2px 14px 14px 54px; }
.lang.open .lang-more { display: block; animation: rise .3s var(--ease); }
.kv { display: flex; gap: 22px; flex-wrap: wrap; color: var(--text-2); font-size: 13px; margin-bottom: 10px; }
.kv span b { color: var(--text); font-weight: 600; }
.subrow { display: flex; align-items: center; gap: 12px; padding: 5px 0; font-size: 13px; color: var(--text-2); }
.subrow .sn { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.subrow .sb { width: 120px; height: 5px; border-radius: 99px; background: var(--active); overflow: hidden; } .subrow .sb i { display: block; height: 100%; border-radius: inherit; }
.subrow .sc { width: 70px; text-align: right; color: var(--text); }
.showmore { display: flex; margin: 8px auto 0; padding: 7px 16px; border-radius: 999px; border: 1px solid var(--border-2); color: var(--text-2); font-size: 13px; transition: background .15s, transform .2s var(--spring); }
.showmore:hover { background: var(--hover); color: var(--text); } .showmore:active { transform: scale(.95); }
.note { color: var(--muted); font-size: 12.5px; line-height: 1.6; margin-top: 14px; padding: 0 14px; }
.none { padding: 26px; text-align: center; color: var(--muted); }

/* files */
.files { display: flex; flex-direction: column; gap: 8px; }
.file { border: 1px solid var(--border); border-radius: 14px; background: var(--bg-2); overflow: hidden; animation: rise .4s var(--ease) both; transition: border-color .2s; }
.file:hover { border-color: var(--border-2); }
.file-main { display: flex; align-items: center; gap: 12px; padding: 11px 12px; width: 100%; text-align: left; }
.f-ic { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--active); color: var(--text-2); flex: none; }
.f-ic svg { width: 17px; height: 17px; }
.f-ic.run svg { animation: spin 1s linear infinite; } .f-ic.done { color: var(--ok); } .f-ic.error { color: var(--err); } .f-ic.warn { color: var(--warn); }
.f-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.f-t b { font-weight: 560; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.f-t small { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.f-t small.err { color: var(--err); white-space: normal; }
.f-w { text-align: right; flex: none; font-weight: 600; } .f-w small { display: block; font-weight: 400; color: var(--muted); font-size: 11.5px; }
.f-act { display: flex; gap: 2px; flex: none; }
.f-act .icon-btn { width: 28px; height: 28px; } .f-act svg { width: 15px; height: 15px; }
.f-bar { display: flex; height: 4px; gap: 1px; background: var(--active); } .f-bar i { display: block; height: 100%; }
.f-prog { height: 3px; background: var(--active); } .f-prog i { display: block; height: 100%; background: var(--accent); transition: width .25s; }
.f-more { display: none; padding: 4px 14px 12px 60px; } .file.open .f-more { display: block; animation: rise .3s var(--ease); }
.warn-line { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; color: var(--warn); padding: 3px 0; } .warn-line svg { width: 14px; height: 14px; margin-top: 2px; }

/* ───────── Dock / composer ───────── */
#dock { flex: none; padding: 0 24px 10px; max-width: 784px; width: 100%; margin: 0 auto; position: relative; z-index: 4; }
#composer { position: relative; background: var(--elev); border: 1px solid var(--border); border-radius: 26px; padding: 14px 14px 10px 20px; transition: border-color .2s, box-shadow .3s; }
#composer:focus-within { border-color: var(--border-2); box-shadow: 0 0 0 4px var(--accent-soft); }
#input { display: block; width: 100%; resize: none; border: 0; outline: 0; background: transparent; line-height: 1.55; max-height: 200px; padding: 2px 0 10px; font-size: 15px; }
#input::placeholder { color: var(--muted); }
.comp-row { display: flex; align-items: center; justify-content: space-between; }
.comp-left, .comp-right { display: flex; align-items: center; gap: 4px; }
.model { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); padding: 4px 8px; }
.model svg { width: 13px; height: 13px; }
#btn-send { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: var(--on-accent); transition: transform .25s var(--spring), opacity .2s, filter .2s; }
#btn-send:hover:not(:disabled) { transform: scale(1.08); filter: brightness(1.08); }
#btn-send:active:not(:disabled) { transform: scale(.9); }
#btn-send:disabled { opacity: .28; cursor: default; }
#btn-send svg { width: 18px; height: 18px; stroke-width: 2.4; }
.dock-foot { text-align: center; font-size: 12px; color: var(--muted); padding: 9px 8px 0; min-height: 28px; }

/* ───────── Overlay / modals / palette ───────── */
#overlay { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(0,0,0,.5); backdrop-filter: blur(6px); animation: fade .2s ease; }
#overlay.top { place-items: start center; padding-top: 14vh; }
.modal { width: min(780px, 94vw); height: min(580px, 88vh); background: var(--bg-2); border: 1px solid var(--border-2); border-radius: 20px; box-shadow: var(--shadow); display: flex; overflow: hidden; animation: modalIn .35s var(--spring); }
.m-nav { width: 196px; flex: none; background: var(--sidebar); border-right: 1px solid var(--border); padding: 16px 10px; display: flex; flex-direction: column; gap: 2px; }
.m-nav h3 { padding: 4px 12px 12px; font-size: 16px; }
.m-nav button { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; color: var(--text-2); text-align: left; transition: background .15s; font-size: 14px; }
.m-nav button:hover { background: var(--hover); } .m-nav button.on { background: var(--active); color: var(--text); font-weight: 560; }
.m-nav svg { width: 16px; height: 16px; }
.m-body { flex: 1; min-width: 0; padding: 22px 28px; overflow-y: auto; position: relative; }
.m-close { position: absolute; top: 12px; right: 12px; }
.m-pane { animation: rise .35s var(--ease); }
.m-pane h2 { font-size: 18px; margin-bottom: 4px; } .m-pane > p { color: var(--muted); font-size: 13.5px; margin-bottom: 16px; line-height: 1.55; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.row:last-child { border-bottom: 0; }
.row .r-t b { display: block; font-weight: 560; font-size: 14.5px; } .row .r-t small { color: var(--muted); font-size: 12.8px; line-height: 1.5; }
.swatches { display: flex; gap: 10px; }
.sw { width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; outline: 2px solid transparent; outline-offset: 2px; transition: transform .25s var(--spring), outline-color .2s; }
.sw:hover { transform: scale(1.15); } .sw.on { outline-color: var(--text); }
.toggle { position: relative; width: 42px; height: 24px; border-radius: 999px; background: var(--active); transition: background .25s; flex: none; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4); transition: transform .3s var(--spring); }
.toggle.on { background: var(--accent); } .toggle.on::after { transform: translateX(18px); }
[data-accent="mono"] .toggle.on::after { background: var(--on-accent); }
.btn { padding: 8px 14px; border-radius: 10px; border: 1px solid var(--border-2); color: var(--text); font-size: 13.5px; transition: background .15s, transform .15s; display: inline-flex; gap: 7px; align-items: center; }
.btn:hover { background: var(--hover); } .btn:active { transform: scale(.96); } .btn svg { width: 15px; height: 15px; }
.btn.danger { color: var(--err); border-color: color-mix(in srgb, var(--err) 40%, transparent); }
.lang-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 2px 14px; margin-top: 12px; }
.lg { display: flex; flex-direction: column; padding: 6px 8px; border-radius: 8px; line-height: 1.3; font-size: 13.5px; } .lg:hover { background: var(--hover); } .lg small { color: var(--muted); font-size: 12px; }
.ext-grid { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 16px; }
.about { text-align: center; padding-top: 26px; } .about .logo { width: 56px; height: 56px; margin: 0 auto 16px; animation: float 5s ease-in-out infinite; }
.about h2 { font-size: 22px; } .about p { max-width: 440px; margin: 10px auto; }
.m-in { width: 100%; background: var(--bg); border: 1px solid var(--border-2); border-radius: 10px; padding: 8px 12px; color: var(--text); outline: none; font-size: 14px; }
.m-in:focus { border-color: var(--accent); }

.palette { width: min(600px, 92vw); background: var(--bg-2); border: 1px solid var(--border-2); border-radius: 18px; box-shadow: var(--shadow); overflow: hidden; animation: modalIn .3s var(--spring); }
.palette .p-in { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); color: var(--muted); }
.palette input { flex: 1; background: none; border: 0; outline: 0; color: var(--text); font-size: 16px; }
.p-list { max-height: 360px; overflow-y: auto; padding: 8px; }
.p-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border-radius: 10px; color: var(--text-2); text-align: left; }
.p-item svg { width: 16px; height: 16px; }
.p-item.sel { background: var(--active); color: var(--text); }
.p-item small { margin-left: auto; color: var(--muted); font-size: 12px; }
.p-group { padding: 8px 12px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }

#drop { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(8px); animation: fade .15s; pointer-events: none; }
#drop > div { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 46px 70px; border: 2px dashed var(--accent); border-radius: 26px; color: var(--text-2); animation: pop .25s var(--spring); }
#drop svg { width: 36px; height: 36px; } #drop b { font-size: 18px; color: var(--text); } #drop span { font-size: 13px; color: var(--muted); }

#toasts { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 99; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; background: var(--elev-2); border: 1px solid var(--border-2); padding: 10px 16px; border-radius: 12px; box-shadow: var(--shadow); font-size: 13.5px; max-width: min(460px, 92vw); animation: toastIn .4s var(--spring); }
.toast svg { width: 16px; height: 16px; } .toast.ok svg { color: var(--ok); } .toast.err svg { color: var(--err); }
.toast.out { animation: toastOut .3s var(--ease) forwards; }

[data-motion="off"] *, [data-motion="off"] *::before, [data-motion="off"] *::after { animation-duration: .001s !important; animation-iteration-count: 1 !important; transition-duration: .001s !important; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001s !important; animation-iteration-count: 1 !important; transition-duration: .001s !important; scroll-behavior: auto !important; } }

@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes slideIn { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: scale(.88); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(18px) scale(.95); } to { opacity: 1; transform: none; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(16px) scale(.9); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px) scale(.95); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes float { 50% { transform: translateY(-7px); } }
@keyframes drift { to { transform: translate(60px, 40px) scale(1.15); } }
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes pulse { 50% { opacity: .35; transform: scale(.8); } }

@media (max-width: 820px) {
  #sidebar { position: absolute; z-index: 40; height: 100%; box-shadow: var(--shadow); }
  body:not(.side-closed) #main::after { content: ""; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 35; }
  .lang-main { grid-template-columns: 22px minmax(0, 1fr) auto auto; gap: 10px; } .lbar { display: none; }
  .lang-more { padding-left: 14px; } .sum-num { font-size: 42px; }
  .m-nav { width: 58px; } .m-nav span, .m-nav h3 { display: none; } .m-nav button { justify-content: center; }
  #results { padding: 8px 14px 40px; } #dock { padding: 0 12px 8px; } .m-body { padding: 18px 16px; } .row { gap: 12px; }
  .f-w { display: none; } .subrow .sb { display: none; }
}

#results.settled .lang, #results.settled .file, #results.settled .summary, #results.settled .lbar i, #results.settled .splitbar i { animation: none; }

.ocr-chip.on { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.ocr-chip { padding: 5px 11px; font-size: 12.5px; }

/* ───────── responsive empty state: never clip, scroll when the viewport is short ───────── */
#empty { justify-content: flex-start; overflow-x: hidden; overflow-y: auto; padding: 8px 20px 24px; }
#empty .glow { position: fixed; }
#empty .logo { margin-top: auto; width: clamp(40px, 7vh, 54px); height: clamp(40px, 7vh, 54px); flex: none; }
#empty .empty-actions { margin-bottom: auto; }
#empty h1 { font-size: clamp(24px, 4.2vw, 32px); }
#empty .lede { font-size: clamp(13.5px, 1.6vw, 14.5px); margin-bottom: clamp(14px, 3vh, 26px); }
.fmt-chips { margin: clamp(10px, 2.4vh, 18px) 0 clamp(10px, 2vh, 14px); }
@media (max-height: 720px) { #empty .lede { display: none; } #empty h1 { margin-bottom: 14px; } .dz-ic { width: 40px; height: 40px; } .dropzone { padding: 12px 18px; } }
@media (max-height: 560px) { .fmt-chips { display: none; } #empty .logo { display: none; } }
@media (max-width: 520px) {
  #empty h1 br { display: none; } .dropzone { padding: 14px; gap: 12px; } .fmt { font-size: 11px; padding: 2px 6px; }
  .empty-actions .chip { font-size: 12.5px; padding: 6px 11px; } .summary .stats { width: 100%; } .stat { flex: 1; min-width: 0; }
  .toolbar .search { flex: 1; min-width: 0; } .m-body { padding: 16px 14px; } .modal { height: 92vh; }
  #dock { padding: 0 10px 6px; } #composer { border-radius: 22px; padding: 12px 10px 8px 14px; } .model { display: none; }
}
@supports (height: 100dvh) { #app { height: 100dvh; } }
.brand-logo img, .logo img { width: 100%; height: 100%; object-fit: contain; display: block; }

/* ── share dialog ── */
.modal.share { width: min(640px, 94vw); height: auto; max-height: 92vh; }
.modal.share .m-body { padding: 24px 26px 26px; }
.modal.share h2 { margin: 0 0 6px; font-size: 20px; letter-spacing: -.01em; }
.sh-p { margin: 0 0 16px; color: var(--text-2); font-size: 13.5px; line-height: 1.55; max-width: 52ch; }
.sh-l { display: grid; gap: 6px; font-size: 12.5px; color: var(--muted); margin-bottom: 14px; }
.sh-l input, .sh-link input { width: 100%; background: var(--bg); border: 1px solid var(--border-2); color: var(--text); border-radius: 10px; padding: 10px 12px; font: inherit; font-size: 14px; outline: none; transition: border-color .15s, box-shadow .15s; }
.sh-l input:focus, .sh-link input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.sh-prev { position: relative; aspect-ratio: 1200 / 630; border-radius: 12px; overflow: hidden; background: var(--bg); border: 1px solid var(--border-2); margin-bottom: 14px; }
.sh-prev img { display: block; width: 100%; height: 100%; object-fit: cover; transition: opacity .25s; }
.sh-prev img.loading { opacity: .25; }
.sh-load { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; text-align: center; font-size: 13px; color: var(--muted); }
.sh-load[hidden] { display: none; }
.sh-link { display: flex; gap: 8px; margin-bottom: 10px; }
.sh-link input { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; text-overflow: ellipsis; }
.btn.primary { background: var(--accent); color: var(--on-accent); border-color: transparent; font-weight: 600; white-space: nowrap; }
.btn.primary:hover { background: var(--accent); filter: brightness(1.08); }
.sh-act { display: flex; gap: 8px; flex-wrap: wrap; }
.sh-note { margin: 12px 0 0; font-size: 12.5px; color: var(--muted); }
@media (max-width: 520px) { .modal.share .m-body { padding: 20px 16px 20px; } .sh-link { flex-direction: column; } }
