:root {
  --ink: #111827;
  --muted: #667085;
  --line: #e2e8f0;
  --surface: #ffffff;
  --surface-soft: #f6f8fc;
  --primary: #4058df;
  --primary-dark: #3045bd;
  --cyan: #5ee0d8;
  --shadow-sm: 0 10px 30px rgba(35, 52, 100, .06);
  --shadow-md: 0 20px 55px rgba(35, 52, 100, .11);
  --radius-lg: 22px;
  --radius-md: 16px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--surface);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
body { min-width: 0; }
a { color: inherit; text-decoration: none; }
img, video { max-width: 100%; }
button { font: inherit; }
.container { width: min(1120px, calc(100% - 40px)); min-width: 0; margin-inline: auto; }
.skip-link {
  position: fixed;
  left: 16px;
  top: -80px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: 8px;
  color: #fff;
  background: var(--ink);
}
.skip-link:focus { top: 16px; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* 顶部导航 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 70px;
  border-bottom: 1px solid rgba(226, 232, 240, .9);
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(14px);
}
.nav-wrap { position: relative; display: flex; height: 100%; align-items: center; justify-content: flex-end; }
.site-nav { display: flex; align-items: center; gap: 30px; font-size: 15px; font-weight: 700; }
.site-nav a { padding: 8px 0; transition: color .18s ease; }
.site-nav a:hover, .site-nav a:focus-visible { color: var(--primary); }
.nav-toggle { display: none; padding: 8px; border: 0; background: transparent; cursor: pointer; }
.nav-toggle span:not(.sr-only) { display: block; width: 24px; height: 2px; margin: 5px; background: var(--ink); }

/* 首页公告 */
.notice-strip { padding: 34px 0 0; background: #fbfcff; }
.announcement-list { display: grid; gap: 14px; }
.announcement {
  display: flex;
  min-height: 190px;
  padding: 34px 40px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.announcement > div { min-width: 0; }
.announcement h3 { margin: 0; font-size: clamp(22px, 2.4vw, 28px); line-height: 1.3; letter-spacing: -.025em; }
.announcement p { max-width: 880px; margin: 9px 0 0; color: var(--muted); font-size: 16px; white-space: pre-line; overflow-wrap: anywhere; }

/* 首页教程入口 */
.landing-main { min-height: calc(100vh - 294px); padding: 48px 0 76px; background: #fbfcff; }
.landing-heading { margin: 0 auto 28px; text-align: center; }
.landing-heading h1 { margin: 0; font-size: clamp(32px, 4vw, 44px); line-height: 1.2; letter-spacing: -.045em; }
.feature-grid { display: grid; width: min(900px, 100%); margin-inline: auto; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.feature-card {
  position: relative;
  display: flex;
  min-height: 214px;
  padding: 28px 30px;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  transition: transform .2s ease, box-shadow .2s ease;
}
.feature-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.feature-card:focus-visible { outline: 3px solid rgba(64, 88, 223, .28); outline-offset: 3px; }
.feature-card-accent { color: #fff; border-color: transparent; background: linear-gradient(145deg, #243273, #4055d2); }
.feature-icon {
  display: grid;
  width: 50px;
  height: 50px;
  place-items: center;
  border-radius: 14px;
  color: var(--primary);
  background: #edf0ff;
  font-size: 14px;
  font-weight: 900;
}
.feature-card-accent .feature-icon { color: #fff; background: rgba(255, 255, 255, .14); }
.feature-arrow { position: absolute; top: 27px; right: 29px; font-size: 24px; line-height: 1; }
.feature-card h2 { margin: 28px 0 0; font-size: clamp(21px, 2.2vw, 25px); line-height: 1.35; letter-spacing: -.025em; overflow-wrap: anywhere; }
.text-link { margin-top: auto; padding-top: 18px; color: var(--primary); font-size: 15px; font-weight: 800; }
.feature-card-accent .text-link { color: var(--cyan); }

/* 教程通用布局 */
.page-hero {
  padding: 46px 0 42px;
  border-bottom: 1px solid var(--line);
  background: radial-gradient(circle at 84% 18%, rgba(94, 224, 216, .14), transparent 25%), linear-gradient(145deg, #f7f9ff, #f1f8f8);
}
.tutorial-hero-inner { max-width: 930px; }
.eyebrow { display: inline-block; margin-bottom: 8px; color: var(--primary); font-size: 13px; font-weight: 800; letter-spacing: .1em; }
.page-hero h1 { margin: 0 0 11px; font-size: clamp(36px, 4.6vw, 54px); line-height: 1.12; letter-spacing: -.05em; }
.page-hero p { max-width: 820px; margin: 0; color: var(--muted); font-size: 17px; line-height: 1.75; }
.section { padding: 0; }
.tutorial-section-wrap { padding: 34px 0 58px; background: var(--surface-soft); }
.tutorial-layout { display: grid; grid-template-columns: 220px minmax(0, 800px); justify-content: center; align-items: start; gap: 28px; }
.tutorial-sidebar { position: sticky; top: 92px; }
.toc-card { min-width: 0; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius-md); background: #fff; box-shadow: var(--shadow-sm); }
.toc-card > strong { display: block; padding: 0 2px 10px; font-size: 14px; }
.toc-card nav { display: grid; }
.toc-card a { display: grid; grid-template-columns: 28px 1fr; gap: 5px; padding: 9px 2px; border-top: 1px solid #edf0f5; color: var(--muted); font-size: 13px; line-height: 1.45; }
.toc-card a:first-child { border-top: 0; }
.toc-card a:hover, .toc-card a:focus-visible { color: var(--primary); }
.toc-card a span { color: var(--primary); font-size: 10px; font-weight: 900; }
.tutorial-body { display: grid; min-width: 0; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.tutorial-step, .tutorial-step:last-child {
  position: relative;
  margin: 0;
  padding: 26px 28px;
  overflow: hidden;
  scroll-margin-top: 92px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 8px 26px rgba(35, 52, 100, .045);
}
.tutorial-step::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: linear-gradient(180deg, var(--primary), var(--cyan)); opacity: .85; }
.step-number { display: inline-flex; padding: 4px 9px; border-radius: 999px; color: var(--primary); background: #edf1ff; font-size: 10px; font-weight: 900; letter-spacing: .08em; }
.tutorial-step h2 { margin: 9px 0 11px; font-size: clamp(24px, 3vw, 28px); line-height: 1.3; letter-spacing: -.03em; overflow-wrap: anywhere; }
.prose { color: #4d586c; font-size: 15px; line-height: 1.78; overflow-wrap: anywhere; }
.prose p { margin: 0 0 8px; }
.prose p:last-child { margin-bottom: 0; }
.note { margin: 14px 0 0; padding: 11px 14px; border-left: 3px solid var(--primary); border-radius: 0 10px 10px 0; color: #40507b; background: #eef2ff; font-size: 14px; line-height: 1.65; overflow-wrap: anywhere; }
.button { display: inline-flex; min-height: 42px; padding: 8px 16px; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: 11px; font-size: 14px; font-weight: 750; transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.button:hover { transform: translateY(-2px); }
.button:focus-visible { outline: 3px solid rgba(64, 88, 223, .24); outline-offset: 2px; }
.button-secondary { border-color: var(--line); background: #fff; }
.button-secondary:hover { border-color: #cbd4e2; box-shadow: var(--shadow-sm); }
.external-action { display: flex; min-width: 0; margin-top: 15px; flex-direction: column; align-items: flex-start; gap: 6px; }
.external-action small { max-width: 100%; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.tutorial-media { display: block; margin-top: 16px; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 10px 30px rgba(35, 52, 100, .07); }
.tutorial-login-image { width: min(350px, 100%); }
.tutorial-video { display: block; width: 100%; height: auto; margin-top: 15px; border-radius: 14px; background: #0d1324; box-shadow: 0 14px 36px rgba(15, 25, 55, .15); }

/* Django 消息提示（主要用于管理相关跳转） */
.messages { padding-top: 16px; }
.message { padding: 12px 16px; border: 1px solid #cbd5e1; border-radius: 10px; background: #fff; }

@media (max-width: 900px) {
  .tutorial-layout { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .tutorial-sidebar { position: static; }
  .toc-card { padding: 15px 16px; }
  .toc-card nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .toc-card a { display: flex; min-width: 0; gap: 7px; padding: 9px 11px; border: 1px solid #e5e9f1; border-radius: 9px; background: #fafbfe; overflow-wrap: anywhere; }
  .toc-card a:first-child { border-top: 1px solid #e5e9f1; }
  .toc-card a span { flex: none; }
}

@media (max-width: 680px) {
  .container { width: min(100% - 28px, 1120px); }
  .site-header { height: 64px; }
  .nav-toggle { display: block; min-width: 44px; min-height: 44px; }
  .site-nav { display: none; position: absolute; top: 58px; right: 0; left: 0; padding: 14px; flex-direction: column; align-items: stretch; gap: 4px; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: var(--shadow-md); }
  .site-nav.is-open { display: flex; }
  .site-nav a { padding: 10px 12px; border-radius: 8px; }
  .notice-strip { padding-top: 20px; }
  .announcement { min-height: 154px; padding: 24px; align-items: flex-start; border-radius: 18px; }
  .announcement h3 { font-size: 21px; }
  .announcement p { font-size: 15px; }
  .landing-main { min-height: auto; padding: 38px 0 52px; }
  .landing-heading { margin-bottom: 22px; }
  .landing-heading h1 { font-size: 31px; }
  .feature-grid { grid-template-columns: 1fr; gap: 14px; }
  .feature-card { min-height: 178px; padding: 23px; border-radius: 18px; }
  .feature-arrow { top: 23px; right: 23px; }
  .feature-card h2 { margin-top: 22px; font-size: 21px; }
  .page-hero { padding: 34px 0 31px; }
  .eyebrow { margin-bottom: 6px; font-size: 12px; }
  .page-hero h1 { font-size: 34px; }
  .page-hero p { font-size: 15px; }
  .tutorial-section-wrap { padding: 20px 0 40px; }
  .tutorial-body { gap: 11px; }
  .tutorial-step, .tutorial-step:last-child { padding: 21px 19px 21px 22px; border-radius: 15px; }
  .tutorial-step h2 { margin-top: 8px; font-size: 23px; }
  .tutorial-video { border-radius: 11px; }
}

@media (max-width: 380px) {
  .container { width: calc(100% - 24px); }
  .landing-heading h1 { font-size: 27px; }
  .page-hero h1 { font-size: 30px; }
  .toc-card nav { grid-template-columns: minmax(0, 1fr); }
  .tutorial-step, .tutorial-step:last-child { padding: 18px 16px 18px 19px; }
  .button { max-width: 100%; text-align: center; white-space: normal; overflow-wrap: anywhere; }
}

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