/* Abarax Companion — the Inked Chronicle (World Bible D-141, D-142).
   Ink laid on in masses, paper left to do the work of light, one flat pigment
   per kind of thing. No rounded corners, shadows or gradients: an edge is
   either cut clean or lifted by a brush. */

@font-face { font-family: "Schola"; src: url("./schola-regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Schola"; src: url("./schola-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Schola"; src: url("./schola-bold.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }

:root {
  /* The pigment kit from the campaign's visual language. */
  --ink: #272925; --parchment: #EEE5D2; --highlight: #F8F2E7; --stone: #969385;
  --oxide: #A0443B; --sea: #456269; --moss: #5B6651; --indigo: #444F68; --brass: #B39463;

  --ground: var(--parchment); --text: var(--ink); --raise: var(--highlight);
  --mass: var(--ink); --on-mass: var(--highlight); --on-mass-quiet: #C9C1AE;
  --quiet: #5B584E; --hair: #BDB49E; --link: #8F3A32; --focus: #2F6E7C;
  --serif: "Schola", "Century Schoolbook", "New Century Schoolbook", Georgia, serif;
  --measure: 44rem;
  --cut: polygon(0 0, calc(100% - 9px) 0, 100% 9px, 100% 100%, 7px 100%, 0 calc(100% - 7px));
  --cut-small: polygon(0 0, calc(100% - 5px) 0, 100% 5px, 100% 100%, 4px 100%, 0 calc(100% - 4px));
  color-scheme: light;
}
:root[data-theme="ink"] {
  --ground: #1E201D; --text: #E9E0CC; --raise: #2B2D29;
  --mass: #111210; --on-mass: #EEE5D2; --on-mass-quiet: #A9A290;
  --quiet: #ACA592; --hair: #4A4C45; --link: #E0958B; --focus: #8CC3CF;
  --oxide: #A5473D; --sea: #4A6C74; --moss: #5F6C55; --indigo: #505C79;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 5rem; }
body {
  margin: 0; background: var(--ground); color: var(--text);
  font: 400 1.0625rem/1.62 var(--serif); font-variant-numeric: lining-nums;
  text-rendering: optimizeLegibility; overflow-wrap: break-word;
}
h1, h2, h3, h4, h5, h6 { font-weight: 700; line-height: 1.18; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(1.8rem, 6.2vw, 2.5rem); letter-spacing: -0.012em; }
h2 { font-size: 1.4rem; margin-top: 2.2rem; }
h3 { font-size: 1.14rem; margin-top: 1.7rem; }
h4, h5, h6 { font-size: 1rem; margin-top: 1.3rem; }
p, ul, ol, dl, table { margin: 0.75rem 0 0; }
ul, ol { padding-left: 1.3rem; }
li + li { margin-top: 0.3rem; }
a { color: var(--link); text-decoration-thickness: 0.07em; text-underline-offset: 0.16em; }
a:hover { text-decoration-thickness: 0.14em; }
strong, b { font-weight: 700; }
small { font-size: 0.86rem; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.86em; overflow-wrap: anywhere; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
#main:focus { outline: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: 0.5rem; top: -4rem; z-index: 30; background: var(--mass); color: var(--on-mass); padding: 0.6rem 0.9rem; }
.skip:focus { top: 0.5rem; }

/* ——— The band: one mass of ink across the head of the page ——— */
.band {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 0.75rem;
  background: var(--mass); color: var(--on-mass); padding: 0.55rem 1.1rem 0.5rem; min-height: 3.2rem;
  padding-top: max(0.55rem, env(safe-area-inset-top));
}
.band::after {
  content: ""; position: absolute; left: 0; right: 0; top: calc(100% - 1px); height: 20px; background: var(--mass);
  -webkit-mask: url("./ink-edge.svg") 0 0 / 1200px 20px repeat-x; mask: url("./ink-edge.svg") 0 0 / 1200px 20px repeat-x;
  pointer-events: none;
}
.brand { color: var(--on-mass); text-decoration: none; line-height: 1; margin-right: auto; display: flex; align-items: baseline; gap: 0.4rem; }
.brand-name { font-weight: 700; font-size: 1.32rem; letter-spacing: 0.01em; }
.brand-sub { font-size: 0.9rem; font-style: italic; color: var(--brass); }
.band-tools { display: flex; align-items: center; gap: 0.15rem; }
.band a.find, .band .plain {
  color: var(--on-mass); font: inherit; font-size: 0.95rem; background: none; border: 0; padding: 0.45rem 0.6rem; min-height: 2.75rem;
  text-decoration: none; cursor: pointer; display: inline-flex; align-items: center;
}
.band a.find { font-weight: 700; }
.band a.find:hover, .band .plain:hover { text-decoration: underline; text-underline-offset: 0.2em; }
.band :focus-visible { outline-color: var(--brass); }

/* Section tabs: along the foot on a phone, in the band on a wide screen. */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--mass); padding: 0.3rem 0.4rem max(0.35rem, env(safe-area-inset-bottom));
}
.tabs::before {
  content: ""; position: absolute; left: 0; right: 0; bottom: calc(100% - 1px); height: 16px; background: var(--mass);
  -webkit-mask: url("./ink-edge-up.svg") 0 0 / 1100px 16px repeat-x; mask: url("./ink-edge-up.svg") 0 0 / 1100px 16px repeat-x;
  pointer-events: none;
}
.tabs a {
  color: var(--on-mass-quiet); text-decoration: none; text-align: center; font-size: 0.95rem; font-weight: 700;
  padding: 0.62rem 0.2rem; min-height: 2.75rem; display: grid; place-items: center;
}
.tabs a[aria-current="page"] { background: var(--parchment); color: var(--ink); clip-path: var(--cut); }
.tabs a:hover:not([aria-current]) { color: var(--on-mass); }

#main { max-width: var(--measure); margin: 0 auto; padding: 2rem 1.15rem 7.5rem; }
.loading { color: var(--quiet); font-style: italic; }
.notice { background: var(--oxide); color: var(--highlight); padding: 0.7rem 0.9rem; margin: 0 0 1.2rem; clip-path: var(--cut); }
.notice button { margin-left: 0.6rem; }
#update-status { background: var(--sea); }
.colophon {
  margin-top: 4rem; padding-top: 1.1rem; position: relative; display: flex; flex-wrap: wrap; gap: 0.3rem 1.2rem;
  font-size: 0.86rem; color: var(--quiet);
}
.colophon::before, .rule {
  content: ""; display: block; position: absolute; left: 0; top: 0; width: 100%; height: 5px; background: var(--text);
  -webkit-mask: url("./ink-rule.svg") 0 0 / 100% 100% no-repeat; mask: url("./ink-rule.svg") 0 0 / 100% 100% no-repeat; opacity: 0.8;
}
.colophon a { color: inherit; }
.colophon button.link { font-size: inherit; font-weight: 400; color: inherit; padding: 0; min-height: 0; text-decoration: underline; text-underline-offset: 0.16em; }
.colophon button.link:hover { background: none; color: var(--text); }

/* ——— Titles ——— */
.page-head { margin-bottom: 1.5rem; }
.page-head h1, .entry h1, article > h1, #content > h1 { position: relative; padding-bottom: 0.7rem; }
.page-head h1::after, .entry h1::after, article > h1::after, #content > h1::after {
  content: ""; position: absolute; left: -0.2rem; bottom: 0; width: min(15rem, 72%); height: 11px; background: var(--text);
  -webkit-mask: url("./ink-stroke.svg") 0 0 / 100% 100% no-repeat; mask: url("./ink-stroke.svg") 0 0 / 100% 100% no-repeat;
}
.lede, .page-intro { font-size: 1.12rem; line-height: 1.5; color: var(--quiet); margin-top: 0.8rem; max-width: 36rem; }
.metadata, .context, .count { color: var(--quiet); font-size: 0.9rem; margin-top: 0.3rem; }
.crumbs { font-size: 0.9rem; margin: 0 0 0.9rem; display: flex; flex-wrap: wrap; gap: 0.15rem 0.45rem; color: var(--quiet); }
.crumbs a { color: var(--quiet); }
.crumbs span { color: var(--stone); }

/* A kind is a block of flat pigment, never a tinted pill. */
.kind {
  display: inline-block; font-size: 0.74rem; font-weight: 700; line-height: 1; padding: 0.3rem 0.5rem 0.26rem;
  background: var(--mass); color: var(--on-mass); clip-path: var(--cut-small); white-space: nowrap; vertical-align: 0.12em;
}
.kind.k-magic { background: var(--indigo); color: var(--highlight); }
.kind.k-rule { background: var(--oxide); color: var(--highlight); }
.kind.k-class { background: var(--moss); color: var(--highlight); }
.kind.k-origin { background: var(--sea); color: var(--highlight); }
.kind.k-gear { background: var(--brass); color: var(--ink); }
.kind.k-plain { background: transparent; color: var(--quiet); box-shadow: inset 0 0 0 1.5px var(--hair); clip-path: none; }
.kinds { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0 0 0.55rem; }

/* ——— First screen ——— */
.hero { position: relative; margin: -0.6rem -0.6rem 1.6rem; padding: 2.1rem 2.6rem 3.4rem 1.2rem; color: var(--on-mass); isolation: isolate; }
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1; background: var(--mass);
  -webkit-mask: url("./ink-slab.svg") 0 0 / 100% 100% no-repeat; mask: url("./ink-slab.svg") 0 0 / 100% 100% no-repeat;
}
.hero h1 { font-size: clamp(2rem, 9vw, 3.1rem); line-height: 1.02; letter-spacing: -0.02em; max-width: 11ch; padding: 0; }
.hero h1::after { display: none; }
.hero p { margin-top: 0.9rem; max-width: 24ch; color: var(--on-mass-quiet); font-style: italic; }
.hero .stroke { display: block; width: 8.5rem; height: 10px; margin-top: 0.9rem; background: var(--oxide);
  -webkit-mask: url("./ink-stroke-short.svg") 0 0 / 100% 100% no-repeat; mask: url("./ink-stroke-short.svg") 0 0 / 100% 100% no-repeat; }

.tiles { list-style: none; padding: 0; margin: 0.9rem 0 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; }
.tiles li { margin: 0; }
.tiles a {
  display: flex; flex-direction: column; justify-content: flex-end; gap: 0.25rem; height: 100%; min-height: 5.6rem;
  padding: 0.8rem 0.85rem 0.75rem; background: var(--mass); color: var(--on-mass); text-decoration: none;
  clip-path: var(--cut); border-left: 7px solid var(--spine, var(--stone));
}
.tiles a strong { font-size: 1.08rem; line-height: 1.15; }
.tiles a span { font-size: 0.84rem; line-height: 1.3; color: var(--on-mass-quiet); }
.tiles a:hover strong, .tiles a:focus-visible strong { text-decoration: underline; text-underline-offset: 0.18em; }
.tiles .wide { grid-column: 1 / -1; }
.tiles .wide a { min-height: 0; flex-direction: row; align-items: baseline; justify-content: space-between; gap: 1rem; }
.s-oxide { --spine: var(--oxide); } .s-indigo { --spine: var(--indigo); } .s-moss { --spine: var(--moss); }
.s-sea { --spine: var(--sea); } .s-brass { --spine: var(--brass); }
:root[data-theme="ink"] .tiles a { background: #0E0F0D; }

/* ——— Lists of references: set on the paper, parted by a dry rule ——— */
.result-list, .field-index, .related-list, .guide-summary { list-style: none; padding: 0; margin: 0.6rem 0 0; }
.result, .field-index li { position: relative; margin: 0; padding: 0.72rem 0 0.78rem; display: grid; grid-template-columns: 1fr auto; gap: 0.1rem 0.8rem; align-items: baseline; }
.result::after, .field-index li::after {
  content: ""; position: absolute; left: 0; bottom: 0; width: 100%; height: 4px; background: var(--hair);
  -webkit-mask: url("./ink-rule.svg") 0 0 / 100% 100% no-repeat; mask: url("./ink-rule.svg") 0 0 / 100% 100% no-repeat;
}
.result > a, .field-index a { font-weight: 700; font-size: 1.06rem; color: var(--text); text-decoration: none; }
.result > a:hover, .field-index a:hover strong, .field-index a:hover { text-decoration: underline; }
.result .context, .result .metadata { grid-column: 1 / -1; margin: 0; }
.result .kind { justify-self: end; }
.field-index li { display: block; }
.field-index a { display: block; }
.field-index a span { display: block; font-weight: 400; font-size: 0.95rem; color: var(--quiet); margin-top: 0.1rem; }
.field-index a::after { content: none; }

/* Small routes out of a page. */
.guide-links, .shortcut-links, .printing-links, .actions { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 0.9rem; }
.guide-links a, .shortcut-links a, .printing-links a, .btn, button, .button-link {
  font: inherit; font-size: 0.95rem; font-weight: 700; line-height: 1.2; text-decoration: none; cursor: pointer;
  display: inline-flex; align-items: center; min-height: 2.6rem; padding: 0.5rem 0.85rem;
  background: transparent; color: var(--text); border: 0; box-shadow: inset 0 0 0 2px var(--text); clip-path: var(--cut-small);
}
.guide-links a:hover, .shortcut-links a:hover, .printing-links a:hover, .btn:hover, button:hover, .button-link:hover { background: var(--text); color: var(--ground); }
.btn:not(.quiet), a.primary-link, .guide-links a.primary-link, button.primary { background: var(--mass); color: var(--on-mass); box-shadow: none; }
.btn:not(.quiet):hover, a.primary-link:hover, .guide-links a.primary-link:hover, button.primary:hover { background: var(--oxide); color: var(--highlight); }
:root[data-theme="ink"] .btn:not(.quiet), :root[data-theme="ink"] a.primary-link, :root[data-theme="ink"] .guide-links a.primary-link, :root[data-theme="ink"] button.primary { background: var(--parchment); color: var(--ink); }
button:disabled, .btn:disabled { opacity: 0.45; cursor: not-allowed; }
button:disabled:hover { background: transparent; color: var(--text); }
button.danger { box-shadow: inset 0 0 0 2px var(--oxide); color: var(--link); }
button.danger:hover { background: var(--oxide); color: var(--highlight); }
button.plain { box-shadow: none; clip-path: none; }
button.mini { min-height: 2.2rem; padding: 0.3rem 0.6rem; font-size: 0.88rem; }

/* ——— Forms ——— */
label { display: block; font-size: 0.9rem; font-weight: 700; margin-top: 0.9rem; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--raise); border: 0; border-bottom: 2px solid var(--text);
  padding: 0.55rem 0.65rem; width: 100%; min-height: 2.75rem; display: block; margin-top: 0.25rem; border-radius: 0;
}
input[type="checkbox"], input[type="radio"] { width: 1.25rem; height: 1.25rem; min-height: 0; display: inline-block; margin: 0 0.45rem 0 0; vertical-align: -0.2rem; accent-color: var(--oxide); }
input[type="file"] { border-bottom: 0; padding-left: 0; background: none; }
textarea { min-height: 5rem; resize: vertical; }
.search { margin-top: 1rem; }
.search label { margin-top: 0; }
.search input[type="search"] { font-size: 1.12rem; padding: 0.75rem 0.8rem; border-bottom-width: 3px; }
.search-filters { margin-top: 0.6rem; }
.filters, .guide-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: 0 0.9rem; }
.guide-fields > * + * { margin-top: 0.9rem; }

/* ——— Reading ——— */
.prose > :first-child, .manuscript > :first-child { margin-top: 0; }
.prose { margin-top: 1.2rem; }
.prose p { hanging-punctuation: first; }
.prose em { font-style: italic; }
.prose h3, .prose h4, .prose h5 { margin-top: 1.6rem; }
.prose ul { list-style: none; padding-left: 1.25rem; }
.prose ul > li { position: relative; }
.prose ul > li::before { content: ""; position: absolute; left: -1.1rem; top: 0.62em; width: 0.55rem; height: 0.3rem; background: var(--oxide); clip-path: polygon(0 20%, 100% 0, 78% 100%, 6% 82%); }
.voice { font-size: 1.14rem; line-height: 1.55; }
.voice > p:first-child em { color: var(--quiet); }
.section { margin-top: 2.6rem; }
.section > h2, .section > h3 { position: relative; padding-top: 1rem; margin-top: 0; }
.section > h2::before, .section > h3::before {
  content: ""; position: absolute; left: 0; top: 0; width: 100%; height: 5px; background: var(--text);
  -webkit-mask: url("./ink-rule.svg") 0 0 / 100% 100% no-repeat; mask: url("./ink-rule.svg") 0 0 / 100% 100% no-repeat;
}
.section .section { margin-top: 1.8rem; }
.section .section > h3::before, .section .section > h4::before { display: none; }
.section .section > h3, .section .section > h4 { padding-top: 0; }
.anchor { color: inherit; text-decoration: none; }
.anchor:hover { text-decoration: underline; }
.contents { margin-top: 1.4rem; background: var(--mass); color: var(--on-mass); padding: 1rem 1.1rem 1.1rem; clip-path: var(--cut); }
.contents h2 { font-size: 0.95rem; margin: 0; color: var(--on-mass-quiet); }
.contents ol { list-style: none; padding: 0; margin: 0.5rem 0 0; columns: 2; column-gap: 1.4rem; }
.contents li { margin: 0 0 0.4rem; break-inside: avoid; }
.contents a { color: var(--on-mass); font-weight: 700; text-decoration: none; }
.contents a:hover { text-decoration: underline; }
.aside-link { font-size: 0.95rem; padding-left: 0.8rem; border-left: 5px solid var(--sea); }
.source-note { margin-top: 2.4rem; font-size: 0.86rem; color: var(--quiet); }
.source-note a { color: inherit; }

/* Named values. On an entry's head they sit on ink; in running text, on paper. */
dl.facts {
  display: grid; grid-template-columns: max-content 1fr; gap: 0.5rem 1.1rem; margin: 1.3rem 0 0; padding: 1rem 1.1rem;
  background: var(--mass); color: var(--on-mass); clip-path: var(--cut);
}
dl.facts dt { font-size: 0.86rem; color: var(--on-mass-quiet); padding-top: 0.12rem; }
dl.facts dd { margin: 0; font-weight: 700; }
dl.labels, dl.traits { display: grid; grid-template-columns: minmax(6.5rem, max-content) 1fr; gap: 0.35rem 1rem; margin-top: 0.9rem; }
dl.labels dt, dl.traits dt { font-weight: 700; }
dl.labels dd, dl.traits dd { margin: 0; }
.named h4 { margin-top: 1.3rem; }
.ruling-summary dl { margin-top: 0.7rem; }
.ruling-summary dt { font-weight: 700; margin-top: 0.7rem; }
.ruling-summary dd { margin: 0.1rem 0 0; padding-left: 0.9rem; border-left: 5px solid var(--oxide); }

.table-wrap, .table-scroll { overflow-x: auto; margin-top: 1.1rem; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; line-height: 1.35; margin: 0; }
caption { text-align: left; font-weight: 700; font-size: 1.02rem; padding-bottom: 0.45rem; }
thead th { background: var(--mass); color: var(--on-mass); text-align: left; font-weight: 700; padding: 0.5rem 0.65rem; white-space: nowrap; vertical-align: bottom; }
tbody td, tbody th { padding: 0.5rem 0.65rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--hair); }
tbody th { font-weight: 700; }
tbody tr:nth-child(even) > * { background: color-mix(in srgb, var(--raise) 70%, transparent); }
.table-related { list-style: none; padding: 0; margin: 0.2rem 0 0; font-size: 0.88rem; }

.statblock { margin-top: 1.3rem; background: var(--raise); border-left: 7px solid var(--brass); padding: 0.9rem 1rem 1rem; }
.statblock-name { margin: 0; font-size: 1.2rem; }
.statblock p { margin-top: 0.45rem; }
.statblock h5, .statblock h6 { margin-top: 1rem; padding-top: 0.5rem; border-top: 2px solid var(--text); font-size: 1rem; }

/* Folds open in place. */
details { margin-top: 1rem; }
summary { cursor: pointer; font-weight: 700; padding: 0.6rem 0 0.6rem 1.5rem; position: relative; list-style: none; min-height: 2.6rem; }
summary::-webkit-details-marker { display: none; }
summary::before { content: ""; position: absolute; left: 0.1rem; top: 1.05rem; width: 0.8rem; height: 0.6rem; background: var(--oxide); clip-path: polygon(0 0, 100% 42%, 8% 100%); transition: transform 0.12s; }
details[open] > summary::before { transform: rotate(90deg); }
details.fold, details.reference-text, details.related { border-top: 2px solid var(--text); }
details > summary + * { margin-top: 0.2rem; }

.panel, .guide-panel { margin-top: 1.2rem; background: var(--raise); border-left: 7px solid var(--text); padding: 0.95rem 1rem 1.05rem; }
.panel > :first-child, .guide-panel > :first-child { margin-top: 0; }
.panel h2, .guide-panel h2, .panel h3, .guide-panel h3 { font-size: 1.14rem; }
.panel.p-oxide { border-color: var(--oxide); } .panel.p-sea { border-color: var(--sea); } .panel.p-moss { border-color: var(--moss); }
.panel.p-indigo { border-color: var(--indigo); } .panel.p-brass { border-color: var(--brass); }

.entry-head { display: grid; grid-template-columns: 1fr auto; gap: 0.6rem 1rem; align-items: start; }
.bookmark[aria-pressed="true"] { background: var(--oxide); color: var(--highlight); box-shadow: none; }
.record-choice { margin-top: 1.2rem; display: grid; grid-template-columns: 1fr; gap: 0.2rem; background: var(--raise); border-left: 7px solid var(--indigo); padding: 0.8rem 1rem 1rem; }
.record-choice label { margin-top: 0; }
.steps { list-style: none; padding: 0; margin: 1.2rem 0 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.3rem; counter-reset: step; }
.steps li { margin: 0; }
.steps a { display: block; padding: 0.5rem 0.4rem 0.45rem; font-size: 0.86rem; font-weight: 700; text-decoration: none; color: var(--quiet); border-top: 5px solid var(--hair); line-height: 1.2; }
.steps a::before { counter-increment: step; content: counter(step) ". "; }
.steps a[aria-current="step"] { color: var(--text); border-top-color: var(--oxide); }
.steps a.done { border-top-color: var(--text); color: var(--text); }
.guide-summary li { display: grid; grid-template-columns: 8rem 1fr; gap: 0.2rem 0.8rem; padding: 0.55rem 0; border-bottom: 1px solid var(--hair); margin: 0; }
.guide-summary li a { grid-column: 2; font-size: 0.9rem; }
.score-row { display: grid; grid-template-columns: 1fr 5.6rem 7.4rem; gap: 0.6rem; align-items: center; padding: 0.35rem 0; border-bottom: 1px solid var(--hair); }
.score-row select { margin: 0; }
.score-head { font-size: 0.86rem; font-weight: 700; color: var(--quiet); border-bottom: 2px solid var(--text); margin-top: 1rem; }
.score-warning { color: var(--link); font-weight: 700; }
.choice-cards { list-style: none; padding: 0; margin: 0.8rem 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); gap: 0.45rem; }
.choice-cards li { margin: 0; }
.choice-cards button { width: 100%; justify-content: flex-start; text-align: left; min-height: 3rem; }
.choice-cards button[aria-pressed="true"] { background: var(--mass); color: var(--on-mass); box-shadow: none; }
:root[data-theme="ink"] .choice-cards button[aria-pressed="true"] { background: var(--parchment); color: var(--ink); }
.class-grid { list-style: none; padding: 0; margin: 0.8rem 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: 0.5rem; }
.class-grid li { margin: 0; background: var(--raise); border-left: 6px solid var(--moss); padding: 0.6rem 0.75rem 0.7rem; }
.class-grid a { display: block; }
.class-grid .class-title { font-weight: 700; font-size: 1.08rem; color: var(--text); text-decoration: none; }
.class-grid a + a { font-size: 0.88rem; margin-top: 0.15rem; }
.compare-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 0.8rem; }
.compare-check { font-weight: 400; margin: 0; grid-column: 1 / -1; }
.inventory-item h2 { margin-top: 0; }
.ledger-list { list-style: none; padding: 0; }
.ledger-list .result { grid-template-columns: 1fr auto; }

/* ——— The play sheet ——— */
.sheet-head { position: relative; margin: -0.4rem -0.5rem 0; padding: 1.4rem 1.2rem 2.3rem; color: var(--on-mass); isolation: isolate; }
.sheet-head::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--mass);
  -webkit-mask: url("./ink-slab.svg") 0 0 / 100% 100% no-repeat; mask: url("./ink-slab.svg") 0 0 / 100% 100% no-repeat; }
.sheet-head h1 { padding: 0; font-size: clamp(1.7rem, 7vw, 2.4rem); max-width: 16ch; }
.sheet-head h1::after { display: none; }
.sheet-head p { margin-top: 0.4rem; color: var(--on-mass-quiet); max-width: 26ch; }
.sheet-nav { display: flex; gap: 0.3rem; margin-top: 1rem; overflow-x: auto; padding-bottom: 0.2rem; scrollbar-width: none; }
.sheet-nav a { flex: none; font-weight: 700; font-size: 0.95rem; text-decoration: none; color: var(--quiet); padding: 0.5rem 0.75rem; border-bottom: 4px solid var(--hair); min-height: 2.6rem; }
.sheet-nav a[aria-current="page"] { color: var(--text); border-bottom-color: var(--oxide); }
.vitals { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.45rem; margin-top: 1.1rem; }
.vital { background: var(--mass); color: var(--on-mass); padding: 0.55rem 0.5rem 0.6rem; clip-path: var(--cut-small); text-align: center; }
.vital b { display: block; font-size: 1.7rem; line-height: 1.05; font-variant-numeric: lining-nums tabular-nums; }
.vital span { display: block; font-size: 0.76rem; color: var(--on-mass-quiet); line-height: 1.15; margin-top: 0.1rem; }
.hp { margin-top: 0.8rem; background: var(--raise); border-left: 7px solid var(--oxide); padding: 0.85rem 0.9rem 0.95rem; }
.hp-row { display: flex; align-items: baseline; gap: 0.6rem; flex-wrap: wrap; }
.hp-now { font-size: 2.6rem; font-weight: 700; line-height: 1; font-variant-numeric: lining-nums tabular-nums; }
.hp-max { color: var(--quiet); }
.hp-bar { height: 9px; background: var(--hair); margin-top: 0.55rem; }
.hp-bar i { display: block; height: 100%; background: var(--oxide); clip-path: polygon(0 0, 100% 0, calc(100% - 5px) 100%, 0 100%); }
.hp-controls { display: grid; grid-template-columns: 1fr auto auto; gap: 0.45rem; margin-top: 0.7rem; align-items: end; }
.hp-controls label { margin: 0; }
.abilities { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.45rem; margin-top: 0.8rem; }
.ability { background: var(--raise); padding: 0.5rem 0.55rem 0.55rem; border-top: 5px solid var(--text); }
.ability b { font-size: 1.55rem; line-height: 1.05; display: block; font-variant-numeric: lining-nums tabular-nums; }
.ability span { font-size: 0.82rem; color: var(--quiet); display: block; }
.ability .save { margin-top: 0.3rem; padding-top: 0.3rem; border-top: 1px solid var(--hair); color: var(--text); }
.ability .save.proficient { font-weight: 700; }
.skills { list-style: none; padding: 0; margin: 0.6rem 0 0; columns: 2; column-gap: 1.1rem; }
.skills li { margin: 0; break-inside: avoid; }
.skills button { width: 100%; box-shadow: none; clip-path: none; justify-content: flex-start; gap: 0.5rem; padding: 0.3rem 0.1rem; min-height: 2.4rem; font-weight: 400; text-align: left; }
.skills button:hover { background: var(--raise); color: var(--text); }
.skills .mark { flex: none; width: 0.85rem; height: 0.85rem; box-shadow: inset 0 0 0 2px var(--text); clip-path: var(--cut-small); }
.skills [data-rank="1"] .mark { background: var(--text); }
.skills [data-rank="2"] .mark { background: var(--oxide); box-shadow: none; }
.skills [data-rank="1"], .skills [data-rank="2"] { font-weight: 700; }
.skills .bonus { margin-left: auto; font-variant-numeric: tabular-nums; }
.pips { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.4rem; }
.pips button { width: 2.4rem; height: 2.4rem; min-height: 0; padding: 0; clip-path: var(--cut-small); background: var(--indigo); box-shadow: none; }
.pips button[aria-pressed="true"] { background: transparent; box-shadow: inset 0 0 0 2px var(--hair); }
.pips.death button { background: transparent; box-shadow: inset 0 0 0 2px var(--text); }
.pips.death button[aria-pressed="true"] { background: var(--text); }
.pips.death.fail button[aria-pressed="true"] { background: var(--oxide); box-shadow: none; }
.slot-row { display: grid; grid-template-columns: 6.6rem 1fr; gap: 0.6rem; align-items: center; margin-top: 0.5rem; }
.slot-row > span { font-weight: 700; font-size: 0.95rem; }
.chips { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.6rem; }
.chips button { min-height: 2.3rem; padding: 0.3rem 0.65rem; font-size: 0.9rem; font-weight: 400; }
.chips button[aria-pressed="true"] { background: var(--oxide); color: var(--highlight); box-shadow: none; font-weight: 700; }
.attack { display: grid; grid-template-columns: 1fr auto; gap: 0.1rem 0.8rem; padding: 0.6rem 0; border-bottom: 1px solid var(--hair); }
.attack a { font-weight: 700; color: var(--text); }
.attack b { font-variant-numeric: tabular-nums; }
.attack small { grid-column: 1 / -1; color: var(--quiet); }
.counter { display: grid; grid-template-columns: 1fr auto; gap: 0.3rem 0.8rem; align-items: center; padding: 0.6rem 0; border-bottom: 1px solid var(--hair); }
.counter h4 { margin: 0; }
.counter .count { margin: 0; font-size: 0.95rem; }
.counter .actions { grid-column: 1 / -1; margin-top: 0.2rem; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem; }
.hint { font-size: 0.9rem; color: var(--quiet); }
.empty { margin-top: 1.4rem; background: var(--raise); border-left: 7px solid var(--stone); padding: 1rem 1.1rem 1.15rem; }
.empty > :first-child { margin-top: 0; }

dialog { background: var(--ground); color: var(--text); border: 3px solid var(--text); padding: 1.3rem; max-width: min(30rem, calc(100vw - 2rem)); }
dialog::backdrop { background: rgba(17, 18, 16, 0.72); }
dialog h2 { margin: 0 0 0.6rem; font-size: 1.3rem; }

/* ——— Wide screens: the tabs move into the band ——— */
@media (min-width: 56rem) {
  .band { padding: 0.7rem 2rem 0.6rem; gap: 1.6rem; }
  .brand { margin-right: 0; }
  .tabs { position: static; display: flex; background: none; padding: 0; margin-right: auto; gap: 0.2rem; }
  .tabs::before { display: none; }
  .tabs a { padding: 0.5rem 0.9rem; min-height: 2.5rem; }
  #main { padding: 3rem 1.5rem 5rem; }
  .hero { padding: 2.8rem 4rem 4.6rem 2rem; margin: -0.8rem -2rem 2rem; }
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .abilities { grid-template-columns: repeat(6, 1fr); }
  .vitals { grid-template-columns: repeat(4, 1fr); }
  .sheet-head { margin: -0.6rem -2rem 0; padding: 2rem 2rem 3rem; }
}
@media (max-width: 23rem) {
  .brand-sub, #theme { display: none; }
  .skills, .contents ol { columns: 1; }
  .vital b { font-size: 1.4rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
@media print {
  .band, .tabs, .colophon, .bookmark, .guide-links, .sheet-nav, button { display: none !important; }
  body { background: #fff; color: #000; }
  #main { padding: 0; max-width: none; }
}

/* The spell step: a name to tick and a way to read it first. */
.spell-row { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; }
.spell-row label { flex: 1; min-width: 0; }
.spell-row a { font-size: .85em; white-space: nowrap; }
.spell-step details { margin: .4rem 0; }
.spell-step details > summary { cursor: pointer; font-weight: 600; padding: .35rem 0; }
