/* Point Buy Calculator. Design notes in DESIGN.md. */

@font-face {
  font-family: "Alegreya";
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url("/fonts/alegreya-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Alegreya Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/alegreya-sans-400-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Alegreya Sans";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/fonts/alegreya-sans-700-latin.woff2") format("woff2");
}

:root {
  --shell: #4a1d2b;
  --on-shell: #f6ece6;
  --on-shell-muted: #dcc7c3;
  --bg: #f6f2ea;
  --surface: #fffdf9;
  --surface-2: #efe8dc;
  --line: #e2d8c8;
  --line-strong: #c9baa3;
  --ink: #24161b;
  --text: #3b2c30;
  --muted: #6d5a5e;
  --accent: #8a2b3e;
  --accent-hover: #74202f;
  --on-accent: #ffffff;
  --accent-soft: #f3e1e2;
  --warn: #9a4a00;
  --empty-cell: #e9e1d4;
  --str: #b4532a;
  --dex: #2f7d6d;
  --con: #9b6d12;
  --int: #3d62a8;
  --wis: #5b7f2a;
  --cha: #8b3f8f;
  --shadow: 0 1px 2px rgb(36 22 27 / 0.06), 0 8px 24px -12px rgb(36 22 27 / 0.18);

  --serif: "Alegreya", Georgia, "Times New Roman", serif;
  --sans: "Alegreya Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 12px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --shell: #2a1219; --on-shell: #f4ece4; --on-shell-muted: #cdb9b4;
    --bg: #171214; --surface: #211a1d; --surface-2: #2a2125;
    --line: #3a2e33; --line-strong: #54454b;
    --ink: #f4ece4; --text: #ddd1ca; --muted: #b3a39f;
    --accent: #ec9aa8; --accent-hover: #f4b6c0; --on-accent: #171214; --accent-soft: #3b2229;
    --warn: #f0a860; --empty-cell: #322a2e;
    --str: #e08a5c; --dex: #5cc0aa; --con: #d9a640; --int: #86a6ea; --wis: #9cc35e; --cha: #cf8ad2;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 10px 28px -12px rgb(0 0 0 / 0.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --shell: #2a1219; --on-shell: #f4ece4; --on-shell-muted: #cdb9b4;
  --bg: #171214; --surface: #211a1d; --surface-2: #2a2125;
  --line: #3a2e33; --line-strong: #54454b;
  --ink: #f4ece4; --text: #ddd1ca; --muted: #b3a39f;
  --accent: #ec9aa8; --accent-hover: #f4b6c0; --on-accent: #171214; --accent-soft: #3b2229;
  --warn: #f0a860; --empty-cell: #322a2e;
  --str: #e08a5c; --dex: #5cc0aa; --con: #d9a640; --int: #86a6ea; --wis: #9cc35e; --cha: #cf8ad2;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 10px 28px -12px rgb(0 0 0 / 0.6);
  color-scheme: dark;
}

/* ---------- base ---------- */
[hidden] { display: none !important; }
html { scroll-padding-top: 16px; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
main { flex: 1; }
::selection { background: var(--accent); color: var(--on-accent); }
p, li { text-wrap: pretty; }
h1, h2, h3 { font-family: var(--serif); color: var(--ink); line-height: 1.15; font-weight: 600; text-wrap: balance; }
h1 { font-size: clamp(2rem, 1.4rem + 2.4vw, 2.75rem); letter-spacing: -0.015em; }
h2 { font-size: clamp(1.5rem, 1.25rem + 1vw, 1.875rem); letter-spacing: -0.01em; }
h3 { font-size: 1.2rem; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); text-decoration-thickness: 2px; }
strong { color: var(--ink); font-weight: 700; }
abbr[title] { text-decoration: none; cursor: help; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
input, select, button { accent-color: var(--accent); }
a, button, select, input, summary, label { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }

.wrap { width: min(1120px, 100% - 32px); margin-inline: auto; }
.skip-link { position: absolute; left: 12px; top: -60px; background: var(--surface); color: var(--ink); padding: 10px 14px; border-radius: 8px; z-index: 10; box-shadow: var(--shadow); }
.skip-link:focus { top: 12px; }

.icon { width: 18px; height: 18px; flex: none; }

/* ---------- header ---------- */
.site-header { background: var(--shell); color: var(--on-shell); }
.site-header .wrap { display: flex; align-items: center; gap: 12px 24px; min-height: 64px; flex-wrap: wrap; padding-block: 8px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--on-shell); text-decoration: none; font-family: var(--serif); font-weight: 700; font-size: 1.2rem; letter-spacing: -0.005em; }
.brand:hover { color: var(--on-shell); }
.brand .mark { width: 26px; height: 26px; }
.nav { display: flex; gap: 4px 18px; flex-wrap: wrap; margin-inline-start: auto; }
.nav a { color: var(--on-shell-muted); text-decoration: none; font-weight: 700; font-size: 0.95rem; padding-block: 6px; border-bottom: 2px solid transparent; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--on-shell); border-bottom-color: currentColor; }
.site-header :focus-visible, .site-footer :focus-visible { outline-color: var(--on-shell); }

.theme-toggle { display: inline-flex; padding: 3px; border-radius: 999px; background: rgb(255 255 255 / 0.08); border: 1px solid rgb(255 255 255 / 0.14); }
.theme-toggle button { display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 999px; background: transparent; color: var(--on-shell-muted); cursor: pointer; }
.theme-toggle button:hover { color: var(--on-shell); }
.theme-toggle button[aria-pressed="true"] { background: var(--on-shell); color: var(--shell); }
.theme-toggle .icon { width: 16px; height: 16px; }

/* ---------- intro ---------- */
.intro { padding-block: 40px 20px; }
.intro .lede { max-width: 62ch; margin-top: 12px; font-size: 1.15rem; color: var(--text); }
.updated { margin-top: 8px; font-size: 0.9rem; color: var(--muted); }

/* ---------- tool ---------- */
.tool { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 20px; margin-bottom: 56px; }
.tool:focus { outline: none; }
.tool:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.tool-bar { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: center; justify-content: space-between; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.system-label { font-family: var(--serif); font-weight: 600; font-size: 1.15rem; color: var(--ink); }

.seg { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; color: var(--text); font-weight: 700; font-size: 0.95rem; padding: 8px 14px; border-radius: 8px; cursor: pointer; min-height: 38px; }
.seg button:hover { color: var(--ink); background: rgb(127 127 127 / 0.08); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--accent); box-shadow: 0 1px 2px rgb(0 0 0 / 0.12), 0 0 0 1px var(--line); }

.tool-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; padding-top: 18px; align-items: start; }

/* ability rows */
.sheet-head, .row { display: grid; grid-template-columns: minmax(130px, 1.4fr) 136px 52px 64px 64px 64px; align-items: center; gap: 8px; }
.tool:not([data-method="pb"]) :is(.sheet-head, .row) { grid-template-columns: minmax(130px, 1.4fr) 136px 64px 64px 64px; }
.sheet-head { padding: 0 12px 8px; font-size: 0.8rem; font-weight: 700; color: var(--muted); letter-spacing: 0.02em; }
.sheet-head span:not(:first-child) { text-align: center; }
.rows { list-style: none; padding: 0; display: grid; gap: 6px; }
.row { --ab: var(--muted); padding: 10px 12px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid transparent; transition: border-color 0.2s ease; }
.row[data-ab="str"] { --ab: var(--str); }
.row[data-ab="dex"] { --ab: var(--dex); }
.row[data-ab="con"] { --ab: var(--con); }
.row[data-ab="int"] { --ab: var(--int); }
.row[data-ab="wis"] { --ab: var(--wis); }
.row[data-ab="cha"] { --ab: var(--cha); }
.row.capped { border-color: var(--warn); }
.ab { display: flex; align-items: center; gap: 10px; min-width: 0; }
.swatch { width: 12px; height: 12px; border-radius: 3px; background: var(--ab); flex: none; }
.ab-name { font-weight: 700; color: var(--ink); }
.ab-short { font-size: 0.78rem; font-weight: 700; color: var(--muted); letter-spacing: 0.04em; }

.cell-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.base { display: flex; justify-content: center; }
.stepper { display: inline-flex; align-items: center; gap: 4px; }
.stepper[hidden] { display: none; }
.step { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); cursor: pointer; transition: background-color 0.15s ease, border-color 0.15s ease; }
.step:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.step:active:not(:disabled) { transform: translateY(1px); }
.step:disabled { opacity: 0.5; border-style: dashed; cursor: not-allowed; }
.base-val { width: 40px; text-align: center; font-family: var(--serif); font-weight: 700; font-size: 1.35rem; color: var(--ink); font-variant-numeric: lining-nums tabular-nums; }
.pick { width: 100%; max-width: 120px; min-height: 40px; padding: 6px 30px 6px 12px; font-family: var(--serif); font-weight: 700; font-size: 1.2rem; font-variant-numeric: lining-nums tabular-nums; }

.cost, .bonus, .final, .mod { text-align: center; font-variant-numeric: lining-nums tabular-nums; }
.cost { color: var(--muted); font-weight: 700; }
.bonus { color: var(--muted); }
.bonus.has .bonus-val { display: inline-block; min-width: 36px; padding: 1px 8px; border-radius: 999px; border: 1.5px solid var(--ab); color: var(--ink); font-weight: 700; }
.bonus.neg .bonus-val { border-style: dashed; }
.final { font-family: var(--serif); font-weight: 700; font-size: 1.6rem; color: var(--ink); line-height: 1; }
.mod-val { display: inline-block; min-width: 46px; font-family: var(--serif); font-weight: 700; font-size: 1.2rem; color: var(--muted); }
.cost[hidden] { display: none; }

.status { min-height: 1.6em; margin-top: 10px; font-size: 0.95rem; color: var(--muted); }

/* panel */
.panel { position: sticky; top: 16px; display: grid; gap: 18px; padding: 18px; border-radius: var(--radius); background: var(--bg); }
.left { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.left-num, .modtotal-num { font-family: var(--serif); font-weight: 700; font-size: 3rem; line-height: 1; color: var(--ink); font-variant-numeric: lining-nums tabular-nums; }
.left-label { color: var(--muted); font-weight: 700; }
.purse.done .left-num { color: var(--accent); }
.purse.over .left-num { color: var(--warn); }
.strip-wrap { margin-top: 12px; }
.strip { display: grid; grid-template-columns: repeat(var(--cells), minmax(0, 1fr)); gap: 3px; }
.strip i { display: block; height: 22px; border-radius: 3px; background: var(--empty-cell); transition: background-color 0.18s cubic-bezier(0.22, 1, 0.36, 1); }
.strip i.on[data-ab="str"] { background: var(--str); }
.strip i.on[data-ab="dex"] { background: var(--dex); }
.strip i.on[data-ab="con"] { background: var(--con); }
.strip i.on[data-ab="int"] { background: var(--int); }
.strip i.on[data-ab="wis"] { background: var(--wis); }
.strip i.on[data-ab="cha"] { background: var(--cha); }
.warn { margin-top: 10px; color: var(--warn); font-weight: 700; font-size: 0.95rem; }
.hint { font-size: 0.88rem; color: var(--muted); margin-top: 4px; }
.totals .hint { margin-top: 8px; }

.panel-title { font-size: 1.15rem; margin-bottom: 2px; }
.bonuses { display: grid; gap: 12px; }
.field { display: grid; gap: 4px; border: 0; padding: 0; min-width: 0; }
.label { font-size: 0.82rem; font-weight: 700; color: var(--muted); letter-spacing: 0.02em; padding: 0; }
select, input[type="text"], input[type="number"] {
  width: 100%; min-height: 42px; padding: 8px 12px; border-radius: 10px;
  border: 1px solid var(--line-strong); background-color: var(--surface); color: var(--ink);
}
select {
  appearance: none; padding-right: 34px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%;
  background-size: 5px 5px; background-repeat: no-repeat;
}
select:hover, input:hover { border-color: var(--accent); }
input[aria-invalid="true"] { border-color: var(--warn); }
input::placeholder { color: var(--muted); opacity: 1; }
.radios { display: flex; gap: 6px; flex-wrap: wrap; }
.radios label { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; font-weight: 700; color: var(--ink); font-variant-numeric: lining-nums; }
.radios label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.radios input { margin: 0; }
.inline { display: flex; gap: 8px; }

.house summary { cursor: pointer; font-weight: 700; color: var(--accent); list-style-position: inside; }
.house[open] summary { margin-bottom: 8px; }

.roll-box { display: grid; gap: 12px; }
.dice-list { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.dice-list:empty { display: none; }
.dice-list li { display: grid; gap: 2px; padding: 6px 8px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); text-align: center; }
.roll-total { font-family: var(--serif); font-weight: 700; font-size: 1.2rem; color: var(--ink); font-variant-numeric: lining-nums tabular-nums; }
.dice { display: flex; justify-content: center; gap: 5px; font-size: 0.82rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.dice s { opacity: 0.7; }

.actions { display: grid; gap: 8px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 16px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font-weight: 700; cursor: pointer; text-decoration: none; transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease; }
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { border-color: var(--line-strong); color: var(--ink); }

.fan-note { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 0.88rem; color: var(--muted); }

/* ---------- content ---------- */
.content { max-width: 60ch; padding-bottom: 64px; }
.content > section + section { margin-top: 52px; }
.content h2 { margin-bottom: 14px; }
.content p + p, .content p + ul, .content ul + p, .content .table-wrap + p, .content p + .table-wrap, .content ul + .note { margin-top: 14px; }
.content ul, .content ol:not(.steps):not(.related) { padding-left: 1.25em; }
.content li + li { margin-top: 8px; }
.content li::marker { color: var(--accent); }

.steps { list-style: none; padding: 0; counter-reset: step; display: grid; gap: 12px; }
.steps li { counter-increment: step; position: relative; padding: 2px 0 2px 52px; margin: 0; }
.steps li + li { margin-top: 0; }
.steps li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-family: var(--serif); font-weight: 700; font-size: 1.15rem; font-variant-numeric: lining-nums; }
.steps h3 { margin-bottom: 2px; }

.band { padding: 28px; border-radius: 16px; background: var(--surface-2); margin-inline: -28px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.table-wrap.tall { max-height: 560px; overflow-y: auto; }
table.data { width: 100%; border-collapse: collapse; font-variant-numeric: lining-nums tabular-nums; }
table.data caption { text-align: left; padding: 12px 14px 4px; font-weight: 700; color: var(--muted); font-size: 0.88rem; }
table.data th, table.data td { padding: 9px 14px; text-align: left; border-top: 1px solid var(--line); }
table.data thead th { border-top: 0; font-size: 0.85rem; color: var(--muted); font-weight: 700; position: sticky; top: 0; background: var(--surface); }
table.data tbody th { color: var(--ink); font-weight: 700; }
table.data td.hi { color: var(--accent); font-weight: 700; }
.class-table th, .class-table td { text-align: center; }
.class-table tbody th, .class-table thead th:first-child { text-align: left; }
.arrays td.nums { font-family: var(--serif); font-weight: 600; font-size: 1.05rem; color: var(--ink); word-spacing: 0.15em; }
.load { font-weight: 700; }

.related { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.related li + li { margin-top: 0; }
.related a { display: grid; gap: 2px; height: 100%; padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); text-decoration: none; color: var(--text); transition: border-color 0.15s ease, transform 0.15s ease; }
.related a:hover { border-color: var(--accent); transform: translateY(-1px); }
.rel-title { font-family: var(--serif); font-weight: 700; font-size: 1.1rem; color: var(--ink); }
.rel-blurb { font-size: 0.92rem; color: var(--muted); }

.faq details { border-top: 1px solid var(--line); }
.faq details:last-of-type { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; padding: 16px 36px 16px 0; font-weight: 700; color: var(--ink); list-style: none; position: relative; font-size: 1.05rem; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: ""; position: absolute; right: 6px; top: 50%; width: 10px; height: 10px; border-right: 2px solid var(--accent); border-bottom: 2px solid var(--accent); transform: translateY(-70%) rotate(45deg); transition: transform 0.2s ease; }
.faq details[open] summary::after { transform: translateY(-30%) rotate(-135deg); }
.faq details p { padding-bottom: 18px; margin-top: -4px; }

.legal article { padding-block: 40px 16px; }
.legal article h1 { margin-bottom: 8px; }
.legal article h2 { margin-top: 36px; margin-bottom: 8px; font-size: 1.4rem; }
.legal article p + p, .legal article ul { margin-top: 12px; }
.legal article ul { padding-left: 1.25em; }
.notfound { padding-block: 56px; }
.notfound p { margin-block: 12px 24px; }

/* ---------- footer ---------- */
.site-footer { background: var(--shell); color: var(--on-shell-muted); font-size: 0.92rem; }
.site-footer .wrap { display: grid; grid-template-columns: 1fr auto; gap: 20px 32px; padding-block: 36px; }
.site-footer a { color: var(--on-shell); }
.site-footer .brand { font-size: 1.1rem; margin-bottom: 8px; }
.foot-main p + p { margin-top: 6px; }
.site-footer nav { display: flex; gap: 18px; align-items: flex-start; }
.credits { grid-column: 1 / -1; max-width: 96ch; padding-top: 20px; border-top: 1px solid rgb(255 255 255 / 0.14); font-size: 0.82rem; line-height: 1.55; display: grid; gap: 8px; overflow-wrap: anywhere; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 16px); opacity: 0; pointer-events: none; padding: 12px 18px; border-radius: 10px; background: var(--ink); color: var(--bg); font-weight: 700; box-shadow: var(--shadow); transition: opacity 0.2s ease, transform 0.3s cubic-bezier(0.22, 1, 0.36, 1); z-index: 20; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast { display: flex; align-items: center; gap: 14px; }
.toast button { border: 0; background: transparent; color: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; padding: 6px 4px; min-height: 36px; }
.toast button:focus-visible { outline-color: var(--bg); }

/* ---------- responsive ---------- */
/* Bigger tap targets on touch screens. */
@media (pointer: coarse) {
  .nav a, .site-footer nav a { display: inline-flex; align-items: center; min-height: 44px; }
  .theme-toggle button { width: 44px; height: 44px; }
  .brand { min-height: 44px; }
  .house summary { display: flex; align-items: center; min-height: 44px; }
  a.load { display: inline-flex; align-items: center; min-height: 44px; padding-inline: 8px; }
}

@media (max-width: 960px) {
  .tool-grid { grid-template-columns: 1fr; }
  .panel { position: static; }
}

@media (max-width: 640px) {
  html { scroll-padding-top: 120px; }
  .site-header .wrap { min-height: 0; padding-block: 12px; }
  .nav { order: 3; width: 100%; margin: 0; gap: 2px 14px; }
  .nav a { font-size: 0.9rem; padding-block: 4px; }
  .theme-toggle { margin-inline-start: auto; }
  .intro { padding-block: 28px 16px; }
  .intro .lede { font-size: 1.05rem; }
  .tool { padding: 14px; border-radius: 14px; margin-inline: auto; }
  .tool-bar { flex-direction: column; align-items: stretch; }
  .seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; }
  .seg button { padding: 8px 4px; min-height: 44px; font-size: 0.9rem; white-space: nowrap; }
  .sheet-head { display: none; }
  /* Points left stays in view while you work through the rows. */
  .tool-grid { display: flex; flex-direction: column; align-items: stretch; gap: 16px; }
  .sheet { display: contents; }
  .panel { display: contents; }
  .purse, .totals { order: -1; position: sticky; top: 0; z-index: 2; margin: 0 -14px; padding: 12px 14px; background: var(--surface); border-bottom: 1px solid var(--line); }
  .purse .left-num, .totals .modtotal-num { font-size: 2.2rem; }
  .strip-wrap { margin-top: 8px; }
  .strip i { height: 16px; }
  .totals .hint { display: none; }
  .tool .row, .tool:not([data-method="pb"]) .row {
    grid-template-columns: minmax(124px, 1fr) 52px 84px;
    grid-template-areas: "ab final mod" "base cost bonus";
    gap: 10px 8px;
  }
  .base-val { width: 32px; }
  .ab { grid-area: ab; }
  .ab-short { display: none; }
  .base { grid-area: base; justify-content: flex-start; }
  .cost { grid-area: cost; }
  .bonus { grid-area: bonus; }
  .final { grid-area: final; }
  .mod { grid-area: mod; text-align: right; }
  .bonus { text-align: right; }
  .cost .cell-label, .bonus .cell-label { position: static; width: auto; height: auto; clip: auto; font-size: 0.8rem; font-weight: 700; color: var(--muted); }
  .step { width: 44px; height: 44px; }
  .roll-box, .bonuses, .class-field, .house, .actions, .status { order: 2; }
  .actions { grid-template-columns: 1fr 1fr; }
  .actions .btn-primary { grid-column: 1 / -1; }
  .band { margin-inline: 0; padding: 20px 16px; }
  .site-footer .wrap { grid-template-columns: 1fr; }
}

@media (max-width: 359px) {
  .tool { padding: 10px; }
  .row { padding: 10px 8px; }
  .tool .row, .tool:not([data-method="pb"]) .row { grid-template-columns: minmax(124px, 1fr) 36px 56px; }
  .cost .cell-label, .bonus .cell-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .purse, .totals { margin: 0 -10px; padding: 10px; }
}

@media print {
  .site-header, .site-footer, .tool-bar, .actions, .panel .bonuses, .class-field, .house, .skip-link, .toast { display: none !important; }
  body { background: #fff; color: #000; }
  .tool { box-shadow: none; border: 0; }
}
