:root {
  --primary: #1f6feb;
  --primary-dark: #1656c4;
  --primary-soft: #e3eeff;
  --accent: #63a9ff;
  --bg: #f7f9fc;
  --surface: #ffffff;
  --text: #12171e;
  --text-muted: #5a6673;
  --border: #dce3ec;
  --radius: 12px;
  --radius-lg: 20px;
  --shadow: 0 10px 30px rgba(22, 86, 196, 0.12);
  --max-width: 1080px;
  --header-bg: rgba(247, 249, 252, 0.92);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang TC",
    "Noto Sans TC", "Microsoft JhengHei", Roboto, "Helvetica Neue", Arial,
    sans-serif;
  color-scheme: light dark;
}

/* 深色變數有兩份，內容必須完全一致：
   1. 這段媒體查詢是「JS 沒跑起來或使用者還沒選過」時的後備（跟隨系統）。
   2. 下面 `:root[data-theme="dark"]` 是使用者按了右上角切換鍵後的明確選擇。
   改色時兩處都要改。 */

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --primary: #4c8dff;
    --primary-dark: #6ba3ff;
    --primary-soft: #16243a;
    --accent: #63a9ff;
    --bg: #0f141b;
    --surface: #161d26;
    --text: #e7ecf3;
    --text-muted: #9aa7b6;
    --border: #263140;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
    --header-bg: rgba(15, 20, 27, 0.92);
    color-scheme: dark;
  }
}

/* 明確選擇深色：不受系統設定影響（深色變數與上面那份同步）。 */
:root[data-theme="dark"] {
  --primary: #4c8dff;
  --primary-dark: #6ba3ff;
  --primary-soft: #16243a;
  --accent: #63a9ff;
  --bg: #0f141b;
  --surface: #161d26;
  --text: #e7ecf3;
  --text-muted: #9aa7b6;
  --border: #263140;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --header-bg: rgba(15, 20, 27, 0.92);
  color-scheme: dark;
}

/* 明確選擇亮色：系統是深色時捲軸與表單元件也要跟著變亮。 */
:root[data-theme="light"] {
  color-scheme: light;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 72px;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: var(--primary);
}

h1,
h2,
h3 {
  line-height: 1.3;
  margin: 0 0 0.5em;
}

p {
  margin: 0 0 1em;
}

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--header-bg);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  padding-top: 10px;
  padding-bottom: 10px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}

.brand img {
  border-radius: 9px;
}

.brand small {
  font-weight: 500;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 18px;
  font-size: 0.92rem;
}

.site-nav a {
  color: var(--text-muted);
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--primary);
}

.lang-switch {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 12px;
  color: var(--text) !important;
  font-weight: 600;
}

.lang-switch:hover {
  border-color: var(--primary);
  color: var(--primary) !important;
}

/* 主題切換鍵（太陽／月亮單鍵）
   圖示顯示**目前**的明暗：亮色太陽、深色月亮；按一下切到相反的一邊。
   hover 提示文字由 theme.js 依 data-theme 更新，說明按下去會變成哪一邊。 */

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.theme-toggle:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-toggle .icon-moon {
  display: none;
}

:root[data-theme="dark"] .theme-toggle .icon-sun {
  display: none;
}

:root[data-theme="dark"] .theme-toggle .icon-moon {
  display: block;
}

/* 沒有 JS（theme.js 未執行）時的後備：跟隨系統換圖示。 */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun {
    display: none;
  }

  :root:not([data-theme="light"]) .theme-toggle .icon-moon {
    display: block;
  }
}

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.98rem;
  text-decoration: none;
  border: 1px solid transparent;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

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

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

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

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn svg {
  width: 18px;
  height: 18px;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0 0 24px;
}

/* Store badges */

.store-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.store-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

.store-badge svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.store-badge span {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.store-badge small {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.store-badge strong {
  font-size: 0.98rem;
}

/* Hero */

.hero {
  padding: 56px 0 32px;
  overflow: hidden;
}

.hero .container {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 48px;
  align-items: center;
}

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

.hero h1 {
  font-size: clamp(2.1rem, 4.6vw, 3.1rem);
  letter-spacing: -0.01em;
}

.hero .lead {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 34em;
}

.hero .store-badges {
  margin-top: 28px;
}

.phone {
  --phone-pad: 8px;
  position: relative;
  border-radius: 34px;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: var(--phone-pad);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.phone img {
  border-radius: 28px;
  width: 100%;
  height: auto;
}

/* 深色模式的截圖蓋在淺色截圖上。
   用背景圖而不是第二個 <img>：深色檔案還沒放進來時，背景是空的，
   下面的淺色截圖照常顯示，不會出現破圖或空白框。 */
.shot-dark {
  display: none;
  position: absolute;
  inset: var(--phone-pad);
  border-radius: 28px;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

:root[data-theme="dark"] .shot-dark {
  display: block;
}

/* 沒有 JS（theme.js 未執行）時跟隨系統。 */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .shot-dark {
    display: block;
  }
}

.phone-pair {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
  align-items: start;
}

.phone-pair figure {
  margin: 0;
}

.phone-pair figcaption {
  margin-top: 10px;
  font-size: 0.86rem;
  color: var(--text-muted);
  text-align: center;
}

.phone-pair figcaption strong {
  color: var(--text);
  display: block;
  font-size: 0.9rem;
}

/* Sections */

.section {
  padding: 64px 0;
}

.section-alt {
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.section-head {
  max-width: 640px;
  margin: 0 0 36px;
}

.section-head h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
}

.section-head p {
  color: var(--text-muted);
  margin: 0;
}

.grid {
  display: grid;
  gap: 20px;
}

.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.section-alt .card {
  background: var(--bg);
}

.card h3 {
  font-size: 1.05rem;
  margin-bottom: 0.4em;
}

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

.card .note {
  display: block;
  margin-top: 10px;
  font-size: 0.8rem;
  color: var(--text-muted);
  opacity: 0.9;
}

.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-bottom: 14px;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary);
}

.icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Steps */

.steps {
  counter-reset: step;
}

/* 數字圓標與標題的間距由同一組變數推導，兩者不會再各自設定而重疊。
   舊版是 `.step { padding-top: 34px }` 配 `::before { top: 20px; height: 26px }`，
   圓標下緣 46px 壓到從 34px 開始的標題（重疊 12px）。 */
.step {
  --step-badge: 26px;
  --step-badge-top: 24px;
  position: relative;
  padding-top: calc(var(--step-badge-top) + var(--step-badge) + 10px);
}

.step::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  top: var(--step-badge-top);
  left: 24px;
  width: var(--step-badge);
  height: var(--step-badge);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
}

.step h3 {
  margin-bottom: 0.35em;
}

/* Screens */

.screens {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.screens figure {
  margin: 0;
}

.screens figcaption {
  margin-top: 12px;
  text-align: center;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.screens figcaption strong {
  display: block;
  color: var(--text);
  font-size: 0.95rem;
}

/* FAQ */

.faq {
  display: grid;
  gap: 14px;
  max-width: 760px;
}

.faq details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
}

.section-alt .faq details {
  background: var(--bg);
}

.faq summary {
  cursor: pointer;
  font-weight: 600;
  list-style: none;
}

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

.faq summary::after {
  content: "+";
  float: right;
  color: var(--primary);
  font-weight: 700;
}

.faq details[open] summary::after {
  content: "−";
}

.faq p {
  margin: 12px 0 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Contact */

.contact {
  text-align: center;
  padding: 72px 0;
}

.contact h2 {
  font-size: clamp(1.4rem, 3vw, 1.9rem);
}

.contact p {
  color: var(--text-muted);
  max-width: 34em;
  margin: 0 auto 24px;
}

.contact .cta-row {
  justify-content: center;
  margin-bottom: 28px;
}

.contact .store-badges {
  justify-content: center;
}

/* Footer */

.site-footer {
  padding: 32px 0;
  font-size: 0.9rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

.site-footer .container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.site-footer p {
  margin: 0;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 24px;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--primary);
  text-decoration: underline;
}

/* Legal */

.legal {
  padding: 56px 0 80px;
}

.legal .container {
  max-width: 760px;
}

.legal h1 {
  font-size: clamp(1.8rem, 4vw, 2.4rem);
}

.legal-meta {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 2em;
}

.legal h2 {
  font-size: 1.3rem;
  margin-top: 2.2em;
}

.legal h3 {
  font-size: 1.02rem;
  margin-top: 1.6em;
}

.legal ul {
  padding-left: 1.2em;
  margin: 0 0 1em;
}

.legal li {
  margin-bottom: 0.5em;
  color: var(--text);
}

.legal p {
  color: var(--text);
}

/* 404 */

.not-found {
  min-height: 70vh;
  display: flex;
  align-items: center;
  text-align: center;
  padding: 72px 0;
}

.not-found img {
  margin: 0 auto 20px;
  border-radius: 20px;
}

.not-found .cta-row {
  justify-content: center;
}

/* Responsive */

@media (max-width: 900px) {
  .hero .container {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .hero-visual {
    max-width: 340px;
    margin: 0 auto;
  }

  .grid-3,
  .screens {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 620px) {
  html {
    /* 手機上 header 會折成兩列，錨點要讓開整個高度 */
    scroll-padding-top: 112px;
  }

  .site-header .container {
    flex-wrap: wrap;
    gap: 8px;
  }

  .site-nav {
    width: 100%;
    gap: 4px 14px;
    font-size: 0.86rem;
    padding-bottom: 6px;
  }

  .grid-3,
  .screens {
    grid-template-columns: 1fr;
  }

  .hero {
    padding-top: 36px;
  }

  .section {
    padding: 48px 0;
  }
}
