/* Interface colors only. Scene art, cosmetics and reward filters stay in style.css. */
body.light-theme {
  color-scheme: light;
  --ink: #252635;
  --paper: #cbd3dd;
  --paper-deep: #bbc6d3;
  --line: #8997aa;
  --bg-page: #bbc6d3;
  --bg-modal: #cbd3dd;
  --bg-input: #dee5ed;
  --text-main: #252635;
  --text-muted: #424f61;
  --border-color: #8997aa;
  --accent-color: #4942a7;
  --bg-hover: #c0ccd9;
  --ui-selected: #d0cee9;
  --ui-selected-text: #3f3c91;
  --ui-field-border: #718298;
  --ui-outline: #566b83;
  --ui-success: #216440;
  --ui-success-bg: #d5e6db;
  --ui-danger: #a32c3e;
  --ui-danger-bg: #f1dce1;
  --ui-warning: #805007;
  --ui-warning-bg: #efdfbe;
  --ui-info: #235581;
  --ui-info-bg: #d7e4ef;
  --ui-shadow: 0 12px 34px rgba(30, 35, 58, .16);
  --shadow: var(--ui-shadow);
  --scrollbar-thumb: #64758b;
  --scrollbar-thumb-hover: #626c82;
  --scrollbar-track: #bbc6d3;
}

body.light-theme ::selection { color: #252635; background: #dcd9fb; }
body.light-theme :is(input, textarea) { caret-color: var(--accent-color); }
body.light-theme :is(input, textarea)::placeholder { color: var(--text-muted); opacity: 1; }
body.light-theme :is(button, input, select, textarea, summary, a):focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 3px;
}
body.light-theme :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]), textarea, select) {
  color: var(--text-main);
  background-color: var(--bg-input);
  border-color: var(--ui-field-border);
}
body.light-theme :is(input, textarea, select):focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-color) 16%, transparent);
}
body.light-theme :is(input, select, textarea):disabled { color: var(--text-muted); background-color: var(--bg-page); }
body.light-theme :is(input[type="checkbox"], input[type="radio"], input[type="range"]) { accent-color: var(--accent-color); }
body.light-theme :is(select option, select optgroup) { color: var(--text-main); background: var(--bg-input); }
body.light-theme button:disabled { cursor: not-allowed; }
body.light-theme button.primary { color: #fff; }
body.light-theme :is(.field-error, .compatible-api-status.is-error, #nsVoiceError) { color: var(--ui-danger); }

/* Elevation separates the controls from the illustrated game scene. */
body.light-theme :is(.modal-card, .screen-card, .lobby-layout, .settings-modal, .seating-modal,
  .neurospy-waiting-card, .character-context-menu, .saved-character-menu-actions) {
  color: var(--text-main);
  border-color: var(--ui-outline);
  box-shadow: var(--ui-shadow);
}
body.light-theme :is(.overlay-modal, .settings-overlay, .seating-overlay) { background: rgba(24, 29, 46, .46); }
body.light-theme :is(.modal-head, .settings-modal .settings-head, .settings-tabs, .lobby-head,
  .neurospy-room-head, .neurospy-chat-head) { background: var(--bg-page); }
body.light-theme :is(.settings-panel, .selected-provider) { color: var(--text-main); background: var(--bg-modal); }
body.light-theme :is(.settings-section label, .settings-section .field-hint, .voice-settings legend,
  .section-title button, .empty-note) { color: var(--text-muted); }
body.light-theme :is(.settings-modal button.danger, #characterCollectionModal .saved-character-menu-actions button.danger) {
  color: var(--ui-danger) !important;
  border-color: var(--ui-danger) !important;
}
body.light-theme .modal-body .room-visibility-option.active {
  color: var(--ui-selected-text); background: var(--ui-selected); border-color: var(--accent-color);
}
body.light-theme .neurospy-choice.active { color: var(--ui-selected-text); background: var(--ui-selected); }
body.light-theme :is(.profile-chip, .online-indicator) {
  background: var(--bg-page); border-color: var(--ui-outline); box-shadow: 0 5px 18px rgba(30, 35, 58, .14);
}
body.light-theme .profile-chip:hover { background: var(--bg-hover); border-color: var(--accent-color); }
body.light-theme .game-action {
  color: var(--text-main); background: var(--bg-modal); border-color: var(--ui-field-border);
  box-shadow: 0 5px 16px rgba(20, 26, 44, .22);
}
body.light-theme .game-action:hover { background: var(--bg-hover); border-color: var(--accent-color); }
body.light-theme .game-action.active { color: var(--ui-selected-text); background: var(--ui-selected); border-color: var(--accent-color); }
body.light-theme .boot-screen { --text-muted: #d3d8e5; --accent-color: #c2bdff; color: #f4f6fa; }
body.light-theme .neurospy-discovery-copy small { color: #fff; }
@media (orientation: portrait) and (max-width: 700px) {
  body.light-theme[data-screen="start"] .floating-toolbar-icons {
    background: var(--bg-modal); border-color: var(--border-color); box-shadow: var(--ui-shadow);
  }
}
body.light-theme :is(.toast, .achievement-toast),
body.light-theme:has(.neurospy-game-screen:not(.hidden)) .toast {
  color: var(--text-main); background: var(--bg-input); border-color: var(--ui-outline); box-shadow: var(--ui-shadow);
}
body.light-theme .achievement-toast-copy p { color: var(--ui-warning); }
body.light-theme .achievement-toast-xp { color: var(--accent-color); }
body.light-theme .achievement-toast-preview .profile-achievement-status { color: #195d36; background: #d5f1df; border-color: #4e9167; }
body.light-theme .hint-dot::after,
body.light-theme .profile-help::after { color: var(--text-main); background: var(--bg-input); box-shadow: var(--ui-shadow); }

/* Public and private chat, including quotations and audience labels. */
body.light-theme .message.spectator { color: var(--text-main); background: var(--ui-success-bg); opacity: 1; }
body.light-theme .message.spectator .message-content { color: var(--text-main); }
body.light-theme .message.spectator .message-author { color: var(--ui-success); }
body.light-theme .message.spectator .message-time { color: var(--text-muted); }
body.light-theme .observer-message-badge { color: var(--ui-success); background: var(--ui-success-bg); border-color: #81ab92; }
body.light-theme .message-addressed { color: var(--ui-selected-text); background: var(--ui-selected); border-color: #a7a3d7; }
body.light-theme .speech { color: var(--text-main); background: var(--bg-input); border-color: #252635; }
body.light-theme .speech::before { border-top-color: #252635; }
body.light-theme .speech::after { border-top-color: var(--bg-input); }
body.light-theme .speech-actions button { color: var(--text-muted); border-color: var(--ui-field-border); }
body.light-theme .typing-indicator span { background: var(--text-muted); }
body.light-theme :is(.neurospy-game-chat-panel, .neurospy-game-chat-handle, .neurospy-game-chat-form,
  .neurospy-game-chat-messages) { color: var(--text-main); background: var(--bg-modal); border-color: var(--border-color); }
body.light-theme .neurospy-game-chat-panel { border-color: var(--ui-outline); }
body.light-theme :is(.neurospy-game-chat-handle, .neurospy-game-chat-form, .ns-chat-tabs,
  .neurospy-chat-panel > header) { background: var(--bg-page); border-color: var(--border-color); }
body.light-theme .neurospy-control-panel { background: #d5dde6; }
body.light-theme .neurospy-game-chat-messages .neurospy-chat-message {
  color: var(--text-main); background: var(--bg-input); border-color: var(--border-color);
}
body.light-theme :is(.neurospy-chat-message strong, .neurospy-game-chat-messages .neurospy-chat-message strong,
  .neurospy-chat-reply, .neurospy-chat-quote strong) { color: var(--ui-selected-text); }
body.light-theme .neurospy-game-chat-messages .neurospy-chat-message.system { color: var(--text-muted); background: transparent; }
body.light-theme :is(.neurospy-message-counter, .neurospy-game-chat-title, .neurospy-game-chat-close) { color: var(--text-muted); }
body.light-theme :is(.neurospy-chat-reply-preview, .neurospy-chat-quote) { color: #4e5375; background: var(--ui-selected); }
body.light-theme .neurospy-chat-reply:hover { color: var(--text-main); }
body.light-theme .neurospy-game-chat-messages .neurospy-chat-message.spectator { background: var(--ui-success-bg); border-color: #81ab92; }
body.light-theme .neurospy-game-chat-messages .neurospy-chat-message.host { background: var(--ui-warning-bg); border-color: #b89855; box-shadow: none; }
body.light-theme .neurospy-host-chat-audience button { color: var(--text-main); background: var(--bg-input); border-color: var(--ui-field-border); }
body.light-theme .neurospy-host-chat-audience button.active { color: #fff; background: #315e8d; border-color: #315e8d; }
body.light-theme .ns-chat-tabs button { color: var(--text-muted); background: var(--bg-page); }
body.light-theme .ns-chat-tabs button:hover { color: var(--text-main); background: var(--bg-hover); }
body.light-theme .ns-chat-tabs button[aria-selected="true"] { color: #fff; background: #514b85; border-color: #514b85; }
body.light-theme :is(.ns-private-heading small, .ns-private-contact small, .ns-private-contact-preview,
  .ns-private-empty, .ns-private-status, .ns-private-message time) { color: var(--text-muted); }
body.light-theme .ns-private-heading button { color: var(--text-main); background: var(--bg-input); border-color: var(--ui-field-border); }
body.light-theme .ns-private-contact { color: var(--text-main); }
body.light-theme .ns-private-contact:hover { background: var(--bg-hover); }
body.light-theme .ns-private-message { color: var(--text-main); background: var(--bg-input); border-color: var(--border-color); }
body.light-theme .ns-private-message.own { background: var(--ui-selected); border-color: #b3afd6; }
body.light-theme :is(.ns-private-message.error, .ns-live-error) { color: var(--ui-danger); background: var(--ui-danger-bg); border-color: #bc7783; }
body.light-theme .ns-private-message strong { color: var(--ui-selected-text); }
body.light-theme .ns-private-message small { color: var(--ui-danger); }

/* Saturated action colors remain saturated; only their pale labels are corrected. */
body.light-theme #nsAddBot { color: #fff; background: #514bb8; border-color: #514bb8; }
body.light-theme :is(#nsRoomSettings, #nsViewRoomSettings) { color: #fff; background: #475569; border-color: #475569; }
body.light-theme #nsSetLocation { color: #fff; background: #9d2863; border-color: #9d2863; }
body.light-theme #nsBecomeSpectator { color: #fff; background: #0f766e; border-color: #0f766e; }
body.light-theme #nsBecomePlayer { color: #fff; background: #216440; border-color: #216440; }
body.light-theme #nsLeaveRoom { color: #fff; background: #805007; border-color: #805007; }
body.light-theme .neurospy-control-actions > #nsDeleteRoom { color: #fff; background: #a32c3e; border-color: #a32c3e; }
body.light-theme :is(.neurospy-admin-delete, .neurospy-preparation-panel button.danger) { color: #fff; background: #a32c3e; border-color: #a32c3e; }
body.light-theme .neurospy-player-row { color: var(--text-main); border-color: var(--ui-field-border); }
body.light-theme .neurospy-player-row.has-ready-profile-card-background { border-color: #4e5a6b; }
body.light-theme .neurospy-owner-badge { color: #68430d; background: #ead9af; }
body.light-theme .neurospy-location-ready { color: var(--ui-success); }
body.light-theme :is(.neurospy-control-actions > button, .neurospy-main-actions .primary):focus-visible { outline-color: var(--accent-color); }
body.light-theme :is(.neurospy-main-actions .primary, .neurospy-preparation-panel button.primary) { border-color: #6256a5; }
body.light-theme .neurospy-host-controls button.danger { color: #fff; background: #762f38; border-color: #762f38; }

/* Room controls, player menus and reactions are UI, not part of the table art. */
body.light-theme :is(.neurospy-ai-context-menu, .neurospy-reaction-panel, .neurospy-host-controls,
  .neurospy-game-phase, .neurospy-host-menu-toggle) {
  color: var(--text-main); background: var(--bg-modal); border-color: var(--ui-outline); box-shadow: var(--ui-shadow);
}
body.light-theme[data-screen="neurospy-game"] .neurospy-game-more-menu {
  color: var(--text-main); background: var(--bg-modal); border-color: var(--ui-outline); box-shadow: var(--ui-shadow);
}
body.light-theme .neurospy-ai-context-menu button { color: var(--text-main); }
body.light-theme .neurospy-ai-context-menu button:hover:not(:disabled) { background: var(--bg-hover); }
body.light-theme .neurospy-ai-context-menu button:disabled { color: var(--text-muted); }
body.light-theme :is(.neurospy-reaction-panel > header button, .neurospy-reaction-section > small,
  .neurospy-game-phase span, .neurospy-game-phase time.unlimited) { color: var(--text-muted); }
body.light-theme .neurospy-game-phase time { color: var(--text-main); }
body.light-theme .neurospy-reaction-grid button { color: var(--text-main); background: var(--bg-input); border-color: var(--ui-field-border); }
body.light-theme .neurospy-reaction-grid button:hover:not(:disabled) { background: var(--bg-hover); border-color: var(--accent-color); }
body.light-theme .neurospy-reaction-toggle,
body.light-theme[data-screen="neurospy-game"] .neurospy-game-chat-toggle {
  color: var(--ui-selected-text); background: var(--ui-selected); border-color: #8e89bd; box-shadow: var(--ui-shadow);
}
body.light-theme :is(.neurospy-reaction-toggle:hover, .neurospy-reaction-toggle[aria-expanded="true"]) {
  color: #fff; background: #514b78; border-color: #514b78;
}
body.light-theme[data-screen="neurospy-game"] :is(.neurospy-game-chat-toggle.active, .neurospy-game-chat-toggle.is-my-turn) {
  color: #fff; background: #315e8d; border-color: #315e8d;
}
body.light-theme .neurospy-game-turn-status { color: var(--ui-success); background: var(--ui-success-bg); }
body.light-theme .neurospy-game-turn-status.mine { color: #fff; background: #216440; }

/* Voting and recovery panels retain semantic colors with readable foregrounds. */
body.light-theme :is(.neurospy-court-panel, .neurospy-preparation-panel, .neurospy-vote-history,
  .neurospy-host-guess-review, .neurospy-returning-player-notice) {
  color: var(--text-main); background: var(--bg-modal); border-color: var(--ui-outline); box-shadow: var(--ui-shadow);
}
body.light-theme :is(.neurospy-court-panel > strong, .neurospy-preparation-panel > strong,
  .neurospy-host-guess-review > strong, .neurospy-host-guess-review b) { color: var(--text-main); }
body.light-theme :is(.neurospy-court-panel > p, .neurospy-preparation-panel p,
  .neurospy-host-guess-review p) { color: var(--text-main); }
body.light-theme .neurospy-preparation-panel #nsPreparationLocation { color: var(--ui-warning); }
body.light-theme .neurospy-preparation-panel #nsChooseSpy { color: #fff; background: #514bb8; border-color: #514bb8; }
body.light-theme .neurospy-preparation-panel #nsChooseFirst { color: #fff; background: #0f766e; border-color: #0f766e; }
body.light-theme .neurospy-preparation-panel .neurospy-preparation-clear { color: var(--text-main); background: var(--bg-input); border-color: var(--ui-field-border); }
body.light-theme .neurospy-court-panel.is-accusation { background: var(--ui-danger-bg); border-color: #bc7783; }
body.light-theme .neurospy-court-panel.is-defense { background: var(--ui-warning-bg); border-color: #b89855; }
body.light-theme :is(.neurospy-court-panel.is-verdict, .neurospy-court-panel.is-tie, .neurospy-host-guess-review) {
  background: var(--ui-info-bg); border-color: #7e9fbd;
}
body.light-theme :is(.neurospy-court-panel.is-last-word, .neurospy-court-panel.is-final-vote,
  .neurospy-court-panel.is-location-guess, .neurospy-returning-player-notice) { background: var(--ui-selected); border-color: #a7a3d7; }
body.light-theme .neurospy-accusation-confirm { color: var(--ui-danger); background: var(--ui-danger-bg); border-color: #bc7783; box-shadow: var(--ui-shadow); }
body.light-theme .neurospy-accusation-confirm > strong,
body.light-theme .neurospy-accusation-confirm p { color: var(--ui-danger); }
body.light-theme .neurospy-ai-recovery { color: var(--ui-warning); background: var(--ui-warning-bg); border-color: #b89855; box-shadow: var(--ui-shadow); }
body.light-theme .neurospy-ai-recovery p { color: var(--ui-warning); }
body.light-theme .neurospy-vote-history-toggle { color: var(--text-main); background: var(--bg-page); }
body.light-theme .neurospy-vote-history-toggle::after { color: var(--text-muted); }
body.light-theme .neurospy-vote-history-entry { background: var(--bg-input); }
body.light-theme .neurospy-vote-history-head span { color: var(--ui-info); }
body.light-theme .neurospy-vote-history-row > small { color: var(--text-muted); }
body.light-theme .neurospy-court-voter { color: var(--text-main); background: var(--bg-page); }
body.light-theme .neurospy-court-voter em { color: var(--ui-info); }

/* Voice, model dialogs, live diagnostics and clean thoughts. */
body.light-theme :is(#neurospyVoiceModal .modal-card, #neurospyPasswordModal .compact-modal-card,
  #neurospyGuessModal .compact-modal-card, #neurospyLocationModal .compact-modal-card,
  #neurospyPasswordModal .modal-body, #neurospyGuessModal .modal-body, #neurospyLocationModal .modal-body,
  .neurospy-ai-inspector-card, .neurospy-ai-inspector-card .modal-head,
  .neurospy-ai-inspector-card .neurospy-ai-inspector-tabs, .neurospy-ai-inspector-card .neurospy-ai-inspector-body) {
  color: var(--text-main); background: var(--bg-modal);
}
body.light-theme :is(.neurospy-own-voice-form label, .neurospy-own-voice-form .field-hint,
  #neurospyPasswordModal label, #neurospyGuessModal label, #neurospyLocationModal label,
  #neurospyGuessModal .muted, .neurospy-ai-inspector-body .muted,
  .neurospy-ai-thought-entry small, .neurospy-role-body p, .neurospy-role-summary > small) { color: var(--text-muted); }
body.light-theme :is(.neurospy-role-body strong, .neurospy-role-summary > strong) { color: var(--text-main); }
body.light-theme .neurospy-role-summary-players span { color: var(--text-main); background: var(--bg-page); }
body.light-theme .neurospy-role-summary-players span.spy { color: #fff; background: #2d579f; }
body.light-theme :is(.neurospy-ai-inspector-body pre, .neurospy-ai-thought-entry) { color: var(--text-main); background: var(--bg-input); }
body.light-theme .neurospy-ai-thought-section + .neurospy-ai-thought-section { border-color: var(--border-color); }
body.light-theme .neurospy-ai-thought-section strong { color: #83418f; }
body.light-theme .neurospy-own-voice-form #nsVoiceError { color: var(--ui-danger); }
body.light-theme .neurospy-ai-inspector-tabs button { color: var(--text-muted); background: var(--bg-input); border-color: var(--ui-field-border); }
body.light-theme .neurospy-ai-inspector-tabs button.active { color: var(--ui-selected-text); background: var(--ui-selected); border-color: var(--accent-color); }
body.light-theme .ai-family-editor input[type="color"] { color-scheme: light; }
body.light-theme :is(.neurospy-model-card .modal-body, .neurospy-bot-body) { scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track); }
body.light-theme :is(.neurospy-model-card .modal-body, .neurospy-bot-body)::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb); border-color: var(--scrollbar-track);
}
body.light-theme :is(.neurospy-model-card .modal-body, .neurospy-bot-body)::-webkit-scrollbar-track { background: var(--scrollbar-track); }
body.light-theme :is(.compatible-api-panel button.danger, .ns-bot-collection-actions .danger,
  #characterCollectionModal .character-collection-count.limit-reached) { color: var(--ui-danger); }
body.light-theme #nsSeatingModal {
  --text-main: #252635; --text-muted: #424f61; --bg-modal: #cbd3dd;
  --bg-input: #dee5ed; --bg-hover: #c0ccd9; --border-color: #8997aa;
}
body.light-theme #nsSeatingGrid .first-seat .neurospy-seat-number { color: var(--ui-success); }

/* Profile UI: no changes to skin/hat images, reward art or locked filters. */
body.light-theme :is(.profile-hero, .profile-background-preview):not(.has-profile-card-background) { background: var(--bg-page); }
body.light-theme :is(.profile-mastery-line > strong, .profile-mastery-xp > strong, .profile-match-xp,
  .leaderboard-value, .leaderboard-row:nth-child(-n+3) .leaderboard-place, .profile-model-version span,
  .profile-background-preview-identity b) { color: var(--ui-warning); }
body.light-theme :is(.profile-modal-body .profile-help, .mastery-road-card .profile-help) { color: var(--ui-selected-text); background: var(--ui-selected); }
body.light-theme .profile-match-result.win { color: var(--ui-success); background: var(--ui-success-bg); }
body.light-theme .profile-match-result.loss { color: var(--ui-danger); background: var(--ui-danger-bg); }
body.light-theme .profile-match-result.unfinished { color: var(--text-muted); background: var(--bg-page); }
body.light-theme .profile-achievement-main .profile-achievement-reward { color: var(--ui-warning); }
body.light-theme :is(.avatar-editor-subtabs button.active, .modal-body .avatar-mode-switch button.active) { color: var(--ui-selected-text); background: var(--ui-selected); border-color: var(--accent-color); }
body.light-theme .avatar-cosmetic-description small { color: var(--ui-success); }
body.light-theme .avatar-cosmetic-description small.locked { color: var(--ui-warning); }
body.light-theme .avatar-badge-choice.equipped { color: var(--ui-selected-text); }
body.light-theme :is(.ai-skin-choice:hover, .ai-skin-choice.active) { color: var(--ui-selected-text); }
body.light-theme .mastery-reward-slot.reached { color: var(--ui-warning); }
body.light-theme .mastery-road-body { --mastery-ink: var(--ui-warning); }
body.light-theme .mastery-account strong { color: #ffe6ac; }
body.light-theme .profile-avatar-editor-button:hover { color: var(--ui-selected-text); }
body.light-theme .has-ready-profile-card-background {
  --text-main: #f4f6fa; --text-muted: #d3d8e5; --ui-warning: #f4cf72; --ui-selected-text: #e1deff;
}
