/* ========================================
   Design Tokens
   ======================================== */
:root {
  /* Colors */
  --bg: #f6f2e9;
  --surface: #ffffff;
  --surface-hover: #f5f7fb;
  --text-primary: #23201b;
  --text-secondary: #57534e;
  --text-tertiary: #8a857c;
  --border: #ddd8cc;
  --border-light: #f3f4f6;
  
  /* Brand Colors */
  --brand-50: #f7ecea;
  --brand-100: #f2dedb;
  --brand-500: #c04537;
  --brand-600: #b03a2e;
  --brand-700: #973128;
  
  /* Semantic Colors */
  --red-500: #ef4444;
  --red-100: #fee2e2;
  --red-600: #dc2626;
  --blue-500: #c04537;
  --blue-100: #f2dedb;
  --green-500: #10b981;
  --green-100: #d1fae5;
  --orange-500: #f59e0b;
  --orange-100: #fef3c7;
  --purple-500: #8b5cf6;
  --purple-100: #ede9fe;
  
  /* Dark theme for header */
  --dark-900: #0f172a;
  --dark-800: #1e293b;
  --dark-700: #334155;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.1);
  
  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  
  /* Radius */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  
  /* Typography */
  --font-sans: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STKaiti", "KaiTi", "SimSun", serif;
  --font-mono: "SF Mono", "Fira Code", monospace;
  
  /* Layout */
  --sidebar-width: 240px;
  --content-max: 960px;
}

/* ========================================
   Reset & Base
   ======================================== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.7;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--brand-600);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--brand-700);
}

/* ========================================
   Navigation
   ======================================== */
.nav-bar {
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.nav-bar-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;   /* 窄屏自动换行，避免溢出 */
  gap: var(--space-2);
  padding: 0 var(--space-6);
  /* 注意：不能设 overflow-x:auto —— 它会连带垂直裁剪，把下拉菜单裁掉 */
  overflow: visible;
}
.nav-bar-inner::-webkit-scrollbar { display: none; }

.nav-bar a {
  color: rgba(255, 255, 255, 0.6);
  text-decoration: none;
  padding: 14px 24px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.3px;
  transition: all 0.25s ease;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  position: relative;
}

.nav-bar a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 2px;
  background: var(--brand-500);
  transition: width 0.25s ease;
}

.nav-bar a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.04);
}

.nav-bar a:hover::after {
  width: 60%;
}

.nav-bar a.active {
  color: #fff;
  border-bottom-color: transparent;
  background: rgba(59, 130, 246, 0.12);
}

.nav-bar a.active::after {
  width: 60%;
}

/* 导航下拉（经典诵读 / 声音训练）：原生 details/summary，点击即展开 */
.nav-bar .nav-drop { position: relative; display: flex; align-items: center; }
.nav-bar .nav-drop summary.nav-drop-btn {
  color: rgba(255, 255, 255, 0.6);
  padding: 14px 24px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.3px;
  white-space: nowrap;
  user-select: none;
  cursor: pointer;
  list-style: none;
}
.nav-bar .nav-drop summary.nav-drop-btn::-webkit-details-marker { display: none; }
.nav-bar .nav-drop summary.nav-drop-btn::-moz-list-bullet { list-style: none; }
.nav-bar .nav-drop:hover summary.nav-drop-btn,
.nav-bar .nav-drop[open] summary.nav-drop-btn { color: #fff; }
.nav-bar .nav-drop .drop-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  /* 与导航栏同色系深色风格 */
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  padding: 6px;
  min-width: 132px;
  z-index: 200;
}
.nav-bar .nav-drop[open] .drop-menu { display: block; }
.nav-bar .nav-drop .drop-menu a {
  display: block;
  padding: 8px 14px;
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.75) !important;
  font-size: 13px;
  white-space: nowrap;
  border-bottom: none;
}
.nav-bar .nav-drop .drop-menu a::after { display: none; }
.nav-bar .nav-drop .drop-menu a:hover { background: rgba(59, 130, 246, 0.18); color: #fff !important; }
.nav-bar .nav-drop .drop-menu a.cur { color: #e0b8ae !important; font-weight: 700; background: rgba(59, 130, 246, 0.15); }

/* ========================================
   Header / Hero
   ======================================== */
.page-header {
  background: linear-gradient(160deg, var(--dark-900) 0%, var(--dark-800) 40%, #1e3a5f 100%);
  color: #fff;
  padding: 56px var(--space-6) 48px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.page-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(59, 130, 246, 0.15) 0%, transparent 70%);
  pointer-events: none;
}

.page-header-content {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 0 auto;
}

.page-header h1 {
  font-size: 30px;
  font-weight: 700;
  margin-bottom: 12px;
  letter-spacing: 0.5px;
  background: linear-gradient(135deg, #fff 0%, #c7d2fe 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.page-header p {
  font-size: 15px;
  opacity: 0.75;
  max-width: 560px;
  margin: 0 auto;
  line-height: 1.8;
}

/* Legacy header support */
header {
  background: linear-gradient(160deg, var(--dark-900) 0%, var(--dark-800) 40%, #1e3a5f 100%);
  color: #fff;
  padding: 56px var(--space-6) 48px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

header h1 {
  font-size: 30px;
  font-weight: 700;
  margin-bottom: 12px;
  letter-spacing: 0.5px;
}

header p {
  font-size: 15px;
  opacity: 0.75;
  max-width: 560px;
  margin: 0 auto;
}

/* ========================================
   Layout
   ======================================== */
.page-wrapper {
  display: flex;
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-8) var(--space-6);
  gap: var(--space-8);
}

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: var(--space-8) var(--space-6);
}

/* ========================================
   Side Navigation (Toc)
   ======================================== */
.side-nav {
  width: var(--sidebar-width);
  flex-shrink: 0;
  position: sticky;
  top: 80px;
  align-self: flex-start;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  padding-right: var(--space-4);
}

.side-nav::-webkit-scrollbar {
  width: 4px;
}

.side-nav::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

.side-nav-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: var(--space-3);
  padding-left: var(--space-3);
}

.side-nav-list {
  list-style: none;
}

.side-nav-item {
  margin-bottom: 2px;
}

.side-nav-link {
  display: block;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: all 0.2s;
  border-left: 2px solid transparent;
  line-height: 1.5;
}

.side-nav-link:hover {
  color: var(--text-primary);
  background: var(--surface-hover);
  border-left-color: var(--brand-500);
}

.side-nav-link.active {
  color: var(--brand-600);
  background: var(--brand-50);
  border-left-color: var(--brand-500);
  font-weight: 500;
}

.side-nav-link .sn-num {
  color: var(--text-tertiary);
  margin-right: 6px;
  font-size: 11px;
  font-family: var(--font-mono);
}

.side-nav-link.active .sn-num {
  color: var(--brand-500);
}

/* ========================================
   Content Area
   ======================================== */
.content-area {
  flex: 1;
  min-width: 0;
}

.main-content {
  flex: 1;
  min-width: 0;
}

/* ========================================
   Sections
   ======================================== */
.section {
  margin-bottom: var(--space-10);
  scroll-margin-top: 80px;
}

.section-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: var(--space-4);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.section-title .section-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}

.section-desc {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: var(--space-5);
  line-height: 1.8;
  padding: 14px 18px;
  background: var(--brand-50);
  border-radius: var(--radius);
  border-left: 3px solid var(--brand-500);
}

/* Legacy h2 support */
.section > h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: var(--space-4);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.section > h3, .subsection-title {
  font-size: 17px;
  font-weight: 600;
  margin: var(--space-6) 0 var(--space-3);
  color: var(--text-primary);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border-light);
}

.subsection-title {
  font-size: 17px;
  font-weight: 600;
  margin: var(--space-6) 0 var(--space-3);
  color: var(--text-primary);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border-light);
}

/* ========================================
   Cards
   ======================================== */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: var(--space-5);
  margin-bottom: var(--space-4);
  transition: box-shadow 0.25s ease;
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-accent {
  border-left: 4px solid var(--brand-500);
}

.card-accent-red {
  border-left: 4px solid var(--red-500);
}

.card-accent-green {
  border-left: 4px solid var(--green-500);
}

.card-accent-orange {
  border-left: 4px solid var(--orange-500);
}

.card-accent-purple {
  border-left: 4px solid var(--purple-500);
}

/* Info Box */
.info-box {
  padding: 14px 18px;
  background: var(--brand-50);
  border-radius: var(--radius);
  border: 1px solid var(--brand-100);
  margin-bottom: var(--space-4);
  font-size: 14px;
  line-height: 1.8;
}

.info-box strong {
  color: var(--brand-700);
}

.warning-box {
  padding: 14px 18px;
  background: var(--orange-100);
  border-radius: var(--radius);
  border: 1px solid #fde68a;
  margin-bottom: var(--space-4);
  font-size: 14px;
  line-height: 1.8;
}

.danger-box {
  padding: 14px 18px;
  background: var(--red-100);
  border-radius: var(--radius);
  border: 1px solid #fecaca;
  margin-bottom: var(--space-4);
  font-size: 14px;
  line-height: 1.8;
}

.insight-box {
  padding: 14px 18px;
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border-radius: var(--radius);
  border: 1px solid #bae6fd;
  margin-bottom: var(--space-4);
  font-size: 14px;
  line-height: 1.8;
}

.insight-box-label {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  color: #0284c7;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
  padding: 2px 8px;
  background: #e0f2fe;
  border-radius: 4px;
}

/* ========================================
   Tables
   ======================================== */
.table-wrapper {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  margin-bottom: var(--space-5);
  box-shadow: var(--shadow-sm);
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

thead th {
  background: #f8fafc;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: 12px 16px;
  border-top: 1px solid var(--border-light);
  font-size: 14px;
  vertical-align: top;
  line-height: 1.6;
}

tbody tr:hover td {
  background: var(--surface-hover);
}

tbody td strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* Matrix Table (general purpose) */
table.matrix {
  width: 100%;
  background: var(--surface);
  border-collapse: separate;
  border-spacing: 0;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  margin-bottom: var(--space-5);
  box-shadow: var(--shadow-sm);
}

table.matrix th {
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  color: var(--text-primary);
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 600;
  border-bottom: 2px solid var(--border);
}

table.matrix td {
  padding: 11px 16px;
  border-top: 1px solid var(--border-light);
  font-size: 14px;
  vertical-align: top;
  line-height: 1.65;
}

table.matrix tr:hover td {
  background: var(--surface-hover);
}

table.matrix td strong {
  color: var(--brand-600);
  font-weight: 600;
}

/* 六态总表单元格样式 */
table.matrix.six-state-matrix td.state-cell {
  padding: 14px 16px;
  background: linear-gradient(180deg, #fafbfd 0%, #f5f7fb 100%);
  border-left: 3px solid var(--brand-500, #3b6df0);
}
table.matrix.six-state-matrix .state-name {
  font-size: 15px;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px dashed var(--border-light, #e5e7eb);
  color: var(--brand-700, #1e3a8a);
}
table.matrix.six-state-matrix .state-row {
  font-size: 13px;
  line-height: 1.7;
  margin: 4px 0;
  color: var(--text-primary);
}
table.matrix.six-state-matrix .state-row ul {
  margin: 4px 0 4px 20px;
  padding-left: 4px;
  list-style: none;
}
table.matrix.six-state-matrix .state-row ul li {
  position: relative;
  padding-left: 14px;
  margin: 2px 0;
}
table.matrix.six-state-matrix .state-row ul li::before {
  content: "▸";
  position: absolute;
  left: 0;
  color: var(--brand-500, #3b6df0);
  font-size: 11px;
}
table.matrix.six-state-matrix .state-quote {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px dotted var(--border-light, #e5e7eb);
  font-size: 13px;
  line-height: 1.6;
  color: #475569;
}
table.matrix.six-state-matrix .state-quote em {
  font-style: italic;
  color: #1e293b;
}

/* Data Table */
.data-table {
  width: 100%;
  background: var(--surface);
  border-collapse: separate;
  border-spacing: 0;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  margin-bottom: var(--space-5);
  box-shadow: var(--shadow-sm);
}

.data-table th {
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  color: var(--text-primary);
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 600;
  border-bottom: 2px solid var(--border);
}

.data-table td {
  padding: 11px 16px;
  border-top: 1px solid var(--border-light);
  font-size: 14px;
  line-height: 1.65;
}

.data-table tr:hover td {
  background: var(--surface-hover);
}

.data-table td strong {
  color: var(--brand-600);
  font-weight: 600;
}

/* Behavior Table */
.behavior-table {
  width: 100%;
  background: var(--surface);
  border-collapse: separate;
  border-spacing: 0;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  margin-bottom: var(--space-4);
  box-shadow: var(--shadow-sm);
}

.behavior-table th {
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  color: var(--text-primary);
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 600;
  border-bottom: 2px solid var(--border);
  text-align: left;
}

.behavior-table th:first-child { width: 80px; }
.behavior-table th:nth-child(2) { width: 150px; }
.behavior-table th:nth-child(3) { width: 200px; }
.behavior-table th:nth-child(4) { width: 220px; }
.behavior-table th:last-child { width: 50px; }

.behavior-table tbody tr {
  transition: background 0.15s;
  cursor: pointer;
}

.behavior-table tbody tr:hover td {
  background: var(--surface-hover);
}

.behavior-table tbody tr.active td {
  background: var(--brand-50);
}

.behavior-table td {
  padding: 12px 16px;
  border-top: 1px solid var(--border-light);
  font-size: 14px;
  vertical-align: middle;
}

.behavior-table td.photo { padding: 6px 12px; }

.behavior-table td.photo img {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center top;
  border: 2px solid var(--border);
  display: block;
}

.behavior-table td.name { font-weight: 600; }

.behavior-table td.name .name-zh { font-size: 15px; }

.behavior-table td.name .name-en {
  font-size: 11px;
  color: var(--text-tertiary);
  display: block;
  margin-top: 1px;
}

.behavior-table td.purpose {
  color: var(--text-secondary);
  font-size: 13px;
}

.behavior-table td.toggle { text-align: center; }

.behavior-table td.toggle .arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #f1f5f9;
  color: var(--brand-500);
  font-size: 12px;
  transition: transform 0.2s, background 0.2s;
}

.behavior-table tbody tr.active td.toggle .arrow {
  transform: rotate(180deg);
  background: var(--brand-500);
  color: #fff;
}

/* Detail Panel */
.detail-row td {
  padding: 0;
  background: #f8fafc !important;
  border-top: none !important;
}

.detail-panel {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: var(--space-5);
  padding: 0 var(--space-5);
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease, padding 0.35s ease;
}

.detail-panel.expanded {
  max-height: 1400px;
  padding: var(--space-5);
  border-top: 2px solid var(--brand-500);
}

.detail-photo img {
  width: 240px;
  height: 240px;
  border-radius: var(--radius);
  object-fit: cover;
  object-position: center top;
  border: 1px solid var(--border);
  display: block;
}

.detail-photo .photo-caption {
  text-align: center;
  margin-top: var(--space-2);
  font-size: 12px;
  color: var(--text-tertiary);
}

.detail-info { padding-left: 0; }

.detail-info h4 {
  font-size: 16px;
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border-light);
}

.detail-section { margin-bottom: var(--space-4); }

.detail-section .ds-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--brand-500);
  letter-spacing: 1px;
  margin-bottom: var(--space-2);
  text-transform: uppercase;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-2) var(--space-4);
  font-size: 13px;
}

.detail-grid .dg-item { padding: 3px 0; }

.detail-grid .dg-item .k {
  color: var(--text-secondary);
  margin-right: var(--space-1);
}

.detail-grid .dg-item .v { font-weight: 600; }

.feature-list {
  list-style: none;
  padding-left: 0;
  font-size: 13px;
}

.feature-list li {
  padding: 2px 0 2px 14px;
  position: relative;
}

.feature-list li::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 10px;
  width: 4px;
  height: 4px;
  background: var(--brand-500);
  border-radius: 50%;
}

/* ========================================
   Category Title
   ======================================== */
.category-title {
  font-size: 15px;
  font-weight: 600;
  margin: var(--space-5) 0 var(--space-3);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.category-title.offense {
  background: linear-gradient(90deg, rgba(239, 68, 68, 0.08), transparent);
  color: var(--red-600);
  border-left: 4px solid var(--red-500);
}

.category-title.defense {
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.08), transparent);
  color: var(--brand-600);
  border-left: 4px solid var(--brand-500);
}

.category-title .icon { font-size: 18px; }

.category-title .count {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-left: auto;
}

/* ========================================
   Badges / Tags
   ======================================== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1.5;
}

.badge-red { background: var(--red-100); color: var(--red-600); }
.badge-blue { background: var(--blue-100); color: var(--brand-600); }
.badge-green { background: var(--green-100); color: #059669; }
.badge-orange { background: var(--orange-100); color: #d97706; }
.badge-purple { background: var(--purple-100); color: #7c3aed; }
.badge-gray { background: #f3f4f6; color: var(--text-secondary); }

/* Blade Direction Badges */
.blade-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1.5;
}

.blade-out {
  background: #fef3c7;
  color: #d97706;
  border: 1px solid #fde68a;
}

.blade-in {
  background: #d1fae5;
  color: #059669;
  border: 1px solid #a7f3d0;
}

/* Li-Quan Badges */
.lq-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1.5;
}

.lq-li {
  background: #d1fae5;
  color: #059669;
  border: 1px solid #a7f3d0;
}

.lq-quan {
  background: #fee2e2;
  color: var(--red-600);
  border: 1px solid #fecaca;
}

/* Cost Badges */
.cost-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1.5;
}

.cost-cog { background: #f2dedb; color: var(--brand-700); }
.cost-emo-mid { background: #fef3c7; color: #b45309; }
.cost-emo { background: #fee2e2; color: var(--red-600); }
.cost-emo-high { background: #fce7f3; color: #be185d; }
.cost-credit-risk { background: #ede9fe; color: #6d28d9; }

/* ========================================
   Quote Block
   ======================================== */
.quote-block {
  background: linear-gradient(135deg, var(--dark-900) 0%, #1e3a5f 100%);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 32px var(--space-8);
  margin: var(--space-8) 0;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.quote-block::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brand-500), var(--purple-500));
}

.quote-label {
  display: inline-block;
  font-size: 11px;
  opacity: 0.6;
  margin-bottom: var(--space-3);
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 4px 12px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 20px;
}

.quote-block p {
  margin-bottom: 6px;
  font-size: 15px;
  line-height: 1.9;
}

.quote-block p:last-child { margin-bottom: 0; }

/* ========================================
   Voice / Audio Components
   ======================================== */
.voice-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-top: var(--space-3);
}

.voice-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px var(--space-5);
  font-size: 12px;
  margin-bottom: var(--space-3);
}

.voice-meta .vm { display: flex; gap: 4px; }
.voice-meta .vm .k { color: var(--text-secondary); }
.voice-meta .vm .v { font-weight: 600; }

.tts-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-2);
}

.tts-btn {
  background: var(--brand-500);
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: background 0.2s;
}

.tts-btn:hover { background: var(--brand-600); }
.tts-btn.playing { background: var(--red-500); }
.tts-btn.replaced {
  background: linear-gradient(135deg, #14b8a6, var(--brand-500));
  box-shadow: 0 2px 8px rgba(20, 184, 166, 0.3);
}
.tts-btn.replaced:hover {
  background: linear-gradient(135deg, #0d9488, var(--brand-600));
}
.tts-btn.replaced::after {
  content: '✎';
  margin-left: 4px;
  font-size: 10px;
  opacity: 0.7;
}

.waveform {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 24px;
  flex: 1;
}

.wave-bar {
  width: 2.5px;
  background: var(--brand-500);
  border-radius: 2px;
  transition: height 0.15s ease;
}

.waveform.playing .wave-bar {
  animation: wave 0.6s ease-in-out infinite alternate;
}

@keyframes wave {
  0% { height: 3px; }
  100% { height: 20px; }
}

.subtext {
  font-size: 13px;
  color: var(--text-primary);
  margin-top: var(--space-2);
  padding: 10px 14px;
  background: #fef3c7;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--orange-500);
  font-style: italic;
}

.subtext .label {
  font-size: 11px;
  color: #b45309;
  font-weight: 700;
  margin-right: var(--space-1);
  font-style: normal;
}

.family-origin {
  margin-top: var(--space-2);
  padding: 10px 14px;
  background: var(--brand-50);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--brand-500);
  font-size: 12px;
}

.family-origin .label {
  font-size: 11px;
  color: var(--brand-600);
  font-weight: 700;
  margin-bottom: 2px;
}

.family-origin .text { color: var(--text-primary); }

.ref-links {
  margin-top: var(--space-2);
  font-size: 11px;
  color: var(--text-tertiary);
}

.ref-links a { color: var(--brand-500); text-decoration: none; }
.ref-links a:hover { text-decoration: underline; }

/* Audio Section */
.audio-section {
  margin-top: var(--space-3);
  padding: 12px 14px;
  background: #f7ecea;
  border-radius: var(--radius);
  border: 1px dashed #e0b8ae;
}

.audio-section .as-title {
  font-size: 11px;
  color: var(--brand-700);
  font-weight: 700;
  margin-bottom: var(--space-2);
}

.audio-upload-btn {
  background: #fff;
  color: var(--brand-600);
  border: 1.5px solid var(--brand-500);
  border-radius: 20px;
  padding: 5px 13px;
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s;
}

.audio-upload-btn:hover { background: var(--brand-50); }

.audio-list {
  margin-top: var(--space-2);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.audio-list-empty {
  padding: 12px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 12px;
  background: var(--surface-hover);
  border-radius: var(--radius);
  border: 1px dashed var(--border);
}

.audio-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  transition: border-color 0.2s;
}

.audio-item:hover {
  border-color: var(--brand-500);
  box-shadow: 0 1px 4px rgba(59, 130, 246, 0.15);
}

.audio-item-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: 6px;
}

.audio-item-name {
  font-size: 12px;
  color: var(--text-primary);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 320px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: background 0.15s;
}

.audio-item-name:hover {
  background: var(--surface-hover);
  color: var(--brand-600);
}

.audio-item-name-input {
  font-size: 12px;
  font-weight: 600;
  padding: 2px 6px;
  border: 1px solid var(--brand-500);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text-primary);
  outline: none;
  max-width: 280px;
  width: auto;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.audio-item-name-input:focus {
  border-color: var(--brand-600);
}

.audio-item-remove {
  background: none;
  color: var(--text-tertiary);
  border: none;
  font-size: 12px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: all 0.2s;
  flex-shrink: 0;
}

.audio-item-remove:hover {
  background: var(--red-100);
  color: var(--red-600);
}

.custom-audio {
  width: 100%;
  height: 32px;
  border-radius: var(--radius-sm);
}

/* ========== 紧凑音频列表（避免页面不断变高） ========== */
.audio-items-compact {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 6px;
}
.audio-item.compact {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border-radius: 6px;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: 13px;
  transition: background 0.15s, border-color 0.15s;
  max-width: 420px;
}
.audio-item.compact:hover {
  background: var(--brand-50);
  border-color: var(--brand-300);
}
.audio-item.compact.playing-item {
  background: var(--brand-50);
  border-color: var(--brand-400);
}
.audio-item-play {
  width: 16px;
  text-align: center;
  color: var(--brand-600);
  flex-shrink: 0;
  font-size: 12px;
}
.audio-item-duration {
  color: var(--text-tertiary);
  font-size: 11px;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.compact-audio {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
}
.audio-item.compact .audio-item-name {
  max-width: 260px;
  padding: 0 4px;
  flex: 1;
}
.voice-library-btn {
  margin-top: 5px;
  padding: 2px 8px;
  font-size: 11px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
  color: var(--brand-600);
  cursor: pointer;
  transition: all 0.15s;
}
.voice-library-btn:hover {
  background: var(--brand-50);
  border-color: var(--brand-300);
}
.audio-more-tip {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-tertiary);
  max-width: 420px;
}
.audio-more-tip a {
  color: var(--brand-600);
  text-decoration: none;
  font-weight: 600;
}
.audio-more-tip a:hover { text-decoration: underline; }

/* ========================================
   Gallery
   ======================================== */
.gallery-section { margin-top: var(--space-4); }

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--space-3);
}

.gallery-item {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
  transition: transform 0.2s, box-shadow 0.2s;
}

.gallery-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.gallery-item img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  object-position: center top;
  display: block;
}

.gallery-caption {
  padding: 6px 8px;
  font-size: 11px;
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.4;
}

.gallery-caption.editable {
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.15s, color 0.15s;
}

.gallery-caption.editable:hover {
  background: var(--surface-hover);
  color: var(--brand-600);
}

.gallery-caption-input {
  width: calc(100% - 16px);
  padding: 4px 6px;
  margin: 2px 8px;
  font-size: 11px;
  border: 1px solid var(--brand-500);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text-primary);
  outline: none;
  text-align: center;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.gallery-caption-input:focus {
  border-color: var(--brand-600);
}

.gallery-upload-bar {
  margin-bottom: var(--space-3);
}

.gallery-upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.gallery-upload-btn:hover {
  border-color: var(--brand-500);
  color: var(--brand-500);
  background: var(--brand-50);
}

.gallery-empty {
  padding: 24px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 13px;
  background: var(--surface-hover);
  border-radius: var(--radius);
  border: 1px dashed var(--border);
}

.gallery-item.removable {
  position: relative;
}

.gallery-remove-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  border: none;
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s, background 0.2s;
  z-index: 2;
}

.gallery-item:hover .gallery-remove-btn {
  opacity: 1;
}

.gallery-remove-btn:hover {
  background: #e74c3c;
}

/* ========================================
   Type Grid (8 Types)
   ======================================== */
.type-grid-8 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-3);
  margin: var(--space-5) 0;
}

.type-card-8 {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-top: 4px solid;
  transition: transform 0.2s, box-shadow 0.2s;
}

.type-card-8:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.type-card-8.out-blade { border-top-color: var(--orange-500); }
.type-card-8.in-blade { border-top-color: var(--green-500); }

.type-card-8 .tc8-name {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 6px;
}

.type-card-8 .tc8-meta {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

.type-card-8 .tc8-desc {
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-secondary);
}

.type-card-8 .tc8-tags { margin-top: var(--space-2); }

/* ========================================
   Comparison Cards
   ======================================== */
.comparison-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  margin: var(--space-5) 0;
}

.compare-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: var(--space-5);
  border: 1px solid var(--border);
  transition: box-shadow 0.25s;
}

.compare-card:hover { box-shadow: var(--shadow-md); }

.compare-card-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 2px solid var(--border-light);
}

.compare-card-title {
  font-size: 16px;
  font-weight: 700;
}

.compare-card-accent .compare-card-header {
  border-bottom-color: var(--brand-500);
}

.compare-card-accent-red .compare-card-header {
  border-bottom-color: var(--red-500);
}

.compare-card-accent-green .compare-card-header {
  border-bottom-color: var(--green-500);
}

/* Root Compare */
.root-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  margin: var(--space-5) 0;
}

.root-card {
  border-radius: var(--radius);
  padding: var(--space-5) var(--space-6);
}

.root-card.interest {
  background: #ecfdf5;
  border-left: 5px solid var(--green-500);
}

.root-card.power {
  background: #fef2f2;
  border-left: 5px solid var(--red-500);
}

.root-card h4 {
  margin: 0 0 var(--space-3);
  font-size: 16px;
}

.root-essence {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-primary);
}

.root-tag {
  display: inline-block;
  font-size: 11px;
  padding: 2px 10px;
  border-radius: 10px;
  margin-bottom: var(--space-2);
  font-weight: 600;
}

.root-card.interest .root-tag {
  background: #d1fae5;
  color: #065f46;
}

.root-card.power .root-tag {
  background: #fee2e2;
  color: var(--red-600);
}

/* Pair Compare */
.pair-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  margin: var(--space-5) 0;
}

.pair-card {
  border-radius: var(--radius);
  padding: 18px 22px;
}

.pair-card.foundation {
  background: var(--brand-50);
  border-left: 5px solid var(--brand-500);
}

.pair-card.shape {
  background: var(--orange-100);
  border-left: 5px solid var(--orange-500);
}

.pair-card h4 {
  margin: 0 0 var(--space-3);
  font-size: 15px;
}

.pair-card p {
  font-size: 13px;
  line-height: 1.8;
  margin: var(--space-2) 0;
}

.pair-icon {
  font-size: 22px;
  margin-bottom: var(--space-2);
}

/* ========================================
   Derivation Chain
   ======================================== */
.derivation-chain {
  background: #f8fafc;
  border-radius: var(--radius);
  padding: var(--space-5) var(--space-6);
  margin: var(--space-5) 0;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 2;
  overflow-x: auto;
}

.chain-node { color: var(--brand-600); font-weight: 700; }
.chain-branch { color: var(--orange-500); }
.chain-leaf { color: var(--green-500); }

/* ========================================
   Mechanism List
   ======================================== */
.mech-list {
  counter-reset: mech;
  margin: var(--space-4) 0;
  padding: 0;
  list-style: none;
}

.mech-list li {
  position: relative;
  padding: 12px 16px 12px 48px;
  margin-bottom: var(--space-2);
  background: var(--surface);
  border-radius: var(--radius);
  border-left: 4px solid var(--orange-500);
  font-size: 14px;
  line-height: 1.7;
  box-shadow: var(--shadow-sm);
}

.mech-list li::before {
  counter-increment: mech;
  content: counter(mech);
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  background: var(--orange-500);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

.mech-list li strong { color: #b45309; }

/* ========================================
   Axis Diagram
   ======================================== */
.axis-diagram {
  background: #f8fafc;
  border-radius: var(--radius);
  padding: var(--space-6);
  margin: var(--space-5) 0;
  text-align: center;
}

.axis-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-8);
  flex-wrap: wrap;
}

.axis-item {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 20px;
  min-width: 180px;
  box-shadow: var(--shadow-sm);
}

.axis-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--brand-600);
  margin-bottom: var(--space-2);
}

.axis-poles { font-size: 12px; color: var(--text-secondary); }
.axis-arrow { color: var(--text-tertiary); margin: 0 var(--space-2); }

/* ========================================
   Conclusion Card
   ======================================== */
.conclusion-card {
  background: linear-gradient(135deg, var(--brand-700), var(--dark-800));
  color: #fff;
  border-radius: var(--radius-lg);
  padding: var(--space-6) var(--space-8);
  margin: var(--space-5) 0;
}

.conclusion-card h4 {
  margin: 0 0 var(--space-3);
  font-size: 15px;
  color: #e0b8ae;
}

.conclusion-card p {
  font-size: 14px;
  line-height: 1.9;
  margin: var(--space-2) 0;
}

.conclusion-card .highlight {
  background: rgba(255, 255, 255, 0.15);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

/* ========================================
   Dimensional Cards
   ======================================== */
.dim-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
  margin: var(--space-4) 0;
}

.dim-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
  border-top: 4px solid var(--brand-500);
  transition: transform 0.2s, box-shadow 0.25s;
}

.dim-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.dim-card .dc-num {
  font-size: 28px;
  font-weight: 700;
  color: var(--brand-500);
  opacity: 0.3;
}

.dim-card .dc-q {
  font-size: 14px;
  font-weight: 600;
  margin: var(--space-1) 0 var(--space-2);
}

.dim-card .dc-a {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* ========================================
   Footer
   ======================================== */
.page-footer {
  background: var(--dark-900);
  color: rgba(255, 255, 255, 0.6);
  text-align: center;
  padding: var(--space-8) var(--space-6);
  font-size: 13px;
  line-height: 1.8;
}

page-footer p { margin: 0; }

/* Legacy footer */
footer {
  background: var(--dark-900);
  color: rgba(255, 255, 255, 0.6);
  text-align: center;
  padding: var(--space-8) var(--space-6);
  font-size: 13px;
  line-height: 1.8;
  margin-top: var(--space-10);
}

footer p { margin: 0; }

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 1024px) {
  .page-wrapper {
    flex-direction: column;
    padding: var(--space-6) var(--space-4);
    gap: var(--space-6);
  }
  
  .side-nav {
    width: 100%;
    position: static;
    max-height: none;
    padding-right: 0;
  }
  
  .side-nav-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
  }
  
  .side-nav-item { margin-bottom: 0; }
  
  .side-nav-link {
    padding: 6px 12px;
    border-left: none;
    border-radius: 16px;
    font-size: 12px;
    border: 1px solid var(--border);
    background: var(--surface);
  }
  
  .side-nav-link:hover {
    border-left: none;
  }
  
  .side-nav-link.active {
    border-left: none;
    background: var(--brand-50);
    border-color: var(--brand-500);
  }
  
  .side-nav-link .sn-num { display: none; }
  
  .type-grid-8 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 720px) {
  .nav-bar a {
    padding: 10px 14px;
    font-size: 13px;
  }
  
  .page-header, header {
    padding: var(--space-8) var(--space-4) var(--space-6);
  }
  
  .page-header h1, header h1 {
    font-size: 24px;
  }
  
  .behavior-table th:nth-child(3),
  .behavior-table td:nth-child(3),
  .behavior-table th:nth-child(4),
  .behavior-table td:nth-child(4) {
    display: none;
  }
  
  .detail-panel {
    grid-template-columns: 1fr;
  }
  
  .detail-photo img {
    width: 100%;
    max-width: 240px;
    margin: 0 auto;
  }
  
  .detail-info {
    padding-left: 0;
    padding-top: var(--space-4);
  }
  
  .detail-grid {
    grid-template-columns: 1fr 1fr;
  }
  
  .dim-grid {
    grid-template-columns: 1fr;
  }
  
  .data-table {
    font-size: 12px;
  }
  
  .data-table th,
  .data-table td {
    padding: 8px 10px;
  }
  
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .gallery-item img {
    height: 100px;
  }
  
  .root-compare,
  .pair-compare,
  .comparison-grid {
    grid-template-columns: 1fr;
  }
  
  .type-grid-8 {
    grid-template-columns: 1fr;
  }
  
  .axis-diagram .axis-row {
    flex-direction: column;
    gap: var(--space-3);
  }
  
  .section-title {
    font-size: 20px;
  }
  
  .section-title .section-num {
    width: 32px;
    height: 32px;
    font-size: 13px;
  }
  
  .quote-block {
    padding: var(--space-6) var(--space-4);
  }
}

/* ========================================
   Add Behavior Modal (shared)
   ======================================== */

/* Modal overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--space-4);
}

.modal-content {
  background: var(--surface);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 720px;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal-content.modal-lg {
  max-width: 820px;
}

.modal-content.modal-sm {
  max-width: 420px;
}

/* 声纹类型编辑弹窗：独立布局（不影响全局 form 样式） */
#voiceModal .modal-content {
  max-width: 600px;
}
#voiceModal form {
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
#voiceModal .vm-body {
  padding: 0;
  overflow-y: auto;
  max-height: calc(92vh - 140px);
}
#voiceModal .vm-section {
  padding: 18px 24px;
}
#voiceModal .vm-section + .vm-section {
  border-top: 1px solid var(--border);
}
#voiceModal .vm-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--brand-700);
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--brand-100);
}
#voiceModal .vm-grid {
  display: grid;
  gap: 14px;
}
#voiceModal .vm-grid-2 { grid-template-columns: 1fr 1fr; }
#voiceModal .vm-grid-3 { grid-template-columns: repeat(3, 1fr); }
#voiceModal .vm-field {
  display: flex;
  flex-direction: column;
}
#voiceModal .vm-field label {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-primary);
}
#voiceModal .vm-field .required { color: var(--red-500); margin-left: 2px; }
#voiceModal .vm-field input[type="text"],
#voiceModal .vm-field input[type="number"],
#voiceModal .vm-field textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: var(--surface);
  color: var(--text-primary);
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}
#voiceModal .vm-field input[type="text"]:focus,
#voiceModal .vm-field input[type="number"]:focus,
#voiceModal .vm-field textarea:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}
#voiceModal .vm-field input::placeholder,
#voiceModal .vm-field textarea::placeholder { color: var(--text-tertiary); }
#voiceModal .vm-field textarea {
  min-height: 60px;
  resize: vertical;
}
#voiceModal .vm-hint {
  margin-top: 12px;
  font-size: 11px;
  color: var(--text-tertiary);
}
@media (max-width: 520px) {
  #voiceModal .vm-grid-2,
  #voiceModal .vm-grid-3 { grid-template-columns: 1fr; }
  #voiceModal .vm-section { padding: 14px 16px; }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}

.modal-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--surface-hover);
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.modal-close:hover {
  background: var(--red-100);
  color: var(--red-600);
}

/* Form sections */
#behaviorForm {
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  padding: var(--space-5) var(--space-6);
}

.form-col {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.form-col:first-child {
  padding-right: var(--space-6);
  border-right: 1px dashed var(--border);
}

.form-col:last-child {
  padding-left: var(--space-6);
}

.form-section {
  margin-bottom: 0;
}

.form-section h4 {
  font-size: 13px;
  font-weight: 700;
  margin: 0 0 var(--space-3);
  padding: 6px 12px;
  background: var(--brand-50);
  border-left: 3px solid var(--brand-500);
  border-radius: 4px;
  color: var(--brand-700);
}

.form-row {
  margin-bottom: var(--space-3);
}

.form-row label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.form-row .required {
  color: var(--red-500);
  margin-left: 2px;
}

.form-row .hint {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-tertiary);
  margin-left: 4px;
}

.form-row input[type="text"],
.form-row input[type="number"],
.form-row select,
.form-row textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: var(--surface);
  color: var(--text-primary);
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.form-row input[type="text"]:focus,
.form-row input[type="number"]:focus,
.form-row select:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-row input::placeholder {
  color: var(--text-tertiary);
}

.form-row-group {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.form-row-group .form-row {
  margin-bottom: 0;
}

/* Modal actions */
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border);
  margin-top: 0;
  background: var(--surface);
  position: sticky;
  bottom: 0;
}

.btn-cancel {
  padding: 8px 20px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-sm);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-secondary);
}

.btn-cancel:hover {
  background: var(--surface-hover);
  border-color: var(--text-tertiary);
}

.btn-submit {
  padding: 8px 24px;
  background: var(--brand-500);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-submit:hover {
  background: var(--brand-600);
}

/* Scrollbar for modal */
.modal-content::-webkit-scrollbar {
  width: 6px;
}

.modal-content::-webkit-scrollbar-track {
  background: transparent;
}

.modal-content::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary);
}

/* Responsive for modal */
@media (max-width: 720px) {
  .modal-content {
    max-width: 100%;
    margin: var(--space-3);
  }
  
  .form-row-group {
    grid-template-columns: 1fr;
  }
}

/* ========================================
   Table Header Add Button & Row Actions
   ======================================== */
.th-actions {
  width: 50px;
  text-align: center !important;
  padding: 8px 12px !important;
}

.th-add-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--brand-500);
  background: var(--brand-500);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  line-height: 1;
}

.th-add-btn:hover {
  background: var(--brand-600);
  border-color: var(--brand-600);
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

/* 声纹/逻辑/语气词新增按钮：覆盖 th-add-btn 的圆形小按钮样式，
   改为自适应宽度的胶囊按钮，文字横排不换行 */
.voice-add-btn {
  width: auto;
  height: auto;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  line-height: 1;
  white-space: nowrap;
}
.voice-add-btn:hover {
  transform: none;
}

.cell-actions {
  text-align: center;
  white-space: nowrap;
  width: 50px;
}

.row-action-btn {
  width: 26px;
  height: 26px;
  border: none;
  background: transparent;
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  transition: all 0.2s;
  margin: 0 1px;
  opacity: 0.6;
}

.row-action-btn:hover {
  opacity: 1;
  transform: scale(1.1);
}

.row-action-btn.btn-edit {
  color: var(--brand-500);
}

.row-action-btn.btn-edit:hover {
  background: var(--brand-100);
}

.row-action-btn.btn-delete {
  color: var(--red-500);
}

.row-action-btn.btn-delete:hover {
  background: var(--red-100);
}

/* Show action buttons on row hover */
.row-main .row-action-btn {
  opacity: 0;
}

.row-main:hover .row-action-btn {
  opacity: 0.7;
}

.row-main:hover .row-action-btn:hover {
  opacity: 1;
}

/* ========================================
   Delete Modal
   ======================================== */

.modal-body {
  padding: var(--space-5) var(--space-6);
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-primary);
}

.modal-body p {
  margin: 0;
}

.btn-danger {
  padding: 8px 24px;
  background: var(--red-500);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-danger:hover {
  background: var(--red-600);
}

/* Modal responsive */
@media (max-width: 768px) {
  .form-grid {
    grid-template-columns: 1fr;
    padding: var(--space-4);
  }
  .form-col:first-child {
    padding-right: 0;
    border-right: none;
    border-bottom: 1px dashed var(--border);
    padding-bottom: var(--space-4);
  }
  .form-col:last-child {
    padding-left: 0;
    padding-top: var(--space-4);
  }
  .modal-content.modal-lg {
    max-width: 100%;
  }
  .form-row-group {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .form-row-group {
    grid-template-columns: 1fr;
  }
  .modal-content {
    max-width: 100%;
    margin: var(--space-2);
  }
}

/* ========================================
   面相对比 — 抬杠者 vs 自证者
   ======================================== */
.face-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  margin: var(--space-5) 0;
}
.face-compare-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-4);
  text-align: center;
  transition: all 0.2s;
}
.face-compare-card:hover {
  border-color: var(--brand-500);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.1);
}
.face-compare-card.face-taigang {
  border-top: 3px solid #dc2626;
}
.face-compare-card.face-zizheng {
  border-top: 3px solid #b03a2e;
}
.face-compare-card .face-img {
  width: 100%;
  max-width: 280px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  object-position: center 20%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: block;
  margin: 0 auto;
}
.face-compare-card .face-name {
  font-size: 18px;
  font-weight: 700;
  margin: var(--space-3) 0 var(--space-1);
  color: var(--text-primary);
}
.face-compare-card.face-taigang .face-name { color: #dc2626; }
.face-compare-card.face-zizheng .face-name { color: #b03a2e; }
.face-compare-card .face-sub {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-bottom: var(--space-3);
}
.face-compare-card .face-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}
.face-compare-card .face-tag {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 12px;
  background: var(--brand-50);
  color: var(--brand-700);
}
.face-compare-card.face-taigang .face-tag {
  background: #fee2e2;
  color: #dc2626;
}
.face-compare-card.face-zizheng .face-tag {
  background: #f2dedb;
  color: #973128;
}

.compare-tip {
  background: linear-gradient(135deg, #fff7ed 0%, #fef3c7 100%);
  border-left: 4px solid #f59e0b;
  padding: 12px 18px;
  border-radius: var(--radius);
  margin: var(--space-4) 0;
  font-size: 14px;
  line-height: 1.8;
  color: #78350f;
}

@media (max-width: 700px) {
  .face-compare {
    grid-template-columns: 1fr;
  }
}

/* ============ 登录鉴权 / 导航 ============ */
.nav-auth {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}
/* 与普通导航项同款的文字链接风格（无胶囊、无边框） */
.nav-auth a {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.3px;
  color: rgba(255, 255, 255, 0.6);
  padding: 14px 12px;
  text-decoration: none;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  position: relative;
  transition: color 0.25s ease;
}
.nav-auth a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 2px;
  background: var(--brand-500);
  transition: width 0.25s ease;
}
.nav-auth a:hover { color: #fff; background: rgba(255, 255, 255, 0.04); }
.nav-auth a:hover::after { width: 60%; }

/* 管理后台：浅蓝文字强调入口（hover 变白） */
.nav-admin-link { color: #e0b8ae; }
.nav-admin-link:hover { color: #fff; }

/* 退出：hover 淡红提示 */
.nav-logout-link:hover { color: #fca5a5; }
.nav-logout-link:hover::after { background: #f87171; }

.nav-user-name {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.5);
  padding: 14px 8px;
  white-space: nowrap;
}

/* 非管理员隐藏内容编辑按钮 */
body:not(.is-admin) .th-add-btn,
body:not(.is-admin) .row-action-btn,
body:not(.is-admin) .gallery-upload-btn,
body:not(.is-admin) .gallery-remove-btn {
  display: none !important;
}
body:not(.is-admin) .gallery-caption.editable {
  display: none !important;
  pointer-events: none;
}

/* ============ 登录页 ============ */
.login-wrapper {
  display: flex;
  justify-content: center;
  padding-top: 40px;
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px 28px;
  box-shadow: 0 10px 30px rgba(37, 99, 235, 0.08);
}
.login-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--brand-700);
  text-align: center;
  margin-bottom: 22px;
}
.login-label {
  display: block;
  font-size: 13px;
  color: #555;
  margin: 12px 0 6px;
}
.login-input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  color: #1f2937;
}
.login-input:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px var(--brand-100);
}
.login-btn {
  width: 100%;
  margin-top: 20px;
  padding: 11px;
  background: var(--brand-600);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.login-btn:hover { background: var(--brand-700); }
.login-btn:disabled { opacity: 0.6; cursor: wait; }
.login-error {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  margin-bottom: 10px;
}
.login-tip {
  text-align: center;
  font-size: 12px;
  color: #999;
  margin-top: 16px;
}
.login-switch {
  text-align: center;
  margin-top: 18px;
  font-size: 13px;
}
.login-switch a {
  color: var(--brand-600);
  text-decoration: none;
}
.login-switch a strong { font-weight: 600; }
.login-switch a:hover { color: var(--brand-700); text-decoration: underline; }

/* ============ 管理后台 ============ */
.admin-tabs {
  display: flex;
  gap: 8px;
  margin: 16px 0;
}
.admin-tab {
  padding: 9px 22px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: #555;
  font-size: 14px;
  cursor: pointer;
}
.admin-tab.active {
  background: var(--brand-600);
  border-color: var(--brand-600);
  color: #fff;
}
.admin-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 18px;
}
.admin-card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--brand-700);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--brand-100);
}
.admin-user-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.admin-user-form .login-input {
  width: auto;
  flex: 1;
  min-width: 130px;
}
.admin-user-form .login-btn {
  width: auto;
  margin: 0;
  padding: 10px 22px;
}
.admin-msg {
  margin-top: 10px;
  font-size: 13px;
  min-height: 18px;
}
.admin-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: 2px;
}
.admin-tag.admin { background: #f2dedb; color: #973128; }
.admin-tag.viewer { background: #f3f4f6; color: #6b7280; }
.admin-tag.pending { background: #fef3c7; color: #b45309; }
.admin-tag.ok { background: #dcfce7; color: #15803d; }
.admin-tag.dis { background: #fee2e2; color: #b91c1c; }
.mini-btn.ok { color: #15803d; border-color: #86efac; }
.mini-btn.ok:hover { background: #f0fdf4; border-color: #4ade80; }
.user-table th, .user-table td {
  font-size: 13px;
  padding: 8px 10px;
}
.mini-btn {
  font-size: 12px;
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: #374151;
  cursor: pointer;
}
.mini-btn:hover { border-color: var(--brand-400); color: var(--brand-700); }
.mini-btn.danger { color: #dc2626; }
.mini-btn.danger:hover { border-color: #fca5a5; background: #fef2f2; }

.admin-tip {
  background: #f7ecea;
  border-left: 4px solid var(--brand-500);
  color: #1e40af;
  font-size: 13px;
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
}
.admin-group {
  margin-bottom: 22px;
}
.admin-group-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--brand-700);
  padding: 6px 0;
  margin-bottom: 8px;
  border-bottom: 2px solid var(--brand-100);
}
.admin-type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
}
.admin-type {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  padding: 10px 12px;
}
.admin-type-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.admin-type-head strong { flex: 1; color: #1f2937; }
.admin-type-count { font-size: 11px; color: #9ca3af; }

/* ===== 音频管理：折叠分组/类型行 ===== */
.audio-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.audio-filter-label {
  font-size: 13px;
  color: #555;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  user-select: none;
}
.audio-filter-label input { accent-color: var(--brand-600); }
.audio-stats {
  font-size: 12px;
  color: #9ca3af;
  margin-left: auto;
}
.admin-group {
  margin-bottom: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}
.admin-group-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  cursor: pointer;
  background: linear-gradient(135deg, #f8faff 0%, #fff 100%);
  border-bottom: 1px solid transparent;
}
.admin-group-head:hover { background: #f0f6ff; }
.admin-group.open .admin-group-head { border-bottom-color: var(--border); }
.ag-arrow {
  font-size: 11px;
  color: var(--brand-600);
  width: 14px;
  text-align: center;
  flex-shrink: 0;
}
.ag-name { font-size: 14px; font-weight: 700; color: var(--brand-700); }
.ag-meta {
  font-size: 12px;
  color: #9ca3af;
  margin-left: auto;
}
.admin-type-rows { padding: 4px 0; }
.admin-type-row {
  border-top: 1px solid #f3f4f6;
}
.admin-type-row:first-child { border-top: none; }
.admin-type-row-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  cursor: pointer;
  font-size: 13px;
}
.admin-type-row-head:hover { background: #f8fafc; }
.at-name { flex: 1; color: #1f2937; }
.admin-type-count.has { color: var(--brand-600); font-weight: 600; }
.at-ops { display: inline-flex; gap: 6px; flex-shrink: 0; }
.admin-audio-list { padding: 2px 16px 8px 40px; }
.admin-audio-list .admin-audio-item:last-child { padding-bottom: 10px; }

.admin-audio-empty {
  font-size: 12px;
  color: #bbb;
  padding: 8px 2px;
}
.admin-audio-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 6px 2px;
  border-top: 1px dashed #f0f0f0;
  font-size: 12px;
}
.admin-play {
  cursor: pointer;
  color: var(--brand-600);
  font-size: 12px;
  width: 18px;
  text-align: center;
}
.admin-fname {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #374151;
}
.admin-fsize { color: #9ca3af; font-size: 11px; }
/* 音频备注（管理后台） */
.admin-note {
  flex: 0 1 auto;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  color: #6b7280;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 1px 8px;
}

/* 时间对齐工具条（管理后台字幕区） */
.admin-cap-tools {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  padding: 5px 8px;
  margin-bottom: 6px;
  background: #f8fafc;
  border: 1px dashed #d1d5db;
  border-radius: 6px;
  font-size: 11px;
}
.admin-cap-tools .t-label { font-weight: 700; color: #374151; margin-right: 2px; }
.admin-cap-tools .shift-all-wrap { display: inline-flex; align-items: center; gap: 3px; margin-left: 4px; color: #374151; cursor: pointer; }
.admin-cap-tools .t-hint { color: #9ca3af; margin-left: 4px; }
/* 单句时间微调/分割按钮 */
.cap-line .cap-shift,
.cap-line .cap-split {
  border: none;
  background: transparent;
  color: #9ca3af;
  cursor: pointer;
  font-size: 10px;
  padding: 0 2px;
  border-radius: 3px;
  line-height: 1.4;
}
.cap-line .cap-shift:hover { background: #e5e7eb; color: #973128; }
.cap-line .cap-split { margin-left: 3px; }
.cap-line .cap-split:hover { background: #fee2e2; color: #b91c1c; }

/* 字幕时间轴轨道（进度条下方） */
.admin-track-wrap {
  flex: 0 0 100%;
  /* 与 .admin-player 的左右内边距一致（left 12px / right 8px），保证轨道与进度条左右对齐 */
  padding: 0 8px 0 12px;
  box-sizing: border-box;
}
.admin-track-tools {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 2px;
}
.admin-track-tools .track-zoom-label {
  font-size: 11px;
  color: #374151;
  font-variant-numeric: tabular-nums;
  min-width: 38px;
  text-align: center;
}
.admin-cap-track {
  position: relative;
  flex: 0 0 100%;
  width: 100%;
  height: 30px;
  margin: 4px 0 2px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  box-sizing: border-box;
}
.admin-cap-track .trk-block {
  position: absolute;
  top: 2px;
  bottom: 2px;
  background: rgba(59, 130, 246, 0.22);
  border: 1px solid #c04537;
  border-radius: 4px;
  font-size: 10px;
  line-height: 24px;
  color: #1e40af;
  box-sizing: border-box;
  overflow: hidden;
  white-space: nowrap;
  padding-left: 3px;
}
/* 伸缩手柄：左右边缘悬停显示前后箭头（对应拖拽命中的 8px 区域） */
.admin-cap-track .trk-block::before,
.admin-cap-track .trk-block::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 8px;
  cursor: ew-resize;
  z-index: 1;
}
.admin-cap-track .trk-block::before { left: 0; }
.admin-cap-track .trk-block::after { right: 0; }
.admin-cap-track .trk-block.spk1 { background: rgba(59, 130, 246, 0.25); }
.admin-cap-track .trk-block.spk2 { background: rgba(234, 88, 12, 0.22); border-color: #ea580c; color: #9a3412; }
.admin-cap-track .trk-block .trk-del {
  position: absolute;
  right: 1px;
  top: 0;
  cursor: pointer;
  color: #b91c1c;
  font-weight: 700;
  font-size: 12px;
  padding: 0 3px;
  display: none;
  line-height: 22px;
  z-index: 3;  /* 保证 × 在伸缩手柄上方可点 */
}
.admin-cap-track .trk-block:hover .trk-del { display: block; background: rgba(255,255,255,.6); border-radius: 3px; }

/* 管理后台播放器（进度条） */
.admin-player {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  flex: 0 0 100%;
  margin-top: 4px;
  padding: 6px 8px 2px 12px;
  box-sizing: border-box;
}
.admin-seek {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 999px;
  background: #e5e7eb;
  outline: none;
  cursor: pointer;
}
.admin-seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--brand-600, #b03a2e);
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.admin-seek::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--brand-600, #b03a2e);
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.admin-time {
  font-size: 11px;
  color: var(--text-3, #9ca3af);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
}

/* 管理后台字幕徽标 */
.admin-cap-badge {
  font-size: 11px;
  color: var(--text-3, #9ca3af);
  background: #f3f4f6;
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
  flex-shrink: 0;
}
.admin-cap-badge.has {
  color: var(--brand-700, #973128);
  background: #f7ecea;
}

/* AI 字幕按钮 */
.mini-btn.ai-btn {
  color: #7c3aed;
  border-color: #ddd6fe;
  background: #f5f3ff;
}
.mini-btn.ai-btn:hover { border-color: #7c3aed; background: #ede9fe; }

/* 批量转录进度弹窗 */
.bt-bar {
  height: 14px;
  background: #f3f4f6;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 10px;
}
.bt-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #8b5cf6, #6d28d9);
  border-radius: 999px;
  transition: width 0.4s ease;
}
.bt-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 12px;
}
.bt-count {
  font-weight: 700;
  color: #374151;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.bt-current {
  color: #6b7280;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  text-align: right;
}
.bt-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}
.bt-stat {
  text-align: center;
  font-size: 11px;
  color: #6b7280;
  border-radius: 8px;
  padding: 8px 4px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
}
.bt-stat b {
  display: block;
  font-size: 17px;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
.bt-stat.bt-ok b { color: #059669; }
.bt-stat.bt-reuse b { color: #7c3aed; }
.bt-stat.bt-skip b { color: #6b7280; }
.bt-stat.bt-fail b { color: #dc2626; }
.bt-msg {
  font-size: 12px;
  color: #6b7280;
  text-align: center;
  min-height: 18px;
  line-height: 1.6;
}
.bt-msg.ok { color: #059669; font-weight: 600; }
.bt-msg.err { color: #dc2626; font-weight: 600; }
@media (max-width: 700px) {
  .bt-stats { grid-template-columns: repeat(2, 1fr); }
}
.mini-btn.ai-btn:disabled { opacity: .6; cursor: wait; }

/* ===== 字幕区（管理后台 + 音频库通用） ===== */
.admin-captions, .va-captions {
  width: 100%;
  flex: 0 0 100%;
  max-height: 200px;
  overflow-y: auto;
  margin-top: 8px;
  padding: 8px 12px;
  background: #fafaf9;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  box-sizing: border-box;
}
.cap-line {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;  /* 允许换行：笔记独占一行放字幕下方 */
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.7;
  color: #6b7280;
  transition: background .15s, color .15s;
}
.cap-line .cap-time {
  flex-shrink: 0;
  font-size: 11px;
  color: #9ca3af;
  font-variant-numeric: tabular-nums;
  padding-top: 2px;
  min-width: 38px;
}
.cap-line .cap-speaker {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 8px;
  margin-right: 6px;
  vertical-align: 1px;
  user-select: none;
  flex-shrink: 0;
  align-self: flex-start;
  margin-top: 2px;
}
.cap-speaker.spk-1 { background: #f2dedb; color: #973128; }
.cap-speaker.spk-2 { background: #fed7aa; color: #c2410c; }
.cap-speaker.spk-n { background: #e5e7eb; color: #4b5563; }
.cap-speaker.cap-sel { cursor: pointer; }
.cap-speaker.cap-sel:hover { outline: 1px dashed #9ca3af; }
.cap-line .cap-text { flex: 1; }
.cap-line.active {
  background: #f7ecea;
  color: #1e40af;
  font-weight: 600;
  border-left: 3px solid #c04537;
  padding-left: 5px;
}
.cap-line.active .cap-time { color: #c04537; }

/* 音频库页播放器（voice_audio） */
.va-player {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  flex: 0 0 100%;
  margin-top: 6px;
  padding: 4px 2px 0 12px;
  box-sizing: border-box;
}
.va-seek {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 999px;
  background: #e5e7eb;
  outline: none;
  cursor: pointer;
}
.va-seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--brand-600, #b03a2e);
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.va-seek::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--brand-600, #b03a2e);
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.va-time {
  font-size: 11px;
  color: var(--text-3, #9ca3af);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
}

/* 手机端字幕+播放器优化 */
@media (max-width: 480px) {
  .va-player {
    padding-left: 8px;
    gap: 6px;
  }
  .va-seek { height: 5px; }
  .va-seek::-webkit-slider-thumb { width: 16px; height: 16px; }
  .va-seek::-moz-range-thumb { width: 16px; height: 16px; }
  .va-captions, .admin-captions {
    max-height: 160px;
    padding: 6px 8px;
  }
  .cap-line {
    font-size: 12px;
    gap: 6px;
    padding: 4px 6px;
  }
  .cap-line .cap-time {
    font-size: 10px;
    min-width: 32px;
  }
}

/* 音频移动选择弹窗 */
.move-type {
  font-size: 13px;
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
  color: #374151;
}
.move-type:hover {
  background: var(--brand-50);
  color: var(--brand-700);
}

@media (max-width: 700px) {
  .admin-type-grid { grid-template-columns: 1fr; }
  .nav-auth { margin-left: 0; }

  /* 手机端紧凑导航：缩小链接间距，保证 4 个页面 + 登录/管理后台都能显示 */
  .nav-bar-inner {
    justify-content: flex-start;
    gap: 2px;
    padding: 0 6px;
  }
  .nav-bar a {
    padding: 12px 9px;
    font-size: 13px;
    letter-spacing: 0;
  }
  .nav-auth { gap: 4px; }
  .nav-auth a {
    font-size: 13px;
    padding: 6px 7px;
  }
  .nav-user-name { display: none; }
}

/* =====================================================
   移动端全局优化（手机观看友好）- 声音五行修仙经典
   ===================================================== */
@media (max-width: 820px) {
  .page-wrapper .side-nav {
    position: static;
    width: 100% !important;
    max-height: none;
    overflow: visible;
    background: transparent;
    border: none;
    padding: 0;
    margin-bottom: 10px;
  }
  .page-wrapper .side-nav-title { display: none; }
  .page-wrapper .side-nav-list {
    display: flex;
    flex-direction: row;
    gap: 8px;
    overflow-x: auto;
    padding: 6px 2px 8px;
    -webkit-overflow-scrolling: touch;
  }
  .page-wrapper .side-nav-list::-webkit-scrollbar { display: none; }
  .page-wrapper .side-nav-item { flex-shrink: 0; }
  .page-wrapper .side-nav-link {
    white-space: nowrap;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 12px;
  }
  .page-wrapper .side-nav-link .sn-num { display: none; }
  .page-wrapper { flex-direction: column; align-items: stretch; }
  .page-wrapper .page-main { width: 100% !important; margin-left: 0 !important; min-width: 0; }
  .page-wrapper .section { padding: 14px 12px !important; }
  .page-wrapper .section-desc { font-size: 13px; }
  .matrix, .data-table, table.matrix {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }
  .matrix td, .matrix th { white-space: nowrap; }
  .audio-row { min-height: 44px; }
  .audio-row .fname {
    min-width: 0;
    word-break: break-all;
    white-space: normal;
    font-size: 13px;
    line-height: 1.4;
  }
  .audio-row .play-icon { width: 26px; font-size: 16px; }
  .tts-btn, .audio-upload-btn, .th-add-btn, .btn, button.btn {
    padding: 9px 16px;
    font-size: 13px;
    min-height: 40px;
  }
  .tts-bar, .audio-upload-bar { gap: 8px; flex-wrap: wrap; }
  .section-title { font-size: 16px !important; }
  .subsection-title { font-size: 14px !important; }
  .info-box, .insight-box, .quote-block { padding: 12px 14px; font-size: 13px; }
  .info-box p, .insight-box p, .quote-block p { font-size: 13px; }
  .page-footer { font-size: 12px; padding: 12px 10px; }
}
@media (max-width: 480px) {
  .section-title { font-size: 15px !important; }
  .tts-btn, .audio-upload-btn { padding: 8px 12px; }
  .matrix { font-size: 12px; }
  .audio-row .fdur { font-size: 10px; }
  .jingwen-content, .classic-text { font-size: 17px !important; line-height: 2.0 !important; }
}
/* =====================================================
   章节折叠 sec-folder（全展开标题样式，保持原页面大标题视觉）
   ===================================================== */
.sec-folder {
  margin: 16px 0 24px;
}
.sec-folder > summary {
  cursor: default;
  padding: 0 0 8px 12px;
  font-size: 21px;
  font-weight: 800;
  color: var(--text-primary, #1f2937);
  list-style: none;
  border-left: 5px solid var(--brand-600, #2563eb);
  margin-bottom: 12px;
  user-select: none;
}
.sec-folder > summary::-webkit-details-marker { display: none; }
.sec-folder > *:not(summary) { padding: 0 2px; }

.sec-tab {
    flex-shrink: 0;
    border: 1px solid var(--border, #e5e7eb);
    background: transparent;
    color: var(--text-primary, #1f2937);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
  }
  .sec-tab.active {
    background: var(--brand-600, #2563eb);
    border-color: var(--brand-600, #2563eb);
    color: #ffffff;
    font-weight: 500;
  }


{
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 12px;
  background: var(--background, #ffffff);
  border-bottom: 1px solid var(--border, #e5e7eb);
  -webkit-overflow-scrolling: touch;
  margin: 0;
}


@media (max-width: 820px) {
  /* 正文阅读优化 */
  .sec-folder > *:not(summary) { padding: 0 2px; }
  .sec-folder p, .sec-folder li { font-size: 14px; line-height: 1.9; }
  .sec-folder h3, .sec-folder .sub-title { font-size: 15px; margin: 14px 0 6px; }
  .sec-folder table { font-size: 13px; }
  /* 卡片单列 + 圆角卡片化 */
  .sec-folder .wx-card, .sec-folder .card, .sec-folder [class*="card"] {
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 10px;
  }
  /* 五行布局单列（宽屏grid降为1列） */
  .sec-folder .wx-layout, .sec-folder [class*="layout"], .sec-folder [class*="grid"] {
    grid-template-columns: 1fr !important;
  }
  /* 大标题 */
  .sec-folder > summary { font-size: 19px; }
}


/* =====================================================
   移动端视觉风格 v2（现代 App 风：浅灰底 + 白卡片 + 圆角阴影）
   ===================================================== */
@media (max-width: 820px) {
  /* 全局背景 */
  body { background: #f4f5f7 !important; }

  /* 吸顶章节导航 */
      
  /* 章节卡片化 */
  .sec-folder {
    background: #ffffff !important;
    border-radius: 14px !important;
    padding: 14px 16px 10px !important;
    margin: 12px 14px !important;
    box-shadow: 0 1px 6px rgba(17, 24, 39, 0.05);
    border: 1px solid #eef0f2;
    overflow: hidden;
  }
  .sec-folder > summary {
    font-size: 17px !important;
    border-left: 4px solid #2563eb;
    padding: 0 0 8px 10px;
    margin-bottom: 10px;
    color: #111827;
  }

  /* 表格：浅底圆角 + 横滚 */
  .sec-folder table, .sec-folder .matrix {
    background: #fafbfc !important;
    border-radius: 10px;
    font-size: 12.5px;
  }
  .sec-folder td, .sec-folder th { padding: 8px 9px; }
  .sec-folder th { background: #f0f3f7 !important; color: #374151 !important; }

  /* 正文 */
  .sec-folder p, .sec-folder li {
    font-size: 14px !important;
    line-height: 1.9;
    color: #374151;
  }
  .sec-folder h3, .sec-folder h4 {
    font-size: 15px !important;
    color: #111827;
    margin: 14px 0 6px;
  }

  /* 卡片元素（五行卡/图卡等） */
  .sec-folder [class*="card"] {
    background: #fafbfc !important;
    border: 1px solid #eef0f2 !important;
    border-radius: 12px !important;
    padding: 14px !important;
    margin-bottom: 10px;
  }
  .sec-folder [class*="layout"], .sec-folder [class*="grid"] {
    grid-template-columns: 1fr !important;
  }

  /* 信息框/引用 */
  .sec-folder .info-box, .sec-folder .insight-box, .sec-folder .quote-block {
    background: #f8fafc !important;
    border: 1px solid #eef0f2 !important;
    border-radius: 12px !important;
    padding: 12px 14px !important;
  }

  /* 副标题/说明 */
  .sec-desc, .section-desc { font-size: 12px; color: #6b7280; line-height: 1.7; }

  /* 页脚 */
  footer, .page-footer {
    font-size: 11px !important;
    color: #9ca3af !important;
    padding: 14px 12px !important;
    text-align: center;
    background: transparent !important;
  }
}


/* =====================================================
   悬浮章节球 ch-ball（右下角小圆钮 → 章节弹层）
   ===================================================== */
#ch-ball {
  position: fixed;
  right: 14px;
  bottom: 26px;
  z-index: 80;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid #e2e5ea;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
  font-size: 16px;
  color: #4b5563;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.8;
  transition: opacity 0.15s, transform 0.15s;
  -webkit-tap-highlight-color: transparent;
}
#ch-ball:active { transform: scale(0.92); }
#ch-pop {
  position: fixed;
  right: 14px;
  bottom: 80px;
  z-index: 85;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.14);
  border: 1px solid #eef0f2;
  max-height: 60vh;
  overflow-y: auto;
  min-width: 170px;
  max-width: 230px;
  padding: 6px;
  display: none;
}
#ch-pop.show { display: block; }
#ch-pop ul { list-style: none; margin: 0; padding: 0; }
#ch-pop a {
  display: block;
  padding: 10px 12px;
  font-size: 13px;
  color: #374151;
  text-decoration: none;
  border-radius: 8px;
}
#ch-pop a:active { background: #f0f4ff; color: #2563eb; }

/* =====================================================
   移动端溢出修复：表格/grid 内容被裁的根治（v109）
   ===================================================== */
@media (max-width: 820px) {
  /* 1. grid/flex 子项允许收缩——防止表格 min-content 把轨道撑爆 */
  .sec-folder [class*="layout"], .sec-folder [class*="grid"],
  .wx-layout, .wx-pair, .cards, .steps, .eight-trace,
  .sec-folder [class*="layout"] > *, .sec-folder [class*="grid"] > *,
  .wx-layout > *, .wx-pair > *, .cards > * {
    min-width: 0;
  }

  /* 2. 表格窄屏强制换行，杜绝溢出（保留 .quick 表横滚） */
  .sec-folder table { width: 100%; }
  .sec-folder table:not(.quick) th,
  .sec-folder table:not(.quick) td {
    white-space: normal !important;
    word-break: break-word;
  }

  /* 3. 章节卡片横向滚动兜底——极端情况下内容可滑到，绝不裁掉 */
  .sec-folder {
    overflow-x: auto !important;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
  }
}

/* =====================================================
   字幕笔记（capnote）：每句台词的讲解，仅管理员可编辑
   ===================================================== */
.cap-note {
  flex-basis: 100%;  /* 独占一行，始终在字幕下方 */
  margin: 3px 0 2px 52px;
  font-size: 12px;
  color: var(--text-2, #4b5563);
  line-height: 1.6;
}
.cap-note:empty { display: none; }  /* 无笔记时空笔记区不占行，避免行距过大 */
.cap-note-txt {
  background: rgba(59, 130, 246, 0.06);
  border-left: 2px solid #2563eb;
  padding: 4px 8px;
  border-radius: 0 6px 6px 0;
  color: #1f2937;
}
.cap-note-btn {
  cursor: pointer;
  color: var(--text-3, #9ca3af);
  font-size: 11px;
  user-select: none;
  white-space: nowrap;
  align-self: center;
  flex-shrink: 0;
}
.cap-note-btn:hover { color: #2563eb; }
.cap-note-input {
  width: 100%;
  box-sizing: border-box;
  font-size: 12px;
  padding: 6px 8px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 6px;
  background: #fff;
  resize: vertical;
  font-family: inherit;
  line-height: 1.6;
}
.cap-note-ops {
  margin-top: 4px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.cap-note-ops button {
  font-size: 12px;
  padding: 3px 14px;
  border-radius: 6px;
  border: 1px solid var(--border, #e5e7eb);
  background: var(--surface, #f9fafb);
  cursor: pointer;
  color: #1f2937;
}
.cap-note-ops button:hover { border-color: #2563eb; color: #2563eb; }
.cap-note-ops .cap-note-del { color: #b91c1c; }
.cap-note-ops .cap-note-del:hover { border-color: #b91c1c; color: #b91c1c; }
@media (max-width: 480px) {
  .cap-note { margin-left: 34px; font-size: 11px; }
}

/* 音频库行内播放器入口 */
.va-pl-open {
  cursor: pointer;
  font-size: 11px;
  color: #b45309;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 999px;
  padding: 2px 10px;
  margin-left: 6px;
  white-space: nowrap;
  user-select: none;
  flex-shrink: 0;
  align-self: center;
}
.va-pl-open:hover { background: #ffedd5; }
