:root {
  --bg-deep: #04091a;
  --bg: #071634;
  --panel: rgba(255, 255, 255, 0.055);
  --panel-strong: rgba(255, 255, 255, 0.09);
  --ink: #f2f7ff;
  --muted: #a7c0e6;
  --line: rgba(150, 190, 255, 0.18);
  --line-strong: rgba(150, 190, 255, 0.34);
  --blue: #3d8bff;
  --blue-bright: #5aa2ff;
  --cyan: #35d6ff;
  --coral: #ff7d6b;
  --yellow: #ffd166;
  --good: #3ddc97;
  --code: #030a1c;
  --code-soft: rgba(255, 255, 255, 0.05);
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  --glow: 0 0 0 1px rgba(93, 162, 255, 0.35), 0 12px 34px rgba(30, 100, 220, 0.28);
  --radius: 12px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background-color: var(--bg-deep);
  background-image:
    radial-gradient(900px 520px at 78% -8%, rgba(61, 139, 255, 0.30), transparent 60%),
    radial-gradient(760px 460px at 4% 6%, rgba(53, 214, 255, 0.16), transparent 62%),
    radial-gradient(1000px 700px at 50% 108%, rgba(89, 60, 220, 0.22), transparent 60%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 62%);
  background-attachment: fixed;
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

::selection {
  background: rgba(61, 139, 255, 0.45);
  color: #ffffff;
}

:focus-visible {
  outline: 2px solid var(--blue-bright);
  outline-offset: 2px;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.03);
}

::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: rgba(150, 190, 255, 0.26);
  background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(150, 190, 255, 0.45);
  background-clip: content-box;
}

.layout {
  display: grid;
  grid-template-columns: 288px minmax(0, 1fr);
  min-height: 100vh;
}

/* ---------- sidebar ---------- */

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 30px 22px;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(61, 139, 255, 0.16), transparent 320px),
    rgba(4, 10, 26, 0.72);
  backdrop-filter: blur(18px);
  color: var(--ink);
  overflow: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 26px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  flex: none;
  border-radius: 13px;
  background: linear-gradient(140deg, var(--cyan), var(--blue));
  box-shadow: 0 10px 26px rgba(61, 139, 255, 0.42);
  color: #041028;
  font-weight: 900;
  font-size: 15px;
}

.brand h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
}

.brand p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.toc-title {
  margin: 24px 0 12px;
  color: rgba(167, 192, 230, 0.75);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.toc {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.toc a {
  position: relative;
  display: block;
  padding: 10px 13px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: rgba(233, 241, 255, 0.86);
  text-decoration: none;
  font-size: 14px;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.toc a:hover,
.toc a:focus-visible {
  border-color: var(--line);
  background: var(--panel);
  color: #ffffff;
  transform: translateX(3px);
}

.toc a.current {
  border-color: rgba(93, 162, 255, 0.45);
  background: linear-gradient(100deg, rgba(61, 139, 255, 0.30), rgba(53, 214, 255, 0.12));
  color: #ffffff;
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.toc a.current::before {
  content: "";
  position: absolute;
  top: 50%;
  left: -22px;
  width: 3px;
  height: 22px;
  transform: translateY(-50%);
  border-radius: 0 3px 3px 0;
  background: var(--cyan);
  box-shadow: 0 0 12px var(--cyan);
}

.switch-link {
  display: block;
  margin-top: 20px;
  padding: 13px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: var(--panel);
  color: #ffffff;
  text-decoration: none;
  font-size: 14px;
  font-weight: 800;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.switch-link:hover {
  border-color: var(--blue-bright);
  background: rgba(61, 139, 255, 0.20);
}

/* ---------- hero ---------- */

.main {
  min-width: 0;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: 40px;
  align-items: center;
  padding: 62px min(6vw, 72px) 38px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 16px;
  padding: 6px 14px 6px 10px;
  border: 1px solid rgba(53, 214, 255, 0.32);
  border-radius: 999px;
  background: rgba(53, 214, 255, 0.10);
  color: var(--cyan);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.eyebrow::before {
  content: "";
  width: 26px;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--cyan), var(--blue));
}

.hero h2 {
  max-width: 780px;
  margin: 0;
  background: linear-gradient(120deg, #ffffff 18%, #bcd8ff 62%, #7fd8ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-size: clamp(34px, 5vw, 60px);
  line-height: 1.08;
}

.hero-copy {
  max-width: 700px;
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 18px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 11px 20px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: var(--panel);
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.button:hover {
  border-color: var(--blue-bright);
  background: var(--panel-strong);
  transform: translateY(-2px);
}

.button.primary {
  border-color: transparent;
  background: linear-gradient(120deg, var(--blue), var(--cyan));
  color: #04122c;
  box-shadow: 0 12px 30px rgba(61, 139, 255, 0.40);
}

.button.primary:hover {
  box-shadow: 0 16px 40px rgba(61, 139, 255, 0.55);
}

.hero-shot,
.shot {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.hero-shot {
  box-shadow: var(--shadow), var(--glow);
}

.hero-shot img,
.shot img {
  display: block;
  width: 100%;
  height: auto;
}

.hero-shot img {
  aspect-ratio: 16 / 9;
  object-fit: cover;
  object-position: top left;
}

/* ---------- content ---------- */

.content {
  padding: 8px min(6vw, 72px) 80px;
}

.section {
  padding: 46px 0;
  border-top: 1px solid var(--line);
}

.section:first-child {
  border-top: 0;
}

.section h2 {
  margin: 0 0 14px;
  font-size: clamp(26px, 3vw, 36px);
  line-height: 1.2;
}

.lead {
  max-width: 880px;
  margin: 0 0 26px;
  color: var(--muted);
  font-size: 17px;
}

.lesson-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.lesson-card,
.panel {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  backdrop-filter: blur(10px);
}

.lesson-card {
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.lesson-card:hover {
  border-color: var(--line-strong);
  background: var(--panel-strong);
  transform: translateY(-3px);
}

.lesson-card strong {
  display: block;
  margin-bottom: 8px;
  color: #ffffff;
  font-size: 17px;
}

.lesson-card p,
.panel p {
  margin: 0;
  color: var(--muted);
}

.panel h3 {
  margin: 0 0 8px;
  color: #ffffff;
  font-size: 22px;
  line-height: 1.25;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.9fr);
  gap: 20px;
  align-items: start;
}

.steps,
.checklist {
  display: grid;
  gap: 12px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.steps li,
.checklist li {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  transition: border-color 0.18s ease, background 0.18s ease;
}

.steps li:hover,
.checklist li:hover {
  border-color: var(--line-strong);
  background: var(--panel-strong);
}

.steps {
  counter-reset: step;
}

.steps li {
  counter-increment: step;
}

.steps li::before,
.tick {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(140deg, var(--blue), var(--cyan));
  color: #04122c;
  font-weight: 900;
  box-shadow: 0 6px 16px rgba(61, 139, 255, 0.34);
}

.steps li::before {
  content: counter(step);
}

.tick {
  background: rgba(61, 220, 151, 0.16);
  color: var(--good);
  box-shadow: inset 0 0 0 1px rgba(61, 220, 151, 0.34);
}

.shot {
  margin-top: 18px;
  box-shadow: none;
}

.shot button {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}

.compact-shot {
  max-width: 360px;
}

.caption {
  margin: 0;
  padding: 11px 14px;
  border-top: 1px solid var(--line);
  background: rgba(4, 10, 26, 0.55);
  color: var(--muted);
  font-size: 13px;
}

.note {
  margin: 22px 0;
  padding: 16px 20px;
  border: 1px solid rgba(255, 209, 102, 0.30);
  border-left: 4px solid var(--yellow);
  border-radius: var(--radius);
  background: rgba(255, 209, 102, 0.09);
  color: #ffe9b8;
}

.note strong {
  color: var(--yellow);
}

/* ---------- code ---------- */

.command {
  overflow: hidden;
  margin: 20px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--code);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.command-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--code-soft);
  color: #d9e7ff;
  font-size: 13px;
  font-weight: 800;
}

.copy {
  min-width: 78px;
  min-height: 32px;
  padding: 6px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: rgba(61, 139, 255, 0.14);
  color: #ffffff;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.copy:hover {
  border-color: var(--blue-bright);
  background: rgba(61, 139, 255, 0.32);
}

pre {
  margin: 0;
  padding: 18px;
  overflow-x: auto;
  color: #d5e6ff;
  font-family: Consolas, "Courier New", monospace;
  font-size: 14px;
  line-height: 1.6;
}

code {
  font-family: Consolas, "Courier New", monospace;
}

.code-pill {
  display: inline-block;
  max-width: 100%;
  margin-top: 12px;
  padding: 9px 13px;
  overflow-wrap: anywhere;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: rgba(61, 139, 255, 0.13);
  color: #cfe3ff;
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px;
  text-decoration: none;
  transition: background 0.18s ease, border-color 0.18s ease;
}

a.code-pill:hover {
  border-color: var(--blue-bright);
  background: rgba(61, 139, 255, 0.28);
  color: #ffffff;
}

/* ---------- closing ---------- */

.final {
  margin-top: 20px;
  padding: 22px;
  border: 1px solid rgba(93, 162, 255, 0.34);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(61, 139, 255, 0.22), rgba(53, 214, 255, 0.10));
  box-shadow: var(--glow);
}

.final h3 {
  margin: 0 0 8px;
  color: #ffffff;
  font-size: 22px;
}

.final p {
  margin: 0;
  color: #cfe0fb;
}

/* ---------- modal ---------- */

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(2, 7, 18, 0.82);
  backdrop-filter: blur(6px);
  z-index: 20;
}

.modal.open {
  display: flex;
}

.modal-inner {
  width: min(1180px, 96vw);
  max-height: 92vh;
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #071634;
  box-shadow: var(--shadow);
}

.modal-head {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  background: #071634;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
}

.modal-close {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.modal-close:hover {
  border-color: var(--coral);
  background: rgba(255, 125, 107, 0.20);
}

.modal img {
  display: block;
  width: 100%;
  height: auto;
}

.footer {
  padding: 30px min(6vw, 72px);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}

/* ---------- responsive ---------- */

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .toc {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .toc a.current::before {
    display: none;
  }

  .hero,
  .split {
    grid-template-columns: 1fr;
  }

  .lesson-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .sidebar,
  .hero,
  .content,
  .footer {
    padding-left: 18px;
    padding-right: 18px;
  }

  .hero {
    padding-top: 34px;
  }

  .toc,
  .lesson-grid {
    grid-template-columns: 1fr;
  }

  .hero-actions {
    flex-direction: column;
  }

  .button {
    width: 100%;
  }

  .compact-shot {
    max-width: none;
  }
}

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