/* Reading preferences. The original game artwork remains in both themes. */
:root,
:root[data-theme="dark"] {
  color-scheme:dark;
  --reading-bg:#111f19;
  --reading-panel:#192c23;
  --reading-raised:#243a2e;
  --reading-text:#f0ecdf;
  --reading-muted:#c3cfbd;
  --reading-line:#596b52;
  --reading-accent:#dfc48a;
  --reading-link:#e5cc97;
  --reading-control:#18271f;
}
:root[data-theme="light"] {
  color-scheme:light;
  --reading-bg:#e9e8dc;
  --reading-panel:#f8f5ed;
  --reading-raised:#e5e9dc;
  --reading-text:#19352a;
  --reading-muted:#4c6053;
  --reading-line:#a5ae95;
  --reading-accent:#75551e;
  --reading-link:#315c37;
  --reading-control:#fffdf6;
}
[data-theme] body {
  --ink:var(--reading-text);--muted:var(--reading-muted);--line:var(--reading-line);--paper:var(--reading-panel);
  color:var(--reading-text);
}
[data-theme="dark"] body.scifi-page {
  --reading-bg:#0c1824;--reading-panel:#172736;--reading-raised:#25394a;--reading-text:#edf2f6;
  --reading-muted:#c0ced8;--reading-line:#647a8c;--reading-accent:#edb38d;--reading-link:#edb38d;--reading-control:#122330;
}
[data-theme="light"] body.scifi-page {
  --reading-bg:#e9eef1;--reading-panel:#f5f7f8;--reading-raised:#e1e8ed;--reading-text:#20384c;
  --reading-muted:#4c6373;--reading-line:#9cabb7;--reading-accent:#8b432d;--reading-link:#86402b;--reading-control:#fff;
}
[data-theme="light"] body.cathay-page {
  background:linear-gradient(#ebe9dabd,#ebe9daec),url('assets/cathay-background.webp') center top/cover fixed;
}
[data-theme="light"] body.archive-page {
  background:linear-gradient(#e8e8dbe3,#e8e8dbee),url('assets/cathay-background.webp') center top/cover fixed;
}
[data-theme="light"] body.scifi-page {
  background:linear-gradient(#e8edf1d9,#e8edf1ed),url('assets/40k-background.webp') center top/cover fixed;
}
[data-theme] .site-header {
  position:relative;z-index:20;gap:24px;padding:0 4%;
  background:var(--reading-bg);color:var(--reading-text);border-color:var(--reading-line);
}
[data-theme] .site-header nav {gap:22px;min-width:0}
[data-theme] .site-header .brand svg {color:var(--reading-accent)}
.header-actions {display:flex;align-items:center;gap:8px;flex-shrink:0}
[data-theme] .header-actions .search-trigger,
[data-theme] .theme-toggle,
[data-theme] .language-switch summary,
[data-theme] .header-actions .menu-toggle {
  height:40px;min-width:40px;padding:9px;display:flex;align-items:center;justify-content:center;gap:6px;
  border:1px solid var(--reading-line);border-radius:8px;background:var(--reading-control);color:var(--reading-text);
  font-size:12px;line-height:1.4;margin:0;
}
[data-theme] .header-actions .menu-toggle {display:none}
.header-actions .search-trigger>span,.header-actions .search-trigger kbd {display:none}
.header-actions svg {width:18px;height:18px;flex:none}
.theme-toggle {display:none!important}
.preferences-ready .theme-toggle {display:flex!important}
.theme-sun,[data-theme="light"] .theme-moon {display:none}
[data-theme="light"] .theme-sun {display:block}
.language-switch {position:relative;padding:0;border:0;font-weight:500}
.language-switch summary {cursor:pointer;list-style:none;user-select:none}
.language-switch summary::-webkit-details-marker {display:none}
.language-short {display:none}
.language-options {
  position:absolute;right:0;top:calc(100% + 9px);min-width:185px;width:max-content;max-width:calc(100vw - 24px);
  padding:7px;border:1px solid var(--reading-line);border-radius:10px;
  background:var(--reading-panel);color:var(--reading-text);box-shadow:0 16px 40px #0003;z-index:40;
}
.language-options a {display:flex;align-items:center;justify-content:space-between;gap:24px;padding:10px 12px;border-radius:6px;white-space:nowrap;font-size:14px}
.language-options a:hover,.language-options a[aria-current="true"] {background:var(--reading-raised);color:var(--reading-link)}
.language-options a[aria-current="true"]:after {content:'✓';font-weight:700}
.theme-switch{display:none;position:relative;border:0;padding:0;margin:0;font-weight:500}
.preferences-ready .theme-switch{display:block}
.theme-switch summary{cursor:pointer;list-style:none;user-select:none}
.theme-switch summary::-webkit-details-marker{display:none}
.theme-options{position:absolute;right:0;top:calc(100% + 9px);width:max-content;min-width:170px;max-width:calc(100vw - 24px);padding:7px;border:1px solid var(--reading-line);border-radius:10px;background:var(--reading-panel);color:var(--reading-text);box-shadow:0 16px 40px #0003;z-index:40}
.theme-options button{display:flex;align-items:center;justify-content:space-between;gap:24px;width:100%;padding:10px 12px;border:0;border-radius:6px;text-align:left;background:transparent;color:var(--reading-text);font:inherit;font-size:14px;cursor:pointer}
.theme-options button:hover,.theme-options button[aria-pressed="true"]{background:var(--reading-raised);color:var(--reading-link)}
.theme-options button[aria-pressed="true"]:after{content:'✓';font-weight:700}
.theme-options button:focus-visible,.theme-switch summary:focus-visible{outline:3px solid var(--reading-accent);outline-offset:2px}
@media(max-width:760px){.theme-current{display:none}.theme-options{min-width:170px}}
[data-theme] :is(.site-header,footer,.portal-section-nav,.portal-section,.portal-end,.player-questions,.briefing-body,.about-page,.hub-section,.guide-article) {
  background-color:var(--reading-panel);color:var(--reading-text);border-color:var(--reading-line);
}
[data-theme] :is(.portal-section,.portal-end,.briefing-body,.about-page,.hub-section,.guide-article) {background-image:none}
[data-theme] :is(.dispatch-card,.dispatch-copy,.lord-copy,.brief-card,.faction-grid article,.hub-lord,.question-grid>a,.toc,.role-cards>div,.featured-card) {
  background:var(--reading-bg);color:var(--reading-text);border-color:var(--reading-line);
}
[data-theme] .question-grid>a:hover {background:var(--reading-raised);border-color:var(--reading-accent)}
[data-theme] :is(.ownership-answer,.notice,.toc-note,.buying-answer,.related-answer) {
  background:var(--reading-raised);color:var(--reading-text);border-color:var(--reading-line);
}
[data-theme] :is(.guide-article,.about-page,.briefing-body,.hub-section) :is(p,li,dd,td),
[data-theme] :is(.question-grid p,.questions-heading p,.dispatch-copy p,.lord-copy p,.field-grid p,.portal-heading p,.footer-main p,.footer-bottom,.section-note,.toc-note,.buying-meta,.small-note,.card-meta) {
  color:var(--reading-muted);
}
[data-theme] :is(.guide-article,.about-page,.briefing-body,.hub-section) :is(strong,h2,h3),
[data-theme] .portal-end p {color:var(--reading-text)}
[data-theme] :is(.guide-article,.about-page,.briefing-body,.hub-section) .eyebrow,
[data-theme] :is(.questions-heading .eyebrow,.question-label,.question-action,.dispatch-copy .eyebrow,.dispatch-more,.lord-copy>.eyebrow,.portal-heading>.eyebrow,.portal-end>.eyebrow,.portal-end em,.portal-end>a,.toc>.eyebrow,.role-cards span,.steps b,.faction-symbol) {
  color:var(--reading-accent);
}
[data-theme] .lord-note {color:var(--reading-muted)!important}
[data-theme] .lord-settings span {color:var(--reading-text);border-color:var(--reading-line)}
[data-theme] .guide-article a:not(.button):not(.decision-links a),
[data-theme] .inline-link {color:var(--reading-link)}
[data-theme] .buying-guide .buying-meta {color:var(--reading-muted)}
[data-theme] .guide-article table th {background:var(--reading-raised);color:var(--reading-text);border-bottom:1px solid var(--reading-line)}
[data-theme] .guide-article table caption {color:var(--reading-muted)}
[data-theme] blockquote {background:#123c2c;color:#f0e3bf}
[data-theme] .decision-links a {background:#173d32;color:#f4eddc}
[data-theme] .decision-links a strong {color:#f4eddc}
[data-theme] .decision-links a span {color:#d0dbca}
[data-theme] .archive-page .dark {background:var(--reading-accent);color:var(--reading-panel)}
[data-theme] .site-header .new {background:var(--reading-raised);color:var(--reading-accent)}
[data-theme] dialog {--ink:var(--reading-text);--muted:var(--reading-muted);--line:var(--reading-line);color:var(--reading-text);background:var(--reading-panel);border-color:var(--reading-line)}
[data-theme] #search-input {color:var(--reading-text);background:var(--reading-control);border-color:var(--reading-line)}
[data-theme] #search-input::placeholder {color:var(--reading-muted);opacity:1}
[data-theme] #search-results a:hover {background:var(--reading-raised)}
[data-theme] #search-results small {color:var(--reading-muted)}
[data-theme] .skip {color:#183a2a;background:#fffdf6}
[data-theme] .briefing-hero {color:#f3eddf}
.reading-preferences-note {margin-top:18px!important}
[data-theme] :is(.faction-grid,.briefing-grid,.field-grid,.question-grid)>* {min-width:0}
[data-theme] :is(.guide-article,.briefing-body,.about-page,.hub-section,.portal-section,.player-questions) :is(h2,h3,p,li,td,th,a) {overflow-wrap:anywhere;hyphens:auto}
[data-theme] :is(.about-page,.article-hero,.briefing-hero) h1 {overflow-wrap:anywhere;hyphens:auto}
[data-theme] .about-page .archive-worlds strong {color:#f0eadb}
[data-theme] .about-page h1 em {color:var(--reading-accent)}
[data-theme] .brief-card .tag {color:var(--reading-accent);border-color:var(--reading-line)}
[data-theme] .fact-grid {grid-template-columns:repeat(2,minmax(0,1fr))}
[data-theme] .fact-grid>div {min-width:0}
[data-theme] .fact-grid span {overflow-wrap:anywhere;hyphens:auto}
@media(max-width:1100px) {
  [data-theme] .site-header {gap:18px;padding:0 3%}
  [data-theme] .site-header nav {gap:15px;font-size:11px}
  .language-name {display:none}.language-short {display:inline}
}
@media(max-width:1000px) {
  [data-theme] .site-header {height:78px}
  [data-theme] .site-header nav {display:none;position:absolute;top:100%;left:0;right:0;flex:initial;padding:16px 5%;background:var(--reading-panel);color:var(--reading-text);border-bottom:1px solid var(--reading-line);box-shadow:0 16px 25px #0003}
  [data-theme] .site-header nav.open {display:flex;flex-direction:column;align-items:stretch;gap:0}
  [data-theme] .site-header nav>a {padding:12px 0;font-size:14px}
  [data-theme] .site-header nav>a.active:after {bottom:7px}
  [data-theme] .header-actions {margin-left:auto}
  [data-theme] .header-actions .menu-toggle {display:flex}
}
@media(max-width:600px) {
  [data-theme] .about-page h1 {font-size:clamp(34px,9vw,48px)}
  [data-theme] .faction-grid {grid-template-columns:minmax(0,1fr)}
  [data-theme] .tag {white-space:normal;max-width:100%}
  [data-theme] .site-header {height:72px;gap:10px;padding:0 14px}
  .site-header .brand {font-size:13px;gap:7px;letter-spacing:1px}
  .site-header .brand svg {width:24px;height:30px}
  .site-header .brand-bottom {display:none}
  .header-actions {gap:5px}
  [data-theme] .header-actions :is(.search-trigger,.theme-toggle,.menu-toggle),
  [data-theme] .language-switch summary {min-width:34px;height:38px;padding:7px;font-size:11px}
  [data-theme] .language-switch summary {gap:3px}
  [data-theme="light"] body:is(.cathay-page,.archive-page,.scifi-page) {background-attachment:scroll}
}
@media(max-width:360px) {
  [data-theme] .site-header {padding:0 10px;gap:7px}
  .site-header .brand {font-size:11px;letter-spacing:.6px;gap:5px}
  .site-header .brand svg {width:20px}
  .header-actions {gap:4px}
  .header-actions svg {width:16px;height:16px}
}
