/* Profile preferences and the shared palette used by every public page. */
:root{
  --theme-page:#f6f7f5;--theme-surface:#fff;--theme-raised:#f0f3eb;
  --theme-text:#252c27;--theme-muted:#69775e;--theme-line:#dfe5da;
  --theme-accent:#536b36;--theme-focus:#779642;
}
.profile-preferences{margin:24px 0 32px}
.profile-preferences h2{margin:0 0 16px;font-size:21px}
.theme-toggle{display:flex;align-items:center;gap:14px;width:100%;min-height:70px;padding:12px 0;border:0;background:transparent;color:var(--theme-text);text-align:left;cursor:pointer}
.theme-toggle>svg{width:24px;height:24px;flex:none;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round;color:var(--theme-accent)}
.theme-toggle-copy{display:flex;flex-direction:column;gap:5px;min-width:0}
.theme-toggle-copy strong{font-size:14px;font-weight:650;line-height:1.4}
.theme-toggle-copy small{font-size:12px;line-height:1.5;color:var(--theme-muted)}
.theme-toggle-track{position:relative;width:46px;height:28px;flex:none;margin-left:auto;border:1px solid #bdc7b7;border-radius:20px;background:#e0e6d9}
.theme-toggle-track:after{content:'';position:absolute;top:3px;left:3px;width:20px;height:20px;background:#fff;border-radius:50%;box-shadow:0 1px 3px #0003;transition:transform .16s}
.theme-toggle[aria-checked="true"] .theme-toggle-track{background:var(--theme-accent);border-color:var(--theme-accent)}
.theme-toggle[aria-checked="true"] .theme-toggle-track:after{transform:translateX(18px);background:#141a16}
.theme-toggle:focus-visible{outline:3px solid var(--theme-focus);outline-offset:5px;border-radius:8px}
.theme-toggle+.theme-toggle{margin-top:8px;padding-top:20px;border-top:1px solid var(--theme-line)}

:root[data-theme="dark"]{
  color-scheme:dark;--theme-page:#141a16;--theme-surface:#1d2620;--theme-raised:#28332a;
  --theme-text:#edf2e8;--theme-muted:#a9b6a2;--theme-line:#3b483c;
  --theme-accent:#bed58b;--theme-focus:#bdd58b;
  --ink:var(--theme-text);--muted:var(--theme-muted);--line:var(--theme-line);--red:#ec8277;
  color:var(--theme-text);background:var(--theme-page);
}
:root[data-theme="dark"] body{color:var(--theme-text);background:var(--theme-page)}
:root[data-theme="dark"] :is(.site-header,header,.site-footer,footer,.account-actions,.tutorial-footer,.cross-note,.help-faq,.help-faq-item,.medal-rules,.total-profile-stats,.profile-points-foot,.daily-winner,.league-champion){border-color:var(--theme-line)}
:root[data-theme="dark"] :is(.panel,.scoreboard,.play-panel,.seed-controls,dialog,.wordlex-menu-popover){background:var(--theme-surface);color:var(--theme-text);border-color:var(--theme-line)}
:root[data-theme="dark"] dialog::backdrop{background:#070c09b8}
:root[data-theme="dark"] .wordlex-menu{color:var(--theme-text)}
:root[data-theme="dark"] .wordlex-menu>summary{background:var(--theme-raised);border-color:var(--theme-line)}
:root[data-theme="dark"] .wordlex-menu>summary:hover,:root[data-theme="dark"] .wordlex-menu[open]>summary{background:#35452e;border-color:#778c5b}
:root[data-theme="dark"] :is(.wordlex-menu-heading,.wordlex-menu-language){border-color:var(--theme-line)}
:root[data-theme="dark"] :is(.wordlex-menu-group,.wordlex-nav-link small,.wordlex-menu-language>span,.wordlex-language-switch a){color:var(--theme-muted)}
:root[data-theme="dark"] .wordlex-menu .wordlex-nav-link{color:var(--theme-text)}
:root[data-theme="dark"] .wordlex-nav-link:hover{background:var(--theme-raised)}
:root[data-theme="dark"] .wordlex-nav-link[aria-current="page"]{background:#35452e;color:var(--theme-accent)}
:root[data-theme="dark"] .wordlex-nav-link>svg{stroke:var(--theme-accent)}
:root[data-theme="dark"] .wordlex-nav-link[aria-current="page"]:after{color:var(--theme-accent)}
:root[data-theme="dark"] .wordlex-menu .wordlex-language-switch{background:var(--theme-raised);border-color:var(--theme-line)}
:root[data-theme="dark"] .wordlex-language-switch a[aria-current="page"]{background:#435336;color:var(--theme-text)}
:root[data-theme="dark"] :is(.caption,.eyebrow,.muted,.small,.intro,.sources,.edition,.brand-copy>:last-child,.play-instruction,.save-status,.keyboard-caption,.score label,.score small,.mode-details,.text-button,.empty-state,.small-live-note,footer,dialog p,.rules,.rule-note,.cross-note,.legend-row p,.input-caption,.profile-stats span,.profile-stats small,.profile-points-foot small,.medal-language,.medal-best,.medal-goal-value,.medal-goal-remaining,.medal-rules summary,.medal-rules p){color:var(--theme-muted)}
:root[data-theme="dark"] :is(.inline-link,.history-date,.points-cell,.profile-ranking-link,.profile-points-foot>strong,.profile-points-foot a,.completion-rank,.completion-status button,.help-sources a,.downloads a){color:var(--theme-accent)}
:root[data-theme="dark"] :is(.rules strong,.help-faq-item summary,.help-faq h3,.help-sources h3,.medal-goal-value strong,.medal-complete strong,.daily-winner strong,.champion-person strong){color:var(--theme-text)}
:root[data-theme="dark"] :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),textarea,select,#seed-input,#share-text){background-color:#18211b;border-color:var(--theme-line);color:var(--theme-text)}
:root[data-theme="dark"] input::placeholder{color:#8a9b84}
:root[data-theme="dark"] :is(button,a,input,select,textarea,summary):focus-visible{outline-color:var(--theme-focus)}
:root[data-theme="dark"] :is(.secondary,.secondary-button,.seed-button:not(.primary),.avatar-choice,.theme-toggle-track,.level-grid a,.pages button){background:var(--theme-raised);border-color:var(--theme-line);color:var(--theme-text)}
:root[data-theme="dark"] :is(.secondary,.secondary-button,.seed-button:not(.primary),.level-grid a):hover{background:#36442f}
:root[data-theme="dark"] :is(.primary,.primary-button,.confirm-button,.seed-button.primary){background:var(--theme-accent);color:#1c2b17;border-color:var(--theme-accent)}
:root[data-theme="dark"] :is(.primary,.primary-button,.confirm-button,.seed-button.primary):hover{background:#cce3a0;border-color:#cce3a0}
:root[data-theme="dark"] :is(.mode-switch,.share-choices,.tutorial-example,.completion-metric,.completion-medal,.downloads,.profile-ranking-link,.ranking-own,.keyboard-panel){background:var(--theme-raised);border-color:var(--theme-line)}
:root[data-theme="dark"] :is(.mode-switch button,.share-choices button){color:var(--theme-muted)}
:root[data-theme="dark"] :is(.mode-switch button,.share-choices button)[aria-pressed="true"]{background:#435336;color:var(--theme-text)}
:root[data-theme="dark"] .segmented-control button{background:var(--theme-raised);border-color:var(--theme-line);color:var(--theme-muted)}
:root[data-theme="dark"] .segmented-control button[aria-pressed="true"]{background:var(--theme-accent);border-color:var(--theme-accent);color:#1c2b17}
:root[data-theme="dark"] .league-card{background:var(--theme-surface);border-color:var(--theme-line);color:var(--theme-text)}
:root[data-theme="dark"] .league-card:hover{background:var(--theme-raised);border-color:#687b57}
:root[data-theme="dark"] :is(.league-card.selected,.completion-earned){background:#2d3d26;border-color:#647b43;color:var(--theme-text)}
:root[data-theme="dark"] :is(.league-card p,.league-card small,.champion-label,.champion-person small,.completion-metric dt){color:var(--theme-muted)}
:root[data-theme="dark"] .league-avatar-stack>.avatar-rank{border-color:var(--theme-surface)}
:root[data-theme="dark"] .medal-wood{--medal-ink:#d6ab87}
:root[data-theme="dark"] .medal-iron{--medal-ink:#bac7c5}
:root[data-theme="dark"] .medal-silver{--medal-ink:#b4d3e5}
:root[data-theme="dark"] .medal-gold{--medal-ink:#ecd080}
:root[data-theme="dark"] .medal-diamond{--medal-ink:#9ddbeb}
:root[data-theme="dark"] .medal-progress progress,:root[data-theme="dark"] .medal-progress progress::-webkit-progress-bar{background:var(--theme-line)}
:root[data-theme="dark"] .medal-progress progress::-webkit-progress-value{background:var(--theme-accent)}
:root[data-theme="dark"] .medal-progress progress::-moz-progress-bar{background:var(--theme-accent)}

/* Clue colors stay recognizable; solved letters keep dark text on green. */
:root[data-theme="dark"] :where(.tile,.tutorial-cell):where(:not(.blocked):not(.correct):not(.candidate):not(.exploded)){background:#27322a;border-color:#4c5a4c;color:var(--theme-text)}
:root[data-theme="dark"] :is(.tile.selected,.tutorial-cell.typed):not(.correct){background:#34462d;border-color:#819960}
:root[data-theme="dark"] .tile.current{border-color:var(--theme-accent);box-shadow:0 0 0 3px #bed58b24}
:root[data-theme="dark"] :is(.tile.correct,.tile.correct .tile-letter,.tutorial-cell.correct,.tutorial-cell.correct .tutorial-letter,.entry-slot.correct){color:#263c23;background-color:#d7edcf;border-color:#aaca9e}
:root[data-theme="dark"] :is(.tile.blocked,.tutorial-cell.blocked){background-color:#0c110d;border-color:#111a13}
:root[data-theme="dark"] :is(.keyboard-panel .key,#close-keyboard):not(.enter):not(.present):not(.absent):not(.excluded){background:#354235;border-color:#52634d;color:var(--theme-text)}
:root[data-theme="dark"] .keyboard-panel .key:not(:disabled):not(.present):not(.absent):not(.excluded):active{background:#485b3f}
:root[data-theme="dark"] .scoreboard .help-button span{border-color:var(--theme-muted);color:var(--theme-muted)}
:root[data-theme="dark"] :is(.scoreboard .help-button:hover,#open-tutorial,#share-win-result,#share-loss-result,.tutorial-example>.secondary-button,[data-color-stage].current){background:var(--theme-raised);border-color:var(--theme-line);color:var(--theme-text)}
:root[data-theme="dark"] :is(#tutorial-dialog p,#tutorial-dialog .tutorial-tip,.tutorial-example-label,.tutorial-example figcaption,.tutorial-never,.tutorial-progress,[data-color-stage],.help-faq-item ul,#share-description,#share-availability,.completion-dialog>p){color:var(--theme-muted)}
:root[data-theme="dark"] :is(.tutorial-example-label strong,#tutorial-dialog .tutorial-takeaway,.tutorial-error-counter strong,#help-dialog .help-faq h3,#help-dialog .help-sources h3,#tutorial-dialog .tutorial-example-heading){color:var(--theme-text)}
:root[data-theme="dark"] :is([data-tutorial-dot],.tutorial-danger-cell){background:var(--theme-raised);border-color:var(--theme-line)}
:root[data-theme="dark"] [data-tutorial-dot].current{background:var(--theme-accent)}
:root[data-theme="dark"] :is(.tile.at-risk,.tutorial-danger-cell.at-risk){border-color:var(--red);animation-name:cell-tremble,dark-cell-pulse}
:root[data-theme="dark"] :is(.tile.exploded,.tutorial-danger-cell.exploded,.danger-note,.loss-symbol){background:#442b27;border-color:var(--red);color:#ffb5a9}
:root[data-theme="dark"] :is(.message.error,.play-instruction.error,#load-status.error,.form-status.error,.error,#loss-dialog .eyebrow){color:#ffaca0}
:root[data-theme="dark"] :is(.message.success,.status,#share-status){color:#c4dfa5}
:root[data-theme="dark"] body[data-page="account"] :is(p,.caption,.divider){color:var(--theme-muted)}
:root[data-theme="dark"] body[data-page="account"] .status:not(:empty){background:#2c3e28;color:#c4dfa5}
:root[data-theme="dark"] body[data-page="account"] .error:not(:empty){background:#442b27;color:#ffaca0}
:root[data-theme="dark"] .theme-toggle[aria-checked="true"] .theme-toggle-track{background:var(--theme-accent);border-color:var(--theme-accent)}
:root[data-theme="dark"] body[data-page="vocabulary"] a{color:var(--theme-accent)}
:root[data-theme="dark"] body[data-page="vocabulary"] section+section{border-color:var(--theme-line)}
@keyframes dark-cell-pulse{0%,100%{background:#27322a;box-shadow:0 0 0 1px #ec827730}50%{background:#442b27;box-shadow:0 0 0 4px #ec827740}}
@media(prefers-reduced-motion:reduce){.theme-toggle-track:after{transition:none}:root[data-theme="dark"] :is(.tile.at-risk,.tutorial-danger-cell.at-risk){background:#442b27}}
