/* ==========================================================================
   中国驾考动画学习站 — 基础设施样式（设计系统 / 排版 / 导航 / 组件）
   纯离线可用，无外部字体与图片依赖
   ========================================================================== */

:root {
  /* 交通标志标准色 */
  --sign-yellow: #FFD100;
  --sign-yellow-deep: #F2C200;
  --sign-red: #D0021B;
  --sign-blue: #0B5FA5;
  --sign-blue-deep: #08477A;
  --sign-green: #00794E;
  --sign-green-deep: #005C3B;
  --sign-brown: #7B5A3C;
  --sign-orange: #F07C00;
  --sign-white: #FFFFFF;
  --sign-black: #1A1A1A;

  /* 站点配色 */
  --ink: #0E1726;
  --ink-2: #1C2B42;
  --paper: #F3F5F9;
  --card: #FFFFFF;
  --line: #E1E7F0;
  --line-soft: #EFF3F9;
  --text: #16233A;
  --text-2: #4A5B75;
  --text-3: #8798B0;
  --brand: #1E63D8;
  --brand-soft: #E8F0FE;
  --brand-deep: #12489F;
  --ok: #12A150;
  --ok-soft: #E4F7EC;
  --warn: #E08A00;
  --warn-soft: #FFF4E0;
  --bad: #D92D20;
  --bad-soft: #FDECEA;

  --r-sm: 8px;
  --r: 12px;
  --r-lg: 18px;
  --r-xl: 26px;

  --sh-1: 0 1px 2px rgba(16,32,58,.06), 0 1px 3px rgba(16,32,58,.05);
  --sh-2: 0 4px 10px rgba(16,32,58,.07), 0 2px 4px rgba(16,32,58,.05);
  --sh-3: 0 14px 32px rgba(16,32,58,.14), 0 4px 10px rgba(16,32,58,.07);
  --sh-4: 0 28px 64px rgba(9,18,36,.32);

  --font: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei UI", "Microsoft YaHei",
          "Source Han Sans SC", "Noto Sans CJK SC", -apple-system, BlinkMacSystemFont,
          "Segoe UI", Roboto, sans-serif;
  --mono: "SF Mono", "JetBrains Mono", Menlo, Consolas, "Courier New", monospace;

  --header-h: 58px;
  --sidebar-w: 226px;
  --ease: cubic-bezier(.22,.68,.3,1);
  --ease-back: cubic-bezier(.34,1.56,.64,1);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.72;
  color: var(--text);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5 { margin: 0; font-weight: 700; line-height: 1.35; letter-spacing: -.01em; }
p { margin: 0 0 12px; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button { font-family: inherit; font-size: inherit; cursor: pointer; }
code { font-family: var(--mono); font-size: .92em; background: var(--line-soft);
  padding: 1px 6px; border-radius: 5px; color: var(--brand-deep); }

::selection { background: #CFE0FF; }

/* ---------- 滚动条 ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #C6D2E3; border-radius: 10px; border: 2px solid var(--paper); }
::-webkit-scrollbar-thumb:hover { background: #A9BAD2; }

/* ==========================================================================
   顶栏
   ========================================================================== */
.site-header {
  position: sticky; top: 0; z-index: 60;
  height: var(--header-h);
  display: flex; align-items: center; gap: 14px;
  padding: 0 18px;
  background: linear-gradient(115deg, #0E1726 0%, #16294A 55%, #123A6B 100%);
  color: #fff;
  box-shadow: 0 2px 14px rgba(9,18,36,.22);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 16.5px;
  letter-spacing: .01em; color: #fff; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-badge {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  background: var(--sign-yellow);
  display: grid; place-items: center;
  box-shadow: 0 0 0 2.5px rgba(255,209,0,.22);
}
.brand-badge svg { width: 19px; height: 19px; }
.brand-sub { font-size: 11.5px; font-weight: 600; color: #9DB4D6; letter-spacing: .06em;
  padding-left: 10px; margin-left: 2px; border-left: 1px solid rgba(255,255,255,.18); }

.header-spacer { flex: 1 1 auto; }

.header-tools { display: flex; align-items: center; gap: 8px; }
.tool-btn {
  height: 34px; padding: 0 13px; border-radius: 9px; border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.07); color: #E4EDFA; font-size: 13px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  transition: background .16s, border-color .16s, transform .16s;
}
.tool-btn:hover { background: rgba(255,255,255,.15); border-color: rgba(255,255,255,.3); text-decoration: none; }
.tool-btn:active { transform: scale(.96); }
.tool-btn.primary { background: var(--sign-yellow); border-color: var(--sign-yellow); color: #201A00; }
.tool-btn.primary:hover { background: #FFDE3D; }
.tool-btn .badge {
  min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
  background: var(--bad); color: #fff; font-size: 10.5px; font-weight: 800;
  display: inline-grid; place-items: center; line-height: 1;
}
.nav-toggle { display: none; }

/* ==========================================================================
   布局
   ========================================================================== */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  gap: 26px;
  max-width: 1360px;
  margin: 0 auto;
  padding: 24px 22px 80px;
  align-items: start;
}

.sidebar { position: sticky; top: calc(var(--header-h) + 24px); }
.side-group + .side-group { margin-top: 18px; }
.side-title {
  font-size: 11px; font-weight: 800; letter-spacing: .13em; color: var(--text-3);
  text-transform: uppercase; padding: 0 12px 7px;
}
.side-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 10px;
  color: var(--text-2); font-weight: 600; font-size: 14px;
  transition: background .15s, color .15s, transform .15s;
}
.side-link:hover { background: var(--line-soft); color: var(--text); text-decoration: none; transform: translateX(2px); }
.side-link.active { background: var(--brand-soft); color: var(--brand-deep); box-shadow: inset 0 0 0 1px #CFE0FF; }
.side-link .ico { width: 20px; height: 20px; flex: none; display: grid; place-items: center; opacity: .85; }
.side-link .ico svg { width: 18px; height: 18px; }
.side-link .count { margin-left: auto; font-size: 11.5px; font-weight: 700; color: var(--text-3);
  background: var(--line-soft); padding: 1px 7px; border-radius: 20px; }
.side-link.active .count { background: #fff; color: var(--brand); }

.main { min-width: 0; }

/* ==========================================================================
   页头 / 通用块
   ========================================================================== */
.page-head { margin-bottom: 22px; }
.crumb { font-size: 12.5px; color: var(--text-3); font-weight: 600; margin-bottom: 8px; }
.crumb a { color: var(--text-3); }
.crumb a:hover { color: var(--brand); }
.page-title { font-size: 27px; letter-spacing: -.02em; display: flex; align-items: center; gap: 11px; flex-wrap: wrap; }
.page-title .pill {
  font-size: 11.5px; font-weight: 800; letter-spacing: .04em;
  padding: 3px 10px; border-radius: 20px; background: var(--brand-soft); color: var(--brand-deep);
  vertical-align: middle;
}
.page-desc { color: var(--text-2); margin-top: 8px; max-width: 76ch; font-size: 14.5px; }

.section { margin: 30px 0; scroll-margin-top: calc(var(--header-h) + 16px); }
.section-head { display: flex; align-items: baseline; gap: 11px; margin-bottom: 14px; flex-wrap: wrap; }
.section-head h2 { font-size: 19px; display: flex; align-items: center; gap: 9px; }
.section-head h2::before {
  content: ""; width: 4px; height: 17px; border-radius: 3px;
  background: linear-gradient(180deg, var(--brand), #59A0FF); flex: none;
}
.section-head .hint { font-size: 13px; color: var(--text-3); font-weight: 600; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 18px 20px; box-shadow: var(--sh-1);
}
.card + .card { margin-top: 14px; }
.card-title { font-size: 15.5px; font-weight: 800; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }

.grid { display: grid; gap: 14px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0,1fr)); }

/* ---------- 徽标 / 标签 ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 700; padding: 2px 9px; border-radius: 20px;
  background: var(--line-soft); color: var(--text-2); white-space: nowrap;
}
.tag.blue { background: var(--brand-soft); color: var(--brand-deep); }
.tag.green { background: var(--ok-soft); color: #0A7A3C; }
.tag.amber { background: var(--warn-soft); color: #9A5D00; }
.tag.red { background: var(--bad-soft); color: #A81E14; }
.tag.dark { background: #23334D; color: #D9E5F7; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 13px; border-radius: 22px; border: 1px solid var(--line);
  background: #fff; color: var(--text-2); font-size: 13px; font-weight: 600;
  transition: all .16s var(--ease); white-space: nowrap;
}
.chip:hover { border-color: #B9CCE8; color: var(--text); transform: translateY(-1px); box-shadow: var(--sh-1); }
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip .n { font-size: 11px; opacity: .6; font-weight: 700; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 17px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; color: var(--text); font-weight: 700; font-size: 14px;
  transition: all .16s var(--ease);
}
.btn:hover { border-color: #B9CCE8; box-shadow: var(--sh-1); text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.985); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-deep); border-color: var(--brand-deep); }
.btn.ghost { background: transparent; }
.btn.sm { height: 31px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn.danger { color: var(--bad); border-color: #F5C6C1; background: #fff; }
.btn.danger:hover { background: var(--bad-soft); }
.btn:disabled { opacity: .45; pointer-events: none; }

/* ---------- 提示条 ---------- */
.note {
  border-radius: var(--r); padding: 12px 15px; font-size: 14px;
  border-left: 4px solid var(--brand); background: var(--brand-soft); color: #123A73;
}
.note + .note { margin-top: 10px; }
.note.tip { border-color: var(--ok); background: var(--ok-soft); color: #0A5C30; }
.note.warn { border-color: var(--warn); background: var(--warn-soft); color: #7A4A00; }
.note.bad { border-color: var(--bad); background: var(--bad-soft); color: #8C1810; }
.note b { font-weight: 800; }
.note .k { font-weight: 800; color: #C0392B; }
.note.tip .k { color: #0A7A3C; }

/* ---------- 表格 ---------- */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: #fff; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 480px; }
table.tbl th, table.tbl td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
table.tbl th { background: #F7F9FD; font-weight: 800; font-size: 12.5px; color: var(--text-2);
  letter-spacing: .02em; position: sticky; top: 0; white-space: nowrap; }
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl tbody tr:hover { background: #FAFCFF; }
table.tbl td.num { font-family: var(--mono); font-weight: 700; color: var(--brand-deep); white-space: nowrap; }

/* ---------- 进度条 ---------- */
.bar { height: 8px; border-radius: 20px; background: var(--line); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 20px;
  background: linear-gradient(90deg, var(--brand), #58A6FF); transition: width .45s var(--ease); }

/* ---------- 折叠面板 ---------- */
details.acc { border: 1px solid var(--line); border-radius: var(--r); background: #fff; overflow: hidden; }
details.acc + details.acc { margin-top: 9px; }
details.acc > summary {
  list-style: none; cursor: pointer; padding: 12px 15px; font-weight: 700; font-size: 14.5px;
  display: flex; align-items: center; gap: 10px; transition: background .15s;
}
details.acc > summary::-webkit-details-marker { display: none; }
details.acc > summary:hover { background: #F8FAFE; }
details.acc > summary::before {
  content: ""; width: 7px; height: 7px; border-right: 2px solid var(--text-3);
  border-bottom: 2px solid var(--text-3); transform: rotate(-45deg); transition: transform .2s var(--ease);
  flex: none; margin-left: 3px;
}
details.acc[open] > summary::before { transform: rotate(45deg); }
details.acc[open] > summary { border-bottom: 1px solid var(--line-soft); }
details.acc .acc-body { padding: 14px 16px; font-size: 14px; }

/* ==========================================================================
   模态框
   ========================================================================== */
.modal-mask {
  position: fixed; inset: 0; z-index: 120;
  background: rgba(8,16,30,.62); backdrop-filter: blur(5px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.modal-mask.on { opacity: 1; pointer-events: auto; }
.modal {
  background: #fff; border-radius: var(--r-xl); box-shadow: var(--sh-4);
  width: min(880px, 100%); max-height: 90vh; overflow: auto;
  transform: translateY(14px) scale(.98); transition: transform .26s var(--ease-back);
}
.modal-mask.on .modal { transform: none; }
.modal-head {
  display: flex; align-items: center; gap: 12px; padding: 16px 20px;
  border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; z-index: 2;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
}
.modal-head h3 { font-size: 18px; flex: 1; }
.modal-body { padding: 20px; }
.modal-close {
  width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line);
  background: #fff; color: var(--text-2); display: grid; place-items: center; font-size: 18px;
  transition: all .15s; flex: none;
}
.modal-close:hover { background: var(--bad-soft); color: var(--bad); border-color: #F5C6C1; }

/* ==========================================================================
   动画通用关键帧 / 工具类
   ========================================================================== */
@keyframes dkSpin { to { transform: rotate(360deg); } }
@keyframes dkPulse { 0%,100% { opacity: 1; } 50% { opacity: .25; } }
@keyframes dkBlink { 0%,45% { opacity: 1; } 50%,95% { opacity: .12; } 100% { opacity: 1; } }
@keyframes dkShake {
  0%,100% { transform: translate(0,0) rotate(0); }
  15% { transform: translate(-3px,1px) rotate(-5deg); }
  30% { transform: translate(3px,-1px) rotate(5deg); }
  45% { transform: translate(-3px,-1px) rotate(-4deg); }
  60% { transform: translate(3px,1px) rotate(4deg); }
  80% { transform: translate(-1px,0) rotate(-2deg); }
}
@keyframes dkBob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes dkDash { to { stroke-dashoffset: -24; } }
@keyframes dkSlideIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes dkGlow {
  0%,100% { filter: drop-shadow(0 0 0 rgba(255,209,0,0)); }
  50% { filter: drop-shadow(0 0 9px rgba(255,180,0,.85)); }
}
@keyframes dkRise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes dkFlashRed { 0%,100% { opacity: .95; } 50% { opacity: .3; } }

.a-spin    { animation: dkSpin 5.5s linear infinite; transform-origin: center; }
.a-pulse   { animation: dkPulse 1.15s ease-in-out infinite; }
.a-blink   { animation: dkBlink 1s steps(1,end) infinite; }
.a-shake   { animation: dkShake .8s ease-in-out infinite; transform-origin: center; }
.a-bob     { animation: dkBob 1.6s ease-in-out infinite; }
.a-dash    { stroke-dasharray: 8 6; animation: dkDash 1s linear infinite; }
.a-glow    { animation: dkGlow 1.8s ease-in-out infinite; }
.a-rise    { animation: dkRise .4s var(--ease) both; }

.pause-anim *, .pause-anim { animation-play-state: paused !important; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ==========================================================================
   响应式
   ========================================================================== */
@media (max-width: 1000px) {
  .grid.c4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .grid.c3 { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

@media (max-width: 860px) {
  .nav-toggle { display: inline-flex; }
  .layout { grid-template-columns: minmax(0,1fr); padding: 16px 14px 90px; gap: 0; }
  .sidebar {
    position: fixed; z-index: 90; top: var(--header-h); left: 0; bottom: 0;
    width: 258px; background: #fff; padding: 16px 12px;
    border-right: 1px solid var(--line); overflow-y: auto;
    transform: translateX(-102%); transition: transform .28s var(--ease);
    box-shadow: 14px 0 34px rgba(9,18,36,.12);
  }
  .sidebar.open { transform: none; }
  .side-scrim { position: fixed; inset: var(--header-h) 0 0 0; z-index: 85; background: rgba(8,16,30,.42);
    opacity: 0; pointer-events: none; transition: opacity .25s; }
  .side-scrim.on { opacity: 1; pointer-events: auto; }
  .brand-sub { display: none; }
  .page-title { font-size: 22px; }
  .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: minmax(0,1fr); }
  .modal-body { padding: 15px; }
}

@media (max-width: 560px) {
  body { font-size: 14.5px; }
  .site-header { padding: 0 12px; gap: 9px; }
  .brand { font-size: 15px; }
  .tool-btn { padding: 0 10px; font-size: 12.5px; }
  .tool-btn .lbl { display: none; }
  .header-tools .tool-btn.primary .lbl { display: inline; }
}

@media print {
  .site-header, .sidebar, .tool-btn, .btn { display: none !important; }
  .layout { grid-template-columns: 1fr; padding: 0; }
  .card { box-shadow: none; break-inside: avoid; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important; }
  html { scroll-behavior: auto; }
}
