/* Site palette: warm ink world → near-black interface → parchment artifact.
   Load last on every document. Gameplay state colors and scene artwork stay
   with their owners; these selectors address the surrounding interface. */
:root{
 --site-world:#211c18;--site-panel:#100f0e;--site-panel-high:#1a1714;
 --site-text:#eee0c8;--site-muted:#bfb4a4;--site-line:#5a4b3c;
 --site-paper:#e7d7b7;--site-paper-high:#f1e5cc;--site-paper-ink:#30271e;
 --site-paper-muted:#68533c;--site-brass:#c9a46a;--site-action:#dec08d;
 --site-shadow:0 14px 34px #00000040;
 /* Bridge existing component contracts to the same palette. */
 --igtt-bg:var(--site-world);--igtt-surface:var(--site-panel);--igtt-surface-raised:var(--site-panel-high);
 --igtt-parchment:var(--site-paper);--igtt-paper:var(--site-paper);--igtt-paper-deep:#d5bd99;
 --igtt-cream:var(--site-text);--igtt-text:var(--site-text);--igtt-text-muted:var(--site-muted);--igtt-muted:var(--site-muted);
 --igtt-accent:var(--site-brass);--igtt-gold:var(--site-brass);--igtt-border:var(--site-line);
 --igtt-world-top:#2d241f;--igtt-world-upper:#261f1b;--igtt-world-mid:var(--site-world);--igtt-world-lower:var(--site-world);--igtt-world-deep:var(--site-world);--igtt-world-floor:#1a1512;
 --igtt-ink-1:var(--site-panel);--igtt-ink-2:var(--site-world);--igtt-ink-3:#0a0a0a;--igtt-ink-edge:var(--site-line);
 --igtt-shadow-card:var(--site-shadow);--igtt-shadow-book:0 28px 60px #00000066;
}
html:has(body[data-site-palette]){background:var(--site-world)!important;color-scheme:dark}
body[data-site-palette="book"]{
 /* Keep warm ink materials on the page even when legacy root themes load later. */
 --site-world:#211c18!important;--site-panel:#100f0e!important;--site-panel-high:#1a1714!important;--site-line:#5a4b3c!important;
 --art-paper:var(--site-paper);--art-ink:var(--site-paper-ink);--art-gold:var(--site-brass);--art-line:var(--site-line);
 --bj-paper:var(--site-paper);--bj-ink:var(--site-paper-ink);--bj-gold:var(--site-brass);--bj-line:var(--site-line);
 background:radial-gradient(ellipse at 78% 0,rgba(201,164,106,.055),transparent 42%),linear-gradient(180deg,#27201b 0%,var(--site-world) 42%,#1d1815 100%),var(--site-world)!important;color:var(--site-text);
}
body[data-site-palette] :is(a,button,input,textarea,select,summary):focus-visible{outline:3px solid var(--site-action)!important;outline-offset:4px}
body[data-site-palette] ::selection{background:var(--site-action);color:var(--site-paper-ink)}
/* Navigation has one selected state regardless of the current world. */
body[data-site-palette] :is(.app-bottom-nav,.menu-options){background:#171411!important;border-color:var(--site-line)!important;box-shadow:var(--site-shadow)!important}
body[data-site-palette] .app-nav-item{color:var(--site-muted)!important}
body[data-site-palette] :is(.app-nav-item.is-active,.app-nav-item[aria-current=page],.book-journey-nav a[aria-current]){background:var(--site-paper)!important;color:var(--site-paper-ink)!important;border-color:var(--site-brass)!important}
body[data-site-palette] .app-nav-item[aria-current] :is(span,svg){color:var(--site-paper-ink)!important}
body[data-site-palette] :is(.menu-item,.menu-drawer-header,.app-context-mark){color:var(--site-text)!important}
body[data-site-palette] .menu-item:hover{background:var(--site-panel-high)!important}
/* Shared primary actions: brass is an instruction to act, not every border. */
body[data-site-palette] :is(.sp-btn:not(.is-ghost):not(.is-text),.igtt-btn-primary,.story-primary,.first-primary,.story-auth-submit,.daily-action){background:var(--site-action)!important;color:var(--site-paper-ink)!important;border-color:var(--site-brass)!important;text-shadow:none!important}
body[data-site-palette] :is(.sp-btn.is-ghost,.story-secondary,.story-link-button,.story-icon-button){background:var(--site-panel)!important;color:var(--site-text)!important;border-color:var(--site-line)!important}
body[data-site-palette] :is(.sp-btn.is-text,.arcade-back,.thought-show-back,.story-exit){color:var(--site-action)!important}
/* Profile: brighter raised cards against a genuinely darker page. */
body[data-site-palette].story-profile-world .story-profile-hero{background:linear-gradient(125deg,var(--site-panel-high),var(--site-panel))!important;border-color:var(--site-line)!important;box-shadow:var(--site-shadow)!important}
body[data-site-palette].story-profile-world :is(.story-profile-thought-summary,.story-profile-record,.story-profile-chapter,.igtt-social-privacy-card){background:var(--site-panel)!important;border:1px solid var(--site-line)!important;box-shadow:var(--site-shadow)!important}
body[data-site-palette].story-profile-world .story-profile-chapter.is-current{background:var(--site-panel-high)!important;border-color:var(--site-brass)!important}
body[data-site-palette].story-profile-world :is(.story-profile-record span,.story-profile-thought-summary p,.igtt-social-privacy-copy small){color:var(--site-muted)!important}
body[data-site-palette].story-profile-world .story-profile-tier-panel{background:#0c0c0c!important;color:var(--site-text)!important;border:1px solid var(--site-line)!important}
body[data-site-palette].story-profile-world .story-profile-tier-copy :is(span,strong,p){color:var(--site-text)!important}
body[data-site-palette].story-profile-world .story-profile-tier-action a{color:var(--site-action)!important}
/* Story hub and archive: paper belongs to the Book and recovered cards. */
body[data-site-palette] :is(.story-hub-status,.story-player-line,.story-hub-next,.story-hub-chapter,.story-archive-chapter,.story-legacy-record,.chapter-coming-soon-card){background:var(--site-panel)!important;border-color:var(--site-line)!important;box-shadow:var(--site-shadow)!important}
body[data-site-palette] :is(.sp-title,.story-archive-head h1,.chapter-coming-soon-copy h1){color:var(--site-text)!important}
body[data-site-palette] :is(.sp-copy,.story-hub-copy>p,.story-archive-head p,.chapter-coming-soon-copy p){color:var(--site-muted)!important}
body[data-site-palette] :is(.story-topbar,.story-options-panel,.story-revisit-panel){background:#171411f5!important;border-color:var(--site-line)!important;color:var(--site-text)!important}
/* Codex: a dark reading room with a visibly light writing surface. */
body[data-site-palette] :is(.codex-tabs,.codex-panel-intro,.codex-my-summary,.codex-collection-mark-card,.thoughts-collection-summary){background:var(--site-panel)!important;border-color:var(--site-line)!important;color:var(--site-text)!important}
body[data-site-palette] :is(.codex-page-inner,.codex-paper .book-page-inner){background:var(--site-paper-high)!important;color:var(--site-paper-ink)!important;box-shadow:inset 0 0 0 1px #9a805a40!important}
body[data-site-palette] .codex-page-inner :is(.codex-page-name,.book-page-chapter,.codex-question-title,.codex-answer-text,.codex-thought-text){color:var(--site-paper-ink)!important}
body[data-site-palette] .codex-page-inner :is(.codex-page-range,.codex-page-unlocked,.codex-loading){color:var(--site-paper-muted)!important}
body[data-site-palette] :is(.codex-tab[aria-selected=true],.codex-tab.is-active){background:var(--site-paper)!important;color:var(--site-paper-ink)!important;border-color:var(--site-brass)!important}
/* Arcade keeps its illustrations and game identities within the same shell. */
body[data-site-palette].arcade-art :is(.arcade-guess-copy,.arcade-pagebreak-copy,.arcade-game-v26-copy,.arcade-panel,.party-panel,.rush-panel,.muse-entry,.game-entry,.wars-economy,.read-room-history,.read-room-accuracy-card){background:var(--site-panel)!important;border-color:var(--site-line)!important;color:var(--site-text)!important;box-shadow:var(--site-shadow)!important}
body[data-site-palette].arcade-art :is(.arcade-pagebreak-visual,.arcade-guess-visual){background-color:#171411!important}
body[data-site-palette].arcade-art :is(.arcade-pagebreak-style-row a,.arcade-guess-style-row a){background:var(--site-panel-high)!important;border-color:var(--site-line)!important;color:var(--site-text)!important}
body[data-site-palette].arcade-art .arcade-hub-v26 .arcade-thought-show-v158{background:var(--site-paper)!important}
body[data-site-palette].arcade-art :is(.arcade-party-bar,.arcade-daily-loop-v132){background:var(--site-paper)!important;color:var(--site-paper-ink)!important}
body[data-site-palette] :is(.arcade-btn:not(.arcade-btn-quiet),.party-launch,.rush-main-btn){background:var(--site-action)!important;color:var(--site-paper-ink)!important;border-color:var(--site-brass)!important;-webkit-text-fill-color:var(--site-paper-ink);text-shadow:none!important}
body[data-site-palette] .arcade-btn-quiet{background:var(--site-panel-high)!important;color:var(--site-text)!important;border-color:var(--site-line)!important}
/* Collection and refinement share materials, not identical card backgrounds. */
body[data-site-palette] :is(.pb-collection-book,.levelup-v3-machine,.levelup-v3-identity){background:var(--site-panel)!important;border-color:var(--site-line)!important;box-shadow:var(--site-shadow)!important}
body[data-site-palette] :is(.book-next-step,.collection-field-note){background:var(--site-panel-high)!important;border-color:var(--site-brass)!important}
body[data-site-palette] :is(.pb-member.is-owned,.pb-member.is-known,.pb-detail-spread,.levelup-collection-primary){background:var(--site-paper)!important;color:var(--site-paper-ink)!important}
body[data-site-palette] .pb-member.is-locked{background:var(--site-panel-high)!important;color:var(--site-muted)!important;border-color:var(--site-line)!important}
body[data-site-palette] :is(.levelup-v3-wallet,.pb-collection-progress){background:var(--site-panel-high)!important;border:1px solid var(--site-line)!important;color:var(--site-text)!important;box-shadow:none!important}
body[data-site-palette] :is(.levelup-v3-wallet,.pb-collection-progress) :is(span,strong,small,b,i){color:var(--site-text)!important}
body[data-site-palette] #spinButton{background:var(--site-action)!important;color:var(--site-paper-ink)!important;border-color:var(--site-brass)!important}
/* Keep the original multi-color XP sectors in book1-journey.css; shared palette must not recolor wheels. */
body[data-site-palette].level-up-world #wheel .slice{color:#fff6e6!important;text-shadow:0 2px 2px #000!important}
/* Public entry, account, legal, legacy Q&A and leaderboard surfaces. */
body[data-site-palette] :is(.story-auth-card,.auth-card,.legal-shell,.first-preview,.first-codex-voices,.first-discover-card,.leaderboard-container,.leaderboard-card,.question-container,.question-card,.response-card,.answer-card,.thought-card,.thoughts-archive-card){background:var(--site-panel)!important;border-color:var(--site-line)!important;color:var(--site-text)!important;box-shadow:var(--site-shadow)!important}
body[data-site-palette] :is(.auth-title,.auth-card label,.legal-shell h1,.legal-shell h2,.first-intro h1){color:var(--site-text)!important}
body[data-site-palette] :is(.auth-copy,.auth-switch,.story-auth-footer,.legal-shell p,.legal-shell li,.first-lede,.first-discover-lede){color:var(--site-muted)!important}
body[data-site-palette] :is(.auth-form input,.auth-form select,.auth-form textarea){background:var(--site-world)!important;color:var(--site-text)!important;border-color:var(--site-line)!important;color-scheme:dark}
body[data-site-palette] :is(.auth-form input,.auth-form textarea)::placeholder{color:var(--site-muted)!important}
body[data-site-palette] :is(.legal-shell a,.auth-reset-link,.first-login){color:var(--site-action)!important}
/* Story tokens also reach chapter-owned controls without recoloring scenes. */
body[data-site-palette]{--sp-ink:var(--site-world);--sp-ink-2:var(--site-panel);--sp-paper:var(--site-paper);--sp-paper-deep:#d5bd99;--sp-cream:var(--site-text);--sp-gold:var(--site-brass);--sp-muted:var(--site-muted);--sp-line:var(--site-line)}
body[data-site-palette] .story-hub-record{background:var(--site-panel)!important;border-color:var(--site-line)!important}
body[data-site-palette] .story-hub-record-copy p{color:var(--site-muted)!important}
body[data-site-palette] .story-hub-status{background:transparent!important;box-shadow:none!important}
body[data-site-palette] .story-hub-status>span{background:var(--site-panel)!important;color:var(--site-muted)!important}
/* Codex chrome is charcoal; only the actual reading page is ivory. */
body[data-site-palette].codex-paper-world .codex-paper-sheet{background:var(--site-panel)!important;border:1px solid var(--site-line)!important;box-shadow:var(--site-shadow)!important;color:var(--site-text)!important}
body[data-site-palette].codex-paper-world :is(#codexMainTitle,.codex-simple-intro h2,.codex-panel-intro h2){color:var(--site-text)!important}
body[data-site-palette].codex-paper-world :is(.codex-world-head p,.codex-simple-intro p,.codex-simple-note,.codex-simple-actions small,.codex-panel-intro p){color:var(--site-muted)!important}
body[data-site-palette].codex-paper-world :is(.codex-world-kicker,.b1c-paper-kicker,#codexCommunityThoughtCount){color:var(--site-action)!important}
body[data-site-palette].codex-paper-world .codex-main-tabs{background:var(--site-world)!important;border-color:var(--site-line)!important;box-shadow:none!important}
body[data-site-palette].codex-paper-world .codex-main-tab{background:transparent!important;color:var(--site-muted)!important}
body[data-site-palette].codex-paper-world .codex-main-tab[aria-selected=true]{background:var(--site-paper)!important;color:var(--site-paper-ink)!important}
body[data-site-palette].codex-paper-world .codex-main-tab :is(span,small){color:inherit!important;opacity:1}
body[data-site-palette].codex-paper-world .codex-stumble-btn{background:var(--site-action)!important;color:var(--site-paper-ink)!important}
body[data-site-palette].codex-paper-world :is(.codex-my-summary,.codex-collection-mark-card){background:var(--site-paper)!important;color:var(--site-paper-ink)!important}
body[data-site-palette].codex-paper-world :is(.codex-my-summary,.codex-collection-mark-card) :is(span,strong,small){color:var(--site-paper-ink)!important}
body[data-site-palette] .codex-page-inner :is(.codex-q-text,.codex-answer-name,.codex-q-locked-text){color:var(--site-paper-ink)!important}
body[data-site-palette] .codex-page-inner :is(.codex-answer-artifact,.codex-answer-open,.codex-unlocked-by,.codex-q-locked-copy){color:var(--site-paper-muted)!important}
body[data-site-palette] .sp-btn[hidden]{display:none!important}
/* Light party invitations need dark controls, including legacy text-fill rules. */
body[data-site-palette] :is(#openCreateLobby,#pbCreateRoom){background:var(--site-paper-ink)!important;color:var(--site-paper-high)!important;-webkit-text-fill-color:var(--site-paper-high)!important;border-color:var(--site-paper-ink)!important}
body[data-site-palette] .arcade-party-bar :is(.arcade-kicker,.arcade-party-bar-intro strong,.arcade-party-bar-intro p,.arcade-quick-join button){color:var(--site-paper-ink)!important;-webkit-text-fill-color:var(--site-paper-ink)!important}
body[data-site-palette] .arcade-quick-join input{color:var(--site-paper-ink)!important;background:transparent!important;border-color:var(--site-paper-muted)!important}
body[data-site-palette] .arcade-quick-join input::placeholder{color:var(--site-paper-muted)!important;opacity:1}
body[data-site-palette] :is(.pb-quick-start,.pagebreak-story-bridge,.story-hub-record){background:var(--site-panel)!important;border-color:var(--site-line)!important}
/* A Thought is a reading artifact: ivory surface and real ink contrast. */
body[data-site-palette].response-detail-page :is(.thought-question-card,.thought-answer-card){background:var(--site-paper-high)!important;color:var(--site-paper-ink)!important;border-color:#9b805c!important}
body[data-site-palette].response-detail-page :is(.thought-detail-question-copy h1,.thought-number,.collectible-owner,.collectible-kicker,.thought-card-footer,.collectible-rarity){color:var(--site-paper-ink)!important}
body[data-site-palette].response-detail-page #original-answer{background:transparent!important;color:var(--site-paper-ink)!important;-webkit-text-fill-color:var(--site-paper-ink)!important}

/* Neutralize the older high-specificity plum and moss rules on the Book Level and Collection journey. */
body.book-journey-world.level-up-world[data-site-palette]{background:var(--site-world)!important;background-image:none!important;color:var(--site-text)!important}
body.book-journey-world.level-up-world[data-site-palette] :is(.levelup-v3-machine,.levelup-v3-identity,.levelup-v3-level-card,.levelup-v3-why,.levelup-v3-next-unlock,.levelup-v3-race-card){background:var(--site-panel)!important;border-color:var(--site-line)!important;color:var(--site-text)!important}
body.book-journey-world.level-up-world[data-site-palette] :is(.levelup-v3-machine-head,.levelup-v3-hero-copy,.levelup-v3-identity-copy,.levelup-v3-why,.levelup-v3-next-unlock,.levelup-v3-race-card) :is(h1,h2,h3,p,span,strong,small,b){color:var(--site-text)!important}
body.book-journey-world.level-up-world[data-site-palette] :is(.levelup-v3-wallet,.levelup-v3-machine,.levelup-v3-identity,.levelup-v3-level-card,.levelup-v3-why,.levelup-v3-next-unlock,.levelup-v3-race-card) :is(.muted,.subtle,.eyebrow){color:var(--site-muted)!important}
body.book-journey-world.level-up-world[data-site-palette] .book-next-step{background:var(--site-panel-high)!important;border-color:var(--site-brass)!important}
body.book-journey-world.level-up-world[data-site-palette] .levelup-collection-card{background:var(--site-paper)!important;color:var(--site-paper-ink)!important;border-color:var(--site-paper-muted)!important;box-shadow:0 6px 0 #171717,0 16px 30px #00000040!important}
body.book-journey-world.level-up-world[data-site-palette] .levelup-collection-card :is(h2,p,strong,b,span,small){color:var(--site-paper-ink)!important}
body.book-journey-world.level-up-world[data-site-palette] .levelup-collection-actions :is(a,button){background:var(--site-panel)!important;color:var(--site-paper-high)!important;border-color:var(--site-panel)!important}
body.book-journey-world.pagebreak-collection-page[data-site-palette]{background:var(--site-world)!important;background-image:none!important}
body.book-journey-world.pagebreak-collection-page[data-site-palette] :is(.collection-field-note,.pb-collection-book,.pb-collection-awakening,.pb-member.is-locked,.pb-member.is-identity-sealed){background:var(--site-panel)!important;border-color:var(--site-line)!important;color:var(--site-text)!important}
body.book-journey-world.pagebreak-collection-page[data-site-palette] .collection-field-note :is(span,p,strong,a){color:var(--site-text)!important}
body.book-journey-world.pagebreak-collection-page[data-site-palette] .pb-collection-filters button{background:var(--site-panel)!important;color:var(--site-muted)!important;border-color:var(--site-line)!important}
body.book-journey-world.pagebreak-collection-page[data-site-palette] .pb-collection-filters button.is-active{background:var(--site-paper)!important;color:var(--site-paper-ink)!important;border-color:var(--site-brass)!important}
body.book-journey-world.pagebreak-collection-page[data-site-palette] .collection-empty{color:var(--site-text)!important}

/* Card surfaces are neutral at their page boundary; parchment belongs to reading artifacts. */
body[data-site-palette].story-profile-world :is(.story-profile-hero,.story-profile-thought-summary,.story-profile-record,.story-profile-chapter,.igtt-social-privacy-card){background:var(--site-panel)!important;border-color:var(--site-line)!important;box-shadow:var(--site-shadow)!important}
body[data-site-palette].story-profile-world .story-profile-card.is-empty{background:var(--site-panel-high)!important;border-color:var(--site-line)!important}
body[data-site-palette].codex-paper-world :is(.codex-paper-sheet,.codex-panel-intro,.codex-my-summary,.codex-collection-mark-card){background:var(--site-panel)!important;color:var(--site-text)!important;border-color:var(--site-line)!important}
body[data-site-palette].codex-paper-world :is(.codex-my-summary,.codex-collection-mark-card) :is(span,strong,small,p){color:var(--site-text)!important}
body[data-site-palette].story-hub-world :is(.story-hub-record,.story-hub-next,.story-player-line,.story-hub-chapter){background:var(--site-panel)!important;border-color:var(--site-line)!important;box-shadow:var(--site-shadow)!important}
body[data-site-palette].story-archive-world :is(.story-archive-chapter,.story-legacy-record){background:var(--site-panel)!important;border-color:var(--site-line)!important}

/* Darker landing world, with black feature cards rather than tinted surfaces. */
body[data-site-palette="book"].first-book-world{background:radial-gradient(ellipse at 75% 0,rgba(201,164,106,.075),transparent 42%),linear-gradient(180deg,#241d19 0%,#1d1815 100%),#1d1815!important}
body[data-site-palette="book"].first-book-world .first-preview{background:#0c0c0c!important;border-color:#554432!important;color:var(--site-text)!important;box-shadow:0 14px 32px #00000045!important}
/* Center the card itself within the login/signup shell. */
body.story-auth-world[data-site-palette] .story-auth-shell{width:min(560px,calc(100% - 32px))!important;margin-inline:auto!important;box-sizing:border-box!important}
body.story-auth-world[data-site-palette] .story-auth-card{width:min(460px,100%)!important;margin-inline:auto!important;box-sizing:border-box!important;background:#0b0b0b!important;border-color:#66513d!important}
/* Current live-progress surface is black, not parchment: remove dark-on-dark text. */
body.book-journey-world.level-up-world[data-site-palette] .levelup-v3-machine>.levelup-v22-live-progress{background:#0e0e0e!important;color:var(--site-text)!important;border-color:#685640!important;box-shadow:0 5px 0 #483421,0 14px 26px #00000052!important}
body.book-journey-world.level-up-world[data-site-palette] .levelup-v22-live-progress-kicker{color:var(--site-action)!important;font-size:.68rem!important;line-height:1.45!important}
body.book-journey-world.level-up-world[data-site-palette] .levelup-v22-live-progress-kicker small{color:#d3c2a7!important;font-size:.61rem!important;line-height:1.45!important}
body.book-journey-world.level-up-world[data-site-palette] .levelup-v22-live-progress .levelup-v25-level-copy>span,
body.book-journey-world.level-up-world[data-site-palette] .levelup-v22-live-progress .levelup-v3-xp>span{color:#d5bea0!important;font-size:.68rem!important;line-height:1.35!important}
body.book-journey-world.level-up-world[data-site-palette] .levelup-v22-live-progress #thinkLevel{color:var(--site-text)!important;text-shadow:none!important}
body.book-journey-world.level-up-world[data-site-palette] .levelup-v22-live-progress #cardTotalXp{color:#f1cb8d!important;text-shadow:none!important}
body.book-journey-world.level-up-world[data-site-palette] .levelup-v22-live-progress #levelupBookTierMeta{color:#d4c3a9!important;font-size:.65rem!important;line-height:1.4!important}
body.book-journey-world.level-up-world[data-site-palette] .levelup-v22-live-progress #progressLabel{color:#ead9bc!important;font-size:clamp(.68rem,1vw,.85rem)!important;line-height:1.5!important;letter-spacing:.015em!important}
@media(max-width:600px){
 body.book-journey-world.level-up-world[data-site-palette] .levelup-v22-live-progress #progressLabel{font-size:.68rem!important;overflow-wrap:anywhere}
 body.book-journey-world.level-up-world[data-site-palette] .levelup-v22-live-progress .levelup-v3-level-head{grid-template-columns:minmax(0,1fr) auto!important}
}
