/* ==================================================================
   mindmap5.3 · reader-topbar.css —— 阅读 B/C 分区与主题协调的覆盖面板
   只消费独立 UI 令牌；原书排版、标记色与导图内容样式不在本文件内。
   ================================================================== */
.reader-topbar-button { display:inline-flex; align-items:center; justify-content:center; gap:5px; flex:none; min-height:var(--ui-control-h); padding:5px 7px; border:1px solid transparent; border-radius:var(--ui-button-radius); color:var(--ui-text); background:transparent; font:400 11px/var(--ui-button-line-height) var(--ui-font); white-space:nowrap; cursor:pointer; }
.reader-topbar-button:hover:not(:disabled),.reader-topbar-button[aria-pressed="true"],.reader-topbar-button[aria-expanded="true"] { color:var(--ui-accent); background:var(--ui-accent-soft); }
.reader-topbar-button:disabled { opacity:var(--ui-disabled-opacity); cursor:default; }
.reader-topbar-button:focus-visible,.reader-topbar-overflow summary:focus-visible { outline:var(--ui-focus-width) solid var(--ui-accent); outline-offset:var(--ui-focus-offset); box-shadow:var(--ui-focus); }
.reader-topbar-button svg { width:18px; height:18px; flex:none; }
.reader-topbar-icon { min-width:var(--ui-icon-button-size); width:var(--ui-icon-button-size); height:var(--ui-icon-button-size); padding:5px; }
.reader-topbar-direct { display:flex; align-items:center; gap:1px; width:max-content; }
.reader-topbar-direct[hidden],.reader-topbar-overflow[hidden],.reader-topbar-button[hidden],.reader-legacy-tools { display:none!important; }
.reader-topbar-overflow { position:relative; }
.reader-topbar-overflow summary { padding:7px 10px; list-style:none; border-radius:var(--ui-button-radius); color:var(--ui-text); font:400 12px/var(--ui-line-height) var(--ui-font); white-space:nowrap; cursor:pointer; }
.reader-topbar-overflow summary::-webkit-details-marker { display:none; }
.reader-topbar-overflow summary::after { content:'⌄'; margin-left:6px; }
.reader-topbar-overflow[open] summary,.reader-topbar-overflow summary:hover { background:var(--ui-hover-bg); color:var(--ui-accent); }
.reader-topbar-menu { position:absolute; top:calc(100% + 8px); right:0; z-index:var(--z-menubar); display:flex; flex-direction:column; gap:2px; min-width:174px; max-height:min(65vh,420px); overflow:auto; padding:6px; border:1px solid var(--ui-border); border-radius:var(--ui-panel-radius); background:var(--ui-panel); box-shadow:var(--ui-shadow); }
.reader-topbar-menu .reader-topbar-button { justify-content:flex-start; min-height:var(--ui-control-h); padding:9px 12px; font-size:12px; }
body.reader-topbar-active #reader-panel>.reader-chrome { display:none!important; }
body.reader-topbar-active #reader-panel .reader-tool-view { width:min(var(--ui-panel-width),100%); bottom:0; color:var(--ui-text); background:var(--ui-panel); box-shadow:var(--ui-shadow-aux); font:var(--ui-font-size)/var(--ui-line-height) var(--ui-font); }
body.reader-topbar-active #reader-panel .reader-tool-view-head { height:var(--ui-panel-header-h); min-height:var(--ui-panel-header-h); padding:var(--ui-panel-header-padding); background:var(--ui-panel); }
body.reader-topbar-active #reader-panel .reader-tool-view-head button { min-width:32px; min-height:32px; }
body.reader-topbar-active #reader-tool-view[data-active="documents"] #reader-catalog-add { display:inline-block; }
body.reader-topbar-active #reader-tool-view>[data-view-panel] { flex:1; min-height:0; padding:var(--ui-panel-body-padding); overscroll-behavior:contain; scrollbar-width:thin; }
body.reader-topbar-active #reader-tool-view>[data-view-panel="quick"] { display:flex; flex-direction:column; overflow:hidden; padding:0; }
.reader-quick-tabs { display:flex; flex:none; align-items:center; gap:4px; padding:15px 16px 9px; border-bottom:1px solid var(--ui-border); }
#reader-tool-view .reader-quick-tab { flex:1; min-height:var(--ui-control-h); border-color:transparent; background:transparent; color:var(--ui-muted); font-size:12px; }
#reader-tool-view .reader-quick-tab[aria-selected="true"] { color:var(--ui-accent); border-color:transparent; background:var(--ui-pressed-bg); }
#reader-tool-view .reader-quick-tab:disabled { opacity:var(--ui-disabled-opacity); cursor:default; }
.reader-quick-view>[data-quick-panel] { flex:1; min-height:0; overflow:auto; padding:var(--ui-panel-body-padding); overscroll-behavior:contain; }
.reader-quick-placeholder { padding:56px 12px!important; text-align:center; color:var(--ui-muted); font-size:12px; line-height:1.9; }
.reader-quick-placeholder strong { display:block; font-size:14px; color:var(--ui-text); font-weight:500; }
#reader-view-settings .reader-settings-grid { display:flex; flex-direction:column; gap:14px; }
#reader-view-settings .reader-setting-card { padding:15px 14px; border:1px solid var(--ui-border); border-radius:var(--ui-group-radius); background:color-mix(in srgb,var(--ui-bg) 60%,var(--ui-panel)); }
#reader-view-settings .reader-setting-card h3 { margin:0 0 13px; color:var(--ui-text); font:650 12px/var(--ui-line-height) var(--ui-font); }
#reader-view-settings .reader-setting-card>label { font-size:12px; gap:10px; margin-bottom:21px; }
#reader-view-settings .reader-setting-card>label:last-child { margin-bottom:0; }
#reader-view-settings .reader-setting-native, #reader-view-settings .reader-setting-label-copy { position:absolute; width:1px; height:1px; margin:-1px; padding:0; border:0; overflow:hidden; clip-path:inset(50%); }
#reader-view-settings .reader-setting-native:focus { position:static; width:100%; height:var(--ui-input-h); margin:0; clip-path:none; }
.reader-setting-segments { display:flex; gap:5px; padding:3px; border:1px solid var(--ui-border); border-radius:var(--ui-section-radius); background:var(--ui-panel); }
#reader-view-settings .reader-setting-segments button { flex:1; min-height:var(--ui-control-h); font-size:11px; padding:5px; background:transparent; border-color:transparent; }
#reader-view-settings .reader-setting-segments button[aria-pressed="true"] { background:var(--ui-pressed-bg); color:var(--ui-accent); border-color:transparent; }
.reader-setting-swatches { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:14px 8px; padding-top:3px; }
#reader-view-settings .reader-setting-swatches button { display:flex; flex-direction:column; align-items:center; justify-content:flex-start; gap:7px; min-width:0; min-height:64px; padding:3px; color:var(--ui-muted); background:transparent; border:1px solid transparent; border-radius:var(--ui-button-radius); font-size:10px; }
#reader-view-settings .reader-setting-swatches button::before { content:''; display:block; width:38px; height:38px; border:1px solid var(--ui-border); border-radius:50%; background:var(--reader-swatch,var(--ui-panel)); }
#reader-view-settings .reader-setting-swatches button[aria-pressed="true"] { color:var(--ui-accent); border-color:transparent; background:transparent; }
#reader-view-settings .reader-setting-swatches button[aria-pressed="true"]::before { outline:2px solid var(--ui-accent); outline-offset:3px; }
#reader-view-settings .reader-setting-swatches button:disabled { opacity:var(--ui-disabled-opacity); }
.reader-setting-swatches [data-value="sepia"] { --reader-swatch:#f2ead8; }.reader-setting-swatches [data-value="light"] { --reader-swatch:#fff; }.reader-setting-swatches [data-value="gray"] { --reader-swatch:#e7e7e4; }.reader-setting-swatches [data-value="sage"] { --reader-swatch:#e4ecdf; }.reader-setting-swatches [data-value="blue"] { --reader-swatch:#e5edf4; }.reader-setting-swatches [data-value="rose"] { --reader-swatch:#f3e7e8; }.reader-setting-swatches [data-value="dark"] { --reader-swatch:#17202a; }
#reader-view-settings .reader-setting-typography input[type="range"] { width:100%; height:20px; min-height:20px; margin:0; padding:0; border:0; accent-color:var(--ui-accent); cursor:pointer; }
#reader-view-settings .reader-setting-typography>label { color:var(--ui-text); gap:var(--ui-toolbar-gap); margin-bottom:var(--ui-row-gap); }
#reader-view-settings .reader-setting-typography>label:last-child { margin-bottom:0; }
#reader-view-settings .reader-setting-typography .reader-setting-page-controls { margin-bottom:var(--ui-row-gap); }
#reader-view-settings .reader-setting-typography>label:has(input[type="range"]) { grid-template-columns:1fr auto; }
#reader-view-settings .reader-setting-typography input[type="range"] { grid-column:1 / -1; }
#reader-view-settings .reader-setting-typography output { margin:0; text-align:right; color:var(--ui-muted); font:400 11px/var(--ui-line-height) var(--ui-font); }
#reader-view-settings .reader-word-bg-setting { padding:12px 0 0; margin-top:14px; border-top:1px solid var(--ui-border); }
.reader-setting-entry-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:6px; }
#reader-view-settings .reader-setting-entry { min-height:var(--ui-control-h); padding:var(--ui-button-padding); font-size:11px; white-space:normal; }
/* 设置面板与共用顶栏使用同一字形；色块、数值和分组标题不叠加装饰。 */
#reader-view-settings .reader-setting-icon-text { display:inline-flex; align-items:center; justify-content:flex-start; gap:var(--ui-control-gap); min-width:0; text-align:left; }
#reader-view-settings .reader-setting-icon-text svg,#reader-tool-view [data-view-close] svg { width:18px; height:18px; flex:none; }
#reader-view-settings .reader-setting-text { min-width:0; overflow-wrap:anywhere; }
#reader-view-settings button.reader-setting-icon-text { min-height:var(--ui-control-h); }
#reader-view-settings button.reader-setting-icon-text[hidden] { display:none!important; }
#reader-view-settings button.reader-setting-icon-text:disabled { opacity:var(--ui-disabled-opacity); cursor:default; }
#reader-view-settings button.reader-setting-icon-text:focus-visible { outline:var(--ui-focus-width) solid var(--ui-accent); outline-offset:var(--ui-focus-offset); box-shadow:var(--ui-focus); }
.reader-setting-page-controls { display:flex; flex-wrap:wrap; align-items:center; gap:5px; }
.reader-setting-page-controls .reader-page-field input { width:44px; height:32px; border:1px solid var(--ui-input-border); border-radius:6px; color:var(--ui-text); background:var(--ui-input-bg); text-align:center; }
.reader-setting-page-controls .reader-tool-group { flex-wrap:wrap; border:0; padding:3px 0; gap:5px; }
#reader-view-settings .reader-setting-document .reader-file { display:flex; flex-direction:column; align-items:stretch; gap:9px; max-width:none; }
#reader-view-settings .reader-setting-document .reader-file strong,#reader-view-settings .reader-setting-document .reader-file span { display:block; white-space:normal; overflow-wrap:anywhere; font-size:11px; line-height:1.8; }
#reader-view-settings .reader-setting-document #reader-cancel-open { width:auto; padding:7px 12px; margin-top:12px; }
.reader-setting-save { display:flex; flex-direction:column; gap:7px; }
#reader-view-settings .reader-setting-reset,#reader-view-settings .reader-setting-retry { min-height:var(--ui-control-h); font-size:12px; padding:var(--ui-button-padding); border:1px solid var(--ui-border); }
.reader-setting-save-status { margin:0; color:var(--ui-muted); font-size:11px; line-height:1.8; }
.reader-setting-save-status[data-status="error"] { color:var(--ui-danger); }
.reader-width-field { display:grid; grid-template-columns:1fr auto; gap:14px; font-size:12px; color:var(--ui-text); }
.reader-width-field output { color:var(--ui-muted); font:11px var(--ui-font-mono); }.reader-width-field input { grid-column:1/-1; width:100%; height:20px; margin:0; padding:0; border:0; accent-color:var(--ui-accent); }
@media(max-width:900px) {
  body.reader-topbar-active #reader-view-settings button.reader-setting-icon-text { min-height:var(--ui-touch-target); }
  #topbar-zone-b,#topbar-zone-c { display:none!important; }
  body.reader-topbar-active #reader-panel .reader-tool-view { width:min(var(--ui-panel-width),100vw); max-width:100%; }
  body.reader-topbar-active #reader-tool-view .reader-topbar-button,body.reader-topbar-active #reader-tool-view .reader-setting-entry,body.reader-topbar-active #reader-tool-view .reader-quick-tab,body.reader-topbar-active #reader-tool-view .reader-setting-reset,body.reader-topbar-active #reader-tool-view .reader-setting-retry { min-height:44px; }
  body.reader-topbar-active #reader-tool-view .reader-tool-view-head button { min-width:44px; min-height:44px; }
  body.reader-topbar-active #reader-panel .reader-tool-view-head { min-height:var(--ui-panel-header-touch-h); height:var(--ui-panel-header-touch-h); }
  body.reader-topbar-active #reader-tool-view>[data-view-panel], .reader-quick-view>[data-quick-panel] { padding:16px; }
  body.reader-topbar-active #reader-tool-view>[data-view-panel="quick"] { padding:0; }
  #reader-view-settings .reader-setting-segments button { min-height:var(--ui-touch-target); }
  #reader-view-settings .reader-setting-typography input[type="range"] { min-height:32px; height:32px; }
}

/* 淡紫阅读背景与正文 runtime 共用同一色值。 */
.reader-setting-swatches [data-value="lavender"] { --reader-swatch:#ece7f4; }

/* 脑图来源开关使用整行标签，触摸时也可点按文字切换。 */
#reader-view-settings .reader-setting-source-toggle { display:flex; align-items:center; min-height:44px; cursor:pointer; }
#reader-view-settings .reader-setting-source-toggle input { width:18px; height:18px; margin:0; flex:none; }

/* 完全脑图的“更多”动作直接展开；窄屏只滚动顶栏，不挤压画布或隐藏动作。 */
.mindmap-topbar-tools { display: flex; flex: none; align-items: center; gap: var(--ui-toolbar-gap); }
.mindmap-topbar-tools[hidden] { display: none; }
html[data-app-mode="mindmap"] body.toolbar-ready #menubar { overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
html[data-app-mode="mindmap"] body.toolbar-ready #menubar .topbar-zone-a { flex: none; min-width: max-content; }
html[data-app-mode="mindmap"] body.toolbar-ready #menubar .shell-views { flex: none; }
html[data-app-mode="mindmap"] body.toolbar-ready #menubar .shell-view { flex: none; }

html[data-app-mode="mindmap"] body.toolbar-ready #menubar .topbar-zone-a .shell-label { display: inline; }

/* 自定义普通区按顺序临时收纳；弹层在视口内，避免横向滚动容器裁剪。 */
body.toolbar-ready #menubar.has-menu-profile { overflow: visible; }
body.toolbar-ready #menubar.has-menu-profile .topbar-zone-a { flex: none; min-width: max-content; }
.profile-overflow-menu { position: fixed; right: auto; box-sizing: border-box; }
.profile-overflow-menu > [hidden], .mindmap-topbar-tools > [hidden] { display: none !important; }
#menubar [data-profile-hidden] { display: none !important; }
.profile-overflow-menu > button { display: flex; align-items: center; gap: var(--ui-control-gap); width: 100%; text-align: start; }
.profile-overflow-menu .reader-topbar-menu { position: static; min-width: 0; box-shadow: none; border: 0; }
.profile-overflow-menu .shell-label { display: inline !important; }
.has-menu-profile.toolbar-icons .mindmap-topbar-tools .reader-topbar-text { display: none; }
.has-menu-profile .mindmap-topbar-tools { min-width: 0; }
.profile-overflow-menu .map-library-trigger-group { align-items: stretch; }
.profile-overflow-menu #map-library-trigger { text-align: start; }

/* 全局导航与阅读动作各占一行，沿用共享图标和悬停／键盘提示。 */
.reader-local-toolbar { position:relative; z-index:var(--z-menubar); display:flex; flex:none; align-items:center; gap:4px; height:var(--reader-toolbar-h); min-width:0; padding:0 10px; border-bottom:1px solid var(--ui-border); background:var(--ui-panel); color:var(--ui-text); }
.reader-local-toolbar[hidden] { display:none; }
#reader-local-toolbar #topbar-zone-b { display:flex!important; flex:1 1 auto; min-width:136px; max-width:220px; padding:0; border:0; overflow:hidden; }
#reader-local-toolbar #topbar-zone-c { display:flex!important; flex:none; margin-left:auto; padding:0; border:0; }
#reader-local-toolbar .reader-topbar-direct { gap:2px; }
#reader-local-toolbar .reader-topbar-direct > .reader-topbar-button,
#reader-local-toolbar .reader-topbar-direct > [data-command] { width:var(--ui-icon-button-size); height:var(--ui-icon-button-size); padding:5px; }
#reader-local-toolbar .reader-topbar-direct > .reader-topbar-button .reader-topbar-text,
#reader-local-toolbar .reader-topbar-direct > [data-topbar-action]:not([data-topbar-action="progress"]):not([data-topbar-action="font-value"]) .reader-topbar-value { display:none; }
#reader-local-toolbar .reader-topbar-direct > [data-topbar-action="progress"],
#reader-local-toolbar .reader-topbar-direct > [data-topbar-action="font-value"] { width:auto; min-width:40px; max-width:100px; font-size:11px; }
#reader-local-toolbar [data-topbar-action="progress"] .reader-topbar-value { overflow:hidden; text-overflow:ellipsis; }
#reader-local-toolbar #topbar-zone-b > button { width:100%; min-width:0; justify-content:flex-start; overflow:hidden; }
#reader-local-toolbar #topbar-zone-b .reader-topbar-value,
#reader-local-toolbar #topbar-zone-b .reader-topbar-text { flex:1 1 auto; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
#reader-local-toolbar > details > summary,
#reader-local-toolbar .reader-topbar-direct > details > summary { display:flex; align-items:center; justify-content:center; width:var(--ui-icon-button-size); height:var(--ui-icon-button-size); padding:0; font-size:0; }
#reader-local-toolbar summary svg { width:18px; height:18px; }
#reader-local-toolbar summary::after { display:none; }
body.reader-topbar-active #reader-panel .reader-tool-view { top:var(--reader-toolbar-h); }
body.toolbar-ready #menubar.has-menu-profile .mindmap-topbar-tools > button,
body.toolbar-ready #menubar.has-menu-profile .topbar-zone-a > [data-app-menu],
body.toolbar-ready #menubar.has-menu-profile .topbar-zone-a > [data-command],
body.toolbar-ready #menubar.has-menu-profile .shell-modes > button { display:inline-flex; align-items:center; justify-content:center; flex:none; width:var(--ui-icon-button-size); height:var(--ui-icon-button-size); min-width:var(--ui-icon-button-size); padding:5px; font-size:0; }
body.toolbar-ready #menubar.has-menu-profile .mindmap-topbar-tools > button .shell-label,
body.toolbar-ready #menubar.has-menu-profile .shell-modes .shell-label,
body.toolbar-ready #menubar.has-menu-profile .topbar-zone-a > [data-command] .shell-label { display:none; }
body.toolbar-ready #menubar.has-menu-profile .mindmap-topbar-tools > button svg,
body.toolbar-ready #menubar.has-menu-profile .topbar-zone-a > [data-app-menu] svg { width:18px; height:18px; }
#reader-local-toolbar .reader-topbar-direct > [data-command] { font-size:0; }
#reader-local-toolbar .reader-topbar-direct > [data-command] .shell-label { display:none; }
#reader-local-toolbar .toolbar-theme-presets { display:flex; flex:none; gap:2px; }
#reader-local-toolbar .toolbar-theme-presets button { width:var(--ui-icon-button-size); height:var(--ui-icon-button-size); padding:0; font-size:0; }
#reader-local-toolbar .reader-topbar-menu [data-profile-hidden] { display:none!important; }
@media(max-width:900px) {
  .reader-local-toolbar { padding-inline:6px; gap:2px; }
  #reader-local-toolbar #topbar-zone-b { min-width:120px; }
  #reader-local-toolbar .reader-topbar-direct > .reader-topbar-button,
  #reader-local-toolbar .reader-topbar-direct > [data-command],
  #reader-local-toolbar > details > summary,
  #reader-local-toolbar .reader-topbar-direct > details > summary { width:var(--ui-touch-target); height:var(--ui-touch-target); min-height:var(--ui-touch-target); }
  #reader-local-toolbar .reader-topbar-direct > [data-topbar-action="progress"] { width:auto; }
  body.toolbar-ready #menubar.has-menu-profile .mindmap-topbar-tools > button,
  body.toolbar-ready #menubar.has-menu-profile .topbar-zone-a > [data-app-menu],
  body.toolbar-ready #menubar.has-menu-profile .topbar-zone-a > [data-command],
  body.toolbar-ready #menubar.has-menu-profile .shell-modes > button { width:var(--ui-touch-target); height:var(--ui-touch-target); min-width:var(--ui-touch-target); }
  #reader-local-toolbar .reader-topbar-menu button { min-height:var(--ui-touch-target); }
}

#reader-local-toolbar .shell-view[data-shell-view="settings"] { display:inline-flex; }
#reader-local-toolbar .profile-overflow-menu .shell-view { font-size:12px; }
#reader-local-toolbar .profile-overflow-menu .shell-label { display:inline!important; }
body.toolbar-ready #menubar.has-menu-profile .shell-modes { height:auto; }

#reader-local-toolbar [hidden] { display:none!important; }
body.toolbar-ready #menubar.has-menu-profile > .reader-topbar-overflow > summary { font-size:0; width:var(--ui-icon-button-size); }
body.toolbar-ready #menubar.has-menu-profile > .reader-topbar-overflow > summary .toolbar-more-chevron { display:none; }
@media(max-width:900px) {
  body.toolbar-ready #menubar.has-menu-profile .shell-modes > [data-shell-view="split"] { display:none; }
  body.toolbar-ready #menubar.has-menu-profile > .reader-topbar-overflow > summary { width:var(--ui-touch-target); height:var(--ui-touch-target); }
  #reader-local-toolbar .reader-topbar-menu summary { min-height:var(--ui-touch-target); }
}
.reader-topbar-menu .demo-launch { position:static; width:100%; min-height:var(--ui-touch-target); margin:0; padding:9px 12px; border:0; border-radius:var(--ui-button-radius); box-shadow:none; transform:none; text-align:start; background:transparent; color:var(--ui-text); }

/* 修订版方案 A+：资料格式徽章、单层分组更多菜单与内置正文宽度分段器 */
#reader-local-toolbar #topbar-zone-b .reader-topbar-badge { flex:none; margin-left:4px; padding:1px 5px; border:1px solid var(--ui-border); border-radius:4px; background:var(--ui-bg); color:var(--ui-muted); font:600 9px/1.3 var(--ui-font-mono,var(--ui-font)); letter-spacing:.03em; }
.reader-topbar-menu .reader-menu-group-label { padding:6px 12px 3px; color:var(--ui-muted); font:600 10px/1.3 var(--ui-font); letter-spacing:.04em; user-select:none; }
.reader-topbar-menu .reader-menu-group-label:not(:first-child) { margin-top:4px; padding-top:8px; border-top:1px solid var(--ui-border); }
#reader-view-settings .reader-setting-width-field { display:flex; flex-direction:column; gap:8px; margin-bottom:var(--ui-row-gap); color:var(--ui-text); font-size:12px; }

/* 阅读区多文档标签栏 (Reader Tabbar) */
.reader-tabbar { display:flex; align-items:stretch; justify-content:space-between; height:34px; min-height:34px; padding:0 8px; background:color-mix(in srgb, var(--ui-bg) 40%, var(--ui-panel)); border-bottom:1px solid var(--ui-border); box-sizing:border-box; overflow:hidden; user-select:none; z-index:2; }
.reader-tabbar[hidden] { display:none!important; }
@media(max-width:900px) {
  .reader-tabbar { display:none!important; }
}
.reader-tabbar__track { display:flex; align-items:flex-end; gap:4px; flex:1 1 auto; min-width:0; height:100%; overflow-x:auto; overflow-y:hidden; scrollbar-width:none; }
.reader-tabbar__track::-webkit-scrollbar { display:none; }
.reader-tab { display:inline-flex; align-items:center; gap:6px; height:28px; max-width:200px; min-width:80px; padding:0 8px 0 10px; border:1px solid var(--ui-border); border-bottom:none; border-radius:var(--ui-button-radius) var(--ui-button-radius) 0 0; background:var(--ui-bg); color:var(--ui-muted); font:400 12px/1 var(--ui-font); cursor:pointer; transition:background .15s, color .15s, border-color .15s; flex:0 1 auto; }
.reader-tab:hover { background:var(--ui-hover-bg); color:var(--ui-text); }
.reader-tab.is-active { background:var(--ui-panel); color:var(--ui-text); border-color:var(--ui-accent); font-weight:500; position:relative; }
.reader-tab.is-active::after { content:''; position:absolute; top:-1px; left:-1px; right:-1px; height:2px; background:var(--ui-accent); border-radius:var(--ui-button-radius) var(--ui-button-radius) 0 0; }
.reader-tab__badge { flex:none; padding:1px 4px; border-radius:3px; font:700 9px/1.2 var(--ui-font-mono, monospace); letter-spacing:.03em; text-transform:uppercase; }
.reader-tab__badge--pdf { background:rgba(239, 68, 68, 0.15); color:#ef4444; border:1px solid rgba(239, 68, 68, 0.3); }
.reader-tab__badge--epub { background:rgba(16, 185, 129, 0.15); color:#10b981; border:1px solid rgba(16, 185, 129, 0.3); }
.reader-tab__badge--docx { background:rgba(59, 130, 246, 0.15); color:#3b82f6; border:1px solid rgba(59, 130, 246, 0.3); }
.reader-tab__badge--markdown, .reader-tab__badge--md { background:rgba(139, 92, 246, 0.15); color:#8b5cf6; border:1px solid rgba(139, 92, 246, 0.3); }
.reader-tab__badge--bilibili { background:rgba(0, 174, 236, 0.15); color:#00aeec; border:1px solid rgba(0, 174, 236, 0.3); }
.reader-tab__badge--default { background:var(--ui-hover-bg); color:var(--ui-muted); border:1px solid var(--ui-border); }
.reader-tab__title { flex:1 1 auto; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.reader-tab__close { display:inline-flex; align-items:center; justify-content:center; width:16px; height:16px; margin-left:2px; padding:0; border:none; border-radius:50%; background:transparent; color:var(--ui-muted); font-size:13px; line-height:1; cursor:pointer; transition:background .15s, color .15s; }
.reader-tab__close:hover { background:var(--ui-hover-bg); color:var(--ui-danger, #ef4444); }
.reader-tabbar__actions { display:flex; align-items:center; gap:4px; flex:none; height:100%; margin-left:8px; }
.reader-tabbar__btn { display:inline-flex; align-items:center; justify-content:center; height:24px; padding:0 7px; border:1px solid transparent; border-radius:var(--ui-button-radius); background:transparent; color:var(--ui-muted); font-size:12px; cursor:pointer; transition:background .15s, color .15s; }
.reader-tabbar__btn:hover { background:var(--ui-hover-bg); color:var(--ui-text); }
.reader-compare-btn { gap:4px; font-size:11px; }
.reader-compare-btn.is-active { background:rgba(59, 130, 246, 0.15); color:var(--ui-accent, #3b82f6); border-color:rgba(59, 130, 246, 0.3); }
.reader-sync-scroll-btn { gap:3px; font-size:11px; }
.reader-sync-scroll-btn.is-active { background:rgba(16, 185, 129, 0.15); color:#10b981; border-color:rgba(16, 185, 129, 0.3); }
.reader-tab.is-secondary { border-color:#8b5cf6; }
.reader-tab.is-secondary::after { content:''; position:absolute; top:-1px; left:-1px; right:-1px; height:2px; background:#8b5cf6; border-radius:var(--ui-button-radius) var(--ui-button-radius) 0 0; }
.reader-tab__compare-tag { padding:0 3px; font-size:9px; border-radius:2px; background:rgba(139, 92, 246, 0.2); color:#8b5cf6; margin-right:2px; }

/* 双栏文献对照容器与中缝拖拽 */
#reader-host.is-split-compare { display:flex !important; flex-direction:row !important; }
.reader-pane { position:relative; height:100%; min-width:0; overflow:hidden; display:flex; flex-direction:column; }
.reader-pane--primary { width:100%; height:100%; flex-shrink:0; }
#reader-host.is-split-compare .reader-pane--primary { width:var(--reader-compare-ratio, 50%); }
.reader-compare-divider { width:6px; margin:0; background:var(--ui-border, #33333d); cursor:col-resize; position:relative; z-index:10; user-select:none; touch-action:none; flex-shrink:0; transition:background-color .15s ease; }
.reader-compare-divider:hover, .reader-compare-divider.is-dragging { background:var(--ui-accent, #3b82f6); }
.reader-compare-divider__handle { position:absolute; top:50%; left:50%; transform:translate(-50%, -50%); width:2px; height:28px; border-radius:1px; background:rgba(255, 255, 255, 0.4); }
.reader-pane--secondary { flex:1 1 0%; min-width:0; height:100%; background:#f2ead8; display:flex; flex-direction:column; border-left:1px solid var(--ui-border, #33333d); }
.reader-pane--secondary[hidden] { display:none !important; }
.reader-compare-divider[hidden] { display:none !important; }
.reader-pane__topbar { display:flex; align-items:center; justify-content:space-between; height:30px; padding:0 10px; background:var(--ui-panel, #1e1e24); color:var(--ui-text, #e2e8f0); font-size:11px; border-bottom:1px solid var(--ui-border, #33333d); flex-shrink:0; }
.reader-pane__tag { font-size:10px; font-weight:700; padding:1px 5px; border-radius:3px; background:#8b5cf6; color:#fff; margin-right:8px; flex:none; }
.reader-pane__title { flex:1 1 auto; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-weight:600; margin-right:8px; }
.reader-pane__close { background:transparent; border:1px solid var(--ui-border, #444); color:var(--ui-muted, #aaa); border-radius:4px; padding:2px 8px; font-size:11px; cursor:pointer; transition:all .15s ease; flex:none; }
.reader-pane__close:hover { background:rgba(239, 68, 68, 0.2); color:#ef4444; border-color:#ef4444; }
.reader-pane__body { position:relative; flex:1 1 0%; min-height:0; overflow:hidden; background:#f2ead8; }
.reader-pane__body iframe { display:block; width:100%; height:100%; border:0; background:#f2ead8; }
.reader-pane.is-focused { outline:1px solid rgba(59, 130, 246, 0.4); }

@media (max-width: 900px) {
  .reader-pane--secondary, .reader-compare-divider { display:none !important; }
  .reader-pane--primary { width:100% !important; }
  .reader-compare-btn, .reader-sync-scroll-btn { display:none !important; }
}
