/* ==========================================================================
   马老师专属混淆 design system
   “深空霓虹 + 玻璃拟态 + 极光渐变”
   ========================================================================== */

:root {
  /* 主题「松烟青瓷」：瓦松绿 #4E8966 · 玉子 #FFFEEE · 天青点缀
     渐变用亮薄荷桥接绿与青，避免脏过渡 */
  --bg-base: #0A100D;
  --bg-elevated: #101812;
  --glass: rgba(255, 255, 255, 0.04);
  --glass-border: rgba(255, 255, 255, 0.09);
  --text-primary: #F0F6EF;
  --text-muted: #8B9C8F;
  --accent-1: #4E8966;
  --accent-2: #58B088;
  --accent-3: #7CC5C9;
  --success: #6FBF8C;
  --danger: #F4586E;
  --warning: #F5A65B;

  --grad-brand: linear-gradient(135deg, #3F7A59 0%, #58B088 52%, #7CC5C9 100%);
  --grad-text: linear-gradient(100deg, #EDF9EE 0%, #A5E3C0 42%, #8ED0D4 100%);

  --radius-card: 16px;
  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.45);
  --glow-accent: 0 0 24px rgba(88, 176, 136, 0.45);

  --font-ui: 'Inter', system-ui, -apple-system, sans-serif;
  --font-code: 'JetBrains Mono', ui-monospace, 'Cascadia Code', monospace;

  --aurora-opacity: 0.13;
  --grid-opacity: 0.45;
  --color-scheme: dark;
}

html[data-theme='light'] {
  --bg-base: #FFFFFF;
  --bg-elevated: #F5FAF3;
  --glass: rgba(255, 255, 255, 0.65);
  --glass-border: rgba(52, 84, 66, 0.13);
  --text-primary: #1D2A22;
  --text-muted: #63756A;
  --success: #3F7A59;
  --grad-text: linear-gradient(100deg, #3D7A58 0%, #3FA981 52%, #47A0A8 100%);
  --aurora-opacity: 0.07;
  --grid-opacity: 0.2;
  --shadow-card: 0 8px 32px rgba(45, 74, 58, 0.1);
  --color-scheme: light;
}

/* ------------------------------------------------------------------ base */

html {
  color-scheme: var(--color-scheme);
}

body {
  font-family: var(--font-ui);
  font-feature-settings: 'cv02', 'cv03', 'cv04';
  background-color: var(--bg-base);
  color: var(--text-primary);
  overflow-x: hidden;
}

code, pre, kbd {
  font-family: var(--font-code);
}

::selection {
  background: rgba(88, 176, 136, 0.35);
  color: var(--text-primary);
}

/* ------------------------------------------------------- custom scrollbar */

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}
*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
*::-webkit-scrollbar-track {
  background: transparent;
}
*::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.16);
  border-radius: 8px;
}
*::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.32);
}
html[data-theme='light'] * {
  scrollbar-color: rgba(20, 20, 50, 0.22) transparent;
}
html[data-theme='light'] *::-webkit-scrollbar-thumb {
  background: rgba(20, 20, 50, 0.2);
}
html[data-theme='light'] *::-webkit-scrollbar-thumb:hover {
  background: rgba(20, 20, 50, 0.36);
}

/* ============================================== 背景三层：光晕 + 网格 */

.bg-aurora {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.orb {
  position: absolute;
  width: 60vmax;
  height: 60vmax;
  border-radius: 50%;
  filter: blur(120px);
  opacity: var(--aurora-opacity);
  will-change: transform;
}

.orb-1 {
  background: radial-gradient(circle at center, var(--accent-1) 0%, transparent 62%);
  top: -22vmax;
  left: -14vmax;
  animation: drift-1 20s ease-in-out infinite alternate;
}

.orb-2 {
  background: radial-gradient(circle at center, var(--accent-2) 0%, transparent 62%);
  bottom: -26vmax;
  right: -16vmax;
  animation: drift-2 20s ease-in-out infinite alternate;
}

@keyframes drift-1 {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  50%  { transform: translate3d(8vmax, 6vmax, 0) scale(1.12); }
  100% { transform: translate3d(-4vmax, 10vmax, 0) scale(0.96); }
}

@keyframes drift-2 {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  50%  { transform: translate3d(-9vmax, -7vmax, 0) scale(1.08); }
  100% { transform: translate3d(5vmax, -11vmax, 0) scale(1.15); }
}

.bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 44px 44px;
  opacity: var(--grid-opacity);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 38%, black 30%, transparent 78%);
  mask-image: radial-gradient(ellipse 70% 60% at 50% 38%, black 30%, transparent 78%);
}

html[data-theme='light'] .bg-grid {
  background-image:
    linear-gradient(rgba(45, 80, 62, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(45, 80, 62, 0.06) 1px, transparent 1px);
}

/* -------------------------------------------------------------- 玻璃卡片 */

.glass-card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
}

/* =============================================================== 顶部导航 */

.site-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  background: color-mix(in srgb, var(--bg-base) 72%, transparent);
  border-bottom: 1px solid var(--glass-border);
}

.nav-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
}

.brand-logo {
  width: 30px;
  height: 30px;
  filter: drop-shadow(0 0 10px rgba(88, 176, 136, 0.45));
}

.brand-name {
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.02em;
}

.nav-links {
  display: flex;
  gap: 4px;
  margin-left: 12px;
}

.nav-link {
  position: relative;
  padding: 8px 13px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.nav-link:hover {
  color: var(--text-primary);
  background: var(--glass);
}

.nav-link.is-active {
  color: var(--text-primary);
}

.nav-link.is-active::after {
  content: '';
  position: absolute;
  left: 13px;
  right: 13px;
  bottom: 2px;
  height: 2px;
  border-radius: 2px;
  background: var(--grad-brand);
}

.nav-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  color: var(--text-primary);
  background: var(--glass);
  border-color: var(--glass-border);
}

/* 主题切换图标状态 */
.icon-sun { display: none; }
html[data-theme='light'] .icon-sun { display: block; }
html[data-theme='light'] .icon-moon { display: none; }

/* ==================================================================== Hero */

.hero {
  text-align: center;
  padding: 44px 16px 28px;
}

/* 首页工具页使用紧凑 hero，把首屏空间留给工作区 */
.hero-compact {
  padding: 26px 16px 18px;
}

.hero-compact .hero-title {
  font-size: clamp(32px, 3.6vw, 46px);
}

.hero-compact .hero-sub {
  margin-top: 10px;
  font-size: 14.5px;
}

.hero-compact .hero-badges {
  margin-top: 14px;
}

.hero-title {
  margin: 0;
  font-size: clamp(38px, 5vw, 60px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.08;
}

.gradient-text {
  background: var(--grad-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-sub {
  margin: 14px auto 0;
  max-width: 620px;
  color: var(--text-muted);
  font-size: 15.5px;
  line-height: 1.65;
}

.hero-badges {
  margin-top: 18px;
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.lang-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
}

/* ================================================================ 工作区 */

.workspace {
  margin-top: 4px;
}

/* 工具条 */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 12px 14px;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

/* 分段控件 */
.segmented {
  position: relative;
  display: inline-flex;
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.segmented-slider {
  position: absolute;
  top: 4px;
  bottom: 4px;
  border-radius: 9px;
  background: var(--glass);
  border: 1px solid rgba(88, 176, 136, 0.35);
  box-shadow: 0 0 18px rgba(88, 176, 136, 0.25);
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), width 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}

.segment {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s ease;
}

.segment:hover {
  color: var(--text-primary);
}

.segment.is-active {
  color: var(--text-primary);
}

/* 等级滑块 */
.level-control {
  display: flex;
  align-items: center;
  gap: 12px;
}

.level-note {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid rgba(88, 176, 136, 0.3);
  background: rgba(88, 176, 136, 0.08);
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 500;
}

.level-note .note-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 8px rgba(88, 176, 136, 0.8);
  flex: none;
}

.level-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.level-slider-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.level-marks {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  padding: 0 2px;
}

.level-marks span.is-active {
  color: var(--text-primary);
  font-weight: 700;
}

input[type='range']#level-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 210px;
  height: 6px;
  border-radius: 999px;
  /* 第一层：已填充段按等级由浅入深（天青 → 薄荷 → 瓦松绿）；
     第二层：完整轨道底色（双主题可见） */
  background:
    linear-gradient(90deg, #7CC5C9, #58B088, #3F7A59) no-repeat,
    var(--glass-border);
  background-size: var(--fill, 50%) 100%, 100% 100%;
  outline: none;
  cursor: pointer;
}

input[type='range']#level-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 2px solid var(--accent-2);
  box-shadow: 0 0 12px rgba(88, 176, 136, 0.6);
  transition: transform 0.15s ease;
}

input[type='range']#level-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

input[type='range']#level-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 2px solid var(--accent-2);
  box-shadow: 0 0 12px rgba(88, 176, 136, 0.6);
}

/* 按钮组 */
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ghost-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  border-radius: 11px;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ghost-btn:hover {
  color: var(--text-primary);
  border-color: rgba(124, 197, 201, 0.45);
  box-shadow: var(--glow-accent);
}

.ghost-btn[aria-expanded='true'] {
  color: var(--text-primary);
  border-color: rgba(88, 176, 136, 0.45);
}

/* 渐变描边 + 发光主按钮（padding:1px 伪元素描边技巧） */
.primary-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 1px;
  border: 0;
  border-radius: 12px;
  background: var(--grad-brand);
  font-family: inherit;
  cursor: pointer;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.primary-btn .btn-shine {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--grad-brand);
  pointer-events: none;
}

.primary-btn .btn-inner,
.primary-btn .btn-text {
  position: relative;
}

.primary-btn > *:not(.btn-shine) {
  position: relative;
}

.primary-btn .btn-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 11px;
  background: color-mix(in srgb, var(--bg-elevated) 30%, transparent);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
}

.primary-btn:hover {
  box-shadow: var(--glow-accent);
}

.primary-btn:active {
  transform: translateY(1px);
}

.primary-btn .btn-kbd {
  font-size: 10.5px;
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: rgba(255, 255, 255, 0.8);
}

.primary-btn.loading .btn-icon-play,
.primary-btn:not(.loading) .btn-icon-spin {
  display: none;
}

.primary-btn.loading .btn-icon-spin {
  display: block;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.primary-btn.small .btn-label {
  padding: 8px 14px;
  font-size: 13px;
}

.primary-btn.small > .btn-text {
  padding: 8px 14px;
  margin: 0;
}

/* 按钮 DOM 约定：<button class="primary-btn"><span class="btn-shine"/><span class="btn-label">icon 文本</span></button> */
.primary-btn:not(:has(.btn-label)) .btn-text,
.primary-btn .btn-icon-play,
.primary-btn .btn-icon-spin {
  z-index: 1;
}

.primary-btn {
  color: #fff;
}

.primary-btn > svg {
  margin-left: 10px;
  z-index: 1;
}

.primary-btn > .btn-text {
  padding: 9px 6px 9px 0;
  margin-right: 12px;
  font-size: 14px;
  font-weight: 700;
  z-index: 1;
}

.primary-btn > .btn-kbd {
  margin-right: 14px;
  z-index: 1;
}

/* 流动渐变进度条 */
.progress-track {
  position: relative;
  height: 3px;
  margin-top: 10px;
  border-radius: 3px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.04);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.progress-track.active {
  opacity: 1;
}

.progress-bar {
  height: 100%;
  width: 40%;
  border-radius: 3px;
  background: var(--grad-brand);
  transform: translateX(-100%);
}

.progress-track.active .progress-bar {
  animation: flow 1.1s ease-in-out infinite;
}

@keyframes flow {
  0%   { transform: translateX(-110%); }
  100% { transform: translateX(360%); }
}

/* 编辑器双栏 —— 主工作区占满首屏 */
.editors {
  display: grid;
  grid-template-columns: var(--split, 1fr) 6px var(--split-out, 1fr);
  margin-top: 10px;
  height: clamp(480px, calc(100vh - 320px), 980px);
  min-height: 480px;
}

.editors.fullscreen-mode {
  position: fixed;
  inset: 16px;
  z-index: 80;
  height: auto;
  margin: 0;
  grid-template-columns: 1fr 6px 1fr;
  box-shadow: 0 0 0 100vmax rgba(2, 2, 8, 0.72);
  border-radius: var(--radius-card);
}

.pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 0;
  border-radius: var(--radius-card);
  background: var(--glass);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

/* 去边框后，浅色下用极淡的绿白 tint 保持容器感 */
html[data-theme='light'] .pane {
  background: color-mix(in srgb, #F0F7EE 45%, var(--bg-base));
}

.pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: 46px;
  padding: 0 14px;
  flex: none;
  border-bottom: 1px solid var(--glass-border);
}

.pane-title {
  font-family: var(--font-code);
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pane-actions {
  display: flex;
  gap: 6px;
  flex: none;
}

.mini-btn {
  padding: 5px 11px;
  border-radius: 8px;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
}

.mini-btn:hover {
  color: var(--text-primary);
  border-color: rgba(88, 176, 136, 0.45);
  box-shadow: 0 0 14px rgba(88, 176, 136, 0.3);
}

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

/* 文件拖拽悬停反馈 */
.editor-shell.dragover {
  outline: 2px dashed var(--accent-2);
  outline-offset: -3px;
  background: rgba(88, 176, 136, 0.06);
}

.editor-shell.dragover::after {
  content: '松开以读取文件（仅读取，不保存）';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--bg-base) 62%, transparent);
  color: var(--accent-1);
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 700;
  pointer-events: none;
}

.editor-host {
  flex: 1;
  min-height: 0;
}

/* 移动端原生输入（pointer: coarse / 窄屏时由 editor.js 启用） */
.editor-textarea {
  display: none;
  flex: 1;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-code);
  font-size: 16px; /* ≥16px prevents iOS focus zoom */
  line-height: 1.6;
  padding: 12px 14px;
  resize: none;
  outline: none;
  white-space: pre;
  overflow: auto;
  caret-color: var(--accent-1);
}

.editor-textarea::selection {
  background: rgba(88, 176, 136, 0.3);
}

body.mobile-editors .editor-textarea {
  display: block;
}

body.mobile-editors .editor-host {
  display: none;
}

body.mobile-editors .editor-placeholder {
  padding-left: 14px !important;
}

/* 隐约的示例占位：overlay，不占用真实内容，粘贴/输入即刻隐藏 */
.editor-placeholder {
  position: absolute;
  top: 14px;
  right: 20px;
  left: 0;
  margin: 0;
  padding-left: 68px;
  font-family: var(--font-code);
  font-size: 13.5px;
  line-height: 21px;
  white-space: pre;
  overflow: hidden;
  color: var(--text-muted);
  opacity: 0.42;
  pointer-events: none;
  user-select: none;
}

.editor-host .monaco-editor,
.editor-host .monaco-editor-background,
.editor-host .monaco-editor .margin {
  background: transparent !important;
}

/* 彻底关闭 Monaco 当前行高亮（含主题残留与边框形态） */
.editor-host .monaco-editor .view-overlays .current-line,
.editor-host .monaco-editor .margin-view-overlays .current-line {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

/* 分隔条 */
.divider {
  cursor: col-resize;
  border-radius: 3px;
  position: relative;
  transition: background 0.2s ease;
}

.divider::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 2px;
  height: 34px;
  border-radius: 2px;
  background: var(--glass-border);
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.divider:hover::after,
.divider.dragging::after {
  background: var(--accent-2);
  box-shadow: 0 0 12px rgba(88, 176, 136, 0.7);
}

/* 结果入场动效 */
.pane-output.reveal-result {
  animation: result-in 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes result-in {
  from { opacity: 0; transform: scale(0.98); }
  to   { opacity: 1; transform: scale(1); }
}

/* 统计徽章 */
.stats-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
  color: var(--text-muted);
}

.stat-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  font-size: 12.5px;
}

.stat-label {
  color: var(--text-muted);
}

.stat-value {
  font-family: var(--font-code);
  font-weight: 600;
  color: var(--text-primary);
}

.ratio-badge .stat-value { color: var(--success); }
.ratio-badge.bad .stat-value { color: var(--warning); }
.time-badge .stat-value { color: #8FC9CE; }

/* 移动端 tab */
.mobile-tabs {
  display: none;
}

/* ================================================================ API 文档 */

.api-docs {
  margin-top: 72px;
}

.section-title {
  margin: 0;
  text-align: center;
  font-size: clamp(28px, 3.4vw, 40px);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.section-sub {
  margin: 10px auto 0;
  max-width: 640px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14.5px;
  line-height: 1.65;
}

.docs-layout {
  display: grid;
  grid-template-columns: 210px 1fr;
  gap: 28px;
  margin-top: 30px;
}

.docs-nav {
  position: sticky;
  top: 84px;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-card);
  background: var(--glass);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

.docs-nav-link {
  padding: 8px 12px;
  border-radius: 9px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: all 0.18s ease;
}

.docs-nav-link:hover {
  color: var(--text-primary);
  background: var(--glass);
}

.docs-nav-link.is-active {
  color: var(--text-primary);
  border-left-color: var(--accent-2);
  background: var(--glass);
}

.docs-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.doc-block {
  padding: 20px 22px;
}

.doc-block h3 {
  margin: 0 0 10px;
  font-size: 16.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.doc-block p {
  margin: 0 0 12px;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.7;
}

.doc-block code {
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(88, 176, 136, 0.12);
  border: 1px solid rgba(88, 176, 136, 0.18);
  font-size: 12.5px;
  color: #A8DDBC;
}

.doc-note {
  font-size: 13px !important;
}

.method-pill {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 3px 9px;
  border-radius: 7px;
}

.method-pill.post {
  color: #8FD8A8;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.method-pill.get {
  color: #7FBFC9;
  background: rgba(124, 197, 201, 0.12);
  border: 1px solid rgba(124, 197, 201, 0.3);
}

.doc-table-wrap {
  margin: 0 0 12px;
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  overflow: hidden;
}

.doc-table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.doc-table-wrap th,
.doc-table-wrap td {
  padding: 9px 14px;
  text-align: left;
  border-bottom: 1px solid var(--glass-border);
}

.doc-table-wrap tr:last-child td {
  border-bottom: 0;
}

.doc-table-wrap th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.02);
}

/* 代码示例块 */
.code-example {
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  overflow: hidden;
  background: color-mix(in srgb, var(--bg-base) 60%, transparent);
}

.example-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--glass-border);
}

.example-tab {
  padding: 5px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
}

.example-tab:hover {
  color: var(--text-primary);
}

.example-tab.is-active {
  color: var(--text-primary);
  background: var(--glass);
  box-shadow: inset 0 0 0 1px var(--glass-border);
}

.example-copy {
  margin-left: auto;
}

.code-block {
  margin: 0;
  padding: 14px 16px;
  overflow-x: auto;
}

.code-block code {
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text-primary);
  font-size: 12.5px;
  line-height: 1.7;
  white-space: pre;
}

.code-block code[hidden] {
  display: none;
}

/* Key 管理卡片 */
.key-card {
  border: 1px solid rgba(88, 176, 136, 0.28);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 40px rgba(88, 176, 136, 0.08);
}

.key-form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.key-input {
  flex: 1;
  min-width: 220px;
  padding: 10px 14px;
  border-radius: 11px;
  border: 1px solid var(--glass-border);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.key-input:focus {
  outline: none;
  border-color: rgba(88, 176, 136, 0.55);
  box-shadow: 0 0 0 3px rgba(88, 176, 136, 0.18), var(--glow-accent);
}

.key-result {
  margin-top: 14px;
  animation: result-in 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.key-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 11px;
  border: 1px solid rgba(88, 176, 136, 0.3);
  background: rgba(88, 176, 136, 0.07);
}

.key-value {
  flex: 1;
  font-size: 13px;
  color: var(--text-primary);
  word-break: break-all;
}

.key-value.masked {
  letter-spacing: 0.2em;
}

.key-meta {
  margin: 8px 0 0;
  font-size: 12.5px;
  color: var(--text-muted);
}

/* ============================================================ 定价 / 关于 */

.pricing,
.about {
  margin-top: 56px;
  padding-bottom: 20px;
}

.pricing-card,
.about-card {
  max-width: 640px;
  margin: 26px auto 0;
  padding: 26px 28px;
  text-align: center;
}

.pricing-grid,
.about-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
  margin-top: 26px;
  max-width: 980px;
  margin-left: auto;
  margin-right: auto;
}

.pricing-grid .pricing-card,
.about-grid .about-card {
  margin: 0;
  max-width: none;
}

.pricing-card.is-featured {
  border-color: rgba(88, 176, 136, 0.4);
  box-shadow: var(--shadow-card), 0 0 44px rgba(88, 176, 136, 0.1);
  position: relative;
}

.pricing-card h3 {
  margin: 10px 0 8px;
  font-size: 20px;
  font-weight: 700;
}

.pricing-price {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  margin: 6px 0 14px;
}

.pricing-price .gradient-text {
  font-size: 34px;
  font-weight: 800;
}

.pricing-period {
  color: var(--text-muted);
  font-size: 13px;
}

.pricing-list {
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--text-muted);
  font-size: 13.5px;
}

.pricing-list li::before {
  content: '✓';
  color: var(--success);
  margin-right: 8px;
  font-weight: 700;
}

.pricing-btn {
  display: inline-block;
  text-decoration: none;
}

.about-h {
  margin: 0 0 8px;
  font-size: 15.5px;
  font-weight: 700;
  color: var(--text-primary);
}

.about-grid .about-card {
  text-align: left;
}

.pricing-card p,
.about-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.7;
}

.pricing-tag {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid rgba(88, 176, 136, 0.35);
  background: rgba(88, 176, 136, 0.1);
  color: #A8DDBC;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.about-card {
  text-align: left;
}

.about-card strong {
  background: var(--grad-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ================================================================= 页脚 */

.site-footer {
  margin-top: 80px;
  padding: 26px 24px 34px;
  border-top: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  max-width: 1400px;
  margin-left: auto;
  margin-right: auto;
  color: var(--text-muted);
  font-size: 13px;
}

.site-footer nav {
  display: flex;
  gap: 18px;
}

.site-footer a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.site-footer a:hover {
  color: var(--text-primary);
}

/* ================================================================ Toast */

.toast-container {
  position: fixed;
  top: 72px; /* 右上角：sticky 导航（60px）正下方，与主题按钮对齐 */
  right: 18px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  max-width: min(380px, calc(100vw - 36px));
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 13px;
  border: 1px solid var(--glass-border);
  border-left-width: 3px;
  background: color-mix(in srgb, var(--bg-elevated) 82%, transparent);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  box-shadow: var(--shadow-card);
  animation: toast-in 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  cursor: pointer;
}

.toast.success {
  border-left-color: var(--success);
  border-color: rgba(16, 185, 129, 0.35);
}

.toast.success .toast-title {
  color: var(--success);
}

.toast.error {
  border-left-color: var(--danger);
  border-color: rgba(244, 63, 94, 0.35);
}

.toast.error .toast-title {
  color: var(--danger);
}

.toast.leaving {
  animation: toast-out 0.22s ease forwards;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-10px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toast-out {
  to { opacity: 0; transform: translateY(-8px) scale(0.97); }
}

.toast-icon {
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}

.toast.success .toast-icon { background: rgba(16, 185, 129, 0.16); color: var(--success); }
.toast.error .toast-icon { background: rgba(244, 63, 94, 0.16); color: var(--danger); }
.toast.info .toast-icon { background: rgba(124, 197, 201, 0.16); color: #8FC9CE; }

.toast-body {
  min-width: 0;
}

.toast-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.toast-msg {
  margin-top: 2px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-muted);
  word-break: break-word;
}

/* ============================================================= 入场动效 */

.reveal {
  opacity: 0;
  transform: translateY(12px);
  animation: rise-in 0.55s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: var(--reveal-delay, 0ms);
}

@keyframes rise-in {
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================================= 焦点可见性 */

:focus-visible {
  outline: 2px solid var(--accent-1);
  outline-offset: 2px;
  border-radius: 6px;
  box-shadow: 0 0 0 4px rgba(88, 176, 136, 0.25), var(--glow-accent);
}

/* Monaco 的隐藏输入框定位在光标行且宽度为行宽，全局 focus-visible
   描边会在这里变成一条“横线”——编辑器的焦点态由 pane 边框表达 */
.monaco-editor textarea:focus-visible,
.monaco-editor .inputarea:focus-visible {
  outline: none !important;
  box-shadow: none !important;
}

/* Chrome 会把 textarea 的默认蓝色焦点环画到 .monaco-editor 容器上 */
.monaco-editor,
.monaco-editor:focus,
.monaco-editor:focus-within,
.monaco-editor:focus-visible {
  outline: none !important;
}

/* ================================================================ 响应式 */

@media (min-width: 1280px) {
  /* 双栏由 .editors grid 控制 */
}

@media (max-width: 1279px) {
  .editors {
    display: flex;
    flex-direction: column;
    height: auto;
  }

  .pane {
    height: clamp(260px, 36vh, 460px);
  }

  .divider {
    display: none;
  }

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

  .docs-nav {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
  }
}

@media (max-width: 767px) {
  .nav-links {
    display: none;
  }

  .hero {
    padding: 30px 12px 20px;
  }

  .hero-sub {
    font-size: 14px;
  }

  .hero-badges .lang-badge:not(:first-child) {
    display: none;
  }

  /* Tab 切换单栏 */
  .mobile-tabs {
    display: flex;
    gap: 4px;
    margin-top: 10px;
    padding: 4px;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    background: var(--glass);
  }

  .mobile-tab {
    flex: 1;
    padding: 8px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
  }

  .mobile-tab.is-active {
    color: var(--text-primary);
    background: var(--glass);
    box-shadow: inset 0 0 0 1px rgba(88, 176, 136, 0.4);
  }

  .editors.mobile-show-output .pane-input,
  .editors:not(.mobile-show-output) .pane-output {
    display: none;
  }

  .editors.mobile-show-output .pane-output,
  .editors:not(.mobile-show-output) .pane-input {
    height: clamp(280px, 52vh, 520px);
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar-right {
    justify-content: stretch;
  }

  .toolbar-right .primary-btn {
    flex: 1;
    justify-content: center;
  }

  .level-slider-wrap {
    flex: 1;
  }

  input[type='range']#level-slider {
    width: 100%;
  }

  .site-footer {
    justify-content: center;
    text-align: center;
  }
}

/* ==================================================== prefers-reduced-motion */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .orb-1,
  .orb-2 {
    animation: none !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}
