:root {
  --bg: #f7f3ec;
  --card: #ffffff;
  --ink: #1f2a2e;
  --ink-2: #55636a;
  --line: #e4ddd1;
  --brand: #2f6f62;
  --brand-2: #e6f1ee;
  --warm: #b34d14;
  --warm-2: #fbeee6;
  --high: #c0392b;
  --medium: #d99a1e;
  --low: #7a8b8f;
  --ok: #2f8f5b;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(31, 42, 46, .06), 0 4px 16px rgba(31, 42, 46, .06);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
main { max-width: 520px; margin: 0 auto; padding: 16px 16px 144px; outline: none; }
h1 { font-size: 26px; line-height: 1.3; margin: 8px 0 4px; letter-spacing: .02em; }
h2 { font-size: 20px; margin: 28px 0 10px; }
h3 { font-size: 17px; margin: 0 0 4px; }
p { margin: 6px 0; }
.muted { color: var(--ink-2); font-size: 16px; }
.small { font-size: 16px; }
a { color: var(--brand); }

.topbar {
  position: sticky; top: 0; z-index: 10;
  background: rgba(247, 243, 236, .92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; max-width: 520px; margin: 0 auto; padding: 10px 16px; text-decoration: none; color: var(--ink); }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 18px; }
.brand-text { font-weight: 700; letter-spacing: .04em; }

.hero { background: var(--brand); color: #fff; border-radius: 20px; padding: 22px 20px; margin: 8px 0 18px; }
.hero h1 { color: #fff; }
.hero .tag { display: inline-block; background: rgba(255,255,255,.16); border-radius: 999px; padding: 4px 12px; font-size: 16px; margin-bottom: 8px; }
.hero p { color: rgba(255,255,255,.9); }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin: 12px 0; }
.card.flat { box-shadow: none; border: 1px solid var(--line); }
.row { display: flex; gap: 10px; align-items: center; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.btn {
  touch-action: manipulation;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 12px 18px; border-radius: 14px; border: 0;
  font: inherit; font-weight: 700; font-size: 17px; cursor: pointer; text-decoration: none;
  background: var(--brand); color: #fff; width: 100%;
}
.btn:active { transform: translateY(1px); }
.btn.secondary { background: var(--brand-2); color: var(--brand); }
.btn.warm { background: var(--warm); }
.btn.ghost { background: transparent; color: var(--ink-2); border: 1px solid var(--line); }
.btn.sm { min-height: 44px; padding: 10px 14px; font-size: 16px; width: auto; border-radius: 10px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.sticky-cta { position: fixed; left: 0; right: 0; bottom: 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--bg) 30%); }
.sticky-cta .inner { max-width: 520px; margin: 0 auto; }

label.field { display: block; margin: 12px 0; font-weight: 600; }
label.field input, label.field select {
  display: block; width: 100%; margin-top: 6px; font: inherit; font-weight: 400;
  padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: #fff;
}

/* 三好步驟導覽 */
.steps { list-style: none; padding: 0; margin: 0; }
.step { display: flex; gap: 14px; align-items: flex-start; padding: 14px; border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); margin: 10px 0; text-decoration: none; color: var(--ink); }
.step .num { flex: none; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; background: var(--brand-2); color: var(--brand); }
.step.done .num { background: var(--brand); color: #fff; }
.step .badge { font-size: 16px; font-weight: 700; color: var(--warm); letter-spacing: .08em; }
.step .go { margin-left: auto; align-self: center; color: var(--ink-2); font-size: 22px; }

/* 照片與標記 */
.photo { position: relative; border-radius: 14px; overflow: hidden; background: #ddd; }
.photo img { display: block; width: 100%; height: auto; }
.pin {
  position: absolute; transform: translate(-50%, -50%);
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 800; font-size: 16px; color: #fff;
  border: 3px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.35);
}
.pin.high { background: var(--high); }
.pin.medium { background: var(--medium); }
.pin.low { background: var(--low); }
.pin.resolved { background: var(--ok); }

.hazard { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.hazard:first-of-type { border-top: 0; }
.hazard .pin { position: static; transform: none; flex: none; }
.sev { display: inline-block; font-size: 16px; font-weight: 700; padding: 2px 10px; border-radius: 999px; }
.sev.high { background: #fbe9e7; color: var(--high); }
.sev.medium { background: #fdf3dc; color: #9a6a06; }
.sev.low { background: #eef1f1; color: var(--low); }
.check-flag { font-size: 16px; color: var(--warm); font-weight: 700; }

.room-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 10px 16px; border-radius: 999px; background: #fff; border: 1px solid var(--line); font-weight: 600; font-size: 16px; cursor: pointer; }
.room-chip.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.thumbs img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 10px; display: block; }

/* 長輩版 */
.elder { font-size: 22px; line-height: 1.7; }
.elder .line { font-weight: 700; font-size: 24px; margin: 6px 0 12px; }
.elder .card { padding: 20px; }
.agree-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.agreed-tag { display: inline-block; background: var(--brand-2); color: var(--brand); font-weight: 700; padding: 4px 12px; border-radius: 999px; font-size: 16px; }

/* 指數 */
.score { display: flex; align-items: baseline; gap: 8px; }
.score .big { font-size: 64px; font-weight: 800; line-height: 1; color: var(--brand); }
.score .from { font-size: 22px; color: var(--ink-2); }
.bar { height: 12px; border-radius: 999px; background: #ece6db; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--brand); border-radius: 999px; transition: width .8s ease; }
.ba { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ba figure { margin: 0; }
.ba figcaption { font-size: 16px; color: var(--ink-2); text-align: center; margin-top: 4px; }
.ba img { width: 100%; border-radius: 10px; display: block; aspect-ratio: 4/3; object-fit: cover; }

.record { background: linear-gradient(160deg, #2f6f62, #24564c); color: #fff; border-radius: 20px; padding: 22px; }
.record .three { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.record .three div { background: rgba(255,255,255,.12); border-radius: 12px; padding: 10px; text-align: center; }
.record .three b { display: block; font-size: 28px; }
.record .three span { font-size: 16px; opacity: .9; }

.notice { background: var(--warm-2); border-radius: 12px; padding: 12px 14px; font-size: 16px; }
.progress-line { height: 4px; background: var(--line); border-radius: 4px; overflow: hidden; margin: 8px 0; }
.progress-line span { display: block; height: 100%; background: var(--warm); transition: width .3s; }

#toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 16px; opacity: 0; pointer-events: none; transition: opacity .2s; max-width: 90vw; }
#toast.show { opacity: 1; }

.footer-note { margin-top: 28px; font-size: 16px; color: var(--ink-2); }

/* 首頁三步驟 */
.how3 { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.how3 li { display: flex; gap: 12px; align-items: flex-start; }
.how3 .n { flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 18px; background: var(--brand-2); color: var(--brand); }
.how3 b { display: block; font-size: 17px; }
.how3 p { margin: 2px 0 0; font-size: 16px; color: var(--ink-2); }

/* 鍵盤焦點要看得見 */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid var(--warm); outline-offset: 2px; }

/* 尊重減少動態偏好：指數條、Toast 不做漸變 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
