.character-app { --sheet-green: #304d40; }
.md-content:has(.character-app) { max-width: 1160px; margin: 0 auto; }
.md-content:has(.character-app) .md-content__inner { margin-top: .8rem; }
.sheet-heading { padding: .5rem 0 1rem; }
.sheet-heading .eyebrow { margin-bottom: .5rem; }
.md-typeset .sheet-heading h1 { margin: 0 0 .4rem; font-size: 2.7rem; }
.sheet-heading > p:last-child { color: var(--codex-muted); margin: 0; }
.sheet-toolbar { display: flex; flex-wrap: wrap; align-items: end; gap: .5rem; padding: 1rem; background: var(--codex-paper); border: 1px solid var(--codex-line); border-radius: 9px; }
.character-app input:not([type="checkbox"]):not([type="file"]), .character-app select, .character-app textarea {
  display: block; width: 100%; min-width: 0; border: 1px solid var(--codex-line); border-radius: 5px; padding: .48rem .6rem; background: var(--md-default-bg-color); color: var(--md-default-fg-color); font: inherit; font-size: .72rem; line-height: 1.5; box-shadow: none;
}
.character-app textarea { resize: vertical; }
.character-app label { font-size: .61rem; font-weight: 600; color: var(--codex-muted); }
.character-app label > input, .character-app label > select, .character-app label > textarea { margin-top: .3rem; }
.character-app input::placeholder, .character-app textarea::placeholder { color: var(--codex-muted); opacity: .8; font-weight: 400; }
.character-app input:focus-visible, .character-app select:focus-visible, .character-app textarea:focus-visible, .character-app button:focus-visible, .import-button:focus-within { outline: 2px solid var(--codex-gold); outline-offset: 2px; }
.character-app [aria-invalid="true"] { border-color: #ae3450 !important; outline: 1px solid #ae3450; }
.roster-label { flex: 1 1 13rem; }
.sheet-button { display: inline-flex; gap: .6rem; justify-content: center; align-items: center; border: 1px solid var(--codex-line); border-radius: 5px; padding: .6rem .8rem; background: var(--codex-paper); color: var(--md-default-fg-color); font: inherit; font-size: .63rem; font-weight: 600; line-height: 1.5; cursor: pointer; white-space: nowrap; min-height: 2.25rem; }
.md-typeset .sheet-button.primary { background: #702e3e; color: #fff8ed; border-color: #702e3e; }
.sheet-button:hover { border-color: var(--codex-gold); }
.md-typeset a.sheet-button:hover { text-decoration: none; }
.import-button { position: relative; overflow: hidden; color: var(--md-default-fg-color) !important; }
.import-button input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.sheet-status { font-size: .61rem; margin: .6rem 0 .25rem !important; color: var(--md-typeset-a-color); min-height: 1.3em; }
.sheet-status.is-error { color: var(--md-typeset-a-color); border-left: 3px solid #ae3450; padding: .5rem .7rem; background: #ae345015; }
.sheet-privacy { margin: 0 0 1.2rem !important; color: var(--codex-muted); font-size: .57rem; }
.sheet-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 1.2rem; background: var(--sheet-green); color: #f3eddf; padding: 1.35rem; border-radius: 9px; }
.summary-identity { flex: 1 1 12rem; }
.sheet-summary .eyebrow { color: #d6bc89; font-size: .45rem; }
.md-typeset .sheet-summary h2 { color: #fff8ed; font-size: 1.7rem; margin: .25rem 0 .1rem; overflow-wrap: anywhere; }
.summary-identity p { color: #dad9ca; font-size: .61rem; margin: 0; }
.sheet-summary > div:not(.summary-identity) { text-align: center; min-width: 3.5rem; }
.sheet-summary small { display: block; font-size: .5rem; color: #dad9ca; }
.sheet-summary strong { font: 1.6rem Georgia, serif; }
.sheet-summary #summary-hp { font-size: 1.1rem; }
.sheet-tabs { display: flex; gap: .2rem; border-bottom: 1px solid var(--codex-line); padding-top: 1rem; overflow-x: auto; }
.sheet-tabs button { padding: .7rem .75rem; font: inherit; font-size: .62rem; color: var(--codex-muted); cursor: pointer; white-space: nowrap; border-bottom: 3px solid transparent; }
.sheet-tabs [aria-selected="true"] { color: var(--md-typeset-a-color); border-bottom-color: var(--md-typeset-a-color); font-weight: 700; }
.sheet-panel { padding: 1.2rem 0; }
.sheet-panel[hidden] { display: none; }
.panel-title { margin-bottom: 1.1rem; }
.md-typeset .panel-title h2 { margin: 0 0 .3rem; font-size: 1.5rem; }
.panel-title p, .field-hint { color: var(--codex-muted); font-size: .62rem; margin: .3rem 0 .8rem; }
.sheet-fields { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 1rem; }
.sheet-reference-links { display: flex; flex-wrap: wrap; gap: .8rem; font-size: .62rem; margin-top: 1rem; }
.sheet-tip { padding: 1rem; margin-top: 1.5rem; background: #a58b5710; border-left: 3px solid var(--codex-gold); color: var(--codex-muted); font-size: .65rem; }
.ability-grid { display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); gap: .65rem; }
.ability-card { text-align: center; padding: .8rem .6rem; background: var(--codex-paper); border: 1px solid var(--codex-line); border-radius: 8px; }
.ability-card input { text-align: center; font-size: 1.2rem !important; font-weight: 650; padding: .4rem !important; }
.ability-card output { display: inline-block; margin-top: .5rem; font: 1.3rem Georgia,serif; color: var(--md-typeset-a-color); }
.sheet-columns { display: grid; grid-template-columns: .85fr 1.3fr; gap: 1.5rem; }
.training-row { display: grid; grid-template-columns: minmax(5rem,1fr) 1.5rem minmax(4.5rem,5rem) 3rem; gap: .4rem; align-items: center; padding: .4rem 0; border-bottom: 1px solid var(--codex-line); font-size: .6rem; }
.training-row.save-row { grid-template-columns: minmax(6rem,1fr) 2rem 3rem; }
.training-row input[type="number"], .training-row select { font-size: .58rem !important; padding: .3rem !important; }
.training-row output { color: var(--md-typeset-a-color); font-weight: 700; text-align: center; }
.skill-name small { display: block; font-size: .42rem; color: var(--codex-muted); }
.sheet-checkbox { display: flex; align-items: center; gap: .4rem; font-size: .65rem !important; margin: .6rem 0; }
.sheet-checkbox input { margin: 0 !important; width: .8rem; height: .8rem; accent-color: #803148; flex-shrink: 0; }
.sheet-wide-label { display: block; margin: 1.1rem 0; }
.sheet-inline-fact, .spell-facts { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; margin: 1rem 0; padding: .8rem 1rem; background: var(--codex-paper); border: 1px solid var(--codex-line); border-radius: 6px; font-size: .7rem; }
.spell-facts strong, .sheet-inline-fact strong { margin-left: .4rem; font: 1.2rem Georgia,serif; color: var(--md-typeset-a-color); }
.slot-grid { display: grid; grid-template-columns: repeat(9,minmax(0,1fr)); gap: .4rem; }
.slot-card { padding: .55rem .4rem; background: var(--codex-paper); border: 1px solid var(--codex-line); border-radius: 5px; }
.slot-card strong { display: block; font-size: .58rem; color: var(--md-typeset-a-color); }
.slot-card label { display: block; font-size: .45rem; margin-top: .4rem; }
.slot-card input { padding: .3rem !important; font-size: .65rem !important; }
.spell-adder { display: flex; align-items: end; gap: .6rem; }
.spell-adder label { flex: 1; }
.spell-row { display: grid; grid-template-columns: minmax(5rem,1fr) 5.5rem minmax(6rem,1fr) auto; gap: .7rem; align-items: center; border-bottom: 1px solid var(--codex-line); padding: .6rem 0; font-size: .68rem; }
.sheet-button.small { padding: .4rem .6rem; font-size: .57rem; min-height: unset; }
.spell-row .sheet-checkbox { font-size: .58rem !important; }
.spell-empty { border: 1px dashed var(--codex-line); padding: 1rem; border-radius: 5px; color: var(--codex-muted); font-size: .66rem; }
.coins { grid-template-columns: repeat(5,minmax(0,1fr)); }
.sheet-print { display: none; }
.workshop-invite { display: flex; align-items: center; flex-wrap: wrap; gap: 1rem; justify-content: space-between; padding: 1.4rem; border: 1px solid var(--codex-line); border-radius: 9px; margin: 1.4rem 0; background: var(--codex-paper); }
.workshop-invite .eyebrow { font-size: .46rem; }
.md-typeset .workshop-invite h2 { margin: .3rem 0; font-size: 1.4rem; }
.workshop-invite p { color: var(--codex-muted); font-size: .65rem; margin: .25rem 0 0; }
@media (max-width: 1000px) { .sheet-columns { grid-template-columns: 1fr; } .slot-grid { grid-template-columns: repeat(5,minmax(0,1fr)); } }
@media (max-width: 600px) {
  .md-typeset .sheet-heading h1 { font-size: 2.1rem; }
  .sheet-toolbar { padding: .7rem; }
  .sheet-toolbar .roster-label { flex-basis: 100%; }
  .sheet-toolbar .sheet-button { flex: 1 1 auto; font-size: .59rem; }
  .sheet-summary { gap: .8rem; padding: 1rem; }
  .summary-identity { flex-basis: 100%; }
  .sheet-summary > div:not(.summary-identity) { min-width: 2.5rem; }
  .sheet-fields { grid-template-columns: repeat(2,minmax(0,1fr)); gap: .8rem; }
  .ability-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .slot-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .coins { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .spell-row { grid-template-columns: 1fr auto; }
  .spell-info { overflow-wrap: anywhere; }
  .spell-row > input { grid-row: 2; }
  .spell-row > button { grid-column: 2; grid-row: 2; }
  .training-row { grid-template-columns: minmax(4.5rem,1fr) 1.2rem 4.5rem 2.5rem; gap: .2rem; }
  .sheet-tabs button { min-height: 2.5rem; }
}
@media print {
  body:has(#character-app) { background: white !important; color: black !important; }
  body:has(#character-app) .md-header, body:has(#character-app) .md-tabs,
  body:has(#character-app) .md-sidebar, body:has(#character-app) .md-banner,
  body:has(#character-app) .codex-footer, body:has(#character-app) .md-top,
  body:has(#character-app) .reference-breadcrumb { display: none !important; }
  body:has(#character-app) .md-main__inner, body:has(#character-app) .md-content__inner { margin: 0 !important; }
  .character-app > :not(.sheet-print) { display: none !important; }
  .sheet-print { display: block; font-size: 10pt; color: black; }
  .md-typeset .sheet-print h1 { color: black; font-size: 24pt; }
  .md-typeset .sheet-print h2 { color: black; font-size: 14pt; border-bottom: 1px solid #bbb; break-after: avoid; margin: 12pt 0 4pt; }
  .sheet-print p { margin: 3pt 0; }
  .print-text { white-space: pre-wrap; overflow-wrap: anywhere; }
  .print-stats, .print-skills { display: grid; grid-template-columns: repeat(3,1fr); gap: 0 12pt; }
  .sheet-print a { color: black; }
}
.workshop-record { border: 1px solid var(--codex-line); border-radius: 8px; padding: .9rem 1rem; margin: .65rem 0; background: var(--codex-paper); }
.md-typeset .workshop-record h4 { margin: 0 0 .3rem; font: 1rem Georgia,serif; }
.workshop-record > label { display: block; margin: .65rem 0; }
.workshop-record > label > select { max-width: 16rem; }
.workshop-record .sheet-button { margin-top: .5rem; }
.record-controls { display: flex; flex-wrap: wrap; gap: .7rem; align-items: end; }
.record-controls > label:not(.sheet-checkbox) { flex: 1 1 12rem; }
.spell-source-summary { padding: .75rem 1rem; margin: .5rem 0; border-left: 3px solid var(--codex-gold); background: var(--codex-paper); border-radius: 0 6px 6px 0; }
.spell-source-summary > p { font-size: .63rem; margin: .25rem 0; }
.spell-source-summary > strong { font-size: .7rem; }
.rest-toolbar { display: flex; flex-wrap: wrap; gap: .5rem; margin: .6rem 0 1rem; }
.workshop-dialog { border: 1px solid var(--codex-gold); border-radius: 9px; padding: 1rem; background: var(--codex-paper); margin: 1rem 0; }
.workshop-dialog[hidden] { display: none; }
.workshop-dialog > .sheet-button { margin: .8rem .5rem 0 0; }
.workshop-dialog > label { display: block; margin: .6rem 0; }
.workshop-dialog .slot-grid { grid-template-columns: repeat(5,minmax(0,1fr)); }
.level-checklist > details { border: 0; margin: .6rem 0; box-shadow: none; background: transparent; }
.level-checklist > details > summary { background: #a58b5710; padding: .5rem .7rem; font-weight: 500; }
.level-checklist > details > summary::before, .level-checklist > details > summary::after { display: none; }
.rule-excerpt { white-space: pre-wrap; max-height: 14rem; overflow-y: auto; font-size: .64rem; }
.inventory-record { border: 1px solid var(--codex-line) !important; border-radius: 8px; background: var(--codex-paper) !important; box-shadow: none !important; padding: .5rem 1rem; margin: .8rem 0 !important; }
.inventory-record > summary { padding: .7rem 1rem !important; margin: -.5rem -1rem 0 !important; background: #a58b5710 !important; font-size: .7rem; }
.inventory-record > .sheet-fields { margin-top: 1rem; }
.inventory-record > p { font-size: .65rem; }
.weapon-roll { color: var(--md-typeset-a-color); font-weight: 600; }
.workshop-rule-options { margin: 1rem 0; }
#origin-choices { margin-top: 1rem; }
#equipment-body > select { max-width: 25rem; margin-bottom: .5rem; }
#equipment-body > .sheet-fields { margin-bottom: 1.3rem; }
.legacy-notes { white-space: pre-wrap; font-size: .65rem; }
.sheet-tabs { scrollbar-width: thin; }
#resource-section > details > input, #resource-section > details > select { margin-top: .5rem; }
@media(max-width:600px) { .workshop-dialog .slot-grid { grid-template-columns: repeat(3,minmax(0,1fr)); } .record-controls { display: grid; grid-template-columns: 1fr; } .inventory-record .sheet-fields { grid-template-columns: 1fr; } }
.character-app [hidden] { display: none !important; }

/* References and guided creation stay entirely on this host. */
.character-app .inventory-record > summary { padding-left:.7rem !important; padding-right:1.2rem !important; }
.character-app .inventory-record > summary::before { left:.8rem; }
.wiki-info { display:inline-flex!important; align-items:center; justify-content:center; padding:0!important; margin:0 .22em!important; min-width:0; border-radius:50%!important; font-weight:700; }
.wiki-sidepane,.creation-dialog { color:var(--md-default-fg-color); background:var(--md-default-bg-color); border:1px solid var(--md-default-fg-color--lightest); padding:1.4rem; box-shadow:0 1rem 4rem #0006; max-height:94dvh; overflow:auto; }
.wiki-sidepane { margin:0 0 0 auto; height:100dvh; max-height:100dvh; width:min(40rem,95vw); max-width:95vw; }
.creation-dialog { width:min(52rem,94vw); border-radius:1rem; }
.creation-dialog::backdrop,.wiki-sidepane::backdrop { background:#10131b88; }
.wiki-sidepane article { font-size:.85rem; line-height:1.65; }
.creation-dialog .sheet-fields { gap:1rem; display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,12rem),1fr)); }
.creation-dialog label { display:flex; flex-direction:column; gap:.3rem; }
.creation-dialog input,.creation-dialog select { border:1px solid #8887; border-radius:.3rem; padding:.5rem; }
.creation-dialog .sheet-checkbox { flex-direction:row; align-items:center; }
.creation-dialog .field-hint { white-space:pre-line; }
@media print { .wiki-sidepane,.creation-dialog,.wiki-info {display:none!important;} }
.wiki-info { width:1.15em!important; height:1.15em!important; max-width:none!important; min-height:0!important; align-self:center; justify-self:start; flex:0 0 auto; line-height:1; }
.creation-dialog .rest-toolbar { position:sticky; bottom:-1.4rem; background:var(--md-default-bg-color); padding:.8rem 0; border-top:1px solid #8883; }
.creation-error { color:#b33; font-weight:700; }
/* Each creation field owns its help icon; ability scores keep one aligned row each. */
.creation-dialog .creation-fields { grid-template-columns:repeat(2,minmax(0,1fr)); align-items:start; }
.creation-dialog .creation-reference-field { position:relative; }
.creation-dialog .creation-reference-field select { width:100%; padding-right:3rem; }
.creation-dialog .creation-reference-field > .wiki-info { position:absolute; right:.35rem; bottom:.35rem; margin:0!important; }
.creation-dialog .creation-scores { display:block; }
.creation-dialog .creation-scores > label { max-width:24rem; margin-bottom:1rem; }
.creation-score-row { display:grid; grid-template-columns:minmax(7rem,.7fr) repeat(2,minmax(0,1fr)); gap:1rem; align-items:center; padding:.65rem 0; border-bottom:1px solid #8883; }
.class-level-editors { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,16rem),1fr)); gap:1rem; }
.class-level-editor { display:flex; gap:.6rem; align-items:end; }
.class-level-editor label { flex:1; min-width:0; }
.class-level-editor input { width:100%; }
.class-level-editor .sheet-button { align-self:end; }
.spellbook-filters { margin:1rem 0; align-items:center; }
.character-app .sheet-fields > .sheet-button { align-self:end; }
@media(max-width:600px) {
 .creation-dialog .creation-fields { grid-template-columns:1fr; }
 .creation-score-row { grid-template-columns:repeat(2,minmax(0,1fr)); gap:.6rem; }
 .creation-score-row > strong { grid-column:1/-1; }
}
.creation-dialog .creation-reference-field > .wiki-info { right:1.9rem; }
.creation-dialog .creation-reference-field select { padding-right:4.4rem; }

#multiclass-section { margin:1rem 0; padding:1rem; border:1px solid var(--md-default-fg-color--lightest); border-radius:.6rem; }
#multiclass-section > h3 { margin-top:0; }
#level-guide > label { max-width:26rem; }
.preparation-breakdown { margin:.7rem 0; }
.preparation-breakdown table { width:100%; border-collapse:collapse; font-size:.65rem; }
.preparation-breakdown th,.preparation-breakdown td { padding:.4rem .6rem; text-align:left; border-bottom:1px solid #8883; }
.feature-reference,.action-reference { margin:.5rem 0; border:1px solid #8883; border-radius:.4rem; padding:.65rem; }
.character-app .feature-reference > summary,.character-app .action-reference > summary { margin:0; padding:.3rem .5rem .3rem 2.1rem; background:transparent; }
.feature-source { display:block; font-size:.6rem; font-weight:400; color:var(--codex-muted); }
.basic-actions { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:.6rem; align-items:start; }
.rule-excerpt { white-space:pre-line; overflow-wrap:anywhere; }
@media(max-width:600px) { .basic-actions { grid-template-columns:1fr; } }
.prepared-overview { display:flex; flex-wrap:wrap; gap:.6rem; margin:.8rem 0 1rem; }
.prepared-overview > div { display:flex; flex-direction:column; align-items:center; gap:.25rem; min-width:4rem; padding:.5rem .8rem; background:var(--codex-paper); border:1px solid #8883; border-radius:.4rem; font-size:.65rem; }
.prepared-overview strong { font-size:1rem; }

/* Workshop disclosure controls follow the Codex palette, including night mode. */
.md-typeset .character-app details { border:1px solid var(--codex-line); background:var(--codex-paper); color:var(--md-default-fg-color); box-shadow:none; }
.md-typeset .character-app details > summary { background:transparent; color:var(--md-default-fg-color); }
.md-typeset .character-app details > summary::before { display:none; }
.md-typeset .character-app details > summary::after { background-color:var(--codex-gold); }
.md-typeset .character-app details.feature-reference,
.md-typeset .character-app details.action-reference,
.md-typeset .character-app details.preparation-breakdown { padding:0; margin:.4rem 0; }
.md-typeset .character-app details.feature-reference > summary,
.md-typeset .character-app details.action-reference > summary,
.md-typeset .character-app details.preparation-breakdown > summary { margin:0; padding:.4rem 2rem .4rem .65rem; }
.md-typeset .character-app details.feature-reference > :not(summary),
.md-typeset .character-app details.action-reference > :not(summary) { margin:.5rem .65rem; }
.md-typeset .character-app .basic-actions { gap:.4rem; }
.md-typeset .character-app .basic-actions details { margin:0; }
.character-app .field-name { display:inline-flex; align-items:center; flex-wrap:wrap; gap:.15rem; }
.character-app .field-name .wiki-info { margin:0 .15rem; }
.character-app .creation-reference-field .wiki-info { position:static; }
.character-app .creation-reference-field select { padding-right:2rem; }
.character-app summary .wiki-info { vertical-align:middle; }
.character-app .feature-source { display:block; }
.character-app .skill-name .wiki-info { width:1.3rem; min-width:1.3rem; height:1.3rem; padding:0; margin:0 .1rem; }
.character-app #attack-section .workshop-record { margin:.5rem 0; }

.md-typeset .character-app .inventory-record > summary { padding:.6rem 2rem .6rem .7rem; }
@media(max-width:450px) { .character-app .ability-grid { grid-template-columns:repeat(2,minmax(0,1fr)); } }

/* Reference icons stay at the size of the label they explain. */
.md-typeset .character-app .wiki-info { font-size:1em !important; line-height:1; width:1.15em; min-width:1.15em; height:1.15em; min-height:0; padding:0 !important; margin:0 .22em; border:0; background:transparent; color:var(--codex-gold); vertical-align:baseline; }
.character-app .field-name { gap:0; }
.character-app .hit-dice-summary { display:block; margin:.3rem 0; font-size:.7rem; font-weight:600; color:var(--md-default-fg-color); }
.character-app .reference-concept { display:inline-flex; align-items:center; margin-right:1rem; }
.character-app .attack-group > h4 { color:var(--codex-gold); margin:1rem 0 .5rem; }
.character-app .level-progression-preview { border-left:2px solid var(--codex-gold); padding-left:.7rem; }

.character-app .sheet-button.danger { color:var(--md-default-fg-color); border-color:#a65353; }
.character-app .sheet-button.danger:hover { background:#a653531a; }
.character-app .delete-character-dialog { width:min(28rem,92vw); max-height:90dvh; overflow:auto; padding:1.3rem; border:1px solid var(--codex-line); border-radius:.7rem; background:var(--codex-paper); color:var(--md-default-fg-color); box-shadow:0 1rem 4rem #0006; }
.character-app .delete-character-dialog::backdrop { background:#10131b99; }
.character-app .delete-character-dialog h2 { margin-top:0; }

/* Explicit disclosure chevrons remain visible even beside checklist checkboxes. */
.md-typeset .character-app details > summary { position:relative; padding-right:2rem!important; list-style:none; }
.md-typeset .character-app details > summary::-webkit-details-marker { display:none; }
.md-typeset .character-app details > summary::after { display:block!important; content:"›"; position:absolute; right:.6rem; top:.45rem; width:1rem; height:1rem; margin:0; background:none; mask:none; -webkit-mask:none; color:var(--codex-gold); font-size:1.05rem; line-height:1; transform:rotate(0deg); }
.md-typeset .character-app details[open] > summary::after { transform:rotate(90deg); }

.carry-total { display:block; font-family:var(--codex-font-display,Georgia,serif);font-size:1.6rem;color:var(--codex-gold,#b18b49);margin:.35rem 0; }
.carry-warning { color:var(--codex-gold,#b18b49);font-weight:600; }
.carry-settings { margin-bottom:1rem; }

.xp-section { margin:1rem 0; }
.xp-section label { display:block;max-width:22rem; }
.xp-section progress { display:block; width:100%;height:.65rem;margin:1rem 0 .5rem;border:0;border-radius:1rem;overflow:hidden;background:var(--md-default-fg-color--lightest);accent-color:#bd9858; }
.xp-section progress::-webkit-progress-bar { background:var(--md-default-fg-color--lightest);border-radius:1rem; }
.xp-section progress::-webkit-progress-value { background:#bd9858;border-radius:1rem; }
.xp-section progress::-moz-progress-bar { background:#bd9858;border-radius:1rem; }

.sheet-summary #summary-hit-dice { font-size:1.1rem; overflow-wrap:anywhere; }

.spell-description { white-space:pre-line;line-height:1.7;overflow-wrap:anywhere; }
.spell-cast-controls { display:flex;flex-wrap:wrap;gap:.65rem;align-items:end;margin:1rem 0; }
.spell-cast-controls label { flex:1;min-width:12rem; }
.character-app details.spell-source-summary > summary { background:transparent;border:0;color:inherit;padding:.3rem 2rem .3rem 0; }
.character-app details.spell-source-summary { margin-bottom:.65rem; }

.character-app details.attack-card > summary,
.character-app details.spellbook-card > summary,
.character-app details.feat-card > summary,
.character-app details.ac-card > summary,
.character-app details.training-card > summary,
.character-app details.resource-card > summary,
.character-app details.companion-card > summary { margin:0;background:transparent;border:0;color:inherit;padding:.2rem 2rem .2rem 0; }
.attack-card-name, .spell-card-name, .feat-card-name, .resource-card-name { font-family:Georgia,serif;font-size:1rem;font-weight:400; }
.character-app .attack-card .feature-source { white-space:normal;overflow-wrap:anywhere; }

.md-typeset .character-app .spell-description { font-size:.62rem;color:var(--codex-muted); }

.md-typeset .character-app .benefit-description,
.md-typeset .character-app .ability-description { white-space:pre-line;line-height:1.7;overflow-wrap:anywhere;font-size:.62rem;color:var(--codex-muted); }

.character-app details.option-card > summary { margin:0;background:transparent;border:0;color:inherit;padding:.2rem 2rem .2rem 0; }
.character-app .option-selection { padding:.6rem 0;border-bottom:1px solid var(--codex-border); }
.character-app .option-selection:last-child { border-bottom:0; }
.character-app .resource-use-controls { display:flex;gap:.65rem;flex-wrap:wrap;align-items:end;margin:.7rem 0; }
.character-app .resource-use-controls label { flex:1;min-width:8rem; }
.character-app .package-contents { font-size:.62rem; }
.character-app .cast-metamagic { flex-basis:100%; }
.character-app #class-choice-section .option-card { margin-bottom:.65rem; }

.md-typeset .character-app .combat-rule-text p {font-size:.62rem;color:var(--codex-muted);line-height:1.7;white-space:pre-line;margin:.5rem 0}
.md-typeset .character-app .combat-rule-text h5 {font-size:.65rem;margin:.85rem 0 .25rem;color:var(--codex-gold)}
.calculation-sources {border-left:2px solid var(--codex-gold);padding-left:.6rem;margin:.7rem 0}
.calculation-note {display:block;font-size:.55rem;font-weight:normal;color:var(--codex-muted);line-height:1.5;margin-top:.2rem}

/* Keep expanded explanations outside the stat cells' intrinsic sizing. */
.sheet-summary > .summary-calculations {flex:0 0 100%;min-width:0;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));align-items:start;gap:.6rem;text-align:left}
.md-typeset .sheet-summary .summary-calculations .calculation-note {min-width:0;margin:0;font-size:.6rem;text-align:left}
.md-typeset .sheet-summary .summary-calculations summary {text-align:left;padding-right:1.5rem}
.md-typeset .sheet-summary .summary-calculations p {white-space:normal;overflow-wrap:anywhere;color:#f3eddf;margin:.6rem;font-size:.6rem;line-height:1.6}
@media(max-width:600px){.sheet-summary > .summary-calculations {grid-template-columns:minmax(0,1fr)}}
