:root {
  --bg: #f5f9fa; --surface: #ffffff; --ink: #1f3339; --muted: #5b7178;
  --accent: #2f97a6; --accent-ink: #ffffff; --soft: #e2f0f2; --line: #d6e6e9;
  --warn: #c55a4a; --warn-soft: #fbeee9; --radius: 20px;
  --stage-bg: radial-gradient(1200px 700px at 30% 20%, #f8fbfc, #dde9ec 60%, #cadcdf);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1a1d; --surface: #16252a; --ink: #e4eff1; --muted: #9db3b9; --accent: #4fb9c8; --accent-ink: #0f1a1d;
    --soft: #1c3237; --line: #25393f; --warn: #f09a86; --warn-soft: #33241f;
    --stage-bg: radial-gradient(1200px 700px at 30% 20%, #1f3136, #142226 60%, #0e1a1d);
  }
}
:root[data-theme="dark"] {
  --bg: #0f1a1d; --surface: #16252a; --ink: #e4eff1; --muted: #9db3b9; --accent: #4fb9c8; --accent-ink: #0f1a1d;
  --soft: #1c3237; --line: #25393f; --warn: #f09a86; --warn-soft: #33241f;
  --stage-bg: radial-gradient(1200px 700px at 30% 20%, #1f3136, #142226 60%, #0e1a1d);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 70px; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: "Noto Sans TC", "PingFang TC", system-ui, sans-serif; line-height: 1.75; font-size: 17px; }
a { color: var(--accent); }
h1, h2, h3, h4 { line-height: 1.3; margin: 0 0 .5em; }
h2 { font-size: clamp(26px, 4vw, 36px); font-weight: 900; }
button { font: inherit; color: inherit; }

.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px clamp(16px, 4vw, 48px); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { font-weight: 900; color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.brand .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--soft); }
nav { display: flex; gap: 18px; overflow-x: auto; }
nav a { color: var(--muted); text-decoration: none; font-size: 15px; white-space: nowrap; }
nav a:hover { color: var(--accent); }

.section { max-width: 1120px; margin: 0 auto; padding: 72px clamp(16px, 4vw, 48px); }
.sub { color: var(--muted); margin-top: -4px; }
.eyebrow { color: var(--accent); font-weight: 700; letter-spacing: .08em; font-size: 14px; margin: 0 0 8px; }

.hero { max-width: 1120px; margin: 0 auto; padding: 64px clamp(16px, 4vw, 48px) 28px; }
.hero h1 { font-size: clamp(36px, 6vw, 64px); font-weight: 900; }
.hero h1 em { font-style: normal; color: var(--accent); }
.lead { font-size: 19px; color: var(--muted); max-width: 640px; }
.cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 22px; }
.btn { display: inline-block; padding: 12px 22px; border-radius: 999px; border: 2px solid var(--accent); color: var(--accent); font-weight: 700; text-decoration: none; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }

/* 3D 檢視器 */
.viewer-wrap { max-width: 1320px; margin: 0 auto; padding: 8px clamp(16px, 3vw, 32px) 0; }
.viewer { position: relative; aspect-ratio: 16 / 9; min-height: 420px; border-radius: 28px; overflow: hidden; background: var(--stage-bg);
  box-shadow: 0 40px 80px -45px rgba(20, 70, 80, .55); border: 1px solid var(--line); touch-action: none; }
.viewer canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; }
.viewer canvas:active { cursor: grabbing; }
.v-labels { position: absolute; inset: 0; pointer-events: none; }
.v-line { position: absolute; inset: 0; overflow: visible; }
.v-line line { stroke: #1f2f34; stroke-width: 2; }
.v-line circle { fill: #fff; stroke: #1f2f34; stroke-width: 2.5; }
.v-tag { position: absolute; transform: translate(0, -50%); background: rgba(255, 255, 255, .94); color: #1f2f34; border: 2px solid #1f2f34;
  border-radius: 999px; padding: 2px 12px; font-size: 14px; font-weight: 700; white-space: nowrap; }
.v-tag.l { transform: translate(-100%, -50%); }
.v-top { position: absolute; left: 16px; right: 16px; top: 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.v-stages { display: flex; gap: 6px; flex-wrap: wrap; background: rgba(255, 255, 255, .8); backdrop-filter: blur(8px); padding: 6px; border-radius: 999px; }
.v-stages button { border: 0; background: transparent; color: #33494f; font-weight: 700; padding: 6px 14px; border-radius: 999px; cursor: pointer; font-size: 15px; }
.v-stages button.on { background: #2f97a6; color: #fff; }
.v-hint { margin: 0; font-size: 13px; color: #33494f; background: rgba(255, 255, 255, .7); padding: 4px 12px; border-radius: 999px; }
.v-bottom { position: absolute; left: 16px; right: 16px; bottom: 16px; display: flex; justify-content: space-between; align-items: end; gap: 12px; flex-wrap: wrap; pointer-events: none; }
.v-info { max-width: 520px; background: rgba(255, 255, 255, .88); backdrop-filter: blur(8px); color: #1f3339; border-radius: 18px; padding: 12px 16px; font-size: 15px; line-height: 1.6; }
.v-info b { display: block; font-size: 18px; }
.v-treat { pointer-events: auto; display: flex; align-items: center; gap: 10px; background: rgba(255, 255, 255, .88); color: #1f3339; border-radius: 999px; padding: 8px 16px; font-size: 14px; font-weight: 700; }
.v-treat input { width: 160px; accent-color: #2f97a6; }
.v-fallback { display: none; position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.viewer.no-webgl .v-fallback { display: block; }
.viewer.no-webgl .v-hint, .viewer.no-webgl .v-treat { display: none; }
.caption { color: var(--muted); font-size: 13px; text-align: center; margin: 10px 0 0; }

.video-wrap { border-radius: var(--radius); overflow: hidden; background: #000; aspect-ratio: 16 / 9; box-shadow: 0 30px 60px -30px rgba(20, 70, 80, .45); }
.video-wrap video { width: 100%; height: 100%; display: block; }

.causes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 24px; }
.cause { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.cause .num { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-weight: 900; margin-bottom: 10px; }
.cause h3 { font-size: 18px; }
.cause p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.6; }

.stages { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-top: 24px; }
.stage-card { text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 10px 16px; cursor: pointer;
  transition: transform .2s, box-shadow .2s; }
.stage-card:hover { transform: translateY(-4px); box-shadow: 0 18px 30px -20px rgba(20, 70, 80, .45); }
.stage-card img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 14px; display: block; background: var(--soft); }
.stage-card .en { display: block; color: var(--accent); font-size: 13px; font-weight: 700; margin: 10px 4px 0; letter-spacing: .05em; }
.stage-card h3 { font-size: 18px; margin: 2px 4px 4px; }
.stage-card p { margin: 0 4px; color: var(--muted); font-size: 14px; line-height: 1.55; }
.stage-card .tip { margin-top: 8px; color: var(--warn); font-weight: 600; }

.tabs { display: flex; gap: 8px; margin-top: 20px; flex-wrap: wrap; }
.tabs button { border: 2px solid var(--line); background: var(--surface); padding: 8px 20px; border-radius: 999px; font-weight: 700; cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.treat-panel { margin-top: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; }
.treat-panel .note { color: var(--muted); margin-top: -6px; }
.treat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-top: 12px; }
.treat-grid article { background: var(--soft); border-radius: 16px; padding: 18px 20px; }
.treat-grid h4 { color: var(--accent); font-size: 17px; margin-bottom: 4px; }
.treat-grid p { margin: 0; font-size: 15px; line-height: 1.65; }

.timeline { list-style: none; padding: 0; margin: 24px 0 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; counter-reset: s; }
.timeline li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; counter-increment: s; position: relative; }
.timeline li::before { content: counter(s); display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-weight: 900; margin-bottom: 10px; }
.timeline b { display: block; font-size: 19px; }
.timeline span { color: var(--muted); font-size: 15px; line-height: 1.6; }

.two-col { display: grid; grid-template-columns: 1.3fr 1fr; gap: 40px; align-items: start; }
.checks { list-style: none; padding: 0; margin: 0; }
.checks li { padding: 10px 0 10px 36px; position: relative; border-bottom: 1px dashed var(--line); }
.checks li::before { content: "✓"; position: absolute; left: 0; top: 10px; width: 24px; height: 24px; border-radius: 50%; background: var(--soft); color: var(--accent); display: grid; place-items: center; font-weight: 900; font-size: 14px; }
.doctor { background: var(--warn-soft); border-radius: var(--radius); padding: 24px 26px; }
.doctor h3 { color: var(--warn); font-size: 19px; }
.doctor ul { margin: 0; padding-left: 1.2em; }

details { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 4px 20px; margin-bottom: 12px; }
summary { cursor: pointer; font-weight: 700; padding: 12px 0; }
details p { margin: 0 0 14px; color: var(--muted); }

.visit-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; max-width: 640px; }
.visit-card p { margin: 6px 0; display: flex; gap: 16px; }
.visit-card span { color: var(--muted); min-width: 3em; }
.visit-card .gentle { color: var(--muted); font-size: 14px; margin-top: 14px; display: block; }
.clinic-name { font-size: 22px; font-weight: 900; }
.foot { text-align: center; color: var(--muted); font-size: 14px; padding: 40px 16px 60px; border-top: 1px solid var(--line); }
.foot p { max-width: 760px; margin: 6px auto; }

@media (max-width: 960px) {
  .causes { grid-template-columns: repeat(2, 1fr); }
  .stages { grid-template-columns: repeat(2, 1fr); }
  .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .topbar nav { display: none; }
  .section { padding: 48px 16px; }
  .viewer { aspect-ratio: 3 / 4; min-height: 0; border-radius: 20px; }
  .v-hint { display: none; }
  .v-stages button { padding: 5px 10px; font-size: 14px; }
  .v-info { font-size: 13px; padding: 10px 12px; }
  .v-info span { display: none; }
  .v-treat input { width: 110px; }
  .v-tag { font-size: 12px; padding: 1px 8px; }
  .causes, .stages, .treat-grid, .timeline { grid-template-columns: 1fr; }
}

/* 診所資訊：連結與按鈕（2026-11-11） */
.home-link { margin-left: auto; padding-left: 14px; color: var(--accent); font-size: 15px; font-weight: 700; text-decoration: none; white-space: nowrap; }
.home-link:hover { text-decoration: underline; }
.visit-card a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.visit-card b { min-width: 0; overflow-wrap: anywhere; }
.visit-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.visit-actions .va { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 20px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--ink); font-weight: 700; text-decoration: none; }
.visit-actions .va.line { background: #06c755; border-color: #06c755; color: #fff; }
@media (max-width: 420px) { .visit-actions .va { flex: 1 1 100%; } }
@media (max-width: 340px) { .brand { font-size: 15px; } .home-link { font-size: 14px; padding-left: 8px; } }
@media (max-width: 340px) { .v-tag { font-size: 11px; padding: 0 5px; border-width: 1px; } }
