/* ==========================================================================
   Play sheet - the at-the-table view. Kept apart from the builder styles
   because it is the one screen that has to work under pressure.
   ========================================================================== */

.sheet-head {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 16px;
}

.sheet-portrait {
  width: 68px;
  height: 68px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--line-2);
  flex: none;
}

/* The portrait doubles as the upload control: click it to put your own photo
   on the sheet. Empty, it says so; filled, it offers to change. */
.portrait-slot {
  position: relative;
  flex: none;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  line-height: 0;
  border-radius: var(--radius);
}

.portrait-slot.empty {
  width: 68px;
  height: 68px;
  border: 1px dashed var(--line-2);
  color: var(--ink-3);
  font-size: 10px;
  line-height: 1.3;
  display: grid;
  place-items: center;
  text-align: center;
}

.portrait-slot.empty:hover { border-color: var(--accent); color: var(--accent); }

.portrait-hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 2px 0;
  font-size: 9px;
  line-height: 1.4;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #fff;
  background: rgba(0, 0, 0, .6);
  border-radius: 0 0 var(--radius) var(--radius);
  opacity: 0;
}

.portrait-slot:hover .portrait-hint { opacity: 1; }
.portrait-slot.empty .portrait-hint { display: none; }

.sheet-id { flex: 1; min-width: 0; }
.sheet-id h2 { margin: 0 0 2px; font-family: var(--serif); font-size: 24px; color: var(--accent); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }

.chip {
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 2px 12px;
  font-size: 11px;
  color: var(--ink-3);
}

.chip b { color: var(--ink); font-size: 12px; }

.sheet-actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }

.insp {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-3);
  cursor: pointer;
}

.insp.on { color: var(--accent); font-weight: 600; }
.insp input { accent-color: var(--accent); }

.sheet-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr) minmax(0, 1.1fr);
  gap: 16px;
  align-items: start;
}

@media (max-width: 1400px) { .sheet-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
@media (max-width: 900px) { .sheet-grid { grid-template-columns: 1fr; } }

.sheet-col { min-width: 0; }

/* -------------------------------------------------------------- abilities */

.ab-col { display: flex; flex-direction: column; gap: 6px; }
.ab-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
/* what is running on them, under the save it changes: advantage, a die, an automatic fail */
.ab-hint { grid-column: 1 / -1; color: var(--accent-2); margin-top: -4px; }
.roll-hint { color: var(--accent-2); font-size: 11px; margin-top: 2px; }
.def-hint { margin: 6px 0 0; }
/* armour class that is not the printed number, so it can be told from it */
.stat-box.changed .sb-v { color: var(--accent-2); }

.ab-score {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  align-items: center;
  gap: 8px;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 5px 12px;
}

.ab-score .ab-k { font-size: 10px; letter-spacing: .08em; color: var(--ink-3); }
.ab-score .ab-n { font-family: var(--serif); font-size: 20px; font-weight: 700; }
.ab-score .ab-m { font-size: 14px; color: var(--accent-2); font-variant-numeric: tabular-nums; }

.ab-save {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 11px;
  color: var(--ink-3);
  min-width: 78px;
  justify-content: flex-end;
}

.ab-save b { font-size: 14px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.ab-save.prof b { color: var(--accent); }
.ab-save.prof::before { content: "●"; color: var(--accent); font-size: 9px; }

/* ------------------------------------------------------------- stat boxes */

.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

.stat-box {
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 6px;
  text-align: center;
}

.stat-box .sb-v { font-family: var(--serif); font-size: 22px; font-weight: 700; line-height: 1.1; }

.stat-box .sb-k {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--ink-3);
  margin-top: 2px;
}

/* ------------------------------------------------------------- hit points */

.hp-block {
  margin-top: 12px;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 12px;
}

.hp-block.hurt { border-color: #8a6d2f; }
.hp-block.down { border-color: var(--red); }

.hp-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.hp-now { display: flex; align-items: baseline; gap: 6px; }

.hp-cur {
  width: 74px;
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 700;
  text-align: center;
  padding: 2px 4px;
  background: var(--bg-2);
}

.hp-max { font-size: 15px; color: var(--ink-3); }
.hp-temp { font-size: 12px; color: var(--blue); margin-left: 6px; }

.hp-buttons { display: flex; align-items: center; gap: 5px; }
.hp-amt { width: 58px; text-align: center; padding: 4px; }

.hp-bar { height: 7px; background: var(--bg); border-radius: 4px; margin-top: 8px; overflow: hidden; }
.hp-fill { height: 100%; background: var(--green); transition: width .18s ease; }
.hp-block.hurt .hp-fill { background: var(--accent); }
.hp-block.down .hp-fill { background: var(--red); }

/* -------------------------------------------------------- limited uses
   A handful of uses is a row of pips (see below). A pool of twenty-five hit
   points of healing is not something anyone counts in dots, so it gets a
   number, a spend box and a bar - the same shape as hit points, because it is
   the same job. */

.pool-row {
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 7px 12px;
  margin-bottom: 7px;
}

.pool-row.empty { border-color: var(--line-2); opacity: .75; }
.pool-head { display: flex; align-items: baseline; gap: 8px; }
.pool-name { font-weight: 600; }
.pool-head .muted { margin-left: auto; }

.pool-now { display: flex; align-items: center; gap: 6px; margin-top: 3px; }

.pool-cur {
  width: 56px;
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 700;
  text-align: center;
  padding: 1px 4px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.pool-amt {
  width: 46px;
  margin-left: auto;
  text-align: center;
  padding: 3px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.pool-row .hp-bar { margin-top: 6px; height: 5px; }

/* ------------------------------------------------------------------- pips */

.mini-h {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ink-3);
  margin-bottom: 5px;
}

.pip-row { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.pip-label { font-size: 12px; color: var(--ink-2); min-width: 62px; }
.pips { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; }

.pip {
  width: 17px;
  height: 17px;
  border-radius: 50%;
  border: 2px solid var(--line-2);
  background: var(--bg-2);
  cursor: pointer;
  padding: 0;
}

.pip:hover { border-color: var(--accent); }
.pip.spent { background: var(--accent); border-color: var(--accent); }

/* ------------------------------------------------------------- conditions */

.cond-list { display: flex; flex-wrap: wrap; gap: 4px; }

/* the pill and its ⓘ travel together, so a wrapped row never orphans a dot */
.cond-wrap { display: inline-flex; align-items: center; gap: 2px; }
.cond-wrap .info-dot { flex: none; }

.cond {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--bg-3);
  color: var(--ink-3);
  cursor: pointer;
}

.cond:hover { border-color: var(--line-2); }
.cond.on { background: var(--red); border-color: var(--red); color: #fff; font-weight: 600; }
.cond input { display: none; }

/* ------------------------------------------------------------- companions */

.companion {
  border: 1px solid var(--line);
  border-left: 3px solid var(--blue);
  border-radius: var(--radius);
  padding: 8px 12px;
  margin-bottom: 8px;
  background: var(--bg-3);
}

.companion:last-child { margin-bottom: 0; }
.comp-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 5px; }
.comp-head b { font-family: var(--serif); font-size: 15px; color: var(--accent-2); }

.comp-abils { display: flex; gap: 4px; margin: 7px 0; }
.comp-abils span { flex: 1; text-align: center; font-size: 12px; }
.comp-abils i { display: block; font-style: normal; font-size: 8px; letter-spacing: .05em; color: var(--ink-3); }
.comp-abils small { color: var(--ink-3); }

.comp-facts { margin: 0; font-size: 12px; }
.comp-facts div { display: flex; gap: 6px; padding: 1px 0; }
.comp-facts dt { flex: none; width: 82px; color: var(--ink-3); }
.comp-facts dd { margin: 0; }

.comp-list { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 8px; margin-top: 6px; font-size: 12px; }
.comp-list i { font-style: normal; color: var(--ink-3); font-size: 10px; text-transform: uppercase; letter-spacing: .05em; }

/* ------------------------------------------------------------------ turn  */

.turn-slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }

.turn-slot {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-3);
  padding: 5px 7px;
  min-width: 0;
}

.turn-slot.spent { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--bg-3)); }
.ts-k { font-size: 9px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }

.ts-v {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  padding: 2px 0 0;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.25;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ts-v.open { color: var(--ink-3); }
/* a staged spell: chosen, but nothing spent until the turn ends */
.ts-pending { color: var(--accent); margin-left: 4px; font-size: 15px; line-height: 0; }
.ts-v:hover { color: var(--accent-2); }

/* the list behind each of the three */
.turn-list { max-height: 60vh; overflow-y: auto; }
.turn-group { margin-bottom: 12px; }

.turn-opt {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  text-align: left;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 5px 8px;
  margin-bottom: 4px;
  color: inherit;
  cursor: pointer;
}

button.turn-opt:hover { border-color: var(--accent); background: var(--bg-4); }
.turn-opt.static { cursor: default; }

/* a choice and its ⓘ, side by side: the ⓘ opens what it does, the choice
   takes it */
.turn-row { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.turn-row > .turn-opt { flex: 1; min-width: 0; margin-bottom: 0; }
.turn-row > .info-dot { flex: none; }
.to-meta { margin-left: auto; font-size: 11px; color: var(--ink-3); }
.to-casts { margin-left: auto; display: flex; gap: 3px; }

.turn-cast {
  min-width: 22px;
  padding: 1px 5px;
  font-size: 11px;
  font-weight: 600;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  color: var(--accent-ink);
  cursor: pointer;
}

.turn-cast:hover { background: var(--accent-2); }

/* ---------------------------------------------------------- spell markers */

/* R for ritual, C for concentration - the two things you need to know before
   casting that the name does not tell you */
.sp-mark {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 15px;
  height: 15px;
  border-radius: 3px;
  border: 1px solid var(--line-2);
  background: var(--bg-3);
  color: var(--ink-3);
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  padding: 0;
}

.sp-mark.ritual { border-color: var(--green); color: var(--green); }
.sp-mark.conc { border-color: var(--blue); color: var(--blue); }
button.sp-mark { cursor: pointer; }
button.sp-mark:hover { background: var(--bg-4); }
.sp-mark.conc.on { background: var(--blue); color: #fff; }

.turn-note { font-family: var(--serif); font-size: 14px; margin-bottom: 7px; }
.turn-note b { color: var(--accent-2); }

/* ------------------------------------------------------- prepared spells  */

.prep-level { border-top: 1px solid var(--line); }
.prep-level > summary { cursor: pointer; padding: 6px 2px; font-weight: 600; }
.prep-level > summary .count { float: right; font-weight: 400; font-size: 11px; color: var(--ink-3); }

/* ---------------------------------------------------------------- attacks */

table.atk { width: 100%; border-collapse: collapse; font-size: 13px; }

table.atk thead td {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-3);
  padding: 0 6px 5px;
  text-align: center;
}

table.atk td { padding: 5px 6px; text-align: center; border-top: 1px solid var(--line); }
table.atk td.left { text-align: left; }
table.atk tbody tr.not-prof { color: var(--ink-3); }
table.atk tbody tr:hover { background: var(--bg-3); }

/* the second weapon, stepped in so it reads as the follow-up it is */
table.atk tbody tr.offhand td.left { padding-left: 16px; }
table.atk tbody tr.offhand td:first-child { border-left: 2px solid var(--line-2); }

/* ----------------------------------------------------------------- spells */

.spell-group { margin-bottom: 8px; }

.spell-lvl {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--accent-2);
  border-bottom: 1px solid var(--line);
  padding-bottom: 3px;
  margin-bottom: 4px;
}

.spell-row {
  display: grid;
  grid-template-columns: 16px 1fr auto auto;
  gap: 7px;
  align-items: baseline;
  padding: 2px 4px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
}

.spell-row:hover { background: var(--bg-3); }
.spell-row.on .sp-name { color: var(--ink); font-weight: 600; }
.spell-row:not(.on) .sp-name { color: var(--ink-2); }
.spell-row input { accent-color: var(--accent); }
.spell-row.disabled { opacity: .4; cursor: not-allowed; }
.sp-meta { font-size: 11px; white-space: nowrap; }

/* ------------------------------------------------------------ spell cards */

.spell-cards-card { margin-top: 16px; }

.spell-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.spell-card {
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-left: 3px solid var(--line-2);
  border-radius: var(--radius);
  padding: 12px 12px;
  display: flex;
  flex-direction: column;
}

.spell-card.prepared { border-left-color: var(--accent); }
.spell-card h4 { margin: 0; font-family: var(--serif); font-size: 16px; color: var(--accent-2); }
.spell-card .sc-sub { font-size: 11px; color: var(--ink-3); margin-top: 2px; }

.pill {
  display: inline-block;
  background: var(--bg-4);
  border-radius: 8px;
  padding: 0 6px;
  margin-left: 4px;
  font-size: 10px;
  color: var(--ink-2);
}

.sc-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 12px;
  margin: 8px 0;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.sc-stats dt { font-size: 9px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); }
.sc-stats dd { margin: 0; font-size: 12px; }

.sc-mat { font-size: 11px; font-style: italic; margin-bottom: 7px; }
.sc-body { font-size: 12.5px; max-height: 260px; overflow-y: auto; }
.sc-body p { margin: 0 0 7px; }
.spell-card footer { font-size: 10px; margin-top: auto; padding-top: 7px; }

/* -------------------------------------------------------------- currency  */

.coins { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.coin { display: flex; flex-direction: column; gap: 3px; align-items: center; }
.coin-k { font-size: 9px; letter-spacing: .07em; color: var(--ink-3); }
.coin input { width: 100%; text-align: center; padding: 4px; }

/* ------------------------------------------------------------------ print */

@media print {
  .sheet-grid { grid-template-columns: 1fr 1fr; }
  .sheet-actions, .hp-buttons { display: none !important; }
  .cond-list .cond-wrap:not(:has(.cond.on)) { display: none !important; }
  .cond-list .info-dot, .portrait-hint { display: none !important; }
  .portrait-slot.empty { display: none !important; }
  .spell-cards { grid-template-columns: 1fr 1fr; }
  .spell-card, .card, .stat-box, .ab-score { break-inside: avoid; }
  .sc-body { max-height: none; overflow: visible; }
  .sheet-head { border-color: #999; }
}

/* an interpolated value the build could not supply */
.unresolved {
  display: inline-block;
  min-width: 14px;
  text-align: center;
  border-bottom: 1px dotted var(--ink-3);
  color: var(--ink-3);
  cursor: help;
}

/* -------------------------------------------------------------- summons

   Putting something on the board, and what is already out there. The live
   half sits above the offers because mid-fight the question is how much is
   left of the steel defender, not what else could be called up. */

.summons-card .summon-out {
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.summon-live {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0 4px 7px;
  border-left: 2px solid var(--blue);
  margin-bottom: 4px;
}

.summon-live .grow { display: flex; flex-direction: column; line-height: 1.25; }
.summon-live b { font-family: var(--serif); font-size: 14px; color: var(--accent-2); }

.summon-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid var(--line);
}

.summon-row:last-child { border-bottom: 0; }
.summon-row .grow { display: flex; flex-direction: column; line-height: 1.3; }
.summon-row button[disabled] { opacity: .5; cursor: default; }

/* Wild Shape. The card reads as the summons card does - what you are now
   first, then what you could become - and a form is a companion block, the
   same one familiars and beast companions already wear. */
.ws-card .ws-uses { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ws-card .ws-limits { margin: 4px 0 8px; }
.ws-card .ws-actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 4px; }
.ws-card .ws-actions button[disabled] { opacity: .5; cursor: default; }
.ws-card .companion { border-left: 2px solid var(--green); }
.ws-card .comp-abils span.yours i { color: var(--accent); }
.ws-card .ws-hp { display: flex; align-items: center; gap: 6px; margin: 6px 0; font-size: 12px; }
.ws-atk { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; font-size: 12px; }
.ws-atk span b { font-weight: 600; }
.ws-forms { display: flex; flex-wrap: wrap; gap: 4px 6px; margin: 4px 0; }
.ws-forms .tag { display: inline-flex; align-items: center; gap: 3px; }
.ws-note { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 6px; }
.ws-spend { display: flex; align-items: center; gap: 6px; padding: 2px 0; font-size: 12px; }
.hp-block .hp-form { font-size: 11px; }

/* What you are concentrating on, beside the hit points rather than beside the
   spell. Damage is what breaks concentration, so this belongs where the damage
   is entered - the DM's card has carried the same chip beside their damage box
   from the start. Fully styled here rather than leaning on `.chip`, whose
   `margin-left: auto` is for a card head and would shove this to the far side
   of the hit point row. */
.hp-conc {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 12px;
  padding: 2px 8px;
  border: 1px solid var(--blue);
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.5;
  cursor: pointer;
  white-space: nowrap;
}

.hp-conc:hover {
  background: var(--bg-3);
  color: var(--blue);
}

/* the psi limit sits with the pool's name, not out at the rest label */
.pool-head .pool-note { margin-left: 0; }

/* ------------------------------------------- a save the table waits on you

   The DM is prompted on their screen when the turn moves, but the die is the
   player's and a prompt on somebody else's laptop is not a prompt. This sits
   at the top of the combat card until it is answered. */

.saves-due {
  margin: 12px 0 0;
  padding: 8px 12px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.save-due-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
}

.save-due-what { display: flex; flex-direction: column; line-height: 1.3; margin-right: auto; }
.save-due-what b { color: var(--accent-2); }
.save-due-what .tiny { color: var(--ink-2); }

/* the conditions currently held, above the fifteen boxes: a bare tick says
   only that it is on, and these say how it ends */
.cond-held { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 6px 0; }
.cond-held .chip.cond-on { background: var(--bg-4); border-color: var(--line-2); color: var(--ink); }
.cond-held .chip.cond-on.due { background: var(--accent); border-color: var(--accent); color: #201802; }

/* ------------------------------------------- what a wrapper actually does

   An infusion's own text is often only "you can replicate an Alchemy Jug".
   The thing it names is a separate element, so the list shows both: the
   wrapper's sentence, then the item's own rules under its name. */

.wrapper-own { color: var(--ink-2); font-style: italic; margin-bottom: 6px; }

.wrapper-twin {
  padding-left: 12px;
  border-left: 2px solid var(--line-2);
}

.wrapper-twin .mini-h { margin-top: 0; }

/* putting a feature away, and the drawer it goes in */
.feature-item > summary { position: relative; }

.feat-hide {
  float: right;
  margin-left: 8px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink-3);
  font-size: 12px;
  line-height: 1.5;
  cursor: pointer;
}

.feat-hide:hover { border-color: var(--accent); color: var(--accent); }

.feature-away {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
}

.feature-away > summary {
  cursor: pointer;
  color: var(--ink-3);
  font-size: 12px;
  padding: 2px 0;
}
/* Stateful 2014 class features. */
.cf-card { min-width:0; }
.cf-card h4 { margin:12px 0 6px; }
.cf-card label { display:flex; flex-direction:column; gap:4px; font-size:12px; margin:8px 0; }
.cf-card input, .cf-card select { width:100%; min-width:0; box-sizing:border-box; color:var(--ink); background:var(--bg-3); border:1px solid var(--line); border-radius:5px; padding:7px; }
.cf-card .cf-check { flex-direction:row; align-items:center; }
.cf-card .cf-check input { width:auto; }
.cf-card .cf-token { display:inline-block; border:1px solid var(--line); border-radius:5px; padding:4px 8px; margin:3px; }
.cf-card .spent { opacity:.55; text-decoration:line-through; }

/* Keep the original independently stacked sheet columns and card spacing. */
.sheet-module { min-width:0; position:relative; }
.sheet-module[hidden] { display:none !important; }
.layout-handle { display:none; }
.layout-editor { margin:8px 0 16px; }
.layout-editor > summary { width:fit-content; cursor:pointer; }
.layout-editor[open] { padding:12px; border:1px solid var(--line); border-radius:var(--radius); }
.layout-rows { display:flex; flex-wrap:wrap; gap:12px 20px; margin:12px 0; }
.layout-row label { display:flex; align-items:center; gap:6px; }
.layout-editing .layout-handle { display:block; width:100%; padding:7px 12px; text-align:left; color:var(--ink); background:var(--bg-3); border:1px dashed var(--accent); border-radius:6px; cursor:grab; touch-action:none; }
.layout-editing .layout-column { min-height:90px; outline:1px dashed var(--line); }
.layout-editing .sheet-module { margin-top:6px; }
.layout-dragging { opacity:.45; }
.layout-drop-before::before,.layout-drop-after::after { content:''; position:absolute; left:0; right:0; height:4px; background:var(--accent); z-index:2; pointer-events:none; }
.layout-drop-before::before { top:-4px; }
.layout-drop-after::after { bottom:0; }
.layout-drop-column { outline:3px solid var(--accent) !important; }
@media print { .layout-editor,.layout-handle { display:none !important; } }
.cf-card details { margin-top:12px; }
.cf-card form > button { margin-top:8px; max-width:100%; white-space:normal; }
.cf-card .cf-history, .cf-card .cf-item { border-bottom:1px solid var(--line); padding:8px 0; overflow-wrap:anywhere; }

.unused-conditions { margin-top:8px; }
.unused-conditions > summary { cursor:pointer; color:var(--ink-3); font-size:12px; padding:5px 0; }
.unused-conditions[open] > summary { margin-bottom:6px; }

/* picks left in the builder, said over the sheet rather than by opening on them */
.todo-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding: 8px 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line));
  background: color-mix(in srgb, var(--accent) 10%, var(--bg-2));
  border-radius: var(--radius);
  font-size: 13px;
}

/* ---------------------------------------------------------- vitals bar

   Pinned to the top of the sheet's scroll while any tab is open (sheet.js
   vitalsBar): hit points and the damage box, armour, initiative, speed, what
   is held, and the slots. */

.vitals-bar {
  position: sticky;
  top: -18px;                 /* the panel's own top padding */
  z-index: 6;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 20px;
  margin: 0 0 12px;
  padding: 12px 16px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 6px 14px -10px rgb(0 0 0 / 60%);
}
.vitals-bar.hurt { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.vitals-bar.down { border-color: var(--red); }
.vb-hp { display: flex; flex-direction: column; gap: 4px; min-width: 150px; }
.vb-hp-now { display: flex; align-items: baseline; gap: 6px; }
.vb-hp-now .hp-cur {
  width: 70px;
  font: 700 26px/1 var(--serif);
  text-align: center;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 2px 4px;
}
.vb-hp .hp-max { font-size: 15px; color: var(--ink-3); }
.vb-hp .hp-bar { height: 6px; }
.vb-amt { display: flex; align-items: center; gap: 5px; }
.vb-amt .hp-amt { width: 58px; text-align: center; }
.vb-stats { display: flex; gap: 6px; }
.vb-stats .stat-box { min-width: 58px; padding: 4px 8px; }
.vb-stats .sb-v { font-size: 17px; }
.vb-status { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; flex: 1 1 200px; }
.vb-slots { display: inline-flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; }
.vb-slot { display: inline-flex; align-items: center; gap: 4px; }
.vb-lvl { font-size: 10px; letter-spacing: .06em; color: var(--ink-3); font-weight: 700; }

/* the spells a caster can reach, under the weapons */
.ready-spells { display: flex; flex-direction: column; }
.rs-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 50px 70px 80px auto auto;
  gap: 8px;
  align-items: center;
  padding: 4px 2px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.rs-row:last-child { border-bottom: 0; }
.rs-lvl, .rs-time, .rs-range { font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------------------------------------------------------------- phone

   The first screen of a phone used to be a name field, three buttons, the
   identity card, the tabs and "Customize layout" - no play at all. The
   identity shrinks to a line, the vitals stay pinned, and the tabs move to a
   bar at the bottom within reach of a thumb. */

@media (max-width: 600px) {
  .play-mode .sheet-head .portrait-slot, .play-mode .sheet-id .chips { display: none; }
  .play-mode .sheet-head { padding: 12px 12px; gap: 8px; }
  .play-mode .sheet-id h2 { font-size: 20px; }
  .play-mode .sheet-actions { flex-direction: row; align-items: center; gap: 6px; }
  .vitals-bar { top: -14px; gap: 8px 12px; padding: 8px 12px; }
  .vb-hp { min-width: 0; flex: 1 1 120px; }
  .vb-stats .stat-box { min-width: 48px; }
  .vb-amt { flex: 1 1 100%; }
  .vb-amt .btn { flex: 1; justify-content: center; }
  .play-mode .sheet-sections {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    margin: 0;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px));
    background: var(--bg-2);
    border-top: 1px solid var(--line);
  }
  .play-mode .sheet-sections .btn { justify-content: center; border-radius: 8px; }
  .play-mode .panel { padding-bottom: 90px; }
  .play-mode .layout-editor { display: none; }
  .rs-row { grid-template-columns: minmax(0, 1fr) 50px auto auto; }
  .rs-time, .rs-range { display: none; }
}

@media (max-width: 600px) {
  .play-mode .sheet-head { display: flex; flex-wrap: wrap; }
  .play-mode .sheet-id { flex: 1 1 100%; }
}
.rs-cast { display: inline-flex; gap: 3px; justify-content: flex-end; }
.rs-cast .btn { padding: 1px 7px; font-size: 11.5px; }

/* a held condition clears from the vitals bar with its ✕ */
.vb-status .chip.cond-on { display: inline-flex; align-items: center; gap: 4px; padding-right: 3px; }
.chip-x {
  display: inline-grid; place-items: center;
  width: 18px; height: 18px; border-radius: 50%;
  background: none; border: 0; padding: 0;
  color: inherit; opacity: .7; font-size: 10px; cursor: pointer;
}
.chip-x:hover { opacity: 1; background: rgb(0 0 0 / 25%); }
@media (any-pointer: coarse) { .chip-x { width: 24px; height: 24px; } }
