:root {
  --bg: #15110d;
  --bg2: #1b1611;
  --panel: #211a14;
  --panel2: #2a211a;
  --line: #3a2e24;
  --line2: #4d3d2f;
  --text: #f1e7d8;
  --muted: #a99886;
  --faint: #7a6b5d;
  --gold: #eab96c;
  --gold2: #f7d49a;
  --gold-dim: #8b6a3d;
  --crimson: #6e1d31;
  --crimson2: #a3304b;
  --crimson3: #d0486a;
  --up: #8fd18a;
  --down: #f08a8a;
  --radius: 10px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --serif: 'Cinzel', Georgia, serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
  --well: #120e0b;
  --hover: #33281f;
  --hover2: #261e17;
  --acc1: #4a1726;
  --acc2: #34111c;
  --acc1h: #5c1c30;
  --acc2h: #3e1421;
  --acc-shadow: #1c0a10;
  --acc-text: #e9c9b0;
  --hit-text: var(--gold2);
  --line-soft: #241c15;
  --glow: rgba(163, 48, 75, .12);
  --bar-bg: rgba(21, 17, 13, .95);
  --ghost-bg: rgba(20, 15, 11, .6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-gutter: stable; }   /* room for the scrollbar always, so the page doesn't shift sideways when it appears */
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 var(--sans);
  background-image: radial-gradient(1200px 600px at 70% -200px, var(--glow), transparent 70%);
  min-height: 100vh;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--gold); }
h1, h2, h3 { font-family: var(--serif); letter-spacing: .02em; margin: 0; }
[hidden] { display: none !important; }

/* ---------- banner ---------- */
.banner { position: relative; height: clamp(160px, calc(100vw / 6), 360px); overflow: hidden; border-bottom: 1px solid var(--line); }
.banner-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 40%; }
.banner-shade { position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(14, 10, 7, .8) 0%, rgba(14, 10, 7, .35) 32%, transparent 58%),
              linear-gradient(0deg, rgba(14, 10, 7, .7) 0%, transparent 30%); }
.banner-inner { position: relative; height: 100%; max-width: 1280px; margin: 0 auto; padding: 0 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--text); min-width: 0; }
.brand img { width: clamp(44px, 5vw, 72px); height: auto; filter: brightness(2.05) saturate(1.35) contrast(1.05) drop-shadow(0 2px 4px rgba(0, 0, 0, .9)) drop-shadow(0 0 16px rgba(234, 185, 108, .45)); }
.brand-name { display: block; font-family: var(--serif); font-weight: 700; font-size: clamp(20px, 3vw, 36px); line-height: 1.05;
  color: var(--gold2); white-space: nowrap;
  text-shadow: 0 0 1px #000, 0 1px 2px #000, 0 2px 6px rgba(0, 0, 0, .95), 0 0 16px rgba(0, 0, 0, .85), 0 0 26px rgba(234, 185, 108, .35); }
.brand-name em { font-style: normal; color: #e8456f;          /* the logo circle's red, brightened so it reads on the banner */
  text-shadow: 0 0 1px #000, 0 1px 2px #000, 0 2px 6px rgba(0, 0, 0, .95), 0 0 16px rgba(0, 0, 0, .85); }
.brand-tag { display: block; color: var(--muted); font-size: clamp(11px, 1.2vw, 14px); margin-top: 4px; font-weight: 500;
  text-shadow: 0 0 1px #000, 0 1px 3px #000, 0 0 10px rgba(0, 0, 0, .9); }

/* Character sheets: half-height banner, cropped evenly top and bottom */
.on-sheet .banner { height: clamp(64px, calc(100vw / 16), 130px); }
.on-sheet .banner-img { object-position: center 50%; }
.on-sheet .brand img { width: clamp(36px, 3.6vw, 52px); }
.on-sheet .brand-name { font-size: clamp(18px, 2.2vw, 28px); }
.on-sheet .brand-tag { margin-top: 2px; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line2);
  background: var(--panel2); padding: 8px 14px; border-radius: 8px; cursor: pointer; font-weight: 600; transition: .15s; }
.btn:hover { border-color: var(--gold-dim); background: var(--hover); }
.btn:focus-visible, .chip:focus-visible, select:focus-visible, input:focus-visible, .tab:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.btn.ghost { background: var(--ghost-bg); backdrop-filter: blur(6px); }
.btn.icon { padding: 8px 12px; font-size: 18px; line-height: 1; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.danger { border-color: #6b2a2a; color: #f3b0b0; }
select, input[type=number], input[type=text], textarea {
  background: var(--bg2); border: 1px solid var(--line2); border-radius: 8px; padding: 7px 10px; }
select { padding-right: 28px; }
input[type=number] { width: 70px; }

main { max-width: 1280px; margin: 0 auto; padding: 20px; box-sizing: border-box; }

/* ---------- campaigns ---------- */
.subbar { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.subbar:has(.crumbs:empty):has(#menuBtn[hidden]) { display: none; }
.crumbs { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; font-size: 16px; color: var(--muted); }
.crumbs a { color: var(--gold); text-decoration: none; }
.r20badge { font-size: 12px; font-weight: 600; letter-spacing: .04em; color: var(--gold2); border: 1px solid var(--gold-dim); border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
.r20badge[hidden] { display: none; }
.subbar:has(.crumbs:empty):has(#menuBtn[hidden]) .r20badge { display: none; }
dialog .form h3 { font-size: 14px; color: var(--gold); text-transform: uppercase; letter-spacing: .08em; margin: 4px 0 -4px; }
dialog:has(.r20text) { width: min(780px, calc(100vw - 32px)); }
.r20text { width: 100%; white-space: pre-wrap; overflow-wrap: anywhere; resize: vertical; font-family: ui-monospace, Consolas, monospace; font-size: 13px; line-height: 1.45; color: var(--text);
  background: var(--panel2); border: 1px solid var(--line2); border-radius: 8px; padding: 8px 10px; }
ol.r20steps { margin: 0; padding-left: 28px; display: grid; gap: 8px; }
ol.r20steps li { padding-left: 4px; line-height: 1.5; }
ol.r20steps a { color: var(--gold); }
ol.r20steps code { font-family: ui-monospace, Consolas, monospace; font-size: 13px; color: var(--text); background: var(--panel2); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; white-space: nowrap; }
.crumbs a:hover { text-decoration: underline; }
.crumbs i { font-style: normal; color: var(--faint); }
.crumbs .crumb-name { font-size: clamp(26px, 3.4vw, 40px); color: var(--gold2); line-height: 1.1; flex-basis: auto; }
.charsub { margin: -6px 0 12px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.charsub b { color: var(--text); font-weight: 600; }
.crumbs .saved { margin-left: auto; font-size: 16px; color: var(--muted); }
.crumbs .saved.bad { color: var(--down); }
.home { margin: 10px 0 0; }
.home-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.home h1 { font-size: clamp(26px, 3.4vw, 38px); color: var(--gold2); }
.lede { color: var(--muted); margin: 6px 0 0; }
.loading { color: var(--muted); text-align: center; padding: 40px 0; }
.camps { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; margin-bottom: 26px; }
.camp { display: flex; flex-direction: column; gap: 6px; padding: 18px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line);
  text-decoration: none; color: var(--text); transition: .15s; }
.camp:hover { border-color: var(--gold-dim); transform: translateY(-1px); background: var(--hover2); }
.camp-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.camp-name { font-family: var(--serif); font-size: 20px; font-weight: 700; color: var(--gold2); }
.camp-blurb { color: var(--muted); font-size: 14px; }
.camp-meta { color: var(--faint); font-size: 13px; margin-top: auto; }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
  padding: 3px 8px; border-radius: 999px; border: 1px solid var(--line2); color: var(--muted); white-space: nowrap; }
.badge.open { color: var(--up); border-color: #3e6a3a; }
.ico { width: 1em; height: 1em; }
.empty { grid-column: 1 / -1; padding: 30px; text-align: center; color: var(--muted); border: 1px dashed var(--line2); border-radius: 14px; }
.center-card { max-width: 440px; margin: 30px auto; text-align: center; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 28px 24px; }
.center-card h1 { font-size: 26px; color: var(--gold2); }
.lockmark { width: 52px; height: 52px; margin: 0 auto 10px; border-radius: 50%; display: grid; place-items: center; color: var(--gold);
  background: var(--crimson); border: 1px solid var(--crimson3); }
.lockmark .ico { width: 24px; height: 24px; }
.passform { display: flex; gap: 8px; margin-top: 18px; }
.passform input { flex: 1; min-width: 0; padding: 10px 12px; font-size: 16px; }
.btn.gold { background: linear-gradient(180deg, #8a6532, #6b4c22); border-color: var(--gold-dim); color: #fff3df; }
.btn.gold:hover { filter: brightness(1.1); }
.err { color: var(--down); min-height: 1.2em; margin: 10px 0 0; font-size: 14px; }
.fine { color: var(--faint); font-size: 13px; }
.roster { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin-bottom: 18px; }
.pc { display: flex; gap: 14px; align-items: center; padding: 14px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line);
  text-decoration: none; color: var(--text); cursor: pointer; transition: .15s; }
.pc:hover, .pc.over { border-color: var(--gold-dim); background: var(--hover2); }
.pc.me { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold-dim); }
.pc.add { border-style: dashed; color: var(--muted); }
.pc .bench { align-self: flex-start; margin-top: 4px; flex: none; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line2); background: var(--bg2);
  color: var(--muted); border-radius: 999px; padding: 3px 9px 3px 6px; font-size: 11px; font-weight: 600; cursor: pointer; }
.pc .bench::before { content: ''; width: 22px; height: 12px; border-radius: 999px; background: var(--well); border: 1px solid var(--line2);
  background-image: radial-gradient(circle at 6px 50%, var(--faint) 0 4px, transparent 4.5px); }
.pc .bench.on { color: var(--text); }
.pc .bench.on::before { background-color: #3e6a3a; border-color: #5c9a55; background-image: radial-gradient(circle at 16px 50%, #fff 0 4px, transparent 4.5px); }
.pc .bench:hover { border-color: var(--gold-dim); }
.pc.benched { opacity: .5; }
.pc.benched:hover { opacity: .8; }
.avatar { flex: none; width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; font-family: var(--serif); font-size: 22px; font-weight: 700;
  color: var(--gold2); background: radial-gradient(circle at 30% 30%, var(--crimson2), var(--crimson)); border: 1px solid var(--crimson3); }
/* Character cards: name across the full width on top, a bigger picture below it with the class line and switch beside it */
.pc.char { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "name name" "av text"; column-gap: 14px; row-gap: 10px; align-items: center; }
.pc.char .pc-name { grid-area: name; line-height: 1.25; justify-self: start; cursor: text; border-radius: 6px; padding: 0 4px; margin: 0 -4px; }
.pc.char .pc-name:hover, .pc.char .pc-name:focus-visible { background: var(--bg2); box-shadow: inset 0 0 0 1px var(--line2); }
.pc.char .pc-rename { grid-area: name; font: inherit; font-weight: 700; font-size: 16px; line-height: 1.25; color: var(--text); background: var(--bg2);
  border: 1px solid var(--gold-dim); border-radius: 6px; padding: 2px 6px; margin: -3px -7px; min-width: 0; width: calc(100% + 14px); outline: none; }
.pc.char .avatar { grid-area: av; width: 84px; height: 84px; font-size: 34px; }
.pc.char .pc-text { grid-area: text; align-self: stretch; }
.pc.char { grid-template-rows: auto 1fr; }
.pc.char .bench { margin-top: auto; }              /* Active switches line up along the bottom of each row */
.pc.char .pc-sum { white-space: normal; }
.pc.char .pc-sum .nb { white-space: nowrap; }
.pc.add .avatar { background: var(--bg2); border: 1px dashed var(--line2); color: var(--muted); }
.pc-text { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pc-name { font-weight: 700; font-size: 16px; }
.pc-name em { font-style: normal; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--bg); background: var(--gold); padding: 1px 6px; border-radius: 999px; margin-left: 6px; vertical-align: 2px; }
.pc-sum { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lootbox { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 14px; margin-bottom: 20px; text-decoration: none; color: var(--text);
  background: linear-gradient(135deg, var(--panel2), var(--panel) 60%); border: 1px solid var(--gold-dim); transition: .15s; }
.lootbox:hover { border-color: var(--gold); transform: translateY(-1px); }
.lootbox-icon { flex: none; width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; font-size: 26px; color: #2a1d0c;
  background: radial-gradient(circle at 35% 30%, var(--gold2), var(--gold) 55%, #9a6f33); }
.lootbox .pc-name { font-family: var(--serif); color: var(--gold2); font-size: 18px; }
.lootbox .pc-sum { white-space: normal; }
.lootbox-go { margin-left: auto; color: var(--gold); font-weight: 600; white-space: nowrap; }
.campboxes { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; margin-bottom: 20px; }
.campboxes .lootbox { margin-bottom: 0; }
.partybox { background: linear-gradient(135deg, var(--acc1), var(--panel) 60%); border-color: var(--crimson2); }
.partybox .lootbox-icon { background: radial-gradient(circle at 35% 30%, var(--crimson3), var(--crimson2) 60%, var(--crimson)); color: #fff; }
.camp-lede { margin: -4px 0 16px; }
.roster-h { font-size: 15px; color: var(--gold); text-transform: uppercase; letter-spacing: .08em; margin: 0 0 10px; }
.legacy { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; }
.legacy p { margin: 0 0 8px; color: var(--muted); font-size: 14px; }
details.gm { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
details.gm summary { cursor: pointer; color: var(--muted); }

/* ---------- empty / import ---------- */
.welcome { max-width: 760px; margin: 30px auto; text-align: center; }
.welcome h1 { font-size: clamp(24px, 4vw, 38px); color: var(--gold2); }
.welcome p { color: var(--muted); font-size: 16px; }
.drop { margin: 28px 0; border: 2px dashed var(--line2); border-radius: 16px; padding: 44px 20px; background: var(--panel);
  cursor: pointer; transition: .15s; }
.drop:hover, .drop.over { border-color: var(--gold); background: var(--hover2); }
.drop strong { display: block; font-family: var(--serif); font-size: 20px; color: var(--gold); margin-bottom: 6px; }
.steps { text-align: left; display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.steps div { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; color: var(--muted); font-size: 14px; }
.steps b { color: var(--text); display: block; margin-bottom: 4px; }

/* ---------- character header ---------- */
.charhead { margin-bottom: 16px; }
.charhead h1 { font-size: clamp(26px, 3.4vw, 40px); color: var(--gold2); line-height: 1.1; }
.charhead .sub { color: var(--muted); margin-top: 4px; }
.warn { background: #3a2a12; border: 1px solid #7a5a22; color: #f3d6a0; padding: 8px 12px; border-radius: 8px; margin-bottom: 14px; font-size: 14px; }

.hp { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.hp-num { font-family: var(--serif); font-size: 28px; font-weight: 700; }
.hp-num small { font-size: 15px; color: var(--muted); font-family: var(--sans); font-weight: 500; }
.hp > .col:first-child { flex: 1; min-width: 0; }
.hp-bar { width: 100%; height: 8px; background: var(--well); border-radius: 5px; overflow: hidden; }
.hp-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--crimson2), var(--crimson3)); transition: width .25s; }
.hp-bar i.ok { background: linear-gradient(90deg, #4c8a45, #7dbb6c); }
.hp-bar i.mid { background: linear-gradient(90deg, #b07a2a, #e2ae4f); }
.hp label { font-size: 12px; color: var(--muted); display: block; }
.hp .col { display: flex; flex-direction: column; gap: 4px; }
.hp .row { display: flex; gap: 6px; align-items: center; }

/* ---------- layout ---------- */
.layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 18px; align-items: start; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.panel h2 { font-size: 15px; color: var(--gold); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 12px; }
.panel + .panel { margin-top: 18px; }
/* Movable sheet cards: drag the bar at the top of a card to another spot or the other column */
.layout > .col { display: flex; flex-direction: column; gap: 18px; min-width: 0; min-height: 60px; }
.dcard { position: relative; min-width: 0; }
.dcard .grip { position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 64px; height: 16px; z-index: 2;
  cursor: grab; touch-action: none; display: flex; align-items: center; justify-content: center; }
.dcard .grip::before { content: ""; width: 36px; height: 4px; border-radius: 2px; background: var(--line2); transition: background .15s, width .15s; }
.dcard .grip:hover::before { background: var(--gold); width: 44px; }
.dcard.dragging { position: fixed; z-index: 60; pointer-events: none; opacity: .92; box-shadow: 0 12px 40px rgba(0,0,0,.5); border-radius: 14px; }
.dcard.dragging .grip::before { background: var(--gold); width: 44px; }
.dcard-ph { border: 2px dashed var(--gold-dim); border-radius: 14px; }
.layout.sorting { cursor: grabbing; user-select: none; }
.layout.sorting > .col { outline: 1px dashed var(--line); outline-offset: 6px; border-radius: 14px; }

.abil { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.abil div { background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 4px; text-align: center; }
.abil b { display: block; font-size: 11px; letter-spacing: .1em; color: var(--muted); }
.abil .m { font-family: var(--serif); font-size: 22px; font-weight: 700; }
.abil .s { font-size: 14px; font-weight: 600; color: var(--muted); }
.abil .chg-up .s, .abil .chg-down .s { color: inherit; }

.statlist { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; }
.stat { display: contents; }
.stat > span:first-child { color: var(--muted); padding: 5px 0; }
.stat > span:last-child { text-align: right; font-weight: 600; padding: 5px 0; font-variant-numeric: tabular-nums; }
.rollable { cursor: pointer; border-radius: 6px; }
.rollable:hover > span { color: var(--gold2); }
.rollable .die, .sk .die { width: 11px; height: 11px; margin-right: 4px; vertical-align: -1px; opacity: .55; }
.rollable:hover .die, .sk:hover .die { opacity: 1; color: var(--gold2); }
.rollable:hover { border-color: var(--gold-dim); }
.big3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 8px; }
.big3 > div { background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 8px; text-align: center; }
.big3 b { display: block; font-size: 11px; letter-spacing: .1em; color: var(--muted); }
.big3 span { font-family: var(--serif); font-size: 22px; font-weight: 700; }
.big3 > .rollable:hover { border-color: var(--gold-dim); }
/* Saves + initiative: proper roll buttons */
.rollbtns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 8px; }
.rollbtn { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px 9px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--crimson2); background: linear-gradient(180deg, var(--acc1), var(--acc2)); color: var(--hit-text);
  box-shadow: 0 2px 0 var(--acc-shadow), 0 4px 12px rgba(0, 0, 0, .3); transition: .12s; }
.rollbtn:hover { border-color: var(--crimson3); background: linear-gradient(180deg, var(--acc1h), var(--acc2h)); transform: translateY(-1px); }
.rollbtn:active { transform: translateY(1px); box-shadow: 0 1px 0 var(--acc-shadow); }
.rollbtn b { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--acc-text); font-weight: 600; }
.rollbtn span { font-family: var(--serif); font-size: 22px; font-weight: 700; line-height: 1.1; }
.rollbtn .die { width: 12px; height: 12px; margin-right: 4px; vertical-align: -2px; }
.initset { grid-column: 1 / -1; display: flex; align-items: stretch; gap: 6px; font-size: 12px; color: var(--muted); }
.initset > span { align-self: center; }
.initset input { width: 70px; padding: 4px 6px; text-align: center; }          /* stretches to the button's height */
.initset .btn { flex: 1; justify-content: center; padding: 5px 6px; }
.rollbtn.wide { grid-column: 1 / -1; flex-direction: row; justify-content: center; gap: 10px; padding: 9px; }
.rollbtn.wide b { font-size: 13px; }
.rollbtn.wide span { font-size: 20px; }
.chg-up { color: var(--up) !important; }
.chg-down { color: var(--down) !important; }

/* ---------- attack bar ---------- */
.attack h2 { display: flex; align-items: center; justify-content: space-between; }
.weapons { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin-bottom: 14px; }
.weapon { text-align: left; background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; cursor: pointer; transition: .15s; }
.weapon:hover { border-color: var(--gold-dim); }
.weapon.on { border-color: var(--gold); background: linear-gradient(180deg, var(--panel2), var(--panel)); box-shadow: inset 0 0 0 1px var(--gold-dim); }
.weapon .wn { font-weight: 700; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.weapon .wd { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.weapon .wt { font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: .06em; }

.seg { display: inline-flex; background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 7px; cursor: pointer; color: var(--muted); font-weight: 600; }
.seg button.on { background: var(--panel2); color: var(--gold2); box-shadow: 0 0 0 1px var(--line2); }
.controls { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin-bottom: 14px; }
.check { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); cursor: pointer; }

.tgroups { display: grid; gap: 12px; margin-bottom: 14px; }
.tgroup h3 { font-family: var(--sans); font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: .12em; margin-bottom: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line2); background: var(--bg2);
  border-radius: 999px; padding: 5px 12px; cursor: pointer; user-select: none; transition: .12s; font-weight: 500; font-size: 14px; }
.chip:hover { border-color: var(--gold-dim); }
.chips.sorting .chip { cursor: grabbing; }
.chip.dragging { border-style: dashed; border-color: var(--gold); opacity: .75; }
.chip.on { background: var(--crimson); border-color: var(--crimson3); color: #fff; }
.chip.on.cond { background: #3d2a12; border-color: #b0802f; }
.chip input { width: 46px; padding: 1px 4px; border-radius: 6px; font-size: 13px; text-align: center; background: rgba(0, 0, 0, .3); border-color: rgba(255, 255, 255, .2); }
.chip .x { opacity: .6; font-size: 12px; margin-left: 2px; }
.chip.add { border-style: dashed; color: var(--muted); }
/* Toggle chips get a little on/off switch so they read as switches */
.chip[data-t] { padding-left: 8px; }
.chip[data-t]::before { content: ''; flex: none; width: 26px; height: 14px; border-radius: 999px; background: var(--well); border: 1px solid var(--line2);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .4); transition: .15s;
  background-image: radial-gradient(circle at 7px 50%, var(--faint) 0 4.5px, transparent 5px); }
.chip[data-t].on::before { background-color: var(--crimson3); border-color: var(--crimson3);
  background-image: radial-gradient(circle at 19px 50%, #fff 0 4.5px, transparent 5px); }
.chip[data-t].cond.on::before { background-color: #c48a2c; border-color: #c48a2c; }
.chip[data-t]:hover::before { border-color: var(--gold-dim); }
.tg-hint { font-size: 12px; color: var(--faint); margin: -4px 0 8px; }

.manual { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; color: var(--muted); font-size: 14px; }
.manual label { display: inline-flex; gap: 6px; align-items: center; }

.preview { margin-top: 16px; background: var(--well); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.preview table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.preview th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); font-weight: 600; padding: 9px 12px; border-bottom: 1px solid var(--line); }
.preview td { padding: 9px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.preview tr:last-child td { border-bottom: 0; }
.preview .hit { font-family: var(--serif); font-weight: 700; font-size: 18px; color: var(--gold2); white-space: nowrap; }
.preview .dmg { font-weight: 600; }
.preview .crit { color: var(--muted); font-size: 13px; }
.preview .n { color: var(--muted); white-space: nowrap; }
.howto { float: right; color: var(--faint); }
.rb { border: 1px solid var(--line2); background: var(--panel2); border-radius: 8px; padding: 6px 10px; cursor: pointer; white-space: nowrap;
  font-variant-numeric: tabular-nums; transition: .12s; position: relative; }
.rb:hover { border-color: var(--gold); background: var(--hover); }
.rb:active { transform: translateY(1px); }
.rb.hit { font-family: var(--serif); font-weight: 700; font-size: 17px; color: var(--hit-text); border-color: var(--crimson2);
  background: linear-gradient(180deg, var(--acc1), var(--acc2)); }
.rb.hit:hover { border-color: var(--crimson3); background: linear-gradient(180deg, var(--acc1h), var(--acc2h)); }
.rb.dmg { font-weight: 600; }
/* Other rolls that go to Roll20 (concentration, overcome SR): roll-button colours at normal size */
.rb.send { color: var(--hit-text); border-color: var(--crimson2); background: linear-gradient(180deg, var(--acc1), var(--acc2)); font-weight: 600; }
.rb.send:hover { border-color: var(--crimson3); background: linear-gradient(180deg, var(--acc1h), var(--acc2h)); }
/* Crit confirm looks like a to-hit roll, crit damage like a damage roll, same size */
.rb.conf { font-family: var(--serif); font-weight: 700; font-size: 17px; color: var(--hit-text); border-color: var(--crimson2);
  background: linear-gradient(180deg, var(--acc1), var(--acc2)); margin: 2px 6px 2px 0; }
.rb.conf:hover { border-color: var(--crimson3); background: linear-gradient(180deg, var(--acc1h), var(--acc2h)); }
.rb.cdmg { font-weight: 600; margin: 2px 6px 2px 0; }
/* Every roll button in the attack table is the same height, whatever its font */
.preview .rb.hit, .preview .rb.dmg, .preview .rb.conf, .preview .rb.cdmg { box-sizing: border-box; height: 38px; line-height: 24px; padding-top: 6px; padding-bottom: 6px; vertical-align: middle; }
.rb.conf small, .rb.cdmg small { font-family: var(--sans); font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; opacity: .8; margin: 0 2px; }
.rb.used { opacity: .45; }
.die { width: 1em; height: 1em; vertical-align: -0.14em; margin-right: 2px; }
.rb.used::after { content: '✓'; position: absolute; top: -7px; right: -6px; background: var(--up); color: #10200f; border-radius: 50%;
  width: 16px; height: 16px; font: 700 11px/16px var(--sans); text-align: center; }
.critc { white-space: normal; }
.notes { padding: 8px 12px; color: #e9c98f; font-size: 13px; border-top: 1px solid var(--line); }
.active-line { padding: 8px 12px; color: var(--muted); font-size: 13px; border-bottom: 1px solid var(--line); }

.fire { margin-top: 12px; display: flex; gap: 10px; align-items: stretch; flex-wrap: wrap; justify-content: flex-end; }
.fire .go { flex: 1 1 260px; font-family: var(--serif); font-size: 20px; font-weight: 700; letter-spacing: .04em; padding: 14px 20px;
  border-radius: 12px; border: 1px solid var(--crimson3); color: #fff; cursor: pointer;
  background: linear-gradient(180deg, var(--crimson2), var(--crimson)); box-shadow: 0 6px 20px rgba(163, 48, 75, .35); transition: .12s; }
.fire .go:hover { filter: brightness(1.12); }
.fire .go:active { transform: translateY(1px); }
.fire .go small { display: block; font-family: var(--sans); font-size: 12px; font-weight: 500; opacity: .85; letter-spacing: 0; }
details.raw { margin-top: 10px; }
details.raw summary { cursor: pointer; color: var(--faint); font-size: 13px; }
details.raw pre { white-space: pre-wrap; word-break: break-all; font: 12px/1.5 var(--mono); background: var(--well); border: 1px solid var(--line); border-radius: 8px; padding: 10px; color: var(--muted); }

/* ---------- portrait, XP, defenses, afflictions ---------- */
.charid { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.charid .charsub { margin: 0; }
.charinfo { flex: 1; min-width: 0; }
.portrait { flex: none; width: 88px; height: 88px; border-radius: 50%; padding: 0; overflow: hidden; cursor: pointer; display: grid; place-items: center; align-content: center;
  border: 1px solid var(--crimson3); background: radial-gradient(circle at 30% 30%, var(--crimson2), var(--crimson)); color: var(--gold2); }
.portrait img { width: 100%; height: 100%; object-fit: cover; display: block; }
.portrait span { font-family: var(--serif); font-size: 34px; font-weight: 700; line-height: 1; }
.portrait small { font-size: 9px; color: var(--acc-text); opacity: .8; }
.portrait:hover { box-shadow: 0 0 0 2px var(--gold-dim); }
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.avatar:has(img) { overflow: hidden; }
.xpadd { border: 1px solid var(--line2); background: var(--bg2); color: var(--gold); border-radius: 6px; width: 20px; height: 20px; line-height: 16px; padding: 0; cursor: pointer; font-weight: 700; }
.xpbar { grid-column: 1 / -1; height: 5px; background: var(--well); border-radius: 3px; overflow: hidden; margin: 4px 0 2px; }
.xpline { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; font-size: 14px; }
.xpline b { color: var(--muted); font-weight: 600; font-size: 12px; letter-spacing: .06em; margin-right: 4px; }
.xpline.xpnext { color: var(--muted); font-size: 12px; margin-top: 1px; }
.xptogo { font-size: 13px; color: var(--text); margin-top: 3px; }
.xptogo b { color: var(--gold2); }
.xpbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold-dim), var(--gold)); }
.levelup { grid-column: 1 / -1; color: var(--gold2); font-size: 13px; }
details.defs { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
details.defs summary { cursor: pointer; color: var(--gold); font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
details.defs dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; margin: 10px 0 0; font-size: 13px; }
details.defs dt { color: var(--faint); }
details.defs dd { margin: 0; color: var(--muted); }
.affs { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 6px; }
.aff { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: #3d2a12; border: 1px solid #b0802f; color: #f3d6a0; }
.hp { display: block; }
.hp-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.hp-top h2 { margin: 0; }
.hp .hp-num { font-size: 30px; line-height: 1; }
.hp .hp-bar { width: 100%; height: 9px; margin: 10px 0 4px; }
.hp-extra { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.hp-ctl { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 10px; }
.hp-ctl input { grid-column: 1 / -1; width: 100%; text-align: center; font-size: 16px; }
.hp-ctl .btn { justify-content: center; padding: 6px 4px; }
.hp .affs { margin-top: 10px; }
.afftbl { width: 100%; border-collapse: collapse; }
.afftbl th { text-align: left; font-size: 12px; color: var(--muted); padding: 4px; }
.afftbl td { padding: 3px 4px; }
.afftbl input { width: 100%; }
.roundc { align-self: center; color: var(--gold2); font-family: var(--serif); font-weight: 700; }
/* Whole-round card sends to Roll20 like the roll buttons, so it gets their colors; sits at the left of the row */
.fire .rollcard { margin-right: auto; color: var(--hit-text); border-color: var(--crimson2); background: linear-gradient(180deg, var(--acc1), var(--acc2)); }
.fire .rollcard:hover { border-color: var(--crimson3); background: linear-gradient(180deg, var(--acc1h), var(--acc2h)); }
.chip .dur { display: none; font-size: 11px; opacity: .7; padding: 0 2px; border-radius: 4px; }
.chip.on .dur.set { display: inline; }
.chip .dur.set { opacity: 1; background: rgba(0, 0, 0, .35); padding: 0 5px; }
.chip .dur:hover { opacity: 1; }
.inv-end { display: flex; align-items: center; gap: 4px; justify-content: flex-end; }
.load { margin-top: 10px; display: grid; gap: 6px; }
.load-bar { position: relative; height: 8px; background: var(--well); border-radius: 5px; overflow: hidden; }
.load-bar i { display: block; height: 100%; background: #4c8a45; }
.load-bar i.medium { background: #b07a2a; } .load-bar i.heavy { background: var(--crimson2); } .load-bar i.overloaded { background: var(--crimson3); }
.load-bar span { position: absolute; top: 0; bottom: 0; width: 1px; background: rgba(255, 255, 255, .35); }
.load-txt { font-size: 13px; color: var(--muted); }

/* ---------- daily uses ---------- */
.trackp h2 { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.trackp h2 .btn { text-transform: none; letter-spacing: 0; font-family: var(--sans); }
.trackers { display: grid; gap: 8px; margin-bottom: 10px; }
.trk { display: grid; gap: 4px; }
.trk.empty .trk-name { color: var(--faint); text-decoration: line-through; }
.trk-name { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.trk-name small { color: var(--faint); font-weight: 400; }
.trk-name .x, .spell .x, .inv-row .x { border: 0; background: none; color: var(--faint); cursor: pointer; padding: 0 4px; }
.trk-name .x:hover, .spell .x:hover, .inv-row .x:hover { color: var(--down); }
.inv-row .x.ret:hover { color: var(--gold); }
.pips { display: flex; flex-wrap: wrap; gap: 4px; }
.pip { width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--gold-dim); background: transparent; cursor: pointer; padding: 0; }
.pip.on { background: radial-gradient(circle at 35% 35%, var(--gold2), var(--gold) 60%, var(--gold-dim)); border-color: var(--gold); }
.pip:hover { box-shadow: 0 0 0 2px rgba(234, 185, 108, .25); }
.ctr { display: inline-flex; align-items: center; gap: 6px; }
.ctr b { font-family: var(--serif); font-size: 20px; min-width: 2ch; text-align: right; }
.ctr small { color: var(--faint); margin-right: 4px; }
.trk-hidden { display: grid; gap: 6px; margin: 0 0 10px; }
.linkish { justify-self: start; border: 0; background: none; padding: 0; color: var(--muted); font-size: 13px; cursor: pointer; text-decoration: underline; }
.linkish:hover { color: var(--gold2); }
.trk-hrow { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.trk-hrow small { color: var(--faint); }
.btn.ghostish { width: 100%; justify-content: center; border-style: dashed; background: transparent; color: var(--muted); font-weight: 500; }

.trk-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.trk-acts .rb { padding: 4px 8px; font-size: 13px; }
.trk-acts .rb.hit { font-size: 14px; }

/* ---------- combat extras, situational rolls ---------- */
.extras { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
.extras-h { font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: .12em; margin-right: 4px; }
.extras .rb { font-size: 13px; padding: 5px 9px; }
.skw { display: grid; align-content: start; min-width: 0; }
.skc { display: block; box-sizing: border-box; max-width: calc(100% - 22px); margin: 0 0 4px 22px; border: 1px dashed var(--line2);
  background: none; color: var(--muted); border-radius: 999px; padding: 2px 10px; font-size: 12px; cursor: pointer; text-align: left;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.skc:hover { border-color: var(--gold-dim); color: var(--gold2); }
.skc b { color: var(--text); margin-right: 2px; }
.weapon.addw { border-style: dashed; background: transparent; }
.weapon.addw .wn { color: var(--muted); }
dialog:has(#wform) { width: min(740px, calc(100vw - 32px)); }
#wform .row { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }

/* ---------- spells ---------- */
.caster + .caster { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 16px; }
.caster-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.caster-head h3 { font-size: 18px; color: var(--gold2); }
.caster-head h3 small { font-family: var(--sans); font-size: 13px; color: var(--muted); font-weight: 500; letter-spacing: 0; margin-left: 6px; }
.caster-rolls { display: flex; gap: 8px; flex-wrap: wrap; }
.slvl { margin-top: 12px; }
.slvl-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 6px 0; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.slvl-head b { font-family: var(--serif); color: var(--gold); min-width: 90px; }
.slvl-head .dc { font-size: 12px; color: var(--muted); border: 1px solid var(--line2); border-radius: 999px; padding: 1px 8px; }
.slvl-head .add-spell { margin-left: auto; }
.atwill, .slotcount { font-size: 13px; color: var(--muted); }
.slotcount.over { color: #e9c98f; }
.spell { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name acts" "meta acts"; column-gap: 10px; padding: 6px 4px; border-radius: 8px; }
.spell:hover { background: var(--bg2); }
.spell-name { grid-area: name; border: 0; background: none; padding: 0; text-align: left; font-weight: 600; cursor: pointer; color: var(--text); }
.spell-name:hover { color: var(--gold2); text-decoration: underline; }
.spell-meta { grid-area: meta; font-size: 12px; color: var(--faint); }
.spell-acts { grid-area: acts; display: flex; align-items: center; gap: 4px; }
.spell.spent .spell-name { color: var(--faint); text-decoration: line-through; }
.btn:disabled { opacity: .4; cursor: default; filter: none; }
.fine.none { margin: 4px; }
.castdlg h2 small, .pickdlg h2 small { font-family: var(--sans); font-size: 13px; color: var(--muted); letter-spacing: 0; }
.spellinfo { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; font-size: 14px; }
.spellinfo dt { color: var(--faint); }
.spellinfo dd { margin: 0; }
.spelldesc { margin: 0; padding: 10px 12px; background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; font-size: 14px; }
.castrolls { display: flex; flex-wrap: wrap; gap: 8px; }
.castrolls .rb.used { opacity: .6; }
.castrolls .rb small { font-family: var(--sans); font-size: 12px; font-weight: 500; color: var(--acc-text); margin-left: 4px; }
.whopick { display: flex; flex-wrap: wrap; gap: 8px; }
.xplink { font-size: 12px; margin-left: 4px; }
dialog:has(.xplogdlg) { width: min(740px, calc(100vw - 32px)); }
.xplogdlg h2 small, .loadouts small { font-family: var(--sans); font-size: 13px; color: var(--muted); letter-spacing: 0; }
.xplog { max-height: min(60vh, 520px); overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.xplog table { width: 100%; border-collapse: collapse; font-size: 13px; }
.xplog th { position: sticky; top: 0; background: var(--panel); text-align: left; color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.xplog td { padding: 5px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.xplog .n { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.xplog .run { color: var(--muted); }
.xplog .ph { color: var(--muted); }
.xplog tr.sep td { color: var(--gold2); font-weight: 600; background: var(--panel2, transparent); }
.xplog tr.site small { color: var(--muted); }
.xplog .btn.small { padding: 2px 7px; }
.loadouts { display: grid; gap: 8px; }
.loadout { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; }
.loadout > div { flex: 1; min-width: 0; }
.loadout span { display: block; color: var(--muted); font-size: 12px; }
dialog:has(.pickdlg), dialog:has(.castdlg) { width: min(660px, calc(100vw - 32px)); }
.picklist { max-height: min(50vh, 420px); overflow-y: auto; display: grid; gap: 4px; border: 1px solid var(--line); border-radius: 10px; padding: 4px; background: var(--bg2); }
.pick { text-align: left; border: 1px solid transparent; background: none; border-radius: 8px; padding: 8px 10px; cursor: pointer; }
.pick:hover { background: var(--panel2); border-color: var(--line2); }
.pick b { color: var(--gold2); }
.pick small { color: var(--faint); margin-left: 6px; }
.pick span { display: block; color: var(--muted); font-size: 13px; }
.pick.added { border-color: #3e6a3a; }
.pick.added b::after { content: ' ✓'; color: var(--up); }

/* ---------- gear + money ---------- */
.money { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.coin { display: flex; align-items: center; gap: 6px; background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 4px 4px 4px 10px; }
.coin span { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.coin.pp span { color: #cfd8e3; } .coin.gp span { color: var(--gold); } .coin.sp span { color: #b9c0c7; } .coin.cp span { color: #c98a5a; }
.coin input { width: 90px; border: 0; background: transparent; font-family: var(--serif); font-size: 18px; font-weight: 700; padding: 4px 6px; }
.money-total { color: var(--muted); font-size: 14px; margin-left: 4px; }
.inv { display: grid; gap: 4px; }
/* Each row is its own grid, so the last column has a fixed width: rows with and without a Use button line up */
.inv-head, .inv-row { display: grid; grid-template-columns: minmax(0, 2.2fr) auto 64px minmax(0, 1.6fr) 104px; gap: 6px; align-items: center; }
.inv-row .inv-end { display: flex; align-items: center; justify-content: flex-end; gap: 4px; }
.inv-head { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); padding: 0 2px 4px; }
.inv-row input { width: 100%; min-width: 0; padding: 5px 8px; }
.inv-row .qty { display: inline-flex; align-items: center; gap: 2px; }
.inv-row .qty input { width: 52px; text-align: center; }
.inv-row .qty .btn { padding: 4px 8px; }
.inv-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; gap: 10px; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: -4px -4px 14px; overflow-x: auto; }
.tab { border: 0; background: none; padding: 9px 14px; cursor: pointer; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab.on { color: var(--gold2); border-bottom-color: var(--gold); }
.skills { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px 18px; }
.skills .stat > span { border-bottom: 1px dashed var(--line); }
.skills .sk { display: grid; grid-template-columns: 1fr auto; padding: 5px 6px; border-radius: 6px; cursor: pointer; }
.skills .sk:hover { background: var(--bg2); color: var(--gold2); }
.skills .sk span:last-child { font-weight: 700; font-variant-numeric: tabular-nums; }
.skills .sk small { color: var(--faint); margin-left: 4px; font-weight: 400; }
.feats { display: grid; gap: 8px; }
.feats div { background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; }
.feats b { color: var(--gold2); }
.feats span { color: var(--muted); display: block; font-size: 14px; }
.feature { margin-bottom: 16px; }
.feature h3 { font-size: 14px; color: var(--gold); margin-bottom: 6px; }
.feature div { white-space: pre-wrap; color: var(--muted); font-size: 14px; }
.feature b { color: var(--text); }
.notes-edit { width: 100%; min-height: 260px; resize: vertical; line-height: 1.5; }
.gear { white-space: pre-wrap; color: var(--muted); font-size: 14px; }

/* ---------- dialog / toast ---------- */
dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line2); border-radius: 14px; padding: 24px; width: min(580px, calc(100vw - 32px)); box-shadow: var(--shadow); font-size: 16px; }
dialog::backdrop { background: rgba(0, 0, 0, .6); }
dialog h2 { font-size: 21px; color: var(--gold2); margin-bottom: 14px; }
dialog .form { display: grid; gap: 12px; }
dialog .form label { display: grid; gap: 4px; color: var(--muted); font-size: 14.5px; }
dialog .form .row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
dialog .form input, dialog .form select, dialog .form textarea { width: 100%; }
dialog .form textarea { resize: vertical; font-size: 15px; }
dialog .acts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.menu-list { display: grid; gap: 8px; }
.menu-list .btn { justify-content: flex-start; }
.menu-list .sep { height: 1px; background: var(--line); margin: 4px 0; }

/* Short messages show in the middle of the window; as a popover they sit above any open dialog too */
#toast { position: fixed; inset: auto; margin: 0; left: 50%; top: 50%; transform: translate(-50%, -50%) scale(.94); opacity: 0; pointer-events: none;
  background: var(--panel2); border: 1px solid var(--gold-dim); color: var(--gold2); padding: 18px 28px; border-radius: 10px; font-size: 20px;
  box-shadow: var(--shadow); transition: .2s; z-index: 50; font-weight: 600; max-width: min(620px, calc(100vw - 32px));
  text-align: center; overflow: visible; }
#toast.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
/* Dims the page below the banner while a message shows; clicks still go through to the page */
#toastDim { position: fixed; left: 0; right: 0; bottom: 0; top: 0; background: rgba(0, 0, 0, .8); opacity: 0; pointer-events: none;
  transition: opacity .2s; z-index: 49; }
#toastDim.show { opacity: 1; }

.foot { text-align: center; color: var(--gold-dim); font-size: 14px; font-weight: 500; letter-spacing: .04em; padding: 28px 16px 22px; }
/* Footer sits at the bottom of the window on short pages */
body { display: flex; flex-direction: column; }
body > main { flex: 1 0 auto; width: 100%; }

/* ---------- mobile ---------- */
.mobilebar { display: none; }
/* Less common conditions/situations: hidden until "+ N more" (an active one always shows) */
.tgroup .chip.more { display: none; }
.tgroup.open .chip.more, .tgroup .chip.more.on { display: inline-flex; }
.morebtn .m2, .tgroup.open .morebtn .m1 { display: none; }
.tgroup.open .morebtn .m2 { display: inline; }
.weapon { min-width: 0; }
.weapon .wnote { display: block; font-size: 12px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.rangec { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; }
.rangec select { padding-top: 4px; padding-bottom: 4px; }
.critx { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; padding: 8px 12px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); }
.critx b { color: var(--text); font-weight: 600; }
.critx .rb { font-size: 12px; padding: 3px 7px; margin-left: 4px; }
.critx .fine { flex-basis: 100%; font-size: 12px; }
.aoo { align-self: center; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--faint); text-transform: uppercase; letter-spacing: .08em; }
.aoo .pip { width: 16px; height: 16px; }
.mnv { grid-column: 1 / -1; display: flex; gap: 6px; align-items: center; margin: 0 0 4px; }
.mnv select { flex: 1 1 0; min-width: 0; max-width: max-content; padding-top: 4px; padding-bottom: 4px; font-size: 14px; }
.mnv .rb { flex: none; font-size: 14px; padding: 4px 9px; }
.cmdx { grid-column: 1 / -1; text-align: right; color: var(--muted); font-size: 12px; margin-top: -4px; }
.cmdx b { color: var(--text); }
.wnotes { margin: 0; font-size: 14px; }
@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .layout > .col[data-col="right"] { display: none; }    /* one column: every card goes in the left one */
  .on-sheet .foot { padding-bottom: 90px; }          /* room for the sheet's bottom Roll bar */
  .mobilebar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; gap: 10px; align-items: center;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: var(--bar-bg); border-top: 1px solid var(--line); backdrop-filter: blur(8px); }
  .mobilebar .sum { flex: 1; min-width: 0; font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mobilebar .sum b { color: var(--gold2); font-family: var(--serif); font-size: 16px; }
  .mobilebar .go { font-family: var(--serif); font-weight: 700; padding: 12px 18px; border-radius: 10px; border: 1px solid var(--crimson3);
    color: #fff; background: linear-gradient(180deg, var(--crimson2), var(--crimson)); }
}
@media (max-width: 600px) {
  main { padding: 16px; }
  .banner { height: auto; min-height: 170px; }
  .on-sheet .banner { height: auto; min-height: 64px; }
  .on-sheet .banner-inner { padding-top: 8px; padding-bottom: 8px; }
  .banner-inner { padding: 14px 16px; flex-direction: column; align-items: flex-start; justify-content: center; gap: 10px; }
  .attack h2 { flex-wrap: wrap; gap: 10px; }
  .seg button { padding: 6px 9px; font-size: 12px; white-space: nowrap; }
  .preview .dmg { white-space: nowrap; }
  .brand-tag { display: none; }
  .preview td, .preview th { padding: 6px; }
  .preview thead { display: none; }
  .preview tr { display: grid; grid-template-columns: auto auto 1fr; gap: 6px; align-items: center; padding: 8px; border-bottom: 1px solid var(--line-soft); }
  .preview td { border: 0; padding: 0; }
  .preview td.critc { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; }
  .preview td.critc .rb { margin: 0; padding: 6px 8px; }
  .preview td.critc .rb small { letter-spacing: 0; margin: 0 1px; }
  .howto { float: none; display: block; }
  .weapons { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .inv-head { display: none; }
  .inv-row { grid-template-columns: minmax(0, 1fr) auto 56px; grid-template-areas: "name qty x" "notes lb x"; padding: 8px 0; border-bottom: 1px solid var(--line); }
  .inv-row input[data-f=name] { grid-area: name; }
  .inv-row .qty { grid-area: qty; }
  .inv-row input[data-f=lb] { grid-area: lb; width: 70px; }
  .inv-row input[data-f=notes] { grid-area: notes; }
  .inv-row .inv-end { grid-area: x; flex-direction: column; }
  .coin input { width: 70px; }
}
@media (max-width: 420px) {
  .weapons { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
/* sheet text size (A− / A+), in the top line before "Saved" */
.crumbs .sheet-zoom { margin-left: auto; align-self: center; }
.crumbs .sheet-zoom + .saved { margin-left: 4px; }

/* ---------- rules menu (rules.js): right-click / press and hold a name for its Archives of Nethys page ---------- */
.rmenu { position: fixed; inset: auto; margin: 0; z-index: 1000; min-width: 220px; max-width: min(420px, calc(100vw - 16px)); padding: 6px;
  background: var(--panel2); color: var(--text); border: 1px solid var(--line2); border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
  display: flex; flex-direction: column; gap: 2px; font-size: 15px; }
.rmenu a, .rmenu button { display: flex; align-items: center; justify-content: space-between; gap: 14px; width: 100%; padding: 9px 12px; border: 0; border-radius: 7px;
  background: none; color: var(--text); font: inherit; text-align: left; text-decoration: none; cursor: pointer; }
.rmenu a:hover, .rmenu button:hover, .rmenu a:focus-visible, .rmenu button:focus-visible { background: var(--panel); color: var(--gold2); outline: none; }
.rmenu button { color: var(--gold); }
.rm-out { color: var(--gold-dim); flex: none; }
[data-rule] { -webkit-touch-callout: none; }
@media (pointer: coarse) { [data-rule]:not(input) { -webkit-user-select: none; user-select: none; } .rmenu a, .rmenu button { padding: 12px 14px; } }
