/* Additive paper palette. The original styles remain the complete moon theme.
   Important declarations are restricted to paint properties: existing portrait,
   state and inline rules have many different specificities. No layout, hit area,
   capture geometry, image filter or animation is overridden here. */
.palm-theme-control[hidden]{display:none!important}
.palm-theme-control{display:inline-flex;align-items:center;max-width:100%;font-size:12px}
.palm-theme-control select{min-height:44px;max-width:100%;padding:8px 30px 8px 12px;border:1px solid #9d83b3;border-radius:14px;background:#251b32;color:#f9e7bd;font:inherit;cursor:pointer;touch-action:manipulation}
.palm-theme-control select:focus-visible{outline:3px solid #e8ca7c;outline-offset:3px}
html[data-palm-theme="paper"]{
  color-scheme:light;
  --theme-bg:#e7e2d8;--theme-paper:#f6f3ec;--theme-raised:#fbf8f2;
  --theme-white:#fffdf8;--theme-ink:#1b1830;--theme-copy:#625a70;
  --theme-purple:#4a3b6b;--theme-purple-deep:#3a2f54;
  --theme-gold:#806523;--theme-border:#cec6d2;--theme-soft:#eee8f0;
  --theme-sage:#e6eddf;--theme-green:#476c43;--theme-rose:#f3e5e0;
  --theme-error:#934830;--theme-shadow:0 10px 28px #4a3b6b0d;
  --night:var(--theme-paper);--bg:var(--theme-bg);--paper:var(--theme-paper);
  --paper2:var(--theme-raised);--panel:var(--theme-raised);--panel2:var(--theme-raised);--card:var(--theme-white);
  --ink:var(--theme-ink);--text:var(--theme-ink);--muted:var(--theme-copy);
  --faint:#716779;--gold:var(--theme-gold);--line:var(--theme-border);
  --mint:var(--theme-green);--violet:var(--theme-purple);
  --love:#9e4b76;--career:#356e8b;--health:var(--theme-green);
  --ok:var(--theme-green);--bad:var(--theme-error);
  --portrait-copy:var(--theme-copy);--portrait-surface:var(--theme-raised);
  --portrait-accent:var(--theme-purple);
  accent-color:var(--theme-purple);
}
html[data-palm-theme="paper"] body{
  background:radial-gradient(ellipse at 10% 5%,#e3e9df99,transparent 40%),radial-gradient(ellipse at 96% 60%,#eadde399,transparent 42%),var(--theme-paper)!important;
  color:var(--theme-ink)!important;
}
html[data-palm-theme="paper"] ::selection{background:#ded3e9;color:var(--theme-purple-deep)}
html[data-palm-theme="paper"] :is(.site-header,.hero,.masthead){background:var(--theme-raised)!important;border-color:var(--theme-border)!important}
/* Collapsing the palm leaves this heading visible as the stage's summary bar.
   Theme the surface together with its text, not only the expanded stage. */
html[data-palm-theme="paper"] .palm-theatre.is-stage-collapsed .theatre-heading{background:var(--theme-raised)!important;border-color:var(--theme-border)!important}
html[data-palm-theme="paper"] .theatre-heading #guideMode{background:var(--theme-soft)!important;color:var(--theme-purple-deep)!important;border-color:var(--theme-border)!important}
html[data-palm-theme="paper"] :is(.brand,.speaker,.brand-moon,.eyebrow,.theatre-heading h2,.chapter-head h2,.subsection-head h3,.card-title,.framework-divider h2){color:var(--theme-purple)!important}
html[data-palm-theme="paper"] :is(#greeting,.conversation h1,.conversation h2,.interpretation-dialog h2,.interpretation-dialog h3,.story-caption h2){color:var(--theme-purple-deep)!important;text-shadow:none!important}
html[data-palm-theme="paper"] :is(.record-link,.speech,.gentle-note,footer,.theatre-kicker,.scene-status,.photo-tip,.cat-caption,.cat-caption button,.lead,.record-empty,.selection-context,.discovery-empty,.palm-chat__note,.palm-chat__head p,.bazi-panel label,.bazi-panel label>small,.bazi-panel>summary strong,.bazi-panel__advanced>p,.bazi-panel__actions small,.chat-familiar__copy small,.chat-familiar__copy span,.subsection-head p,.card-id,.card-foot span,.card-item-label,.observation-label,.chapter-head p,.chapter-method ol,.chapter-method .why,.toolbar label span,.toolbar p,.step-method p,.step-method li,.evidence-location){color:var(--theme-copy)!important}
html[data-palm-theme="paper"] :is(.primary,.palm-chat__form button,.bazi-panel__actions button:not(#removeBazi),#continueGuide){background:var(--theme-purple)!important;color:var(--theme-raised)!important;border-color:var(--theme-purple)!important;box-shadow:0 8px 20px #4a3b6b21!important}
html[data-palm-theme="paper"] :is(.primary,.palm-chat__form button,.bazi-panel__actions button:not(#removeBazi),#continueGuide):hover{background:var(--theme-purple-deep)!important}
html[data-palm-theme="paper"] :is(.primary,.palm-chat__form button):disabled{background:#d7d0de!important;color:#62586e!important;border-color:#c5bdcc!important;box-shadow:none!important}
html[data-palm-theme="paper"] :is(.text-button,.knowledge-home-link,.language-control select,.language-control button,.palm-theme-control select,.route-choices button,.story-chapters button,.director-controls button,.theatre-heading__tools button,.mount-picker,.mount-choices button,.domain-choices button,.palm-chat__head-actions button,.palm-chat__scopes button,.palm-chat__suggestions button,.bazi-panel__actions #removeBazi,.interpretation-dialog__head button,.interpretation-dialog__next button,.records-header button,.hero nav a,.toolbar button,.domain-grid a,.step-nav a){background:var(--theme-raised)!important;color:var(--theme-purple)!important;border-color:var(--theme-border)!important;box-shadow:none!important}
html[data-palm-theme="paper"] :is(.knowledge-home-link,.language-control select,.palm-theme-control select,.domain-grid a,.step-nav a):hover{background:var(--theme-soft)!important;border-color:var(--theme-purple)!important}
html[data-palm-theme="paper"] :is(a,button,input,select,textarea,summary):focus-visible{outline-color:var(--theme-purple)!important}
html[data-palm-theme="paper"] :is(.domain-choices button.is-active,.domain-choices button[aria-pressed="true"],.route-choices button[aria-pressed="true"],.story-chapters button[aria-pressed="true"],.mount-choices button[aria-pressed="true"],.palm-chat__scopes button[aria-pressed="true"],.domain-grid a.active){background:var(--theme-purple)!important;color:var(--theme-raised)!important;border-color:var(--theme-purple)!important;box-shadow:none!important}
html[data-palm-theme="paper"] :is(.upload-panel,.selected-panel,.reveal,.recovery){color:var(--theme-ink)!important;border-color:var(--theme-border)!important}
html[data-palm-theme="paper"] :is(.reveal,.recovery,.panel,.bazi-panel,.bazi-panel__advanced,.palm-chat,.interpretation-finish,.interpretation-summary,.interpretation-combined,.interpretation-insight-card,.interpretation-advice,.interpretation-watch-list,.evidence-panel,.discovery-item,.quest-hud,.story-caption,.chat-familiar,.chat-familiar__copy,.chat-familiar__scene){background:var(--theme-raised)!important;color:var(--theme-ink)!important;border-color:var(--theme-border)!important;box-shadow:var(--theme-shadow)!important}
html[data-palm-theme="paper"] :is(.journey-track span,.journey-track i){border-color:var(--theme-border)!important;color:var(--theme-copy)!important}
html[data-palm-theme="paper"] :is(.journey-track .active,.quest-dots .active){background:var(--theme-soft)!important;color:var(--theme-purple)!important;border-color:var(--theme-purple)!important}
html[data-palm-theme="paper"] :is(.journey-track .done,.quest-dots .done,.ready){background:var(--theme-sage)!important;color:var(--theme-green)!important;border-color:var(--theme-green)!important}
html[data-palm-theme="paper"] :is(.reading-invitation span,.conversation .ability-orbit>button){background:#fbf8f2b8!important;border-color:var(--theme-border)!important;box-shadow:none!important}
html[data-palm-theme="paper"] :is(.reading-invitation b,.reading-invitation i,.conversation .ability-orbit b,.conversation .ability-orbit span){color:var(--theme-purple)!important}
html[data-palm-theme="paper"] :is(.reading-invitation small,.conversation .ability-orbit small){color:var(--theme-copy)!important}
html[data-palm-theme="paper"] .conversation .ability-orbit [aria-current="true"]{background:var(--theme-soft)!important;border-color:var(--theme-purple)!important}
html[data-palm-theme="paper"] :is(.intro-call,.hand-invitation>span,.palmistry-labels em){background:var(--theme-raised)!important;color:var(--theme-purple)!important;border-color:var(--theme-border)!important;box-shadow:var(--theme-shadow)!important}
html[data-palm-theme="paper"] :is(.mystic-portal,.star,.moon-ring,.orbit){color:#8e773d!important;border-color:#9a7b2f55!important;text-shadow:none!important}
html[data-palm-theme="paper"] .halo{background:radial-gradient(circle,#ded4e877,transparent 65%)!important;box-shadow:none!important}
html[data-palm-theme="paper"] .mystic-portal{background:radial-gradient(circle,#eee6f033,transparent 68%)!important;box-shadow:none!important}
html[data-palm-theme="paper"] :is(.palm-stage,.palm-theatre .palm-stage){background:radial-gradient(ellipse at 50% 42%,#fffdf8,#eee9df)!important;border-color:#bcaf9c!important;box-shadow:inset 0 0 48px #c9bfa522,var(--theme-shadow)!important}
html[data-palm-theme="paper"] :is(.palm-stage__status,.palm-stage__controls button,.palm-stage__hint,.palm-stage__clue){background:#fbf8f2f2!important;color:var(--theme-purple-deep)!important;border-color:var(--theme-border)!important;box-shadow:var(--theme-shadow)!important}
html[data-palm-theme="paper"] .edge-ritual__note{background:linear-gradient(transparent,#fbf8f2f5 35%)!important;color:var(--theme-ink)!important}
html[data-palm-theme="paper"] :is(.edge-ritual__title,.edge-ritual__note strong,.edge-ritual__note button){color:var(--theme-purple)!important}
html[data-palm-theme="paper"] .edge-ritual__note small{color:var(--theme-copy)!important}
html[data-palm-theme="paper"] :is(.quest-hud strong,.quest-hud span,.quest-hud b,.story-caption p,.story-caption small,.discovery-item p,.discovery-item strong,.evidence-panel p,.evidence-panel strong,.evidence-meaning,.interpretation-card strong,.interpretation-insight-card p,.interpretation-summary p,.interpretation-combined p,.interpretation-advice p,.interpretation-watch-list,.palm-chat__message,.palm-chat__message p){color:var(--theme-ink)!important}
html[data-palm-theme="paper"] :is(.quest-hud small,.evidence-eyebrow,.interpretation-card span,.interpretation-card i,.interpretation-card p,.interpretation-insight-card footer,.interpretation-framework,.interpretation-advice small,.interpretation-group__title small,.palm-chat__message time){color:var(--theme-copy)!important}
html[data-palm-theme="paper"] :is(.discovery-item[data-tier="core"],.discovery-item.is-selected,.discovery-item.seen){background:#f1ebdf!important;border-color:#c5b47f!important}
html[data-palm-theme="paper"] .evidence-meaning{background:#f3eddf!important}
html[data-palm-theme="paper"] .interpretation-card{background:var(--theme-raised)!important;color:var(--theme-ink)!important;border-color:var(--theme-border)!important;box-shadow:var(--theme-shadow)!important}
html[data-palm-theme="paper"] .interpretation-card.has-text{background:#f3edf5!important;border-color:#a69ab8!important}
html[data-palm-theme="paper"] .interpretation-card.is-complete{background:var(--theme-raised)!important;border-color:var(--theme-gold)!important}
html[data-palm-theme="paper"] :is(.interpretation-group__title>span,.interpretation-finish strong,.palm-chat__head h2,.palm-chat__form label,.bazi-panel>summary,.bazi-panel__advanced>summary,.chat-familiar__copy strong,.step-method h3,.chapter-method strong,.card-kind,.pair-block b){color:var(--theme-purple)!important}
html[data-palm-theme="paper"] :is(dialog,.interpretation-dialog){background:var(--theme-paper)!important;color:var(--theme-ink)!important;border-color:#b2a5bf!important;box-shadow:0 24px 80px #1b183045!important}
html[data-palm-theme="paper"] dialog::backdrop{background:#1b183080!important}
html[data-palm-theme="paper"] :is(.records-header,.interpretation-dialog__head){background:var(--theme-raised)!important;border-color:var(--theme-border)!important}
html[data-palm-theme="paper"] :is(.records-header span,.interpretation-dialog__head span){color:var(--theme-copy)!important}
html[data-palm-theme="paper"] :is(dialog iframe,.interpretation-sheet){background:var(--theme-paper)!important}
html[data-palm-theme="paper"] .interpretation-dialog__body{scrollbar-color:#ac9bb8 var(--theme-paper)}
html[data-palm-theme="paper"] :is(.palm-chat__message--assistant,.palm-chat__message--thinking){background:var(--theme-raised)!important;border-color:var(--theme-border)!important}
html[data-palm-theme="paper"] .palm-chat__message--user{background:var(--theme-soft)!important;border-color:#c5b7d0!important}
html[data-palm-theme="paper"] :is(.bazi-panel input,.bazi-panel select,.palm-chat__form input,.palm-chat__form textarea,.toolbar input,.toolbar select){background:var(--theme-white)!important;color:var(--theme-ink)!important;border-color:#b8aabd!important}
html[data-palm-theme="paper"] :is(input,textarea)::placeholder{color:#74697e!important;opacity:1}
html[data-palm-theme="paper"] .bazi-panel :is(.bazi-panel__unknown,.bazi-panel__manual-toggle){color:var(--theme-copy)!important}
html[data-palm-theme="paper"] .bazi-panel__result{background:#eee7d3!important;color:var(--theme-gold)!important;border-color:#cbb77a!important}
html[data-palm-theme="paper"] .bazi-panel input[aria-invalid="true"]{border-color:var(--theme-error)!important;box-shadow:0 0 0 2px #93483022!important}
html[data-palm-theme="paper"] .bazi-panel label:has(input[aria-invalid="true"])>small{color:var(--theme-error)!important}
/* Camera pixels, landmark overlays and framing geometry keep their original colors. */
html[data-palm-theme="paper"] .palm-camera-dialog{background:var(--theme-paper)!important}
html[data-palm-theme="paper"] :is(.palm-camera-head,.palm-camera-actions,.palm-camera-settings){background:var(--theme-paper)!important;color:var(--theme-purple-deep)!important;border-color:var(--theme-border)!important}
html[data-palm-theme="paper"] .palm-camera-dialog :is(.palm-camera-head button,.palm-camera-actions button:not(.primary),.palm-camera-settings select){background:var(--theme-raised)!important;color:var(--theme-purple)!important;border-color:#b5a8bd!important}
html[data-palm-theme="paper"] :is(.palm-camera-progress,.palm-camera-feedback,.palm-camera-checks){color:var(--theme-copy)!important}
html[data-palm-theme="paper"] .palm-camera-checks .is-ok{color:var(--theme-green)!important}
html[data-palm-theme="paper"] .palm-camera-checks span{background:var(--theme-raised)!important;color:var(--theme-copy)!important;border-color:var(--theme-border)!important}
html[data-palm-theme="paper"] .palm-camera-checks span.is-ok{background:var(--theme-sage)!important;color:var(--theme-green)!important;border-color:var(--theme-green)!important}
html[data-palm-theme="paper"] .palm-camera-head :is(p,small,span){color:var(--theme-copy)!important}
html[data-palm-theme="paper"] .palm-camera-view .palm-camera-progress,
html[data-palm-theme="paper"] .palm-camera-view .palm-camera-progress span{color:#fbf8f2!important}
/* Knowledge cards are paper on paper; keep condition/result areas distinct. */
html[data-palm-theme="paper"] :is(.knowledge-card,.step-method){background:var(--theme-raised)!important;border-color:var(--theme-border)!important;box-shadow:var(--theme-shadow)!important}
html[data-palm-theme="paper"] .knowledge-card:hover{border-color:#a69ab8!important}
html[data-palm-theme="paper"] :is(.observe,.card-kind){background:var(--theme-soft)!important;border-color:#d1c4dc!important}
html[data-palm-theme="paper"] .result{background:#f2ecde!important;border-color:#dfd1ab!important}
html[data-palm-theme="paper"] :is(.observe p,.result p){color:var(--theme-ink)!important}
html[data-palm-theme="paper"] :is(.result b,.knowledge-card.web-card .card-kind,.card-title){color:var(--theme-gold)!important}
html[data-palm-theme="paper"] :is(.knowledge-card.reference-card .card-title,.subsection-head h3){color:var(--theme-purple)!important}
html[data-palm-theme="paper"] :is(.chapter-head .number,.subsection-head .count,.step-nav a,.coverage-pills){color:var(--theme-green)!important}
html[data-palm-theme="paper"] .framework-divider{background:var(--theme-sage)!important;border-color:var(--theme-green)!important}
html[data-palm-theme="paper"] .health{color:var(--theme-green)!important;background:var(--theme-sage)!important}
html[data-palm-theme="paper"] .health.error{color:var(--theme-error)!important;background:var(--theme-rose)!important}
html[data-palm-theme="paper"] :is(.columns>div,.card,.knowledge-detail,.ai-reading,.drop){background:var(--theme-raised)!important;color:var(--theme-ink)!important;border-color:var(--theme-border)!important}
html[data-palm-theme="paper"] :is(.badge,.summary-count,.step-no,.feature-toggle){background:var(--theme-soft)!important;color:var(--theme-purple)!important;border-color:var(--theme-border)!important}
html[data-palm-theme="paper"] :is(.rule-group,.feature-group>h4){color:var(--theme-purple)!important}
html[data-palm-theme="paper"] :is(.wrap input,.wrap select,.wrap textarea){background:var(--theme-white)!important;color:var(--theme-ink)!important;border-color:#b8aabd!important}
html[data-palm-theme="paper"] .wrap button{background:var(--theme-raised)!important;color:var(--theme-purple)!important;border-color:var(--theme-border)!important}
html[data-palm-theme="paper"] .wrap #run{background:var(--theme-purple)!important;color:var(--theme-raised)!important}
html[data-palm-theme="paper"] .wrap pre{background:#eee9e0!important;color:var(--theme-ink)!important;border-color:var(--theme-border)!important}
html[data-palm-theme="paper"] #restoreNotice{color:var(--theme-purple)!important}
html[data-palm-theme="paper"] #greeting :is(strong,em){color:var(--theme-gold)!important;text-shadow:none!important}
html[data-palm-theme="paper"] .palm-file-open{background:var(--theme-raised)!important;color:var(--theme-purple)!important;border-color:#a99ab5!important;box-shadow:none!important}
html[data-palm-theme="paper"] :is(.palm-file-open small,footer span){color:var(--theme-copy)!important}
html[data-palm-theme="paper"] .palm-file-open span{color:var(--theme-purple)!important}
html[data-palm-theme="paper"] .palm-source-actions .primary :is(span,small){color:var(--theme-raised)!important;opacity:1!important}
html[data-palm-theme="paper"] :is(.palm-camera-feedback strong,.palm-camera-feedback p){color:var(--theme-purple)!important}
html[data-palm-theme="paper"] .bazi-panel.has-bazi>summary::after{background:#eee7d3!important;color:var(--theme-gold)!important}
html[data-palm-theme="paper"] .hero{display:flex;align-items:center;flex-wrap:wrap;gap:12px;padding:0 24px}
html[data-palm-theme="paper"] .hero-inner{flex:1;min-width:0;padding-inline:0}
html[data-palm-theme="paper"] .hero>.language-control{padding-block:16px}
.report-tools:has(.palm-theme-control){flex-wrap:wrap}
/* Printed hardware reports already use the reference palette; retain print rules. */
@media(max-width:650px){.palm-theme-control select{max-width:155px;font-size:12px}}
@media print{.palm-theme-control{display:none!important}html[data-palm-theme="paper"] body{background:white!important}html[data-palm-theme="paper"] :is(.panel,.report-section){box-shadow:none!important}}

/* Workspace reading contrast: child colors from the moon palette must not
   survive on paper surfaces. Paint only; preserve content, layout and actions. */
html[data-palm-theme="paper"] :is(.interpretation-summary>span,.interpretation-combined>span,.interpretation-insight-card h3,.interpretation-insight-card>span,.interpretation-insight-card footer b,.interpretation-framework b,.interpretation-advice p b,.discovery-card__top b,.evidence-panel h2,.evidence-panel h3,.reveal h3,.reveal h4,.palm-chat__head>div>span,.mount-picker summary,.selection-context strong){color:var(--theme-purple-deep)!important}
html[data-palm-theme="paper"] :is(.interpretation-insight-card p,.interpretation-insight-card p b,.interpretation-summary p,.interpretation-combined p,.interpretation-advice p,.interpretation-watch-list li,.discovery-item>strong,.discovery-item>span,.discovery-item>small,.evidence-panel p,.evidence-panel small,.reveal p){color:var(--theme-ink)!important}
html[data-palm-theme="paper"] :is(.interpretation-insight-card footer,.interpretation-framework,.interpretation-framework p,.interpretation-advice small,.interpretation-group__title small,.interpretation-finish>span,.interpretation-finish p,.discovery-card__top em,.discovery-item>i,.mount-picker>p,.selection-context small,.palm-chat__head-actions button,#baziMessage){color:var(--theme-copy)!important}
html[data-palm-theme="paper"] .discovery-item.seen{opacity:1;filter:none}
html[data-palm-theme="paper"] :is(.interpretation-card p,.interpretation-card span,.interpretation-card i){color:var(--theme-copy)!important}
html[data-palm-theme="paper"] .interpretation-card strong{color:var(--theme-purple-deep)!important}
html[data-palm-theme="paper"] :is(.interpretation-dialog__next,.selection-context){background:var(--theme-raised)!important;border-color:var(--theme-border)!important;box-shadow:none!important}
html[data-palm-theme="paper"] :is(.interpretation-dialog__next span,.interpretation-dialog__next strong){color:var(--theme-purple-deep)!important}
html[data-palm-theme="paper"] :is(.selection-context button,.evidence-panel button,#stopReading){background:var(--theme-raised)!important;color:var(--theme-purple)!important;border-color:var(--theme-border)!important}
html[data-palm-theme="paper"] :is(.recovery p){color:var(--theme-error)!important}
html[data-palm-theme="paper"] :is(.interpretation-watch-list li::marker,.evidence-meaning::before){color:var(--theme-gold)!important}
html[data-palm-theme="paper"] :is(.chat-active .conversation>.discovery-panel::before,#showDiscoveries,.discovery-stream-status,#experienceBuild,#guideMode){color:var(--theme-copy)!important}
html[data-palm-theme="paper"] :is(#discoveryCount,.discovery-card__top em){background:var(--theme-soft)!important;color:var(--theme-purple)!important;border-color:var(--theme-border)!important}
html[data-palm-theme="paper"] :is(.language-control>span,.story-caption>span){color:var(--theme-purple)!important}
/* The retained moon palette also needs readable role labels and form hints. */
html[data-palm-theme="moon"] :is(.interpretation-insight-card>span,.bazi-panel label>small,.bazi-panel__advanced>p,.palm-chat__note){color:var(--muted)!important}

/* Record tables must use a complete palette, not paper text on moon zebra rows.
   Scope status colors to tables; camera pixels and palm overlays stay untouched. */
html[data-palm-theme="paper"] .table-wrap{background:var(--theme-raised)!important;border-color:var(--theme-border)!important}
html[data-palm-theme="paper"] .table-wrap :is(table,thead,tbody){background:var(--theme-raised)!important;color:var(--theme-ink)!important}
html[data-palm-theme="paper"] .table-wrap tbody tr{background:var(--theme-raised)!important;color:var(--theme-ink)!important}
html[data-palm-theme="paper"] .table-wrap tbody tr:nth-child(even){background:#eee9e0!important}
html[data-palm-theme="paper"] .table-wrap th{background:var(--theme-soft)!important;color:var(--theme-purple-deep)!important;border-color:var(--theme-border)!important}
html[data-palm-theme="paper"] .table-wrap td{color:var(--theme-ink)!important;border-color:var(--theme-border)!important}
html[data-palm-theme="paper"] .table-wrap .high{color:#24593c!important}
html[data-palm-theme="paper"] .table-wrap .normal{color:#715313!important}
html[data-palm-theme="paper"] .table-wrap .low{color:#8b3547!important}
html[data-palm-theme="paper"] #rows td:first-child b{color:var(--theme-purple-deep)!important}
