/* Shared UI palette. Screen-only variables leave printed documents at their original colours.
   Existing declarations retain their original fallback for standalone/exported content. */
@media screen {
    html[data-ui-theme="light"] {
        color-scheme: light;
        --ui-bg: #f3f6fa;
        --ui-panel: #ffffff;
        --ui-raised: #e8eef5;
        --ui-text: #192b3a;
        --ui-muted: #4b6073;
        --ui-border: #a9b8c7;
        --ui-wash: rgba(31, 55, 77, .07);
        --ui-info: #1d4ed8;
        --ui-teal: #0f6b67;
        --ui-purple: #6b21a8;
        --ui-success: #166534;
        --ui-warning: #854d0e;
        --ui-danger: #b91c1c;
        --ui-soft-info: #e8efff;
        --ui-soft-teal: #dff5f1;
        --ui-soft-purple: #f3e8ff;
        --ui-soft-success: #e4f4e8;
        --ui-soft-warning: #fff3d5;
        --ui-soft-danger: #fde8e8;
    }
    html[data-ui-theme="dark"] {
        color-scheme: dark;
        --ui-bg: #101923;
        --ui-panel: #182532;
        --ui-raised: #243647;
        --ui-text: #edf3f8;
        --ui-muted: #b4c4d3;
        --ui-border: #60758a;
        --ui-wash: rgba(215, 231, 246, .07);
        --ui-info: #9fc5ff;
        --ui-teal: #7ee5d5;
        --ui-purple: #d8b4fe;
        --ui-success: #9ae6ae;
        --ui-warning: #f4d48a;
        --ui-danger: #fca5a5;
        --ui-soft-info: #1c3150;
        --ui-soft-teal: #173b39;
        --ui-soft-purple: #362445;
        --ui-soft-success: #1b382b;
        --ui-soft-warning: #3f321b;
        --ui-soft-danger: #44272d;
    }
    html[data-ui-theme] { background-color: var(--ui-bg); }
    html[data-ui-theme] body { color: var(--ui-text); }
    html[data-ui-theme] :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="submit"]):not([type="button"]), textarea, select):not(:where(.css-demo *, .html-demo *, .bootstrap-demo *, .reference-preview *, [data-lesson-preview] *)) {
        background-color: var(--ui-panel);
        color: var(--ui-text);
        border-color: var(--ui-border);
    }
    html[data-ui-theme] :is(input, textarea)::placeholder { color: var(--ui-muted); opacity: 1; }
    html[data-ui-theme] :is(input[type="checkbox"], input[type="radio"]) { accent-color: #287caf; }
    html[data-ui-theme] select option { background-color: var(--ui-panel); color: var(--ui-text); }
    html[data-ui-theme] :focus-visible { outline-color: var(--ui-info); }

    html[data-ui-theme][data-ui-site="web"] .slider--btn svg { stroke: var(--ui-text); }
    html[data-ui-theme="light"][data-ui-site="web"] .slide__bg::before { background: rgba(245, 248, 252, .58); }
    html[data-ui-theme="light"][data-ui-site="web"] body > :is(h1, h4) { text-shadow: none; }
    html[data-ui-theme="light"][data-ui-site="web"] .top-bar {
        background-color: #dce6f0;
        box-shadow: 0 1px 0 #a9b8c7, 0 4px 18px #192b3a12;
    }
    html[data-ui-theme="light"][data-ui-site="web"] .nav-dropdown-menu { background: #e8eef5; }

    html[data-ui-theme][data-ui-site="eltventure"] .navbar { background: var(--ui-panel); color: var(--ui-text); }
    html[data-ui-theme][data-ui-site="eltventure"] .nav-links :is(a, button) { color: var(--ui-text); }
    html[data-ui-theme][data-ui-site="eltventure"] .menu-toggle span { background-color: var(--ui-text); }
    html[data-ui-theme][data-ui-site="tananyag"] .reference-box { background: var(--ui-soft-info); border-color: var(--ui-border); }
    html[data-ui-theme][data-ui-site="tananyag"] .reference-links a { color: var(--ui-info); }
    html[data-ui-theme][data-ui-site="tananyag"] :is(.css-demo, .html-demo, .bootstrap-demo, .reference-preview) { color: #1e293b; color-scheme: light; }
    html[data-ui-theme="light"][data-ui-site="mese"] .night-sky { background: radial-gradient(ellipse at 72% 18%, #e0eadc, transparent 48%), linear-gradient(135deg, #f5f4ec, #edf4f1); }
    html[data-ui-theme="light"][data-ui-site="mese"] :is(.stars, .shooting-star) { opacity: .15; }
    html[data-ui-theme][data-ui-site="nyiltnap"] :is(.sidebar, .mobile-menu) { background: var(--ui-panel); color: var(--ui-text); }
    html[data-ui-theme][data-ui-site="nyiltnap"] .sidebar :is(a, strong, small, .nav-label, .progress-copy) { color: var(--ui-text); }
    html[data-ui-theme][data-ui-site="nyiltnap"] .question-nav a:hover { background: var(--ui-raised); }
    html[data-ui-theme][data-ui-site="nyiltnap"] .mobile-menu span { background: var(--ui-text); }
    html[data-ui-theme][data-ui-site="nyiltnap"] .story { color: #102231; }
    html[data-ui-theme][data-ui-site="szalagavato"] .preview-meta { color: var(--ui-muted); }
    html[data-ui-theme][data-ui-site="szalagavato"] .preview-monitor { color: #fff; color-scheme: dark; }
    html[data-ui-theme][data-ui-site="tananyag"] :is(.css-demo, .html-demo, .bootstrap-demo, .reference-preview) {
        --bs-body-color: #212529;
        --bs-body-bg: #fff;
        --bs-secondary-color: #6c757d;
        --bs-border-color: #dee2e6;
        --bs-tertiary-bg: #f8f9fa;
    }

    /* Keep image-backed landing pages readable, while their controls follow the chosen mode. */
    html[data-ui-theme="light"] body[data-season="autumn"] { --season-dark: #fff1dd; --season-accent: #854511; }
    html[data-ui-theme="light"] body[data-season="winter"] { --season-dark: #e9f4f8; --season-accent: #64501a; }
    html[data-ui-theme="light"] body[data-season="newyear"] { --season-dark: #f4edff; --season-accent: #6b4b10; }
    html[data-ui-theme="light"] body[data-season="spring"] { --season-dark: #eaf5e9; --season-accent: #286438; }
    html[data-ui-theme="light"] body[data-season]:not([data-season=""]) :is(.top-bar, .header, .guide-header, .navbar, .footer, .guide-footer) {
        background: linear-gradient(110deg, var(--season-dark), var(--ui-panel));
        color: var(--ui-text);
    }
    html[data-ui-theme="light"] body[data-season]:not([data-season=""]) .navbar :is(a, button) { color: var(--ui-text); }

    /* The legacy Tailwind shell still contains explicit colour utility classes. */
    html[data-ui-theme] :is(.bg-white, .bg-gray-100, .dark\:bg-gray-800, .dark\:bg-gray-900) { background-color: var(--ui-panel); }
    html[data-ui-theme] :is(.text-gray-900, .text-gray-800, .text-gray-700, .dark\:text-gray-100) { color: var(--ui-text); }
    html[data-ui-theme] :is(.text-gray-600, .text-gray-500, .dark\:text-gray-400) { color: var(--ui-muted); }

    /* Bootstrap's page palette; teaching demos retain their explicit demonstration colours. */
    html[data-ui-theme] {
        --bs-body-color: var(--ui-text);
        --bs-body-bg: var(--ui-bg);
        --bs-secondary-color: var(--ui-muted);
        --bs-border-color: var(--ui-border);
        --bs-tertiary-bg: var(--ui-raised);
    }
}

.appearance-options { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .8rem; }
.appearance-options legend { margin-bottom: .75rem; font-weight: 600; }
.appearance-option { display: flex; align-items: center; gap: .65rem; padding: 1rem 1.25rem; border: 2px solid var(--ui-border, #94a3b8); border-radius: 12px; cursor: pointer; flex: 1 1 180px; }
.appearance-option:has(input:checked) { border-color: var(--ui-info, #93c5fd); background: var(--ui-soft-info, #1c3150); }
.appearance-option:focus-within { outline: 2px solid var(--ui-info, #93c5fd); outline-offset: 3px; }
.appearance-option input { width: 1.15rem; height: 1.15rem; flex-shrink: 0; }
.appearance-option span { font-size: 1.5rem; }
.appearance-description { color: var(--ui-muted, #b4c4d3); line-height: 1.6; margin-top: 1rem; }
