/* Shared reading palette. Images and token faces retain their original colors. */
html[data-theme=dark]{color-scheme:dark;background:#1c2c25}
html[data-theme=light]{color-scheme:light}
html[data-theme=dark] body{--paper:#24372e;--ground:#1c2c25;--ink:#e0e7cf;--text:#e2e4d8;--muted:#b4c0a9;--line:#445742;--soft:#304634;--accent:#d4b483;--highlight:#3e5b3a;color:var(--text);background:var(--ground)}
.reading-toggle{min-height:44px;padding:8px 10px;border:0;border-radius:4px;background:transparent;color:var(--muted,#b4c0a9);font:12px/1.5 system-ui;cursor:pointer}
.generator-links{display:block;padding:16px;background:#e0e7d9;border:1px solid #b1c1a5;border-radius:10px;box-shadow:0 6px 22px #253b2810}
.generator-group+.generator-group{border-top:1px solid #b1c1a5;margin-top:14px;padding-top:14px}
.generator-group-title{display:block;font:650 9px/1.5 system-ui;letter-spacing:.15em;text-transform:uppercase;color:#52694c;margin-bottom:8px}
.generator-group-items{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px}
.generator-links button,.generator-links .library-nav-link{display:flex;align-items:center;justify-content:flex-start;text-align:left;width:100%;min-height:44px;padding:10px;font-size:11px;line-height:1.45;border:1px solid #b1c1a5;background:#f8faf2;text-decoration:none;border-radius:5px}
.generator-links button.active{background:#35593e;border-color:#35593e;color:#fffbed;box-shadow:inset 3px 0 #c5d79d}
.generator-links button:hover,.generator-links a:hover{background:#cfddc1;color:#243b30}
.generator-group[hidden],.generator-links button[hidden]{display:none}
html[data-theme=dark] .generator-links{background:#142a24;border-color:#526b52;box-shadow:0 8px 24px #0002}
html[data-theme=dark] .generator-group+.generator-group{border-color:#3f5945}
html[data-theme=dark] .generator-group-title{color:#b8cca3}
html[data-theme=dark] .generator-links button,html[data-theme=dark] .generator-links .library-nav-link{background:#2c4335;border-color:#526b52;color:#e0e7cf}
html[data-theme=dark] .generator-links button.active{background:#526f45;border-color:#a6ba84;box-shadow:inset 3px 0 #d3e1ad;color:#fffceb}
html[data-theme=dark] .generator-links button:hover,html[data-theme=dark] .generator-links a:hover{background:#405b3b;color:#fffceb}
html[data-theme=dark] :is(.masthead,.tabs){background:#203329;border-color:var(--line)}
html[data-theme=dark] :is(.folio,.welcome-choice,dialog,.glossary-popover){background:var(--paper);border-color:var(--line);color:var(--text)}
html[data-theme=dark] :is(select,input:not([type=checkbox]):not([type=radio]):not([type=range]),textarea,.editor-panel textarea,dialog textarea,#tableSearch,.world-form input[type=number],.play-grid input,.play-grid select,.hero-workspace-layout textarea,.hero-workspace-layout input,.hero-workspace-layout select,#quickNotes,#favorQuestion,#threadForm textarea){background:#1d3027;color:var(--ink);border-color:#64745a}
html[data-theme=dark] :is(.secondary,.library-nav-link){background:#304634;border-color:#64745a;color:var(--ink)}
html[data-theme=dark] :is(.secondary:hover,.quiet:hover){background:#40563b}
html[data-theme=dark] .primary{background:#48633f;color:#fffbed;border:1px solid #829568}
html[data-theme=dark] .primary:hover{background:#567649}
html[data-theme=dark] :is(article p,#past p,.welcome-brand,.welcome-intro h1,.library-welcome-link,.glossary-popover a){color:var(--ink)}
html[data-theme=dark] :is(.welcome-intro>p:last-child,.welcome-choice-description,.welcome-footnote,.glossary-source){color:var(--muted)}
html[data-theme=dark] :is(.world-form,.spark-card,.enemy-card,.favor-card,.calendar-day,.session-cards article,.hero-slot,.bag-token-card,.travel-draw,.journey-level,.book-card.available){background:var(--paper);border-color:var(--line);color:var(--text)}
html[data-theme=dark] :is(.world-hook,.encounter-summary,.enemy-stats span,.tabs span,.learn-lesson,.weight-lesson,.rules-alert,.exert-notice,.travel-legend,#socialSuggestion,.calendar-day.selected,.spark-card strong,pre){background:var(--soft);color:var(--ink);border-color:var(--line)}
html[data-theme=dark] :is(.field,.orvah-value){background:#3e5b3a;color:#e6f1d5}
html[data-theme=dark] :is(.field:hover,.orvah-value:hover:not(:disabled)){background:#526f45}
html[data-theme=dark] .field.locked{background:#5b4934;color:#f1d4a8}
html[data-theme=dark] :is(.orvah-value:disabled,.sheet-field :disabled,.journey-level.coming-soon){background:#2d3b30;color:#aeb7a4}
html[data-theme=dark] .sheet-invalid{background:#634235!important}
html[data-theme=dark] :is(.combat-error,.weather-bag-heading .invalid,.input-error){color:#f1b09a}
html[data-theme=dark] #npcSocialResult{color:#c7e8bd}
html[data-theme=dark] .calendar-day .proposed{color:#dcc398}
html[data-theme=dark] .seal{border-color:#829568;color:#bdcca7}
html[data-theme=dark] .hint-dot{background:#94ac74}
html[data-theme=dark] .audience-switch button[aria-pressed=true]{background:#526f45;color:#fffbed}
html[data-theme=dark] .book-card.available{background:#304634}
html[data-theme=dark] .welcome-choice:hover{border-color:#b8cca3}
@media(max-width:740px){.generator-group-items{grid-template-columns:repeat(2,minmax(0,1fr))}.reading-toggle{right:12px;bottom:12px;font-size:11px}.masthead{padding-right:16px}}
@media print{.reading-toggle{display:none}html[data-theme=dark] body{--paper:#fff;--ground:#fff;--ink:#111;--text:#111;--muted:#444;--line:#ccc;--soft:#eee;background:white;color:black}}

/* Shared hierarchy: neutral prose, gold titles, amber headings, and sage subheads. */
html[data-theme=dark] body{--rhuna-body:#ece9df;--rhuna-title:#edd095;--rhuna-heading:#e3b776;--rhuna-subheading:#bdd5ad;--rhuna-eyebrow:#d6bc91;--text:var(--rhuna-body)}
html[data-theme=light] body{--rhuna-body:#293d33;--rhuna-title:#62401e;--rhuna-heading:#7b492a;--rhuna-subheading:#355c4c;--rhuna-eyebrow:#76532c}
html[data-theme] body h1{color:var(--rhuna-title)}
html[data-theme] body :is(h2,h3){color:var(--rhuna-heading)}
html[data-theme] body :is(h4,h5,h6){color:var(--rhuna-subheading)}
html[data-theme] body :is(.welcome-choice-title,.lib-nav-book,.welcome-brand){color:var(--rhuna-title)}
html[data-theme] body :is(.eyebrow,.generator-group-title){color:var(--rhuna-eyebrow)}
html[data-theme] body :is(#chapter p,#chapter li,#chapter td,article p,#past p){color:var(--rhuna-body)}
html[data-theme] body #chapter>p>strong:only-child{color:var(--rhuna-subheading)}
html[data-theme] body :is(.lib-reading th,.sheet-section>summary){color:var(--rhuna-heading)}
html[data-theme=light] body :is(.lib-cover,.books-hero) h1{color:#ffe6b2}
html[data-theme=light] body :is(.lib-cover,.books-hero) .eyebrow{color:#e2d3ae}
@media print{html[data-theme] body :is(h1,h2,h3,h4,h5,h6,.welcome-choice-title,.lib-nav-book,.welcome-brand,.eyebrow,.generator-group-title,#chapter p,#chapter li,#chapter td,#chapter>p>strong:only-child,.lib-reading th){color:#111!important}}

html[data-theme] body :is(h1,h2,h3,h4,h5,h6) a:not(.lib-heading-link){color:inherit}

/* Reading mode is chosen on Home and remembered across all pages. */
.welcome-reading{display:flex;justify-content:flex-end;margin:8px 0 16px}
#homeReadingToggle{position:static;box-shadow:none;z-index:auto}
#homeReadingToggle:hover{color:var(--ink);text-decoration:underline}
#homeReadingToggle:focus-visible{outline:2px solid currentColor;outline-offset:2px}

/* Compact, keyboard-accessible generator groups. */
.generator-group>summary.generator-group-title{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:44px;margin:0;cursor:pointer;list-style:none}.generator-group>summary::-webkit-details-marker{display:none}.generator-group>summary:after{content:'';width:7px;height:7px;border-right:1.5px solid currentColor;border-bottom:1.5px solid currentColor;transform:rotate(-45deg);margin-right:4px;flex:none}.generator-group[open]>summary:after{transform:rotate(45deg)}.generator-group[open]>.generator-group-items{padding-top:6px}.generator-group+.generator-group{margin-top:8px;padding-top:8px}.generator-group>summary:focus-visible{outline:2px solid currentColor;outline-offset:3px;border-radius:3px}

.character-options{margin-top:10px}.character-options>summary{cursor:pointer;min-height:44px;display:flex;align-items:center;justify-content:space-between;gap:12px;font:600 12px/1.5 system-ui;color:var(--muted);list-style:none;padding:8px 0}.character-options>summary::-webkit-details-marker{display:none}.character-options>summary:after{content:'';width:7px;height:7px;border-right:1.5px solid currentColor;border-bottom:1.5px solid currentColor;transform:rotate(-45deg);margin-right:5px}.character-options[open]>summary:after{transform:rotate(45deg)}.character-options-content{padding-top:10px}.character-options>summary:focus-visible{outline:2px solid currentColor;outline-offset:3px;border-radius:3px}
