:root {
  color-scheme: dark;
  --bg: #050a0f;
  --bg-elevated: #09121a;
  --panel: #0b151e;
  --panel-card: rgba(14, 27, 38, 0.7);
  --line: rgba(155, 222, 218, 0.1);
  --line-strong: rgba(115, 239, 218, 0.3);
  --text: #ecf5f7;
  --text-secondary: #b4cbd3;
  --muted: #7891a1;
  --cyan: #6ef2de;
  --cyan-dim: rgba(110, 242, 222, 0.14);
  --gold: #f5cc7e;
  --gold-dim: rgba(245, 204, 126, 0.15);
  --cinnabar: #e67360;
  --serif: "Songti SC", "STSong", "Noto Serif SC", "Noto Serif CJK SC", "Source Han Serif SC", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  --mono: "SFMono-Regular", "JetBrains Mono", Consolas, "Liberation Mono", Menlo, monospace;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 13px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

button, input, select {
  font: inherit;
}

button, a, input, select {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

a {
  color: var(--cyan);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: #b4fff2;
}

button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

button:disabled {
  opacity: 0.3;
  cursor: default;
  pointer-events: none;
}

[hidden] {
  display: none !important;
}

/* ==================== HEADER ==================== */
header {
  height: 70px;
  padding: 0 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(ellipse at 16% 0%, rgba(110, 242, 222, 0.085), transparent 52%),
    radial-gradient(ellipse at 82% 0%, rgba(245, 204, 126, 0.075), transparent 50%),
    rgba(6, 12, 18, 0.94);
  backdrop-filter: blur(18px);
  position: relative;
  z-index: 10;
}

header::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 8%;
  right: 8%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(110, 242, 222, 0.4), rgba(245, 204, 126, 0.38), transparent);
  pointer-events: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  flex-shrink: 0;
}

.seal {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(245, 204, 126, 0.52);
  background:
    radial-gradient(circle at 28% 24%, rgba(245, 204, 126, 0.24), transparent 65%),
    linear-gradient(145deg, rgba(110, 242, 222, 0.16), rgba(13, 28, 38, 0.9));
  color: var(--gold);
  border-radius: 10px;
  font: 600 22px/1 var(--serif);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    inset 0 0 14px rgba(245, 204, 126, 0.14),
    0 4px 18px rgba(0, 0, 0, 0.45);
  position: relative;
}

.seal::after {
  content: '';
  position: absolute;
  inset: 3px;
  border: 1px solid rgba(245, 204, 126, 0.22);
  border-radius: 7px;
  pointer-events: none;
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.brand strong {
  font: 600 22px/1.15 var(--serif);
  letter-spacing: 5px;
  background: linear-gradient(115deg, #ffffff 12%, #d9f8f2 55%, #f5cc7e 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-sub {
  font: 9.5px/1.2 var(--mono);
  color: var(--muted);
  letter-spacing: 1.4px;
}

.header-center {
  display: flex;
  align-items: center;
  gap: 18px;
}

.shichen-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid rgba(245, 204, 126, 0.34);
  background: linear-gradient(135deg, rgba(245, 204, 126, 0.13), rgba(110, 242, 222, 0.06));
  color: #f8e2b6;
  font-size: 11.5px;
  letter-spacing: 0.4px;
  white-space: nowrap;
  box-shadow: 0 2px 14px rgba(245, 204, 126, 0.09);
}

.shichen-pill:hover {
  border-color: var(--gold);
  background: linear-gradient(135deg, rgba(245, 204, 126, 0.24), rgba(110, 242, 222, 0.12));
  transform: translateY(-1px);
}

.shichen-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 10px var(--gold);
  animation: pulseGlow 2.4s ease-in-out infinite;
}

@keyframes pulseGlow {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.42; transform: scale(0.8); }
}

.header-stats {
  display: flex;
  gap: 16px;
}

.header-stats span {
  font-size: 10.5px;
  color: var(--muted);
  display: flex;
  align-items: baseline;
  gap: 5px;
  white-space: nowrap;
}

.header-stats b {
  font: 500 17px/1 var(--mono);
  color: #e6f3f6;
}

.edition {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.mat-switch {
  display: flex;
  padding: 3px;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(4, 9, 15, 0.7);
}

.mat-switch button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  padding: 5px 9px;
  border-radius: 6px;
  white-space: nowrap;
}

.mat-switch button:hover {
  color: var(--text);
}

.mat-switch button.active {
  background: linear-gradient(135deg, rgba(110, 242, 222, 0.22), rgba(110, 242, 222, 0.08));
  color: var(--cyan);
  box-shadow: inset 0 0 0 1px rgba(110, 242, 222, 0.34);
}

.mat-switch button[data-mat="bronze"].active {
  background: linear-gradient(135deg, rgba(245, 204, 126, 0.24), rgba(186, 135, 72, 0.12));
  color: var(--gold);
  box-shadow: inset 0 0 0 1px rgba(245, 204, 126, 0.42);
}

.mat-switch button[data-mat="xray"].active {
  background: linear-gradient(135deg, rgba(96, 185, 255, 0.24), rgba(30, 80, 140, 0.15));
  color: #8fd3ff;
  box-shadow: inset 0 0 0 1px rgba(143, 211, 255, 0.4);
}

.mat-switch button[data-mat="ivory"].active {
  background: linear-gradient(135deg, rgba(238, 229, 214, 0.22), rgba(190, 178, 158, 0.12));
  color: #f3ece0;
  box-shadow: inset 0 0 0 1px rgba(243, 236, 224, 0.38);
}

.immersive-btn {
  border: 1px solid rgba(110, 242, 222, 0.36);
  border-radius: 8px;
  padding: 6px 12px;
  background: rgba(110, 242, 222, 0.08);
  color: var(--cyan);
  font-size: 11px;
  letter-spacing: 0.6px;
  white-space: nowrap;
}

.immersive-btn:hover {
  background: rgba(110, 242, 222, 0.18);
  border-color: var(--cyan);
  box-shadow: 0 0 18px rgba(110, 242, 222, 0.2);
}

.immersive-btn[aria-pressed="true"] {
  background: var(--cyan);
  color: #051b17;
  font-weight: 600;
}

/* ==================== MAIN LAYOUT ==================== */
main {
  height: calc(100dvh - 102px);
  min-height: 680px;
  display: grid;
  grid-template-columns: 296px minmax(400px, 1fr) 348px;
  gap: 1px;
  background: var(--line);
}

.library, .detail {
  background:
    radial-gradient(ellipse at 50% 0%, rgba(22, 50, 62, 0.34), transparent 64%),
    linear-gradient(168deg, #0b1620 0%, #070e15 100%);
  min-width: 0;
}

/* ==================== LEFT SIDEBAR (LIBRARY) ==================== */
.library {
  padding: 16px 16px 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 7px;
  font: 600 9.5px/1.3 var(--mono);
  letter-spacing: 1.6px;
  color: #6bc4ba;
  text-transform: uppercase;
}

.eyebrow::before {
  content: '';
  width: 11px;
  height: 1.5px;
  background: linear-gradient(90deg, var(--cyan), transparent);
}

.library h1 {
  font: 600 20px/1.25 var(--serif);
  letter-spacing: 2px;
  margin: 6px 0 4px;
  color: #f4f9fa;
}

.muted {
  color: var(--muted);
}

.intro {
  font-size: 11px;
  color: #7c94a3;
  margin: 0 0 10px;
}

.scope {
  display: flex;
  padding: 3px;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(4, 9, 14, 0.65);
  margin-bottom: 8px;
}

.scope button {
  flex: 1;
  background: none;
  border: 0;
  border-radius: 6px;
  padding: 5px 8px;
  color: #8499a8;
  font-size: 11.5px;
  font-weight: 500;
}

.scope button.active {
  background: linear-gradient(135deg, #1b383f, #132830);
  color: var(--cyan);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 2px 8px rgba(0, 0, 0, 0.35);
}

.search {
  height: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(180, 225, 230, 0.14);
  border-radius: 8px;
  padding: 0 10px;
  background: rgba(5, 11, 17, 0.78);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search:focus-within {
  border-color: rgba(110, 242, 222, 0.6);
  box-shadow: 0 0 0 3px rgba(110, 242, 222, 0.1);
}

.search-icon {
  font-size: 16px;
  color: var(--cyan);
  line-height: 1;
}

.search input {
  border: 0;
  background: none;
  outline: none;
  width: 100%;
  min-width: 0;
  color: var(--text);
  font-size: 11.5px;
}

.search input::placeholder {
  color: #597080;
}

.search-kbd {
  font: 10px/1 var(--mono);
  color: #6b8393;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  padding: 2px 5px;
}

.library-filters {
  margin-top: 10px;
}

.filter-head-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
}

.filter-label {
  display: block;
  margin: 0 0 5px;
  color: #8ea5b3;
  font-size: 10.5px;
  letter-spacing: 0.7px;
  font-weight: 500;
}

.filter-head-row .filter-label {
  margin: 0;
}

.filter-mini-tag {
  font-size: 10px;
  color: var(--cyan);
  background: rgba(110, 242, 222, 0.08);
  border: 1px solid rgba(110, 242, 222, 0.2);
  border-radius: 4px;
  padding: 1px 6px;
}

/* 4x4 经脉矩阵 */
.meridian-pills {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

.meridian-pills button {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 5px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.065);
  background: rgba(255, 255, 255, 0.02);
  color: #93a9b6;
  font-size: 10.5px;
  white-space: nowrap;
  overflow: hidden;
}

.meridian-pills button:hover {
  border-color: rgba(110, 242, 222, 0.35);
  color: var(--text);
  background: rgba(110, 242, 222, 0.08);
}

.meridian-pills button.active {
  border-color: rgba(110, 242, 222, 0.58);
  background: rgba(110, 242, 222, 0.14);
  color: var(--cyan);
  font-weight: 500;
  box-shadow: inset 0 0 8px rgba(110, 242, 222, 0.08);
}

.meridian-pills i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.channel-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.meta-tag {
  font-size: 9.5px;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(110, 242, 222, 0.08);
  border: 1px solid rgba(110, 242, 222, 0.22);
  color: #9ce6db;
}

.meta-tag.gold {
  background: rgba(245, 204, 126, 0.1);
  border-color: rgba(245, 204, 126, 0.28);
  color: var(--gold);
}

.channel-summary {
  font-size: 10.5px;
  line-height: 1.45;
  color: #778f9e;
  margin: 5px 0 8px;
}

/* 4x2 解剖区域矩阵 */
.chips {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

.chips button {
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(255, 255, 255, 0.02);
  color: #92a6b3;
  border-radius: 6px;
  padding: 4px 4px;
  font-size: 10.5px;
  text-align: center;
}

.chips button.active, .chips button:hover {
  border-color: rgba(110, 242, 222, 0.5);
  background: rgba(110, 242, 222, 0.13);
  color: var(--cyan);
}

.list-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 10px 0 6px;
  padding-top: 7px;
  border-top: 1px solid var(--line);
  color: #7ea0ad;
  font-size: 11px;
}

.list-head button {
  border: 0;
  background: none;
  color: #8ca3b0;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
}

.list-head button:hover {
  color: var(--cyan);
  background: rgba(110, 242, 222, 0.08);
}

.point-list {
  overflow-y: auto;
  flex: 1;
  min-height: 130px;
  padding-right: 4px;
}

.point-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.014);
  border-radius: 8px;
  color: #b4c6d1;
  padding: 7px 9px;
  margin: 0 0 4px;
  gap: 8px;
}

.point-row:hover {
  background: rgba(255, 255, 255, 0.045);
  border-color: rgba(165, 224, 220, 0.15);
  transform: translateX(2px);
}

.point-row.active {
  background: linear-gradient(90deg, rgba(110, 242, 222, 0.16), rgba(110, 242, 222, 0.03));
  border-color: rgba(110, 242, 222, 0.36);
  box-shadow: inset 3px 0 0 var(--cyan), 0 4px 12px rgba(0, 0, 0, 0.25);
}

.point-row b {
  font-size: 13px;
  font-weight: 600;
  color: #e6f2f5;
  display: flex;
  align-items: center;
}

.point-row small {
  display: block;
  font-size: 10px;
  color: #708898;
  margin-top: 2px;
}

.point-row > span:last-child {
  font: 500 10px var(--mono);
  color: #8cb2ad;
  background: rgba(110, 242, 222, 0.06);
  border: 1px solid rgba(110, 242, 222, 0.14);
  padding: 2px 6px;
  border-radius: 5px;
  flex-shrink: 0;
}

.row-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-right: 6px;
  box-shadow: 0 0 7px currentColor;
  flex-shrink: 0;
}

.key-badge {
  font-size: 9px;
  font-style: normal;
  font-weight: 500;
  background: rgba(245, 204, 126, 0.13);
  color: var(--gold);
  border: 1px solid rgba(245, 204, 126, 0.32);
  border-radius: 4px;
  padding: 0 4px;
  margin-left: 5px;
}

.fx-badge {
  font-size: 9px;
  font-style: normal;
  background: rgba(110, 242, 222, 0.1);
  color: var(--cyan);
  border: 1px solid rgba(110, 242, 222, 0.24);
  border-radius: 4px;
  padding: 0 4px;
  margin-left: 4px;
}

.library-foot {
  font-size: 9.5px;
  color: #577182;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* ==================== CENTER STAGE ==================== */
.stage {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(ellipse 58% 50% at 50% 45%, rgba(22, 72, 82, 0.38), transparent 68%),
    radial-gradient(ellipse 46% 36% at 80% 15%, rgba(36, 62, 110, 0.22), transparent 62%),
    radial-gradient(ellipse 48% 28% at 50% 90%, rgba(245, 204, 126, 0.09), transparent 66%),
    #040a10;
  color: var(--text);
}

.stage::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(135, 215, 220, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(135, 215, 220, 0.025) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse at 50% 48%, #000 32%, transparent 82%);
}

.stage::after {
  content: '';
  position: absolute;
  inset: 11px;
  pointer-events: none;
  border: 1px solid rgba(120, 225, 215, 0.085);
  border-radius: 15px;
  z-index: 2;
  box-shadow: inset 0 0 48px rgba(0, 0, 0, 0.38);
}

.stage-top {
  position: absolute;
  left: 22px;
  right: 22px;
  top: 62px;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10.5px;
  color: #b8d0d4;
  pointer-events: none;
}

.stage-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(8, 19, 28, 0.72);
  border: 1px solid rgba(110, 242, 222, 0.2);
  backdrop-filter: blur(8px);
}

.live-dot {
  height: 6px;
  width: 6px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 12px var(--cyan);
}

.filter-pill {
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(245, 204, 126, 0.14);
  border: 1px solid rgba(245, 204, 126, 0.35);
  color: var(--gold);
  font-size: 10px;
}

.hint {
  margin-left: auto;
  font: 10.5px var(--mono);
  color: #84a5b0;
  background: rgba(8, 19, 28, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 3px 10px;
  border-radius: 999px;
}

.stage-watermark {
  position: absolute;
  top: 104px;
  left: 26px;
  pointer-events: none;
  z-index: 0;
  user-select: none;
}

.stage-watermark span {
  display: block;
  font: 9px var(--mono);
  letter-spacing: 3.2px;
  color: rgba(125, 168, 182, 0.42);
}

.stage-watermark strong {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font: 600 clamp(28px, 3.2vw, 46px)/1.1 var(--serif);
  letter-spacing: 5px;
  color: rgba(160, 215, 222, 0.075);
  margin-top: 3px;
}

.stage-watermark strong small {
  font: 200 clamp(15px, 1.6vw, 22px)/1 var(--sans);
  letter-spacing: 3.5px;
}

.stage-caption {
  position: absolute;
  top: 186px;
  left: 28px;
  font: 11.5px/1.8 var(--serif);
  color: rgba(120, 162, 175, 0.38);
  letter-spacing: 5px;
  writing-mode: vertical-rl;
  pointer-events: none;
  user-select: none;
}

.stage-axis {
  position: absolute;
  right: 24px;
  top: 148px;
  bottom: 160px;
  width: 10px;
  background: repeating-linear-gradient(to bottom, rgba(119, 185, 197, 0.2) 0 1px, transparent 1px 18px);
  border-left: 1px solid rgba(119, 185, 197, 0.13);
  pointer-events: none;
}

.stage-axis::before {
  content: 'SUPERIOR · 巅';
  position: absolute;
  right: 0;
  top: -20px;
  white-space: nowrap;
  font: 8px var(--mono);
  letter-spacing: 1.4px;
  color: #557886;
}

.stage-axis::after {
  content: 'INFERIOR · 足';
  position: absolute;
  right: 0;
  bottom: -20px;
  white-space: nowrap;
  font: 8px var(--mono);
  letter-spacing: 1.4px;
  color: #557886;
}

#canvas, #leaderLines, #labels, #effectLabels {
  position: absolute;
  inset: 0;
}

#canvas {
  z-index: 1;
}

#canvas canvas {
  display: block;
  touch-action: none;
  cursor: grab;
}

#canvas canvas:active {
  cursor: grabbing;
}

.leader-lines {
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

.leader-path {
  fill: none;
  stroke: rgba(155, 224, 224, 0.34);
  stroke-width: 1;
}

.leader-path.key {
  stroke: rgba(245, 204, 126, 0.45);
}

.leader-path.selected {
  stroke: #f5cc7e;
  stroke-width: 1.4;
  filter: drop-shadow(0 0 4px rgba(245, 204, 126, 0.55));
}

.leader-path.effect {
  stroke: rgba(110, 242, 222, 0.72);
  stroke-width: 1.25;
  stroke-dasharray: 3.5 2.5;
  filter: drop-shadow(0 0 5px rgba(110, 242, 222, 0.45));
}

.leader-dot {
  fill: rgba(175, 238, 232, 0.7);
}

.leader-dot.key {
  fill: var(--gold);
}

.leader-dot.selected {
  fill: #fff6d6;
}

.leader-dot.effect {
  fill: var(--cyan);
}

#labels, #effectLabels {
  pointer-events: none;
  z-index: 3;
}

.pin-label {
  position: absolute;
  white-space: nowrap;
  pointer-events: auto;
  background: rgba(8, 19, 29, 0.84);
  border: 1px solid rgba(165, 230, 235, 0.2);
  backdrop-filter: blur(10px);
  border-radius: 6px;
  color: #cbe2e6;
  padding: 2px 8px;
  font-size: 11px;
  line-height: 1.45;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.35);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: transform 0.16s, border-color 0.16s, box-shadow 0.16s;
}

.pin-label[data-align="right"] {
  transform: translate(0, -50%);
}

.pin-label[data-align="left"] {
  transform: translate(-100%, -50%);
  flex-direction: row-reverse;
}

.pin-label::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--pin-color, var(--cyan));
  box-shadow: 0 0 6px var(--pin-color, var(--cyan));
  flex-shrink: 0;
}

.pin-label:hover {
  border-color: var(--cyan);
  color: #fff;
  z-index: 7;
}

.key-label {
  color: #fae3b5;
  border-color: rgba(245, 204, 126, 0.36);
  background: rgba(19, 24, 29, 0.88);
}

.key-label::before {
  background: var(--gold);
  box-shadow: 0 0 8px var(--gold);
}

.pin-label.selected {
  background: linear-gradient(135deg, rgba(46, 39, 25, 0.95), rgba(20, 30, 34, 0.95));
  color: #fff4d4;
  border-color: var(--gold);
  font-weight: 600;
  padding: 3px 9px;
  box-shadow: 0 0 22px rgba(245, 204, 126, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.14);
  z-index: 6;
}

.pin-label small {
  font: 500 9.5px var(--mono);
  color: var(--gold);
  opacity: 0.85;
}

.effect-label {
  position: absolute;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(5, 36, 36, 0.92);
  border: 1px solid rgba(110, 242, 222, 0.68);
  backdrop-filter: blur(10px);
  color: #d6fff8;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 500;
  box-shadow: 0 4px 18px rgba(110, 242, 222, 0.25);
}

.effect-label[data-align="right"] {
  transform: translate(0, -50%);
}

.effect-label[data-align="left"] {
  transform: translate(-100%, -50%);
  flex-direction: row-reverse;
}

.effect-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 8px var(--gold);
  flex-shrink: 0;
}

.hover-tip {
  position: absolute;
  z-index: 9;
  pointer-events: none;
  transform: translate(-50%, calc(-100% - 14px));
  background: rgba(7, 17, 26, 0.95);
  border: 1px solid rgba(245, 204, 126, 0.58);
  border-radius: 8px;
  padding: 6px 10px;
  color: #fff;
  font-size: 11.5px;
  white-space: nowrap;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.52);
  backdrop-filter: blur(10px);
}

.hover-tip small {
  color: var(--gold);
  font-family: var(--mono);
  margin-left: 5px;
}

.stage-hud-top {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  z-index: 4;
  white-space: nowrap;
}

.view-switch {
  display: flex;
  padding: 3px;
  gap: 2px;
  border: 1px solid rgba(164, 213, 222, 0.16);
  border-radius: 10px;
  background: rgba(7, 16, 25, 0.85);
  backdrop-filter: blur(14px);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.35);
}

.view-switch button {
  background: none;
  border: 0;
  color: #8ba3b0;
  border-radius: 7px;
  padding: 5px 11px;
  font-size: 11px;
}

.view-switch button:hover {
  color: var(--text);
}

.view-switch button.active {
  background: linear-gradient(135deg, rgba(110, 242, 222, 0.22), rgba(33, 68, 70, 0.7));
  color: var(--cyan);
  box-shadow: inset 0 0 0 1px rgba(110, 242, 222, 0.32);
}

.side-choice {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  color: #84a0ae;
  background: rgba(7, 16, 25, 0.8);
  border: 1px solid rgba(164, 213, 222, 0.16);
  padding: 4px 10px;
  border-radius: 10px;
  backdrop-filter: blur(12px);
}

.side-choice select {
  padding: 1px 4px;
  border: 0;
  background: transparent;
  color: var(--cyan);
  font-size: 10.5px;
  font-weight: 500;
  cursor: pointer;
}

.marker-legend {
  position: absolute;
  bottom: 132px;
  left: 22px;
  display: grid;
  gap: 5px;
  z-index: 3;
  pointer-events: none;
  font-size: 10px;
  color: #9bb5be;
  max-width: 165px;
  background: rgba(7, 16, 25, 0.68);
  border: 1px solid rgba(164, 213, 222, 0.12);
  backdrop-filter: blur(10px);
  padding: 9px 11px;
  border-radius: 10px;
}

.legend-title {
  font-size: 9px;
  letter-spacing: 1.4px;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 1px;
}

.marker-legend span {
  display: flex;
  align-items: center;
  gap: 7px;
}

.marker-legend i {
  display: inline-block;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend-key {
  width: 8px;
  height: 8px;
  background: var(--gold);
  box-shadow: 0 0 9px var(--gold);
}

.legend-normal {
  width: 6px;
  height: 6px;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
  margin: 0 1px;
}

.legend-needle {
  width: 10px;
  height: 2px;
  border-radius: 2px !important;
  background: linear-gradient(90deg, #fff4c2, var(--gold));
  box-shadow: 0 0 6px var(--gold);
}

.legend-flow {
  width: 10px;
  height: 2.5px;
  border-radius: 3px !important;
  background: linear-gradient(90deg, var(--gold), var(--cyan));
}

.marker-legend small {
  font-size: 9px;
  color: #607d8a;
  line-height: 1.45;
  margin-top: 2px;
}

.stage-title {
  position: absolute;
  bottom: 78px;
  left: 24px;
  z-index: 3;
  pointer-events: none;
}

.stage-title span {
  display: block;
  font: 8.5px var(--mono);
  color: #5e929e;
  letter-spacing: 2.4px;
}

.stage-title strong {
  display: block;
  font-size: 10.5px;
  font-weight: 400;
  color: #7d9aa7;
  margin-top: 2px;
}

.zoom {
  position: absolute;
  right: 22px;
  bottom: 78px;
  display: grid;
  gap: 5px;
  z-index: 4;
}

.zoom button {
  width: 34px;
  height: 34px;
  background: rgba(10, 22, 33, 0.84);
  border: 1px solid rgba(164, 213, 222, 0.2);
  backdrop-filter: blur(10px);
  color: #b4d0d8;
  border-radius: 9px;
  font-size: 16px;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.32);
}

.zoom button:hover {
  border-color: var(--cyan);
  color: var(--cyan);
  background: rgba(18, 42, 56, 0.92);
}

.bottom-tools {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 13px;
  white-space: nowrap;
  padding: 8px 15px;
  border: 1px solid rgba(180, 219, 227, 0.16);
  border-radius: 12px;
  background: rgba(8, 19, 29, 0.86);
  backdrop-filter: blur(16px);
  z-index: 4;
  color: #9cb6c2;
  font-size: 11px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.45);
}

.bottom-tools label {
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  user-select: none;
}

.bottom-tools label:hover {
  color: var(--text);
}

input[type="checkbox"] {
  accent-color: var(--cyan);
  width: 13px;
  height: 13px;
  cursor: pointer;
}

.tool-sep {
  width: 1px;
  height: 15px;
  background: var(--line);
}

.bottom-tools button {
  background: rgba(110, 242, 222, 0.08);
  border: 1px solid rgba(110, 242, 222, 0.28);
  border-radius: 7px;
  padding: 4px 10px;
  color: #a9dcd4;
  font-size: 10.5px;
}

.bottom-tools button:hover {
  border-color: var(--cyan);
  color: #fff;
}

.bottom-tools button.active {
  background: rgba(110, 242, 222, 0.22);
  border-color: var(--cyan);
  color: var(--cyan);
  box-shadow: 0 0 14px rgba(110, 242, 222, 0.2);
}

/* ==================== RIGHT SIDEBAR (DETAIL DOSSIER) ==================== */
.detail {
  padding: 16px 16px 20px;
  overflow-y: auto;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.detail::before {
  content: '';
  position: absolute;
  top: 0;
  left: 18px;
  right: 18px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(245, 204, 126, 0.58), rgba(110, 242, 222, 0.58), transparent);
}

.detail-header-card {
  padding: 14px;
  border-radius: 12px;
  border: 1px solid rgba(245, 204, 126, 0.22);
  background:
    radial-gradient(ellipse at 95% 5%, rgba(245, 204, 126, 0.13), transparent 65%),
    radial-gradient(ellipse at 10% 90%, rgba(110, 242, 222, 0.08), transparent 60%),
    rgba(11, 22, 32, 0.8);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 8px 22px rgba(0, 0, 0, 0.26);
}

.detail-eyebrow-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.model-status {
  font-size: 10px;
  color: #79b8aa;
  margin: 0;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(110, 242, 222, 0.08);
  border: 1px solid rgba(110, 242, 222, 0.22);
  white-space: nowrap;
  flex-shrink: 0;
}

.model-status.important {
  color: var(--gold);
  background: rgba(245, 204, 126, 0.12);
  border-color: rgba(245, 204, 126, 0.35);
}

.detail-top {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.code {
  font: 600 11.5px var(--mono);
  letter-spacing: 1.2px;
  color: var(--gold);
  border: 1px solid rgba(245, 204, 126, 0.38);
  background: rgba(245, 204, 126, 0.1);
  padding: 2px 8px;
  border-radius: 5px;
}

.element-badge {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 5px;
  border: 1px solid rgba(110, 242, 222, 0.25);
  background: rgba(110, 242, 222, 0.08);
  color: #a8ebe0;
}

.special-badge {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 5px;
  border: 1px solid rgba(230, 115, 96, 0.48);
  background: rgba(230, 115, 96, 0.14);
  color: #ffb8ac;
  font-weight: 500;
}

.mini-badge {
  font-size: 10px;
  color: #849dab;
  margin-left: auto;
}

.title-block {
  display: flex;
  align-items: baseline;
  gap: 11px;
  margin: 8px 0 8px;
}

h2 {
  font: 600 38px/1.15 var(--serif);
  letter-spacing: 5px;
  margin: 0;
  color: #fcf8ef;
  text-shadow: 0 0 28px rgba(245, 204, 126, 0.2);
}

.pinyin {
  font: italic 12.5px Georgia, serif;
  letter-spacing: 1.2px;
  color: #aaa698;
  margin: 0;
}

.meridian-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.meridian {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border: 1px solid rgba(110, 242, 222, 0.28);
  border-radius: 6px;
  background: rgba(110, 242, 222, 0.09);
  color: #9be0d4;
  font-size: 11px;
  font-weight: 500;
}

.channel-total {
  font-size: 10px;
  color: #7c95a4;
}

.focus {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  border: 1px solid rgba(110, 242, 222, 0.45);
  border-radius: 8px;
  background: linear-gradient(115deg, rgba(40, 88, 80, 0.85), rgba(20, 48, 50, 0.85));
  color: #d8fff5;
  padding: 8px 13px;
  margin-top: 11px;
  font-size: 11.5px;
  font-weight: 500;
  box-shadow: 0 4px 16px rgba(110, 242, 222, 0.1);
}

.focus:hover {
  border-color: var(--cyan);
  box-shadow: 0 0 20px rgba(110, 242, 222, 0.25);
  transform: translateY(-1px);
}

.info-card {
  padding: 11px 13px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel-card);
}

.section-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.8px;
  color: #7eb2c2;
  margin: 0 0 6px;
}

.section-label span {
  font: 600 9.5px var(--mono);
  color: var(--cyan);
  background: rgba(110, 242, 222, 0.1);
  padding: 1px 5px;
  border-radius: 4px;
}

.location {
  font-size: 13px;
  line-height: 1.65;
  color: #e0ecf2;
  margin: 0 0 8px;
}

.tip-box {
  display: flex;
  gap: 7px;
  align-items: flex-start;
  padding: 7px 9px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.025);
  border-left: 2px solid rgba(110, 242, 222, 0.42);
}

.tip-icon {
  color: var(--gold);
  font-size: 10.5px;
  line-height: 1.6;
}

.detail .muted, .route-info {
  font-size: 11px;
  line-height: 1.6;
  color: #8ba3b2;
  margin: 0;
}

.shichen-detail {
  margin-top: 7px;
  padding-top: 7px;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
  font-size: 10.5px;
  color: #b7c8d1;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.shichen-detail b {
  color: var(--gold);
  font-weight: 500;
}

/* ==================== NEIGHBOR MERIDIAN CHAIN ==================== */
.neighbor-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.neighbor-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  color: #7c99a8;
}

.neighbor-nav button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: #b4cad3;
  border-radius: 5px;
  padding: 2px 7px;
}

.neighbor-nav button:hover {
  border-color: var(--cyan);
  color: var(--cyan);
}

.meridian-progress {
  height: 3px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  margin-top: 8px;
  overflow: hidden;
}

.meridian-progress i {
  display: block;
  height: 100%;
  width: 20%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--cyan), var(--gold));
  transition: width 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.nearby {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.nearby button {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.02);
  color: #93aab7;
  padding: 4px 7px;
  font-size: 10.5px;
  text-align: left;
}

.nearby button:hover {
  border-color: rgba(110, 242, 222, 0.36);
  color: var(--text);
}

.nearby small {
  display: block;
  font: 8.5px var(--mono);
  color: #5e7e8c;
}

.nearby button.active {
  background: linear-gradient(135deg, rgba(110, 242, 222, 0.16), rgba(110, 242, 222, 0.04));
  border-color: rgba(110, 242, 222, 0.5);
  color: var(--cyan);
  font-weight: 600;
}

/* ==================== EFFECTS CARD ==================== */
.effects-card {
  position: relative;
  padding: 13px;
  border: 1px solid rgba(110, 242, 222, 0.25);
  border-radius: 11px;
  background:
    radial-gradient(ellipse at 100% 0%, rgba(110, 242, 222, 0.13), transparent 70%),
    rgba(10, 25, 31, 0.75);
}

.effects-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.effects-header .section-label {
  margin: 0;
  color: #82d4c5;
}

.effect-kind {
  font-size: 9.5px;
  color: var(--gold);
  background: rgba(245, 204, 126, 0.1);
  border: 1px solid rgba(245, 204, 126, 0.28);
  padding: 1px 7px;
  border-radius: 999px;
}

.effects-card strong {
  display: block;
  font-size: 12.5px;
  line-height: 1.55;
  font-weight: 600;
  color: #c4f7eb;
  margin: 5px 0 3px;
}

.effects-card p, .effects-card small {
  font-size: 10.5px;
  line-height: 1.6;
  color: #89a8b5;
  margin: 3px 0 6px;
}

.source-link {
  display: inline-block;
  font-size: 10.5px;
  color: var(--cyan);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.effect-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  margin: 9px 0;
  color: #a3cbc4;
  font-size: 10.5px;
}

.toggle-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-right: auto;
  cursor: pointer;
}

.effect-controls button, #effectExamples button {
  border: 1px solid rgba(110, 242, 222, 0.25);
  border-radius: 5px;
  background: rgba(110, 242, 222, 0.08);
  color: #a3d4c9;
  padding: 3px 7px;
  font-size: 10px;
}

.effect-controls button:hover, #effectExamples button:hover {
  border-color: var(--cyan);
  background: rgba(110, 242, 222, 0.18);
  color: #fff;
}

.examples-label {
  font-size: 9.5px;
  color: #6f94a0;
  margin-bottom: 4px;
}

#effectExamples {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

#effectExamples button.active {
  border-color: var(--gold);
  background: rgba(245, 204, 126, 0.16);
  color: var(--gold);
}

.effect-disclaimer {
  display: block;
  font-size: 9.5px !important;
  color: #5b7c8a !important;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 6px;
}

.note {
  margin-top: 2px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
  font-size: 10px;
  color: #5b7788;
  line-height: 1.65;
}

.note strong {
  font-weight: 500;
  color: #88a0ae;
}

.note a {
  color: #77aba6;
}

/* ==================== FOOTER ==================== */
footer {
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  border-top: 1px solid var(--line);
  background: #050a0f;
  font: 9.5px var(--mono);
  letter-spacing: 0.9px;
  color: #4f6c7c;
}

#error {
  position: absolute;
  top: 35%;
  left: 10%;
  right: 10%;
  z-index: 10;
  background: rgba(18, 32, 42, 0.95);
  border: 1px solid var(--gold);
  padding: 24px;
  border-radius: 12px;
  text-align: center;
}

::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

::-webkit-scrollbar-thumb {
  background: rgba(110, 242, 222, 0.2);
  border-radius: 8px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(110, 242, 222, 0.38);
}

::-webkit-scrollbar-track {
  background: transparent;
}

/* ==================== IMMERSIVE MODE ==================== */
.immersive main {
  grid-template-columns: 1fr;
}

.immersive .library, .immersive .detail {
  display: none;
}

.immersive .stage-watermark {
  left: 4%;
  top: 12%;
}

.immersive .stage-caption {
  left: 4%;
}

.immersive .stage {
  min-height: 0;
}

.stage-watermark, .stage-caption, .stage-axis {
  animation: appear 1s ease both;
}

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

/* ==================== RESPONSIVE BREAKPOINTS ==================== */
@media (min-width: 1600px) {
  main {
    grid-template-columns: 324px minmax(480px, 1fr) 375px;
  }
}

@media (max-width: 1280px) and (min-width: 901px) {
  main {
    grid-template-columns: 262px minmax(340px, 1fr) 300px;
  }
  .header-stats {
    display: none;
  }
  .stage-caption {
    display: none;
  }
}

@media (max-width: 900px) {
  header {
    height: auto;
    padding: 10px 14px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .brand-sub, .header-stats {
    display: none;
  }
  .header-center {
    order: 3;
    width: 100%;
    justify-content: flex-start;
  }
  main {
    height: auto;
    min-height: 0;
    grid-template-columns: 1fr;
  }
  .stage {
    grid-row: 1;
    height: 74dvh;
    min-height: 520px;
  }
  .library {
    max-height: 600px;
  }
  .point-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
  }
  .stage-caption {
    display: none;
  }
  footer span:nth-child(2) {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
