/* Shared theme controls. The paper theme remains the default fallback. */
:root{color-scheme:light}
.site-header-tools{display:flex;align-items:center;gap:12px;flex:none}
.theme-toggle{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-width:76px;height:36px;padding:0 11px;border:1px solid var(--line);color:var(--ink);font:9px var(--mono);white-space:nowrap}
.theme-toggle svg{width:16px;height:16px;flex:none}
.theme-toggle:hover{background:var(--soft);border-color:var(--green)}
@media(max-width:1050px){.site-header-tools{gap:8px}.site-header-tools .admin-link{font-size:8px;padding-inline:10px}.header{gap:15px}.header nav{gap:18px;margin-left:0}}
@media(max-width:700px){.theme-toggle{min-width:34px;width:34px;height:34px;padding:0}.theme-toggle span{display:none}.site-header-tools{margin-left:auto}.construction-header-right{gap:12px}.legal-header{flex-wrap:wrap}.legal-header nav{gap:15px}.legal-header .theme-toggle{margin-left:auto}}
/* Night palette inspired by Papertrade: midnight, lilac, blush and mint. */
:root[data-theme="dark"]{color-scheme:dark;--paper:#11162b;--ink:#efedf7;--muted:#a9b0c9;--line:#343d60;--green:#9bd7cb;--soft:#242c49;--night-panel:#191f39;--night-raised:#222a48;--night-lilac:#bcb8ee;--night-blush:#e4b5d2;--night-mint:#9bd7cb}
:root[data-theme="dark"] body{background:radial-gradient(ellipse at 78% 0%,#28294c80,transparent 48%),var(--paper);background-attachment:fixed}
:root[data-theme="dark"] body:before{opacity:.018}
:root[data-theme="dark"] ::selection{background:#6766a2;color:#fff}
:root[data-theme="dark"] input::placeholder,:root[data-theme="dark"] textarea::placeholder{color:#939dbb;opacity:1}
:root[data-theme="dark"] .theme-toggle{border-color:#505b85;background:#202742;color:var(--night-lilac)}
:root[data-theme="dark"] .theme-toggle:hover{background:#2b3457;border-color:var(--night-lilac)}
:root[data-theme="dark"] .btn-dark{background:linear-gradient(105deg,#9bd7cb,#b8bcea);border-color:#b1cde0;color:#11182c}
:root[data-theme="dark"] .btn-dark:hover{background:#c6d8eb;border-color:#c6d8eb}
:root[data-theme="dark"] :is(.hero-art,.construction-art,.login-art,.game-cover){background:#20253e;border-color:var(--line)}
:root[data-theme="dark"] :is(.hero-art img,.construction-art>img,.login-art>img,.game-cover>img){mix-blend-mode:normal;filter:brightness(.88) saturate(.9)}
:root[data-theme="dark"] :is(.hero-art:before,.hero-art:after,.construction-art-corner){color:#d7c8ce}
:root[data-theme="dark"] .construction-art{box-shadow:8px 8px 0 #05091640}
:root[data-theme="dark"] .construction-description{color:#bbc1d7}
:root[data-theme="dark"] .construction-status{background:#232d43;border-color:#465e69}
:root[data-theme="dark"] .construction-words>span:nth-child(even){color:#7983a5}
:root[data-theme="dark"] .construction-admin:hover{background:var(--soft)}
:root[data-theme="dark"] :is(.game-card,.home-preview-card,.member-panel,.member-stats,.member-favorite,.discovery-panel,.rank-sheet,.side-panel,.related-card,.inventory-item){background:var(--night-panel);border-color:var(--line)}
:root[data-theme="dark"] .discover-grid .game-card{background:var(--night-panel)}
:root[data-theme="dark"] :is(.game-card,.home-preview-card,.related-card):hover{border-color:#7e8dba}
:root[data-theme="dark"] :is(.ticker,.newswire,.newswire-label,.builder,.paper-note,.source-box,.discovery-filters,.connection-notes,.quest-bonus,.admin-editor){background:var(--night-panel)}
:root[data-theme="dark"] :is(.discovery-search,.login-copy input,.social-badge-actions input,dialog input,dialog select,dialog textarea,.editor-field input,.editor-field select,.editor-field textarea,.inventory-tools>input){background:#151b32;border-color:#3d486b;color:var(--ink)}
:root[data-theme="dark"] :is(.discovery-search kbd,.newswire-link,.rank-number,.rail-method,.rank-empty>span){color:#aeb7d3}
:root[data-theme="dark"] :is(.discovery-sorts button:not(.active):hover,.filter-button:hover,.filter-button.has-filters,.filter-button[aria-expanded=true],.tab:hover,.inventory-item:hover,.inventory-item.selected){background:#273451;border-color:#6a80a1}
:root[data-theme="dark"] .boost-panel{background:linear-gradient(140deg,#303052,#202b43);border-color:#5c628c;color:#eee9fb;box-shadow:4px 4px 0 #05091625}
:root[data-theme="dark"] .boost-panel h2 span{color:var(--night-lilac)}
:root[data-theme="dark"] .boost-panel p{color:#b8c2d6}
:root[data-theme="dark"] .boost-symbol{color:#a0a3d6}
:root[data-theme="dark"] .boost-kicker .dot{background:var(--night-mint)}
:root[data-theme="dark"] .boost-cta{border-color:#565f85}
:root[data-theme="dark"] .boost-fold{background:linear-gradient(135deg,#454e74 49%,var(--paper) 51%);border-color:#535e85}
:root[data-theme="dark"] .boost-logo{background:#262e4b;border-color:#5c678d}
:root[data-theme="dark"] :is(.rank-icon,.game-logo,.member-avatar,.connection-icon,.quest-symbol){background:#28324e;border-color:#465a74}
:root[data-theme="dark"] .discover-empty{background:#1d2940;border-color:#526a83}
:root[data-theme="dark"] .discover-grid .card-title .card-project-status{background:#223c43;border-color:#466e72;color:#b3e3d9}
:root[data-theme="dark"] .discover-grid .card-title .project-status-concept{background:#302c49;border-color:#686084;color:#e0cee9}
:root[data-theme="dark"] .discover-grid .card-title .project-status-playable{background:#29524f;border-color:#64a196;color:#c9f4e6}
:root[data-theme="dark"] .discover-grid .card-title .project-status-inactive{background:#2d3044;border-color:#61687f;color:#c3c5d2}
:root[data-theme="dark"] :is(.tag-status,.status-playable,.editor-score,.signal-badge,.signal-audit,.connected-tag){background:#20363e;border-color:#496b73;color:#afe0d4}
:root[data-theme="dark"] .editor-score.is-unrated{background:transparent;border-color:var(--line);color:var(--muted)}
:root[data-theme="dark"] .discover-grid .card-source-link:hover{background:#2a4b4d;border-color:#9bd7cb}
:root[data-theme="dark"] .save{background:#1c2544e6;border-color:#687295;color:#e8e5f6}
:root[data-theme="dark"] .save.saved{background:var(--green);color:var(--paper);border-color:var(--green)}
:root[data-theme="dark"] .card-art{background:#252b49}
:root[data-theme="dark"] .wheel-art{background:#29364b}
:root[data-theme="dark"] .dice-art{background:#302e4a}
:root[data-theme="dark"] .arcade-art{background:#253c46}
:root[data-theme="dark"] .trading-art{background:#2a3049}
:root[data-theme="dark"] .wheel{border-color:#9eacd1;background:conic-gradient(#8c9ac5 0deg 45deg,#29364e 45deg 90deg,#8cc6bb 90deg 135deg,#343957 135deg 180deg,#8c9ac5 180deg 225deg,#29364e 225deg 270deg,#8cc6bb 270deg 315deg,#343957 315deg);box-shadow:8px 8px 0 #080e2240,inset 0 0 0 7px #2c3853,inset 0 0 0 8px #9eacd1}
:root[data-theme="dark"] .wheel:before{border-color:#889bb6}
:root[data-theme="dark"] .arcade-machine{background:#7b8fa4;border-color:#acbcd1;box-shadow:8px 5px 0 #111b31}
:root[data-theme="dark"] .machine-screen{background:#183c3b;border-color:#536f7b;color:#bde2d6}
:root[data-theme="dark"] .machine-top{color:#e0d8ef}
:root[data-theme="dark"] .level-card{background:linear-gradient(120deg,#1c233f,#252746);border-color:#424d72}
:root[data-theme="dark"] .level-decoration{color:#acb2e319}
:root[data-theme="dark"] .m-progress{background:#343e5c}
:root[data-theme="dark"] .m-progress>span{background:linear-gradient(90deg,#91d5c9,#bbb7ea)}
:root[data-theme="dark"] .ritual-card{background:linear-gradient(145deg,#37345b,#25414d);color:#efedf7}
:root[data-theme="dark"] :is(.ritual-card .panel-kicker,.ritual-count>span,.ritual-card p,.ritual-bottom){color:#c4c8df}
:root[data-theme="dark"] .ritual-bottom b{color:#f3e8f5}
:root[data-theme="dark"] :is(.quest-row.completed .quest-symbol,.quest-bonus.claimed,.calendar-day.done,.calendar-key i,.checkin-button:disabled,.review-message){background:#223e43;border-color:#527d7b;color:#b6e5d8}
:root[data-theme="dark"] .calendar-day{background:#1a223b;border-color:#3a4466;color:#b0b8ce}
:root[data-theme="dark"] .calendar-day.today{border-color:var(--green);color:var(--green)}
:root[data-theme="dark"] .calendar-key span+span i{background:transparent}
:root[data-theme="dark"] .badge-card{background:#1b233d;border-color:#3a4466}
:root[data-theme="dark"] .badge-card.locked{opacity:.66}
:root[data-theme="dark"] .badge-stamp{background:#303953;color:#a6b0ca}
:root[data-theme="dark"] .badge-stamp.tier-1{background:#294247;color:#b2dfd2}
:root[data-theme="dark"] .badge-stamp.tier-2{background:#34504f;color:#c1eadb}
:root[data-theme="dark"] .badge-stamp.tier-3{background:#303c67;color:#c4d2fa}
:root[data-theme="dark"] .badge-stamp.tier-4{background:#4a345c;color:#e5c6ef}
:root[data-theme="dark"] .badge-rarity{border-color:#66778c}
:root[data-theme="dark"] #member-notice{background:#253046;border-color:#4b627c;color:#bedfdc}
:root[data-theme="dark"] #login-availability{background:#202c44}
:root[data-theme="dark"] :is(.concept-notice,.preview-banner){background:#2c304b;border-color:#646888;color:#d5d3eb}
:root[data-theme="dark"] .preview-banner{background:#303452}
:root[data-theme="dark"] :is(.prose p,.legal-section p,.legal-section li,.legal-document td,.construction-description){color:#b8bfd5}
:root[data-theme="dark"] .legal-summary{background:#212e43;border-color:#4b6772}
:root[data-theme="dark"] .legal-summary p{color:#c6dcd9}
:root[data-theme="dark"] .legal-document a{color:var(--green);text-decoration-color:#5d9b99}
:root[data-theme="dark"] .legal-document th{background:#242c49;color:#c4d6e8}
:root[data-theme="dark"] :is(.editor-error,#profile-error,#social-action-status){color:#f0b9b1}
:root[data-theme="dark"] .editor-error{background:#492c3b;border-color:#996a80}
:root[data-theme="dark"] .editor-field input[readonly]{background:#202a43}
:root[data-theme="dark"] .xp-closing{background:#25334a;border-color:#536d85}
:root[data-theme="dark"] .xp-hero figure:before{border-color:#7b82b675}
:root[data-theme="dark"] dialog{background:#1b223d;border-color:#737ca0;box-shadow:14px 14px 0 #03071260}
:root[data-theme="dark"] dialog::backdrop{background:#060a1ed1}
:root[data-theme="dark"] :is(#page-toast,.toast){background:#c1cbe7;color:#141b31;border:1px solid #e2dcf0}
/* Google's button keeps its official light treatment in both themes. */
:root[data-theme="dark"] .google-login-button{background:#fff;color:#25271f;border-color:#747775}
:root[data-theme="dark"] .google-login-button:hover{background:#f2f3f5}
@media(prefers-reduced-motion:reduce){.theme-toggle{transition:none}}

@media(max-width:700px){.site-header-tools .admin-link{display:none}}

@media(max-width:700px){.construction-header{flex-wrap:wrap;gap:14px}.construction-header-right{margin-left:auto;gap:10px}.legal-header{gap:18px}.legal-header .wordmark{order:0}.legal-header .theme-toggle{order:1}.legal-header nav{order:2;width:100%;justify-content:flex-start;gap:24px}}
