/* Homebrew character sheet (/sheets/player/). Built on components.css; colours are global tokens only. */
/* owner asked for a purple theme on this page (2026-10-28), so the accent tokens are overridden here */
:root {
    --accent: var(--sheet-accent);
    --accent-soft: var(--sheet-accent-soft);
    --btn: var(--sheet-btn);
    --btn-line: var(--sheet-btn-line);
    --btn-hover: var(--sheet-btn-hover);
    --link: var(--sheet-link);
    --info-bg: var(--sheet-info-bg);
    --info-line: var(--sheet-info-line);
}
.hb [hidden] { display: none !important; }
.hb .field { min-width: 0; width: 100%; }
.hb .hb-hint { margin: 8px 0 0; font-size: 13px; }
.hb-hbsrc { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.hb .actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.hb h3 { margin: 20px 0 8px; font-size: 15px; }
.hb-lbl { color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.hb-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: 8px; }
.hb-grid label, .hb-id label, .hb-coins label, .hb-slotmax label { display: grid; gap: 4px; min-width: 0; color: var(--muted); font-size: 13px; }

/* toolbar */
.hb-bar .hb-pick { flex: 0 1 260px; }
.hb-bar .hb-gap { flex: 1; }

/* the always-visible top: one column on phones, art + saves + senses on the right from 960 px */
.hb-sheet {
    display: grid; gap: 16px; grid-template-columns: clamp(80px, 22vw, 160px) minmax(0, 1fr);
    grid-template-areas: "art id" "abil abil" "combat combat" "saves saves" "senses senses" "panels panels";
}
/* wider than the site's 1280px: above it the side space is halved (width = 1280 + half the extra) */
.page.hb { max-width: calc(50vw + 640px); }
.hb-top-id { grid-area: id; }
.hb-top-art { grid-area: art; }
.hb-top-abil { grid-area: abil; }
.hb-top-combat { grid-area: combat; display: grid; gap: 10px; align-content: start; }
.hb-top-saves { grid-area: saves; }
.hb-top-senses { grid-area: senses; }
.hb-top-panels { grid-area: panels; min-width: 0; }
/* art, saves and senses: separate grid cells on phones, one tight stack in the right column from 960 px */
.hb-side { display: contents; }
@media (min-width: 960px) {
    .hb-sheet {
        grid-template-columns: minmax(0, 1fr) 300px; grid-template-rows: auto auto auto 1fr;
        grid-template-areas: "id side" "abil side" "combat side" "panels side";
    }
    .hb-side { grid-area: side; display: flex; flex-direction: column; gap: 16px; align-self: start; min-width: 0; }
}

/* classes on the left, conditions, speed and defences filling the rest of the row */
.hb-id { display: flex; flex-wrap: wrap; align-items: end; gap: 8px 12px; }
.hb-id .hb-classes { flex: 0 0 auto; max-width: 100%; }
.hb-id .hb-more { flex: 1 1 260px; min-height: 38px; }
.hb-id .hb-more-body { flex: 1 1 100%; }

.hb-art {
    display: grid; place-items: center; width: 100%; aspect-ratio: 1; padding: 0; overflow: hidden;
    background: var(--card); border: 1px dashed var(--line-strong); border-radius: var(--radius-lg);
    color: var(--muted); font: inherit; font-size: 14px; cursor: pointer; transition: border-color var(--fast);
}
.hb-art:hover { border-color: var(--accent); }
.hb-art img { width: 100%; height: 100%; object-fit: cover; }
.hb-crop { display: block; width: min(100%, 360px); aspect-ratio: 1; margin: 12px auto; border-radius: var(--radius-lg); cursor: grab; touch-action: none; }
.hb-crop:active { cursor: grabbing; }

/* boxes: abilities, combat numbers */
.hb-abils { display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: 8px; }
.hb-abil, .hb-box {
    position: relative; display: grid; justify-items: center; align-content: start; gap: 6px; min-width: 0; padding: 10px;
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); text-align: center;
}
.hb .hb-panel .hb-box { background: var(--card2); }
.hb .hb-score { width: 64px; padding: 4px 6px; text-align: center; }
.hb-roll {
    min-width: 44px; padding: 2px 8px; background: var(--card2); border: 1px solid var(--line); border-radius: var(--radius);
    color: var(--text); font: inherit; font-size: 14px; font-variant-numeric: tabular-nums; cursor: pointer; transition: border-color var(--fast);
}
.hb-roll:hover { border-color: var(--accent); }
.hb-val { min-width: 44px; font-variant-numeric: tabular-nums; text-align: center; }
.hb-roll:active { transform: translateY(1px); }
.hb-big { font-size: clamp(22px, 3vw, 28px); font-weight: 700; line-height: 1.2; }
.hb .hb-bad { color: var(--danger-line); border-color: var(--danger-line); }
.hb-edit {
    position: absolute; right: 4px; bottom: 4px; display: grid; place-items: center; width: 28px; height: 28px; padding: 0;
    background: none; border: 0; border-radius: var(--radius); color: var(--muted); cursor: pointer;
}
.hb-edit:hover { color: var(--text); background: var(--card2); }

.hb-combat { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); align-items: start; gap: 8px; }
.hb-hp-head { display: flex; justify-content: center; align-items: center; gap: 4px; width: 100%; position: relative; }
.hb-hp-head .hb-x { position: absolute; right: -4px; top: -6px; display: grid; place-items: center; }
.hb-hp-head .hb-x[aria-expanded="true"] { color: var(--accent); }
.hb-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: start; }
.hb-stats > * { display: grid; justify-items: center; gap: 6px; min-width: 0; }
.hb-hpv { display: flex; align-items: center; gap: 6px; font-size: 20px; }
.hb .hb-hpv .field { width: 72px; padding: 4px 6px; font-size: 20px; font-weight: 700; text-align: center; }
.hb-hp .progress { width: 100%; }
.hb-dmg { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.hb .hb-dmg .field { width: 64px; padding: 4px 6px; text-align: center; }
.hb-insp { cursor: pointer; }
.hb-insp input { width: 28px; height: 28px; margin: 0; accent-color: var(--accent); }

.hb-more { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-size: 14px; }
.hb-condsum { color: var(--highlight); }
.hb-more-body .badges { margin-top: 0; }
.hb button.badge { color: var(--text); font: inherit; font-size: 12px; cursor: pointer; }

/* saves and senses */
.hb-savegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 6px; }
.hb-save { display: flex; align-items: center; gap: 8px; padding: 6px 8px; background: var(--card2); border-radius: var(--radius); font-size: 14px; font-weight: 600; }
.hb-save span { flex: 1; }
.hb-dot { display: flex; cursor: pointer; }
.hb-dot input, .hb-prof {
    flex: none; width: 14px; height: 14px; margin: 0; padding: 0; appearance: none; background: none;
    border: 1.5px solid var(--line-strong); border-radius: 50%; cursor: pointer;
}
.hb-dot input:checked, .hb-prof.l2 { background: var(--accent); border-color: var(--accent); }
.hb-prof.l1 { background: linear-gradient(90deg, var(--accent) 50%, transparent 50%); border-color: var(--accent); }
.hb-prof.l3 { background: var(--accent); border-color: var(--highlight); box-shadow: 0 0 0 2px var(--card2), 0 0 0 3.5px var(--highlight); }
.hb-senses .rowi b { font-size: 17px; }
.hb-other { display: grid; gap: 4px; margin-top: 12px; }
.hb-other textarea.field { min-height: 64px; text-transform: none; letter-spacing: 0; font-weight: 400; }

/* panels */
.hb-tabs { margin-bottom: 12px; }
.hb-two { grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); }
.hb-two .rowi { padding: 4px 4px 4px 10px; }
.hb-table td { padding: 6px 4px; vertical-align: middle; }
.hb-table th { padding: 6px 4px; }
.hb-table .field { min-width: 110px; padding: 6px 8px; }
.hb .hb-table .hb-n { width: 64px; min-width: 64px; }
.hb .hb-table .hb-formula { min-width: 120px; }
.hb-c { text-align: center; }
.hb-c input { width: 18px; height: 18px; accent-color: var(--accent); }
.hb-nowrap { white-space: nowrap; }
.hb-fx { display: flex; align-items: center; gap: 6px; }
.hb-formula { font-family: var(--mono); font-size: 13px; }
.hb-x {
    width: 32px; height: 32px; padding: 0; background: none; border: 1px solid transparent; border-radius: var(--radius);
    color: var(--muted); font: inherit; font-size: 18px; line-height: 1; cursor: pointer;
}
.hb-x:hover:not(:disabled) { color: var(--text); border-color: var(--line-strong); }
.hb-x:disabled { opacity: .3; cursor: default; }

.hb-pips { display: inline-flex; flex-wrap: wrap; gap: 4px; vertical-align: middle; }
.hb-pips button { width: 18px; height: 18px; padding: 0; background: none; border: 1.5px solid var(--accent); border-radius: 4px; cursor: pointer; }
.hb-pips button.used { background: var(--accent); }
.hb-panel .kv .hb-bad-pips .hb-pips button { border-color: var(--danger-line); }
.hb-panel .kv .hb-bad-pips .hb-pips button.used { background: var(--danger-line); }
.hb-slots { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 12px 0 0; }
.hb-slot { display: inline-flex; align-items: center; gap: 6px; }
.hb-slot small { color: var(--muted); font-size: 13px; }
.hb-details { margin: 12px 0; font-size: 14px; }
.hb-details summary { color: var(--muted); cursor: pointer; }
.hb-slotmax, .hb-coins { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; margin: 10px 0; }

.hb-list { display: grid; gap: 10px; }
.hb-entry { display: grid; gap: 6px; padding: 10px; background: var(--card2); border-radius: var(--radius); }
.hb-entry-h { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.hb .hb-entry-h .hb-strong { flex: 1 1 180px; width: auto; font-weight: 600; }
.hb .hb-entry-h .hb-src { flex: 0 1 160px; width: auto; }
.hb-entry textarea.field, .hb-text { min-height: 64px; field-sizing: content; }
.hb .hb-text { min-height: 160px; }
.hb-track { flex-wrap: wrap; }
.hb .hb-track .grow { flex: 1 1 140px; width: auto; }
.hb .hb-track .hb-n { width: 64px; padding: 4px 6px; text-align: center; }
.hb .hb-track select.field { width: auto; }

/* dialogs */
dialog.hb-dlg { width: min(760px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); }
/* Customise keeps one size whichever tab is open; longer tabs scroll inside it */
dialog.hb-dlg.hb-custdlg { height: min(720px, calc(100dvh - 32px)); overflow-y: auto; }
.hb-dlg h3:first-of-type { margin-top: 12px; }
.hb-dlg .hb-err { color: var(--danger-line); }
.hb-addpanel select.field { width: auto; }

/* classes (multiclass rows) */
.hb-classes { display: grid; gap: 8px; }
.hb-cls { display: flex; flex-wrap: wrap; align-items: end; gap: 8px 12px; }
.hb-cls > label:first-child { flex: 0 1 200px; }
.hb-cls .hb-lvl { flex: 0 0 72px; }
.hb-cls .hb-hitdie { flex: 0 0 84px; }
.hb-cls label { display: grid; gap: 4px; min-width: 0; color: var(--muted); font-size: 13px; }
.hb-cls-more { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; font-size: 13px; }
/* class, level, hit die and Add a class on one line where there is room */
@media (min-width: 700px) { .hb-cls { flex-wrap: nowrap; } .hb-cls-more { flex-wrap: nowrap; white-space: nowrap; min-height: 38px; } }

/* hit points: current / max with temp, a two-part bar, and the edit fields */
.hb-hpv b { font-size: 20px; }
.hb-temp { color: var(--accent); font-size: 14px; font-weight: 600; }
.hb .hb-warn { color: var(--danger-line); }
.hb-hpbar { display: flex; width: 100%; height: 8px; overflow: hidden; background: var(--card2); border-radius: 999px; }
.hb-hpbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--btn), var(--accent)); }
.hb-hpbar i + i { background: var(--series-3); }
.hb-hpf { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; width: 100%; }
.hb-hpf label { display: grid; gap: 2px; min-width: 0; color: var(--muted); font-size: 12px; }
.hb .hb-hpf .field { padding: 4px 6px; text-align: center; }

/* conditions, speeds and defences */
.hb-more-body h3:first-child { margin-top: 0; }
.hb-exh { display: inline-grid; gap: 4px; color: var(--muted); font-size: 13px; }
.hb .hb-exh .field { width: 80px; }
.hb-speeds { display: grid; gap: 6px; }
.hb-speed { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.hb .hb-speed .field:first-child { flex: 1 1 140px; width: auto; }
.hb .hb-speed .hb-n, .hb .hb-n { width: 72px; min-width: 0; padding: 4px 6px; text-align: center; }

/* sub-tabs inside a panel */
.hb-sub { margin: 4px 0 12px; }
.hb-sub button { padding: 3px 10px; font-size: 12px; }

/* actions and spells: a summary line that opens into an editor */
.hb-entry-h { flex-wrap: wrap; }
.hb-link { padding: 0; background: none; border: 0; color: var(--link); font: inherit; font-weight: 600; text-align: left; cursor: pointer; }
.hb-link:hover { text-decoration: underline; }
.hb-sum { flex: 1 1 200px; min-width: 0; color: var(--muted); font-size: 13px; }
.hb-prop { padding: 0; background: none; border: 0; color: inherit; font: inherit; text-decoration: underline dotted; text-underline-offset: 3px; cursor: pointer; }
.hb-prop:hover { color: var(--link); text-decoration-style: solid; }
.hb-toggle { display: grid; place-items: center; margin-left: auto; }
.hb-toggle[aria-expanded="true"] { color: var(--accent); }
.hb-editor { display: grid; gap: 8px; padding-top: 10px; border-top: 1px solid var(--line); }
.hb-editor h4 { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.hb-editor .actions { margin-top: 0; }
.hb-wide { display: grid; gap: 4px; color: var(--muted); font-size: 13px; }
.hb-fxbox { display: grid; gap: 4px; justify-items: start; color: var(--muted); font-size: 13px; }
.hb-checks { display: flex; flex-wrap: wrap; align-items: end; gap: 4px 14px; }
.hb-dmgs { display: grid; gap: 6px; }
.hb-dmgrow { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 6px; }
/* homebrew effects: kind, then dice + type (or one wide field), then remove */
.hb-fxrow { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr) auto; gap: 6px; align-items: center; }
.hb .hb-fxrow select.field { width: auto; }
.hb-fxrow .hb-fxwide { grid-column: span 2; }
.hb-costrow { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 6px; }
@media (max-width: 560px) { .hb-fxrow { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; } .hb-fxrow select.field { grid-column: 1 / -1; } }
.hb-addtag { display: flex; gap: 6px; max-width: 360px; }
.hb .hb-addtag .field { flex: 1; width: auto; }
.hb-prep { display: flex; }
.hb-prep input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.hb-cost { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.hb-tool .field { width: auto; }
.hb .hb-tool .grow { flex: 1 1 160px; }
.hb-attune { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin: 0 0 12px; font-size: 14px; }
.hb-attune label { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.hb .field.hb-auto { width: auto; }
.hb-lists textarea.field { min-height: 120px; }

/* formula builder */
.hb-result { margin: 4px 0; }
.hb-part { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 6px 0; border-top: 1px solid var(--line); }
.hb .hb-part .field { width: auto; }
.hb .hb-part .hb-sign { width: 56px; }
.hb .hb-part .hb-formula, .hb .hb-part .hb-plabel { flex: 1 1 140px; }

/* rests and the details drawer */
.hb-plain { margin: 0 0 8px; padding-left: 20px; font-size: 14px; }
.hb-drawer h2 { margin: 0 32px 4px 0; font-size: 20px; }
.hb-drawer:focus { outline: none; }
.hb-desc { margin-top: 12px; font-size: 14px; overflow-wrap: anywhere; }
.hb-desc p { margin: 0 0 8px; }
/* SRD rules text under conditions and proficiencies, and in the drawer */
.hb-rules { margin-top: 12px; display: grid; gap: 10px; font-size: 14px; }
.hb-rules h4 { margin: 4px 0 0; }
.hb-rule p { margin: 2px 0 0; color: var(--muted); }
.hb-rule p.hb-bullet, .hb-desc p.hb-bullet { position: relative; padding-left: 14px; }
.hb-rule p.hb-bullet::before, .hb-desc p.hb-bullet::before { content: ""; position: absolute; left: 3px; top: .6em; width: 4px; height: 4px; border-radius: 50%; background: currentColor; }
.hb-rules .hb-hint { margin: 0; font-size: 12px; }
/* combat actions everyone has, under the Actions panel */
.hb-basics { margin-top: 12px; font-size: 14px; }
.hb-basics h4 { margin: 0 0 4px; }
.hb-basics p { margin: 4px 0 0; }
.hb-basics .muted { margin-right: 6px; }
@media (prefers-reduced-motion: reduce) { .hb-drawer { transition: none; } }

/* notes: list beside the open note once the panel is wide enough */
.hb-panel { container-type: inline-size; }
.hb-ntools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.hb .hb-ntools .hb-nq { flex: 1 1 180px; width: auto; }
.hb .hb-ntools select.field { width: auto; }
.hb-notes { display: grid; gap: 12px; }
@container (min-width: 620px) { .hb-notes { grid-template-columns: minmax(200px, 260px) minmax(0, 1fr); } }
.hb-nlist { display: grid; gap: 6px; align-content: start; max-height: 560px; overflow-y: auto; }
.hb-nitem {
    display: grid; gap: 2px; min-width: 0; padding: 8px 10px; background: var(--card2); border: 1px solid transparent; border-radius: var(--radius);
    color: var(--text); font: inherit; text-align: left; cursor: pointer; transition: border-color var(--fast);
}
.hb-nitem:hover { border-color: var(--line-strong); }
.hb-nitem.on { background: var(--accent-soft); border-color: var(--btn-line); }
.hb-ntitle { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 14px; }
.hb-ntitle b, .hb-nsnip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-ntitle .badge { flex: none; }
.hb-nsnip { color: var(--muted); font-size: 13px; }
.hb-nsnip:empty { display: none; }
.hb-nitem small { color: var(--muted); font-size: 12px; }
.hb-nedit { display: grid; gap: 8px; align-content: start; min-width: 0; }
.hb .hb-ntitle-in { font-size: 17px; font-weight: 600; }
.hb-nbar { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; }
.hb-ngroup { display: grid; flex: 1 1 160px; gap: 4px; color: var(--muted); font-size: 13px; }
.hb textarea.hb-nbody { min-height: 260px; field-sizing: content; }
.hb-nempty { margin: 0; }
.hb-grename { display: inline-grid; gap: 4px; margin: 0 0 10px; color: var(--muted); font-size: 13px; }
.hb .btn[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--btn-line); }

/* notes pinned to the sheet */
.hb-pins { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 8px; }
.hb-pin { display: grid; gap: 6px; padding: 10px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.hb-pin-h { display: flex; align-items: center; gap: 6px; min-width: 0; }
.hb-pin-h .hb-link { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb textarea.hb-pin-body { min-height: 64px; max-height: 220px; field-sizing: content; font-size: 14px; }

/* uses on passive abilities, and resources with their own tabs */
.hb-uses { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 13px; color: var(--muted); }
.hb-uses label, .hb-maxl { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.hb .hb-uses select.field, .hb .hb-res select.field { width: auto; }
.hb-subrow { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 4px 8px; }
.hb-subrow .hb-sub { margin-bottom: 8px; }
.hb-tabtools { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; margin-bottom: 10px; }
.hb-tabtools .hb-grename { margin: 0; }
.hb-tedit { margin-left: auto; }
.hb-fxf { display: inline-flex; align-items: center; gap: 6px; margin: 0 0 8px auto; color: var(--muted); font-size: 13px; }
.hb-fxf .field { width: auto; }
.hb-attrs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; min-width: 160px; }
.hb-attr { display: inline-flex; align-items: center; gap: 2px; padding: 0 2px 0 8px; background: var(--btn2); border: 1px solid var(--line-strong); border-radius: 999px; font-size: 13px; white-space: nowrap; }
.hb-attr .hb-x { width: 20px; height: 20px; }
.hb .hb-attrin { width: 72px; min-width: 72px; padding: 4px 6px; font-size: 13px; }
.hb-tabedit { display: grid; gap: 8px; margin-bottom: 12px; }
.hb-tabedit .hb-tabtools { margin: 0; flex-wrap: nowrap; }
.hb-tabedit .actions { margin-top: 0; }
.hb-count { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.hb .hb-res .hb-strong { flex: 1 1 160px; width: auto; }
.hb .hb-count .hb-formula, .hb .hb-uses .hb-formula { width: 140px; }
.hb-levels { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px; }
.hb-levels > .actions { flex-basis: 100%; margin-top: 0; }
.hb-level { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 6px 8px; border: 1px solid var(--line); border-radius: var(--radius); }
.hb .hb-level .hb-lvlname { width: 64px; padding: 4px 6px; }
.hb .hb-level .hb-n { width: 56px; }
.hb-level .hb-x { width: 24px; height: 24px; font-size: 16px; }
.hb-unit { display: inline-flex; align-items: center; gap: 4px; }
.hb-table .hb-total td { border-top: 1px solid var(--line); color: var(--muted); font-weight: 600; }
.hb-table .hb-total b { color: var(--text); }
/* coins: amounts, total and the spend/add box */
.hb-purse { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin: 10px 0; font-size: 14px; }
.hb-coin { color: var(--muted); }
.hb-coin b { color: var(--text); font-size: 17px; }
.hb-coinbox { display: flex; align-items: center; gap: 6px; flex: 0 1 260px; min-width: 0; }
.hb .hb-coinin { flex: 1 1 120px; width: auto; min-width: 0; }
.hb-coinbox .btn { display: inline-flex; align-items: center; justify-content: center; min-width: 40px; min-height: 40px; padding: 0; font-size: 17px; line-height: 1; }
/* spell limits, the slot hint and spell points (ROADMAP 4.4); the weight line (4.5) */
.hb-limits { display: grid; gap: 6px; margin: 12px 0; }
.hb-limits:empty { display: none; }
.hb-limit { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 7px 10px; background: var(--card2); border-radius: var(--radius); font-size: 14px; }
.hb-limit > .hb-link { flex: 1 1 110px; min-width: 0; }
.hb-limit span { color: var(--muted); font-size: 13px; }
.hb-limit span b { color: var(--text); font-size: 14px; }
.hb-limit span b.badge { padding: 0 8px; font-weight: 600; }
.hb-slothint { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 12px 0 0; }
.hb-slothint .hb-link { flex: 1 1 160px; min-width: 0; color: var(--text); font-weight: 400; text-decoration: underline dotted; text-underline-offset: 3px; }
.hb-points { margin: 12px 0 0; }
.hb-points .btn { min-width: 40px; justify-content: center; }
.hb-weight { display: grid; gap: 6px; margin: 0 0 12px; }
.hb-wtline { padding: 0; background: none; border: 0; color: var(--text); font: inherit; font-size: 14px; text-align: left; text-decoration: underline dotted; text-underline-offset: 3px; cursor: pointer; }
.hb-wtline:hover { color: var(--link); }
.hb-weight .progress { position: relative; height: 8px; }
.hb-weight .progress em { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--muted); }
.hb-weight .progress.hb-over i { background: var(--danger-line); }
.hb-weight .err { margin: 0; padding: 6px 10px; }
.hb-weight .actions { margin-top: 0; }
.hb-carry { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin: -4px 0 10px; }
.hb-nc { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; cursor: pointer; white-space: nowrap; }
.hb-nc input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
/* a narrow panel: name, tick and buttons on one line, what the item is under them */
@container (max-width: 560px) { .hb-entry-h:has(> .hb-nc) > .hb-sum { flex: 1 1 100%; order: 5; } .hb-entry-h > .hb-nc { margin-left: auto; } }
.hb-offrow > .hb-entry-h > .hb-sum, .hb-offrow .ph-rowq small { text-decoration: line-through; }
.hb-pttable { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; }
.hb-pttable label { display: grid; gap: 2px; color: var(--muted); font-size: 12px; }
.hb .hb-pttable .field { padding: 4px 6px; text-align: center; }
.ph-on .hb-nc { min-height: 44px; }
.ph-on .hb-nc input { width: 22px; height: 22px; }
.hb-wt { margin: 8px 0 0; color: var(--muted); font-size: 14px; font-weight: 600; }
.hb-wt b { color: var(--text); }
.hb-undo { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 8px 8px 14px; border-radius: var(--radius); font-size: 14px; background: var(--info-bg); border: 1px solid var(--info-line); }
.hb-undo[hidden] { display: none; }
.hb-fbuild { padding: 12px; margin-bottom: 8px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--sunken); }
.hb-fwords { white-space: normal; }
.hb-fword { margin: 2px; padding: 2px 8px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--sunken); color: var(--text); font: 13px/1.5 ui-monospace, Consolas, monospace; cursor: pointer; }
.hb-fword:hover { border-color: var(--accent); color: var(--accent); }
/* Flexible Casting: made slots and points above the maximum are dashed until a long rest */
.hb-pips button.extra { border-style: dashed; }
.hb-flex { margin-top: 12px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); }
.hb-flex h4 { margin: 0 0 8px; }
.hb-flexrow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 6px 0; }
.hb-flexrow > span:first-child { min-width: 170px; }
/* dice: clickable bonuses, the roll card and the dice tray (bottom left, clear of the toasts on the right) */
.hb-d20 { padding: 0 4px; background: none; border: 1px solid transparent; border-radius: var(--radius); color: inherit; font: inherit; cursor: pointer; transition: border-color var(--fast), background var(--fast); }
.hb-d20:hover { border-color: var(--accent); background: var(--accent-soft); }
.hb-dice { position: fixed; left: 16px; bottom: 16px; z-index: 1750; display: grid; justify-items: start; gap: 8px; }
.hb-dicebtn { display: grid; place-items: center; width: 52px; height: 52px; background: var(--card2); border: 1px solid var(--line-strong); border-radius: 50%; color: var(--text); box-shadow: var(--lift); cursor: pointer; }
.hb-dicebtn:hover, .hb-dicebtn[aria-expanded="true"] { border-color: var(--accent); color: var(--accent); }
.hb-tray { display: grid; gap: 10px; width: min(320px, calc(100vw - 32px)); padding: 12px; background: var(--sunken); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--lift); }
.hb-traydice { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.hb-die { position: relative; min-height: 44px; background: var(--card2); border: 1px solid var(--line-strong); border-radius: var(--radius); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
.hb-die:hover { border-color: var(--accent); }
.hb-die small { position: absolute; top: -6px; right: -6px; min-width: 20px; padding: 0 4px; background: var(--accent); border-radius: 999px; color: var(--sunken); font-size: 12px; line-height: 20px; }
.hb-trayrow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 14px; }
.hb-trayrow > span { flex: 1 1 120px; min-width: 0; }
.hb-trayslot { display: grid; justify-items: start; gap: 8px; }
.hb-rollcard { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "head tot" "dice tot"; align-items: center; gap: 2px 16px; width: min(320px, calc(100vw - 32px)); padding: 12px 16px; background: var(--sunken); border: 1px solid var(--line-strong); border-left: 4px solid var(--accent); border-radius: var(--radius-lg); box-shadow: var(--lift); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.hb-rollhead { grid-area: head; display: grid; }
.hb-rollhead small, .hb-rolldice { color: var(--muted); font-size: 13px; }
.hb-rolldice { grid-area: dice; overflow-wrap: anywhere; }
.hb-rolltot { grid-area: tot; font-size: 34px; font-weight: 700; line-height: 1; }
.hb-rollcard.hb-each .hb-rolltot, .hb-logt.hb-each { font-size: 20px; }
.hb-rollcard.hb-nat20 { border-left-color: var(--gold-line); background: var(--gold-bg); }
.hb-rollcard.hb-nat1 { border-left-color: var(--danger-line); background: var(--danger-bg); }
/* 3D dice layer over the page, under the roll card and tray; clicks go through it */
#hb-throw { position: fixed; inset: 0; z-index: 1740; width: 100vw; height: 100vh; pointer-events: none; }
/* dice style pictures in Customise; the picked one is outlined */
/* Customise: the dice are chosen on the Dice Sets page */
.hb-dicelink { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 8px 0 12px; font-size: 14px; }
/* roll log: fixed in the empty space left of the sheet (sheet.js sets the width), from the top down to the dice button */
.hb-log { position: fixed; left: 16px; top: 16px; bottom: 84px; z-index: 1500; display: grid; grid-template-rows: auto 1fr; gap: 8px; padding: 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.hb-logbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.hb-logbar h2 { margin: 0; font-size: 17px; }
.hb-log > .hb-logl { overflow-y: auto; min-height: 0; }
.hb-logl { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; align-content: start; }
.hb-logi { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "head tot" "dice tot"; gap: 2px 10px; align-items: center; padding: 8px 10px; background: var(--card2); border-left: 3px solid var(--accent); border-radius: var(--radius); font-size: 13px; }
.hb-logi.hb-nat20 { border-left-color: var(--gold-line); background: var(--gold-bg); }
.hb-logi.hb-nat1 { border-left-color: var(--danger-line); background: var(--danger-bg); }
.hb-logh { grid-area: head; display: flex; justify-content: space-between; gap: 8px; min-width: 0; }
.hb-logh b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-logh small, .hb-logd { color: var(--muted); }
.hb-logd { grid-area: dice; overflow-wrap: anywhere; }
.hb-logt { grid-area: tot; font-size: 20px; font-weight: 700; }
.hb-traylog { display: grid; gap: 6px; max-height: 220px; overflow-y: auto; font-size: 13px; }
/* to-hit and damage roll buttons in action and spell summaries, boxed like D&D Beyond's */
.hb-rollbtn { display: inline-block; padding: 0 6px; background: var(--card); border: 1px solid var(--line-strong); border-radius: var(--radius); color: var(--text); font: inherit; font-weight: 600; line-height: 1.6; cursor: pointer; transition: border-color var(--fast), background var(--fast); }
.hb-rollbtn:hover { border-color: var(--accent); background: var(--accent-soft); }
/* the latest roll shows in the top-right corner, under the sticky sheet bar and clear of the toasts at the bottom */
#hb-rolls { position: fixed; top: 76px; right: 16px; z-index: 1750; display: grid; gap: 8px; max-height: calc(100dvh - 92px); overflow: hidden; }
/* scroll style of hit points: both words sit in one cell, so the button keeps the width of the longer one */
.hb-hpgo { display: inline-grid; border-color: var(--danger-line); }
.hb-hpgo > span { grid-area: 1 / 1; }
.hb-hpgo > span + span, .hb-hpgo[data-heal] > span:first-child { visibility: hidden; }
.hb-hpgo[data-heal] { border-color: var(--ok-line); }
.hb-hpgo[data-heal] > span + span { visibility: visible; }

/* the top line: character, Edit, who they are, rests and Customise; fields line up with the buttons along the bottom */
.hb-bar { align-items: end; }
/* sheet.js redraws the bar inside .hb-barin; the sign-in widget sits after it and is never redrawn */
.hb-barin { display: contents; }
.hb-bar label { display: grid; gap: 2px; min-width: 0; color: var(--muted); font-size: 12px; }
.hb-bar .hb-name { flex: 1 1 160px; }
.hb-bar .hb-name .field { font-weight: 700; }
.hb-bar .hb-race, .hb-bar .hb-align { flex: 0 1 130px; }
.hb-bar .hb-age { flex: 0 0 64px; }
.hb-manage { display: inline-flex; flex-wrap: wrap; gap: 8px; }
.hb-bar [data-act=manage] { display: inline-flex; align-items: center; gap: 4px; }
/* the bar wraps to several rows on phones, so it scrolls away there instead of sticking */
@media (max-width: 699.98px) { .hb-bar { position: static; } }
/* the page title is for screen readers only */
.hb-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* the page title is for screen readers only */
.hb-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
/* right-click (or press and hold) menu on a d20 roll */
.hb-advmenu { position: fixed; z-index: 1760; display: grid; min-width: 180px; padding: 4px; background: var(--sunken); border: 1px solid var(--line-strong); border-radius: var(--radius-lg); box-shadow: var(--lift); animation: hb-advin 140ms ease-out; }
.hb-advmenu[hidden] { display: none; }
.hb-advmenu button { padding: 8px 12px; background: none; border: 0; border-radius: var(--radius); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.hb-advmenu button:hover, .hb-advmenu button:focus-visible { background: var(--card2); }
.hb-d20, .hb-roll, .hb-rollbtn[data-d20] { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
@keyframes hb-advin { from { opacity: 0; transform: translateY(4px); } }
@media (prefers-reduced-motion: reduce) { .hb-advmenu { animation: none; } }
/* Customise: title and Close on one line, then the tabs */
.hb-custhead { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.hb-custhead h2 { margin: 0; }
.hb-ctabs { margin-top: 12px; }

/* the table (ROADMAP 1.3): where rolls go, in the dice tray; Mine / Table tabs on the roll log; other players' roll cards */
.hb-trayto label { display: flex; flex: 1 1 200px; align-items: center; gap: 6px; min-width: 0; color: var(--muted); font-size: 13px; }
.hb-trayto .field { flex: 1; min-width: 0; }
.hb-trayto [aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.hb-logtabs { margin: 0 auto 0 8px; }
.hb-rolldice s, .hb-logd s { color: var(--muted); }
.hb-rollcard.hb-other { border-left-color: var(--series-2); }
/* archive and versions (ROADMAP 0.5) */
.hb-arcnote { color: var(--muted); font-size: 14px; }
.hb-narc { cursor: default; }
.hb-narc .btn { justify-self: start; }
.hb-narch { margin-top: 12px; }
.hb-narch summary { color: var(--muted); font-size: 14px; cursor: pointer; }
.hb-narch .rows { margin-top: 8px; }
dialog.hb-ver { width: min(640px, calc(100vw - 32px)); }
.hb-verhead { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
.hb-verhead h2 { flex: 1; }
.hb-vlist { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.hb-vrow { padding: 8px 10px; background: var(--card2); border-radius: var(--radius); }
.hb-vline { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.hb-vsum { display: flex; flex: 1 1 260px; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; min-width: 0; padding: 0; background: none; border: 0; color: var(--text); font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.hb-vsum:disabled { cursor: default; }
.hb-vsum small { font-size: 13px; }
.hb-vacts { display: flex; gap: 6px; }
.hb-vform { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.hb-vform .field { flex: 1 1 200px; }
.hb-vchanges { margin: 8px 0 0; padding-left: 20px; font-size: 14px; }
.hb-vchanges summary { cursor: pointer; }
.hb-vtext pre { margin: 4px 0 8px; padding: 8px; max-height: 240px; overflow: auto; background: var(--sunken); border-radius: var(--radius); font: inherit; white-space: pre-wrap; }
.hb-vmore { margin: 8px 0 0; }

/* DM mode (ROADMAP 1.5): the bar under the top line, with what the DM was told until it's dismissed */
.hb-dmbar { margin: 0 0 12px; }
.hb-dmbar p { margin: 0; }
.hb-dmnotes { margin: 8px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.hb-dmnotes li { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
/* Edit > New: the builder or an empty sheet (ROADMAP 4.2); the Blank one is a button styled as a hub card */
.hb-newgrid { grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); margin-top: 12px; }
.hb-newgrid button.hub-card { width: 100%; font: inherit; text-align: left; cursor: pointer; }
/* Character details (4.2) */
.hb-details-f { margin-bottom: 8px; }

/* ---------- phone play mode (ROADMAP 2.1, assets/js/phone.js): <html class="ph-on"> below 700 px or a phone on its side ---------- */
#ph-head, #ph-tabs { display: none; }
.ph-on { --phh: 108px; --tabh: 56px; }
.ph-on #ph-head { display: grid; } .ph-on #ph-tabs { display: grid; }
.ph-on .page.hb { padding: 0 0 calc(var(--tabh) + env(safe-area-inset-bottom) + 84px); max-width: 100%; }
.ph-on .page.hb > .crumbs, .ph-on #main > .hb-hint, .ph-on #main > .mon-credit, .ph-on #hb-log { display: none; }
/* the old top bar only holds the sign-in widget until the menu shows it; off screen rather than hidden, so Google can draw its button */
.ph-on #hb-bar { position: absolute; left: -9999px; top: 0; }
.ph-on .hb-sheet { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-areas: none; gap: 12px; padding: 12px max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left)); }
.ph-on .hb [id^="hb-p-"], .ph-on .ph-sec { scroll-margin-top: calc(var(--phh) + 8px); }
.ph-ell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* the header */
.ph-head { position: sticky; top: 0; z-index: 60; gap: 4px; padding: max(4px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) 6px max(8px, env(safe-area-inset-left)); background: var(--sunken); border-bottom: 1px solid var(--line-strong); }
.ph-h1 { display: flex; align-items: center; gap: 2px; min-width: 0; }
.ph-ico { display: grid; flex: none; place-items: center; width: 44px; height: 44px; padding: 0; background: none; border: 0; border-radius: var(--radius); color: var(--text); cursor: pointer; text-decoration: none; }
.page a.ph-ico { color: var(--text); }
.ph-ico:disabled { opacity: .3; cursor: default; }
.ph-name { display: grid; flex: 1; min-width: 0; min-height: 44px; align-content: center; padding: 0 4px; background: none; border: 0; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.ph-name b { font-size: 16px; line-height: 1.2; }
.ph-name small { color: var(--muted); font-size: 12px; line-height: 1.2; }
.ph-name small.cond { color: var(--highlight); }
.ph-h2 { display: grid; grid-template-columns: minmax(0, 1fr) 50px 50px 50px; gap: 4px; }
.ph-stat { display: grid; justify-items: center; align-content: center; min-width: 0; min-height: 50px; padding: 2px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); font: inherit; cursor: pointer; }
.ph-stat small { color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; }
.ph-stat b { font-size: 20px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.ph-stat.set b { color: var(--highlight); }
.ph-hp { padding: 2px 8px; }
.ph-hpline { display: flex; align-items: baseline; gap: 4px; }
.ph-hpline b { font-size: 22px; }
.ph-hpline span { color: var(--muted); font-size: 14px; }
.ph-hpline .ph-temp, .ph-hpnow .ph-temp { color: var(--accent); font-weight: 600; }
.ph-hp .hb-hpbar { height: 5px; margin-top: 2px; }
.ph-hp.low { border-color: var(--gold-line); }
.ph-hp.low .hb-hpbar i:first-child { background: var(--gold-line); }
.ph-hp.down { background: var(--danger-bg); border-color: var(--danger-line); }
/* a phone on its side: everything on one line */
@media (max-height: 500px) {
    .ph-on { --tabh: 44px; }
    .ph-on .ph-head { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); align-items: center; gap: 4px 8px; }
    .ph-h2 { grid-template-columns: minmax(90px, 1fr) 46px 46px 46px; }
    .ph-stat { min-height: 44px; }
    .ph-stat small { font-size: 10px; } .ph-stat b { font-size: 16px; } .ph-hpline b { font-size: 18px; } .ph-hp .hb-hpbar { margin-top: 0; }
    .tabbar svg { display: none; }
}

/* notices under the header: one line until tapped */
.ph-on #hb-fight, .ph-on #hb-dmbar, .ph-on #hb-camps { margin: 0; padding: 4px 12px; border-radius: 0; }
.ph-on #hb-dmbar:not(.ph-open) .hb-dmnotes, .ph-on #hb-camps:not(.ph-open) p + p { display: none; }
.ph-on #hb-dmbar:not(.ph-open) p, .ph-on #hb-camps:not(.ph-open) p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 36px; }
.ph-on .hb-dmbar, .ph-on .hb-camps { cursor: pointer; }

.ph-note { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 8px; padding: 4px 12px; background: var(--card2); border-bottom: 1px solid var(--line-strong); font-size: 14px; }

/* dice button, roll card and toasts: above the tab bar, in thumb reach; inside an open sheet they sit at its foot */
.ph-on .hb-dice { left: auto; right: 12px; bottom: calc(var(--tabh) + env(safe-area-inset-bottom) + 8px); justify-items: end; z-index: 50; }
.ph-on .hb-dicebtn { width: 56px; height: 56px; background: var(--btn); border-color: var(--btn-line); color: var(--on-btn); }
html.ph-typing #ph-tabs, html.ph-typing .hb-dice { display: none; }
.ph-on #hb-rolls { top: auto !important; left: auto; right: 12px; max-width: calc(100vw - 24px); justify-items: end; bottom: calc(var(--tabh) + env(safe-area-inset-bottom) + 72px); max-height: none; overflow: visible; z-index: 50; }
/* a small pill on phones (owner, 2026-11-04): the roll's name and total; the dice are in the log */
.ph-on .hb-rollcard { display: flex; align-items: center; gap: 8px; width: auto; max-width: 100%; min-height: 44px; padding: 4px 14px; border-left-width: 1px; border-radius: 999px; }
.ph-on .hb-rollhead { display: block; min-width: 0; overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.ph-on .hb-rollhead small, .ph-on .hb-rolldice, .ph-on .hb-other .hb-rollwhat { display: none; }
.ph-on .hb-rolltot, .ph-on .hb-rollcard.hb-each .hb-rolltot { flex: none; font-size: 20px; }
.ph-on .hb-rollcard.hb-nat20 { border-color: var(--gold-line); }
.ph-on .hb-rollcard.hb-nat1 { border-color: var(--danger-line); }
.ph-on .toasts { left: 12px; right: 12px; bottom: calc(var(--tabh) + env(safe-area-inset-bottom) + 72px); width: auto; z-index: 55; }
.ph-on dialog #hb-rolls, .ph-on dialog .toasts { bottom: 12px; }
.ph-on #hb-throw { width: 100%; height: 100dvh; }

/* 44 px for everything you tap; small boxes keep their looks with a bigger tap area, links inside sentences get room instead */
.ph-on .hb .btn { min-height: 44px; justify-content: center; }
.ph-on .hb .btn.small { padding: 5px 12px; font-size: 14px; }
.ph-on .hb-coinbox .btn { min-width: 44px; }
.ph-on .hb .field { min-height: 44px; font-size: 16px; } /* 16 px: iPhone Safari zooms into anything smaller */
.ph-on .hb-x { display: inline-grid; flex: none; place-items: center; width: 44px; height: 44px; }
.ph-on .hb-edit { width: 44px; height: 44px; right: 0; bottom: 0; }
.ph-on .hb .rowi { min-height: 44px; padding: 0 4px 0 0; }
.ph-on .hb-link { min-height: 44px; }
.ph-on .hb-hpf { width: 100%; }
.ph-on .hb-roll, .ph-on .hb-rollbtn, .ph-on .stabs button, .ph-on .hb-d20, .ph-on .hb-sub button { position: relative; min-width: 44px; min-height: 36px; }
.ph-on .hb-roll::after, .ph-on .hb-rollbtn::after, .ph-on .stabs button::after, .ph-on .hb-d20::after, .ph-on .hb-sub button::after { content: ""; position: absolute; inset: -4px 0; }
.ph-on .stabs { gap: 8px 4px; }
.ph-on .hb-sub button { font-size: 13px; }
.ph-on .hb button.badge { min-height: 44px; padding-inline: 12px; font-size: 14px; }
.ph-on .hb .hb-prof, .ph-on .hb-dot { position: relative; display: grid; flex: none; place-items: center; width: 44px; height: 44px; margin: 0; }
.ph-on .hb .hb-prof { background: none !important; border: 0; border-radius: 0; box-shadow: none; }
.ph-on .hb .hb-prof::before { content: ""; width: 18px; height: 18px; border: 2px solid var(--line-strong); border-radius: 50%; }
.ph-on .hb .hb-prof.l1::before { background: linear-gradient(90deg, var(--accent) 50%, transparent 50%); border-color: var(--accent); }
.ph-on .hb .hb-prof.l2::before { background: var(--accent); border-color: var(--accent); }
.ph-on .hb .hb-prof.l3::before { background: var(--accent); border-color: var(--highlight); box-shadow: 0 0 0 2px var(--card2), 0 0 0 3.5px var(--highlight); }
.ph-on .hb-dot input { width: 18px; height: 18px; }
.ph-on .hb-pips { gap: 0; }
.ph-on .hb-pips button { display: grid; place-items: center; width: 44px; height: 44px; background: none; border: 0; }
.ph-on .hb-pips button::before { content: ""; width: 20px; height: 20px; border: 2px solid var(--accent); border-radius: 4px; }
.ph-on .hb-pips button.used { background: none; }
.ph-on .hb-pips button.used::before { background: var(--accent); }
.ph-on .hb-pips button.extra::before { border-style: dashed; }
.ph-on .hb-panel .kv .hb-bad-pips .hb-pips button { background: none; }
.ph-on .hb-panel .kv .hb-bad-pips .hb-pips button::before { border-color: var(--danger-line); }
.ph-on .hb-panel .kv .hb-bad-pips .hb-pips button.used::before { background: var(--danger-line); }
.ph-on .hb-prep { display: grid; flex: none; place-items: center; width: 44px; height: 44px; }
.ph-on .hb-prep input, .ph-on .hb-c input, .ph-on .ph-profrow input { width: 22px; height: 22px; }
.ph-on .hb .check { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.ph-on .hb-insp input { width: 28px; height: 28px; }
.ph-on .hb details > summary { display: flex; align-items: center; min-height: 44px; }
.ph-on .hb-prop, .ph-on .hb-basics p { line-height: 2; }
.ph-on .hb-nitem { min-height: 44px; }
.ph-on .hb-nlist { max-height: none; }
.ph-on .hb-level .hb-x { width: 44px; height: 44px; }
.ph-on .hb-two { grid-template-columns: minmax(0, 1fr); }

/* Main */
.ph-jump { margin: 0; }
.ph-sec h2 { display: flex; align-items: center; gap: 4px; }
.ph-tool { margin-left: auto; color: var(--muted); }
.ph-abils { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.ph-abils .hb-abil { gap: 0; min-height: 76px; padding: 4px; background: var(--card2); }
.ph-on .ph-abils .hb-roll { position: static; background: none; border: 0; font-size: 24px; font-weight: 700; }
.ph-on .ph-abils .hb-roll::after { inset: 0; }
.ph-abils small { font-size: 12px; }
.ph-profrow { margin-top: 6px; padding-left: 10px !important; }
.ph-rests { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }

/* one-line rows */
.ph-on .hb-entry { padding: 2px 8px; gap: 2px; }
.ph-on .hb-entry-h { flex-wrap: nowrap; }
.ph-on .hb .ph-rowname { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ph-rowq { display: flex; flex: none; flex-wrap: nowrap; align-items: center; gap: 4px; max-width: 62%; color: var(--muted); font-size: 12px; }
.ph-rowq small { white-space: nowrap; }
.ph-rowopen { display: grid; gap: 4px; padding: 4px 0 6px; font-size: 14px; }
.ph-rowbtns { display: flex; align-items: center; gap: 4px; }
.ph-on .hb-sum { flex: none; }
.ph-on .hb-res .hb-entry-h { flex-wrap: wrap; }
.ph-on .hb-res .hb-entry-h:has(> b.grow) { flex-wrap: nowrap; }
.ph-on .hb-editor { padding-bottom: 6px; }

/* the bottom sheets' contents */
.bsheet-body h3 { margin: 8px 0 0; color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.ph-hpnow { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center; gap: 6px; }
.ph-hpnow b { font-size: 40px; line-height: 1; }
.ph-hpnow > span { color: var(--muted); font-size: 18px; }
.ph-hpform { display: grid; gap: 10px; }
.ph-on .hb .ph-amt { font-size: 24px; font-weight: 700; text-align: center; }
.ph-hpgo { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; }
.ph-on .hb .ph-hpgo .btn { min-height: 56px; font-size: 17px; font-weight: 600; }
.ph-on .hb .btn.ph-dmg { background: var(--danger-bg); border-color: var(--danger-line); }
.ph-on .hb .btn.ph-heal { background: var(--ok-bg); border-color: var(--ok-line); }
.ph-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.ph-dice { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.ph-die { position: relative; display: grid; }
.ph-die.has .hb-die { padding-right: 44px; border-color: var(--accent); }
.ph-minus { position: absolute; top: 0; right: 0; width: 44px; height: 44px; padding: 0; background: var(--accent-soft); border: 1px solid var(--btn-line); border-radius: 0 var(--radius) var(--radius) 0; color: var(--text); font: inherit; font-size: 18px; cursor: pointer; }
.ph-seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.ph-seg button { min-height: 44px; background: var(--card2); border: 1px solid var(--line); color: var(--text); font: inherit; font-size: 14px; cursor: pointer; }
.ph-seg button:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.ph-seg button:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.ph-seg button.on { background: var(--accent-soft); border-color: var(--btn-line); }
.ph-go { display: grid; grid-template-columns: 1fr 2fr; gap: 6px; }
.ph-loghead { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.ph-loghead h3 { margin: 0; }
.ph-loghead .stabs { margin: 0; }

/* the menu: the top bar's own buttons and fields, put in order */
.ph-menu { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; }
.ph-menu > * { order: 20; }
.ph-menu label { display: grid; gap: 2px; min-width: 0; color: var(--muted); font-size: 13px; }
.ph-menu > a.btn, .ph-menu > [data-act=custom] { order: 1; flex: 1 1 40%; }
.ph-menu [data-act=manage], .ph-menu .hb-pick, .ph-menu .mon-encbar, .ph-menu .mon-diffbar, .ph-menu .hb-gap, .ph-menu > .hb-pick { display: none !important; }
.ph-hc { order: 2; flex-basis: 100%; }
.ph-menu > .hb-name { order: 3; flex: 1 1 100%; }
.ph-menu > .hb-race, .ph-menu > .hb-align, .ph-menu > .hb-age { order: 4; flex: 1 1 40%; }
.ph-cls { order: 5; flex: 1 1 100%; }
.ph-on .hb-cls > label:first-child { flex: 1 1 100%; }
.ph-on .hb-cls .hb-lvl, .ph-on .hb-cls .hb-hitdie { flex: 1 1 40%; }
.ph-artw { order: 6; width: 96px; }
.ph-menu > [data-act=rest], .ph-menu > [href*="/characters/build"], .ph-menu > [data-act=dup] { order: 7; flex: 1 1 40%; }
.ph-hf { order: 8; flex-basis: 100%; }
.ph-menu > .hb-manage { order: 9; display: grid; flex: 1 1 100%; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.ph-authw { order: 10; flex: 1 1 100%; min-height: 44px; }
.ph-authw .auth { display: flex; align-items: center; gap: 8px; }
.ph-authw button { min-height: 44px; }
.ph-full { order: 11; flex: 1 1 100%; }
.ph-back { position: fixed; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 20; box-shadow: var(--lift); }
.ph-back[hidden] { display: none; }
@media print { .ph-back { display: none; } }
.ph-foot { order: 12; flex: 1 1 100%; color: var(--muted); font-size: 13px; }

/* Customise fills the phone; its Panels tab is rows */
.ph-on dialog.hb-dlg { width: 100%; max-width: 100%; margin: auto 0 0; }
.ph-on dialog.hb-dlg.hb-custdlg { height: calc(100dvh - 16px); }
.ph-on .hb-ptable thead { display: none; }
.ph-on .hb-ptable table, .ph-on .hb-ptable tbody { display: block; }
.ph-on .hb-ptable tr { display: flex; flex-wrap: wrap; align-items: center; gap: 0 4px; padding: 4px 0; border-bottom: 1px solid var(--line); }
.ph-on .hb-ptable td { padding: 0; border: 0; }
.ph-on .hb-ptable td:nth-child(2) { flex: 1 1 60%; min-width: 0; }
.ph-on .hb-ptable td:nth-child(2) .field { min-width: 0; width: 100%; }
.ph-on .hb-ptable td:nth-child(3) { flex: 1 1 60%; font-size: 13px; }
.ph-on .hb-ptable td:nth-child(1) { display: grid; place-items: center; width: 44px; height: 44px; }
.ph-on .hb-ptable td:last-child { margin-left: auto; }
