/* =====================================================================
   Compendium theme v54 - "Arcane Ink"
   New colour system, type and components. Loaded after the main stylesheet,
   so everything here intentionally wins over older rules.
   Light is the default; dark is a toggle.
   ===================================================================== */

/* ---------- 1. Colour tokens ---------- */
:root,
:root[data-theme="light"]{
  color-scheme:light;
  --bg:#eef1f6; --surface:#ffffff; --panel:#ffffff; --panel-raised:#f6f8fc; --panel-soft:#edf1f8;
  --line:#d9e0eb; --line-strong:#b4c0d3;
  --text:#1b2433; --muted:#4f5d73; --dim:#76849a;
  --orange:#3454d1; --orange-bright:#2845b4; --orange-soft:#e8edfc;
  --blue:#2f5fd0; --purple:#6a4cbd; --purple-soft:#eee8fa;
  --green:#1d7a4b; --green-soft:#e4f4ec; --red:#b3261e; --red-soft:#fbe9e7;
  --gold:#a96b00; --gold-soft:#fff3d6;
  --ink:#15203a; --ink-2:#22336b;
  --shadow:0 1px 2px #1b243314, 0 8px 22px #1b24330d;
}
:root[data-theme="dark"]{
  color-scheme:dark;
  --bg:#0f131b; --surface:#171c27; --panel:#171c27; --panel-raised:#1e2533; --panel-soft:#262e3f;
  --line:#2c3649; --line-strong:#46536b;
  --text:#e8ecf4; --muted:#a9b4c8; --dim:#7e8ba2;
  --orange:#8aa4ff; --orange-bright:#a9bcff; --orange-soft:#1e2a52;
  --blue:#8aa4ff; --purple:#b9a2ff; --purple-soft:#2a2347;
  --green:#5fd09a; --green-soft:#12301f; --red:#ff8b81; --red-soft:#3a1a18;
  --gold:#f0b84b; --gold-soft:#3a2f12;
  --ink:#0b1020; --ink-2:#18265a;
  --shadow:0 1px 2px #0006, 0 10px 28px #0005;
}

/* ---------- 2. Type and base ---------- */
html{font-size:16px}
body{
  background:var(--bg); color:var(--text);
  font-family:"Inter","Segoe UI",system-ui,-apple-system,"Helvetica Neue",Arial,sans-serif;
  line-height:1.6; -webkit-font-smoothing:antialiased; text-rendering:optimizeLegibility;
}
h1,h2,h3,h4{font-family:inherit; letter-spacing:-.01em; line-height:1.25; color:var(--text)}
h1{font-size:clamp(26px,3.4vw,34px); font-weight:800}
h2{font-size:clamp(21px,2.4vw,26px); font-weight:750}
p,li{max-width:75ch}
a{color:var(--orange-bright)}
a:hover{text-decoration:underline}
.eyebrow{color:var(--orange-bright); font-size:11px; font-weight:800; letter-spacing:.12em}
.content-block h3{font-family:inherit; font-size:18px; color:var(--orange-bright); border-bottom:2px solid var(--orange-soft)}
.content-block p,.content-block li,.spell-description-paragraph{color:var(--text); font-size:15px; line-height:1.7}
.content-block strong,.spell-description-section-line strong{color:var(--text)}
:focus-visible{outline:3px solid var(--orange); outline-offset:2px}

/* ---------- 3. Buttons, inputs, tags ---------- */
.primary-button{
  border:1px solid var(--orange); border-radius:8px; background:var(--orange); color:#fff;
  font-weight:700; box-shadow:0 1px 2px #1b24332a;
}
.primary-button:hover{filter:brightness(1.08)}
:root[data-theme="dark"] .primary-button{color:#0b1020}
.secondary-button,.text-link-button{
  border:1px solid var(--line-strong); border-radius:8px; background:var(--surface); color:var(--text); font-weight:650;
}
.secondary-button:hover{border-color:var(--orange); background:var(--orange-soft); color:var(--orange-bright)}
.danger-button{border-radius:8px}
.form-input,input[type="text"],input[type="search"],input[type="email"],input[type="password"],input[type="number"],select,textarea{
  border:1px solid var(--line-strong); border-radius:8px; background:var(--surface); color:var(--text);
}
.form-input:focus,input:focus,select:focus,textarea:focus{border-color:var(--orange); box-shadow:0 0 0 3px var(--orange-soft)}
.tag,.pill{border:1px solid var(--line); background:var(--panel-soft); color:var(--text); font-weight:700}
.tag.gold,.pill.gold{border-color:var(--gold); background:var(--gold-soft); color:var(--gold)}
.tag.blue,.pill.blue{border-color:var(--orange); background:var(--orange-soft); color:var(--orange-bright)}
.tag.green,.tag.mint,.pill.green{border-color:var(--green); background:var(--green-soft); color:var(--green)}
.tag.violet,.pill.violet{border-color:var(--purple); background:var(--purple-soft); color:var(--purple)}

/* ---------- 4. Header and navigation ---------- */
.topbar,
:root[data-theme] .topbar{background:var(--ink); border-bottom:3px solid var(--orange); box-shadow:0 4px 16px #0a122433}
.character-context-bar,
:root[data-theme] .character-context-bar{background:transparent; border-top:1px solid #ffffff1f}
.topbar>.brand,.topbar .nav-item,.topbar .header-account{color:#eef2ff}
.topbar .nav-item{min-height:42px; border-radius:8px; font-size:12.5px; letter-spacing:.05em}
.topbar .nav-item:hover,.topbar .nav-item.active,.topbar .nav-item[aria-current="page"],
.topbar .header-account:hover,.topbar .header-account.active{background:#ffffff1f; border-color:#ffffff59; color:#fff}
.topbar .nav-item.active,.topbar .nav-item[aria-current="page"]{background:var(--orange); border-color:var(--orange); color:#fff}
:root[data-theme="dark"] .topbar .nav-item.active,:root[data-theme="dark"] .topbar .nav-item[aria-current="page"]{color:#0b1020}
.new-character-button{border-radius:8px; border-color:var(--orange); background:var(--orange); color:#fff}
:root[data-theme="dark"] .new-character-button{color:#0b1020}
.nav-dropdown-menu{border:1px solid var(--line-strong); border-radius:12px; background:var(--surface); box-shadow:0 16px 40px #0a12244d}
.nav-dropdown-menu .nav-item{color:var(--text); min-height:38px; text-transform:none; letter-spacing:0; font-size:14px; font-weight:600; justify-content:flex-start}
.nav-dropdown-menu .nav-item:hover{background:var(--orange-soft); color:var(--orange-bright); border-color:transparent}
.ux-menu-heading{color:var(--orange-bright)}
#header-active-character-profile{border-radius:8px}
.mobile-bottom-nav{background:var(--surface); border-top:1px solid var(--line)}
.mobile-bottom-nav>button.active,.mobile-bottom-nav>button[aria-current="page"]{color:var(--orange-bright); background:var(--orange-soft)}

/* side panel */
.side-rail{background:transparent}
.rail-panel-toggle{color:var(--muted); font-weight:800}
.rail-link{border-radius:8px; color:var(--text); font-weight:600}
.rail-link:hover{background:var(--panel-soft)}
.rail-link.active,.rail-link[aria-current="page"]{background:var(--orange-soft); color:var(--orange-bright); box-shadow:inset 3px 0 0 var(--orange)}

/* general cards */
.search-strip,.hero,.home-card,.character-dashboard,.character-saved-row{border-radius:12px; border-color:var(--line); box-shadow:var(--shadow)}

/* ---------- 5. Character sheet ---------- */
.ddb-sheet-page{gap:14px}
.ddb-sheet-page .ddb-sheet-header,.ddb-sheet .ddb-sheet-header{
  position:relative; padding:20px 24px; border:0; border-bottom:4px solid var(--orange); border-radius:14px;
  background:linear-gradient(120deg,var(--ink) 0%,var(--ink-2) 100%)!important; color:#fff; box-shadow:var(--shadow);
}
.ddb-sheet-avatar{
  display:grid; place-items:center; flex:0 0 auto; width:60px; height:60px; border:0; border-radius:16px;
  background:var(--orange); color:#fff; font-size:21px; font-weight:800; letter-spacing:.02em; box-shadow:0 4px 14px #0a122440;
}
:root[data-theme="dark"] .ddb-sheet-avatar{color:#0b1020}
.ddb-sheet-name-block h2{margin:2px 0 3px; color:#fff; font-size:clamp(24px,3vw,32px); font-weight:800}
.ddb-sheet-name-block p{margin:0; color:#cbd6f5; font-size:14px}
.ddb-sheet-name-block .eyebrow{color:#9db3ff}
.ddb-sheet-header-actions .secondary-button{
  min-height:40px; border:1px solid #ffffff4d; border-radius:8px; background:#ffffff14; color:#fff;
  font-size:13px; font-weight:700; text-transform:none; letter-spacing:.02em;
}
.ddb-sheet-header-actions .secondary-button:hover{background:#ffffff2e; border-color:#fff; color:#fff}

/* stat tiles */
.ddb-sheet-stat,.ddb-sheet-defense-stat,.ddb-sheet-defense-info{
  border:1px solid var(--line); border-radius:12px; background:var(--surface); box-shadow:var(--shadow);
}
.ddb-sheet-stat-label{color:var(--muted); font-size:11px; font-weight:800; letter-spacing:.09em; text-transform:uppercase}
.ddb-sheet-stat-value{color:var(--text); font-weight:800; font-variant-numeric:tabular-nums}
.ddb-sheet-stat-foot{color:var(--dim); font-size:12px}
.ddb-sheet-ability{border-top:4px solid var(--orange); min-height:104px}
.ddb-sheet-ability .ddb-sheet-stat-value{font-size:34px; line-height:1.1}
.ddb-sheet-core-stats .ddb-sheet-stat-value{font-size:28px}
.ddb-sheet-inspiration-stat{border-top:4px solid var(--gold)}
.ddb-sheet-defense-info strong{color:var(--orange-bright); font-size:12px; letter-spacing:.08em; text-transform:uppercase}

/* hit points: one calm card, extras tucked away */
.ddb-sheet-hp-stat{
  padding:18px 22px; border:1px solid var(--line); border-left:6px solid var(--green); border-radius:14px; background:var(--surface);
}
.ddb-sheet-hp-heading .ddb-sheet-stat-label{font-size:12px}
.ddb-sheet-hp-values{display:flex; align-items:baseline; gap:8px}
.ddb-sheet-hp-current{color:var(--green); font-size:46px; font-weight:800; line-height:1}
.ddb-sheet-hp-divider{color:var(--dim); font-size:30px}
.ddb-sheet-hp-maximum{color:var(--text); font-size:32px; font-weight:800}
.ddb-sheet-hp-bar{height:12px; border-radius:999px; background:var(--panel-soft); overflow:hidden}
.ddb-sheet-hp-bar-fill{border-radius:999px; background:linear-gradient(90deg,var(--green),#46c486)}
.ddb-sheet-hp-control{display:flex!important; flex-wrap:wrap; align-items:flex-start; gap:12px; margin-top:14px}
.ddb-sheet-hp-action{flex:1 1 280px; max-width:440px; padding:0; border:0; background:transparent}
.ddb-sheet-hp-action .form-input,.ddb-sheet-hp-action input{min-height:46px; font-size:18px; font-weight:700}
.ddb-sheet-hp-action .secondary-button{min-height:46px; padding-inline:18px; font-size:14px}
.ddb-sheet-hp-action-buttons .secondary-button:first-child{border-color:var(--green); background:var(--green-soft); color:var(--green)}
.ddb-sheet-hp-action-buttons .secondary-button:last-child{border-color:var(--red); background:var(--red-soft); color:var(--red)}
.ddb-sheet-hp-more{flex:1 1 100%}
.ddb-sheet-hp-more>summary{width:max-content; color:var(--orange-bright); font-size:13px; font-weight:750; cursor:pointer}
.ddb-sheet-hp-more-body{display:grid; grid-template-columns:repeat(auto-fit,minmax(230px,1fr)); gap:10px; margin-top:10px}
.ddb-sheet-hp-rule-note,.ddb-sheet-hp-save-status{flex:1 1 100%; color:var(--dim); font-size:12px}

/* cards in the three columns */
.ddb-sheet-card{padding:16px 18px; border:1px solid var(--line); border-radius:14px; background:var(--surface); box-shadow:var(--shadow)}
.ddb-sheet-card-heading{display:flex; align-items:center; justify-content:space-between; gap:10px; margin:0 0 8px; padding:0 0 9px; border-bottom:2px solid var(--orange-soft)}
.ddb-sheet-card-heading h3{margin:0; color:var(--orange-bright); font-size:12.5px; font-weight:800; letter-spacing:.1em; text-transform:uppercase}
.ddb-sheet-save-row,.ddb-sheet-passive-row,.ddb-sheet-skill-row{padding:8px 6px; border-bottom:1px solid var(--line); font-size:14.5px}
.ddb-sheet-skill-row:nth-child(even){background:var(--panel-raised)}
.ddb-sheet-save-row strong,.ddb-sheet-passive-row strong,.ddb-sheet-skill-row strong{color:var(--text); font-variant-numeric:tabular-nums; font-weight:800}
.ddb-sheet-skill-ability{color:var(--dim); font-size:11px; font-weight:800; letter-spacing:.06em}
.ddb-sheet-training-dot{color:var(--line-strong)}
.ddb-sheet-training-dot.trained{color:var(--orange)}
.ddb-sheet-proficiency-group strong{color:var(--muted); font-size:11px; font-weight:800; letter-spacing:.09em; text-transform:uppercase}
.ddb-sheet-proficiency-group span{color:var(--text)}

/* tabs: Actions / Spells / Inventory / ... */
.ddb-sheet-column-main{gap:0}
.ddb-sheet-panel-tabs{
  position:sticky; top:var(--topbar-h,118px); z-index:8; display:flex; gap:2px; overflow-x:auto; padding:6px 8px 0;
  border:1px solid var(--line); border-bottom:1px solid var(--line-strong); border-radius:14px 14px 0 0; background:var(--surface); box-shadow:0 6px 14px #1b243310;
}
.ddb-sheet-panel-tab{
  flex:0 0 auto; padding:12px 16px; border:0; border-bottom:4px solid transparent; border-radius:8px 8px 0 0; background:transparent;
  color:var(--muted); font-size:12.5px; font-weight:800; letter-spacing:.07em; text-transform:uppercase; cursor:pointer;
}
.ddb-sheet-panel-tab:hover{background:var(--panel-soft); color:var(--text)}
.ddb-sheet-panel-tab[aria-selected="true"]{border-bottom-color:var(--orange); background:var(--orange-soft); color:var(--orange-bright)}
.ddb-sheet-panel{padding:18px; border:1px solid var(--line); border-top:0; border-radius:0 0 14px 14px; background:var(--surface); box-shadow:var(--shadow)}
.ddb-sheet-section-title{margin:18px 0 10px; color:var(--text); font-size:17px; font-weight:800}
.ddb-sheet-section-title:first-child{margin-top:0}

/* resources, spells, features */
.ddb-sheet-resource,.ddb-sheet-spell-row,.ddb-sheet-feat-row,.ddb-sheet-inventory-item,.ddb-sheet-identity-card{
  border:1px solid var(--line); border-radius:12px; background:var(--panel-raised);
}
.ddb-sheet-resource strong,.ddb-sheet-spell-row strong{color:var(--text)}
.ddb-sheet-feature{border:1px solid var(--line); border-radius:12px; background:var(--panel-raised)}
.ddb-sheet-feature>summary{padding:12px 14px; color:var(--text); font-size:14.5px; font-weight:750}
.ddb-sheet-feature[open]>summary{border-bottom:1px solid var(--line); color:var(--orange-bright)}
.ddb-sheet-feature-body{padding:6px 16px 14px}
.ddb-sheet-spell-detail{border-left:4px solid var(--orange); background:var(--orange-soft)}
.ddb-sheet-spell-summary{color:var(--text)}
.ddb-sheet-spell-facts{color:var(--muted)}

/* ---------- 6. Layout rhythm ---------- */
.page-shell{gap:22px}
.content-area{min-width:0}
.character-builder-guide{border-radius:14px; border:1px solid var(--line); box-shadow:var(--shadow)}
.character-builder-step.complete .character-builder-step-number{background:var(--green); color:#fff}

@media(max-width:680px){
  .ddb-sheet-header{padding:16px}
  .ddb-sheet-hp-current{font-size:40px}
  .ddb-sheet-panel{padding:14px}
  .ddb-sheet-panel-tab{padding:12px 13px}
}

/* wider main column so all seven tabs fit on laptop screens */
@media(min-width:1321px){
  .ddb-sheet-columns{grid-template-columns:minmax(200px,.7fr) minmax(220px,.8fr) minmax(0,1.9fr)}
}
.ddb-sheet-panel-tab{padding:12px 13px; letter-spacing:.05em}.ddb-sheet-panel-tab{padding:12px 10px; font-size:12px; letter-spacing:.04em}@media(max-width:680px){.ddb-sheet-core-stats{grid-template-columns:repeat(2,minmax(0,1fr))!important}.ddb-sheet-core-stats>.ddb-sheet-defense-info{grid-column:1/-1!important}}
/* =====================================================================
   Guided character creator (v54)
   ===================================================================== */
/* Focus on the build: hide the generic page title while the guide is showing */
#app:has(.character-builder-guide) .ux-page-heading{display:none}

/* Layout: steps across the top, content left, live summary right */
.character-tabs-layout.creator-layout{display:grid; grid-template-columns:minmax(0,1fr) 330px; gap:20px; align-items:start}
.creator-layout>.character-builder-guide{grid-column:1/-1}
.creator-layout>.ux-section-picker,.creator-layout>.character-tabs{display:none!important}
.creator-layout>.character-tab-panel,.creator-layout>.character-builder-bottom-actions{grid-column:1}
.creator-layout>.creator-summary{grid-column:2; grid-row:2 / span 8; position:sticky; top:calc(var(--topbar-h,118px) + 14px); align-self:start}

/* Stepper */
.character-builder-guide{padding:20px 22px; background:var(--surface)}
.character-builder-guide-title h2{margin:2px 0 0}
.character-builder-progress{display:none}
.character-builder-steps{display:grid!important; grid-template-columns:repeat(6,minmax(0,1fr)); gap:8px; margin-top:14px; padding:0!important; border:0!important; background:transparent!important}
.character-builder-step{
  display:flex; align-items:center; gap:10px; min-height:58px; padding:10px 12px; border:1px solid var(--line)!important; border-radius:12px;
  background:var(--panel-raised)!important; color:var(--text)!important; text-align:left; cursor:pointer;
}
.character-builder-step:hover{border-color:var(--orange)!important}
.character-builder-step-number{
  display:grid; flex:0 0 auto; place-items:center; width:30px; height:30px; border:0!important; border-radius:50%;
  background:var(--panel-soft)!important; color:var(--muted)!important; font-size:13px; font-weight:800;
}
.character-builder-step-copy{min-width:0}
.character-builder-step-copy strong{display:block; color:var(--text)!important; font-size:13px; font-weight:750; letter-spacing:0; text-transform:none}
.character-builder-step-description{display:block; color:var(--muted)!important; font-size:11.5px; line-height:1.3}
.character-builder-step.current{border-color:var(--orange)!important; background:var(--orange-soft)!important; box-shadow:0 0 0 2px var(--orange)}
.character-builder-step.current .character-builder-step-number{background:var(--orange)!important; color:#fff!important}
:root[data-theme="dark"] .character-builder-step.current .character-builder-step-number{color:#0b1020!important}
.character-builder-step.complete .character-builder-step-number{background:var(--green)!important; color:#fff!important}
:root[data-theme="dark"] .character-builder-step.complete .character-builder-step-number{color:#07210f!important}
.character-builder-actions{margin-top:14px}
.character-builder-bottom-actions{display:flex; justify-content:space-between; gap:12px; margin-top:6px}

/* Step panels read as cards */
.creator-layout>.character-tab-panel{padding:22px; border:1px solid var(--line); border-radius:14px; background:var(--surface); box-shadow:var(--shadow)}

/* Pick-from-cards */
.creator-picker{margin-bottom:26px}
.creator-picker-head h3{margin:0 0 4px; font-size:21px}
.creator-picker-help{margin:0 0 14px; color:var(--muted)}
.creator-picker-search{max-width:440px; min-height:46px; margin-bottom:14px}
.creator-card-grid{display:grid; grid-template-columns:repeat(auto-fill,minmax(235px,1fr)); gap:14px}
.creator-card{display:flex; flex-direction:column; gap:7px; padding:15px; border:1px solid var(--line); border-radius:14px; background:var(--surface); box-shadow:var(--shadow)}
.creator-card:hover{border-color:var(--orange)}
.creator-card.selected{border-color:var(--green); background:var(--green-soft); box-shadow:0 0 0 2px var(--green)}
.creator-card-art{width:100%; height:130px; border-radius:10px; background:var(--panel-soft); object-fit:cover; object-position:top}
.creator-card h4{margin:0; font-size:17px; font-weight:800}
.creator-card-meta{margin:0; color:var(--orange-bright); font-size:12px; font-weight:700; line-height:1.4}
.creator-card-desc{display:-webkit-box; margin:0; overflow:hidden; color:var(--muted); font-size:13.5px; line-height:1.55; -webkit-line-clamp:4; -webkit-box-orient:vertical}
.creator-card-actions{display:flex; align-items:center; justify-content:space-between; gap:10px; margin-top:auto; padding-top:8px}
.creator-selected{border-color:var(--green)!important; color:var(--green)!important}
.creator-picker-empty{grid-column:1/-1; padding:18px; color:var(--muted); text-align:center}

/* Live summary */
.creator-summary-card{overflow:hidden; border:1px solid var(--line); border-radius:14px; background:var(--surface); box-shadow:var(--shadow)}
.creator-summary-card>summary{padding:13px 16px; background:var(--ink); color:#fff; font-size:12.5px; font-weight:800; letter-spacing:.09em; text-transform:uppercase; cursor:pointer}
.creator-summary-body{display:grid; gap:14px; padding:16px}
.creator-summary-name{margin:0; font-size:21px}
.creator-summary-rows{display:grid; gap:6px}
.creator-summary-row{display:flex; align-items:center; justify-content:space-between; gap:10px; width:100%; padding:10px 12px; border:1px solid var(--line); border-radius:10px; background:var(--panel-raised); color:var(--text); text-align:left; cursor:pointer}
.creator-summary-row:hover,.creator-summary-row.current{border-color:var(--orange); background:var(--orange-soft)}
.creator-summary-label{color:var(--muted); font-size:12px; font-weight:700}
.creator-summary-row strong{font-size:13.5px; font-weight:750; text-align:right; color:var(--dim)}
.creator-summary-row.done strong{color:var(--green)}
.creator-summary-stats{display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px}
.creator-summary-stat{display:grid; padding:9px 11px; border-radius:10px; background:var(--panel-soft)}
.creator-summary-stat span{color:var(--muted); font-size:11px; font-weight:800; letter-spacing:.06em; text-transform:uppercase}
.creator-summary-stat strong{font-size:22px; font-weight:800}
.creator-summary-abilities{display:grid; grid-template-columns:repeat(6,minmax(0,1fr)); gap:6px}
.creator-summary-ability{display:grid; justify-items:center; padding:7px 2px 6px; border:1px solid var(--line); border-top:3px solid var(--orange); border-radius:8px; background:var(--surface)}
.creator-summary-ability span{color:var(--muted); font-size:10.5px; font-weight:800; letter-spacing:.05em}
.creator-summary-ability strong{font-size:16px; font-weight:800}
.creator-summary-ability small{color:var(--dim); font-size:11px}

@media(max-width:1000px){
  .character-tabs-layout.creator-layout{grid-template-columns:minmax(0,1fr)}
  .creator-layout>.character-builder-guide{order:-2}
  .creator-layout>.creator-summary{grid-column:1; grid-row:auto; order:-1; position:static}
  .character-builder-steps{grid-template-columns:repeat(3,minmax(0,1fr))}
}
@media(max-width:560px){
  .character-builder-steps{grid-template-columns:repeat(2,minmax(0,1fr))}
  .character-builder-step-description{display:none}
  .creator-layout>.character-tab-panel{padding:16px}
  .creator-card-grid{grid-template-columns:minmax(0,1fr)}
}
/* =====================================================================
   Dice rolling, Equipment and Description steps (v54)
   ===================================================================== */
.is-rollable{cursor:pointer; transition:box-shadow .15s, transform .08s}
.is-rollable:hover{box-shadow:0 0 0 2px var(--orange)}
.is-rollable:active{transform:scale(.985)}
.ddb-sheet-skill-row.is-rollable:hover,.ddb-sheet-save-row.is-rollable:hover{background:var(--orange-soft)}
td.is-rollable{color:var(--orange-bright); font-weight:700; text-decoration:underline dotted}
.sheet-roll-tray{
  position:fixed; top:calc(var(--topbar-h,118px) + 10px); right:14px; z-index:60; width:min(320px,calc(100vw - 28px));
  padding:12px 14px; border:1px solid var(--line-strong); border-radius:14px; background:var(--surface); box-shadow:0 14px 36px #0a122440;
}
.sheet-roll-head{display:flex; align-items:center; justify-content:space-between}
.sheet-roll-close{border:0; background:transparent; color:var(--muted); font-size:22px; line-height:1; cursor:pointer}
.sheet-roll-modes{display:flex; gap:4px; margin:8px 0}
.sheet-roll-mode{flex:1; padding:7px 4px; border:1px solid var(--line); border-radius:8px; background:var(--panel-raised); color:var(--muted); font-size:12px; font-weight:700; cursor:pointer}
.sheet-roll-mode.active{border-color:var(--orange); background:var(--orange); color:#fff}
:root[data-theme="dark"] .sheet-roll-mode.active{color:#0b1020}
.sheet-roll-latest{display:grid; gap:2px; padding:10px 12px; border-radius:10px; background:var(--panel-soft); text-align:center}
.sheet-roll-label{font-size:13px; font-weight:750}
.sheet-roll-total{font-size:46px; font-weight:800; line-height:1}
.sheet-roll-latest.crit .sheet-roll-total{color:var(--green)}
.sheet-roll-latest.fumble .sheet-roll-total{color:var(--red)}
.sheet-roll-detail{color:var(--muted); font-size:12px}
.sheet-roll-log{margin:8px 0 0; padding-left:18px; color:var(--muted); font-size:12px; line-height:1.5}
@media(max-width:760px){.sheet-roll-tray{top:auto; right:10px; bottom:150px; left:10px; width:auto}}

.character-builder-steps{grid-template-columns:repeat(auto-fit,minmax(150px,1fr))!important}
@media(max-width:1000px){.character-builder-steps{grid-template-columns:repeat(3,minmax(0,1fr))!important}}
@media(max-width:560px){.character-builder-steps{grid-template-columns:repeat(2,minmax(0,1fr))!important}}

.creator-step-body{display:grid; gap:18px}
.creator-reference{padding:12px 14px; border-left:4px solid var(--gold); border-radius:8px; background:var(--gold-soft); font-size:14px}
.creator-reference p{margin:4px 0 0}
.creator-block{padding:16px; border:1px solid var(--line); border-radius:12px; background:var(--panel-raised)}
.creator-fields{display:grid; grid-template-columns:repeat(auto-fit,minmax(200px,1fr)); gap:12px}
.creator-field{display:grid; gap:5px; color:var(--muted); font-size:13px; font-weight:700}
.creator-field.wide{grid-column:1/-1}
.creator-field textarea{min-height:90px; line-height:1.5}
.ddb-sheet-gear{display:grid; gap:4px; margin-top:12px; padding:12px 14px; border:1px solid var(--line); border-radius:12px; background:var(--panel-raised)}
.ddb-sheet-gear strong{color:var(--muted); font-size:11px; font-weight:800; letter-spacing:.09em; text-transform:uppercase}
.ddb-sheet-detail-text{margin:0 0 8px; white-space:pre-wrap}
/* Eight steps fit on one row on desktop: number + name, description on phones/tablets only */
@media(min-width:1001px){
  .character-builder-steps{grid-template-columns:repeat(8,minmax(0,1fr))!important}
  .character-builder-step{flex-direction:column; align-items:flex-start; gap:6px; padding:10px}
  .character-builder-step-description{display:none}
}
/* =====================================================================
   Home and Browse pages (v54)
   ===================================================================== */
.home-page{gap:22px}
.home-hero{
  padding:30px 32px; border:0; border-bottom:4px solid var(--orange); border-radius:16px;
  background:linear-gradient(120deg,var(--ink) 0%,var(--ink-2) 100%); color:#fff; box-shadow:var(--shadow);
}
.home-hero .page-title,.home-hero h1{margin:4px 0 8px; color:#fff; font-size:clamp(28px,4vw,40px); font-weight:800}
.home-hero .page-intro{color:#d3dcf6; font-size:16px; max-width:52ch}
.home-hero .eyebrow{color:#9db3ff}
.home-hero .home-active-character{color:#9db3ff}
.home-hero .secondary-button{border-color:#ffffff59; background:#ffffff14; color:#fff}
.home-hero .secondary-button:hover{background:#ffffff2e; color:#fff}
.home-hero .primary-button{background:#fff; border-color:#fff; color:var(--ink)}
:root[data-theme="dark"] .home-hero .primary-button{color:#0b1020}

.home-characters .eyebrow{margin-bottom:2px}
.home-characters h2{margin:0 0 12px}
.home-character-row{display:grid; grid-template-columns:repeat(auto-fill,minmax(230px,1fr)); gap:12px}
.home-character-card{
  display:flex; align-items:center; gap:12px; padding:14px; border:1px solid var(--line); border-radius:14px; background:var(--surface);
  box-shadow:var(--shadow); color:var(--text); text-align:left; cursor:pointer;
}
.home-character-card:hover{border-color:var(--orange); background:var(--orange-soft)}
.home-character-card.active{border-color:var(--orange); box-shadow:0 0 0 2px var(--orange)}
.home-character-avatar{display:grid; flex:0 0 auto; place-items:center; width:46px; height:46px; border-radius:12px; background:var(--orange); color:#fff; font-size:16px; font-weight:800}
:root[data-theme="dark"] .home-character-avatar{color:#0b1020}
.home-character-text{display:grid; min-width:0}
.home-character-text strong{overflow:hidden; font-size:15px; text-overflow:ellipsis; white-space:nowrap}
.home-character-text small{overflow:hidden; color:var(--muted); font-size:12.5px; text-overflow:ellipsis; white-space:nowrap}

.home-feature-card,.home-browse-card{border:1px solid var(--line); border-radius:14px; background:var(--surface); box-shadow:var(--shadow)}
.home-feature-icon{display:grid; place-items:center; width:42px; height:42px; border-radius:12px; background:var(--orange-soft); color:var(--orange-bright); font-size:20px}
.home-browse-card h2,.home-feature-heading h2,.home-browse-section h2{font-family:inherit; font-size:19px; font-weight:800; letter-spacing:-.01em}
.home-browse-grid{gap:16px}
.home-browse-links{gap:8px}
.home-browse-link{
  display:flex; align-items:center; min-height:46px; padding:10px 14px; border:1px solid var(--line); border-radius:10px;
  background:var(--panel-raised); color:var(--text); font-size:14.5px; font-weight:700; text-decoration:none;
}
.home-browse-link:hover{border-color:var(--orange); background:var(--orange-soft); color:var(--orange-bright); text-decoration:none}

/* Reference lists (classes, species, spells, monsters ...) read as cards */
.section-head h2,.page-title{font-family:inherit}
.character-spell-row,.class-card,.species-card,.reference-card,.monster-card,.feat-card,.background-card{border-radius:12px; border:1px solid var(--line); background:var(--surface)}
.character-spell-row:hover,.class-card:hover,.species-card:hover,.reference-card:hover,.monster-card:hover{border-color:var(--orange)}
table{border-collapse:collapse}
th{background:var(--panel-soft); color:var(--text); font-weight:800}
td,th{border-color:var(--line)}.home-browse-card h2,.home-browse-card h3,.home-feature-card h2,.home-feature-card h3,.home-browse-section h2,.home-browse-section h3,h2,h3,h4{font-family:"Inter","Segoe UI",system-ui,-apple-system,"Helvetica Neue",Arial,sans-serif}
/* Ability Scores / Features / Feats steps: calmer cards and larger inputs (v54) */
.character-stats-panel,.character-hp-panel,.character-armour-class-panel,.organised-feature-panel{
  padding:18px; border:1px solid var(--line); border-radius:14px; background:var(--panel-raised); box-shadow:none;
}
.character-ability-score-panel .eyebrow,.character-hp-panel .eyebrow{margin-bottom:2px}
.ability-score-grid{display:grid!important; grid-template-columns:repeat(auto-fit,minmax(140px,1fr)); gap:12px}
.ability-score-grid>*{padding:12px; border:1px solid var(--line); border-top:4px solid var(--orange); border-radius:12px; background:var(--surface); text-align:center}
.ability-score-grid input{min-height:46px; font-size:20px; font-weight:800; text-align:center}
.ability-score-grid strong,.ability-score-grid .modifier{color:var(--orange-bright); font-weight:800}
.point-buy-budget{display:flex; justify-content:space-between; gap:12px; padding:12px 14px; border:1px solid var(--line); border-radius:10px; background:var(--surface)}
.character-row-note,.character-build-help{color:var(--muted); font-size:13.5px; line-height:1.6}
.character-feature-source{border:1px solid var(--line); border-radius:12px; background:var(--surface)}
.character-feature-source>summary{background:var(--panel-raised); font-weight:750}
.character-choice-card,.character-choice-section{border-radius:12px; border-color:var(--line); background:var(--surface)}
.choice-colour-key{color:var(--muted)}
/* Signed-out header: the "Sign in to select" click target must sit invisibly over the select box (it was rendering as a white bar) */
.header-character-switcher{position:relative}
.header-character-switcher .header-character-login-overlay{
  position:absolute; inset:0; top:0; right:0; bottom:0; left:0; z-index:5; width:100%; height:100%; padding:0; margin:0;
  border:0; border-radius:inherit; background:transparent; box-shadow:none; color:transparent; cursor:pointer;
}
.header-character-switcher .header-character-login-overlay:focus-visible{outline:3px solid var(--orange); outline-offset:2px}