/* Campaign Forge — phone first. Layout is a single column with a sticky bar and
   a bottom tab strip sized for thumbs; wider screens get a two-column dashboard. */
:root {
  --bg: #14161b;
  --bg-2: #1b1e25;
  --bg-3: #22262f;
  --line: #333a47;
  --ink: #e8e4dc;
  --ink-dim: #a7a293;
  --ink-faint: #757062;
  --red: #a4232b;
  --red-bright: #d4353f;
  --gold: #c8a250;
  --green: #4f9d69;
  --blue: #5b8bbd;
  --radius: 12px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --tap: 44px;                       /* minimum comfortable touch target */
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
/* The `hidden` attribute is how this app hides things, and the UA rule behind it is
   only `display: none` at the lowest specificity — so any class that sets `display`
   (`.bar` and `.tabs` are both flex) silently defeats it. That left the top bar on the
   login screen and the bottom tab strip across the DM's desk layout, and it is why
   `.sheet-back[hidden]` and `.toast[hidden]` each grew their own rule. One rule for
   all of them instead. */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overscroll-behavior-y: contain;
}
h1, h2, h3, h4 { font-family: var(--serif); margin: 0; font-weight: 600; }
a { color: var(--gold); }

/* --------------------------------------------------------------- top bar */
.bar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 10px;
  padding: max(10px, env(safe-area-inset-top)) 12px 10px;
  background: #171a21ee; backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.bar-title { flex: 1; min-width: 0; }
.bar-title strong { display: block; font-family: var(--serif); font-size: 16px; }
.bar-title small { display: block; color: var(--ink-faint); font-size: 11.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-right { display: flex; align-items: center; gap: 6px; }
.icon-btn {
  width: var(--tap); height: var(--tap); flex: none; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg-3); color: var(--ink);
  font-size: 19px; line-height: 1; cursor: pointer;
}
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ink-faint); }
.dot.live { background: var(--green); box-shadow: 0 0 8px #4f9d69aa; }
.dot.down { background: var(--red-bright); }

/* ----------------------------------------------------------------- layout */
.view { padding: 14px 12px calc(84px + var(--safe-b)); max-width: 1100px; margin: 0 auto; }
.view.wide { max-width: 1400px; }
@media (min-width: 900px) {
  .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
  .grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; align-items: start; }
}

.card {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; margin-bottom: 12px;
}
.card > h3 { font-size: 16px; margin-bottom: 4px; }
.card > h3 + p { margin: 0 0 10px; color: var(--ink-dim); font-size: 13px; }
.card.tight { padding: 10px 12px; }
.hint { color: var(--ink-dim); font-size: 13px; margin: 0 0 10px; }
.muted { color: var(--ink-faint); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.tight { gap: 6px; }
/* the element that takes up the slack in a row, so what follows sits at the right
   edge — the markup has used this since the start without a rule behind it */
.grow { flex: 1; min-width: 0; }
.spacer { flex: 1; }

/* ---------------------------------------------------------------- controls */
.btn {
  min-height: var(--tap); padding: 11px 16px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg-3); color: var(--ink);
  font: 500 14.5px/1 system-ui, sans-serif; cursor: pointer;
}
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn.gold { background: var(--gold); border-color: var(--gold); color: #241f12; font-weight: 600; }
.btn.ghost { background: transparent; }
.btn.small { min-height: 36px; padding: 8px 12px; font-size: 13px; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .45; }
.btn.danger { border-color: var(--red); color: var(--red-bright); }

input, select, textarea {
  width: 100%; min-height: var(--tap); padding: 11px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg-3); color: var(--ink);
  font: inherit; font-size: 16px;           /* 16px stops iOS zooming on focus */
}
textarea { min-height: 84px; resize: vertical; line-height: 1.45; }
label.field { display: block; margin-bottom: 10px; }
label.field span {
  display: block; font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-faint); margin-bottom: 6px;
}
.switch { display: flex; align-items: center; gap: 10px; min-height: var(--tap); }
.switch input { width: auto; min-height: auto; }

/* ------------------------------------------------------------------- tabs */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: space-around; gap: 2px;
  padding: 6px 6px calc(6px + var(--safe-b));
  background: #171a21f2; backdrop-filter: blur(8px); border-top: 1px solid var(--line);
}
.tabs button {
  flex: 1; min-height: 50px; border: 0; background: none; color: var(--ink-faint);
  font: 500 11px/1.3 system-ui, sans-serif; cursor: pointer; border-radius: 10px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
}
.tabs button b { font-size: 17px; font-weight: 400; }
.tabs button.active { color: #fff; background: #ffffff10; }
.tabs button .badge {
  position: absolute; transform: translate(16px, -14px);
  background: var(--red-bright); color: #fff; border-radius: 10px;
  font-size: 9.5px; padding: 1px 5px;
}

/* ------------------------------------------------------------------ party */
.pc {
  display: grid; grid-template-columns: 1fr auto; gap: 8px 10px;
  padding: 12px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--bg-2); margin-bottom: 10px;
}
.pc h4 { font-size: 15.5px; }
.pc .who { color: var(--ink-faint); font-size: 11.5px; }
.pc .stats { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.pill {
  font-size: 11.5px; padding: 3px 8px; border-radius: 20px;
  background: #ffffff10; color: var(--ink-dim); white-space: nowrap;
}
.pill.ok { background: #4f9d6926; color: #7fc496; }
.pill.warn { background: #d4353f26; color: #e78f95; }
.pill.gold { background: #c8a25026; color: var(--gold); }
.pc .hpbar { grid-column: 1 / -1; height: 8px; border-radius: 5px; background: #ffffff12;
  overflow: hidden; }
.pc .hpbar i { display: block; height: 100%; background: var(--green); transition: width .3s; }
.pc .hpbar i.hurt { background: var(--gold); }
.pc .hpbar i.bad { background: var(--red-bright); }
.pc.down { border-color: var(--red); }

.hpnum { font: 600 22px/1 var(--serif); }
.hpnum small { font-size: 12px; color: var(--ink-faint); font-family: system-ui, sans-serif; }

/* --------------------------------------------------------------- big stats */
.statgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.statgrid.six { grid-template-columns: repeat(3, 1fr); }
.stat {
  background: var(--bg-3); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 6px; text-align: center;
}
.stat b { display: block; font: 600 20px/1.1 var(--serif); color: #fff; }
.stat small { display: block; margin-top: 2px; font-size: 9.5px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-faint); }
.stat .sub { font-size: 11px; color: var(--gold); }

/* ------------------------------------------------------------------- feed */
.feed { display: grid; gap: 8px; }
.feed .item {
  border-left: 2px solid var(--line); padding: 6px 0 6px 10px; font-size: 13.5px;
}
.feed .item time { display: block; color: var(--ink-faint); font-size: 11px; }
.feed .item.hp { border-left-color: var(--red); }
.feed .item.note { border-left-color: var(--gold); }
.feed .item.join { border-left-color: var(--green); }
.feed .item.system { border-left-color: var(--blue); }
.feed .item.private::after { content: " DM only"; font-size: 9.5px; color: var(--red-bright); }
/* a timeline entry that has a report behind it */
.feed .item.tappable {
  width: 100%; text-align: left; background: none; color: var(--ink);
  font: inherit; font-size: 13.5px; cursor: pointer;
}
.feed .item.tappable:active { background: #ffffff08; }

/* A shared handout is meant to be looked at, so it is shown where it was posted. */
.attach-img {
  display: block; width: 100%; max-height: 340px; object-fit: contain;
  border-radius: 8px; background: #0006; cursor: zoom-in;
}
.lightbox-img { display: block; width: 100%; max-height: 70vh; object-fit: contain;
  border-radius: 8px; background: #0006; }

.note-card { border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px;
  background: var(--bg-2); margin-bottom: 8px; }
.note-card.pinned { border-color: var(--gold); }
.note-card .meta { color: var(--ink-faint); font-size: 11px; margin-top: 6px; }
.note-card p { margin: 0; white-space: pre-wrap; font-size: 14px; }

/* a player's own notebook */
.notebox {
  width: 100%; padding: 10px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--bg-1); color: var(--ink); resize: vertical;
  font: inherit; font-size: 16px;      /* 16px keeps iOS from zooming on focus */
  line-height: 1.4;
}
.note-card.mine { border-left: 3px solid var(--gold); }
.note-card .notebody { font-size: 14.5px; line-height: 1.45; }
.note-card .meta { display: flex; gap: 10px; align-items: center; }
.note-card .meta .grow { flex: 1; min-width: 0; }
.linkish {
  background: none; border: 0; padding: 4px 2px; color: var(--ink-dim);
  font: inherit; font-size: 11.5px; text-decoration: underline; cursor: pointer;
  min-height: 32px;
}
.linkish:hover { color: var(--ink); }
.linkish.danger { color: #d98a90; }

/* ------------------------------------------------------------------ sheets */
.sheet-back {
  position: fixed; inset: 0; z-index: 60; background: #000000b0;
  display: flex; align-items: flex-end;
}
.sheet-back[hidden] { display: none; }
.sheet {
  width: 100%; max-height: 88vh; overflow: auto; background: var(--bg-2);
  border-top: 1px solid var(--line); border-radius: 16px 16px 0 0;
  padding: 16px 14px calc(20px + var(--safe-b));
  animation: rise .16s ease-out;
}
@keyframes rise { from { transform: translateY(18px); opacity: .6; } }
@media (min-width: 760px) {
  .sheet-back { align-items: center; justify-content: center; }
  .sheet { max-width: 560px; border-radius: 16px; border: 1px solid var(--line); }
}
.sheet h3 { margin-bottom: 10px; }

.toast {
  position: fixed; left: 50%; bottom: calc(80px + var(--safe-b)); transform: translateX(-50%);
  z-index: 70; background: var(--bg-3); border: 1px solid var(--gold);
  padding: 10px 16px; border-radius: 10px; font-size: 13.5px; max-width: 90vw;
  box-shadow: 0 8px 24px #000a;
}
.toast[hidden] { display: none; }

/* ------------------------------------------------- DM workspace (laptop) */
/* Players are on phones; the DM is on a laptop and wants everything at once,
   so on wide screens the DM view abandons tabs for a three-column desk. */
.desk {
  display: grid; gap: 12px;
  grid-template-columns: minmax(320px, 1.1fr) minmax(300px, 1fr) minmax(320px, 1.15fr);
  align-items: start;
}
@media (max-width: 1240px) { .desk { grid-template-columns: 1fr 1fr; } }
.desk .col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.desk .card { margin-bottom: 0; }
.desk-scroll { max-height: 46vh; overflow: auto; padding-right: 4px; }
.desk-scroll.tall { max-height: 62vh; }

.dm-head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 14px; margin-bottom: 12px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--bg-2);
}
.dm-head h2 { font-size: 19px; }
.dm-head .status { font-size: 12.5px; color: var(--ink-dim); }
.dm-head .status b { color: var(--gold); font-variant-numeric: tabular-nums; }

/* a compact combat-ready party row for the DM */
.roster { display: grid; gap: 8px; }
.rr {
  border: 1px solid var(--line); border-radius: 10px; background: var(--bg-2);
  padding: 10px 12px;
}
.rr.down { border-color: var(--red); }
.rr-top { display: flex; align-items: baseline; gap: 8px; }
.rr-top strong { font-family: var(--serif); font-size: 15px; }
.rr-top .who { color: var(--ink-faint); font-size: 11.5px; }
.rr-top .hp { margin-left: auto; font: 600 18px/1 var(--serif); }
.rr-top .hp small { font-size: 11px; color: var(--ink-faint); }
/* named hpline, not bar: `.bar` is the sticky top app bar and would win here */
.rr .hpline { height: 6px; border-radius: 4px; background: #ffffff12; margin: 7px 0;
  overflow: hidden; }
.rr .hpline i { display: block; height: 100%; background: var(--green); transition: width .3s; }
.rr .hpline i.hurt { background: var(--gold); }
.rr .hpline i.bad { background: var(--red-bright); }
.rr .nums { display: flex; gap: 5px; flex-wrap: wrap; }
.rr .act { display: flex; gap: 5px; margin-top: 8px; align-items: center; }
.rr .act input { width: 62px; min-height: 34px; padding: 6px 8px; text-align: center;
  font-size: 14px; }
.rr .act .btn { min-height: 34px; padding: 6px 10px; font-size: 12.5px; }
.rr .act .spacer { flex: 1; }

.mini-log { display: grid; gap: 6px; font-size: 12.5px; }
.mini-log .row2 { display: grid; grid-template-columns: 52px 1fr; gap: 8px;
  padding: 4px 0; border-bottom: 1px solid #ffffff08; }
.mini-log time { color: var(--ink-faint); font-size: 10.5px; }

.mon-panel { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 10px; }
.mon-panel h4 { font-size: 15px; }
.mon-panel .act-block { margin-top: 8px; font-size: 12.5px; }
.mon-panel .act-block b { color: var(--ink); }

/* ------------------------------------------------------------ battle grid */
.grid-wrap { overflow: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
.grid {
  position: relative; display: grid; gap: 1px; background: var(--line);
  border: 1px solid var(--line); border-radius: 6px; width: max-content;
}
.grid .cell { width: var(--cell); height: var(--cell); background: #1a1d24; }
.grid .cell:nth-child(even) { background: #1c1f27; }
/* lit while a token is selected, so it is obvious the grid is a move target */
.grid .cell.drop { background: #2c3446; box-shadow: inset 0 0 0 1px #ffffff10; }
.tok {
  position: absolute; width: var(--cell); height: var(--cell);
  display: grid; place-items: center; border-radius: 50%;
  font: 700 11px/1 system-ui, sans-serif; color: #fff; cursor: pointer;
  border: 2px solid #0006; transition: left .18s, top .18s; user-select: none;
}
.tok.pc { background: #3d6fa5; }
.tok.enemy { background: #a4232b; }
.tok.npc { background: #6b5ba8; }
.tok.red { background: #a4232b; } .tok.amber { background: #b6802f; }
.tok.green { background: #3f7d54; } .tok.blue { background: #3d6fa5; }
.tok.violet { background: #6b5ba8; } .tok.slate { background: #4a5262; }
.tok.sel { outline: 3px solid var(--gold); outline-offset: 1px; z-index: 3; }
.tok.turn { box-shadow: 0 0 0 3px #4f9d69, 0 0 12px #4f9d69aa; z-index: 2; }
.tok.down { opacity: .45; text-decoration: line-through; }
.tok.hidden-tok { background: #2f3542; border-style: dashed; }
.tok .tokhp {
  position: absolute; bottom: -3px; left: 8%; width: 84%; height: 3px;
  border-radius: 2px; background: #0008; overflow: hidden;
}
.tok .tokhp i { display: block; height: 100%; background: #7fc496; }
.tok .tokhp i.hurt { background: var(--gold); }
.tok .tokhp i.bad { background: #ff6a72; }
.tok.mine { border-color: var(--gold); }

/* areas of effect: translucent squares below the tokens, so a token standing in
   one is still readable */
.area {
  position: absolute; width: var(--cell); height: var(--cell);
  pointer-events: none; z-index: 1;
}
.area.violet { background: #6b5ba859; box-shadow: inset 0 0 0 1px #6b5ba8aa; }
.area.red { background: #a4232b59; box-shadow: inset 0 0 0 1px #a4232baa; }
.area.amber { background: #b6802f59; box-shadow: inset 0 0 0 1px #b6802faa; }
.area.green { background: #3f7d5459; box-shadow: inset 0 0 0 1px #3f7d54aa; }
.area.blue { background: #3d6fa559; box-shadow: inset 0 0 0 1px #3d6fa5aa; }
.tok { z-index: 2; }

.area-row { border-top: 1px solid var(--line); padding-top: 8px; margin-top: 8px; }
.area-row .swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.area-row .swatch.violet { background: #6b5ba8; } .area-row .swatch.red { background: #a4232b; }
.area-row .swatch.amber { background: #b6802f; } .area-row .swatch.green { background: #3f7d54; }
.area-row .swatch.blue { background: #3d6fa5; }

/* ------------------------------------------------------- the combat roster table */
/* Every combatant's initiative, armour class and hit points at once. It scrolls
   sideways inside its own box rather than making the page scroll. */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 8px 0; }
.fight-table { border-collapse: collapse; width: 100%; font-size: 13px; }
.fight-table th {
  text-align: left; font: 600 10px/1 system-ui, sans-serif; letter-spacing: .08em;
  text-transform: uppercase; color: var(--ink-faint); padding: 4px 6px;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
.fight-table td { padding: 6px; border-bottom: 1px solid #ffffff0a; vertical-align: top; }
.fight-table tr.now td { background: #1c262033; }
.fight-table tr.now td:first-child { box-shadow: inset 2px 0 0 var(--green); }
.fight-table tr.dead td { opacity: .5; }
/* your own row, the moment something lands on it */
@keyframes struck { from { background: #d4353f66; } to { background: transparent; } }
.fight-table tr.struck td { animation: struck 1.1s ease-out; }
.fight-table td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.fight-table .who-btn {
  background: none; border: 0; padding: 0; color: var(--ink); font: inherit;
  font-family: var(--serif); font-size: 14px; text-align: left; cursor: pointer;
}
.fight-table .who-btn.mine { color: var(--gold); }
.fight-table .hpline { height: 4px; border-radius: 3px; background: #ffffff12;
  overflow: hidden; margin-top: 3px; min-width: 46px; }
.fight-table .hpline i { display: block; height: 100%; background: var(--green); }
.fight-table .hpline i.hurt { background: var(--gold); }
.fight-table .hpline i.bad { background: var(--red-bright); }
.fight-table .amt { width: 52px; min-height: 32px; padding: 5px 6px; text-align: center;
  font-size: 13px; }
.fight-table .btn.small { min-height: 32px; padding: 5px 9px; }
.init-cell { display: flex; flex-direction: column; gap: 2px; align-items: flex-start; }
.init-input { width: 56px; min-height: 32px; padding: 5px 6px; text-align: center;
  font-size: 14px; }
.init-cell small { font-size: 10px; }
.switch.tiny { min-height: 30px; gap: 4px; font-size: 11px; color: var(--ink-dim); }

/* a d-pad, because aiming at a 26px square on a phone is not a plan */
.movepad { margin-top: 8px; font-size: 11.5px; }
.movepad .pad { display: grid; grid-template-columns: repeat(3, 40px); gap: 4px;
  margin-top: 4px; }
.movepad .pad .btn { min-height: 38px; padding: 0; }
.movepad .dot-mid { border-radius: 8px; background: #ffffff08; }

/* the enemy picker: pins, results, and a basket of what to place */
.pin-head { font-size: 10px; letter-spacing: .1em; margin: 10px 0 4px; }
.pick-row {
  display: flex; align-items: center; gap: 6px; padding: 7px 8px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--bg-2);
}
.pick-row.picked { border-color: var(--gold); background: #2a241533; }
.pick-row .pick-name { background: none; border: 0; text-align: left; color: var(--ink);
  font: inherit; cursor: pointer; min-width: 0; padding: 0; }
.pick-row .pick-name strong { display: block; font-family: var(--serif); font-size: 14px; }
.pick-row .pick-name small { display: block; color: var(--ink-faint); font-size: 11px; }
.pick-row .pin { background: none; border: 0; cursor: pointer; opacity: .3;
  font-size: 15px; min-height: 34px; min-width: 34px; }
.pick-row .pin.on { opacity: 1; }
.pick-row .counter .btn { min-height: 32px; padding: 4px 10px; }
.pick-row .counter b { min-width: 18px; text-align: center;
  font-variant-numeric: tabular-nums; }
.basket { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 10px;
  font-size: 12.5px; }

.init-strip { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.init-strip .slot {
  flex: none; min-width: 82px; padding: 7px 9px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--bg-2); font-size: 12px;
}
.init-strip .slot.now { border-color: var(--green); background: #1c2620; }
.init-strip .slot b { display: block; font-family: var(--serif); font-size: 13px; }
.init-strip .slot small { color: var(--ink-faint); }

/* ----------------------------------------------------------- level up flow */
.lvl-step { border: 1px solid var(--line); border-radius: 10px; padding: 12px;
  margin-bottom: 10px; background: var(--bg-2); }
.lvl-step h4 { font-size: 14.5px; margin-bottom: 6px; }
.lvl-step .why { color: var(--ink-dim); font-size: 12.5px; margin: 0 0 8px; }
.dice-big {
  display: flex; gap: 8px; align-items: center; justify-content: center;
  padding: 10px 0;
}
.dice-big .face {
  width: 54px; height: 54px; border-radius: 10px; background: #f2ede1; color: #1d1a14;
  display: grid; place-items: center; font: 700 24px/1 var(--mono);
  box-shadow: inset 0 -3px 0 #00000022;
}
.dice-big .face.rolling { animation: shake .28s linear infinite; }
@keyframes shake {
  0% { transform: translate(0,0) rotate(0); } 25% { transform: translate(1px,-2px) rotate(-7deg); }
  50% { transform: translate(-1px,1px) rotate(6deg); } 75% { transform: translate(2px,1px) rotate(-3deg); }
  100% { transform: translate(0,0) rotate(0); }
}

/* Pick lists: feats, weapon masteries, spells. A scroll box rather than a long
   page, so the "Take level" button stays reachable with one thumb. */
.picksearch {
  width: 100%; margin-bottom: 8px; padding: 10px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--bg-1); color: var(--ink);
  font-size: 16px;                 /* 16px stops iOS zooming on focus */
}
.picklist { display: grid; gap: 6px; max-height: 46vh; overflow-y: auto;
  -webkit-overflow-scrolling: touch; padding-right: 2px; }
.pick {
  display: grid; gap: 2px; text-align: left; width: 100%; min-height: 44px;
  padding: 9px 11px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg-1); color: var(--ink); font: inherit; cursor: pointer;
}
.pick.sel { border-color: var(--gold); background: #2a2415; }
.pick.off { opacity: .45; }
.pick .nm { font-size: 14px; display: flex; gap: 6px; align-items: center;
  flex-wrap: wrap; }
.pick .ds { color: var(--ink-dim); font-size: 12px; line-height: 1.35; }
.pick .pill { font-size: 10px; padding: 1px 5px; }

/* ------------------------------------------------------------- provenance */
.why-list { display: grid; gap: 4px; font-size: 12.5px; }
.why-list .why-row { display: flex; gap: 8px; justify-content: space-between; }
.why-list .why-row span:last-child { font-variant-numeric: tabular-nums; color: var(--gold); }
.why-total { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 6px;
  display: flex; justify-content: space-between; font-weight: 600; }
.explainable { cursor: help; border-bottom: 1px dotted var(--ink-faint); }

/* ----------------------------------------------------------------- misc */
.center { text-align: center; }
.big-code {
  font: 700 26px/1 var(--mono); letter-spacing: .12em; color: var(--gold);
  background: var(--bg-3); border: 1px dashed var(--gold); border-radius: 10px;
  padding: 14px; text-align: center; user-select: all;
}
.qr { background: #fff; border-radius: 12px; padding: 10px; width: 210px; margin: 0 auto; }
.qr svg { width: 100%; height: auto; display: block; }
.list { display: grid; gap: 8px; }
.tap-row {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  min-height: var(--tap); padding: 11px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg-2); color: var(--ink);
  font: inherit; cursor: pointer;
}
.tap-row:active { background: var(--bg-3); }
.tap-row .grow { flex: 1; min-width: 0; }
.tap-row small { display: block; color: var(--ink-faint); font-size: 11.5px; }
.tap-row .chev { color: var(--ink-faint); }
.banner {
  border-radius: 10px; padding: 10px 12px; font-size: 13.5px; margin-bottom: 12px;
  border: 1px solid var(--line); background: var(--bg-2);
}
.banner.warn { border-color: var(--red); background: #2e2126; }
.banner.ok { border-color: var(--green); background: #1c2620; }
.spell-row { display: flex; gap: 8px; align-items: baseline; font-size: 13.5px;
  padding: 5px 0; border-bottom: 1px solid #ffffff0a; }
.spell-row .lv { font: 600 11px/1 var(--mono); color: var(--ink-faint); width: 18px; }
.spell-row .nm { flex: 1; }
/* a spell you can open: same row, but it is a button and says so */
.spell-row.tappable {
  width: 100%; text-align: left; background: none; border: 0;
  border-bottom: 1px solid #ffffff0a; color: var(--ink); font: inherit;
  font-size: 13.5px; cursor: pointer; min-height: 38px;
}
.spell-row.tappable:active { background: #ffffff08; }
.spell-row .chev { color: var(--ink-faint); margin-left: auto; }
/* the row a DM has selected in the give-item search */
.spell-row.tappable.picked { background: #2a241533; box-shadow: inset 2px 0 0 var(--gold); }

/* Explanatory text inside a sheet. `.why` was scoped to the level-up step, and the
   magic item sheet needs the same voice: small, dim, and not competing with the rules
   text it introduces. */
.sheet .why { color: var(--ink-dim); font-size: 12.5px; margin: 0 0 8px; }
.sheet .why.warn { color: #e78f95; }
.sheet input[type="text"], .sheet input[type="search"] {
  width: 100%; margin-bottom: 8px;
}

/* ------------------------------------------------- spell slots and the kit panel */
/* Slots are pips rather than a number because "how many are left" is read across a
   table at a glance, and a spent one has to be as obvious as an empty one. */
.slots { display: grid; gap: 5px; margin: 6px 0 10px; }
.slot-row { display: flex; align-items: center; gap: 8px; }
.slot-row .lv { font: 600 11px/1 var(--mono); color: var(--ink-faint); width: 22px; }
.slot-row small { margin-left: auto; font-variant-numeric: tabular-nums; }
.pips { display: flex; gap: 4px; flex-wrap: wrap; }
.pip {
  width: 20px; height: 20px; border-radius: 50%; cursor: pointer;
  border: 2px solid var(--gold); background: var(--gold); padding: 0;
}
.pip.spent { background: transparent; border-color: var(--ink-faint); }
.pip:disabled { cursor: default; opacity: .75; }

.kit { border: 1px solid var(--line); border-radius: 10px; background: var(--bg-2);
  padding: 8px 12px; margin-top: 10px; }
.kit > summary {
  display: flex; align-items: center; gap: 8px; cursor: pointer; min-height: 34px;
  font-family: var(--serif); font-size: 14px; list-style: none;
}
.kit > summary::-webkit-details-marker { display: none; }
.kit > summary::before { content: '▸'; color: var(--ink-faint); font-size: 11px; }
.kit[open] > summary::before { content: '▾'; }
.kit-head { font-size: 10px; letter-spacing: .1em; color: var(--ink-faint);
  margin: 10px 0 3px; }
.slot-sum { display: flex; gap: 6px; font-size: 11px; flex-wrap: wrap; }
.slot-sum .out { color: var(--red-bright); }

.dice-line { margin-top: 10px; padding: 8px 10px; border-radius: 8px;
  background: var(--bg-3); border: 1px solid var(--gold); }
.dice-line b { font: 700 18px/1 var(--mono); color: var(--gold); }
.detail { font-size: 13px; line-height: 1.5; color: var(--ink-dim);
  white-space: pre-wrap; margin: 6px 0 0; }
kbd { font: 600 12px var(--mono); background: var(--bg-3); border: 1px solid var(--line);
  border-radius: 6px; padding: 2px 6px; }
