:root {
  --bg: #f6f8f7;
  --surface: #ffffff;
  --surface-alt: #eef3f1;
  --text: #15211e;
  --muted: #52635e;
  --border: #dce5e1;
  --accent: #117a5f;
  --accent-deep: #0e5369;
  --accent-soft: #e3f3ee;
  --warn-bg: #fff6e5;
  --warn-border: #f0c975;
  --warn-text: #744c00;
  --code-bg: #eef2f0;
  --shadow: 0 2px 10px rgba(14, 51, 43, 0.06);
  --radius: 14px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1514;
    --surface: #17201e;
    --surface-alt: #1f2b28;
    --text: #e8f0ed;
    --muted: #9eb0aa;
    --border: #2a3a36;
    --accent: #34b391;
    --accent-deep: #1b6f8a;
    --accent-soft: #16332c;
    --warn-bg: #2e2514;
    --warn-border: #7a5c1d;
    --warn-text: #f6d488;
    --code-bg: #202d2a;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
  }
}

:root[data-theme="dark"] {
  --bg: #0f1514;
  --surface: #17201e;
  --surface-alt: #1f2b28;
  --text: #e8f0ed;
  --muted: #9eb0aa;
  --border: #2a3a36;
  --accent: #34b391;
  --accent-deep: #1b6f8a;
  --accent-soft: #16332c;
  --warn-bg: #2e2514;
  --warn-border: #7a5c1d;
  --warn-text: #f6d488;
  --code-bg: #202d2a;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  font-size: 16px;
  line-height: 1.65;
}

.hero {
  background: linear-gradient(135deg, #147b5e 0%, #0e5369 100%);
  color: #ffffff;
  padding: max(20px, env(safe-area-inset-top)) 16px 20px;
}

.hero-inner, .container, .toc-pills { max-width: 920px; margin: 0 auto; }

.brand-row { display: flex; align-items: flex-start; gap: 12px; }
.app-icon {
  flex: 0 0 48px;
  height: 48px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.16);
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.25);
}
.brand-text { flex: 1; min-width: 0; }
.brand-text h1 { margin: 0; font-size: 1.35rem; line-height: 1.3; letter-spacing: 0.01em; }
.subtitle { margin: 4px 0 0; font-size: 0.92rem; color: rgba(255, 255, 255, 0.88); }

.icon-btn {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
}

.platform-strip { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.chip {
  font-size: 0.78rem;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #fff;
}

.search-wrap { position: relative; margin-top: 14px; display: flex; gap: 8px; }
#search-input {
  width: 100%;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.96);
  color: #15211e;
  font-size: 16px;
}
#search-input:focus-visible { outline: 2px solid #ffffff; outline-offset: 2px; }
#search-input::placeholder { color: #637570; }
.clear-btn {
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(0, 0, 0, 0.22);
  color: #fff;
  font-size: 0.88rem;
  cursor: pointer;
  white-space: nowrap;
}
.search-status { margin-top: 8px; font-size: 0.85rem; color: rgba(255, 255, 255, 0.92); }

.toc-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 8px 12px;
  backdrop-filter: blur(10px);
}
.toc-pills {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.toc-pills::-webkit-scrollbar { display: none; }
.toc-pill {
  flex: 0 0 auto;
  text-decoration: none;
  color: var(--muted);
  background: var(--surface-alt);
  border: 1px solid transparent;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 500;
  white-space: nowrap;
}
.toc-pill.active, .toc-pill:hover {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: var(--accent);
}

.container { padding: 18px 14px 48px; }
.guide-section { scroll-margin-top: 64px; margin-bottom: 28px; }
.section-head { margin-bottom: 12px; }
.section-kicker {
  display: inline-block;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 9px;
  border-radius: 999px;
  margin-bottom: 6px;
}
.section-head h2 { margin: 0; font-size: 1.28rem; line-height: 1.35; }
.section-lead { margin: 4px 0 0; color: var(--muted); font-size: 0.94rem; }

.card-grid { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 720px) {
  .card-grid.two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.card {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 15px 16px;
  box-shadow: var(--shadow);
}
.card h3 { margin: 0 0 8px; font-size: 1.03rem; line-height: 1.4; }
.card p { margin: 0 0 8px; }
.card p:last-child, .card ul:last-child, .card ol:last-child { margin-bottom: 0; }
.card ul, .card ol { margin: 6px 0 8px; padding-left: 20px; }
.card li { margin-bottom: 5px; }

.pipeline { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .pipeline { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.pipe-step {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 13px 14px;
}
.pipe-num { font-size: 0.76rem; font-weight: 700; color: var(--accent); margin-bottom: 4px; }
.pipe-step h4 { margin: 0 0 6px; font-size: 0.98rem; }
.pipe-step p { margin: 0; font-size: 0.88rem; color: var(--muted); }

.callout {
  margin-top: 10px;
  padding: 11px 13px;
  border-radius: 11px;
  font-size: 0.9rem;
  border: 1px solid var(--border);
  background: var(--surface-alt);
}
.callout.warn {
  background: var(--warn-bg);
  border-color: var(--warn-border);
  color: var(--warn-text);
}

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin-top: 8px; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; min-width: 460px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-weight: 600; background: var(--surface-alt); white-space: nowrap; }

code, kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.86em;
  background: var(--code-bg);
  padding: 2px 6px;
  border-radius: 6px;
}
kbd { border: 1px solid var(--border); box-shadow: inset 0 -1px 0 var(--border); }

.code-block {
  position: relative;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 72px 11px 12px;
  margin: 8px 0 0;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.83rem;
  line-height: 1.5;
  white-space: pre;
}
.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 8px;
  padding: 4px 9px;
  font-size: 0.78rem;
  cursor: pointer;
}

.faq-list { display: grid; gap: 8px; }
details.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
}
details.faq-item summary {
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
details.faq-item summary::after { content: "+"; color: var(--accent); font-weight: 700; }
details.faq-item[open] summary::after { content: "−"; }
details.faq-item p { margin: 8px 0 0; color: var(--muted); font-size: 0.93rem; }

.empty-state {
  text-align: center;
  padding: 36px 16px;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}
.site-footer {
  text-align: center;
  padding: 20px 16px max(28px, env(safe-area-inset-bottom));
  color: var(--muted);
  font-size: 0.83rem;
  border-top: 1px solid var(--border);
}
.is-hidden { display: none !important; }
