:root {
  /* Owlbear-native (1.78): Owlbear's own navy surfaces, lilac accent, round shapes, Roboto */
  --bg: #1d2030; --panel: #222639; --panel2: #2d3147; --row: #282c41; --line: #3d4262; --text: #f4f5fb; --dim: #a3a8c8;
  --gold: #bb99ff; --gold2: #d2bcff; --accent: #bb99ff; --red: #ff7a7a; --green: #6fd6a0; --blue: #6fb3ff; --violet: #e59cff;
  --cur: #3b3466; --radius: 12px; --muted: #a3a8c8; --onaccent: #1a1d2d;
  --serif: 'Roboto', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --sans: 'Roboto', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.4 var(--sans); }
.hidden { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: var(--text); background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; }
input:focus, select:focus, textarea:focus { outline: 1px solid var(--gold); border-color: var(--gold); }
.btn { background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 5px 10px; white-space: nowrap; }
.btn:hover { border-color: var(--gold); }
.btn.primary { background: var(--gold); color: var(--onaccent); border-color: var(--gold); font-weight: 600; }
.btn.primary:hover { background: var(--gold2); }
.btn.ghost { background: transparent; }
.btn.danger { border-color: #6b2f2f; color: #f0a0a0; }
.btn.small { padding: 2px 7px; font-size: 12px; }
.err { color: var(--red); min-height: 1em; }
.muted { color: var(--dim); }

/* login */
.login { position: fixed; inset: 0; display: grid; place-items: center; }
.login-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 28px; width: 320px; display: grid; gap: 10px; }
.login-card h1 { font-family: var(--serif); color: var(--gold); margin: 0; font-weight: normal; }

/* top bar */
.topbar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; position: sticky; top: 0; z-index: 20; }
.brand { font-family: var(--serif); color: var(--gold); font-size: 18px; margin-right: 6px; }
#campaignSelect { max-width: 260px; font-weight: 600; }
.spacer { flex: 1; }
.save-status { font-size: 12px; color: var(--dim); min-width: 70px; text-align: right; }
.save-status.error { color: var(--red); }
.gmres { display: flex; gap: 10px; }
.gmres .res { display: flex; align-items: center; gap: 4px; background: var(--panel2); border: 1px solid var(--line); border-radius: 20px; padding: 2px 4px 2px 10px; }
.gmres .res b { color: var(--violet); min-width: 20px; text-align: center; font-size: 16px; }
.menu { position: relative; }
.menu-list { position: absolute; right: 0; top: 110%; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 4px; display: grid; min-width: 210px; z-index: 30; box-shadow: 0 8px 30px #0008; }
.menu-list button { text-align: left; background: none; border: 0; padding: 7px 10px; border-radius: 5px; }
.menu-list button:hover { background: var(--panel2); }
.banner { background: #3b3466; color: var(--gold2); padding: 6px 14px; font-size: 13px; }

/* layout */
.layout { display: grid; grid-template-columns: 1fr 440px; gap: 0; height: calc(100vh - 52px); }
.layout.noside { grid-template-columns: 1fr; }
.layout.noside .side { display: none; }
.tracker { overflow: auto; padding: 10px 14px 80px; }
.side { border-left: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
.side-tabs { display: flex; gap: 2px; padding: 6px 6px 0; border-bottom: 1px solid var(--line); }
.side-tabs button { background: none; border: 0; padding: 7px 12px; border-radius: 6px 6px 0 0; color: var(--dim); }
.side-tabs button.on { background: var(--panel2); color: var(--text); }
.side-tabs .side-close { margin-left: auto; }
.side-body { overflow: auto; padding: 12px 14px 72px; flex: 1; }
@media (max-width: 1000px) {
  .layout { grid-template-columns: 1fr; height: auto; }
  .side { border-left: 0; border-top: 1px solid var(--line); }
}

/* controls */
.controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; position: sticky; top: 0; background: var(--bg); padding: 6px 0; z-index: 5; }
.round { display: flex; align-items: center; gap: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 2px 4px; }
.round span { font-family: var(--serif); font-size: 16px; padding: 0 6px; }
.round span b { color: var(--gold); }
.turnbtn { font-size: 15px; padding: 6px 16px; }

/* list */
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.row { display: grid; grid-template-columns: 22px 64px minmax(220px, 1fr) auto; gap: 8px; align-items: start; background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: var(--radius); padding: 8px 10px 8px 6px; }
.row.pc { border-left-color: var(--blue); }
.row.enemy { border-left-color: var(--red); }
.row.ally { border-left-color: var(--green); }
.row.current { background: var(--cur); border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }
.row.down { opacity: .55; }
.row.dragover { outline: 2px dashed var(--gold); }
.handle { cursor: grab; color: var(--dim); user-select: none; padding-top: 6px; text-align: center; }
.init { display: grid; gap: 3px; justify-items: center; }
.init input { width: 56px; text-align: center; font-size: 18px; font-weight: 700; padding: 3px 2px; }
.init .tb { font-size: 10px; color: var(--dim); }
.card { width: 54px; height: 40px; border-radius: 5px; background: #f3efe4; color: #222; display: grid; place-items: center; font-weight: 800; font-size: 17px; border: 1px solid #000; cursor: pointer; }
.card.red { color: #b3261e; }
.card.joker { background: linear-gradient(135deg, #f3d36a, #e48b5b); font-size: 13px; }
.card.none { background: var(--panel2); color: var(--dim); border-color: var(--line); }
.spot { font-size: 12px; }
.namebox { display: grid; gap: 4px; min-width: 0; }
.nameline { display: flex; gap: 6px; align-items: center; }
.nameline input.name { flex: 1; font-weight: 700; font-size: 15px; background: transparent; border-color: transparent; padding: 3px 4px; min-width: 60px; }
.nameline input.name:hover { border-color: var(--line); }
.nameline .icon { background: none; border: 0; color: var(--dim); padding: 2px 4px; font-size: 14px; }
.nameline .icon:hover { color: var(--gold); }
.badge { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; border-radius: 4px; padding: 1px 5px; background: var(--panel2); color: var(--dim); border: 1px solid var(--line); cursor: pointer; }
.badge.wc { color: var(--gold); border-color: var(--gold); }
textarea.notes { width: 100%; resize: none; overflow: hidden; min-height: 28px; background: transparent; border-color: transparent; color: #d3d6ea; padding: 3px 4px; line-height: 1.35; }
textarea.notes:hover, textarea.notes:focus { border-color: var(--line); background: var(--panel2); }
.chips { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.chip { font-size: 12px; border-radius: 12px; padding: 1px 8px; background: #3a3260; border: 1px solid #54498a; cursor: pointer; }
.chip.use { background: #1f3340; border-color: #2f5166; }
.chip.use.spent { opacity: .45; text-decoration: line-through; }
.chip.add { background: none; border-style: dashed; color: var(--dim); }
.chip .x { margin-left: 4px; color: var(--dim); }
.fields { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-start; justify-content: flex-end; }
.field { display: grid; gap: 2px; justify-items: center; }
.field label { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--dim); }
.field input.num { width: 52px; text-align: center; font-weight: 600; }
.field input.txt { width: 80px; text-align: center; }
.hp { display: grid; gap: 3px; justify-items: center; }
.hp .vals { display: flex; align-items: center; gap: 3px; }
.hp .vals input { width: 48px; text-align: center; font-weight: 700; }
.hp .vals .max { width: 44px; color: var(--dim); font-weight: 400; }
.hp .temp { width: 38px; text-align: center; color: var(--blue); }
.hp .bar { width: 130px; height: 5px; background: var(--panel2); border-radius: 3px; overflow: hidden; }
.hp .bar i { display: block; height: 100%; background: var(--green); }
.hp .bar i.mid { background: var(--gold); }
.hp .bar i.low { background: var(--red); }
.dmg { width: 130px; font-size: 12px; text-align: center; }
.slots { display: flex; gap: 3px; flex-wrap: wrap; max-width: 160px; justify-content: center; }
.slot { width: 16px; height: 16px; border-radius: 3px; border: 1px solid var(--dim); background: transparent; padding: 0; }
.slot.on { background: var(--red); border-color: var(--red); }
.slot.stress.on { background: var(--violet); border-color: var(--violet); }
.counter { display: flex; align-items: center; gap: 2px; }
.counter b { min-width: 22px; text-align: center; font-size: 16px; }
.counter button { background: var(--panel2); border: 1px solid var(--line); border-radius: 4px; width: 22px; height: 22px; padding: 0; }
.rowmenu { position: relative; }
.rowmenu > button { background: none; border: 0; color: var(--dim); font-size: 16px; padding: 2px 6px; }
.empty { text-align: center; color: var(--dim); padding: 50px 20px; border: 1px dashed var(--line); border-radius: 10px; }
.empty h2 { font-family: var(--serif); color: var(--gold); font-weight: normal; }

/* stat block */
.sb h2 { font-family: var(--serif); color: var(--gold); margin: 0; font-weight: normal; font-size: 22px; }
.sb .meta { font-style: italic; color: var(--dim); margin-bottom: 6px; }
.sb .src { font-size: 12px; color: var(--dim); }
.sb hr { border: 0; border-top: 1px solid var(--line); margin: 8px 0; }
.sb .kv { margin: 2px 0; }
.sb .kv b { color: #e6e8f5; }
.sb .abil { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; margin: 6px 0; font-size: 12.5px; }
.sb .abil table { width: 100%; border-collapse: collapse; background: #ffffff0a; border-radius: 4px; font-variant-numeric: tabular-nums; }
.sb .abil th, .sb .abil td { padding: 1px 3px; text-align: center; font-weight: normal; white-space: nowrap; }
.sb .abil thead th { font-size: 9px; text-transform: uppercase; letter-spacing: .05em; color: var(--dim); background: transparent; }
.sb .abil tbody th { text-align: right; text-transform: uppercase; font-size: 10.5px; letter-spacing: .04em; font-weight: 700; color: var(--accent); }
.sb .abil td.sc { text-align: left; }
.sb .abil tbody td:not(.sc) { background: #6aa8ff1a; }
.sb .abil tr.prof td:last-child { font-weight: 700; }
.sb h3 { font-family: var(--serif); color: var(--gold); font-weight: normal; border-bottom: 1px solid var(--line); margin: 12px 0 4px; font-size: 17px; }
.sb .entry { margin: 5px 0; white-space: pre-line; }
.sb .entry > b { font-style: italic; color: #eef0fa; }
.sb .intro { color: #d3d6ea; white-space: pre-line; }
.sb .cost { font-size: 11px; background: #33284a; border-radius: 8px; padding: 0 6px; margin-left: 4px; }
.roll { color: var(--blue); cursor: pointer; border-bottom: 1px dotted var(--blue); }
.term { border-bottom: 1px dotted var(--gold); cursor: help; }
.term.missing { border-bottom-color: var(--red); }
.sb .raw { white-space: pre-wrap; font-size: 12px; color: var(--dim); background: var(--panel2); padding: 8px; border-radius: 6px; }
.sb details summary { cursor: pointer; color: var(--dim); margin-top: 12px; }

/* side lists */
.lib-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; border: 1px solid transparent; }
.lib-item:hover { border-color: var(--line); background: var(--panel2); }
.lib-item .nm { flex: 1; min-width: 0; }
.lib-item .nm small { color: var(--dim); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toolbar { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.toolbar input[type=search] { flex: 1; min-width: 140px; }
.gl-item { padding: 8px; border-bottom: 1px solid var(--line); }
.gl-item b { color: var(--gold2); }
.gl-item .exact { font-size: 12px; color: #d3d6ea; margin-top: 4px; white-space: pre-line; border-left: 2px solid var(--gold); padding-left: 8px; }
.pill { font-size: 11px; color: var(--dim); }

/* modal */
.modal { position: fixed; inset: 0; background: #000a; display: grid; place-items: start center; padding: 5vh 12px; z-index: 50; overflow: auto; }
.modal-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; width: min(820px, 100%); padding: 18px 20px; box-shadow: 0 20px 60px #000a; }
.modal-card h2 { font-family: var(--serif); color: var(--gold); font-weight: normal; margin: 0 0 12px; }
.modal-card .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }
.tabs { display: flex; gap: 4px; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.tabs button { background: none; border: 0; padding: 7px 12px; color: var(--dim); border-bottom: 2px solid transparent; }
.tabs button.on { color: var(--text); border-bottom-color: var(--gold); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form label { display: grid; gap: 3px; font-size: 12px; color: var(--dim); margin-bottom: 8px; }
.form label input, .form label select, .form label textarea { color: var(--text); font-size: 14px; }
.paste { width: 100%; min-height: 220px; font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.preview-entries .pe { display: flex; gap: 6px; align-items: flex-start; border-bottom: 1px solid var(--line); padding: 4px 0; }
.preview-entries .pe input { width: 200px; font-weight: 600; }
.preview-entries .pe textarea { flex: 1; min-height: 40px; font-size: 12px; }
.ftable { width: 100%; border-collapse: collapse; }
.ftable td { padding: 3px; }
.ftable input, .ftable select { width: 100%; }

/* tooltip & toasts */
.tip { position: fixed; z-index: 60; max-width: 420px; max-height: 60vh; overflow: auto; background: #1a1d2d; border: 1px solid var(--gold); border-radius: 8px; padding: 10px 12px; box-shadow: 0 10px 30px #000c; font-size: 13px; pointer-events: none; }
.tip.interactive { pointer-events: auto; }
.tip b { color: var(--gold2); }
.toasts { position: fixed; right: 14px; bottom: 14px; display: grid; gap: 6px; z-index: 70; max-width: 380px; }
.toast { background: #1a1d2d; border: 1px solid var(--line); border-left: 4px solid var(--gold); border-radius: 6px; padding: 8px 12px; box-shadow: 0 6px 20px #0009; }
.toast.warn { border-left-color: var(--red); }
.toast.good { border-left-color: var(--green); }

/* selection / secrecy markers */
.row.selected { box-shadow: 0 0 0 2px var(--blue) inset; }
.row.current.selected { box-shadow: 0 0 0 1px var(--gold) inset, 0 0 0 3px var(--blue) inset; }
.row.secret { background-image: repeating-linear-gradient(135deg, transparent 0 12px, #ffffff06 12px 24px); }

/* narrow screens and the Owlbear panel: side panel becomes a drawer, rows stack */
@media (max-width: 1000px) {
  .layout { grid-template-columns: 1fr; height: auto; }
  .side { position: fixed; top: 0; right: 0; bottom: 0; width: min(460px, 94vw); z-index: 40; border-left: 1px solid var(--line); box-shadow: -10px 0 40px #000a; }
}
@media (max-width: 760px) {
  .topbar { gap: 5px; padding: 6px 8px; }
  .topbar .btn { padding: 4px 7px; }
  .brand { display: none; }
  .tracker { padding: 8px 8px 60px; }
  .turnbtn { padding: 5px 10px; }
}
body.obr .topbar { position: sticky; }
body.obr .save-status { min-width: 0; }

/* player view */
.player .round-label { font-family: var(--serif); font-size: 16px; }
.player .round-label b { color: var(--gold); }
.plist { list-style: none; margin: 0; padding: 10px; display: grid; gap: 6px; }
.prow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: 8px; padding: 9px 12px; cursor: default; }
.prow[data-ptoken] { cursor: pointer; }
.prow.pc { border-left-color: var(--blue); }
.prow.enemy { border-left-color: var(--red); }
.prow.ally { border-left-color: var(--green); }
.prow.current { background: var(--cur); border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }
.prow.mine .pname { color: var(--gold2); }
.pname { font-weight: 700; font-size: 15px; flex: 1; min-width: 120px; }
.phealth { font-size: 12px; border-radius: 10px; padding: 1px 8px; background: var(--panel2); border: 1px solid var(--line); }
.phealth.h-bloodied { color: var(--gold2); }
.phealth.h-down { color: var(--red); }
.phealth.h-unhurt { color: var(--green); }
.card.small { width: 38px; height: 28px; font-size: 13px; }

/* app fills the window; the list scrolls under a fixed top bar + turn controls */
#app:not(.hidden) { display: flex; flex-direction: column; height: 100vh; }
#app .layout { flex: 1; min-height: 0; height: auto; }
#app .tracker { min-height: 0; overflow: auto; }
.player .brand { display: block !important; }
.player { display: flex; flex-direction: column; height: 100vh; }
.player .plist { overflow: auto; flex: 1; }

/* use counters: every dot is its own button */
.chip.use .pip { cursor: pointer; padding: 0 1px; font-size: 13px; line-height: 1; }
.chip.use .pip:hover { color: var(--gold); transform: scale(1.25); display: inline-block; }
.chip.use .pip:not(.full) { opacity: .55; }
.chip.use.spellslot { border-color: #4b5d8a; }
/* lair turn */
.row.lairrow { background: #2f2c4a; }
.row.lairrow .lairname { font-weight: 600; color: var(--gold); padding: 4px 6px; flex: 1; }

.chip.use { white-space: nowrap; flex: 0 0 auto; }
.chips.spellslots { margin-top: 4px; align-items: center; }
.chips.spellslots .slotlbl { font-size: 11px; color: var(--muted, #9a9486); margin-right: 2px; }

.menu-list a.menulink { display: block; padding: 6px 12px; color: var(--text); text-decoration: none; }
.menu-list a.menulink:hover { background: var(--panel2); }

/* per-turn trackers on rows */
.econrow { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; margin: 2px 0 3px; font-size: 12px; }
.econ { font-size: 11px; padding: 1px 8px; border-radius: 10px; border: 1px solid #3c6b4c; background: #1d3326; color: #bfe5c9; }
.econ.used { background: transparent; border-color: var(--line); color: var(--dim); text-decoration: line-through; }
.econ:hover { border-color: var(--gold); }
.econrow .mainfo { color: var(--dim); margin-left: 4px; }
.econrow .pen { color: #f0b060; }
.form label.chk { display: grid; gap: 2px; }
.econ.mapip { border-color: var(--line); background: var(--panel2); color: var(--text); }
.econ.mapip.on { background: var(--gold); border-color: var(--gold); color: var(--onaccent); font-weight: 700; }

/* party panel */
.partyrow { display: grid; grid-template-columns: 40px 1fr auto; gap: 8px; align-items: center; padding: 6px 4px; border-bottom: 1px solid var(--line); }
.ptok { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; border: 2px solid var(--gold); background: var(--panel2); display: grid; place-items: center; color: var(--gold); font-family: var(--serif); }
.pinfo { display: grid; min-width: 0; } .pinfo small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pbtns { display: flex; gap: 4px; align-items: center; }
.pbtns .btn[disabled] { opacity: .45; cursor: not-allowed; }
a.btn { text-decoration: none; color: inherit; display: inline-block; }

/* 🎬 NPC scene controls */
.scenebar { border: 1px solid var(--gold); border-radius: 8px; padding: 8px 10px; margin-bottom: 10px; background: linear-gradient(180deg, rgba(187,153,255,.12), transparent); }
.scenebar .sbhead { display: flex; gap: 6px; align-items: center; }
.scenebar .spacer { flex: 1; }
.scenebar .sbnpcs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.scenebar .sbnpc { display: flex; gap: 8px; align-items: center; padding: 6px; border: 1px solid var(--line); border-radius: 6px; opacity: .8; }
.scenebar .sbnpc.speaking { border-color: var(--gold); opacity: 1; }
.scenebar .sbnpc img, .scenebar .noimg { width: 44px; height: 56px; object-fit: cover; object-position: top; border-radius: 4px; background: var(--panel2); display: grid; place-items: center; color: var(--dim); }
.scenebar .sbbtns { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; align-items: center; }
.portraits { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.portrait { border: 1px solid var(--line); border-radius: 6px; padding: 6px; display: flex; flex-direction: column; gap: 4px; }
.portrait img { width: 100%; height: 150px; object-fit: contain; background: var(--panel2); border-radius: 4px; }
.portrait > div { display: flex; justify-content: space-between; align-items: center; }
.trashrow { display: flex; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.trashrow .spacer { flex: 1; }
.condlist { display: grid; gap: 6px; margin-bottom: 8px; }
.condrow { display: flex; gap: 8px; align-items: center; border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; }
.condrow .spacer { flex: 1; }
.condinst { margin-top: 6px; border-top: 1px solid var(--line); padding-top: 4px; font-size: 12px; }
#condForm fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; margin: 6px 0; }
#condForm fieldset .chk { display: block; margin: 4px 0; }
#condForm fieldset select, #condForm fieldset input[type=number] { width: auto; display: inline-block; padding: 2px 4px; }
#condForm .targets { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 2px 10px; max-height: 160px; overflow: auto; }
.chip.hbc { border-style: dashed; }
#condForm [data-sel] { color: var(--gold); }
.castgrid { display: grid; grid-template-columns: 240px 1fr; gap: 14px; }
.castlist { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.castpicks { display: flex; flex-direction: column; gap: 2px; max-height: 380px; overflow: auto; }
.castpicks .pick { text-align: left; background: none; border: 1px solid transparent; color: inherit; padding: 3px 6px; border-radius: 6px; cursor: pointer; font: inherit; }
.castpicks .pick:hover, .castpicks .pick.on { border-color: var(--gold); }
.castmain fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; margin: 6px 0; }
.castmain .targets { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 2px 10px; max-height: 200px; overflow: auto; }
.castmain .dartn { width: 46px; margin-right: 4px; }
.castmain .grid3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.fxsum { background: #0002; border-radius: 8px; padding: 6px 8px; }
.spelltext { white-space: pre-wrap; max-height: 200px; overflow: auto; }
.castmain a, #modalCard [data-cts] { color: var(--gold); }
.fxed { display: grid; gap: 6px; }
.fxed .fxrow { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; }
.fxed label { flex: 1 1 150px; } .fxed .chk { flex: 0 1 auto; }
@media (max-width: 700px) { .castgrid { grid-template-columns: 1fr; } }

#toasts { bottom: 64px !important; }
.concbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 0 0 8px; padding: 10px 12px; border-radius: 10px; border: 2px solid #b48ae0; background: linear-gradient(90deg, #3b2556, #2a1f3a); box-shadow: 0 0 0 3px #b48ae033; animation: concpulse 1.6s ease-in-out infinite; }
.concbar .concicon { font-size: 26px; } .concbar .spacer { flex: 1; }
@keyframes concpulse { 50% { box-shadow: 0 0 0 6px #b48ae022; } }

/* 5e.tools-style filters */
.btn.on { border-color: var(--gold); color: var(--gold); }
.fbar { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin: 6px 0; }
.fchip { font-size: 12px; padding: 1px 7px; border-radius: 10px; cursor: pointer; user-select: none; }
.fchip.inc, .fpill.inc { background: #1e3550; color: #cfe3fb; border-color: var(--blue); }
.fchip.exc, .fpill.exc { background: #4a1f22; color: #f6c9c9; border-color: var(--red); text-decoration: line-through; }
.fpanel { border: 1px solid var(--line, #333); border-radius: 6px; padding: 6px 8px; margin: 4px 0 8px; display: grid; gap: 6px; }
.fhead { display: flex; gap: 4px; align-items: center; } .fhead b { min-width: 90px; color: var(--gold); font-size: 13px; }
.fpills { display: flex; flex-wrap: wrap; gap: 4px; }
.fpill { font-size: 12px; padding: 2px 8px; border: 1px solid var(--line, #444); border-radius: 10px; cursor: pointer; user-select: none; }
.fpill small { opacity: .6; } .fpill:hover { border-color: var(--gold); }
.seg { display: flex; gap: 2px; }
/* Daggerheart SRD picker + environment panel */
.dhres { max-height: 55vh; overflow: auto; }
.dhrow .nm small { display: block; }
.dhprev { margin: 0 0 10px 12px; border-left: 2px solid var(--gold); padding-left: 8px; }
.envbar { border: 1px solid #3c5a3a; background: #1a241a; border-radius: 6px; padding: 6px 10px; margin: 0 0 8px; }
.envhead { display: flex; align-items: center; gap: 6px; } .envhead .spacer { flex: 1; }
.envsb .entry { margin: 4px 0; }
.envsb .chip { cursor: pointer; }
/* campaign settings: D&D edition exceptions */
.exbox { border: 1px solid var(--line, #333); border-radius: 6px; padding: 8px; margin: 6px 0 10px; display: grid; gap: 6px; }
#exList { display: flex; flex-wrap: wrap; gap: 4px; }
#exList .chip.allow { border-color: #3c7a46; } #exList .chip.block { border-color: var(--red); }
.exres { max-height: 220px; overflow: auto; } .exrow { display: flex; align-items: center; gap: 6px; padding: 2px 0; border-bottom: 1px solid #ffffff10; } .exrow .spacer { flex: 1; }
/* a PC's player, under its name in the fight list */
.pcplayer { font-size: 12px; color: var(--dim); padding: 0 4px; white-space: nowrap; }
.nameline input.name.fit { flex: 0 1 auto; field-sizing: content; min-width: 4ch; max-width: 60%; }
.nameline input.pcplayer { field-sizing: content; min-width: 8ch; max-width: 30%; }
.nameline .namegap { flex: 1; }
input.pcplayer { background: transparent; border: 1px solid transparent; }
input.pcplayer:hover, input.pcplayer:focus { border-color: var(--line); }
.pcline { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.pcline .btn.small { padding: 1px 6px; font-size: 11px; }
/* the row's token picture, above its initiative */
.rowpic { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; background: var(--panel2); border: 2px solid var(--line); display: grid; place-items: center; font-weight: 700; color: var(--dim); font-size: 18px; }
.row.pc .rowpic { border-color: var(--blue); } .row.enemy .rowpic { border-color: var(--red); } .row.ally .rowpic { border-color: var(--green); }
.row.current .rowpic { border-color: var(--gold); }
.rowpic.none { opacity: .7; }
/* action economy and conditions on one line */
.chipline { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-top: 2px; }
.chipline .econrow, .chipline .chips { display: contents; }
.menu-list { max-width: calc(100vw - 12px); max-height: calc(100vh - 80px); overflow-y: auto; }
/* narrow fight list (Owlbear's panel, or a side panel open): measured on the list itself, not the window */
.list.narrow .row { grid-template-columns: 16px 52px 1fr; gap: 6px; padding: 6px 8px 6px 4px; }
.list.narrow .init input { width: 48px; font-size: 16px; }
.list.narrow .nameline input.name { font-size: 14px; }
.list.narrow textarea.notes { min-height: 24px; padding: 2px 4px; }
.list.narrow .row .namebox { grid-column: 3 / -1; }
.namebox { min-width: 0; }
.nameline { flex-wrap: wrap; }
/* narrow: chips on the left, HP/AC on the right of the same line */
.bottomline { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; justify-content: space-between; margin-top: 2px; }
.bottomline .chipline { flex: 1 1 200px; margin-top: 0; }
.bottomline .fields { gap: 8px; align-items: center; justify-content: flex-end; }
.bottomline .field { display: flex; align-items: center; gap: 4px; }
.bottomline .field > label { font-size: 10px; margin: 0; }
.bottomline .field.hp { position: relative; padding-bottom: 5px; }
.bottomline .field.hp .bar { position: absolute; left: 22px; right: 0; bottom: 0; height: 3px; margin: 0; width: auto; }

/* tables inside glossary entries (e.g. the list of actions under "Action") */
.gl-table { border-collapse: collapse; margin: 6px 0; white-space: normal; }
.gl-table td, .gl-table th { border: 1px solid var(--line); padding: 3px 10px; }
.gl-table th { color: var(--gold); text-align: left; }
.side.dropping { outline: 2px dashed var(--accent); outline-offset: -6px; }
/* 🎯 click-and-aim */
.aimbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 0 0 8px; padding: 10px 12px; border-radius: 10px; border: 2px solid #e0574a; background: linear-gradient(90deg, #4a1f1c, #2a1d1d); box-shadow: 0 0 0 3px #e0574a33; }
.aimbar .aimicon { font-size: 26px; } .aimbar .spacer { flex: 1; } .aimbar kbd { font-size: 11px; }
body.aiming #list li.row { cursor: crosshair; }
body.aiming #list li.row * { cursor: crosshair !important; }
body.aiming #list li.row:hover { box-shadow: 0 0 0 2px #e0574a88 inset; }
#list li.row.aimed { box-shadow: 0 0 0 3px #e0574a inset; background: linear-gradient(90deg, #e0574a2a, transparent 60%); }
#list li.row.aimed .name { color: #ffb3a8; }
#list li.row.aimself { opacity: .55; }
/* drag an ability onto a creature */
.sb .abil-drag { cursor: pointer; border-bottom: 1px dashed #e0574a88; }
.sb .abil-drag:active { cursor: grabbing; }
.sb .abil-drag:hover { color: #ffb3a8; }
body.abildragging #list li.row { outline: 1px dashed #e0574a55; outline-offset: -2px; }
#list li.row.dropaim { box-shadow: 0 0 0 3px #e0574a inset; background: linear-gradient(90deg, #e0574a33, transparent 60%); }
.rowpic.placeable { cursor: grab; } .rowpic.placeable:hover { box-shadow: 0 0 0 2px var(--gold); }
/* neutral side */
.row.neutral { border-left-color: #c9a227; }
.prow.neutral { border-left-color: #c9a227; }
.row.neutral .rowpic { border-color: #c9a227; }
.handlecol { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.handlecol .initroll { font-size: 15px; padding: 2px 0; width: 22px; line-height: 1; opacity: .75; }
.handlecol .initroll:hover { opacity: 1; transform: rotate(-12deg); }

/* a PC's own rolls: type the number or 🎲 fill it in */
.pcroll, .pcdmg { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; margin: 8px 0; }
.pcroll label, .pcdmg label { display: flex; flex-direction: column; font-size: 12px; color: var(--dim); }
.pcroll input, .pcdmg input { width: 7em; font-size: 18px; padding: 4px 6px; }
.pcac { margin: 8px 0; padding: 6px 10px; border: 1px solid var(--line, #333); border-radius: 6px; }
.pcac legend { font-size: 12px; color: var(--dim); padding: 0 4px; }
.pcac > div, .pcac > label { margin: 4px 0; }
.pcac .chk { margin-right: 8px; white-space: nowrap; }
#pcAcNow { font-size: 16px; }

/* Check / Edit stat block: ability scores */
.pvabil { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; margin: 10px 0; padding: 6px 10px; border: 1px solid var(--line, #333); border-radius: 6px; }
.pvabil legend { font-size: 12px; color: var(--dim); padding: 0 4px; }
.pvabil legend .warn { color: #e0a040; font-weight: 600; }
.pvabil label { display: flex; flex-direction: column; gap: 2px; font-size: 11px; font-weight: 700; letter-spacing: .05em; color: var(--dim); }
.pvabil input { width: 100%; font-size: 14px; padding: 3px 5px; }

/* ☰ names only (held) */
#namesHold.on { background: var(--gold); color: var(--onaccent); }
body.namesonly #list { display: block; column-width: 170px; column-gap: 6px; }
body.namesonly #list li.row { display: block; break-inside: avoid; padding: 2px 6px; margin: 0 0 3px; min-height: 0; border-left-width: 4px; }
body.namesonly #list li.row > :not(.namebox) { display: none !important; }
body.namesonly #list li.row .namebox > :not(.nameline) { display: none !important; }
body.namesonly #list li.row .nameline > :not(input.name):not(.lairname) { display: none !important; }
body.namesonly #list li.row input.name, body.namesonly #list li.row .lairname { pointer-events: none; width: 100%; padding: 1px 2px; font-size: 13px; border: 0; background: transparent; }
body.namesonly #list li.row.companion { margin-left: 12px; }
body.namesonly #list li.row.companion input.name::before { content: '↳'; }
body.namesonly #aimBar, body.namesonly #concBar { display: block; }
#list li.row.flash { animation: rowflash 1.2s ease-out; }
@keyframes rowflash { 0%, 40% { box-shadow: 0 0 0 3px var(--gold) inset; } 100% { box-shadow: none; } }

/* 🐾 companions */
.row.companion { margin-left: 26px; border-left-style: dashed; padding-top: 5px; padding-bottom: 5px; }
.row.companion.cocurrent { background: var(--cur); border-color: var(--gold); }
.row .cotag { display: inline-block; font-size: 20px; color: var(--gold); padding: 4px 0 0 6px; }
.badge.cobadge { background: #3b3466; color: var(--gold); }
.prow.pco { margin-left: 18px; font-size: .92em; }
.coform > label { display: block; margin: 6px 0; }
.coform > label > select, .coform > label > input, .coform > label > textarea { display: block; width: 100%; margin-top: 2px; }
.coform label.cokeep { display: flex; gap: 6px; align-items: baseline; }
.coform label.cokeep input { width: auto; display: inline; margin: 0; }
.coform .grid3 input { width: 100%; }
.coform label.coconc { display: flex; gap: 6px; align-items: center; }
.coform label.coconc input { width: auto; display: inline; margin: 0; }
.coform .grid3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.coform .grid3 label { display: block; }
/* the roll bar (▲ADV ▼DIS Private Log) floats at the bottom: leave room so a dialog's last buttons can scroll above it */
.modal { padding-bottom: 84px; }
#obrBoot { position: fixed; inset: 0; display: grid; place-content: center; text-align: center; gap: 6px; background: var(--bg); color: var(--fg, #ddd); z-index: 100; font-size: 15px; }
#obrBoot .obrf5 { font-size: 18px; margin: 10px 0 0; }
#obrBoot kbd { border: 1px solid var(--line); border-bottom-width: 3px; border-radius: 5px; padding: 1px 7px; font: inherit; background: var(--panel); }
/* saves screen: one row per creature, marked as it's rolled */
.saverows .saverow { flex-wrap: wrap; gap: 6px; align-items: center; border-left: 3px solid transparent; padding-left: 6px; }
.saverows .saverow.ok { border-left-color: var(--good, #3a9d5d); }
.saverows .saverow.bad { border-left-color: var(--bad, #c0453a); }
.saverows .savemod { width: 3.2em; text-align: center; }
/* 📁 library folders */
.folderbar { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin: 6px 0; }
.fchip { border: 1px solid var(--line); background: var(--panel2); color: inherit; border-radius: 999px; padding: 2px 9px; font-size: 12px; cursor: pointer; }
.fchip small { color: var(--dim); margin-left: 2px; }
.fchip.on { border-color: var(--gold); color: var(--gold); }
.fchip.ghost { background: transparent; border-style: dashed; }
.fchip.dropaim { outline: 2px dashed var(--gold); background: var(--cur); }
body.libdragging [data-fdrop] { border-style: dashed; border-color: var(--gold); }
.pill.fpill { font-size: 10px; }
.pill.fpill { white-space: nowrap; }
.npcchk { display: flex; gap: 8px; align-items: center; margin: 6px 0; }
.npcchk input { width: auto; margin: 0; }
.npcchk label { margin: 0; display: inline; }
/* 📦 content packs */
.pktable { border-collapse: collapse; width: 100%; font-size: 13px; }
.pktable td { padding: 4px 8px; border-bottom: 1px solid var(--line); }
.pktable td:last-child { text-align: right; }
/* 💾 storage used */
.usageline { font-size: 11px; color: var(--dim); padding: 6px 10px 4px; border-top: 1px solid var(--line); margin-top: 4px; max-width: 280px; line-height: 1.5; }
.usageline:empty { display: none; }
.usageline b, #pkUsage b { color: var(--text, inherit); }
.usewarn { color: var(--red, #e66); }
/* 📖 bestiary browser */
.modal-card.bstwide { width: min(1180px, 100%); }
.bstbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.bstbar input[type=search] { flex: 1; min-width: 240px; }
.bstchips { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin: 3px 0; }
.bstchips > .small { width: 34px; }
.bstgrid { display: grid; grid-template-columns: minmax(240px, 0.9fr) minmax(300px, 1.3fr); gap: 12px; margin-top: 6px; }
@media (max-width: 760px) { .bstgrid { grid-template-columns: 1fr; } }
.bstgrid > * { min-width: 0; }
.bstlist, .bstprev { max-height: 58vh; overflow: auto; border: 1px solid var(--line); border-radius: 6px; padding: 4px; }
.bstprev { padding: 8px 12px; }
.bstgroup { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--gold); padding: 8px 6px 2px; position: sticky; top: 0; background: var(--panel); }
.bstitem { padding: 3px 8px; border-radius: 4px; cursor: pointer; display: flex; flex-direction: column; }
.bstitem small { color: var(--dim); font-size: 11px; }
.bstitem:hover { background: var(--panel2); }
.bstitem.on { background: rgba(187,153,255,.18); outline: 1px solid var(--gold); }
.bstprevhead { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; position: sticky; top: -8px; background: var(--panel); padding: 4px 0; }
#bstRe { color: var(--gold); }
/* ---- compact initiative rows (1.60): less padding, notes on the name line, picture beside the initiative,
   HP/AC labels turned sideways beside their boxes */
.list { gap: 4px; }
.row { grid-template-columns: 20px auto minmax(220px, 1fr) auto; gap: 6px; align-items: center; padding: 3px 8px 3px 4px; }
.handlecol { gap: 1px; }
.handlecol .initroll { font-size: 13px; padding: 0; }
.init { display: flex; align-items: center; gap: 4px; }
.init .tb { display: none; }
.init .tb[style] { display: inline; } /* tie-break info stays */
.init input { width: 42px; font-size: 16px; padding: 2px 1px; }
.rowpic { width: 30px; height: 30px; font-size: 13px; border-width: 2px; }
.namebox { gap: 1px; }
.nameline { gap: 4px; }
.nameline input.name { flex: 0 1 auto; field-sizing: content; min-width: 4ch; max-width: 55%; padding: 1px 4px; font-size: 14px; }
.nameline .icon { padding: 1px 3px; font-size: 13px; }
.nameline .badge { padding: 0 5px; font-size: 10px; }
textarea.notes.inl { flex: 1 1 80px; min-width: 60px; min-height: 22px; height: 22px; padding: 1px 6px; font-size: 12px; resize: none; background: transparent; border-color: transparent; }
textarea.notes.inl:hover { border-color: var(--line); }
textarea.notes.inl:focus { background: var(--panel2); border-color: var(--gold); min-height: 44px; }
.chipline { margin-top: 0; gap: 3px; }
.chips { gap: 3px; }
.chip, .econ { padding-top: 0; padding-bottom: 0; }
.fields { gap: 6px; align-items: center; }
.field { display: flex; align-items: center; gap: 2px; }
.field label { writing-mode: vertical-rl; transform: rotate(180deg); font-size: 9px; letter-spacing: .04em; line-height: 1; max-height: 44px; overflow: hidden; }
.field.hp { display: grid; grid-template-columns: auto auto; column-gap: 2px; align-items: center; }
.field.hp label { grid-row: 1 / span 2; }
.field.hp .bar { grid-column: 2; margin-top: 1px; }
.field input.num { width: 44px; padding: 2px 2px; }
.field .vals input.temp { width: 36px; padding: 2px; }
.rowmenu > button { padding: 0 4px; }
.controls { gap: 6px; margin-bottom: 6px; padding: 4px 0; }
.controls .btn { padding: 4px 9px; }
.chips.spellslots { margin-top: 1px; }
.row.companion { padding-top: 2px; padding-bottom: 2px; }
.controls .btn { padding: 3px 8px; font-size: 13px; }
.controls { row-gap: 4px; }
.side-tabs button { padding: 6px 9px; white-space: nowrap; font-size: 13px; }
.side-tabs { overflow-x: auto; scrollbar-width: none; }
.rowpic { flex-shrink: 0; }
@media (max-width: 640px) {
  .nameline input.name { max-width: 100%; }
  .rowpic { width: 26px; height: 26px; font-size: 12px; }
  .init input { width: 36px; font-size: 15px; }
  .row { gap: 4px; padding-right: 6px; }
}
textarea.notes.inl:placeholder-shown:not(:focus) { white-space: nowrap; height: 22px !important; overflow: hidden; flex: 1 1 90px; min-width: 90px; }
@media (max-width: 640px) {
  .row { grid-template-columns: 18px auto minmax(0, 1fr) auto; }
}
.init input { flex: 0 0 auto; min-width: 36px; }
.init { min-width: max-content; }
.list.narrow .row { grid-template-columns: 16px auto minmax(0, 1fr); gap: 4px; padding: 3px 6px 3px 4px; }
.list.narrow .init input { width: 38px; font-size: 15px; }
.list.narrow .rowpic { width: 26px; height: 26px; font-size: 12px; }
.list.narrow .nameline input.name { max-width: 100%; }
.list.narrow textarea.notes.inl { min-height: 22px; }
.list.narrow textarea.notes.inl:placeholder-shown:not(:focus) { flex: 1 1 80px; min-width: 80px; }
.controls { gap: 5px; }
.controls label.chk, .controls label.small { font-size: 12px; }
.controls .btn { padding: 3px 7px; }
.round { gap: 2px; padding: 1px 3px; }
.round span { font-size: 15px; padding: 0 3px; }
.round .btn, .round button { padding: 2px 6px; }
.controls .spacer { min-width: 0; }
.controls .btn { font-size: 12.5px; padding: 3px 6px; }
/* ✨ summons */
.smlist { max-height: 30vh; overflow: auto; display: flex; flex-direction: column; gap: 2px; border: 1px solid var(--line); border-radius: 6px; padding: 4px; }
.smlist .pick { text-align: left; background: none; border: 1px solid transparent; border-radius: 4px; padding: 3px 6px; color: inherit; }
.smlist .pick:hover { border-color: var(--line); background: var(--panel2); }
.smsel { padding: 6px 8px; border: 1px solid var(--gold); border-radius: 6px; }
/* ± temporary changes */
.fxbox { border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; margin: 6px 0; }
.fxbox summary { cursor: pointer; }
.fxquick { margin: 6px 0; }
.fxrow { display: flex; gap: 4px; } .fxrow select { width: auto; }
.chip.fxchip { border-color: #4f7fb8; background: #1c2a3b; color: #cfe2ff; }
.chip .fxsum { color: #9bbbe0; font-size: 10px; }
.aceff { margin-left: 3px; font-weight: 700; padding: 1px 5px; border-radius: 4px; font-size: 13px; }
.aceff.up { background: #1e3a2a; color: #9be3b4; } .aceff.down { background: #3a1e1e; color: #f0a0a0; }
input.num.acbase { opacity: .6; width: 36px !important; }

.scenebar .sbstat { font-size: 12px; margin: 2px 0 6px; color: var(--muted, #aaa); line-height: 1.35; }
.scenebar .sbstat.warn { color: #e0b050; }
.scenebar .sbstat .bad, .scenebar .sbstat.bad { color: #e46a5a; }

.row .icon.scenebtn.on { background: var(--gold); color: var(--onaccent); border-radius: 4px; }
.scenebar .sbbtns .icon[data-act=sceneOff] { background: transparent; color: var(--text, #ddd); border: 1px solid #555; border-radius: 4px; padding: 1px 6px; }
.scenebar .sbbtns .icon[data-act=sceneOff]:hover { color: #ff8a80; border-color: #ff8a80; }

.verdict { margin: 8px 0 4px; padding: 6px 10px; border-radius: 6px; font-weight: 600; background: rgba(255,255,255,.04); color: var(--muted, #aaa); border: 1px solid rgba(255,255,255,.08); }
.verdict.hit { color: #8fdc8f; border-color: #3f7a3f; background: rgba(80,160,80,.12); }
.verdict.crit { color: #ffd36b; border-color: #a8842c; background: rgba(187,153,255,.16); }
.verdict.miss { color: #ff8a80; border-color: #8a3a35; background: rgba(200,80,70,.12); }
.pcdmgbox { margin-top: 6px; transition: opacity .15s; }
.pcdmgbox.off { opacity: .45; }

/* Daggerheart rows: five aligned columns, labels on top */
.fields.dhf { display: grid; grid-template-columns: 150px 112px 112px 62px 78px auto; gap: 10px; align-items: start; justify-content: end; }
.fields.dhf .dhcol { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; min-width: 0; }
.fields.dhf .dhcol > label { writing-mode: horizontal-tb; transform: none; max-height: none; font-size: 10px; letter-spacing: .05em; text-transform: uppercase; color: var(--dim); white-space: nowrap; }
.fields.dhf .dhcount { color: var(--text); letter-spacing: 0; text-transform: none; cursor: pointer; margin-left: 3px; }
.fields.dhf .slots { justify-content: flex-start; max-width: none; }
.fields.dhf .dhhp input.dmg { width: 100%; max-width: 150px; box-sizing: border-box; font-size: 12px; }
.fields.dhf .dhnum input, .fields.dhf .dhthr input { width: 100%; box-sizing: border-box; text-align: center; }
.fields.dhf .dhval { font-size: 15px; padding: 3px 0; display: block; width: 100%; text-align: center; }
.slot.hope { border-color: #d4a24c; } .slot.hope.on { background: #d4a24c; }
.dhacted { font: inherit; font-size: 12px; padding: 1px 9px; border-radius: 10px; border: 1px dashed var(--line); background: transparent; color: var(--dim); cursor: pointer; }
.dhacted:hover { color: var(--text); border-color: var(--dim); }
.dhacted.on { border-style: solid; background: rgba(80,160,80,.2); border-color: #3f7a3f; color: #8fdc8f; }
.row:has(.dhacted.on) .namebox .name { opacity: .65; }
.row.acted-dim .namebox .name { opacity: .7; }

#list .grouphead { list-style: none; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); margin: 8px 2px 2px; border-bottom: 1px solid var(--line); padding-bottom: 2px; }
#list .grouphead:first-child { margin-top: 0; }
/* 🎬 bar: narrator / background row, Owlbear key legend */
.scenebar .sbrow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 6px 0 2px; }
.scenebar .sbrow label { display: inline-flex; align-items: center; gap: 4px; }
.scenebar .sbkeys { margin: 2px 0 4px; }
.scenebar .sbkeys kbd, .bglist kbd { font: 11px system-ui, sans-serif; border: 1px solid var(--line, #555); border-radius: 3px; padding: 0 4px; }
.bglist { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.bgitem { display: flex; flex-direction: column; gap: 4px; padding: 6px; border: 1px solid var(--line, #444); border-radius: 8px; }
.bgitem.on { border-color: var(--gold); }
.bgitem img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 4px; background: #000; }
.bgitem > div { display: flex; justify-content: space-between; align-items: center; }
#bgDiag { margin: 8px 12px; padding: 6px 8px; border: 1px dashed #a5532b; border-radius: 6px; color: #e0a07a; }
/* 📚 library tabs: this campaign / General */
.libtabs { display: flex; gap: 4px; margin: 2px 0 8px; border-bottom: 1px solid var(--line); }
.libtab { background: transparent; border: 1px solid transparent; border-bottom: 0; border-radius: 6px 6px 0 0; padding: 5px 12px; color: var(--dim); cursor: pointer; margin-bottom: -1px; }
.libtab small { color: var(--dim); margin-left: 3px; }
.libtab:hover { color: var(--text); }
.libtab.on { color: var(--gold2); background: var(--panel2); border-color: var(--line); border-bottom: 1px solid var(--panel2); font-weight: 600; }
.libselbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 6px 8px; margin: 0 0 8px; background: var(--panel2); border: 1px solid var(--gold); border-radius: 6px; }
.lib-item.picked { border-color: var(--gold); background: #332d55; }
.lib-item .libpick { width: 16px; height: 16px; flex: none; cursor: pointer; }
/* 💾 saved companions in the 🐾 dialog */
.cosaved { margin: 0 0 10px; }
.cochips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.cochip { display: inline-flex; gap: 2px; align-items: center; border: 1px solid var(--line, #444); border-radius: 8px; padding: 2px; }
.cochip.on { border-color: var(--accent); }
/* 🙋 players' requests for 2014 options */
.reqbadge { background: #f0b060; color: #1a1205; border-radius: 8px; padding: 0 6px; font-size: 11px; font-weight: bold; margin-left: 4px; }
.exreq { border: 1px solid #f0b060; border-radius: 8px; padding: 6px 8px; margin: 6px 0; }
.exreq .exrow { display: flex; gap: 6px; align-items: center; margin: 4px 0; }
/* 🚶 marching order */
.marchlist { list-style: none; padding: 0; margin: 8px 0; }
.marchlist li { display: flex; align-items: center; gap: 6px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; margin: 4px 0; }
.marchlist img { width: 28px; height: 28px; object-fit: contain; }
.marchlist .mnum { width: 1.4em; text-align: right; color: var(--muted, #999); }
.marchlist .mname { flex: 1; }
/* 🏃 movement this turn (Owlbear) */
.chip.movechip { background: #1e2a3a; border-color: #3d5a80; cursor: pointer; white-space: nowrap; }
.chip.movechip.over { background: #5a1a1a; border-color: #b03a3a; color: #ffd6d6; }
/* 🔣 markers */
.nameline .cbmark { align-self: center; }
/* ✋ Prepare */
.controls .prepchk.on { color: var(--accent, #c9a3ff); font-weight: 600; }
.preplist { display: grid; gap: 4px; }
.prepitem { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 6px; border: 1px solid transparent; }
.prepitem:hover { border-color: var(--line); background: var(--panel2); }
.prepitem.on { border-color: var(--line); background: var(--panel2); }
.prepitem img, .prepitem .noimg { width: 32px; height: 32px; object-fit: contain; flex: none; border-radius: 50%; }
.prepitem .noimg { display: grid; place-items: center; background: var(--panel2); }
.prepitem .nm { flex: 1; min-width: 0; display: flex; flex-direction: column; color: inherit; text-decoration: none; }
.prepitem .nm small { color: var(--muted); }

/* ==== 1.78 Owlbear-native look ====
   Surfaces, shapes and type follow Owlbear's own panels: navy layers, pill buttons, round chips,
   lilac for "this one / do this", Roboto everywhere. Everything below only restyles; nothing is hidden for good. */
html, body { font-family: var(--sans); -webkit-font-smoothing: antialiased; }
h1, h2, h3, .brand, .login-card h1, .modal-card h2, .empty h2, .sb h2, .sb h3, .round span, .player .round-label { font-family: var(--sans); font-weight: 500; }
.brand { color: var(--text); font-weight: 700; font-size: 17px; letter-spacing: 0; }
.login-card h1 { color: var(--text); font-weight: 700; }
.login-card { border-radius: 16px; border-color: transparent; box-shadow: 0 12px 40px #0008; }

/* buttons: pills, filled on hover like Owlbear's */
.btn { border-radius: 20px; border-color: transparent; background: var(--panel2); padding: 5px 12px; transition: background-color .12s; }
.btn:hover { border-color: transparent; background: #3a3f5c; }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: #ffffff14; }
.btn.primary { background: var(--gold); color: var(--onaccent); border-color: transparent; font-weight: 700; }
.btn.primary:hover { background: var(--gold2); }
.btn.danger { background: transparent; border-color: #ff7a7a55; color: #ffb0b0; }
.btn.danger:hover { background: #ff7a7a22; }
.btn.on { border-color: transparent; background: #4a3f80; color: var(--text); }
input, select, textarea { border-radius: 8px; border-color: transparent; background: var(--panel2); }
input:hover, select:hover, textarea:hover { border-color: var(--line); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold); outline-offset: -1px; border-color: transparent; }
select { padding-right: 22px; }

/* keyboard focus you can see, everywhere */
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
button:focus:not(:focus-visible) { outline: none; }

/* top bar */
.topbar { background: var(--panel); border-bottom: 0; box-shadow: 0 1px 0 #00000040; }
#campaignSelect { background: transparent; font-weight: 500; font-size: 15px; }
#campaignSelect:hover { background: var(--panel2); }
.menu-list { background: var(--panel); border-color: var(--line); border-radius: 12px; padding: 6px; box-shadow: 0 12px 36px #000a; }
.menu-list button, .menu-list a.menulink { border-radius: 8px; }
.menu-list button:hover, .menu-list a.menulink:hover { background: #ffffff12; }
.gmres .res { border-color: transparent; }
.banner { background: #3b3466; color: var(--text); }

/* side panel: tabs underlined in lilac */
.side { background: var(--panel); border-left-color: #00000040; }
.side-tabs { border-bottom-color: var(--line); gap: 0; }
.side-tabs button { border-radius: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.side-tabs button.on { background: none; color: var(--text); border-bottom-color: var(--gold); }
.side-tabs button:hover:not(.on) { color: var(--text); }
.side-close .sideback { display: none; }

/* turn controls */
.controls { background: var(--bg); }
.round { background: var(--panel2); border: 0; border-radius: 20px; padding: 2px 4px; }
.round span { font-size: 14px; color: var(--dim); }
.round span b { color: var(--text); font-size: 17px; }
.round .btn, .round button { border-radius: 50%; width: 26px; height: 26px; padding: 0; display: grid; place-items: center; }
.controls .turnbtn.primary { padding: 5px 18px; font-size: 14px; }
.controls label.chk { display: inline-flex; align-items: center; gap: 4px; }
.controls .prepchk { border-radius: 20px; padding: 3px 10px 3px 6px; background: transparent; }
.controls .prepchk.on { background: #4a3f80; color: var(--text); }
.fightmenu .menu-list { right: 0; left: auto; min-width: 240px; }
.fightmenu .menu-list label.chk { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.fightmenu .menu-list label.chk:hover { background: #ffffff12; }
.fightmenu .menu-list hr { border: 0; border-top: 1px solid var(--line); margin: 4px 2px; width: auto; }
.fightmenu .menu-list .danger { color: #ffb0b0; }
.fightmenu .menu-list .mnote { font-size: 12px; color: var(--dim); padding: 2px 10px 6px; }

/* rows: rounded cards, the side shown on the left edge and on the picture ring */
.row { background: var(--row); border: 0; border-left: 3px solid var(--line); border-radius: 12px; }
.row.pc { border-left-color: var(--blue); } .row.enemy { border-left-color: var(--red); } .row.ally { border-left-color: var(--green); }
.row.current { background: var(--cur); box-shadow: inset 0 0 0 2px var(--gold); border-left-color: var(--gold); }
.row.selected { box-shadow: inset 0 0 0 2px var(--blue); }
.row.current.selected { box-shadow: inset 0 0 0 2px var(--gold), inset 0 0 0 4px var(--blue); }
.row.current .rowpic { border-color: var(--gold); }
.row.down .nameline input.name { text-decoration: line-through; }
.row.companion { border-left-style: dashed; }
.init input { border-radius: 50%; aspect-ratio: 1; width: 36px; height: 36px; padding: 0; background: #1a1d2d; font-weight: 700; }
.row.current .init input { background: var(--gold); color: var(--onaccent); }
.list.narrow .init input { width: 32px; height: 32px; }
.nameline input.name { font-weight: 500; font-size: 15px; }
.nameline input.name:hover { border-color: transparent; background: #ffffff0d; }
.nameline .icon { border-radius: 50%; width: 26px; height: 26px; padding: 0; display: inline-grid; place-items: center; }
.nameline .icon:hover { color: var(--text); background: #ffffff14; }
/* rarely needed row buttons (find token, scene, make it their turn, undo this one) show on hover, on the current row,
   and always on touch screens */
/* (1.80: row buttons always show, so nothing moves under the mouse) */
.badge { text-transform: none; letter-spacing: 0; font-size: 11px; border-radius: 10px; padding: 0 7px; border: 0; background: #1a1d2d; }
.nameline .badge { font-size: 11px; padding: 0 7px; }
.badge.wc { background: #4a3f80; color: var(--text); }
.chip { border-radius: 10px; }
.chip.use { background: #22344a; border-color: #34506e; }
.chip.add { border: 1px dashed var(--line); background: none; }
.econ { border: 0; background: #1a1d2d; color: #d3d6ea; border-radius: 10px; padding: 0 9px; }
.econ:hover { background: #3a3f5c; }
.econ.used { background: transparent; color: #6b7094; box-shadow: inset 0 0 0 1px var(--line); }
.econ.mapip.on { background: var(--gold); color: var(--onaccent); }
textarea.notes { color: #d3d6ea; }

/* labels beside their boxes now read normally, left to right */
.field label { writing-mode: horizontal-tb; transform: none; max-height: none; font-size: 11px; letter-spacing: 0; text-transform: none; color: var(--dim); white-space: nowrap; }
.field.hp { grid-template-columns: auto auto; column-gap: 5px; }
.field.hp.bloodied label { color: var(--red); }
.field input.num { background: #1a1d2d; font-weight: 700; }
.field .vals input.max { background: transparent; color: var(--dim); }
.field .vals input.temp { background: transparent; box-shadow: inset 0 0 0 1px var(--line); color: var(--blue); width: 44px; }
.field .vals input.temp::placeholder { color: #6b7094; font-size: 11px; }
.hp .bar { background: #1a1d2d; border-radius: 3px; }
.hp .bar i { background: var(--green); } .hp .bar i.mid { background: #ffc76b; } .hp .bar i.low { background: var(--red); }
.rowmenu > button { border-radius: 50%; width: 26px; height: 26px; padding: 0; }
.rowmenu > button:hover { background: #ffffff14; color: var(--text); }
#list .grouphead { text-transform: none; letter-spacing: 0; font-size: 12px; font-weight: 500; border-bottom: 0; }
.empty { border: 0; background: var(--row); border-radius: 16px; }
.empty h2 { color: var(--text); }

/* stat block, glossary, dialogs */
.sb h2 { color: var(--text); font-weight: 700; font-size: 21px; }
.sb h3 { color: var(--gold2); font-weight: 500; font-size: 15px; border-bottom-color: var(--line); }
.sb .abil thead th, .sb .abil tbody th, .bstgroup { text-transform: none; letter-spacing: 0; }
.sb .abil tbody th { color: var(--gold2); font-size: 11.5px; }
.sb .abil table { border-radius: 8px; }
.roll { color: var(--blue); }
.modal { background: #0b0d18b3; }
.modal-card { border-radius: 16px; border-color: transparent; background: var(--panel); box-shadow: 0 20px 60px #000c; }
.modal-card h2 { color: var(--text); font-weight: 500; }
.tabs button.on { border-bottom-color: var(--gold); }
.tip { background: #1a1d2d; border-color: var(--line); border-radius: 12px; }
.toast { background: #1a1d2d; border-color: transparent; border-left-color: var(--gold); border-radius: 12px; }
.lib-item { border-radius: 10px; }
.lib-item:hover { border-color: transparent; background: var(--panel2); }
.libtab { border-radius: 10px 10px 0 0; }
.libtab.on { color: var(--text); }
.fchip, .fpill { border-radius: 999px; }
.pvabil label { letter-spacing: 0; }
.fields.dhf .dhcol > label { text-transform: none; letter-spacing: 0; font-size: 11px; }
.prow { background: var(--row); border: 0; border-left: 3px solid var(--line); border-radius: 12px; }
.prow.pc { border-left-color: var(--blue); } .prow.enemy { border-left-color: var(--red); } .prow.ally { border-left-color: var(--green); } .prow.neutral { border-left-color: #c9a227; }
.prow.current { background: var(--cur); box-shadow: inset 0 0 0 2px var(--gold); border-left-color: var(--gold); }
.phealth { border: 0; background: #1a1d2d; }

/* phones: the side panel is a full drawer with a clear way back */
@media (max-width: 520px) { .side { width: 100vw; } }
@media (max-width: 760px) {
  .side-close { order: -1; }
  .side-close .sideback { display: inline; }
  .side-tabs .side-close { margin-left: 0; margin-right: 4px; color: var(--gold); white-space: nowrap; }
}
@media (max-width: 1000px) {
  .side { box-shadow: -10px 0 40px #000c; }
}

/* motion only when wanted */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
.field.hp .bld { font-size: 10px; color: var(--red); }
/* 🎨 colour markers (1.79): a dot in the marker's colour; the same colour rings its token on the map */
.cbmark { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; margin-right: 6px; flex: none; vertical-align: middle;
  background: var(--mk); box-shadow: 0 0 0 2px #00000080; font-size: 9px; line-height: 1; }
.cbmark i { font-style: normal; font-weight: 700; color: #000; }
.cbmark.mk-dark { box-shadow: 0 0 0 2px #ffffffb0; } .cbmark.mk-dark i { color: #fff; }
.cbmark.mk-neon { box-shadow: 0 0 0 2px #00000080, 0 0 6px 1px var(--mk); }
.cbmark.mk-metal { background: radial-gradient(circle at 35% 30%, #ffffffcc 0 12%, transparent 45%), linear-gradient(135deg, var(--mk), #00000055 70%, var(--mk)); background-color: var(--mk); }
.prow .cbmark { width: 18px; height: 18px; }
.mkname { font-size: 11px; color: var(--dim); font-weight: 400; margin-right: 6px; }

/* 1.80: notes are always visible as a box on the row; the name players see (???) sits beside the name */
textarea.notes.inl { box-shadow: inset 0 0 0 1px var(--line); color: #d3d6ea; }
textarea.notes.inl::placeholder { color: #7d82a6; }
input.pubname { width: auto; min-width: 3ch; font-size: 12px; padding: 1px 6px; border-radius: 10px; background: #1a1d2d; color: #ffb0b0; box-shadow: inset 0 0 0 1px #ff7a7a55; }
input.pubname::placeholder { color: #ffb0b0; opacity: .8; }
/* 1.80: in Owlbear the side panel always sits beside the list (no drawer, no open/close buttons) */
body.obr .layout:not(.noside) { grid-template-columns: minmax(0, 1fr) clamp(300px, 40%, 440px); height: auto; }
body.obr .layout:not(.noside) .side { position: static; width: auto; box-shadow: none; border-left: 1px solid #00000040; border-top: 0; min-height: 0; }
body.obr .side-close, body.obr [data-act=obrWide] { display: none !important; }
#list li.row.flash { animation: rowflash 1.5s ease-out; }
@keyframes rowflash { 0%, 30% { box-shadow: inset 0 0 0 3px var(--gold), 0 0 18px #bb99ff88; } 100% { box-shadow: none; } }
/* 💀 death saves on a PC's row at 0 HP */
.dsline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 4px; font-size: 12px; }
.dslbl { color: var(--dim); }
.dsgrp { display: inline-flex; gap: 3px; }
.dspip { width: 20px; height: 20px; border-radius: 50%; padding: 0; border: 0; background: #1a1d2d; color: #4b5070; font-size: 11px; font-weight: 700; cursor: pointer; }
.dspip.s.on { background: var(--green); color: #10251a; }
.dspip.f.on { background: var(--red); color: #2a0f0f; }
.dsok { color: var(--green); } .dsdead { color: var(--red); }
/* 1.80: one-row top bar; words on its buttons drop away when the window is narrow (Owlbear), icons stay with tooltips */
.topbar { flex-wrap: nowrap; }
#campaignSelect { flex: 0 1 auto; min-width: 110px; max-width: 340px; text-overflow: ellipsis; }
.topbar .btn { flex: none; white-space: nowrap; }
#saveStatus { flex: none; width: 62px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 12px; color: var(--dim); }
@media (max-width: 1100px) { .topbar .tl { display: none; } .topbar .btn { padding: 4px 8px; } #saveStatus { width: 54px; } }
body.obr .topbar .tl { display: none; }
.controls { gap: 6px; }
.chip.cond .csym { margin-right: 3px; font-size: 13px; }
/* a PC down at 0 HP stays readable while its death saves are going */
.row.down:has(.dsline) { opacity: 1; }
.row.down:has(.dsline) .nameline input.name { opacity: .6; }
/* the turn bar fits on one line in Owlbear */
body.obr .controls { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
body.obr .controls > * { flex: none; }
body.obr .controls .prepchk { padding-right: 8px; }
@media (max-width: 1150px) { body.obr .controls .tl2 { display: none; } }
/* 🎨 the colour dot on a row is a button: change the colour or remove it */
.markbtn { background: none; border: 0; padding: 2px; margin: 0 2px 0 0; border-radius: 50%; cursor: pointer; display: inline-grid; place-items: center; flex: none; }
.markbtn:hover { background: #ffffff14; }
.markbtn .cbmark { margin-right: 0; }
.cbmark.mk-off { background: transparent; box-shadow: none; border: 1.5px dashed #7d82a6; }
.mktier { margin-bottom: 8px; }
.mkgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 4px; margin-top: 3px; }
.mkpick { display: flex; align-items: center; gap: 6px; background: var(--panel2); border: 0; border-radius: 10px; padding: 5px 8px; color: var(--text); cursor: pointer; font: inherit; font-size: 13px; text-align: left; }
.mkpick:hover { background: #3a3f5c; }
.mkpick.on { box-shadow: inset 0 0 0 2px var(--gold); }
.mkpick .cbmark { margin-right: 0; }
.mkpick small { margin-left: auto; color: var(--dim); }
/* ⚡ battlefield actions */
.bfaline { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 5px; padding: 5px 8px; border-radius: 10px; background: #4a2f12; box-shadow: inset 0 0 0 1px #ff9f43aa; font-size: 12.5px; }
.bfaline .bfaname { color: #ffd29a; }
.bfaline .bfatell { flex-basis: 100%; color: #f3d9bb; font-style: italic; }
.bfapick { display: grid; gap: 6px; margin: 8px 0; }
.bfaopt { display: block; background: var(--panel2); border-radius: 10px; padding: 7px 10px; cursor: pointer; }
.bfaopt:hover { background: #3a3f5c; }
.pwarn { flex-basis: 100%; margin-top: 4px; padding: 4px 8px; border-radius: 8px; background: #4a2f12; color: #ffd29a; font-size: 13px; }
.prow:has(.pwarn) { flex-wrap: wrap; }

/* 🎲 1.82: the table-dice box (above every other window) */
#diceAsk { position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center; background: #0008; }
#diceAsk.hidden { display: none; }
#diceAsk .dacard { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; width: min(380px, calc(100vw - 24px)); box-shadow: 0 12px 40px #000a; display: grid; gap: 10px; }
#diceAsk .dahead { font-size: 15px; }
#diceAsk .damath { font-size: 20px; font-weight: 700; }
#diceAsk .damode { display: flex; gap: 6px; flex-wrap: wrap; }
#diceAsk .dafaces { display: flex; gap: 8px; }
#diceAsk .daf { width: 96px; font-size: 26px; text-align: center; padding: 6px; }
#diceAsk .actions { display: flex; gap: 8px; justify-content: flex-end; }
.overwarn { color: var(--gold2); font-weight: 600; }
.qegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 12px; }
.qegrid .qewide { grid-column: 1 / -1; }
.bfaopt.on { outline: 2px solid var(--accent); }
.bfaopt .btn { margin-right: 6px; }
.cnlist { display: grid; gap: 6px; margin-top: 8px; max-height: 50vh; overflow: auto; }
.cnrow { justify-content: flex-start; text-align: left; }

/* ✨ 1.82: what the last action changed (what Undo would put back) */
#list .chg { outline: 2px solid #ffd54a; outline-offset: 1px; border-radius: 8px; box-shadow: 0 0 10px #ffd54a55; }
#list li.row.chgrow { box-shadow: inset 3px 0 0 #ffd54a; }
@media (prefers-reduced-motion: no-preference) { #list .chg { transition: outline-color .3s; } }
.pastefx { margin-bottom: 8px; }
.pastefx textarea { width: 100%; }
.pfxlines { display: grid; gap: 3px; margin: 6px 0; max-height: 180px; overflow: auto; }
.pfxlines .ok { color: var(--green); }
.pfxlines .todo { color: var(--dim); }
.qecls { border: 1px solid var(--line); border-radius: 10px; padding: 8px; }
.qcfeats details { background: var(--panel2); border-radius: 8px; padding: 6px 10px; margin: 4px 0; }

/* 💡 the little guide at the top of the homebrew form */
.hbguide { margin: 6px 0 10px; padding: 8px 10px; border-left: 3px solid #d4a24c; background: rgba(212,162,76,.1); border-radius: 0 6px 6px 0; }

/* ⚡ the second place in the order of a creature with two turns a round */
.row.echo { display: flex; align-items: center; gap: 10px; min-height: 0; padding: 4px 10px; border-left-style: dotted; opacity: .9; }
.row.echo .echoname { flex: 1; min-width: 0; }
.row.echo .init { flex: none; }
.row.echo.current { opacity: 1; }

/* ✋ hands: main and off hand on every D&D row */
.hands { display: inline-flex; gap: 4px; align-items: center; margin-left: 6px; }
.hand { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; padding: 0 7px; border-radius: 6px; border: 1px solid #4a4f66; background: #171a26; color: #9aa0b8; max-width: 130px; cursor: pointer; }
.hand.full { color: #f0e6c8; border-color: #8a7a45; background: #2a2616; }
.hand .handname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.handico { display: inline-block; font-size: 12px; line-height: 1; }
.hand.off .handico, .handico.off { transform: scaleX(-1); }
.handfloor { font-size: 11px; color: #c9a36a; }
.handgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.handcard { border: 1px solid #3a3f55; border-radius: 8px; padding: 8px 10px; }
.handcard.pick { border-color: #8a7a45; }
.handcard h3 { margin: 0 0 6px; font-size: 14px; }
.handatk input { width: 100%; box-sizing: border-box; margin-top: 4px; }
@media (max-width: 560px) { .handgrid { grid-template-columns: 1fr; } }
.handbtns { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.handbtns .btn { flex: none; white-space: nowrap; }
.handbtns .handin { flex: 1; min-width: 120px; }

/* 🖼 2.0 pictures on the stat block */
.statpics { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; margin: 6px 0 10px; padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: #0002; }
.statpics .sp-tok { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 92px; text-align: center; }
.statpics .sp-tok img, .statpics .sp-none { width: 72px; height: 72px; object-fit: contain; border-radius: 50%; background: #0003; display: grid; place-items: center; font-size: 28px; }
.statpics .sp-por { flex: 1; min-width: 160px; display: flex; gap: 6px; flex-wrap: wrap; align-items: flex-end; }
.statpics .sp-por img { height: 120px; max-width: 160px; object-fit: contain; border-radius: 6px; background: #0003; display: block; }
.statpics .sp-btns { display: flex; gap: 4px; flex-wrap: wrap; }
.statpics label.btn { cursor: pointer; }

/* 2.0: tie-break note sits under the initiative number; a drawn d20 replaces the dice emoji */
.initstack { display: flex; flex-direction: column; align-items: center; }
.init .tb.tie { display: block; font-size: 9px; line-height: 1; margin-top: 1px; color: var(--gold); white-space: nowrap; font-weight: 600; letter-spacing: .02em; }
.handlecol .initroll { width: 22px; height: 22px; padding: 0; display: grid; place-items: center; border-radius: 6px; color: var(--dim); opacity: 1; background: transparent; border: 0; box-shadow: none; transition: color .15s, background-color .15s, transform .25s; }
.handlecol .initroll .d20 { width: 18px; height: 18px; display: block; }
.handlecol .initroll:hover { color: var(--gold); background: #ffffff12; transform: rotate(-20deg); }
.handlecol .initroll:active { transform: rotate(160deg) scale(.9); }

/* 2.0.1: bigger token pictures on the rows, smaller initiative circle */
.row .rowpic { width: 46px; height: 46px; font-size: 18px; border-width: 2px; }
.list.narrow .row .rowpic { width: 40px; height: 40px; font-size: 16px; }
.init input { width: 28px; height: 28px; min-width: 0; font-size: 14px; }
.list.narrow .init input { width: 26px; height: 26px; font-size: 13px; }
.init .tb.tie { font-size: 8px; }
