:root {
  color-scheme: light dark;
  /* 淺色模式背景與面板都是白色，輸入框只能靠框線辨認，所以表單控制項用比 --line 深的 --control-line（對白底至少 3:1） */
  --bg: #fff; --surface: #fff; --text: #1d1d1b; --muted: #6b6b66; --line: #f0e3e8; --control-line: #a8808f;
  --accent: #c92a68; --accent-text: #fff; --bad: #b3261e; --ok: #2e7d4f; --note-bg: #fdf2f5;
  font-family: system-ui, -apple-system, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  font-size: 16px; line-height: 1.6;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171314; --surface: #201a1c; --text: #ecebe6; --muted: #a2a19b; --line: #3a2f33; --control-line: #806a74;
    --accent: #f48fb1; --accent-text: #171314; --bad: #f08a80; --ok: #7cc79a; --note-bg: #2e2528;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
a { color: var(--accent); }
.box { max-width: 420px; margin: 48px auto; padding: 32px 28px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
@media (max-width: 480px) { .box { margin: 0; min-height: 100vh; border: 0; border-radius: 0; padding: 24px 16px; } }
.brand { display: inline-block; margin-bottom: 20px; font-weight: 700; color: var(--text); text-decoration: none; }
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-inner { max-width: 960px; margin: 0 auto; padding: 14px 24px; display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.topbar .brand { margin: 0; }
.nav { display: flex; gap: 16px; flex: 1; flex-wrap: wrap; }
.nav a { color: var(--muted); text-decoration: none; padding: 4px 0; }
.nav a[aria-current] { color: var(--text); font-weight: 600; border-bottom: 2px solid var(--accent); }
.topbar button { padding: 6px 12px; font-size: 14px; }
.app { max-width: 960px; margin: 32px auto; padding: 0 24px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.card { padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.card h2 { margin-bottom: 4px; }
.stat { font-size: 24px; font-weight: 700; margin: 0; }
.back { margin: 0 0 12px; font-size: 14px; }
@media (max-width: 480px) {
  .topbar-inner { padding: 12px 16px; gap: 12px; }
  .nav { order: 3; flex-basis: 100%; gap: 12px; }
  .app { margin: 24px auto; padding: 0 16px; }
}
h1 { font-size: 24px; margin: 0 0 20px; }
h2 { font-size: 18px; margin: 0 0 8px; }
form { display: grid; gap: 14px; }
label { display: grid; gap: 4px; font-size: 14px; color: var(--muted); }
label small { font-size: 12px; }
input[type=email], input[type=password], input[type=tel], input[type=text] { font: inherit; color: var(--text); background: var(--bg); padding: 10px 12px; border: 1px solid var(--control-line); border-radius: 8px; }
input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
input[type=date] { font: inherit; color: var(--text); background: var(--bg); padding: 10px 12px; border: 1px solid var(--control-line); border-radius: 8px; }
select { font: inherit; color: var(--text); background: var(--bg); padding: 10px 12px; border: 1px solid var(--control-line); border-radius: 8px; }
/* 勾選框與單選鈕跟著主色，不用瀏覽器預設的藍色 */
input[type=checkbox], input[type=radio] { accent-color: var(--accent); }
label.check { display: flex; gap: 8px; align-items: flex-start; color: var(--text); }
label.check input { margin-top: 5px; }
button, .button { font: inherit; font-weight: 600; padding: 10px 16px; border: 0; border-radius: 8px; background: var(--accent); color: var(--accent-text); cursor: pointer; text-align: center; text-decoration: none; display: inline-block; }
button.secondary, .button.secondary { background: transparent; color: var(--text); border: 1px solid var(--control-line); }
button:disabled { opacity: .6; cursor: wait; }
.row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.form-error { color: var(--bad); margin: 0; min-height: 1.6em; font-size: 14px; }
.form-error:empty { min-height: 0; }
.form-status { color: var(--ok); margin: 8px 0 0; font-size: 14px; }
.panel { margin-top: 8px; }
.panel[hidden], form[hidden] { display: none; }
/* 帳號頁的更換 email／手機：表單和登入頁一樣窄，手機寬度時佔滿 */
.settings { max-width: 420px; margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--line); }
.note { background: var(--note-bg); padding: 12px 14px; border-radius: 8px; }
.muted { color: var(--muted); }
.links { margin-top: 24px; font-size: 14px; color: var(--muted); }
dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0; }
dt { color: var(--muted); }
dd { margin: 0; overflow-wrap: anywhere; }
.box.wide { max-width: 960px; }
fieldset.cycle { display: flex; gap: 16px; align-items: center; border: 0; padding: 0; margin: 0 0 20px; }
fieldset.cycle legend { float: left; margin-right: 8px; color: var(--muted); font-size: 14px; }
fieldset.cycle label { display: flex; gap: 6px; align-items: center; color: var(--text); font-size: 16px; }
/* 性別：兩顆左右並排的按鈕，各自獨立、互斥。radio 用 1px 藏起來但保留焦點與鍵盤操作，
   外觀由相鄰的 span 畫出來——選中的那顆用 accent 底色，沒選的是線框。 */
fieldset.gender { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.gender legend { padding: 0; margin-bottom: 4px; color: var(--muted); font-size: 14px; }
fieldset.gender small { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); }
.gender-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.gender-options input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; }
.gender-options span { display: block; padding: 10px 12px; border: 1px solid var(--control-line); border-radius: 8px; background: var(--bg); color: var(--text); font-size: 16px; text-align: center; cursor: pointer; }
.gender-options input:checked + span { border-color: var(--accent); background: var(--accent); color: var(--accent-text); font-weight: 600; }
.gender-options input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
/* 高對比模式下背景與文字色會被系統值覆寫，改用框線粗細與勾號表示選中 */
@media (forced-colors: active) {
  .gender-options span { border-width: 1px; }
  .gender-options input:checked + span { border-width: 3px; }
  .gender-options input:checked + span::after { content: " ✓"; }
}
.tiers { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin-bottom: 16px; }
.tier { display: flex; flex-direction: column; gap: 8px; padding: 20px; border: 1px solid var(--line); border-radius: 12px; }
.tier h2, .tier p { margin: 0; }
.tier ul { margin: 0; padding-left: 20px; flex: 1; }
.price { font-size: 28px; font-weight: 700; }
.price .muted { font-size: 14px; font-weight: 400; }
.small { font-size: 13px; }
footer.site { margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.legal h2 { margin-top: 28px; }
.legal ol { padding-left: 22px; }
.legal li { margin-bottom: 6px; }
.legal table { width: 100%; border-collapse: collapse; margin: 8px 0 16px; font-size: 14px; display: block; overflow-x: auto; }
.legal th, .legal td { text-align: left; vertical-align: top; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.legal th { color: var(--muted); font-weight: 600; white-space: nowrap; }
.settings summary { cursor: pointer; font-weight: 600; color: var(--bad); }
.settings details[open] summary { margin-bottom: 12px; }
.settings form p { margin: 0; }
.panel.note p + p { margin-top: 8px; }
button.danger { background: var(--bad); color: var(--bg); }
