:root {
  --bg: #f5f1ea;
  --card: #ffffff;
  --ink: #1c2b28;
  --ink-2: #4a5b57;
  --muted: #7a8a86;
  --brand: #2f6c62;
  --brand-2: #4a9b8f;
  --accent: #d97757;
  --border: #e2ddd2;
  --code-bg: #10221f;
  --code-ink: #e8f1ee;
  --shadow: 0 1px 2px rgba(28, 43, 40, 0.06), 0 8px 24px rgba(28, 43, 40, 0.08);
  --radius: 14px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1614;
    --card: #17221f;
    --ink: #ecf3f0;
    --ink-2: #b8c5c1;
    --muted: #8a9995;
    --brand: #4a9b8f;
    --brand-2: #63b7ab;
    --accent: #e6926f;
    --border: #223330;
    --code-bg: #0a1513;
    --shadow: 0 1px 2px rgba(0,0,0,0.3), 0 8px 24px rgba(0,0,0,0.4);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  padding-bottom: env(safe-area-inset-bottom);
}

#app {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 16px 60px;
}

.hero {
  padding: 24px 20px 22px;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);
  color: #fff;
  margin-bottom: 22px;
  box-shadow: var(--shadow);
}
.hero h1 {
  margin: 0 0 6px;
  font-size: 22px;
  letter-spacing: 0.5px;
}
.hero .sub {
  margin: 0;
  opacity: 0.92;
  font-size: 14px;
}
.hero .intro {
  margin: 12px 0 0;
  font-size: 14px;
  line-height: 1.6;
  opacity: 0.94;
}

.section-label {
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 1px;
  margin: 24px 4px 10px;
  text-transform: uppercase;
}

.stages {
  display: grid;
  gap: 12px;
}

.stage-card {
  display: block;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease;
}
.stage-card:active { transform: scale(0.99); }
.stage-card .row { display: flex; align-items: baseline; gap: 10px; }
.stage-card .num {
  display: inline-block;
  min-width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  text-align: center;
  line-height: 32px;
  font-size: 15px;
}
.stage-card .title { font-size: 18px; font-weight: 700; margin: 0; }
.stage-card .subtitle { color: var(--muted); font-size: 13px; margin: 2px 0 8px 42px; }
.stage-card .goal { margin: 8px 0 0 42px; font-size: 14px; color: var(--ink-2); }
.stage-card .tools { margin: 6px 0 0 42px; font-size: 12px; color: var(--brand); }

.quick-links {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}
.quick-link {
  display: block;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  text-decoration: none;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
}
.quick-link .hint {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  margin-top: 2px;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.back-btn {
  background: transparent;
  border: none;
  color: var(--brand);
  font-size: 15px;
  font-weight: 600;
  padding: 6px 0;
  cursor: pointer;
}
.stage-header h2 {
  margin: 0 0 6px;
  font-size: 22px;
}
.stage-header .sub {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 12px;
}
.stage-header .box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 18px;
}
.stage-header .box strong { color: var(--brand); }
.stage-header ol {
  margin: 8px 0 0;
  padding-left: 20px;
  color: var(--ink-2);
  font-size: 14px;
}
.stage-header ol li { margin-bottom: 4px; }

.item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.item h3 {
  margin: 0 0 10px;
  font-size: 16px;
}
.item .body {
  margin: 0 0 12px;
  color: var(--ink-2);
  font-size: 14px;
  white-space: pre-wrap;
  line-height: 1.6;
}
.item .content-block {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 14px;
  white-space: pre-wrap;
  line-height: 1.6;
  max-height: 220px;
  overflow: auto;
  margin: 0 0 10px;
}
.item .code-block {
  background: var(--code-bg);
  color: var(--code-ink);
  border-radius: 10px;
  padding: 12px 14px;
  font: 12.5px/1.55 "SF Mono", Menlo, Consolas, monospace;
  white-space: pre;
  overflow: auto;
  max-height: 240px;
  margin: 0 0 10px;
}
.item .row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.btn {
  appearance: none;
  border: none;
  font: inherit;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: 10px;
  cursor: pointer;
  min-height: 40px;
  font-size: 14px;
}
.btn-primary {
  background: var(--brand);
  color: #fff;
  flex: 1;
  min-width: 100px;
}
.btn-primary:active { background: var(--brand-2); }
.btn-secondary {
  background: transparent;
  color: var(--brand);
  border: 1px solid var(--border);
}
.btn-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--brand);
  color: #fff;
  text-decoration: none;
  padding: 12px 16px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 15px;
  width: 100%;
  justify-content: center;
}
.btn-link:active { background: var(--brand-2); }

.item.item-link .body { margin-bottom: 12px; }
.item.item-link .row { flex-direction: column; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translate(-50%, 20px);
  background: var(--ink);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  box-shadow: var(--shadow);
  z-index: 100;
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.footer {
  margin-top: 32px;
  padding: 16px 4px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  line-height: 1.7;
}
