/* ============================================================
   OpenClaw 教程 — 共用样式
   提取自 index.html 主站深色主题，扩展教程页面专用样式
   ============================================================ */

/* ---- CSS Variables (from index.html) ---- */
:root {
  --bg: #0c0b0f;
  --surface: #14131a;
  --surface-2: #1c1b23;
  --surface-3: #24232d;
  --border: #2a2933;
  --border-light: #3a3946;
  --text: #edecf0;
  --text-secondary: #a09cac;
  --text-muted: #6b6779;
  --accent: #f0a45b;
  --accent-dim: rgba(240, 164, 91, .12);
  --accent-glow: rgba(240, 164, 91, .25);
  --lavender: #b4a7d6;
  --lavender-dim: rgba(180, 167, 214, .12);
  --mint: #7ed6b8;
  --mint-dim: rgba(126, 214, 184, .12);
  --rose: #e8889a;
  --rose-dim: rgba(232, 136, 154, .12);
  --sky: #7db8e8;
  --sky-dim: rgba(125, 184, 232, .12);
  --peach: #f0c090;
  --peach-dim: rgba(240, 192, 144, .10);
  --lime: #b8e070;
  --lime-dim: rgba(184, 224, 112, .10);

  /* Tutorial-specific */
  --sidebar-w: 260px;
  --topnav-h: 64px;
  --content-max: 820px;
}

/* ---- Reset & Base ---- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--topnav-h) + 24px); }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  line-height: 1.7;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Noise overlay (same as main site) */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.025'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9999;
}

/* Ambient glow */
.ambient { position: fixed; border-radius: 50%; filter: blur(150px); pointer-events: none; z-index: 0; }
.ambient-1 { width: 700px; height: 700px; background: radial-gradient(circle, rgba(240,164,91,.07), transparent 70%); top: -250px; right: 5%; }
.ambient-2 { width: 500px; height: 500px; background: radial-gradient(circle, rgba(180,167,214,.05), transparent 70%); top: 35%; left: -200px; }
.ambient-3 { width: 500px; height: 500px; background: radial-gradient(circle, rgba(126,214,184,.04), transparent 70%); bottom: 20%; right: -150px; }

a { color: var(--accent); text-decoration: none; transition: color .2s; }
a:hover { color: #f5b97a; }

/* ---- Top Navigation ---- */
.top-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topnav-h);
  background: rgba(12, 11, 15, .85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  z-index: 100;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  flex-shrink: 0;
}
.logo-mark {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent), var(--rose));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 4px 20px rgba(240,164,91,.2);
}
.logo-name {
  font-weight: 700;
  font-size: 18px;
  color: var(--text);
  letter-spacing: -.02em;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 20px;
}
.nav-link {
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
}
.nav-link:hover { color: var(--text); }
.nav-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px;
  background: var(--accent);
  color: #0c0b0f;
  border-radius: 10px;
  font-weight: 600;
  font-size: 13px;
  text-decoration: none;
  transition: all .2s;
  box-shadow: 0 2px 16px var(--accent-glow);
}
.nav-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 24px var(--accent-glow);
  color: #0c0b0f;
}

/* Hamburger */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  z-index: 110;
}
.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-secondary);
  border-radius: 2px;
  transition: all .3s;
}
.hamburger.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* ---- Layout ---- */
.layout {
  display: flex;
  margin-top: var(--topnav-h);
  min-height: calc(100vh - var(--topnav-h));
  position: relative;
  z-index: 1;
}

/* ---- Sidebar ---- */
.sidebar {
  position: fixed;
  top: var(--topnav-h);
  left: 0;
  width: var(--sidebar-w);
  height: calc(100vh - var(--topnav-h));
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 50;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.sidebar-inner { padding: 24px 0; }

.sidebar-title {
  padding: 0 20px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .1em;
  margin-bottom: 12px;
}

.sidebar-nav { list-style: none; }
.sidebar-nav li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  font-size: 14px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all .15s;
  border-left: 3px solid transparent;
  font-weight: 500;
}
.sidebar-nav li a:hover {
  color: var(--text);
  background: var(--surface-2);
}
.sidebar-nav li a.active {
  color: var(--accent);
  background: var(--accent-dim);
  border-left-color: var(--accent);
  font-weight: 600;
}
.sidebar-nav li a .nav-icon {
  font-size: 16px;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 40;
}
.sidebar-overlay.active { display: block; }

/* ---- Main Content ---- */
.content {
  margin-left: var(--sidebar-w);
  flex: 1;
  max-width: calc(var(--content-max) + 80px);
  padding: 32px 40px 80px;
  position: relative;
}

/* ---- Breadcrumb ---- */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 32px;
}
.breadcrumb a { color: var(--text-muted); font-weight: 500; }
.breadcrumb a:hover { color: var(--text-secondary); }
.breadcrumb .sep { color: var(--border-light); }
.breadcrumb .current { color: var(--text-secondary); }

/* ---- TOC (Table of Contents) ---- */
.toc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 40px;
}
.toc-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 12px;
}
.toc ul { list-style: none; }
.toc ul li { margin-bottom: 4px; }
.toc ul li a {
  display: block;
  padding: 5px 12px;
  font-size: 14px;
  color: var(--text-secondary);
  border-left: 2px solid var(--border);
  transition: all .15s;
}
.toc ul li a:hover {
  color: var(--text);
  border-left-color: var(--border-light);
}
.toc ul li a.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: var(--accent-dim);
  border-radius: 0 6px 6px 0;
}

/* ---- Content Typography ---- */
.content h1 {
  font-family: 'Playfair Display', 'Noto Sans SC', serif;
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.2;
  margin-bottom: 12px;
}
.content .page-desc {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 40px;
  line-height: 1.8;
}
.content h2 {
  font-family: 'Playfair Display', 'Noto Sans SC', serif;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -.01em;
  margin-top: 56px;
  margin-bottom: 20px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  line-height: 1.3;
}
.content h2:first-of-type { border-top: none; padding-top: 0; margin-top: 0; }
.content h3 {
  font-size: 19px;
  font-weight: 700;
  margin-top: 36px;
  margin-bottom: 14px;
  color: var(--text);
}
.content h4 {
  font-size: 16px;
  font-weight: 600;
  margin-top: 28px;
  margin-bottom: 10px;
  color: var(--text);
}
.content p {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.9;
  margin-bottom: 16px;
}
.content strong { color: var(--text); font-weight: 600; }
.content ul, .content ol {
  padding-left: 24px;
  margin-bottom: 16px;
}
.content li {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 6px;
}
.content li strong { color: var(--text); }

/* Inline code */
.content code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 6px;
  color: var(--accent);
  word-break: break-word;
}

/* ---- Code Blocks ---- */
.code-block {
  position: relative;
  margin-bottom: 20px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
}
.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.code-block-lang {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
}
.code-copy-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-family: 'Noto Sans SC', sans-serif;
  cursor: pointer;
  transition: all .2s;
  display: flex;
  align-items: center;
  gap: 4px;
}
.code-copy-btn:hover {
  color: var(--text-secondary);
  border-color: var(--border-light);
  background: var(--surface-3);
}
.code-copy-btn.copied {
  color: var(--mint);
  border-color: var(--mint);
}
.code-block pre {
  padding: 16px 20px;
  overflow-x: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  margin: 0;
}
.code-block pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
  color: inherit;
  border-radius: 0;
}
/* Syntax highlights */
.code-block .kw { color: var(--lavender); font-weight: 500; }
.code-block .str { color: var(--mint); }
.code-block .cm { color: var(--text-muted); font-style: italic; }
.code-block .fn { color: var(--sky); }
.code-block .num { color: var(--rose); }
.code-block .op { color: var(--text-muted); }
.code-block .var { color: var(--peach); }
.code-block .cmd { color: var(--accent); font-weight: 500; }

/* ---- Alert Boxes ---- */
.alert {
  padding: 16px 20px;
  border-radius: 12px;
  margin-bottom: 20px;
  font-size: 14px;
  line-height: 1.8;
  border: 1px solid;
  display: flex;
  gap: 12px;
}
.alert-icon {
  font-size: 18px;
  flex-shrink: 0;
  line-height: 1.6;
}
.alert-body { flex: 1; }
.alert-body strong { display: block; margin-bottom: 2px; }
.alert-body p { margin-bottom: 4px; font-size: 14px; }
.alert-body code {
  font-size: 12px;
  padding: 1px 6px;
}

/* Info (blue) */
.alert-info {
  background: var(--sky-dim);
  border-color: rgba(125, 184, 232, .2);
  color: var(--sky);
}
.alert-info strong { color: var(--sky); }

/* Warning (yellow/accent) */
.alert-warning {
  background: var(--accent-dim);
  border-color: rgba(240, 164, 91, .2);
  color: var(--peach);
}
.alert-warning strong { color: var(--accent); }

/* Danger (red) */
.alert-danger {
  background: var(--rose-dim);
  border-color: rgba(232, 136, 154, .2);
  color: var(--rose);
}
.alert-danger strong { color: var(--rose); }

/* Tip (green) */
.alert-tip {
  background: var(--mint-dim);
  border-color: rgba(126, 214, 184, .2);
  color: var(--mint);
}
.alert-tip strong { color: var(--mint); }

/* ---- Tables ---- */
.table-wrap {
  overflow-x: auto;
  margin-bottom: 20px;
  border-radius: 12px;
  border: 1px solid var(--border);
}
.content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  background: var(--surface);
}
.content thead { background: var(--surface-2); }
.content th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--text);
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.content td {
  padding: 12px 16px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  line-height: 1.6;
}
.content tr:last-child td { border-bottom: none; }
.content tr:hover td { background: var(--surface-2); }
.content td code {
  font-size: 12px;
  white-space: nowrap;
}

/* ---- Prev/Next Page Navigation ---- */
.page-nav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 64px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}
.page-nav a {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: all .2s;
  text-decoration: none;
  min-width: 0;
  flex: 1;
}
.page-nav a:hover {
  border-color: var(--border-light);
  background: var(--surface-2);
  transform: translateY(-2px);
}
.page-nav-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}
.page-nav-title {
  font-size: 15px;
  color: var(--text);
  font-weight: 600;
}
.page-nav .next {
  text-align: right;
  margin-left: auto;
}

/* ---- Guide Index Cards ---- */
.guide-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 40px;
}
.guide-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  transition: all .3s;
  text-decoration: none;
  position: relative;
  overflow: hidden;
}
.guide-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0;
  transition: opacity .3s;
}
.guide-card:hover {
  border-color: var(--border-light);
  transform: translateY(-3px);
  box-shadow: 0 12px 40px rgba(0,0,0,.3);
}
.guide-card:hover::before { opacity: 1; }
.guide-card-icon {
  font-size: 28px;
  margin-bottom: 12px;
}
.guide-card-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}
.guide-card-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
}
.guide-card-num {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.guide-card-time {
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Guide featured card (wide) */
.guide-card.featured {
  grid-column: span 2;
  background: linear-gradient(135deg, var(--surface), var(--surface-2));
  border-color: rgba(240, 164, 91, .15);
}
.guide-card.featured .guide-card-num {
  background: var(--accent);
  color: #0c0b0f;
}

/* ---- Steps ---- */
.steps {
  counter-reset: step;
}
.step {
  position: relative;
  padding-left: 56px;
  padding-bottom: 32px;
  margin-bottom: 8px;
}
.step::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Playfair Display', serif;
  font-size: 18px;
  font-weight: 800;
  color: var(--accent);
  z-index: 1;
}
.step::after {
  content: '';
  position: absolute;
  left: 19px;
  top: 44px;
  bottom: 0;
  width: 2px;
  background: var(--border);
}
.step:last-child::after { display: none; }
.step:last-child { padding-bottom: 0; }
.step h3 {
  margin-top: 0;
  font-size: 18px;
}

/* ---- Highlight gradient text ---- */
.hl {
  background: linear-gradient(135deg, var(--accent), var(--rose), var(--lavender));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ---- Time badge ---- */
.time-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  background: var(--mint-dim);
  border: 1px solid rgba(126, 214, 184, .2);
  border-radius: 100px;
  font-size: 13px;
  color: var(--mint);
  font-weight: 500;
  margin-bottom: 24px;
}

/* ---- Platform Tabs ---- */
.platform-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px;
  overflow-x: auto;
}
.platform-tab {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-muted);
  background: transparent;
  border: none;
  font-family: inherit;
  transition: all .2s;
  white-space: nowrap;
}
.platform-tab:hover { color: var(--text-secondary); }
.platform-tab.active {
  background: var(--accent-dim);
  color: var(--accent);
}
.platform-content {
  display: none;
}
.platform-content.active {
  display: block;
}

/* ---- Concept Card ---- */
.concept-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 16px;
  transition: all .2s;
}
.concept-card:hover {
  border-color: var(--border-light);
}
.concept-card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}
.concept-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.concept-card-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}
.concept-card-en {
  font-size: 13px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}
.concept-card p {
  font-size: 14px;
}

/* ---- Footer ---- */
.guide-footer {
  margin-left: var(--sidebar-w);
  padding: 32px 40px;
  border-top: 1px solid var(--border);
  text-align: center;
}
.guide-footer p {
  font-size: 13px;
  color: var(--text-muted);
}
.guide-footer a {
  color: var(--text-secondary);
}
.guide-footer a:hover { color: var(--accent); }

/* ---- Responsive ---- */

/* Tablet */
@media (max-width: 1000px) {
  .content {
    padding: 28px 32px 60px;
  }
  .guide-cards {
    grid-template-columns: 1fr;
  }
  .guide-card.featured {
    grid-column: span 1;
  }
}

/* Mobile */
@media (max-width: 768px) {
  :root {
    --sidebar-w: 280px;
  }

  .hamburger {
    display: flex;
  }

  .nav-right {
    display: none;
  }

  .sidebar {
    left: calc(-1 * var(--sidebar-w));
    transition: left .3s ease;
    z-index: 90;
    background: var(--bg);
  }
  .sidebar.open {
    left: 0;
  }

  .content {
    margin-left: 0;
    padding: 24px 20px 60px;
  }

  .guide-footer {
    margin-left: 0;
    padding: 24px 20px;
  }

  .content h1 { font-size: 28px; }
  .content h2 { font-size: 22px; }

  .page-nav {
    flex-direction: column;
  }
  .page-nav .next {
    text-align: left;
  }

  .table-wrap {
    margin-left: -20px;
    margin-right: -20px;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

  .guide-cards {
    grid-template-columns: 1fr;
  }
  .guide-card.featured {
    grid-column: span 1;
  }

  .platform-tabs {
    border-radius: 8px;
  }
}

/* Small mobile */
@media (max-width: 480px) {
  .code-block pre {
    padding: 12px 14px;
    font-size: 12px;
  }
  .alert {
    flex-direction: column;
    gap: 6px;
  }
}
