html[data-smurdy-theme="dark"] {
    color-scheme: dark;
    --smurdy-blue: #4aa8e8;
    --smurdy-blue-dark: #78bdf0;
    --smurdy-action-blue: #2489c9;
    --smurdy-action-blue-hover: #3298d8;
    --smurdy-text: #dfe4e7;
    --smurdy-muted: #aab3b9;
    --smurdy-line: rgba(255, 255, 255, 0.15);
    --smurdy-surface: rgba(32, 38, 43, 0.97);
    --smurdy-surface-soft: #293137;
    --directory-blue: #4aa8e8;
    --directory-blue-dark: #78bdf0;
    --directory-text: #dfe4e7;
    --directory-muted: #aab3b9;
    --directory-line: #465159;
    --brand: #4aa8e8;
    --brand-dark: #78bdf0;
    --text: #dfe4e7;
    --muted: #aab3b9;
    --line: #465159;
    --soft: #293137;
    --correct: #65c982;
    --wrong: #ff8b82;
}

html[data-smurdy-theme="dark"] body,
html[data-smurdy-theme="dark"] body[data-smurdy-quiz-page] {
    background: #171c20;
    color: #dfe4e7;
}

html[data-smurdy-theme="dark"] a,
html[data-smurdy-theme="dark"] #quiz-desc a,
html[data-smurdy-theme="dark"] #qb-directory-fallback > div a {
    color: #78bdf0;
}

html[data-smurdy-theme="dark"] .panel-brand-name,
html[data-smurdy-theme="dark"] .directory-brand,
html[data-smurdy-theme="dark"] .brand,
html[data-smurdy-theme="dark"] .quiz-brand,
html[data-smurdy-theme="dark"] .flag-brand,
html[data-smurdy-theme="dark"] .panel-brand {
    color: #dfe4e7;
}

html[data-smurdy-theme="dark"] :is(.panel-brand, .directory-brand, .brand, .quiz-brand, .flag-brand) img {
    filter: invert(1);
}

html[data-smurdy-theme="dark"] #quiz-panel,
html[data-smurdy-theme="dark"] #quiz-browser,
html[data-smurdy-theme="dark"] #qb-directory-fallback,
html[data-smurdy-theme="dark"] .site-header,
html[data-smurdy-theme="dark"] .directory-header,
html[data-smurdy-theme="dark"] body[data-smurdy-quiz-page] main,
html[data-smurdy-theme="dark"] body[data-smurdy-quiz-page] .quiz-page,
html[data-smurdy-theme="dark"] .quiz-brand,
html[data-smurdy-theme="dark"] .flag-brand,
html[data-smurdy-theme="dark"] .directory-card,
html[data-smurdy-theme="dark"] .info-card {
    background: #181e23 !important;
    color: #dfe4e7;
}

html[data-smurdy-theme="dark"] #quiz-desc,
html[data-smurdy-theme="dark"] .directory-lead,
html[data-smurdy-theme="dark"] .directory-card-description,
html[data-smurdy-theme="dark"] .lead,
html[data-smurdy-theme="dark"] .quiz-lead,
html[data-smurdy-theme="dark"] .flag-lead,
html[data-smurdy-theme="dark"] .info-card p,
html[data-smurdy-theme="dark"] .maker-note,
html[data-smurdy-theme="dark"] body.smurdy-quiz-landing .casual-example,
html[data-smurdy-theme="dark"] body.smurdy-quiz-landing .mode-note {
    color: #bbc3c8 !important;
}

html[data-smurdy-theme="dark"] .site-header,
html[data-smurdy-theme="dark"] .directory-header,
html[data-smurdy-theme="dark"] .site-footer,
html[data-smurdy-theme="dark"] .directory-footer,
html[data-smurdy-theme="dark"] .directory-section + .directory-section,
html[data-smurdy-theme="dark"] .directory-card,
html[data-smurdy-theme="dark"] .info-card,
html[data-smurdy-theme="dark"] .quiz-brand,
html[data-smurdy-theme="dark"] .flag-brand,
html[data-smurdy-theme="dark"] .flag-links,
html[data-smurdy-theme="dark"] .quiz-links,
html[data-smurdy-theme="dark"] .link-section,
html[data-smurdy-theme="dark"] .page-specific {
    border-color: #465159 !important;
}

html[data-smurdy-theme="dark"] :is(button, input, select, textarea) {
    border-color: #4a545c;
}

html[data-smurdy-theme="dark"] :is(input, select, textarea),
html[data-smurdy-theme="dark"] #quiz-buttons .qb-btn,
html[data-smurdy-theme="dark"] #quiz-buttons button,
html[data-smurdy-theme="dark"] .weak-spots-menu-button,
html[data-smurdy-theme="dark"] .quiz-button,
html[data-smurdy-theme="dark"] .qb-btn,
html[data-smurdy-theme="dark"] .flag-button {
    background: #30383e;
    color: #dfe4e7;
}

html[data-smurdy-theme="dark"] :is(#quiz-buttons .qb-btn, #quiz-buttons button, .weak-spots-menu-button, .quiz-button, .qb-btn, .flag-button):hover {
    background: #343e45;
}

html[data-smurdy-theme="dark"] :is(.quiz-button, .qb-btn, .flag-button).primary,
html[data-smurdy-theme="dark"] #quiz-buttons .qb-btn.primary {
    border-color: #2489c9;
    background: #2489c9;
    color: #fff;
}

html[data-smurdy-theme="dark"] .included-list,
html[data-smurdy-theme="dark"] .flag-stage {
    border-color: #465159;
    background: #242b30;
}

html[data-smurdy-theme="dark"] .flag-progress-track {
    background: #39434b;
}

html[data-smurdy-theme="dark"] [data-smurdy-quiz-favorite][aria-pressed="true"],
html[data-smurdy-theme="dark"] :is(.quiz-button, .qb-btn, .flag-button).favorite[aria-pressed="true"] {
    border-color: #b99222 !important;
    background: #4a3c13 !important;
    color: #ffd54f !important;
}

html[data-smurdy-theme="dark"] .button-link {
    border-color: #2489c9 !important;
    background: #2489c9 !important;
    color: #fff !important;
}
html[data-smurdy-theme="dark"] .button-link:hover,
html[data-smurdy-theme="dark"] .button-link:focus-visible {
    border-color: #3298d8 !important;
    background: #3298d8 !important;
    color: #fff !important;
}

html[data-smurdy-theme="dark"] #weak-spots-dialog,
html[data-smurdy-theme="dark"] .smurdy-page-share-dialog,
html[data-smurdy-theme="dark"] .smurdy-quiz-suggestion-dialog {
    border-color: #4a555d !important;
    background: #181e23 !important;
    color: #dfe4e7 !important;
}

html[data-smurdy-theme="dark"] #weak-spots-close {
    background: #30383e;
    color: #dfe4e7;
}

html[data-smurdy-theme="dark"] .weak-spot-group {
    background: #30383e;
    color: #bbc3c8;
}

html[data-smurdy-theme="dark"] .weak-spot-mode {
    border-color: rgba(74, 168, 232, .35);
    background: rgba(74, 168, 232, .12);
    color: #8fc9f2;
}

html[data-smurdy-theme="dark"] body #quiz-browser #qb-category-tabs::before,
html[data-smurdy-theme="dark"] body #quiz-browser #qb-mode-tabs::before,
html[data-smurdy-theme="dark"] body #quiz-browser #qb-family-tabs::before {
    background: #181e23;
    color: #aab3b9;
}

html[data-smurdy-theme="dark"] body #quiz-browser :is(.qb-library-tab, .qb-category-tab, .qb-mode-tab, .qb-family-tab) {
    color: #b2bbc1;
}

html[data-smurdy-theme="dark"] body #quiz-browser :is(.qb-library-tab, .qb-category-tab, .qb-mode-tab, .qb-family-tab)[aria-selected="true"] {
    color: #78bdf0;
}

html[data-smurdy-theme="dark"] body #quiz-browser .qb-library-count {
    color: #919ba1 !important;
}

html[data-smurdy-theme="dark"] body #quiz-browser #qb-search {
    border-color: #465159;
}

html[data-smurdy-theme="dark"] .smurdy-page-share-panel,
html[data-smurdy-theme="dark"] .smurdy-page-share-preview {
    background: #181e23 !important;
    color: #dfe4e7 !important;
    border-color: #465159 !important;
}

html[data-smurdy-theme="dark"] .smurdy-page-share-preview p,
html[data-smurdy-theme="dark"] .smurdy-quiz-suggestion-card p {
    color: #bbc3c8 !important;
}

html[data-smurdy-theme="dark"] .smurdy-page-share-actions button {
    border-color: #4a555d;
    background: #30383e;
    color: #dfe4e7;
}

html[data-smurdy-theme="dark"] .smurdy-page-share-actions button:hover {
    border-color: #58656f;
    background: #343e45;
}

html[data-smurdy-theme="dark"] .smurdy-page-share-actions button[data-share-action="native"] {
    border-color: #2489c9;
    background: #2489c9;
    color: #fff;
}

html[data-smurdy-theme="dark"] .smurdy-page-share-actions button[data-share-action="native"]:hover {
    background: #3298d8;
}

html[data-smurdy-theme="dark"] .smurdy-page-share-close,
html[data-smurdy-theme="dark"] .smurdy-quiz-suggestion-close {
    color: #dfe4e7;
}

html[data-smurdy-theme="dark"] .smurdy-page-share-status {
    color: #aab3b9;
}

.home-quick-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
}

.home-quick-actions .weak-spots-menu-button {
    margin-top: 0;
}

.smurdy-theme-toggle {
    width: 42px;
    height: 42px;
    min-width: 42px;
    min-height: 42px;
    padding: 0;
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    border: 1px solid rgba(0, 0, 0, .18);
    border-radius: 6px;
    background: #f3f3f3;
    color: #30363a;
    cursor: pointer;
    line-height: 1;
}

.smurdy-theme-toggle:hover {
    border-color: rgba(0, 0, 0, .28);
    background: #e9e9e9;
    color: #111;
}

.smurdy-theme-toggle:focus-visible {
    outline: 3px solid rgba(0, 119, 204, .28);
    outline-offset: 2px;
}

.smurdy-theme-icon {
    width: 20px;
    height: 20px;
    display: block;
    background: currentColor;
    -webkit-mask-position: center;
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-size: contain;
    mask-position: center;
    mask-repeat: no-repeat;
    mask-size: contain;
}

.smurdy-theme-icon--moon {
    -webkit-mask-image: url('/assets/icons/moon.png');
    mask-image: url('/assets/icons/moon.png');
}

.smurdy-theme-icon--sun {
    display: none;
    -webkit-mask-image: url('/assets/icons/sun.png');
    mask-image: url('/assets/icons/sun.png');
}

html[data-smurdy-theme="dark"] .smurdy-theme-icon--moon {
    display: none;
}

html[data-smurdy-theme="dark"] .smurdy-theme-icon--sun {
    display: block;
}

html[data-smurdy-theme="dark"] .smurdy-theme-toggle {
    border-color: #46515a;
    background: #2a3238;
    color: #cdd3d7;
}

html[data-smurdy-theme="dark"] .smurdy-theme-toggle:hover {
    border-color: #58656f;
    background: #343e45;
    color: #e0e4e7;
}

html.smurdy-quiz-active .home-quick-actions {
    display: none !important;
}

/* dark-theme-polish-v3 */
html[data-smurdy-theme="dark"] body,
html[data-smurdy-theme="dark"] body[data-smurdy-quiz-page] {
    background: #171c20;
}

html[data-smurdy-theme="dark"] body[data-smurdy-quiz-page] main,
html[data-smurdy-theme="dark"] body[data-smurdy-quiz-page] .quiz-page {
    background: #22282d !important;
}

html[data-smurdy-theme="dark"] body[data-smurdy-quiz-page] :is(hr, .page-specific, .link-section, .quiz-links, .flag-links) {
    border-color: #4a555d !important;
}

html[data-smurdy-theme="dark"] body[data-smurdy-quiz-page] :is(.quiz-lead, .flag-lead, .lead, .maker-note, .mode-note, .casual-example) {
    color: #bbc3c8 !important;
}

html[data-smurdy-theme="dark"] .site-header,
html[data-smurdy-theme="dark"] .directory-header {
    background: #20262b !important;
}

html[data-smurdy-theme="dark"] .site-footer,
html[data-smurdy-theme="dark"] .directory-footer {
    color: #aab3b9;
}


/* 404 dark-mode readability */
html[data-smurdy-theme="dark"] body[data-smurdy-404] {
    background: #171c20 !important;
    color: #dfe4e7 !important;
}

html[data-smurdy-theme="dark"] body[data-smurdy-404] p {
    color: #bbc3c8 !important;
}

html[data-smurdy-theme="dark"] body[data-smurdy-404] .uncharted {
    color: #aab3b9 !important;
}

html[data-smurdy-theme="dark"] body[data-smurdy-404] nav {
    border-color: #465159 !important;
}

html[data-smurdy-theme="dark"] body[data-smurdy-404] img {
    filter: invert(1);
}

/* 1.16.3 dark-mode fixes for saved quizzes, Weak Spots, and suggestions */
html[data-smurdy-theme="dark"] #quiz-browser .qb-favorite[aria-pressed="true"] {
    border-color: #b99222 !important;
    background: #4a3c13 !important;
    color: #ffd54f !important;
}

html[data-smurdy-theme="dark"] .weak-spots-dialog-header,
html[data-smurdy-theme="dark"] .weak-spots-dialog-footer,
html[data-smurdy-theme="dark"] .weak-spot-item,
html[data-smurdy-theme="dark"] #quiz-review {
    border-color: #465159;
}

html[data-smurdy-theme="dark"] .weak-spot-item,
html[data-smurdy-theme="dark"] .quiz-review-country,
html[data-smurdy-theme="dark"] #weak-spots-practice-next {
    background: #242b30;
    color: #dfe4e7;
}

html[data-smurdy-theme="dark"] .weak-spot-name,
html[data-smurdy-theme="dark"] .quiz-review-country,
html[data-smurdy-theme="dark"] #weak-spots-practice-next strong {
    color: #dfe4e7;
}

html[data-smurdy-theme="dark"] .weak-spot-meta,
html[data-smurdy-theme="dark"] .quiz-review-country-detail,
html[data-smurdy-theme="dark"] .quiz-review-summary,
html[data-smurdy-theme="dark"] #weak-spots-practice-next span {
    color: #aab3b9;
}

html[data-smurdy-theme="dark"] .quiz-review-country {
    border-color: #465159;
}

html[data-smurdy-theme="dark"] .quiz-review-country:hover {
    background: #30383e;
}

html[data-smurdy-theme="dark"] #weak-spots-clear {
    border-color: #4a555d;
    background: #30383e;
    color: #ffaaa3;
}

html[data-smurdy-theme="dark"] #weak-spots-practice-next {
    border-color: #465159;
}

html[data-smurdy-theme="dark"] .smurdy-quiz-suggestion-play {
    border-color: #2489c9 !important;
    background: #2489c9 !important;
    color: #ffffff !important;
}

html[data-smurdy-theme="dark"] .smurdy-quiz-suggestion-play:hover,
html[data-smurdy-theme="dark"] .smurdy-quiz-suggestion-play:focus-visible {
    border-color: #3298d8 !important;
    background: #3298d8 !important;
    color: #ffffff !important;
}

html[data-smurdy-theme="dark"] .smurdy-quiz-suggestion-close {
    color: #cdd3d7 !important;
}
