/* 全站视口锁定 3 段式原语 & 内部列表滚动 */
.view-frame {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.view-head { flex: none; }
.view-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.view-foot {
  flex: none;
  padding-top: 12px;
  margin-top: 12px;
  border-top: 1px solid var(--line);
}
.view-scroll table.data-table { margin-top: 0; }
.view-scroll table.data-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface);
  box-shadow: inset 0 -1px 0 var(--line);
}
.exam-room-frame { max-width: 920px; width: 100%; margin: 0 auto; }

/* 刷题三栏视口内部滚动与左右独立折叠 */
.practice-shell {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#p-modebar-slot, #p-immbar-slot, #p-examres-slot, .practice-toolbar { flex: none; overflow-anchor: none; }
.practice-layout { flex: 1; min-height: 0; align-items: stretch; }
.practice-shell.notes-collapsed .practice-layout { grid-template-columns: minmax(0, 1fr) 12px var(--aside-w, 332px); }
.practice-shell.notes-collapsed .practice-notes,
.practice-shell.notes-collapsed .pane-resizer[data-resize="notes"] { display: none; }
.practice-shell.aside-collapsed .practice-layout { grid-template-columns: var(--notes-w, 280px) 12px minmax(0, 1fr); }
.practice-shell.aside-collapsed .practice-aside,
.practice-shell.aside-collapsed .pane-resizer[data-resize="aside"] { display: none; }
.practice-shell.notes-collapsed.aside-collapsed .practice-layout { grid-template-columns: minmax(0, 1fr); }
.practice-shell.notes-collapsed.aside-collapsed .question-box { max-width: 920px; width: 100%; margin: 0 auto; }

.question-box {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.q-head { flex: none; overflow-anchor: none; }
.q-body-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-anchor: none;
  overscroll-behavior: contain;
  padding-right: 4px;
}
.practice-nav-footer { flex: none; margin-top: 12px !important; }
.practice-notes,
.practice-aside {
  position: static;
  max-height: none;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 14px;
}
.notes-panel-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.notes-panel-body .note-textarea { min-height: 150px; flex: none; }
.notes-panel-body .note-history-list { flex: 1; min-height: 0; max-height: none; overflow-y: auto; }
.aside-tabs { flex: none; }
.aside-body-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.aside-body-scroll.is-ai-tab { overflow: hidden; display: flex; flex-direction: column; }
#aside-ai-chat { flex: 1; min-height: 0; display: flex; flex-direction: column; }
#modal-ai-chat { height: 62vh; max-height: 540px; display: flex; flex-direction: column; }

/* 题库中心：左右双栏布局 & 当前题库右侧工作台 */
.banks-view-frame { gap: 10px; }
.banks-split {
  flex: 1; min-height: 0; overflow: hidden;
  display: grid; grid-template-columns: minmax(0, 1fr) 356px; gap: 14px; align-items: stretch;
}
.banks-main-col { gap: 9px; }
.banks-side-col { min-height: 0; overflow-y: auto; scrollbar-width: thin; }

.bank-workbench {
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent-soft) 28%, var(--surface)) 0%, var(--surface) 64%);
  border: 1px solid var(--line); border-radius: 14px; padding: 14px; box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 11px;
}
.wb-top { display: flex; align-items: flex-start; gap: 10px; }
.bank-cover {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--line));
  color: var(--accent-fg); display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.bank-cover-sm {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--surface-soft); border: 1px solid var(--line);
  color: var(--muted); display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.wb-title {
  margin: 0; font-size: 0.9688rem; font-weight: 700; letter-spacing: -0.01em; line-height: 1.35;
  color: var(--ink); display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.wb-sub {
  font-size: 0.75rem; line-height: 1.45; color: var(--muted);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.wb-stats-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border-radius: 10px; background: var(--surface-soft); border: 1px solid var(--line);
}
.wb-kpis {
  flex: 1; min-width: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  font-variant-numeric: tabular-nums;
}
.wb-kpi {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 0 4px; border-right: 1px solid var(--line);
}
.wb-kpi:last-child { border-right: 0; }
.wb-kpi strong { font-size: 0.875rem; font-weight: 700; line-height: 1.15; color: var(--ink); }
.wb-kpi span { font-size: 0.6875rem; color: var(--muted); }
.wb-kpi.is-bad strong { color: var(--bad); }
.wb-kpi.is-warn strong { color: var(--warn); }
.wb-ring-wrap { display: flex; align-items: center; gap: 7px; flex: none; font-variant-numeric: tabular-nums; }
.wb-ring { width: 34px; height: 34px; transform: rotate(-90deg); }
.wb-ring-bg { fill: none; stroke: var(--line-strong); stroke-width: 3.5; }
.wb-ring-val { fill: none; stroke: var(--accent-fg); stroke-width: 3.5; stroke-linecap: round; transition: stroke-dashoffset 0.3s ease; }
.wb-ring-text strong { display: block; font-size: 0.8125rem; line-height: 1.1; color: var(--ink); }
.wb-ring-text span { display: block; font-size: 0.6875rem; color: var(--muted); }
.wb-primary-cta { width: 100%; justify-content: center; height: 36px; font-weight: 700; }

/* 8 项练习模式 2×4 规整微卡 */
.mode-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.mode-tile {
  display: flex; align-items: center; justify-content: flex-start; gap: 7px;
  padding: 7px 9px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font: inherit;
  cursor: pointer; min-width: 0; box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
  transition: background-color 0.14s ease, border-color 0.14s ease;
}
.mode-tile:hover { background: var(--surface-hover); border-color: var(--line-strong); }
.mode-tile-icon {
  width: 24px; height: 24px; border-radius: 7px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
}
.mode-tile.tone-accent .mode-tile-icon { background: var(--accent-soft); color: var(--accent-fg); }
.mode-tile.tone-violet .mode-tile-icon { background: rgba(139, 92, 246, 0.12); color: #7c3aed; }
.mode-tile.tone-ok .mode-tile-icon { background: var(--ok-soft); color: var(--ok); }
.mode-tile.tone-bad .mode-tile-icon { background: var(--bad-soft); color: var(--bad); }
.mode-tile.tone-warn .mode-tile-icon { background: var(--warn-soft); color: var(--warn); }
:root[data-color-scheme="dark"] .mode-tile.tone-violet .mode-tile-icon { background: rgba(139, 92, 246, 0.2); color: #c4b5fd; }
.mode-tile-label { font-size: 0.7813rem; font-weight: 600; white-space: nowrap; }
.mode-tile-badge {
  margin-left: auto; font-size: 0.6875rem; font-weight: 600; color: var(--muted);
  white-space: nowrap; font-variant-numeric: tabular-nums;
}
.mode-tile-badge[data-count="1"] { padding: 1px 6px; border-radius: 999px; background: var(--surface-soft); border: 1px solid var(--line); }
.mode-tile.tone-bad .mode-tile-badge[data-count="1"] { color: var(--bad); background: var(--bad-soft); border-color: transparent; }
.mode-tile.tone-warn .mode-tile-badge[data-count="1"] { color: var(--warn); background: var(--warn-soft); border-color: transparent; }

@media (max-width: 1080px) {
  .banks-view-frame { overflow-y: auto; overflow-x: hidden; }
  .banks-split { grid-template-columns: minmax(0, 1fr); overflow: visible; flex: none; }
  .banks-side-col { order: -1; overflow: visible; }
  .banks-main-col, .banks-scroll-body { flex: none; height: auto; overflow: visible; padding-bottom: 16px; }
  .mode-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* 列表头与滚动容器 */
.section-head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 2px;
}
.banks-scroll-body { padding-bottom: 48px; }
.section-title {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-count { font-size: 0.7813rem; font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; }
.view-seg {
  display: inline-flex;
  padding: 3px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 9px;
  gap: 2px;
}
.view-seg-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
}
.view-seg-btn.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.banks-filter-input { width: 210px; padding: 5px 10px; font-size: 0.7813rem; }

/* 横条列表（无 overflow: hidden 防止裁切菜单） */
.bank-list {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
}
.bank-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  transition: background-color 0.14s ease;
}
.bank-row:first-child { border-top-left-radius: 14px; border-top-right-radius: 14px; }
.bank-row:last-child { border-bottom: 0; border-bottom-left-radius: 14px; border-bottom-right-radius: 14px; }
.bank-row:hover { background: var(--surface-hover); }
.bank-row.selected .bank-cover-sm {
  color: var(--accent-fg);
  border-color: var(--line-strong);
  background: var(--accent-soft);
}

.bank-row-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
  cursor: pointer;
}
.bank-row-info { min-width: 0; }
.bank-row-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9063rem;
  font-weight: 600;
  color: var(--ink);
}
.bank-row-meta {
  margin-top: 2px;
  font-size: 0.7813rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tag-pill {
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 5px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  color: var(--muted);
  flex: none;
}
.tag-pill.current { color: var(--accent-fg); background: var(--accent-soft); border-color: transparent; }

.bank-row-right {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: none;
}
.bank-row-prog {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 156px;
  font-variant-numeric: tabular-nums;
}
.bank-row-prog .progress-bar { flex: 1; height: 5px; }
.bank-pct-num { font-size: 0.7813rem; font-weight: 600; color: var(--muted); min-width: 32px; text-align: right; }

/* 卡片网格（兼容考试中心 .cards-grid / .bank-card） */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}
.bank-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.14s ease, background-color 0.14s ease;
}
.bank-card:hover { border-color: var(--line-strong); }
.bank-card.selected { border-color: var(--line-strong); }
.bank-card h3 { margin: 0; font-size: 0.9688rem; }
.bank-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.bank-card-title { margin: 0; font-size: 0.9688rem; font-weight: 700; cursor: pointer; display: flex; align-items: center; gap: 6px; }
.bank-card-meta { margin-top: 4px; font-size: 0.7813rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.card-more-wrap { position: relative; flex: none; }
.card-more-wrap .dropdown-menu { z-index: 55; }
.bank-card:has(.dropdown-menu:not([hidden])) { z-index: 30; transform: none !important; }

@media (max-width: 960px) {
  .mode-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .practice-shell, .question-box, .practice-notes, .practice-aside { height: auto; overflow: visible; }
  .q-body-scroll, .aside-body-scroll { overflow: visible; }
}

@media (max-width: 860px) {
  .view-frame, .view-scroll { flex: none; overflow: visible; }
  .banks-scroll-body { padding-bottom: 24px; }
  .bank-workbench { padding: 11px 12px; }
  .wb-title { font-size: 0.9688rem; }
  .bank-row { flex-direction: column; align-items: stretch; gap: 8px; padding: 10px 12px; }
  .bank-row-right { justify-content: space-between; flex-wrap: wrap; gap: 8px; }
  .bank-row-prog { width: auto; flex: 1; min-width: 110px; }
  .banks-filter-input { width: 100%; }
}

/* 沉浸模式：通栏极简顶条 + 无框居中阅读画布（覆盖侧栏/笔记网格优先级） */
body.immersive-mode .app-main { max-width: none; width: 100%; padding: 0; }
body.immersive-mode .practice-shell .practice-layout {
  grid-template-columns: minmax(0, 1fr) !important;
}
body.immersive-mode .immersive-bar {
  position: relative;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.imm-progress-track {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: transparent;
  pointer-events: none;
}
.imm-progress-fill {
  height: 100%;
  background: var(--accent);
  transition: width .22s ease;
}
body.immersive-mode .question-box {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  max-width: 780px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 24px 20px;
}
body.immersive-mode .q-progress-track { display: none; }
body.immersive-mode .q-title { font-size: 1.25rem; line-height: 1.75; }
body.immersive-mode .option-item:not(.selected):not(.correct):not(.wrong) {
  background: var(--surface);
}
body.immersive-mode .practice-nav-footer {
  border-top-color: var(--line);
  padding-top: 16px;
}

@media (max-width: 860px) {
  body.immersive-mode .immersive-bar { padding: 10px 14px; }
  body.immersive-mode .question-box { padding: 18px 14px 14px; }
}

/* 搜题中心紧凑分隔列表 */
.search-list { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.search-item { border-top: 1px solid var(--line); }
.search-item:first-child { border-top: 0; }
.search-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 14px; cursor: pointer; list-style: none; }
.search-summary::-webkit-details-marker { display: none; }
.search-summary:hover { background: var(--surface-soft); }
.search-sum-main { min-width: 0; flex: 1; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.search-q-title { font-weight: 600; color: var(--ink); word-break: break-word; }
.search-sum-right { flex: none; display: flex; align-items: center; gap: 8px; }
.search-ans-preview { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.7813rem; font-weight: 600; color: var(--ok); background: var(--ok-soft); padding: 2px 9px; border-radius: 999px; }
.search-chevron { color: var(--muted); display: inline-flex; transition: transform .16s ease; }
.search-item[open] .search-chevron { transform: rotate(90deg); }
.search-detail-body { padding: 12px 14px 14px; border-top: 1px solid var(--line); background: var(--surface-soft); display: flex; flex-direction: column; gap: 8px; }
.search-opt { padding: 7px 10px; border-radius: 7px; font-size: 0.8438rem; background: var(--surface); border: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.search-opt.is-correct { border-color: var(--ok); background: var(--ok-soft); color: var(--ok); font-weight: 600; }
.search-ai-card { padding: 14px 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line)); margin-bottom: 10px; }
.search-ai-card .ai-msg-bubble { max-width: none; background: transparent; border: 0; padding: 8px 0 0; }
@media (max-width: 720px) { .search-ans-preview { max-width: 120px; } }

/* 更新日志紧凑标题胶囊与独立浮出详情卡片 */
.cl-hint-bar { font-size: 0.75rem; color: var(--muted); margin: 4px 0 8px; }
.cl-ver-list { display: flex; flex-direction: column; gap: 8px; }
.cl-ver-block { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); overflow: hidden; }
.cl-ver-sum { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 12px; cursor: pointer; list-style: none; font-weight: 700; color: var(--accent-fg); user-select: none; }
.cl-ver-sum::-webkit-details-marker { display: none; }
.cl-ver-sum:hover { background: var(--surface-soft); }
.cl-ver-chevron { font-size: 0.75rem; color: var(--muted); transition: transform .15s ease; }
.cl-ver-block[open] .cl-ver-chevron { transform: rotate(90deg); }
.cl-ver-body { padding: 4px 12px 12px; border-top: 1px dashed var(--line); display: flex; flex-direction: column; gap: 8px; }
.cl-group-title { font-size: 0.75rem; font-weight: 700; color: var(--muted); margin: 4px 0 4px; }
.cl-chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.cl-chip { appearance: none; border: 1px solid var(--line); background: var(--surface-soft); color: var(--ink); font: inherit; font-size: 0.7813rem; font-weight: 600; padding: 5px 10px; border-radius: 999px; cursor: pointer; line-height: 1.35; text-align: left; transition: border-color .14s ease, background .14s ease, color .14s ease; }
.cl-chip:hover, .cl-chip:focus-visible, .cl-chip.is-active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--surface)); color: var(--accent-fg); outline: none; }
.cl-float-pop { position: fixed; z-index: 1200; width: min(390px, calc(100vw - 24px)); max-height: min(320px, 60vh); overflow-y: auto; padding: 12px 14px; border-radius: 12px; background: var(--surface); border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--line)); box-shadow: 0 14px 34px rgba(15, 23, 42, .22); font-size: 0.8125rem; line-height: 1.6; color: var(--ink); animation: clPopIn .14s ease; }
.cl-float-pop-title { font-weight: 700; color: var(--accent-fg); margin-bottom: 6px; padding-bottom: 5px; border-bottom: 1px solid var(--line); }
.cl-float-pop-list { margin: 0; padding-left: 16px; display: flex; flex-direction: column; gap: 4px; color: var(--ink); }
.upd-stack { display: flex; flex-direction: column; gap: 12px; max-height: 420px; overflow-y: auto; }
.upd-pane { border-radius: 12px; padding: 10px 12px; border: 1px solid var(--line); }
.upd-pane + .upd-pane { margin-top: 12px; }
.upd-stack > .upd-pane + .upd-pane { margin-top: 0; }
.upd-pane.is-project { background: color-mix(in srgb, var(--accent) 8%, var(--surface)); border-color: color-mix(in srgb, var(--accent) 34%, var(--line)); }
.upd-pane.is-question { background: color-mix(in srgb, var(--ok) 9%, var(--surface)); border-color: color-mix(in srgb, var(--ok) 36%, var(--line)); }
.upd-pane-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.upd-kicker { font-size: 0.8125rem; font-weight: 800; }
.upd-pane.is-project .upd-kicker { color: var(--accent-fg); }
.upd-pane.is-question .upd-kicker { color: var(--ok); }
.upd-hint { font-size: 0.7188rem; color: var(--muted); font-weight: 500; }
.upd-list, .upd-rows { display: flex; flex-direction: column; gap: 8px; }
.upd-rows { gap: 5px; max-height: 170px; overflow-y: auto; }
.upd-card { padding: 8px 10px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); }
.upd-pane.is-project .upd-card { border-left: 3px solid var(--accent); }
.upd-pane.is-question .upd-card { border-left: 3px solid var(--ok); }
.upd-card-top, .upd-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.upd-row { align-items: flex-start; padding: 4px 0; border-bottom: 1px dashed color-mix(in srgb, var(--ok) 35%, var(--line)); }
.upd-time { font-size: 0.7188rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.upd-title { font-weight: 700; color: var(--ink); }
.upd-detail { margin-top: 3px; font-size: 0.75rem; color: var(--muted); }
.badge.project { background: var(--accent-soft); color: var(--accent-fg); }
@keyframes clPopIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
