/* Shared theme defaults yield to native page palettes, including GPTun's dark utilities.
   Pages with their own dark palette opt out via data-theme-scope="native". */
@layer site-dark-defaults {
    html.dark {
        color-scheme: dark;
        --site-dark-bg: #0f1115;
        --site-dark-surface: #171a21;
        --site-dark-surface-2: #242a35;
        --site-dark-border: #394252;
        --site-dark-text: #e6e8ec;
        --site-dark-text-muted: #aab4c4;
    }
    html.dark body { background-color: var(--site-dark-bg); color: var(--site-dark-text); }
    html.dark hr { border-color: var(--site-dark-border); }
    html.dark :is(pre, code, kbd) { background-color: #11151c; color: #d6dbe4; }
    html.dark ::-webkit-scrollbar { width: 10px; height: 10px; }
    html.dark ::-webkit-scrollbar-track { background: #12151b; }
    html.dark ::-webkit-scrollbar-thumb { background: #333a47; border-radius: 6px; }
    /* A page that paints its own surface is not overridden by the shared defaults. */
    html.dark [data-theme="own"],
    html.dark [data-theme-ignore] { color: inherit; }
}

/* Сильный слой для страниц без своей тёмной палитры. Страницы с нативной тёмной
   темой выключают его через data-theme-scope="native" на <html>. */
html.dark:not([data-theme-scope="native"]) {
    background-color: var(--site-dark-bg);
    color: var(--site-dark-text);
}
html.dark:not([data-theme-scope="native"]):is(.bg-gray-50,.bg-gray-100,.bg-white),
html.dark:not([data-theme-scope="native"]) :is(.bg-white,.bg-gray-50,.bg-gray-100,.bg-slate-50,.bg-slate-100,.bg-zinc-50,.bg-zinc-100,.bg-neutral-50,.bg-neutral-100,.card,.panel,.sidebar,.modal-content,.dropdown-menu,.list-group-item) {
    background-color: var(--site-dark-surface);
    border-color: var(--site-dark-border);
}
html.dark:not([data-theme-scope="native"]) :is(.bg-gray-200,.bg-slate-200,.hover\:bg-gray-50:hover,.hover\:bg-gray-100:hover,.hover\:bg-slate-50:hover,.hover\:bg-slate-100:hover,.hover\:bg-white:hover) {
    background-color: var(--site-dark-surface-2);
}
html.dark:not([data-theme-scope="native"]):is(.text-gray-900,.text-gray-800),
html.dark:not([data-theme-scope="native"]) :is(.text-black,.text-gray-900,.text-gray-800,.text-slate-900,.text-slate-800,.text-zinc-900,.hover\:text-gray-900:hover) {
    color: var(--site-dark-text);
}
html.dark:not([data-theme-scope="native"]) :is(.text-gray-700,.text-gray-600,.text-slate-700,.text-slate-600) { color: #c7cfdd; }
html.dark:not([data-theme-scope="native"]) :is(.text-gray-500,.text-gray-400,.text-slate-500,.text-slate-400) { color: var(--site-dark-text-muted); }
html.dark:not([data-theme-scope="native"]) :is(.border-gray-100,.border-gray-200,.border-gray-300,.border-slate-100,.border-slate-200,.border-slate-300),
html.dark:not([data-theme-scope="native"]) :is(.divide-gray-200,.divide-slate-200) > :not([hidden]) ~ :not([hidden]) { border-color: var(--site-dark-border); }
html.dark:not([data-theme-scope="native"]) :is(input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]):not([type=submit]):not([type=button]),select,textarea) {
    background-color: var(--site-dark-surface-2);
    color: var(--site-dark-text);
    border-color: var(--site-dark-border);
}
html.dark:not([data-theme-scope="native"]) :is(input,textarea)::placeholder { color: var(--site-dark-text-muted); }
html.dark:not([data-theme-scope="native"]) :is([class^="bg-white/"],[class*=" bg-white/"],[class^="bg-gray-50/"],[class*=" bg-gray-50/"],[class^="bg-gray-100/"],[class*=" bg-gray-100/"]) {
    background-color: rgba(23, 26, 33, 0.94);
}
html.dark:not([data-theme-scope="native"]) :is(.bg-blue-50,.bg-red-50,.bg-green-50,.bg-amber-50,.bg-emerald-50,.bg-indigo-50,.bg-purple-50,.bg-yellow-50,.bg-orange-50,.bg-rose-50,.bg-sky-50,.bg-teal-50,.bg-violet-50,.bg-pink-50,.bg-cyan-50,.bg-lime-50,.bg-fuchsia-50,.bg-blue-100,.bg-red-100,.bg-green-100,.bg-amber-100,.bg-emerald-100,.bg-indigo-100,.bg-purple-100) {
    background-color: rgba(118, 140, 190, 0.14);
    border-color: var(--site-dark-border);
}
html.dark:not([data-theme-scope="native"]) :is(.text-blue-900,.text-blue-800,.text-blue-700,.text-red-900,.text-red-800,.text-red-700,.text-green-900,.text-green-800,.text-green-700,.text-amber-900,.text-amber-800,.text-emerald-900,.text-emerald-800,.text-indigo-900,.text-indigo-800,.text-purple-900,.text-purple-800,.text-slate-900,.text-gray-900) {
    color: #dbe3f0;
}
html.dark:not([data-theme-scope="native"]) :is(.text-indigo-600,.text-indigo-700,.text-purple-600,.text-purple-700,.text-violet-600,.text-violet-700,.text-blue-600) { color: #a5b4fc; }
html.dark:not([data-theme-scope="native"]) :is(pre,code,kbd) { background-color: #11151c; color: #d6dbe4; }
