/* Shared styles for Payoff Ladder tool and guide pages */
:root {
  color-scheme: light;
  --bg: #edf1f5; --panel: #ffffff; --field: #f6f8fa;
  --ink: #14213a; --ink-2: #4d5a6e; --ink-3: #6b7789;
  --line: #d6dce4; --line-strong: #b9c2ce;
  --hero: #14213a; --hero-ink: #f3f6fa; --hero-ink-2: #b4c0d2; --hero-line: #2c3b57;
  --warn: #9a4a00; --warn-bg: #fff3e6; --good: #0b7a55;
  --focus: #257de0; --accent: #257de0; --accent-2: #f47230;
  --radius-lg: 18px; --radius-md: 10px; --radius-sm: 6px;
  --font: "Public Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0f1520; --panel: #18202c; --field: #111821;
    --ink: #e8edf3; --ink-2: #a8b3c2; --ink-3: #8794a6;
    --line: #2a3443; --line-strong: #3a4657;
    --hero: #1d2c47; --hero-ink: #f3f6fa; --hero-ink-2: #aab8cd; --hero-line: #2f4166;
    --warn: #ffb36b; --warn-bg: #33240f; --good: #4fd1a5;
    --focus: #6aabf1; --accent: #338ced; --accent-2: #e76624;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.55; font-variant-numeric: tabular-nums; }
a { color: inherit; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.wrap { max-width: 1140px; margin: 0 auto; padding: 0 20px; }

/* Header + tool nav */
.site-head { padding: 18px 0 6px; }
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -0.01em; text-decoration: none; font-size: 18px; }
.brand svg { width: 28px; height: 28px; }
.tool-nav { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; padding: 2px; }
.tool-nav::-webkit-scrollbar { display: none; }
.tool-nav a { flex: none; font-size: 14px; font-weight: 600; text-decoration: none; color: var(--ink-2); background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 7px 13px; white-space: nowrap; }
.tool-nav a:hover { color: var(--ink); border-color: var(--ink-2); }
.tool-nav a[aria-current="page"] { background: var(--ink); color: var(--panel); border-color: var(--ink); }

/* Intro */
.intro { padding: 22px 0 22px; max-width: 780px; }
.intro h1 { font-size: clamp(30px, 5vw, 50px); line-height: 1.05; letter-spacing: -0.035em; font-weight: 800; margin: 0 0 12px; }
.intro p { margin: 0; font-size: 18px; color: var(--ink-2); max-width: 62ch; }

/* Tool layout */
.tool { display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); gap: 20px; align-items: start; }
.sheet { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 24px; }
.sheet h2 { font-size: 20px; letter-spacing: -0.015em; margin: 0 0 4px; font-weight: 800; }
.hint { color: var(--ink-2); font-size: 14px; margin: 0 0 16px; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 14px; }
.fields .full { grid-column: 1 / -1; }
.f label, .f .lbl { display: block; font-size: 14px; font-weight: 700; margin-bottom: 5px; }
.f small { display: block; font-size: 12.5px; color: var(--ink-3); margin-top: 4px; }
.field { width: 100%; font: inherit; font-size: 16px; color: var(--ink); background: var(--field); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 9px 10px; min-height: 44px; }
.field:hover { border-color: var(--line-strong); }
.field:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 25%, transparent); background: var(--panel); }
.affix { position: relative; }
.affix .field { padding-left: 24px; }
.affix.pct .field, .affix.mo .field { padding-left: 10px; padding-right: 34px; }
.affix::before { position: absolute; top: 50%; transform: translateY(-50%); color: var(--ink-3); font-size: 15px; pointer-events: none; }
.affix.usd::before { content: "$"; left: 10px; }
.affix.pct::before { content: "%"; right: 10px; }
.affix.mo::before { content: "mo"; right: 10px; font-size: 13px; }
.seg { display: inline-flex; background: var(--field); border: 1px solid var(--line); border-radius: 999px; padding: 3px; gap: 2px; margin-bottom: 14px; flex-wrap: wrap; }
.seg button { font: inherit; font-size: 14px; font-weight: 600; color: var(--ink-2); background: none; border: 0; border-radius: 999px; padding: 8px 14px; cursor: pointer; min-height: 38px; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--panel); }
.warnbox { font-size: 14px; color: var(--warn); background: var(--warn-bg); border-radius: var(--radius-sm); padding: 8px 12px; margin-top: 14px; }
.warnbox:empty { display: none; }

/* Result panel */
.result { background: var(--hero); color: var(--hero-ink); border-radius: var(--radius-lg); padding: 24px; position: sticky; top: 16px; }
.result .lead { font-size: 15px; color: var(--hero-ink-2); margin: 0; }
.result .big { font-size: clamp(38px, 5vw, 54px); font-weight: 800; letter-spacing: -0.04em; line-height: 1; margin: 8px 0 10px; }
.result .sub { margin: 0 0 16px; color: var(--hero-ink-2); font-size: 15px; }
.result .sub strong { color: var(--hero-ink); font-weight: 600; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--hero-line); border-radius: var(--radius-md); overflow: hidden; margin: 0; }
.stat { background: var(--hero); padding: 12px 14px; }
.stat dt { font-size: 13px; color: var(--hero-ink-2); }
.stat dd { margin: 2px 0 0; font-size: 21px; font-weight: 800; letter-spacing: -0.02em; }
.result table { width: 100%; border-collapse: collapse; margin-top: 16px; font-size: 14px; }
.result caption { text-align: left; font-weight: 600; font-size: 14px; color: var(--hero-ink-2); padding-bottom: 6px; }
.result th, .result td { text-align: right; padding: 7px 0 7px 8px; border-top: 1px solid var(--hero-line); }
.result th:first-child, .result td:first-child { text-align: left; padding-left: 0; }
.result thead th { font-weight: 500; color: var(--hero-ink-2); font-size: 12.5px; border-top: 0; }
.result tr.pick td, .result tr.pick th { color: var(--hero-ink); font-weight: 700; }
.result tr:not(.pick) td { color: var(--hero-ink-2); }
.verdict { margin: 14px 0 0; font-size: 14.5px; }
.verdict strong { color: var(--hero-ink); }
.result .cta { display: inline-block; margin-top: 16px; font-size: 14px; font-weight: 600; color: var(--hero-ink); border: 1px solid var(--hero-line); border-radius: 999px; padding: 7px 14px; text-decoration: none; }
.result .cta:hover { border-color: var(--hero-ink-2); }

/* Article */
.article { max-width: 760px; margin: 48px 0 0; }
.article h2 { font-size: clamp(24px, 3vw, 30px); letter-spacing: -0.025em; line-height: 1.15; margin: 44px 0 12px; font-weight: 800; }
.article h3 { font-size: 19px; letter-spacing: -0.01em; margin: 26px 0 6px; }
.article p, .article li { font-size: 17px; line-height: 1.7; }
.article p { margin: 0 0 14px; }
.article ul, .article ol { padding-left: 22px; margin: 0 0 14px; }
.article li { margin-bottom: 6px; }
.article .note { color: var(--ink-2); font-size: 15px; }
.article table { width: 100%; border-collapse: collapse; margin: 8px 0 18px; font-size: 15px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; }
.article th, .article td { text-align: right; padding: 9px 12px; border-bottom: 1px solid var(--line); }
.article th:first-child, .article td:first-child { text-align: left; }
.article thead th { background: var(--field); font-size: 13px; color: var(--ink-2); }
.table-scroll { overflow-x: auto; }
.callout { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--radius-md); padding: 14px 18px; margin: 18px 0; }
.callout p:last-child { margin-bottom: 0; }
.faq details { border-top: 1px solid var(--line); padding: 14px 0; }
.faq details:last-child { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; font-weight: 700; font-size: 17px; }
.faq details p { margin: 10px 0 2px; color: var(--ink-2); }
.byline { color: var(--ink-3); font-size: 14px; margin: -4px 0 18px; }

/* Related tools */
.related { margin: 56px 0 0; }
.related h2 { font-size: 22px; letter-spacing: -0.02em; margin: 0 0 12px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.card { display: block; text-decoration: none; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 16px 18px; }
.card:hover { border-color: var(--ink-2); }
.card b { display: block; font-size: 16px; margin-bottom: 4px; }
.card span { display: block; font-size: 14px; color: var(--ink-2); }

/* Ads: invisible until an ad unit is pasted inside */
.ad-slot { margin: 28px auto; text-align: center; min-height: 100px; }
.ad-slot:empty { display: none; }

footer { margin-top: 72px; border-top: 1px solid var(--line); padding: 28px 0 40px; color: var(--ink-2); font-size: 14px; }
footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; }
footer nav { display: flex; flex-wrap: wrap; gap: 8px 18px; }
footer p { margin: 0; max-width: 62ch; }

@media (max-width: 900px) {
  .tool { grid-template-columns: 1fr; }
  .result { position: static; }
}
@media (max-width: 600px) {
  .wrap { padding: 0 14px; }
  .sheet { padding: 18px; border-radius: 14px; }
  .fields { grid-template-columns: 1fr; }
  .intro h1 { font-size: 30px; }
  .intro p { font-size: 16px; }
  .article p, .article li { font-size: 16px; }
  .article th, .article td { padding: 8px 8px; font-size: 14px; }
}
@media print {
  .site-head .tool-nav, .ad-slot, .related, footer nav { display: none !important; }
  body { background: #fff; }
  .result, .result * { background: #fff !important; color: #000 !important; border-color: #999 !important; }
}

/* Mobile: result pinned to the bottom while the result panel is off screen */
.dock { display: none; }
@media (max-width: 900px) {
  .dock {
    position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 6;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    background: var(--hero); color: var(--hero-ink); border-radius: 14px; padding: 10px 10px 10px 16px;
    box-shadow: 0 8px 28px rgba(10, 16, 28, 0.28); transition: transform .2s ease, opacity .2s ease;
  }
  .dock.off { transform: translateY(140%); opacity: 0; pointer-events: none; }
  .dock-txt { min-width: 0; line-height: 1.25; }
  .dock-l { display: block; font-size: 12.5px; color: var(--hero-ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .dock strong { display: block; font-size: 20px; font-weight: 800; letter-spacing: -0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .dock button { flex: none; font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; border: 0; background: var(--hero-ink); color: var(--hero); border-radius: 999px; padding: 10px 16px; min-height: 42px; }
  html { scroll-padding-bottom: 96px; }
  body { padding-bottom: 84px; }
  .result { scroll-margin-top: 16px; }
}
@media print { .dock { display: none !important; } }
