/* ==========================================================================
   Literati — marketing site. Cursor-style shell + faithful Midnight app mockup
   ========================================================================== */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --page-bg: #0b0b10;
  --page-bg-soft: #101019;
  --page-text: #ececf1;
  --page-muted: #9a9aa8;
  --page-faint: #6c6c7a;
  --page-border: rgba(255,255,255,0.08);

  /* app window — sampled from real screenshots */
  --bg-primary: #1a1a2e;     /* editor, pdf pane, inputs, active tab */
  --bg-secondary: #15213e;   /* topbar, sidebar */
  --bg-tertiary: #0f3460;    /* accent buttons (Compile, find papers) */
  --bg-hover: #1e2a4a;
  --bg-selected: #253a5e;
  --bg-iconactive: #2a3358;
  --text-primary: #e0e0e0;
  --text-secondary: #a0a0b0;
  --text-muted: #707080;
  --accent: #82aaff;
  --border: #25304f;
  --border-light: #38456a;
  --success: #4caf50;
  --error: #f44336;
  --st-add: #2ea043;
  --st-mod: #2563eb;
  --st-del: #dc2626;

  --syntax-keyword: #82aaff;
  --syntax-math: #a78bfa;
  --syntax-label: #ffa657;
  --syntax-number: #f78c6c;
  --syntax-comment: #6b7a99;
  --syntax-string: #a8b3c2;
  --syntax-content: #e8eaed;
  --syntax-bracket: #6a7595;

  --radius-sm: 4px; --radius-md: 6px; --radius-lg: 8px; --radius-xl: 14px;
  --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', Monaco, Consolas, monospace;
}

html { scroll-behavior: smooth; scroll-padding-top: 90px; }
body { font-family: var(--font-ui); background: var(--page-bg); color: var(--page-text); line-height: 1.6; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; overflow-x: hidden; }
a { color: inherit; text-decoration: none; }
.container { max-width: 1180px; margin: 0 auto; padding: 0 24px; }

/* ---------- Nav ---------- */
.nav { position: fixed; top: 0; left: 0; right: 0; z-index: 1000; background: rgba(11,11,16,0.72); backdrop-filter: saturate(160%) blur(14px); -webkit-backdrop-filter: saturate(160%) blur(14px); border-bottom: 1px solid transparent; transition: border-color .25s ease; }
.nav.scrolled { border-bottom-color: var(--page-border); }
.nav-inner { max-width: 1320px; margin: 0 auto; height: 64px; padding: 0 28px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.nav-brand { display: flex; align-items: center; }
.nav-wordmark { height: 22px; width: auto; display: block; }
.nav-links { display: flex; gap: 30px; position: absolute; left: 50%; transform: translateX(-50%); }
.nav-links a, .nav-link-quiet { font-size: .92rem; font-weight: 500; color: var(--page-muted); transition: color .18s ease; }
.nav-links a:hover, .nav-link-quiet:hover { color: var(--page-text); }
.nav-actions { display: flex; align-items: center; gap: 14px; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-ui); font-size: .95rem; font-weight: 600; padding: 11px 20px; border-radius: 999px; cursor: pointer; border: 1px solid transparent; white-space: nowrap; transition: transform .15s ease, background .18s ease, border-color .18s ease; }
.btn:hover { transform: translateY(-1px); }
.btn-white { background: #f4f4f5; color: #111; } .btn-white:hover { background: #fff; }
.btn-ghost { background: rgba(255,255,255,0.04); color: var(--page-text); border-color: var(--page-border); } .btn-ghost:hover { background: rgba(255,255,255,0.09); }
.btn-lg { padding: 14px 26px; font-size: 1rem; }
.nav-actions .btn { padding: 9px 16px; font-size: .9rem; }

/* ---------- Section scaffold ---------- */
.section { padding: 110px 0; position: relative; }
.section-head { max-width: 760px; margin-bottom: 40px; }
.section-head.center { margin-left: auto; margin-right: auto; text-align: center; }
.eyebrow { display: inline-block; font-size: .8rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #8f9bff; margin-bottom: 16px; }
.section h2 { font-size: 2.4rem; line-height: 1.1; font-weight: 700; letter-spacing: -.03em; color: #fff; margin-bottom: 16px; }
.section h2 em { font-style: italic; color: #c9a8ff; }
.section h2 .accent2 { color: #8f9bff; }
.section .lede { font-size: 1.18rem; color: var(--page-muted); max-width: 640px; }
.section .lede .hl { color: var(--page-text); font-weight: 500; }
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .7s ease, transform .7s ease; }
.reveal.in { opacity: 1; transform: none; }
.demo-caption { margin-top: 22px; text-align: center; font-size: 1.05rem; font-weight: 600; color: var(--page-text); }
.demo-caption .glow { background: linear-gradient(110deg,#9aa6ff,#c9a8ff); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }

/* demo wallpaper stage (same computer-screen backdrop as the hero) */
.demo-stage { position: relative; width: 100%; padding: 70px 24px; margin: 28px 0; overflow: hidden;
  background:
    linear-gradient(180deg, var(--page-bg), transparent 90px),
    linear-gradient(0deg, var(--page-bg), transparent 90px),
    linear-gradient(180deg,#d7c6a4 0%,#c8c1a6 22%,#aeb6ad 46%,#95a7b0 70%,#7f95a4 100%); }
.demo-stage::before { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(70% 60% at 75% 6%, rgba(255,247,225,.6), transparent 60%), radial-gradient(80% 50% at 14% 100%, rgba(70,92,120,.4), transparent 65%), radial-gradient(55% 45% at 96% 80%, rgba(120,140,120,.32), transparent 60%); }
.demo-stage .ide-window { position: relative; z-index: 1; max-width: 1060px; margin: 0 auto; box-shadow: 0 44px 96px rgba(0,0,0,.55), 0 0 0 1px rgba(0,0,0,.4); }

/* ====================== APP WINDOW ====================== */
.ide-window { background: var(--bg-primary); border: 1px solid var(--border); border-radius: var(--radius-xl); overflow: hidden; color: var(--text-primary); box-shadow: 0 30px 70px rgba(0,0,0,.45), 0 0 0 1px rgba(255,255,255,0.04); }
.section .ide-window { max-width: 1060px; margin: 0 auto; }

/* top bar */
.app-topbar { height: 46px; display: flex; align-items: center; background: var(--bg-secondary); border-bottom: 1px solid var(--border); padding: 0 14px; position: relative; }
.tb-left { display: flex; align-items: center; z-index: 1; }
.tb-logo { width: 22px; height: 22px; display: block; }
.tb-center { position: absolute; left: 50%; transform: translateX(-50%); font-size: 13px; color: var(--text-primary); font-weight: 500; }
.tb-caret { color: var(--text-muted); }
.tb-right { margin-left: auto; z-index: 1; }
.tb-share { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-primary); background: rgba(255,255,255,0.06); border: 1px solid var(--border-light); border-radius: 999px; padding: 5px 14px; }
.tb-share svg { width: 13px; height: 13px; }

/* body / 3-pane */
.app-body { display: flex; height: 560px; position: relative; overflow: hidden; }
.hero-window .app-body { height: 460px; }

/* sidebar */
.app-side { width: 252px; flex: 0 0 252px; background: var(--bg-secondary); border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.side-icons { display: flex; gap: 2px; padding: 7px 8px; border-bottom: 1px solid var(--border); }
.side-ic { width: 30px; height: 30px; border: none; background: transparent; color: var(--text-secondary); opacity: .55; border-radius: 6px; display: flex; align-items: center; justify-content: center; cursor: pointer; position: relative; transition: opacity .12s ease, background .12s ease; }
.side-ic svg { width: 18px; height: 18px; }
.side-ic:hover { opacity: 1; background: var(--bg-hover); }
.side-ic.active { opacity: 1; color: #cfd6ee; background: var(--bg-iconactive); }
.side-ic[data-tip]:hover::after { content: attr(data-tip); position: absolute; top: 34px; left: 0; background: var(--bg-primary); border: 1px solid var(--border); color: var(--text-primary); font-size: 11px; padding: 3px 8px; border-radius: 4px; white-space: nowrap; z-index: 40; font-family: var(--font-ui); }
.side-views { flex: 1; min-height: 0; position: relative; }
.side-view { display: none; }
.side-view.active { display: flex; flex-direction: column; height: 100%; min-height: 0; overflow-y: auto; }
.side-view[data-view="chat"].active { overflow: hidden; }

/* sidebar headings */
.sv-head { display: flex; align-items: center; gap: 6px; padding: 9px 14px 5px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
.sv-head--mt { margin-top: 8px; }
.sv-plus { margin-left: auto; opacity: .7; } .sv-plus svg { width: 13px; height: 13px; }
.sv-badge { background: var(--bg-tertiary); color: var(--text-secondary); border-radius: 999px; font-size: 10px; padding: 0 6px; }
.sv-empty { padding: 8px 16px; font-size: 12px; color: var(--text-muted); }

/* file tree */
.tree { padding: 2px 0; }
.tree-row { display: flex; align-items: center; gap: 6px; padding: 4px 14px; font-size: 12.5px; color: var(--text-secondary); cursor: default; }
.tree-row:hover { background: var(--bg-hover); }
.tree-row svg { width: 14px; height: 14px; color: var(--text-muted); flex: 0 0 14px; }
.tree-row .tw { width: 10px; flex: 0 0 10px; color: var(--text-muted); font-size: 9px; }
.tree-row .tn { color: var(--text-primary); }
.tree-row.indent { padding-left: 28px; }
.tree-row .tlock { margin-left: 6px; opacity: .7; } .tree-row .tlock svg { width: 11px; height: 11px; }
.tree-row .ic-sty svg { color: #a78bfa; }
.tree-row.flash { background: var(--bg-selected); }

/* file outline */
.ol-row .ol-sec { color: #8f9bff; font-size: 11px; width: 14px; flex: 0 0 14px; text-align: center; }
.ol-row .ol-ln { margin-left: auto; color: var(--text-muted); font-size: 10.5px; font-family: var(--font-mono); opacity: .8; }

/* git panel */
.vc-commit { padding: 4px 12px 8px; }
.vc-commit-input { background: var(--bg-primary); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 7px 9px; min-height: 32px; font-size: 12.5px; color: var(--text-primary); font-family: var(--font-ui); }
.vc-commit-input .ph { color: var(--text-muted); }
.vc-commit-btn { width: 100%; margin-top: 8px; background: var(--bg-iconactive); color: var(--text-primary); border: 1px solid var(--border-light); border-radius: var(--radius-sm); padding: 6px 12px; font-size: 12px; font-weight: 600; font-family: var(--font-ui); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.vc-commit-btn svg { width: 13px; height: 13px; } .vc-commit-btn.flash { background: #2f5e91; }
.vc-file { display: flex; align-items: center; gap: 6px; padding: 4px 14px; font-size: 12.5px; color: var(--text-secondary); }
.vc-file:hover { background: var(--bg-hover); }
.vc-dot { color: var(--st-mod); font-size: 9px; } .vc-name { color: var(--text-primary); } .vc-dir { color: var(--text-muted); font-size: 11px; } .vc-sp { flex: 1; }
.vc-pill { width: 15px; height: 15px; border-radius: 3px; font-size: 10px; font-weight: 700; color: #fff; display: flex; align-items: center; justify-content: center; }
.vc-pill.m { background: var(--st-mod); } .vc-pill.a { background: var(--st-add); } .vc-pill.d { background: var(--st-del); }
.vc-history { margin-top: 4px; }
.vc-hist { display: flex; align-items: center; gap: 6px; padding: 5px 14px; font-size: 12px; }
.vc-chev { color: var(--text-muted); } .vc-msg { flex: 1; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .vc-meta { color: var(--text-muted); font-size: 11px; }
.vc-revert { color: #8f9bff; font-size: 11px; opacity: 0; transition: opacity .15s ease; } .vc-hist:hover .vc-revert { opacity: 1; }
.vc-hist.head .vc-chev { color: #8f9bff; }

/* chat */
.chat-head { padding: 11px 14px; font-size: 13px; font-weight: 600; color: var(--text-primary); border-bottom: 1px solid var(--border); }
.agent-model { font-weight: 600; }
.agent-model.gemini { background: linear-gradient(110deg,#4f8cff,#a26bff); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.agent-model.claude { color: #d77757; }
.chat-msgs { flex: 1; min-height: 0; overflow: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.chat-suggest { display: flex; justify-content: flex-end; }
.suggest-pill { background: var(--bg-tertiary); color: #cfe0ff; font-size: 12px; border-radius: 999px; padding: 5px 14px; }
.msg { font-size: 13px; line-height: 1.5; animation: msgIn .3s ease; }
.msg.user { align-self: flex-end; max-width: 88%; background: var(--bg-tertiary); color: #e6edff; padding: 8px 12px; border-radius: var(--radius-md); }
.msg.assistant { color: var(--text-primary); }
.msg code { font-family: var(--font-mono); font-size: 12px; background: var(--bg-primary); border: 1px solid var(--border); border-radius: 3px; padding: 0 4px; color: var(--syntax-keyword); }
.msg.assistant ul { margin: 6px 0 0 16px; } .msg.assistant li { margin: 3px 0; }
@keyframes msgIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.tool-card { background: var(--bg-primary); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 7px 10px; font-family: var(--font-mono); font-size: 11.5px; color: var(--text-secondary); animation: msgIn .3s ease; }
.tool-card { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tool-card .tc-ic { color: #8f9bff; flex: 0 0 auto; }
.tool-card.running .tc-ic { display: inline-block; animation: spin .9s linear infinite; }
.tool-card.done .tc-ic { color: var(--success); }
.tool-card .tc-name { color: var(--syntax-keyword); } .tool-card .tc-args { color: var(--text-muted); }
.tool-card .tc-preview { flex-basis: 100%; margin-top: 5px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tool-card.err .tc-ic { color: var(--error); animation: none; }
.tc-diff { flex-basis: 100%; margin-top: 6px; border-top: 1px solid var(--border); padding-top: 6px; display: flex; flex-direction: column; gap: 1px; }
.tcd { font-size: 11px; line-height: 1.5; white-space: pre-wrap; border-radius: 2px; padding: 0 5px; }
.tcd.a { color: #7ee2a8; background: rgba(46,160,67,.13); }
.tcd.d { color: #ff9f97; background: rgba(220,38,38,.13); }
.tcd.h { color: #8f9bff; }
.found { display: flex; flex-direction: column; gap: 6px; animation: msgIn .3s ease; }
.found-head { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text-muted); }
.found-head .agent-model { font-size: 11.5px; }
.found-item { background: var(--bg-primary); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 7px 9px; display: flex; flex-direction: column; gap: 2px; }
.found-item .fi-key { font-family: var(--font-mono); font-size: 10.5px; color: #8f9bff; }
.found-item .fi-ttl { font-size: 12px; color: var(--text-primary); }
.found-item .fi-meta { font-size: 11px; color: var(--text-muted); }
.permission { border: 1px solid var(--border-light); border-radius: var(--radius-md); padding: 10px 12px; background: rgba(255,255,255,0.02); animation: msgIn .3s ease; }
.perm-title { font-family: var(--font-mono); font-size: 13px; font-weight: 600; color: var(--text-primary); }
.perm-desc { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); margin: 4px 0 8px; }
.perm-opt { display: flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: var(--radius-sm); font-size: 13px; color: var(--text-secondary); cursor: pointer; }
.perm-opt .perm-ind { width: 12px; color: var(--accent); } .perm-opt .perm-num { color: var(--text-muted); }
.perm-opt.sel { background: var(--bg-tertiary); color: var(--text-primary); } .perm-opt.clicked { background: var(--bg-selected); }
.perm-hint { font-size: 11px; color: var(--text-muted); margin-top: 6px; }
.typing { display: inline-flex; gap: 4px; padding: 4px 2px; }
.typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--text-muted); animation: typing 1.2s infinite ease-in-out; }
.typing span:nth-child(2) { animation-delay: .2s; } .typing span:nth-child(3) { animation-delay: .4s; }
@keyframes typing { 0%,60%,100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }
.chat-input { flex: 0 0 auto; border-top: 1px solid var(--border); padding: 10px 12px; }
.chat-box { border: 1px solid var(--border); border-radius: var(--radius-md); padding: 9px 11px; font-family: var(--font-mono); font-size: 12.5px; color: var(--text-muted); }
.chat-hint { display: flex; justify-content: space-between; margin-top: 6px; font-size: 11px; color: var(--text-muted); }

/* editor */
.app-editor { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--bg-primary); }
.ed-tabs { height: 36px; display: flex; align-items: center; background: var(--bg-primary); border-bottom: 1px solid var(--border); padding-right: 10px; }
.ed-tab { display: flex; align-items: center; gap: 7px; height: 100%; padding: 0 14px; font-size: 12.5px; color: var(--text-primary); border-right: 1px solid var(--border); }
.ed-tab svg { width: 14px; height: 14px; color: #8f9bff; }
.ed-x { opacity: .5; } .ed-sub { color: var(--text-muted); opacity: .7; }
.ed-mode { margin-left: auto; font-size: 12px; color: var(--text-secondary); border: 1px solid var(--border-light); border-radius: 6px; padding: 3px 10px; }
.ed-host { flex: 1; position: relative; min-height: 0; overflow: hidden; }
.cm { height: 100%; overflow: auto; padding: 12px 0; font-family: var(--font-mono); font-size: 13px; line-height: 1.7; color: var(--syntax-content); position: relative; }
.cm-line { display: flex; padding: 0 16px; white-space: pre-wrap; }
.cm-ln { width: 30px; flex: 0 0 30px; margin-right: 16px; text-align: right; color: var(--text-muted); opacity: .5; user-select: none; }
.cm-tx { flex: 1; min-width: 0; white-space: pre-wrap; }
.cm-gut { width: 12px; flex: 0 0 12px; margin-right: 4px; }
.cm-line.add { background: rgba(46,160,67,.16); } .cm-line.add .cm-gut { color: var(--st-add); }
.cm-line.del { background: rgba(220,38,38,.16); } .cm-line.del .cm-gut { color: var(--st-del); }
.tok-kw { color: var(--syntax-keyword); } .tok-math { color: var(--syntax-math); } .tok-label { color: var(--syntax-label); } .tok-num { color: var(--syntax-number); } .tok-com { color: var(--syntax-comment); font-style: italic; } .tok-str { color: var(--syntax-string); } .tok-br { color: var(--syntax-bracket); } .tok-cite { color: var(--syntax-label); }
.cm-caret { display: inline-block; width: 2px; height: 1.05em; vertical-align: text-bottom; background: var(--text-primary); margin-left: 1px; animation: caretBlink 1s steps(1) infinite; }
@keyframes caretBlink { 50% { opacity: 0; } }
.cite-pop { position: absolute; left: 58px; top: 60px; width: 320px; background: var(--bg-secondary); border: 1px solid var(--border-light); border-radius: var(--radius-md); box-shadow: 0 16px 40px rgba(0,0,0,.5); z-index: 25; overflow: hidden; }
.cite-pop-head { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-muted); padding: 7px 10px; border-bottom: 1px solid var(--border); }
.cite-opt { display: flex; align-items: baseline; gap: 10px; padding: 6px 10px; font-size: 12px; }
.cite-opt.selected { background: var(--bg-selected); }
.cite-opt .cite-key { font-family: var(--font-mono); color: #8f9bff; } .cite-opt .cite-ttl { color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pane-note { display: flex; gap: 8px; align-items: center; padding: 10px 16px; border-top: 1px solid var(--border); background: rgba(143,155,255,.06); color: var(--text-secondary); font-size: 12.5px; opacity: 0; transform: translateY(6px); transition: all .4s ease; }
.pane-note.show { opacity: 1; transform: none; }
.pane-note svg { width: 16px; height: 16px; flex: 0 0 16px; color: #8f9bff; }

/* pdf pane */
.app-pdf { flex: 0 0 38%; max-width: 42%; min-width: 0; display: flex; flex-direction: column; background: var(--bg-primary); border-left: 1px solid var(--border); }
.pdf-bar { height: 36px; display: flex; align-items: center; gap: 8px; padding: 0 10px; border-bottom: 1px solid var(--border); }
.pdf-compile { background: var(--bg-tertiary); color: #dbe6ff; border: none; border-radius: var(--radius-sm); padding: 5px 14px; font-size: 12.5px; font-weight: 600; font-family: var(--font-ui); cursor: pointer; }
.pdf-compile.cancel { background: transparent; border: 1px solid var(--text-muted); color: var(--text-secondary); }
.pdf-iconbtn { color: var(--text-secondary); opacity: .85; display: inline-flex; align-items: center; position: relative; cursor: pointer; background: none; border: none; }
.pdf-iconbtn svg { width: 16px; height: 16px; }
.pdf-iconbtn.has-err { color: #ffb3ad; opacity: 1; }
.pdf-errbadge { position: absolute; top: -6px; right: -8px; background: var(--error); color: #fff; border-radius: 999px; font-size: 9px; padding: 0 4px; }
.pdf-spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(255,255,255,.2); border-top-color: #ffce82; animation: spin .7s linear infinite; }
.pdf-status { font-size: 12px; color: var(--text-muted); }
.pdf-sp { flex: 1; }
.pdf-pagebox { border: 1px solid var(--border-light); border-radius: 4px; padding: 1px 8px; font-size: 11px; color: var(--text-primary); }
.pdf-pagetot { font-size: 11px; color: var(--text-muted); } .pdf-zoom { font-size: 12px; color: var(--text-secondary); }
.pdf-bar--redline .rl-toggle { border: 1px solid var(--border-light); border-radius: 3px; padding: 3px 9px; font-size: 11.5px; color: var(--text-secondary); }
.pdf-bar--redline .rl-toggle.active { background: var(--bg-tertiary); color: var(--text-primary); border-color: #1177bb; }
.rl-meta { font-size: 11px; color: var(--text-muted); margin-left: 4px; }
.pdf-body { flex: 1; overflow: auto; padding: 16px; display: flex; justify-content: center; align-items: flex-start; }
.pdf-page { background: #fff; color: #1a1a1a; width: 100%; max-width: 320px; aspect-ratio: 8.5 / 11; border-radius: 2px; box-shadow: 0 8px 24px rgba(0,0,0,.4); padding: 22px 24px; font-family: 'Times New Roman', Georgia, serif; font-size: 7px; line-height: 1.5; transition: opacity .2s ease; overflow: hidden; }
.pdf-page.flash { animation: pdfFlash .55s ease; }
@keyframes pdfFlash { 0% { opacity: .2; filter: brightness(1.7); } 100% { opacity: 1; filter: none; } }
.pp-rule { border-top: 1.5px solid #111; margin: 2px 0 8px; }
.pdf-page h4 { font-size: 9.5px; text-align: center; font-weight: bold; margin: 4px 0; }
.pp-authors { text-align: center; font-size: 6.5px; line-height: 1.5; margin: 8px 0; }
.pp-abs { text-align: center; font-weight: bold; font-size: 8.5px; margin: 10px 0 5px; }
.pp-sec { font-weight: bold; font-size: 8px; margin: 8px 0 3px; }
.pp-body { font-size: 7.5px; margin: 3px 0; display: flex; gap: 6px; }
.pp-n { color: #999; }
.pp-foot { font-size: 5.5px; text-align: center; color: #444; margin-top: 56px; }
.pdf-eq { font-family: var(--font-mono); font-size: 8px; color: #111; text-align: center; margin: 8px 0; padding: 5px; background: #f1f1f1; border-radius: 2px; }
.redline-page { font-size: 9px; }
.redline-page .pp-body, .redline-page p { font-size: 9px; margin: 6px 0; line-height: 1.6; }
.rl-add { color: #1558d6; text-decoration: underline; } .rl-del { color: #d11; text-decoration: line-through; }

/* log panel (Overleaf-style logs & errors) */
.logpanel { border-top: 1px solid var(--border); background: var(--bg-secondary); max-height: 0; overflow: hidden; transition: max-height .35s ease; }
.logpanel.open { max-height: 200px; }
.log-tabs { display: flex; border-bottom: 1px solid var(--border); }
.log-tab { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; font-size: 12px; color: var(--text-muted); border-bottom: 2px solid transparent; cursor: pointer; }
.log-tab:hover { color: var(--text-secondary); }
.log-tab.active { color: var(--text-primary); border-bottom-color: var(--accent); }
.log-cnt { background: var(--bg-hover); color: var(--text-secondary); border-radius: 8px; font-size: 10px; padding: 0 5px; }
.log-cnt:empty { display: none; }
.log-tab.active .log-cnt { background: var(--accent); color: var(--bg-primary); }
.log-fail { padding: 6px 12px; font-size: 12px; font-weight: 600; color: #ffb3ad; border-bottom: 1px solid var(--border); }
.log-list { overflow: auto; max-height: 140px; }
.log-row { display: flex; flex-direction: column; gap: 2px; padding: 7px 12px; border-left: 3px solid var(--border); border-bottom: 1px solid var(--border); font-family: var(--font-mono); }
.log-row.error { border-left-color: var(--error); }
.log-row.warning { border-left-color: #e0a92e; }
.log-row.info { border-left-color: var(--accent); }
.log-row .log-loc { font-size: 11px; color: var(--text-secondary); } .log-row .log-msg { font-size: 12.5px; color: var(--text-primary); }
.log-list[data-filter="error"] .log-row:not(.error) { display: none; }
.log-list[data-filter="warning"] .log-row:not(.warning) { display: none; }
.log-list[data-filter="info"] .log-row:not(.info) { display: none; }

/* peer cursors */
.peer-caret { position: absolute; width: 2px; height: 18px; z-index: 12; cursor: grab; display: none; }
.peer-caret.show { display: block; } .peer-caret.dragging { cursor: grabbing; }
.peer-flag { position: absolute; top: -15px; left: 0; white-space: nowrap; font-family: var(--font-ui); font-size: 10px; font-weight: 600; color: #fff; padding: 1px 6px; border-radius: 3px 3px 3px 0; }

/* palette */
.palette-overlay { position: absolute; inset: 0; z-index: 40; background: rgba(5,5,12,.4); display: flex; justify-content: center; padding-top: 54px; opacity: 0; pointer-events: none; transition: opacity .18s ease; }
.palette-overlay.show { opacity: 1; }
.palette { width: 520px; max-width: 84%; background: var(--bg-secondary); border: 1px solid var(--border-light); border-radius: var(--radius-lg); box-shadow: 0 24px 60px rgba(0,0,0,.55); overflow: hidden; transform: translateY(-8px) scale(.98); transition: transform .18s ease; }
.palette-overlay.show .palette { transform: none; }
.palette-input { display: flex; align-items: center; gap: 8px; padding: 11px 14px; border-bottom: 1px solid var(--border); font-size: 14px; color: var(--text-primary); }
.palette-input svg { width: 15px; height: 15px; color: var(--text-muted); }
.pal-typed { border-right: 2px solid #8f9bff; min-height: 18px; } .pal-ph { color: var(--text-muted); }
.palette-hint { padding: 4px 16px 6px; font-size: 11px; color: var(--text-muted); border-bottom: 1px solid var(--border); }
.palette-results { padding: 6px; max-height: 200px; overflow: auto; }
.palette-item { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--radius-sm); font-size: 13px; color: var(--text-secondary); }
.palette-item .pal-key { font-family: var(--font-mono); color: var(--text-primary); } .palette-item .pal-sub { color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-item .pal-actions { margin-left: auto; display: flex; gap: 4px; } .palette-item .pal-act { font-size: 11px; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 2px 8px; color: var(--text-muted); }
.palette-item.sel { background: var(--bg-selected); color: var(--text-primary); }

/* editor panes / tabs */
.ed-tab .ed-tab-ic { display: inline-flex; }
.ed-tab .ed-sub { color: var(--text-muted); opacity: .75; font-size: 11.5px; }
.ed-tab .ed-x { cursor: pointer; }
.ed-tab .ed-x:hover { opacity: 1; }
.ed-tab:not(.active) { opacity: .55; cursor: pointer; }
.ed-tab:not(.active):hover { opacity: .85; }
.ed-pane { display: none; height: 100%; min-height: 0; }
.ed-pane.active { display: block; }
.cm-diff { color: var(--syntax-content); }

/* literati.bib pane — read-only, generated from the library */
.ed-pane[data-pane="bib"].active { display: flex; flex-direction: column; }
.ed-pane[data-pane="bib"] .cm { flex: 1; min-height: 0; }
.ed-banner { display: flex; align-items: center; gap: 7px; padding: 6px 16px; font-size: 11.5px; color: #e8c66a; background: rgba(224,169,46,.08); border-bottom: 1px solid var(--border); }
.ed-banner svg { width: 12px; height: 12px; flex: 0 0 12px; }
.cm-line.bib-new { background: rgba(46,160,67,.14); animation: bibNew 1.4s ease; }
@keyframes bibNew { from { background: rgba(46,160,67,.5); } }

/* find & replace */
.fr-panel { padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.fr-row { display: flex; align-items: center; gap: 6px; }
.fr-input { flex: 1; min-width: 0; background: var(--bg-primary); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 9px; font-family: var(--font-mono); font-size: 12px; color: var(--text-primary); }
.fr-input:focus { outline: none; border-color: #1177bb; }
.fr-input::placeholder { color: var(--text-muted); }
.fr-btn { background: var(--bg-tertiary); color: #dbe6ff; border: none; border-radius: var(--radius-sm); padding: 6px 10px; font-size: 11.5px; font-weight: 600; cursor: pointer; font-family: var(--font-ui); white-space: nowrap; }
.fr-btn:hover { background: var(--bg-selected); }
.fr-opts { display: flex; gap: 6px; }
.fr-tog { width: 26px; height: 22px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: 4px; font-size: 11px; color: var(--text-muted); cursor: pointer; font-family: var(--font-mono); user-select: none; }
.fr-tog:hover { background: var(--bg-hover); }
.fr-tog.on { background: var(--bg-iconactive); color: #cfd6ee; border-color: #1177bb; }
.fr-count { font-size: 11.5px; color: var(--text-muted); padding-top: 2px; }
mark.fr-hit { background: #5a4a1c; color: #ffe6a3; border-radius: 2px; }
mark.fr-hit.cur { background: #e0a92e; color: #201a08; }
.cm-code.fr-flash { animation: pdfFlash .5s ease; }

/* library */
.lib-filter { margin: 8px 12px 4px; background: var(--bg-primary); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 9px; font-size: 12px; color: var(--text-primary); font-family: var(--font-ui); }
.lib-filter:focus { outline: none; border-color: #1177bb; }
.lib-filter::placeholder { color: var(--text-muted); }
.lib-list { display: flex; flex-direction: column; }
.lib-item { padding: 9px 14px; border-bottom: 1px solid var(--border); cursor: pointer; display: flex; flex-direction: column; gap: 3px; }
.lib-item:hover { background: var(--bg-hover); }
.lib-item.sel { background: var(--bg-selected); box-shadow: inset 2px 0 0 #8f9bff; }
.lib-item .lib-key { font-family: var(--font-mono); font-size: 10px; color: #8f9bff; }
.lib-item .lib-ttl { font-size: 12.5px; color: var(--text-primary); line-height: 1.35; }
.lib-item .lib-meta { font-size: 10.5px; color: var(--text-muted); }

/* git — clickable changed files */
.vc-file[data-diff] { cursor: pointer; }
.vc-file.sel { background: var(--bg-selected); box-shadow: inset 2px 0 0 #8f9bff; }

/* pdf viewer (opened library paper) */
.pdf-viewer { height: 100%; overflow: auto; background: #2a2c31; padding: 22px 0 30px; }
.fig-card { background: #fff; width: 90%; max-width: 500px; margin: 0 auto; padding: 24px 20px 18px; border-radius: 2px; box-shadow: 0 12px 44px rgba(0,0,0,.5); }
.fig-card svg { display: block; width: 100%; height: auto; }
.paper { background: #fff; color: #14151a; width: 90%; max-width: 560px; margin: 0 auto; padding: 40px 46px 46px; font-family: Georgia, 'Times New Roman', serif; box-shadow: 0 12px 44px rgba(0,0,0,.5); font-size: 12.5px; line-height: 1.6; }
.paper h1 { font-size: 18px; line-height: 1.28; text-align: center; margin: 0 0 14px; font-weight: 700; }
.paper .p-authors { text-align: center; font-size: 11.5px; color: #2a2a2a; margin-bottom: 3px; }
.paper .p-aff { text-align: center; font-size: 10.5px; color: #777; margin-bottom: 18px; }
.paper .p-abs { font-size: 11.5px; margin: 0 18px 18px; color: #222; text-align: justify; }
.paper .p-abs b { display: block; text-align: center; letter-spacing: .05em; text-transform: uppercase; margin-bottom: 5px; font-size: 11px; }
.paper h2 { font-size: 13px; margin: 16px 0 6px; font-weight: 700; }
.paper p { margin: 0 0 9px; text-align: justify; }
.paper i { font-style: italic; }
.paper .p-fig { border: 1px solid #d5d5d5; background: #fbfbfb; padding: 16px 14px 12px; margin: 14px 0; text-align: center; }
.paper .p-fig .bars { display: flex; align-items: flex-end; justify-content: center; gap: 16px; height: 96px; margin: 6px 0 22px; }
.paper .p-fig .bar { width: 34px; border-radius: 2px 2px 0 0; position: relative; }
.paper .p-fig .bar span { position: absolute; top: -15px; left: -6px; right: -6px; font-size: 9px; color: #222; font-family: var(--font-ui); }
.paper .p-fig .bar small { position: absolute; bottom: -16px; left: -8px; right: -8px; font-size: 8.5px; color: #666; font-family: var(--font-ui); }
.paper .p-cap { font-size: 10px; color: #555; text-align: left; }
.paper .p-refs { font-size: 10px; color: #444; margin-top: 16px; border-top: 1px solid #e2e2e2; padding-top: 10px; }
.paper .p-refs div { margin-bottom: 4px; padding-left: 16px; text-indent: -16px; }

/* demo controls */
.demo-controls { display: flex; align-items: center; gap: 14px; padding: 8px 14px; border-top: 1px solid var(--border); background: var(--bg-secondary); }
.replay-btn { width: 28px; height: 28px; flex: 0 0 28px; display: inline-flex; align-items: center; justify-content: center; background: transparent; border: 1px solid var(--border-light); color: var(--text-secondary); border-radius: 50%; padding: 0; cursor: pointer; position: relative; transition: background .15s ease, color .15s ease; }
.replay-btn svg { width: 13px; height: 13px; }
.replay-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.replay-btn[data-tip]:hover::after { content: attr(data-tip); position: absolute; bottom: 34px; left: 0; background: var(--bg-primary); border: 1px solid var(--border); color: var(--text-primary); font-size: 11px; padding: 3px 8px; border-radius: 4px; white-space: nowrap; z-index: 40; font-family: var(--font-ui); }
.ctrl-tip { font-size: 11px; color: var(--text-muted); }
@keyframes spin { to { transform: rotate(360deg); } }

/* footer */
.footer { border-top: 1px solid var(--page-border); padding: 40px 0; text-align: center; color: var(--page-faint); font-size: .88rem; }
.footer a { color: var(--page-muted); margin: 0 12px; } .footer a:hover { color: var(--page-text); }
.footer .legal { margin-bottom: 12px; }

/* responsive */
@media (max-width: 860px) { .app-pdf { display: none; } }
@media (max-width: 760px) {
  .section { padding: 70px 0; } .section h2 { font-size: 1.8rem; }
  .app-body { height: 500px; } .app-side { width: 210px; flex: 0 0 210px; }
}
@media (max-width: 560px) {
  .nav-inner { padding: 0 16px; }
  .app-side { display: none; }
}
