/* Same dusk-gold palette as cat.howtolose.trade; one narrow column. */
: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;
  color-scheme: light;
}
@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; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font-body); font-size: 1rem; line-height: 1.7;
  padding: 24px 16px 48px;
}
[hidden] { display: none !important; }
.wrap { max-width: 34rem; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
h1, h2 { font-family: var(--font-display); margin: 0; line-height: 1.3; text-wrap: balance; }
p { margin: 0; }
.head { display: flex; flex-direction: column; gap: 8px; }
.brand { font-size: .8rem; letter-spacing: .08em; color: var(--muted); }
.title { font-size: clamp(1.6rem, 7vw, 2.1rem); font-weight: 900; }
.title em { font-style: normal; color: var(--gold); }
.lede { color: var(--muted); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; border: 0; margin: 0; padding: 0; min-width: 0; }
.label { font-size: .85rem; color: var(--muted); }
.pair { display: flex; gap: 12px; align-items: center; }
.pair input[type=range] { flex: 1; min-width: 0; accent-color: var(--gold); }
.pair input[type=number] { width: 6rem; }
input[type=number] {
  font: inherit; font-size: 1.1rem; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; width: 100%;
}
input:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.seg { gap: 8px; }
.seg legend { margin-bottom: 6px; padding: 0; }
.seg label { display: flex; gap: 8px; align-items: center; font-size: .95rem; }
.seg input { accent-color: var(--gold); }
.error { color: var(--warn); font-size: .9rem; }

.result { border-color: var(--gold); }
.big { font-family: var(--font-display); font-size: clamp(2rem, 10vw, 2.8rem); font-weight: 900; color: var(--gold); font-variant-numeric: tabular-nums; line-height: 1.1; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stats div { display: flex; flex-direction: column; background: var(--bg); border-radius: 10px; padding: 8px 10px; min-width: 0; }
.stats b { font-size: 1.05rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stats .label { font-size: .75rem; }
.chart { width: 100%; height: auto; }
.chart .bar { fill: var(--gold); }
.chart .bar.last { fill: var(--warn); }
.chart .axis { stroke: var(--line); }
.chart text { fill: var(--muted); font-size: 9px; font-family: var(--font-body); }

.h2 { font-size: 1.1rem; font-family: var(--font-display); font-weight: 700; }
details summary { cursor: pointer; }
.tablewrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; font-variant-numeric: tabular-nums; }
th, td { text-align: right; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th { font-size: .75rem; color: var(--muted); font-weight: 500; }
tr:last-child td { border-bottom: 0; }
tr.hl td { background: var(--gold-soft); font-weight: 700; }
.neg { color: var(--warn); }

.note { display: flex; flex-direction: column; gap: 8px; font-size: .9rem; color: var(--muted); padding: 0 4px; }
.note b { color: var(--ink); }
.foot { display: flex; flex-direction: column; gap: 12px; align-items: center; text-align: center; }
.btn { display: inline-block; background: var(--gold); color: var(--on-gold); text-decoration: none; font-weight: 700; padding: 10px 18px; border-radius: 999px; }
.fine { font-size: .75rem; color: var(--muted); }
@media (max-width: 340px) { .stats { grid-template-columns: 1fr; } }

/* 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); }
