﻿/* ========================================
   Web Tutorial — 页面专有样式
   ======================================== */

:root {
  --color-primary: #2563eb;        /* 主蓝色 */
  --color-primary-light: #60a5fa;  /* 浅蓝 (hero标题) */
  --color-primary-border: #93c5fd; /* 蓝边框 (卡片hover) */
  --color-primary-shadow: rgba(37,99,235,0.12); /* 阴影 (卡片hover) */
  --color-accent: #f59e0b;         /* 橙色点缀 */
  --color-heading: #1e293b;        /* 标题/深色背景 */
  --color-text: #334155;           /* 正文 */
  --color-muted: #64748b;          /* 次要文字 */
  --color-light: #94a3b8;          /* 更浅文字 */
  --color-border: #e2e8f0;        /* 边框 */
  --color-border-light: #e8ecf1;  /* 浅边框 */
  --color-bg-hover: #f1f5f9;      /* 悬停背景 */
  --color-bg-card: #f8fafc;       /* 卡片背景 */
  --color-bg-active: #eff6ff;     /* 激活项背景 */
  --color-bg-badge: #dbeafe;      /* 标签背景 */
  --color-scrollbar: #cbd5e1;     /* 滚动条 */
  --color-white: #fff;            /* 白色 */
}

/* ---------- 顶部导航 ---------- */
.header {
  position: sticky; top: 0; z-index: 200;
  background: var(--color-white);
  width: 100%;
}

/* 第一行：Logo + 语言切换 */
.header-top {
  border-bottom: 1px solid var(--color-border-light);
  padding: 0 28px;
  height: 72px;
  display: flex;
  align-items: center;
}
.header-inner {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}
.logo {
  font-size: 42px;
  font-weight: 800;
  color: var(--color-primary);
  letter-spacing: -0.5px;
}
.logo span { color: var(--color-accent); }
.logo .com {
  font-size: 22px;
  font-weight: 600;
  color: var(--color-light);
  margin-left: 2px;
}

/* 第二行：导航条（9分类下拉菜单） */
.sub-nav {
  display: flex;
  align-items: center;
  background: #2563eb;
  padding: 0 28px;
  height: 44px;
  gap: 0;
}
.sub-nav-item {
  position: relative;
  height: 100%;
  flex-shrink: 0;
}
.sub-nav-link {
  padding: 0 18px;
  font-size: 14px;
  font-weight: 500;
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  white-space: nowrap;
  height: 100%;
  display: flex;
  align-items: center;
  transition: all 0.2s;
  border-bottom: 3px solid transparent;
  cursor: pointer;
}
.sub-nav-link:hover {
  color: #fff;
  background: rgba(255,255,255,0.1);
  border-bottom-color: var(--color-accent);
}

/* 主页图标 */
.sub-nav-home {
  font-size: 18px;
  padding: 0 14px;
  line-height: 1;
  flex-shrink: 0;
}

/* 下拉菜单 */
.sub-nav-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 180px;
  background: #fff;
  border: 1px solid var(--color-border);
  border-top: 2px solid var(--color-accent);
  border-radius: 0 0 6px 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 300;
  padding: 6px 0;
}
.sub-nav-item:hover .sub-nav-dropdown {
  display: block;
}
.sub-nav-dropdown a {
  display: block;
  padding: 8px 20px;
  font-size: 13px;
  color: var(--color-text);
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.15s;
}
.sub-nav-dropdown a:hover {
  background: var(--color-bg-active);
  color: var(--color-primary);
}

/* ---------- 汉堡菜单按钮 ---------- */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  width: 32px; height: 32px;
  flex-direction: column;
  justify-content: space-around;
  align-items: center;
}
.menu-toggle span {
  display: block;
  width: 22px; height: 2.5px;
  background: var(--color-text);
  border-radius: 2px;
  transition: all 0.3s;
}
.menu-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-toggle.open span:nth-child(2) { opacity: 0; }
.menu-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- 遮罩层 ---------- */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 99;
  opacity: 0;
  transition: opacity 0.3s;
}
.overlay.show {
  display: block;
  opacity: 1;
}

/* ---------- 语言切换 ---------- */
.lang-switch {
  display: flex;
  gap: 12px;
  align-items: center;
}
.lang-switch a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  opacity: 0.5;
  transition: all 0.2s;
  line-height: 0;
  text-decoration: none;
  position: relative;
}
.lang-switch a:hover {
  opacity: 0.8;
}
.lang-switch a.active {
  opacity: 1;
}
.lang-switch a img {
  width: 28px; height: 21px;
  display: block;
}

/* ---------- 手机端语言下拉 ---------- */
.lang-mobile {
  display: none;
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
}
.lang-mobile select {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 4px 24px 4px 8px;
  font-size: 12px;
  color: var(--color-text);
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 4px center;
}

.lang-switch a::after {
  content: '';
  display: block;
  width: 0;
  height: 2px;
  background: var(--color-primary);
  border-radius: 1px;
  transition: width 0.2s;
}
.lang-switch a.active::after {
  width: 100%;
}

/* ---------- 页脚 ---------- */
.footer {
  background: var(--color-heading);
  color: var(--color-light);
  padding: 40px 32px 24px;
  font-size: 13px;
  margin-top: auto;
}
.footer-inner {
  max-width: none;
  margin: 0;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 32px;
}
.footer-col {
  flex: 1;
  min-width: 160px;
}
.footer-col h4 {
  color: var(--color-border);
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 10px;
}
.footer-col p, .footer-col a {
  color: var(--color-light);
  display: block;
  margin-bottom: 4px;
}
.footer-col a:hover { color: var(--color-primary-light); }
.footer-bottom {
  text-align: center;
  padding-top: 24px;
  margin-top: 24px;
  border-top: 1px solid var(--color-text);
  font-size: 12px;
  color: var(--color-muted);
}

/* ---------- 焦点样式 (无障碍) ---------- */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: 2px;
}
a:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ========================================
   教程页面样式 — 三栏布局
   ======================================== */

/* 教程页面左右布局 — 与首页 layout/sidebar/main 风格对齐 */
.tutorial-layout {
  display: flex;
  width: 100%;
  min-height: calc(100vh - 72px);
}

/* 教程目录侧栏 — 宽度、sticky、滚动条与首页 sidebar 一致 */
.toc-sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--color-white);
  border-right: 1px solid var(--color-border-light);
  padding: 12px 0;
  overflow-y: auto;
  height: calc(100vh - 72px);
  position: sticky;
  top: 72px;
}

/* 目录侧栏滚动条 — 与首页 sidebar 一致 */
.toc-sidebar::-webkit-scrollbar {
  width: 5px;
}
.toc-sidebar::-webkit-scrollbar-track {
  background: transparent;
}
.toc-sidebar::-webkit-scrollbar-thumb {
  background: var(--color-scrollbar);
  border-radius: 10px;
}
.toc-sidebar::-webkit-scrollbar-thumb:hover {
  background: var(--color-light);
}

.toc-header {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-light);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 0 20px 12px;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 8px;
}

.toc-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  font-size: 14px;
  color: var(--color-text);
  text-decoration: none;
  transition: all 0.15s;
  border-left: 3px solid transparent;
}

.toc-item:hover {
  background: var(--color-bg-hover);
  color: var(--color-primary);
}

.toc-item.active {
  background: var(--color-bg-active);
  color: var(--color-primary);
  border-left-color: var(--color-primary);
  font-weight: 600;
}

.toc-item .toc-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--color-bg-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--color-light);
  flex-shrink: 0;
}

.toc-item.active .toc-num {
  background: var(--color-primary);
  color: var(--color-white);
}

.toc-item:hover .toc-num {
  background: var(--color-primary-border);
  color: var(--color-white);
}

/* 教程正文区域 */
.tutorial-content {
  flex: 1;
  min-width: 0;
  padding: 40px 48px;
  background: var(--color-white);
  --text-size: 15px;
}

/* 教程页技术图标 */
.tutorial-icon {
  text-align: center;
  margin-bottom: 8px;
}
.tutorial-icon i {
  font-size: 80px;
  line-height: 1;
}

.tutorial-content h1 {
  font-size: 32px;
  font-weight: 800;
  color: var(--color-heading);
  margin-bottom: 8px;
  line-height: 1.2;
}

.tutorial-content .tutorial-intro {
  font-size: var(--text-size);
  color: var(--color-muted);
  margin-bottom: 32px;
  line-height: 1.7;
}

/* 教程正文段落 */
.tutorial-content p {
  font-size: var(--text-size);
  color: var(--color-text);
  line-height: 1.8;
  margin-bottom: 16px;
}

.tutorial-content h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--color-heading);
  margin: 36px 0 12px;
}

.tutorial-content h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-heading);
  margin: 28px 0 10px;
}

.tutorial-content ul,
.tutorial-content ol {
  margin: 0 0 16px 24px;
  font-size: var(--text-size);
  line-height: 1.8;
  color: var(--color-text);
}

.tutorial-content li {
  margin-bottom: 6px;
}

/* 教程页表格 */
.tutorial-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0 24px;
  font-size: var(--text-size);
  line-height: 1.7;
}
.tutorial-content th,
.tutorial-content td {
  padding: 10px 14px;
  text-align: left;
  border: 1px solid #e0e3e8;
}
.tutorial-content th {
  background: #f0f2f5;
  font-weight: 600;
  color: var(--color-text);
}
.tutorial-content td {
  color: var(--color-text);
}
.tutorial-content tbody tr:nth-child(even) {
  background: #f8f9fb;
}
.tutorial-content tbody tr:hover {
  background: #eef0f4;
}

/* 行内 code 标签（重用频率高）— 排除 Prism 代码高亮，避免灰底 */
.tutorial-content code:not([class*="language-"]) {
  background: #eef0f4;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.9em;
  color: #d63384;
  word-break: break-word;
}

/* 语法公式展示块（统一浅色背景，重点在整体而非局部） */
.syntax {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  vertical-align: middle;
  white-space: nowrap;
  background: #eef0f4;
  padding: 2px 10px;
  border-radius: 5px;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.9em;
  color: #1a1a2e;
}
.syntax-name,
.syntax-op,
.syntax-string,
.syntax-tag,
.syntax-bracket {
  display: inline-block;
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

/* 代码示例块 */
.code-block {
  margin: 20px 0 24px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--color-border);
}

.code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  background: var(--color-heading);
  color: var(--color-border);
  font-size: 12px;
  font-weight: 600;
}

.code-header .code-lang {
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.code-header .code-copy {
  background: none;
  border: none;
  color: var(--color-light);
  font-size: 12px;
  cursor: pointer;
  padding: 2px 8px;
  border-radius: 4px;
  transition: all 0.15s;
}

.code-header .code-copy:hover {
  background: rgba(255,255,255,0.1);
  color: var(--color-white);
}

/* Prism 基础覆盖 — 统一代码块内边距/背景 */
.code-block pre[class*="language-"] {
  margin: 0;
  padding: 20px 24px;
  background: #1e293b;
  overflow-x: auto;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 14px;
  line-height: 1.6;
  tab-size: 2;
  border-radius: 0;
  text-shadow: none;
}
.code-block code[class*="language-"] {
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 14px;
  line-height: 1.6;
  text-shadow: none;
  direction: ltr;
  text-align: left;
  white-space: pre;
  word-spacing: normal;
  word-break: normal;
}
/* 修复：代码注释斜体导致第一行左对齐偏移 */
.code-block .token.comment {
  font-style: normal;
}
/* Dracula 主题下代码块背景修正 */
.code-block[data-theme="dracula"] pre[class*="language-"] {
  background: #282a36;
}
/* Solarized Light 主题下代码块背景修正 */
.code-block[data-theme="solarizedlight"] pre[class*="language-"] {
  background: #fdf6e3;
}
.code-block[data-theme="solarizedlight"] pre[class*="language-"] code {
  color: #586e75;
}
/* 去掉 solarizedlight 给 HTML 实体加的灰底 */
.code-block[data-theme="solarizedlight"] .token.entity {
  background: transparent;
}
.code-block[data-theme="solarizedlight"] pre::-webkit-scrollbar-track {
  background: #eee8d5;
}
.code-block[data-theme="solarizedlight"] pre::-webkit-scrollbar-thumb {
  background: #93a1a1;
}
/* Coy 主题下代码块背景修正 */
.code-block[data-theme="coy"] pre[class*="language-"] {
  background: #fdfdfd;
}
.code-block[data-theme="coy"] pre[class*="language-"]::before,
.code-block[data-theme="coy"] pre[class*="language-"]::after {
  display: none; /* 去掉 Coy 的装饰三角 */
}

/* 代码块滚动条 */
.code-block pre::-webkit-scrollbar,
.code-block pre[class*="language-"]::-webkit-scrollbar {
  height: 6px;
}
.code-block pre::-webkit-scrollbar-track,
.code-block pre[class*="language-"]::-webkit-scrollbar-track {
  background: #1e293b;
}
.code-block pre::-webkit-scrollbar-thumb,
.code-block pre[class*="language-"]::-webkit-scrollbar-thumb {
  background: #475569;
  border-radius: 3px;
}

/* ---------- macOS 风格三色圆点切换 ---------- */
.code-theme-dots {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-right: 8px;
}

.code-theme-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  position: relative;
  transition: transform 0.15s, opacity 0.15s;
  opacity: 0.6;
  flex-shrink: 0;
  padding: 0;
}
.code-theme-dot:hover {
  transform: scale(1.25);
  opacity: 1;
}
.code-theme-dot.active {
  opacity: 1;
  box-shadow: 0 0 6px rgba(255,255,255,0.3);
}

/* 三色 */
.code-theme-dot-dracula        { background: #ff5f57; }
.code-theme-dot-solarizedlight { background: #febc2e; }
.code-theme-dot-coy            { background: #28c840; }

/* 圆点 Tooltip */
.code-theme-dot::after {
  content: attr(data-tip);
  position: absolute;
  top: -28px;
  left: 50%;
  transform: translateX(-50%) scale(0);
  background: #1e293b;
  color: #e2e8f0;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: all 0.15s;
}
.code-theme-dot:hover::after {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}
.code-block pre::-webkit-scrollbar {
  height: 6px;
}
.code-block pre::-webkit-scrollbar-track {
  background: #1e293b;
}
.code-block pre::-webkit-scrollbar-thumb {
  background: #475569;
  border-radius: 3px;
}

/* 试一试按钮 */
.btn-try {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 24px;
  background: #10b981;
  color: var(--color-white);
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
  margin-bottom: 32px;
}

.btn-try:hover {
  background: #059669;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16,185,129,0.3);
}

/* 提示框 */
.note-box {
  padding: 16px 20px;
  border-radius: 8px;
  margin: 20px 0 24px;
  font-size: calc(var(--text-size) - 1px);
  line-height: 1.7;
}

.note-box.info {
  background: #eff6ff;
  border-left: 4px solid var(--color-primary);
  color: #1e40af;
}

.note-box.warning {
  background: #fffbeb;
  border-left: 4px solid var(--color-accent);
  color: #92400e;
}

.note-box.tip {
  background: #ecfdf5;
  border-left: 4px solid #10b981;
  color: #065f46;
}

/* 上下页导航 */
.page-nav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--color-border);
}

.page-nav a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 32px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 700;
  color: var(--color-accent);
  text-decoration: none;
  border: 2px solid var(--color-accent);
  background: transparent;
  transition: all 0.2s;
}

.page-nav a:hover {
  background: var(--color-accent);
  color: var(--color-white);
}

.page-nav .nav-next {
  margin-left: auto;
}

.lesson-nav { display: flex; justify-content: space-between; margin: 40px 0; padding: 20px 0; border-top: 1px solid var(--color-border); }
.lesson-nav-item { padding: 10px 24px; border-radius: 8px; text-decoration: none; color: var(--color-text); background: var(--color-bg-hover); transition: background 0.2s; }
.lesson-nav-item:hover:not(.disabled) { background: var(--color-accent); color: #fff; }
.lesson-nav-item.disabled { opacity: 0.4; cursor: not-allowed; }

/* ---------- 右栏（广告/工具区） ---------- */
.tutorial-sidebar {
  width: 300px;
  flex-shrink: 0;
  background: var(--color-white);
  border-left: 1px solid var(--color-border-light);
  position: sticky;
  top: 72px;
  max-height: calc(100vh - 72px);
  display: flex;
  flex-direction: column;
  transition: width 0.3s ease;
}

/* 右栏收起状态 — 宽度收缩，内容区自动展开 */
.tutorial-sidebar.collapsed {
  width: 0;
  min-width: 0;
  border-left: none;
}

/* 固定广告区 — 始终显示在右栏顶部 */
.sidebar-ads {
  flex-shrink: 0;
  padding: 24px 20px 0;
}

/* 可滚动内容区 */
.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding: 0 20px 24px;
}

/* 收起时隐藏内部内容 */
.tutorial-sidebar.collapsed .sidebar-ads,
.tutorial-sidebar.collapsed .sidebar-scroll,
.tutorial-sidebar.collapsed .sidebar-toggle-text {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}

/* 收起/展开按钮 — 位于右栏左侧边缘 */
.sidebar-toggle {
  position: absolute;
  left: -29px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  width: 28px;
  height: 48px;
  border: 1px solid var(--color-border);
  border-right: none;
  border-radius: 8px 0 0 8px;
  background: var(--color-white);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--color-muted);
  transition: all 0.2s;
  box-shadow: -2px 0 8px rgba(0,0,0,0.06);
  padding: 0;
}

.sidebar-toggle:hover {
  background: var(--color-bg-hover);
  color: var(--color-primary);
}

.tutorial-sidebar.collapsed .sidebar-toggle {
  left: -28px;
  z-index: 110;
}

/* 右栏滚动条 */
.sidebar-scroll::-webkit-scrollbar {
  width: 4px;
}
.sidebar-scroll::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar-scroll::-webkit-scrollbar-thumb {
  background: var(--color-scrollbar);
  border-radius: 4px;
}

/* ---------- 回到顶部浮动按钮 ---------- */
#backTop {
  position: fixed;
  right: 24px;
  bottom: 32px;
  z-index: 999;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: none;
  background: var(--color-primary);
  color: var(--color-white);
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(37,99,235,0.3);
  transition: all 0.2s;
  opacity: 0;
  pointer-events: none;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

#backTop.show {
  opacity: 1;
  pointer-events: auto;
}

#backTop:hover {
  background: var(--color-accent);
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(245,158,11,0.35);
}

/* 手机端大小调整 */
@media (max-width: 768px) {
  #backTop { right: 16px; bottom: 24px; width: 44px; height: 44px; font-size: 18px; }
  .menu-toggle { width: 44px; height: 44px; padding: 8px; }
}

/* ---------- 浮动字体大小工具条 — 竖条 ---------- */
.font-toolbar {
  position: fixed;
  right: 300px;
  top: 30%;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: var(--color-primary);
  border-radius: 8px 0 0 8px;
  padding: 6px 4px;
  box-shadow: -2px 0 12px rgba(37,99,235,0.25);
  transition: opacity 0.6s ease, box-shadow 0.4s ease, right 0.3s ease;
  opacity: 1;
}

.font-toolbar.dimmed {
  opacity: 0.25;
  box-shadow: none;
}

.font-toolbar.highlight {
  opacity: 1;
  box-shadow: -2px 0 16px rgba(37,99,235,0.45);
}

.font-toolbar:hover {
  opacity: 1;
  box-shadow: -2px 0 12px rgba(37,99,235,0.25);
}

.ft-btn {
  width: 30px;
  height: 30px;
  border: none;
  background: transparent;
  color: var(--color-white);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  line-height: 1;
  padding: 0;
}

.ft-btn:hover {
  background: var(--color-accent);
}

.ft-label {
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  color: rgba(255,255,255,0.85);
  line-height: 1;
  padding: 3px 0;
  letter-spacing: 1px;
}

@media (max-width: 1024px) {
  .font-toolbar { right: 240px; }
  .tutorial-sidebar.collapsed + .font-toolbar { right: 25px; }
  .ft-btn { width: 26px; height: 26px; font-size: 12px; }
  .ft-label { font-size: 8px; letter-spacing: 1px; }
}

@media (max-width: 768px) {
  .font-toolbar { display: none; }
}

.sidebar-widget {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--color-border);
}

.sidebar-widget:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.sidebar-widget h4 {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
}

.sidebar-widget p {
  font-size: 13px;
  color: var(--color-light);
  line-height: 1.6;
}

/* 右栏本页目录 — tocbot 覆盖 */
.sidebar-toc {
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--color-border);
}
.sidebar-toc .toc { padding: 0; overflow: visible; }
.sidebar-toc .toc-list,
.sidebar-toc .toc-list .toc-list {
  padding-left: 0;
  margin: 0;
}
.sidebar-toc .toc-list li {
  list-style: none;
  margin: 0;
}
.sidebar-toc .toc-list .toc-list {
  padding-left: 14px;
}
.sidebar-toc .toc-link {
  display: block !important;
  height: auto !important;
  font-size: 14px;
  color: var(--color-light) !important;
  line-height: 1.7;
  padding: 3px 0 3px 12px;
  border-left: 2px solid transparent;
  transition: all 0.15s;
  text-decoration: none;
  position: relative;
  cursor: pointer;
}
.sidebar-toc .toc-list .toc-list .toc-link {
  font-size: 13px;
  padding-left: 12px;
}
.sidebar-toc .toc-link:hover {
  color: var(--color-accent) !important;
  border-left-color: var(--color-accent);
}
.sidebar-toc .is-active-link {
  color: var(--color-accent) !important;
  border-left-color: var(--color-accent);
  font-weight: 600;
}
/* 彻底去掉 tocbot 默认的伪元素装饰线 */
.sidebar-toc .toc-link::before,
.sidebar-toc .is-active-link::before {
  display: none !important;
  content: none !important;
}
.sidebar-toc-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-heading);
  background: var(--color-bg-hover);
  padding: 8px 20px;
  margin: 0 -20px 12px;
}
.sidebar-toc-title .toc-icon {
  font-size: 20px;
  margin-right: 2px;
}

/* 右栏工具卡片 */
.sidebar-tool {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  text-decoration: none;
  transition: all 0.15s;
  margin-bottom: 8px;
}

.sidebar-tool:last-child {
  margin-bottom: 0;
}

.sidebar-tool:hover {
  border-color: var(--color-primary-border);
  background: var(--color-bg-active);
}

.sidebar-tool .tool-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  background: var(--color-white);
  border: 1px solid var(--color-border);
  flex-shrink: 0;
}

.sidebar-tool .tool-text {
  flex: 1;
}

.sidebar-tool .tool-text strong {
  display: block;
  font-size: 13px;
  color: var(--color-text);
  margin-bottom: 1px;
}

.sidebar-tool .tool-text span {
  font-size: 11px;
  color: var(--color-light);
}

/* 教程页响应式 — 与首页断点保持一致 */
@media (max-width: 1024px) {
  .toc-sidebar { width: 210px; }
  .tutorial-content { padding: 32px; }
  .tutorial-sidebar { width: 240px; }
  .sidebar-ads { padding: 16px 12px 0; }
  .sidebar-scroll { padding: 0 12px 16px; }
  .sidebar-widget h4 { font-size: 12px; }
  .sidebar-toggle { display: flex; }
  .font-toolbar { right: 240px; }
}

@media (max-width: 768px) {
  .tutorial-layout { flex-direction: column; }
  .toc-sidebar {
    width: 100%;
    height: auto;
    position: static;
    border-right: none;
    border-bottom: 1px solid var(--color-border-light);
    padding: 12px 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0;
  }
  .toc-header { display: none; }
  .toc-item { flex: 1 0 45%; padding: 8px 12px; font-size: 13px; }
  .toc-item .toc-num { width: 18px; height: 18px; font-size: 10px; }
  .tutorial-content { padding: 24px 16px; }
  .tutorial-content h1 { font-size: 24px; }
  .tutorial-content h2 { font-size: 18px; }
  .code-block pre { padding: 14px 16px; font-size: 13px; }
  .page-nav { flex-direction: column; }
  .page-nav .nav-next { margin-left: 0; }
  .btn-try { width: 100%; justify-content: center; }
  /* 手机端隐藏右栏及切换按钮 */
  .tutorial-sidebar { display: none; }
  .sidebar-toggle { display: none; }
}

/* ---------- 页脚小号文字 ---------- */
.footer-sm {
  font-size: 12px;
  color: var(--color-light);
  line-height: 1.8;
}
.footer-sm-link {
  display: block;
  margin-top: 4px;
  font-size: 12px;
}
.footer-col > .footer-sm-link:first-of-type {
  margin-top: 8px;
}

/* ---------- 教程页元素表格 ---------- */
.table-wrapper {
  overflow-x: auto;
  margin: 16px 0;
}
.elem-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  line-height: 1.6;
}
.elem-table thead th {
  background: var(--color-bg-hover);
  color: var(--color-text);
  font-weight: 700;
  padding: 10px 12px;
  text-align: left;
  border-bottom: 2px solid var(--color-primary);
  font-size: 13px;
}
.elem-table tbody td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
  vertical-align: middle;
}
.elem-table tbody tr:hover {
  background: var(--color-bg-hover);
}
.elem-table tbody td:first-child,
.elem-table tbody td:nth-child(3),
.elem-table tbody td:nth-child(5) {
  font-family: 'Courier New', Courier, monospace;
  font-size: 13px;
  color: var(--color-primary);
  white-space: nowrap;
}
.elem-table tbody td:nth-child(2),
.elem-table tbody td:nth-child(4),
.elem-table tbody td:nth-child(6) {
  color: var(--color-muted);
}
@media (max-width: 768px) {
  .elem-table { font-size: 12px; }
  .elem-table thead th { padding: 6px 8px; font-size: 11px; }
  .elem-table tbody td { padding: 5px 6px; }
}

/* ========================================
   广告位预留 — 仅HTML标记，浏览器不可见
   Google AdSense 自动广告启用后自动填充
   ======================================== */

/* ---------- 通用：预留容器均隐藏 ---------- */
.ad-hero-bottom,
.ad-category-gap,
.ad-home-footer,
.sidebar-ads,
.ad-widget,
.ad-inline,
.ad-bottom,
.ad-interstitial,
.ad-interstitial-backdrop,
.ad-interstitial-modal,
.ad-interstitial-adzone,
.ad-interstitial-footer,
.ad-placeholder,
.ad-label {
  display: none;
}

/* ---------- 减少动画 (无障碍) — 本站无闪烁/跳动动画，不加限制 ---------- */

/* ========================================
   教程页通用组件（editor-modal 等）
   ======================================== */

/* 编辑器模态窗 */
.editor-modal {
  display: none; position: fixed; z-index: 9999; inset: 0;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
}
.editor-modal.show { display: flex; align-items:center; justify-content:center; }
.editor-modal-box {
  width:90%; height:90%; max-width:1400px;
  background:#1e1e2e; border-radius:12px; overflow:hidden;
  box-shadow:0 20px 60px rgba(0,0,0,0.5);
  display:flex; flex-direction:column;
}
.editor-modal-box iframe {
  flex:1; border:none; width:100%; height:100%;
}
@media (max-width:768px) {
  .editor-modal-box { width:100%; height:100%; border-radius:0; }
}

/* ========== 施工页 (Construction Page) ========== */
.construction-hero {
  text-align:center; padding:80px 24px; max-width:720px; margin:0 auto;
}
.construction-icon {font-size:128px; margin-bottom:16px; line-height:1.2; }
.construction-icon svg.icon-svg { width:128px; height:128px; }

.construction-hero h1 {
  font-size:36px; color:var(--color-heading); margin-bottom:16px;
}
.construction-lead {
  font-size:17px; color:var(--color-text); line-height:1.8; margin-bottom:40px;
  text-align:left;
}
.construction-card {
  background:#fff; border:1px solid var(--color-border); border-radius:12px;
  padding:32px 40px; text-align:left; margin-bottom:32px;
  box-shadow:0 2px 12px rgba(0,0,0,0.04);
}
.construction-card h2 {
  font-size:24px; color:var(--color-heading); margin-bottom:12px;
}
.construction-card p {
  font-size:15px; color:var(--color-text-muted); line-height:1.8; margin-bottom:8px;
}
.construction-note { color:var(--color-accent, #2563eb) !important; }
.construction-links { margin-top:16px; }
.construction-links .btn-back {
  display:inline-block; padding:10px 28px; background:var(--color-accent, #2563eb);
  color:#fff; border-radius:8px; text-decoration:none; font-size:15px; font-weight:500;
  transition:opacity 0.2s;
}
.construction-links .btn-back:hover { opacity:0.88; }
@media (max-width:768px) {
  .construction-hero { padding:40px 16px; }
  .construction-hero h1 { font-size:28px; }
  .construction-card { padding:24px 20px; }
}

/* ── 参考手册页表（与教程页表格风格一致） ── */
.ref-table { width:100%; border-collapse:collapse; margin:20px 0; font-size:var(--text-size,14px); line-height:1.7; }
.ref-table thead th {
  background:#f0f2f5; color:#1e1e2e; padding:10px 14px; text-align:left;
  font-weight:600; border:1px solid #d0d3d8;
}
.ref-table tbody td {
  padding:10px 14px; border:1px solid #d0d3d8; vertical-align:top;
  color:#333; background:#fff;
}
.ref-table tbody tr:nth-child(even) td { background:#f8f9fb; }
.ref-table tbody tr:hover td { background:#eef0f4; }
.ref-table .tag-name {
  font-family:'Consolas','Courier New',monospace; color:#1a73e8;
  white-space:nowrap; font-weight:600;
}
.ref-table .tag-desc { color:#444; line-height:1.6; }

/* ── 标签徽标（通用，不限于参考手册） ── */
.tag-badge {
  display:inline-block; font-size:11px; padding:1px 6px; border-radius:3px;
  margin-left:4px; font-weight:600;
}
.badge-new { background:#1b8a3d; color:#fff; }
.badge-deprecated { background:#d93025; color:#fff; }
.badge-obsolete { background:#5f6368; color:#fff; }

/* ── 参考手册页字母分组 + A-Z 索引 + 筛选按钮 ── */
.letter-group { margin-top:4px; }
.letter-header {
  font-size:2rem; font-weight:700; color:#1a73e8; padding:8px 0 4px;
  margin-bottom:0; letter-spacing:1px;
}
.az-index { margin-top:16px; padding-top:12px; border-top:1px solid #e0e3e8; }
.az-index-title { font-size:12px; color:#666; margin-bottom:8px; font-weight:600; }
.az-index-grid { display:flex; flex-wrap:wrap; gap:4px; }
.az-index-grid a {
  display:inline-flex; align-items:center; justify-content:center;
  width:28px; height:28px; border-radius:4px; background:#e8eaed;
  color:#333; font-size:12px; font-weight:600; text-decoration:none;
  transition:all .15s;
}
.az-index-grid a:hover { background:#1a73e8; color:#fff; }
.filter-bar { display:flex; flex-wrap:wrap; gap:6px; margin:16px 0; }
.filter-btn {
  padding:4px 12px; border:1px solid #d0d3d8; border-radius:4px;
  background:#f8f9fb; color:#444; font-size:12px; cursor:pointer;
  transition:all .15s;
}
.filter-btn:hover { background:#e8eaed; color:#1a73e8; border-color:#1a73e8; }
.filter-btn.active { background:#1a73e8; color:#fff; border-color:#1a73e8; font-weight:600; }
