/* BigMap Cesium API Docs — 浅色「白地图」：纸面白 + 浅灰网格 + 海图青主色（文档 + 调试台） */
:root {
  --bg-deep: #f0f4f8;
  --bg-mid: #e2e8f0;
  --bg-panel: rgba(255, 255, 255, 0.94);
  --bg-panel-solid: #ffffff;
  --border: rgba(15, 23, 42, 0.09);
  --border-strong: rgba(14, 165, 233, 0.35);
  --accent: #0284c7;
  --accent-hover: #0369a1;
  --accent-dim: rgba(14, 165, 233, 0.1);
  --accent-glow: rgba(14, 165, 233, 0.22);
  --sky: #0ea5e9;
  --sky-dim: rgba(14, 165, 233, 0.08);
  --violet: #6366f1;
  --violet-dim: rgba(99, 102, 241, 0.08);
  --text: #0f172a;
  --text-muted: #64748b;
  --danger: #e11d48;
  --radius: 16px;
  --radius-sm: 10px;
  --font: "DM Sans", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Code", "Consolas", monospace;
  --nav-width: clamp(300px, 26vw, 360px);
  --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px -4px rgba(15, 23, 42, 0.08);
  --shadow-float: 0 12px 40px -8px rgba(15, 23, 42, 0.12);
  /* 全局滚动条（Firefox scrollbar-color + WebKit） */
  --sb-size: 10px;
  --sb-track: rgba(241, 245, 249, 0.92);
  --sb-thumb-top: #e0f2fe;
  --sb-thumb-mid: #7dd3fc;
  --sb-thumb-bot: #38bdf8;
  --sb-thumb-hover: #0ea5e9;
  --sb-thumb-active: #0284c7;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  color-scheme: light;
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg-deep);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* 全局滚动条样式（侧栏、主文、代码块、调试台等所有可滚动区域） */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--sb-thumb-mid) var(--sb-track);
}

*::-webkit-scrollbar {
  width: var(--sb-size);
  height: var(--sb-size);
}

*::-webkit-scrollbar-track {
  background: var(--sb-track);
  border-radius: 999px;
  margin: 2px;
}

*::-webkit-scrollbar-thumb {
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.55);
  background: linear-gradient(165deg, var(--sb-thumb-top) 0%, var(--sb-thumb-mid) 45%, var(--sb-thumb-bot) 100%);
  box-shadow: inset 0 0 0 1px rgba(14, 165, 233, 0.12);
}

*::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(165deg, #bae6fd 0%, var(--sb-thumb-hover) 55%, #0284c7 100%);
  border-color: rgba(255, 255, 255, 0.75);
}

*::-webkit-scrollbar-thumb:active {
  background: var(--sb-thumb-active);
}

*::-webkit-scrollbar-corner {
  background: transparent;
}

/* 背景：白地图纸感 + 极淡水域色晕 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(ellipse 90% 70% at 12% 18%, rgba(186, 230, 253, 0.45), transparent 52%),
    radial-gradient(ellipse 80% 60% at 92% 12%, rgba(224, 242, 254, 0.55), transparent 48%),
    radial-gradient(ellipse 70% 55% at 50% 100%, rgba(226, 232, 240, 0.9), transparent 55%),
    linear-gradient(180deg, #fbfcfe 0%, #f0f4f8 42%, #eef2f7 100%);
  pointer-events: none;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.16) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.16) 1px, transparent 1px);
  background-size: 48px 48px;
  background-position: -1px -1px;
  pointer-events: none;
  opacity: 0.65;
}

/* 仅文档首页：极淡氛围（不压暗纸面） */
.docs-index .docs-ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(circle 380px at 10% 8%, rgba(14, 165, 233, 0.06), transparent 70%),
    radial-gradient(circle 320px at 88% 6%, rgba(56, 189, 248, 0.05), transparent 65%);
}

.docs-index .docs-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 50;
  pointer-events: none;
  overflow: hidden;
}

.docs-index .docs-topbar__glow {
  display: block;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(14, 165, 233, 0.55) 28%,
    rgba(56, 189, 248, 0.75) 50%,
    rgba(14, 165, 233, 0.5) 72%,
    transparent 100%
  );
  filter: blur(0.5px);
  opacity: 0.9;
}

.docs-index .docs-topbar__line {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #0ea5e9, #0284c7, #0369a1);
  opacity: 0.55;
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse-border {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(14, 165, 233, 0.12);
  }
  50% {
    box-shadow: 0 0 20px 2px rgba(14, 165, 233, 0.18);
  }
}

@keyframes shimmer {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 200% 50%;
  }
}

.app-shell {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* —— 侧栏 —— */
.sidebar {
  width: var(--nav-width);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 55%, #f1f5f9 100%);
  backdrop-filter: blur(12px) saturate(1.05);
  -webkit-backdrop-filter: blur(12px) saturate(1.05);
  box-shadow: 4px 0 24px rgba(15, 23, 42, 0.04);
  animation: fade-up 0.55s ease-out;
}

/* 文档首页：侧栏占满一屏高度，API 列表在 #navRoot 内滚动 */
.docs-index .sidebar {
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
}

.sidebar-header {
  padding: 1.5rem 1.25rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background:
    linear-gradient(135deg, rgba(224, 242, 254, 0.65) 0%, transparent 58%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.9) 0%, transparent 100%);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 0.85rem;
}

.sidebar-brand__mark {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 3.125rem;
  height: 3.125rem;
  padding: 0;
  border-radius: 15px;
  overflow: hidden;
  color: transparent;
  font-size: 0;
  line-height: 0;
  background:
    linear-gradient(145deg, #ffffff 0%, #e0f2fe 42%, #bae6fd 100%);
  border: 1px solid rgba(14, 165, 233, 0.22);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.9),
    0 6px 18px rgba(14, 165, 233, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    inset 0 -1px 4px rgba(14, 165, 233, 0.08);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.sidebar-brand__mark::after {
  content: "";
  position: absolute;
  inset: -40%;
  background: conic-gradient(from 210deg, transparent 0deg, rgba(255, 255, 255, 0.65) 38deg, transparent 76deg);
  opacity: 0.45;
  pointer-events: none;
  animation: bm-mark-shine 6s ease-in-out infinite;
}

@keyframes bm-mark-shine {
  0%,
  100% {
    transform: rotate(0deg);
  }
  50% {
    transform: rotate(18deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar-brand__mark::after {
    animation: none;
    opacity: 0.25;
  }

  .sidebar-brand:hover .sidebar-brand__mark {
    transform: none;
  }
}

.sidebar-brand:hover .sidebar-brand__mark {
  transform: scale(1.04) translateY(-1px);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.95),
    0 10px 26px rgba(14, 165, 233, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    inset 0 -1px 4px rgba(14, 165, 233, 0.06);
}

.sidebar-brand__svg {
  position: relative;
  z-index: 1;
  display: block;
  width: 88%;
  height: 88%;
  filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.9)) drop-shadow(0 1px 1px rgba(15, 23, 42, 0.12));
}

.sidebar-brand__svg text {
  text-rendering: geometricPrecision;
}

.sidebar-brand__text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.sidebar-brand__kicker {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.sidebar-brand__title {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  background: linear-gradient(105deg, #0f172a 0%, #1e3a5f 45%, #0369a1 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer 8s ease-in-out infinite alternate;
}

.nav-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.65rem 0 0.75rem;
  -webkit-overflow-scrolling: touch;
}

.sidebar-doc-intro {
  flex-shrink: 0;
  padding: 0.5rem 1rem 1rem;
  border-top: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.95) 0%, #ffffff 100%);
}

.sidebar-doc-intro__btn {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border-radius: 10px;
  border: 1px solid rgba(14, 165, 233, 0.28);
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  color: #0c4a6e;
  font-size: 0.78rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
}

.sidebar-doc-intro__btn:hover {
  border-color: rgba(14, 165, 233, 0.45);
  background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
  transform: translateY(-1px);
}

.nav-group {
  margin-top: 0.4rem;
}

/* 文档首页：隐藏首个分组「链式子属性」整块（标题 + 子链接） */
.docs-index #navRoot > .nav-group:first-child {
  display: none;
}

/* 文档首页：隐藏「动态调用 invoke」整块（分类标题 + 子链接） */
.docs-index #navRoot > .nav-group[data-cat="invoke"] {
  display: none;
}

/* 文档首页：隐藏「AOI 点击与空间查询」整块（分类标题 + 子链接） */
.docs-index #navRoot > .nav-group[data-cat="aoi-click"] {
  display: none;
}

/* 文档首页：隐藏「建筑编辑器（DOM 依赖）」整块 */
.docs-index #navRoot > .nav-group[data-cat="editor"] {
  display: none;
}

/* 侧栏不展示该条目（仍可通过 URL hash 打开详情） */
.docs-index #navRoot .nav-link[data-id="LoadLBqxtiles"],
.docs-index #navRoot .nav-link[data-id="loadModelFromUrl"],
.docs-index #navRoot .nav-link[data-id="triggerUploadLocalModel"],
.docs-index #navRoot .nav-link[data-id="applyFencengToModelHandle"] {
  display: none;
}

.nav-group-title {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.62rem 1.1rem;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  border-radius: 0 12px 12px 0;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}

.nav-group-title:hover {
  background: linear-gradient(90deg, var(--accent-dim), transparent);
  color: var(--accent-hover);
}

.nav-group-title .chev {
  display: inline-block;
  width: 0.4rem;
  height: 0.4rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.25s ease;
  flex-shrink: 0;
  opacity: 0.75;
  margin-top: -2px;
}

.nav-group.open .nav-group-title .chev {
  transform: rotate(45deg);
  margin-top: 2px;
}

.nav-group-title__label {
  flex: 1;
  min-width: 0;
}

.nav-group-items {
  display: none;
  padding: 0.2rem 0 0.45rem;
  margin: 0 0.4rem 0 0.65rem;
  border-left: 2px solid rgba(14, 165, 233, 0.2);
}

.nav-group.open .nav-group-items {
  display: block;
  animation: fade-up 0.35s ease-out;
}

.nav-link {
  display: block;
  padding: 0.42rem 0.85rem 0.42rem 1rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.78rem;
  font-family: var(--mono);
  font-weight: 450;
  line-height: 1.42;
  overflow-wrap: break-word;
  word-break: break-word;
  border-radius: 0 10px 10px 0;
  transition: color 0.15s, background 0.15s, transform 0.15s, border-color 0.15s;
  border-left: 2px solid transparent;
}

.nav-link:hover {
  color: var(--text);
  background: rgba(14, 165, 233, 0.06);
}

.nav-link.active {
  color: var(--accent-hover);
  background: linear-gradient(90deg, var(--accent-dim), rgba(14, 165, 233, 0.06));
  border-left-color: var(--sky);
  box-shadow: inset 0 0 20px rgba(14, 165, 233, 0.04);
}

.nav-link.child {
  font-size: 0.7rem;
  padding: 0.46rem 0.72rem 0.46rem 0.95rem;
  line-height: 1.48;
  opacity: 0.92;
  word-break: keep-all;
  overflow-wrap: anywhere;
  hyphens: none;
}

.nav-link.child::before {
  content: "└ ";
  opacity: 0.45;
}

/* —— 主内容 —— */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  animation: fade-up 0.6s ease-out 0.06s both;
}

.main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  padding: 1.15rem 2rem 1.15rem 2.25rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 250, 252, 0.92) 100%);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.85);
}

.main-header__titles {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
}

/* 主标题：优先方正兰亭黑（常见办公机已预装），否则回退雅黑/苹方 */
.main-header h2,
#detailTitle {
  margin: 0;
  font-size: clamp(1.15rem, 2.2vw, 1.45rem);
  font-weight: 600;
  font-family:
    "FZLanTingHeiS-DB-GB",
    "FZLanTingHeiS-R-GB",
    "FZLanTingHei-DB-GBK",
    "FZLanTingHei-R-GBK",
    "FZLanTingHei-B-GBK",
    "方正兰亭粗黑简体",
    "方正兰亭黑简体",
    "方正兰亭中黑_GBK",
    "方正中等线简体",
    "Microsoft YaHei UI",
    "Microsoft YaHei",
    "PingFang SC",
    sans-serif;
  letter-spacing: 0.01em;
  color: var(--text);
  line-height: 1.3;
}

.btn-debug {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1.15rem;
  border-radius: 12px;
  border: 1px solid rgba(14, 165, 233, 0.35);
  background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
  color: #f8fafc;
  font-size: 0.84rem;
  font-weight: 600;
  text-decoration: none;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s, background 0.2s;
  animation: pulse-border 3.5s ease-in-out infinite;
  box-shadow: 0 4px 16px rgba(14, 165, 233, 0.22);
}

.btn-debug__icon {
  font-size: 1rem;
  opacity: 0.95;
  color: #e0f2fe;
}

.btn-debug__label {
  letter-spacing: 0.02em;
}

.btn-debug__chev {
  font-size: 0.9rem;
  opacity: 0.85;
  transition: transform 0.2s;
}

.btn-debug:hover {
  transform: translateY(-2px);
  border-color: rgba(3, 105, 161, 0.5);
  background: linear-gradient(135deg, #38bdf8 0%, #0369a1 100%);
  box-shadow: var(--shadow-float), 0 0 0 1px rgba(14, 165, 233, 0.2);
}

.btn-debug:hover .btn-debug__chev {
  transform: translateX(3px);
}

.main-body {
  flex: 1;
  overflow-y: auto;
  padding: 2rem 2.25rem 4rem;
}

/* 文档首页：主栏与顶栏同宽、尽量用满视口剩余宽度（避免正文卡片过窄） */
@media (min-width: 901px) {
  .docs-index .main-header,
  .docs-index .main-body {
    max-width: min(1420px, calc(100vw - var(--nav-width) - 2rem));
    margin-inline: auto;
    width: 100%;
  }
}

.doc-card {
  max-width: 100%;
  width: 100%;
  padding: 1.65rem 2rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: linear-gradient(165deg, #ffffff 0%, #fafbfc 48%, #f8fafc 100%);
  backdrop-filter: blur(8px) saturate(1.02);
  -webkit-backdrop-filter: blur(8px) saturate(1.02);
  box-shadow: var(--shadow-card), inset 0 1px 0 rgba(255, 255, 255, 0.95);
  transition: transform 0.35s ease, box-shadow 0.35s ease, border-color 0.35s ease;
  /* 宽表不挤压列宽：允许横向滚动，避免「位置」等列被压成几十像素 */
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.doc-card:hover {
  transform: translateY(-3px);
  border-color: rgba(14, 165, 233, 0.22);
  box-shadow: var(--shadow-float), 0 0 0 1px rgba(14, 165, 233, 0.08);
}

.signature {
  margin: 0 0 1.15rem;
  padding: 1rem 1.15rem;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
  border: 1px solid rgba(14, 165, 233, 0.18);
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 500;
  color: #0c4a6e;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.doc-card .lead {
  margin: 0 0 1rem;
  color: var(--text-muted);
  line-height: 1.68;
  font-size: 0.94rem;
}

.doc-card pre.api-example {
  margin: 0.5rem 0 1rem;
  padding: 0.95rem 1.1rem;
  border-radius: var(--radius-sm);
  background: #f1f5f9;
  border: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.58;
  color: #334155;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.doc-card h3 {
  margin: 1.45rem 0 0.65rem;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--accent-hover);
  border-bottom: 1px solid rgba(14, 165, 233, 0.2);
  padding-bottom: 0.35rem;
}

.doc-card h3:first-child {
  margin-top: 0;
}

.doc-card table {
  /* 至少占满卡片宽度；内容更宽时按内容伸展，由 .doc-card 横向滚动承接 */
  width: max(100%, max-content);
  min-width: 100%;
  table-layout: auto;
  border-collapse: collapse;
  font-size: 0.84rem;
  margin: 0.55rem 0 1.1rem;
  border-radius: var(--radius-sm);
}

.doc-card th,
.doc-card td {
  border: 1px solid var(--border);
  padding: 0.55rem 0.75rem;
  text-align: left;
  vertical-align: top;
  /* 避免在极窄列里把中文逐字断开，造成表头与单元格「错位」观感 */
  word-break: keep-all;
  overflow-wrap: break-word;
}

/* 首列常为「位置 / 第 n 个」等：保证最小可读宽度，避免被压成极窄条 */
.doc-card thead th:first-child,
.doc-card tbody td:first-child {
  min-width: 5.5rem;
}

.doc-card th {
  background: linear-gradient(180deg, #e0f2fe 0%, #f0f9ff 100%);
  color: #0c4a6e;
  font-weight: 600;
}

.doc-card td {
  color: var(--text-muted);
  background: rgba(248, 250, 252, 0.85);
}

.doc-card td code,
.doc-card p code,
.signature code {
  font-family: var(--mono);
  font-size: 0.84em;
  color: #0369a1;
  background: rgba(224, 242, 254, 0.85);
  padding: 0.12em 0.38em;
  border-radius: 5px;
  border: 1px solid rgba(14, 165, 233, 0.2);
}

.doc-card ul {
  margin: 0.5rem 0 1rem 1.2rem;
  color: var(--text-muted);
  line-height: 1.65;
}

.doc-card .returns {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, rgba(238, 242, 255, 0.95), rgba(224, 242, 254, 0.5));
  border-left: 3px solid var(--violet);
  color: #4338ca;
  font-size: 0.86rem;
  margin-top: 0.85rem;
}

.empty-state {
  color: var(--text-muted);
  padding: 4rem 2rem;
  text-align: center;
  max-width: 28rem;
  margin: 0 auto;
}

.empty-state__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.5rem;
  height: 3.5rem;
  margin-bottom: 1.25rem;
  font-size: 1.5rem;
  color: var(--sky);
  border-radius: 18px;
  background: linear-gradient(145deg, #e0f2fe, #f0f9ff);
  border: 1px solid rgba(14, 165, 233, 0.25);
  box-shadow: 0 6px 20px rgba(14, 165, 233, 0.1);
}

.empty-state__title {
  margin: 0 0 0.5rem;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.empty-state__hint {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--text-muted);
}

/* 文档首页：简介（无 hash 或无效 hash 时） */
.docs-intro {
  max-width: 100%;
  overflow-x: visible;
}

.docs-intro.doc-card:hover {
  transform: translateY(-1px);
}

.docs-intro__hero {
  margin-bottom: 1.75rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid rgba(14, 165, 233, 0.15);
}

.docs-intro__eyebrow {
  margin: 0 0 0.4rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.docs-intro__title {
  margin: 0 0 0.65rem;
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
  line-height: 1.2;
}

.docs-intro__lead {
  margin: 0;
  font-size: 0.96rem;
  line-height: 1.72;
  color: var(--text-muted);
}

.docs-intro__lead a {
  color: var(--accent-hover);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid rgba(14, 165, 233, 0.35);
  transition: color 0.15s, border-color 0.15s;
}

.docs-intro__lead a:hover {
  color: #0369a1;
  border-bottom-color: rgba(3, 105, 161, 0.55);
}

.docs-intro__h {
  margin: 1.75rem 0 0.75rem;
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.docs-intro__h:first-of-type {
  margin-top: 0.25rem;
}

.docs-intro__p {
  margin: 0 0 0.75rem;
  font-size: 0.92rem;
  line-height: 1.72;
  color: var(--text-muted);
}

.docs-intro__p--tight {
  margin-top: 0.5rem;
}

.docs-intro__pre {
  margin: 0.5rem 0 0.85rem;
  padding: 1rem 1.15rem;
  border-radius: var(--radius-sm);
  background: linear-gradient(165deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.62;
  color: #334155;
  overflow-x: auto;
  white-space: pre;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.docs-intro__list {
  margin: 0 0 0.25rem;
  padding-left: 1.25rem;
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.75;
}

.docs-intro__list li {
  margin-bottom: 0.45rem;
}

.docs-intro__list strong {
  color: var(--text);
  font-weight: 600;
}

.docs-intro__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  margin: 0.5rem 0 0.25rem;
}

.docs-intro__card {
  margin: 0;
  padding: 1rem 1.1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: linear-gradient(160deg, #f8fafc 0%, #ffffff 100%);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9) inset;
}

.docs-intro__card-title {
  margin: 0 0 0.45rem;
  font-size: 0.86rem;
  font-weight: 700;
  color: #0c4a6e;
}

.docs-intro__card-text {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.62;
  color: var(--text-muted);
}

.docs-intro__steps {
  margin: 0.35rem 0 0.5rem;
  padding-left: 1.35rem;
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.75;
}

.docs-intro__steps li {
  margin-bottom: 0.4rem;
}

.docs-intro__hint {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  margin: 1.75rem 0 0;
  padding: 1rem 1.15rem;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, rgba(224, 242, 254, 0.65), rgba(248, 250, 252, 0.95));
  border: 1px solid rgba(14, 165, 233, 0.22);
  font-size: 0.88rem;
  line-height: 1.65;
  color: #334155;
}

.docs-intro__hint-icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  margin-top: 0.08rem;
  font-size: 0.95rem;
  color: var(--accent);
  background: #fff;
  border-radius: 10px;
  border: 1px solid rgba(14, 165, 233, 0.25);
}

.docs-intro code {
  font-family: var(--mono);
  font-size: 0.84em;
  color: #0369a1;
  background: rgba(224, 242, 254, 0.85);
  padding: 0.1em 0.35em;
  border-radius: 5px;
  border: 1px solid rgba(14, 165, 233, 0.2);
}

@media (max-width: 900px) {
  .docs-intro__title {
    font-size: 1.35rem;
  }

  .docs-intro__grid {
    grid-template-columns: 1fr;
  }

  :root {
    --nav-width: 100%;
  }

  .app-shell {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 42vh;
  }

  .docs-index .sidebar {
    height: auto;
    max-height: 42vh;
    position: relative;
    align-self: stretch;
    overflow: hidden;
  }

  .main-header {
    padding: 1rem 1.25rem;
  }

  .main-body {
    padding: 1.25rem 1.25rem 3rem;
  }
}

/* Playground */
.pg-layout {
  display: grid;
  grid-template-columns: 1fr 6px 1fr;
  grid-template-rows: auto 1fr;
  height: 100vh;
  gap: 0;
}

.pg-layout > .pg-pane:nth-child(2) {
  grid-column: 1;
  grid-row: 2;
  min-width: 0;
}

.pg-layout > .pg-resizer {
  grid-column: 2;
  grid-row: 2;
  z-index: 4;
}

.pg-layout > .pg-pane:nth-child(4) {
  grid-column: 3;
  grid-row: 2;
  min-width: 0;
}

@media (max-width: 960px) {
  .pg-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 1fr;
    height: auto;
    min-height: 100vh;
  }

  .pg-layout > .pg-resizer {
    display: none;
  }

  .pg-layout > .pg-pane:nth-child(2) {
    grid-column: 1;
    grid-row: 2;
  }

  .pg-layout > .pg-pane:nth-child(4) {
    grid-column: 1;
    grid-row: 3;
  }
}

.pg-toolbar {
  grid-column: 1 / -1;
  grid-row: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  backdrop-filter: blur(8px);
  z-index: 5;
}

.pg-resizer {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: col-resize;
  background: linear-gradient(180deg, #e2e8f0 0%, #cbd5e1 50%, #e2e8f0 100%);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  touch-action: none;
  user-select: none;
}

.pg-resizer:hover,
.pg-resizer.is-dragging {
  background: linear-gradient(180deg, #bae6fd 0%, #7dd3fc 50%, #bae6fd 100%);
}

.pg-resizer::after {
  content: "";
  display: block;
  width: 2px;
  height: 28px;
  border-radius: 1px;
  background: rgba(100, 116, 139, 0.35);
  box-shadow: 4px 0 0 rgba(100, 116, 139, 0.2);
}

.pg-pane > .pg-pane-header:last-child {
  border-bottom: none;
  border-top: 1px solid var(--border);
}

.pg-toolbar h1 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text);
}

.pg-actions {
  display: flex;
  gap: 0.5rem;
}

.pg-actions button,
.pg-actions a {
  padding: 0.45rem 0.9rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text);
  font-size: 0.8rem;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
}

.pg-actions button.primary {
  background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
  border-color: rgba(14, 165, 233, 0.45);
  color: #f8fafc;
  font-weight: 600;
}

.pg-actions button:hover,
.pg-actions a:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.pg-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--border);
  animation: fade-up 0.5s ease-out;
}

.pg-pane:last-child {
  border-right: none;
}

.pg-pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.45rem 0.75rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
}

.pg-pane-hint {
  text-transform: none;
  letter-spacing: 0.02em;
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--text-muted);
  opacity: 0.92;
  white-space: nowrap;
}

@media (max-width: 1100px) {
  .pg-pane-hint {
    white-space: normal;
    text-align: right;
    line-height: 1.35;
  }
}

.pg-editor-wrap {
  flex: 1;
  min-height: 0;
  position: relative;
  display: flex;
  flex-direction: column;
}

.pg-editor {
  flex: 1;
  width: 100%;
  min-height: 0;
  height: 100%;
  margin: 0;
  padding: 0.85rem 1rem;
  border: none;
  resize: none;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.55;
  color: #1e293b;
  background: #fafbfc;
  tab-size: 2;
  white-space: pre;
  overflow: auto;
  overflow-wrap: normal;
  word-break: normal;
  caret-color: var(--accent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.pg-editor::placeholder {
  color: rgba(100, 116, 139, 0.65);
}

.pg-editor:focus {
  outline: none;
  background: #ffffff;
  box-shadow:
    inset 0 0 0 2px rgba(14, 165, 233, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.pg-editor::selection {
  background: rgba(14, 165, 233, 0.18);
  color: inherit;
}

/* CodeMirror：对齐大地图类「源代码编辑器」浅色行号区 + 铺满面板 */
.pg-editor-wrap .CodeMirror {
  flex: 1;
  min-height: 0;
  width: 100%;
  height: 100%;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.55;
  border: none;
  border-radius: 0;
  background: #fafbfc;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.pg-editor-wrap .CodeMirror-scroll {
  min-height: 100%;
  overscroll-behavior: contain;
}

.pg-editor-wrap .CodeMirror-gutters {
  background: #f1f5f9;
  border-right: 1px solid var(--border);
  padding-right: 2px;
}

.pg-editor-wrap .CodeMirror-linenumber {
  color: #94a3b8;
  font-size: 0.72rem;
  padding: 0 0.35rem 0 0.25rem;
  min-width: 2.25rem;
}

.pg-editor-wrap .CodeMirror-cursor {
  border-left-color: var(--accent);
}

.pg-editor-wrap .CodeMirror-focused {
  background: #ffffff;
  box-shadow:
    inset 0 0 0 2px rgba(14, 165, 233, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.pg-editor-wrap .CodeMirror-selected {
  background: rgba(14, 165, 233, 0.12);
}

.pg-editor-wrap .CodeMirror-activeline-background {
  background: rgba(14, 165, 233, 0.05);
}

/* 预览区：flex 子项须 min-height:0，否则 iframe 的 height:100% 无法得到稳定高度，Cesium 画布会按错误视口初始化导致「错乱」 */
.pg-preview {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  background: #e2e8f0;
}

.pg-preview iframe {
  flex: 1;
  min-height: 0;
  width: 100%;
  border: none;
  display: block;
}

.pg-status {
  position: absolute;
  bottom: 0.5rem;
  left: 0.5rem;
  right: 0.5rem;
  padding: 0.4rem 0.6rem;
  font-size: 0.72rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border);
  color: var(--text-muted);
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}
