/* Dark theme ("ليل المجلس") for the site pages: html[data-theme=dark] is set by theme.js and the header button.
   Scoped to body.site-page; the games and the room keep their own look. Loaded last so equal selectors win. */
html[data-theme=dark] body.site-page{color-scheme:dark;
 --j-paper:#1a1314;--j-surface:#251b1c;--j-sand:#33272a;--j-ink:#efe3d1;--j-wine:#cfb293;--j-wine-dark:#3d1820;
 --j-wood:#cfb293;--j-muted:#b6a18d;--j-line:#4a3a33;--j-gold:#d4a866;--j-green:#2f6556;--j-shadow:0 12px 34px #0000004d;
 --dk-on-accent:#f7ecda;--dk-wine-bg:#7d2d3d;--dk-wine-hover:#933448;--dk-line-strong:#5a4639;--dk-shadow:#0d0909;--dk-field:#201718;
 background:radial-gradient(#ffffff08 .7px,transparent .8px) 0 0/7px 7px,var(--j-paper)}
html[data-theme=dark]{background:#1a1314}

/* Text that sits on wine or green stays light. */
html[data-theme=dark] .site-page .header-play{color:var(--dk-on-accent)!important}
html[data-theme=dark] .site-page .btn{background:var(--dk-wine-bg);border-color:var(--dk-wine-bg);color:var(--dk-on-accent)}
html[data-theme=dark] .site-page .btn:hover{background:var(--dk-wine-hover)}
html[data-theme=dark] .site-page .together{color:var(--dk-on-accent);border-block-color:#8a7650;box-shadow:6px 6px 0 var(--dk-shadow)}
html[data-theme=dark] .site-page .together .btn{background:#f4e6c8;border-color:#f4e6c8;color:#305d50}
html[data-theme=dark] .site-page .together::after{background:repeating-linear-gradient(45deg,#ffffff0d 0 9px,transparent 9px 18px)}
html[data-theme=dark] .site-page .filter-tabs button.active{background:var(--dk-wine-bg);color:var(--dk-on-accent)}
html[data-theme=dark] .site-page .guide-list article>b{color:var(--dk-on-accent)}
html[data-theme=dark] .site-page .getting-started li>span{background:var(--dk-wine-bg);color:var(--dk-on-accent)}
html[data-theme=dark] .site-page.home-page .welcome,html[data-theme=dark] .site-page.home-page .welcome h1{color:#fff3df}

/* Fields */
html[data-theme=dark] .site-page :is(input,select,textarea),html[data-theme=dark] .site-page :is(.catalog-refine select,.report-form select,.report-form textarea){background:var(--dk-field);border-color:var(--dk-line-strong);color:var(--j-ink)}
html[data-theme=dark] .site-page input::placeholder{color:#8f7d70}
html[data-theme=dark] .site-page #join-status:not(:empty){background:#3a2226}
html[data-theme=dark] .site-page .session-footnote{background:#2c2123;border-top-color:var(--j-line)}
html[data-theme=dark] .site-page .report-status{background:#2c2123;border-inline-start-color:#5f9c86}

/* Cards and panels */
html[data-theme=dark] .site-page .session-card{border-color:var(--dk-line-strong);box-shadow:4px 4px 0 var(--dk-shadow)}
html[data-theme=dark] .site-page .gameCard{background:var(--j-surface);border-color:var(--dk-line-strong);box-shadow:3px 3px 0 var(--dk-shadow)}
html[data-theme=dark] .site-page .gameCard:hover{box-shadow:6px 8px 0 var(--dk-shadow)}
html[data-theme=dark] .site-page .gameCard:nth-child(3n){border-bottom-color:#b2733e}
html[data-theme=dark] .site-page .gc-art{border-color:#4f3d33}
html[data-theme=dark] .site-page .gc-txt .chip{background:#34282a;color:#d8bfa5}
html[data-theme=dark] .site-page .gc-mode,html[data-theme=dark] .site-page .gc-txt .chip+.chip{color:#8fc2ad!important}
html[data-theme=dark] .site-page .getting-started li{border-inline-start-color:#4f3d33}
html[data-theme=dark] .site-page .question-grid details{background:var(--j-surface)}
html[data-theme=dark] .site-page .catalog-tools{background:#2e2325;box-shadow:3px 3px 0 var(--dk-shadow)}
html[data-theme=dark] .site-page :is(.paper,.guide-list article,.faq-full details,.notice,.category-gallery figure){box-shadow:3px 3px 0 var(--dk-shadow)}
html[data-theme=dark] .site-page .category-gallery figure{background:var(--j-surface)}
html[data-theme=dark] .site-page .category-gallery figcaption{color:#9fd0bd}
html[data-theme=dark] .site-page .nav-toggle{border-color:var(--dk-line-strong)}

/* Home carousel cards */
html[data-theme=dark] .site-page .hero-game-card{background:var(--j-surface);border-color:var(--dk-line-strong);color:var(--j-wine)}
html[data-theme=dark] .site-page .hero-game-art{border-bottom-color:#4f3d33}
html[data-theme=dark] .site-page.home-page .welcome .hero-game-copy>b{color:var(--j-wine)}
html[data-theme=dark] .site-page .hero-game-players{color:var(--j-muted)}

/* Footer: a shade darker than the page so it still reads as the base of the page. */
html[data-theme=dark] .site-page .site-footer{background:#110c0d;color:#f4e9d2}

/* Intro doors keep their wine; the name stays light on them. */
html[data-theme=dark] .site-page :is(.intro-logo,.intro p){color:#f4e9d2}

/* ---- Games and the room (body without .site-page). Their hard-coded colours come from the generated
   dark-games.css (scripts/build-dark.cjs); here the shared tokens turn dark, and the fixes the generator cannot know. */
html[data-theme=dark] body:not(.site-page){color-scheme:dark;
 --j-paper:#1a1314;--j-surface:#251b1c;--j-sand:#33272a;--j-ink:#efe3d1;--j-wine:#cfb293;--j-wood:#cfb293;--j-muted:#b6a18d;
 --j-line:#4a3a33;--j-gold:#d4a866;--j-shadow:0 12px 34px #0000004d;
 --bg:#1a1314;--surface:#251b1c;--sunk:#2e2224;--land:#33272a;--fg:#efe3d1;--muted:#b6a18d;--line:rgba(207,178,147,.22);
 --auth:#cfb293;--accent:var(--auth);
 --ink:#201812;/* text on card stock: playing cards stay light, like real cards on a dark table */
 --play-paper:#251b1c;--play-muted:#b6a18d;--play-line:#4a3a33;--play-ink:#efe3d1;
 --dk-on-accent:#f7ecda;--dk-wine-bg:#7d2d3d;--dk-auth-bg:#6b4e45;
 background-color:#1a1314}
html[data-theme=dark] body:not(.site-page) .tile{color:var(--fg)}
/* QR boxes stay white so phones can scan them; their captions stay dark. */
html[data-theme=dark] body:not(.site-page) .joinQr{color:#231F20}
html[data-theme=dark] body:not(.site-page) .tfBack b{color:#6b4e45}
/* Tafra: the board centre sets its own dark-text tokens. */
html[data-theme=dark] body:not(.site-page) .tfPlay .tfCenter{--fg:var(--j-ink);--muted:#b6a18d;--accent:var(--auth);box-shadow:inset 0 0 0 1px #4a3a33}

/* The header button */
.theme-toggle{display:inline-grid;place-items:center;width:44px;height:44px;flex:none;padding:0;border:1px solid var(--j-line);border-radius:3px;background:transparent;color:var(--j-wood);cursor:pointer}
.theme-toggle:hover{background:var(--j-sand)}
.theme-toggle svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.theme-toggle .sun,html[data-theme=dark] .theme-toggle .moon{display:none}
html[data-theme=dark] .theme-toggle .sun{display:block}
@media(max-width:760px){.theme-toggle{width:40px;height:40px}}
