/* 深色主题: what Bootstrap's own dark mode and the generated copy of the site's colours (theme.js) don't cover. */
html.theme-pending body { visibility: hidden; }

.theme-btn { background: none; border: 0; color: rgba(255, 255, 255, .9); padding: .25rem .4rem; border-radius: .4rem; font-size: 1.05rem; line-height: 1; }
.theme-btn:hover { background: rgba(255, 255, 255, .15); }

html[data-theme="dark"] {
    color-scheme: dark;
    --bs-body-bg: #141619;
    --bs-body-bg-rgb: 20, 22, 25;
    --bs-body-color: #dfe3e7;
    --bs-body-color-rgb: 223, 227, 231;
    --bs-secondary-bg: #24282c;
    --bs-tertiary-bg: #1c1f22;
    --bs-tertiary-bg-rgb: 28, 31, 34;
    --bs-border-color: #383d42;
    --bs-secondary-color: rgba(223, 227, 231, .7);
    --bs-emphasis-color: #fff;
    --bs-link-color: #6ea8fe;
    --bs-link-color-rgb: 110, 168, 254;
    --bs-link-hover-color: #9ec5fe;
    --bs-link-hover-color-rgb: 158, 197, 254;
}
html[data-theme="dark"] body { background-color: var(--bs-body-bg); color: var(--bs-body-color); }
html[data-theme="dark"] .card, html[data-theme="dark"] .modal-content, html[data-theme="dark"] .offcanvas, html[data-theme="dark"] .dropdown-menu, html[data-theme="dark"] .list-group-item {
    --bs-card-bg: #1e2124; --bs-modal-bg: #1e2124; --bs-offcanvas-bg: #1e2124; --bs-dropdown-bg: #24282c; --bs-list-group-bg: #1e2124;
}
html[data-theme="dark"] .navbar.bg-success { background-color: #12603c !important; }
html[data-theme="dark"] .text-muted { color: #9aa3ad !important; }

/* Bootstrap keeps these light in its dark mode */
html[data-theme="dark"] .bg-white, html[data-theme="dark"] .bg-light { background-color: #1e2124 !important; }
html[data-theme="dark"] .text-dark { color: #dfe3e7 !important; }
html[data-theme="dark"] .text-black, html[data-theme="dark"] .link-dark { color: #dfe3e7 !important; }
html[data-theme="dark"] .text-black-50 { color: rgba(255, 255, 255, .55) !important; }
html[data-theme="dark"] .text-bg-light { background-color: #2b3035 !important; color: #dfe3e7 !important; }
html[data-theme="dark"] .btn-light { --bs-btn-bg: #2b3035; --bs-btn-border-color: #3d4349; --bs-btn-color: #dfe3e7; --bs-btn-hover-bg: #343a40; --bs-btn-hover-border-color: #495057; --bs-btn-hover-color: #fff; --bs-btn-active-bg: #3d4349; --bs-btn-active-color: #fff; }
html[data-theme="dark"] .btn-outline-dark { --bs-btn-color: #dfe3e7; --bs-btn-border-color: #868e96; --bs-btn-hover-bg: #dfe3e7; --bs-btn-hover-color: #141619; }
html[data-theme="dark"] .btn-dark { --bs-btn-bg: #3d4349; --bs-btn-border-color: #495057; }
html[data-theme="dark"] .table-light { --bs-table-bg: #2b3035; --bs-table-color: #dfe3e7; --bs-table-border-color: #3d4349; --bs-table-striped-bg: #30353a; --bs-table-hover-bg: #343a40; color: #dfe3e7; }
html[data-theme="dark"] .border-light { border-color: #3d4349 !important; }
/* dark writing on a strong yellow / light-blue / white badge stays dark */
html[data-theme="dark"] .bg-warning.text-dark, html[data-theme="dark"] .text-bg-warning, html[data-theme="dark"] .bg-info.text-dark, html[data-theme="dark"] .text-bg-info,
html[data-theme="dark"] .btn-warning, html[data-theme="dark"] .badge.bg-warning { color: #212529 !important; }

/* photos and pictures keep their own colours; a white-backed picture is dimmed a little so it doesn't glare.
   :where() keeps this rule weightless, so a page's own filter wins (a past turtle's grey photo, a loading blur) */
:where(html[data-theme="dark"]) img:where(:not([src$=".svg"]):not(.no-dim)) { filter: brightness(.94); }
/* past turtles: grey and faded as in the light theme, faded a little more so they stand back on the dark page */
html[data-theme="dark"] .tcard.inactive { opacity: .45; }
html[data-theme="dark"] .tcard.inactive .timg img, html[data-theme="dark"] .ttable tr.inactive-row img { filter: grayscale(1) brightness(.8); }
