/* ====================================================
   摩托车D照考试指南 — 公共样式
   版本: v1.0 | 2026-05-14
   ==================================================== */

/* ===== CSS VARIABLES ===== */
:root {
  --bg: #faf8f4;
  --surface: #ffffff;
  --accent: #c0392b;
  --accent-light: #fdecea;
  --accent-secondary: #2c3e50;
  --text-primary: #1a1a1a;
  --text-body: #333333;
  --text-muted: #595959;
  --border: #e0dbd3;
  --border-light: #f0ece6;
  --tag-blue: #1a5276;
  --tag-blue-bg: #eaf2f8;
  --tag-green: #1e6e3e;
  --tag-green-bg: #e8f6ef;
  --tag-orange: #7d5a00;
  --tag-orange-bg: #fef9e7;
  --tag-purple: #5b2c6f;
  --tag-purple-bg: #f4ecf7;
  --tag-red: #922b21;
  --tag-red-bg: #fdedec;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
}

/* ===== RESET ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
/* Focus indicator for keyboard accessibility (WCAG AA) */
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}
body {
  font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text-body);
  font-size: 14px;
  line-height: 1.8;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

/* ===== LAYOUT ===== */
.page-container {
  max-width: 820px;
  margin: 0 auto;
  padding: 40px 50px;
}

/* ===== SITE NAV ===== */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
}
.site-nav-inner {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.site-nav .logo {
  font-family: 'Noto Serif SC', serif;
  font-weight: 700;
  font-size: 16px;
  color: var(--accent);
  text-decoration: none;
}
.site-nav .nav-links {
  display: flex;
  gap: 4px;
  font-size: 13px;
}
.site-nav .nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  padding: 4px 10px;
  border-radius: 4px;
  transition: all 0.2s;
}
.site-nav .nav-links a:hover,
.site-nav .nav-links a.active {
  color: var(--accent);
  background: var(--accent-light);
}

/* ===== BACK TO TOP ===== */
.back-to-top {
  position: fixed;
  bottom: 36px;
  right: 36px;
  width: 44px;
  height: 44px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s ease;
  z-index: 999;
}
.back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
}
.back-to-top:hover {
  background: #a93226;
  transform: translateY(-2px);
}

/* ===== COVER ===== */
.cover {
  text-align: center;
  padding: 80px 40px 60px;
  margin-bottom: 50px;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  color: #fff;
  border-radius: 6px;
  position: relative;
  overflow: hidden;
  page-break-after: always;
}
.cover::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -30%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(192,57,43,0.25) 0%, transparent 70%);
  border-radius: 50%;
}
.cover::after {
  content: '';
  position: absolute;
  bottom: -40%;
  left: -20%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(255,255,255,0.05) 0%, transparent 70%);
  border-radius: 50%;
}
.cover .badge {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 3px;
  padding: 6px 20px;
  border-radius: 3px;
  margin-bottom: 40px;
  text-transform: uppercase;
  position: relative;
  z-index: 1;
}
.cover h1 {
  font-family: 'Noto Serif SC', serif;
  font-size: 36px;
  font-weight: 900;
  line-height: 1.3;
  margin-bottom: 16px;
  position: relative;
  z-index: 1;
}
.cover .subtitle {
  font-size: 16px;
  color: rgba(255,255,255,0.7);
  margin-bottom: 40px;
  position: relative;
  z-index: 1;
}
.cover .meta {
  display: flex;
  justify-content: center;
  gap: 30px;
  font-size: 13px;
  color: rgba(255,255,255,0.5);
  position: relative;
  z-index: 1;
}
.cover .meta span {
  display: flex;
  align-items: center;
  gap: 6px;
}
.cover .divider-line {
  width: 60px;
  height: 2px;
  background: var(--accent);
  margin: 0 auto 30px;
  position: relative;
  z-index: 1;
}

/* ===== HOME COVER (for index page) ===== */
.home-cover {
  text-align: center;
  padding: 80px 40px 60px;
  margin-bottom: 40px;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  color: #fff;
  border-radius: 6px;
  position: relative;
  overflow: hidden;
}
.home-cover::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -30%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(192,57,43,0.25) 0%, transparent 70%);
  border-radius: 50%;
}
.home-cover h1 {
  font-family: 'Noto Serif SC', serif;
  font-size: 32px;
  font-weight: 900;
  line-height: 1.3;
  margin-bottom: 12px;
  position: relative;
  z-index: 1;
}
.home-cover .subtitle {
  font-size: 15px;
  color: rgba(255,255,255,0.7);
  position: relative;
  z-index: 1;
}

/* ===== SUBJECT CARDS (for index page) ===== */
.subject-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 40px;
}
.subject-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 28px 24px;
  text-decoration: none;
  color: var(--text-primary);
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}
.subject-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
}
.subject-card .card-num {
  font-family: 'Noto Serif SC', serif;
  font-size: 28px;
  font-weight: 900;
  margin-bottom: 4px;
}
.subject-card .card-title {
  font-family: 'Noto Serif SC', serif;
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--accent-secondary);
}
.subject-card .card-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 12px;
}
.subject-card .card-meta {
  display: flex;
  gap: 12px;
  font-size: 11px;
  color: var(--text-muted);
}
.subject-card .card-meta span {
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 3px;
}
/* Color variants */
.subject-card.k1 .card-num { color: var(--accent); }
.subject-card.k2 .card-num { color: var(--tag-blue); }
.subject-card.k3 .card-num { color: var(--tag-green); }
.subject-card.k4 .card-num { color: var(--tag-orange); }
.subject-card.k1:hover { border-color: var(--accent); }
.subject-card.k2:hover { border-color: var(--tag-blue); }
.subject-card.k3:hover { border-color: var(--tag-green); }
.subject-card.k4:hover { border-color: var(--tag-orange); }

/* ===== TOC ===== */
.toc {
  page-break-after: always;
  margin-bottom: 50px;
}
.toc h2 {
  font-family: 'Noto Serif SC', serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--accent-secondary);
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--accent);
}
.toc-list {
  list-style: none;
  counter-reset: toc-counter;
}
.toc-list li {
  counter-increment: toc-counter;
  border-bottom: 1px solid var(--border-light);
}
.toc-list li a {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 12px 16px;
  text-decoration: none;
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 500;
  border-radius: 6px;
  transition: all 0.2s ease;
}
.toc-list li a:hover {
  background: var(--accent-light);
  color: var(--accent);
  padding-left: 22px;
}
.toc-list li a::before {
  content: counter(toc-counter, decimal-leading-zero);
  font-family: 'Noto Serif SC', serif;
  font-weight: 700;
  color: var(--accent);
  font-size: 18px;
  min-width: 28px;
  transition: color 0.2s ease;
}
.toc-list li a:hover::before {
  color: var(--accent);
}
.toc-list li a .toc-arrow {
  margin-left: auto;
  color: var(--border);
  font-size: 13px;
  transition: all 0.2s ease;
}
.toc-list li a:hover .toc-arrow {
  color: var(--accent);
  transform: translateX(4px);
}

/* ===== SECTION HEADERS ===== */
.section {
  margin-bottom: 48px;
  scroll-margin-top: 60px;
}
.section-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--accent);
}
.section-num {
  font-family: 'Noto Serif SC', serif;
  font-size: 32px;
  font-weight: 900;
  color: var(--accent);
  line-height: 1;
}
.section-title {
  font-family: 'Noto Serif SC', serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--accent-secondary);
}
.section-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.sub-section {
  margin-bottom: 28px;
}
.sub-section h3 {
  font-family: 'Noto Serif SC', serif;
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 14px;
  padding-left: 14px;
  border-left: 3px solid var(--accent);
}
.sub-section h4 {
  font-size: 15px;
  font-weight: 700;
  color: var(--accent-secondary);
  margin-bottom: 10px;
  margin-top: 18px;
}

/* ===== TABLES ===== */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
  font-size: 13.5px;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.data-table thead th {
  background: var(--accent-secondary);
  color: #fff;
  font-weight: 500;
  padding: 10px 14px;
  text-align: left;
  font-size: 13px;
}
.data-table tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: top;
}
.data-table tbody tr:nth-child(even) {
  background: #fdfcfa;
}
.data-table tbody tr:hover {
  background: var(--accent-light);
}

/* ===== CALLOUT BLOCKS ===== */
.callout {
  background: #fdfcfa;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 20px 24px;
  margin-bottom: 20px;
  font-size: 13.5px;
  line-height: 2;
  position: relative;
  page-break-inside: avoid;
}
.callout::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--accent);
  border-radius: 6px 0 0 6px;
}
.callout strong {
  color: var(--text-primary);
}
.callout-title {
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 8px;
  font-size: 14px;
}

.callout-blue { border-left: 4px solid var(--tag-blue); }
.callout-blue::before { background: var(--tag-blue); }
.callout-green { border-left: 4px solid var(--tag-green); }
.callout-green::before { background: var(--tag-green); }
.callout-orange { border-left: 4px solid var(--tag-orange); }
.callout-orange::before { background: var(--tag-orange); }
.callout-purple { border-left: 4px solid var(--tag-purple); }
.callout-purple::before { background: var(--tag-purple); }
.callout-red { border-left: 4px solid var(--tag-red); }
.callout-red::before { background: var(--tag-red); }

.callout .callout-title-blue { color: var(--tag-blue); }
.callout .callout-title-green { color: var(--tag-green); }
.callout .callout-title-orange { color: var(--tag-orange); }
.callout .callout-title-purple { color: var(--tag-purple); }
.callout .callout-title-red { color: var(--tag-red); }

/* ===== MNEMONIC BOX ===== */
.mnemonic-box {
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  color: #fff;
  border-radius: 8px;
  padding: 28px 30px;
  margin-bottom: 20px;
  page-break-inside: avoid;
}
.mnemonic-box .mnemonic-title {
  font-family: 'Noto Serif SC', serif;
  font-size: 16px;
  font-weight: 700;
  color: #e8c547;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.mnemonic-box .mnemonic-item {
  margin-bottom: 14px;
  padding-left: 16px;
  border-left: 2px solid rgba(232,197,71,0.4);
  line-height: 1.8;
}
.mnemonic-box .mnemonic-item:last-child { margin-bottom: 0; }
.mnemonic-box .mnemonic-label {
  color: #e8c547;
  font-weight: 700;
  font-size: 14px;
}
.mnemonic-box .mnemonic-text {
  color: rgba(255,255,255,0.85);
  font-size: 13.5px;
}
.mnemonic-box .mnemonic-highlight {
  display: inline-block;
  background: rgba(232,197,71,0.15);
  color: #e8c547;
  padding: 1px 8px;
  border-radius: 3px;
  font-weight: 700;
  font-size: 15px;
  margin: 4px 2px;
}

/* ===== TIP CARDS ===== */
.tip-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 20px;
}
.tip-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 18px 20px;
  page-break-inside: avoid;
}
.tip-card .tip-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.tip-card .tip-label.label-green { color: var(--tag-green); }
.tip-card .tip-label.label-red { color: var(--tag-red); }
.tip-card .tip-label.label-blue { color: var(--tag-blue); }
.tip-card .tip-label.label-orange { color: var(--tag-orange); }
.tip-card ul {
  list-style: none;
  font-size: 13px;
  line-height: 2;
}
.tip-card ul li::before {
  content: '\00b7';
  color: var(--accent);
  font-weight: 900;
  margin-right: 6px;
}

/* ===== PLAN TABLE ===== */
.plan-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
  font-size: 13px;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.plan-table thead th {
  background: var(--accent);
  color: #fff;
  font-weight: 500;
  padding: 10px 14px;
  text-align: left;
}
.plan-table tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: top;
}
.plan-table tbody tr:nth-child(even) {
  background: #fdfcfa;
}
.plan-table .day-cell {
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
  min-width: 70px;
}

/* ===== COLOR CHART ===== */
.color-chart {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}
.color-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 13px;
}
.color-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 2px solid rgba(0,0,0,0.1);
}
.color-item strong {
  color: var(--text-primary);
  font-size: 13px;
}
.color-item span {
  font-size: 12px;
  color: var(--text-muted);
  display: block;
}

/* ===== CHECKLIST ===== */
.checklist {
  list-style: none;
  margin-bottom: 20px;
}
.checklist li {
  padding: 8px 0 8px 28px;
  position: relative;
  font-size: 14px;
  border-bottom: 1px solid var(--border-light);
}
.checklist li::before {
  content: '\2713';
  position: absolute;
  left: 0;
  top: 8px;
  width: 20px;
  height: 20px;
  background: var(--tag-green-bg);
  color: var(--tag-green);
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===== FOOTER ===== */
.footer-note {
  margin-top: 50px;
  padding-top: 24px;
  border-top: 2px solid var(--border);
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.8;
}
.footer-note strong {
  color: var(--accent);
}

/* ===== DIVIDER ===== */
.divider {
  height: 1px;
  background: var(--border);
  margin: 32px 0;
}

/* ===== DIAGRAM BOX (SVG container) ===== */
.diagram-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 24px;
  margin-bottom: 20px;
  text-align: center;
  overflow-x: auto;
  page-break-inside: avoid;
}
.diagram-box svg {
  max-width: 100%;
  height: auto;
}
.diagram-box .diagram-title {
  font-weight: 700;
  color: var(--accent-secondary);
  margin-bottom: 16px;
  font-size: 14px;
}
.diagram-box .diagram-note {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 12px;
  line-height: 1.6;
}

/* ===== DEDUCT TABLE (for scoring deduction) ===== */
.deduct-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
  font-size: 13px;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.deduct-table thead th {
  background: var(--accent-secondary);
  color: #fff;
  font-weight: 500;
  padding: 10px 14px;
  text-align: left;
  font-size: 13px;
}
.deduct-table tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: top;
}
.deduct-table tbody tr:hover {
  background: var(--accent-light);
}
.deduct-100 { background: var(--tag-red-bg) !important; }
.deduct-10 { background: var(--tag-orange-bg) !important; }
.deduct-5 { background: #f8f8f6 !important; }
.deduct-value {
  font-weight: 700;
  font-size: 13px;
  padding: 2px 8px;
  border-radius: 3px;
  white-space: nowrap;
}
.deduct-value.dv-100 {
  background: var(--tag-red);
  color: #fff;
}
.deduct-value.dv-10 {
  background: var(--tag-orange);
  color: #fff;
}
.deduct-value.dv-5 {
  background: var(--border);
  color: var(--text-body);
}

/* ===== STEP FLOW (for process visualization) ===== */
.step-flow {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.step-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
}
.step-num {
  width: 24px;
  height: 24px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}
.step-arrow {
  color: var(--border);
  font-size: 16px;
  margin: 0 4px;
  flex-shrink: 0;
}

/* ===== PROCESS OVERVIEW (for index page) ===== */
.process-flow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin: 30px 0;
  flex-wrap: wrap;
}
.process-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 12px;
  min-width: 100px;
}
.process-step .ps-circle {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Noto Serif SC', serif;
  font-size: 16px;
  font-weight: 900;
  color: #fff;
  flex-shrink: 0;
}
.process-step .ps-label {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.4;
}
.process-step .ps-check {
  font-size: 11px;
  color: var(--tag-green);
  font-weight: 700;
}
.process-arrow {
  color: var(--border);
  font-size: 22px;
  margin: 0 2px;
  padding-bottom: 30px;
  flex-shrink: 0;
}

/* ===== PRINT STYLES ===== */
@media print {
  body { background: #fff; font-size: 12px; }
  .page-container { padding: 20px 30px; max-width: 100%; }
  .cover { padding: 60px 30px 40px; margin-bottom: 30px; }
  .cover h1 { font-size: 28px; }
  .section { page-break-inside: avoid; scroll-margin-top: 0; }
  .sub-section { page-break-inside: avoid; }
  .callout { page-break-inside: avoid; }
  .mnemonic-box { page-break-inside: avoid; }
  .diagram-box { page-break-inside: avoid; }
  .tip-grid { grid-template-columns: 1fr 1fr; }
  .color-chart { grid-template-columns: repeat(3, 1fr); }
  .back-to-top { display: none !important; }
  .site-nav { display: none !important; }
  .toc-list li a { padding: 8px 0; }
  .toc-list li a:hover { background: none; padding-left: 0; color: var(--text-primary); }
  .toc-list li a .toc-arrow { display: none; }
  .subject-grid { grid-template-columns: 1fr 1fr; }
  .subject-card:hover { transform: none; box-shadow: var(--shadow-sm); }
}
