/* =====================================================================
   The look: a parchment field, dark slate bars, and the deep red rule
   that runs through every frame. Built wide first — a laptop should
   not be reading a phone layout.
   ===================================================================== */
:root{
  /* these are only the starting values; Theme.apply writes over them */
  --paper:#efe9dc; --panel:#fffdf8; --ink:#1c1b18; --slate:#24211c;
  --rule:#8f2b23; --rule-soft:#b4574d; --line:#cfc6b1; --shade:#e6dfcd;
  --muted:#6d6657; --good:#3f6b3f; --gold:#b08d3f;
  --frameW:2px; --frameStyle:solid; --frameR:10px;
  --pad:1; --textScale:1; --bgImage:none; --bgFade:.14;
  --display:"Spectral","Iowan Old Style",Georgia,serif;
  --body:system-ui,-apple-system,"Segoe UI",sans-serif;
  --num:"IBM Plex Mono",ui-monospace,monospace;
  --frame:0 1px 0 rgba(0,0,0,.06),0 0 0 1px var(--line);
  --gutter:22px;
}
*{box-sizing:border-box;margin:0;padding:0;-webkit-tap-highlight-color:transparent}
/* min-height, not height: a body held to the window's height is where a
   sticky top bar stops sticking — one screen down, it scrolled away */
html{height:100%}
body{min-height:100%}
body{background:var(--paper);color:var(--ink);
  font:calc(15px * var(--textScale,1))/1.45 var(--body);
  background-image:radial-gradient(circle at 20% 10%,rgba(0,0,0,.028),transparent 55%),
    radial-gradient(circle at 85% 70%,rgba(0,0,0,.03),transparent 50%)}
button,input,select,textarea{font:inherit;color:inherit;background:none;border:none}
button{cursor:pointer}
input,select,textarea{cursor:text}
h1,h2,h3{font-family:var(--display);font-weight:600}
[hidden]{display:none!important}

/* ---------- the bar across the top ---------- */
.topbar{background:var(--slate);color:#f1ece1;padding:0 var(--gutter);
  display:flex;align-items:center;gap:16px;height:58px;position:sticky;top:0;z-index:40;
  box-shadow:0 2px 10px rgba(0,0,0,.22)}
.topbar .brand{font-family:var(--display);font-size:17px;letter-spacing:.02em;font-weight:600}
.topbar nav{display:flex;gap:2px;margin-left:12px;height:100%}
.topbar nav button{padding:0 15px;font-size:13.5px;letter-spacing:.03em;color:#bcb4a4;
  border-bottom:3px solid transparent;height:100%}
.topbar nav button[aria-current=true]{color:#fff;border-bottom-color:var(--rule-soft)}
.topbar nav button:hover{color:#fff}
.topbar nav .navgap{width:1px;align-self:center;height:22px;margin:0 9px;
  background:rgba(255,255,255,.16)}
.topbar .right{margin-left:auto;display:flex;gap:9px;align-items:center}
.chip{border:1px solid #4a443a;border-radius:6px;padding:5px 11px;font-size:12.5px;color:#ddd6c8}
.chip:hover{border-color:#6d6557}
.chip.on{background:var(--rule);border-color:var(--rule);color:#fff}

/* ---------- frames ---------- */
.frame{background:var(--panel);border:var(--frameW,2px) var(--frameStyle,solid) var(--rule);
  border-radius:var(--frameR,10px);
  position:relative;box-shadow:0 2px 5px rgba(0,0,0,.07)}
.frame > h2{font-size:11px;letter-spacing:.12em;text-transform:uppercase;color:var(--muted);
  text-align:center;padding:7px 12px 6px;border-bottom:1px solid var(--shade)}
.frame > h2 em{font-style:normal;letter-spacing:0;text-transform:none;color:var(--rule)}
.frame .foot{font-size:10px;letter-spacing:.12em;text-transform:uppercase;color:var(--muted);
  text-align:center;padding:6px;border-top:1px solid var(--shade)}
.plain{background:var(--panel);border:1px solid var(--line);border-radius:var(--frameR,9px)}

/* ---------- rows ---------- */
.row{display:flex;align-items:center;gap:9px;padding:6px 11px;border-bottom:1px solid var(--shade);
  width:100%;text-align:left}
.row:last-child{border-bottom:none}
button.row:hover,.pickrow:hover{background:var(--shade)}
.grow{flex:1;min-width:0}
.val{font-family:var(--num);font-size:14.5px;font-weight:600;min-width:36px;text-align:right}
.sub{display:block;font-size:11.5px;color:var(--muted)}
.pip{width:10px;height:10px;border-radius:50%;border:1.5px solid #9a9282;flex:none}
.pip.on{background:var(--ink);border-color:var(--ink)}
.pip.exp{background:var(--rule);border-color:var(--rule);
  box-shadow:0 0 0 2px var(--panel),0 0 0 3.5px var(--rule)}
.ab{width:32px;font-size:9.5px;letter-spacing:.06em;text-transform:uppercase;color:var(--muted)}
.tag{font-size:10px;letter-spacing:.06em;text-transform:uppercase;border:1px solid var(--line);
  border-radius:4px;padding:1px 5px;color:var(--muted)}
.note{font-size:12.5px;color:var(--muted)}

/* ---------- buttons ---------- */
.btn{border:1px solid var(--line);border-radius:8px;padding:8px 14px;font-size:13.5px;
  background:var(--panel)}
.btn:hover{border-color:var(--rule-soft)}
.btn.primary{background:var(--rule);border-color:var(--rule);color:#fff}
.btn.primary:hover{background:#a2332a}
.btn.wide{width:100%}
.btnrow{display:flex;gap:9px;flex-wrap:wrap}

/* =====================================================================
   THE HOME SCREEN
   ===================================================================== */
.page{max-width:1500px;margin:0 auto;padding:26px var(--gutter) 60px}
.pagehead{display:flex;align-items:flex-end;gap:16px;margin-bottom:22px}
.pagehead h1{font-size:27px}
.pagehead .note{padding-bottom:5px}
.pagehead .btnrow{margin-left:auto}

.cardgrid{display:grid;gap:16px;
  grid-template-columns:repeat(auto-fill,minmax(290px,1fr))}
.charcard{background:var(--panel);border:1px solid var(--line);border-radius:11px;
  overflow:hidden;text-align:left;transition:border-color .12s,transform .12s}
.charcard:hover{border-color:var(--rule-soft);transform:translateY(-1px)}
.charcard .band{background:var(--slate);color:#f1ece1;padding:13px 15px;
  display:flex;gap:12px;align-items:center}
.charcard .por{width:46px;height:46px;border-radius:8px;background:#3a352c;flex:none;
  display:grid;place-items:center;font-size:21px;overflow:hidden}
.charcard .por img{width:100%;height:100%;object-fit:cover}
.charcard .nm{font-family:var(--display);font-size:17px;font-weight:600;line-height:1.15}
.charcard .wh{font-size:12px;opacity:.72}
.charcard .stats{display:flex;padding:11px 15px;gap:18px}
.charcard .stats div{text-align:center}
.charcard .stats b{display:block;font-family:var(--num);font-size:17px;font-weight:600}
.charcard .stats span{font-size:9.5px;letter-spacing:.08em;text-transform:uppercase;color:var(--muted)}
.newcard{border:2px dashed var(--line);border-radius:11px;min-height:150px;
  display:grid;place-items:center;gap:6px;color:var(--muted);background:transparent}
.newcard:hover{border-color:var(--rule);color:var(--rule)}
.newcard b{font-family:var(--display);font-size:16px;font-weight:600}

.settinggrid{display:grid;gap:16px;grid-template-columns:repeat(auto-fit,minmax(330px,1fr))}
.check{display:flex;align-items:center;gap:10px;padding:8px 11px;width:100%;text-align:left;
  border-bottom:1px solid var(--shade)}
.check:last-child{border-bottom:none}
.check:hover{background:var(--shade)}
.box{width:20px;height:20px;border-radius:5px;border:2px solid #a49b88;flex:none;
  display:grid;place-items:center;font-size:12px;color:#fff}
.check.on .box{background:var(--rule);border-color:var(--rule)}

/* =====================================================================
   THE SHEET — laid out for a laptop first
   ===================================================================== */
#sheetTop{background:var(--slate);color:#f1ece1;padding:11px var(--gutter);
  display:flex;gap:15px;align-items:center;flex-wrap:wrap}
#sheetTop .por{width:48px;height:48px;border-radius:9px;background:#3a352c;flex:none;
  display:grid;place-items:center;font-size:22px;overflow:hidden}
#sheetTop .por img{width:100%;height:100%;object-fit:cover}
#sheetTop .nm{font-family:var(--display);font-size:20px;font-weight:600;line-height:1.1}
#sheetTop .wh{font-size:12.5px;opacity:.72}
#sheetTop .sheetactions{margin-left:auto;display:flex;gap:8px;flex-wrap:wrap;
  align-items:center;justify-content:flex-end}
/* a menu for what is done now and then, in words */
.moremenu{position:relative}
.moremenu summary{list-style:none;cursor:pointer;user-select:none}
.moremenu summary::-webkit-details-marker{display:none}
.moremenu[open] summary{background:var(--rule);border-color:var(--rule);color:#fff}
.moremenu .menu{position:absolute;right:0;top:calc(100% + 6px);z-index:30;
  background:var(--panel);color:var(--ink);border:2px solid var(--rule);
  border-radius:10px;box-shadow:0 10px 26px rgba(0,0,0,.28);
  min-width:230px;padding:5px;display:flex;flex-direction:column}
.moremenu .menu button{text-align:left;padding:9px 11px;border-radius:7px;
  font-size:13.5px}
.moremenu .menu button:hover{background:var(--shade);color:var(--rule)}
.moremenu .menu button[hidden]{display:none}

/* the ability shields */
#band{display:flex;gap:9px;padding:13px var(--gutter);flex-wrap:wrap;align-items:flex-start;
  background:linear-gradient(180deg,var(--shade),transparent)}
.shield{width:82px;background:var(--panel);border:2px solid var(--rule);
  border-radius:9px 9px 26px 26px;padding:6px 4px 5px;text-align:center;position:relative}
.shield:hover{background:#fff8f0}
.shield b{display:block;font-family:var(--num);font-size:23px;font-weight:600;line-height:1.1}
.shield span{display:block;font-size:8.5px;letter-spacing:.1em;text-transform:uppercase;
  color:var(--muted);margin-top:1px}
.shield small{display:inline-block;font-family:var(--num);font-size:11.5px;margin-top:4px;
  border:1.5px solid var(--rule);border-radius:11px;padding:1px 9px;background:var(--panel)}
.gem{min-width:92px;background:var(--panel);border:2px solid var(--rule);border-radius:9px;
  padding:7px 12px;text-align:center}
.gem b{display:block;font-family:var(--num);font-size:21px;font-weight:600;line-height:1.15}
.gem span{display:block;font-size:8.5px;letter-spacing:.1em;text-transform:uppercase;color:var(--muted)}
.gem small{display:block;font-family:var(--num);font-size:11px;color:var(--muted)}
/* Heroic inspiration is a gem like the rest, not a star tucked in a corner:
   it is the one thing on the band a player spends, so it has to be found. */
.gem.inspire{cursor:pointer;font:inherit}
.gem.inspire b{color:var(--muted)}
.gem.inspire.on{border-color:var(--gold)}
/* a tint mixed from the gold itself, so it holds up on a dark palette too;
   where color-mix is not understood the border and the letters carry it */
@supports (background:color-mix(in srgb,red 10%,transparent)){
  .gem.inspire.on{background:color-mix(in srgb,var(--gold) 13%,transparent)}
}
.gem.inspire.on b{color:var(--gold)}
.gem.inspire.on span,.gem.inspire.on small{color:var(--gold)}
.hpgem{background:var(--panel);border:2px solid var(--rule);border-radius:9px;padding:6px 13px;
  display:flex;gap:11px;align-items:center;margin-left:auto}
.hpgem .num{font-family:var(--num);font-size:22px;font-weight:600}
.hpgem .lbl{font-size:8.5px;letter-spacing:.1em;text-transform:uppercase;color:var(--muted)}
.hpbtn{border:1.5px solid var(--line);border-radius:6px;padding:4px 9px;font-size:11.5px}
.hpbtn.heal{border-color:var(--good);color:var(--good)}
.hpbtn.dmg{border-color:var(--rule);color:var(--rule)}
#hpin{width:52px;text-align:center;border:1.5px solid var(--line);border-radius:6px;padding:4px}

/* three columns, wide on a laptop */
#sheetBody{display:grid;gap:15px;padding:4px var(--gutter) 60px;
  grid-template-columns:1fr;max-width:1600px;margin:0 auto}
/* minmax(0,…) rather than 1fr: a plain 1fr will not shrink below its
   widest table, and the actions table and the row of tabs made the sheet
   1498px wide — wider than a 1280 laptop and a 1440 screen alike. */
@media(min-width:900px){#sheetBody{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}}
@media(min-width:1180px){#sheetBody{grid-template-columns:250px 285px minmax(0,1fr)}}
@media(min-width:1500px){#sheetBody{grid-template-columns:290px 330px minmax(0,1fr)}}
.col{display:flex;flex-direction:column;gap:15px;min-width:0}
/* what is still wider than its column scrolls inside it, not the page */
#pane{overflow-x:auto;min-width:0}
#pane .atktable{min-width:520px}

/* The tabs wrap onto a second line rather than scroll: a tab that has
   scrolled out of sight is a tab nobody finds. */
#panetabs{display:flex;flex-wrap:wrap;border-bottom:2px solid var(--shade)}
#panetabs button{padding:11px 16px;font-size:12.5px;letter-spacing:.05em;text-transform:uppercase;
  color:var(--muted);border-bottom:3px solid transparent;white-space:nowrap;margin-bottom:-2px}
#panetabs button[aria-selected=true]{color:var(--rule);border-bottom-color:var(--rule);font-weight:600}
#panetabs button:hover{color:var(--ink)}
.act{display:grid;grid-template-columns:1fr auto auto;gap:13px;align-items:center;
  padding:10px 13px;border-bottom:1px solid var(--shade)}
.act:last-child{border-bottom:none}
.act:hover{background:#faf7f0}
.act .n{font-weight:600}
.act .meta{font-size:11.5px;color:var(--muted)}
.roll{font-family:var(--num);font-size:15px;font-weight:600;border:1.5px solid var(--line);
  border-radius:8px;padding:6px 11px;min-width:48px;text-align:center;background:var(--panel)}
.roll:hover{border-color:var(--rule)}
.roll:active{background:var(--rule);color:#fff;border-color:var(--rule)}
.dmg{font-family:var(--num);font-size:13px;background:var(--shade);border-radius:7px;
  padding:5px 10px;white-space:nowrap}

/* =====================================================================
   THE BUILDER
   ===================================================================== */
#buildBody{display:grid;gap:22px;grid-template-columns:1fr;max-width:1400px;margin:0 auto;
  padding:22px var(--gutter) 70px}
@media(min-width:1000px){#buildBody{grid-template-columns:210px 1fr}}
.steps{display:flex;gap:4px;overflow-x:auto;padding-bottom:6px}
@media(min-width:1000px){.steps{flex-direction:column;position:sticky;top:80px;padding:0}}
.step{display:flex;gap:10px;align-items:center;padding:9px 12px;border-radius:8px;
  font-size:13.5px;color:var(--muted);white-space:nowrap;text-align:left;width:100%}
.step .no{width:22px;height:22px;border-radius:50%;border:1.5px solid var(--line);flex:none;
  display:grid;place-items:center;font-size:11px;font-family:var(--num)}
.step[aria-current=true]{background:var(--panel);color:var(--ink);font-weight:600;
  box-shadow:var(--frame)}
.step[aria-current=true] .no{background:var(--rule);border-color:var(--rule);color:#fff}
.step.done .no{background:var(--good);border-color:var(--good);color:#fff}

.pick{display:flex;gap:13px;align-items:center;padding:13px 15px;width:100%;text-align:left;
  background:var(--panel);border:1px solid var(--line);border-radius:10px;margin-bottom:9px}
.pick:hover{border-color:var(--rule-soft)}
.pick[aria-pressed=true]{border-color:var(--rule);border-width:2px;background:#fffaf6}
.pick .ico{width:44px;height:44px;border-radius:8px;background:var(--shade);flex:none;
  display:grid;place-items:center;font-size:21px}
.pick .t{font-family:var(--display);font-size:16px;font-weight:600;letter-spacing:.02em}
.pick .d{font-size:12.5px;color:var(--muted)}

/* an open decision, marked the way the players already know */
.choice{border:2px solid #6ea8dc;border-radius:9px;margin-bottom:11px;background:var(--panel);
  position:relative}
.choice.settled{border-color:var(--line);border-width:1px}
.choice > .head{display:flex;gap:11px;align-items:center;padding:12px 15px;width:100%;text-align:left}
.choice .bang{width:22px;height:22px;border-radius:50%;background:#6ea8dc;color:#fff;flex:none;
  display:grid;place-items:center;font-size:13px;font-weight:700}
.choice.settled .bang{background:var(--good)}
.choice .body{padding:0 15px 15px;border-top:1px solid var(--shade);padding-top:13px}
.reftable{width:100%;border-collapse:collapse;font-size:13.5px;margin:10px 0}
.reftable th{text-align:left;width:38%;padding:7px 10px;background:var(--shade);
  font-weight:600;border-bottom:1px solid var(--line);vertical-align:top}
.reftable td{padding:7px 10px;border-bottom:1px solid var(--shade)}
.reftable tr:nth-child(even) th{background:#ddd5c1}
select.wide,input.wide{width:100%;border:1.5px solid #6ea8dc;border-radius:8px;padding:9px 11px;
  background:var(--panel)}
select.wide:disabled{border-color:var(--line)}

/* ---------- the overlay for picking and preparing ---------- */
#overlay{position:fixed;inset:0;z-index:60;background:rgba(28,27,24,.55);
  display:grid;place-items:center;padding:20px}
#overlay[hidden]{display:none}
.sheetwrap{background:var(--panel);border:2px solid var(--rule);border-radius:12px;
  width:min(680px,100%);max-height:86vh;display:flex;flex-direction:column;
  box-shadow:0 18px 50px rgba(0,0,0,.35)}
.sheethead{display:flex;gap:13px;align-items:center;padding:14px 16px;
  border-bottom:1px solid var(--shade)}
.sheethead b{font-family:var(--display);font-size:17px}
.sheethead .note{flex:1}
.sheetbody{overflow-y:auto;padding-bottom:64px}

/* ---------- inventory ---------- */
.money{display:flex;gap:9px;padding:12px 13px;flex-wrap:wrap;border-bottom:1px solid var(--shade)}
.coin{display:flex;align-items:center;gap:6px;border:1px solid var(--line);border-radius:8px;
  padding:5px 9px}
.coin input{width:56px;text-align:right;font-family:var(--num);border:none}
.coin span{font-size:10px;letter-spacing:.09em;text-transform:uppercase;color:var(--muted)}

/* =====================================================================
   THE BATTLE MAP
   ===================================================================== */
#battle{display:grid;gap:15px;padding:15px var(--gutter) 50px;
  grid-template-columns:1fr;max-width:1700px;margin:0 auto}
@media(min-width:1100px){#battle{grid-template-columns:1fr 330px}}
@media(min-width:1500px){#battle{grid-template-columns:1fr 380px}}
#mapwrap{position:relative}
#map{position:relative;width:100%;aspect-ratio:16/10;border:2px solid var(--rule);
  border-radius:10px;background:var(--shade) center/cover no-repeat;overflow:hidden;
  touch-action:none;cursor:crosshair}
#map.empty{background-image:
  linear-gradient(rgba(0,0,0,.08) 1px,transparent 1px),
  linear-gradient(90deg,rgba(0,0,0,.08) 1px,transparent 1px);
  background-size:40px 40px}
.token{position:absolute;width:40px;height:40px;margin:-20px 0 0 -20px;border-radius:50%;
  background:var(--tc);border:2px solid var(--panel);display:grid;place-items:center;
  cursor:grab;touch-action:none;box-shadow:0 2px 6px rgba(0,0,0,.4);font-size:13px;
  font-weight:700;color:#fff;text-transform:uppercase}
.token.mine{outline:3px solid var(--gold);outline-offset:2px}
.token.acting{box-shadow:0 0 0 4px var(--gold),0 2px 6px rgba(0,0,0,.4)}
.token .hpbar{position:absolute;left:2px;right:2px;bottom:-6px;height:4px;border-radius:2px;
  background:rgba(0,0,0,.5);overflow:hidden}
.token .hpbar i{display:block;height:100%;background:var(--good)}
.token .conds{position:absolute;left:50%;top:-11px;transform:translateX(-50%);display:flex;gap:2px}
.token .conds i{font-style:normal;font-size:9px;line-height:14px;min-width:14px;text-align:center;
  background:var(--slate);color:#fff;border-radius:4px}
.order{display:flex;align-items:center;gap:9px;padding:7px 11px;border-bottom:1px solid var(--shade);
  width:100%;text-align:left}
.order.now{background:#fff5ec;border-left:3px solid var(--rule)}
.order .dot{width:11px;height:11px;border-radius:50%;flex:none}
.acts{display:flex;gap:3px}
.acts button{width:22px;height:22px;border-radius:5px;border:1px solid var(--line);
  font-size:10px;color:var(--rule);line-height:1}
.acts button.used{background:var(--shade);color:var(--muted);text-decoration:line-through}

/* ---------- signing in ---------- */
.authwrap{max-width:420px;margin:60px auto;padding:0 var(--gutter)}
.authwrap .frame{padding-bottom:4px}
.field{padding:11px 15px;border-bottom:1px solid var(--shade)}
.field label{display:block;font-size:9.5px;letter-spacing:.09em;text-transform:uppercase;
  color:var(--muted);margin-bottom:5px}
.field input{width:100%;border:1.5px solid var(--line);border-radius:8px;padding:9px 11px;
  background:var(--panel)}
.field input:focus{outline:none;border-color:var(--rule)}
.authmsg{padding:11px 15px;font-size:13px;border-radius:8px;margin:11px 15px}
.authmsg.bad{background:#f7e4e2;color:var(--rule)}
.authmsg.good{background:#e6f0e6;color:var(--good)}
.whochip{display:flex;align-items:center;gap:7px}
.whochip .role{font-size:9.5px;letter-spacing:.08em;text-transform:uppercase;
  border:1px solid #4a443a;border-radius:4px;padding:1px 5px}
.whochip .role.dm{background:var(--rule);border-color:var(--rule);color:#fff}

/* ---------- the rules editor ---------- */
.edcols{display:grid;gap:15px;grid-template-columns:1fr}
@media(min-width:900px){.edcols{grid-template-columns:230px 1fr}}
@media(min-width:1300px){.edcols{grid-template-columns:250px 1fr}}
.edlist{max-height:70vh;overflow-y:auto}
.edtabs{display:flex;flex-direction:column;gap:2px;position:sticky;top:78px}
.edtab{display:flex;gap:9px;align-items:center;padding:8px 12px;border-radius:8px;
  font-size:13.5px;color:var(--muted);text-align:left;width:100%}
.edtab[aria-current=true]{background:var(--panel);color:var(--ink);font-weight:600;
  box-shadow:var(--frame)}
.edtab .n{margin-left:auto;font-family:var(--num);font-size:11.5px}
.fx{border:1px solid var(--line);border-radius:9px;padding:11px;margin-bottom:9px;
  background:var(--panel)}
.fx select,.fx input{border:1px solid var(--line);border-radius:7px;padding:7px 9px;
  background:var(--panel)}
.grid2{display:grid;grid-template-columns:1fr 1fr;gap:8px}

/* =====================================================================
   THE LOOK — texture, corners, and the pickers
   ===================================================================== */
body.no-texture{background-image:none}
body.dark{color-scheme:dark}
body.dark #battleMap.empty,body.dark #map.empty{
  background-image:linear-gradient(rgba(255,255,255,.09) 1px,transparent 1px),
    linear-gradient(90deg,rgba(255,255,255,.09) 1px,transparent 1px)}
/* brass fittings at the corners of every frame */
body.frame-corners .frame{position:relative}
body.frame-corners .frame::before,body.frame-corners .frame::after{
  content:"";position:absolute;width:10px;height:10px;border:2px solid var(--rule);
  opacity:.75;pointer-events:none}
body.frame-corners .frame::before{left:-2px;top:-2px;border-right:none;border-bottom:none;
  border-radius:var(--frameR) 0 0 0}
body.frame-corners .frame::after{right:-2px;bottom:-2px;border-left:none;border-top:none;
  border-radius:0 0 var(--frameR) 0}

.swatchrow{display:flex;flex-wrap:wrap;gap:9px;padding:12px 13px}
.swatch{width:64px;border-radius:9px;overflow:hidden;border:2px solid transparent;
  background:none;padding:0}
.swatch[aria-pressed=true]{border-color:var(--rule)}
.swatch .band{height:22px;display:flex}
.swatch .band i{flex:1}
.swatch .lbl{font-size:9.5px;padding:4px 2px;color:var(--muted);text-align:center;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.dot-accent{width:30px;height:30px;border-radius:50%;border:2px solid var(--line)}
.dot-accent[aria-pressed=true]{border-color:var(--ink);transform:scale(1.12)}
.modeswitch{display:flex;gap:0;border:1px solid var(--line);border-radius:9px;overflow:hidden}
.modeswitch button{padding:7px 15px;font-size:13px;color:var(--muted)}
.modeswitch button[aria-pressed=true]{background:var(--rule);color:#fff}
.framesample{display:flex;flex-wrap:wrap;gap:9px;padding:12px 13px}
.framesample button{width:78px;height:52px;border-radius:8px;background:var(--panel);
  display:grid;place-items:center;font-size:10px;color:var(--muted);
  border:2px solid var(--line)}
.framesample button[aria-pressed=true]{border-color:var(--rule);color:var(--ink)}

/* =====================================================================
   THE DICE
   Shapes drawn as polygons and spun into place. The number is decided
   before anything moves, so a stuck animation never loses a roll.
   ===================================================================== */
/* The dice button is above everything a player reads — dialogs (60) and
   windows (60) included — so a spell can be rolled while its text is
   open. Only the dice rolling (70), search (75) and the "newer version"
   bar (80) come above it. */
#dicebar{position:fixed;right:18px;bottom:calc(18px + env(safe-area-inset-bottom,0px));
  z-index:65;display:flex;flex-direction:column;align-items:flex-end;gap:9px}
/* Every page keeps room below its last line, so the dice button never
   sits on top of anything you cannot scroll out from under it. */
.page,#sheet,#build,#battle,#edit{padding-bottom:96px}
#dicetray{background:var(--panel);border:2px solid var(--rule);border-radius:12px;
  padding:11px;box-shadow:0 10px 30px rgba(0,0,0,.28);width:min(320px,86vw)}
#dicetray[hidden]{display:none}
.dicegrid{display:flex;flex-wrap:wrap;gap:7px;margin-bottom:9px}
.dicebtn{width:44px;height:44px;border:1px solid var(--line);border-radius:9px;
  display:grid;place-items:center;font-family:var(--num);font-size:12px;color:var(--muted)}
.dicebtn:hover{border-color:var(--rule);color:var(--rule)}
.dicebtn b{position:absolute;font-size:11px}
#diceopen{width:56px;height:56px;border-radius:50%;background:var(--rule);color:#fff;
  border:2px solid var(--panel);box-shadow:0 6px 18px rgba(0,0,0,.35);
  display:grid;place-items:center;font-size:22px}
#dicestage{position:fixed;inset:0;z-index:70;display:grid;place-items:center;
  background:rgba(0,0,0,.45);pointer-events:none}
/* a result with something to press under it takes presses */
#dicestage.waits{pointer-events:auto;cursor:pointer}
/* of two d20s, the one that did not count */
#dicestage .dropped{opacity:.32;filter:grayscale(.7);transform:scale(.86)}
.afterroll{display:flex;gap:9px;justify-content:center;margin-top:14px;flex-wrap:wrap}
.afterroll button{background:var(--panel);color:var(--ink);border:2px solid var(--rule);
  border-radius:10px;padding:10px 18px;font:inherit;font-weight:600;font-size:15px;
  cursor:pointer;box-shadow:0 6px 18px rgba(0,0,0,.3)}
.afterroll button.crit{background:var(--gold);border-color:var(--gold);color:#1c1b18}
.afterroll button:hover{transform:translateY(-1px)}

/* the menu a long press or a right click opens on a roll */
#rollmenu{position:fixed;z-index:72;background:var(--panel);color:var(--ink);
  border:2px solid var(--rule);border-radius:11px;padding:5px;min-width:200px;
  box-shadow:0 12px 30px rgba(0,0,0,.32);display:flex;flex-direction:column}
#rollmenu[hidden]{display:none}
#rollmenu .what{font-size:11px;letter-spacing:.08em;text-transform:uppercase;
  color:var(--muted);padding:6px 10px 4px}
#rollmenu button{text-align:left;padding:10px 12px;border-radius:7px;font-size:14.5px;
  display:flex;gap:10px;align-items:center}
#rollmenu button:hover,#rollmenu button:focus-visible{background:var(--shade);
  color:var(--rule);outline:none}
#rollmenu button i{font-style:normal;width:20px;text-align:center;color:var(--rule)}
/* rollable things say so, the way D&D Beyond's boxed numbers do */
[data-roll],[data-dmg],[data-castatk],[data-castroll]{-webkit-touch-callout:none;
  user-select:none}
#dicestage[hidden]{display:none}
.dieroll{filter:drop-shadow(0 8px 18px rgba(0,0,0,.5))}
.dieface{font-family:var(--num);font-weight:700;text-anchor:middle;dominant-baseline:central}
.dieface.bold{font-family:system-ui,-apple-system,"Segoe UI",sans-serif;font-weight:900}
/* dice that give off their own light: ember, frost */
#dicestage.lit .dieroll,.dicelook.lit .dieroll{filter:drop-shadow(0 0 10px var(--dieglow)) drop-shadow(0 8px 18px rgba(0,0,0,.5))}
/* a twenty or a one, seen as well as heard */
#dicestage.fx-glow.fx-crit .die3d:not(.dropped) .dieroll,
#dicestage.fx-glow.fx-crit .tumbling:not(.dropped) .dieroll{animation:critglow 1.4s ease-out both}
#dicestage.fx-glow.fx-fumble .die3d:not(.dropped) .dieroll,
#dicestage.fx-glow.fx-fumble .tumbling:not(.dropped) .dieroll{animation:fumbleglow 1.4s ease-out both}
@keyframes critglow{0%{filter:drop-shadow(0 0 0 #ffd76a)}
  30%{filter:drop-shadow(0 0 22px #ffd76a) drop-shadow(0 0 6px #fff)}
  100%{filter:drop-shadow(0 0 12px #ffd76a) drop-shadow(0 8px 18px rgba(0,0,0,.5))}}
@keyframes fumbleglow{0%{filter:drop-shadow(0 0 0 #c0262d)}
  30%{filter:drop-shadow(0 0 22px #c0262d)}
  100%{filter:drop-shadow(0 0 10px #8a1a1f) grayscale(.35) drop-shadow(0 8px 18px rgba(0,0,0,.5))}}
#dicestage.fx-shake>div{animation:tableshake .5s cubic-bezier(.36,.07,.19,.97) both}
#dicestage.fx-shake.fx-fumble>div{animation-duration:.7s}
@keyframes tableshake{10%,90%{transform:translate(-2px,1px)}20%,80%{transform:translate(4px,-2px)}
  30%,50%,70%{transform:translate(-7px,2px)}40%,60%{transform:translate(7px,-1px)}}
.sparks{position:absolute;width:0;height:0;pointer-events:none}
.sparks i{position:absolute;left:-3px;top:-3px;width:6px;height:6px;border-radius:50%;
  background:#ffe07a;box-shadow:0 0 8px #ffb52e;animation:spark .8s ease-out both}
.fx-fumble .sparks i{background:#ff6b5e;box-shadow:0 0 8px #b3121c}
@keyframes spark{0%{transform:translate(0,0) scale(1.2);opacity:1}
  100%{transform:translate(var(--dx),var(--dy)) scale(.2);opacity:0}}
@media(prefers-reduced-motion:reduce){#dicestage.fx-shake>div,.sparks i{animation:none}.sparks{display:none}}
@keyframes tumble{
  0%{transform:translateY(-40vh) rotate(0deg) scale(.6);opacity:0}
  12%{opacity:1}
  55%{transform:translateY(4vh) rotate(540deg) scale(1.08)}
  70%{transform:translateY(-2vh) rotate(690deg) scale(1)}
  85%{transform:translateY(1vh) rotate(730deg) scale(1.02)}
  100%{transform:translateY(0) rotate(720deg) scale(1)}
}
.tumbling{animation:tumble .95s cubic-bezier(.22,1.2,.36,1) both}
.diceresult{margin-top:14px;text-align:center;color:#fff;font-family:var(--display)}
.diceresult .total{font-size:44px;font-weight:600;line-height:1}
.diceresult .detail{font-size:14px;opacity:.85;margin-top:5px}
.diceresult .crit{color:#8fd08f}
.diceresult .fumble{color:#e08b8b}

/* =====================================================================
   THE BUILDER, IN DETAIL
   A full look before you commit, then the choices one panel at a time.
   ===================================================================== */
.confirmhead{background:var(--slate);color:#f1ece1;padding:15px 18px;
  display:flex;align-items:center;gap:10px}
.confirmhead b{font-family:var(--display);font-size:16px;letter-spacing:.06em;
  text-transform:uppercase}
.confirmhead button{margin-left:auto;color:#f1ece1;font-size:20px;line-height:1}
.confirmtop{display:flex;gap:16px;padding:16px 18px;align-items:flex-start}
.confirmtop .ico{width:74px;height:74px;border-radius:10px;background:var(--shade);
  flex:none;display:grid;place-items:center;font-family:var(--display);font-size:30px;
  color:var(--rule)}
.confirmtop h3{font-size:22px;font-weight:600;margin-bottom:3px}
.confirmtop .src{font-style:italic;font-size:13px;color:var(--muted)}
.confirmtop .line{font-size:13.5px;margin-top:7px}
.confirmtop .line b{font-weight:600}

.fold{border:1px solid var(--line);border-radius:8px;margin:0 18px 8px;
  background:var(--panel);overflow:hidden}
.fold.open{border-color:var(--rule-soft)}
.fold.needs{border:2px solid #6ea8dc}
.fold > .top{display:flex;align-items:center;gap:10px;padding:11px 14px;width:100%;
  text-align:left}
.fold > .top:hover{background:var(--shade)}
.fold .nm{font-weight:600;font-size:14.5px}
.fold .lv{display:block;font-size:11.5px;color:var(--muted)}
.fold .arrow{margin-left:auto;color:var(--muted);font-size:13px;transition:transform .15s}
.fold.open .arrow{transform:rotate(180deg)}
.fold .inner{padding:2px 14px 14px;border-top:1px solid var(--shade);font-size:13.5px;
  line-height:1.55}
.fold .inner p{margin:9px 0}
.fold .bang{width:20px;height:20px;border-radius:50%;background:#6ea8dc;color:#fff;
  flex:none;display:grid;place-items:center;font-size:12px;font-weight:700}
.fold .done{width:20px;height:20px;border-radius:50%;background:var(--good);color:#fff;
  flex:none;display:grid;place-items:center;font-size:11px}
.pickfield{width:100%;border:1.5px solid #6ea8dc;border-radius:8px;padding:9px 11px;
  background:var(--panel);margin-top:9px}
.pickfield.set{border-color:var(--line)}
.pickwhy{font-size:12.5px;color:var(--muted);margin-top:7px;font-style:italic}
.higher{margin:14px 18px 4px;font-size:13.5px;font-weight:600;color:var(--muted);
  display:flex;align-items:center;gap:8px}
.higher button{width:22px;height:22px;border-radius:50%;border:1px solid var(--line);
  color:var(--good);font-size:15px;line-height:1}
.levelrow{display:flex;align-items:center;gap:11px;padding:13px 18px;
  border-bottom:1px solid var(--shade)}
.levelrow .ico{width:38px;height:38px;border-radius:8px;background:var(--shade);
  display:grid;place-items:center;font-family:var(--display);color:var(--rule)}
.levelrow h3{font-size:18px;font-weight:600}
.levelrow select{margin-left:auto;border:1px solid var(--line);border-radius:7px;padding:5px 9px}
.groupline{font-size:11px;letter-spacing:.11em;text-transform:uppercase;color:var(--good);
  border-bottom:2px solid var(--good);display:inline-block;padding:0 0 4px;margin:16px 18px 10px}

/* ---------- pictures on rules entries ---------- */
.pick .ico img,.confirmtop .ico img,.levelrow .ico img{
  width:100%;height:100%;object-fit:cover;border-radius:inherit;display:block}
.pick .ico,.confirmtop .ico,.levelrow .ico{overflow:hidden}
.picdrop{display:block;border:2px dashed var(--line);border-radius:10px;padding:14px;text-align:center;cursor:pointer;
  color:var(--muted);font-size:13px;margin:11px 13px}
.picdrop:hover{border-color:var(--rule);color:var(--rule)}
.picpreview{width:100%;max-height:190px;object-fit:cover;border-radius:9px;
  border:1px solid var(--line);display:block;margin-bottom:9px}

/* =====================================================================
   THE PANES, THE WAY D&D BEYOND ARRANGES THEM
   A filter row under every tab, content grouped by where it came from.
   ===================================================================== */
.filters{display:flex;flex-wrap:wrap;gap:7px;padding:12px 14px;
  border-bottom:1px solid var(--shade)}
.filters button{border:1px solid var(--line);border-radius:6px;padding:5px 12px;
  font-size:11.5px;letter-spacing:.05em;text-transform:uppercase;color:var(--muted);
  background:var(--panel)}
.filters button[aria-pressed=true]{background:var(--rule);border-color:var(--rule);color:#fff}
.filters button:hover{border-color:var(--rule-soft)}
.groupname{font-size:12px;letter-spacing:.09em;text-transform:uppercase;color:var(--rule);
  font-weight:600;padding:14px 14px 7px;border-bottom:1px solid var(--shade)}
.subgroup{font-family:var(--display);font-size:16px;font-weight:600;color:var(--rule);
  padding:13px 14px 4px}
.paneline{padding:11px 14px;border-bottom:1px solid var(--shade);font-size:13.5px;
  line-height:1.55}
.paneline .hd{font-weight:600;margin-bottom:3px}
.paneline .src{font-size:11.5px;color:var(--muted);font-style:italic}
.paneline .quote{border-left:3px solid var(--shade);padding:5px 0 5px 12px;margin-top:8px}
/* a choice that can be made, or thought better of, on the sheet itself */
.paneline.wants{border-left:3px solid var(--rule)}
.paneline .picks{display:flex;flex-direction:column;gap:7px;margin-top:9px}
.paneline .picks select{border:1px solid var(--line);border-radius:7px;
  padding:7px 9px;background:var(--panel);font:inherit;font-size:13px;
  max-width:340px}
.paneline .picks select:not([data-empty]){color:inherit}
.paneline .picks .pickwhy{margin-top:0}
.usebox{display:flex;align-items:center;gap:7px;margin-top:8px;font-size:12.5px}
.usebox b{width:17px;height:17px;border:1.5px solid var(--line);border-radius:4px;
  display:inline-grid;place-items:center;font-size:11px;cursor:pointer;font-weight:400}
.usebox b.spent{background:var(--rule);border-color:var(--rule);color:#fff}

/* the attack table */
.atktable{width:100%;border-collapse:collapse;font-size:13px}
.atktable th{text-align:left;font-size:10px;letter-spacing:.09em;text-transform:uppercase;
  color:var(--muted);padding:9px 10px;border-bottom:1px solid var(--shade);font-weight:600}
.atktable td{padding:9px 10px;border-bottom:1px solid var(--shade);vertical-align:middle}
.atktable .nm{font-weight:600}
.atktable .kind{font-size:11.5px;color:var(--muted)}
.atktable .num{font-family:var(--num);font-weight:600;border:1.5px solid var(--line);
  border-radius:7px;padding:5px 10px;background:var(--panel);min-width:44px;text-align:center}
.atktable .num:hover{border-color:var(--rule)}
.atktable .tags{font-size:11.5px;color:var(--muted)}

/* the inventory table */
.invsearch{display:flex;gap:9px;padding:12px 14px;border-bottom:1px solid var(--shade)}
.invsearch input{flex:1;border:1px solid var(--line);border-radius:8px;padding:8px 11px;
  background:var(--panel)}
.carried{display:flex;align-items:baseline;gap:10px;padding:12px 14px;
  border-bottom:1px solid var(--shade)}
.carried b{font-size:16px;font-weight:600}
.carried .state{font-size:11px;letter-spacing:.07em;text-transform:uppercase;color:var(--muted)}
.carried .coins{margin-left:auto;font-family:var(--num);font-weight:600}

/* the characteristics grid */
.chargrid{display:grid;gap:13px 16px;padding:13px 14px;
  grid-template-columns:repeat(auto-fit,minmax(110px,1fr))}
.chargrid .cell label{display:block;font-size:10px;letter-spacing:.08em;
  text-transform:uppercase;color:var(--muted);margin-bottom:4px}
.chargrid .cell input{width:100%;border:none;border-bottom:1px solid var(--line);
  padding:3px 0;background:none;font-size:13.5px}
.chargrid .cell input:focus{outline:none;border-bottom-color:var(--rule)}
.addline{padding:10px 14px;border-bottom:1px solid var(--shade)}
.addline .hd{font-weight:600;font-size:13.5px;margin-bottom:4px}
.addline textarea{width:100%;border:1px solid var(--line);border-radius:7px;padding:8px;
  background:var(--panel);resize:vertical;font-size:13.5px}
.addline .prompt{color:var(--good);font-size:13px}

/* defences and conditions, up beside the hit points */
#defences{display:grid;grid-template-columns:1fr 1fr;gap:0;background:var(--panel);
  border:2px solid var(--rule);border-radius:10px;overflow:hidden;flex:1;min-width:280px}
#defences > div{padding:10px 13px}
#defences > div:first-child{border-right:1px solid var(--shade)}
/* with nothing in force, the defences have the band to themselves */
#defences > div:only-child{grid-column:1/-1;border-right:none}
#defences .inforce{background:color-mix(in srgb,var(--rule) 6%,var(--panel))}
@media(max-width:760px){
  #defences{grid-template-columns:1fr}
  #defences > div:first-child{border-right:none;border-bottom:1px solid var(--shade)}
  #defences > div:only-child{border-bottom:none}
}
#defences h4{font-size:11px;letter-spacing:.09em;text-transform:uppercase;
  color:var(--ink);font-weight:600;margin-bottom:5px}
#defences .none{font-size:12.5px;color:var(--muted)}
#defences .chiprow{display:flex;flex-wrap:wrap;gap:5px}
#defences .chiprow button{font-size:11px;border:1px solid var(--line);border-radius:5px;
  padding:2px 7px;color:var(--muted)}
#defences .chiprow button.on{background:var(--rule);border-color:var(--rule);color:#fff}

/* ---------- homebrew: the cards, and the fuller editor ---------- */
.brewgrid{display:grid;gap:16px;grid-template-columns:repeat(auto-fill,minmax(300px,1fr))}
.brewcard{background:var(--slate);color:#f1ece1;border-radius:12px;overflow:hidden;
  min-height:180px;display:flex;flex-direction:column;justify-content:center;
  padding:24px 20px;text-align:center;position:relative}
.brewcard h3{font-family:var(--display);font-size:26px;font-weight:600;margin-bottom:8px}
.brewcard p{font-size:13px;opacity:.78;margin-bottom:16px;line-height:1.5}
.brewcard .btnrow{justify-content:center}
.brewcard .btn{background:var(--rule-soft);border-color:var(--rule-soft);color:#fff;
  font-size:12px;letter-spacing:.04em;text-transform:uppercase}
.brewcard .btn:hover{background:var(--rule);border-color:var(--rule)}
.brewcard .count{position:absolute;top:12px;right:14px;font-family:var(--num);
  font-size:12px;opacity:.6}
.section{border-top:1px solid var(--shade);padding:16px 15px}
.section .top{display:flex;align-items:flex-start;gap:12px;margin-bottom:6px}
.section h4{font-size:14.5px;font-weight:600;flex:1}
.section .why{font-size:12.5px;color:var(--muted);line-height:1.5}
.section .btn{white-space:nowrap;font-size:12px;padding:6px 12px}
.modrow{display:grid;gap:8px;grid-template-columns:1fr 1fr auto;align-items:center;
  padding:9px 0;border-bottom:1px solid var(--shade)}
.modrow:last-child{border-bottom:none}
.modrow select,.modrow input{border:1px solid var(--line);border-radius:7px;padding:7px 9px;
  background:var(--panel);width:100%}
.required{color:var(--rule)}

/* ---------- managing characters and the party ---------- */
.charcard{position:relative}
.cardtools{position:absolute;top:9px;right:9px;display:flex;gap:5px;opacity:0;
  transition:opacity .12s;z-index:2}
.charcard:hover .cardtools,.cardtools:focus-within{opacity:1}
.cardtools button{width:26px;height:26px;border-radius:6px;background:rgba(0,0,0,.55);
  color:#fff;font-size:12px;line-height:1;border:1px solid rgba(255,255,255,.2)}
.cardtools button:hover{background:var(--rule);border-color:var(--rule)}
.charcard.out .band{opacity:.5}
.charcard.out::after{content:"not in the party";position:absolute;left:15px;bottom:11px;
  font-size:10px;letter-spacing:.08em;text-transform:uppercase;color:var(--muted)}
.sortbar{display:flex;gap:7px;align-items:center;margin-bottom:14px;flex-wrap:wrap}
.sortbar button{border:1px solid var(--line);border-radius:7px;padding:5px 11px;
  font-size:12.5px;color:var(--muted);background:var(--panel)}
.sortbar button[aria-pressed=true]{border-color:var(--rule);color:var(--rule)}
.partyrow{display:grid;grid-template-columns:1fr auto auto auto auto;gap:11px;
  align-items:center;padding:10px 13px;border-bottom:1px solid var(--shade)}
.partyrow .who b{display:block;font-size:14px}
.partyrow .who span{font-size:11.5px;color:var(--muted)}
.hpbar{width:88px;height:7px;border-radius:4px;background:var(--shade);overflow:hidden}
.hpbar i{display:block;height:100%;background:var(--good);transition:width .2s}
.hpbar i.hurt{background:var(--gold)}
.hpbar i.bad{background:var(--rule)}
.mini{font-family:var(--num);font-size:12.5px;min-width:52px;text-align:right}

/* ---------- search over everything ---------- */
#searchwrap{position:fixed;inset:0;z-index:75;background:rgba(28,27,24,.5);
  display:grid;place-items:start center;padding:60px 20px 20px}
#searchwrap[hidden]{display:none}
#searchbox{background:var(--panel);border:2px solid var(--rule);border-radius:12px;
  width:min(620px,100%);max-height:78vh;display:flex;flex-direction:column;
  box-shadow:0 18px 50px rgba(0,0,0,.4)}
#searchbox input{border:none;border-bottom:1px solid var(--shade);padding:15px 18px;
  font-size:16px;background:none;width:100%}
#searchbox input:focus{outline:none}
#searchresults{overflow-y:auto}
.hit{display:flex;gap:11px;align-items:center;padding:10px 16px;width:100%;text-align:left;
  border-bottom:1px solid var(--shade)}
.hit:hover,.hit.on{background:var(--shade)}
.hit .kind{font-size:9.5px;letter-spacing:.08em;text-transform:uppercase;color:var(--muted);
  border:1px solid var(--line);border-radius:4px;padding:2px 6px;flex:none;min-width:64px;
  text-align:center}
.hit b{font-size:14px;display:block}
.hit .sub{font-size:12px;color:var(--muted)}
.searchfoot{padding:9px 16px;border-top:1px solid var(--shade);font-size:11.5px;
  color:var(--muted);display:flex;gap:14px}
.searchfoot kbd{border:1px solid var(--line);border-radius:4px;padding:1px 5px;
  font-family:var(--num);font-size:10.5px}

/* ---------- shapes on the battle map ---------- */
.shape{position:absolute;pointer-events:auto;cursor:move;opacity:.42;
  border:2px solid currentColor;touch-action:none}
.shape.circle{border-radius:50%}
.shape.square{border-radius:2px}
.shape.cone{border:none;clip-path:polygon(50% 100%,0 0,100% 0)}
.shape.line{border-radius:3px}
.shape .fill{position:absolute;inset:0;background:currentColor;opacity:.3}
.shape .x{position:absolute;top:-9px;right:-9px;width:18px;height:18px;border-radius:50%;
  background:var(--slate);color:#fff;font-size:11px;line-height:18px;text-align:center;
  opacity:0;cursor:pointer}
.shape:hover .x{opacity:1}

/* ---------- printing ---------- */
@media print{
  .topbar,#dicebar,#defenceband .chiprow button,#panetabs,.filters,
  .cardtools,.sortbar,#undobar{display:none!important}
  body{background:#fff!important}
  .frame{break-inside:avoid;box-shadow:none}
  #sheetBody{grid-template-columns:1fr 1fr!important}
  #sheetTop{background:#fff!important;color:#000!important;
    border-bottom:2px solid #000}
  .print-only{display:block!important}
}
.print-only{display:none}

/* =====================================================================
   DENSITY, TYPE AND A BACKGROUND OF YOUR OWN
   Padding is scaled rather than rewritten, so one number moves every
   panel at once.
   ===================================================================== */
.row{padding:calc(6px * var(--pad)) calc(11px * var(--pad))}
.frame > h2{padding:calc(7px * var(--pad)) calc(12px * var(--pad)) calc(6px * var(--pad))}
.paneline{padding:calc(11px * var(--pad)) calc(14px * var(--pad))}
.act{padding:calc(10px * var(--pad)) calc(13px * var(--pad))}
.atktable td,.atktable th{padding:calc(9px * var(--pad)) calc(10px * var(--pad))}
.fold > .top{padding:calc(11px * var(--pad)) calc(14px * var(--pad))}
.partyrow{padding:calc(10px * var(--pad)) calc(13px * var(--pad))}
.col{gap:calc(15px * var(--pad))}
#sheetBody{gap:calc(15px * var(--pad))}

/* a picture behind everything, faded so the text still reads */
body.has-bg{position:relative}
body.has-bg::before{content:"";position:fixed;inset:0;z-index:-1;
  background:var(--bgImage) center/cover no-repeat fixed;
  opacity:var(--bgFade);pointer-events:none}
body.has-bg{background-color:var(--paper)}

/* ---------- the fuller look editor ---------- */
.swatchedit{display:grid;gap:9px;padding:12px 13px;
  grid-template-columns:repeat(auto-fit,minmax(128px,1fr))}
.swatchedit label{display:flex;align-items:center;gap:8px;font-size:12.5px}
.swatchedit input[type=color]{width:34px;height:26px;border:1px solid var(--line);
  border-radius:6px;padding:0;background:none;cursor:pointer;flex:none}
.slider{display:flex;align-items:center;gap:11px;padding:9px 13px;
  border-bottom:1px solid var(--shade)}
.slider label{width:96px;font-size:13px}
.slider input[type=range]{flex:1}
.slider .val{font-family:var(--num);font-size:12px;width:52px;text-align:right;
  color:var(--muted)}
.facebtn{border:1px solid var(--line);border-radius:8px;padding:9px 12px;
  text-align:left;background:var(--panel);min-width:110px}
.facebtn[aria-pressed=true]{border-color:var(--rule);border-width:2px}
.facebtn b{display:block;font-size:15px;margin-bottom:2px}
.facebtn span{font-size:11.5px;color:var(--muted)}

/* =====================================================================
   THE EDITOR, ON ITS OWN PAGE
   Wide fields, sections down the page, and a save button that stays in
   view — the way a form for making something ought to look.
   ===================================================================== */
#editpage{max-width:1500px;margin:0 auto;padding:0 var(--gutter) 80px}
/* the form, and beside it the page the table will read */
.editcols{display:grid;grid-template-columns:minmax(0,1fr);gap:28px}
.editpreview{background:var(--panel);border:1px solid var(--line);border-radius:12px;
  overflow:hidden;align-self:start;margin-top:22px}
.editpreview .pvhead{padding:11px 16px;background:var(--slate);color:#f1ece1;
  display:flex;flex-direction:column;gap:2px}
.editpreview .pvhead .note{color:#bcb4a4;font-size:12px}
@media(min-width:1200px){
  .editcols{grid-template-columns:minmax(0,1fr) minmax(360px,420px)}
  .editpreview{position:sticky;top:80px;max-height:calc(100vh - 170px);overflow-y:auto;margin-top:26px}
}
.propgrid{display:flex;flex-wrap:wrap;gap:8px}
.propbox{display:inline-flex;align-items:center;gap:7px;border:1px solid var(--line);
  border-radius:8px;padding:8px 11px;cursor:pointer;background:var(--panel);font-size:13.5px}
.bigfield .propbox{display:inline-flex;text-transform:none;letter-spacing:0;font-weight:500;margin:0}
.propbox.on{border-color:var(--rule);background:rgba(143,43,35,.07)}
.propbox input[type=checkbox]{width:auto;accent-color:var(--rule)}
.bigfield .propbox .versdice{width:64px;padding:3px 7px;font-size:13px}
.bigfield.wide{grid-column:1/-1}
.editbar{background:var(--slate);color:#f1ece1;padding:0 var(--gutter);
  display:flex;align-items:center;gap:14px;height:60px;position:sticky;top:0;z-index:35;
  box-shadow:0 2px 10px rgba(0,0,0,.2);margin:0 calc(var(--gutter) * -1)}
.editbar .name{font-family:var(--display);font-size:19px;font-weight:600;
  flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.editbar .kindtag{font-size:10px;letter-spacing:.09em;text-transform:uppercase;
  border:1px solid #4a443a;border-radius:5px;padding:2px 8px;color:#ccc4b4}
.edithead{padding:26px 0 8px;border-bottom:2px solid var(--rule);margin-bottom:20px;
  display:flex;align-items:flex-end;gap:14px}
.edithead h1{font-size:28px}
.edithead .req{margin-left:auto;font-size:12px;color:var(--rule)}
.edithead .req b{color:var(--rule)}
.editsection{margin-bottom:26px}
.editsection > h3{font-size:13px;letter-spacing:.1em;text-transform:uppercase;
  font-weight:600;margin-bottom:5px}
.editsection > .why{font-size:13px;color:var(--muted);line-height:1.55;margin-bottom:14px}
.fieldgrid{display:grid;gap:16px;grid-template-columns:1fr}
@media(min-width:760px){.fieldgrid.two{grid-template-columns:2fr 1fr}}
@media(min-width:760px){.fieldgrid.three{grid-template-columns:1fr 1fr 1fr}}
.bigfield label{display:block;font-size:11.5px;letter-spacing:.07em;text-transform:uppercase;
  font-weight:600;margin-bottom:6px}
.bigfield label .star{color:var(--rule)}
.bigfield input,.bigfield select,.bigfield textarea{width:100%;
  border:1px solid var(--line);border-radius:8px;padding:11px 13px;
  background:var(--panel);font-size:14.5px}
.bigfield input:focus,.bigfield textarea:focus,.bigfield select:focus{
  outline:none;border-color:var(--rule)}
.bigfield textarea{resize:vertical;min-height:130px;line-height:1.6}
.bigfield .hint{font-size:12px;color:var(--muted);margin-top:5px}
.bigfield .check{border:1px solid var(--line);border-radius:8px;margin:0}
.sectionhead{display:flex;align-items:center;gap:14px;padding:16px 0 6px;
  border-top:1px solid var(--shade);margin-top:22px}
.sectionhead h3{font-size:16px;font-weight:600;flex:1}
.sectionhead .n{font-family:var(--num);font-size:13px;color:var(--muted)}
.savebar{position:sticky;bottom:0;background:var(--paper);padding:14px 0;
  border-top:1px solid var(--line);display:flex;gap:11px;align-items:center;
  margin-top:26px;z-index:20}
.savebar .note{flex:1}
/* room for the dice button, which sits over the bottom right corner */
.savebar{padding-right:78px}
.bigfield.off{opacity:.45}
.bigfield.off:focus-within{opacity:1}

/* ---------- the party row, given room to breathe ---------- */
.partyrow{grid-template-columns:minmax(0,1fr) auto auto auto auto;align-items:start}
.partyrow .who{min-width:0}
.partyrow .who b{display:block;font-size:14.5px;line-height:1.3;
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.partyrow .who .line{display:block;font-size:11.5px;color:var(--muted);line-height:1.45;
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.partyrow .who .line.quiet{opacity:.8}
.partyrow .who .marks{display:flex;flex-wrap:wrap;gap:4px;margin-top:4px}
.partyrow .who .marks i{font-style:normal;font-size:10px;letter-spacing:.03em;
  border:1px solid var(--rule);color:var(--rule);border-radius:4px;padding:1px 6px;
  white-space:nowrap}
.partyrow .hpbar{margin-top:5px}
.partyrow .mini{margin-top:3px}
@media(max-width:700px){
  .partyrow{grid-template-columns:minmax(0,1fr) auto;gap:8px}
  .partyrow .hpbar{grid-column:1;width:100%}
  .partyrow .mini{grid-column:2;text-align:right}
}

/* ---------- the shared roll feed ---------- */
#rollfeed{position:fixed;left:18px;bottom:18px;z-index:44;display:flex;
  flex-direction:column-reverse;gap:7px;max-width:min(300px,52vw);pointer-events:none}
#rollfeed .rollline{background:var(--slate);color:#f1ece1;border-radius:9px;
  padding:8px 12px;font-size:12.5px;box-shadow:0 4px 14px rgba(0,0,0,.28);
  animation:rollin .3s ease-out both}
#rollfeed .rollline b{display:block;font-family:var(--num);font-size:15px}
#rollfeed .rollline .who{opacity:.7;font-size:11px}
@keyframes rollin{from{opacity:0;transform:translateY(8px)}to{opacity:1}}
.livedot{width:7px;height:7px;border-radius:50%;background:var(--good);
  display:inline-block;margin-right:5px}
.livedot.off{background:var(--muted)}

/* ---------- measuring on the map ---------- */
#ruler{position:absolute;inset:0;pointer-events:none;z-index:5}
#ruler line{stroke:var(--gold);stroke-width:2.5;stroke-dasharray:7 5}
#ruler circle{fill:var(--gold)}
#ruler text{fill:var(--slate);font-family:var(--num);font-size:13px;font-weight:700;
  paint-order:stroke;stroke:var(--panel);stroke-width:4}
#map.measuring{cursor:crosshair}

/* =====================================================================
   CAMPAIGNS AND MAPS
   ===================================================================== */
.campcard{background:var(--panel);border:1px solid var(--line);border-radius:11px;
  overflow:hidden;text-align:left;transition:border-color .12s,transform .12s}
.campcard:hover{border-color:var(--rule-soft);transform:translateY(-1px)}
.campcard[aria-current=true]{border-color:var(--rule);border-width:2px}
.campcard .band{background:var(--slate);color:#f1ece1;padding:14px 16px}
.campcard .nm{font-family:var(--display);font-size:18px;font-weight:600}
.campcard .wh{font-size:12px;opacity:.75;margin-top:2px}
.campcard .body{padding:12px 16px;font-size:13px;color:var(--muted);line-height:1.5}
.campcard .foot{display:flex;gap:9px;align-items:center;padding:10px 16px;
  border-top:1px solid var(--shade);font-size:11.5px;color:var(--muted)}
.code{font-family:var(--num);letter-spacing:.16em;font-weight:600;font-size:14px;
  background:var(--shade);border-radius:6px;padding:3px 9px}

#maplist{display:grid;gap:14px;grid-template-columns:repeat(auto-fill,minmax(250px,1fr));
  margin-bottom:18px}
.mapcard{border:1px solid var(--line);border-radius:10px;overflow:hidden;text-align:left;
  background:var(--panel)}
.mapcard[aria-current=true]{border-color:var(--rule);border-width:2px}
/* The picture is the point of a map card, so give it the room. The
   caption sits over the foot of it rather than taking a band of its own. */
.mapcard{position:relative}
.mapcard .thumb{aspect-ratio:4/3;height:auto;min-height:150px;
  background:var(--shade) center/cover no-repeat;
  display:grid;place-items:center;color:var(--muted);font-size:11px}
.mapcard .cap{position:absolute;left:0;right:0;bottom:0;padding:22px 12px 9px;
  background:linear-gradient(transparent,rgba(20,16,12,.82) 46%);
  color:#f4efe5;pointer-events:none}
.mapcard .cap b{display:block;font-size:15px;font-family:var(--display);
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
  text-shadow:0 1px 3px rgba(0,0,0,.6)}
.mapcard .cap span{font-size:11px;opacity:.82}

/* the drawing layer and its tools */
.mapdraw{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;z-index:4}
#map.drawing{cursor:crosshair}
.drawbar{display:flex;flex-wrap:wrap;gap:6px;align-items:center;padding:10px 0}
.drawbar .tool{border:1px solid var(--line);border-radius:7px;padding:6px 11px;
  font-size:12px;background:var(--panel)}
.drawbar .tool[aria-pressed=true]{background:var(--rule);border-color:var(--rule);color:#fff}
.inkdot{width:24px;height:24px;border-radius:50%;border:2px solid var(--line)}
.inkdot[aria-pressed=true]{border-color:var(--ink);transform:scale(1.14)}
.widthdot{width:34px;height:30px;border:1px solid var(--line);border-radius:7px;
  display:grid;place-items:center}
.widthdot[aria-pressed=true]{border-color:var(--rule)}
.widthdot i{display:block;background:var(--ink);border-radius:9px}
.token.grouped{outline:2px dashed var(--gold);outline-offset:2px}
.token.groupmark{width:46px;height:46px;margin:-23px 0 0 -23px;
  border-width:3px;font-size:11px}
.token.groupmark .count{position:absolute;right:-4px;bottom:-4px;background:var(--slate);
  color:#fff;border-radius:50%;width:18px;height:18px;font-size:10px;line-height:18px;
  text-align:center}

/* ---------- campaign cards with a picture ---------- */
.campcard .pic{display:block;width:100%;height:150px;position:relative;
  background:var(--slate) center/cover no-repeat;border:none;padding:0;
  display:grid;place-items:center;overflow:hidden}
.campcard .pic .none{font-family:var(--display);font-size:52px;color:#6b6357}
.campcard .pic .over{position:absolute;left:0;right:0;bottom:0;
  padding:26px 16px 12px;text-align:left;
  background:linear-gradient(transparent,rgba(20,18,15,.88))}
.campcard .pic .nm{display:block;font-family:var(--display);font-size:19px;
  font-weight:600;color:#f7f3ea}
.campcard .pic .wh{display:block;font-size:11.5px;color:#d6cfc2;margin-top:2px}
.campcard .pic .playing{position:absolute;top:10px;right:10px;
  background:var(--rule);color:#fff;font-size:10px;letter-spacing:.09em;
  text-transform:uppercase;border-radius:5px;padding:3px 9px}

/* the arrow back out of a campaign */
.topbar nav .campback{font-size:17px;padding:6px 10px;line-height:1}

/* the way into a fight, only while there is one */
#toBattle{background:var(--rule);border-color:var(--rule);color:#fff;
  animation:battlepulse 2.4s ease-in-out infinite}
#toBattle:hover{background:var(--rule-soft)}
@keyframes battlepulse{0%,100%{opacity:1}50%{opacity:.72}}

/* turn order across the top of a map that has a fight on it */
.turnstrip{display:flex;gap:7px;align-items:center;flex-wrap:wrap;
  padding:10px 13px;border-bottom:1px solid var(--shade)}
.turnstrip .turn{border:1px solid var(--line);border-radius:7px;padding:4px 10px;
  font-size:12px;display:flex;gap:7px;align-items:baseline;background:var(--panel)}
.turnstrip .turn.foe{border-color:var(--rule-soft)}
.turnstrip .turn.now{background:var(--rule);border-color:var(--rule);color:#fff}
.turnstrip .turn span{font-family:var(--num);opacity:.72;font-size:11px}

/* =====================================================================
   THE DM'S PAGE
   The party is what a DM looks at all evening, so it gets the room. The
   short things — the fight, the session, treasure — sit across the top
   in a narrower row where they are still one glance away.
   ===================================================================== */
.dmtop{display:grid;gap:14px;margin-bottom:16px;
  grid-template-columns:repeat(auto-fit,minmax(250px,1fr))}
.dmtop .frame{margin:0}
@media(min-width:1000px){
  #dmbody{grid-template-columns:repeat(2,minmax(0,1fr))}
  #dmbody .wide{grid-column:1 / -1}
}

/* stepping the grid, and a slider that keeps up while dragging */
.gridset{display:inline-flex;align-items:center;gap:2px;border:1px solid var(--line);
  border-radius:7px;overflow:hidden;background:var(--panel)}
.gridset button{width:26px;height:28px;font-size:15px;line-height:1;color:var(--muted)}
.gridset button:hover{background:var(--shade);color:var(--ink)}
.gridset b{font-family:var(--num);font-size:12px;padding:0 7px;min-width:46px;
  text-align:center}
.widthdot i{background:var(--ink);display:block}
.widthdot{width:34px;height:34px}

/* a mark with a picture on it */
.token.haspic{background-size:cover;background-position:center;color:transparent;
  box-shadow:0 2px 7px rgba(0,0,0,.35)}
.token.haspic .hpbar{color:initial}

/* =====================================================================
   THE MARKET
   ===================================================================== */
#marketbody{display:grid;gap:16px;grid-template-columns:repeat(auto-fit,minmax(320px,1fr))}
.shop{background:var(--panel);border:1px solid var(--line);border-radius:11px;
  overflow:hidden;display:flex;flex-direction:column}
.shop.shut{opacity:.6}
.shop > header{background:var(--slate);color:#f1ece1;padding:12px 15px}
.shop > header b{font-family:var(--display);font-size:17px;display:block}
.shop > header span{font-size:11.5px;opacity:.75}
.shop .purse{display:flex;align-items:center;gap:9px;padding:9px 15px;
  border-bottom:1px solid var(--shade);font-size:13px}
.shop .purse .amount{margin-left:auto;font-family:var(--num);font-weight:600}
.shop .goods{max-height:340px;overflow-y:auto}
.buyrow{display:grid;grid-template-columns:1fr auto auto;gap:9px;align-items:center;
  padding:8px 15px;border-bottom:1px solid var(--shade);font-size:13.5px}
.buyrow:last-child{border-bottom:none}
.buyrow .what b{display:block}
.buyrow .what span{font-size:11px;color:var(--muted)}
.buyrow .cost{font-family:var(--num);font-size:13px;white-space:nowrap}
.buyrow button{border:1px solid var(--line);border-radius:7px;padding:4px 11px;
  font-size:12px;background:var(--panel);white-space:nowrap}
.buyrow button:hover:not(:disabled){border-color:var(--rule);color:var(--rule)}
.buyrow button:disabled{opacity:.4}
.buyrow.cannot .cost{color:var(--muted)}
.shopsearch{padding:9px 15px;border-bottom:1px solid var(--shade)}
.shopsearch input{width:100%;border:1px solid var(--line);border-radius:7px;
  padding:6px 10px;background:var(--panel)}
.ledger{padding:9px 15px;border-top:1px solid var(--shade);font-size:12px;
  color:var(--muted);max-height:120px;overflow-y:auto}
.ledger div{padding:2px 0}

/* =====================================================================
   THE STALL
   A market stall rather than a list: an awning, a keeper behind it, and
   a tray of compartments. What is on the shelf sits in a compartment;
   an empty one is an empty one.
   ===================================================================== */
/* The stall is a painting — awning, lamps, the street behind — with the
   keeper standing in the middle of it and the tray built underneath in
   markup, so every compartment is something you can press. */
.stall{position:relative;border-radius:12px;overflow:hidden;
  background:#241a11}
.stall .behind{position:relative;padding-top:36.3%;   /* the picture's shape */
  background:url("stall.jpg") center top/100% auto no-repeat,#2b2018}
.stall .keeper{position:absolute;left:50%;bottom:2%;transform:translateX(-50%);
  filter:drop-shadow(0 3px 8px rgba(0,0,0,.45))}
.stall .sign{position:absolute;left:5.5%;top:18%;color:#f2e7d0;
  font-family:var(--display);font-size:clamp(11px,1.5vw,15px);font-weight:600;
  text-shadow:0 1px 3px rgba(0,0,0,.7);max-width:26%;
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
  transform:rotate(-1deg)}

.tray{background:url("wood.jpg") center/auto 100% repeat-x,#6b4a2c;
  border-top:5px solid #8a6339;padding:11px;
  display:grid;gap:9px;grid-template-columns:repeat(5,1fr)}
@media(max-width:620px){.tray{grid-template-columns:repeat(3,1fr)}}
/* A compartment, with the padded red oval the picture has in each one. */
.slot{aspect-ratio:1/1;border-radius:7px;
  background:radial-gradient(ellipse 66% 52% at 50% 55%,#9c5f5c 0 99%,transparent 100%),
    url("wood.jpg") center/cover;
  border:2px solid #5a3d22;box-shadow:inset 0 2px 6px rgba(0,0,0,.4);
  display:grid;place-items:center;position:relative;padding:5px;text-align:center}
.slot.empty{filter:brightness(.86)}
/* The picture is what a buyer looks at, so let it fill the compartment.
   It is drawn at 62 and then told to fit, which keeps it sharp at any
   size — including inside a window, where the tray is much narrower. */
.slot .itemicon{display:block;width:62%;height:auto;max-height:58%}
.slot .nm{font-size:9.5px;line-height:1.15;color:#f0e4cd;margin-top:4px;
  max-height:22px;overflow:hidden}
/* in a window the whole stall is shrunk, so the goods keep their share */
.panel .tray{grid-template-columns:repeat(4,1fr);gap:7px;padding:8px}
.panel .slot{padding:4px}
.panel .slot .nm{font-size:8.5px;max-height:18px}
.panel .slot .price,.panel .slot .left{font-size:8px}
.slot .price{position:absolute;right:3px;bottom:2px;font-family:var(--num);
  font-size:9px;color:#f7e6b8;background:rgba(0,0,0,.45);border-radius:4px;
  padding:0 4px}
.slot .left{position:absolute;left:3px;top:2px;font-size:8.5px;color:#f0e4cd;
  background:rgba(0,0,0,.4);border-radius:4px;padding:0 4px}
.slot:hover:not(.empty):not(.cannot){border-color:var(--gold);cursor:pointer}
.slot.cannot{opacity:.5}
.slot.picked{border-color:var(--gold);box-shadow:0 0 0 2px var(--gold)}
.itemicon{vertical-align:middle}
.raritydot{width:9px;height:9px;border-radius:50%;display:inline-block;
  margin-right:5px;vertical-align:-1px}

/* the keeper's face, chosen from a few */
.facepick{display:flex;gap:9px;flex-wrap:wrap;padding:12px 14px}
.facepick button{border:2px solid var(--line);border-radius:10px;padding:5px;
  background:var(--panel)}
.facepick button[aria-pressed=true]{border-color:var(--rule)}

/* seeing it as a player would */
.asplayer{position:fixed;left:50%;bottom:16px;transform:translateX(-50%);z-index:70;
  background:var(--gold);color:#2a2118;border-radius:9px;padding:8px 15px;
  font-size:13px;display:flex;gap:12px;align-items:center;
  box-shadow:0 6px 20px rgba(0,0,0,.3)}
.asplayer button{font-weight:600;text-decoration:underline}

/* the little picture at the left of every entry in the library */
.entrypic{flex:none;border-radius:7px;background-size:cover;background-position:center;
  display:grid;place-items:center;overflow:hidden;border:1px solid var(--line)}
.entrypic.letter{font-family:var(--display);font-size:16px;font-weight:600;
  color:#f3ece0;border-color:transparent}
.entrypic.drawn{background:var(--shade)}
.edlist .row{gap:10px}

/* the drawn marks sit level with the text around them */
.pick .ico .itemicon,.entrypic .itemicon{display:block}
.pick .ico{display:grid;place-items:center;overflow:hidden}

/* an entry a DM has switched off for their table */
.edlist .row.switchedoff{opacity:.45}
.edlist .row.switchedoff b{text-decoration:line-through}
.onoff{border:1px solid var(--line);border-radius:6px;padding:3px 10px;
  font-size:11px;letter-spacing:.05em;text-transform:uppercase;color:var(--muted);
  background:var(--panel);flex:none}
.edlist .row.switchedoff .onoff{border-color:var(--rule);color:var(--rule)}
.onoff:hover{border-color:var(--rule)}
.tagrow{display:flex;flex-wrap:wrap;gap:4px;margin-top:3px}
.tagrow i{font-style:normal;font-size:10px;letter-spacing:.04em;
  border:1px solid var(--line);border-radius:4px;padding:1px 6px;color:var(--muted)}
.tagbar{display:flex;flex-wrap:wrap;gap:6px;align-items:center;
  padding:9px 13px;border-bottom:1px solid var(--shade)}
.tagbar button{border:1px solid var(--line);border-radius:6px;padding:3px 10px;
  font-size:11.5px;color:var(--muted);background:var(--panel)}
.tagbar button[aria-pressed=true]{background:var(--rule);border-color:var(--rule);
  color:#fff}
/* the count on a chip that is on was the muted colour on red — unreadable */
.tagbar button[aria-pressed=true] .note{color:rgba(255,255,255,.82)}
.tagbar button.hidden-tag{border-style:dashed;opacity:.6}

/* in or out of the campaign being sorted */
.onoff.in{background:var(--good);border-color:var(--good);color:#fff}

/* =====================================================================
   FLOATING PANELS
   ===================================================================== */
#panelroot{position:fixed;inset:0;pointer-events:none;z-index:60}
.panel{position:absolute;pointer-events:auto;display:flex;flex-direction:column;
  background:var(--panel);border:1px solid var(--line);border-radius:11px;
  box-shadow:0 10px 34px rgba(0,0,0,.28);overflow:hidden;min-width:240px}
.panel > header{display:flex;align-items:center;gap:8px;flex:none;
  background:var(--slate);color:#f1ece1;padding:7px 9px 7px 12px;cursor:move;
  user-select:none;touch-action:none}
.panel > header b{font-family:var(--display);font-size:14px;flex:1;
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.panel > header button{width:24px;height:24px;border-radius:6px;flex:none;
  color:#f1ece1;opacity:.72;font-size:13px;line-height:1}
.panel > header button:hover{opacity:1;background:rgba(255,255,255,.13)}
.panel .inner{flex:1;overflow:auto;background:var(--paper)}
.panel.rolled{height:auto!important}
.panel.rolled .inner,.panel.rolled .grip{display:none}
.grip{position:absolute;right:0;bottom:0;width:18px;height:18px;cursor:nwse-resize;
  touch-action:none}
.grip::after{content:"";position:absolute;right:4px;bottom:4px;width:8px;height:8px;
  border-right:2px solid var(--muted);border-bottom:2px solid var(--muted);opacity:.6}
.panel.dragging{opacity:.92;box-shadow:0 16px 44px rgba(0,0,0,.36)}

/* the row of what is open, along the bottom */
#panelbar{position:fixed;left:50%;bottom:10px;transform:translateX(-50%);z-index:59;
  display:flex;gap:7px;align-items:center;background:var(--panel);
  border:1px solid var(--line);border-radius:10px;padding:5px 7px;
  box-shadow:0 5px 18px rgba(0,0,0,.22);max-width:94vw;overflow-x:auto}
#panelbar:empty{display:none}
#panelbar button{border:1px solid var(--line);border-radius:7px;padding:4px 10px;
  font-size:12px;white-space:nowrap;background:var(--panel)}
#panelbar button.hidden-one{opacity:.55;border-style:dashed}
#panelbar button:hover{border-color:var(--rule)}
@media(max-width:620px){
  .panel{left:2vw!important;right:2vw;width:96vw!important;
    top:auto!important;bottom:56px;height:64vh!important}
  .grip{display:none}
}

/* the DM's own cast, below the party */
.casthead{grid-column:1/-1;padding:16px 2px 4px;border-top:1px solid var(--shade);
  margin-top:8px}
.casthead b{font-family:var(--display);font-size:15px;display:block}
.charcard.npc{border-style:dashed}
.charcard.npc .cardface b::after{content:" · NPC";font-size:11px;color:var(--muted);
  font-family:var(--body);font-weight:400}

/* a face on every vault card */
.lorecard .band{display:flex;gap:11px;align-items:center}
.lorepic{width:44px;height:44px;border-radius:9px;flex:none;overflow:hidden;
  background-size:cover;background-position:center;background-color:rgba(255,255,255,.12);
  display:grid;place-items:center}
.lorepic.letter{font-family:var(--display);font-size:20px;color:#f1ece1}
.lorepic.small{width:34px;height:34px;border-radius:7px;
  background-color:var(--shade)}
.lorepic.letter.small{font-size:15px;color:var(--muted)}

/* ---- reading a vault of thirty entries ----
   A line to search by, chips for the kinds, and then either cards or
   rows. The rows are the point: a long vault has to be scannable, and a
   grid of pictures is not. */
.vaultfind{display:flex;gap:8px;align-items:center;margin-bottom:10px;
  flex-wrap:wrap}
.vaultfind input{flex:1;min-width:180px;border:1.5px solid var(--line);
  border-radius:9px;padding:8px 12px;background:var(--panel)}
.vaultfind .grow{flex:1}
#vaultkinds{margin-bottom:12px}
.vaultgroup{margin-bottom:14px}
.vaultgroup .grouphead{display:flex;gap:9px;align-items:baseline;width:100%;
  text-align:left;padding:7px 4px;border-bottom:1px solid var(--line);
  margin-bottom:10px}
.vaultgroup .grouphead b{font-family:var(--display);font-size:15px}
.vaultgroup .grouphead .arrow{color:var(--muted);font-size:11px;width:11px}
.vaultgroup .grouphead .why{color:var(--muted);font-size:12px;font-style:italic;
  margin-left:auto;text-align:right}
.vaultgroup .grouphead:hover b{color:var(--rule)}
.vaultrows{display:grid;grid-template-columns:minmax(0,1fr);gap:1px 22px}
/* a row is a name and a line of text; on a wide screen that fills half
   the width at most, so two columns show twice as much at a glance */
@media(min-width:1100px){.vaultrows{grid-template-columns:repeat(2,minmax(0,1fr))}}
.lorerow{display:flex;align-items:center;gap:8px;position:relative;
  border:1px solid transparent;border-radius:9px;padding:2px 6px 2px 2px}
.lorerow:hover{border-color:var(--line);background:var(--panel)}
.lorerow > button.grow{flex:1;display:flex;gap:11px;align-items:center;
  text-align:left;padding:7px 4px;min-width:0}
.lorerow .says{min-width:0;flex:1}
.lorerow .nm{display:block;font-weight:600;font-size:13.5px;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.lorerow .marks{font-weight:400;font-size:11.5px;color:var(--rule);
  font-style:italic}
.lorerow .sub{display:block;font-size:12px;color:var(--muted);
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.lorerow.keptback{opacity:.62}
.lorerow.keptback .nm{font-style:italic}
.lorerow .lorewin{position:static;opacity:0}
.lorerow:hover .lorewin,.lorerow .lorewin:focus-within{opacity:1}
.lorerow .lorewin button{background:var(--panel);
  border-color:var(--line);color:var(--muted)}
.lorerow .lorewin button:hover{border-color:var(--rule);color:var(--rule)}

/* the folded parts of a vault entry's form */
.lorefold{border-top:1px solid var(--shade)}
.lorefold .foldhead{display:flex;gap:9px;align-items:baseline;width:100%;
  text-align:left;padding:10px 14px}
.lorefold .foldhead b{font-family:var(--display);font-size:13.5px}
.lorefold .foldhead .arrow{color:var(--muted);font-size:11px;width:11px}
.lorefold .foldhead .n{font-family:var(--num);font-size:11.5px;
  color:var(--rule)}
.lorefold .foldhead .note{font-size:11.5px}
.lorefold .foldhead .why{color:var(--muted);font-size:11.5px;font-style:italic;
  margin-left:auto;text-align:right;max-width:52%}
.lorefold .foldhead:hover b{color:var(--rule)}
.lorefold.open{background:var(--shade)}
.lorefold.open .foldbody{background:var(--panel);
  border-top:1px solid var(--shade)}

/* a name in the text that leads somewhere */
.linkrow{display:flex;flex-wrap:wrap;gap:6px;padding:4px 0}
.linkrow button{border:1px solid var(--line);border-radius:7px;padding:3px 10px;
  font-size:12px;background:var(--panel);display:flex;gap:6px;align-items:center}
.linkrow button:hover{border-color:var(--rule);color:var(--rule)}
.linkrow .x{color:var(--rule);opacity:.7}

/* the two window buttons, top right of whatever they belong to */
.winbtns{display:inline-flex;gap:4px;flex:none}
.winbtns button{width:24px;height:24px;border-radius:6px;font-size:12px;
  border:1px solid var(--line);background:var(--panel);color:var(--muted);
  display:grid;place-items:center}
.winbtns button:hover{border-color:var(--rule);color:var(--rule)}
.cardtools .winbtns button{border:none;background:transparent}
.sheethead .winbtns,.pagehead .winbtns{margin-left:auto}
.shop > header .winbtns button{border-color:rgba(255,255,255,.28);
  background:rgba(255,255,255,.1);color:#f1ece1}

/* a vault entry the DM is holding back */
.lorecard.keptback{opacity:.6;border-style:dashed}

/* a page shown small inside a window */
.panel .shrunk{zoom:.78}
.panel .shrunk .pagehead{padding-top:6px}
.panel .shrunk .topbar,.panel .shrunk .savebar,
.panel .shrunk .winbtns{display:none}
.panel .shrunk > .page{display:block!important}
@supports not (zoom:1){
  .panel .shrunk{transform:scale(.78);transform-origin:top left;width:128%}
}

/* the window buttons on a map card and a vault card */
.mapcard-wrap{position:relative}
.mapwin,.lorewin{position:absolute;right:7px;top:7px;z-index:2;
  opacity:0;transition:opacity .12s}
.mapcard-wrap:hover .mapwin,.lorecard:hover .lorewin,
.mapwin:focus-within,.lorewin:focus-within{opacity:1}
.mapwin button,.lorewin button{background:rgba(20,16,12,.62);
  border-color:rgba(255,255,255,.22);color:#f1ece1}
.mapwin button:hover,.lorewin button:hover{background:var(--rule);
  border-color:var(--rule);color:#fff}
.lorecard{position:relative}

/* the folded parts of a vault entry's form */
.lorefold{border-top:1px solid var(--shade)}
.lorefold .foldhead{display:flex;gap:9px;align-items:baseline;width:100%;
  text-align:left;padding:10px 14px}
.lorefold .foldhead b{font-family:var(--display);font-size:13.5px}
.lorefold .foldhead .arrow{color:var(--muted);font-size:11px;width:11px}
.lorefold .foldhead .n{font-family:var(--num);font-size:11.5px;
  color:var(--rule)}
.lorefold .foldhead .note{font-size:11.5px}
.lorefold .foldhead .why{color:var(--muted);font-size:11.5px;font-style:italic;
  margin-left:auto;text-align:right;max-width:52%}
.lorefold .foldhead:hover b{color:var(--rule)}
.lorefold.open{background:var(--shade)}
.lorefold.open .foldbody{background:var(--panel);
  border-top:1px solid var(--shade)}

/* a name in the text that leads somewhere */
.loremention{color:var(--rule);border-bottom:1px dotted var(--rule);cursor:pointer}
.loremention:hover{background:var(--shade)}

/* =====================================================================
   AN ENTRY AS IT READS
   The picture at the left, the words beside it — a portrait shown small
   above a wall of text is worth nothing.
   ===================================================================== */
.loreread{display:flex!important;gap:14px;padding:14px 15px;
  align-items:flex-start;flex-wrap:nowrap}
.loreread .pic{width:min(34%,220px);min-width:110px;aspect-ratio:3/4;
  border-radius:10px;background-size:cover;background-position:center top;
  flex:0 0 auto;border:1px solid var(--line)}
.loreread .pic.none{display:grid;place-items:center;background:var(--slate);
  color:#f1ece1;font-family:var(--display);font-size:44px}
.loreread .words{flex:1;min-width:0}
.loreread .words > b{font-family:var(--display);font-size:19px;display:block;
  margin-bottom:5px}
.loreread .text{white-space:pre-wrap;font-size:13.5px;line-height:1.65;
  margin-top:10px}
.loreread .secrets{margin-top:13px;border-top:1px solid var(--shade);padding-top:10px}
.loreread .secrets .lbl{font-size:10px;letter-spacing:.09em;text-transform:uppercase;
  color:var(--muted);display:block;margin-bottom:6px}
.loreread .secrets > div{font-size:13px;line-height:1.6;white-space:pre-wrap;
  padding:6px 0;border-bottom:1px solid var(--shade)}
.loreread .secrets > div:last-child{border-bottom:none}
@media(max-width:430px){
  .loreread{flex-direction:column}
  .loreread .pic{width:100%;aspect-ratio:16/10}
}

/* =====================================================================
   HEALTH ABOVE A MARK
   ===================================================================== */
.hpover{position:absolute;left:50%;bottom:calc(100% + 4px);
  transform:translateX(-50%);display:flex;flex-direction:column;
  align-items:center;gap:1px;pointer-events:none;z-index:3}
.hpover .bar{width:38px;height:5px;border-radius:3px;overflow:hidden;
  background:rgba(20,16,12,.55);box-shadow:0 0 0 1px rgba(255,255,255,.25)}
.hpover .bar i{display:block;height:100%;background:#4a9a4a;
  transition:width .18s}
.hpover.half .bar i{background:#c9a227}
.hpover.low .bar i{background:#b8382c}
.hpover .num{font-family:var(--num);font-size:9.5px;line-height:1.1;
  color:#f4efe5;background:rgba(20,16,12,.7);border-radius:4px;padding:0 4px;
  white-space:nowrap}
/* the mark itself no longer carries one */
.token > .hpbar{display:none}
/* in a small window the numbers would crowd it out */
.panel .hpover .num{font-size:8px;padding:0 3px}
.panel .hpover .bar{width:30px;height:4px}

/* =====================================================================
   HOW A NUMBER WAS REACHED
   ===================================================================== */
.working{border-bottom:1px solid var(--shade)}
.working summary{display:flex;gap:10px;align-items:center;padding:9px 15px;
  cursor:pointer;list-style:none}
.working summary::-webkit-details-marker{display:none}
.working .mark{font-size:11px;color:var(--good);min-width:18px;text-align:right}
.working.off .mark{color:var(--rule);font-weight:600}
.working.off summary{background:rgba(143,43,35,.06)}
.working .parts{padding:4px 15px 12px 30px;font-size:13px}
.working .parts > div{display:flex;justify-content:space-between;gap:12px;
  padding:3px 0;border-bottom:1px dotted var(--line)}
.working .parts .total{font-weight:600;border-bottom:none}
.working .parts p{margin:8px 0 0;font-size:12px;color:var(--muted);line-height:1.55}

/* =====================================================================
   A FIGHT ON THE MAP
   ===================================================================== */
.battlebar{display:flex;flex-wrap:wrap;gap:7px;align-items:center;
  padding:9px 13px;border-bottom:1px solid var(--shade)}
.battlebar button[aria-pressed=true]{border-color:var(--rule);color:var(--rule)}
.battlelog{margin:0 13px 6px;border:1px solid var(--line);border-radius:10px;
  overflow:hidden}
.battlelog .tally{display:grid;gap:6px;padding:10px 13px;
  grid-template-columns:repeat(auto-fill,minmax(200px,1fr));
  border-bottom:1px solid var(--shade)}
.battlelog .tally > div{display:flex;flex-direction:column;gap:2px;font-size:13px}
.battlelog .avg{font-family:var(--num);font-size:11px;color:var(--muted)}
.battlelog .avg.good{color:var(--good)}
.battlelog .avg.poor{color:var(--rule)}
.battlelog .lines{max-height:260px;overflow-y:auto}
.logline{display:flex;gap:9px;align-items:baseline;padding:6px 13px;
  border-bottom:1px solid var(--shade);font-size:13px}
.logline .rd{font-size:10px;color:var(--muted);width:22px;flex:none}
.logline .nat{font-family:var(--num);font-size:11px;color:var(--muted)}
.logline .tot{font-family:var(--num);font-weight:600;min-width:22px;text-align:right}
.logline .q{font-size:11px;color:var(--muted)}
.logline.crit{background:rgba(74,154,74,.12)}
.logline.crit .q{color:var(--good);font-weight:600}
.logline.fumble{background:rgba(184,56,44,.10)}
.logline.fumble .q{color:var(--rule);font-weight:600}
.logline.good .q{color:var(--good)}
.logline.poor .q{color:var(--rule)}
.logline.dmg .tot{color:var(--rule)}
.logline.dark{opacity:.55;font-style:italic}
.mapcard-wrap.veiled .mapcard{border-style:dashed;opacity:.72}
.creaturemove{display:flex;gap:9px;align-items:center;padding:8px 13px;
  border-bottom:1px solid var(--shade)}
.creaturemove .sub{display:block;font-size:11.5px;color:var(--muted)}

/* temporary hit points: a second bar, above the real one, in blue */
.hpover .bar.temp{height:4px;background:rgba(20,16,12,.45)}
.hpover .bar.temp i{background:#3f7fb8}
.hpover .num em{font-style:normal;color:#8fc0e8}

/* the ruler */
.measureline{position:absolute;inset:0;width:100%;height:100%;
  pointer-events:none;z-index:6}
.measureline line{stroke:#f4efe5;stroke-width:.5;stroke-dasharray:2 1.4;
  vector-effect:non-scaling-stroke;filter:drop-shadow(0 0 2px rgba(0,0,0,.8))}
.measuresay{position:absolute;transform:translate(8px,-50%);z-index:7;
  background:rgba(20,16,12,.82);color:#f4efe5;font-family:var(--num);
  font-size:11px;padding:2px 7px;border-radius:6px;pointer-events:none;
  white-space:nowrap}

/* the name under a mark */
.tokname{position:absolute;left:50%;top:calc(100% + 3px);transform:translateX(-50%);
  font-size:10px;line-height:1.1;white-space:nowrap;pointer-events:none;
  background:rgba(20,16,12,.7);color:#f4efe5;padding:1px 5px;border-radius:5px;
  max-width:96px;overflow:hidden;text-overflow:ellipsis}

/* a foe's bar, without the count beneath it */
.hpover.quiet .bar{width:44px}

/* ---- the bar that says a newer version is on the server ----
   The quiet failure this catches: every file stale in the same way, so
   nothing disagrees and nothing looks wrong. */
#stalebar{position:fixed;left:0;right:0;bottom:0;z-index:80;
  background:var(--rule);color:#fff;display:flex;gap:12px;align-items:center;
  padding:11px 16px;font-size:13.5px;line-height:1.45;
  box-shadow:0 -2px 10px rgba(0,0,0,.18)}
#stalebar b{font-weight:600}
#stalebar span{flex:1;min-width:0}
#stalebar button{border:1.5px solid rgba(255,255,255,.55);border-radius:7px;
  padding:5px 13px;color:#fff;font-weight:600;flex:none}
#stalebar button:hover{background:rgba(255,255,255,.16)}
#stalebar button[data-dismissstale]{border-color:transparent;padding:5px 9px;
  font-weight:400;opacity:.8}
#stalebar .other{color:#fff;opacity:.85;font-size:12.5px;flex:none;
  text-decoration:underline}
#stalebar .other:hover{opacity:1}

/* =====================================================================
   ON A PHONE
   The top bar had room for three of its nine buttons, so every page was
   914px wide on a 390px screen and Characters, Maps, Vault and Market
   were only reached by wiping sideways. Now the pages you play in live
   in a bar at the bottom, under the thumb, and the rest behind More.
   The dice button stays exactly where a thumb finds it — bottom right —
   just lifted clear of that bar.
   ===================================================================== */
#tabbar{display:none}
@media(max-width:760px){
  :root{--gutter:14px}
  /* clip, not hidden: hidden makes the body a scroll box of its own,
     and nothing inside a scroll box can stick to the top of the screen */
  html{overflow-x:clip}
  .topbar{gap:10px}
  .topbar nav{display:none}
  .topbar .brand{font-size:15.5px;white-space:nowrap;overflow:hidden;
    text-overflow:ellipsis;min-width:0}
  #tabbar{display:flex;position:fixed;left:0;right:0;bottom:0;z-index:44;
    background:var(--slate);border-top:1px solid rgba(255,255,255,.08);
    padding:4px 4px calc(4px + env(safe-area-inset-bottom,0px));
    box-shadow:0 -2px 10px rgba(0,0,0,.22)}
  #tabbar button{flex:1;min-width:0;display:flex;flex-direction:column;
    align-items:center;gap:1px;padding:6px 2px 5px;border-radius:8px;
    color:#bcb4a4;font-size:10.5px;letter-spacing:.02em}
  #tabbar button i{font-style:normal;font-size:18px;line-height:1.1}
  #tabbar button span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
    max-width:100%}
  #tabbar button[aria-current=true]{color:#fff;background:rgba(255,255,255,.08)}
  #tabbar button[aria-current=true] i{color:var(--rule-soft)}
  #tabbar button[hidden]{display:none}
  /* the dice button sits just above the bar, same corner as always */
  #dicebar{right:14px;bottom:calc(70px + env(safe-area-inset-bottom,0px))}
  #rollfeed{bottom:calc(74px + env(safe-area-inset-bottom,0px))}
  /* and every page keeps room for both */
  .page,#sheet,#build,#battle,#edit{padding-bottom:160px}

  /* the sheet's own header wraps rather than running off */
  #sheetTop{gap:10px;padding:10px var(--gutter)}
  #sheetTop .sheetactions{margin-left:0;width:100%;justify-content:flex-start}
  #sheetTop .sheetactions .chip{padding:6px 10px}
  #sheetTop .chip[data-go="home"]{order:-1}
  .moremenu .menu{right:auto;left:0}

  /* the ability band: three to a row, and nothing wider than the screen */
  #band{gap:7px}
  #band .shield{width:calc((100% - 14px)/3)}
  #band .gem{min-width:0;flex:1 1 calc((100% - 14px)/3);padding:7px 6px}
  /* the hit point box takes a whole row, and its numbers stay on one line */
  .hpgem{width:100%;margin-left:0;flex-wrap:wrap;justify-content:space-between;
    gap:8px 10px;padding:9px 11px}
  .hpgem .num{white-space:nowrap}
  .hpgem > div{flex:none}
  #hpin{width:58px}
  #defenceband{flex-direction:column}
}

/* on a phone, everything that lives along the bottom sits above the bar */
@media(max-width:760px){
  #panelbar{bottom:calc(72px + env(safe-area-inset-bottom,0px));
    max-width:calc(100vw - 100px);left:14px;transform:none}
  .asplayer{bottom:calc(72px + env(safe-area-inset-bottom,0px))}
  #stalebar{bottom:calc(62px + env(safe-area-inset-bottom,0px));
    flex-wrap:wrap;font-size:12.5px;padding:9px 12px}
  .panel{bottom:calc(128px + env(safe-area-inset-bottom,0px))!important;
    height:58vh!important}
  /* a dialog fills the screen above the bar rather than floating */
  #overlay{padding:10px 8px calc(70px + env(safe-area-inset-bottom,0px))}
  .sheetwrap{max-height:100%}
}

/* a map's name, written straight over */
.mapname{font:inherit;color:inherit;background:transparent;border:0;
  border-bottom:1.5px dashed transparent;padding:0 2px;margin:0 -2px;
  width:auto;min-width:6ch;max-width:100%;field-sizing:content}
.mapname:hover{border-bottom-color:var(--line)}
.mapname:focus{outline:none;border-bottom-color:var(--rule);background:var(--panel)}

/* ---- what just happened, said briefly along the bottom ---- */
#toast{position:fixed;left:50%;bottom:calc(24px + env(safe-area-inset-bottom,0px));
  transform:translate(-50%,14px);z-index:78;max-width:min(560px,calc(100vw - 110px));
  background:var(--slate);color:#f1ece1;border-radius:10px;padding:10px 16px;
  font-size:13.5px;line-height:1.45;box-shadow:0 8px 24px rgba(0,0,0,.35);
  opacity:0;pointer-events:none;transition:opacity .18s,transform .18s}
#toast.show{opacity:1;transform:translate(-50%,0)}
#toast.bad{background:var(--rule);color:#fff}
@media(max-width:760px){
  #toast{bottom:calc(74px + env(safe-area-inset-bottom,0px));
    left:14px;right:84px;transform:translateY(14px);max-width:none}
  #toast.show{transform:none}
}
@media(prefers-reduced-motion:reduce){#toast{transition:none}}

/* ---- jumping within the sheet, on a phone ---- */
#sheetjump{display:none}
@media(max-width:760px){
  #sheetjump{display:flex;gap:6px;overflow-x:auto;position:sticky;top:58px;z-index:30;
    padding:8px var(--gutter);background:var(--paper);
    border-bottom:1px solid var(--line);scrollbar-width:none;
    -webkit-overflow-scrolling:touch}
  #sheetjump::-webkit-scrollbar{display:none}
  #sheetjump button{flex:none;border:1px solid var(--line);border-radius:999px;
    padding:6px 13px;font-size:12.5px;background:var(--panel);white-space:nowrap}
  #sheetjump button:active{border-color:var(--rule);color:var(--rule)}
  #sheetjump button[hidden]{display:none}
}
/* =====================================================================
   THE DETAIL PANE
   A column at the right on a computer, rising from the bottom on a phone.
   Below the dice (65) and anything opened over it (60), above the sheet.
   ===================================================================== */
#detail{position:fixed;top:58px;right:0;bottom:0;width:min(430px,100vw);z-index:58;
  background:var(--panel);color:var(--ink);border-left:3px solid var(--rule);
  box-shadow:-10px 0 28px rgba(0,0,0,.18);display:flex;flex-direction:column;outline:none}
#detail[hidden],#detailscrim[hidden]{display:none}
#detail.in{animation:detailIn .18s ease-out}
@keyframes detailIn{from{transform:translateX(24px);opacity:.3}to{transform:none;opacity:1}}
#detailscrim{display:none}
#detail .dhead{display:flex;gap:12px;align-items:center;padding:14px 14px 12px 16px;
  border-bottom:1px solid var(--shade);background:var(--paper)}
#detail .dpic{flex:none;display:flex}
#detail .dimg{width:46px;height:46px;border-radius:8px;background:center/cover no-repeat;display:block}
#detail .dtitle{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}
#detail .dtitle b{font-family:var(--display);font-size:20px;font-weight:600;line-height:1.2}
#detail .dtitle small{font-size:12.5px;color:var(--muted)}
#detail .dclose{flex:none;width:36px;height:36px;border-radius:50%;font-size:16px;
  color:var(--muted);border:1px solid var(--line)}
#detail .dclose:hover{color:var(--ink);border-color:var(--rule-soft)}
#detail .dbody{flex:1;overflow-y:auto;overscroll-behavior:contain;
  padding:4px 0 110px;font-size:13.5px}
#detail .dactions{display:flex;gap:8px;flex-wrap:wrap;align-items:center;padding:14px 16px 4px}
#detail .dactions .btn{display:inline-flex;flex-direction:column;align-items:center;line-height:1.25}
#detail .dactions .btn small{font-size:10.5px;opacity:.75}
#detail .dactions .btn[disabled]{opacity:.45;cursor:default}
#detail .qty{display:inline-flex;align-items:center;gap:6px;border:1px solid var(--line);
  border-radius:8px;padding:2px 4px}
#detail .qty .num{width:30px;height:30px;border-radius:6px;font-size:17px;font-weight:600}
#detail .qty .num:hover{background:var(--shade)}
#detail .qty b{font-family:var(--num);min-width:20px;text-align:center}
#detail .drolls{display:flex;gap:10px;flex-wrap:wrap;align-items:center;padding:12px 16px 6px}
#detail .rollbig{display:flex;flex-direction:column;align-items:center;min-width:92px;
  padding:7px 12px;border:1.5px solid var(--line);border-radius:10px;background:var(--paper)}
#detail .rollbig:hover{border-color:var(--rule)}
#detail .rollbig small{font-size:10px;letter-spacing:.08em;text-transform:uppercase;color:var(--muted)}
#detail .rollbig b{font-family:var(--num);font-size:18px}
#detail .drolls .note{flex-basis:100%}
#detail .dnote{padding:10px 16px 0}
.dgroup{margin-top:14px;padding:7px 16px;background:var(--shade);font-size:10.5px;
  letter-spacing:.09em;text-transform:uppercase;color:var(--muted)}
.drow{display:flex;flex-wrap:wrap;gap:4px 12px;padding:8px 16px;
  border-bottom:1px solid var(--shade)}
.drow .k{flex:1;font-weight:600}
.drow .v{font-family:var(--num);text-align:right}
.drow.long .v{flex-basis:100%;text-align:left;font-family:inherit}
.drow .why{flex-basis:100%;color:var(--muted);font-size:12.5px;line-height:1.5}
.dtext{padding:12px 16px;line-height:1.65;white-space:pre-wrap}
#detail .dnotes{display:block;width:calc(100% - 32px);margin:10px 16px;padding:9px 10px;
  border:1px solid var(--line);border-radius:8px;background:var(--paper);resize:vertical;
  font-size:13.5px;line-height:1.5}
/* the one way an entry is shown: here, in Content and beside the editor */
.ev{font-size:13.5px}
.ev .abilrow{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:4px;
  padding:9px 16px;border-bottom:1px solid var(--shade);text-align:center;font-size:12.5px}
.ev .abilrow span{display:flex;flex-direction:column}
.ev .abilrow b{font-size:10.5px;letter-spacing:.08em;color:var(--muted)}
.ev .abilrow i{font-style:normal;color:var(--muted);font-size:11.5px}
.ev .evfeat{padding:10px 16px 0;border-bottom:1px solid var(--shade)}
.ev .evfeat>b{font-size:14px}
.ev .evfeat .dtext{padding:6px 0 11px}
.ev .evsub{border-bottom:1px solid var(--shade)}
.ev .evsub>summary{padding:10px 16px;cursor:pointer;font-size:14px}
.ev .evsub[open]>summary{background:rgba(143,43,35,.05)}
.ev .evsub .dtext{padding:6px 16px 10px}
.ev .evsub .evfeat{padding-left:26px}
.evhead{display:flex;gap:14px;align-items:center;padding:16px 16px 12px}
.evhead .evpic{flex:none;display:flex}
.evname{font-family:var(--display);font-size:22px;font-weight:600;line-height:1.2}
.evhead .tag{margin-top:6px;display:inline-block}
#detail .rollbig.still{cursor:default}
#detail .dfeature .paneline{border:none;padding:12px 16px}
#detail .dfeature .paneline>.hd{display:none}
#detail .dfeature .ftext{line-height:1.65;white-space:pre-wrap}

/* the rows that open it: they say so, and the open one is marked */
#pane [data-detail]{cursor:pointer}
#pane tr[data-detail]:hover td,#pane .act[data-detail]:hover,
#pane .paneline[data-detail]:hover{background:rgba(143,43,35,.045)}
#pane [data-detail].isopen td,#pane .act[data-detail].isopen,
#pane .paneline[data-detail].isopen{background:rgba(143,43,35,.09)}
#pane tr[data-detail].isopen td:first-child,#pane .act[data-detail].isopen,
#pane .paneline[data-detail].isopen{box-shadow:inset 3px 0 0 var(--rule)}
/* with the whole text a press away, the list shows the start of it */
#pane .act .sub,#pane .paneline .ftext{display:-webkit-box;-webkit-box-orient:vertical;
  -webkit-line-clamp:2;overflow:hidden}
#pane .paneline .ftext{-webkit-line-clamp:3}
@media print{#detail,#detailscrim{display:none!important}}
/* Three columns wide, the rows it opens from are in the one at the right,
   so it opens at the left instead — over the saving throws and resources,
   next to the list rather than on top of it. */
@media(min-width:1180px){
  #detail{right:auto;left:0;border-left:none;border-right:3px solid var(--rule);
    box-shadow:10px 0 28px rgba(0,0,0,.18)}
  #detail.in{animation-name:detailInLeft}
}
@keyframes detailInLeft{from{transform:translateX(-24px);opacity:.3}to{transform:none;opacity:1}}

@media(max-width:760px){
  #detailscrim{display:block;position:fixed;inset:0;z-index:57;background:rgba(20,16,12,.34)}
  #detail{top:auto;left:0;width:auto;max-height:84vh;max-height:84dvh;
    border-left:none;border-top:3px solid var(--rule);border-radius:16px 16px 0 0;
    box-shadow:0 -10px 28px rgba(0,0,0,.25)}
  #detail.in{animation:detailUp .2s ease-out}
  #detail .dhead{border-radius:16px 16px 0 0;position:relative;padding-top:20px}
  #detail .dhead::before{content:"";position:absolute;top:7px;left:50%;width:40px;height:4px;
    margin-left:-20px;border-radius:2px;background:var(--line)}
  #detail .dbody{padding-bottom:calc(120px + env(safe-area-inset-bottom,0px))}
}
@keyframes detailUp{from{transform:translateY(40px);opacity:.4}to{transform:none;opacity:1}}

/* ---------- starting something new ---------- */
.brewstart{display:grid;gap:12px;padding:16px}
.bigchoice{display:flex;flex-direction:column;gap:4px;text-align:left;border:1.5px solid var(--line);
  border-radius:12px;padding:15px 16px;background:var(--panel)}
button.bigchoice:hover{border-color:var(--rule)}
.bigchoice b{font-size:16px;font-family:var(--display)}
.bigchoice span{font-size:13px;color:var(--muted);line-height:1.5}

/* "read in full" in a list, and the pane when it is opened over a window */
.readbtn{flex:none;display:inline-grid;place-items:center;width:24px;height:24px;border-radius:50%;
  border:1.5px solid var(--line);color:var(--muted);font:600 12.5px/1 var(--display);font-style:italic;
  cursor:pointer;background:var(--panel);align-self:center}
.readbtn:hover,.readbtn:focus-visible{border-color:var(--rule);color:var(--rule);outline:none}
#detail.over{z-index:62}
#detailscrim.over{z-index:61}
@media(min-width:1180px){
  #detail.over{left:auto;right:0;border-right:none;border-left:3px solid var(--rule);
    box-shadow:-10px 0 28px rgba(0,0,0,.18)}
}
/* two lines of a long text in a list; the rest is a press away */
.clamp2{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden}
.pickrow{cursor:pointer;width:100%;text-align:left}
.pickrow:focus-visible{outline:2px solid var(--rule);outline-offset:-2px}
.pickrow .grow{min-width:0}
/* a shelf slot, with its "read in full" in the corner */
.slotwrap{position:relative;display:block;min-width:0}
.slotwrap>.slot{width:100%}
.slotwrap>.readbtn{position:absolute;top:4px;left:4px;z-index:2;width:20px;height:20px;font-size:11px;
  background:rgba(255,253,248,.92)}
/* the SRD's licence asks to be credited; it is, quietly, where the rules live */
.credit{max-width:760px;margin:28px auto 0;font-size:11.5px;line-height:1.55;color:var(--muted);text-align:center}
.credit a{color:inherit;text-decoration:underline}
/* ---------- a choice: cards to read and pick, or a dropdown ---------- */
.choicehead{font-size:11px;letter-spacing:.08em;text-transform:uppercase;color:var(--muted);
  margin:10px 0 6px;font-weight:600}
.pickcards{display:grid;gap:8px;margin:6px 0 4px;grid-template-columns:repeat(auto-fill,minmax(210px,1fr))}
.pickcard{display:flex;flex-direction:column;gap:3px;border:1.5px solid var(--line);border-radius:10px;
  padding:10px 12px 10px 34px;cursor:pointer;position:relative;background:var(--panel);font-size:13px;
  text-transform:none;letter-spacing:0;font-weight:400}
.pickcard input{position:absolute;left:11px;top:12px;accent-color:var(--rule);width:auto}
.pickcard b{font-size:14px}
.pickcard span{color:var(--muted);line-height:1.45}
.pickcard.on,.pickcard:has(input:checked){border-color:var(--rule);background:rgba(143,43,35,.06)}
.pickcard:hover{border-color:var(--rule-soft)}
.lvchoices{margin-top:8px}
.lvchoices select{border:1px solid var(--line);border-radius:7px;padding:6px;background:var(--panel);
  font:inherit;width:100%;margin-bottom:6px}
/* ---------- the grants and choices editor ---------- */
.grantwrap{padding:10px 13px;overflow:visible}
.grants{display:flex;flex-direction:column;gap:7px}
.grantshead{font-size:11px;letter-spacing:.08em;text-transform:uppercase;color:var(--muted);font-weight:600;margin:8px 0 2px}
.grant{display:flex;flex-wrap:wrap;gap:6px 8px;align-items:center;border:1px solid var(--line);
  border-radius:9px;padding:7px 9px;background:var(--panel)}
.grant select,.grant input,.choicerow input,.choicerow select,.choiceopts select,.choiceopts input:not([type=checkbox]),
.optrow textarea{border:1px solid var(--line);border-radius:7px;padding:5px 7px;background:var(--panel);font:inherit;font-size:13px}
.grant .grantkind{flex:1 1 230px;min-width:0;font-weight:600}
.grant .grantbody{display:flex;flex-wrap:wrap;gap:6px;align-items:center;flex:1 1 260px;font-size:13px}
.grant .grantbody input:not([type]),.grant .grantbody input[list]{flex:1;min-width:120px}
.grantlvl{font-size:11.5px;color:var(--muted);display:inline-flex;gap:4px;align-items:center}
.btn.mini{padding:4px 9px;font-size:12.5px;font-family:inherit;min-width:0;text-align:center}
.btn.mini.add{align-self:flex-start;border-style:dashed}
.tick{display:inline-flex;gap:4px;align-items:center;font-size:12.5px;margin-right:6px}
.tick input{width:auto;accent-color:var(--rule)}
.choices{display:flex;flex-direction:column;gap:9px}
.choice-ed{border:1.5px solid var(--line);border-radius:10px;padding:9px;background:rgba(0,0,0,.015)}
.choicerow{display:flex;flex-wrap:wrap;gap:6px 8px;align-items:center}
.choicerow input:not([type=number]){flex:1 1 200px;min-width:0}
.choiceopts{margin-top:8px;font-size:13px;display:flex;flex-wrap:wrap;gap:6px;align-items:center}
.choiceopts>.optrow{flex-basis:100%;border-left:3px solid var(--line);padding:4px 0 6px 10px;display:flex;
  flex-direction:column;gap:6px}
.optrow textarea{width:100%;resize:vertical}
.grantbox{margin-top:8px;border:1px dashed var(--line);border-radius:9px;padding:6px 10px}
.grantbox>summary{cursor:pointer;font-size:12.5px;font-weight:600;color:var(--muted)}
.grantbox>summary .n{font-family:var(--num);margin-left:4px;color:var(--rule)}
.grantbox[open]>summary{margin-bottom:6px}
.evgrants{display:flex;flex-wrap:wrap;gap:6px;padding:9px 16px}
.evfeat .evgrants{padding:0 0 10px}
.evgrants span{background:rgba(143,43,35,.07);border:1px solid rgba(143,43,35,.18);border-radius:999px;
  padding:3px 10px;font-size:12.5px}
.evchoice{padding:6px 16px 10px;font-size:13px}
.evfeat .evchoice{padding:0 0 10px}
.evchoice ul{margin:6px 0 0 18px;display:flex;flex-direction:column;gap:4px}
.evchoice li{line-height:1.45}

/* a search line over any list in the overlay */
.findbar{flex-wrap:wrap;position:sticky;top:0;z-index:2;background:var(--panel)}
.findbar input{min-width:200px;font:inherit}
.findchips{display:flex;flex-wrap:wrap;gap:6px;width:100%}
.findchips .chip{border:1px solid var(--line);color:var(--ink);background:var(--panel);
  border-radius:999px;padding:4px 11px;font-size:12.5px}
.findchips .chip:hover{border-color:var(--rule)}
.findchips .chip.on{background:var(--rule);border-color:var(--rule);color:#fff}

/* ---------- encounters ---------- */
.encgrid{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.15fr);gap:16px;align-items:start}
.enccol{display:flex;flex-direction:column;gap:16px;min-width:0}
@media (max-width:900px){.encgrid{grid-template-columns:1fr}}
.encpartyrow input[type=number]{width:62px;border:1px solid var(--line);border-radius:7px;padding:5px 7px;font:inherit;background:var(--panel)}
.encpartyrow select,.encsel select,.encline select,.encplace select{border:1px solid var(--line);border-radius:7px;
  padding:5px 7px;font:inherit;background:var(--panel)}
.encaim{gap:6px}
.encmeter{position:relative;height:12px;border-radius:6px;background:var(--shade);margin:6px 0 8px;overflow:visible}
.encmeter .z{position:absolute;top:0;bottom:0}
.encmeter .z.low{left:0;background:#b9c9a3;border-radius:6px 0 0 6px}
.encmeter .z.mod{background:#e3c77e}
.encmeter .z.high{background:#d99173}
.encmeter .mark{position:absolute;top:-4px;bottom:-4px;width:3px;margin-left:-1px;background:var(--ink);border-radius:2px}
.encnums{display:flex;gap:12px;align-items:baseline;flex-wrap:wrap}
.encnums b{font-size:15px}
.encnums .d-high,.encnums .d-deadly{color:var(--rule)}
.encline{flex-wrap:wrap}
.enccount{display:flex;align-items:center;gap:6px}
.enccount b{min-width:18px;text-align:center}
.encname{border:1px solid transparent;border-radius:6px;padding:3px 6px;font:inherit;font-weight:600;
  background:transparent;width:100%;max-width:280px}
.encname:hover,.encname:focus{border-color:var(--line);background:var(--panel)}
.encline .sub{display:block;padding-left:6px}
.encplace{gap:8px;flex-wrap:wrap}
.encfilters .findchips .chip small{opacity:.6;margin-left:3px}
.encsel{display:flex;flex-wrap:wrap;gap:8px;align-items:center;width:100%;font-size:13px}
.enclist{max-height:70vh;overflow-y:auto}
.enccr{min-width:34px;text-align:center;font-size:12px;font-weight:600;border:1px solid var(--line);
  border-radius:6px;padding:3px 4px;color:var(--muted)}
.encrow .tag{font-size:10px;letter-spacing:.06em;text-transform:uppercase;color:var(--rule);
  border:1px solid var(--rule);border-radius:4px;padding:0 4px;margin-left:4px}
.encname::placeholder{color:var(--ink);opacity:1}
.encsel .tick input{width:auto;margin:0}
.encline .btn.mini,.enccount .btn.mini{min-width:28px}
.findbar input[type=checkbox]{min-width:0;flex:none;border:none;padding:0}
@media (max-width:640px){
  #encounters .pagehead{flex-wrap:wrap;gap:6px 14px}
  #encounters .pagehead .note{flex-basis:100%;order:3;padding-bottom:0}
  #encounters .pagehead .btn{padding:6px 11px;font-size:12.5px}
  .encline .grow{flex-basis:100%;order:-1}
  .encline .encname{max-width:none}
  .encsel{font-size:12.5px}
}

/* a creature's token: its kind as a white shape on its kind's colour */
.token.creature .tokglyph{display:block;pointer-events:none}
.token .tokno{position:absolute;right:-5px;bottom:-5px;min-width:15px;height:15px;padding:0 3px;
  border-radius:8px;background:var(--slate,#24211c);color:#fff;font-size:9.5px;line-height:15px;
  text-align:center;font-weight:700;border:1px solid var(--panel)}
.token .tokcrown{position:absolute;left:-6px;top:-7px;font-size:13px;color:#e0b83a;
  text-shadow:0 1px 2px rgba(0,0,0,.6)}
.token.sp-boss{border-color:#e0b83a;box-shadow:0 0 0 2px #e0b83a,0 2px 6px rgba(0,0,0,.4)}
.token.sp-elite{border-color:#c9a227}

/* =====================================================================
   HANDOUTS
   ===================================================================== */
.handoutpic{width:96px;height:96px;flex:none;border:2px dashed var(--line);border-radius:10px;
  display:grid;place-items:center;text-align:center;font-size:11.5px;color:var(--muted);cursor:pointer;
  background-size:cover;background-position:center}
.handoutimg{display:block;padding:14px 16px 0}
.handoutimg img{display:block;max-width:100%;max-height:62vh;margin:0 auto;border-radius:8px;
  box-shadow:0 3px 14px rgba(0,0,0,.25)}
.handouttext{white-space:pre-wrap;font-size:15px;line-height:1.55;padding:14px 18px}

/* =====================================================================
   PAPER: the printed sheet and spell cards
   ===================================================================== */
#printarea{display:none}
@media print{
  body.printing > *:not(#printarea){display:none!important}
  body.printing{background:#fff!important;margin:0}
  body.printing #printarea{display:block!important}
  @page{size:A4;margin:8mm}
}
.paper{font:8.6pt/1.35 Georgia,"Times New Roman",serif;color:#111;background:#fff}
.paper h1{font-size:21pt;margin:0;line-height:1.1}
.paper h2{font-size:13pt;margin:0 0 6px;border-bottom:1.5px solid #111;padding-bottom:2px}
.paper h3{font:700 7.4pt/1.2 system-ui,sans-serif;letter-spacing:.12em;text-transform:uppercase;
  margin:0 0 4px;color:#333;border-bottom:1px solid #999;padding-bottom:2px}
.paper h4{font:700 9pt/1.2 Georgia,serif;margin:8px 0 3px;column-span:all}
.paper i{font-style:normal;color:#555}
.ppage{break-after:page;page-break-after:always}
.ppage:last-of-type{break-after:auto;page-break-after:auto}
.phead{display:flex;justify-content:space-between;align-items:flex-end;gap:14px;
  border-bottom:2.5px solid #111;padding-bottom:6px;margin-bottom:9px}
.pmeta{display:flex;flex-wrap:wrap;gap:4px 14px}
.pmeta span{display:flex;flex-direction:column;min-width:70px}
.pmeta i{font:7pt system-ui,sans-serif;text-transform:uppercase;letter-spacing:.08em}
.pgrid1{display:grid;grid-template-columns:1.05fr 1.15fr 1.9fr;gap:10px}
.pgrid2{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-top:10px}
.pabil{display:flex;flex-direction:column;gap:5px;margin-bottom:9px}
.pab{border:1.5px solid #111;border-radius:7px;text-align:center;padding:3px 2px}
.pab span{display:block;font:7pt system-ui,sans-serif;text-transform:uppercase;letter-spacing:.08em}
.pab b{display:block;font-size:17pt;line-height:1.1}
.pab i{display:inline-block;border:1px solid #111;border-radius:9px;padding:0 7px;font-size:8.5pt;color:#111}
.pcore{display:grid;grid-template-columns:1fr 1fr;gap:5px;margin-bottom:9px}
.pbox{border:1.5px solid #111;border-radius:6px;padding:3px 5px;text-align:center}
.pbox b{display:block;font-size:13pt}
.pbox span{display:block;font:6.8pt system-ui,sans-serif;text-transform:uppercase;letter-spacing:.07em}
.pbox i{display:block;font-size:7pt}
.plist{border:1.2px solid #111;border-radius:6px;padding:5px 6px;margin-bottom:9px}
.plist > div{display:flex;align-items:center;gap:5px;padding:1px 0;border-bottom:.5px dotted #bbb}
.plist > div:last-child{border-bottom:none}
.plist span{flex:1}
.plist .ppip{flex:none}
.plist b{min-width:22px;text-align:right}
.ppip{flex:none;width:8px;height:8px;border:1.2px solid #111;border-radius:50%;display:inline-block}
.ppip.on{background:#111}
.ppip.exp{background:#111;box-shadow:0 0 0 1.5px #fff,0 0 0 2.6px #111}
.pdeath{font-size:7.6pt;margin-top:4px;display:block!important;border:none!important}
.pblock{border:1.2px solid #111;border-radius:6px;padding:5px 7px;margin-bottom:9px;break-inside:avoid}
.ptable{width:100%;border-collapse:collapse;font-size:8.2pt}
.ptable th{font:700 6.8pt system-ui,sans-serif;text-transform:uppercase;letter-spacing:.06em;text-align:left;
  border-bottom:1px solid #111;padding:2px 3px}
.ptable td{border-bottom:.5px solid #ccc;padding:2px 3px;vertical-align:top}
.pkv{margin:2px 0}
.pkv i{font:700 6.8pt system-ui,sans-serif;text-transform:uppercase;letter-spacing:.07em;margin-right:5px}
.pinline{display:inline-block;margin-right:10px}
.pres{display:flex;gap:6px;align-items:baseline;padding:1px 0}
.pres span{flex:1}
.pres em{font-style:normal;letter-spacing:1px}
.pres i{font-size:7pt}
.pcols{column-count:2;column-gap:14px}
.pfeat{break-inside:avoid;margin:0 0 6px}
.pfeat .ptext{white-space:pre-wrap;font-size:8pt}
.pchosen{font-size:8pt;margin-top:1px}
.pslots{display:flex;flex-wrap:wrap;gap:4px 14px;margin:4px 0 6px;font-size:10pt;letter-spacing:1px}
.pslots i{font:6.8pt system-ui,sans-serif;text-transform:uppercase;letter-spacing:.06em;margin-right:4px}
.pnote{font-size:7pt;color:#555;margin-top:3px}
.pcoins{display:flex;gap:10px;margin-bottom:5px}
.pcoins span{border:1px solid #111;border-radius:5px;padding:1px 6px;text-align:center;min-width:34px}
.pcoins i{display:block;font:6.6pt system-ui,sans-serif}
.plines{height:90px;background:repeating-linear-gradient(#fff 0 17px,#bbb 17px 18px)}
.pfoot{font-size:7pt;color:#666;text-align:right;margin-top:6px}
/* spell cards: 63 × 88 mm, nine to an A4 page */
.paper.cards{display:grid;grid-template-columns:repeat(3,63mm);gap:2mm;justify-content:center}
.paper.cards .pcard:nth-child(9n){break-after:page}
.pcard{width:63mm;height:88mm;border:1.2px solid #111;border-radius:3mm;padding:2.6mm;box-sizing:border-box;
  display:flex;flex-direction:column;break-inside:avoid;overflow:hidden}
.pcardhead b{display:block;font-size:10pt;line-height:1.15}
.pcardhead i{font-size:7pt}
.pcardfacts{display:grid;grid-template-columns:1fr 1fr;gap:1px 6px;font-size:7pt;margin:3px 0;
  border-top:1px solid #111;border-bottom:1px solid #111;padding:2px 0}
.pcardfacts i{display:block;font:6pt system-ui,sans-serif;text-transform:uppercase;letter-spacing:.05em}
.pcardtext{flex:1;white-space:pre-wrap;font-size:6.6pt;line-height:1.28;overflow:hidden}
.pcardfoot{font-size:6.2pt;color:#555;border-top:.5px solid #999;padding-top:1px;margin-top:2px}
.field textarea{border:1px solid var(--line);border-radius:8px;padding:8px 11px;background:var(--panel);
  font:inherit;line-height:1.45;resize:vertical}

/* =====================================================================
   THE CREATURE BUILDER
   ===================================================================== */
#cbuild{padding-bottom:96px}
#cbBody{display:grid;gap:22px;grid-template-columns:1fr;max-width:1500px;margin:0 auto;padding:22px var(--gutter) 70px}
@media(min-width:1000px){#cbBody{grid-template-columns:200px minmax(0,1fr) 290px}}
@media(min-width:1000px){#cbhints{position:sticky;top:80px;align-self:start}}
@media(max-width:999px){#cbhints{order:-1}}
.cbh1{font-size:24px;margin-bottom:6px}
.cbh2{font-size:17px;margin:22px 0 8px}
.cbintro{margin-bottom:16px;line-height:1.5}
.cbgrid{display:grid;grid-template-columns:repeat(auto-fit,minmax(210px,1fr));gap:12px 16px}
.cbfield{display:flex;flex-direction:column;gap:5px}
.cbfield.wide{grid-column:1/-1}
.cbfield > span{font-size:10px;letter-spacing:.09em;text-transform:uppercase;color:var(--muted)}
.cbfield > span i{font-style:normal;text-transform:none;letter-spacing:0;color:var(--rule)}
#cbstep input:not([type=checkbox]):not([type=file]),#cbstep select,#cbstep textarea{border:1px solid var(--line);border-radius:8px;
  padding:7px 10px;background:var(--panel);font:inherit;min-width:0}
#cbstep textarea{width:100%;resize:vertical;line-height:1.45}
.cbstartfrom{display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin:-4px 0 18px;padding:10px 12px;
  border:1px dashed var(--line);border-radius:10px}
.cbstartfrom input{flex:1;min-width:180px}
.cbroles{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:0 12px;margin-top:16px}
.cbusual{display:flex;flex-wrap:wrap;gap:8px;padding:10px 12px}
.cbusual span{border:1px solid var(--line);border-radius:8px;padding:5px 10px;display:flex;flex-direction:column;min-width:92px}
.cbusual i{font-style:normal;font-size:9.5px;letter-spacing:.08em;text-transform:uppercase;color:var(--muted)}
.cbabil{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:10px}
.cbab{border:1.5px solid var(--line);border-radius:10px;padding:9px 10px;text-align:center;background:var(--panel)}
.cbab > span{display:block;font-size:10px;letter-spacing:.09em;text-transform:uppercase;color:var(--muted)}
.cbab > div{display:flex;gap:4px;justify-content:center;align-items:center;margin:5px 0}
.cbab input{text-align:center}
.cbab > b{display:block;font-size:20px}
.cbab .tick{justify-content:center;margin-top:4px}
.cbskills{display:grid;grid-template-columns:repeat(auto-fit,minmax(250px,1fr));gap:4px 16px;padding:10px 12px}
.cbskills label{display:flex;gap:8px;align-items:center}
.cbskills label span{flex:1}
.cbskills label i{font-style:normal;color:var(--muted);font-size:11px}
.cbskills b{min-width:28px;text-align:right}
.cbinline{display:flex;flex-wrap:wrap;gap:10px 18px;align-items:flex-end;padding:10px 12px}
.cbinline label{display:flex;flex-direction:column;gap:4px;font-size:12.5px}
.cbinline label.tick{flex-direction:row;align-self:center}
.cbchipsrow{display:flex;gap:10px;align-items:flex-start;padding:8px 12px;border-bottom:1px solid var(--shade)}
.cbchipsrow > span{min-width:84px;font-size:12px;color:var(--muted);padding-top:5px}
.cbpart{padding:10px 12px;margin-bottom:10px}
.cbpart.plain{border:none;box-shadow:none;border-bottom:1px solid var(--shade);border-radius:0;margin:0}
.cbpartrow{display:flex;flex-wrap:wrap;gap:6px 8px;align-items:center;margin-bottom:7px}
.cbpartrow > span{font-size:12.5px;color:var(--muted)}
.cbname{font-weight:600;flex:1;min-width:160px}
.cbrider{flex:1;min-width:240px}
.cbout{font-size:13px;font-weight:600;color:var(--rule)}
.cbhintframe .cbhintrows > div{display:grid;grid-template-columns:22px 1fr auto;gap:0 8px;align-items:baseline;
  padding:6px 12px;border-bottom:1px solid var(--shade)}
.cbhintrows b{text-align:right;font-size:15px}
.cbhintrows i{grid-column:2/-1;font-style:normal;font-size:11.5px;color:var(--muted)}
.cbtick{display:inline-grid;place-items:center;width:18px;height:18px;border-radius:50%;font-size:11px;font-weight:700;flex:none}
.cbtick.ok{background:var(--good);color:#fff}
.cbtick.no{background:#d99a2b;color:#fff}
.cbplays{padding:10px 12px;border-bottom:1px solid var(--shade)}
.cbplays > div:first-child{display:flex;justify-content:space-between;align-items:baseline}
.cbplays b{font-size:19px}
.cbhere{display:flex;gap:12px;align-items:center;flex-wrap:wrap;padding:10px 14px;margin:-6px 0 16px;
  border:1px dashed var(--rule-soft);border-radius:10px;font-size:13.5px}
.bigchoice.recommended{border-color:var(--rule);border-width:2px}
.cbpreview .ev{padding:4px 2px 10px}
.cbdet > summary{display:flex;justify-content:space-between;align-items:baseline;gap:8px;padding:8px 12px;
  cursor:pointer;border-bottom:1px solid var(--shade);list-style:none}
.cbdet > summary::-webkit-details-marker{display:none}
.cbdet > summary b{font-size:16px}
@media(min-width:1000px){.cbdet > summary{display:none}}

/* ---------- companions ---------- */
#compband{padding:0 var(--gutter) 14px}
.compband{display:flex;gap:10px;align-items:stretch;flex-wrap:wrap}
.complabel{align-self:center;font-size:10.5px;letter-spacing:.1em;text-transform:uppercase;
  color:var(--muted);margin-right:2px}
.compcard{display:flex;align-items:center;gap:9px;background:var(--panel);border:1.5px solid var(--line);
  border-radius:12px;padding:6px 10px 6px 7px;min-height:52px;position:relative;color:var(--ink);font:inherit}
.compcard.down{opacity:.6;border-style:dashed}
.compcard.offer,.compcard.add{border-style:dashed;cursor:pointer;background:transparent}
.compcard.add{color:var(--rule);font-weight:600;padding:6px 14px}
.compcard .plus{font-size:20px;color:var(--rule);width:30px;text-align:center}
.compmain{display:flex;align-items:center;gap:8px;background:none;border:none;padding:0;
  font:inherit;color:inherit;cursor:pointer;text-align:left;min-width:0}
.compname{display:flex;flex-direction:column;min-width:0}
.compname b{font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:170px}
.compname .sub{font-size:11px;color:var(--muted);white-space:nowrap}
.comphp{display:flex;align-items:center;gap:4px;position:relative;padding-bottom:5px;
  border-left:1px solid var(--line);padding-left:9px;margin-left:2px}
.comphp button{width:24px;height:24px;border-radius:50%;border:1px solid var(--line);background:var(--panel);
  color:var(--ink);font-size:15px;line-height:1;cursor:pointer;padding:0}
.comphp button:hover{border-color:var(--rule);color:var(--rule)}
.comphp .num{font-family:var(--num);font-weight:700;font-size:15px;min-width:44px;text-align:center}
.comphp .num small{font-weight:400;opacity:.6;font-size:11px}
.comphp .num small.tmp{color:var(--good);opacity:1}
.comphp .bar{position:absolute;left:9px;right:0;bottom:0;height:3px;border-radius:2px;background:var(--shade)}
.comphp .bar i{display:block;height:100%;border-radius:2px;background:var(--good)}
.comphp .bar i.hurt{background:var(--gold)}
.comphp .bar i.bad{background:var(--rule)}
.compconds{position:absolute;top:-8px;right:8px;display:flex;gap:3px}
.compconds i{font-style:normal;font-size:9.5px;background:var(--rule);color:#fff;border-radius:6px;padding:1px 5px}
.comphead{display:flex;gap:12px;align-items:center;padding:14px 16px 8px}
.compnamein{font:inherit;font-size:19px;font-weight:700;border:none;border-bottom:1.5px dashed var(--line);
  background:transparent;color:var(--ink);width:100%;padding:2px 0}
.comphead .sub{font-size:12px;color:var(--muted);margin-top:3px}
.compstats{display:grid;grid-template-columns:repeat(4,1fr);gap:8px;padding:8px 13px 10px}
.compstats>*{border:1.5px solid var(--line);border-radius:10px;padding:7px 4px;text-align:center;
  background:var(--panel);color:var(--ink);font:inherit;display:flex;flex-direction:column;gap:2px}
.compstats b{font-family:var(--num);font-size:17px}
.compstats span{font-size:10px;letter-spacing:.07em;text-transform:uppercase;color:var(--muted)}
.compstats button{cursor:pointer}.compstats button:hover{border-color:var(--rule)}
.compgrid{display:grid;grid-template-columns:repeat(auto-fill,minmax(88px,1fr));gap:6px;padding:8px 13px 10px}
.compgrid button{display:flex;justify-content:space-between;align-items:center;gap:6px;border:1px solid var(--line);
  border-radius:8px;padding:6px 9px;background:var(--panel);color:var(--ink);font:inherit;font-size:12.5px;cursor:pointer}
.compgrid button:hover{border-color:var(--rule);color:var(--rule)}
.compgrid b{font-family:var(--num)}
.linkish{background:none;border:none;padding:0;font:inherit;color:inherit;cursor:pointer;text-align:left}
.linkish:hover b,.linkish:hover .hd{color:var(--rule)}
@media(max-width:600px){.compstats{grid-template-columns:repeat(2,1fr)}.compname b{max-width:120px}}

/* =====================================================================
   MORE OF THE LOOK
   Each choice is a class on the page (Theme.apply sets exactly one of
   each kind), so everything here is plain CSS over the same variables.
   ===================================================================== */
/* ---------- headings ---------- */
body.heads-plain .frame>h2{text-transform:none;letter-spacing:.01em;font-size:15px;
  color:var(--ink);text-align:left;padding-left:14px;font-family:var(--display)}
body.heads-banner .frame>h2{background:var(--rule);color:var(--rule-ink);border-bottom:none;
  border-radius:max(0px,calc(var(--frameR,10px) - 3px)) max(0px,calc(var(--frameR,10px) - 3px)) 0 0}
body.heads-banner .frame>h2 em,body.heads-banner .frame>h2 em button{color:inherit;opacity:.9}
body.heads-script .frame>h2{text-transform:none;letter-spacing:.01em;font-style:italic;
  font-size:17px;color:var(--rule);font-family:var(--display);font-weight:600}
body.heads-banner .frame .foot,body.heads-plain .frame .foot{letter-spacing:.06em}
/* ---------- depth ---------- */
body.depth-flat .frame,body.depth-flat .compcard,body.depth-flat .charcard{box-shadow:none}
body.depth-raised .frame,body.depth-raised .charcard{box-shadow:0 1px 2px rgba(0,0,0,.08),0 8px 22px rgba(0,0,0,.13)}
body.depth-raised .shield,body.depth-raised .gem,body.depth-raised .compcard{box-shadow:0 4px 12px rgba(0,0,0,.12)}
body.depth-raised.dark .frame,body.depth-raised.dark .charcard{box-shadow:0 8px 26px rgba(0,0,0,.5)}
/* ---------- ability scores ---------- */
body.scores-medallion .shield{width:86px;height:92px;border-radius:50%;display:flex;
  flex-direction:column;align-items:center;justify-content:center;padding:4px}
body.scores-medallion .shield small{margin-top:2px}
body.scores-square .shield{border-radius:5px}
body.scores-pill .shield{border-radius:30px;padding:9px 4px 8px}
body.scores-square .gem{border-radius:5px}
body.scores-pill .gem{border-radius:30px}
/* ---------- the bars ---------- */
body.bar-accent .topbar,body.bar-accent #sheetTop{background:var(--rule);color:var(--rule-ink)}
body.bar-accent .topbar nav button,body.bar-accent #tabbar button{color:color-mix(in srgb,var(--rule-ink) 72%,transparent)}
body.bar-accent .topbar nav button[aria-current=true],body.bar-accent .topbar nav button:hover{
  color:var(--rule-ink);border-bottom-color:var(--rule-ink)}
body.bar-accent .topbar .chip,body.bar-accent #sheetTop .chip{color:var(--rule-ink);
  border-color:color-mix(in srgb,var(--rule-ink) 42%,transparent)}
body.bar-light .topbar,body.bar-light #sheetTop{background:var(--panel);color:var(--ink);
  box-shadow:0 1px 0 var(--line),0 4px 14px rgba(0,0,0,.05)}
body.bar-light .topbar nav button,body.bar-light #tabbar button{color:var(--muted)}
body.bar-light .topbar nav button[aria-current=true],body.bar-light .topbar nav button:hover{
  color:var(--ink);border-bottom-color:var(--rule)}
body.bar-light .topbar .chip,body.bar-light #sheetTop .chip{color:var(--ink);border-color:var(--line)}
body.bar-light .topbar nav .navgap{background:var(--line)}
body.bar-light #sheetTop{border-bottom:1px solid var(--line)}
@media(max-width:760px){
  body.bar-accent #tabbar{background:var(--rule)}
  body.bar-accent #tabbar button[aria-current=true]{color:var(--rule-ink);background:rgba(255,255,255,.14)}
  body.bar-accent #tabbar button[aria-current=true] i{color:var(--rule-ink)}
  body.bar-light #tabbar{background:var(--panel);border-top:1px solid var(--line)}
  body.bar-light #tabbar button[aria-current=true]{color:var(--ink);background:var(--shade)}
  body.bar-light #tabbar button[aria-current=true] i{color:var(--rule)}
}
/* ---------- portraits ---------- */
body.portrait-circle #sheetTop .por,body.portrait-circle .charcard .por,body.portrait-circle .comphead .itemicon{border-radius:50%}
body.portrait-square #sheetTop .por,body.portrait-square .charcard .por{border-radius:2px}
body.portrait-hex #sheetTop .por,body.portrait-hex .charcard .por{border-radius:0;
  clip-path:polygon(25% 3%,75% 3%,100% 50%,75% 97%,25% 97%,0 50%)}
/* ---------- behind everything ---------- */
body.pattern-dots{background-image:radial-gradient(color-mix(in srgb,var(--ink) 11%,transparent) 1.1px,transparent 1.6px);
  background-size:18px 18px}
body.pattern-hex{background-image:
  linear-gradient(30deg,color-mix(in srgb,var(--ink) 6%,transparent) 12%,transparent 12.5%,transparent 87%,color-mix(in srgb,var(--ink) 6%,transparent) 87.5%),
  linear-gradient(150deg,color-mix(in srgb,var(--ink) 6%,transparent) 12%,transparent 12.5%,transparent 87%,color-mix(in srgb,var(--ink) 6%,transparent) 87.5%),
  linear-gradient(90deg,color-mix(in srgb,var(--ink) 4%,transparent) 2%,transparent 2.5%,transparent 97%,color-mix(in srgb,var(--ink) 4%,transparent) 97.5%);
  background-size:36px 62px}
body.pattern-lines{background-image:repeating-linear-gradient(180deg,transparent 0 27px,color-mix(in srgb,var(--rule) 13%,transparent) 27px 28px),
  linear-gradient(90deg,transparent 58px,color-mix(in srgb,var(--rule) 18%,transparent) 58px 59px,transparent 59px)}
body.pattern-stone{background-image:
  radial-gradient(ellipse 40% 30% at 20% 30%,color-mix(in srgb,var(--ink) 6%,transparent),transparent 70%),
  radial-gradient(ellipse 35% 25% at 75% 20%,color-mix(in srgb,var(--ink) 5%,transparent),transparent 70%),
  radial-gradient(ellipse 45% 35% at 60% 80%,color-mix(in srgb,var(--ink) 6%,transparent),transparent 70%),
  radial-gradient(ellipse 30% 25% at 15% 85%,color-mix(in srgb,var(--ink) 5%,transparent),transparent 70%);
  background-size:260px 220px}
body.pattern-stars{background-image:
  radial-gradient(1.2px 1.2px at 12% 18%,color-mix(in srgb,var(--ink) 40%,transparent),transparent),
  radial-gradient(1px 1px at 38% 72%,color-mix(in srgb,var(--ink) 30%,transparent),transparent),
  radial-gradient(1.6px 1.6px at 67% 34%,color-mix(in srgb,var(--rule) 55%,transparent),transparent),
  radial-gradient(1px 1px at 84% 86%,color-mix(in srgb,var(--ink) 35%,transparent),transparent),
  radial-gradient(1.3px 1.3px at 52% 8%,color-mix(in srgb,var(--ink) 30%,transparent),transparent),
  radial-gradient(1px 1px at 92% 52%,color-mix(in srgb,var(--ink) 25%,transparent),transparent);
  background-size:230px 230px}
body.pattern-diamonds{background-image:
  linear-gradient(45deg,color-mix(in srgb,var(--rule) 6%,transparent) 25%,transparent 25%,transparent 75%,color-mix(in srgb,var(--rule) 6%,transparent) 75%),
  linear-gradient(45deg,color-mix(in srgb,var(--rule) 6%,transparent) 25%,transparent 25%,transparent 75%,color-mix(in srgb,var(--rule) 6%,transparent) 75%);
  background-size:28px 28px;background-position:0 0,14px 14px}
body.pattern-none{background-image:none}
/* ---------- width ---------- */
body.width-centered :is(.page,#sheet,#build,#edit,#cbuild,#account){max-width:1240px;
  margin-left:auto;margin-right:auto}
/* ---------- movement ---------- */
body.motion-reduced *,body.motion-reduced *::before,body.motion-reduced *::after{
  animation-duration:.01ms!important;animation-iteration-count:1!important;
  transition-duration:.01ms!important;scroll-behavior:auto!important}
/* ---------- the pickers for all of it ---------- */
.presetrow{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:9px;padding:12px 13px}
.presetcard{border:2px solid var(--line);border-radius:11px;overflow:hidden;background:var(--panel);
  text-align:left;padding:0;color:var(--ink);font:inherit;cursor:pointer}
.presetcard[aria-pressed=true]{border-color:var(--rule)}
.presetcard .pv{height:62px;position:relative;overflow:hidden}
.presetcard .pv .bar{height:13px}
.presetcard .pv .card{position:absolute;left:10px;right:34px;top:21px;bottom:7px;border-width:1.5px;border-style:solid}
.presetcard .pv .dot{position:absolute;right:9px;top:23px;width:18px;height:18px;border-radius:50%}
.presetcard .nm{display:block;padding:7px 9px 1px;font-weight:600;font-size:13px}
.presetcard .d{display:block;padding:0 9px 8px;font-size:11px;color:var(--muted)}
.lookgroup{border-top:1px solid var(--shade)}
.lookgroup>summary{list-style:none;cursor:pointer;padding:9px 13px;font-size:11px;letter-spacing:.09em;
  text-transform:uppercase;background:var(--shade);display:flex;align-items:center;gap:8px}
.lookgroup>summary::-webkit-details-marker{display:none}
.lookgroup>summary::after{content:"▾";margin-left:auto;transition:transform .15s}
.lookgroup:not([open])>summary::after{transform:rotate(-90deg)}
.lookgroup>summary .now{text-transform:none;letter-spacing:0;color:var(--muted);font-size:12px}
.lookopts{display:flex;flex-wrap:wrap;gap:6px;padding:4px 13px 12px}
.lookline{padding:9px 13px 0;font-size:12.5px;color:var(--muted)}
.patternsample{width:26px;height:18px;border-radius:4px;border:1px solid var(--line);display:inline-block;
  vertical-align:middle;margin-right:6px;background-color:var(--paper)}
