:root {
  --ink: #0c2a2a;
  --paper: #f5f0e5;
  --card: #fffdf8;
  --line: #e2dccf;
  --line-2: #cfc8ba;
  --soft: #f6f2e8;
  --muted: #67736f;
  --text-2: #4b5a56;
  --mint: #b9ff66;
  --amber: #ffb547;
  --red: #e4513f;
  --green: #137b5b;
  /* 台股慣例：紅色賺錢、綠色賠錢（淺底用深一階，深底用亮一階） */
  --up: #d63a2f;
  --down: #0e8a5a;
  --up-dark: #ff6f61;
  --down-dark: #43d39b;
  /* 深色結果區的文字 */
  --on-dark: #f3f6f4;
  --on-dark-2: #a9bdb7;
  --on-dark-line: rgba(255, 255, 255, .1);
  --cost: #ffc266;
  --soft-green: #e2f4cc;
  --shadow: 0 24px 60px rgba(12, 42, 42, .14);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: "DM Sans", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif; -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button, a, label { -webkit-tap-highlight-color: transparent; }
.script-warning { position: relative; z-index: 100; padding: 12px 20px; color: #fff; background: var(--red); text-align: center; font-size: 14px; font-weight: 700; }

/* ---------- header ---------- */
.top { position: -webkit-sticky; position: sticky; top: 0; z-index: 20; background: var(--paper); border-bottom: 1px solid var(--line); }
.top-inner { max-width: 1240px; height: 64px; margin: 0 auto; padding: 0 24px; display: -webkit-box; display: flex; -webkit-box-align: center; align-items: center; }
.brand { display: -webkit-box; display: flex; -webkit-box-align: center; align-items: center; margin-right: 28px; font-size: 19px; font-weight: 900; letter-spacing: .01em; white-space: nowrap; }
.brand-text small { display: block; margin-top: 1px; color: var(--muted); font-size: 10.5px; font-weight: 600; letter-spacing: .06em; }
.brand-mark { -webkit-box-flex: 0; flex: none; width: 36px; height: 36px; margin-right: 10px; border-radius: 10px; }
.nav { display: -webkit-box; display: flex; -webkit-box-flex: 1; flex: 1; }
.nav a { margin-right: 4px; padding: 8px 13px; color: var(--text-2); border-radius: 99px; font-size: 14px; font-weight: 600; white-space: nowrap; }
.nav a.on { color: var(--ink); background: var(--mint); }
.fee-chip { margin-left: auto; padding: 8px 14px; background: transparent; border: 1px solid var(--ink); border-radius: 99px; font-size: 13px; font-weight: 700; white-space: nowrap; }
.fee-chip b { color: var(--green); }
.chips { display: none; }
@media (hover: hover) { .nav a:not(.on):hover { color: var(--ink); background: rgba(12, 42, 42, .06); } .fee-chip:hover { background: rgba(12, 42, 42, .05); } }

/* ---------- layout ---------- */
.page { max-width: 1240px; margin: 0 auto; padding: 28px 24px 0; display: grid; grid-template-columns: minmax(0, 1fr) 300px; grid-gap: 32px; gap: 32px; }
.side { min-width: 0; }

/* ---------- calculator ---------- */
.calc { display: grid; grid-template-columns: minmax(0, 1fr) 380px; background: var(--card); border: 1px solid var(--ink); border-radius: 16px; overflow: hidden; box-shadow: 8px 10px 0 #d8e1ce; }
.inputs { min-width: 0; padding: 26px 28px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-gap: 18px; gap: 18px; align-content: start; align-items: end; }
.calc-head { grid-column: 1 / -1; display: -webkit-box; display: flex; -webkit-box-pack: justify; justify-content: space-between; -webkit-box-align: start; align-items: flex-start; }
.eyebrow { margin: 0 0 6px; color: var(--green); font-size: 11.5px; font-weight: 800; letter-spacing: .14em; }
.calc-head h1 { margin: 0; font-size: 28px; line-height: 1.25; letter-spacing: -.04em; }
.calc-head .sub { margin: 6px 0 0; color: var(--muted); font-size: 13.5px; line-height: 1.6; }
.calc-head .sub a, .article p a { color: var(--green); font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.ghost { -webkit-box-flex: 0; flex: none; margin-left: 12px; padding: 7px 12px; color: var(--muted); background: transparent; border: 1px solid var(--line-2); border-radius: 7px; font-size: 13px; white-space: nowrap; }

.field { min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.field-label { display: -webkit-box; display: flex; -webkit-box-pack: justify; justify-content: space-between; -webkit-box-align: baseline; align-items: baseline; margin-bottom: 7px; color: #44524f; font-size: 13px; font-weight: 700; }
.label-main { white-space: nowrap; }
.label-unit { display: none; font-weight: 600; }
.field[hidden] { display: none; }
.field-note { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.flow { grid-column: 1 / -1; margin: -8px 0 0; padding: 0 2px; color: var(--muted); font-size: 12.5px; line-height: 1.6; }
.field-label small { margin-left: 8px; color: var(--muted); font-size: 12px; font-weight: 500; white-space: nowrap; }

.seg { display: grid; grid-auto-columns: 1fr; grid-auto-flow: column; padding: 5px; background: #eeebe3; border-radius: 12px; }
.seg label { position: relative; display: block; }
.seg input { position: absolute; top: 0; left: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.seg span { display: block; padding: 11px 6px; color: var(--muted); border-radius: 9px; text-align: center; font-size: 14.5px; font-weight: 700; transition: background .15s, color .15s; }
.seg input:checked + span { color: #fff; background: var(--ink); }
.seg input:focus + span { box-shadow: 0 0 0 3px rgba(19, 123, 91, .25); }
.seg input:disabled { cursor: not-allowed; }
.seg input:disabled + span { opacity: .4; text-decoration: line-through; }
.mini-seg { display: -webkit-inline-box; display: inline-flex; padding: 2px; background: #eeebe3; border-radius: 99px; }
.mini-seg label { position: relative; display: block; }
.mini-seg input { position: absolute; top: 0; left: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.mini-seg span { display: block; padding: 3px 9px; color: var(--muted); border-radius: 99px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.mini-seg input:checked + span { color: #fff; background: var(--ink); }
.mini-seg input:focus + span { box-shadow: 0 0 0 2px rgba(19, 123, 91, .3); }
.field-label { -webkit-box-align: center; align-items: center; }
.note.odd-note { display: block; color: #7a5a1c; background: #fff3dc; }
.note.odd-note[hidden] { display: none; }

.select select { width: 100%; height: 52px; padding: 0 40px 0 14px; color: var(--ink); background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%230c2a2a' stroke-width='2'/%3E%3C/svg%3E") no-repeat right 15px center; border: 1px solid var(--line-2); border-radius: 10px; outline: none; -webkit-appearance: none; -moz-appearance: none; appearance: none; font-size: 16px; font-weight: 700; }
.select select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(19, 123, 91, .12); }

.stepper { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; height: 52px; background: var(--card); border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; transition: border-color .15s, box-shadow .15s; }
.stepper:focus-within { border-color: var(--green); box-shadow: 0 0 0 3px rgba(19, 123, 91, .12); }
.step-btn { display: grid; place-items: center; padding: 0; color: var(--ink); background: #f4efe4; border: 0; font-size: 21px; line-height: 1; -ms-touch-action: manipulation; touch-action: manipulation; -webkit-user-select: none; user-select: none; }
.step-btn:first-child { border-right: 1px solid var(--line); }
.step-btn:last-child { border-left: 1px solid var(--line); }
.step-btn:active { background: var(--soft-green); }
.step-value { position: relative; min-width: 0; }
.step-value input { display: block; width: 100%; height: 100%; padding: 0 24px 0 6px; background: transparent; border: 0; border-radius: 0; outline: none; text-align: center; font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.step-value .unit { position: absolute; top: 50%; right: 8px; color: var(--muted); font-size: 12px; font-weight: 500; -webkit-transform: translateY(-50%); transform: translateY(-50%); pointer-events: none; }
@media (hover: hover) { .step-btn:hover { background: #ece6d8; } }

.note { grid-column: 1 / -1; display: -webkit-box; display: flex; -webkit-box-align: center; align-items: center; padding: 11px 14px; color: var(--muted); background: var(--soft); border-radius: 9px; font-size: 12.5px; line-height: 1.5; }
.note b { margin: 0 2px; color: var(--ink); }
.note button { margin-left: auto; padding: 0 0 0 12px; color: var(--green); background: none; border: 0; font-size: 12.5px; font-weight: 700; white-space: nowrap; }

/* ---------- result ---------- */
.result { min-width: 0; padding: 26px 28px; color: var(--on-dark); background: var(--ink); }
.result .k { color: var(--on-dark-2); font-size: 13px; }
.result .big { margin: 6px 0 10px; color: #fbf7ec; font-size: 48px; font-weight: 700; line-height: 1.05; letter-spacing: -.05em; word-break: break-all; }
.result .big.up { color: var(--up-dark); }
.result .big.down { color: var(--down-dark); }
.chip { display: inline-block; padding: 4px 11px; color: var(--on-dark); background: rgba(255, 255, 255, .12); border-radius: 99px; font-size: 13px; font-weight: 700; }
.chip.up { color: #fff; background: #e0483b; }
.chip.down { color: #fff; background: #12936a; }
.chip.safe { color: #8ff0c4; background: rgba(67, 211, 155, .16); }
.chip.warning { color: var(--ink); background: var(--amber); }
.chip.danger { color: #fff; background: #e0483b; }
.rows { margin-top: 22px; border-top: 1px solid var(--on-dark-line); }
.rows div { display: -webkit-box; display: flex; -webkit-box-pack: justify; justify-content: space-between; padding: 11px 0; border-bottom: 1px solid rgba(255, 255, 255, .07); font-size: 14px; }
.rows span { color: var(--on-dark-2); }
.rows b { font-weight: 600; white-space: nowrap; }
.rows .total b { color: var(--cost); }
.rows .up b { color: var(--up-dark); }
.rows .down b { color: var(--down-dark); }
.pair { display: grid; grid-template-columns: 1fr 1fr; grid-gap: 10px; gap: 10px; margin-top: 18px; }
.pair div { min-width: 0; padding: 12px 14px; background: rgba(255, 255, 255, .05); border: 1px solid var(--on-dark-line); border-radius: 10px; }
.pair span { display: block; color: var(--on-dark-2); font-size: 12px; }
.pair b { display: block; margin-top: 4px; font-size: 19px; overflow-wrap: anywhere; }

.gauge { position: relative; height: 10px; margin: 22px 0 26px; background: rgba(255, 255, 255, .12); border-radius: 99px; }
.gauge i { position: absolute; top: 0; bottom: 0; left: 0; border-radius: 99px; background: var(--down-dark); }
.gauge i.warning { background: var(--amber); }
.gauge i.danger { background: var(--up-dark); }
.gauge em { position: absolute; top: -4px; bottom: -4px; width: 2px; background: #fff; font-style: normal; }
.gauge em::after { content: attr(data-label); position: absolute; top: 18px; left: 50%; color: var(--on-dark-2); font-size: 11px; white-space: nowrap; -webkit-transform: translateX(-50%); transform: translateX(-50%); }

/* ---------- ladder ---------- */
.card { margin-top: 22px; padding: 20px 22px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
.card-head { display: -webkit-box; display: flex; -webkit-box-pack: justify; justify-content: space-between; -webkit-box-align: baseline; align-items: baseline; margin-bottom: 14px; }
.card-head h2 { margin: 0; font-size: 17px; }
.card-head span { margin-left: 12px; color: var(--muted); font-size: 12.5px; }
.card-head.stacked { display: block; margin-bottom: 10px; }
.card-head.stacked span { display: block; margin: 4px 0 0; }
.legend { display: -webkit-box; display: flex; -ms-flex-wrap: wrap; flex-wrap: wrap; margin: 0 0 14px; color: var(--text-2); font-size: 12.5px; font-weight: 600; }
.legend span { display: -webkit-inline-box; display: inline-flex; -webkit-box-align: center; align-items: center; margin: 0 18px 6px 0; }
.swatch { display: inline-block; width: 22px; height: 14px; margin-right: 7px; border-radius: 3px; }
.swatch.entry { background: #ffeab8; box-shadow: inset 4px 0 0 #e09a2b; }
.swatch.breakeven { background: #fde7e4; box-shadow: inset 4px 0 0 var(--up); }
.book { display: grid; grid-template-columns: 1fr 1fr; grid-gap: 14px; gap: 14px; }
.book-side { min-width: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.bhead, .lrow { display: grid; grid-template-columns: 1fr 1fr; align-items: center; padding: 0 16px; }
.bhead { height: 38px; color: rgba(255, 255, 255, .78); background: var(--ink); font-size: 12.5px; font-weight: 700; }
.bhead span:last-child, .lrow b { text-align: right; }
.lrow { height: 42px; border-top: 1px solid var(--line); font-size: 14.5px; }
.lrow:nth-child(odd) { background: #faf7f0; }
.lrow span { display: -webkit-box; display: flex; -webkit-box-align: center; align-items: center; font-weight: 600; white-space: nowrap; }
.lrow b { font-weight: 700; white-space: nowrap; }
/* 台股慣例：紅色賺錢、綠色賠錢 */
.lrow b.up { color: var(--up); }
.lrow b.down { color: var(--down); }
.lrow.entry { background: #ffeab8; box-shadow: inset 4px 0 0 #e09a2b; }
.lrow.breakeven { background: #fde7e4; box-shadow: inset 4px 0 0 var(--up); }
.stress { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-gap: 12px; gap: 12px; }
.stress-item { padding: 14px 16px; background: #e8f6ee; border: 1px solid #bfe6d0; border-radius: 10px; }
.stress-item span { display: block; color: var(--muted); font-size: 12.5px; font-weight: 700; }
.stress-item b { display: block; margin: 6px 0 2px; font-size: 20px; }
.stress-item small { color: var(--down); font-size: 12.5px; font-weight: 700; }
.stress-item.danger { background: #fdecea; border-color: #f4c3bc; }
.stress-item.danger small { color: var(--up); }
.more { margin-top: 14px; text-align: center; }
.more button { padding: 10px 20px; background: var(--card); border: 1px solid var(--ink); border-radius: 99px; font-size: 13.5px; font-weight: 700; }

/* ---------- average lots ---------- */
.lot-head, .lot { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-gap: 10px; gap: 10px; }
.lot-head { margin-bottom: 8px; color: var(--muted); font-size: 12.5px; font-weight: 700; }
.lot { padding: 12px 0; border-top: 1px solid var(--line); }
.lot:first-child { border-top: 0; padding-top: 0; }
.lot-meta { grid-column: 1 / -1; display: -webkit-box; display: flex; -webkit-box-align: center; align-items: center; margin-bottom: -2px; color: var(--muted); font-size: 12.5px; font-weight: 700; }
.lot-sum { margin-left: auto; margin-right: 10px; }
.lot-sum output { color: var(--ink); font-size: 14px; }
.lot .stepper { height: 48px; grid-template-columns: 38px minmax(0, 1fr) 38px; }
.lot .step-value input { font-size: 16px; }
.lot-del { -webkit-box-flex: 0; flex: none; width: 30px; height: 30px; padding: 0; color: var(--muted); background: transparent; border: 1px solid var(--line); border-radius: 50%; font-size: 16px; line-height: 1; }
@media (hover: hover) { .lot-del:hover { color: var(--red); border-color: var(--red); } }
.add-lot { width: 100%; margin-top: 12px; padding: 11px; color: var(--ink); background: transparent; border: 1px dashed var(--line-2); border-radius: 10px; font-size: 14px; font-weight: 700; }

/* ---------- ads ---------- */
.ad-slot { margin-top: 26px; text-align: center; }
.ad-slot:empty { display: none; }
.ad-a { min-height: 100px; }
.ad-b { min-height: 120px; margin: 24px 0; }
.ad-c { position: -webkit-sticky; position: sticky; top: 88px; min-height: 600px; margin: 0 0 20px; }

/* ---------- article ---------- */
.article { margin-top: 34px; padding: 30px 32px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
.article h2 { margin: 28px 0 12px; font-size: 21px; letter-spacing: -.03em; }
.article h2:first-child { margin-top: 0; }
.article p { margin: 0 0 12px; color: var(--text-2); font-size: 15px; line-height: 1.85; }
.formula { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-gap: 12px; gap: 12px; margin: 16px 0 6px; }
.formula div { padding: 14px 16px; background: var(--soft); border-radius: 10px; }
.formula span { color: var(--muted); font-size: 12px; }
.formula b { display: block; margin-top: 4px; font-size: 14.5px; }
.faq details { border-top: 1px solid var(--line); }
.faq details:last-child { border-bottom: 1px solid var(--line); }
.faq summary { position: relative; padding: 15px 30px 15px 0; font-size: 15px; font-weight: 700; list-style: none; cursor: pointer; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; top: 13px; right: 4px; color: var(--muted); font-size: 18px; font-weight: 400; }
.faq details[open] summary::after { content: "−"; }
.faq details p { margin: -4px 0 16px; }

.related { display: none; margin-top: 34px; }
.related h2 { margin: 0 0 14px; font-size: 17px; }
.related-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-gap: 12px; gap: 12px; }
.related-grid a { display: block; padding: 16px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; transition: border-color .15s, -webkit-transform .15s; transition: border-color .15s, transform .15s; }
.related-grid span { color: var(--green); font-size: 11px; font-weight: 800; }
.related-grid b { display: block; margin: 6px 0 3px; font-size: 15px; }
.related-grid small { color: var(--muted); font-size: 12px; }
@media (hover: hover) { .related-grid a:hover { border-color: var(--ink); -webkit-transform: translateY(-2px); transform: translateY(-2px); } .side-card a:hover b { color: var(--green); } }

.side-card { position: -webkit-sticky; position: sticky; top: 88px; padding: 18px 20px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
.ad-c:not(:empty) + .side-card { position: static; }
.side-card h2 { margin: 0 0 6px; font-size: 15px; }
.side-card a { display: block; padding: 11px 0; border-top: 1px solid var(--line); }
.side-card a:first-of-type { border-top: 0; }
.side-card b { display: block; font-size: 14.5px; }
.side-card small { color: var(--muted); font-size: 12px; }

.report-link { margin: 12px 4px 0; color: var(--muted); font-size: 13px; text-align: right; }
.report-link a { color: var(--green); font-weight: 700; }
.contact-form { display: grid; grid-gap: 18px; gap: 18px; margin-top: 18px; }
.contact-form textarea, .contact-form input[type=email] { width: 100%; padding: 12px 14px; color: var(--ink); background: var(--card); border: 1px solid var(--line-2); border-radius: 10px; outline: none; font-size: 16px; line-height: 1.6; }
.contact-form textarea { resize: vertical; min-height: 140px; }
.contact-form textarea:focus, .contact-form input[type=email]:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(19, 123, 91, .12); }
.field-error { margin: 6px 0 0; color: var(--up); font-size: 12.5px; font-weight: 700; }
.field-error[hidden] { display: none; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.contact-submit { justify-self: start; min-width: 140px; padding: 13px 24px; font-size: 15px; }
.contact-submit:disabled { opacity: .6; cursor: wait; }
.contact-note { margin: -6px 0 0 !important; font-size: 12.5px !important; }
.contact-done[hidden], .contact-form[hidden] { display: none; }
.footer { margin-top: 48px; padding: 26px 24px; color: rgba(255, 255, 255, .62); background: #071b1b; text-align: center; font-size: 12.5px; line-height: 1.8; }
.footer span { margin-left: 12px; white-space: nowrap; }
.footer a { color: rgba(255, 255, 255, .85); text-decoration: underline; text-underline-offset: 2px; }

/* ---------- settings modal ---------- */
.settings-modal { position: fixed; z-index: 50; top: 0; right: 0; bottom: 0; left: 0; display: -webkit-box; display: flex; -webkit-box-align: center; align-items: center; -webkit-box-pack: center; justify-content: center; padding: 16px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.settings-modal[hidden] { display: none; }
.settings-backdrop { position: fixed; top: 0; right: 0; bottom: 0; left: 0; background: rgba(3, 19, 18, .62); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.settings-dialog { position: relative; width: 100%; max-width: 460px; margin: auto; color: var(--ink); background: var(--paper); border: 1px solid var(--ink); border-radius: 14px; box-shadow: var(--shadow); outline: none; -webkit-animation: appear .2s ease; animation: appear .2s ease; }
.settings-dialog form { padding: 26px; }
.dialog-head { display: -webkit-box; display: flex; -webkit-box-pack: justify; justify-content: space-between; -webkit-box-align: start; align-items: flex-start; }
.dialog-head h2 { margin: 0; font-size: 22px; }
.dialog-close { width: 34px; height: 34px; padding: 0; background: transparent; border: 1px solid var(--line-2); border-radius: 50%; font-size: 17px; }
.dialog-sub { margin: 8px 0 18px; color: var(--muted); font-size: 13px; }
.dialog-field { display: block; margin-top: 14px; color: #44524f; font-size: 13px; font-weight: 700; }
.dialog-input { position: relative; display: block; margin-top: 7px; }
.dialog-input input { width: 100%; height: 48px; padding: 0 40px 0 14px; background: var(--card); border: 1px solid var(--line-2); border-radius: 10px; outline: none; font-size: 16px; font-weight: 700; }
.dialog-input input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(19, 123, 91, .12); }
.dialog-input .unit { position: absolute; top: 50%; right: 14px; color: var(--muted); font-size: 12px; font-weight: 500; -webkit-transform: translateY(-50%); transform: translateY(-50%); }
.presets { display: -webkit-box; display: flex; -ms-flex-wrap: wrap; flex-wrap: wrap; margin-top: 8px; }
.presets button { margin: 0 6px 6px 0; padding: 6px 12px; color: var(--text-2); background: var(--card); border: 1px solid var(--line-2); border-radius: 99px; font-size: 12.5px; font-weight: 700; }
.presets button.on { color: #fff; background: var(--ink); border-color: var(--ink); }
.dialog-actions { display: -webkit-box; display: flex; -webkit-box-pack: end; justify-content: flex-end; margin-top: 24px; }
.dialog-actions button + button { margin-left: 10px; }
.btn-secondary, .btn-primary { padding: 11px 18px; border-radius: 9px; font-size: 14px; font-weight: 700; }
.btn-secondary { background: var(--card); border: 1px solid var(--ink); }
.btn-primary { color: #fff; background: var(--ink); border: 1px solid var(--ink); }

.toast { position: fixed; z-index: 60; right: 24px; bottom: 24px; padding: 12px 18px; background: var(--mint); border: 1px solid var(--ink); border-radius: 8px; box-shadow: var(--shadow); font-size: 13px; font-weight: 700; opacity: 0; -webkit-transform: translateY(14px); transform: translateY(14px); pointer-events: none; transition: .25s; }
.toast.show { opacity: 1; -webkit-transform: none; transform: none; }
.mobile-result-bar { display: none; }

@-webkit-keyframes appear { from { opacity: 0; -webkit-transform: translateY(8px); } }
@keyframes appear { from { opacity: 0; transform: translateY(8px); } }

/* ---------- responsive ---------- */
@media (max-width: 1279px) {
  .page { display: block; max-width: 960px; }
  .side { display: none; }
  .related { display: block; }
}
@media (max-width: 1279px) {
  .nav { display: none; }
  .chips { display: -webkit-box; display: flex; padding: 10px 16px; overflow-x: auto; scrollbar-width: none; border-top: 1px solid var(--line); -webkit-overflow-scrolling: touch; }
  .chips::-webkit-scrollbar { display: none; }
  .chips a { -webkit-box-flex: 0; flex: none; margin-right: 8px; padding: 7px 13px; color: var(--text-2); background: var(--card); border: 1px solid var(--line); border-radius: 99px; font-size: 13.5px; font-weight: 700; white-space: nowrap; }
  .chips a.on { color: var(--ink); background: var(--mint); border-color: var(--ink); }
}
@media (max-width: 899px) {
  .calc { display: block; }
  .related-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stress { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
  html { scroll-padding-bottom: 96px; }
  .top-inner { height: 56px; padding: 0 16px; }
  .brand { font-size: 18px; }
  .brand-mark { width: 32px; height: 32px; border-radius: 9px; }
  .brand-text small { display: none; }
  .fee-chip { padding: 7px 11px; font-size: 12px; }
  .page { padding: 16px 16px 0; }
  .calc { border-radius: 14px; box-shadow: 5px 6px 0 #d8e1ce; }
  .inputs { padding: 18px 16px; grid-gap: 14px; gap: 14px; }
  .calc-head h1 { font-size: 23px; }
  .calc-head .sub { font-size: 12.5px; }
  .stepper { grid-template-columns: 34px minmax(0, 1fr) 34px; height: 54px; }
  .step-value input { padding-right: 20px; font-size: 16px; }
  .field:not(.wide) .step-value input.long { padding-right: 4px; padding-left: 4px; }
  .field:not(.wide) .step-value input.long + .unit { display: none; }
  .step-value .unit { right: 6px; }
  .field-label small { display: none; }
  .field-note { display: none; }
  /* 手機版單位移到標題後面，輸入框只放數字 */
  .label-unit { display: inline; }
  .step-value .unit { display: none; }
  .step-value input, .field:not(.wide) .step-value input.long { padding: 0 4px; }
  .field-label small[data-tick-hint] { display: inline; }
  .contact .field-label small { display: inline; }
  .result { padding: 22px 18px; }
  .result .big { font-size: 42px; }
  .card { padding: 18px 14px; }
  .card-head { display: block; }
  .card-head span { display: block; margin: 3px 0 0; }
  .book { grid-gap: 8px; gap: 8px; }
  .bhead, .lrow { padding: 0 10px; }
  .lrow { height: 40px; font-size: 13.5px; }
  .lot-head, .lot { grid-gap: 8px; gap: 8px; }
  .lot .stepper { grid-template-columns: 34px minmax(0, 1fr) 34px; }
  .article { padding: 22px 18px; }
  .article h2 { font-size: 19px; }
  .article p { font-size: 14.5px; }
  .formula { grid-template-columns: 1fr; }
  .related-grid { grid-template-columns: 1fr 1fr; }
  .footer { padding-bottom: 96px; }
  .footer span { display: block; margin: 0; }

  .mobile-result-bar { position: fixed; z-index: 30; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "label label icon" "value rate icon"; align-items: baseline; grid-column-gap: 10px; column-gap: 10px; padding: 10px 16px 12px; color: #fff; background: var(--ink); border: 1px solid rgba(185, 255, 102, .4); border-radius: 14px; box-shadow: 0 14px 34px rgba(12, 42, 42, .32); text-align: left; -webkit-animation: appear .2s ease; animation: appear .2s ease; }
  .mobile-result-bar[hidden] { display: none; }
  .mobile-result-bar.above-keyboard { bottom: 8px; }
  .mobile-result-bar span { grid-area: label; color: var(--on-dark-2); font-size: 12px; }
  .mobile-result-bar strong { grid-area: value; color: #fbf7ec; font-size: 24px; line-height: 1.15; letter-spacing: -.04em; white-space: nowrap; }
  .mobile-result-bar strong.up { color: var(--up-dark); }
  .mobile-result-bar strong.down { color: var(--down-dark); }
  .mobile-result-bar small { grid-area: rate; overflow: hidden; color: var(--on-dark-2); font-size: 12.5px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
  .mobile-result-bar i { grid-area: icon; align-self: center; display: grid; place-items: center; width: 36px; height: 36px; color: var(--ink); background: var(--mint); border-radius: 50%; font-style: normal; font-weight: 800; }
  .toast { right: 12px; bottom: calc(96px + env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { -webkit-animation-duration: .01ms !important; animation-duration: .01ms !important; transition-duration: .01ms !important; } }
