/* SSDNS Character Sheet · screen styles
   Look follows the PHB (1_SSDNS_PHB/styles.css): worn parchment, PHB drop-red, dark umber cards,
   ochre + Eldorite-green accents. Fonts are bundled (OFL) so it looks the same offline. */
@font-face { font-family: "Rye"; src: url("../fonts/Rye-Regular.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "IM Fell English SC"; src: url("../fonts/IMFellEnglishSC-Regular.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "Crimson Text"; src: url("../fonts/CrimsonText-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Crimson Text"; src: url("../fonts/CrimsonText-Italic.ttf") format("truetype"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Crimson Text"; src: url("../fonts/CrimsonText-SemiBold.ttf") format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Oswald"; src: url("../fonts/Oswald-VariableFont_wght.ttf") format("truetype"); font-weight: 200 700; font-display: swap; }

:root {
  --bg: #e6d7b8; --ink: #1a120c; --red: #58180d; --muted: #6a5644; --edge: #c4a574;
  --umber: #3a2616; --dark: #1d140d; --ochre: #b8862f; --eld: #3fbf9a; --parch: #efe2c2; --gunmetal: #4a5157;
  --line: #2b1d12; --fill: rgba(255, 250, 238, 0.55); --fill-hi: rgba(255, 252, 244, 0.85);
  --title: "Rye", "Rockwell Extra Bold", serif;
  --head: "IM Fell English SC", "Palatino Linotype", Palatino, serif;
  --label: "Oswald", "Arial Narrow", "Segoe UI", sans-serif;
  --body: "Crimson Text", "Palatino Linotype", Palatino, Georgia, serif;
  --tap: 36px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: #2a2218; color: var(--ink); font-family: var(--body); font-size: 15px; line-height: 1.3; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
.noscript { color: #fff; padding: 2rem; text-align: center; }

/* ---------------- app bar */
.appbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 16px; background: var(--dark); border-bottom: 2px solid var(--ochre); box-shadow: 0 2px 10px rgba(0,0,0,.45); }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-gun { width: 58px; height: auto; filter: drop-shadow(0 0 4px rgba(63,191,154,.35)); }
.brand-title { font-family: var(--title); color: var(--parch); font-size: 20px; letter-spacing: .02em; line-height: 1; white-space: nowrap; }
.brand-sub { font-family: var(--label); color: var(--ochre); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; margin-top: 3px; white-space: nowrap; }
#appVersion { color: var(--eld); }
.actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.btn { appearance: none; border: 1px solid var(--ochre); background: transparent; color: var(--parch); font-family: var(--label); font-size: 13px;
  letter-spacing: .08em; text-transform: uppercase; padding: 0 12px; min-height: var(--tap); border-radius: 2px; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; }
.btn:hover { background: rgba(184,134,47,.18); }
.btn:focus-visible, .tab:focus-visible, .chamber:focus-visible, .prof3:focus-visible { outline: 2px solid var(--eld); outline-offset: 2px; }
.btn-primary { background: var(--ochre); color: var(--dark); font-weight: 600; }
.btn-primary:hover { background: #d09a3a; }
.page .btn, .dlg .btn { color: var(--dark); border-color: var(--line); background: rgba(255,250,238,.7); }
.page .toggle, .page .tactics-note, .dlg .toggle, .dlg .tactics-note,
.page .reveal-bar, .dlg .reveal-bar { color: #2a1c12; }
.page .btn:hover, .dlg .btn:hover { background: var(--parch); }
.btn.sm { min-height: 30px; font-size: 11.5px; padding: 0 9px; }
.btn.xs { min-height: 28px; min-width: 28px; padding: 0 6px; font-size: 14px; }
.btn.ghost { border-color: transparent; background: transparent !important; }
.linkbtn { appearance: none; border: 0; background: none; color: inherit; text-decoration: underline; font-family: var(--label); letter-spacing: .06em;
  text-transform: uppercase; font-size: 12px; cursor: pointer; padding: 4px 6px; font-weight: 600; }

/* ---------------- save bar */
.savebar { position: sticky; top: 60px; z-index: 29; display: flex; align-items: center; gap: 8px; padding: 6px 16px; font-family: var(--label);
  font-size: 12.5px; letter-spacing: .04em; background: #2f3a33; color: #d9f3ea; border-bottom: 1px solid rgba(0,0,0,.4); }
.savebar-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--eld); flex: none; box-shadow: 0 0 6px var(--eld); }
.savebar.warn { background: #5a3d10; color: #fbe6bd; } .savebar.warn .savebar-dot { background: #f0b545; box-shadow: 0 0 6px #f0b545; }
.savebar.bad { background: #5c140c; color: #ffd9d0; } .savebar.bad .savebar-dot { background: #ff6a4d; box-shadow: 0 0 6px #ff6a4d; }
.savebar.busy .savebar-dot { animation: pulse 1s infinite alternate; }
.savebar.idle { background: #2c241b; color: #d8c9a8; } .savebar.idle .savebar-dot { background: #8b7a62; box-shadow: none; }
@keyframes pulse { from { opacity: .35; } to { opacity: 1; } }

/* ---------------- tabs */
.tabs { display: flex; justify-content: flex-start; align-items: flex-end; flex-wrap: wrap; gap: 4px; padding: 10px 12px 0; max-width: 1200px; margin: 0 auto; }
.tab { appearance: none; border: 1px solid #6b5236; border-bottom: 0; background: #3a2c1e; color: #d8c9a8; font-family: var(--head); font-size: 17px;
  padding: 8px 18px; min-height: 42px; cursor: pointer; border-radius: 3px 3px 0 0; white-space: nowrap; flex: 0 0 auto; }
.tab[aria-selected="true"] { background: var(--bg) url("../images/paper.jpg") center/cover; color: var(--red); border-color: var(--edge); }

/* ---------------- page */
main { padding: 0 12px 64px; }
.page { max-width: 1200px; margin: 0 auto; padding: 18px 20px 24px; background: var(--bg) url("../images/paper.jpg") center top / 100% auto repeat-y;
  box-shadow: 0 10px 28px rgba(0,0,0,.45), inset 0 0 0 1px rgba(120,85,45,.25); position: relative; }
h2 { font-family: var(--head); color: var(--red); font-weight: 400; font-size: 21px; margin: 0; line-height: 1.05; }
h3 { font-family: var(--label); text-transform: uppercase; letter-spacing: .1em; font-size: 12px; margin: 0; color: var(--red); font-weight: 600; }
h4 { font-family: var(--head); color: var(--red); font-weight: 400; font-size: 17px; margin: 10px 0 2px; border-bottom: 1px solid rgba(88,24,13,.35); }
h4 small { font-family: var(--body); color: var(--muted); font-size: 13px; }
label, .box-title, .pill span, .sq-box span, .shield-box span, .mini span { font-family: var(--label); text-transform: uppercase; letter-spacing: .07em; font-size: 10.5px; color: #3b2a1a; }
.fine { font-size: 12.5px; color: var(--muted); line-height: 1.25; }
.reminder { font-size: 12.5px; margin: 6px 0; padding: 4px 8px; background: rgba(88,24,13,.08); border-left: 3px solid var(--red); }

input[type=text], input[type=number], input:not([type]), select, textarea {
  width: 100%; border: 0; border-bottom: 1px solid var(--line); background: transparent; padding: 4px 3px; min-height: 30px; border-radius: 0; }
input[type=number] { -moz-appearance: textfield; }
input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
select { cursor: pointer; background: transparent; }
select:disabled { opacity: .5; }
textarea { border: 1px solid rgba(43,29,18,.45); background: var(--fill); resize: vertical; line-height: 1.35; padding: 6px 8px; }
input:focus, select:focus, textarea:focus { outline: none; background: var(--fill-hi); box-shadow: 0 1px 0 var(--eld); }
.calc { color: #16324a; }
.calc.overridden { color: var(--red); font-weight: 600; background: rgba(88,24,13,.07); }

.box { border: 1px solid var(--line); background: var(--fill); padding: 8px 10px; position: relative; border-radius: 3px; }
.box-title { display: block; text-align: center; font-weight: 600; margin-top: 4px; }
.box-title.bottom { margin-top: 6px; }
.box-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; border-bottom: 2px solid var(--ochre); margin: -2px 0 8px; padding-bottom: 3px; }
.sub-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.spot { height: 44px; width: auto; opacity: .9; }
.chk { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 11px; }
.chk input { width: 18px; height: 18px; accent-color: var(--red); }
.tiny { font-size: 10px; display: inline-flex; align-items: center; gap: 3px; cursor: pointer; }
.tiny input { width: 14px; height: 14px; accent-color: var(--red); }

/* custom checkboxes */
.cb { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; cursor: pointer; }
.cb input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; width: 100%; height: 100%; }
.cb-box { width: 16px; height: 16px; border: 1.5px solid var(--line); background: rgba(255,255,255,.6); border-radius: 50%; transition: background .1s; }
.cb input:checked + .cb-box { background: var(--line); box-shadow: inset 0 0 0 2px #f6ecd6; }
.cb input:focus-visible + .cb-box { outline: 2px solid var(--eld); outline-offset: 2px; }
.cb.bad input:checked + .cb-box { background: var(--red); }
.cb.gem .cb-box { width: 18px; height: 18px; border-radius: 2px; transform: rotate(45deg); border-color: #1f5c4b; }
.cb.gem input:checked + .cb-box { background: var(--eld); box-shadow: inset 0 0 0 2px #e8fff6, 0 0 6px rgba(63,191,154,.8); }
.cb.hexbox .cb-box { border-radius: 2px; width: 17px; height: 17px; }
.cb.hexbox input:checked + .cb-box { background: var(--ochre); box-shadow: inset 0 0 0 2px #fff4dc; }
.checkgrid { display: flex; flex-wrap: wrap; gap: 2px; align-items: center; }

/* ---------------- top block */
.topblock { display: grid; grid-template-columns: minmax(220px, 1fr) 2fr; gap: 14px; align-items: stretch; margin-bottom: 14px; }
.identity { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.portrait-slot { display: flex; flex-direction: column; gap: 6px; flex: 1 1 auto; min-height: 0; }
.portrait-slot .imgdrop { flex: 1 1 auto; min-height: 148px; flex-direction: column; gap: 8px; }
.portrait-slot .imgdrop img { width: 100%; height: 100%; max-height: none; object-fit: cover; }
.portrait-slot .imgdrop-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.portrait-silhouette { width: 76px; height: 84px; position: relative; display: block; }
.portrait-silhouette::before { content: ""; position: absolute; left: 22px; top: 0; width: 32px; height: 32px; border: 2px solid var(--line); border-radius: 50%; background: rgba(255,250,238,.7); }
.portrait-silhouette::after { content: ""; position: absolute; left: 10px; bottom: 0; width: 56px; height: 36px; border: 2px solid var(--line); border-radius: 28px 28px 6px 6px; background: rgba(255,250,238,.7); }
.portrait-slot .imgbtns { margin: 0; }
.portrait-url { display: flex; align-items: center; gap: 4px; flex: 1 1 8rem; min-width: 0; font-family: var(--label); font-size: 10.5px; letter-spacing: .07em; text-transform: uppercase; }
.portrait-url input { flex: 1; min-width: 0; min-height: 36px; }
.eldorite-bar { margin: 0 0 14px; }
.eldorite-bar .shards { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.eldorite-bar .shards-title, .eldorite-bar .shard-total, .eldorite-bar .shard-actions { grid-column: 1 / -1; }
.shard-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.shard-actions .es-total { font-family: var(--head); font-size: 26px; line-height: 1; min-width: 88px; }
.shard-actions select { width: auto; min-width: 120px; }
.hex-roll { display: flex; gap: 6px; align-items: center; margin-left: auto; }
.hex-roll select { width: auto; min-width: 110px; }
.hp-auto-note { margin: 4px 0 0; }
.store-wallet { font-size: 15px; margin: 0 0 12px; padding: 8px 10px; border: 1px solid var(--line); background: rgba(63,191,154,.08); }
.namebox { border: 1px solid var(--line); background: var(--fill); padding: 8px 12px 4px; border-radius: 3px; }
.namebox input, .namebox .mirror { font-family: var(--head); font-size: 26px; color: var(--red); border: 0; min-height: 40px; display: block; width: 100%; }
.namebox label { display: block; }
.topgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px 14px; border: 1px solid var(--line); background: var(--fill); padding: 6px 12px; border-radius: 3px; }
.tf { display: flex; flex-direction: column; justify-content: flex-end; min-width: 0; }
.tf label { margin-top: 2px; }
.pair { display: flex; gap: 6px; }
.pair select { flex: 1 1 9rem; min-width: 8.5rem; }
.tf-lineage .pair { flex-wrap: wrap; }
#lineageCard { flex: 1 1 100%; margin: 4px 0 0; }
.pair .lvl { width: 56px; flex: none; text-align: center; }
.topgrid .tf:not(.tf-calling) { position: relative; z-index: 1; }
.topgrid .tf-calling { grid-column: 1 / -1; position: relative; z-index: 3; }
.kit-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; position: relative; z-index: 4; }
.hp.hp-flash { animation: hpflash 2.6s ease; }
.hp.hp-heal { animation: hpheal 2.6s ease; }
@keyframes hpheal {
  0%, 55% { background: #2f7d4a; color: #fff; box-shadow: 0 0 0 3px #3fa866; }
  100% { background: var(--fill-hi); color: inherit; box-shadow: none; }
}
body.ask-open #sheet, body.wizard-open #sheet, body.ask-open .appbar, body.wizard-open .appbar { pointer-events: none; }
body.ask-open dialog, body.wizard-open dialog { pointer-events: auto; }
.ssdns-wizard { width: min(640px, 94vw); max-height: 86vh; overflow: auto; }
.wiz-body { display: flex; flex-direction: column; gap: 8px; }
.wiz-field { display: flex; flex-direction: column; gap: 4px; }
.wiz-err { color: #8d2b22; }
.cond-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.cond-levels, .cond-head { display: flex; flex-wrap: wrap; gap: 6px; }
.turn-badge { display: inline-flex; width: 1.6em; height: 1.6em; align-items: center; justify-content: center; border-radius: 50%; background: #3a2a1c; color: #f3e6cf; font-size: 11px; }
@keyframes hpflash {
  0%, 55% { background: #c4322a; color: #fff; box-shadow: 0 0 0 3px #e24a3c; }
  100% { background: var(--fill-hi); color: inherit; box-shadow: none; }
}
.your-turn-banner { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 80; display: flex; gap: 12px; align-items: center; background: var(--dark); color: var(--parch); border: 2px solid var(--eld); padding: 12px 16px; font-size: 16px; box-shadow: 0 8px 28px rgba(0,0,0,.55); }
.your-turn-banner[hidden] { display: none; }
.tab-warn { position: fixed; bottom: 0; left: 0; right: 0; top: auto; z-index: 90; background: #6a2a16; color: #fff; text-align: center; padding: 8px 12px; font-size: 14px; }
body.sheet-readonly input,
body.sheet-readonly select,
body.sheet-readonly textarea,
body.sheet-readonly button,
body.sheet-readonly [contenteditable="true"] { pointer-events: none; }
body.sheet-readonly .tab-warn,
body.sheet-readonly .tab-warn button { pointer-events: auto; }
.ssdns-ask p { font-size: 17px; line-height: 1.4; margin: 0 0 8px; }
.ssdns-ask .dlg-foot { gap: 8px; flex-wrap: wrap; }
.ssdns-ask .btn { min-height: 44px; min-width: 44%; }
.turn-panel { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; width: auto; max-width: calc(100% - 24px); margin: 8px 12px 0; padding: 8px 12px; border: 1px solid var(--ochre); background: rgba(29,20,13,.55); color: var(--parch); }
.turn-order-strip { display: flex; flex-wrap: nowrap; gap: 6px; overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }
.turn-panel #turnDetail { flex: 1 0 100%; min-width: 0; }
.turn-panel #turnDetail:empty { display: none; }
.turn-panel.your-turn { border-color: var(--eld); box-shadow: inset 0 0 0 1px var(--eld); }
.pact-focus { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0 0 8px; padding: 8px; border: 1px solid var(--line); background: var(--fill); }
/* 0.3.96: the revealed Borrowed Iron's engraving on its Gear-tab card (same 3:1 box as a gun card photo) */
.pact-iron-art { flex: 1 1 100%; aspect-ratio: 3 / 1; max-width: 520px; border: 1px solid #c4b497; background: #fffaf3; border-radius: 4px; overflow: hidden; }
.pact-iron-art img { width: 100%; height: 100%; object-fit: contain; object-position: center; display: block; }
.pact-iron-name { font-weight: 600; }
/* 0.3.100: before the DM reveals the iron, the card shows the plain square Borrowed Iron tile, centred */
.pact-iron-art.pact-iron-generic { aspect-ratio: auto; height: 120px; }

/* ---------------- page 1 grid */
.main-grid { display: grid; grid-template-columns: 1.1fr 1fr 1fr; grid-template-areas: "c1 c2 c3" "c1 feat feat"; gap: 12px; align-items: start; }
.col-1 { grid-area: c1; } .col-2 { grid-area: c2; } .col-3 { grid-area: c3; }
.span-23 { grid-area: fire; } .span-2 { grid-area: equip; } .span-3 { grid-area: feat; }
.col { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.abil-and-skills { display: grid; grid-template-columns: 92px 1fr; gap: 8px; }
.abilities { display: flex; flex-direction: column; gap: 8px; background: rgba(58,38,22,.12); padding: 6px; border: 1px solid var(--line); border-radius: 3px; }
.abil { background: var(--fill-hi); border: 1px solid var(--line); border-radius: 8px 8px 30px 30px / 8px 8px 16px 16px; text-align: center; padding: 4px 4px 6px; position: relative; }
.abil-name { font-family: var(--label); text-transform: uppercase; font-size: 9.5px; letter-spacing: .06em; font-weight: 600; }
.abil-mod { font-family: var(--head); font-size: 30px; line-height: 1; color: var(--ink); margin: 2px 0; }
.abil-score { width: 52px !important; margin: 0 auto; text-align: center; border: 1px solid var(--line) !important; border-radius: 50%; background: #fffaf0 !important; min-height: 28px !important; padding: 2px !important; font-weight: 600; }
.abil-note { font-family: var(--label); font-size: 9.5px; color: var(--red); min-height: 0; }
.stack { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.pill { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--fill); border-radius: 20px; padding: 2px 10px 2px 2px; }
.pill input { width: 46px; text-align: center; border: 1px solid var(--line); border-radius: 50%; background: #fffaf0; font-weight: 600; min-height: 34px; }
.pill span { font-weight: 600; }
.party-insp { padding: 6px 8px; }
.party-insp .box-title { margin: 0 0 4px; color: var(--red); }
.insp { justify-content: center; gap: 4px; }
.insp-rules { margin: 6px 0 0; padding-left: 14px; font-size: 11.5px; }
.rows { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 6px; min-height: 26px; border-bottom: 1px dotted rgba(43,29,18,.2); }
.row:last-child { border-bottom: 0; }
.row .calc.sm, .calc.sm { width: 40px; flex: none; text-align: center; min-height: 24px; padding: 2px; }
.row-name { font-size: 13.5px; line-height: 1.1; }
.row-name small { color: var(--muted); font-size: 11px; }
.prof3 { width: 24px; height: 24px; flex: none; border: 0; background: none; cursor: pointer; position: relative; padding: 0; }
.prof3::before { content: ""; position: absolute; left: 4px; top: 4px; width: 16px; height: 16px; border: 1.5px solid var(--line); border-radius: 50%; background: rgba(255,255,255,.6); box-sizing: border-box; }
.prof3.p1::before { background: var(--line); box-shadow: inset 0 0 0 2px #f6ecd6; }
.prof3.p2::before { background: var(--red); box-shadow: inset 0 0 0 2px #f6ecd6, 0 0 0 2px var(--ochre); }
.pill.wide { border-radius: 4px; }
.text-box textarea { min-height: 120px; }

/* ---------------- combat */
.combat { display: flex; flex-direction: column; gap: 8px; background: rgba(58,38,22,.1); }
.trio { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.sq-box, .shield-box { display: flex; flex-direction: column; align-items: center; justify-content: center; border: 1px solid var(--line); background: var(--fill-hi); padding: 6px 4px; text-align: center; border-radius: 3px; }
.shield-box { clip-path: polygon(0 0, 100% 0, 100% 62%, 50% 100%, 0 62%); padding-bottom: 18px; background: #fff9ec; }
input.big { font-family: var(--head); font-size: 28px !important; text-align: center; border: 0 !important; min-height: 38px; width: 100%; }
.sq-box span, .shield-box span { font-weight: 600; font-size: 9.5px; }
.armor-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.armor-row > label:first-child { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 180px; }
.armor-row select { flex: 1; min-width: 0; }
.hp { border: 1px solid var(--line); background: var(--fill-hi); border-radius: 6px 6px 0 0; padding: 6px 8px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; }
.hp-max { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; border-bottom: 1px solid rgba(43,29,18,.25); padding-bottom: 4px; }
.hp-max input { width: 70px; text-align: center; }
.hp-cur input { font-family: var(--head); font-size: 34px; text-align: center; min-height: 52px; border: 0; }
.hp-tmp input { font-family: var(--head); font-size: 26px; text-align: center; min-height: 52px; border: 0; }
.hp-cur, .hp-tmp { text-align: center; display: flex; flex-direction: column; }
.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.hd, .ds { border: 1px solid var(--line); background: var(--fill-hi); padding: 6px 8px; display: flex; flex-direction: column; gap: 4px; border-radius: 3px; }
.hd input[type=text] { text-align: center; font-family: var(--head); font-size: 20px; }
.mini { display: flex; align-items: center; gap: 6px; }
.mini input { width: 64px; text-align: center; }
.ds-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-family: var(--label); font-size: 10px; text-transform: uppercase; letter-spacing: .06em; }

/* ---------------- traits */
.traits { display: flex; flex-direction: column; gap: 8px; background: rgba(58,38,22,.08); }
.trait { border: 1px solid var(--line); background: var(--fill-hi); padding: 4px 6px 6px; border-radius: 3px; }
.trait-head { display: flex; align-items: center; justify-content: space-between; }
.trait-head label { font-weight: 600; }
.trait textarea { border: 0; background: transparent; min-height: 58px; padding: 2px; }
.roll { appearance: none; border: 1px solid var(--red); color: var(--red); background: transparent; font-family: var(--label); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; padding: 2px 7px; min-height: 26px; cursor: pointer; border-radius: 2px; }
.roll:hover { background: rgba(88,24,13,.08); }

/* ---------------- gear page */
.gear-target {
  display: flex; align-items: center; gap: 12px;
  margin: 8px 0 14px; padding: 10px 12px;
  border: 2px solid #8d1c14; background: #f6d5d0; color: #6e1212;
  border-radius: 4px;
}
.gear-bullseye { width: 36px; height: 36px; flex: 0 0 36px; }
.gear-target-slot { flex: 1; min-width: 0; }
.gear-target-label { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-family: var(--label); font-size: 14px; letter-spacing: .08em; text-transform: uppercase; font-weight: 700; color: #6e1212; }
.gear-target-label select { min-width: min(280px, 100%); font-weight: 700; border-color: #8d1c14; background: #fff8f6; }
.gear-columns { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(300px, 1fr); gap: 16px; align-items: start; }
.gear-col { min-width: 0; }
.gear-kit .equip-body { gap: 10px; }
.gear-kit .armor-row { margin-bottom: 8px; }

/* ---------------- firearms */
.firearms { background: rgba(255,250,238,.6); }
.gun-head { display: none; }
.gun { display: flex; flex-direction: column; gap: 8px; padding: 10px; margin: 0 0 10px; border: 1px solid var(--line); background: #fffaf3; border-radius: 4px; }
.g-card-top { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 10px; align-items: start; }
.g-photo { position: relative; width: 76px; height: 76px; display: flex; align-items: center; justify-content: center; text-align: center; font-family: var(--label); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: #6b5438; border: 1px dashed #8a7040; background: repeating-linear-gradient(45deg, #f6efe2, #f6efe2 6px, #efe4d0 6px, #efe4d0 12px); overflow: hidden; }
.g-photo.gun-x::after { content: ""; position: absolute; inset: 8%; background: linear-gradient(to bottom right, transparent 46%, #c41212 46%, #c41212 54%, transparent 54%), linear-gradient(to bottom left, transparent 46%, #c41212 46%, #c41212 54%, transparent 54%); pointer-events: none; z-index: 2; }
.g-card-top:has(.g-photo.has-art) { grid-template-columns: minmax(0, 1fr); }
.g-photo.has-art { width: 100%; height: auto; aspect-ratio: 3 / 1; border-style: solid; border-color: #c4b497; background: #fffaf3; }
.g-photo.has-art img { width: 100%; height: 100%; object-fit: contain; object-position: center; display: block; }
.g-stats { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 6px; }
.g-stats [data-label] { display: flex; flex-direction: column; gap: 2px; min-width: 52px; }
.g-stats [data-label]::before { content: attr(data-label); font-family: var(--label); font-size: 10px; letter-spacing: .07em; text-transform: uppercase; color: #3b2a1a; }
.gun .g-note { margin-top: 0; }
.gun .g-note:empty { display: none; }
.g-name select { font-weight: 600; }
.g-sub { display: flex; align-items: center; gap: 8px; margin-top: 2px; }
.g-sub .load { width: auto; min-height: 24px; font-size: 12.5px; padding: 0 2px; }
.gun:not(.is-shotgun) .load { display: none; }
.g-cal { font-family: var(--label); font-size: 11px; color: #1f5c4b; letter-spacing: .04em; }
.g-atk input, .g-dmg input { text-align: center; }
.g-rng, .g-cap, .g-mis { text-align: center; font-size: 13.5px; }
.g-mis { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.gun.empty .g-chamber-row, .gun.empty .g-smith, .gun.empty .g-actions, .gun.empty .g-note, .gun.empty .load-picks, .gun.empty .g-stats, .gun.empty .g-sub { display: none; }
.gun.jammed { background: rgba(88,24,13,.08); }
.gun.jammed .chamber.loaded { filter: grayscale(.8); }
.g-chamber-row, .g-actions, .g-smith, .g-mis { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.g-actions [data-gunroll],
.g-actions [data-gunmelee] { flex: 0 0 auto; }
.g-actions .g-gunmelee {
  flex: 0 0 auto;
  max-width: 100%;
  margin-left: 8px;
  line-height: 1.3;
}
.g-actions .g-gunmelee:empty { display: none; margin: 0; }
.g-smith select, .ammo-pool, .g-actions .cast-spell { flex: 1 1 140px; min-width: 0; }
.g-mis { margin-left: auto; }
.chambers { display: flex; flex-wrap: wrap; gap: 3px; }
.chamber {
  position: relative; width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid #3a2a1c;
  background: radial-gradient(circle at 50% 42%, #120c08 0 46%, #4a3828 50% 78%, #1a120c 100%);
  box-shadow: inset 0 2px 3px rgba(0,0,0,.7); cursor: pointer; padding: 0; color: transparent;
}
.chamber.loaded.brass {
  border-color: #6d4e16; color: transparent;
  background:
    radial-gradient(circle at 50% 50%, #a86b3c 0 12%, #f4f0e8 14% 26%, #5c4634 27% 32%, transparent 33%),
    linear-gradient(155deg, #fbe7b0 0%, #e0b44a 32%, #a67c2a 62%, #6b4a14 82%, #d7b15e 100%);
  box-shadow: inset 0 1px 1px rgba(255,244,210,.75), inset 0 -2px 3px rgba(70,40,8,.5);
}
.chamber.loaded.tinted {
  border-color: #1a120c;
  background:
    radial-gradient(circle at 50% 50%, rgba(30,18,8,.55) 0 12%, #f3efe6 14% 26%, rgba(0,0,0,.45) 27% 32%, transparent 33%),
    var(--case, #c4a35a);
  box-shadow: inset 0 1px 1px rgba(255,255,255,.28), inset 0 -2px 3px rgba(0,0,0,.4);
}
.chamber.loaded:hover { transform: scale(1.12); }
.ammo-holster { display: grid; grid-template-columns: 1.5fr 1fr; gap: 14px; margin: 10px 0 8px; }
.ammo-list { display: flex; flex-direction: column; gap: 4px; }
.ammo-row { display: grid; grid-template-columns: minmax(120px, 1fr) 84px 28px 56px 28px 28px; gap: 4px; align-items: center; }
.ammo-row input[type=number] { text-align: center; font-weight: 600; }
.holster select { margin-bottom: 4px; }
.holster .fine { margin: 4px 0 0; }
.firearms > textarea { min-height: 48px; }

/* ---------------- equipment + shards */
.equipment { display: block; }
.shards { display: flex; flex-direction: column; gap: 5px; }
.shards-title { font-family: var(--label); text-transform: uppercase; font-size: 10.5px; letter-spacing: .08em; font-weight: 600; text-align: center; color: var(--red); }
.shard { display: grid; grid-template-columns: 18px 1fr; grid-template-rows: auto auto; column-gap: 6px; align-items: center; border: 1px solid var(--line); background: var(--fill-hi); border-radius: 12px; padding: 3px 8px 3px 6px; }
.shard .gem { grid-row: 1 / 3; width: 16px; height: 20px; clip-path: polygon(50% 0, 100% 28%, 100% 72%, 50% 100%, 0 72%, 0 28%); border: 0; box-shadow: inset 0 0 0 1px rgba(0,0,0,.4); }
.shard-name { font-family: var(--label); text-transform: uppercase; font-size: 10px; letter-spacing: .06em; font-weight: 600; }
.shard input { grid-column: 2; font-weight: 600; min-height: 26px; padding: 1px 2px; }
.shard-val { grid-column: 2; font-size: 10.5px; color: var(--muted); font-family: var(--label); letter-spacing: .03em; }
.shard-white .gem { background: linear-gradient(135deg, #fff, #d9d6cc); }
.shard-blue .gem { background: linear-gradient(135deg, #8cc0ff, #2c62b5); }
.shard-green .gem { background: linear-gradient(135deg, #9ff2d6, #1f8f6d); }
.shard-yellow .gem { background: linear-gradient(135deg, #ffe89a, #c4921c); }
.shard-purple .gem { background: linear-gradient(135deg, #d8b3ff, #6b35a8); }
.shard-total { font-family: var(--label); font-size: 11px; text-align: center; color: #1f5c4b; letter-spacing: .03em; }
.equip-body { display: flex; flex-direction: column; min-width: 0; }
.quickadd { display: flex; gap: 6px; margin-bottom: 6px; }
.equip-body textarea { flex: 1; min-height: 230px; }

/* ---------------- features */
.features { display: flex; flex-direction: column; gap: 6px; }
.feats select { width: auto; max-width: 60%; font-size: 13px; min-height: 28px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; min-height: 26px; }
.chip { display: inline-flex; align-items: center; gap: 2px; padding: 2px 4px 2px 9px; background: var(--umber); color: var(--parch); border: 1px solid var(--ochre); font-family: var(--label); font-size: 12px; letter-spacing: .04em; border-radius: 12px; }
.chip-x { appearance: none; border: 0; background: none; color: var(--ochre); cursor: pointer; font-size: 16px; line-height: 1; min-width: 24px; min-height: 24px; }
.features textarea { min-height: 200px; }
.ref { border-top: 2px solid var(--ochre); padding-top: 4px; }
.ref summary { cursor: pointer; font-family: var(--label); text-transform: uppercase; letter-spacing: .08em; font-size: 11.5px; color: var(--red); font-weight: 600; min-height: 30px; display: flex; align-items: center; }
#refBody { font-size: 13.5px; max-height: 520px; overflow: auto; padding-right: 4px; }
#refBody ul { margin: 2px 0 6px; padding-left: 18px; }
#refBody p { margin: 3px 0; }

/* ---------------- page 2 */
.topgrid.g3 { grid-template-columns: repeat(3, 1fr); }
.story-grid { display: grid; grid-template-columns: 1fr 1fr; grid-template-areas: "portrait allies" "backstory addl" "backstory treasure"; gap: 12px; align-items: start; }
.portrait { grid-area: portrait; } .allies { grid-area: allies; } .backstory { grid-area: backstory; } .addl { grid-area: addl; } .treasure { grid-area: treasure; }
.backstory textarea { min-height: 560px; }
.imgdrop { border: 1px dashed var(--line); background: rgba(255,255,255,.35); min-height: 220px; display: flex; align-items: center; justify-content: center; cursor: pointer; overflow: hidden; }
.imgdrop img { max-width: 100%; max-height: 320px; display: block; }
.imgdrop.has .imgdrop-empty { display: none; }
.imgdrop-empty { font-family: var(--label); text-transform: uppercase; letter-spacing: .08em; font-size: 11px; color: var(--muted); }
.imgbtns { display: flex; gap: 6px; margin: 6px 0; }
.gang { display: grid; grid-template-columns: 1fr 110px; gap: 10px; align-items: end; }
.gang-name input { font-family: var(--head); font-size: 20px; }
.imgdrop.sym { min-height: 100px; }
.imgdrop.sym img { max-height: 110px; }
.draft-tag { font-family: var(--label); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; background: var(--red); color: var(--parch); padding: 2px 6px; border-radius: 2px; }
.add-row { display: flex; gap: 12px; align-items: flex-end; margin-bottom: 8px; flex-wrap: wrap; }
.num { display: flex; flex-direction: column; align-items: center; min-width: 76px; }
.num input, .num output { width: 70px; text-align: center; font-family: var(--head); font-size: 22px; border: 1px solid var(--line); background: #fffaf0; min-height: 36px; display: flex; align-items: center; justify-content: center; }
.num label { text-align: center; margin-top: 2px; }
.chk.big { font-size: 13px; min-height: var(--tap); }
.chk.big input { width: 22px; height: 22px; }
.usecount { display: flex; flex-wrap: wrap; gap: 3px; margin: 4px 0 8px; }
.tick { width: 10px; height: 18px; border: 1px solid var(--line); background: rgba(255,255,255,.5); }
.tick.third { margin-right: 6px; border-width: 1px 2px 1px 1px; }
.tick.on { background: var(--gunmetal); }
.tick.on.third { background: var(--red); }
.add-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.adjusted { display: flex; gap: 8px; margin: 8px 0 4px; }
.adj { flex: 1; border: 1px solid var(--line); background: var(--fill-hi); text-align: center; padding: 3px; font-family: var(--label); font-size: 13px; }
.adj b { display: block; font-size: 10px; letter-spacing: .08em; }
.adj.hit { color: var(--red); border-color: var(--red); }
.adj.zero { background: var(--red); color: #fff; }

/* ---------------- page 3 */
.hexhead { grid-template-columns: minmax(200px, 1fr) 2fr 120px; align-items: stretch; }
.hexinfo { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; border: 1px solid var(--line); background: var(--fill); padding: 6px 12px; border-radius: 3px; }
.hexstats { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.hexstats output { font-family: var(--head); font-size: 22px; min-height: 38px; display: flex; align-items: center; }
.hex-art { width: 120px; height: auto; align-self: center; filter: drop-shadow(0 2px 3px rgba(0,0,0,.35)); }
.restbar { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; flex-wrap: wrap; }
.restbar .fine { flex: 1; min-width: 240px; }
.spell-grid { columns: 3; column-gap: 12px; }
.sp-level { break-inside: avoid; margin-bottom: 12px; border: 1px solid var(--line); background: var(--fill); border-radius: 3px; display: inline-block; width: 100%; }
.sp-head { display: flex; align-items: center; gap: 8px; background: var(--umber); color: var(--parch); padding: 5px 8px; border-bottom: 2px solid var(--ochre); }
.sp-num { width: 34px; height: 34px; flex: none; border: 2px solid var(--ochre); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-family: var(--head); font-size: 20px; background: var(--dark); }
.sp-title { display: flex; flex-direction: column; }
.sp-title b { font-family: var(--head); font-weight: 400; font-size: 18px; }
.sp-title small { font-family: var(--label); font-size: 10.5px; letter-spacing: .05em; color: var(--eld); }
.sp-slots { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.sp-total { display: flex; align-items: center; gap: 6px; }
.sp-total span { font-family: var(--label); text-transform: uppercase; font-size: 10px; letter-spacing: .08em; color: var(--ochre); }
.sp-total input { color: var(--parch); border-bottom-color: var(--ochre); width: 40px; }
.sp-total input.overridden { color: #ffb4a3; background: rgba(255,255,255,.08); }
.hexgrid .cb-box { border-color: var(--ochre); background: rgba(255,255,255,.1); }
.sp-level.no-slots .sp-head { background: #4b3a2a; }
.sp-level.no-slots .hexgrid::before { content: none; }
.sp-lines { padding: 2px 8px 6px; }
.sp-line { display: flex; align-items: center; gap: 4px; }
.sp-line input[type=text] { min-height: 26px; padding: 2px; }
.wild { margin-top: 4px; }
.wild summary { cursor: pointer; font-family: var(--label); text-transform: uppercase; letter-spacing: .08em; font-size: 11.5px; color: var(--red); font-weight: 600; min-height: 30px; display: flex; align-items: center; }
.wild ol { margin: 4px 0; font-size: 13.5px; }

/* ---------------- overlays */
.drop-overlay { position: fixed; inset: 0; z-index: 60; display: none; align-items: center; justify-content: center; background: rgba(29,20,13,.8); color: var(--parch); font-family: var(--head); font-size: 28px; border: 4px dashed var(--eld); }
.drop-overlay.on { display: flex; }
.toast { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 70; max-width: min(640px, calc(100vw - 24px)); background: var(--dark); color: var(--parch); border: 1px solid var(--ochre); border-left: 4px solid var(--eld); padding: 10px 14px; font-size: 14px; box-shadow: 0 6px 22px rgba(0,0,0,.5); display: flex; gap: 10px; align-items: center; border-radius: 3px; }
.toast .linkbtn { color: var(--eld); }
.dlg { border: 1px solid var(--ochre); padding: 0; max-width: min(680px, calc(100vw - 20px)); width: 100%; background: var(--bg) url("../images/paper.jpg") center/cover; color: var(--ink); border-radius: 3px; }
.dlg::backdrop { background: rgba(10,6,3,.7); }
.dlg form { padding: 16px 18px; max-height: 84vh; overflow: auto; }
.dlg h2 { border-bottom: 2px solid var(--ochre); padding-bottom: 4px; margin-bottom: 6px; }
.dlg h3 { margin: 14px 0 6px; }
.ver, .game { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid rgba(43,29,18,.25); }
.game { flex-wrap: wrap; }
.game b { font-family: var(--head); font-weight: 400; font-size: 17px; color: var(--red); flex: 1; min-width: 180px; }
.dlg-foot { display: flex; justify-content: flex-end; margin-top: 12px; }
.shards.mini { flex-direction: row; flex-wrap: wrap; margin: 10px 0; }
.shards.mini .shard { width: auto; flex: 1 1 140px; max-width: 100%; min-width: 0; }
.shards.mini .shard-total { width: 100%; }
code { font-size: 12px; background: rgba(58,38,22,.1); padding: 0 3px; }

/* ---------------- tablet */
@media screen and (max-width: 1080px) {
  .main-grid { grid-template-columns: 1.1fr 1fr; grid-template-areas: "c1 c2" "c1 c3" "feat feat"; }
}
/* ---------------- phone */
@media screen and (max-width: 760px) {
  :root { --tap: 44px; }
  body { font-size: 16px; }
  .appbar { flex-direction: column; align-items: stretch; padding: 6px 8px; gap: 6px; }
  .brand-gun { width: 44px; } .brand-title { font-size: 17px; }
  /* v0.2.1: buttons wrap into a grid (nothing cut off at 360-390px) */
  .actions { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 4px; }
  .actions .btn { padding: 0 4px; font-size: 12px; letter-spacing: .05em; min-height: 40px; }
  .actions .btn[hidden] { display: none; }
  .savebar { position: static; padding: 6px 10px; font-size: 12.5px; flex-wrap: wrap; }
  .tabs { position: sticky; top: var(--appbar-h, 104px); z-index: 25; background: #2a2218; padding: 6px 4px 0; gap: 2px; }
  .tab { flex: 1; font-size: 14px; padding: 6px 4px; min-height: 46px; }
  main { padding: 0 0 80px; }
  .page { padding: 12px 10px 18px; box-shadow: none; }
  .topblock, .hexhead, .eldorite-bar { grid-template-columns: 1fr; }
  .portrait-slot .imgdrop { min-height: 180px; max-height: 240px; }
  .portrait-slot .imgbtns .btn, .portrait-url input { min-height: 44px; }
  .topgrid, .topgrid.g3, .hexinfo { grid-template-columns: 1fr 1fr; }
  .tf-calling { grid-column: 1 / -1; }
  .hex-art { display: none; }
  input[type=text], input[type=number], input:not([type]), select { min-height: 40px; font-size: 16px; }
  .main-grid { grid-template-columns: 1fr; grid-template-areas: "c1" "c2" "c3" "feat"; }
  .abil-and-skills { grid-template-columns: 1fr; }
  .abilities { display: grid; grid-template-columns: repeat(3, 1fr); }
  .row { min-height: 40px; }
  .row .calc.sm { width: 48px; min-height: 36px; }
  .prof3 { width: 40px; height: 40px; } .prof3::before { left: 11px; top: 11px; width: 18px; height: 18px; }
  .cb { width: 40px; height: 40px; } .cb-box { width: 20px; height: 20px; } .cb.gem .cb-box { width: 20px; height: 20px; }
  .insp { gap: 0; }
  .g-card-top { grid-template-columns: 64px minmax(0, 1fr); }
  .g-photo { width: 64px; height: 64px; }
  .g-card-top:has(.g-photo.has-art) { grid-template-columns: minmax(0, 1fr); }
  .g-photo.has-art { width: 100%; height: auto; aspect-ratio: 3 / 1; }
  .g-mis { margin-left: 0; align-items: flex-start; }
  .chamber { width: 34px; height: 34px; }
  .chambers { gap: 6px; }
  .gear-columns { grid-template-columns: 1fr; }
  .gear-target-label select, .g-actions .btn, .g-chamber-row .btn { min-height: 44px; }
  .ammo-holster { grid-template-columns: 1fr; }
  .ammo-row { grid-template-columns: 1fr 80px 40px 56px 40px 40px; }
  .btn.xs { min-width: 40px; min-height: 40px; }
  .equipment { grid-template-columns: 1fr; }
  .shards { display: grid; grid-template-columns: 1fr 1fr; }
  .shards-title, .shard-total { grid-column: 1 / -1; }
  .story-grid { grid-template-columns: 1fr; grid-template-areas: "portrait" "allies" "backstory" "addl" "treasure"; }
  .backstory textarea { min-height: 320px; }
  .spell-grid { columns: 1; }
  .sp-line input[type=text] { min-height: 40px; }
  .hexstats { grid-template-columns: 1fr 1fr 1fr; }
  .toast { bottom: 10px; font-size: 14px; }
  .tf-lineage { grid-column: 1 / -1; }
  .insp { display: grid; grid-template-columns: repeat(5, 40px); justify-content: center; }
  .duo { grid-template-columns: 1fr; }
  .hp-cur input { font-size: 34px; } .hp-tmp input { font-size: 26px; }
  .hd input[type=text] { font-size: 20px; }
  .namebox input, .namebox .mirror { font-size: 24px; }
  .num input, .num output { font-size: 22px; }
  .gang-name input { font-size: 20px; }
}
.sq-box output { font-family: var(--head); font-size: 24px; min-height: 38px; display: flex; align-items: center; justify-content: center; }
.armor-row select, .holster select { font-family: var(--body); font-size: 14px; text-transform: none; letter-spacing: 0; color: var(--ink); }

/* ---- v0.2 (2026-10-04): chambering, Tactical Reload, hex lead shells ---- */
.g-sub { flex-wrap: wrap; row-gap: 2px; }
.g-sub .chamber-sel { width: auto; max-width: 150px; min-height: 24px; font-size: 12.5px; padding: 0 2px; }
.g-sub .chamber-sel[hidden] { display: none; }
.g-btns { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.g-btns [hidden] { display: none !important; }
.g-count { font-family: "Oswald", sans-serif; font-size: 12px; color: var(--ink-soft, #5b4735); min-width: 2.4em; }
.btn.tr { background: transparent; }
.hexload { display: inline-flex; gap: 3px; align-items: center; }
.hexload .hex-lvl { width: auto; min-height: 24px; font-size: 12px; padding: 0 2px; }
.chamber.hex { color: #fff; font: 700 8px/1 "Oswald", sans-serif; text-shadow: 0 1px 1px #000; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 1px; }
.gun.is-caster .g-cal { color: #4a2a7a; }
@media screen and (max-width: 760px) {
  .chamber.hex { font-size: 14px; }
  .g-btns .btn { min-height: 34px; }
}
@media print { .g-btns .btn, .hexload { display: none !important; } }
.g-sub .mod-sel, .g-sub .cap-sel { width: auto; max-width: 120px; min-height: 24px; font-size: 12px; padding: 0 2px; }
.g-sub .mod-sel[hidden], .g-sub .cap-sel[hidden] { display: none; }
/* v0.2.1 */
.gun.tr-warn .btn.tr { border-color: #a3301f; color: #a3301f; box-shadow: 0 0 0 2px rgba(163,48,31,.25); }

/* v0.2.2 explosives + Storyteller kit */
.explosives { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--line); }
.explosives .ammo-row { grid-template-columns: minmax(180px, 2fr) 56px 28px 28px; }
.storyteller-kit { margin-top: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 4px; background: var(--fill); }
.storyteller-kit .storyteller-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px 10px; }
.storyteller-kit .field { display: flex; flex-direction: column; gap: 2px; font-size: 12px; }
.storyteller-kit .field span { font-family: var(--label); letter-spacing: .04em; text-transform: uppercase; opacity: .75; font-size: 11px; }
@media print {
  .explosives .btn, .storyteller-kit .btn { display: none !important; }
}


/* v0.2.3 spellbook */
.spellbook-empty { border: 1px dashed var(--line); background: var(--fill); padding: 16px 14px; border-radius: 4px; margin-bottom: 12px; }
.spellbook-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 10px; padding: 8px 10px; border: 1px solid var(--line); background: var(--fill-hi); border-radius: 4px; }
.spellbook-bar input[type=search] { flex: 1 1 160px; min-height: 40px; min-width: 140px; }
.spellbook-bar #spellLimits { flex: 1 1 100%; font-size: 12.5px; }
.spellbook-bar #spellLimits.warn { color: #a3301f; font-weight: 600; }
.spell-picker { border: 1px solid var(--ochre); background: var(--fill); border-radius: 4px; margin-bottom: 12px; max-height: 340px; display: flex; flex-direction: column; }
.spell-picker-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 10px; background: var(--umber); color: var(--parch); }
.spell-picker-levels { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.spell-picker-levels .btn { min-height: 34px; padding: 0 10px; }
.spell-picker-levels .btn.on { background: var(--ochre); color: #1a120a; }
.spell-picker-list { overflow: auto; padding: 4px 0; -webkit-overflow-scrolling: touch; }
.spell-pick { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; text-align: left; padding: 8px 12px; border: 0; border-bottom: 1px solid var(--line); background: transparent; cursor: pointer; font: inherit; color: inherit; min-height: 44px; }
.spell-pick:hover, .spell-pick:focus { background: rgba(196,149,58,.18); outline: none; }
.spell-pick .sp-name { font-weight: 600; }
.spell-pick .sp-meta { font-size: 12px; opacity: .75; }
.spell-pick.have { opacity: .55; }
.sp-line.known { gap: 6px; padding: 4px 0; border-bottom: 1px dotted var(--line); }
.sp-line.known .sp-label { flex: 1; font-size: 13.5px; line-height: 1.25; }
.sp-line.known .sp-alias { color: var(--umber); font-weight: 600; }
.sp-line.known .sp-phb { opacity: .75; font-size: 12px; }
.sp-line .btn.xs { min-height: 32px; min-width: 32px; }
.kit-crosswalk { margin-top: 6px; }
.kit-crosswalk select { flex: 1; min-height: 40px; }
@media screen and (max-width: 760px) {
  .spellbook-bar { padding: 8px; }
  .spell-picker { max-height: 50vh; }
  .sp-line.known { flex-wrap: wrap; }
}
@media print {
  .spellbook-bar, .spell-picker, #btnAddSpell, .sp-line .btn { display: none !important; }
  .spellbook-empty { display: none !important; }
}


/* ---- DM Join room bar (DMCC) ---- */
.dm-join-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 6px 16px; background: #1a2220; border-bottom: 1px solid rgba(63,191,154,.35);
  font-family: var(--label); font-size: 12px; color: #d9f3ea;
}
.dm-join-bar.joined { background: #1e3a32; border-bottom-color: var(--eld); }
.dm-join-label {
  letter-spacing: .12em; text-transform: uppercase; color: var(--eld); font-weight: 600;
}
.dm-join-bar input {
  width: 120px; min-height: 32px; padding: 4px 8px;
  border: 1px solid var(--eld); background: rgba(0,0,0,.25); color: var(--parch);
  font-family: var(--label); letter-spacing: .08em; text-transform: uppercase; border-radius: 2px;
}
.dm-join-bar .btn { color: var(--parch); border-color: var(--eld); }
.dm-join-status { color: #a8c4ba; letter-spacing: .04em; }
.dm-join-badge { border: 1px solid #3fbf9a; border-radius: 2px; padding: 2px 6px; letter-spacing: .08em; text-transform: uppercase; }
.dm-join-badge.reconnecting, .dm-join-badge.offline { border-color: #c45b4a; color: #f0c2b8; }
.version-banner { display: block; width: 100%; background: #6b3a12; color: #fff8ee; border: 0; padding: 8px 12px; text-align: center; cursor: pointer; font-family: var(--label); }
.feature-uses { display: flex; flex-wrap: wrap; gap: 8px 14px; margin: 0 0 8px; }
.melee-box { margin-top: 10px; }
#dlgSaloon[open] { display: flex; flex-direction: column; max-height: 92vh; }
#dlgSaloon .dlg-top { position: sticky; top: 0; z-index: 4; justify-content: flex-start; background: #f4efe4; margin-top: 0; }
#gameList { max-height: 46vh; overflow: auto; }
@media screen and (max-width: 1200px) {
  .topgrid, .topgrid.g3 { grid-template-columns: 1fr 1fr; }
  .tf-calling, .tf-lineage { grid-column: 1 / -1; }
}
@media (max-width: 520px) {
  .dm-join-bar { padding: 6px 10px; }
  .dm-join-bar input { width: 100px; }
}

/* v0.2 HP stepper, store, log, phone */
.hp-step { display: flex; align-items: center; gap: 6px; }
.hp-step input { flex: 1; min-width: 0; }
.hp-btn { min-width: 44px; min-height: 44px; font-size: 22px; padding: 0; line-height: 1; }
.hp-quick { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.hp-quick input { width: 88px; min-height: 44px; text-align: center; }
.hp.hp-down { box-shadow: inset 0 0 0 2px #a3301f; }
.cond-banner { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.cond-chip { font-family: var(--label); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; border: 1px solid #a3301f; color: #a3301f; border-radius: 99px; padding: 4px 8px; }
.hp-notice { margin-top: 6px; padding: 8px 10px; background: #2a2218; color: var(--parch, #efe2c2); border-radius: 4px; }
.page-title { font-family: var(--head); font-weight: 400; margin: 0 0 8px; }
.store-row, .log-item { display: flex; justify-content: space-between; gap: 8px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.log-item { flex-direction: column; align-items: flex-start; white-space: pre-line; }
.log-meta { font-size: 12px; opacity: .7; }
.log-filters, .log-chat { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.log-chat input { flex: 1 1 140px; min-height: 44px; }
.log-filters .btn.on { background: var(--ochre, #c4953a); color: #1a120a; }
.audio-ctl { display: inline-flex; align-items: center; gap: 4px; color: #d9f3ea; }
html, body { overflow-x: hidden; }
.sheet-dock {
  position: fixed; top: 0; right: 0; bottom: 0; width: 300px; z-index: 40;
  display: flex; flex-direction: column;
  background: #1c2420; color: #e8efe9; border-left: 1px solid #3a454c;
}
.sheet-dock .dock-head, .sheet-dock .dock-filters, .sheet-dock .dock-compose { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; padding: 8px; }
.sheet-dock .dock-head { justify-content: space-between; border-bottom: 1px solid #3a454c; }
.sheet-dock .dock-head b { font-family: var(--head); color: #3fbf9a; font-weight: 400; }
.sheet-dock .dock-feed { flex: 1; overflow: auto; padding: 8px; }
.sheet-dock .dock-item { border-bottom: 1px solid #3a454c; padding: 6px 2px; font-size: 14px; white-space: pre-line; }
.sheet-dock .dock-meta { font-size: 11px; letter-spacing: .04em; text-transform: uppercase; opacity: .7; }
.sheet-dock .dock-compose { border-top: 1px solid #3a454c; }
.sheet-dock .dock-compose input { flex: 1; min-width: 0; min-height: 40px; }
.sheet-dock .btn { color: #efe2c2; border-color: #3fbf9a; }
.sheet-dock .btn.on { background: #2a8a6e; color: #efe2c2; }
.dock-fab {
  display: none; position: fixed; right: 12px; bottom: 12px; z-index: 41;
  min-height: 44px; padding: 8px 14px; border-radius: 99px;
  background: #1f5c4b; color: #efe2c2; border: 1px solid #3fbf9a; cursor: pointer;
}
@media (min-width: 801px) {
  body:not(.sheet-dock-collapsed) .appbar,
  body:not(.sheet-dock-collapsed) .savebar,
  body:not(.sheet-dock-collapsed) .dm-join-bar,
  body:not(.sheet-dock-collapsed) .tabs,
  body:not(.sheet-dock-collapsed) .turn-panel,
  body:not(.sheet-dock-collapsed) .dice-tray,
  body:not(.sheet-dock-collapsed) main { margin-right: 300px; }
  body:not(.sheet-dock-collapsed) .turn-panel { max-width: calc(100% - 324px); }
  body.sheet-dock-collapsed .sheet-dock { width: 48px; }
  body.sheet-dock-collapsed .dock-filters,
  body.sheet-dock-collapsed .dock-feed,
  body.sheet-dock-collapsed .dock-compose,
  body.sheet-dock-collapsed .dock-head b { display: none; }
}
.store-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.store-tabs .btn { min-height: 44px; }
.store-row { display: flex; gap: 8px; align-items: center; justify-content: space-between; min-height: 44px; padding: 8px 0; border-bottom: 1px solid var(--line, #c8b89a); }
.store-row .btn { min-height: 44px; }
.store-row.sold { opacity: .55; }
.ref-tag { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; border: 1px solid #8a6a32; color: #8a6a32; padding: 1px 4px; }
@media (max-width: 800px) {
  #page-store { max-width: 100%; overflow-x: hidden; }
  body.store-tab-active .dock-fab { bottom: 76px; }
  body.store-tab-active .store-row { padding-right: 96px; }
  .appbar, .savebar, .dm-join-bar, .tabs, main { margin-right: 0 !important; }
  .dock-fab { display: inline-flex; align-items: center; gap: 6px; }
  .sheet-dock {
    top: auto; left: 0; right: 0; width: auto; height: min(68vh, 480px);
    transform: translateY(110%); transition: transform .2s ease; border-left: 0; border-top: 1px solid #3fbf9a;
  }
  body.dock-open .sheet-dock { transform: none; }
}
.d20 { min-width: 44px; min-height: 36px; padding: 0 6px; font-family: var(--label); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; border: 1px solid var(--red); color: var(--red); background: transparent; border-radius: 2px; cursor: pointer; }
.abil .d20 { margin: 0 auto 4px; }
.row .d20 { flex: none; }
.chamber.next { outline: 2px solid var(--red); outline-offset: 1px; }
.cast-through, .load-picks { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.cast-through[hidden], .load-picks:empty { display: none; }
.cast-spell, .cast-slot { min-height: 32px; max-width: 100%; }
.sheet-dock .dock-item.roll-attack, .log-item.roll-attack {
  box-shadow: inset 4px 0 0 #c46212; background: rgba(224, 122, 47, .16);
}
.sheet-dock .dock-item.roll-crit, .log-item.roll-crit {
  box-shadow: inset 4px 0 0 #d23b2f; background: rgba(210, 59, 47, .22);
}
.sheet-dock .roll-tag { font-weight: 700; letter-spacing: .08em; }
.sheet-dock .roll-attack .roll-tag { color: #ffb06a; }
.sheet-dock .roll-crit .roll-tag { color: #ff8d84; }
.log-item.roll-attack { background: #f6e2c4; }
.log-item.roll-attack .roll-tag { color: #8a3e08; font-weight: 700; letter-spacing: .08em; }
.log-item.roll-crit { background: #f3d2cc; }
.log-item.roll-crit .roll-tag { color: #8a1c14; font-weight: 700; letter-spacing: .08em; }
.shared-insp { display: flex; align-items: center; gap: 8px; margin: 4px 0 8px; }
.shared-insp b { font-family: var(--head); font-size: 28px; line-height: 1; }
.cond-list { display: flex; flex-direction: column; gap: 8px; }
.cond-card { border: 1px solid var(--line); background: var(--fill); padding: 8px 10px; border-radius: 3px; }
.cond-card.on { border-color: #a3301f; background: #f4e4d4; }
.cond-card h3 { margin: 0 0 4px; font-family: var(--head); font-weight: 400; font-size: 18px; }
.cond-card p { margin: 0; }
.lvl-block { border: 1px solid var(--line); margin: 8px 0; padding: 8px; }
.lvl-block legend, .lvl-block h3 { font-family: var(--head); font-weight: 400; }
.lvl-spell, .lvl-block .chk { display: flex; gap: 8px; align-items: flex-start; margin: 4px 0; }
.lvl-summary { margin-top: 8px; padding: 8px; background: rgba(58,38,22,.08); }
.lvl-two { display: flex; gap: 8px; }
.sq-box { position: relative; }
.sq-box .btn { margin-top: 4px; }
details.phone-fold > summary { cursor: pointer; font-family: var(--head); font-size: 18px; min-height: 44px; display: flex; align-items: center; }
#page-equip .firearms, #page-equip .equipment { margin-top: 10px; }
@media screen and (max-width: 414px) {
  html, body { overflow-x: hidden; max-width: 100%; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; justify-content: flex-start; }
  .tab { flex: 0 0 auto; min-height: 44px; font-size: 15px; padding: 8px 12px; }
  .dm-join-bar input, .log-filters .btn, .store-row .btn, .hp-quick .btn, .g-btns .btn, .d20, .cast-spell, .cast-slot { min-height: 44px; }
  .sheet-dock .dock-item, .log-item { font-size: 15px; padding: 8px 8px 8px 12px; line-height: 1.35; }
  .d20 { min-width: 44px; }
  main { padding-bottom: 96px; }
  .gun { grid-template-columns: 1fr 1fr; }
  .g-name, .g-load, .g-note { grid-column: 1 / -1; }
  .ammo-row, .explosives .ammo-row { grid-template-columns: 1fr 1fr; }
  .ammo-row > * { min-width: 0; }
  .topgrid, .topgrid.g3, .hexinfo { grid-template-columns: 1fr; }
  .brand-title, .brand-sub { white-space: normal; }
  .actions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sheet-dock { height: min(52vh, 420px); }
  .dock-fab { bottom: 10px; }
  .pair { flex-wrap: wrap; }
  .pair .lvl, #btnLevelUp { min-height: 44px; }
}

/* Explicit field colors. Android Chrome paints inputs a light gray and keeps
   inherited light text, which hid the table-log message. Dark chrome uses the
   log colors; the parchment sheet uses ink on a light field. */
.sheet-dock,
.dm-join-bar,
.appbar,
.savebar { color-scheme: dark; }
.sheet-dock input,
.sheet-dock textarea,
.sheet-dock select,
.dm-join-bar input,
.dm-join-bar textarea,
.dm-join-bar select {
  color-scheme: dark;
  background: #1e2a24 !important;
  color: #f2ead8 !important;
  -webkit-text-fill-color: #f2ead8 !important;
  caret-color: #f2ead8;
  border: 1px solid #3d5c4e;
}
.sheet-dock input::placeholder,
.sheet-dock textarea::placeholder,
.dm-join-bar input::placeholder,
.dm-join-bar textarea::placeholder {
  color: #c9bfa6;
  -webkit-text-fill-color: #c9bfa6;
  opacity: 1;
}
.sheet-dock input:-webkit-autofill,
.sheet-dock textarea:-webkit-autofill,
.sheet-dock select:-webkit-autofill,
.dm-join-bar input:-webkit-autofill,
.dm-join-bar textarea:-webkit-autofill,
.dm-join-bar select:-webkit-autofill {
  -webkit-text-fill-color: #f2ead8 !important;
  caret-color: #f2ead8;
  box-shadow: 0 0 0 1000px #1e2a24 inset;
}
.page input:not([type=checkbox]):not([type=radio]):not([type=button]):not([type=submit]):not([type=file]):not([type=range]):not([type=color]),
.page textarea,
.page select,
.dlg input:not([type=checkbox]):not([type=radio]):not([type=button]):not([type=submit]),
.dlg textarea,
.dlg select {
  color-scheme: light;
  background: #fff8ee;
  color: #1a120c;
  -webkit-text-fill-color: #1a120c;
  caret-color: #1a120c;
}
.page input::placeholder,
.page textarea::placeholder,
.dlg input::placeholder,
.dlg textarea::placeholder {
  color: #5c4a38;
  -webkit-text-fill-color: #5c4a38;
  opacity: 1;
}
.page input:focus,
.page textarea:focus,
.page select:focus,
.dlg input:focus,
.dlg textarea:focus,
.dlg select:focus {
  background: #fff8ee;
  color: #1a120c;
  -webkit-text-fill-color: #1a120c;
}
.dock-fab {
  bottom: calc(12px + env(safe-area-inset-bottom, 0px) + var(--vv-bottom, 0px));
}
@media (max-width: 800px) {
  .sheet-dock {
    bottom: var(--vv-bottom, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .dock-compose { padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px)); }
  body.dock-open .dock-fab,
  body.chat-focus .dock-fab {
    display: none !important;
  }
}
.your-turn-box { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 80; display: flex; align-items: center; justify-content: center; min-height: 44px; min-width: 160px; background: #b42318; color: #fff; text-align: center; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; padding: 12px 18px; border: 2px solid #ffd0c8; border-radius: 6px; box-shadow: 0 10px 28px rgba(0,0,0,.45); }
.your-turn-box[hidden] { display: none !important; }
.turn-order-strip { display: flex; gap: 6px; overflow-x: auto; padding: 0; width: max-content; max-width: 100%; }
.turn-chip { border: 1px solid #c8b89a; border-radius: 999px; padding: 4px 8px; white-space: nowrap; background: #f4efe4; display: inline-flex; gap: 6px; align-items: center; }
.turn-chip .chip-face { width: 36px; height: 36px; border-radius: 50%; display: inline-grid; place-items: center; background: rgba(0,0,0,.18); font-weight: 700; }
.turn-chip.current { background: #fff6d8; border-color: #8a6a22; box-shadow: 0 0 0 3px #e2c56a; opacity: 1; }
.turn-chip.ondeck { opacity: .55; }
.turn-chip.later { opacity: .32; }
.turn-chip.enemy, .turn-chip.side-enemy { background: #6e2430; color: #fff; }
.turn-chip.player, .turn-chip.side-pc { background: #2f5f73; color: #fff; }
.turn-chip.side-ally { background: #3d6b4f; color: #fff; }
.token-chip { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; vertical-align: middle; box-shadow: inset 0 0 0 1px rgba(0,0,0,.35); }
.name-mode { display: inline-flex; gap: 4px; align-items: center; }
.name-mode button.on { box-shadow: inset 0 0 0 2px currentColor; }
.status-chips .bloodied, .status-chips .status-bloodied { background: #8a3b12; color: #fff; }
.status-chips .down, .status-chips .status-down, .status-chips .status-unconscious { background: #6e2430; color: #fff; }
.status-chips .hurt, .status-chips .status-hurt { background: #a36b2a; color: #fff; }
.status-chips .unhurt, .status-chips .status-unhurt { background: #3d6b4f; color: #fff; }
.status-chips .fled, .status-chips .status-fled { background: #4a4038; color: #fff; }
.chamber-dot { width: 16px; height: 16px; border-radius: 50%; border: 1px solid #333; display: inline-block; background: transparent; padding: 0; }
.chamber-dot.full { background: #c4a35a; }
.chamber-dot.locked, .chamber.locked { background: #2a2420; color: #e23b32; font-weight: 800; font-size: 10px; line-height: 14px; }
.status-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.status-chips .chip { border-radius: 999px; padding: 2px 8px; font-size: 12px; background: #efe6d4; }
.status-chips .faction { background: #2f5f73; color: #fff; }
.status-chips .rage { background: #8a3b12; color: #fff; }
.status-chips .cover { background: #3d6b4f; color: #fff; }
.status-chips .cond { background: #6e2430; color: #fff; }
.wiz-ref { max-height: 80vh; overflow: auto; width: min(40rem, 92vw); }
.wiz-chart { width: 100%; border-collapse: collapse; margin: 8px 0 12px; }
.wiz-chart th, .wiz-chart td { border: 1px solid var(--edge); padding: 4px 8px; text-align: left; vertical-align: top; }
.wiz-chart th { width: 34%; font-family: var(--label); font-weight: 600; }
.wiz-page { margin-top: 12px; }
.wiz-kit { margin: 6px 0 10px; padding-left: 1.2rem; }
.d4-reveal { width: min(28rem, 92vw); text-align: center; }
.d4-reveal h2 { font-size: 1.7rem; }
.d4-face { font-size: 2.2rem; min-height: 3rem; }
.d4-fire { font-size: 1.7rem; font-weight: 700; color: #8a1c14; margin: 0.35rem 0 0.6rem; }
.d4-die { font-size: 4rem; min-width: 7rem; min-height: 7rem; }
#badgeState, #dmBadge { font: inherit; margin-left: 4px; }
.gun-status { display: block; font-weight: 700; }
.spell-more { margin: 4px 0 8px; }
.spell-more summary { cursor: pointer; }
.spell-desc { margin: 6px 0 0; max-width: 42rem; }
.spell-pick-row { display: flex; flex-direction: column; align-items: stretch; margin-bottom: 6px; }
.clean-modal { width: min(32rem, 94vw); }
.clean-opts { display: flex; flex-direction: column; gap: 8px; margin: 8px 0; }
#btnTakeCover.is-on { background: #3d6b4f; color: #fff; }

@media (max-width: 700px) {
  html, body { overflow-x: hidden; max-width: 100%; }
  .appbar, .savebar, .dm-join-bar, .toolbar, .log-filters, .log-chat, .dock-head, .dock-filters, .dock-compose, .g-btns, .actions {
    flex-wrap: wrap;
    max-width: 100%;
  }
  .tabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
  .tab { flex: 0 0 auto; }
  .tab, .btn, .btn.sm, .log-filters .btn, .dock-compose button, .name-mode button, .hp-btn, .d20 { min-height: 40px; min-width: 40px; }
  .chamber, .chamber-dot { width: 40px; height: 40px; min-width: 40px; min-height: 40px; }
  .roll { min-height: 40px; padding: 8px 10px; }
  .row .calc.sm, .calc.sm { min-height: 40px; min-width: 40px; }
  .turn-panel, .sheet-dock, main, .appbar { max-width: 100%; }
  img, video, canvas { max-width: 100%; }
  input, select, textarea { max-width: 100%; }
}
@media (max-width: 520px) {
  .appbar, .brand { flex-wrap: wrap; }
  .topgrid, .topgrid.g3, .hexinfo, .gun, .ammo-row { grid-template-columns: 1fr; }
  .form-grid, .pair { display: flex; flex-wrap: wrap; }
  main { padding-left: 8px; padding-right: 8px; }
  .your-turn-box { left: 8px; right: 8px; transform: none; width: auto; }
}
.item-gear { margin: 8px 0 12px; }
.item-row { display: flex; gap: 8px; align-items: flex-start; margin: 6px 0; }
.item-row .art-thumb { width: 96px; height: 36px; object-fit: cover; border-radius: 3px; }
.art-ph { display: inline-flex; width: 72px; height: 36px; align-items: center; justify-content: center; border: 1px dashed var(--line, #8a7560); font-size: 11px; color: var(--muted, #8a7560); }
.item-tag { font-size: 11px; border: 1px solid var(--line, #8a7560); padding: 0 4px; margin-right: 4px; }
.item-form label { display: block; margin: 4px 0; font-size: 13px; }
.item-form input, .item-form select { max-width: 100%; }
.item-form-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
/* 0.3.80 compact player "Add item ▾" menu */
.add-item-menu { position: relative; margin-top: 6px; }
.add-item-bar { display: flex; gap: 8px; align-items: center; }
.add-item-toggle { min-height: 36px; }
.add-item-pop {
  /* in normal flow (not absolute): the Items box sits near the bottom of the Gear page,
     and an overlay could hang past the end of the document where it can't be scrolled to */
  position: relative; margin-top: 4px; z-index: 2;
  max-height: min(60vh, 420px); overflow: auto; padding: 8px;
  background: var(--paper, #f6ecd6); color: var(--ink, #2a1f16);
  border: 1px solid var(--line, #8a7560); border-radius: 6px; box-shadow: 0 8px 22px rgba(0,0,0,.28);
}
.add-item-search { width: 100%; box-sizing: border-box; min-height: 36px; margin: 0 0 6px; padding: 4px 8px; }
.add-item-group { margin: 4px 0 8px; }
.add-item-group-head { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; opacity: .8; border-bottom: 1px solid var(--line, #8a7560); margin-bottom: 2px; }
.add-item-shelf-head { font-size: 11px; font-weight: 700; font-style: italic; opacity: .75; margin: 6px 0 1px 4px; }
.item-row .item-wt { margin-left: 4px; font-weight: 400; }
.add-item-pick {
  display: flex; justify-content: space-between; gap: 8px; width: 100%; text-align: left; min-height: 34px;
  padding: 4px 6px; background: transparent; border: 0; border-radius: 4px; color: inherit; font: inherit; cursor: pointer;
}
.add-item-pick:hover, .add-item-pick:focus-visible { background: rgba(138,117,96,.2); }
.add-item-custom { width: 100%; margin-top: 4px; }
.add-item-formwrap { margin-top: 8px; padding: 8px; border: 1px dashed var(--line, #8a7560); border-radius: 6px; }
.add-item-formhead { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.add-notes-panel { margin-top: 8px; padding: 8px; border: 1px dashed var(--line, #8a7560); border-radius: 6px; }
.add-notes-panel[hidden] { display: none; }
.add-notes-panel .quickadd { margin: 6px 0 4px; }
.add-notes-panel .quickadd input { flex: 1; min-width: 0; }
.add-item-group-notes { border-top: 1px solid var(--line, #8a7560); padding-top: 4px; }
@media (max-width: 520px) {
  .add-item-pick { min-height: 44px; }
  .add-item-toggle { min-height: 44px; }
}
.weight-line { font-weight: 600; }
/* 0.3.54 fading, non-blocking toasts */
.fade-toasts { position: fixed; top: 72px; left: 50%; transform: translateX(-50%); z-index: 9999; display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
.fade-toast { background: rgba(28,22,18,.94); color: #f3e6c8; border: 1px solid #c9a24a; border-radius: 8px; padding: 10px 18px; font-size: 18px; font-weight: 700; box-shadow: 0 4px 14px rgba(0,0,0,.4); transition: opacity .7s ease, transform .7s ease; }
.fade-toast.out { opacity: 0; transform: translateY(-8px); }
/* 0.3.54 items: attunement, created weapons, explosives in Items */
.attune-line { margin: 0 0 6px; font-weight: 700; }
.item-weapon-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; border: 1px dashed #c4b497; padding: 6px 8px; margin: 6px 0; }
.item-weapon-fields[hidden] { display: none; }
.exp-row { display: flex; gap: 8px; align-items: center; }
.exp-row .exp-name { flex: 1; }

/* Paper doll (0.3.54) — Art Bot B6 frame */
.doll-wrap { max-width: 540px; margin: 0 auto 14px; }
.doll { position: relative; width: 100%; aspect-ratio: 1080 / 1350; background-size: 100% 100%; background-repeat: no-repeat; container-type: inline-size; }
.doll-slot { position: absolute; padding: 0; border: 0; background-color: transparent; background-size: 100% 100%; cursor: pointer; overflow: hidden; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; font: inherit; color: #2b1d10; }
.doll-ro .doll-slot { cursor: default; }
.doll-slot:hover:not(div), .doll-slot:focus-visible { outline: 3px solid #8d1c14; outline-offset: -2px; }
.doll-art { position: absolute; inset: 8%; width: 84%; height: 84%; object-fit: contain; }
.doll-name { position: relative; z-index: 1; font-size: 2.1cqw; line-height: 1.1; background: rgba(245,232,205,.88); padding: 1px 3px; margin-bottom: 4%; max-width: 92%; text-align: center; border-radius: 3px; }
.doll-label { position: absolute; top: 3%; left: 0; right: 0; font-size: 1.7cqw; text-align: center; opacity: .55; text-transform: uppercase; letter-spacing: .03em; }
.doll-slot.filled .doll-label { opacity: 0; }
.doll-slot.filled:hover .doll-label { opacity: .8; }
.doll-unattuned { filter: grayscale(.8); }
.doll-off::after { content: "off: two-handed"; position: absolute; top: 40%; font-size: 1.8cqw; background: #8d1c14; color: #fff; padding: 1px 4px; border-radius: 3px; }
.doll-counter { position: absolute; display: flex; align-items: center; justify-content: center; gap: .3em; font-weight: 700; color: #2b1d10; font-size: 4.2cqw; }
.doll-es-unit { font-size: .6em; opacity: .75; }
.doll-pick { margin-top: 8px; padding: 8px; border: 1px solid #b39a6a; border-radius: 6px; background: #f6ecd6; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.doll-pick .fine { flex-basis: 100%; margin: 0; }
@media print { .doll-wrap { display: none; } }
/* 0.3.54: doll lives in the Gear right column; tiles are 9-sliced so tall/wide slots keep square corners. */
.doll-wrap.doll-in-col { max-width: 100%; width: 100%; margin: 0 0 12px; }
.doll-slot.doll-9 { background: none; border-style: solid; border-width: 0; border-image-slice: 34 fill; border-image-width: 2.8cqw; border-image-repeat: stretch; border-image-outset: 0; }
.doll-tall .doll-art, .doll-wide .doll-art { inset: 10% 8%; width: 84%; height: 80%; }
.doll-weapon .doll-art { object-fit: contain; filter: drop-shadow(0 1px 1px rgba(0,0,0,.4)); }
.mx-mine-ctl { display: inline-block; }
.mx-mine-ctl[open] { background: rgba(255,255,255,.08); border-radius: 6px; padding: 2px 6px; }
.art-upload .fine { margin: 2px 0 6px; }

/* 0.3.54: lineage description gets its own full-width row (no gap under Background/Player) */
.topgrid .lineage-row { grid-column: 1 / -1; margin: 0; padding: 2px 0 4px; }
.topgrid .lineage-row:empty { display: none; }
.instrument-list { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.instrument-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 8px; border: 1px solid #b39a6a; border-radius: 6px; background: rgba(246,236,214,.6); }
.instrument-row.is-focus { border-color: #8d1c14; }

/* 0.3.54: wizard spell picker (card grid) */
.spell-info-strip { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 8px 12px; margin: 4px 0 10px; border: 1px solid #b39a6a; border-left: 4px solid #8d1c14; border-radius: 6px; background: linear-gradient(180deg, #f6ecd6, #ead9b4); color: #2b1d10; font-size: 13px; }
.spell-info-strip .sis-cell b { font-variant: small-caps; letter-spacing: .03em; color: #6b3f12; margin-right: 2px; }
.spell-info-strip .sis-focus { flex-basis: 100%; font-size: 12px; opacity: .9; }
.spell-counter { position: sticky; top: 0; z-index: 3; display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 6px 10px; margin: 0 0 8px; background: #2b1d10; color: #f6e7c1; border-radius: 6px; font-weight: 700; font-size: 14px; box-shadow: 0 2px 6px rgba(0,0,0,.3); }
.spell-counter .sc-group.full { color: #9fe0a4; }
.spell-counter .sc-dots { display: inline-flex; gap: 3px; vertical-align: middle; margin-left: 4px; }
.spell-counter .sc-dot { width: 9px; height: 9px; border-radius: 50%; border: 1px solid #c9a227; background: transparent; display: inline-block; }
.spell-counter .sc-dot.on { background: #c9a227; }
.spell-counter.shake { animation: sc-shake .35s; }
@keyframes sc-shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.spell-section-head { margin: 12px 0 6px; padding-bottom: 3px; border-bottom: 2px solid #8a6a2c; font-size: 16px; color: #6b3f12; }
.spell-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; align-items: start; }
@media (max-width: 520px) { .spell-grid { grid-template-columns: 1fr; } }
.spell-card { position: relative; border: 2px solid #c8b083; border-radius: 8px; background: #fbf4e3; transition: border-color .12s, box-shadow .12s; }
.spell-card.is-picked { border-color: #8d1c14; box-shadow: 0 0 0 2px rgba(141,28,20,.18); background: #fff6e6; }
.spell-card-pick { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; width: 100%; text-align: left; padding: 8px 34px 8px 30px; background: none; border: 0; font: inherit; color: #2b1d10; cursor: pointer; min-height: 64px; }
.spell-check { position: absolute; left: 7px; top: 9px; width: 16px; height: 16px; border-radius: 50%; border: 2px solid #b39a6a; font-size: 11px; line-height: 12px; text-align: center; color: #fff; }
.spell-card.is-picked .spell-check { background: #8d1c14; border-color: #8d1c14; }
.spell-name { font-weight: 700; font-size: 14px; }
.spell-tag { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: #6b3f12; background: #ead9b4; border-radius: 3px; padding: 0 4px; }
.spell-line { font-size: 12px; opacity: .85; }
.spell-info { position: absolute; right: 6px; top: 6px; width: 22px; height: 22px; border-radius: 50%; border: 1px solid #8a6a2c; background: #f6ecd6; font: italic 700 13px/1 Georgia, serif; color: #6b3f12; cursor: pointer; padding: 0; }
.spell-card.is-open .spell-info { background: #6b3f12; color: #f6ecd6; }
.spell-card .spell-desc { margin: 0; padding: 0 10px 10px 30px; font-size: 12.5px; }
.doll-weapon .doll-name { font-size: 1.6cqw; }
.doll-tall.doll-weapon .doll-art { inset: auto; left: 50%; top: 46%; width: 230%; height: 40%; transform: translate(-50%, -50%) rotate(-90deg); }
.doll-weapon .doll-art ~ .doll-name { display: none; }

/* 0.3.54: per-turn action pips + cost tags on gun buttons + gunsmith rechamber dialog. */
.act-pips { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; margin-right: 8px; font: 600 11px/1 system-ui, sans-serif; }
.act-pips .pip-label { color: #7a5a2c; text-transform: uppercase; letter-spacing: .05em; }
.act-pips .pip { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; border: 2px solid #3d6b2e; background: #6fbf4f; color: #fff; font-weight: 800; box-shadow: inset 0 -2px 3px rgba(0,0,0,.25); }
.act-pips .pip-bonus { border-color: #8a6a12; background: #e2b33a; }
.act-pips .pip { width: auto; min-width: 24px; height: 24px; padding: 0 9px; border-radius: 12px; cursor: pointer; font: 800 11px/1 system-ui, sans-serif; }
.act-pips .pip:hover { filter: brightness(1.08); outline: 2px solid rgba(61,107,46,.35); outline-offset: 1px; }
.act-pips .pip-reaction { border-color: #2f5f86; background: #5c9bd1; }
.act-pips .pip.used.partial { background: linear-gradient(90deg, #d8d0c2 50%, #6fbf4f 50%); color: #2c2a24; text-decoration: none; }
.act-pips .pip.used { background: #d8d0c2; border-color: #a99d8a; color: #8a7f6c; text-decoration: line-through; box-shadow: none; }
.gun button[data-cost]::after { content: attr(data-cost); display: inline-block; margin-left: 5px; padding: 1px 4px; border-radius: 3px; background: #efe4cc; color: #6b4f22; font: 700 9px/1.2 system-ui, sans-serif; text-transform: uppercase; letter-spacing: .03em; vertical-align: middle; }
.gun button[data-cost="Bonus"]::after { background: #f6e2a8; }
.gun button[data-cost="Full turn"]::after { background: #f2c9b8; color: #7a2a14; }
.gun button[data-cost="Free"]::after { background: #d9eccf; color: #2f5a22; }
.rc-modal { position: fixed; inset: 0; z-index: 9000; background: rgba(20, 14, 8, .55); display: flex; align-items: center; justify-content: center; padding: 16px; }
.rc-card { background: #fbf5e8; color: #2a1e12; border: 2px solid #8a6a3a; border-radius: 10px; max-width: 480px; width: 100%; padding: 16px 18px; box-shadow: 0 10px 30px rgba(0,0,0,.4); }
.rc-card h3 { margin: 0 0 6px; font-size: 18px; }
.rc-list { display: grid; gap: 6px; margin: 10px 0; }
.rc-row { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; padding: 8px 10px; border: 1px solid #d6c6a6; border-radius: 6px; background: #fff; cursor: pointer; }
.rc-row:has(input:checked) { border-color: #8a6a3a; background: #f6ecd6; }
.rc-row.rc-off { opacity: .55; cursor: not-allowed; }
.rc-cost { font-weight: 700; color: #6b4f22; font-size: 13px; }
.rc-off .rc-cost { font-weight: 400; font-size: 12px; }
.rc-btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.rc-msg { min-height: 1.2em; color: #8e241f; }
.rc-btns .btn { background: #fff; color: #2a1e12; border: 1px solid #8a6a3a; opacity: 1; }
.rc-btns .btn:last-child { background: #6b4f22; color: #fff8e6; border-color: #4a3414; }
.rc-btns .btn:disabled { opacity: .5; }

/* 0.3.55 End turn (only on your turn) */
.turn-panel .end-turn { margin-left: 8px; background: #8b2f1f; color: #fff; border-color: #5e1e13; font-weight: 700; }
.turn-panel .end-turn[hidden] { display: none; }
/* 0.3.55 Now playing */
.mx-now { font: 600 12px/1.2 system-ui, sans-serif; color: #b9ab8f; max-width: 48ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mx-now.on { color: #f3d27a; }
.mx-mine-ctl label, .mx-mine-ctl .vol-pct { color: #f3e6c8; }
/* pd-labels: a branded plate on every slot, names always shown, faint glyph when empty. */
.doll-cell { position: absolute; }
.doll-cell > .doll-slot { position: absolute; inset: 0; width: 100%; height: 100%; }
.doll-cell > .doll-label, .doll > .doll-group-label { position: absolute; z-index: 5; left: 50%; top: auto; bottom: calc(100% + .3cqw); transform: translateX(-50%); opacity: 1; right: auto;
  font-family: var(--title, "Rye", serif); font-size: 2.1cqw; line-height: 1; letter-spacing: .05em; text-transform: none; white-space: nowrap;
  color: #f4e6c4; background: linear-gradient(#4a2e18, #2e1b0d); border: 1px solid #b08a4a; border-radius: 3px; padding: .16em .5em .1em;
  box-shadow: 0 1px 2px rgba(0,0,0,.45), inset 0 0 0 1px rgba(255,230,180,.08); pointer-events: none; text-shadow: 0 1px 0 #000; }
.doll > .doll-group-label { bottom: auto; transform: translate(-50%, calc(-100% - .3cqw)); letter-spacing: .12em; }
.doll-cell:hover > .doll-label { background: linear-gradient(#8d1c14, #5e110b); }
.doll-slot .doll-glyph { position: absolute; left: 50%; top: 50%; width: 56%; height: 56%; transform: translate(-50%, -54%); fill: none; stroke: #5a3f22; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; opacity: .2; pointer-events: none; }
.doll-tall .doll-glyph, .doll-wide .doll-glyph { width: 70%; height: 40%; }
.doll-slot.doll-noart .doll-glyph { opacity: .55; stroke: #6b4320; top: 36%; width: 46%; height: 46%; }
.doll-slot .doll-name { font-family: Georgia, "Times New Roman", serif; font-size: clamp(6.5px, 1.2cqw, 11px); font-weight: 600; line-height: 1.22; max-width: 90%; margin-bottom: 6%;
  padding: 0 .25em; box-shadow: 0 0 0 .18em rgba(246,234,207,.92); background: rgba(246,234,207,.92); border: 1px solid rgba(120,88,48,.45); border-radius: 2px; color: #2b1d10;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: normal; text-align: center; }
.doll-weapon .doll-art ~ .doll-name { display: -webkit-box; }
.doll-tall.doll-weapon .doll-art { top: 44%; }
.doll-slot.filled .doll-art { inset: 9% 6% 34%; width: 88%; height: 57%; }
.doll-tall.doll-weapon.filled .doll-art { inset: auto; left: 50%; top: 44%; width: 230%; height: 40%; }
.doll-wide.filled .doll-art { inset: 8% 8% 20%; width: 84%; height: 72%; }
.doll-slot .doll-art { max-width: none; max-height: none; }
/* 2026-10-19: Holster L / Holster R / Belt pickers. */
.holster-sides { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 6px; }
.holster-side { display: flex; flex-direction: column; gap: 2px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; min-width: 0; }
.holster-side select { width: 100%; min-width: 0; }
.holster-belt { margin-bottom: 6px; }
@media (max-width: 420px) { .holster-sides { grid-template-columns: 1fr; } }
/* Pair holster: one rig over both sides, shown mirrored in Holster L and R. */
.doll-slot.doll-pair { box-shadow: 0 0 0 .35cqw rgba(176,138,74,.55); }
.doll-slot.doll-pair::after { content: "pair"; position: absolute; top: 4%; right: 4%; font: 700 1.3cqw/1 Georgia, serif; color: #f4e6c4; background: #6b4320; padding: .1em .3em; border-radius: 2px; }
/* Worn-gear art (2026-10-19): contain inside the box; wide pieces (gun belt, bandolier, pair rig) get a little extra scale. */
.doll-slot .doll-art { object-fit: contain; }
.doll-slot.doll-wideart .doll-art { transform: scale(1.18); }
/* Duster Form frame (2026-10-19): the figure is baked into the frame (no .doll-sil layer).
   Plates never shrink below 8px, so they stay readable on a 390px phone. */
.doll-cell > .doll-label, .doll > .doll-group-label { font-size: max(8px, 2.1cqw); }
/* Caption: one small line in a strip under the art so the gear art isn't covered; the full name is in the tooltip. */
.doll-slot.filled:not(.doll-tall):not(.doll-wide) .doll-art { inset: 6% 8% 25%; width: 84%; height: 69%; }
.doll-slot.filled .doll-name { font-size: max(6.5px, 1.05cqw); line-height: 1.15; -webkit-line-clamp: 1; white-space: nowrap; text-overflow: ellipsis; display: block;
  max-width: 88%; margin-bottom: 5%; padding: .05em .3em; box-shadow: none; background: rgba(246,234,207,.85); }
.doll-tall.filled .doll-name, .doll-wide.filled .doll-name { margin-bottom: 4%; }

/* 0.3.72: Off-hand attack card (Gear tab, under the weapons) */
.offhand-card { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 8px 0 4px; padding: 8px 10px; border: 2px dashed #8a6a12; border-radius: 8px; background: rgba(226,179,58,.12); }
.offhand-card b { font-family: "Rye", serif; letter-spacing: .02em; }
.offhand-card .pip-tag { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 10px; border: 2px solid #8a6a12; background: #e2b33a; color: #fff; font: 800 10px/1 system-ui, sans-serif; text-transform: uppercase; }
.offhand-card select { max-width: 100%; }
.offhand-card .offhand-note { flex-basis: 100%; }

/* 0.3.73: stowed pair */
.offhand-card button:disabled { opacity: .45 !important; cursor: not-allowed; filter: grayscale(1); }

/* 0.3.73: Pistolero Fan the Hammer */
.btn.fan:disabled { opacity: .45; cursor: not-allowed; }
.btn.fan.lit { box-shadow: 0 0 0 2px #e0a526, 0 0 8px rgba(224,165,38,.7); }
.btn.tr.tr-locked { opacity: .45; text-decoration: line-through; }

/* 0.3.75: compact gun card (Jessey's markup, 2026-10-19)
   name row = weapon + mod + capacity · sub row adds ADV / DIS ticks · Roll / Melee on the cylinder row ·
   misfire range, condition ticks and Clean / Unjam / Reopen as one horizontal row */
.g-namerow { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.g-namerow > select[data-gun] { flex: 1 1 200px; min-width: 0; width: auto; }
.g-namerow .mod-sel, .g-namerow .cap-sel { flex: 0 1 140px; width: auto; max-width: 160px; min-width: 96px; font-size: 13px; }
.g-namerow .mod-sel[hidden], .g-namerow .cap-sel[hidden] { display: none; }
.g-advdis { display: inline-flex; align-items: center; gap: 8px; }
.g-advdis .adv-sel { display: none !important; }
/* ADV green / DIS red, the same hues as the kept-d20 chat rings (dice.css: #46c46a / #e0524a).
   Text uses a darker shade of each so it reads on parchment; unchecked is a faint tint, checked is solid. */
.g-advdis label { padding: 1px 6px; border-radius: 4px; border: 1px solid transparent; }
.g-advdis .adv-tick { color: #2f7a46; background: rgba(70, 196, 106, .10); border-color: rgba(70, 196, 106, .35); }
.g-advdis .dis-tick { color: #a8382f; background: rgba(224, 82, 74, .08); border-color: rgba(224, 82, 74, .32); }
.g-advdis .adv-tick input { accent-color: #46c46a; }
.g-advdis .dis-tick input { accent-color: #e0524a; }
.g-advdis .adv-tick:has(input:checked) { color: #17602f; font-weight: 700; background: rgba(70, 196, 106, .24); border-color: #46c46a; box-shadow: 0 0 0 1px rgba(70, 196, 106, .45); }
.g-advdis .dis-tick:has(input:checked) { color: #8f241c; font-weight: 700; background: rgba(224, 82, 74, .20); border-color: #e0524a; box-shadow: 0 0 0 1px rgba(224, 82, 74, .45); }
.g-smith:not(:has(> :not([hidden]))) { display: none; }
.g-rollbtns { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.g-chamber-row .g-gunmelee { flex: 0 1 auto; max-width: 100%; margin-left: 2px; line-height: 1.3; }
.g-chamber-row .g-gunmelee:empty { display: none; margin: 0; }
.g-chamber-row .ammo-pool { flex: 1 1 160px; }
.g-actions:not(:has(> :not([hidden]):not(.g-mis))) { gap: 0; }
.g-actions .g-mis { flex: 1 1 100%; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: flex-start; margin-left: 0; gap: 4px 12px; text-align: left; }
/* Misfire 1–X badge: thin dark-brown border, ink tint, bold, set apart from the condition ticks (Jessey, 8:26 PM CT) */
.g-actions .g-mis > [data-out^="mis."] { display: inline-flex; align-items: baseline; gap: 4px; padding: 2px 8px; border: 1px solid #4a3220; border-radius: 4px;
  background: rgba(59, 42, 26, .12); color: #2a1c10; font-weight: 700; font-size: 13.5px; line-height: 1.25; white-space: nowrap; }
.g-actions .g-mis > [data-out^="mis."]::before { content: "Misfire"; font-family: var(--label); font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: #3b2a1a; }
.g-actions .g-mis > [data-out^="mis."]:empty::after { content: "—"; }
.g-actions .g-mis .gun-status:empty { display: none; }
@media screen and (max-width: 760px) {
  .g-namerow .mod-sel, .g-namerow .cap-sel { flex: 1 1 140px; max-width: none; min-height: 40px; }
  .g-actions .g-mis { gap: 2px 10px; }
  .g-advdis label { min-height: 40px; }
}
/* 0.3.75: condition chips in the misfire row (Jessey, 8:42 PM CT). Each condition shows once; an active one is a bold
   tinted chip (rust for Dirty / Fouled, red for Jammed / Locked up). The boxes are auto-set (disabled) but never dimmed. */
.g-mis label.jam { display: inline-flex; align-items: center; gap: 4px; padding: 1px 6px; border: 1px solid transparent; border-radius: 4px; opacity: 1; }
.g-mis label.jam input { appearance: none; -webkit-appearance: none; width: 14px; height: 14px; margin: 0; border: 1.5px solid #8a7558; border-radius: 3px; background: #fffaf0; opacity: 1; cursor: default; flex: 0 0 auto; }
.g-mis label.jam input:checked { background: var(--chip, #7a1f14) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M3 7.2l2.6 2.6L11 4.4' fill='none' stroke='%23fff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 12px no-repeat; border-color: var(--chip, #7a1f14); }
.g-mis label.jam.on { font-weight: 700; color: var(--chip-ink, #7a1f14); background: var(--chip-bg, rgba(163, 48, 31, .14)); border-color: var(--chip, #7a1f14); }
.g-mis label.jam[data-cond="dirty"], .g-mis label.jam[data-cond="fouled"] { --chip: #b0611a; --chip-ink: #7a3d0c; --chip-bg: rgba(214, 135, 40, .20); }
.g-mis label.jam[data-cond="jammed"], .g-mis label.jam[data-cond="lockup"] { --chip: #b3261e; --chip-ink: #8a1a13; --chip-bg: rgba(224, 82, 74, .17); }
/* ---- SAMPLE main-tab layout (Jessey 2026-10-19 9:00 PM CT): portrait | identity fields (tight) | Eldorite ----
   Scoped to #page-main so Backstory / Hexes top blocks (also .topblock / .topgrid) keep their layout. */
#page-main .topblock { grid-template-columns: minmax(220px, 1fr) minmax(0, 1.45fr) minmax(250px, 1fr); align-items: start; }
#page-main .identity { align-self: stretch; }
#page-main .topgrid { grid-template-columns: 1fr 1fr; align-content: start; gap: 4px 12px; padding: 8px 12px 10px; }
#page-main .topgrid .tf { justify-content: flex-start; }
#page-main .topgrid .tf-calling, #page-main .topgrid .tf-lineage, #page-main .topgrid .lineage-row { grid-column: 1 / -1; }
#page-main .topgrid .tf-calling .pair select { flex: 1 1 auto; min-width: 0; }
#page-main .kit-actions { margin-top: 6px; }
#page-main .tf-lineage .pair { flex-wrap: nowrap; }
#page-main .tf-lineage .pair select { flex: 1 1 0; min-width: 0; }
#page-main .topgrid .lineage-row { padding: 0 0 2px; line-height: 1.35; }
#page-main .eldorite-col { margin: 0; min-width: 0; }
#page-main .eldorite-col .shards { display: flex; flex-direction: column; gap: 4px; padding: 8px 10px; margin: 0; }
#page-main .eldorite-col .shard { grid-template-columns: 18px minmax(52px, auto) minmax(0, 1fr) auto; grid-template-rows: auto; padding: 2px 8px 2px 6px; }
#page-main .eldorite-col .shard .gem { grid-row: 1; }
#page-main .eldorite-col .shard-name { grid-column: 2; }
#page-main .eldorite-col .shard input { grid-column: 3; min-height: 24px; text-align: center; }
#page-main .eldorite-col .shard-val { grid-column: 4; white-space: nowrap; }
#page-main .eldorite-col .shard-total { margin-top: 2px; }
#page-main .eldorite-col .shard-actions { gap: 6px; }
#page-main .eldorite-col .shard-actions .es-total { font-size: 22px; min-width: 0; }
#page-main .eldorite-col .shard-actions select { flex: 1 1 110px; min-width: 0; }
/* tablet: portrait | fields, Eldorite runs full width under them with the five shards in a row */
@media screen and (max-width: 1080px) {
  #page-main .topblock { grid-template-columns: minmax(200px, 1fr) minmax(0, 1.6fr); }
  #page-main .eldorite-col { grid-column: 1 / -1; }
  #page-main .eldorite-col .shards { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
  #page-main .eldorite-col .shards-title, #page-main .eldorite-col .shard-total, #page-main .eldorite-col .shard-actions { grid-column: 1 / -1; }
  #page-main .eldorite-col .shard { grid-template-columns: 18px minmax(0, 1fr); grid-template-rows: auto auto; }
  #page-main .eldorite-col .shard .gem { grid-row: 1 / 3; }
  #page-main .eldorite-col .shard input { grid-column: 2; grid-row: 2; }
  #page-main .eldorite-col .shard-val { display: none; }
}
/* phones: everything stacks; shards two per row */
@media screen and (max-width: 760px) {
  #page-main .topblock { grid-template-columns: 1fr; }
  #page-main .topgrid { grid-template-columns: 1fr 1fr; }
  #page-main .eldorite-col .shards { grid-template-columns: 1fr 1fr; }
  #page-main .eldorite-col .shard-val { display: block; grid-column: 2; }
}
@media screen and (max-width: 520px) {
  #page-main .topgrid { grid-template-columns: 1fr; }
}
#page-main .tf-calling .pair { flex-wrap: nowrap; }

/* L0188 food & water + exhaustion */
.exh-badge { display: block; font-size: .72rem; font-weight: 700; color: #8b1a1a; line-height: 1.1; margin-top: .15rem; }
body.exh-on .sq-box input[data-f="character.speed"] { text-decoration: line-through; text-decoration-color: #8b1a1a; }
.exh-note { margin: .4rem 0; padding: .4rem .6rem; border: 2px solid #8b1a1a; border-radius: 6px; background: #fbeee6; color: #4a1010; font-size: .9rem; }
.exh-note b { color: #8b1a1a; margin-right: .3rem; }
.supplies-box { margin: .5rem 0; padding: .5rem .6rem; border: 1px solid #a07c4f; border-radius: 6px; background: #fbf5e8; }
.supplies-box .sup-head { display: flex; flex-wrap: wrap; gap: .4rem; align-items: baseline; justify-content: space-between; }
.supplies-box h3 { margin: 0; font-size: 1rem; }
.supplies-box .sup-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; margin-top: .35rem; }
.supplies-box .sup-cell { display: flex; flex-direction: column; align-items: center; text-align: center; padding: .3rem; border: 1px solid #d9c6a3; border-radius: 4px; background: #fff; }
.supplies-box .sup-cell b { font-size: 1.25rem; }
.supplies-box .sup-cell span { font-size: .8rem; font-weight: 700; }
.supplies-box .sup-cell small { font-size: .68rem; color: #6b5a40; }
.supplies-box .sup-cell.bad { border-color: #8b1a1a; background: #fbeee6; }
.supplies-box .sup-last { margin: .35rem 0 0; }
.supplies-save .sup-why { margin: .2rem 0 .6rem; }
.supplies-save.pass .d4-face { color: #1d6b2a; font-weight: 700; }
.supplies-save.fail .d4-face { color: #8b1a1a; font-weight: 700; }
.cond-toast { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 9000; display: flex; flex-direction: column; gap: 6px; width: min(34rem, 94vw); }
.cond-toast-card { display: flex; gap: .6rem; align-items: center; justify-content: space-between; padding: .6rem .8rem; border: 3px solid #8b1a1a; border-radius: 8px; background: #fff8ec; color: #2a1a0a; box-shadow: 0 6px 18px rgba(0,0,0,.35); animation: ctIn .25s ease-out; }
.cond-toast-card .ct-text { display: flex; flex-direction: column; gap: .1rem; }
.cond-toast-card .ct-who { font-size: .78rem; color: #6b5a40; }
.cond-toast-card .ct-title { font-size: 1.15rem; color: #8b1a1a; }
.cond-toast-card .ct-what { font-size: .95rem; }
@keyframes ctIn { from { transform: translateY(-8px); opacity: 0; } to { transform: none; opacity: 1; } }
.supplies-box .sup-share { display: inline-flex; align-items: center; gap: .3rem; margin-top: .35rem; font-weight: 700; font-size: .85rem; }

/* 0.3.84 default UI by type: kind picker, kind fields, the "lives in" badge, Special UI hook slots */
.item-form .item-kind-home { margin: 0 0 6px; }
.item-form .item-kind-fields { border: 1px dashed var(--line, #8a7560); border-radius: 6px; padding: 4px 8px; margin: 6px 0; }
.item-form .item-flags { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.item-tag.item-home { background: rgba(120, 90, 50, .12); }
.item-tag.item-supply { background: rgba(60, 110, 160, .12); }
.itemui-extra, .itemui-replace { margin-top: 4px; }
.itemui-replaced > :not(.itemui-replace):not(.g-card-top) { display: none; }

/* typeui: fields folded away for the picked kind */
[data-item-form] [hidden] { display: none !important; }

/* 0.3.86 Player Give */
.give-bar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0 0 8px; }
.item-tag.give-held { background: #f3e2b8; border-color: #b0873a; color: #5a3d10; }
.item-row[data-item-held] { opacity: .85; }
.give-picker label, .give-prompt label { display: block; margin: 8px 0; }
.give-picker select, .give-picker input[type=number] { min-width: 12em; }
.give-prompt .give-what { font-size: 1.15em; margin: 6px 0 10px; }

/* ---------------- 0.3.102 Equipment list (Jessey 2026-10-20 mockup): grouped, filterable, dense rows */
.item-gear.eq { margin: 10px 0 12px; padding-top: 6px; border-top: 1px solid rgba(43,29,18,.35); }
.eq-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.eq-head h2 { font-size: 22px; }
.eq-head .eq-carried { margin: 0; font-family: var(--label); font-size: 12px; letter-spacing: .04em; }
.eq .give-bar { margin: 4px 0; }
.eq-chips { position: sticky; top: 0; z-index: 6; display: flex; gap: 5px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none;
  padding: 7px 0; margin: 2px 0; background: linear-gradient(var(--bg) 82%, rgba(230,215,184,0)); }
.eq-chips::-webkit-scrollbar { display: none; }
.eq-chip { flex: 0 0 auto; appearance: none; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; min-height: 30px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 15px; background: rgba(255,250,238,.6); color: var(--umber); font-family: var(--label);
  font-size: 12px; letter-spacing: .06em; text-transform: uppercase; }
.eq-chip .n { font-size: 11px; min-width: 16px; padding: 0 4px; border-radius: 8px; background: rgba(58,38,22,.12); text-align: center; }
.eq-chip[aria-pressed="true"] { background: var(--umber); color: var(--parch); border-color: var(--ochre); }
.eq-chip[aria-pressed="true"] .n { background: var(--ochre); color: var(--dark); }
.eq-chip.empty { opacity: .45; }
.eq-cat { display: flex; align-items: baseline; gap: 8px; margin: 10px 0 2px; padding-bottom: 2px; border-bottom: 1px solid rgba(43,29,18,.35); }
.eq-cat .fine { font-family: var(--label); font-size: 11px; letter-spacing: .04em; }
.eq-list { margin: 0; padding: 0; list-style: none; }
.eq-row { border-bottom: 1px dotted rgba(43,29,18,.25); margin: 0; display: block; }
.eq-main { display: grid; grid-template-columns: 32px minmax(0,1fr) auto auto auto 26px; align-items: center; gap: 8px; min-height: 42px; padding: 3px 2px; cursor: pointer; }
.eq-main:hover { background: rgba(255,250,238,.45); }
.eq-thumb { width: 32px; height: 32px; border-radius: 4px; overflow: hidden; background: #d9c8a4; border: 1px solid rgba(43,29,18,.35); display: block; }
.eq-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* 0.3.96: Weapons rows: the 3:1 engraving letterboxed on parchment, not cropped to its middle */
.eq-thumb.eq-wide { width: 72px; height: 32px; background: #fffaf3; border-color: #c4b497; }
.eq-thumb.eq-wide img { object-fit: contain; padding: 1px 2px; box-sizing: border-box; }
/* 0.3.102: only a row that still shows a 3:1 engraving (a gun with no square tile) gets the wide thumb column */
.eq-row[data-eq-cat="weapons"] .eq-main:has(.eq-wide) { grid-template-columns: 72px minmax(0,1fr) auto auto auto 26px; }
@media (max-width: 640px) { .eq-row[data-eq-cat="weapons"] .eq-main:has(.eq-wide) { grid-template-columns: 66px minmax(0,1fr) auto auto auto 22px; } .eq-thumb.eq-wide { width: 66px; height: 30px; } }
.eq-name { min-width: 0; line-height: 1.15; }
.eq-name b { display: block; font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.eq-sub { display: block; font-family: var(--label); font-size: 10.5px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.eq-qty, .eq-wt { font-family: var(--label); font-size: 12.5px; color: var(--umber); text-align: right; white-space: nowrap; }
.eq-qty { min-width: 28px; } .eq-wt { min-width: 44px; color: var(--muted); }
.eq-give { min-width: 50px; text-align: right; white-space: nowrap; }
.eq-give .btn.xs { font-family: var(--label); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; min-height: 28px; padding: 0 9px; }
.eq-give .item-tag.give-held { display: inline-block; max-width: 110px; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.eq-worn { font-family: var(--label); font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.eq-caret { appearance: none; border: 0; background: none; cursor: pointer; width: 26px; height: 28px; color: var(--red); font-size: 13px; transition: transform .15s; padding: 0; }
.eq-row.open .eq-caret { transform: rotate(180deg); }
.eq-more { margin: 0 0 8px 40px; padding: 7px 10px; background: rgba(255,250,238,.7); border-left: 3px solid var(--ochre); }
.eq-more .eq-desc { margin: 0 0 4px; }
.eq-facts { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 6px; align-items: center; }
.eq-facts .item-tag { margin: 0; background: rgba(120,90,50,.1); }
.eq-acts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.eq-acts:empty, .eq-facts:empty { display: none; }
.eq-row[data-item-held] { opacity: .85; }
.eq-empty { padding: 10px 2px; }
.eq-notes { margin-top: 14px; }
.eq-notes textarea { width: 100%; min-height: 110px; border: 1px solid var(--line); background: var(--fill-hi); padding: 6px 8px; font-family: var(--body); font-size: 15px; }
.equip-body .eq-notes textarea { flex: none; min-height: 110px; }
@media (max-width: 560px) {
  .eq-main { grid-template-columns: 30px minmax(0,1fr) auto auto auto 22px; gap: 6px; min-height: 40px; }
  .eq-thumb { width: 30px; height: 30px; }
  .eq-name b { font-size: 14px; }
  .eq-wt { min-width: 36px; } .eq-qty { min-width: 24px; } .eq-give { min-width: 44px; }
  .eq-more { margin-left: 0; }
}

/* L0197 (0.3.102): Focus slot by Calling. Pact Seeker = Borrowed Iron (away = faded, returns next turn);
   Hexslinger = read-only mirror of the Caster Gun in Pistol L / R, or the no-gun message. */
.doll-slot .doll-focus-note { position: absolute; left: 50%; top: 5%; transform: translateX(-50%); z-index: 2; width: max-content; max-width: 86%; padding: .1em .45em; border-radius: 3px;
  font: 700 max(7px, 1.25cqw)/1.2 Georgia, "Times New Roman", serif; text-align: center; color: #f4e6c4; background: rgba(46,27,13,.86); border: 1px solid #b08a4a; pointer-events: none; }
.doll-slot.doll-focus-nocaster .doll-focus-note { top: 50%; transform: translate(-50%, -50%); max-width: 80%; font-size: max(8px, 1.7cqw); line-height: 1.25; padding: .35em .6em; color: #fff; background: rgba(141,28,20,.92); border-color: #e2b33a; }
.doll-slot.doll-focus-nocaster .doll-glyph { opacity: .12; }
.doll-slot.doll-away .doll-art { filter: grayscale(1) brightness(.75); opacity: .45; }
.doll-slot.doll-away .doll-focus-note { background: rgba(141,28,20,.9); color: #fff; }
.doll-slot.doll-focus-caster { box-shadow: 0 0 0 .35cqw rgba(176,138,74,.55); }
/* 0.3.96: patron in the Focus slot; a weapon that is also the focus glows in both of its slots */
.doll-slot.doll-focus-patron, .doll-slot.doll-focus-weapon, .doll-slot.doll-focus-weapon-src { box-shadow: 0 0 0 .35cqw rgba(176,138,74,.55); }
/* the Borrowed Iron in a weapon slot: art + name plate only while in hand; a small red note while it's away */
.doll-slot.doll-iron:not(.doll-away) .doll-focus-note { display: none; }
.doll-slot.doll-iron.doll-away .doll-focus-note { font-size: max(7px, 1.1cqw); top: 3%; max-width: 94%; line-height: 1.15; }
.focus-cast-note { color: #8d1c14; font-weight: 600; margin: 4px 0 0; }
button.focus-blocked { opacity: .55; cursor: not-allowed; }

/* Condition symbols on the character (2026-10-20): portrait corner + paper doll strip + chip icon */
.portrait-slot { position: relative; }
#portraitConds { position: absolute; top: 6px; left: 6px; z-index: 3; display: flex; flex-wrap: wrap; gap: 4px; max-width: calc(100% - 12px); pointer-events: auto; }
#dollConds { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 0 0 6px; }
.cond-badges[hidden] { display: none !important; }
.cond-badge { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: rgba(20,12,6,.86); border: 1.5px solid #e8dcc8; font-size: 16px; line-height: 1; box-shadow: 0 1px 3px rgba(0,0,0,.4); cursor: help; }
.chip.cond .cond-sym { margin-right: 4px; }
/* L0200: Wrecked Caster Gun line + the no-shells note on a Caster Gun card */
.gun-wrecked { display: block; margin: 4px 0 2px; padding: 3px 8px; border: 1px solid #8b1e1e; border-radius: 4px; background: #f6e0d8; color: #7a1414; font-weight: 600; font-size: .85em; }
.gun.is-wrecked .g-photo { filter: grayscale(.85) sepia(.3); }
.gun.is-wrecked [data-reload], .gun.is-wrecked [data-roll] { opacity: .55; }
.shell-note { display: block; color: #6b3d1e; font-style: italic; margin-top: 2px; }

/* 0.3.100: Borrowed Iron card quick spells (Pact Shot first), Pact Boon / Fixed Bayonet, the free Pact Shot */
.pact-iron-spells { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; flex: 1 1 100%; }
.pact-iron-spells .tiny select { max-width: 220px; }
.pact-shot-swap { margin: 4px 0; padding: 6px 8px; border: 1px solid #8d1c14; background: #fff1e0; color: #6b1a12; font-size: 13px; }
.sp-free-tag { color: #6b3f12; font-style: italic; }
.spell-card.is-locked .spell-card-pick { cursor: default; }
.spell-card.is-locked .spell-check { background: #6b3f12; border-color: #6b3f12; }
/* 0.3.102 (Jessey 2026-10-21 4:07 PM): tall weapon slots (Long gun, Melee). A 1200x400 engraving turns muzzle-up and
   fills the slot height inside the border; the box below is pre-rotation (width = visual height ~76% of the slot,
   height = visual width ~26% of the slot height ≈ 58% of the slot width), centred above the name plate.
   Square tiles (hidden Borrowed Iron, tile-only guns) stay upright and contained. */
.doll-slot.doll-tall.doll-weapon.doll-longart .doll-art { inset: auto; left: 50%; top: 42%; width: 170%; height: 26%; max-width: none; max-height: none;
  object-fit: contain; transform: translate(-50%, -50%) rotate(-90deg); transform-origin: 50% 50%; }
.doll-slot.doll-tall.doll-weapon.doll-squareart .doll-art { inset: auto; left: 10%; top: 14%; width: 80%; height: 66%; max-width: 80%; max-height: 66%;
  object-fit: contain; transform: none; }
/* 0.3.102 (4:35 PM): a hidden long iron's card shows the plain long-gun outline at the engraving's 3:1 shape */
.pact-iron-art.pact-iron-generic.pact-iron-outline { aspect-ratio: 3 / 1; height: auto; }

/* 0.3.102 (art batch 1): Pact Shot tile on the Borrowed Iron card's Pact Shot button (icon + label, same button height) */
#btnPactShot { display: inline-flex; align-items: center; gap: 5px; }
#btnPactShot .iron-spell-art { width: 20px; height: 20px; margin: -3px 0 -3px -3px; border-radius: 3px; object-fit: cover; flex: 0 0 20px; display: block; }
