/* ============================================================
   無人機自學站　styles.css
   中性獨立靜態教學站　·　零依賴
   ============================================================ */

:root {
  --bg: #f4f7fb;
  --bg-elev: #ffffff;
  --bg-soft: #eef3fa;
  --text: #1a2438;
  --text-soft: #5a6678;
  --text-mute: #8a94a6;
  --line: #e2e8f2;
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --brand-soft: #dbeafe;
  --sky: #38bdf8;
  --accent: #f59e0b;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --tip: #0ea5e9;
  --tip-soft: #e0f2fe;
  --ok: #16a34a;
  --shadow: 0 4px 18px rgba(30, 58, 95, 0.08);
  --shadow-lg: 0 12px 40px rgba(30, 58, 95, 0.14);
  --radius: 16px;
  --radius-sm: 10px;
  --sidebar-w: 244px;
  --topbar-h: 58px;
  --maxw: 880px;
}

[data-theme="dark"] {
  --bg: #0d1320;
  --bg-elev: #151d2e;
  --bg-soft: #1a2336;
  --text: #e8eef7;
  --text-soft: #aab6c9;
  --text-mute: #75839a;
  --line: #273248;
  --brand: #60a5fa;
  --brand-dark: #3b82f6;
  --brand-soft: #1e3358;
  --danger-soft: #3a1a1c;
  --tip-soft: #0c2a3d;
  --shadow: 0 4px 18px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--topbar-h) + 16px); }

body {
  font-family: "Noto Sans TC", -apple-system, BlinkMacSystemFont, "PingFang TC", "Microsoft JhengHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.85;
  -webkit-font-smoothing: antialiased;
  letter-spacing: 0.01em;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- 進度條 ---------- */
#progress-bar {
  position: fixed; top: 0; left: 0; height: 3px; width: 0%;
  background: linear-gradient(90deg, var(--brand), var(--sky));
  z-index: 200; transition: width 0.1s linear;
}

/* ---------- 頂部列 ---------- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--topbar-h);
  background: color-mix(in srgb, var(--bg-elev) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px;
  padding: 0 18px; z-index: 150;
}
.menu-toggle {
  display: none; background: none; border: none; font-size: 22px;
  color: var(--text); cursor: pointer; padding: 4px 8px; border-radius: 8px;
}
.menu-toggle:hover { background: var(--bg-soft); }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 900; font-size: 18px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark { font-size: 22px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.topbar-link {
  font-size: 14px; color: var(--text-soft); padding: 7px 12px; border-radius: 999px;
  font-weight: 500; transition: all 0.15s;
}
.topbar-link:hover { background: var(--brand-soft); color: var(--brand-dark); text-decoration: none; }
.lang-switch { border: 1px solid var(--line); font-weight: 700; }
.lang-switch:hover { text-decoration: none; }
.theme-toggle {
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 999px;
  width: 38px; height: 38px; font-size: 16px; cursor: pointer; color: var(--text);
  transition: transform 0.2s;
}
.theme-toggle:hover { transform: rotate(-20deg); }

/* ---------- 版面 ---------- */
.layout { display: flex; padding-top: var(--topbar-h); }

.sidebar {
  position: fixed; top: var(--topbar-h); left: 0; bottom: 0; width: var(--sidebar-w);
  background: var(--bg-elev); border-right: 1px solid var(--line);
  overflow-y: auto; padding: 22px 14px; z-index: 100;
}
.sidebar-title {
  font-size: 12px; font-weight: 700; color: var(--text-mute);
  letter-spacing: 0.12em; padding: 0 10px 8px;
}
.toc { list-style: none; }
.toc li a {
  display: block; padding: 9px 12px; border-radius: var(--radius-sm);
  color: var(--text-soft); font-size: 14.5px; font-weight: 500;
  margin-bottom: 2px; transition: all 0.15s; white-space: nowrap;
}
.toc li a:hover { background: var(--bg-soft); color: var(--text); text-decoration: none; }
.toc li a.active {
  background: var(--brand-soft); color: var(--brand-dark); font-weight: 700;
}
.sidebar-note {
  margin-top: 18px; padding: 12px 10px 0; border-top: 1px dashed var(--line);
  font-size: 12px; color: var(--text-mute); line-height: 1.7;
}

.backdrop {
  display: none; position: fixed; inset: 0; top: var(--topbar-h);
  background: rgba(10, 18, 35, 0.45); z-index: 90;
}
.backdrop.show { display: block; }

.content {
  margin-left: var(--sidebar-w); flex: 1; min-width: 0;
  padding: 36px clamp(18px, 5vw, 56px) 80px;
}
.content > section { max-width: var(--maxw); margin: 0 auto; }

/* ---------- Hero ---------- */
.hero { padding: 28px 0 14px; }
.hero-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.badge {
  background: var(--bg-elev); border: 1px solid var(--line); box-shadow: var(--shadow);
  padding: 6px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--text-soft);
}
.hero-title {
  font-size: clamp(30px, 6vw, 50px); font-weight: 900; line-height: 1.25;
  letter-spacing: -0.01em; margin-bottom: 18px;
  background: linear-gradient(120deg, var(--text), var(--brand));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.hero-sub { font-size: clamp(16px, 2.4vw, 19px); color: var(--text-soft); max-width: 640px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin: 26px 0 18px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 13px 24px; border-radius: 999px; font-size: 15px; font-weight: 700;
  cursor: pointer; border: 1px solid transparent; transition: all 0.18s; font-family: inherit;
}
.btn-sm { padding: 8px 16px; font-size: 13.5px; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 6px 18px rgba(37, 99, 235, 0.32); }
.btn-primary:hover { background: var(--brand-dark); transform: translateY(-2px); text-decoration: none; }
.btn-ghost { background: var(--bg-elev); color: var(--text); border-color: var(--line); }
.btn-ghost:hover { background: var(--bg-soft); text-decoration: none; }

.hero-disclaimer {
  margin-top: 18px; font-size: 13px; color: var(--text-mute); background: var(--bg-soft);
  border-left: 3px solid var(--accent); padding: 12px 16px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* ---------- 學習路徑 ---------- */
.path { margin: 40px auto; }
.path-title { font-size: 22px; font-weight: 800; margin-bottom: 16px; }
.path-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.path-step {
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 18px; box-shadow: var(--shadow); position: relative;
}
.path-num {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 10px; background: var(--brand-soft);
  color: var(--brand-dark); font-weight: 900; font-size: 16px; margin-bottom: 12px;
}
.path-step b { font-size: 16px; display: block; margin-bottom: 4px; }
.path-step p { font-size: 13.5px; color: var(--text-soft); }

/* ---------- 章節 ---------- */
.chapter { margin: 56px auto; scroll-margin-top: calc(var(--topbar-h) + 16px); }
.chapter-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; padding-bottom: 14px; border-bottom: 2px solid var(--line); }
.chapter-head h2 { font-size: clamp(24px, 4vw, 32px); font-weight: 900; }
.chapter-tag {
  background: var(--bg-soft); color: var(--text-mute); font-size: 12.5px; font-weight: 700;
  padding: 5px 12px; border-radius: 999px; white-space: nowrap; letter-spacing: 0.04em;
}
.chapter-tag-law { background: var(--danger-soft); color: var(--danger); }
.chapter-tag-tool { background: var(--tip-soft); color: var(--tip); }
.chapter h3 { font-size: 19px; font-weight: 800; margin: 30px 0 12px; }
.chapter p { color: var(--text); margin-bottom: 14px; }
.chapter strong { color: var(--brand-dark); font-weight: 700; }
[data-theme="dark"] .chapter strong { color: var(--brand); }
.note-line { font-size: 13.5px; color: var(--text-mute); }

/* ---------- 卡片網格 ---------- */
.cards-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 6px 0 8px; }
.cards-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin: 6px 0 8px; }
.info-card {
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow);
}
.info-card .ic { font-size: 26px; display: block; margin-bottom: 8px; }
.info-card b { font-size: 15.5px; display: block; margin-bottom: 4px; }
.info-card p { font-size: 13.5px; color: var(--text-soft); margin: 0; }

/* ---------- 迷思 ---------- */
.myth {
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; margin-bottom: 12px; box-shadow: var(--shadow); font-size: 14.5px; line-height: 1.9;
}
.myth-x { display: inline-block; color: var(--danger); font-weight: 800; margin-right: 6px; }
.myth-o { display: inline-block; color: var(--ok); font-weight: 800; margin-right: 6px; }

/* ---------- 表格 ---------- */
.spec-table {
  width: 100%; border-collapse: collapse; margin: 8px 0 14px; font-size: 14.5px;
  background: var(--bg-elev); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
}
.spec-table th {
  background: var(--bg-soft); text-align: left; padding: 12px 16px; font-weight: 700; color: var(--text);
  border-bottom: 1px solid var(--line);
}
.spec-table td { padding: 12px 16px; border-bottom: 1px solid var(--line); color: var(--text-soft); vertical-align: top; }
.spec-table tr:last-child td { border-bottom: none; }
.spec-table td b { color: var(--text); }

/* ---------- 重量級距條 ---------- */
.weight-bar { display: flex; gap: 4px; margin: 10px 0 8px; flex-wrap: wrap; }
.weight-seg {
  flex: 1; min-width: 120px; border-radius: var(--radius-sm); padding: 14px 12px; text-align: center; color: #fff;
}
.weight-seg b { display: block; font-size: 15px; }
.weight-seg span { font-size: 12.5px; opacity: 0.95; }
.weight-seg.s1 { background: #22c55e; }
.weight-seg.s2 { background: #3b82f6; }
.weight-seg.s3 { background: #f59e0b; }
.weight-seg.s4 { background: #f97316; }
.weight-seg.s5 { background: #dc2626; }

/* ---------- 清單 ---------- */
.check-list, .num-list { margin: 6px 0 14px; padding-left: 4px; }
.check-list { list-style: none; }
.check-list li { position: relative; padding-left: 28px; margin-bottom: 9px; color: var(--text-soft); font-size: 14.5px; }
.check-list li::before { content: "✓"; position: absolute; left: 0; top: 0; color: var(--ok); font-weight: 900; }
.check-list li b { color: var(--text); }
.num-list { padding-left: 24px; }
.num-list li { margin-bottom: 9px; color: var(--text-soft); font-size: 14.5px; }
.num-list li b { color: var(--text); }

/* ---------- callout ---------- */
.callout { border-radius: var(--radius); padding: 16px 18px; margin: 16px 0; font-size: 14.5px; line-height: 1.85; }
.callout b { display: block; margin-bottom: 4px; font-size: 15px; }
.callout-tip { background: var(--tip-soft); border-left: 4px solid var(--tip); }
.callout-warn { background: var(--danger-soft); border-left: 4px solid var(--danger); }

/* ---------- 法規章節 ---------- */
.chapter-law { background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 26px clamp(18px, 4vw, 34px); box-shadow: var(--shadow-lg); }
.rule-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 8px 0 12px; }
.rule { background: var(--bg-soft); border-radius: var(--radius-sm); padding: 14px 16px; }
.rule-ic { font-size: 22px; display: block; margin-bottom: 6px; }
.rule b { font-size: 15px; display: block; margin-bottom: 3px; }
.rule p { font-size: 13px; color: var(--text-soft); margin: 0; }
.resource-box { background: var(--brand-soft); border-radius: var(--radius); padding: 18px 20px; margin-top: 16px; }
.resource-box b { display: block; margin-bottom: 10px; font-size: 15px; color: var(--brand-dark); }
[data-theme="dark"] .resource-box b { color: var(--brand); }
.resource-box ul { list-style: none; }
.resource-box li { margin-bottom: 7px; font-size: 14px; }

/* ---------- 起飛前清單 ---------- */
.preflight { background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); }
.preflight-progress { height: 8px; background: var(--bg-soft); border-radius: 999px; overflow: hidden; margin-bottom: 8px; }
.preflight-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--ok), var(--sky)); transition: width 0.3s; }
.preflight-count { font-size: 13px; color: var(--text-mute); margin-bottom: 12px; }
.preflight-list { list-style: none; }
.preflight-list li { margin-bottom: 4px; }
.preflight-list label {
  display: flex; align-items: flex-start; gap: 10px; padding: 9px 12px; border-radius: var(--radius-sm);
  cursor: pointer; font-size: 14.5px; color: var(--text-soft); transition: background 0.12s;
}
.preflight-list label:hover { background: var(--bg-soft); }
.preflight-list input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--ok); cursor: pointer; flex-shrink: 0; }
.preflight-list input:checked + * {}
.preflight-list li.done label { color: var(--text-mute); text-decoration: line-through; }
#preflight-reset { margin-top: 6px; }

/* ---------- 工具：考照判斷 ---------- */
.tool-section { background: linear-gradient(135deg, var(--bg-elev), var(--bg-soft));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 26px clamp(18px, 4vw, 34px); box-shadow: var(--shadow-lg); }
.checker { margin-top: 10px; }
.checker-field { margin-bottom: 18px; }
.checker-field > label { display: block; font-weight: 700; margin-bottom: 8px; font-size: 15px; }
.seg-control { display: inline-flex; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 999px; padding: 4px; gap: 4px; }
.seg-wrap { flex-wrap: wrap; border-radius: var(--radius); }
.seg {
  border: none; background: none; padding: 9px 16px; border-radius: 999px; cursor: pointer;
  font-size: 14px; font-weight: 600; color: var(--text-soft); font-family: inherit; transition: all 0.15s;
}
.seg:hover { color: var(--text); }
.seg.active { background: var(--brand); color: #fff; box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3); }
.checker-result {
  margin-top: 18px; background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); animation: fade 0.3s;
}
.checker-result h4 { font-size: 17px; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.result-item { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--line); font-size: 14.5px; }
.result-item:last-child { border-bottom: none; }
.result-item .ri-ic { font-size: 20px; flex-shrink: 0; }
.result-item b { color: var(--text); }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; margin-left: 6px; }
.pill-yes { background: var(--danger-soft); color: var(--danger); }
.pill-no { background: #dcfce7; color: var(--ok); }
[data-theme="dark"] .pill-no { background: #14331f; }

@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- FAQ ---------- */
.faq {
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius-sm);
  margin-bottom: 10px; box-shadow: var(--shadow); overflow: hidden;
}
.faq summary {
  cursor: pointer; padding: 15px 18px; font-weight: 600; font-size: 15px; list-style: none;
  display: flex; justify-content: space-between; align-items: center;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "＋"; color: var(--brand); font-weight: 900; font-size: 18px; }
.faq[open] summary::after { content: "－"; }
.faq p { padding: 0 18px 16px; color: var(--text-soft); font-size: 14.5px; margin: 0; }

/* ---------- 詞彙表 ---------- */
.glossary { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.term { background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 16px; box-shadow: var(--shadow); }
.term b { color: var(--brand-dark); font-size: 14.5px; }
[data-theme="dark"] .term b { color: var(--brand); }
.term span { display: block; font-size: 13px; color: var(--text-soft); margin-top: 2px; }

/* ---------- 測驗 ---------- */
.quiz { margin: 8px 0 16px; }
.quiz-q { background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 14px; box-shadow: var(--shadow); }
.quiz-q .q-text { font-weight: 700; font-size: 15.5px; margin-bottom: 12px; }
.quiz-q .q-num { color: var(--brand); margin-right: 6px; }
.quiz-opt { display: block; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 8px; cursor: pointer; font-size: 14.5px; transition: all 0.12s; color: var(--text-soft); }
.quiz-opt:hover { border-color: var(--brand); background: var(--bg-soft); }
.quiz-opt input { margin-right: 8px; accent-color: var(--brand); }
.quiz-opt.correct { border-color: var(--ok); background: #dcfce7; color: #14532d; }
.quiz-opt.wrong { border-color: var(--danger); background: var(--danger-soft); color: var(--danger); }
[data-theme="dark"] .quiz-opt.correct { background: #14331f; color: #86efac; }
.quiz-explain { font-size: 13px; color: var(--text-mute); margin-top: 8px; padding-left: 4px; display: none; }
.quiz-q.answered .quiz-explain { display: block; }
.quiz-result { background: var(--brand-soft); border-radius: var(--radius); padding: 22px; text-align: center; margin-bottom: 14px; }
.quiz-result .score { font-size: 34px; font-weight: 900; color: var(--brand-dark); }
[data-theme="dark"] .quiz-result .score { color: var(--brand); }
.quiz-result p { margin: 6px 0 0; color: var(--text-soft); }

/* ---------- footer ---------- */
.site-footer { text-align: center; margin-top: 70px; padding-top: 30px; border-top: 1px solid var(--line); color: var(--text-mute); }
.footer-brand { font-size: 18px; font-weight: 900; color: var(--text); margin-bottom: 4px; }
.footer-disc { font-size: 12.5px; max-width: 560px; margin: 14px auto 0; line-height: 1.7; }
.footer-ver { font-size: 12px; margin-top: 10px; opacity: 0.6; }

/* ---------- 回頂 ---------- */
.to-top {
  position: fixed; bottom: 24px; right: 24px; width: 46px; height: 46px; border-radius: 50%;
  background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 22px; box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transition: opacity 0.25s, transform 0.25s; z-index: 120;
}
.to-top.show { opacity: 1; pointer-events: auto; }
.to-top:hover { transform: translateY(-3px); text-decoration: none; }

/* ---------- RWD ---------- */
@media (max-width: 1024px) {
  .cards-3 { grid-template-columns: repeat(2, 1fr); }
  .path-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .menu-toggle { display: block; }
  .sidebar { transform: translateX(-100%); transition: transform 0.28s ease; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: translateX(0); }
  .content { margin-left: 0; }
  .topbar-link { display: none; }
  .lang-switch { display: inline-block; padding: 6px 12px; font-size: 13px; }
  .cards-3, .cards-2, .rule-grid, .glossary { grid-template-columns: 1fr; }
  .weight-seg { min-width: calc(50% - 4px); }
  .seg-control { width: 100%; }
}
@media (max-width: 480px) {
  .path-grid { grid-template-columns: 1fr; }
  .hero-cta .btn { width: 100%; }
  .weight-seg { min-width: 100%; }
}
