/* Documents — the app chrome. Tokens on :root; dark is the default look, light follows the OS or the theme switch. */
:root {
  --ink: #0a0a0a; --lime: #e7efff;
  --font-ui: 'Inter Tight', 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;
  --bg: #0e0e10; --panel: #151518; --panel-2: #1d1d22; --desk: #2a2a30; --line: #24242a; --line-2: #33333b;
  --fg: #ececef; --dim: #a3a3ad; --faint: #6c6c76; --accent: #e7efff; --accent-ink: #0a0a0a;
  --hover: #24242b; --active: #2e2e36; --input: #0f0f12; --sel: rgba(96, 165, 250, .35); --danger: #ff5a6e;
  --paper: #ffffff; --paper-ink: #000000; --radius: 8px;
  --sui-bg: var(--panel); --sui-bg2: var(--panel-2); --sui-input: var(--input); --sui-line: var(--line-2); --sui-fg: var(--fg); --sui-dim: var(--dim);
  --sui-faint: var(--faint); --sui-hover: var(--hover); --sui-sel: var(--active); --sui-accent: var(--accent); --sui-accent-ink: var(--accent-ink);
  --sui-font: var(--font-ui); --sui-mono: var(--mono); --sui-radius: 6px;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="pro"]) { --bg: #f4f4f1; --panel: #ffffff; --panel-2: #f1f1ee; --desk: #dcdcd6; --line: #e2e2dc; --line-2: #cfcfc7; --fg: #15151a; --dim: #55555f; --faint: #8a8a94; --hover: #ececE6; --active: #e2e2da; --input: #ffffff; --sel: rgba(37, 99, 235, .25); }
}
:root[data-theme="light"] { --bg: #f4f4f1; --panel: #ffffff; --panel-2: #f1f1ee; --desk: #dcdcd6; --line: #e2e2dc; --line-2: #cfcfc7; --fg: #15151a; --dim: #55555f; --faint: #8a8a94; --hover: #ececE6; --active: #e2e2da; --input: #ffffff; --sel: rgba(37, 99, 235, .25); }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); font: 13px/1.4 var(--font-ui); overflow: hidden; }
body { background: var(--bg); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.topbar { display: flex; align-items: center; gap: 8px; height: 48px; padding: 0 10px; background: var(--panel); border-bottom: 1px solid var(--line); flex: none; }
/* The shared header buttons (Drive, Tour, View, Theme, Apps: shared/ui/hbtn.css) and the bar's own .tb are as tall as Save. */
.topbar { --tlbx-hbtn-h: 34px; --tlbx-hbtn-line: var(--line-2); --tlbx-hbtn-hover: var(--hover); }
.topbar .tb { min-width: 34px; height: 34px; border-radius: 8px; }
.brand { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; color: var(--accent); flex: none; }
.brand-mark { width: 24px; height: 24px; fill: currentColor; }
.brand-mark .shine { fill: none; stroke: var(--panel); stroke-width: 2; stroke-linecap: round; }
.docname { flex: 0 1 260px; min-width: 0; }
.docname input { width: 100%; box-sizing: border-box; background: transparent; border: 1px solid transparent; border-radius: 6px; padding: 5px 8px; color: var(--fg); font: 600 14px var(--font-ui); }
.docname input:hover, .docname input:focus { border-color: var(--line-2); background: var(--input); outline: none; }
.menus { display: flex; gap: 2px; }
.menu-btn { background: none; border: 0; color: var(--dim); padding: 6px 9px; border-radius: 6px; font: 500 13px var(--font-ui); cursor: pointer; }
.menu-btn:hover, .menu-btn[aria-expanded="true"] { background: var(--hover); color: var(--fg); }
.tb-flex { flex: 1; }
.local-badge { display: inline-flex; align-items: center; gap: 6px; color: var(--faint); font-size: 11.5px; white-space: nowrap; }
.local-badge .ic { width: 14px; height: 14px; }
.btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 7px; border: 1px solid var(--line-2); background: var(--panel-2); color: var(--fg); font: 600 13px var(--font-ui); cursor: pointer; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn:disabled { opacity: .45; cursor: default; }
.btn .ic { width: 16px; height: 16px; }
.toolbar { display: flex; align-items: center; gap: 4px; padding: 6px 10px; background: var(--panel-2); border-bottom: 1px solid var(--line); overflow-x: auto; flex: none; scrollbar-width: thin; }
.toolbar > * { flex: none; }
.tb { min-width: 30px; height: 30px; display: inline-grid; place-items: center; padding: 0 6px; border: 1px solid transparent; border-radius: 6px; background: none; color: var(--fg); font: 600 13px var(--font-ui); cursor: pointer; }
.tb:hover:not(:disabled) { background: var(--hover); }
.tb[aria-pressed="true"] { background: var(--active); border-color: var(--line-2); color: var(--accent); }
.tb:disabled { opacity: .35; cursor: default; }
.tb sup { font-size: 9px; }
.tb b, .tb i, .tb u { font-family: var(--font-ui); }
.sep { width: 1px; height: 20px; background: var(--line-2); margin: 0 4px; }
.sel { height: 30px; box-sizing: border-box; padding: 0 6px; border: 1px solid var(--line-2); border-radius: 6px; background: var(--input); color: var(--fg); font: 13px var(--font-ui); }
.style-sel { width: 118px; } .font-sel { width: 150px; }
.size-in { width: 52px; height: 30px; box-sizing: border-box; padding: 0 6px; border: 1px solid var(--line-2); border-radius: 6px; background: var(--input); color: var(--fg); font: 13px var(--font-ui); }
.stage { flex: 1; min-height: 0; overflow: auto; background: var(--desk); padding: 28px 16px 60px; position: relative; overscroll-behavior: contain; }
.pages { display: flex; flex-direction: column; align-items: center; gap: 22px; min-width: min-content; }
/* The app draws its own caret and selection (input.js): a long press is its menu, not the system's text selection or callout */
.pages { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.page { position: relative; background: var(--paper); color: var(--paper-ink); box-shadow: 0 2px 8px rgba(0, 0, 0, .35); flex: none; overflow: hidden; }
.page .t { position: absolute; white-space: pre; margin: 0; pointer-events: none; }
.page .r { position: absolute; pointer-events: none; }
.page .sel-r { position: absolute; background: var(--sel); pointer-events: none; }
.page .caret { position: absolute; width: 2px; background: #1d4ed8; pointer-events: none; animation: blink 1.06s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.ime { position: fixed; left: 0; top: 0; width: 1px; height: 1px; opacity: 0; border: 0; padding: 0; resize: none; overflow: hidden; background: transparent; color: transparent; caret-color: transparent; }
/* It sits at the caret: a tap or a long press there is the page's (input.js), never the hidden field's */
.ime { pointer-events: none; }
.statusbar { display: flex; align-items: center; gap: 14px; height: 28px; padding: 0 12px; background: var(--panel); border-top: 1px solid var(--line); color: var(--faint); font-size: 11.5px; flex: none; white-space: nowrap; }
.st-msg { color: var(--dim); }
.zoom .sel { height: 22px; font-size: 11.5px; }
.ctx-menu-note { color: var(--faint); }
.noscript { padding: 24px; }
.menu-sheet { position: fixed; }
@media (max-width: 640px) {
  .local-badge, .docname .hide-s, #wordInfo { display: none; }
  .docname { flex: 0 1 140px; }
  .topbar { gap: 4px; padding: 6px; height: auto; min-height: 48px; box-sizing: border-box; flex-wrap: wrap; }
  .menu-btn { padding: 6px 6px; }
  .stage { padding: 12px 8px 40px; }
}
@media print {
  html, body { background: none; overflow: visible; height: auto; margin: 0; padding: 0 !important; }
  .app { display: block; height: auto; }
  body > *:not(.app), .app > *:not(.stage) { display: none !important; } /* banners, panels, toasts: only the pages print */
  .topbar, .toolbar, .statusbar, .ime, .caret, .sel-r, .outline, .doctabs-host, .sui-back, .sui-toast { display: none !important; }
  .stage { overflow: visible; padding: 0; background: none; }
  .pages { gap: 0; display: block; }
  .page { box-shadow: none; break-after: page; margin: 0; }
  .page:last-child { break-after: auto; }
}
/* the Header and footer panel (ui/hf.js): docked at the right edge, beside the pages */
.sui-back.sui-dock-right:has(.hf-dlg) { padding: 100px 12px 16px 16px; }
.sui-dlg.hf-dlg { width: min(340px, 100%); }
.hf-panel { display: grid; gap: 10px; }
.hf-first[hidden] { display: none; }
.hf-area { border: 1px solid var(--line-2); border-radius: 6px; padding: 8px; margin: 0; display: grid; gap: 6px; }
.hf-area legend { padding: 0 4px; color: var(--dim); font-size: 12px; }
.hf-text { width: 100%; box-sizing: border-box; resize: vertical; font: 13px var(--font-ui); }
.hf-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.hf-row .sui-input { width: auto; }
.hf-ins { font-size: 12px; padding: 4px 7px; }
.hf-row .sui-input:first-child { height: 28px; padding: 0 4px; }
.hf-first { display: grid; gap: 10px; }
.hf-gaps .sui-input { width: 64px; }
.hf-note { color: var(--faint); font-size: 12px; margin: 0; }
