:root {
  --bg: #0d1520;
  --bg-2: #132030;
  --card: #18283a;
  --card-2: #1f3247;
  --line: #2c4560;
  --text: #e6eef7;
  --muted: #8ea4bb;
  --accent: #8fd3ff;
  --accent-ink: #062033;
  --danger: #ff7b7b;
  --hit: #ffb86b;
  --ok: #7be0a6;
  --radius: 12px;
  font-family: Inter, system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 10% -10%, #1d3550 0%, transparent 60%),
    radial-gradient(900px 500px at 110% 10%, #1a2d44 0%, transparent 55%),
    var(--bg);
}

h1, h3 { font-family: Cinzel, Georgia, serif; letter-spacing: 0.02em; }
small, .muted { color: var(--muted); }
[hidden] { display: none !important; }

input, select, button { font: inherit; color: inherit; }

input, select {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  min-width: 0;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
input[type="number"] { -moz-appearance: textfield; }
input::-webkit-outer-spin-button, input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* Header */
.app-header {
  position: sticky; top: 0; z-index: 10;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px;
  background: rgba(13, 21, 32, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo { font-size: 28px; color: var(--accent); }
.brand h1 { margin: 0; font-size: 1.25rem; }
.brand p { margin: 0; font-size: 0.8rem; color: var(--muted); }

.tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.tab {
  background: transparent; border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 16px; cursor: pointer;
}
.tab.is-active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.tab.ghost { color: var(--muted); }

main { max-width: 1400px; margin: 0 auto; padding: 16px; }

/* Buttons */
.btn {
  background: var(--card-2); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 14px; cursor: pointer;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn.ghost { background: transparent; }
.btn.small { padding: 5px 10px; font-size: 0.85rem; }
.icon-btn {
  width: 28px; height: 28px; flex: none;
  display: inline-grid; place-items: center;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 6px; cursor: pointer; padding: 0;
}
.icon-btn:hover { border-color: var(--accent); }
.icon-btn.danger:hover { border-color: var(--danger); color: var(--danger); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }

/* Roster */
.players {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 560px), 1fr));
}
.player { border-top: 4px solid var(--player); padding: 12px 14px 16px; }
.player-head { display: flex; align-items: center; gap: 8px; }
.player-name {
  flex: 1; font-family: Cinzel, Georgia, serif; font-size: 1.15rem; font-weight: 700;
  background: transparent; border-color: transparent;
}
.player-name:hover { border-color: var(--line); }
.player-color { width: 32px; height: 32px; padding: 2px; cursor: pointer; }

.category { margin-top: 14px; }
.category h3 {
  margin: 0 0 6px; font-size: 0.9rem; color: var(--player);
  border-bottom: 1px solid var(--line); padding-bottom: 4px;
}
.count { font-family: Inter, sans-serif; font-size: 0.75rem; color: var(--muted); font-weight: 500; }

.stat-head, .figure {
  display: grid; align-items: center; gap: 4px;
  grid-template-columns: minmax(120px, 1fr) repeat(6, 42px) 96px 28px;
}
.stat-head { font-size: 0.72rem; color: var(--muted); text-align: center; padding: 0 0 2px; }
.stat-head .col-name { text-align: left; }
.figure { padding: 4px 0; border-bottom: 1px dashed rgba(44, 69, 96, 0.6); }
.figure .col-name { display: flex; flex-direction: column; min-width: 0; }
.figure .col-name input { background: transparent; border-color: transparent; padding: 3px 6px; font-weight: 600; }
.figure .col-name input:hover { border-color: var(--line); }
.figure .col-name small { padding-left: 7px; font-size: 0.72rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat { text-align: center; padding: 5px 2px; width: 100%; }
.hp { display: flex; align-items: center; justify-content: center; gap: 4px; }
.hp-val { min-width: 24px; text-align: center; font-weight: 600; color: var(--ok); }
.figure.is-out { opacity: 0.5; }
.figure.is-out .hp-val { color: var(--danger); }

.add-figure { display: flex; gap: 6px; margin-top: 8px; }
.add-figure select { flex: 1; }

.add-player {
  min-height: 160px; border: 2px dashed var(--line); border-radius: var(--radius);
  background: transparent; color: var(--muted); font-size: 1.1rem; cursor: pointer;
}
.add-player:hover { border-color: var(--accent); color: var(--accent); }
.add-player span { font-size: 0.85rem; }

@media (max-width: 640px) {
  .stat-head { display: none; }
  .figure { grid-template-columns: repeat(6, 1fr); row-gap: 6px; padding: 8px 0; }
  .figure .col-name { grid-column: 1 / -2; }
  .figure > .icon-btn.danger, .figure > span:last-child { grid-column: -2 / -1; justify-self: end; }
  .figure .col-hp { grid-column: 1 / -1; justify-content: flex-start; }
  .figure .col-hp::before { content: "Health"; color: var(--muted); font-size: 0.8rem; margin-right: 6px; }
  .figure .stat::placeholder { color: var(--muted); }
}

/* Combat */
.combat { padding: 16px; max-width: 980px; margin: 0 auto; }

.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.segmented label, .pills label {
  border: 1px solid var(--line); border-radius: 10px; cursor: pointer; background: var(--bg-2);
}
.segmented label { padding: 10px 14px; display: flex; flex-direction: column; }
.segmented label.is-active, .pills label.is-active { border-color: var(--accent); background: rgba(143, 211, 255, 0.12); }
.segmented input, .pills input { position: absolute; opacity: 0; pointer-events: none; }
.segmented strong { font-family: Cinzel, Georgia, serif; font-size: 1.05rem; }
.segmented small { font-size: 0.78rem; }

.matchup { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; margin-top: 16px; align-items: stretch; }
.vs {
  align-self: center; font-family: Cinzel, Georgia, serif; font-weight: 700; color: var(--accent);
  width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line);
}
.side {
  display: flex; flex-direction: column; gap: 10px;
  padding: 14px; border-radius: 10px; background: var(--bg-2);
  border: 1px solid var(--line); border-left: 4px solid var(--player);
}
.side h3 { margin: 0; font-size: 0.95rem; }
.side .muted { margin: 0; font-size: 0.85rem; }

.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { font-size: 0.8rem; padding: 2px 8px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); }
.chip b { color: var(--muted); margin-right: 4px; font-weight: 600; }
.chip.is-key { border-color: var(--accent); }
.chip.is-key b { color: var(--accent); }

.modifier { display: flex; flex-direction: column; gap: 6px; font-size: 0.88rem; }
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper span { min-width: 20px; text-align: center; font-weight: 600; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pills label { padding: 5px 10px; font-size: 0.85rem; }
.pills small { color: var(--accent); }

.die { display: flex; align-items: center; gap: 8px; margin-top: auto; font-size: 0.88rem; }
.die input { width: 72px; text-align: center; font-size: 1.1rem; font-weight: 600; }

.combat-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 16px 0; }

.result { border-top: 1px solid var(--line); padding-top: 16px; }
.result > .muted { text-align: center; margin: 0; }
.result > .btn { display: block; width: 100%; margin-top: 8px; }
.result-head {
  display: grid; grid-template-columns: 1fr 2fr 1fr; align-items: center; gap: 8px;
  padding: 12px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line);
}
.result-head.is-hit { border-color: var(--hit); }
.result-head.is-miss { border-color: var(--muted); }
.score { display: flex; flex-direction: column; align-items: center; min-width: 0; }
.score small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.score b { font-size: 2rem; font-family: Cinzel, Georgia, serif; }
.headline { text-align: center; font-family: Cinzel, Georgia, serif; font-size: 1.15rem; font-weight: 700; }
.is-hit .headline { color: var(--hit); }
.steps { margin: 12px 0 0; padding-left: 20px; font-size: 0.9rem; line-height: 1.6; }

@media (max-width: 640px) {
  .matchup { grid-template-columns: 1fr; }
  .vs { justify-self: center; }
  .result-head { grid-template-columns: 1fr 1fr; }
  .headline { grid-column: 1 / -1; grid-row: 1; }
}

/* Shared bits */
h2 { font-family: Cinzel, Georgia, serif; margin: 0 0 12px; font-size: 1.15rem; }
.center { text-align: center; }
.note { font-size: 0.88rem; color: var(--muted); margin: 8px 0 0; }
.btn:disabled { opacity: 0.6; cursor: default; }
.btn.apply { display: block; width: 100%; margin-top: 8px; }

.school-pick { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 0.85rem; color: var(--muted); }
.school-pick select { flex: 1; color: var(--text); }

.toggle { display: flex; align-items: center; gap: 8px; justify-content: center; margin-top: 14px; font-size: 0.88rem; cursor: pointer; }
.toggle input { width: 18px; height: 18px; accent-color: var(--accent); }

/* Spells */
.spell-layout { display: grid; gap: 16px; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); align-items: start; }
.cast-panel { padding: 16px; position: sticky; top: 84px; max-height: calc(100vh - 100px); overflow-y: auto; }
.book-panel { padding: 16px; }
@media (max-width: 960px) {
  .spell-layout { grid-template-columns: 1fr; }
  .cast-panel { position: static; max-height: none; }
}

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 0.8rem; color: var(--muted); }
.field select { color: var(--text); }
@media (max-width: 520px) { .field-row { grid-template-columns: 1fr; } }

.spell-summary {
  margin-top: 12px; padding: 12px; border-radius: 10px; background: var(--bg-2);
  border: 1px solid var(--line); border-left: 4px solid var(--school);
}
.spell-summary p { margin: 8px 0 0; font-size: 0.9rem; line-height: 1.5; }
.cn-line { color: var(--muted); }
.cn-line b { color: var(--text); }
.cn-big { font-size: 1.2rem; color: var(--accent) !important; }

.spell-meta { display: flex; flex-wrap: wrap; gap: 4px; }
.school-pill, .cat-pill, .tag { font-size: 0.72rem; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); white-space: nowrap; }
.school-pill { border-color: var(--school); color: var(--school); font-weight: 600; }
.cat-pill { background: var(--card); cursor: help; }
.tag { background: rgba(143, 211, 255, 0.1); border-color: transparent; color: var(--accent); }

.cast-controls { display: flex; flex-direction: column; gap: 12px; margin: 14px 0; }
.cast-controls .die { margin-top: 0; }
#cast-outcome .result { padding-top: 12px; }

.target-box {
  display: flex; flex-direction: column; gap: 10px; margin-top: 14px; padding: 12px;
  border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line);
}
.target-box h3 { margin: 0; font-size: 0.95rem; }
.target-box .die { margin-top: 0; }
.target-box .muted { margin: 0; font-size: 0.88rem; }
.result-head.compact { padding: 8px; }
.result-head.compact .score b { font-size: 1.5rem; }
.result-head.compact .headline { font-size: 1rem; }

.book-filters { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 8px; margin-bottom: 12px; }
@media (max-width: 640px) { .book-filters { grid-template-columns: 1fr; } }
.book-note { margin: 0 0 8px; font-size: 0.82rem; }
.book-list { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }

.spell-card {
  display: flex; flex-direction: column; gap: 8px; padding: 12px;
  border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line); border-top: 3px solid var(--school);
}
.spell-card header { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.spell-card h3 { margin: 0; font-size: 0.98rem; }
.spell-card p { margin: 0; font-size: 0.84rem; line-height: 1.45; color: #c9d6e3; flex: 1; }
.spell-card .btn { align-self: flex-start; }
.cn { display: flex; flex-direction: column; align-items: center; min-width: 40px; padding: 2px 6px; border-radius: 8px; border: 1px solid var(--school); }
.cn b { font-family: Cinzel, Georgia, serif; font-size: 1.1rem; }
.cn small { font-size: 0.65rem; }
.book-note { grid-column: 1 / -1; }
.field select, .target-box select { font-size: 0.95rem; }

.weapon { display: flex; flex-direction: column; gap: 4px; font-size: 0.88rem; }
.weapon select { font-size: 0.88rem; }
.warn { margin: 0; font-size: 0.8rem; color: var(--hit); }

/* Campaign */
.campaign { display: flex; flex-direction: column; gap: 4px; }
.campaign-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.campaign-head h2 { margin: 0; color: var(--player); }
.badges { display: flex; gap: 8px; }
.badge {
  display: flex; flex-direction: column; align-items: center; min-width: 64px; padding: 4px 10px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--bg-2);
}
.badge small { font-size: 0.7rem; }
.badge b { font-family: Cinzel, Georgia, serif; font-size: 1.4rem; }
.badge.is-ready { border-color: var(--ok); }
.badge.is-ready b { color: var(--ok); }

.campaign-section { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.campaign-section h3 { margin: 0 0 8px; font-size: 0.9rem; color: var(--player); }
.campaign-section h3 small { font-family: Inter, sans-serif; font-weight: 500; color: var(--muted); margin-left: 6px; }
.campaign-section .note { margin: 0 0 8px; }

.xp-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 4px 0; font-size: 0.88rem; }
.xp-row small { display: block; font-size: 0.74rem; }
.xp-row.check { cursor: pointer; }
.xp-row.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.xp-row .stepper span { min-width: 28px; }

.xp-total { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.xp-total summary { cursor: pointer; font-size: 0.92rem; }
.xp-total summary b { color: var(--ok); }
.xp-total ul, .history ul { list-style: none; margin: 6px 0 0; padding: 0; font-size: 0.82rem; }
.xp-total li { display: flex; justify-content: space-between; padding: 2px 0; color: var(--muted); }
.xp-total li b { color: var(--text); }

.adv-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
@media (max-width: 520px) { .adv-grid { grid-template-columns: repeat(2, 1fr); } }
.btn.adv { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; font-size: 0.85rem; }
.btn.adv small { font-size: 0.68rem; color: var(--muted); text-align: center; }
.btn.adv:not(:disabled) { border-color: var(--ok); }
.learn-row { display: flex; gap: 6px; margin-top: 8px; }
.learn-row select { flex: 1; min-width: 0; }
.learn-row + .note { margin-top: 6px; }

.known-spell {
  display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 8px;
  padding: 5px 8px; margin-bottom: 4px; border-radius: 8px; background: var(--bg-2); border-left: 3px solid var(--school);
}
.known-spell .name { font-size: 0.9rem; font-weight: 600; }
.known-spell .name small { font-weight: 400; margin-left: 4px; }
.known-spell .stat { width: 56px; }
.cn-val { font-family: Cinzel, Georgia, serif; font-size: 1.1rem; min-width: 28px; text-align: center; }
.cn.is-known { border-color: var(--ok); }
.cn.is-known small { color: var(--ok); }

.checklist { list-style: none; margin: 0 0 8px; padding: 8px 10px; border-radius: 8px; border: 1px dashed var(--line); font-size: 0.82rem; color: var(--muted); }
.checklist li.ok { color: var(--ok); }
.checklist.is-valid { border-color: var(--ok); }

.setup-box { margin-top: 10px; padding: 10px; border-radius: 10px; border: 1px dashed var(--accent); }
.setup-fields { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.setup-fields input { width: 100%; }
.setup-toggle { justify-content: flex-start; margin-top: 12px; }

.history summary { cursor: pointer; font-size: 0.9rem; color: var(--player); font-family: Cinzel, Georgia, serif; font-weight: 700; }
.history li { padding: 3px 0; border-bottom: 1px dashed var(--line); }
.history li small { display: block; }

.btn.xp { border-color: var(--ok); color: var(--ok); }

/* Uncontrolled creatures */
.creatures h2.player-name { margin: 0; padding: 6px 8px; color: var(--player); }
.creatures .note { margin: 4px 0 0; }
.summoned { margin: 2px 0 0 6px; padding: 2px 4px; font-size: 0.72rem; color: var(--muted); max-width: 100%; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50;
  max-width: min(560px, calc(100vw - 32px)); padding: 12px 18px; border-radius: 10px;
  background: var(--card-2); border: 1px solid var(--ok); color: var(--text);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45); font-size: 0.92rem;
  transition: opacity 0.5s, transform 0.5s;
}
.toast.is-leaving { opacity: 0; transform: translate(-50%, 10px); }

/* Treasure */
.treasure-layout { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 480px), 1fr)); align-items: start; }
.treasure-panel { padding: 16px; }
.panel-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px; }
.counts { display: flex; gap: 10px; font-size: 0.8rem; color: var(--muted); }
.tokens { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.token { padding: 10px 12px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line); }
.token.is-central { border-color: #e0c060; }
.token-head { display: flex; justify-content: space-between; align-items: center; }
.token-name { font-weight: 600; }
.status-pill { font-size: 0.72rem; padding: 2px 8px; border-radius: 999px; text-transform: capitalize; border: 1px solid var(--line); color: var(--muted); }
.status-pill.is-carried { border-color: var(--accent); color: var(--accent); }
.status-pill.is-secured { border-color: var(--ok); color: var(--ok); }
.status-pill.is-lost { border-color: var(--danger); color: var(--danger); }
.token-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.token-actions select { flex: 1; min-width: 160px; }
.carrier { margin: 6px 0 0; padding-left: 8px; border-left: 3px solid var(--player); font-size: 0.9rem; }
.carrier .fx { display: block; color: var(--hit); }
.end-game { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.end-game h3 { margin: 0 0 4px; font-size: 0.92rem; }
.end-lines { margin: 8px 0 0; padding-left: 18px; font-size: 0.88rem; }

.roll-group { margin-top: 14px; }
.roll-group h3 { margin: 0 0 6px; font-size: 0.95rem; color: var(--player); }
.roll-group h3 small { font-family: Inter, sans-serif; font-weight: 500; color: var(--muted); margin-left: 6px; }
.roll-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; padding: 8px 10px; margin-bottom: 6px; border-radius: 8px; background: var(--bg-2); border: 1px solid var(--line); }
.roll-row p { flex-basis: 100%; margin: 0; font-size: 0.88rem; }
.roll-row.is-pending { border-color: var(--hit); }
.roll-row.is-done { border-color: var(--ok); }
.roll-row ul { flex-basis: 100%; margin: 0; padding-left: 18px; font-size: 0.86rem; }
.roll-row .token-actions { flex-basis: 100%; margin-top: 2px; }

.chip.is-treasure { border-color: #e0c060; color: #e0c060; }

.vault-item { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px dashed var(--line); font-size: 0.88rem; }
.vault-item .kind { display: inline-block; min-width: 92px; color: var(--muted); }
.vault-item .ok { color: var(--ok); }
.stat.gold { width: 90px; }

/* Bases */
.base-options { margin: 8px 0 0; padding-left: 18px; font-size: 0.82rem; color: var(--muted); line-height: 1.5; }
.base-options b { color: var(--text); }
.base-effect { margin: 0 0 8px; font-size: 0.88rem; }
.resources, .move-base { margin-top: 10px; }
.resources summary, .move-base summary { cursor: pointer; font-size: 0.88rem; }
.resources summary small, .move-base summary small { color: var(--muted); }
.resource { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 0.86rem; }
.resource small { display: block; color: var(--muted); }
.resource.is-owned b { color: var(--ok); }
.resource .owned { display: flex; align-items: center; gap: 6px; color: var(--ok); white-space: nowrap; }
.resource .btn { white-space: nowrap; }
.base-bonus { color: var(--ok) !important; }

/* Rulebook page references */
.ref {
  display: inline-block; margin-left: 4px; padding: 0 6px; border-radius: 999px;
  font-size: 0.68rem; font-weight: 500; font-family: Inter, sans-serif; letter-spacing: 0;
  line-height: 1.5; vertical-align: 1px; white-space: nowrap; text-transform: none;
  color: var(--muted); border: 1px solid var(--line); background: var(--bg);
}
h3 .ref, h2 .ref { vertical-align: 2px; }

/* Rules gaps: traits, shooting modifiers, shooting into combat, scrolls, kills */
.toggle.small { justify-content: flex-start; margin-top: 8px; font-size: 0.82rem; }
.toggle.small input { width: 16px; height: 16px; flex: none; }
.chip.is-trait { border-color: #c79bff; color: #d8bcff; }
.into-combat { margin-top: 6px; padding: 8px; border: 1px dashed var(--line); border-radius: 8px; display: grid; gap: 6px; }
.into-combat .note { margin: 0; }
.combat-group small { color: var(--muted); font-size: 0.75rem; }
.illusion { display: block; color: #d8bcff; font-size: 0.72rem; margin: 2px 0 0 6px; }
.killed { display: block; color: var(--muted); font-size: 0.72rem; margin: 2px 0 0 6px; }
.target-warn { color: #ffb15c; font-size: 0.88rem; margin: 8px 0 0; }
.scroll-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }

/* Before game */
.pregame-layout { display: grid; gap: 16px; max-width: 900px; margin: 0 auto; }
.pregame-layout > .card { padding: 16px 18px; }
.pregame-layout h2 { margin: 0 0 6px; }
.pregame-attempt .muted { font-size: 0.88rem; margin: 0; }
.pregame-spells .roll-group { margin-top: 12px; }
.pregame-caster { border-top: 1px dashed var(--line); padding-top: 8px; margin-top: 8px; }
.pregame-caster h4 { margin: 0 0 6px; font-size: 0.95rem; }
.pregame-caster h4 small { color: var(--muted); font-weight: 400; }
.pregame-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.pregame-form .die { margin-top: 0; }
.pregame-attempt { margin-top: 10px; display: grid; gap: 6px; }
.pregame-attempt details summary { cursor: pointer; color: var(--muted); font-size: 0.82rem; }
.initiative li { border-left: 3px solid var(--player); padding-left: 8px; }

/* After game, level record, status tags */
.after-step h2 { display: flex; align-items: center; gap: 8px; }
.step-no { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #0b1622; font-size: 0.9rem; flex: none; }
.after-row { border-top: 1px dashed var(--line); padding: 8px 0; display: grid; gap: 6px; }
.after-row:first-of-type { border-top: 0; }
.survival-result { margin: 0; font-size: 0.9rem; }
.survival-result.is-dead { color: #ff8a80; }
.survival-result.is-fullRecovery, .survival-result.is-closeCall { color: #9be29b; }
.toggle.small.inline { margin-top: 0; }
.debt { color: #ff8a80; }
.level-record { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 8px; font-size: 0.85rem; color: var(--muted); }
.level-record label { display: flex; align-items: center; gap: 6px; }
.level-record input { width: 64px; text-align: center; color: var(--text); }
.level-tag { color: var(--accent); font-weight: 600; }
.status-tags { display: flex; flex-wrap: wrap; gap: 4px; margin: 2px 0 0 6px; }
.status-tag { font-size: 0.7rem; padding: 1px 6px; border-radius: 999px; border: 1px solid #ffb15c; color: #ffb15c; }
.status-tag.is-dead { border-color: #ff8a80; color: #ff8a80; }
.status-tag.is-good { border-color: #9be29b; color: #9be29b; }

/* Page badges that open the rulebook PDF */
.ref.is-linked { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.ref a { color: inherit; text-decoration: none; }
.ref a:hover, .ref a:focus-visible { text-decoration: underline; }
