/* Rendered on <html> by the server before the first paint. No colour inversion
   or JavaScript/localStorage preference is applied to user images or map data. */
:root {
    --theme-panel-alt: #eef3ee;
    --theme-error-bg: #fff0eb;
    --theme-error-text: #853f2c;
    --theme-notice-bg: #faf5df;
    --theme-notice-text: #594b1e;
}
.account-appearance { margin: 1.6rem 0; padding-block: 1rem; border-block: 1px solid var(--line); }
.account-appearance h2 { margin-bottom: .8rem; }
.theme-preference-form label { display: flex; gap: .7rem; align-items: center; font-weight: 700; }
.theme-preference-form input { width: 1.3rem; height: 1.3rem; accent-color: #387b68; }
.theme-preference-form p { color: var(--muted); font-size: .9rem; margin: .6rem 0; }
.site-support-footer { padding: .8rem 24px; border-top: 1px solid var(--line); color: var(--muted); font-size: .8rem; }
.site-support-footer p { width: min(1200px, 100%); margin: 0 auto; }
.site-support-footer a { text-underline-offset: .15em; }

html[data-theme="dark"] {
    color-scheme: dark;
    --ink: #e3ede8;
    --muted: #b0c2bb;
    --paper: #111b1b;
    --surface: #1b2a29;
    --line: #47605a;
    --accent: #f0a489;
    --theme-panel-alt: #253a36;
    --theme-error-bg: #452a28;
    --theme-error-text: #ffbeaa;
    --theme-notice-bg: #39351f;
    --theme-notice-text: #f0d997;
    scrollbar-color: #68877c #172522;
}
html[data-theme="dark"] :is(.party-shell, .play-screen, .party-chat) {
    --party-ink: var(--ink); --party-muted: var(--muted); --party-border: var(--line);
    --play-ink: var(--ink); --play-green: #a4d4b9; --play-line: var(--line);
    --chat-ink: var(--ink); --chat-border: var(--line);
}
html[data-theme="dark"] body { background: var(--paper); color: var(--ink); }
html[data-theme="dark"] .topbar { background: #132e28; color: #edf6f0; border-bottom: 1px solid var(--line); }
html[data-theme="dark"] :is(.party-card, .setup-panel, .setup-card, .setup-create-form,
    .party-map-option, .party-wizard-steps li, .catalog-card, .catalog-filters,
    .catalog-search, .catalog-search-bar, .catalog-picker, .catalog-picker-dialog,
    .moderation-card, .moderation-grid > *, .report-evidence-message, .map-completion,
    .connection-confirmation, .connection-inspector, .catalog-empty,
    .map-panel, .inspector, .editor-wizard, .geometry-diagnostics,
    .play-leaderboard, .play-map-card, .play-command-panel, .play-map-command,
    .party-chat-panel, dialog) {
    color: var(--ink); background: var(--surface); border-color: var(--line);
}
html[data-theme="dark"] :is(input:not([type="color"]):not([type="range"]):not([type="checkbox"]):not([type="radio"]), select, textarea) {
    background: #142321; color: var(--ink); border-color: #75948a;
}
html[data-theme="dark"] :is(input, textarea)::placeholder { color: #a7bcb2; opacity: 1; }
html[data-theme="dark"] :is(input, select, textarea) { accent-color: #7cc3a4; }
html[data-theme="dark"] :is(button, a, input, select, textarea, summary):focus-visible {
    outline: 3px solid #f2ca70; outline-offset: 2px;
}
html[data-theme="dark"] .button-primary { background: #326f58; color: #fff; }
html[data-theme="dark"] .button-primary:hover { background: #3e856c; }
html[data-theme="dark"] :is(.button-secondary, .play-map-toolbar button, .play-map-command button,
    .play-action-buttons button, .play-target-options button, .play-start-row button,
    .play-result-switch button, .party-chat button, .selection-list-item, .catalog-reaction-button) {
    background: var(--theme-panel-alt); color: var(--ink); border-color: #75948a;
}
html[data-theme="dark"] :is(.button-secondary:hover, .selection-list-item:hover,
    .play-target-options button:hover, .party-chat button:hover) { background: #344d43; }
html[data-theme="dark"] :is(.party-notice, .social-notification, .chat-notice,
    .support-internal, .moderation-warning, .report-evidence-target, .import-warning,
    .geometry-warning, .play-result-review, .import-detail-limited, .completion-badge) {
    background: var(--theme-notice-bg); color: var(--theme-notice-text); border-color: #a38e4b;
}
html[data-theme="dark"] :is(.party-errors, .errorlist, .message-error, .chat-error,
    .play-error, .geometry-inline-error, .party-danger-button, .region-conflict) {
    background: var(--theme-error-bg); color: var(--theme-error-text); border-color: #b87e69;
}
html[data-theme="dark"] :is(.support-message, .support-reply, .report-evidence,
    .sc-position-tools, .selection-multi, .geometry-assignment-summary,
    .chat-message, .chat-create, .chat-members, .chat-invitation,
    .party-chat-header, .template-mark, .message:not(.message-error):not(.geometry-warning), .catalog-filter-tag,
    .catalog-section-count, .catalog-card-status, .party-badge) {
    background: var(--theme-panel-alt); color: var(--ink); border-color: var(--line);
}
html[data-theme="dark"] .chat-message[data-own="true"] { background: #2b443c; }
html[data-theme="dark"] :is(.catalog-card h3 a, .chat-actions a, .chat-message-text a,
    .play-link-button, .social-active, .chat-active, .connection-region-button,
    .completion-issue-location, .catalog-selection-label) { color: #a4dac1; }
html[data-theme="dark"] :is(.party-muted, .catalog-card-owner, .catalog-card-dates,
    .catalog-card-map, .catalog-card-summary, .catalog-card-statistics, .catalog-reaction-status,
    .catalog-section-heading p, .catalog-active-filters, .catalog-result-count,
    .catalog-region-range p, .catalog-preview-unavailable,
    .play-victory, .play-map-help, .play-legend, .play-order-empty,
    .chat-muted, .chat-message time, .chat-person-nation, .chat-conversation-meta,
    .chat-message-system, .chat-retention) { color: var(--muted); }
html[data-theme="dark"] .play-legend b { color: var(--ink); }
html[data-theme="dark"] :is(.selection-chosen li, .selection-list-item[aria-pressed="true"],
    .candidate-select[aria-pressed="true"], .play-order-list li.is-selected, .play-start-row.is-selected) {
    color: #ffe0ca; background: #4a3430; border-color: #efa989;
}
html[data-theme="dark"] :is(.wizard-steps button[aria-current="step"],
    .party-wizard-steps li[aria-current="step"], .party-map-option:has(input:checked),
    .setup-country-row[data-selected="true"], .setup-country-row.is-selected,
    .play-leaderboard li.is-own, .play-target-options .play-target-choice,
    .chat-conversation[aria-current="true"], .catalog-reaction-button[aria-pressed="true"],
    .completion-badge.is-complete) { background: #2c473d; color: var(--ink); border-color: #91bba4; }
html[data-theme="dark"] .wizard-steps button:hover:not(:disabled) { background: #2c473d; }
html[data-theme="dark"] :is(.wizard-step-number, .party-wizard-steps span) { background: #2b4238; color: var(--ink); }
html[data-theme="dark"] .wizard-steps button[aria-current="step"] .wizard-step-number { background: #326f58; color: #fff; }
html[data-theme="dark"] :is(.play-action-buttons button.is-active,
    .play-result-switch button[aria-pressed="true"], .play-result-switch #play-result-continue,
    .chat-compose-footer button) { background: #326f58; color: #fff; }
html[data-theme="dark"] .play-order-list .play-order-select { color: var(--ink); }
html[data-theme="dark"] .play-order-delete { color: #ffc2ab; }
html[data-theme="dark"] .role-badge { background: #3d3822; color: #f3dda0; border-color: #ab985b; }
html[data-theme="dark"] :is(.map-frame, .catalog-preview, .party-map-preview) { background: #25332f; border-color: var(--line); }

/* Map fills, nation colours, unit shapes and SCs remain data colours.
   Text painted over a light map needs dark ink even when UI text is pale. */
html[data-theme="dark"] :is(.test-map, .imported-map-svg) .region-label { fill: #203b32; }
html[data-theme="dark"] :is(.test-map, .imported-map-svg) .region-caption { fill: #354f42; }
html[data-theme="dark"] :is(.selected-region-outline, .candidate-shape[aria-pressed="true"]) { stroke: #933c28; }
html[data-theme="dark"] .map-region:focus-visible { outline: none; }
html[data-theme="dark"] .two-factor-qr { background: #fff; }
html[data-theme="dark"] :is(.completion-errors h3, .completion-issue-button, #connection-conflicts) { color: #ffbeaa; }
html[data-theme="dark"] :is(.completion-warnings h3, .completion-warnings .completion-issue-button) { color: #f0d997; }
html[data-theme="dark"] .replace-confirmation { color: #ffbeaa !important; }
html[data-theme="dark"] :is(.wizard-pending, .wizard-step-intro > .wizard-pending) {
    background: var(--theme-notice-bg); color: var(--theme-notice-text);
}
/* Images, QR codes, flags, map textures and profile photos are never filtered. */
