/* Shared appearance controls. Keep game colours and event branding untouched. */
:root[data-theme="light"]{color-scheme:light;--bg:#faf6ef;--surface:#fffdf9;--surface-2:#f4f0e9;--text:#20211f;--theme-muted:#62615e;--theme-line:#ded7cd;--theme-accent:#1467d8}
:root[data-theme="dark"]{color-scheme:dark;--bg:#111827;--surface:#1c2637;--surface-2:#253247;--text:#f4f6fb;--muted:#b8c2d3;--line:#3a465a;--lime:#74b3ff;--pop-ink:#f4f6fb;--theme-muted:#b8c2d3;--theme-line:#3a465a;--theme-accent:#91c3ff}
.theme-tools{display:flex;align-items:center;gap:10px;flex-shrink:0;order:1}
.theme-toggle{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:44px;padding:10px 13px;margin:0;border:1px solid var(--theme-line);border-radius:15px;background:var(--surface);color:var(--text);font:800 12px/1.3 Nunito,system-ui,sans-serif;cursor:pointer;white-space:nowrap;box-shadow:0 3px 0 #0000000c}
.theme-toggle svg{width:20px;height:20px;flex-shrink:0}
.theme-toggle:hover{border-color:var(--theme-accent)}
.theme-toggle:focus-visible{outline:3px solid var(--theme-accent);outline-offset:3px}
.theme-tools>.secondary{font-size:12px;padding:10px 16px;max-width:180px;min-height:44px;overflow-wrap:anywhere;border-radius:24px;background:#eee9e1;color:#333c48;border:0;box-shadow:0 3px 0 #e0d8cc}
.theme-standalone{display:flex;justify-content:flex-end;max-width:1200px;margin:16px auto;padding:0 24px}
:root[data-theme="light"] body:has(.theme-standalone){background:var(--bg);color:var(--text)}
:root[data-theme="light"] .theme-standalone~main :is(h1,h2,h3){color:var(--text)}
:root[data-theme="light"] .theme-standalone~main :is(p,small){color:var(--theme-muted)}
@media(max-width:1200px){.theme-toggle span{display:none}.theme-toggle{width:44px;padding:10px}}
@media(max-width:650px){body>header{gap:8px 10px}.theme-tools{margin-left:auto;gap:6px}.theme-toggle{width:40px;min-height:44px;padding:9px}.theme-tools>.secondary{max-width:124px;padding:8px 10px;font-size:11px}header .brand{font-size:clamp(16px,4.3vw,23px)!important;gap:5px}header .brand-logo{width:30px;height:30px}.theme-standalone{padding:0 16px}}

:root[data-theme="dark"]{background:var(--bg);color:var(--text)}
:root[data-theme="dark"] body{background:radial-gradient(ellipse at 0 18%,#27344a55,transparent 42%),var(--bg);color:var(--text)}
:root[data-theme="dark"] body>header{background:var(--bg);border-color:var(--line);box-shadow:0 3px 14px #0003}
:root[data-theme="dark"] :is(h1,h2,h3,h4,label,legend,summary,.brand,.room-section-title){color:var(--text)}
:root[data-theme="dark"] :is(p,small,.field-help,.pass-status,.room-custom-help,.home-panel-help,.header-note,.small-label,footer){color:var(--muted)}
:root[data-theme="dark"] :is(.eyebrow,.seo-guide a,.account-admin,.text-button,.room-stepper button){color:var(--theme-accent)}
:root[data-theme="dark"] :is(#monthly-benefits a,#account-benefits>a,.theme-standalone~main a):not(.primary):not(.secondary){color:var(--theme-accent);text-underline-offset:3px}
:root[data-theme="dark"] :is(input,select,textarea,.event-options select,#fiesta-options select){background:var(--bg);color:var(--text);border-color:var(--line)}
:root[data-theme="dark"] input::placeholder,:root[data-theme="dark"] textarea::placeholder{color:#99a8be}
:root[data-theme="dark"] :is(input,select,textarea):focus{border-color:var(--theme-accent);outline-color:#74b3ff44}
:root[data-theme="dark"] input:is([type="checkbox"],[type="radio"]){accent-color:#74b3ff}
:root[data-theme="dark"] :is(.join-card,.home-grid>.join-card,.arena,.leaderboard,.room-section,.hub-card,.account-dialog,.streamer-invite,.event-banner,.venue-welcome){background:var(--surface);color:var(--text);border-color:var(--line);box-shadow:0 5px 0 #080e1a,0 15px 30px #0002}
:root[data-theme="dark"] :is(.secondary,.text-button,.theme-tools>.secondary){background:var(--surface-2);color:var(--text);border-color:var(--line);box-shadow:0 3px 0 #0d1523}
:root[data-theme="dark"] .secondary:hover{background:#2c3c55}
:root[data-theme="dark"] :is(.home-tabs,.join-avatar-picker,.account-photo,.plan-option,.streamer-option,.event-logo-picker){background:var(--bg);border-color:var(--line)}
:root[data-theme="dark"] .home-tabs button{color:var(--muted)}
:root[data-theme="dark"] .home-tabs button[aria-selected="true"]{color:#fff}
:root[data-theme="dark"] .home-tabs::before{background:#1769d6;box-shadow:0 3px 8px #0004}
:root[data-theme="dark"] .plan-option:has(input:checked){background:#203753;border-color:#74b3ff;box-shadow:0 3px 0 #101e32}
:root[data-theme="dark"] :is(.plan-option span,.plan-option small,.room-section summary small,.venue-welcome p,.event-banner p){color:var(--muted)}
:root[data-theme="dark"] .plan-option small{color:var(--theme-accent)}
:root[data-theme="dark"] .avatar-choice{background:var(--surface-2);border-color:var(--line);box-shadow:0 3px 0 #0d1523}
:root[data-theme="dark"] #join-form .avatar-choice{box-shadow:0 3px 0 #0d1523}
:root[data-theme="dark"] :is(.avatar-choice[aria-pressed="true"],#join-form .avatar-choice[aria-pressed="true"]){background:#244567;border-color:#74b3ff;box-shadow:0 0 0 2px #74b3ff33,0 3px 0 #112d48}
:root[data-theme="dark"] .account-dialog::backdrop{background:#040913bb}
:root[data-theme="dark"] .account-dialog [aria-pressed="true"]{color:#91c3ff;border-color:#74b3ff}
:root[data-theme="dark"] #account-error{color:#ffb0b8}
:root[data-theme="dark"] #account-recovery-code{background:#203753;color:#b4d5ff}
:root[data-theme="dark"] .account-photo-copy label{background:#344763;color:#fff}
:root[data-theme="dark"] .account-photo-preview{border-color:var(--surface-2)}
:root[data-theme="dark"] .top-nav :is(a,summary){color:var(--text)}
:root[data-theme="dark"] :is(.top-nav>a:hover,.top-nav summary:hover,.top-nav details[open]>summary){background:var(--surface-2)}
:root[data-theme="dark"] :is(.top-nav>a[aria-current],.top-nav .nav-current>summary,.nav-dropdown a:hover,.nav-dropdown a[aria-current]){background:#203753;color:#a0cdff}
:root[data-theme="dark"] .nav-dropdown{background:var(--surface);border-color:var(--line);box-shadow:0 14px 36px #0006}
:root[data-theme="dark"] .nav-dropdown small{color:var(--muted)}
:root[data-theme="dark"] .hub-links a{background:#203753;color:#a0cdff}
:root[data-theme="dark"] .hub-card:nth-child(2) .hub-links a{background:#1c3c33;color:#a4e4c7}
:root[data-theme="dark"] .hub-card:nth-child(3) .hub-links a{background:#3e3321;color:#f4d390}
:root[data-theme="dark"] .classification-switch a{background:var(--surface-2);color:var(--muted)}
:root[data-theme="dark"] .classification-switch a[aria-current]{background:#1769d6;color:#fff}
:root[data-theme="dark"] .features article>span{background:#203753;color:#91c3ff;border-color:#365577}
:root[data-theme="dark"] .pop-benefits span{color:var(--text)!important}
:root[data-theme="dark"] :is(.seo-guide ol,.app-download details){color:var(--muted)}
:root[data-theme="dark"] .room-stepper button{background:#203753;border-color:#365577}
:root[data-theme="dark"] .room-stepper button:hover{background:#2b496b}
:root[data-theme="dark"] .event-logo-visual{background:var(--surface-2);border-color:var(--line);color:var(--muted)}
:root[data-theme="dark"] #event-logo-pick{background:var(--surface-2);color:var(--text);border-color:var(--line)}
:root[data-theme="dark"] .room-control-heading>output{background:#203753;color:#a0cdff}
:root[data-theme="dark"] .venue-template-card{background:var(--bg);border-color:var(--line)}
:root[data-theme="dark"] .join-card :is(.venue-template-use,#venue-refresh){background:var(--surface-2);color:#a0cdff;border-color:var(--line);box-shadow:0 3px 0 #0d1523}
:root[data-theme="dark"] .join-card :is(.venue-template-use:hover,#venue-refresh:hover){background:#2c3c55}
:root[data-theme="dark"] .join-card #venue-save{background:#1769d6;color:#fff;border-color:#3d85e5;box-shadow:0 3px 0 #123a70}
:root[data-theme="dark"] .join-card #venue-save:hover{background:#287be6}
:root[data-theme="dark"] .join-card #event-logo-remove{color:#ffbac3}
:root[data-theme="dark"] .join-card #event-logo-remove:hover{background:#4a2833}
:root[data-theme="dark"] .join-card .venue-template-delete{background:#4a2833;color:#ffbac3}
:root[data-theme="dark"] .join-card .venue-template-delete:hover{background:#5a303e}
:root[data-theme="dark"] .winner{background:radial-gradient(ellipse at top,#6b4d1744,transparent 75%),var(--surface);border-color:#7e622f}
:root[data-theme="dark"] .winner .winner-score{color:var(--text)}
:root[data-theme="dark"] #toast{background:#e1e9f7;color:#172238;box-shadow:0 8px 40px #0006}
:root[data-theme="dark"] body:is([data-event-theme="ocean"],[data-event-theme="plum"]){color:var(--text)}
:root[data-theme="dark"] body[data-event-theme] .game-top{background:var(--surface);border-radius:20px;padding:20px}

/* The admin keeps its own layout; its appearance follows the same preference. */
:root[data-theme="light"]:has(.admin-card){background:#faf6ef;color:#20211f;--muted:#62615e;--border:#ded7cd;--accent:#1467d8}
:root[data-theme="light"] :is(.admin-header,.admin-card article,#webhook-url){background:#f4f0e9;color:#20211f}
:root[data-theme="light"] :is(.admin-card,.admin-sidebar nav>a:hover){background:#fffdf9;color:#20211f}
:root[data-theme="light"] .admin-brand{color:#20211f}
:root[data-theme="light"] .admin-sidebar nav>a[aria-current="page"]{background:#eaf2ff;color:#145bb5;border-color:#c5d8ed}
:root[data-theme="light"] .admin-note{background:#edf7ef;color:#30583c;border-color:#cce1d0}
:root[data-theme="light"] .admin-note strong{color:#244630}
:root[data-theme="light"] :is(.admin-card input:not([type="checkbox"]),.admin-card select){background:#faf8f4;color:#20211f;border-color:#d8d1c5}
:root[data-theme="light"] :is(.admin-action,.admin-card button){color:#fff}
:root[data-theme="light"] .admin-card article button:not(:first-of-type){background:#eaf2ff;color:#145bb5;border-color:#c5d8ed}
:root[data-theme="dark"]:has(.admin-card){--border:#3a465a;--accent:#91c3ff}
:root[data-theme="dark"] :is(.admin-card,.admin-sidebar nav>a:hover){background:var(--surface);color:var(--text)}
:root[data-theme="dark"] :is(.admin-header,.admin-card article,#webhook-url){background:var(--bg);color:var(--text)}
:root[data-theme="dark"] .admin-sidebar nav>a[aria-current="page"]{background:#203753;color:var(--text);border-color:#365577}
:root[data-theme="dark"] .admin-note{background:#1c3c33;color:#b6dfc8;border-color:#3d6050}
:root[data-theme="dark"] .admin-note strong{color:#d5f4e2}
:root[data-theme="dark"] .admin-brand{color:var(--text)}
@media(max-width:580px){.admin-header{flex-wrap:wrap}.admin-header .theme-tools{margin-left:auto}.admin-header .theme-toggle{margin:0}.admin-header .admin-back{margin-left:auto}}
