:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-alt: #f1f5f9;
  --text: #0f172a;
  --text-muted: #475569;
  --border: #e2e8f0;
  --primary: #1a73e8;
  --primary-hover: #1557b0;
  --primary-soft: #e8f0fe;
  --success: #16a34a;
  --success-soft: #dcfce7;
  --warn-bg: #fffbeb;
  --warn-border: #fcd34d;
  --warn-text: #92400e;
  --danger-bg: #fef2f2;
  --danger-border: #fca5a5;
  --danger-text: #991b1b;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 4px 16px rgba(15, 23, 42, 0.04);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

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

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.container {
  max-width: 920px;
  margin: 0 auto;
  padding: 24px 18px 64px;
}

/* Top Navigation */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-inner {
  max-width: 920px;
  margin: 0 auto;
  padding: 12px 18px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
}

.brand:hover {
  text-decoration: none;
  color: var(--primary);
}

.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  display: inline-block;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.nav-link {
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: background 0.15s, color 0.15s;
}

.nav-link:hover {
  background: var(--surface-alt);
  color: var(--text);
  text-decoration: none;
}

.nav-link.active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}

/* Hero / Page Header */
.hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

.badge {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 10px;
}

h1 {
  margin: 0 0 10px;
  font-size: clamp(1.5rem, 3.2vw, 2rem);
  line-height: 1.25;
  letter-spacing: -0.01em;
}

h2 {
  margin: 0 0 14px;
  font-size: 1.25rem;
  line-height: 1.35;
}

h3 {
  margin: 0 0 8px;
  font-size: 1.05rem;
}

.subtitle {
  margin: 0;
  color: var(--text-muted);
  font-size: 1rem;
}

/* Cards & Grids */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.entry-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  margin-bottom: 0;
  transition: transform 0.15s, border-color 0.15s;
}

.entry-card:hover {
  transform: translateY(-2px);
  border-color: #bfd4f9;
}

.entry-card p {
  color: var(--text-muted);
  margin: 8px 0 18px;
  font-size: 0.95rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 9px;
  font-size: 0.92rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  text-decoration: none;
}

.btn:hover {
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-outline {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.btn-outline:hover {
  background: var(--surface-alt);
  border-color: #cbd5e1;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.84rem;
}

.quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* Table */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.94rem;
  background: var(--surface);
}

th,
td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

th {
  background: var(--surface-alt);
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

tr:last-child td {
  border-bottom: none;
}

/* Callouts */
.callout {
  border-radius: 10px;
  padding: 14px 16px;
  margin: 14px 0;
  font-size: 0.94rem;
  border: 1px solid;
}

.callout-warn {
  background: var(--warn-bg);
  border-color: var(--warn-border);
  color: var(--warn-text);
}

.callout-danger {
  background: var(--danger-bg);
  border-color: var(--danger-border);
  color: var(--danger-text);
}

.callout-info {
  background: var(--primary-soft);
  border-color: #bfdbfe;
  color: #1e3a8a;
}

.callout strong {
  font-weight: 700;
}

/* Interactive Checklist */
.checklist-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.progress-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.progress-bar {
  width: 110px;
  height: 8px;
  background: var(--surface-alt);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--success);
  transition: width 0.2s ease;
}

.step-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.step-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  background: var(--surface);
  transition: background 0.15s, border-color 0.15s;
}

.step-item.done {
  background: #f8fafc;
  border-color: #bbf7d0;
}

.step-label {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
}

.step-checkbox {
  margin-top: 3px;
  width: 19px;
  height: 19px;
  accent-color: var(--success);
  cursor: pointer;
  flex-shrink: 0;
}

.step-content {
  flex: 1;
  min-width: 0;
}

.step-title {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 4px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.step-item.done .step-title {
  color: var(--text-muted);
  text-decoration: line-through;
}

.step-desc {
  color: var(--text-muted);
  font-size: 0.93rem;
}

.step-desc ul {
  margin: 6px 0 0;
  padding-left: 18px;
}

.step-desc li {
  margin-bottom: 4px;
}

.step-actions {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Details / Collapsible */
details.card {
  padding: 0;
  overflow: hidden;
}

details.card > summary {
  padding: 18px 22px;
  font-weight: 700;
  font-size: 1.05rem;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

details.card > summary::-webkit-details-marker {
  display: none;
}

details.card > summary::after {
  content: "展開說明 ▾";
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
  flex-shrink: 0;
}

details.card[open] > summary::after {
  content: "收起 ▴";
}

.details-body {
  padding: 0 22px 22px;
  border-top: 1px solid var(--border);
}

/* Code / Copy Box */
.code-box {
  position: relative;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 10px;
  padding: 14px 16px;
  margin-top: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.83rem;
  line-height: 1.55;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.copy-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 14px;
  gap: 10px;
}

code.inline {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.86em;
  color: #0f172a;
}

.footer {
  margin-top: 32px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

@media (max-width: 600px) {
  .container {
    padding: 16px 12px 48px;
  }
  .hero,
  .card {
    padding: 18px 16px;
  }
  th,
  td {
    padding: 10px;
    font-size: 0.88rem;
  }
}
