/* ── Screen-reader only (visible to AI crawlers, hidden visually) ── */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

:root {
  --ink: #0d0d14;
  --paper: #0d0d14;
  --gold: #c9a84c;
  --gold-light: #e8d5a3;
  --gold-dim: #7a6330;
  --red: #c0392b;
  --teal: #1a7a6e;
  --blue: #1a4a7a;
  --purple: #5a2d82;
  --slate: #2c3e50;
  --warm: #7a4f3a;
  --mint: #2d7a5f;
  --text-body: rgba(255,255,255,0.92);
  --text-light: rgba(255,255,255,0.55);
  --bg-section: #0c0c16;
  --bg-card: #12121e;
  --border: rgba(255,255,255,0.08);
  --shadow: 0 4px 20px rgba(0,0,0,0.4);
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Noto Sans SC', sans-serif;
  background: #08080f;
  color: var(--text-body);
  line-height: 1.7;
  font-size: 14px;
}

/* ===== HERO — LUXURY MASTHEAD v4 ===== */
.hero {
  background: #04040a;
  position: relative;
  overflow: hidden;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse 50% 45% at 50% 44%, rgba(180,150,80,0.03) 0%, transparent 70%);
  pointer-events: none;
}
.hero::after {
  content: '';
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(180,150,80,0.01) 1px, transparent 1px),
    linear-gradient(90deg, rgba(180,150,80,0.01) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse 60% 50% at 50% 45%, rgba(0,0,0,0.4) 0%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 60% 50% at 50% 45%, rgba(0,0,0,0.4) 0%, transparent 75%);
  pointer-events: none;
}
.hero-ghost {
  position: absolute;
  font-family: 'Cinzel', serif;
  font-weight: 900;
  font-size: clamp(300px, 52vw, 700px);
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1px rgba(180,150,80,0.018);
  top: 50%; left: 50%;
  transform: translate(-50%, -54%);
  pointer-events: none;
  user-select: none;
}

/* ── TOP BAR ── */
.hero-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 36px;
  border-bottom: 1px solid rgba(180,150,80,0.1);
  position: relative;
  z-index: 2;
}
.hero-topbar-seg {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: rgba(180,150,80,0.5);
}
.hero-topbar-center {
  display: flex;
  align-items: center;
  gap: 12px;
}
.hero-topbar-badge {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: rgba(180,150,80,0.65);
  border: 1px solid rgba(180,150,80,0.2);
  padding: 3px 14px;
}
.hero-topbar-dot {
  width: 3px; height: 3px;
  background: rgba(180,150,80,0.35);
  transform: rotate(45deg);
}

/* ── SIDE RAILS ── */
.hero-rail {
  position: absolute;
  top: 0; bottom: 0;
  width: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  pointer-events: none;
}
.hero-rail.l { left: 0; border-right: 1px solid rgba(180,150,80,0.05); }
.hero-rail.r { right: 0; border-left: 1px solid rgba(180,150,80,0.05); }
.hero-rail-text {
  writing-mode: vertical-rl;
  font-family: 'DM Mono', monospace;
  font-size:10px;
  letter-spacing: 3.5px;
  text-transform: uppercase;
  color: rgba(180,150,80,0.15);
}
.hero-rail.l .hero-rail-text { transform: rotate(180deg); }

/* ── CENTER STAGE ── */
.hero-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 48px;
  position: relative;
  z-index: 2;
  text-align: center;
}

.hero-logo-en {
  font-family: 'Noto Serif SC', serif;
  font-weight: 700;
  font-size: clamp(48px, 10.5vw, 148px);
  letter-spacing: 0.22em;
  text-indent: 0.22em;
  line-height: 0.92;
  color: transparent;
  background: linear-gradient(168deg,
    rgba(255,250,235,0.04) 0%,
    rgba(195,165,75,0.55) 12%,
    rgba(240,218,155,1) 35%,
    rgba(210,180,95,0.9) 52%,
    rgba(180,145,60,0.55) 72%,
    rgba(255,250,235,0.03) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  margin-bottom: clamp(16px, 2.5vw, 28px);
}

.hero-rule {
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 640px;
  margin-bottom: clamp(16px, 2.5vw, 28px);
}
.hero-rule-line {
  flex: 1; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(180,150,80,0.4));
}
.hero-rule-line.r {
  background: linear-gradient(90deg, rgba(180,150,80,0.4), transparent);
}
.hero-rule-mid {
  display: flex; align-items: center; gap: 12px; padding: 0 20px;
}
.hero-rule-diamond {
  width: 5px; height: 5px;
  background: rgba(180,150,80,0.55);
  transform: rotate(45deg);
}
.hero-rule-label {
  font-family: 'Cinzel', serif;
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 5px;
  text-transform: uppercase;
  color: rgba(180,150,80,0.5);
  white-space: nowrap;
}

.hero-logo-zh {
  font-family: 'Noto Serif SC', serif;
  font-weight: 700;
  font-size: clamp(30px, 5.5vw, 66px);
  color: rgba(255,255,255,0.93);
  letter-spacing: 0.55em;
  text-indent: 0.55em;
  line-height: 1.1;
  margin-bottom: clamp(6px, 1vw, 12px);
}

.hero-subtitle {
  font-family: 'Noto Serif SC', serif;
  font-size: clamp(15px, 2.2vw, 22px);
  color: rgba(200,170,80,0.65);
  letter-spacing: 0.5em;
  text-indent: 0.5em;
  font-weight: 400;
  margin-bottom: clamp(40px, 6vw, 72px);
}

/* ── CREDENTIAL BLOCK ── */
.hero-cred-block {
  text-align: center;
  max-width: 720px;
}
.hero-cred-label {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  letter-spacing: 3.5px;
  text-transform: uppercase;
  color: rgba(180,150,80,0.4);
  margin-bottom: 12px;
}
.hero-cred-orgs {
  font-family: 'Cinzel', serif;
  font-weight: 400;
  font-size: clamp(12px, 1.5vw, 16px);
  letter-spacing: 3.5px;
  text-transform: uppercase;
  color:rgba(255,255,255,0.30);
  line-height: 2.4;
}
.hero-cred-sep {
  display: inline-block;
  width: 18px; height: 1px;
  background: rgba(180,150,80,0.2);
  vertical-align: middle;
  margin: 0 12px;
}

/* ── HERO RESPONSIVE ── */
@media (max-width: 640px) {
  .hero-topbar { padding: 8px 16px; }
  .hero-topbar-center { display: none; }
  .hero-stage { padding: 0 20px; }
  .hero-rail { display: none; }
  .hero-cred-orgs { font-size: 11px; letter-spacing: 2px; }
}

/* ===== READING GUIDE ===== */
.guide-bar {
  background: linear-gradient(135deg, #0f1018 0%, #13141f 100%);
  border-top: 1px solid rgba(255,255,255,0.04);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding: 10px 20px;
  text-align: center;
  font-size: 11px;
  color: rgba(255,255,255,0.3);
  font-weight: 400;
  letter-spacing: 2px;
  text-transform: uppercase;
}

/* ===== NAV ===== */
.sticky-nav {
  position: fixed;
  top: 0;
  z-index: 100;
  width: 100%;
  height: 44px;
  background: #0d0d14;
  border-bottom: 1px solid rgba(201,168,76,0.2);
  display: flex;
  align-items: center;
}
.sticky-nav::-webkit-scrollbar { display: none; }
.nav-track {
  display: inline-flex;
  animation: navScroll 100s linear infinite;
  white-space: nowrap;
}
.nav-track:hover { animation-play-state: paused; }
@keyframes navScroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}
.nav-item {
  flex-shrink: 0;
  padding: 12px 14px;
  font-size: 11px;
  color: rgba(255,255,255,0.65);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  white-space: nowrap;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 5px;
}
.nav-item:hover { color: var(--gold); border-bottom-color: var(--gold-dim); }
.nav-item.active { color: var(--gold); border-bottom-color: var(--gold); }

/* ===== MAIN LAYOUT ===== */
.main { max-width: 1100px; margin: 0 auto; padding: 24px 16px 60px; }

/* ===== SECTION ===== */
.section {
  margin-bottom: 16px;
  border-radius: 12px;
  overflow: visible;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.section-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 22px;
  cursor: pointer;
  user-select: none;
  background: var(--bg-card);
  transition: background 0.2s;
  position: relative;
  border-radius: 12px 12px 0 0;
  overflow: hidden;
}
.section-header:hover { background: rgba(255,255,255,0.04); }
.section-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.section-meta { flex: 1; }
.section-title {
  font-family: 'Noto Serif SC', serif;
  font-size: 17px;
  font-weight: 600;
  color: var(--text-body);
  margin-bottom: 2px;
}
.section-desc {
  font-size: 11px;
  color: var(--text-light);
  letter-spacing: 0.3px;
}
.section-toggle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-section);
  color: var(--text-light);
  font-size: 14px;
  transition: transform 0.3s;
  flex-shrink: 0;
}
.section.open .section-toggle { transform: rotate(180deg); }
.section-body {
  display: none;
  background: var(--bg-section);
  border-top: 1px solid var(--border);
}
.section.open .section-body { display: block; }

/* ===== TOPIC GRID ===== */
.topic-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}
.topic-card {
  padding: 20px 22px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.topic-card:last-child { border-right: none; }

/* ===== TOPIC COMPONENTS ===== */
.topic-name {
  font-family: 'Noto Serif SC', serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-body);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-conclusion {
  font-size: 14px;
  font-weight: 700;
  color: #1a3a5c;
  line-height: 1.6;
  margin: 8px 0 10px 0;
  padding: 8px 12px;
  background: linear-gradient(135deg, rgba(26,58,92,0.06), rgba(201,168,76,0.06));
  border-left: 3px solid #c9a84c;
  border-radius: 0 6px 6px 0;
}
.topic-name .tag {
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
  letter-spacing: 0.5px;
}
/* 小白解释 */
.layman-box {
  background: rgba(201,168,76,0.06);
  border: 1px solid rgba(201,168,76,0.18);
  border-left: 3px solid var(--gold);
  border-radius: 6px;
  padding: 10px 13px;
  margin: 8px 0;
  font-size: 12px;
  line-height: 1.6;
  color: rgba(255,255,255,0.80);
}
.layman-box .lb-head {
  font-size: 10px;
  font-weight: 700;
  color: #c9a84c;
  letter-spacing: 1px;
  margin-bottom: 4px;
  text-transform: uppercase;
}
/* 专业解释 */
.pro-box {
  background: rgba(59,130,246,0.05);
  border: 1px solid rgba(59,130,246,0.18);
  border-left: 3px solid var(--blue);
  border-radius: 6px;
  padding: 10px 13px;
  margin: 8px 0;
  font-size: 12px;
  line-height: 1.6;
  color: rgba(255,255,255,0.80);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.pro-box .pb-head {
  font-size: 10px;
  font-weight: 700;
  color: #3b82f6;
  letter-spacing: 1px;
  margin-bottom: 4px;
}
/* 真实案例 */
.case-box {
  background: rgba(34,197,94,0.05);
  border: 1px solid rgba(34,197,94,0.18);
  border-left: 3px solid var(--teal);
  border-radius: 6px;
  padding: 10px 13px;
  margin: 8px 0;
  font-size: 12px;
  line-height: 1.6;
  color: rgba(255,255,255,0.80);
}
.case-box .cb-head {
  font-size: 10px;
  font-weight: 700;
  color: var(--teal);
  letter-spacing: 1px;
  margin-bottom: 4px;
}
/* 数据亮点 */
.data-box {
  background: rgba(239,68,68,0.05);
  border: 1px solid rgba(239,68,68,0.18);
  border-left: 3px solid var(--red);
  border-radius: 6px;
  padding: 10px 13px;
  margin: 8px 0;
  font-size: 12px;
  line-height: 1.6;
  color: rgba(255,255,255,0.80);
}
.data-box .db-head {
  font-size: 10px;
  font-weight: 700;
  color: var(--red);
  letter-spacing: 1px;
  margin-bottom: 4px;
}
/* 警示 */
.warn-box {
  background: rgba(122,79,58,0.06);
  border: 1px solid rgba(122,79,58,0.2);
  border-left: 3px solid var(--warm);
  border-radius: 6px;
  padding: 10px 13px;
  margin: 8px 0;
  font-size: 12px;
  line-height: 1.6;
  color: rgba(255,255,255,0.80);
}
.warn-box .wb-head {
  font-size: 10px;
  font-weight: 700;
  color: var(--warm);
  letter-spacing: 1px;
  margin-bottom: 4px;
}

/* bullet points */
.dot-list { list-style: none; padding: 0; margin: 8px 0; }
.dot-list li {
  padding: 3px 0 3px 16px;
  position: relative;
  font-size: 12.5px;
  color: var(--text-body);
  line-height: 1.7;
  overflow-wrap: break-word;
  word-break: break-word;
}
.dot-list li::before {
  content: '·';
  position: absolute;
  left: 0;
  color: var(--gold);
  font-size: 18px;
  line-height: 1.2;
}
/* Emphasized numbers */
.num { 
  font-family: 'Noto Serif SC', serif;
  font-weight: 700;
  color: var(--red);
}
.highlight { color: var(--gold-dim); font-weight: 500; }
.brand { 
  background: rgba(201,168,76,0.1);
  color: var(--gold-dim);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 11.5px;
  font-weight: 500;
}

/* Full-width topic */
.topic-full {
  padding: 20px 22px;
  border-bottom: 1px solid var(--border);
}

/* Two-col layout within topic */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 10px 0;
}
@media (max-width: 600px) { .two-col { grid-template-columns: 1fr; } }

/* Comparison table */
.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin: 10px 0;
  min-width: 420px;
}
.compare-table th {
  background: var(--ink);
  color: var(--gold);
  padding: 8px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.compare-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  word-break: break-word;
}
.compare-table tr:nth-child(even) td { background: rgba(0,0,0,0.015); }

/* Flow diagram */
.flow {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  margin: 10px 0;
}
.flow-step {
  background: var(--ink);
  color: var(--gold-light);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
}
.flow-arrow {
  color: var(--gold-dim);
  font-size: 14px;
}

/* Quote */
.quote-box {
  border-left: 3px solid var(--gold);
  padding: 8px 14px;
  margin: 8px 0;
  font-style: italic;
  font-size: 13px;
  color: var(--text-light);
  background: rgba(201,168,76,0.04);
}
.quote-box cite {
  display: block;
  font-style: normal;
  font-size: 11px;
  color: var(--gold-dim);
  margin-top: 4px;
}

/* Color-coded section accents */
.s1 .section-icon { background: rgba(192,57,43,0.1); }
.s2 .section-icon { background: rgba(201,168,76,0.12); }
.s3 .section-icon { background: rgba(26,122,110,0.1); }
.s4 .section-icon { background: rgba(26,74,122,0.1); }
.s5 .section-icon { background: rgba(90,45,130,0.1); }
.s6 .section-icon { background: rgba(122,79,58,0.1); }
.s7 .section-icon { background: rgba(45,122,95,0.1); }
.s8 .section-icon { background: rgba(192,57,43,0.1); }
.s9 .section-icon { background: rgba(26,74,122,0.1); }
.s10 .section-icon { background: rgba(201,168,76,0.12); }

/* Expand all button */
.controls {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-bottom: 16px;
}
.ctrl-btn {
  padding: 7px 16px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: 20px;
  font-size: 11px;
  cursor: pointer;
  color: var(--text-light);
  transition: all 0.2s;
  font-family: inherit;
}
.ctrl-btn:hover { background: var(--ink); color: var(--gold); border-color: var(--ink); }

/* Footer */
.footer {
  text-align: center;
  padding: 30px;
  color: var(--text-light);
  font-size: 11px;
  border-top: 1px solid var(--border);
  margin-top: 20px;
  letter-spacing: 0.5px;
}

/* Progress badge */


/* Keyword pill */
.kw {
  display: inline-block;
  background: var(--ink);
  color: var(--gold-light);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  margin: 2px;
}

/* Problem box */
.problem-box {
  background: rgba(239,68,68,0.04);
  border: 1px solid #e8b4c8;
  border-left: 3px solid #c0396a;
  border-radius: 6px;
  padding: 12px 14px;
  margin: 10px 0;
  font-size: 12px;
  line-height: 1.7;
}
.problem-box .prb-head {
  font-size: 10px;
  font-weight: 700;
  color: #c0396a;
  letter-spacing: 0.8px;
  margin-bottom: 6px;
}
/* Solution box */
.solution-box {
  background: rgba(34,197,94,0.04);
  border: 1px solid #a8d8bc;
  border-left: 3px solid #1a8a50;
  border-radius: 6px;
  padding: 12px 14px;
  margin: 10px 0;
  font-size: 12px;
  line-height: 1.7;
}
.solution-box .sol-head {
  font-size: 10px;
  font-weight: 700;
  color: #1a8a50;
  letter-spacing: 0.8px;
  margin-bottom: 6px;
}
/* Psychology box */
.psych-box {
  background: rgba(168,85,247,0.04);
  border: 1px solid #c8b4e8;
  border-left: 3px solid #6a39c0;
  border-radius: 6px;
  padding: 12px 14px;
  margin: 10px 0;
  font-size: 12px;
  line-height: 1.7;
}
.psych-box .psy-head {
  font-size: 10px;
  font-weight: 700;
  color: #6a39c0;
  letter-spacing: 0.8px;
  margin-bottom: 6px;
}
.psych-quote {
  font-style: italic;
  color: #6a39c0;
  border-left: 2px solid #c8b4e8;
  padding-left: 8px;
  margin: 6px 0;
}
/* Sub-section heading */
.sub-heading {
  font-family: 'Noto Serif SC', serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-body);
  margin: 14px 0 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

/* ===== SEARCH ===== */
.search-trigger {
  flex-shrink: 0;
  padding: 10px 16px;
  font-size: 11px;
  color: rgba(255,255,255,0.85);
  cursor: pointer;
  background: rgba(201,168,76,0.18);
  border: 1px solid rgba(201,168,76,0.35);
  border-radius: 6px;
  margin: 6px 12px 6px auto;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: all 0.2s;
  letter-spacing: 0.3px;
}
.search-trigger:hover { background: rgba(201,168,76,0.3); color: var(--gold); }
.search-trigger kbd {
  font-size: 9px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 3px;
  padding: 1px 5px;
  color: rgba(255,255,255,0.65);
}

/* overlay */
.search-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(10,10,18,0.92);
  padding: 60px 20px 20px;
  overflow-y: auto;
}
.search-overlay.open { display: flex; flex-direction: column; align-items: center; }

.search-box-wrap {
  width: 100%;
  max-width: 720px;
  position: relative;
  flex-shrink: 0;
}
.search-icon-inside {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  opacity: 0.5;
  pointer-events: none;
}
#searchInput {
  width: 100%;
  padding: 18px 18px 18px 52px;
  font-size: 18px;
  font-family: 'Noto Sans SC', sans-serif;
  background: #1a1a2e;
  color: #fff;
  border: 2px solid rgba(201,168,76,0.5);
  border-radius: 12px;
  outline: none;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  caret-color: var(--gold);
}
#searchInput:focus { border-color: var(--gold); }
#searchInput::placeholder { color: rgba(255,255,255,0.3); }

.search-close {
  position: fixed;
  top: 16px;
  right: 20px;
  color: rgba(255,255,255,0.65);
  font-size: 28px;
  cursor: pointer;
  line-height: 1;
  padding: 4px 10px;
  border-radius: 8px;
  transition: all 0.15s;
  z-index: 10001;
}
.search-close:hover { color: #fff; background: rgba(255,255,255,0.1); }

.search-hint {
  color:rgba(255,255,255,0.30);
  font-size: 12px;
  margin-top: 12px;
  text-align: center;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}
.search-hint span { color: rgba(201,168,76,0.7); }

#searchResults {
  width: 100%;
  max-width: 720px;
  margin-top: 20px;
}
.search-empty {
  text-align: center;
  color: rgba(255,255,255,0.3);
  font-size: 14px;
  padding: 40px 0;
}
.search-count {
  font-size: 11px;
  color:rgba(255,255,255,0.30);
  margin-bottom: 12px;
  letter-spacing: 0.5px;
  text-align: center;
}
.search-count span { color: var(--gold); }

/* result groups */
.result-group { margin-bottom: 16px; }
.result-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: rgba(255,255,255,0.05);
  border-radius: 8px 8px 0 0;
  border-left: 3px solid var(--gold);
}
.rg-icon { font-size: 16px; }
.rg-title {
  font-size: 12px;
  font-weight: 600;
  color: rgba(255,255,255,0.80);
  letter-spacing: 0.3px;
}
.rg-count {
  margin-left: auto;
  font-size: 10px;
  color: rgba(201,168,76,0.6);
  background: rgba(201,168,76,0.1);
  border-radius: 10px;
  padding: 2px 8px;
}

/* individual result card */
.result-item {
  background: rgba(255,255,255,0.04);
  border-left: 3px solid transparent;
  padding: 12px 16px;
  cursor: pointer;
  transition: all 0.15s;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.result-item:last-child { border-radius: 0 0 8px 8px; border-bottom: none; }
.result-item:hover {
  background: rgba(255,255,255,0.08);
  border-left-color: var(--gold);
}
.result-type {
  display: inline-block;
  font-size: 9px;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 10px;
  margin-bottom: 6px;
  font-weight: 600;
}
.type-problem { background: rgba(192,57,43,0.2); color: #e57e73; }
.type-solution { background: rgba(26,122,110,0.2); color: #5ecabb; }
.type-concept { background: rgba(26,74,122,0.2); color: #6aacf0; }
.type-data { background: rgba(90,45,130,0.2); color: #b57fdd; }
.type-case { background: rgba(201,168,76,0.2); color: var(--gold); }
.type-card { background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.65); }
.type-psych { background: rgba(255,150,100,0.15); color: #ffaa80; }

.result-card-name {
  font-size: 13px;
  color: rgba(255,255,255,0.85);
  margin-bottom: 5px;
  font-weight: 500;
  line-height: 1.4;
}
.result-card-name mark {
  background: rgba(201,168,76,0.35);
  color: var(--gold);
  border-radius: 2px;
  padding: 0 1px;
}
.result-snippet {
  font-size: 11px;
  color: rgba(255,255,255,0.38);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.result-snippet mark {
  background: rgba(201,168,76,0.25);
  color: rgba(201,168,76,0.9);
  border-radius: 2px;
  padding: 0 1px;
}
.result-arrow {
  float: right;
  color: rgba(255,255,255,0.2);
  font-size: 14px;
  margin-top: 2px;
  transition: all 0.15s;
}
.result-item:hover .result-arrow { color: var(--gold); transform: translateX(3px); }

/* search highlight on page */
.search-highlight-pulse {
  animation: searchPulse 1.5s ease-out;
}
@keyframes searchPulse {
  0%   { box-shadow: 0 0 0 0 rgba(201,168,76,0.6), inset 0 0 0 2px rgba(201,168,76,0.4); }
  50%  { box-shadow: 0 0 0 12px rgba(201,168,76,0), inset 0 0 0 2px rgba(201,168,76,0.2); }
  100% { box-shadow: none; }
}


/* ===== SEARCH BAR — Double Deck ===== */
.search-bar-wrap { padding:4px 4px 0; position:relative; max-width:1400px; margin:0 auto; }
.search-bar {
  display:flex;flex-direction:column;
  border:1px solid rgba(180,150,80,0.12);border-radius:4px;
  background:rgba(255,255,255,0.02);overflow:visible;position:relative;z-index:10;
}
.search-bar:focus-within { border-color:rgba(180,150,80,0.25); }
/* Row 1: icon + input + go */
.sb-row1 {
  display:flex;align-items:center;height:44px;
}
.sb-icon {
  color:rgba(180,150,80,0.35);padding:0 12px 0 14px;font-size:13px;flex-shrink:0;
  font-style:normal;line-height:1;
}
.sb-input {
  flex:1;height:100%;border:none;outline:none;
  background:transparent;color:rgba(255,255,255,0.9);
  font-size:15px;font-family:'Noto Sans SC',sans-serif;padding:0 8px;
}
.sb-input::placeholder { color:rgba(255,255,255,0.35);font-size:14px; }
.sb-go {
  font-family:'DM Mono',monospace;font-size:10px;letter-spacing:1px;
  color:#04040a;background:#c9a84c;
  border:none;
  padding:0 20px;cursor:pointer;white-space:nowrap;height:100%;font-weight:500;
  border-radius:0 3px 0 0;
}
.sb-go:hover { background:#b8943f; }
.sb-go.loading { opacity:0.6;pointer-events:none; }
/* Row 2: toolbar */
.sb-row2 {
  display:flex;align-items:center;justify-content:space-between;
  padding:0 8px;height:28px;
  border-top:1px solid rgba(255,255,255,0.03);
  background:rgba(180,150,80,0.015);
  border-radius:0 0 3px 3px;
}
.sb-row2-right { display:flex;align-items:center;gap:10px;padding-right:4px; }
.sb-tabs { display:flex;align-items:center;gap:1px; }
.sb-tab {
  font-family:'DM Mono',monospace;font-size:10px;letter-spacing:0.5px;
  color:rgba(255,255,255,0.35);background:none;
  border:1px solid transparent;border-radius:3px;
  padding:2px 10px;cursor:pointer;white-space:nowrap;
}
.sb-tab:hover { color:rgba(255,255,255,0.55); }
.sb-tab.active { color:#c9a84c;border-color:rgba(180,150,80,0.18);background:rgba(180,150,80,0.05); }
.sb-web-toggle {
  font-family:'DM Mono',monospace;font-size:10px;letter-spacing:0.5px;
  color:rgba(255,255,255,0.18);background:none;
  border:1px solid transparent;border-radius:3px;
  padding:2px 10px;cursor:pointer;white-space:nowrap;
}
.sb-web-toggle:hover { color:rgba(255,255,255,0.35); }
.sb-web-toggle.active { border-color:rgba(34,197,94,0.2);color:#22c55e;background:rgba(34,197,94,0.03); }
.sb-info { display:flex;align-items:center; }
.sb-info.off { display:none; }
.sb-stat { font-family:'DM Mono',monospace;font-size:9px;letter-spacing:1px;color:rgba(255,255,255,0.18); }
.sb-stat em { font-style:normal;color:rgba(180,150,80,0.4); }
.sb-controls { display:none;align-items:center; }
.sb-controls.on { display:flex; }
/* sb-key-btn defined below with API Key section */
.kb-dropdown {
  display:none;position:absolute;top:100%;left:0;right:0;z-index:20;
  background:#0d0e16;border:1px solid rgba(180,150,80,0.1);border-top:none;
  border-radius:0 0 6px 6px;max-height:320px;overflow-y:auto;
}
.kb-dropdown.show { display:block; }
.kb-item {
  display:flex;align-items:center;gap:12px;
  padding:10px 16px;cursor:pointer;border-bottom:1px solid rgba(255,255,255,0.02);
}
.kb-item:last-child { border-bottom:none; }
.kb-item:hover { background:rgba(180,150,80,0.04); }
.kb-id { font-family:'DM Mono',monospace;font-size:10px;color:rgba(180,150,80,0.4);min-width:28px; }
.kb-name { font-size:13px;color:rgba(255,255,255,0.80);flex:1; }
.kb-match { font-family:'DM Mono',monospace;font-size:9px;color:rgba(255,255,255,0.20);letter-spacing:0.5px; }
.kb-count { font-family:'DM Mono',monospace;font-size:9px;color:rgba(180,150,80,0.3); }
.ai-result {
  display:none;margin-top:12px;
  border:1px solid rgba(180,150,80,0.08);border-radius:6px;
  background:#0a0b12;overflow:hidden;
}
.ai-result.show { display:block; }
.ai-result-header {
  display:flex;align-items:center;justify-content:space-between;
  padding:10px 16px;border-bottom:1px solid rgba(255,255,255,0.03);background:rgba(255,255,255,0.01);
}
.ai-result-query { font-size:12px;color:rgba(255,255,255,0.55); }
.ai-result-badge { font-family:'DM Mono',monospace;font-size:9px;letter-spacing:1px;color:rgba(180,150,80,0.4); }
.ai-result-body { padding:16px;font-size:13px;color:rgba(255,255,255,0.65);line-height:1.85; }
.ai-result-body p { margin-bottom:12px; }
.ai-result-body strong { color:rgba(255,255,255,0.85);font-weight:600; }
.ai-citations {
  padding:10px 16px;border-top:1px solid rgba(255,255,255,0.03);
  display:flex;align-items:center;gap:8px;flex-wrap:wrap;
}
.ai-cite-label { font-family:'DM Mono',monospace;font-size:9px;letter-spacing:1.5px;text-transform:uppercase;color:rgba(255,255,255,0.20); }
.ai-cite-tag {
  font-family:'DM Mono',monospace;font-size:9px;letter-spacing:0.5px;
  color:rgba(180,150,80,0.4);background:rgba(180,150,80,0.04);
  border:1px solid rgba(180,150,80,0.1);border-radius:3px;padding:2px 8px;cursor:pointer;
}
.ai-cite-tag:hover { border-color:rgba(180,150,80,0.25);color:rgba(180,150,80,0.6); }
.ai-deep {
  padding:8px 16px;border-top:1px solid rgba(180,150,80,0.06);
  background:rgba(180,150,80,0.02);display:flex;align-items:center;justify-content:flex-end;
}
.ai-deep a { font-family:'DM Mono',monospace;font-size:10px;letter-spacing:1px;color:rgba(180,150,80,0.5);text-decoration:none; }
.ai-deep a:hover { color:#c9a84c; }
.sb-chips { display:flex;gap:6px;flex-wrap:wrap;margin-top:8px;margin-bottom:12px; }
.sb-chip {
  font-family:'DM Mono',monospace;font-size:11px;letter-spacing:0.3px;
  color:rgba(255,255,255,0.35);border:1px solid rgba(255,255,255,0.06);
  border-radius:3px;padding:4px 12px;cursor:pointer;
  background:transparent;
}
.sb-chip:hover { color:rgba(180,150,80,0.5);border-color:rgba(180,150,80,0.15); }
/* API Key button — inside AI controls */
.sb-key-btn {
  font-family:'DM Mono',monospace;font-size:9px;letter-spacing:0.5px;
  color:rgba(255,255,255,0.20);background:none;
  border:1px solid rgba(255,255,255,0.05);border-radius:3px;
  padding:3px 8px;cursor:pointer;white-space:nowrap;
}
.sb-key-btn:hover { color:rgba(180,150,80,0.4);border-color:rgba(180,150,80,0.15); }
.sb-key-btn.configured { color:rgba(34,197,94,0.5);border-color:rgba(34,197,94,0.15); }
/* API Key dropdown panel */
.sb-key-panel {
  display:none;position:absolute;top:46px;right:0;z-index:30;
  background:#0d0e16;border:1px solid rgba(180,150,80,0.12);border-radius:6px;
  padding:12px 14px;width:320px;
}
.sb-key-panel.show { display:block; }
.sb-key-row { display:flex;align-items:center;gap:8px; }
.sb-key-input {
  flex:1;height:28px;
  background:rgba(255,255,255,0.04);border:1px solid rgba(255,255,255,0.08);
  border-radius:4px;padding:0 10px;color:rgba(255,255,255,0.65);
  font-family:'DM Mono',monospace;font-size:10px;outline:none;
}
.sb-key-input:focus { border-color:rgba(180,150,80,0.3); }
.sb-key-input::placeholder { color:rgba(255,255,255,0.20); }
.sb-key-save {
  font-family:'DM Mono',monospace;font-size:9px;letter-spacing:0.5px;
  color:#c9a84c;background:rgba(180,150,80,0.08);
  border:1px solid rgba(180,150,80,0.2);border-radius:3px;
  padding:4px 12px;cursor:pointer;white-space:nowrap;
}
.sb-key-save:hover { background:rgba(180,150,80,0.15); }
.sb-key-remember {
  display:flex;align-items:center;gap:5px;margin-top:8px;
  font-family:'DM Mono',monospace;font-size:9px;color:rgba(255,255,255,0.20);cursor:pointer;
}
.sb-key-remember input { accent-color:#c9a84c;cursor:pointer; }
.sb-key-status {
  font-family:'DM Mono',monospace;font-size:9px;color:rgba(34,197,94,0.6);
  margin-top:6px;display:none;
}
@keyframes spin { to { transform:rotate(360deg); } }

/* ===== AI RESULTS PANEL ===== */
.ai-results-panel {
  background: linear-gradient(135deg, #0f0f1c 0%, #161625 100%);
  border-bottom: 1px solid rgba(201,168,76,0.15);
  display: none;
  overflow: hidden;
}
.ai-results-panel.open { display: block; }

.ai-results-inner {
  max-width: 760px;
  margin: 0 auto;
  padding: 20px 20px 24px;
}

.ai-results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.ai-results-title {
  font-size: 12px;
  color: rgba(255,255,255,0.4);
  letter-spacing: 0.5px;
}
.ai-results-title strong { color: var(--gold); }
.ai-close-btn {
  font-size: 18px;
  color: rgba(255,255,255,0.3);
  cursor: pointer;
  padding: 2px 8px;
  border-radius: 6px;
  transition: all 0.15s;
  line-height: 1;
}
.ai-close-btn:hover { color: #fff; background: rgba(255,255,255,0.08); }

/* two-column layout: AI questions | local matches */
.ai-results-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 600px) {
  .ai-results-cols { grid-template-columns: 1fr; }
}
.ai-col-head {
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.3);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.ai-col-head span {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
.col-ai .ai-col-head span { background: var(--gold); }
.col-local .ai-col-head span { background: #5ecabb; }

/* AI question items */
.ai-q-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
  margin-bottom: 6px;
  border: 1px solid transparent;
}
.ai-q-item:hover {
  background: rgba(201,168,76,0.07);
  border-color: rgba(201,168,76,0.2);
}
.ai-q-num {
  font-size: 10px;
  color: rgba(201,168,76,0.5);
  font-weight: 700;
  flex-shrink: 0;
  padding-top: 1px;
  width: 16px;
}
.ai-q-text {
  font-size: 13px;
  color: rgba(255,255,255,0.75);
  line-height: 1.5;
}
.ai-q-tag {
  font-size: 9px;
  color: rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.06);
  border-radius: 10px;
  padding: 2px 7px;
  flex-shrink: 0;
  margin-top: 2px;
  white-space: nowrap;
}

/* local match items */
.local-match-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.15s;
  margin-bottom: 5px;
  border: 1px solid transparent;
}
.local-match-item:hover {
  background: rgba(94,202,187,0.07);
  border-color: rgba(94,202,187,0.2);
}
.lm-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: rgba(94,202,187,0.5);
  flex-shrink: 0;
  margin-top: 5px;
}
.lm-content { flex: 1; }
.lm-title {
  font-size: 12px;
  color: rgba(255,255,255,0.65);
  line-height: 1.4;
  margin-bottom: 2px;
}
.lm-title mark {
  background: rgba(201,168,76,0.25);
  color: var(--gold);
  border-radius: 2px;
  padding: 0 1px;
}
.lm-section {
  font-size: 10px;
  color:rgba(255,255,255,0.30);
}
.lm-arrow {
  color:rgba(255,255,255,0.20);
  font-size: 12px;
  flex-shrink: 0;
  padding-top: 1px;
  transition: all 0.15s;
}
.local-match-item:hover .lm-arrow { color: #5ecabb; transform: translateX(2px); }

/* AI typing animation */
.ai-typing {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 16px 0;
  color: rgba(255,255,255,0.3);
  font-size: 13px;
}
.ai-typing-dots span {
  display: inline-block;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--gold);
  margin: 0 2px;
  animation: dotBounce 1.2s ease-in-out infinite;
}
.ai-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.ai-typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dotBounce {
  0%,80%,100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

.ai-error {
  padding: 12px 16px;
  background: rgba(192,57,43,0.1);
  border: 1px solid rgba(192,57,43,0.25);
  border-radius: 8px;
  color: #e57e73;
  font-size: 13px;
}

/* no more separate overlay, but keep local search accessible via ctrl+k */


/* ===== AI ANSWER PANEL (RAG mode) ===== */
.ai-results-panel {
  background: linear-gradient(160deg, #0e0e1c 0%, #15152a 100%);
  border-bottom: 1px solid rgba(201,168,76,0.18);
  display: none;
  overflow: hidden;
}
.ai-results-panel.open { display: block; }

.ai-results-inner {
  max-width: 820px;
  margin: 0 auto;
  padding: 24px 24px 28px;
}

/* header row */
.ai-ans-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.ai-ans-query-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}
.ai-ans-query-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: rgba(201,168,76,0.15);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.ai-ans-query-text {
  font-size: 15px;
  font-weight: 600;
  color: rgba(255,255,255,0.85);
  line-height: 1.4;
}
.ai-ans-query-sub {
  font-size: 10px;
  color: rgba(201,168,76,0.6);
  letter-spacing: 0.5px;
  margin-top: 2px;
}
.ai-close-btn {
  font-size: 18px;
  color: rgba(255,255,255,0.3);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.15s;
  line-height: 1;
  flex-shrink: 0;
}
.ai-close-btn:hover { color: #fff; background: rgba(255,255,255,0.08); }

/* loading state */
.ai-loading-block {
  padding: 20px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ai-loading-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color:rgba(255,255,255,0.30);
  font-size: 13px;
}
.ai-loading-row .step-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: rgba(201,168,76,0.3);
  flex-shrink: 0;
  transition: all 0.3s;
}
.ai-loading-row.active .step-dot {
  background: var(--gold);
  box-shadow: 0 0 8px rgba(201,168,76,0.5);
}
.ai-loading-row.active { color: rgba(255,255,255,0.65); }
.ai-loading-row.done .step-dot { background: #5ecabb; }
.ai-loading-row.done { color: rgba(94,202,187,0.6); }

/* main answer block */
.ai-answer-block {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(201,168,76,0.15);
  border-radius: 12px;
  padding: 20px 22px;
  margin-bottom: 20px;
  line-height: 1.8;
}
.ai-answer-label {
  font-size: 9px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: rgba(201,168,76,0.6);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.ai-answer-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(201,168,76,0.12);
}
/* Answer text formatting */
.ai-answer-body {
  color: rgba(255,255,255,0.78);
  font-size: 14px;
}
.ai-answer-body h3 {
  color: var(--gold);
  font-size: 14px;
  font-weight: 600;
  margin: 16px 0 8px;
  padding-left: 10px;
  border-left: 3px solid var(--gold);
}
.ai-answer-body h3:first-child { margin-top: 0; }
.ai-answer-body p { margin-bottom: 10px; color: rgba(255,255,255,0.72); }
.ai-answer-body ul, .ai-answer-body ol {
  padding-left: 18px;
  margin-bottom: 10px;
}
.ai-answer-body li { margin-bottom: 5px; color: rgba(255,255,255,0.68); }
.ai-answer-body strong { color: rgba(255,255,255,0.9); }
.ai-answer-body .num { color: var(--gold); font-weight: 700; }
.ai-answer-body .warn {
  background: rgba(192,57,43,0.1);
  border-left: 3px solid rgba(192,57,43,0.4);
  padding: 8px 12px;
  border-radius: 0 6px 6px 0;
  margin: 10px 0;
  font-size: 13px;
  color: #e57e73;
}
.ai-answer-body .tip {
  background: rgba(26,122,110,0.1);
  border-left: 3px solid rgba(26,122,110,0.4);
  padding: 8px 12px;
  border-radius: 0 6px 6px 0;
  margin: 10px 0;
  font-size: 13px;
  color: #5ecabb;
}

/* related sections */
.ai-related-head {
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color:rgba(255,255,255,0.30);
  margin-bottom: 10px;
}
.ai-related-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.ai-related-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  font-size: 12px;
  color: rgba(255,255,255,0.55);
}
.ai-related-chip:hover {
  background: rgba(94,202,187,0.08);
  border-color: rgba(94,202,187,0.25);
  color: #5ecabb;
}
.ai-related-chip .rc-icon { font-size: 13px; }
.ai-related-chip .rc-text { line-height: 1.3; }
.ai-related-chip .rc-section { font-size: 10px; color:rgba(255,255,255,0.30); display: block; }

/* follow-up */
.ai-followup-row {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.ai-followup-btn {
  font-size: 12px;
  color: rgba(201,168,76,0.7);
  background: rgba(201,168,76,0.07);
  border: 1px solid rgba(201,168,76,0.2);
  border-radius: 20px;
  padding: 5px 14px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: 'Noto Sans SC', sans-serif;
}
.ai-followup-btn:hover {
  background: rgba(201,168,76,0.15);
  color: var(--gold);
}

.ai-error-block {
  padding: 16px;
  background: rgba(192,57,43,0.08);
  border: 1px solid rgba(192,57,43,0.2);
  border-radius: 10px;
  color: #e57e73;
  font-size: 13px;
  line-height: 1.6;
}


/* API key row */
.api-key-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 0 14px;
  border-top: 1px solid rgba(255,255,255,0.06);
  margin-top: 2px;
  padding-top: 12px;
}
.api-key-toggle {
  font-size: 11px;
  color:rgba(255,255,255,0.30);
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s;
  user-select: none;
  flex-shrink: 0;
}
.api-key-toggle:hover { color: rgba(201,168,76,0.7); }
.api-key-toggle.has-key { color: rgba(94,202,187,0.6); }
#apiKeyInputWrap {
  display: none;
  flex: 1;
  gap: 6px;
  align-items: center;
}
#apiKeyInputWrap.open { display: flex; }
#apiKeyField {
  flex: 1;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  color: rgba(255,255,255,0.80);
  font-family: monospace;
  outline: none;
}
#apiKeyField:focus { border-color: rgba(201,168,76,0.4); }
#apiKeyField::placeholder { color: rgba(255,255,255,0.2); font-family: 'Noto Sans SC', sans-serif; }
.api-key-save {
  font-size: 11px;
  padding: 6px 12px;
  background: rgba(201,168,76,0.15);
  border: 1px solid rgba(201,168,76,0.3);
  border-radius: 6px;
  color: var(--gold);
  cursor: pointer;
  white-space: nowrap;
  font-family: 'Noto Sans SC', sans-serif;
  transition: background 0.15s;
}
.api-key-save:hover { background: rgba(201,168,76,0.25); }
.api-key-status {
  font-size: 10px;
  color: rgba(94,202,187,0.7);
  white-space: nowrap;
}

/* smart fallback answer */
.sf-section {
  margin-bottom: 16px;
}
.sf-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--gold);
  padding-left: 10px;
  border-left: 3px solid var(--gold);
  margin-bottom: 10px;
}
.sf-item {
  padding: 10px 14px;
  background: rgba(255,255,255,0.03);
  border-radius: 8px;
  margin-bottom: 6px;
  border: 1px solid rgba(255,255,255,0.05);
  transition: all 0.15s;
}
.sf-item:hover {
  background: rgba(201,168,76,0.07);
  border-color: rgba(201,168,76,0.25);
  transform: translateX(2px);
}
.sf-q {
  font-size: 12px;
  color: rgba(255,255,255,0.45);
  margin-bottom: 5px;
  display: flex;
  align-items: flex-start;
  gap: 6px;
}
.sf-q-dot { color: #e57e73; flex-shrink: 0; }
.sf-a {
  font-size: 13px;
  color: rgba(255,255,255,0.75);
  line-height: 1.6;
}
.sf-a strong { color: rgba(255,255,255,0.9); }
.sf-no-key-note {
  font-size: 11px;
  color:rgba(255,255,255,0.30);
  text-align: center;
  padding: 8px 0 0;
  line-height: 1.6;
}
.sf-no-key-note a {
  color: rgba(201,168,76,0.6);
  cursor: pointer;
  text-decoration: underline;
}


/* ===== SYNTHESIZED ANSWER (local RAG) ===== */
.syn-answer {
  line-height: 1.85;
  color: rgba(255,255,255,0.78);
  font-size: 14px;
}
.syn-lead {
  font-size: 15px;
  color: rgba(255,255,255,0.88);
  line-height: 1.7;
  margin-bottom: 18px;
  padding: 14px 16px;
  background: rgba(201,168,76,0.06);
  border-left: 3px solid var(--gold);
  border-radius: 0 8px 8px 0;
}
.syn-step {
  margin-bottom: 14px;
  padding: 14px 16px;
  background: rgba(255,255,255,0.03);
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.06);
  transition: all 0.15s;
  cursor: pointer;
}
.syn-step:hover {
  background: rgba(201,168,76,0.06);
  border-color: rgba(201,168,76,0.2);
  transform: translateX(2px);
}
.syn-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px; height: 20px;
  background: rgba(201,168,76,0.2);
  color: var(--gold);
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  margin-right: 8px;
  flex-shrink: 0;
}
.syn-step-title {
  font-weight: 600;
  color: rgba(255,255,255,0.88);
  font-size: 14px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
}
.syn-step-body {
  font-size: 13px;
  color: rgba(255,255,255,0.62);
  line-height: 1.7;
  padding-left: 28px;
}
.syn-inline-data {
  display: inline-block;
  background: rgba(90,45,130,0.2);
  color: #b57fdd;
  border-radius: 4px;
  padding: 1px 7px;
  font-size: 12px;
  font-weight: 600;
  margin: 0 2px;
}
.syn-inline-case {
  display: inline-block;
  background: rgba(26,122,110,0.15);
  color: #5ecabb;
  border-radius: 4px;
  padding: 1px 7px;
  font-size: 12px;
  margin: 0 2px;
}
.syn-warn {
  margin: 12px 0;
  padding: 10px 14px;
  background: rgba(192,57,43,0.08);
  border-left: 3px solid rgba(192,57,43,0.4);
  border-radius: 0 8px 8px 0;
  font-size: 13px;
  color: #e57e73;
}
.syn-sources {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.syn-sources-label {
  font-size: 10px;
  color: rgba(255,255,255,0.2);
  letter-spacing: 0.5px;
  margin-right: 4px;
}
.syn-source-tag {
  font-size: 11px;
  color:rgba(255,255,255,0.30);
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 3px 10px;
  cursor: pointer;
  transition: all 0.15s;
}
.syn-source-tag:hover {
  color: #5ecabb;
  border-color: rgba(94,202,187,0.3);
  background: rgba(94,202,187,0.05);
}


/* ===== PHASE 1: CLARIFYING QUESTIONS ===== */
.clarify-block {
  margin-bottom: 4px;
}
.clarify-intro {
  font-size: 13px;
  color: rgba(255,255,255,0.55);
  line-height: 1.7;
  margin-bottom: 16px;
  padding: 12px 16px;
  background: rgba(255,255,255,0.03);
  border-radius: 8px;
  border-left: 3px solid rgba(201,168,76,0.4);
}
.clarify-intro strong { color: rgba(255,255,255,0.8); }
.clarify-questions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}
.clarify-q {
  font-size: 12px;
  color: rgba(255,255,255,0.4);
  margin-bottom: 6px;
  letter-spacing: 0.3px;
}
.clarify-options {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.clarify-option {
  padding: 7px 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px;
  font-size: 12px;
  color: rgba(255,255,255,0.65);
  cursor: pointer;
  transition: all 0.15s;
  font-family: 'Noto Sans SC', sans-serif;
}
.clarify-option:hover {
  background: rgba(201,168,76,0.1);
  border-color: rgba(201,168,76,0.4);
  color: var(--gold);
}
.clarify-option.selected {
  background: rgba(201,168,76,0.15);
  border-color: var(--gold);
  color: var(--gold);
}
.clarify-submit-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.clarify-submit {
  padding: 9px 24px;
  background: var(--gold);
  color: var(--ink);
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  font-family: 'Noto Sans SC', sans-serif;
  cursor: pointer;
  transition: all 0.15s;
}
.clarify-submit:hover { background: #e0bc60; }
.clarify-skip {
  font-size: 12px;
  color:rgba(255,255,255,0.30);
  cursor: pointer;
  text-decoration: underline;
  transition: color 0.15s;
}
.clarify-skip:hover { color: rgba(255,255,255,0.65); }

/* ===== PHASE 2: SYNTHESIZED ANSWER ===== */
.syn-answer {
  line-height: 1.85;
  color: rgba(255,255,255,0.78);
  font-size: 14px;
}
.syn-context-para {
  font-size: 14px;
  color: rgba(255,255,255,0.72);
  line-height: 1.85;
  margin-bottom: 20px;
  padding: 16px 18px;
  background: rgba(255,255,255,0.03);
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.06);
}
.syn-context-para strong { color: rgba(255,255,255,0.9); }
.syn-context-para .ctx-data {
  display: inline-block;
  background: rgba(90,45,130,0.2);
  color: #b57fdd;
  border-radius: 4px;
  padding: 0 6px;
  font-size: 12px;
  font-weight: 600;
  margin: 0 1px;
}
.syn-steps-head {
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color:rgba(255,255,255,0.30);
  margin-bottom: 10px;
}
.syn-step {
  margin-bottom: 10px;
  padding: 14px 16px;
  background: rgba(255,255,255,0.03);
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.06);
  transition: all 0.15s;
  cursor: pointer;
}
.syn-step:hover {
  background: rgba(201,168,76,0.06);
  border-color: rgba(201,168,76,0.2);
  transform: translateX(2px);
}
.syn-step-title {
  font-weight: 600;
  color: rgba(255,255,255,0.88);
  font-size: 14px;
  margin-bottom: 7px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.syn-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px; height: 20px;
  background: rgba(201,168,76,0.2);
  color: var(--gold);
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}
.syn-step-body {
  font-size: 13px;
  color: rgba(255,255,255,0.62);
  line-height: 1.75;
  padding-left: 28px;
}
.syn-inline-data {
  display: inline-block;
  background: rgba(90,45,130,0.2);
  color: #b57fdd;
  border-radius: 4px;
  padding: 0 6px;
  font-size: 12px;
  font-weight: 600;
  margin: 0 1px;
}
.syn-inline-case {
  display: inline;
  color: #5ecabb;
  font-size: 12px;
}
.syn-warn-inline {
  margin-top: 7px;
  padding: 7px 10px;
  background: rgba(192,57,43,0.08);
  border-left: 2px solid rgba(192,57,43,0.4);
  border-radius: 0 6px 6px 0;
  font-size: 12px;
  color: #e57e73;
}
.syn-sources {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.syn-sources-label {
  font-size: 10px;
  color: rgba(255,255,255,0.2);
  letter-spacing: 0.5px;
  margin-right: 4px;
}
.syn-source-tag {
  font-size: 11px;
  color:rgba(255,255,255,0.30);
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 3px 10px;
  cursor: pointer;
  transition: all 0.15s;
}
.syn-source-tag:hover {
  color: #5ecabb;
  border-color: rgba(94,202,187,0.3);
}


/* ===== THINKING PROCESS DISPLAY ===== */
.thinking-block {
  padding: 4px 0 16px;
}
.thinking-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 7px 0;
  opacity: 0.3;
  transition: opacity 0.4s;
}
.thinking-row.active { opacity: 1; }
.thinking-row.done   { opacity: 0.5; }
.thinking-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  flex-shrink: 0;
  margin-top: 5px;
  transition: all 0.3s;
}
.thinking-row.active .thinking-dot {
  background: var(--gold);
  box-shadow: 0 0 8px rgba(201,168,76,0.6);
  animation: thinkPulse 1s ease-in-out infinite;
}
.thinking-row.done .thinking-dot { background: #5ecabb; }
@keyframes thinkPulse {
  0%,100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.4); opacity: 0.7; }
}
.thinking-text {
  font-size: 13px;
  color: rgba(255,255,255,0.65);
  line-height: 1.5;
}
.thinking-row.active .thinking-text { color: rgba(255,255,255,0.85); }
.thinking-row.done .thinking-text   { color:rgba(255,255,255,0.30); }
.thinking-sub {
  font-size: 11px;
  color: rgba(255,255,255,0.3);
  margin-top: 2px;
  display: none;
}
.thinking-row.active .thinking-sub { display: block; }
.thinking-found {
  display: inline-block;
  font-size: 10px;
  background: rgba(94,202,187,0.12);
  color: #5ecabb;
  border-radius: 10px;
  padding: 1px 8px;
  margin: 3px 3px 0 0;
}


/* ===== JUMP HIGHLIGHT ===== */
.jump-highlight {
  animation: jumpFlash 2.5s ease-out forwards;
  position: relative;
  z-index: 2;
}
@keyframes jumpFlash {
  0%   { background: rgba(201,168,76,0.25); box-shadow: 0 0 0 3px rgba(201,168,76,0.4); border-radius: 6px; }
  40%  { background: rgba(201,168,76,0.15); box-shadow: 0 0 0 2px rgba(201,168,76,0.25); }
  100% { background: transparent; box-shadow: none; }
}
/* Dim everything else in the section when highlighting */
.section.jump-active .problem-item:not(.jump-highlight),
.section.jump-active .topic-card:not(.jump-highlight) {
  opacity: 0.3;
  transition: opacity 0.3s;
}
.section.jump-active .problem-item.jump-highlight,
.section.jump-active .topic-card.jump-highlight {
  opacity: 1;
}
/* Restore after */
.section .problem-item,
.section .topic-card {
  transition: opacity 0.5s;
}


/* ===== ZONE MAP ===== */
.zone-map{padding:20px 20px 16px;background:#0f0f18;border-bottom:1px solid rgba(255,255,255,0.06)}
.zone-map.hidden{display:none}
.zone-map-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:14px}
.zone-map-label{font-size:10px;letter-spacing:2px;color:rgba(255,255,255,0.2);text-transform:uppercase}
.zone-map-collapse{font-size:11px;color:rgba(255,255,255,0.20);cursor:pointer;transition:color .15s}
.zone-map-collapse:hover{color:rgba(255,255,255,0.4)}
.zone-map-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:6px}
@media(max-width:900px){.zone-map-grid{grid-template-columns:repeat(2,1fr)}}
@media(max-width:500px){.zone-map-grid{grid-template-columns:1fr}}
.zone-card{background:rgba(255,255,255,0.03);border:1px solid color-mix(in srgb, var(--zc) 35%, transparent);border-radius:8px;padding:12px 13px;transition:background .15s}
.zone-card:hover{background:rgba(255,255,255,0.06)}
.zone-card-top{display:flex;align-items:center;gap:8px;margin-bottom:9px}
.zone-card-icon{font-size:15px;flex-shrink:0;opacity:.6}
.zone-card-info{flex:1;min-width:0}
.zone-card-name{font-size:12px;font-weight:700;color:var(--zc)}
.zone-card-desc{font-size:10px;color:rgba(255,255,255,0.18);margin-top:2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.zone-chips{display:flex;flex-wrap:wrap;gap:4px}
.zone-chip{font-size:10px;color:rgba(255,255,255,0.3);background:rgba(255,255,255,0.03);border:1px solid rgba(255,255,255,0.06);border-radius:20px;padding:3px 9px;cursor:pointer;transition:all .15s;white-space:nowrap}
.zone-chip:hover{color:var(--zc);border-color:var(--zc)}
.zone-map-bar{display:none;padding:8px 20px;font-size:10px;color:rgba(255,255,255,0.20);cursor:pointer;text-align:center;background:#0f0f18;border-bottom:1px solid rgba(255,255,255,0.05);letter-spacing:1.5px;text-transform:uppercase;transition:color .15s}
.zone-map-bar.visible{display:block}
.zone-map-bar:hover{color:var(--gold)}
.controls{display:none!important}

/* Nav fixed top compensation */
body { padding-top: 44px; }

/* === Section count badge === */
.sec-count-badge {
  display: inline-block;
  font-size: 10px;
  color: rgba(0,0,0,0.25);
  background: rgba(0,0,0,0.05);
  border-radius: 10px;
  padding: 1px 8px;
  margin-top: 4px;
  letter-spacing: 0.3px;
}

/* === Zone density bar === */
.zone-density {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  margin-bottom: 2px;
}
.zone-density-fill {
  height: 2px;
  background: var(--zc);
  opacity: 0.5;
  border-radius: 2px;
  flex-shrink: 0;
  max-width: 80px;
}
.zone-density span {
  font-size: 9px;
  color: rgba(255,255,255,0.2);
  white-space: nowrap;
}

/* === Back to top === */
#backToTop {
  position: fixed;
  bottom: 28px;
  right: 24px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--gold);
  border: 1px solid rgba(201,168,76,0.3);
  font-size: 16px;
  cursor: pointer;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s, transform 0.2s;
  z-index: 500;
  box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}
#backToTop.visible {
  opacity: 1;
  transform: translateY(0);
}
#backToTop:hover { background: #1a1a2e; }

/* === Bookmarks === */
.bm-btn {
  position: absolute;
  right: 52px;
  font-size: 16px;
  color: rgba(0,0,0,0.2);
  cursor: pointer;
  transition: all 0.15s;
  line-height: 1;
  z-index: 2;
  user-select: none;
}
.bm-btn:hover { color: var(--gold); transform: scale(1.2); }
.bm-btn.bookmarked { color: var(--gold); content: '★'; }
.bm-btn.bookmarked::after { content: ''; }

/* === Print === */
@media print {
  .sticky-nav, .zone-map, .zone-map-bar, .zone-map-sections-header,
  #backToTop, .search-bar-wrap, .hero, .controls { display: none !important; }
  .section { display: block !important; }
  .section-body { display: block !important; }
  body { background: white; color: black; padding-top: 0; }
}

/* === Mobile === */
@media (max-width: 640px) {
  .zone-map-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .topic-grid { grid-template-columns: 1fr !important; }
  .section-header { padding: 14px 16px !important; }
  .bm-btn { right: 44px; }
}
@media (max-width: 380px) {
  .zone-map-grid { grid-template-columns: 1fr !important; }
}

/* === Cross-reference block === */


/* ── Synonym badge in search ── */
.syn-hint { font-size:10px; color:rgba(255,255,255,0.30); margin-left:6px; }

/* ── Learning path modal ── */
#pathModal {
  display:none; position:fixed; inset:0; z-index:9000;
  background:rgba(0,0,0,0.75);
  align-items:center; justify-content:center;
}
#pathModal.open { display:flex; }
#pathModalBox {
  background:#16161f; border-radius:12px; width:min(540px,92vw);
  max-height:85vh; overflow-y:auto; box-shadow:0 20px 60px rgba(0,0,0,0.3);
}
#pathModalBox h2 {
  font-size:17px; font-weight:700; color:#1a1a2e; margin:0;
  padding:22px 24px 0; letter-spacing:-0.3px;
}
#pathModalBox p.path-sub {
  font-size:12px; color:rgba(0,0,0,0.4); padding:6px 24px 18px; margin:0;
  border-bottom:1px solid rgba(0,0,0,0.07);
}
.path-options { display:grid; grid-template-columns:1fr 1fr; gap:10px; padding:18px 24px; }
.path-opt {
  border:1.5px solid rgba(0,0,0,0.1); border-radius:10px; padding:14px;
  cursor:pointer; transition:all 0.15s; text-align:left; background:white;
}
.path-opt:hover { border-color:#c9a84c; background:rgba(201,168,76,0.05); }
.path-opt.active { border-color:#c9a84c; background:rgba(201,168,76,0.08); }
.path-opt-icon { font-size:22px; margin-bottom:6px; }
.path-opt-label { font-size:13px; font-weight:600; color:#1a1a2e; }
.path-opt-desc { font-size:11px; color:rgba(0,0,0,0.4); margin-top:3px; line-height:1.4; }
#pathList { padding:0 24px 24px; }
#pathList h3 {
  font-size:12px; font-weight:600; color:rgba(0,0,0,0.4); text-transform:uppercase;
  letter-spacing:0.8px; margin:0 0 12px;
}
.path-step {
  display:flex; align-items:center; gap:10px; padding:10px 12px;
  border-radius:8px; cursor:pointer; transition:background 0.15s; margin-bottom:4px;
}
.path-step:hover { background:rgba(0,0,0,0.04); }
.path-step-num {
  width:22px; height:22px; border-radius:50%; background:#1a1a2e;
  color:#c9a84c; font-size:10px; font-weight:700; flex-shrink:0;
  display:flex; align-items:center; justify-content:center;
}
.path-step-icon { font-size:16px; }
.path-step-title { font-size:12.5px; color:#1a1a2e; font-weight:500; line-height:1.3; }
.path-step-reason { font-size:10.5px; color:rgba(0,0,0,0.35); }
.path-modal-close {
  position:sticky; bottom:0; width:100%; padding:12px 24px max(12px, env(safe-area-inset-bottom));
  background:#1a1a2e; border-top:1px solid rgba(255,255,255,0.06);
  display:flex; gap:10px;
}
.path-modal-close button {
  flex:1; padding:10px; border-radius:8px; border:none; cursor:pointer;
  font-size:13px; font-weight:600; transition:all 0.15s;
}
.path-start-btn { background:#1a1a2e; color:#c9a84c; }
.path-start-btn:hover { background:#2a2a3e; }
.path-cancel-btn { background:rgba(0,0,0,0.07); color:rgba(0,0,0,0.5); }

/* ── Path & progress FABs ── */
#fabGroup {
  position:fixed; bottom:80px; right:24px;
  display:flex; flex-direction:column; gap:8px; z-index:500;
}
.fab {
  width:40px; height:40px; border-radius:50%;
  background:var(--ink); color:var(--gold);
  border:1px solid rgba(201,168,76,0.3); font-size:15px;
  cursor:pointer; display:flex; align-items:center; justify-content:center;
  box-shadow:0 2px 12px rgba(0,0,0,0.3); transition:all 0.2s;
  position:relative;
}
.fab:hover { background:#1a1a2e; transform:scale(1.08); }
.fab-tooltip {
  position:absolute; right:48px; top:50%; transform:translateY(-50%);
  background:#1a1a2e; color:#f0ebe0; font-size:11px; white-space:nowrap;
  padding:4px 10px; border-radius:6px; opacity:0; pointer-events:none;
  transition:opacity 0.15s;
}
.fab:hover .fab-tooltip { opacity:1; }

/* ── Progress resume banner ── */
#resumeBanner {
  display:none; position:fixed; bottom:24px; left:50%; transform:translateX(-50%);
  background:#1a1a2e; color:#f0ebe0; font-size:12px; border-radius:20px;
  padding:8px 18px 8px 14px; gap:10px; align-items:center; z-index:600;
  box-shadow:0 4px 20px rgba(0,0,0,0.4); border:1px solid rgba(201,168,76,0.2);
}
#resumeBanner.show { display:flex; }
#resumeBanner span { color:rgba(255,255,255,0.55); font-size:11px; }
#resumeBanner button {
  background:#c9a84c; color:#1a1a2e; border:none; border-radius:12px;
  padding:3px 10px; font-size:11px; font-weight:700; cursor:pointer;
}
#resumeClose {
  background:none; border:none; color:rgba(255,255,255,0.3);
  font-size:14px; cursor:pointer; padding:0; margin-left:4px;
}


/* ── AI mode tabs ── */
.ai-mode-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  justify-content: center;
  align-items: center;
  position: relative;
  flex-wrap: wrap;
}
.ai-mode-tab {
  padding: 6px 18px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
  color: rgba(255,255,255,0.38);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
  letter-spacing: 0.5px;
}
.ai-mode-tab:hover {
  color: var(--gold);
  border-color: rgba(201,168,76,0.4);
  background: rgba(201,168,76,0.07);
}
.ai-mode-tab.active {
  background: rgba(201,168,76,0.12);
  border-color: rgba(201,168,76,0.5);
  color: var(--gold);
  box-shadow: 0 0 12px rgba(201,168,76,0.12);
}
.web-toggle { color:rgba(255,255,255,0.30) !important; }
.web-toggle.on { color: #4caf7d !important; background: rgba(76,175,125,0.1) !important; border-color: rgba(76,175,125,0.3) !important; }
.ai-mode-tab:hover:not(.active) {
  background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.55);
}
/* script answer styles */
.script-answer { padding: 4px 0; }
.script-answer h3 { color: #c9a84c; font-size: 13px; font-weight: 700; margin: 16px 0 6px; }
.script-answer h3:first-child { margin-top: 0; }
.script-answer p { color: rgba(255,255,255,0.75); font-size: 13px; line-height: 1.8; margin: 4px 0; }
.script-answer strong { color: #fff; }
.script-answer .script-block { background: rgba(201,168,76,0.05); border-left: 2px solid rgba(201,168,76,0.4); padding: 10px 14px; border-radius: 0 8px 8px 0; margin: 8px 0; font-size: 13px; color: rgba(255,255,255,0.8); line-height: 1.8; white-space: pre-wrap; }
.script-answer .script-meta { font-size: 11px; color:rgba(255,255,255,0.30); margin-top: 12px; text-align: right; }
.api-key-row { margin-top: 10px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ── clarify custom input ── */
.clarify-custom-input {
  width: 100%;
  padding: 8px 12px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(201,168,76,0.3);
  border-radius: 8px;
  color: #fff;
  font-size: 13px;
  font-family: 'Noto Sans SC', sans-serif;
  outline: none;
  box-sizing: border-box;
}
.clarify-custom-input:focus {
  border-color: rgba(201,168,76,0.7);
  background: rgba(255,255,255,0.09);
}
.clarify-custom-input::placeholder {
  color:rgba(255,255,255,0.30);
}

/* ════════════════════════════════════════
   SCRIPT HISTORY PANEL
   ════════════════════════════════════════ */
.history-panel {
  background: linear-gradient(135deg, #13131f 0%, #1a1a2e 100%);
  border-top: 1px solid rgba(255,255,255,0.06);
  padding: 20px 0 28px;
}
.history-inner {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 20px;
}
.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.history-title {
  font-size: 13px;
  font-weight: 700;
  color:rgba(255,255,255,0.55);
  letter-spacing: 0.5px;
}
.history-title span { color: var(--gold); }
.history-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.history-folder-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.folder-tab {
  padding: 4px 12px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.1);
  background: transparent;
  color: rgba(255,255,255,0.4);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.folder-tab.active {
  background: rgba(201,168,76,0.15);
  border-color: rgba(201,168,76,0.4);
  color: #c9a84c;
}
.folder-tab:hover:not(.active) {
  background: rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.80);
}
.folder-tab.add-folder {
  border-style: dashed;
  color:rgba(255,255,255,0.30);
}
.folder-tab.add-folder:hover {
  color: rgba(201,168,76,0.7);
  border-color: rgba(201,168,76,0.3);
  background: transparent;
}
.history-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.history-item {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 10px;
  padding: 12px 16px;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}
.history-item:hover {
  background: rgba(255,255,255,0.06);
  border-color: rgba(201,168,76,0.2);
}
.history-item-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.history-item-query {
  font-size: 13px;
  font-weight: 700;
  color: rgba(255,255,255,0.85);
  line-height: 1.4;
  flex: 1;
}
.history-item-meta {
  font-size: 11px;
  color:rgba(255,255,255,0.30);
  margin-top: 4px;
  display: flex;
  gap: 10px;
  align-items: center;
}
.history-item-folder-badge {
  background: rgba(201,168,76,0.1);
  color: rgba(201,168,76,0.7);
  border-radius: 10px;
  padding: 1px 8px;
  font-size: 10px;
}
.history-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s;
}
.history-item:hover .history-actions { opacity: 1; }
.hist-btn {
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.05);
  color:rgba(255,255,255,0.55);
  font-size: 10px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.12s;
  white-space: nowrap;
}
.hist-btn:hover { background: rgba(255,255,255,0.12); color: #fff; }
.hist-btn.del:hover { background: rgba(224,123,99,0.2); border-color: rgba(224,123,99,0.4); color: #e07b63; }
.history-empty {
  text-align: center;
  padding: 24px 0;
  color: rgba(255,255,255,0.2);
  font-size: 13px;
}
/* Follow-up chips after answer */
.script-followups {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(255,255,255,0.07);
}
.script-followups-label {
  font-size: 11px;
  color:rgba(255,255,255,0.30);
  margin-bottom: 8px;
}
.script-followup-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.sfp-chip {
  padding: 6px 12px;
  border-radius: 16px;
  border: 1px solid rgba(201,168,76,0.2);
  background: rgba(201,168,76,0.05);
  color: rgba(201,168,76,0.8);
  font-size: 11px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
  text-align: left;
}
.sfp-chip:hover {
  background: rgba(201,168,76,0.15);
  border-color: rgba(201,168,76,0.5);
  color: #c9a84c;
}
/* Move-to-folder modal */
.folder-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 9998;
  align-items: center;
  justify-content: center;
}
.folder-modal-overlay.open { display: flex; }
.folder-modal {
  background: #1a1a2e;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  padding: 22px 24px;
  width: 320px;
  max-width: 90vw;
}
.folder-modal h3 {
  color: #fff;
  font-size: 14px;
  margin: 0 0 16px;
}
.folder-modal-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}
.folder-modal-item {
  padding: 9px 14px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.75);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.12s;
  font-family: inherit;
  text-align: left;
}
.folder-modal-item:hover {
  background: rgba(201,168,76,0.15);
  border-color: rgba(201,168,76,0.4);
  color: #c9a84c;
}
.folder-modal-cancel {
  color:rgba(255,255,255,0.30);
  font-size: 12px;
  cursor: pointer;
  text-align: center;
  display: block;
}
.folder-modal-cancel:hover { color: rgba(255,255,255,0.80); }

/* ── backup buttons ── */
.hist-backup-bar {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.hist-backup-btn {
  padding: 5px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
  color:rgba(255,255,255,0.55);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.hist-backup-btn:hover {
  background: rgba(255,255,255,0.09);
  color: rgba(255,255,255,0.85);
}
.hist-backup-btn.import-btn:hover {
  background: rgba(76,175,125,0.15);
  border-color: rgba(76,175,125,0.4);
  color: #4caf7d;
}

/* ── cost tooltip ── */
.web-toggle-wrap {
  position: relative;
  display: inline-flex;
}
.cost-tooltip {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #1e1e2e;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  padding: 14px 16px;
  width: 300px;
  z-index: 200;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  font-size: 12px;
  color: rgba(255,255,255,0.65);
  line-height: 1.5;
  pointer-events: none;
}
.web-toggle-wrap:hover .cost-tooltip { display: block; }
.cost-info-title {
  font-size: 13px;
  font-weight: 700;
  color: rgba(255,255,255,0.9);
  margin-bottom: 10px;
}
.cost-info-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 7px;
}
.cost-tag {
  flex-shrink: 0;
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 700;
  margin-top: 1px;
}
.cost-tag.off { background: rgba(255,255,255,0.08); color:rgba(255,255,255,0.55); }
.cost-tag.on  { background: rgba(76,175,125,0.15); color: #4caf7d; }
.cost-info-divider {
  height: 1px;
  background: rgba(255,255,255,0.07);
  margin: 10px 0;
}
.cost-info-tip {
  color: rgba(255,255,255,0.45);
  font-size: 11px;
  line-height: 1.6;
}
.cost-info-tip b { color: rgba(255,255,255,0.75); }

/* ── Mobile responsive ── */
@media (max-width: 600px) {
  .sb-chips { gap:4px; }
  .sb-chip { font-size:9px;padding:2px 8px; }
  .ai-mode-bar { flex-wrap: wrap; gap: 5px; }
  .ai-mode-tab { font-size: 11px; padding: 5px 10px; }
  #aiResultsPanel { margin: 0 8px; border-radius: 12px; }
  .ai-answer-body h3 { font-size: 13px; }
  .script-block { font-size: 13px; }
  .sfp-chip { font-size: 11px; padding: 5px 10px; }
  .script-followups { padding: 12px; }
  #historyPanel { margin: 0 8px; border-radius: 12px; }
  .history-header { flex-direction: column; align-items: flex-start; gap: 8px; }
  .history-toolbar { width: 100%; justify-content: space-between; }
  #histSearchInput { width: 100% !important; }
  .section-block { margin: 0 8px 12px; border-radius: 12px; }
  .topic-grid { grid-template-columns: 1fr; }
  .hero-section { padding: 60px 16px 30px; }
  .hero-title { font-size: 22px; }
  #scriptContinueRow { padding: 10px 12px; }
}

/* ── Citation refs ── */
.cite-ref {
  display:inline-flex;align-items:center;justify-content:center;
  width:16px;height:16px;border-radius:50%;
  background:rgba(201,168,76,0.18);border:1px solid rgba(201,168,76,0.4);
  color:#c9a84c;font-size:10px;font-weight:700;
  cursor:pointer;vertical-align:super;margin-left:2px;
  transition:background 0.2s;user-select:none;
}
.cite-ref:hover { background:rgba(201,168,76,0.35); }
/* ── Sources footer ── */
#sourcesSection {
  background:linear-gradient(135deg,#0d0d14,#13131c);
  border-top:1px solid rgba(201,168,76,0.15);
  padding:32px 28px 28px;
  font-family:inherit;
}
#sourcesSection .src-title {
  font-size:13px;font-weight:700;color:#c9a84c;
  letter-spacing:.08em;margin-bottom:16px;
  display:flex;align-items:center;gap:8px;
}
#sourcesSection .src-item {
  display:flex;gap:12px;padding:12px 14px;
  background:rgba(255,255,255,0.03);border:1px solid rgba(255,255,255,0.07);
  border-radius:10px;margin-bottom:10px;align-items:flex-start;
}
#sourcesSection .src-num {
  width:22px;height:22px;border-radius:50%;
  background:rgba(201,168,76,0.15);border:1px solid rgba(201,168,76,0.3);
  color:#c9a84c;font-size:11px;font-weight:700;
  display:flex;align-items:center;justify-content:center;flex-shrink:0;margin-top:1px;
}
#sourcesSection .src-body { flex:1; }
#sourcesSection .src-name { font-size:13px;color:#ddd;font-weight:600;margin-bottom:3px; }
#sourcesSection .src-meta { font-size:11px;color:rgba(255,255,255,0.30);margin-bottom:6px; }
#sourcesSection .src-link {
  display:inline-block;padding:3px 10px;
  background:rgba(201,168,76,0.1);border:1px solid rgba(201,168,76,0.3);
  border-radius:5px;color:#c9a84c;font-size:11px;text-decoration:none;
  transition:background 0.2s;
}
#sourcesSection .src-link:hover { background:rgba(201,168,76,0.2); }

/* ── Card Wall ── */
/* ═══════ CARD WALL ═══════ */
.cardwall-section {
  background: #08080f;
  padding: 40px 20px 60px;
}
.cardwall-header {
  max-width: 1400px;
  margin: 0 auto 8px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 4px;
}
.cardwall-tag {
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: rgba(180,150,80,0.9);
  border: 1px solid rgba(180,150,80,0.15);
  padding: 3px 14px;
  flex-shrink: 0;
}
.cardwall-line {
  flex: 1;
  height: 1px;
  background: rgba(180,150,80,0.08);
}
.cardwall-count {
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  letter-spacing: 1.5px;
  color: rgba(255,255,255,0.65);
}
.cardwall-filters {
  max-width: 1400px;
  margin: 0 auto 20px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 0 4px;
}
.cardwall-filter {
  font-size: 12px;
  color:rgba(255,255,255,0.30);
  background: transparent;
  border: 1px solid rgba(255,255,255,0.06);
  padding: 5px 14px;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.cardwall-filter:hover {
  color: rgba(255,255,255,0.65);
  border-color: rgba(255,255,255,0.12);
}
.cardwall-filter.active {
  color: rgba(255,255,255,0.85);
  border-color: rgba(180,150,80,0.3);
  background: rgba(180,150,80,0.06);
}
.filter-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.cardwall-grid {
  max-width: 1400px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

/* ═══ THE CARD — institutional index style ═══ */
.cw-card {
  background: #0e0f18;
  border: 1px solid rgba(255,255,255,0.04);
  padding: 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: background 0.15s, border-color 0.15s;
  position: relative;
}
.cw-card:hover {
  background: #131420;
  border-color: rgba(255,255,255,0.08);
}

/* Top color band */
.cw-card-band {
  height: 3px;
  width: 100%;
  flex-shrink: 0;
}
.cw-card[data-cat="行业认知"] .cw-card-band { background: #c9a84c; }
.cw-card[data-cat="供应链"]   .cw-card-band { background: #22c55e; }
.cw-card[data-cat="品牌建设"] .cw-card-band { background: #3b82f6; }
.cw-card[data-cat="销售渠道"] .cw-card-band { background: #f97316; }
.cw-card[data-cat="商品运营"] .cw-card-band { background: #a855f7; }
.cw-card[data-cat="数字增长"] .cw-card-band { background: #eab308; }
.cw-card[data-cat="经营管理"] .cw-card-band { background: #14b8a6; }
.cw-card[data-cat="创业成长"] .cw-card-band { background: #ef4444; }

.cw-card-body {
  padding: 14px 16px 14px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Row 1: ID + Category */
.cw-card-row1 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.cw-card-id {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 1.5px;
  color: rgba(180,150,80,0.5);
}
.cw-card-cat {
  font-family: 'DM Mono', monospace;
  font-size:10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color:rgba(255,255,255,0.30);
}

/* Row 2: Name */
.cw-card-name {
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: rgba(255,255,255,0.88);
  line-height: 1.35;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Row 3: Bottom stats */
.cw-card-bottom {
  margin-top: auto;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}
.cw-card-stat {
  display: flex;
  align-items: baseline;
  gap: 4px;
}
.cw-card-num {
  font-family: 'Cinzel', serif;
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
}
/* Number color inherits from category */
.cw-card[data-cat="行业认知"] .cw-card-num { color: #c9a84c; }
.cw-card[data-cat="供应链"]   .cw-card-num { color: #22c55e; }
.cw-card[data-cat="品牌建设"] .cw-card-num { color: #3b82f6; }
.cw-card[data-cat="销售渠道"] .cw-card-num { color: #f97316; }
.cw-card[data-cat="商品运营"] .cw-card-num { color: #a855f7; }
.cw-card[data-cat="数字增长"] .cw-card-num { color: #eab308; }
.cw-card[data-cat="经营管理"] .cw-card-num { color: #14b8a6; }
.cw-card[data-cat="创业成长"] .cw-card-num { color: #ef4444; }

.cw-card-unit {
  font-size: 11px;
  color:rgba(255,255,255,0.30);
}
.cw-card-arrow {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color:rgba(255,255,255,0.20);
  transition: color 0.15s;
}
.cw-card:hover .cw-card-arrow { color: rgba(255,255,255,0.4); }

/* ═══════ PANEL OVERLAY — Research Document View ═══════ */
.panel-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100vh;
  background: #09090f;
  z-index: 1000;
  overflow: hidden;
  display: none;
}
.panel-overlay.active { display: flex; }

.panel-inner {
  width: 100%; height: 100%;
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

/* ── Panel Header ── */
.panel-header {
  flex-shrink: 0;
  padding: 0 36px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.panel-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.panel-topbar-left {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: rgba(180,150,80,0.4);
}
.panel-topbar-right {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  letter-spacing: 2px;
  color: rgba(255,255,255,0.2);
}
.panel-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0 14px;
}
.panel-title-group {
  display: flex;
  align-items: baseline;
  gap: 14px;
}
.panel-title-id {
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  letter-spacing: 2px;
  color: rgba(180,150,80,0.6);
  flex-shrink: 0;
}
.panel-title-name {
  font-family: 'Noto Serif SC', serif;
  font-size: 22px;
  font-weight: 700;
  color: rgba(255,255,255,0.92);
}
.panel-title-cat {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color:rgba(255,255,255,0.30);
  border: 1px solid rgba(255,255,255,0.08);
  padding: 2px 10px;
  flex-shrink: 0;
}
.panel-close {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color:rgba(255,255,255,0.30);
  cursor: pointer;
  padding: 6px 16px;
  border: 1px solid rgba(255,255,255,0.08);
  background: transparent;
  letter-spacing: 1px;
  transition: all 0.15s;
}
.panel-close:hover {
  color: rgba(255,255,255,0.80);
  border-color:rgba(255,255,255,0.20);
}
.panel-stats {
  display: flex;
  gap: 24px;
  padding: 10px 0 0;
}
.panel-stat-item {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: rgba(255,255,255,0.2);
  letter-spacing: 1px;
}
.panel-stat-item strong {
  color: #c9a84c;
  font-weight: 600;
}
/* Desktop: hide mobile-only elements */
.panel-current-topic { display:none; }
.close-mobile { display:none; }
.close-desktop { display:inline; }
/* Table scroll wrapper (active on all sizes, harmless on desktop) */
.table-scroll-wrap { position:relative;margin:14px 0;overflow-x:auto;-webkit-overflow-scrolling:touch; }
.table-scroll-wrap table { margin:0; }

/* ── Panel Body ── */
.panel-body {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* Sidebar */
.panel-sidebar {
  width: 240px;
  flex-shrink: 0;
  border-right: 1px solid rgba(255,255,255,0.05);
  padding: 20px 0 20px 36px;
  overflow-y: auto;
}
.panel-sidebar::-webkit-scrollbar { width: 2px; }
.panel-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.06); }
.sidebar-section-label {
  font-family: 'DM Mono', monospace;
  font-size:10px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: rgba(180,150,80,0.35);
  margin-bottom: 14px;
  padding-right: 16px;
}
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px 8px 0;
  cursor: pointer;
  transition: all 0.12s;
  border-left: 2px solid transparent;
  margin-left: -1px;
}
.sidebar-item:hover {
  border-left-color: rgba(180,150,80,0.2);
}
.sidebar-item.active {
  border-left-color: #c9a84c;
}
.sidebar-item-num {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  color:rgba(255,255,255,0.20);
  min-width: 18px;
  flex-shrink: 0;
}
.sidebar-item.active .sidebar-item-num {
  color: rgba(180,150,80,0.6);
}
.sidebar-item-text {
  font-size: 12px;
  color: rgba(255,255,255,0.4);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.4;
}
.sidebar-item.active .sidebar-item-text {
  color: rgba(255,255,255,0.88);
}

/* ── Content Area ── */
.panel-content {
  flex: 1;
  padding: 24px 36px 60px 36px;
  overflow-y: auto;
}
.panel-content::-webkit-scrollbar { width: 3px; }
.panel-content::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.06); border-radius: 3px; }
.topic-body { max-width: 740px; }
.topic-title {
  font-family: 'Noto Serif SC', serif;
  font-size: 20px;
  font-weight: 700;
  color: rgba(255,255,255,0.92);
  margin-bottom: 4px;
  line-height: 1.4;
}
.topic-subtitle {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: rgba(255,255,255,0.2);
  letter-spacing: 1.5px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.topic-block { display: none; }
.topic-block.active { display: block; }

/* ── Content Boxes — institutional style ── */
.content-box {
  margin-bottom: 18px;
  padding: 16px 18px;
  border-left: 3px solid;
  background: rgba(255,255,255,0.015);
  font-size: 13px;
  line-height: 1.85;
  color: rgba(255,255,255,0.80);
}
.content-box-head {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.content-box-tag {
  font-family: 'DM Mono', monospace;
  font-size:10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 1px 7px;
  border-radius: 2px;
}
.box-insight { border-left-color: #c9a84c; }
.box-insight .content-box-head { color: #c9a84c; }
.box-insight .content-box-tag { background: rgba(201,168,76,0.12); color: #c9a84c; }
.box-case { border-left-color: #22c55e; }
.box-case .content-box-head { color: #22c55e; }
.box-case .content-box-tag { background: rgba(34,197,94,0.12); color: #22c55e; }
.box-expert { border-left-color: #3b82f6; }
.box-expert .content-box-head { color: #3b82f6; }
.box-expert .content-box-tag { background: rgba(59,130,246,0.12); color: #3b82f6; }
.box-warning { border-left-color: #ef4444; }
.box-warning .content-box-head { color: #ef4444; }
.box-warning .content-box-tag { background: rgba(239,68,68,0.1); color: #ef4444; }
.box-data {
  border-left-color: #a855f7;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.06);
  border-left: 3px solid #a855f7;
}
.box-data .content-box-head { color: #a855f7; }
.box-data .content-box-tag { background: rgba(168,85,247,0.12); color: #a855f7; }

/* Legacy box compat */
.topic-block .info-box,
.topic-block .beginner-box { margin-bottom: 16px; padding: 14px 16px; border-left: 3px solid #c9a84c; background: rgba(255,255,255,0.015); font-size: 13px; line-height: 1.85; color: rgba(255,255,255,0.80); }
.topic-block .case-box     { margin-bottom: 16px; padding: 14px 16px; border-left: 3px solid #22c55e; background: rgba(255,255,255,0.015); font-size: 13px; line-height: 1.85; color: rgba(255,255,255,0.80); }
.topic-block .expert-box   { margin-bottom: 16px; padding: 14px 16px; border-left: 3px solid #3b82f6; background: rgba(255,255,255,0.015); font-size: 13px; line-height: 1.85; color: rgba(255,255,255,0.80); }
.topic-block .warn-box     { margin-bottom: 16px; padding: 14px 16px; border-left: 3px solid #ef4444; background: rgba(255,255,255,0.015); font-size: 13px; line-height: 1.85; color: rgba(255,255,255,0.80); }
.topic-block .data-box     { margin-bottom: 16px; padding: 14px 16px; border-left: 3px solid #a855f7; background: rgba(255,255,255,0.02); border: 1px solid rgba(255,255,255,0.06); font-size: 13px; line-height: 1.85; color: rgba(255,255,255,0.80); }
.topic-block p { color: rgba(255,255,255,0.80); font-size: 13px; line-height: 1.9; margin-bottom: 14px; }
.topic-block strong { color: rgba(255,255,255,0.88); }
.topic-block ul, .topic-block ol { color: rgba(255,255,255,0.80); font-size: 13px; line-height: 1.85; padding-left: 20px; margin-bottom: 12px; }

/* Quote */
.content-quote {
  border-left: 2px solid rgba(180,150,80,0.3);
  padding: 10px 18px;
  margin: 14px 0;
  color:rgba(255,255,255,0.55);
  font-size: 13px;
  font-style: italic;
  line-height: 1.8;
}
.content-quote-src {
  font-style: normal;
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  color: rgba(180,150,80,0.35);
  margin-top: 6px;
  letter-spacing: 0.5px;
}

/* Table */
.content-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 18px;
  font-size: 12px;
}
.content-table th {
  background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.45);
  padding: 9px 12px;
  border: 1px solid rgba(255,255,255,0.06);
  text-align: left;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.5px;
  font-weight: 500;
}
.content-table td {
  padding: 9px 12px;
  color: rgba(255,255,255,0.65);
  border: 1px solid rgba(255,255,255,0.05);
}
.content-table tr:nth-child(even) td {
  background: rgba(255,255,255,0.015);
}
.topic-block table { width: 100%; font-size: 12px; border-collapse: collapse; margin-bottom: 18px; }
.topic-block th { background: rgba(255,255,255,0.04); color: rgba(255,255,255,0.45); padding: 9px 12px; text-align: left; border: 1px solid rgba(255,255,255,0.06); font-family: 'DM Mono', monospace; font-size: 10px; }
.topic-block td { padding: 9px 12px; color: rgba(255,255,255,0.65); border: 1px solid rgba(255,255,255,0.05); }

/* Tags */
.content-tag {
  display: inline-block;
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 2px;
  background: rgba(255,255,255,0.06);
  color:rgba(255,255,255,0.55);
  margin: 0 3px 3px 0;
}
.content-tag.gold { background: rgba(201,168,76,0.12); color: #c9a84c; }
.content-tag.blue { background: rgba(59,130,246,0.12); color: #7ab3f5; }
.content-tag.green { background: rgba(34,197,94,0.12); color: #6de0a0; }
.content-tag.red { background: rgba(239,68,68,0.12); color: #f08080; }

/* Cite ref */
.cite-ref {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: rgba(201,168,76,0.15);
  color: #c9a84c;
  font-size: 9px;
  font-weight: 700;
  cursor: pointer;
  vertical-align: super;
  margin-left: 2px;
  font-family: 'DM Mono', monospace;
}
.hl { color: #c9a84c; font-weight: 500; }
.num { color: #ef4444; font-weight: 700; font-family: 'DM Mono', monospace; }

/* ═══════ FOOTER ═══════ */
/* ═══════ FOOTER — COMPACT INSTITUTIONAL ═══════ */
.site-footer{background:#04040a;border-top:1px solid rgba(180,150,80,0.08);padding:28px 32px 24px;}
.footer-inner{max-width:1200px;margin:0 auto;}
.footer-row1{display:flex;align-items:center;justify-content:space-between;margin-bottom:14px;}
.footer-brand-group{display:flex;align-items:baseline;gap:12px;}
.footer-logo-mark{display:none;}
.footer-brand-col{display:contents;}
.footer-brand{font-family:'Cinzel',serif;font-weight:600;font-size:18px;letter-spacing:6px;text-transform:uppercase;color:rgba(180,150,80,0.65);}
.footer-sub{font-family:'Noto Serif SC',serif;font-size:12px;color:rgba(255,255,255,0.3);letter-spacing:2px;}
.footer-meta-inline{display:flex;gap:0;border:1px solid rgba(255,255,255,0.05);}
.fmi{padding:8px 16px;border-right:1px solid rgba(255,255,255,0.05);display:flex;align-items:baseline;gap:8px;}
.fmi:last-child{border-right:none;}
.fmi-label{font-family:'DM Mono',monospace;font-size:9px;letter-spacing:1.5px;text-transform:uppercase;color:rgba(255,255,255,0.30);}
.fmi-value{font-family:'DM Mono',monospace;font-size:12px;color:#c9a84c;letter-spacing:0.5px;}
.footer-row2{padding:14px 0;margin-bottom:14px;}
.footer-features-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:0;border:1px solid rgba(255,255,255,0.05);}
.footer-feature{font-family:'DM Mono',monospace;font-size:11px;letter-spacing:0.5px;color:rgba(255,255,255,0.3);padding:6px 0;text-align:center;border-right:1px solid rgba(255,255,255,0.05);text-decoration:none;transition:color 0.2s;}
a.footer-feature:hover{color:#c9a84c;}
.footer-feature:nth-child(3n){border-right:none;}
.footer-feature:nth-child(n+4){border-top:1px solid rgba(255,255,255,0.05);}
.footer-row4{display:flex;align-items:center;justify-content:space-between;padding-top:14px;border-top:1px solid rgba(255,255,255,0.05);}
.fc-left{display:flex;align-items:center;gap:10px;}
.fc-badge{font-family:'DM Mono',monospace;font-size:9px;letter-spacing:2px;text-transform:uppercase;color:#c9a84c;border:1px solid rgba(180,150,80,0.25);padding:2px 10px;}
.fc-text{font-size:11px;color:rgba(255,255,255,0.2);letter-spacing:0.3px;}
.footer-right-info{text-align:right;}
.fc-version{font-family:'DM Mono',monospace;font-size:10px;color:rgba(255,255,255,0.18);letter-spacing:1px;}
.footer-copyright{font-family:'DM Mono',monospace;font-size:10px;color:rgba(255,255,255,0.20);letter-spacing:1px;margin-top:2px;}

/* ── Responsive ── */
@media (max-width: 1100px) {
  .cardwall-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
  .cardwall-grid { grid-template-columns: repeat(2, 1fr); }
  .cw-card-name { font-size: 14px; }
  .cw-card-num { font-size: 20px; }
  .search-bar-wrap { padding:16px 0 0; }
  .sb-row1 { height:40px; }
  .sb-icon { padding:0 10px;font-size:12px; }
  .sb-input { font-size:16px;min-width:0;padding:0 6px; }
  .sb-go { padding:0 14px;font-size:9px;border-radius:0 3px 0 0; }
  .sb-row2 { height:26px;padding:0 4px; }
  .sb-tab { padding:2px 6px;font-size:8px; }
  .sb-web-toggle { padding:2px 6px;font-size:8px; }
  .sb-info { display:none; }
  .sb-controls { padding:0;gap:4px; }
  .panel-header { padding: 0 16px; }
  .panel-body { flex-direction: column; }
  .panel-sidebar {
    width: 100%;
    height: auto;
    max-height: 35vh;
    border-right: none;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    padding: 14px 16px;
  }
  .sidebar-item { padding: 6px 12px 6px 0; }
  .panel-content { padding: 16px 16px 40px; }
  .panel-title-name { font-size: 18px; }
  .panel-title-cat { display: none; }
  .topic-body { max-width: 100%; }
}
@media (max-width: 480px) {
  .cardwall-grid { grid-template-columns: 1fr 1fr; gap: 4px; }
  .cw-card-body { padding: 10px 12px; }
  .cw-card-name { font-size: 13px; }
}

/* ── Dark theme overrides for panel content ── */
#panel-content,
#panel-content * {
  color: rgba(255,255,255,0.75);
}
#panel-content .topic-title {
  color: rgba(255,255,255,0.92) !important;
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 6px;
  line-height: 1.4;
}
#panel-content .topic-subtitle {
  color:rgba(255,255,255,0.30) !important;
  font-size: 12px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
#panel-content .layman-box {
  background: rgba(201,168,76,0.07) !important;
  border: 1px solid rgba(201,168,76,0.2) !important;
  border-left: 3px solid #c9a84c !important;
  border-radius: 6px;
  padding: 14px 16px;
  margin-bottom: 16px;
}
#panel-content .lb-head {
  color: #c9a84c !important;
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 8px;
}
#panel-content .pro-box {
  background: rgba(59,130,246,0.06) !important;
  border: 1px solid rgba(59,130,246,0.2) !important;
  border-left: 3px solid #3b82f6 !important;
  border-radius: 6px;
  padding: 14px 16px;
  margin-bottom: 16px;
}
#panel-content .pb-head {
  color: #3b82f6 !important;
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 8px;
}
#panel-content .case-box {
  background: rgba(34,197,94,0.06) !important;
  border: 1px solid rgba(34,197,94,0.2) !important;
  border-left: 3px solid #22c55e !important;
  border-radius: 6px;
  padding: 14px 16px;
  margin-bottom: 16px;
}
#panel-content .cb-head {
  color: #22c55e !important;
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 8px;
}
#panel-content .data-box {
  background: rgba(239,68,68,0.05) !important;
  border: 1px solid rgba(239,68,68,0.2) !important;
  border-left: 3px solid #ef4444 !important;
  border-radius: 6px;
  padding: 14px 16px;
  margin-bottom: 16px;
}
#panel-content .db-head {
  color: #ef4444 !important;
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 8px;
}
#panel-content .quote-box {
  border-left: 3px solid #c9a84c !important;
  padding: 8px 14px;
  margin: 8px 0;
  background: rgba(255,255,255,0.02) !important;
  color: rgba(255,255,255,0.65) !important;
  font-style: italic;
}
#panel-content .tag {
  background: rgba(255,255,255,0.08) !important;
  color: rgba(255,255,255,0.65) !important;
  border: none !important;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
}
#panel-content .tag.tag-blue  { background: rgba(59,130,246,0.15) !important; color: #7ab3f5 !important; }
#panel-content .tag.tag-green { background: rgba(34,197,94,0.15) !important;  color: #6de0a0 !important; }
#panel-content .tag.tag-red   { background: rgba(239,68,68,0.15) !important;  color: #f08080 !important; }
#panel-content .tag.tag-gold  { background: rgba(201,168,76,0.15) !important; color: #c9a84c !important; }
#panel-content .highlight { color: #c9a84c !important; font-weight: 500; }
#panel-content .num { color: #ef4444 !important; font-weight: 700; }
#panel-content .cite-ref {
  background: rgba(201,168,76,0.2) !important;
  color: #c9a84c !important;
  border: none !important;
}
#panel-content .compare-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 16px;
  font-size: 12px;
}
#panel-content .compare-table th {
  background: rgba(255,255,255,0.06) !important;
  color:rgba(255,255,255,0.55) !important;
  padding: 8px 10px;
  border: 1px solid rgba(255,255,255,0.08) !important;
  text-align: left;
}
#panel-content .compare-table td {
  background: transparent !important;
  color: rgba(255,255,255,0.65) !important;
  padding: 8px 10px;
  border: 1px solid rgba(255,255,255,0.06) !important;
}
#panel-content .compare-table tr:nth-child(even) td {
  background: rgba(255,255,255,0.02) !important;
}
#panel-content .dot-list { padding-left: 0; list-style: none; }
#panel-content .dot-list li { 
  padding: 4px 0 4px 16px; 
  position: relative;
  color: rgba(255,255,255,0.80) !important;
}
#panel-content .dot-list li::before {
  content: '·';
  position: absolute; left: 4px;
  color: #c9a84c;
}
#panel-content p { color: rgba(255,255,255,0.80) !important; font-size: 13px; line-height: 1.8; margin-bottom: 10px; }
#panel-content ul, #panel-content ol { color: rgba(255,255,255,0.80) !important; font-size: 13px; line-height: 1.8; }
#panel-content strong { color: rgba(255,255,255,0.88) !important; }
#panel-content .brand {
  background: rgba(201,168,76,0.12) !important;
  color: #c9a84c !important;
  padding: 1px 5px;
  border-radius: 3px;
  font-weight: 600;
}

/* ── Strip tags inside sidebar and topic titles ── */
#panel-sidebar-list .tag,
.sidebar-item .tag {
  background: none !important;
  border: none !important;
  padding: 0 2px !important;
  font-size: 11px !important;
  font-weight: 500 !important;
  border-radius: 0 !important;
}
#panel-content .topic-title .tag {
  background: none !important;
  border: none !important;
  padding: 0 3px !important;
  font-size: 14px !important;
  font-weight: 600 !important;
}
.sticky-nav {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 48px;
  background: #0d0d14;
  border-bottom: 1px solid rgba(201,168,76,0.2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 9999;
  box-sizing: border-box;
  overflow: visible;
}
.nav-left .nav-logo {
  font-family: 'Noto Serif SC', serif;
  font-size: 13px;
  font-weight: 700;
  color: #c9a84c;
  letter-spacing: 0.5px;
}
.nav-center {
  display: flex;
  align-items: center;
  gap: 4px;
}
.nav-link {
  font-size: 12px;
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 4px;
}
.nav-link:hover { color: rgba(255,255,255,0.92); background: rgba(255,255,255,0.05); }
.nav-right { display: flex; align-items: center; gap: 4px; }
.nav-tools-wrap { position: relative; }
.nav-tools-btn {
  font-size: 12px;
  color: rgba(255,255,255,0.65);
  background: none;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 4px;
  padding: 5px 12px;
  cursor: pointer;
  font-family: 'Noto Sans SC', sans-serif;
}
.nav-tools-btn:hover { color: rgba(255,255,255,0.9); border-color: rgba(255,255,255,0.2); }
.nav-tools-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: #1a1c28;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  min-width: 240px;
  overflow: hidden;
  z-index: 10000;
}
.nav-tools-menu.open { display: block; }
.nav-tools-item {
  display: block;
  padding: 10px 16px;
  font-size: 12px;
  color: rgba(255,255,255,0.80);
  text-decoration: none;
}
.nav-tools-item:hover { background: rgba(255,255,255,0.05); color: #c9a84c; }

/* ═══ DARK OVERRIDES: problem-box / problem-item in panel ═══ */
#panel-content .topic-card,
#panel-content [style*="background: linear-gradient"] {
  background: rgba(255,255,255,0.02) !important;
  border: 1px solid rgba(255,255,255,0.06) !important;
  border-radius: 8px;
}
#panel-content .problem-box {
  background: rgba(239,68,68,0.04) !important;
  border: 1px solid rgba(239,68,68,0.15) !important;
  border-left: 3px solid rgba(239,68,68,0.5) !important;
  border-radius: 6px;
  padding: 14px 16px;
  margin: 12px 0;
}
#panel-content .prb-head {
  color: #ef5555 !important;
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 10px;
}
#panel-content .problem-item {
  background: rgba(255,255,255,0.02) !important;
  border: 1px solid rgba(255,255,255,0.06) !important;
  border-radius: 8px;
  padding: 16px;
  margin: 12px 0;
}
#panel-content .p-q {
  color: rgba(255,255,255,0.85) !important;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
#panel-content .p-a {
  color: rgba(255,255,255,0.65) !important;
  font-size: 13px;
  line-height: 1.85;
}
#panel-content .p-a strong {
  color: rgba(255,255,255,0.88) !important;
}
#panel-content .p-a em {
  color: rgba(255,255,255,0.45) !important;
  font-style: italic;
}
/* Override any remaining light inline backgrounds */
#panel-content [style*="background:#f"],
#panel-content [style*="background: #f"],
#panel-content [style*="background:linear-gradient(135deg, #fa"],
#panel-content [style*="background:linear-gradient(135deg, #f5"] {
  background: transparent !important;
}
#panel-content [style*="color:#888"] {
  color:rgba(255,255,255,0.30) !important;
}
#panel-content .topic-name {
  color: rgba(255,255,255,0.88) !important;
}

/* ═══════ RECENT UPDATES FEED (in cardwall) ═══════ */
.cw-feed {
  padding: 14px 20px 12px;
  max-width: 1400px;
  margin: 0 auto 20px;
  border: 1px solid rgba(255,255,255,0.03);
  background: rgba(255,255,255,0.01);
}
.cw-feed-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.cwf-left { display: flex; align-items: center; gap: 8px; }
.cwf-dot { width: 5px; height: 5px; background: #22c55e; border-radius: 50%; }
.cwf-label {
  font-family: 'DM Mono', monospace; font-size: 12px;
  letter-spacing: 2.5px; text-transform: uppercase; color: rgba(180,150,80,0.85);
}
.cwf-meta {
  font-family: 'DM Mono', monospace; font-size: 12px;
  letter-spacing: 1px; color:rgba(255,255,255,0.55);
}
.cwf-table { width: 100%; border-collapse: collapse; }
.cwf-table tr { border-bottom: 1px solid rgba(255,255,255,0.02); }
.cwf-table tr:last-child { border-bottom: none; }
.cwf-table td { padding: 5px 0; vertical-align: baseline; white-space: nowrap; }
.cwf-time {
  width: 90px; font-family: 'DM Mono', monospace; font-size: 12px;
  color: rgba(255,255,255,0.40); padding-right: 10px; white-space: nowrap;
}
.cwf-tag { width: 50px; padding-right: 10px; }
.cwf-tag span {
  font-family: 'Noto Sans SC', sans-serif; font-size: 10px; letter-spacing: 0.5px;
  padding: 2px 6px; border-radius: 2px; white-space: nowrap;
}
.cwf-tag .new { color: #22c55e; background: rgba(34,197,94,0.08); }
.cwf-tag .upd { color: #3b82f6; background: rgba(59,130,246,0.08); }
.cwf-tag .exp { color: #a855f7; background: rgba(168,85,247,0.08); }
.cwf-tag .rev { color: #eab308; background: rgba(234,179,8,0.08); }
.cwf-text { color: rgba(255,255,255,0.8); font-size: 14px; padding-right: 16px; }
.cwf-src {
  width: 80px; text-align: right; font-family: 'DM Mono', monospace;
  font-size: 12px; color: rgba(180,150,80,0.7);
}
.cwf-hidden { display: none; }
.cw-feed.expanded .cwf-hidden { display: table-row; }
.cwf-toggle {
  display: flex; align-items: center; justify-content: center;
  padding: 6px 0 0; cursor: pointer; user-select: none;
}
.cwf-toggle-text {
  font-family: 'DM Mono', monospace; font-size: 12px;
  letter-spacing: 1.5px; color:rgba(255,255,255,0.55);
}
.cwf-toggle:hover .cwf-toggle-text { color: rgba(180,150,80,0.4); }
.cwf-toggle-arrow { font-size: 10px; color: rgba(255,255,255,0.1); margin-left: 5px; }
.cw-feed.expanded .cwf-toggle-arrow { transform: rotate(180deg); }

/* ═══════ HERO DASHBOARD ═══════ */
.hero-dashboard {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0;
  border-top: 1px solid rgba(180,150,80,0.08);
  margin-top: 40px;
  position: relative;
  z-index: 2;
}
.hd-item {
  padding: 18px 20px 16px;
  border-right: 1px solid rgba(255,255,255,0.04);
  text-align: center;
}
.hd-item:last-child { border-right: none; }
.hd-icon {
  font-size: 9px;
  color: rgba(180,150,80,0.25);
  margin-bottom: 6px;
}
.hd-label {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.2);
  margin-bottom: 6px;
}
.hd-value {
  font-family: 'DM Mono', monospace;
  font-size: 22px;
  font-weight: 600;
  color: #c9a84c;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.hd-sub {
  font-size: 10px;
  color:rgba(255,255,255,0.20);
  letter-spacing: 0.5px;
}
@media (max-width: 768px) {
  .hero-dashboard { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 480px) {
  .hero-dashboard { grid-template-columns: repeat(2, 1fr); }
}

/* ═══════ HERO DASHBOARD ═══════ */
.hero-dash{text-align:center;max-width:960px;margin:0 auto;padding-bottom:20px;}
.hero-dash-label{font-family:'DM Mono',monospace;font-size:9px;letter-spacing:3.5px;text-transform:uppercase;color:rgba(180,150,80,0.4);margin-bottom:20px;}
.hero-dash-grid{display:flex;justify-content:center;gap:0;}
.hero-dash-item{flex:1;padding:0 20px;border-right:1px solid rgba(180,150,80,0.08);text-align:center;}
.hero-dash-item:last-child{border-right:none;}
.hd-num{font-family:'Cinzel',serif;font-weight:700;font-size:26px;color:rgba(180,150,80,0.5);line-height:1.1;letter-spacing:1px;}
.hd-unit{font-family:'Cinzel',serif;font-size:26px;font-weight:700;color:rgba(180,150,80,0.5);letter-spacing:1px;}
.hero-dash-item .hd-label{margin-bottom:0;margin-top:6px;color:rgba(255,255,255,0.20);}

/* ╔══════════════════════════════════════════════════════════════════╗
   ║  MOBILE RESPONSIVE — Comprehensive adaptation                  ║
   ╚══════════════════════════════════════════════════════════════════╝ */

/* ── Hamburger button (hidden on desktop) ── */
.nav-hamburger {
  display:none;
  flex-direction:column;
  gap:4px;
  background:none;border:none;cursor:pointer;padding:6px;
  z-index:10001;
}
.nav-hamburger span {
  display:block;width:20px;height:1.5px;
  background:rgba(255,255,255,0.5);
  border-radius:1px;
}

/* ══════ 768px: Tablet ══════ */
@media (max-width: 768px) {
  /* Nav → hamburger */
  .nav-hamburger { display:flex; }
  .nav-right {
    display:none;
    position:fixed;top:48px;left:0;right:0;
    background:#0d0e16;border-bottom:1px solid rgba(180,150,80,0.15);
    flex-direction:column;padding:12px 20px 16px;gap:0;z-index:9998;
  }
  .nav-right.mobile-open { display:flex; }
  .nav-right .nav-link {
    display:block;padding:12px 0;font-size:13px;
    border-bottom:1px solid rgba(255,255,255,0.04);
  }
  .nav-right .nav-tools-wrap { padding:12px 0 4px; }
  .nav-right .nav-tools-btn { width:100%;text-align:left;padding:8px 0;border:none; }
  .nav-right .nav-tools-menu {
    position:static;border:none;background:transparent;display:block;min-width:auto;
  }
  .nav-right .nav-tools-item { padding:10px 0 10px 16px;border-bottom:1px solid rgba(255,255,255,0.03); }

  /* Hero */
  .hero { min-height:100vh; }
  .hero-stage { padding:0 20px; }
  .hero-topbar { padding:8px 16px; }
  .hero-topbar-center { display:none; }
  .hero-topbar-seg { font-size:9px;letter-spacing:1.5px; }
  .hero-rail { display:none; }
  .hero-ghost { font-size:clamp(200px,50vw,300px); }
  .hero-logo-en { margin-bottom:10px; }
  .hero-rule { margin-bottom:10px;max-width:85%; }
  .hero-logo-zh { margin-bottom:2px; }
  .hero-subtitle { margin-bottom:18px; }
  .hero-dash { padding-bottom:12px; }
  .hero-dash-label { margin-bottom:8px; }
  .hero-dash-grid { flex-wrap:wrap;gap:0; }
  .hero-dash-item {
    flex:none;width:33.33%;padding:6px 6px;
    border-right:1px solid rgba(180,150,80,0.06);
    border-bottom:1px solid rgba(180,150,80,0.06);
  }
  .hero-dash-item:nth-child(3n) { border-right:none; }
  .hero-dash-item:nth-child(n+4) { border-bottom:none; }
  .hd-num { font-size:18px; }
  .hd-unit { font-size:18px; }
  .hero-dash-item .hd-label { font-size:9px; }

  /* Cardwall */
  .cardwall-section { padding:16px 16px 40px; }
  .cardwall-header { padding:0;gap:8px;flex-wrap:wrap;margin-bottom:6px; }
  .cardwall-tag { font-size:9px;padding:3px 10px;letter-spacing:2px; }
  .cardwall-count { font-size:9px;letter-spacing:1px;display:none; }

  /* Search bar — Double Deck mobile */
  .search-bar-wrap { padding:4px 0 0; }
  .search-bar { height:auto; }
  .sb-row1 { height:38px; }
  .sb-icon { padding:0 8px;font-size:11px; }
  .sb-input { font-size:16px;padding:0 6px;min-width:0; }
  .sb-go { padding:0 12px;font-size:9px; }
  .sb-row2 { height:24px;padding:0 3px; }
  .sb-tab { padding:2px 6px;font-size:8px; }
  .sb-web-toggle { font-size:8px;padding:2px 5px; }
  .sb-info { display:none; }
  .sb-controls { padding:0;gap:4px; }
  .sb-key-btn { padding:2px 5px;font-size:8px; }
  .sb-key-panel { width:280px;right:-10px; }
  .sb-chips {
    gap:4px;flex-wrap:nowrap;overflow-x:auto;-webkit-overflow-scrolling:touch;scrollbar-width:none;
    mask-image:linear-gradient(90deg, #000 85%, transparent 100%);
    -webkit-mask-image:linear-gradient(90deg, #000 85%, transparent 100%);
  }
  .sb-chips::-webkit-scrollbar { display:none; }
  .sb-chip { font-size:9px;padding:2px 8px;flex-shrink:0;white-space:nowrap; }
  .kb-dropdown { max-height:260px; }

  /* CW Feed table */
  .cwf-src { display:none; }
  .cwf-time { font-size:10px;width:85px; }
  .cwf-text { font-size:11px;white-space:normal; }

  /* Filter buttons → horizontal scroll with fade hint */
  .cardwall-filters {
    flex-wrap:nowrap;overflow-x:auto;-webkit-overflow-scrolling:touch;
    padding:0 0 4px 0;scrollbar-width:none;
    position:relative;
    mask-image:linear-gradient(90deg, #000 80%, transparent 100%);
    -webkit-mask-image:linear-gradient(90deg, #000 80%, transparent 100%);
  }
  .cardwall-filters::-webkit-scrollbar { display:none; }
  .cardwall-filters.scrolled-end {
    mask-image:none;-webkit-mask-image:none;
  }
  .cardwall-filter { flex-shrink:0;font-size:11px;padding:5px 12px; }

  /* Cards 2 columns */
  .cardwall-grid { grid-template-columns:repeat(2,1fr);gap:8px; }
  .cw-card-name { font-size:13px; }
  .cw-card-num { font-size:18px; }

  /* Panel overlay */
  .panel-overlay { padding:0; padding-bottom:max(0px, env(safe-area-inset-bottom)); }
  .panel-inner { width:100%;max-width:100%;border-radius:0;height:100vh;max-height:100vh; }
  .panel-header { padding:52px 14px 0; }
  .panel-topbar { flex-wrap:wrap;gap:4px;padding:4px 0; }
  .panel-topbar-left { font-size:9px;letter-spacing:1px; }
  .panel-topbar-right { font-size:9px; }
  .panel-title-row { padding:6px 0 4px;flex-wrap:wrap;gap:8px; }
  .panel-title-group { gap:8px;flex-wrap:wrap; }
  .panel-title-name { font-size:16px; }
  .panel-title-cat { display:none; }
  .panel-close { font-size:10px;padding:5px 10px;flex-shrink:0; }
  .close-desktop { display:none; }
  .close-mobile { display:inline; }
  .panel-stats { flex-direction:column;gap:2px;padding:4px 0 6px; }
  .panel-stat-item { font-size:9px;letter-spacing:0.5px; }

  /* Current topic bar (mobile only) */
  .panel-current-topic {
    display:flex;align-items:center;gap:10px;
    padding:8px 0;border-top:1px solid rgba(255,255,255,0.04);
    max-height:50px;opacity:1;overflow:hidden;
    transition:max-height 0.3s ease,padding 0.3s ease,opacity 0.25s ease;
  }
  .panel-current-topic.hidden { max-height:0;padding:0;opacity:0;border-top-color:transparent; }
  .pct-num { font-family:'DM Mono',monospace;font-size:10px;color:rgba(180,150,80,0.5); }
  .pct-text { font-size:12px;color:rgba(255,255,255,0.55);flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap; }
  .pct-expand {
    font-family:'DM Mono',monospace;font-size:9px;letter-spacing:0.5px;
    color:#c9a84c;background:rgba(180,150,80,0.08);
    border:1px solid rgba(180,150,80,0.2);border-radius:3px;
    padding:4px 10px;cursor:pointer;flex-shrink:0;white-space:nowrap;
  }

  /* Sidebar — collapsible on mobile */
  .panel-body { flex-direction:column; }
  .panel-sidebar {
    width:100%;height:auto;max-height:300px;
    border-right:none;border-bottom:1px solid rgba(255,255,255,0.05);
    padding:10px 14px;overflow:hidden;
    transition:max-height 0.3s ease,padding 0.3s ease,opacity 0.25s ease;
    opacity:1;
  }
  .panel-sidebar.collapsed { max-height:0;padding:0;opacity:0;border-bottom-color:transparent; }
  .sidebar-section-label { font-size:9px;margin-bottom:8px; }
  .sidebar-item { padding:5px 10px 5px 0;font-size:12px; }
  .sidebar-item-text { font-size:11px; }
  .panel-content { padding:14px 14px 40px;overflow-x:hidden; }
  .topic-body { max-width:100%; }

  /* Tables inside panel — scroll wrapper */
  .table-scroll-wrap {
    position:relative;margin:14px 0;
    overflow-x:auto;-webkit-overflow-scrolling:touch;
  }
  .table-scroll-wrap::after {
    content:'';position:absolute;top:0;right:0;bottom:0;width:32px;
    background:linear-gradient(90deg,transparent,#09090f);
    pointer-events:none;opacity:1;transition:opacity 0.3s;
  }
  .table-scroll-wrap.scrolled-end::after { opacity:0; }
  .table-scroll-wrap table { margin:0;min-width:max-content; }
  .panel-content table { font-size:12px; }
  .panel-content td,
  .panel-content th,
  .topic-body td,
  .topic-body th { white-space:nowrap;padding:6px 10px; }

  /* Table scroll wrapper for mobile */
  .compare-table { display:block;overflow-x:auto;-webkit-overflow-scrolling:touch; }

  /* AI results panel */
  .ai-results-inner { padding:16px; }
  .ai-ans-header { flex-direction:column;gap:8px;align-items:flex-start; }
  .ai-answer-body { font-size:13px; }
  .ai-answer-body h3 { font-size:14px; }

  /* Footer — 方案C: 卡片分组式 (统一标准) */
  .site-footer { padding:16px!important;padding-bottom:max(16px, env(safe-area-inset-bottom))!important; }

  /* Row1: header-card with M logo */
  .footer-row1 { flex-direction:column;gap:0;align-items:stretch;margin-bottom:12px; }
  .footer-brand-group {
    display:flex;align-items:center;gap:10px;
    padding-bottom:10px;margin-bottom:12px;
    border-bottom:1px solid rgba(180,150,80,0.06);
  }
  .footer-logo-mark {
    display:flex!important;
    width:24px;height:24px;
    background:linear-gradient(135deg,#c9a84c,#7a6330);
    border-radius:6px;
    align-items:center;justify-content:center;
    font-size:10px;font-weight:900;color:#04040a;
    flex-shrink:0;
    font-family:'DM Mono',monospace;
  }
  .footer-brand-col { display:block!important; }
  .footer-brand { font-size:12px!important;letter-spacing:2.5px!important; }
  .footer-sub { font-size:9px!important;color:rgba(255,255,255,0.2)!important;letter-spacing:1px!important; }

  /* Meta inline → 2×2 info-grid cards */
  .footer-meta-inline {
    display:grid!important;grid-template-columns:1fr 1fr;gap:6px;
    border:none!important;
  }
  .fmi {
    flex-direction:column!important;align-items:flex-start!important;gap:2px!important;
    padding:6px 8px!important;border-right:none!important;
    background:rgba(255,255,255,0.02);border:1px solid rgba(255,255,255,0.04)!important;
    border-radius:4px;
  }
  .fmi-label { font-size:8px!important;letter-spacing:1px!important;margin-bottom:2px;color:rgba(255,255,255,0.2)!important; }
  .fmi-value { font-size:11px!important;color:#c9a84c!important; }

  /* Features grid → 3x2 on mobile */
  .footer-row2 { padding:0!important;margin-bottom:12px!important;border:none!important; }
  .footer-features-grid {
    display:grid!important;grid-template-columns:repeat(3,1fr)!important;gap:0!important;
    border:1px solid rgba(255,255,255,0.04)!important;
  }
  .footer-feature {
    font-size:10px!important;color:rgba(255,255,255,0.25)!important;
    padding:8px 4px!important;text-align:center;
    border-right:1px solid rgba(255,255,255,0.04)!important;
    border-bottom:1px solid rgba(255,255,255,0.04)!important;
  }
  .footer-feature:nth-child(3n) { border-right:none!important; }
  .footer-feature:nth-child(n+4) { border-bottom:none!important; }

  /* Legal row */
  .footer-row4 {
    display:flex;flex-direction:row!important;
    align-items:center;justify-content:space-between;
    padding-top:8px;border-top:1px solid rgba(255,255,255,0.04);
    gap:6px;
  }
  .fc-left { flex-direction:row!important;align-items:center;gap:6px; }
  .fc-badge { font-size:8px!important;padding:2px 6px!important; }
  .fc-text { font-size:8px!important;color:rgba(255,255,255,0.18)!important; }
  .footer-right-info { text-align:right;flex-shrink:0; }
  .fc-version { font-size:8px!important;color:rgba(255,255,255,0.15)!important; }
  .footer-copyright { font-size:8px!important;color:rgba(255,255,255,0.15)!important; }
}

/* ══════ 480px: Phone ══════ */
@media (max-width: 480px) {
  /* Nav */
  .nav-logo { font-size:11px !important;letter-spacing:0 !important; }

  /* Hero */
  .hero { min-height:100vh; }
  .hero-logo-en { font-size:clamp(32px,12vw,52px);letter-spacing:0.15em;text-indent:0.15em;margin-bottom:8px; }
  .hero-logo-zh { font-size:clamp(20px,7vw,34px);letter-spacing:0.35em;text-indent:0.35em; }
  .hero-subtitle { font-size:clamp(12px,3.5vw,16px);letter-spacing:0.3em;text-indent:0.3em;margin-bottom:16px; }
  .hero-rule { max-width:90%;margin-bottom:8px; }
  .hero-rule-label { font-size:9px;letter-spacing:3px; }
  .hero-dash-item { width:33.33%;padding:5px 4px; }
  .hd-num { font-size:16px; }
  .hd-unit { font-size:16px; }

  /* Cardwall */
  .cardwall-section { padding:12px 12px 30px; }
  .cardwall-grid { grid-template-columns:1fr 1fr;gap:6px; }
  .cw-card-body { padding:10px 10px 8px; }
  .cw-card-name { font-size:12px;margin-bottom:8px; }
  .cw-card-num { font-size:16px; }
  .cw-card-id { font-size:9px; }
  .cw-card-cat { font-size:9px; }

  /* Search bar — Double Deck 480px */
  .search-bar { height:auto; }
  .sb-row1 { height:36px; }
  .sb-go { padding:0 10px;font-size:8px; }
  .sb-row2 { height:22px; }
  .sb-tab { padding:1px 5px;font-size:8px;letter-spacing:0.3px; }
  .sb-web-toggle { font-size:8px;padding:1px 5px; }
  .sb-key-panel { width:calc(100% - 20px);right:-10px;max-width:calc(100vw - 40px); }

  /* CW Feed */
  .cwf-time { font-size:9px;width:80px; }
  .cwf-text { font-size:10px; }
  .cwf-tag span { font-size:9px;padding:1px 5px; }

  /* Panel */
  .panel-header { padding:50px 12px 0; }
  .panel-title-row { padding:4px 0; }
  .panel-title-name { font-size:14px; }
  .panel-title-id { font-size:11px; }
  .panel-sidebar { padding:8px 12px; }
  .sidebar-item-text { font-size:10px; }
  .panel-content { padding:12px 12px 30px; }
  .panel-content table { font-size:11px; }
  .panel-content td,.panel-content th,.topic-body td,.topic-body th { padding:5px 8px; }
  .pct-text { font-size:11px; }

  /* AI results */
  .ai-results-inner { padding:12px; }

  /* Footer — 480px: already 方案C from 768px, just tighten padding */
  .site-footer { padding:14px 12px!important;padding-bottom:max(14px,env(safe-area-inset-bottom))!important; }
}

/* ══════ 500px: Mid phone ══════ */
@media (max-width: 500px) {
  /* Hero */
  .hero-stage { padding:0 14px; }
  .hero-ghost { font-size:clamp(160px,45vw,240px); }
  .hero-logo-en { font-size:clamp(28px,10vw,42px); }
  .hero-logo-zh { font-size:clamp(18px,6vw,28px); }
  .hero-subtitle { font-size:clamp(11px,3vw,14px); }
  .hero-dash-item .hd-label { font-size:8px; }
  .hd-num { font-size:16px; }
  .hd-unit { font-size:16px; }
  /* Cards */
  .cw-card-name { font-size:12px; }
  .cw-card-num { font-size:16px; }
  .cw-card-body { padding:10px 10px 8px; }
  /* Search — 500px */
  .sb-row1 { height:34px; }
  .sb-icon { padding:0 6px;font-size:10px; }
  .sb-tab { font-size:8px;padding:1px 4px; }
  .sb-chip { font-size:9px;padding:3px 8px; }
  .sb-web-toggle { font-size:8px;padding:1px 4px; }
  .sb-go { font-size:8px;padding:0 8px; }
  /* Footer — 500px: 方案C inherited, minor tighten */
  .site-footer { padding:14px 10px!important;padding-bottom:max(12px,env(safe-area-inset-bottom))!important; }
  /* Section headers */
  .section-title { font-size:15px !important; }
  .section-desc { font-size:12px; }
  /* Zone map */
  .zone-header-title { font-size:14px; }
}

/* ══════ 360px: Small phone ══════ */
@media (max-width: 360px) {
  .hero-stage { padding:0 10px; }
  .hero-dash-item { width:50%; }
  .hero-dash-item:nth-child(3n) { border-right:1px solid rgba(180,150,80,0.06); }
  .hero-dash-item:nth-child(2n) { border-right:none; }
  .hero-dash-item:nth-child(n+5) { border-bottom:none; }
  .hero-dash-item:nth-child(-n+4) { border-bottom:1px solid rgba(180,150,80,0.06); }
  .hd-num { font-size:14px; }
  .hd-unit { font-size:14px; }
  .hero-dash-item .hd-label { font-size:8px; }
  .sb-info { display:none; }
  /* Cards */
  .cardwall-section { padding:10px 8px 24px; }
  .cardwall-grid { gap:4px; }
  .cw-card-name { font-size:11px; }
  .cw-card-num { font-size:14px; }
  .cw-card-body { padding:8px 8px 6px; }
  .cw-card-id { font-size:8px; }
  /* Search — 360px */
  .search-bar { height:auto; }
  .sb-row1 { height:32px; }
  .sb-row2 { height:20px; }
  .sb-tab { font-size:8px;padding:1px 4px; }
  .sb-input { font-size:16px; }
  /* Footer — 360px: 方案C tightest */
  .site-footer { padding:12px 10px!important;padding-bottom:max(10px,env(safe-area-inset-bottom))!important; }
  .footer-brand-group { gap:8px;padding-bottom:8px;margin-bottom:10px; }
  .footer-logo-mark { width:22px!important;height:22px!important;font-size:9px!important;border-radius:5px; }
  .footer-brand { font-size:11px!important;letter-spacing:2px!important; }
  .footer-sub { font-size:8px!important; }
  .footer-meta-inline { gap:5px!important; }
  .fmi { padding:5px 7px!important; }
  .fmi-label { font-size:8px!important; }
  .fmi-value { font-size:10px!important; }
  .footer-row2 { margin-bottom:10px!important; }
  .footer-feature { font-size:8px!important;padding:3px 6px!important; }
  .fc-badge { font-size:8px!important;padding:2px 5px!important; }
  .fc-text { font-size:8px!important; }
  .fc-version { font-size:8px!important; }
  .footer-copyright { font-size:8px!important; }
  /* Nav */
  .nav-logo { font-size:10px !important; }
}


/* ╔══════════════════════════════════════════════════════════════════════╗
   ║  MOBILE FIX v2 — 2026.03 complete phone adaptation                ║
   ║  Covers: safe-area, touch targets, overflow, dvh, layout fixes    ║
   ╚══════════════════════════════════════════════════════════════════════╝ */

/* ── 1. Safe-area support (iPhone notch / home indicator) ── */
@supports (padding-top: env(safe-area-inset-top)) {
  .sticky-nav {
    padding-top: env(safe-area-inset-top);
    height: calc(48px + env(safe-area-inset-top));
  }
  body {
    padding-top: calc(48px + env(safe-area-inset-top));
  }
  .site-footer {
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
  }
  #backToTop {
    bottom: calc(28px + env(safe-area-inset-bottom));
  }
  #fabGroup {
    bottom: calc(80px + env(safe-area-inset-bottom));
  }
}

/* ── 2. Hero 100vh fix — use dvh on supporting browsers ── */
@supports (min-height: 100dvh) {
  .hero { min-height: 100dvh; }
}

/* ── 2b. Global overflow prevention ── */
@media (max-width: 768px) {
  html,body { overflow-x:hidden !important; max-width:100%; -webkit-text-size-adjust:100%; text-size-adjust:100%; }
}

/* ── 3. Global touch target enforcement ── */
@media (max-width: 768px) {
  /* Ensure minimum 44px tap targets */
  .sb-chip,
  .cardwall-filter,
  .clarify-option,
  .ai-followup-btn,
  .sfp-chip,
  .ai-mode-tab,
  .folder-tab,
  .sb-web-toggle,
  .sb-go,
  .sb-key-btn,
  .sb-tab {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .nav-hamburger {
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* ── 4. Search bar Double Deck layout fix ── */
  .search-bar {
    flex-direction: column;
    height: auto;
  }
  .sb-row1 {
    width: 100%;
  }
  .sb-row2 {
    width: 100%;
  }
  .sb-input {
    min-width: 0;
    flex: 1 1 auto;
  }
  .sb-controls {
    flex-shrink: 0;
    flex-wrap: nowrap;
  }

  /* ── 5. API key panel — stay inside viewport ── */
  .sb-key-panel {
    position: fixed !important;
    top: auto !important;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100% !important;
    border-radius: 14px 14px 0 0;
    padding: 16px 20px calc(16px + env(safe-area-inset-bottom, 0px));
    z-index: 10001;
    box-shadow: 0 -8px 40px rgba(0,0,0,0.6);
  }

  /* ── 6. Feed table — prevent horizontal overflow ── */
  .cwf-text {
    white-space: normal !important;
    word-break: break-word;
  }
  .cwf-table {
    table-layout: fixed;
    width: 100%;
  }
  .cwf-time { width: 85px; }
  .cwf-tag { width: 50px; }
  .cwf-text { width: auto; }

  /* ── 7. AI clarify options — better spacing ── */
  .clarify-options {
    gap: 8px;
  }
  .clarify-option {
    padding: 10px 16px;
    font-size: 13px;
    line-height: 1.4;
  }
  .clarify-submit {
    width: 100%;
    padding: 12px 24px;
    font-size: 14px;
  }
  .clarify-skip {
    text-align: center;
    display: block;
    width: 100%;
    padding: 8px 0;
  }
  .clarify-submit-row {
    flex-direction: column;
    gap: 8px;
  }

  /* ── 8. AI answer follow-up chips ── */
  .ai-followup-row {
    gap: 8px;
  }
  .ai-followup-btn {
    padding: 8px 16px;
    font-size: 13px;
  }

  /* ── 9. Panel header — safe area for notch ── */
  .panel-header {
    padding-top: calc(52px + env(safe-area-inset-top, 0px)) !important;
  }

  /* ── 10. sb-chips scroll — show scroll indicator ── */
  .sb-chips {
    padding-bottom: 6px;
    scroll-snap-type: x proximity;
  }
  .sb-chip {
    scroll-snap-align: start;
  }
  /* Visible scrollbar hint on first load */
  .sb-chips::after {
    content: '';
    flex-shrink: 0;
    width: 1px;
  }

  /* ── 11. Improve card grid for phone ── */
  .cw-card-body {
    padding: 12px 12px 10px;
  }
  .cw-card-bottom {
    gap: 4px;
  }

  /* ── 12. History panel mobile layout ── */
  .history-item {
    padding: 12px 14px;
  }
  .history-actions {
    opacity: 1; /* Always visible on touch */
  }
  .hist-btn {
    min-height: 44px;
    padding: 8px 12px;
  }

  /* ── 13. Modal overlays — safe area ── */
  .folder-modal,
  #pathModalBox {
    max-height: calc(85vh - env(safe-area-inset-bottom, 0px));
  }

  /* ── 14. Sources section mobile ── */
  #sourcesSection {
    padding: 24px 16px 20px;
  }
  #sourcesSection .src-item {
    flex-direction: column;
    gap: 8px;
  }

  /* ── 15. Zone map cards — touch friendly ── */
  .zone-chip {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  /* ── 15b. Section toggle — 44px touch target ── */
  .section-toggle {
    width: 44px;
    height: 44px;
  }
  .section-head {
    min-height: 44px;
  }

  /* ── 16. Prevent body scroll when panel/modal open ── */
  body.panel-open,
  body.modal-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
  }

  /* ── 17. Smooth scroll snap on filter bar ── */
  .cardwall-filters {
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
  }
  .cardwall-filter {
    scroll-snap-align: start;
  }

  /* ── 18. AI answer block padding ── */
  .ai-answer-block {
    padding: 16px 14px;
    border-radius: 10px;
  }
  .ai-answer-body {
    font-size: 13px;
    line-height: 1.85;
  }

  /* ── 19. Thinking process on mobile ── */
  .thinking-block {
    padding: 8px 0 12px;
  }
  .thinking-row {
    gap: 8px;
    padding: 6px 0;
  }
  .thinking-text {
    font-size: 12px;
  }

  /* ── 20. Script answer mobile ── */
  .script-answer .script-block {
    padding: 10px 12px;
    font-size: 12px;
    line-height: 1.75;
  }
  .script-followup-chips {
    gap: 8px;
  }
  .sfp-chip {
    padding: 8px 14px;
    font-size: 12px;
  }
}

/* ── Additional 480px refinements ── */
@media (max-width: 480px) {
  /* Tighter hero */
  .hero-stage {
    padding: 0 16px;
  }

  /* Search bar — Double Deck 480px */
  .sb-controls {
    gap: 4px;
  }
  .sb-go {
    padding: 0 10px;
    font-size: 9px;
  }

  /* Card name — prevent orphan words */
  .cw-card-name {
    word-break: break-all;
    overflow-wrap: break-word;
    hyphens: auto;
  }

  /* AI panel tighter */
  .ai-results-inner {
    padding: 14px 12px 16px;
  }
  .ai-ans-query-text {
    font-size: 14px;
  }
  .ai-ans-query-icon {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }

  /* Clarify options — stack to 1 column */
  .clarify-options {
    flex-direction: column;
  }

  /* Related chips stack */
  .ai-related-grid {
    flex-direction: column;
  }
  .ai-related-chip {
    width: 100%;
  }

  /* Panel content — tighter */
  .panel-content {
    padding: 12px 12px 40px;
  }
  .content-box {
    padding: 12px 14px;
    font-size: 12px;
  }

  /* Feed meta hide on very small */
  .cwf-meta {
    font-size: 9px;
    letter-spacing: 0.5px;
  }
}

/* ── Additional 360px refinements ── */
@media (max-width: 360px) {
  .nav-left .nav-logo {
    font-size: 10px !important;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .sb-tab {
    padding: 0 6px;
    font-size: 9px;
    letter-spacing: 0;
  }

  .hero-logo-en {
    font-size: clamp(28px, 11vw, 44px);
  }

  .hero-rule-label {
    font-size: 8px;
    letter-spacing: 2px;
  }

  .cw-card-body {
    padding: 8px 10px 8px;
  }

  .cw-card-name {
    font-size: 11px;
    -webkit-line-clamp: 2;
  }

  .cw-card-num {
    font-size: 14px;
  }
}

/* ╔══════════════════════════════════════════════════════════════════════╗
   ║  PANEL BOTTOM NAV — mobile topic switcher (方案A)                  ║
   ╚══════════════════════════════════════════════════════════════════════╝ */

/* Desktop: hidden */
.panel-bottom-nav {
  display: none;
}

@media (max-width: 768px) {
  .panel-bottom-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 50px;
    min-height: 50px;
    flex-shrink: 0;
    background: rgba(13,13,20,0.96);
    border-top: 1px solid rgba(180,150,80,0.15);
    padding: 0 14px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    z-index: 10;
    gap: 6px;
  }

  /* Prev / Next sides */
  .pbn-prev,
  .pbn-next {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    min-height: 44px;
    flex: 1;
    min-width: 0;
  }
  .pbn-prev {
    justify-content: flex-start;
  }
  .pbn-next {
    justify-content: flex-end;
  }

  .pbn-arrow {
    font-size: 18px;
    color: rgba(180,150,80,0.55);
    flex-shrink: 0;
    line-height: 1;
    transition: color 0.15s;
  }
  .pbn-prev:active .pbn-arrow,
  .pbn-next:active .pbn-arrow {
    color: #c9a84c;
  }

  .pbn-label {
    font-size: 11px;
    color: rgba(255,255,255,0.45);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 110px;
    transition: color 0.15s;
  }
  .pbn-prev:active .pbn-label,
  .pbn-next:active .pbn-label {
    color: rgba(255,255,255,0.8);
  }

  /* Disabled state */
  .pbn-prev.disabled,
  .pbn-next.disabled {
    pointer-events: none;
    opacity: 0.25;
  }

  /* Counter */
  .pbn-counter {
    font-family: 'DM Mono', monospace;
    font-size: 10px;
    color: rgba(180,150,80,0.4);
    letter-spacing: 0.5px;
    flex-shrink: 0;
    white-space: nowrap;
  }

  /* Panel content needs extra bottom padding for the nav bar */
  .panel-content {
    padding-bottom: 60px !important;
  }
}

@supports (padding-bottom: env(safe-area-inset-bottom)) {
  @media (max-width: 768px) {
    .panel-bottom-nav {
      height: calc(50px + env(safe-area-inset-bottom));
      min-height: calc(50px + env(safe-area-inset-bottom));
    }
  }
}

/* ╔══════════════════════════════════════════════════════════════════════╗
   ║  MOBILE READABILITY — font size + brightness boost                ║
   ║  Benchmark: Xiaohongshu body 15px, WeChat 16px, iOS HIG 17px     ║
   ╚══════════════════════════════════════════════════════════════════════╝ */

@media (max-width: 768px) {

  /* ── HERO DASHBOARD: fix overlap ── */
  .hero-dash-item {
    padding: 10px 6px !important;
  }
  .hd-num { font-size: 20px !important; line-height: 1.2; }
  .hd-unit { font-size: 20px !important; }
  .hero-dash-item .hd-label {
    font-size: 10px !important;
    margin-top: 4px;
    line-height: 1.3;
    letter-spacing: 0.5px;
    color: rgba(255,255,255,0.35) !important;
  }
  .hero-dash-label {
    font-size: 10px !important;
    color: rgba(180,150,80,0.5) !important;
  }

  /* ── TIER 1: Body text — 12-13px → 15px, opacity → 0.82-0.85 ── */
  .topic-block p,
  .dot-list li,
  .content-box,
  .layman-box,
  .pro-box,
  .case-box,
  .data-box,
  .warn-box,
  .problem-box,
  .solution-box,
  .psych-box,
  .ai-answer-body,
  .syn-answer,
  .syn-context-para,
  .syn-step-body,
  .sf-a,
  .script-answer p,
  .topic-block ul,
  .topic-block ol,
  .ai-answer-body li,
  .p-a {
    font-size: 15px !important;
    color: rgba(255,255,255,0.85) !important;
    line-height: 1.85 !important;
  }

  /* ── TIER 1.5: Content box text specifically ── */
  .topic-block .info-box,
  .topic-block .beginner-box,
  .topic-block .case-box,
  .topic-block .expert-box,
  .topic-block .warn-box,
  .topic-block .data-box {
    font-size: 14px !important;
    color: rgba(255,255,255,0.82) !important;
  }

  /* ── TIER 2: Secondary text — 11-12px → 13px, opacity → 0.65 ── */
  .sb-input,
  .sb-chip,
  .cardwall-filter,
  .ai-q-text,
  .ai-followup-btn,
  .sfp-chip,
  .clarify-option,
  .ai-related-chip,
  .lm-title,
  .result-card-name,
  .kb-name,
  .ai-result-body,
  .ai-error-block,
  .clarify-intro,
  .ai-typing,
  .ai-error,
  .ai-loading-row,
  .thinking-text,
  .quote-box,
  .history-item-query,
  .history-empty,
  .folder-modal-item,
  .script-answer .script-block,
  .sidebar-item,
  .pbn-label,
  .pct-text,
  .nav-right .nav-link {
    font-size: 13px !important;
  }

  .sb-chip,
  .cardwall-filter,
  .ai-q-text,
  .clarify-option,
  .lm-title,
  .result-card-name,
  .ai-loading-row,
  .thinking-text,
  .history-item-query {
    color: rgba(255,255,255,0.65) !important;
  }

  /* ── TIER 3: Captions/labels — 9-10px → 11-12px, opacity → 0.40-0.50 ── */
  .hero-topbar-seg,
  .sb-tab,
  .sb-stat,
  .sb-web-toggle,
  .sb-go,
  .sb-key-btn,
  .cardwall-tag,
  .cardwall-count,
  .cw-card-id,
  .cw-card-cat,
  .cw-card-unit,
  .cw-card-arrow,
  .panel-topbar-left,
  .panel-topbar-right,
  .panel-stat-item,
  .panel-close,
  .sidebar-section-label,
  .sidebar-item-num,
  .content-box-tag,
  .content-tag,
  .topic-subtitle,
  .cite-ref,
  .ai-cite-tag,
  .ai-cite-label,
  .ai-ans-query-sub,
  .ai-related-head,
  .ai-col-head,
  .ai-q-num,
  .ai-q-tag,
  .ai-answer-label,
  .syn-sources-label,
  .syn-source-tag,
  .syn-steps-head,
  .syn-inline-data,
  .syn-inline-case,
  .syn-warn-inline,
  .thinking-found,
  .thinking-sub,
  .pct-num,
  .pct-expand,
  .pbn-counter,
  .cwf-time,
  .cwf-tag span,
  .cwf-meta,
  .cwf-src,
  .cwf-toggle-text,
  .fmi-label,
  .fmi-value,
  .fc-badge,
  .fc-text,
  .fc-version,
  .footer-copyright,
  .footer-feature,
  .footer-brand,
  .footer-sub,
  .zone-map-label,
  .zone-card-desc,
  .zone-chip,
  .zone-density span,
  .hist-btn,
  .history-item-meta,
  .history-item-folder-badge,
  .script-followups-label,
  .api-key-status,
  .api-key-toggle,
  .sb-key-input,
  .sb-key-save,
  .sb-key-remember,
  .sb-key-status,
  .cost-tag,
  .result-type,
  .rg-count,
  .lm-section,
  .kb-id,
  .kb-match,
  .kb-count,
  .ai-result-badge,
  .content-quote-src,
  .hero-rule-label {
    font-size: 11px !important;
  }

  /* Brightness boost for captions: 0.20-0.30 → 0.40-0.50 */
  .hero-topbar-seg,
  .panel-topbar-left,
  .panel-topbar-right,
  .panel-stat-item,
  .sidebar-section-label,
  .sidebar-item-num,
  .topic-subtitle,
  .content-tag,
  .content-quote-src,
  .ai-cite-label,
  .ai-q-num,
  .ai-answer-label,
  .ai-related-head,
  .ai-col-head,
  .syn-sources-label,
  .syn-steps-head,
  .thinking-sub,
  .cwf-meta,
  .cwf-toggle-text,
  .fmi-label,
  .fc-text,
  .fc-version,
  .footer-copyright,
  .footer-feature,
  .zone-map-label,
  .zone-card-desc,
  .zone-density span,
  .history-item-meta,
  .script-followups-label,
  .api-key-status,
  .lm-section,
  .kb-match,
  .kb-count,
  .ai-result-badge,
  .rg-count,
  .hero-rule-label {
    color: rgba(255,255,255,0.40) !important;
  }

  .cw-card-id { color: rgba(180,150,80,0.6) !important; }
  .cw-card-cat,
  .cw-card-unit,
  .cw-card-arrow { color: rgba(255,255,255,0.45) !important; }
  .cwf-time { color: rgba(255,255,255,0.50) !important; }
  .cwf-src { color: rgba(180,150,80,0.65) !important; }
  .pbn-counter { color: rgba(180,150,80,0.50) !important; }

  /* ── Titles boost ── */
  .cw-card-name {
    font-size: 14px !important;
    color: rgba(255,255,255,0.92) !important;
  }
  .panel-title-name {
    color: rgba(255,255,255,0.95) !important;
  }
  .topic-title {
    font-size: 18px !important;
    color: rgba(255,255,255,0.95) !important;
  }
  #panel-content .topic-title {
    font-size: 18px !important;
    color: rgba(255,255,255,0.95) !important;
  }

  /* ── Box heads boost ── */
  .content-box-head,
  .lb-head,
  .pb-head,
  .cb-head,
  .db-head,
  .wb-head,
  .prb-head,
  .sol-head,
  .psy-head,
  #panel-content .lb-head,
  #panel-content .pb-head,
  #panel-content .cb-head,
  #panel-content .db-head,
  #panel-content .prb-head {
    font-size: 12px !important;
  }

  /* ── Nav logo ── */
  .nav-left .nav-logo {
    font-size: 13px !important;
  }

  /* ── Search bar tabs ── */
  .sb-tab {
    font-size: 12px !important;
    padding: 0 10px !important;
  }

  /* ── Feed text ── */
  .cwf-text {
    font-size: 13px !important;
    color: rgba(255,255,255,0.82) !important;
  }

  /* ── Zone card name ── */
  .zone-card-name { font-size: 13px !important; }

  /* ── Strong/bold inside body ── */
  .topic-block strong,
  .ai-answer-body strong,
  .syn-answer strong,
  #panel-content strong {
    color: rgba(255,255,255,0.95) !important;
  }

  /* ── Panel sidebar text ── */
  .sidebar-item-text {
    font-size: 12px !important;
    color: rgba(255,255,255,0.50) !important;
  }
  .sidebar-item.active .sidebar-item-text {
    color: rgba(255,255,255,0.90) !important;
  }
}

/* ── 480px: keep proportions ── */
@media (max-width: 480px) {
  .hero-dash-item {
    padding: 8px 4px !important;
  }
  .hd-num { font-size: 18px !important; }
  .hd-unit { font-size: 18px !important; }
  .hero-dash-item .hd-label {
    font-size: 10px !important;
    letter-spacing: 0.3px;
  }
  .cw-card-name {
    font-size: 13px !important;
  }
  .topic-title,
  #panel-content .topic-title {
    font-size: 16px !important;
  }
}

/* ── 360px: smallest screens ── */
@media (max-width: 360px) {
  .hero-dash-item {
    padding: 8px 4px !important;
  }
  .hd-num { font-size: 16px !important; }
  .hd-unit { font-size: 16px !important; }
  .cw-card-name {
    font-size: 12px !important;
  }
}

/* ╔══════════════════════════════════════════════════════════════════════╗
   ║  MOBILE INTERACTION v3 — 2026.03 touch/scroll/feedback polish     ║
   ╚══════════════════════════════════════════════════════════════════════╝ */

/* ── 1. Eliminate 300ms tap delay globally ── */
@media (max-width: 768px) {
  a, button, [onclick], [role="button"],
  .cw-card, .sidebar-item, .zone-chip,
  .sb-chip, .sb-tab, .cardwall-filter,
  .ai-followup-btn, .sfp-chip, .clarify-option,
  .hist-btn, .section-toggle, .nav-hamburger,
  .folder-tab, .ai-mode-tab, .panel-close,
  .pct-expand {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }
}

/* ── 2. Active state visual feedback (pressed feel) ── */
@media (max-width: 768px) {
  .cw-card:active {
    transform: scale(0.98);
    opacity: 0.85;
    transition: transform 0.08s, opacity 0.08s;
  }
  .sb-chip:active,
  .zone-chip:active,
  .cardwall-filter:active,
  .ai-followup-btn:active,
  .sfp-chip:active,
  .clarify-option:active {
    opacity: 0.7;
    transition: opacity 0.06s;
  }
  .sidebar-item:active {
    background: rgba(180,150,80,0.06);
  }
  .panel-close:active,
  .pct-expand:active,
  .hist-btn:active {
    opacity: 0.6;
    transition: opacity 0.06s;
  }
  .nav-hamburger:active {
    background: rgba(255,255,255,0.05);
  }
  button:active, a:active {
    transition: opacity 0.06s;
  }
  .sb-tab:active,
  .sb-web-toggle:active,
  .sb-go:active,
  .ai-cite-tag:active,
  .search-trigger:active,
  .search-close:active,
  .nav-item:active,
  .section-header:active,
  .path-start-btn:active,
  .fab:active {
    opacity: 0.7;
    transition: opacity 0.06s;
  }
  .kb-item:active,
  .result-item:active {
    opacity: 0.85;
    transition: opacity 0.06s;
  }
}

/* ── 3. Overscroll behavior — prevent swipe-back ── */
@media (max-width: 768px) {
  html {
    overscroll-behavior-x: none;
  }
  body {
    overscroll-behavior-x: none;
  }
  .panel-overlay,
  .panel-content,
  .mob-chat-area {
    overscroll-behavior: contain;
  }
}

/* ── 4. Panel sidebar items — better touch targets ── */
@media (max-width: 768px) {
  .sidebar-item {
    min-height: 40px;
    padding: 8px 10px 8px 0;
  }
  .sidebar-item-text {
    line-height: 1.4;
  }
}

/* ── 5. Smooth momentum scroll on key containers ── */
@media (max-width: 768px) {
  .panel-content,
  .panel-sidebar,
  .hist-list,
  .cwf-table-wrap {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
  }
}

/* ── 6. Input focus ring for accessibility ── */
@media (max-width: 768px) {
  .sb-input:focus,
  .sb-key-input:focus,
  #mainInput:focus,
  #continueInput:focus {
    outline: 2px solid rgba(180,150,80,0.3);
    outline-offset: -2px;
  }
}

/* ── 7. Long text safety net ── */
@media (max-width: 768px) {
  .ai-answer-body,
  .panel-content,
  .topic-body {
    word-break: break-word;
    overflow-wrap: break-word;
  }
  .ai-answer-body pre,
  .panel-content pre,
  .topic-body pre {
    white-space: pre-wrap;
    word-break: break-all;
    overflow-x: auto;
  }
  .ai-answer-body table,
  .topic-body table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}


/* ╔══════════════════════════════════════════════════════════════╗
   ║  DOUBLE DECK SEARCH BAR — FINAL OVERRIDE                   ║
   ║  此块放在文件最末尾，确保覆盖所有分散的 sb- 规则            ║
   ╚══════════════════════════════════════════════════════════════╝ */

/* --- Outer container --- */
#searchBarWrap .search-bar {
  display:flex !important;
  flex-direction:column !important;
  height:auto !important;
  min-height:0 !important;
  border:1px solid rgba(180,150,80,0.12) !important;
  border-radius:4px !important;
  background:rgba(255,255,255,0.02) !important;
  overflow:hidden !important;
  position:relative !important;
  z-index:10 !important;
  flex-wrap:nowrap !important;
}
#searchBarWrap .search-bar:focus-within {
  border-color:rgba(180,150,80,0.25) !important;
}

/* --- Row 1: input row --- */
#searchBarWrap .sb-row1 {
  display:flex !important;
  align-items:center !important;
  height:42px !important;
  min-height:42px !important;
  width:100% !important;
  border-bottom:none !important;
  border-top:none !important;
}

/* --- Icon --- */
#searchBarWrap .sb-icon {
  color:rgba(180,150,80,0.35) !important;
  padding:0 12px 0 14px !important;
  font-size:13px !important;
  flex-shrink:0 !important;
  line-height:1 !important;
  min-height:0 !important;
  height:auto !important;
}

/* --- Input --- */
#searchBarWrap .sb-input {
  flex:1 1 auto !important;
  height:100% !important;
  min-height:0 !important;
  border:none !important;
  outline:none !important;
  background:transparent !important;
  color:rgba(255,255,255,0.9) !important;
  font-size:15px !important;
  font-family:'Noto Sans SC',sans-serif !important;
  padding:0 8px !important;
  min-width:0 !important;
}
#searchBarWrap .sb-input::placeholder {
  color:rgba(255,255,255,0.3) !important;
  font-size:14px !important;
}

/* --- Go button --- */
#searchBarWrap .sb-go {
  font-family:'DM Mono',monospace !important;
  font-size:10px !important;
  letter-spacing:1px !important;
  color:#04040a !important;
  background:#c9a84c !important;
  border:none !important;
  border-radius:0 3px 0 0 !important;
  padding:0 20px !important;
  cursor:pointer !important;
  white-space:nowrap !important;
  height:100% !important;
  min-height:0 !important;
  font-weight:500 !important;
  display:flex !important;
  align-items:center !important;
  justify-content:center !important;
}
#searchBarWrap .sb-go:hover {
  background:#b8943f !important;
}

/* --- Row 2: toolbar --- */
#searchBarWrap .sb-row2 {
  display:flex !important;
  align-items:center !important;
  justify-content:space-between !important;
  padding:0 8px !important;
  height:28px !important;
  min-height:28px !important;
  width:100% !important;
  border-top:1px solid rgba(255,255,255,0.04) !important;
  background:rgba(180,150,80,0.018) !important;
  border-radius:0 0 3px 3px !important;
}
#searchBarWrap .sb-row2-right {
  display:flex !important;
  align-items:center !important;
  gap:10px !important;
  padding-right:4px !important;
}

/* --- Tabs in row2 --- */
#searchBarWrap .sb-tabs {
  display:flex !important;
  align-items:center !important;
  gap:1px !important;
  height:auto !important;
  border-right:none !important;
  flex-shrink:0 !important;
}
#searchBarWrap .sb-tab {
  font-family:'DM Mono',monospace !important;
  font-size:10px !important;
  letter-spacing:0.5px !important;
  color:rgba(255,255,255,0.3) !important;
  background:none !important;
  border:1px solid transparent !important;
  border-radius:3px !important;
  padding:2px 10px !important;
  cursor:pointer !important;
  white-space:nowrap !important;
  height:auto !important;
  min-height:0 !important;
  display:inline-flex !important;
  align-items:center !important;
}
#searchBarWrap .sb-tab:hover {
  color:rgba(255,255,255,0.5) !important;
}
#searchBarWrap .sb-tab.active {
  color:#c9a84c !important;
  border-color:rgba(180,150,80,0.18) !important;
  background:rgba(180,150,80,0.05) !important;
}

/* --- Web toggle in row2 --- */
#searchBarWrap .sb-web-toggle {
  font-family:'DM Mono',monospace !important;
  font-size:10px !important;
  letter-spacing:0.5px !important;
  color:rgba(255,255,255,0.18) !important;
  background:none !important;
  border:1px solid transparent !important;
  border-radius:3px !important;
  padding:2px 10px !important;
  cursor:pointer !important;
  white-space:nowrap !important;
  height:auto !important;
  min-height:0 !important;
  display:inline-flex !important;
  align-items:center !important;
}
#searchBarWrap .sb-web-toggle:hover {
  color:rgba(255,255,255,0.35) !important;
}
#searchBarWrap .sb-web-toggle.active {
  border-color:rgba(34,197,94,0.2) !important;
  color:#22c55e !important;
  background:rgba(34,197,94,0.03) !important;
}

/* --- Info & controls in row2 --- */
#searchBarWrap .sb-info {
  display:flex !important;
  align-items:center !important;
}
#searchBarWrap .sb-info.off { display:none !important; }
#searchBarWrap .sb-stat {
  font-family:'DM Mono',monospace !important;
  font-size:9px !important;
  letter-spacing:1px !important;
  color:rgba(255,255,255,0.18) !important;
}
#searchBarWrap .sb-controls { display:none !important;align-items:center !important; }
#searchBarWrap .sb-controls.on { display:flex !important; }
#searchBarWrap .sb-key-btn {
  font-family:'DM Mono',monospace !important;
  font-size:9px !important;
  letter-spacing:0.5px !important;
  color:rgba(34,197,94,0.6) !important;
  background:none !important;
  border:none !important;
  padding:0 !important;
  min-height:0 !important;
  height:auto !important;
}

/* --- Chips --- */
#searchBarWrap .sb-chips {
  display:flex !important;
  gap:6px !important;
  flex-wrap:wrap !important;
  margin-top:8px !important;
  margin-bottom:12px !important;
}
#searchBarWrap .sb-chip {
  font-family:'DM Mono',monospace !important;
  font-size:11px !important;
  letter-spacing:0.3px !important;
  color:rgba(255,255,255,0.3) !important;
  border:1px solid rgba(255,255,255,0.06) !important;
  border-radius:3px !important;
  padding:5px 12px !important;
  cursor:pointer !important;
  background:transparent !important;
  min-height:0 !important;
  height:auto !important;
  display:inline-flex !important;
  align-items:center !important;
}
#searchBarWrap .sb-chip:hover {
  color:rgba(180,150,80,0.5) !important;
  border-color:rgba(180,150,80,0.12) !important;
}

/* --- Dropdown (needs overflow visible override) --- */
#searchBarWrap .kb-dropdown {
  display:none;
  position:absolute !important;
  top:100% !important;
  left:0 !important;
  right:0 !important;
  z-index:20 !important;
}
#searchBarWrap .kb-dropdown.show { display:block !important; }

/* overflow:hidden clips the dropdown, so override it when dropdown is showing */
#searchBarWrap .search-bar:has(.kb-dropdown.show) {
  overflow:visible !important;
}

/* --- Mobile: 768px --- */
@media (max-width:768px) {
  #searchBarWrap .sb-row1 { height:40px !important;min-height:40px !important; }
  #searchBarWrap .sb-icon { padding:0 10px 0 12px !important;font-size:12px !important; }
  #searchBarWrap .sb-input { font-size:16px !important; }
  #searchBarWrap .sb-go { padding:0 14px !important;font-size:9px !important;border-radius:0 3px 0 0 !important; }
  #searchBarWrap .sb-row2 { height:26px !important;min-height:26px !important;padding:0 6px !important; }
  #searchBarWrap .sb-tab { font-size:9px !important;padding:2px 8px !important; }
  #searchBarWrap .sb-web-toggle { font-size:9px !important;padding:2px 8px !important; }
  #searchBarWrap .sb-chip { font-size:10px !important;padding:4px 10px !important; }
  #searchBarWrap .sb-chips {
    flex-wrap:nowrap !important;overflow-x:auto !important;
    -webkit-overflow-scrolling:touch !important;scrollbar-width:none !important;
    mask-image:linear-gradient(90deg,#000 85%,transparent 100%) !important;
    -webkit-mask-image:linear-gradient(90deg,#000 85%,transparent 100%) !important;
  }
  #searchBarWrap .sb-chips::-webkit-scrollbar { display:none !important; }
  #searchBarWrap .sb-chip { flex-shrink:0 !important;white-space:nowrap !important; }
}

/* --- Mobile: 480px --- */
@media (max-width:480px) {
  #searchBarWrap .sb-row1 { height:38px !important;min-height:38px !important; }
  #searchBarWrap .sb-go { padding:0 12px !important;font-size:9px !important; }
  #searchBarWrap .sb-row2 { height:24px !important;min-height:24px !important; }
  #searchBarWrap .sb-tab { font-size:8px !important;padding:2px 6px !important; }
  #searchBarWrap .sb-web-toggle { font-size:8px !important;padding:2px 6px !important; }
}

/* --- Mobile: 360px --- */
@media (max-width:360px) {
  #searchBarWrap .sb-row1 { height:36px !important;min-height:36px !important; }
  #searchBarWrap .sb-row2 { height:22px !important;min-height:22px !important; }
  #searchBarWrap .sb-go { padding:0 10px !important;font-size:8px !important; }
  #searchBarWrap .sb-tab { font-size:8px !important;padding:1px 5px !important; }
  #searchBarWrap .sb-web-toggle { font-size:8px !important;padding:1px 5px !important; }
}
