/* DuitCalc — "sticker" style: paper background, ink outlines, hard offset shadows, flat colour blocks.
   Every font is self-hosted in /fonts (no third-party requests). Light is the default; dark is opt-in via the header toggle. */
@font-face {
  font-family: "Baloo 2";
  font-style: normal;
  font-weight: 500 800;
  font-display: swap;
  src: url(/fonts/baloo2-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "ZCOOL KuaiLe";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/fonts/zcool-kuaile-zh.woff2) format("woff2");
  unicode-range: U+2014, U+2018-201D, U+2026, U+3000-303F, U+3400-9FFF, U+FF00-FFEF;
}
@font-face {
  font-family: "Fredoka";
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url(/fonts/fredoka-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url(/fonts/jetbrains-mono-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Mali";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/fonts/mali-400-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Mali";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(/fonts/mali-700-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light;
  --bg: #fff4dd;            /* paper */
  --surface: #fffdf7;       /* card */
  --surface-alt: #f6e9cb;
  --text: #26201a;          /* ink: text and outlines */
  --muted: #5c5347;
  --border: var(--text);
  --hair: #26201a33;
  --accent: #ff5c2b;
  --accent-ink: #b8340c;    /* accent used as text */
  --on-accent: #26201a;
  --sun: #ffd84d;   --on-sun: #26201a;
  --rose: #ffb9cc;  --on-rose: #26201a;
  --sky: #a5dcff;   --on-sky: #26201a;
  --mint: #b9e6a6;  --on-mint: #26201a;
  --peach: #ffb07a; --on-peach: #26201a;
  --watch-paper: #fff0bd;
  --dot-ink: #26201a1a;
  --blue: #1d6fd1;          /* focus ring */
  --danger: #c0182f;
  --danger-soft: #ffd9de;
  --input-bg: #fff8ea;
  --track: #f1e3c4;
  --c-green: #52b46b;
  --c-blue: #4aa0d5;
  --c-amber: #f2a516;
  --c-slate: #b3a58f;
  --c-red: #ec5a4a;
  --gain-ink: #0f7645;
  --gain-bg: #d9f5df;
  --loss-ink: #b91c1c;
  --loss-bg: #ffe1e5;
  --shadow-ink: #26201a;
  --shadow: 4px 4px 0 var(--shadow-ink);
  --shadow-sm: 3px 3px 0 var(--shadow-ink);
  --radius: 14px;
  --display: "Fredoka", "ZCOOL KuaiLe", "Baloo 2", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --sans: "Mali", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", monospace;
}

/* Light is the default for everyone. Dark is opt-in only (header toggle sets data-theme="dark"); the OS setting is ignored. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: oklch(18% .012 70);
  --surface: oklch(24% .014 70);
  --surface-alt: oklch(30% .018 72);
  --text: oklch(93% .025 80);
  --muted: oklch(76% .025 75);
  --hair: #f6e8cf33;
  --accent: oklch(67% .2 38);
  --accent-ink: oklch(78% .15 45);
  --on-accent: oklch(20% .03 38);
  --sun: oklch(75% .135 82);   --on-sun: oklch(22% .04 82);
  --rose: oklch(70% .12 355);  --on-rose: oklch(20% .03 350);
  --sky: oklch(71% .095 232);  --on-sky: oklch(20% .03 235);
  --mint: oklch(72% .11 145);  --on-mint: oklch(20% .04 145);
  --peach: oklch(78% .12 48);  --on-peach: oklch(20% .03 48);
  --watch-paper: oklch(30% .055 72);
  --dot-ink: #f6e8cf14;
  --blue: oklch(75% .12 240);
  --danger: oklch(74% .16 25);
  --danger-soft: oklch(32% .08 25);
  --input-bg: oklch(18% .012 70);
  --track: oklch(35% .022 75);
  --c-green: oklch(72% .11 145);
  --c-blue: oklch(71% .095 232);
  --c-amber: oklch(75% .135 82);
  --c-slate: oklch(72% .03 75);
  --c-red: oklch(67% .2 38);
  --gain-ink: #7ee2a8;
  --gain-bg: oklch(29% .07 148);
  --loss-ink: #ff8e99;
  --loss-bg: oklch(30% .08 22);
  --shadow-ink: oklch(8% .005 70);
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 100%; -webkit-font-smoothing: antialiased; scroll-behavior: smooth; scroll-padding-bottom: 84px; }
body { margin: 0; font-family: var(--sans); background: var(--bg); color: var(--text); line-height: 1.55; }
a { color: var(--text); text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--text); }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }

.skip-link { position: absolute; left: 8px; top: -60px; z-index: 100; background: var(--text); color: var(--bg); padding: 8px 14px; border-radius: 10px; font-weight: 700; }
.skip-link:focus { top: 8px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.container { max-width: 860px; margin: 0 auto; padding: 0 16px; }

/* HEADER: logo left, theme + language right (no tab strip) */
.header { padding: 14px 0 2px; }
.header-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.logo { display: inline-flex; align-items: center; line-height: 0; text-decoration: none; }
.logo-svg { display: block; height: 36px; width: auto; }
.lg-tile { fill: var(--accent); stroke: var(--text); stroke-width: 2.5; filter: drop-shadow(2px 2px 0 var(--shadow-ink)); }
.lg-glyph { stroke: var(--on-accent); }
.lg-ink { stroke: var(--text); }
.lg-accent { stroke: var(--accent); }
.lg-coin { fill: var(--sun); stroke: var(--text); stroke-width: 2; }

.header-actions { display: inline-flex; align-items: center; gap: 10px; margin-inline-start: auto; }
.theme-btn {
  width: 40px; height: 40px; padding: 0; border: 2px solid var(--border); border-radius: 50%; background: var(--surface); color: var(--text);
  font: inherit; font-size: 1.05rem; line-height: 1; cursor: pointer; box-shadow: 2px 2px 0 var(--shadow-ink);
}
.lang-switch { display: inline-flex; border: 2px solid var(--border); border-radius: 999px; overflow: hidden; background: var(--surface); box-shadow: 2px 2px 0 var(--shadow-ink); }
.lang-btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 36px; padding: 4px 13px; white-space: nowrap;
  font-family: var(--mono); font-size: 0.8125rem; font-weight: 700; color: var(--text); text-decoration: none; background: transparent;
}
.lang-btn + .lang-btn { border-inline-start: 2px solid var(--border); }
.lang-btn:hover { background: var(--watch-paper); }
.lang-btn[aria-current="true"], .lang-btn.active { background: var(--sun); color: var(--on-sun); }
.theme-btn:hover, .lang-switch:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--shadow-ink); }

/* MAIN */
main { padding: 18px 0 56px; }
h1 { margin: 0 0 8px; font-family: var(--display); font-weight: 800; font-size: clamp(1.8rem, 5.2vw, 2.6rem); line-height: 1.1; letter-spacing: -0.01em; }
.lead { margin: 0 0 18px; color: var(--muted); font-size: 1rem; max-width: 60ch; }
.breadcrumb { font-family: var(--mono); font-size: 0.8125rem; color: var(--muted); margin: 0 0 12px; }
.breadcrumb a { display: inline-block; padding: 6px 2px; margin: -6px 0; }
.breadcrumb a { color: var(--muted); }
.trust-strip { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 22px; }
.trust-pill { font-family: var(--mono); font-size: 0.8125rem; font-weight: 700; color: var(--on-mint); background: var(--mint); border: 2px solid var(--border); padding: 4px 12px; border-radius: 999px; box-shadow: 2px 2px 0 var(--shadow-ink); }
.trust-pill:nth-child(2) { background: var(--sky); color: var(--on-sky); }
.trust-pill:nth-child(3) { background: var(--rose); color: var(--on-rose); }
.meta-line { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0 0 16px; font-family: var(--mono); font-size: 0.8125rem; color: var(--muted); }

/* LANGUAGE SUGGESTION BANNER (never redirects) */
.lang-suggest { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 12px 0 0; padding: 10px 14px; border: 2px solid var(--border); border-radius: 12px; background: var(--sky); color: var(--on-sky); font-size: 0.875rem; font-weight: 600; }
.lang-suggest[hidden] { display: none; }
.lang-suggest a { color: var(--on-sky); }
.lang-suggest button { font: inherit; font-size: 0.8125rem; border: 0; background: transparent; color: var(--on-sky); text-decoration: underline; cursor: pointer; min-height: 36px; }

/* TOOL CARDS (home + related): flat colour blocks with ink outline and hard shadow */
.tool-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.tool-card {
  --tile: var(--sun); --on-tile: var(--on-sun);
  display: flex; flex-direction: column; gap: 6px; padding: 16px; color: var(--on-tile); background: var(--tile); text-decoration: none;
  border: 2px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); transition: transform 120ms ease-out, box-shadow 120ms ease-out;
}
.tool-card:nth-child(5n+2) { --tile: var(--rose); --on-tile: var(--on-rose); }
.tool-card:nth-child(5n+3) { --tile: var(--sky); --on-tile: var(--on-sky); }
.tool-card:nth-child(5n+4) { --tile: var(--mint); --on-tile: var(--on-mint); }
.tool-card:nth-child(5n) { --tile: var(--peach); --on-tile: var(--on-peach); }
.tool-card:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--shadow-ink); }
.tool-card:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--shadow-ink); }
.tool-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tool-tag { align-self: flex-start; font-family: var(--mono); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text); background: var(--surface); border: 2px solid var(--border); padding: 1px 8px; border-radius: 999px; }
.tool-icon { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 12px; background: var(--surface); color: var(--text); border: 2px solid var(--border); flex-shrink: 0; }
.tool-icon .icon { width: 22px; height: 22px; }
.tool-card h2, .tool-card h3 { margin: 4px 0 0; font-family: var(--display); font-weight: 700; font-size: 1.2rem; line-height: 1.2; }
.tool-card p { margin: 0; font-size: 0.85rem; opacity: 0.85; }
.section-title { margin: 30px 0 14px; font-family: var(--display); font-weight: 800; font-size: 1.5rem; line-height: 1.15; }

/* CALCULATOR CARD */
.calc-card { background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 18px; }
.input-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.field > span, .field-head > label, .field label.lbl { font-size: 0.9375rem; font-weight: 700; color: var(--text); }
.field input[type="number"], .field select {
  width: 100%; height: 46px; padding: 8px 12px; border: 2px solid var(--border); border-radius: 10px;
  font: inherit; font-size: 1rem; color: var(--text); background: var(--input-bg); font-variant-numeric: tabular-nums;
}
.field input[type="number"]:focus, .field select:focus { outline: 3px solid var(--blue); outline-offset: 2px; }
.field input[aria-invalid="true"] { border-color: var(--danger); background: var(--danger-soft); }
.field select { text-overflow: ellipsis; }
.hint { font-size: 0.875rem; color: var(--muted); margin: 0; }
.hint .badge { margin-inline-end: 6px; }
.hint a, .field a { padding: 2px 0; }
.field-error { font-size: 0.875rem; font-weight: 700; color: var(--danger); margin: 0; }
.group-title { align-self: flex-start; margin: 6px 0 -4px; padding: 2px 12px; font-family: var(--display); font-weight: 700; font-size: 0.98rem; line-height: 1.35; color: var(--on-sun); background: var(--sun); border: 2px solid var(--border); border-radius: 8px; }
.relief-group { gap: 10px; }

/* CHECKBOX PICKER */
.checks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.check { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 2px solid var(--border); border-radius: 10px; background: var(--input-bg); font-size: 0.875rem; cursor: pointer; }
.check input { width: 20px; height: 20px; margin-top: 1px; accent-color: var(--accent); flex-shrink: 0; }
.check small { display: block; color: var(--muted); font-size: 0.75rem; }

/* RANGE SLIDER + PRESET CHIPS */
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 16px; margin: 12px 0; border: 2px solid var(--border); border-radius: 999px; background: var(--track); cursor: pointer; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 32px; height: 32px; border-radius: 50%; background: var(--accent); border: 2px solid var(--border); box-shadow: 2px 2px 0 var(--shadow-ink); }
input[type="range"]::-moz-range-thumb { width: 28px; height: 28px; border-radius: 50%; background: var(--accent); border: 2px solid var(--border); box-shadow: 2px 2px 0 var(--shadow-ink); }
input[type="range"]::-moz-range-track { background: transparent; }
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { min-height: 40px; border: 2px solid var(--border); background: var(--surface); color: var(--text); border-radius: 999px; padding: 4px 14px; font-family: var(--mono); font-size: 0.8125rem; font-weight: 700; cursor: pointer; box-shadow: 2px 2px 0 var(--shadow-ink); transition: transform 100ms ease-out, box-shadow 100ms ease-out; }
.chip:hover { background: var(--watch-paper); transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--shadow-ink); }
.chip:active { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--shadow-ink); }
.chip[aria-pressed="true"] { background: var(--sun); color: var(--on-sun); }

/* ANSWER PANEL: dotted paper with a "sticker" number */
.visual-answer {
  margin-top: 22px; padding: 18px; border: 2px solid var(--border); border-radius: var(--radius);
  background-color: var(--watch-paper); background-image: radial-gradient(var(--dot-ink) 1px, transparent 1px); background-size: 14px 14px;
  display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center;
}
.answer-label { display: block; font-family: var(--mono); font-size: 0.875rem; font-weight: 700; color: var(--muted); }
.answer-big {
  display: inline-block; max-width: 100%; margin: 8px 0 6px; padding: 0 0.3em 0.06em; border-radius: 10px; transform: rotate(-1deg);
  font-family: var(--display); font-weight: 800; font-size: clamp(1.9rem, 6vw, 2.7rem); line-height: 1.2; color: var(--on-sun); background: var(--sun);
  font-variant-numeric: tabular-nums; overflow-wrap: anywhere;
}
.answer-sub { margin: 6px 0 0; font-size: 1rem; color: var(--text); }
.donut-svg { width: 126px; height: 126px; flex-shrink: 0; }
.gauge-svg { width: 156px; height: 94px; flex-shrink: 0; }
.svg-track { fill: none; stroke: var(--track); }
.svg-center-top { fill: var(--text); font-family: var(--display); font-weight: 800; }
.svg-center-bottom { fill: var(--muted); font-family: var(--sans); }
.chart-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 10px 0 0; padding: 0; list-style: none; font-family: var(--mono); font-size: 0.8125rem; color: var(--text); }
.chart-legend i { display: inline-block; width: 12px; height: 12px; border: 2px solid var(--border); border-radius: 4px; margin-inline-end: 6px; vertical-align: -1px; }

/* BUTTONS */
.action-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.btn-wa, .btn-secondary, .aff-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 18px; border-radius: 999px;
  border: 2px solid var(--border); background: var(--accent); color: var(--on-accent); font: inherit; font-size: 0.9rem; font-weight: 800;
  text-decoration: none; cursor: pointer; box-shadow: var(--shadow-sm); transition: transform 100ms ease-out, box-shadow 100ms ease-out;
}
.btn-secondary, .aff-btn { background: var(--surface); color: var(--text); }
.btn-wa:hover, .btn-secondary:hover, .aff-btn:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--shadow-ink); }
.btn-wa:active, .btn-secondary:active, .aff-btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--shadow-ink); }
.action-row + .hint { margin-top: 8px; }

/* CALLOUTS */
.insight-box { margin-top: 16px; padding: 14px 16px; border: 2px solid var(--border); border-radius: 12px; background: var(--watch-paper); color: var(--text); font-size: 0.875rem; }
.insight-box:empty { display: none; }
.insight-box strong { display: block; font-family: var(--display); font-weight: 700; font-size: 1rem; margin-bottom: 2px; }
.warn-box { margin-top: 12px; padding: 12px 14px; border: 2px solid var(--border); border-radius: 12px; background: var(--danger-soft); color: var(--text); font-size: 0.875rem; font-weight: 600; }
.warn-box:empty { display: none; }

/* COMPARISON BARS */
.comp-bars { display: flex; flex-direction: column; gap: 12px; margin-top: 18px; }
.comp-row { display: flex; flex-direction: column; gap: 4px; }
.comp-meta { display: flex; justify-content: space-between; gap: 8px; font-size: 0.875rem; font-weight: 700; }
.comp-track { height: 28px; background: var(--track); border: 2px solid var(--border); border-radius: 9px; overflow: hidden; display: flex; }
.comp-fill { height: 100%; display: flex; align-items: center; padding: 0 8px; color: #26201a; border-inline-end: 2px solid var(--border); font-family: var(--mono); font-size: 0.8125rem; font-weight: 700; white-space: nowrap; }
.fill-green { background: var(--c-green); }
.fill-blue { background: var(--c-blue); }
.fill-amber { background: var(--c-amber); }
.fill-slate { background: var(--c-slate); }

/* BREAKDOWN LIST */
.rows { border-top: 2px solid var(--border); margin-top: 18px; }
.row { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 0; border-bottom: 2px dashed var(--hair); gap: 12px; font-size: 0.9375rem; }
.row:last-child { border-bottom: none; }
.row .val { font-family: var(--mono); font-weight: 700; font-variant-numeric: tabular-nums; text-align: end; }
.row.strong { font-weight: 800; }

.badge { display: inline-block; padding: 1px 10px; border: 2px solid var(--border); border-radius: 999px; font-family: var(--mono); font-size: 0.8125rem; font-weight: 700; color: var(--text); background: var(--surface); }
.badge[hidden] { display: none; }
.badge-safe { background: var(--mint); color: var(--on-mint); }
.badge-warn { background: var(--sun); color: var(--on-sun); }
.badge-danger { background: var(--rose); color: var(--on-rose); }

/* PARTNER CARD (only rendered when enabled with a real URL) */
.aff-card { margin-top: 18px; padding: 16px 18px; border: 2px dashed var(--border); border-radius: var(--radius); background: var(--watch-paper); display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; }
.aff-tag { display: inline-block; font-family: var(--mono); font-size: 0.66rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text); background: var(--surface); border: 2px solid var(--border); padding: 0 8px; border-radius: 999px; margin-bottom: 4px; }
.aff-card strong { display: block; font-family: var(--display); font-size: 1.05rem; }
.aff-card p { margin: 2px 0 0; font-size: 0.8125rem; color: var(--muted); }
.aff-disclosure { margin: 6px 2px 0; font-size: 0.75rem; color: var(--muted); }

/* ARTICLE / FAQ / SOURCES */
.seo-card, .article { background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px 20px; margin-top: 24px; }
.article h2, .seo-card h2 { margin: 28px 0 8px; font-family: var(--display); font-weight: 800; font-size: 1.4rem; line-height: 1.2; }
.article h2:first-child, .seo-card h2:first-child { margin-top: 0; }
.article h3, .seo-card h3 { margin: 18px 0 4px; font-family: var(--display); font-weight: 700; font-size: 1.05rem; }
.article p, .seo-card p { margin: 0 0 10px; font-size: 0.9688rem; color: var(--muted); }
.article ul, .article ol { margin: 0 0 12px; padding-inline-start: 22px; font-size: 0.9688rem; color: var(--muted); }
.article li { margin-bottom: 4px; }
.article strong { color: var(--text); }
.article a { color: var(--text); }
.table-wrap { overflow-x: auto; margin: 0 0 14px; border: 2px solid var(--border); border-radius: 10px; background: var(--surface); }
.article table, .calc-card table { border-collapse: collapse; width: 100%; font-size: 0.875rem; }
.article th, .article td, .calc-card th, .calc-card td { padding: 8px 10px; border-bottom: 1px solid var(--hair); text-align: start; color: var(--text); }
.article th, .calc-card th { background: var(--sun); color: var(--on-sun); font-weight: 800; border-bottom: 2px solid var(--border); }
.article tr:last-child td, .calc-card tr:last-child td, .calc-card tr:last-child th { border-bottom: none; }
.article td.num, .article th.num, .calc-card td.num, .calc-card th.num { text-align: end; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.calc-card .table-wrap { margin: 16px 0 0; }
.calc-card caption { text-align: start; font-weight: 800; padding: 10px 10px 8px; color: var(--text); background: var(--surface); }
.callout { margin: 0 0 14px; padding: 12px 14px; border: 2px solid var(--border); border-inline-start-width: 8px; border-inline-start-color: var(--accent); border-radius: 10px; background: var(--watch-paper); font-size: 0.875rem; color: var(--text); }
.faq-item { margin: 0 0 12px; padding: 12px 14px; border: 2px solid var(--border); border-radius: var(--radius); background: var(--bg); }
.faq-item:last-child { margin-bottom: 0; }
.article .faq-item h3 { margin: 0 0 4px; font-size: 1.02rem; }
.article .faq-item p { margin: 0; }
.sources li { word-break: break-word; }

/* FOOTER */
.footer { border-top: 2px solid var(--border); padding: 22px 0 40px; font-size: 0.875rem; color: var(--muted); }
.footer-calcs { display: flex; flex-wrap: wrap; gap: 0 16px; margin: 0 0 12px; padding: 0; list-style: none; font-weight: 600; }
.footer-calcs a, .footer-links a { display: inline-block; padding: 8px 0; }
.footer-calcs a, .footer a { color: var(--text); }
.footer-inner { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.footer-links { display: flex; gap: 0 18px; flex-wrap: wrap; }

/* ILLUSTRATIONS (original artwork, inlined so it follows the theme) */
.page-head { display: grid; grid-template-columns: minmax(0, 1fr) 230px; gap: 8px 22px; align-items: center; margin-bottom: 6px; }
.page-head-text { min-width: 0; }
.hero-art { margin: 0; border: 2px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; background: var(--mint); }
.hero-art svg, .hero-art img { display: block; width: 100%; height: auto; }
.hero-art img { aspect-ratio: 16 / 9; object-fit: cover; }

/* Home Hero Visual Banner & Illustrated Cards */
.home-hero {
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 22px; align-items: center;
  padding: 22px; margin-bottom: 18px; border: 2px solid var(--border); border-radius: 20px;
  background-color: var(--surface); background-image: radial-gradient(var(--dot-ink) 1px, transparent 1px); background-size: 16px 16px;
  box-shadow: var(--shadow);
}
.home-hero .trust-strip { margin: 14px 0 0; }
.home-hero .lead { margin-bottom: 0; }
.home-hero-art {
  margin: 0; border: 2px solid var(--border); border-radius: 16px; overflow: hidden;
  box-shadow: var(--shadow-sm); background: var(--bg);
}
.home-hero-art img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; }

/* Illustrated Tool Cards */
.tool-card { padding: 0; overflow: hidden; gap: 0; }
.tool-card[hidden] { display: none; }
.tool-thumb { border-bottom: 2px solid var(--border); background: var(--bg); overflow: hidden; }
.tool-thumb img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; transition: transform 220ms ease-out; }
.tool-card:hover .tool-thumb img { transform: scale(1.04); }
.tool-card-body { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px 16px; }

/* Home Category Filter Pills */
.cat-filter { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.cat-btn {
  min-height: 36px; padding: 4px 14px; border: 2px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--text); font-family: var(--display); font-size: 0.88rem; font-weight: 700;
  cursor: pointer; box-shadow: 2px 2px 0 var(--shadow-ink); transition: transform 100ms ease-out, box-shadow 100ms ease-out;
}
.cat-btn:hover { background: var(--watch-paper); transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--shadow-ink); }
.cat-btn[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }

/* Punchier KPI Stat Grid for Calculator Breakdown (.rows) */
.rows {
  border-top: 0; margin-top: 18px;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px;
}
.row {
  display: flex; flex-direction: column; align-items: stretch; justify-content: space-between;
  padding: 11px 14px; border: 2px solid var(--border); border-radius: 12px;
  background: var(--bg); gap: 6px; box-shadow: 2px 2px 0 var(--shadow-ink);
}
.row:last-child { border-bottom: 2px solid var(--border); }
.row > span:first-child { font-size: 0.82rem; font-weight: 600; color: var(--muted); }
.row .val { font-size: 1.08rem; text-align: start; padding-inline-start: 30px; }
.row.strong {
  grid-column: 1 / -1; flex-direction: row; align-items: center; justify-content: space-between;
  background: var(--gain-bg); border-color: var(--gain-ink); padding: 13px 16px;
}
.row.strong > span:first-child { font-size: 0.94rem; font-weight: 800; color: var(--text); }
.row.strong .val { font-size: 1.24rem; text-align: end; padding-inline-start: 0; }

/* Subtle pop animation on KPI update */
@keyframes kpiPop {
  0% { transform: rotate(-1deg) scale(0.96); }
  55% { transform: rotate(-1deg) scale(1.03); }
  100% { transform: rotate(-1deg) scale(1); }
}
.answer-big.is-pop { animation: kpiPop 240ms ease-out; }
.row { transition: transform 130ms ease-out, box-shadow 130ms ease-out; }
.row:hover { transform: translate(-1px, -2px); box-shadow: 3px 4px 0 var(--shadow-ink); }
.comp-fill { transition: width 320ms cubic-bezier(.22, 1, .36, 1); }

/* Tactile micro-confetti sparkles on preset/max/copy clicks */
.spark-dot {
  position: fixed; left: 0; top: 0; width: 9px; height: 9px; border-radius: 50%;
  border: 1.5px solid var(--border); pointer-events: none; z-index: 9999;
  animation: sparkFly 480ms cubic-bezier(.16, 1, .3, 1) forwards;
}
@keyframes sparkFly {
  0% { opacity: 1; transform: translate(var(--x0), var(--y0)) scale(0.6); }
  100% { opacity: 0; transform: translate(calc(var(--x0) + var(--dx)), calc(var(--y0) + var(--dy))) scale(1.15); }
}

@media (max-width: 720px) {
  .home-hero { grid-template-columns: minmax(0, 1fr); padding: 16px; gap: 14px; }
  .rows { grid-template-columns: minmax(0, 1fr); }
  .row { flex-direction: row; align-items: center; }
  .row .val { padding-inline-start: 0; text-align: end; font-size: 0.98rem; }
}
.art .a { fill: var(--accent); }
.art .b { fill: var(--c-blue); }
.art .c { fill: var(--sun); }
.art .k { fill: #26201a; }
.art .s { fill: var(--surface); }
.art .w { fill: #fffdf7; }
.art .g { fill: var(--sky); }
.art .r { fill: var(--c-red); }
.art .m { fill: var(--track); }
.art .bg { fill: var(--mint); }
.art .a, .art .b, .art .c, .art .s, .art .w, .art .g, .art .r { stroke: #26201a; stroke-width: 2.5; stroke-linejoin: round; }
.art .ln { fill: none; stroke: #26201a; stroke-width: 2.5; stroke-linecap: round; }
.art text { font-family: var(--display); font-weight: 800; fill: #26201a; }

@media (max-width: 640px) {
  .tool-grid, .input-grid, .checks { grid-template-columns: minmax(0, 1fr); }
  .visual-answer { grid-template-columns: minmax(0, 1fr); text-align: start; }
  .donut-svg, .gauge-svg { margin: 0 auto; }
  .calc-card, .article, .seo-card { padding: 16px; }
  .btn-wa, .btn-secondary, .aff-btn { width: 100%; }
  .chip { min-height: 40px; padding: 6px 14px; font-size: 0.8125rem; }
  .page-head { grid-template-columns: minmax(0, 1fr) 104px; align-items: start; gap: 6px 12px; }
  .hero-art { margin-top: 4px; box-shadow: var(--shadow-sm); }
  .calc-card th, .calc-card td { padding: 7px 6px; font-size: 0.875rem; }
  .calc-card th[scope="row"] { white-space: nowrap; }
  .tool-card h2, .tool-card h3 { font-size: 1.15rem; }
}

@media (max-width: 359px) {
  .hero-art { display: none; }
  .page-head { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 420px) {
  .calc-card .col-real { display: none; } /* the same figure is in the result rows above the table */
  .lang-btn { padding: 4px 10px; }
  .logo-svg { height: 30px; }
  .header-actions { gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .answer-big { transform: none; }
}

/* polish */
.article tbody th, .calc-card tbody th { background: transparent; color: var(--text); border-bottom: 1px solid var(--hair); }
.tool-tag { border-radius: 10px; line-height: 1.35; }
/* Chinese tags use the same playful display font as the titles (Latin letters still come from Fredoka) */
:lang(zh) .tool-tag, :lang(zh) .badge, :lang(zh) .trust-pill { font-family: var(--display); letter-spacing: 0.02em; text-transform: none; }

/* review fixes: plain section headings, readable small text, tidier phone header, related block under the calculator */
.group-title { align-self: stretch; margin: 10px 0 0; padding: 0 0 4px; background: transparent; color: var(--text); border: 0; border-bottom: 2px solid var(--border); border-radius: 0; font-size: 1.05rem; }
.all-link { margin: 12px 0 0; font-family: var(--mono); font-size: 0.875rem; font-weight: 700; }
.all-link a { display: inline-block; padding: 8px 0; }
.aff-tag { font-size: 0.8125rem; }
.tool-tag { font-size: 0.8125rem; }
.sources small { font-size: 0.8125rem; }
.calc-card > .hint:first-child, .calc-card > p.hint { margin-bottom: 10px; }
.donut-svg { width: 140px; height: 140px; }
.comp-meta { flex-wrap: wrap; }
.tool-card, .field, .row > span:first-child, .comp-meta > span, .hint, .answer-label { min-width: 0; overflow-wrap: anywhere; }
@media (min-width: 360px) { .comp-meta span:last-child, .row .val { white-space: nowrap; } }
/* PAGE SECTION TABS (Calculator / Explanation & FAQ / References) */
.page-tabs {
  display: inline-flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 18px;
}
.page-tab {
  min-height: 40px; padding: 6px 16px; border: 2px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--text); font-family: var(--display); font-size: 0.94rem; font-weight: 700;
  cursor: pointer; box-shadow: 2px 2px 0 var(--shadow-ink); transition: transform 100ms ease-out, box-shadow 100ms ease-out, background-color 100ms ease-out;
}
.page-tab:hover { background: var(--watch-paper); transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--shadow-ink); }
.page-tab:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--shadow-ink); }
.page-tab[aria-selected="true"] { background: var(--sun); color: var(--on-sun); box-shadow: var(--shadow-sm); }
.tab-panel[hidden] { display: none; }
.tab-link-row { margin: 14px 0 0; }
.tab-link { min-height: 40px; padding: 8px 0; border: 0; background: none; color: var(--accent-ink); font: inherit; font-weight: 700; text-align: start; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.tab-link:hover { text-decoration-thickness: 3px; }
#sampleBadge { font-size: 0.9375rem; padding: 3px 10px; }
.tab-panel > .article:first-child { margin-top: 0; }

/* Improved reading rhythm for guide & FAQ */
body { line-height: 1.62; }
:lang(zh) h1, :lang(zh) .tool-card h2, :lang(zh) .section-title, :lang(zh) .article h2, :lang(zh) .page-tab, :lang(zh) .insight-box strong {
  font-synthesis-weight: none;
  letter-spacing: 0.02em;
}
.article p, .seo-card p, .article ul, .article ol { font-size: 0.95rem; line-height: 1.72; color: var(--text); }
.article p, .article li { max-width: 68ch; }
.article h2 { padding-bottom: 6px; border-bottom: 2px dashed var(--hair); }

/* Semantic money highlights, formula card & scannable subpoints */
.hl-money, .hl-gain, .hl-loss, .hl-rate {
  display: inline-block; padding: 0 6px; border-radius: 6px; font-family: var(--mono); font-size: 0.88em; font-weight: 700; line-height: 1.45; white-space: nowrap;
}
.hl-money { background: var(--watch-paper); color: var(--text); border-bottom: 2px solid var(--sun); }
.hl-gain { background: var(--gain-bg); color: var(--gain-ink); }
.hl-loss { background: var(--loss-bg); color: var(--loss-ink); }
.hl-rate { background: var(--sky); color: var(--on-sky); }
.val-gain { color: var(--gain-ink) !important; }
.val-loss { color: var(--loss-ink) !important; }
.formula-box {
  margin: 10px 0 16px; padding: 12px 16px; border: 2px dashed var(--border); border-radius: 12px;
  background: var(--watch-paper); font-family: var(--mono); font-size: 0.9rem; font-weight: 700; color: var(--text); line-height: 1.6;
}
/* Beginner-friendly Visual Formula Card: fraction bar, color-coded symbols, legend & plain-words takeaway */
.formula-card {
  margin: 14px 0 18px; padding: 16px 18px; border: 2px solid var(--border); border-radius: 16px;
  background-color: var(--watch-paper);
  background-image: radial-gradient(var(--dot-ink) 1px, transparent 1px); background-size: 14px 14px;
  box-shadow: var(--shadow-sm); color: var(--text);
}
.formula-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px;
}
.formula-badge {
  display: inline-flex; align-items: center; padding: 2px 10px; border: 2px solid var(--border); border-radius: 999px;
  background: var(--accent); color: var(--on-accent); font-family: var(--mono); font-size: 0.72rem; font-weight: 800; letter-spacing: 0.04em;
}
.formula-title {
  font-family: var(--display); font-size: 1.05rem; font-weight: 700; color: var(--text);
}
.formula-eq {
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px 8px;
  padding: 14px 16px; border: 2px solid var(--border); border-radius: 12px; background: var(--surface);
  font-family: var(--mono); font-size: 1rem; font-weight: 700; color: var(--text); line-height: 1.4;
}
.formula-steps { display: flex; flex-direction: column; gap: 10px; }
.formula-step {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px;
  border: 2px solid var(--border); border-radius: 12px; background: var(--surface);
}
.f-step-num {
  display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; margin-top: 2px;
  border: 2px solid var(--border); border-radius: 50%; background: var(--sun); color: var(--on-sun);
  font-family: var(--mono); font-size: 0.8rem; font-weight: 800; flex-shrink: 0;
}
.f-step-body { flex: 1 1 auto; min-width: 0; }
.f-step-lbl { display: block; font-size: 0.8rem; font-weight: 700; color: var(--muted); margin-bottom: 4px; }
.formula-step .formula-eq { justify-content: flex-start; padding: 4px 0 0; border: 0; border-radius: 0; background: transparent; }
.f-var {
  display: inline-flex; align-items: center; justify-content: center; min-width: 26px; padding: 2px 9px;
  border: 1.5px solid var(--border); border-radius: 8px; font-family: var(--mono); font-size: 0.92em; font-weight: 800;
  line-height: 1.3; white-space: nowrap;
}
.f-res { background: var(--sun); color: var(--on-sun); }
.f-a { background: var(--sky); color: var(--on-sky); }
.f-b { background: var(--rose); color: var(--on-rose); }
.f-c { background: var(--mint); color: var(--on-mint); }
.f-d { background: var(--bg); color: var(--text); }
.f-op { font-family: var(--mono); font-weight: 800; font-size: 1.05em; color: var(--text); }
.f-frac {
  display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; margin: 0 2px;
}
.f-num {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px; padding: 0 8px 4px;
  border-bottom: 2px solid var(--border); text-align: center;
}
.f-den {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px; padding: 4px 8px 0; text-align: center;
}
.f-den sup, .f-num sup, .formula-eq sup { font-size: 0.78em; vertical-align: super; line-height: 0; }
.formula-legend {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; margin-top: 12px;
}
.f-item {
  display: flex; align-items: flex-start; gap: 8px; padding: 8px 10px;
  border: 1.5px solid var(--hair); border-radius: 10px; background: var(--surface); font-size: 0.85rem; line-height: 1.45;
}
.f-item .f-var { flex-shrink: 0; font-size: 0.8rem; min-width: 24px; padding: 1px 7px; margin-top: 1px; }
.f-desc { min-width: 0; color: var(--muted); overflow-wrap: break-word; }
.f-desc strong { color: var(--text); }
.article .formula-plain {
  margin: 12px 0 0; padding: 10px 14px; border: 1.5px dashed var(--border); border-radius: 10px;
  background: var(--bg); color: var(--text); font-size: 0.88rem; line-height: 1.55;
}
@media (max-width: 640px) {
  .formula-card { padding: 12px; }
  .formula-eq { font-size: 0.88rem; padding: 10px; }
  .formula-legend { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 359px) {
  .f-var { white-space: normal; text-align: center; }
  .f-num, .f-den { flex-wrap: wrap; }
}

/* Interactive `?` row tooltips & formula-symbol floating popover */
.tip-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; margin-inline-start: 6px; padding: 0;
  border: 1.5px solid var(--border); border-radius: 50%;
  background: var(--watch-paper); color: var(--muted);
  font-family: var(--mono); font-size: 0.72rem; font-weight: 800; line-height: 1;
  cursor: pointer; flex-shrink: 0; vertical-align: middle;
  transition: background-color 110ms ease-out, color 110ms ease-out, transform 110ms ease-out;
}
.tip-btn:hover, .tip-btn:focus-visible, .tip-btn.is-open {
  background: var(--accent); color: var(--on-accent); border-color: var(--border); transform: scale(1.08);
}
.formula-eq .f-var.has-tip {
  cursor: help; text-decoration: underline dotted var(--border); text-underline-offset: 3px;
  transition: transform 110ms ease-out, box-shadow 110ms ease-out;
}
.formula-eq .f-var.has-tip:hover, .formula-eq .f-var.has-tip:focus-visible, .formula-eq .f-var.has-tip.is-open {
  transform: translateY(-1px); box-shadow: 2px 2px 0 var(--shadow-ink);
}
.tip-popover {
  position: fixed; z-index: 900; max-width: min(300px, calc(100vw - 24px));
  padding: 10px 13px; border: 2px solid var(--border); border-radius: 12px;
  background: var(--text); color: var(--surface);
  font-family: var(--sans); font-size: 0.83rem; font-weight: 600; line-height: 1.48;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.22); pointer-events: auto;
}
.tip-popover::after {
  content: ""; position: absolute; left: var(--arrow-x, 50%); bottom: -7px;
  width: 10px; height: 10px; margin-left: -5px;
  background: var(--text); border-right: 2px solid var(--border); border-bottom: 2px solid var(--border);
  transform: rotate(45deg);
}
.tip-popover.is-below::after {
  bottom: auto; top: -7px;
  border-right: 0; border-bottom: 0; border-left: 2px solid var(--border); border-top: 2px solid var(--border);
}
.article:not(.sources) ul {
  list-style: none; padding-inline-start: 0; display: flex; flex-direction: column; gap: 8px;
}
.article:not(.sources) ul li {
  position: relative; margin: 0; padding: 9px 14px 9px 30px; max-width: 100%;
  background: var(--bg); border: 1.5px solid var(--hair); border-radius: 10px;
}
.article:not(.sources) ul li::before {
  content: ""; position: absolute; left: 12px; top: 17px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--accent); border: 1.5px solid var(--border);
}

/* Visual Tax Relief Cards & In-Article Infographics */
.relief-group-head {
  display: flex; align-items: center; gap: 10px; width: 100%; margin: 16px 0 6px; padding: 8px 14px;
  border: 2px solid var(--border); border-radius: 14px;
  background-color: var(--surface); background-image: radial-gradient(var(--dot-ink) 1px, transparent 1px); background-size: 12px 12px;
  color: var(--text); font-family: var(--display); font-size: 1.05rem; font-weight: 700; box-shadow: var(--shadow-sm);
}
.relief-group-head .icon {
  width: 30px; height: 30px; padding: 5px; border: 2px solid var(--border); border-radius: 10px;
  background: var(--sky); color: var(--on-sky); flex-shrink: 0;
}
.relief-group.grp-family .relief-group-head .icon { background: var(--rose); color: var(--on-rose); }
.relief-group.grp-other .relief-group-head .icon { background: var(--mint); color: var(--on-mint); }

/* Breakdown row & explanation table mini-icons */
.row-ico {
  display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px;
  margin-inline-end: 8px; border: 1.5px solid var(--border); border-radius: 7px;
  background: var(--watch-paper); color: var(--text); vertical-align: -5px; flex-shrink: 0;
}
.row-ico svg { width: 13px; height: 13px; }
.row-ico.ico-gain { background: var(--gain-bg); color: var(--gain-ink); border-color: var(--gain-ink); }
.row-ico.ico-loss { background: var(--loss-bg); color: var(--loss-ink); border-color: var(--loss-ink); }
.row-ico.ico-epf { background: var(--sky); color: var(--on-sky); }
.row-ico.ico-home { background: var(--peach); color: var(--on-peach); }
.row > span:first-child { display: inline-flex; align-items: center; }
.relief-card {
  padding: 12px; border: 2px solid var(--border); border-radius: 12px; background: var(--bg);
  box-shadow: 2px 2px 0 var(--shadow-ink); transition: background-color 120ms ease-out, border-color 120ms ease-out, transform 120ms ease-out;
}
.relief-card.is-active { background: var(--gain-bg); border-color: var(--gain-ink); }
.relief-card-top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.relief-group-head .relief-svg {
  width: 38px; height: 38px; padding: 3px; border: 2px solid var(--border); border-radius: 11px;
  background: var(--watch-paper); box-shadow: 2px 2px 0 var(--shadow-ink); flex-shrink: 0;
}
.relief-ico {
  display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; padding: 3px;
  border: 2px solid var(--border); border-radius: 12px; background: var(--surface);
  box-shadow: 2px 2px 0 var(--shadow-ink); flex-shrink: 0; transition: transform 150ms ease-out;
}
.relief-card:hover .relief-ico { transform: rotate(-4deg) scale(1.06); }
.relief-ico .relief-svg { width: 34px; height: 34px; display: block; }
.relief-card-top label { flex: 1 1 auto; font-size: 0.86rem; font-weight: 700; line-height: 1.25; color: var(--text); }
.relief-max-btn {
  min-height: 28px; padding: 2px 9px; border: 2px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--text); font-family: var(--mono); font-size: 0.7rem; font-weight: 700;
  cursor: pointer; white-space: nowrap; flex-shrink: 0;
}
.relief-max-btn:hover { background: var(--sun); color: var(--on-sun); }
.relief-card.is-active .relief-max-btn { background: var(--sun); color: var(--on-sun); }
.savings-banner {
  margin-top: 14px; padding: 12px 16px; border: 2px solid var(--border); border-radius: 12px;
  background: var(--gain-bg); color: var(--gain-ink); font-size: 0.92rem; font-weight: 700;
  box-shadow: 2px 2px 0 var(--shadow-ink);
}
.savings-banner:empty { display: none; }
.article-figure {
  margin: 14px 0 18px; border: 2px solid var(--border); border-radius: 14px; overflow: hidden;
  box-shadow: var(--shadow-sm); background: var(--mint);
}
.article-figure svg { display: block; width: 100%; height: auto; }

/* Enamel-pin sticker badges & lively interactive sliders/chips */
.trust-pill {
  display: inline-flex; align-items: center; gap: 7px; font-family: var(--display); font-size: 0.84rem; font-weight: 700;
  padding: 5px 13px; box-shadow: inset 0 2px 0 #ffffff66, 2px 3px 0 var(--shadow-ink);
  transition: transform 140ms ease-out, box-shadow 140ms ease-out;
}
.trust-pill::before { content: "✦"; font-size: 0.78em; opacity: 0.85; }
.trust-pill:hover { transform: translateY(-2px) rotate(-1deg); box-shadow: inset 0 2px 0 #ffffff80, 3px 5px 0 var(--shadow-ink); }
.tool-tag {
  display: inline-flex; align-items: center; gap: 6px; font-family: var(--display); font-size: 0.76rem; font-weight: 700;
  letter-spacing: 0.02em; padding: 2px 10px; border-radius: 999px;
  box-shadow: inset 0 2px 0 #ffffff80, 2px 2px 0 var(--shadow-ink);
}
.tool-tag::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); border: 1.5px solid var(--border); flex-shrink: 0; }
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 11px;
  font-family: var(--display); font-size: 0.78rem; font-weight: 700;
  box-shadow: inset 0 2px 0 #ffffff70, 2px 2px 0 var(--shadow-ink);
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: 0.75; }
input[type="range"] {
  height: 14px; background: linear-gradient(90deg, var(--accent) var(--pct, 0%), var(--track) var(--pct, 0%));
  box-shadow: inset 0 2px 0 #00000014;
}
input[type="range"]::-webkit-slider-thumb {
  width: 28px; height: 28px; background: var(--sun); border: 2.5px solid var(--border);
  box-shadow: inset 0 2px 0 #ffffff99, 2px 2px 0 var(--shadow-ink);
  transition: transform 120ms cubic-bezier(.22, 1, .36, 1), background-color 120ms ease-out;
}
input[type="range"]:hover::-webkit-slider-thumb, input[type="range"]:active::-webkit-slider-thumb {
  transform: scale(1.14); background: var(--accent);
}
input[type="range"]::-moz-range-thumb {
  width: 24px; height: 24px; background: var(--sun); border: 2.5px solid var(--border);
  transition: transform 120ms ease-out, background-color 120ms ease-out;
}
input[type="range"]:hover::-moz-range-thumb, input[type="range"]:active::-moz-range-thumb {
  transform: scale(1.14); background: var(--accent);
}
.chip {
  box-shadow: inset 0 -2px 0 #00000014, 2px 3px 0 var(--shadow-ink);
  transition: transform 110ms cubic-bezier(.22, 1, .36, 1), box-shadow 110ms ease-out, background-color 110ms ease-out;
}
.chip:hover { transform: translate(-1px, -2px); box-shadow: inset 0 -2px 0 #00000014, 3px 4px 0 var(--shadow-ink); }
.chip[aria-pressed="true"] { box-shadow: inset 0 2px 0 #ffffff88, 2px 2px 0 var(--shadow-ink); }
.relief-card:hover { transform: translate(-1px, -2px); box-shadow: 3px 4px 0 var(--shadow-ink); }

/* Mini sticker illustrations beside long-section headings & FAQ cards */
.article h2.h2-illus {
  display: flex; align-items: center; gap: 12px; padding-bottom: 10px;
}
.mini-art {
  display: inline-flex; align-items: center; justify-content: center; width: 46px; height: 46px; padding: 4px;
  border: 2px solid var(--border); border-radius: 13px; background: var(--watch-paper);
  box-shadow: 2px 3px 0 var(--shadow-ink); flex-shrink: 0; transition: transform 160ms ease-out;
}
.h2-illus:hover .mini-art { transform: rotate(-4deg) scale(1.06); }
.mini-svg { display: block; width: 36px; height: 36px; }
.article .faq-item h3 { display: flex; align-items: flex-start; gap: 9px; margin: 0 0 6px; }
.faq-num {
  display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 24px; padding: 0 7px;
  border: 2px solid var(--border); border-radius: 8px; background: var(--sun); color: var(--on-sun);
  font-family: var(--mono); font-size: 0.72rem; font-weight: 800; box-shadow: 1.5px 2px 0 var(--shadow-ink); flex-shrink: 0;
}

@media (max-width: 640px) {
  .page-tabs { display: flex; width: 100%; gap: 6px; }
  .page-tab { flex: 1 1 auto; padding: 6px 10px; font-size: 0.85rem; text-align: center; }
}

@media (max-width: 420px) {
  h1 { font-size: clamp(1.55rem, 7vw, 1.9rem); }
  .page-head { grid-template-columns: minmax(0, 1fr) 84px; }
}

/* STICKY RESULT BAR: shown only while the answer panel is still below the visible screen */
.sticky-answer {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 40; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px max(16px, calc((100vw - 860px) / 2 + 16px)) calc(10px + env(safe-area-inset-bottom)); text-decoration: none; color: var(--on-sun); background: var(--sun);
  border-top: 2px solid var(--border); box-shadow: 0 -3px 0 var(--shadow-ink);
}
.sticky-answer[hidden] { display: none; }
@media (max-width: 359px) {
  .sticky-answer { flex-wrap: wrap; row-gap: 2px; }
  .sticky-answer .sa-label { flex: 1 1 100%; -webkit-line-clamp: 3; }
}
.sticky-answer .sa-label { min-width: 0; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; line-height: 1.2; font-family: var(--mono); font-size: 0.8125rem; font-weight: 700; }
.sticky-answer .sa-val { flex-shrink: 0; font-family: var(--display); font-weight: 800; font-size: 1.35rem; line-height: 1.1; white-space: nowrap; }
.sticky-answer .sa-go { flex-shrink: 0; font-weight: 800; }
.table-wrap:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
/* scroll hint: a soft shadow shows on whichever side still has more table to scroll to */
.table-wrap {
  background:
    linear-gradient(to right, var(--surface) 30%, transparent) left center / 28px 100% no-repeat local,
    linear-gradient(to left, var(--surface) 30%, transparent) right center / 28px 100% no-repeat local,
    linear-gradient(to right, rgba(0, 0, 0, 0.3), transparent) left center / 12px 100% no-repeat scroll,
    linear-gradient(to left, rgba(0, 0, 0, 0.3), transparent) right center / 12px 100% no-repeat scroll,
    var(--surface);
}
@media (max-width: 480px) {
  .article th, .article td, .calc-card th, .calc-card td { padding: 7px 6px; }
  .article table, .calc-card table { font-size: 0.8125rem; }
}
.nowrap { white-space: nowrap; }

/* ===== Design pass: phone-first compaction (keep this block last) ===== */
.breadcrumb, .meta-line { font-family: var(--sans); }
.reliefs-grid { margin-top: 18px; }
.donut-wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px 16px; }
.donut-wrap #donutSlot { flex: 0 0 auto; }
.donut-wrap .chart-legend { margin: 0; flex-direction: column; gap: 6px; }
/* Clear Input vs Result Visual Hierarchy (all 10 calculators) */
.input-grid { gap: 12px; }
.input-grid > .field.full:has(input[type="range"]) {
  padding: 16px 18px; border: 1.5px solid var(--hair); border-radius: 14px;
  background: var(--bg); box-shadow: none;
}
.input-grid > .field.full:has(input[type="range"]):focus-within {
  border-color: var(--border); background: var(--surface); box-shadow: 2px 3px 0 var(--shadow-ink);
}
.input-grid > .field.full:has(input[type="range"]) input[type="number"] {
  height: 50px; font-family: var(--mono); font-size: 1.3rem; font-weight: 800; background: var(--surface);
}
.input-grid > .field:not(.full):not(.relief-card) {
  padding: 12px 14px; border: 1.5px solid var(--hair); border-radius: 12px; background: var(--bg);
  transition: border-color 140ms ease-out, box-shadow 140ms ease-out, transform 140ms ease-out, background-color 140ms ease-out;
}
.input-grid > .field:not(.full):not(.relief-card):focus-within {
  border-color: var(--border); background: var(--surface); box-shadow: 2px 3px 0 var(--shadow-ink); transform: translateY(-1px);
}
.field input[type="number"] { font-family: var(--mono); font-weight: 700; background: var(--surface); }
.field select { font-weight: 700; background: var(--surface); }

/* Unmistakable Result Zone Spotlight (separates answers cleanly from inputs above) */
.visual-answer {
  position: relative; margin-top: 38px; padding: 24px 22px 22px;
  border: 3px solid var(--border); border-top: 8px solid var(--accent); border-radius: 18px;
  background-color: var(--watch-paper); background-image: radial-gradient(var(--dot-ink) 1px, transparent 1px); background-size: 14px 14px;
  box-shadow: 5px 5px 0 var(--shadow-ink);
}
.visual-answer::before {
  content: "▼"; position: absolute; left: 50%; top: -22px; transform: translateX(-50%);
  display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px;
  border: 2.5px solid var(--border); border-radius: 50%; background: var(--accent); color: #fff;
  font-size: 0.78rem; line-height: 1; box-shadow: 0 2px 0 var(--shadow-ink);
}
.answer-big {
  font-size: clamp(2.1rem, 6.4vw, 3rem); padding: 2px 0.34em 0.08em;
  border: 2px solid var(--border); box-shadow: 3px 3px 0 var(--shadow-ink);
}
.rows:not(.ledger-rows) .row:not(.strong) {
  border-width: 1.5px; box-shadow: none;
}
.rows:not(.ledger-rows) .row:not(.strong):hover {
  border-color: var(--border); box-shadow: 2px 3px 0 var(--shadow-ink);
}

/* Desktop 2-Column Split Workbench: Left = Inputs, Right = Sticky Live Results */
.calc-inputs, .calc-results { min-width: 0; }
@media (min-width: 980px) {
  .container:has(.calc-card.is-split) { max-width: 1180px; }
  .calc-card.is-split {
    display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(380px, 0.85fr); gap: 28px; align-items: start;
    padding: 24px;
  }
  .calc-card.is-split > .calc-inputs {
    padding-inline-end: 24px; border-inline-end: 2px dashed var(--hair);
  }
  .calc-card.is-split > .calc-results {
    position: sticky; top: 16px;
  }
  .calc-card.is-split .visual-answer { margin-top: 0; padding: 18px 18px 16px; grid-template-columns: minmax(0, 1fr); }
  .calc-card.is-split .visual-answer::before { display: none; }
  .calc-card.is-split .donut-wrap { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
  .calc-card.is-split .calc-results .rows { margin-top: 14px; gap: 8px; }
  .calc-card.is-split .calc-results .rows:not(.ledger-rows) { grid-template-columns: minmax(0, 1fr); }
  .calc-card.is-split .calc-results .rows:not(.ledger-rows) .row {
    flex-direction: row; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 8px 12px;
  }
  .calc-card.is-split .calc-results .rows:not(.ledger-rows) .row .val { padding-inline-start: 0; text-align: end; }
  .calc-card.is-split .calc-results .rows:not(.ledger-rows) .row .row-meter { flex-basis: 100%; }
  body:has(.calc-card.is-split) .sticky-bar { display: none !important; }
}

/* Dedicated AdSense display container (hidden until configured; zero CLS, clearly labelled) */
.ad-slot-wrap {
  margin: 22px 0; padding: 12px 14px 14px; border: 2px dashed var(--hair); border-radius: 14px;
  background: var(--surface); min-height: 110px; text-align: center;
}
.ad-slot-wrap[hidden] { display: none; }
.ad-label {
  display: block; margin-bottom: 8px; font-family: var(--mono); font-size: 0.68rem; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
}
.aff-card {
  background-color: var(--watch-paper); background-image: radial-gradient(var(--dot-ink) 1px, transparent 1px); background-size: 14px 14px;
  box-shadow: var(--shadow-sm);
}
.aff-copy { flex: 1 1 260px; }
.aff-btn { background: var(--accent); color: var(--on-accent); }

/* Visual breakdown KPI tiles: color-coded left accent, micro progress bars, zero orphan gaps, lively insight callout */
.rows:not(.ledger-rows) .row:not(.strong) {
  border-inline-start: 5px solid var(--sun);
  background: var(--surface);
}
.rows:not(.ledger-rows) .row.tone-loss { border-inline-start-color: var(--c-red); }
.rows:not(.ledger-rows) .row.tone-gain { border-inline-start-color: var(--c-green); }
.rows:not(.ledger-rows) .row.tone-epf { border-inline-start-color: var(--c-blue); }
.rows:not(.ledger-rows) .row.row-wide {
  grid-column: 1 / -1; flex-direction: row; align-items: center; justify-content: space-between; flex-wrap: wrap;
}
.rows:not(.ledger-rows) .row.row-wide .val { padding-inline-start: 0; text-align: end; }
.rows:not(.ledger-rows) .row.row-wide .row-meter { flex-basis: 100%; }
.row-meter {
  width: 100%; height: 7px; margin-top: 4px; border-radius: 999px;
  background: var(--track); border: 1px solid var(--hair); overflow: hidden;
}
.row-meter > i {
  display: block; height: 100%; border-radius: 999px; background: var(--c-amber);
  transition: width 300ms cubic-bezier(.22, 1, .36, 1);
}
.row.tone-loss .row-meter > i { background: var(--c-red); }
.row.tone-gain .row-meter > i { background: var(--c-green); }
.row.tone-epf .row-meter > i { background: var(--c-blue); }
.insight-box {
  position: relative; padding-inline-start: 52px; box-shadow: 2px 3px 0 var(--shadow-ink);
}
.insight-box::before {
  content: "💡"; position: absolute; left: 12px; top: 12px;
  display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px;
  border: 2px solid var(--border); border-radius: 10px; background: var(--sun); font-size: 0.95rem;
}

/* Car Loan Showroom Picker & Malaysian Bank Rate Grid (spacious & illustrated) */
.showroom-box {
  margin-bottom: 18px; padding: 18px; border: 2px solid var(--border); border-radius: 16px;
  background: var(--bg); box-shadow: 2px 3px 0 var(--shadow-ink);
}
.brand-tabs { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0 16px; }
.brand-tab {
  display: inline-flex; align-items: center; gap: 7px; min-height: 38px; padding: 4px 14px 4px 8px;
  border: 2px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text);
  font-family: var(--display); font-size: 0.9rem; font-weight: 700; cursor: pointer;
  box-shadow: 2px 2px 0 var(--shadow-ink); transition: transform 100ms ease-out;
}
.brand-logo-wrap {
  display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 24px; padding: 2px 4px;
  border: 1.5px solid var(--border); border-radius: 999px; background: #fff; overflow: hidden; flex-shrink: 0;
}
.brand-logo { max-width: 24px; max-height: 18px; width: auto; height: auto; object-fit: contain; display: block; }
.model-photo {
  width: 104px; height: 66px; object-fit: cover; border-radius: 10px;
  border: 1.5px solid var(--border); background: var(--surface); flex-shrink: 0;
}
.bank-logo-wrap {
  display: inline-flex; align-items: center; justify-content: center; width: 100%; max-width: 108px; height: 34px; padding: 4px 8px;
  border: 1.5px solid var(--border); border-radius: 9px; background: #fff; overflow: hidden; flex-shrink: 0;
}
.bank-logo { max-width: 92px; max-height: 24px; width: auto; height: auto; object-fit: contain; display: block; }
.brand-crest {
  display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px;
  border: 1.5px solid var(--border); border-radius: 50%; background: var(--sun); color: var(--on-sun);
  font-family: var(--mono); font-size: 0.68rem; font-weight: 800;
}
.brand-tab:hover { background: var(--watch-paper); transform: translateY(-1px); }
.brand-tab[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.brand-tab[aria-pressed="true"] .brand-logo-wrap {
  display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 24px; padding: 2px 4px;
  border: 1.5px solid var(--border); border-radius: 999px; background: #fff; overflow: hidden; flex-shrink: 0;
}
.brand-logo { max-width: 24px; max-height: 18px; width: auto; height: auto; object-fit: contain; display: block; }
.model-photo {
  width: 104px; height: 66px; object-fit: cover; border-radius: 10px;
  border: 1.5px solid var(--border); background: var(--surface); flex-shrink: 0;
}
.bank-logo-wrap {
  display: inline-flex; align-items: center; justify-content: center; width: 100%; max-width: 108px; height: 34px; padding: 4px 8px;
  border: 1.5px solid var(--border); border-radius: 9px; background: #fff; overflow: hidden; flex-shrink: 0;
}
.bank-logo { max-width: 92px; max-height: 24px; width: auto; height: auto; object-fit: contain; display: block; }
.brand-crest { background: var(--surface); color: var(--text); }
.model-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 12px; }
.model-card.chip {
  display: flex; flex-direction: row; align-items: center; gap: 12px; width: 100%; min-height: 76px;
  padding: 12px 14px; border-radius: 14px; text-align: start; font-family: var(--sans);
}
.model-art {
  display: flex; align-items: center; justify-content: center; width: 78px; height: 48px; padding: 4px;
  border: 1.5px solid var(--hair); border-radius: 10px; background: var(--watch-paper); flex-shrink: 0;
}
.car-mini { width: 70px; height: 36px; display: block; }
.model-info { display: flex; flex-direction: column; gap: 5px; flex: 1 1 auto; min-width: 0; }
.model-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; flex-wrap: wrap; }
.model-top strong { font-family: var(--display); font-size: 0.96rem; color: var(--text); }
.model-type {
  padding: 1px 8px; border: 1.5px solid var(--border); border-radius: 999px; background: var(--watch-paper);
  font-family: var(--mono); font-size: 0.66rem; font-weight: 700; color: var(--text); white-space: nowrap;
}
.model-type.is-ev { background: var(--mint); color: var(--on-mint); }
.model-price { font-family: var(--mono); font-size: 0.92rem; font-weight: 800; color: var(--accent-ink); }
.bank-box {
  padding: 16px 18px; border: 2px solid var(--border); border-radius: 16px; background: var(--bg);
}
.bank-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(136px, 1fr)); gap: 12px; margin: 12px 0; }
.bank-btn.chip {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 82px; padding: 12px 10px; border-radius: 13px; text-align: center;
}
.bank-dot {
  display: inline-flex; align-items: center; justify-content: center; padding: 2px 9px;
  border: 1.5px solid var(--border); border-radius: 7px; font-family: var(--mono); font-size: 0.7rem; font-weight: 800;
}
.bank-mbb { background: #ffd84d; color: #26201a; }
.bank-pbb { background: #ffb9cc; color: #26201a; }
.bank-cimb { background: #ff8c7a; color: #26201a; }
.bank-hlb { background: #a5dcff; color: #26201a; }
.bank-rhb { background: #b9e6a6; color: #26201a; }
.bank-name { font-family: var(--sans); font-size: 0.8rem; font-weight: 700; color: var(--muted); }
.bank-btn strong { font-family: var(--mono); font-size: 1.02rem; color: var(--text); }
.chart-card {
  margin-top: 18px; padding: 16px 18px; border: 2px solid var(--border); border-radius: 14px;
  background: var(--bg); box-shadow: 2px 2px 0 var(--shadow-ink);
}
.tenure-chart { display: block; width: 100%; max-width: 520px; height: auto; margin: 10px auto 0; }
.chart-top-val { fill: var(--text); font-family: var(--mono); font-weight: 800; }
.chart-lbl { fill: var(--text); font-family: var(--display); font-weight: 800; }
.chart-sub { fill: var(--muted); font-family: var(--mono); font-weight: 700; }
@media (max-width: 640px) {
  .model-grid { grid-template-columns: minmax(0, 1fr); }
  .bank-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Clean single-column ledger for waterfall breakdowns (e.g. Income Tax) */
.rows.ledger-rows {
  display: flex; flex-direction: column; gap: 0; padding: 4px 16px;
  border: 2px solid var(--border); border-radius: 14px; background: var(--bg);
  box-shadow: var(--shadow-sm);
}
.rows.ledger-rows .row {
  flex-direction: row; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 4px; border: 0; border-bottom: 1.5px dashed var(--hair); border-radius: 0;
  background: transparent; box-shadow: none;
}
.rows.ledger-rows .row:hover { transform: none; box-shadow: none; }
.rows.ledger-rows .row:last-child { border-bottom: 0; }
.rows.ledger-rows .row[hidden] { display: none; }
.rows.ledger-rows .row > span:first-child { font-size: 0.9rem; font-weight: 600; color: var(--text); }
.rows.ledger-rows .row .val { padding-inline-start: 0; text-align: end; font-size: 0.98rem; }
.rows.ledger-rows .row.row-subtotal {
  margin: 4px -10px; padding: 10px 14px; border: 0; border-radius: 10px;
  background: var(--watch-paper); font-weight: 800;
}
.rows.ledger-rows .row.row-subtotal > span:first-child { font-weight: 800; }
.rows.ledger-rows .row.strong {
  margin: 6px -10px; padding: 12px 14px; border: 2px solid var(--gain-ink); border-radius: 11px;
  background: var(--gain-bg);
}
.rows.ledger-rows .row.strong.is-owes {
  border-color: var(--loss-ink); background: var(--loss-bg);
}
.rows.ledger-rows .row.strong.is-owes .val { color: var(--loss-ink) !important; }

/* SGD vs MYR real-life scenario cards & SG/MY section banners */
.scenario-wrap { margin-bottom: 16px; }
.scenario-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 8px; }
.scenario-btn {
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px; text-align: start;
  padding: 10px 13px; border: 2px solid var(--border); border-radius: 13px; background: var(--bg);
  color: var(--text); font: inherit; cursor: pointer; box-shadow: 2px 3px 0 var(--shadow-ink);
  transition: transform 110ms ease-out, box-shadow 110ms ease-out, background-color 110ms ease-out;
}
.scenario-btn strong { font-family: var(--display); font-size: 0.94rem; font-weight: 700; }
.scenario-btn small { font-size: 0.76rem; color: var(--muted); line-height: 1.35; }
.scenario-btn:hover { background: var(--watch-paper); transform: translate(-1px, -2px); box-shadow: 3px 4px 0 var(--shadow-ink); }
.scenario-btn[aria-pressed="true"] { background: var(--sun); color: var(--on-sun); }
.scenario-btn[aria-pressed="true"] small { color: var(--on-sun); opacity: 0.85; }
.country-head {
  display: flex; align-items: center; gap: 10px; margin: 6px 0 -2px; padding: 7px 12px;
  border: 2px solid var(--border); border-radius: 12px; background: var(--sky); color: var(--on-sky);
  font-family: var(--display); font-size: 1rem; font-weight: 700; box-shadow: 2px 2px 0 var(--shadow-ink);
}
.country-head.country-my { background: var(--sun); color: var(--on-sun); }
.country-pill {
  display: inline-flex; align-items: center; justify-content: center; padding: 1px 8px;
  border: 2px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text);
  font-family: var(--mono); font-size: 0.72rem; font-weight: 800;
}
@media (max-width: 640px) { .scenario-grid { grid-template-columns: minmax(0, 1fr); } }

/* Overtime day-type color-coded cards & multiplier pills */
.ot-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ot-rate {
  display: inline-flex; align-items: center; padding: 2px 9px; border: 2px solid var(--border); border-radius: 999px;
  font-family: var(--mono); font-size: 0.72rem; font-weight: 800; white-space: nowrap; flex-shrink: 0;
  box-shadow: 1.5px 2px 0 var(--shadow-ink);
}
.ot-normal { border-top: 5px solid var(--c-green) !important; }
.ot-normal .ot-rate { background: var(--mint); color: var(--on-mint); }
.ot-rest { border-top: 5px solid var(--c-blue) !important; }
.ot-rest .ot-rate { background: var(--sky); color: var(--on-sky); }
.ot-ph { border-top: 5px solid var(--c-amber) !important; }
.ot-ph .ot-rate { background: var(--sun); color: var(--on-sun); }

@media (max-width: 640px) {
  .breadcrumb { margin: 0 0 6px; }
  .page-head { gap: 4px 12px; margin-bottom: 0; }
  .lead { margin-bottom: 10px; font-size: 0.9375rem; }
  .meta-line { margin: 0 0 10px; gap: 2px 12px; }
  .page-tabs { margin: 2px 0 12px; }
  .home-hero-art { display: none; }
  .trust-pill:nth-child(3) { display: none; }
  .trust-strip { gap: 6px; margin-bottom: 12px; }
  .cat-filter { gap: 6px; }
  .tool-thumb img { aspect-ratio: 2 / 1; }
}
@media (min-width: 360px) and (max-width: 640px) {
  .breadcrumb { white-space: nowrap; }
  .breadcrumb span { display: inline-block; max-width: calc(100% - 5.5rem); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
}
@media (min-width: 360px) and (max-width: 480px) {
  h1 { font-size: clamp(1.4rem, 6.4vw, 1.6rem); }
  .page-head { grid-template-columns: minmax(0, 1fr) 68px; }
}
@media (max-width: 480px) {
  .chip-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(64px, 1fr)); gap: 8px; width: 100%; }
  .chip { display: inline-flex; align-items: center; justify-content: center; padding: 4px 2px; }
}

/* reflow safety at 320px-wide-equivalent zoom (WCAG 1.4.10): nothing may force sideways scrolling */
@media (max-width: 359px) {
  .rows { grid-template-columns: minmax(0, 1fr); }
  .row { min-width: 0; padding: 9px 10px; }
  .row .val { padding-inline-start: 0; white-space: normal; overflow-wrap: anywhere; font-size: 1rem; }
  .row > span:first-child { min-width: 0; overflow-wrap: anywhere; }
  .relief-max-btn { white-space: normal; flex-shrink: 1; min-width: 0; max-width: 100%; }
  .relief-card-top { flex-wrap: wrap; }
  .article h2.h2-illus { flex-wrap: wrap; }
  .h2-illus > span { min-width: 0; overflow-wrap: anywhere; }
}

/* ---- design pass, round 2 (from persona review) ---- */
/* words never break mid-letter; a long value drops under its label instead of squeezing it */
.tool-card, .field, .row > span:first-child, .comp-meta > span, .hint, .answer-label { overflow-wrap: break-word; }
@media (max-width: 720px) {
  .row { flex-wrap: wrap; row-gap: 2px; }
  .row > span:first-child { flex: 1 1 9rem; }
  .row .val { margin-inline-start: auto; }
}
/* donut + legend stay side by side down to a 360px phone */
@media (max-width: 420px) {
  .visual-answer { padding: 12px; }
  .donut-wrap { gap: 8px 6px; }
}
/* 13px floor for the small controls and tags */
.relief-max-btn { font-size: 0.8125rem; min-height: 32px; padding: 2px 10px; }
.tool-tag, .faq-num { font-size: 0.8125rem; }
.reliefs-title { margin: 4px 0 0; font-family: var(--display); font-size: 1.25rem; font-weight: 800; line-height: 1.2; }
.reliefs-grid { margin-top: 12px; }
.cat-label { align-self: center; font-family: var(--mono); font-size: 0.8125rem; font-weight: 700; color: var(--muted); }

/* ---- design pass, round 3 ---- */
.badge, .hint .badge, .badge-warn, .badge-safe, .badge-danger { font-size: 0.8125rem; }
@media (max-width: 359px) {
  .tool-head { flex-wrap: wrap; }
  .tool-tag { max-width: 100%; white-space: normal; }
  h3 > span { min-width: 0; overflow-wrap: anywhere; }
}
/* relief cards on phones: the Max button drops under the title instead of squeezing it */
@media (max-width: 480px) {
  .relief-card-top { flex-wrap: wrap; row-gap: 6px; }
  .relief-card-top label { flex: 1 1 calc(100% - 44px); min-width: 0; }
  .relief-max-btn { margin-inline-start: 38px; }
}

/* long links and big figures must never push the page sideways (WCAG 1.4.10) */
a { overflow-wrap: anywhere; }
@media (max-width: 359px) {
  .answer-big { font-size: 1.5rem; overflow-wrap: anywhere; }
  .ot-head { flex-wrap: wrap; }
  .page-head { grid-template-columns: minmax(0, 1fr); }
  .visual-answer > div { min-width: 0; }
  .action-row { flex-wrap: wrap; }
  .action-row .btn-wa, .action-row .btn-secondary, .action-row button, .action-row a { white-space: normal; min-width: 0; max-width: 100%; }
  .model-grid { grid-template-columns: minmax(0, 1fr); }
  .model-card, .model-card > * { min-width: 0; overflow-wrap: anywhere; }
  .article li, .article p, .article td { overflow-wrap: anywhere; }
}

.gauge-svg { max-width: 100%; height: auto; }

/* ---- design pass, round 4: car showroom cards reflow on very narrow screens, 13px floor ---- */
.model-type { font-size: 0.8125rem; }
@media (max-width: 359px) {
  .showroom-box, .bank-box { padding: 12px; }
  .brand-tabs { gap: 6px; }
  .model-card.chip { flex-wrap: wrap; min-width: 0; padding: 10px; }
  .model-top { min-width: 0; }
  .model-type { white-space: normal; }
  .bank-grid { grid-template-columns: minmax(0, 1fr); }
  .insight-box, .answer-sub, .savings-banner { overflow-wrap: anywhere; }
  .sticky-answer { box-sizing: border-box; max-width: 100vw; }
  .sticky-answer .sa-val { white-space: normal; overflow-wrap: anywhere; font-size: 1.2rem; }
}

/* ---- design pass, round 5: large-text safety (WCAG 1.4.4 / 1.4.10). Nothing here depends on the viewport width, because enlarged text shrinks the usable width without changing it ---- */
.row { min-width: 0; }
.row .val { overflow-wrap: anywhere; }
.f-item { min-width: 0; }
.formula-eq { min-width: 0; }
.f-frac { max-width: 100%; }
.f-num, .f-den { flex-wrap: wrap; max-width: 100%; }
.f-var { white-space: normal; max-width: 100%; text-align: center; overflow-wrap: anywhere; }
.model-card.chip { min-width: 0; max-width: 100%; }
/* quick-amount chips size to their text, so "RM 1,000" is never squeezed at 200% text */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; }
.chip-row > .chip { flex: 1 1 0; min-width: min(max-content, 100%); max-width: 100%; padding: 4px 10px; }
/* sticky result bar: the label and the value wrap onto two rows instead of being cut */
.sticky-answer { flex-wrap: wrap; row-gap: 2px; box-sizing: border-box; max-width: 100vw; }
.sticky-answer .sa-label { flex: 1 1 5rem; -webkit-line-clamp: 3; }
.sticky-answer .sa-val { flex-shrink: 1; min-width: 0; white-space: normal; overflow-wrap: anywhere; }
@media (max-width: 359px) { .sticky-answer .sa-label { flex: 1 1 100%; } }
/* values may wrap at spaces when text is enlarged (NBSP keeps "RM 28,000.00" together); headings with an icon wrap too */
.row .val, .comp-meta span:last-child { white-space: normal; }
.model-type { white-space: normal; }
.article h2.h2-illus { flex-wrap: wrap; }
.h2-illus > span:not(.mini-art) { flex: 1 1 8rem; min-width: 0; overflow-wrap: anywhere; }
.relief-max-btn { white-space: normal; flex-shrink: 1; min-width: 0; max-width: 100%; }
.article .faq-item h3 > span:not(.faq-num) { flex: 1 1 0; min-width: 0; overflow-wrap: anywhere; }
