:root {
  --primary: #009955;
  --primary-dark: #00703f;
  --primary-darker: #004d2a;
  --primary-light: #4caf7d;
  --bg: #eef2ee;
  --text: #1a2e1f;
  --muted: #5a6b5e;
  --border: #c2d0c4;
  --accent: #d9ebde;
  --accent-strong: #b8d8c1;
  --warning-bg: #fff4d6;
  --warning-border: #e6a700;
  --note-bg: #e6f4ec;
  --note-border: #009955;
  --code-bg: #e8efe9;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Microsoft JhengHei", "PingFang TC", "Noto Sans TC", -apple-system, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.7;
}

/* Layout */
.layout { display: flex; min-height: 100vh; }
/* Language toggle */
html[lang^="zh"] [lang="en"] { display: none !important; }
html[lang="en"] [lang^="zh"] { display: none !important; }
html[lang="en"] body { font-family: "Segoe UI", -apple-system, "Helvetica Neue", Arial, sans-serif; }

.lang-switch {
  display: flex;
  gap: 4px;
  margin: 0 24px 16px;
}
.lang-switch button {
  flex: 1;
  padding: 4px 8px;
  font-size: 12px;
  background: transparent;
  border: 1px solid var(--primary-dark);
  border-radius: 4px;
  color: #d4e7da;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.lang-switch button:hover {
  background: var(--primary-dark);
  color: #fff;
}
.lang-switch button.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
}

nav.sidebar {
  width: 260px;
  background: var(--primary-darker);
  border-right: 1px solid var(--primary-dark);
  padding: 24px 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  flex-shrink: 0;
}
nav.sidebar h1 {
  font-size: 18px;
  margin: 0 24px 4px;
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.5px;
}
nav.sidebar .version {
  font-size: 12px;
  color: #a8c9b3;
  margin: 0 24px 24px;
}
nav.sidebar ol {
  list-style: none;
  padding: 0;
  margin: 0;
}
nav.sidebar li a {
  display: block;
  padding: 10px 24px;
  color: #d4e7da;
  text-decoration: none;
  font-size: 14px;
  border-left: 3px solid transparent;
  transition: all 0.15s;
}
nav.sidebar li a:hover {
  background: var(--primary-dark);
  color: #fff;
}
nav.sidebar li a.active {
  background: var(--primary);
  color: #fff;
  border-left-color: #fff;
  font-weight: 600;
}
nav.sidebar .nav-group-title {
  padding: 16px 24px 6px;
  font-size: 11px;
  color: #a8c9b3;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
}

main {
  flex: 1;
  max-width: 960px;
  padding: 48px 64px;
  background: #fff;
}

/* Sections */
section {
  margin-bottom: 64px;
  scroll-margin-top: 24px;
}
section h2 {
  color: var(--primary-darker);
  border-bottom: 3px solid var(--primary);
  padding-bottom: 10px;
  margin-top: 0;
  font-size: 26px;
  font-weight: 700;
}
section h3 {
  color: var(--primary-dark);
  margin-top: 32px;
  font-size: 18px;
  font-weight: 600;
}
section p, section li { font-size: 15px; }
section ul, section ol { padding-left: 24px; }

/* Cover */
.cover {
  text-align: center;
  padding: 64px 32px 48px;
  background: linear-gradient(135deg, var(--primary-darker) 0%, var(--primary) 100%);
  border-radius: 8px;
  margin-bottom: 48px;
  color: #fff;
}
.cover h1 {
  font-size: 38px;
  color: #fff;
  margin: 0 0 12px;
  font-weight: 700;
  letter-spacing: 1px;
}
.cover .subtitle {
  font-size: 17px;
  color: #e6f2ea;
  margin-bottom: 28px;
  font-weight: 500;
}
.cover .meta {
  display: inline-flex;
  gap: 28px;
  font-size: 14px;
  color: #c8dfd0;
}

/* Screenshot placeholder */
.screenshot {
  background: #fafbfc;
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 48px 24px;
  text-align: center;
  color: var(--muted);
  margin: 16px 0;
  font-size: 14px;
}
.screenshot::before {
  content: "📷  ";
  font-size: 18px;
}
.screenshot .label {
  display: block;
  margin-top: 4px;
  color: var(--text);
  font-weight: 600;
}
.screenshot .hint {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}
.screenshot .filename {
  display: inline-block;
  margin-top: 12px;
  padding: 6px 14px;
  background: var(--primary-darker);
  color: #fff;
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px;
  border-radius: 4px;
  font-weight: 600;
  letter-spacing: 0.3px;
}
.screenshot .filename::before {
  content: "📁 存檔為: ";
  font-family: "Microsoft JhengHei", sans-serif;
  font-weight: normal;
  opacity: 0.85;
}

/* Real screenshots */
figure.shot {
  margin: 20px 0;
  text-align: center;
}
figure.shot img {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0, 77, 42, 0.12);
  cursor: zoom-in;
  user-select: none;
  transition: transform 0.12s;
}
figure.shot img:hover {
  transform: scale(1.01);
}

/* Lightbox modal */
.image-modal {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.88);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  padding: 32px;
  box-sizing: border-box;
}
.image-modal.open { display: flex; }
.image-modal img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.6);
  border-radius: 4px;
}
.image-modal .close-hint {
  position: absolute;
  top: 20px;
  right: 28px;
  color: #fff;
  font-size: 13px;
  opacity: 0.7;
  pointer-events: none;
}
figure.shot figcaption {
  margin-top: 10px;
  font-size: 13px;
  color: var(--muted);
  font-style: italic;
}

/* Step blocks */
.step {
  display: flex;
  gap: 16px;
  margin: 24px 0;
  padding: 20px;
  background: #fafcfa;
  border-left: 4px solid var(--primary);
  border-radius: 0 8px 8px 0;
}
.step .step-number {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
}
.step .step-content { flex: 1; }
.step .step-content h4 {
  margin: 0 0 8px;
  color: var(--primary-darker);
  font-size: 16px;
  font-weight: 600;
}
.step .step-content p {
  margin: 4px 0 8px;
}

/* Info / warning / note boxes */
.note {
  background: var(--note-bg);
  border-left: 4px solid var(--note-border);
  padding: 12px 16px;
  margin: 16px 0;
  border-radius: 0 4px 4px 0;
  font-size: 14px;
}
.note::before {
  content: "💡 ";
  font-weight: 600;
}
.warning {
  background: var(--warning-bg);
  border-left: 4px solid var(--warning-border);
  padding: 12px 16px 12px 44px;
  margin: 16px 0;
  border-radius: 0 4px 4px 0;
  font-size: 14px;
  position: relative;
}
.warning::before {
  content: "⚠️";
  font-weight: 600;
  position: absolute;
  left: 16px;
  top: 12px;
}

/* Table */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 14px;
}
table th {
  background: var(--primary);
  color: #fff;
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
}
table td {
  padding: 10px 12px;
  border: 1px solid var(--border);
}
table tr:nth-child(even) td {
  background: #f7faf8;
}

/* Code / inline */
code {
  background: var(--code-bg);
  padding: 2px 8px;
  border-radius: 3px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px;
  color: var(--primary-darker);
}

/* FAQ */
.faq-item {
  background: #fafcfa;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px 20px;
  margin: 12px 0;
}
.faq-item .q {
  font-weight: 700;
  color: var(--primary-darker);
  margin-bottom: 8px;
  font-size: 15px;
}
.faq-item .q::before {
  content: "Q: ";
  color: var(--primary);
}
.faq-item .a {
  color: var(--text);
  font-size: 14px;
  margin-left: 20px;
}
.faq-item .a::before {
  content: "A: ";
  color: var(--primary);
  font-weight: 700;
  margin-left: -20px;
}

/* Footer */
.footer {
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

/* Responsive */
@media (max-width: 900px) {
  .layout { flex-direction: column; }
  nav.sidebar {
    width: 100%;
    height: auto;
    position: static;
    padding: 16px 0;
  }
  main { padding: 24px; }
}

/* Inline-style replacements (CSP clean — no need for style-src 'unsafe-inline') */
.link-primary { color: var(--primary-dark); }
.link-primary-bold { color: var(--primary-dark); font-weight: 600; }
.h5-tab { color: var(--primary-dark); margin-top: 24px; margin-bottom: 6px; font-size: 15px; }
.list-tight { margin: 6px 0; }
