:root { color-scheme: light; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; }
img { max-width: 100%; }
[hidden] { display: none !important; }
/* Layout: one narrow column (max 34rem) like a phone card; dusk-gold palette taken from the cover banner. */
:root {
  --bg: #f7efe2;
  --surface: #fffaf2;
  --ink: #3a2a1c;
  --muted: #7a6450;
  --gold: #b9811f;
  --gold-soft: #f1dcb0;
  --line: #e4d3b8;
  --ok: #2f7a4f;
  --warn: #b0562a;
  --on-gold: #2b1d10;
  --font-display: "Noto Serif TC", "Songti TC", "PMingLiU", serif;
  --font-body: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1c1610; --surface: #271f17; --ink: #f2e6d3; --muted: #b8a58c;
    --gold: #e0ac4a; --gold-soft: #4a3820; --line: #3d3125; --ok: #6fc490; --warn: #ef9a6c; --on-gold: #1c1208;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1c1610; --surface: #271f17; --ink: #f2e6d3; --muted: #b8a58c;
  --gold: #e0ac4a; --gold-soft: #4a3820; --line: #3d3125; --ok: #6fc490; --warn: #ef9a6c; --on-gold: #1c1208;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body {
  background: var(--bg); color: var(--ink);
  font-family: var(--font-body); font-size: 1rem; line-height: 1.7;
  padding-inline: 16px; padding-block: 0 48px;
}
.wrap { max-width: 34rem; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }
.screen { margin: 0; width: 100%; min-width: 0; }
h1, h2, h3 { font-family: var(--font-display); text-wrap: balance; margin: 0; line-height: 1.3; }
p { margin: 0; }
.hero { margin-inline: -16px; position: relative; }
.hero img { display: block; width: 100%; aspect-ratio: 600 / 480; object-fit: cover; }
.signoff { font-size: .8rem; color: var(--muted); text-align: center; }
.brand { font-size: .8rem; letter-spacing: .08em; color: var(--muted); }
.title { font-size: clamp(1.7rem, 7vw, 2.2rem); font-weight: 900; }
.title em { font-style: normal; color: var(--gold); }
.lede { color: var(--muted); }
.meta { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font-size: .8rem; padding: 2px 10px; border-radius: 999px; background: var(--gold-soft); color: var(--ink); }

.tiers { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: .85rem; min-width: 30rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .75rem; letter-spacing: .06em; color: var(--muted); font-weight: 500; }
tr:last-child td { border-bottom: 0; }
td:first-child { font-weight: 700; white-space: nowrap; }
tr.hl td { background: var(--gold-soft); }
.src { font-size: .75rem; color: var(--muted); }

.btn {
  font: inherit; font-weight: 700; cursor: pointer; border: 0; border-radius: 12px;
  padding: 14px 18px; background: var(--gold); color: var(--on-gold); text-align: center; text-decoration: none; display: block; width: 100%;
}
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); font-weight: 500; }
.btn:focus-visible, .opt:focus-visible, .back:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1 1 10rem; }

.progress { display: flex; gap: 6px; padding-top: 24px; }
.progress span { flex: 1; height: 6px; border-radius: 3px; background: var(--line); }
.progress span.on { background: var(--gold); }
.qhead { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.qnum { font-size: .8rem; color: var(--muted); letter-spacing: .06em; font-variant-numeric: tabular-nums; }
.qdim { font-size: .8rem; color: var(--gold); font-weight: 700; }
.qtext { font-size: 1.3rem; font-weight: 700; }
.opts { display: flex; flex-direction: column; gap: 10px; }
.opt {
  font: inherit; text-align: left; cursor: pointer; padding: 14px 16px; border-radius: 12px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); display: flex; gap: 12px; align-items: flex-start;
}
.opt:hover { border-color: var(--gold); }
.opt.picked { border-color: var(--gold); background: var(--gold-soft); }
.opt b { font-family: var(--font-display); color: var(--gold); min-width: 1.2em; }
.back { font: inherit; background: none; border: 0; color: var(--muted); cursor: pointer; padding: 4px 0; align-self: flex-start; }

.result-head { display: flex; gap: 16px; align-items: center; padding-top: 24px; }
.avatar {
  flex: 0 0 104px; height: 104px; border-radius: 50%; border: 3px solid var(--gold);
  background-image: url("cover.jpg"); background-repeat: no-repeat; background-size: 589px auto;
}
.avatar.black { background-position: -426px -74px; }
.avatar.white { background-position: -338px -182px; }
.avatar.etf { background-image: url("cat-etf.jpg"); background-size: cover; background-position: center; }
.avatar.day { background-image: url("cat-day.jpg"); background-size: cover; background-position: center; }
.result-head > div { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.rname { font-size: 1.7rem; font-weight: 900; }
.rtier { color: var(--muted); font-size: .9rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.card h3 { font-size: 1.05rem; }
.checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.checks li { display: grid; grid-template-columns: 1.6em 1fr; gap: 6px; }
.checks li > div { min-width: 0; }
.mark { font-weight: 700; }
.mark.ok { color: var(--ok); }
.mark.no { color: var(--warn); }
.col { font-size: .75rem; color: var(--muted); letter-spacing: .06em; display: block; }
.quote { border-left: 3px solid var(--gold); padding-left: 12px; color: var(--muted); }
.legal { font-size: .78rem; color: var(--muted); line-height: 1.6; border-top: 1px solid var(--line); padding-top: 14px; }
.toast { font-size: .85rem; color: var(--ok); min-height: 1.4em; }
@media (prefers-reduced-motion: no-preference) {
  .screen { animation: rise .25s ease-out; }
  @keyframes rise { from { transform: translateY(6px); } to { transform: none; } }
}
.progress.many { gap: 3px; }
.dims { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.dims li { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.dim-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.dim-name { font-weight: 700; }
.dim-score { font-size: .85rem; font-variant-numeric: tabular-nums; color: var(--muted); }
.meter { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--gold); border-radius: 4px; }
.tag { font-size: .72rem; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.tag.ok { color: var(--ok); border-color: var(--ok); }
.tag.no { color: var(--warn); border-color: var(--warn); }
.dim-note { font-size: .88rem; color: var(--muted); }
.dim-reflect { font-size: .88rem; border-left: 3px solid var(--gold); padding-left: 10px; }
.link { color: var(--gold); text-align: center; display: block; }

/* 0050 定期定額試算頁 */
.fields { display: flex; flex-wrap: wrap; gap: 10px; }
.fields .field { flex: 1 1 8rem; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; color: var(--muted); min-width: 0; }
.field input, .field select {
  font: inherit; font-size: 1.05rem; color: var(--ink); background: var(--surface); width: 100%; min-width: 0;
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-variant-numeric: tabular-nums;
}
.field input:focus-visible, .field select:focus-visible { outline: 3px solid var(--gold); outline-offset: 1px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr)); gap: 12px; }
.stat { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat b { font-size: 1.25rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.note { font-size: .88rem; border-left: 3px solid var(--warn); padding-left: 10px; }
.toast.warn { color: var(--warn); }
.toast.warn:empty { display: none; }
table.slim { min-width: 0; font-variant-numeric: tabular-nums; }
table.slim td:first-child { white-space: nowrap; }
table.slim.nowrap th, table.slim.nowrap td { white-space: nowrap; padding-inline: 8px; }
.chart { display: block; width: 100%; height: auto; }
.chart .bar { fill: var(--gold); }
.chart .bar.latest { fill: var(--warn); }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 9px; font-family: var(--font-body); }
.key { font-weight: 700; color: var(--warn); }

/* Back-to-home bar shown on every tool page. */
.homebar { max-width: 34rem; margin: 0 auto; padding: 10px 0; font-size: .85rem; }
.homebar a { color: var(--muted); text-decoration: none; }
.homebar a:hover, .homebar a:focus-visible { color: var(--gold); }
