/* 政企产数知识竞赛备考 · 移动端优先静态复习站样式 */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f0f2f6;
  --fg: #18202c;
  --fg-2: #4b5565;
  --muted: #6e7a8a;
  --border: #e2e6ee;
  --accent: #1d5fd6;
  --accent-soft: #eaf1ff;
  --accent-fg: #1449ab;
  --danger: #c62828;
  --danger-soft: #fdecec;
  --ok: #157f4b;
  --ok-soft: #e6f6ee;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --strong: #b42318;
  --shadow: 0 2px 10px rgba(15, 23, 42, 0.05);
  --radius: 14px;
  --radius-sm: 10px;
  --nav-h: 60px;
  --head-h: 54px;
  --font-size: 16px;
}

:root[data-theme="dark"] {
  --bg: #0d1117;
  --surface: #161b22;
  --surface-2: #1f2630;
  --fg: #e6edf3;
  --fg-2: #b4c0ce;
  --muted: #8b949e;
  --border: #2a313c;
  --accent: #58a6ff;
  --accent-soft: rgba(88, 166, 255, 0.14);
  --accent-fg: #79b8ff;
  --danger: #ff7b72;
  --danger-soft: rgba(255, 123, 114, 0.14);
  --ok: #3fb950;
  --ok-soft: rgba(63, 185, 80, 0.14);
  --warn: #e3b341;
  --warn-soft: rgba(227, 179, 65, 0.15);
  --strong: #ff8b82;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}

:root[data-theme="sepia"] {
  --bg: #f4efe4;
  --surface: #fbf7ee;
  --surface-2: #efe7d6;
  --fg: #2c2419;
  --fg-2: #574a38;
  --muted: #7a6b55;
  --border: #dfd5c1;
  --accent: #9a4a1a;
  --accent-soft: #f5e5d5;
  --accent-fg: #7d3810;
  --danger: #b52b27;
  --danger-soft: #fae4e2;
  --ok: #266c44;
  --ok-soft: #e4f2ea;
  --warn: #a05b0b;
  --warn-soft: #f8ebd0;
  --strong: #9f231b;
  --shadow: 0 2px 10px rgba(72, 52, 24, 0.06);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  font-size: var(--font-size);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

button, input, select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
}

a {
  color: var(--accent);
  text-decoration: none;
}

/* 顶部栏 */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--head-h);
  padding: 0 12px;
  padding-top: env(safe-area-inset-top, 0px);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  z-index: 40;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.brand-dot {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 13px;
  flex-shrink: 0;
}

.topbar-title {
  font-size: 15.5px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--fg);
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 600;
  transition: background 0.15s, transform 0.1s;
}

.icon-btn:active {
  transform: scale(0.94);
}

/* 主体容器 */
.app-main {
  max-width: 820px;
  margin: 0 auto;
  padding: calc(var(--head-h) + env(safe-area-inset-top, 0px) + 12px) 12px calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 24px);
  min-height: 100vh;
}

/* 底部导航栏 */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  z-index: 40;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  position: relative;
  transition: color 0.15s;
}

.nav-item .nav-ico {
  font-size: 18px;
  line-height: 1.1;
}

.nav-item.active {
  color: var(--accent);
  font-weight: 700;
}

.nav-item.active::before {
  content: "";
  position: absolute;
  top: 0;
  left: 22%;
  right: 22%;
  height: 2.5px;
  border-radius: 0 0 3px 3px;
  background: var(--accent);
}

/* 通用卡片与排版 */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 14px 2px 8px;
}

.section-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--fg);
}

.section-head .sub {
  font-size: 12px;
  color: var(--muted);
}

.pill-row {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 2px 0 6px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.pill-row::-webkit-scrollbar {
  display: none;
}

.pill {
  flex-shrink: 0;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--fg-2);
  white-space: nowrap;
}

.pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--fg);
  border: 1px solid var(--border);
  transition: opacity 0.15s, transform 0.1s;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-ok {
  background: var(--ok-soft);
  border-color: transparent;
  color: var(--ok);
}

.btn-danger {
  background: var(--danger-soft);
  border-color: transparent;
  color: var(--danger);
}

.btn-sm {
  padding: 6px 10px;
  font-size: 12.5px;
  border-radius: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--fg-2);
}

.badge-accent {
  background: var(--accent-soft);
  color: var(--accent-fg);
}

.badge-ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.badge-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.badge-warn {
  background: var(--warn-soft);
  color: var(--warn);
}

/* 首页统计 & 快捷入口 */
.hero-card {
  background: linear-gradient(135deg, #1b56c8 0%, #2a74ea 100%);
  color: #fff;
  border: none;
  padding: 16px;
}

:root[data-theme="dark"] .hero-card {
  background: linear-gradient(135deg, #163770 0%, #1d4e9b 100%);
}

:root[data-theme="sepia"] .hero-card {
  background: linear-gradient(135deg, #873f15 0%, #b15c26 100%);
}

.hero-card h1 {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.3;
}

.hero-card p {
  margin: 0 0 12px;
  font-size: 13px;
  opacity: 0.9;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.stat-box {
  background: rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  padding: 9px 8px;
  text-align: center;
}

.stat-val {
  font-size: 18px;
  font-weight: 800;
  line-height: 1.2;
}

.stat-lbl {
  font-size: 11px;
  opacity: 0.9;
  margin-top: 2px;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.quick-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px;
  text-align: left;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.quick-card:active {
  transform: scale(0.98);
}

.quick-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.quick-ico {
  font-size: 20px;
}

.quick-title {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--fg);
}

.quick-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

.path-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 10px;
}

.path-tab {
  padding: 7px 6px;
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--fg-2);
  font-size: 12.5px;
  font-weight: 600;
  text-align: center;
}

.path-tab.active {
  background: var(--accent-soft);
  color: var(--accent-fg);
}

.step-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.step-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 10px;
  background: var(--surface-2);
  font-size: 13.5px;
}

.step-item .step-go {
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 600;
  flex-shrink: 0;
}

/* ==================== 一页纸 / 默写 ==================== */
.sticky-bar {
  position: sticky;
  top: calc(var(--head-h) + env(safe-area-inset-top, 0px));
  z-index: 20;
  background: var(--bg);
  padding: 6px 0 8px;
  margin: -4px 0 8px;
}

.mode-switch {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  background: var(--surface-2);
  padding: 3px;
  border-radius: 11px;
  margin-bottom: 8px;
}

.mode-btn {
  padding: 7px 10px;
  border-radius: 9px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--fg-2);
  text-align: center;
}

.mode-btn.active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.op-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: wrap;
}

.op-section-title {
  font-size: 15.5px;
  font-weight: 800;
  color: var(--accent-fg);
  margin: 0 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px dashed var(--border);
}

.op-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
  line-height: 1.75;
}

.op-item:last-child {
  border-bottom: none;
  padding-bottom: 2px;
}

.op-num {
  display: inline-block;
  min-width: 22px;
  font-weight: 700;
  color: var(--muted);
  font-size: 13px;
}

.op-tag {
  display: inline-block;
  padding: 1px 6px;
  margin-right: 4px;
  border-radius: 5px;
  font-size: 12.5px;
  font-weight: 700;
  background: var(--accent-soft);
  color: var(--accent-fg);
}

.op-item strong {
  color: var(--strong);
  font-weight: 700;
}

/* 交互式挖空按钮 */
.cloze {
  display: inline;
  padding: 1px 6px;
  margin: 0 1px;
  border-radius: 6px;
  border-bottom: 2px solid var(--accent);
  background: var(--accent-soft);
  color: transparent;
  user-select: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.cloze.hidden-blank {
  display: inline-block;
  min-width: 36px;
  text-align: center;
  vertical-align: baseline;
  color: var(--accent);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 1px;
}

.cloze.revealed {
  background: var(--ok-soft);
  border-bottom-color: var(--ok);
  color: var(--fg);
  user-select: text;
}

.cloze.revealed.wrong-mark {
  background: var(--danger-soft);
  border-bottom-color: var(--danger);
}

.op-item-actions {
  margin-top: 6px;
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ==================== 闪卡 ==================== */
.fc-progress {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}

.progress-track {
  height: 6px;
  border-radius: 99px;
  background: var(--surface-2);
  overflow: hidden;
  margin-bottom: 12px;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
  transition: width 0.25s ease;
}

.flashcard {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 20px 18px;
  min-height: 280px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  position: relative;
}

.fc-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;
}

.fc-question {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.55;
  color: var(--fg);
  margin: 8px 0 16px;
}

.fc-answer-box {
  border-top: 1px dashed var(--border);
  padding-top: 14px;
  margin-top: 10px;
  animation: fadeIn 0.18s ease;
}

.fc-answer-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--ok);
  margin-bottom: 6px;
  text-transform: uppercase;
}

.fc-answer {
  font-size: 16px;
  line-height: 1.7;
  color: var(--fg);
}

.fc-tap-hint {
  text-align: center;
  padding: 18px 10px;
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.fc-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.fc-actions-3 {
  display: grid;
  grid-template-columns: auto 1fr 1fr auto;
  gap: 8px;
  margin-top: 14px;
  align-items: stretch;
}

/* ==================== 题库 ==================== */
.quiz-q-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 14px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}

.quiz-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.quiz-stem {
  font-size: 15.5px;
  line-height: 1.7;
  font-weight: 600;
  margin-bottom: 14px;
}

.opt-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.opt-btn {
  width: 100%;
  text-align: left;
  padding: 11px 12px;
  border-radius: 11px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  line-height: 1.55;
  font-size: 14.5px;
  transition: border-color 0.15s, background 0.15s;
}

.opt-key {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--fg-2);
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}

.opt-btn.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.opt-btn.selected .opt-key {
  background: var(--accent);
  color: #fff;
}

.opt-btn.correct {
  border-color: var(--ok);
  background: var(--ok-soft);
}

.opt-btn.correct .opt-key {
  background: var(--ok);
  color: #fff;
}

.opt-btn.wrong {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.opt-btn.wrong .opt-key {
  background: var(--danger);
  color: #fff;
}

.quiz-explain {
  margin-top: 14px;
  padding: 12px;
  border-radius: 12px;
  background: var(--surface-2);
  font-size: 14px;
  line-height: 1.65;
  animation: fadeIn 0.18s ease;
}

.quiz-explain-row {
  margin-bottom: 8px;
}

.quiz-explain-row:last-child {
  margin-bottom: 0;
}

.quiz-explain-row strong.lbl {
  color: var(--accent-fg);
  margin-right: 4px;
}

.quiz-explain-row.trap {
  background: var(--warn-soft);
  padding: 8px 10px;
  border-radius: 8px;
}

.quiz-nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
}

.q-sheet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
  gap: 7px;
  margin-top: 10px;
}

.q-dot {
  height: 36px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg-2);
  display: grid;
  place-items: center;
}

.q-dot.current {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
  color: var(--accent);
}

.q-dot.is-ok {
  background: var(--ok-soft);
  border-color: transparent;
  color: var(--ok);
}

.q-dot.is-wrong {
  background: var(--danger-soft);
  border-color: transparent;
  color: var(--danger);
}

/* ==================== 思维导图 ==================== */
.mm-tree {
  list-style: none;
  margin: 0;
  padding: 0;
}

.mm-tree ul {
  list-style: none;
  margin: 4px 0 4px 10px;
  padding-left: 12px;
  border-left: 1.5px dashed var(--border);
}

.mm-tree li {
  margin: 5px 0;
}

.mm-tree summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 4px 6px;
  border-radius: 8px;
}

.mm-tree summary::-webkit-details-marker {
  display: none;
}

.mm-arrow {
  display: inline-block;
  width: 16px;
  color: var(--accent);
  font-size: 12px;
  transition: transform 0.15s;
  flex-shrink: 0;
  margin-top: 3px;
}

details[open] > summary > .mm-arrow {
  transform: rotate(90deg);
}

.mm-leaf {
  padding: 3px 6px 3px 22px;
  font-size: 14.5px;
}

.mm-text strong {
  color: var(--strong);
}

.mm-text.masked:not(.unmasked) {
  filter: blur(6px);
  background: var(--surface-2);
  border-radius: 6px;
  padding: 1px 4px;
  user-select: none;
  cursor: pointer;
}

/* ==================== 资料阅读器 ==================== */
.doc-content {
  font-size: var(--font-size);
  line-height: 1.72;
  word-break: break-word;
}

.doc-content h1 {
  font-size: 1.28em;
  margin: 0 0 10px;
  line-height: 1.35;
}

.doc-content h2 {
  font-size: 1.15em;
  margin: 22px 0 10px;
  padding: 7px 10px;
  border-left: 4px solid var(--accent);
  background: var(--surface-2);
  border-radius: 0 8px 8px 0;
  scroll-margin-top: calc(var(--head-h) + 60px);
}

.doc-content h3 {
  font-size: 1.04em;
  margin: 18px 0 8px;
  color: var(--accent-fg);
  scroll-margin-top: calc(var(--head-h) + 60px);
}

.doc-content h4, .doc-content h5 {
  font-size: 0.98em;
  margin: 14px 0 6px;
}

.doc-content p {
  margin: 8px 0;
}

.doc-content strong {
  color: var(--strong);
  font-weight: 700;
}

.doc-content code {
  background: var(--surface-2);
  padding: 1px 5px;
  border-radius: 5px;
  font-size: 0.88em;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.doc-content blockquote {
  margin: 10px 0;
  padding: 10px 12px;
  border-left: 3.5px solid var(--accent);
  background: var(--surface-2);
  border-radius: 0 10px 10px 0;
  font-size: 0.92em;
  color: var(--fg-2);
}

.doc-content ul, .doc-content ol {
  padding-left: 1.35em;
  margin: 6px 0;
}

.doc-content li {
  margin: 4px 0;
}

.doc-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 18px 0;
}

.tbl-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 12px 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.tbl-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  line-height: 1.55;
  min-width: 420px;
}

.tbl-wrap th, .tbl-wrap td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.tbl-wrap th:last-child, .tbl-wrap td:last-child {
  border-right: none;
}

.tbl-wrap tr:last-child td {
  border-bottom: none;
}

.tbl-wrap th {
  background: var(--surface-2);
  font-weight: 700;
  white-space: nowrap;
}

.code-wrap {
  overflow-x: auto;
  background: var(--surface-2);
  border-radius: 10px;
  padding: 10px 12px;
  margin: 10px 0;
  font-size: 12.5px;
  line-height: 1.5;
}

.code-wrap pre {
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* 抽屉 / 弹窗（搜索、目录、设置） */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.48);
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn 0.15s ease;
}

.modal-sheet {
  width: 100%;
  max-width: 680px;
  max-height: 82vh;
  background: var(--surface);
  border-radius: 18px 18px 0 0;
  padding: 14px 16px calc(18px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}

@media (min-width: 680px) {
  .modal-backdrop {
    align-items: center;
  }
  .modal-sheet {
    border-radius: 18px;
    max-height: 78vh;
  }
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.modal-head h3 {
  margin: 0;
  font-size: 16px;
}

.modal-body {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-right: 2px;
}

.search-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 11px;
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  font-size: 15px;
  outline: none;
}

.search-input:focus {
  border-color: var(--accent);
  background: var(--surface);
}

.search-item {
  width: 100%;
  text-align: left;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  margin-bottom: 8px;
  display: block;
}

.search-item-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 3px;
}

.search-item-snippet {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.45;
}

.search-item mark {
  background: var(--warn-soft);
  color: var(--fg);
  padding: 0 2px;
  border-radius: 3px;
}

.toc-item {
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--fg);
  display: block;
}

.toc-item:hover, .toc-item:active {
  background: var(--surface-2);
}

.toc-item.lvl-3 {
  padding-left: 24px;
  font-size: 13px;
  color: var(--fg-2);
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}

.setting-row:last-child {
  border-bottom: none;
}

.seg-group {
  display: flex;
  gap: 6px;
}

.floating-top {
  position: fixed;
  right: 14px;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 14px);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 4px 14px rgba(0,0,0,0.12);
  display: grid;
  place-items: center;
  font-size: 16px;
  z-index: 30;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.floating-top.show {
  opacity: 1;
  pointer-events: auto;
}

.empty-state {
  text-align: center;
  padding: 36px 16px;
  color: var(--muted);
  font-size: 14px;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
