:root {
  --paper: #f6f7f4;
  --surface: #ffffff;
  --surface-soft: #eef3f5;
  --ink: #172126;
  --muted: #66747a;
  --line: #dce3e4;
  --blue: #2188c9;
  --blue-dark: #176994;
  --blue-soft: #e3f2fa;
  --sage: #2e7d65;
  --sage-soft: #e4f2ed;
  --amber: #a36716;
  --amber-soft: #f8edd9;
  --violet: #6d5ca6;
  --violet-soft: #eeeafb;
  --danger: #a54444;
  --shadow: 0 24px 70px rgba(30, 54, 64, 0.1);
  --radius-xl: 32px;
  --radius-lg: 22px;
  --radius-md: 14px;
  --content: 1180px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button { color: inherit; }
code, pre, .command-name {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.shell { width: min(calc(100% - 40px), var(--content)); margin: 0 auto; }
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
  backdrop-filter: blur(18px);
}
.nav {
  min-height: 68px;
  display: flex;
  align-items: center;
  gap: 28px;
}
.brand { display: flex; align-items: center; gap: 11px; font-weight: 760; letter-spacing: -0.02em; }
.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 10px 10px 10px 3px;
  background: linear-gradient(145deg, #63c0ef, var(--blue));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.35), 0 8px 18px rgba(33,136,201,.2);
  position: relative;
}
.brand-mark::after {
  content: "";
  position: absolute;
  width: 9px;
  height: 9px;
  border: 2px solid white;
  border-top: 0;
  border-left: 0;
  transform: rotate(-45deg);
  left: 8px;
  top: 8px;
}
.nav-links { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.nav-links a {
  color: var(--muted);
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 650;
}
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--ink); background: var(--surface); }
.search-link { border: 1px solid var(--line); background: var(--surface); }
.mobile-nav { display: none; margin-left: auto; border: 0; background: transparent; font-size: 22px; }

.hero { padding: 94px 0 66px; }
.hero-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 74px; align-items: center; }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--blue-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .09em;
  text-transform: uppercase;
}
.eyebrow::before { content: ""; width: 22px; height: 2px; background: currentColor; }
h1, h2, h3 { letter-spacing: -.045em; line-height: 1.12; margin-top: 0; text-wrap: balance; }
h1 { font-size: clamp(48px, 6.7vw, 88px); margin: 22px 0 25px; max-width: 780px; }
.hero h1 > span { display: block; }
h2 { font-size: clamp(34px, 4.5vw, 58px); margin-bottom: 18px; }
h3 { font-size: 23px; margin-bottom: 10px; }
.lead { color: var(--muted); font-size: clamp(17px, 2vw, 21px); max-width: 650px; }
.hero-actions { display: flex; gap: 11px; margin-top: 34px; flex-wrap: wrap; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  font-weight: 720;
  cursor: pointer;
}
.button:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(20,40,50,.08); }
.button.primary { background: var(--ink); color: white; border-color: var(--ink); }
.button.blue { background: var(--blue); color: white; border-color: var(--blue); }
.button.small { min-height: 36px; padding: 0 12px; font-size: 13px; border-radius: 10px; }

.path-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 32px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.path-card::before {
  content: "";
  position: absolute;
  width: 250px;
  height: 250px;
  border-radius: 50%;
  background: var(--blue-soft);
  right: -110px;
  top: -120px;
}
.path-title { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; }
.path-step { display: grid; grid-template-columns: 48px 1fr; gap: 16px; align-items: center; position: relative; padding: 17px 0; }
.path-step + .path-step::before { content: ""; position: absolute; width: 2px; height: 18px; background: var(--line); left: 23px; top: -9px; }
.level-dot { width: 48px; height: 48px; border-radius: 15px; display: grid; place-items: center; font-weight: 850; }
.level-1 { background: var(--blue-soft); color: var(--blue-dark); }
.level-2 { background: var(--sage-soft); color: var(--sage); }
.level-3 { background: var(--violet-soft); color: var(--violet); }
.path-step b { display: block; }
.path-step small { color: var(--muted); }

.section { padding: 88px 0; }
.section.soft { background: var(--surface-soft); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section-heading { max-width: 720px; margin-bottom: 42px; }
.section-heading p { color: var(--muted); font-size: 18px; }
.level-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.level-card {
  min-height: 410px;
  padding: 30px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  transition: transform .2s ease, box-shadow .2s ease;
}
.level-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.level-label { display: flex; justify-content: space-between; align-items: center; font-size: 12px; font-weight: 800; letter-spacing: .08em; color: var(--muted); }
.level-number { font-size: 70px; font-weight: 800; line-height: 1; color: var(--line); letter-spacing: -.08em; margin: 64px 0 20px; }
.level-card p { color: var(--muted); margin: 0 0 24px; }
.level-card .card-link { margin-top: auto; font-weight: 760; color: var(--blue-dark); }
.tag { display: inline-flex; align-items: center; min-height: 25px; padding: 0 9px; border-radius: 99px; background: var(--blue-soft); color: var(--blue-dark); font-size: 11px; font-weight: 760; }
.tag.green { background: var(--sage-soft); color: var(--sage); }
.tag.purple { background: var(--violet-soft); color: var(--violet); }
.tag.amber { background: var(--amber-soft); color: var(--amber); }
.tag.gray { background: #edf0f0; color: #5d696e; }

.page-hero { padding: 72px 0 50px; border-bottom: 1px solid var(--line); }
.page-hero h1 { font-size: clamp(44px, 6vw, 72px); margin-bottom: 18px; }
.page-hero .lead { max-width: 760px; }
.breadcrumbs { color: var(--muted); font-size: 13px; margin-bottom: 20px; }
.breadcrumbs a:hover { color: var(--blue-dark); }
.level-chip { display: inline-flex; gap: 8px; align-items: center; border-radius: 99px; padding: 7px 11px; background: var(--surface); border: 1px solid var(--line); font-size: 12px; font-weight: 780; }

.docs-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 56px; padding: 56px 0 100px; }
.side-index { position: sticky; top: 92px; align-self: start; }
.side-index strong { display: block; font-size: 12px; letter-spacing: .08em; color: var(--muted); margin-bottom: 12px; }
.side-index a { display: block; padding: 7px 10px; border-left: 2px solid var(--line); color: var(--muted); font-size: 14px; }
.side-index a:hover { color: var(--ink); border-color: var(--blue); }
.lesson { scroll-margin-top: 94px; padding: 8px 0 74px; }
.lesson + .lesson { border-top: 1px solid var(--line); padding-top: 64px; }
.lesson-number { color: var(--blue-dark); font-weight: 800; font-size: 13px; letter-spacing: .08em; }
.lesson h2 { font-size: clamp(32px, 4vw, 48px); margin: 12px 0 15px; }
.lesson-intro { color: var(--muted); font-size: 18px; max-width: 700px; }
.tip, .notice { margin: 24px 0; padding: 17px 19px; border-radius: var(--radius-md); border: 1px solid var(--line); background: var(--surface); }
.tip { border-left: 4px solid var(--blue); }
.notice { border-left: 4px solid var(--amber); background: var(--amber-soft); }

.telegram-frame {
  max-width: 680px;
  background: #dceaf0;
  border: 1px solid #cadce3;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 22px 50px rgba(30,70,90,.12);
  margin: 28px 0;
}
.telegram-bar { height: 58px; background: white; padding: 10px 17px; display: flex; align-items: center; gap: 10px; }
.tg-avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--blue); color: white; font-weight: 800; }
.telegram-bar small { display: block; color: var(--muted); font-size: 10px; }
.telegram-body { padding: 20px 14px 24px; }
.bubble { width: fit-content; max-width: 85%; border-radius: 14px 14px 14px 4px; padding: 10px 12px; background: white; margin: 8px 0; font-size: 14px; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.bubble.user { margin-left: auto; background: #d9f7cf; border-radius: 14px 14px 4px 14px; }
.tg-card { background: white; border-radius: 16px; padding: 15px; margin-top: 10px; max-width: 92%; }
.tg-card p { margin: 7px 0; color: #4f6067; }
.tg-buttons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; overflow: hidden; border-radius: 9px; margin-top: 10px; }
.tg-buttons span { background: #e8f5fb; color: #197cad; padding: 9px 5px; text-align: center; font-size: 12px; font-weight: 720; }

.feature-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; margin-top: 32px; }
.feature-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 27px; min-height: 230px; }
.feature-card.wide { grid-column: span 2; }
.feature-card p { color: var(--muted); }
.feature-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 22px; }
.route { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; margin-top: 20px; color: var(--muted); font-size: 13px; }
.route span { background: var(--surface-soft); border-radius: 8px; padding: 5px 8px; color: var(--ink); }

.master-tools { position: sticky; top: 69px; z-index: 30; background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(16px); border-bottom: 1px solid var(--line); }
.tools-inner { padding: 16px 0; display: grid; grid-template-columns: minmax(240px, 1fr) auto; gap: 14px; align-items: center; }
.command-search { position: relative; }
.command-search input { width: 100%; height: 46px; padding: 0 46px 0 16px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); outline: none; }
.command-search input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
.key-hint { position: absolute; right: 10px; top: 9px; border: 1px solid var(--line); border-radius: 7px; padding: 3px 6px; color: var(--muted); background: var(--paper); font-size: 11px; }
.filters { display: flex; gap: 7px; flex-wrap: wrap; }
.filter { border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 8px 12px; font-size: 12px; cursor: pointer; }
.filter.active { background: var(--ink); color: white; border-color: var(--ink); }
.master-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 48px; padding: 44px 0 100px; }
.command-count { color: var(--muted); font-size: 13px; margin-bottom: 20px; }
.command-list { display: grid; gap: 14px; }
.command-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; scroll-margin-top: 150px; }
.command-summary { width: 100%; border: 0; background: transparent; text-align: left; padding: 20px; display: grid; grid-template-columns: minmax(140px, .5fr) 1.5fr auto; gap: 18px; align-items: center; cursor: pointer; }
.command-summary:hover { background: #fbfcfc; }
.command-name { color: var(--blue-dark); font-weight: 800; font-size: 15px; }
.command-purpose { color: var(--muted); font-size: 14px; }
.command-meta { display: flex; gap: 5px; flex-wrap: wrap; justify-content: flex-end; }
.command-detail { display: none; padding: 0 20px 22px; border-top: 1px solid var(--line); }
.command-card.open .command-detail { display: block; }
.command-card.open .command-summary { background: var(--surface-soft); }
.detail-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px; margin-top: 20px; }
.detail-block h4 { margin: 0 0 7px; font-size: 12px; letter-spacing: .07em; color: var(--muted); }
.detail-block p { margin: 0; }
.code-line { display: flex; align-items: center; gap: 10px; border: 1px solid #24343b; background: #172126; color: #e9f3f5; border-radius: 11px; padding: 12px 13px; overflow-x: auto; }
.code-line code { flex: 1; white-space: nowrap; font-size: 13px; }
.copy { flex: none; border: 1px solid #53656c; background: #293a41; color: white; border-radius: 8px; padding: 5px 9px; cursor: pointer; font-size: 11px; }
.output { background: var(--surface-soft); border-radius: 11px; padding: 13px; white-space: pre-wrap; font-size: 13px; color: #405159; }
.empty-state { text-align: center; padding: 70px 20px; color: var(--muted); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius-lg); }

.site-footer { border-top: 1px solid var(--line); padding: 30px 0 40px; color: var(--muted); font-size: 13px; }
.footer-inner { display: flex; justify-content: space-between; gap: 20px; }
.mobile-tabbar { display: none; }

@media (max-width: 900px) {
  .hero-grid, .docs-layout, .master-layout { grid-template-columns: 1fr; }
  .hero { padding-top: 66px; }
  .path-card { max-width: 620px; }
  .level-grid { grid-template-columns: 1fr; }
  .level-card { min-height: 300px; }
  .level-number { margin-top: 34px; }
  .side-index { position: static; display: flex; gap: 7px; flex-wrap: wrap; }
  .side-index strong { width: 100%; }
  .side-index a { border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
  .tools-inner { grid-template-columns: 1fr; }
  .master-tools { top: 68px; }
  .master-layout .side-index { display: none; }
}

@media (max-width: 680px) {
  body { font-size: 16px; padding-bottom: calc(74px + env(safe-area-inset-bottom)); }
  .shell { width: min(calc(100% - 32px), var(--content)); }
  .nav { min-height: 62px; }
  .brand { font-size: 15px; }
  .brand-mark { width: 28px; height: 28px; }
  .nav-links { display: none; position: absolute; left: 12px; right: 12px; top: 61px; padding: 10px; flex-direction: column; align-items: stretch; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
  .nav-links.open { display: flex; }
  .nav-links a { min-height: 48px; display: flex; align-items: center; padding: 0 14px; }
  .mobile-nav { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; }
  .mobile-nav:active { background: var(--surface-soft); }
  .hero { padding: 42px 0 40px; }
  .hero-grid { gap: 36px; }
  h1 { font-size: clamp(38px, 10.5vw, 42px); line-height: 1.1; margin: 17px 0 18px; }
  .hero-title-line { white-space: nowrap; letter-spacing: -.065em; }
  .section-heading h2 > span { display: block; }
  h2 { font-size: clamp(31px, 9vw, 40px); }
  h3 { font-size: 21px; }
  .lead { font-size: 17px; line-height: 1.7; }
  .hero-actions { display: grid; grid-template-columns: 1fr; width: 100%; }
  .button { width: 100%; min-height: 50px; }
  .section { padding: 56px 0; }
  .section-heading { margin-bottom: 28px; }
  .section-heading p { font-size: 16px; }
  .path-card { padding: 22px; border-radius: 24px; }
  .path-step { grid-template-columns: 44px 1fr; gap: 13px; padding: 14px 0; }
  .level-dot { width: 44px; height: 44px; border-radius: 13px; }
  .path-step + .path-step::before { left: 21px; }
  .feature-grid { grid-template-columns: 1fr; }
  .feature-card.wide { grid-column: auto; }
  .level-card { min-height: 0; padding: 24px; }
  .level-number { font-size: 54px; margin: 26px 0 16px; }
  .page-hero { padding: 38px 0 32px; }
  .page-hero h1 { font-size: clamp(38px, 11vw, 48px); }
  .breadcrumbs { margin-bottom: 14px; }
  .docs-layout { gap: 28px; padding: 0 0 68px; }
  .docs-layout > .side-index {
    position: sticky;
    top: 62px;
    z-index: 25;
    flex-wrap: nowrap;
    overflow-x: auto;
    margin: 0 -16px;
    padding: 10px 16px;
    background: color-mix(in srgb, var(--paper) 94%, transparent);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
    scrollbar-width: none;
  }
  .docs-layout > .side-index::-webkit-scrollbar { display: none; }
  .docs-layout > .side-index strong { display: none; }
  .docs-layout > .side-index a { flex: none; min-height: 40px; display: flex; align-items: center; padding: 0 12px; }
  .lesson { padding: 2px 0 56px; scroll-margin-top: 124px; }
  .lesson + .lesson { padding-top: 46px; }
  .lesson-intro { font-size: 17px; }
  .telegram-frame { width: 100%; margin: 22px 0; border-radius: 19px; }
  .telegram-body { padding: 16px 10px 19px; }
  .bubble { max-width: 91%; font-size: 13px; }
  .tg-card { max-width: 100%; padding: 13px; }
  .tg-buttons { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tg-buttons span { min-height: 42px; display: grid; place-items: center; padding: 7px 3px; font-size: 11px; line-height: 1.3; }
  .feature-card { min-height: 0; padding: 22px; }
  .tip, .notice { padding: 15px 16px; }
  .route { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
  .route span { flex: none; }
  .master-tools { top: 62px; }
  .tools-inner { padding: 11px 0 9px; gap: 9px; }
  .command-search input { height: 48px; padding-right: 14px; font-size: 16px; }
  .key-hint { display: none; }
  .filters { margin: 0 -16px; padding: 0 16px 4px; scrollbar-width: none; }
  .filters::-webkit-scrollbar { display: none; }
  .filter { min-height: 40px; padding: 0 13px; }
  .master-layout { padding: 28px 0 68px; }
  .command-summary { grid-template-columns: 1fr; gap: 7px; }
  .command-summary { min-height: 110px; padding: 17px; }
  .command-name { font-size: 16px; }
  .command-meta { justify-content: flex-start; }
  .command-detail { padding: 0 16px 18px; }
  .detail-grid { grid-template-columns: 1fr; gap: 18px; }
  .code-line { align-items: stretch; flex-direction: column; }
  .code-line code { white-space: pre-wrap; overflow-wrap: anywhere; }
  .copy { min-height: 44px; }
  .filters { flex-wrap: nowrap; overflow-x: auto; }
  .filter { white-space: nowrap; }
  .footer-inner { flex-direction: column; }
  .site-footer { padding-bottom: 22px; }
  .mobile-tabbar {
    position: fixed;
    z-index: 60;
    left: 0;
    right: 0;
    bottom: 0;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    min-height: calc(64px + env(safe-area-inset-bottom));
    padding: 6px 6px env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    border-top: 1px solid var(--line);
    box-shadow: 0 -10px 30px rgba(25, 45, 55, .08);
    backdrop-filter: blur(18px);
  }
  .mobile-tabbar a {
    min-width: 0;
    min-height: 52px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 1px;
    border-radius: 11px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 720;
  }
  .mobile-tabbar a::before { font-size: 19px; line-height: 1.2; }
  .mobile-tabbar a[data-page="index"]::before { content: "⌂"; }
  .mobile-tabbar a[data-page="beginner"]::before { content: "①"; }
  .mobile-tabbar a[data-page="advanced"]::before { content: "②"; }
  .mobile-tabbar a[data-page="master"]::before { content: "③"; }
  .mobile-tabbar a.active { color: var(--blue-dark); background: var(--blue-soft); }
}

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