
button.theme-switch[data-theme-switch],
div.lang-switch[data-lang-switch] > button[data-lang-toggle] {
    all: unset;
    box-sizing: border-box;
    position: relative;
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    margin: 0;
    padding: 0;
    border: 1px solid rgba(116, 231, 255, 0.34);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
    cursor: pointer;
    line-height: 1;
    transition: background-color 200ms ease, border-color 200ms ease, color 200ms ease, transform 160ms ease;
    -webkit-tap-highlight-color: transparent;
}

button.theme-switch[data-theme-switch]:hover,
div.lang-switch[data-lang-switch] > button[data-lang-toggle]:hover {
    border-color: rgba(116, 231, 255, 0.7);
    background: rgba(255, 255, 255, 0.14);
}

button.theme-switch[data-theme-switch]:active,
div.lang-switch[data-lang-switch] > button[data-lang-toggle]:active {
    transform: scale(0.92);
}

button.theme-switch[data-theme-switch]:focus-visible,
div.lang-switch[data-lang-switch] > button[data-lang-toggle]:focus-visible {
    outline: 3px solid rgba(56, 189, 248, 0.72);
    outline-offset: 2px;
}

button.theme-switch[data-theme-switch] svg {
    grid-area: 1 / 1;
    width: 17px;
    height: 17px;
}

button.theme-switch[data-theme-switch] .is-sun { color: #fbbf24; }
button.theme-switch[data-theme-switch] .is-moon { color: #c7d2fe; display: none; }
html[data-theme="dark"] button.theme-switch[data-theme-switch] .is-sun { display: none; }
html[data-theme="dark"] button.theme-switch[data-theme-switch] .is-moon { display: block; }

button.theme-switch[data-theme-switch].is-flipping svg {
    animation: theme-toggle-flip 380ms cubic-bezier(0.34, 1.4, 0.64, 1);
}

@keyframes theme-toggle-flip {
    from { transform: rotate(-120deg) scale(0.4); opacity: 0; }
    to { transform: none; opacity: 1; }
}

div.lang-switch[data-lang-switch] {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
}

div.lang-switch[data-lang-switch] > button[data-lang-toggle] {
    font: 800 11.5px/1 "Be Vietnam Pro", "Segoe UI", Arial, sans-serif;
    letter-spacing: 0.05em;
}

button.theme-switch[data-theme-switch].is-floating,
div.lang-switch[data-lang-switch].is-floating {
    position: fixed;
    bottom: 16px;
    z-index: 2147483000;
}

button.theme-switch[data-theme-switch].is-floating {
    left: 16px;
}

div.lang-switch[data-lang-switch].is-floating {
    left: 58px;
}

button.theme-switch[data-theme-switch].is-floating,
div.lang-switch[data-lang-switch].is-floating > button[data-lang-toggle] {
    border-color: rgba(116, 231, 255, 0.45);
    background: rgba(6, 20, 39, 0.86);
    box-shadow: 0 8px 24px rgba(2, 12, 27, 0.3);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

@media (max-width: 430px) {
    button.theme-switch[data-theme-switch],
    div.lang-switch[data-lang-switch] > button[data-lang-toggle] {
        width: 30px;
        height: 30px;
    }

    button.theme-switch[data-theme-switch] svg {
        width: 15px;
        height: 15px;
    }

    div.lang-switch[data-lang-switch] > button[data-lang-toggle] {
        font-size: 10.5px;
    }

    div.lang-switch[data-lang-switch].is-floating {
        left: 54px;
    }
}

@media (prefers-reduced-motion: reduce) {
    button.theme-switch[data-theme-switch].is-flipping svg {
        animation: none;
    }
}

@media print {
    button.theme-switch[data-theme-switch],
    div.lang-switch[data-lang-switch] {
        display: none !important;
    }
}

html[data-lang="en"]:not(.i18n-ready) body {
    visibility: hidden;
}

html.theme-switching,
html.theme-switching *,
html.theme-switching *::before,
html.theme-switching *::after {
    transition: background-color 260ms ease, border-color 260ms ease, color 260ms ease, fill 260ms ease, box-shadow 260ms ease !important;
}

@media (prefers-reduced-motion: reduce) {
    html.theme-switching,
    html.theme-switching *,
    html.theme-switching *::before,
    html.theme-switching *::after {
        transition: none !important;
    }
}

html[data-theme="dark"] {
    color-scheme: dark;
}

html[data-theme="dark"] body.site-standard-background {
    --site-background:
        radial-gradient(circle at 18% 24%, rgba(36, 144, 255, 0.26), transparent 28%),
        radial-gradient(circle at 82% 18%, rgba(42, 214, 255, 0.12), transparent 24%),
        linear-gradient(180deg, #030c19 0%, #08234a 52%, #0a3d80 100%);
}

html[data-theme="dark"] :is([style*="background:#fff"], [style*="background: #fff"], [style*="background-color:#fff"], [style*="background-color: #fff"], [style*="background:white"], [style*="background: white"], [style*="background-color: white"]):not(img, canvas, [class*="qr"], [id*="qr"]) {
    background-color: #17212f !important;
}

html[data-theme="dark"] :is([style*="background:#f8fafc"], [style*="background: #f8fafc"], [style*="background:#f9fafb"], [style*="background: #f9fafb"]) {
    background-color: #1b2533 !important;
}

html[data-theme="dark"] :is([style*="background:#f1f5f9"], [style*="background: #f1f5f9"], [style*="background:#f3f4f6"], [style*="background: #f3f4f6"]) {
    background-color: #1f2938 !important;
}

html[data-theme="dark"] :is([style*="color:#0f172a"], [style*="color: #0f172a"], [style*="color:#111827"], [style*="color: #111827"], [style*="color:#334155"], [style*="color: #334155"], [style*="color:#000"], [style*="color: #000"]) {
    color: #dbe4f2 !important;
}

html[data-theme="dark"] :is(.problem-rich-text, .exam-description, .problem-text, .question-content) img {
    background: #fff;
    border-radius: 6px;
}

html[data-theme="dark"] ::selection {
    background: rgba(56, 189, 248, 0.35);
    color: #f8fafc;
}

html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder {
    color: #7c8aa0;
}

html[data-theme="dark"] select option {
    background-color: #17212f;
    color: #e2e8f0;
}

:is(.home-site-header, .ui-global-header) button.theme-switch[data-theme-switch],
:is(.home-site-header, .ui-global-header) div.lang-switch[data-lang-switch] > button[data-lang-toggle] {
    width: 32px;
    height: 32px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: none;
}

:is(.home-site-header, .ui-global-header) div.lang-switch[data-lang-switch] > button[data-lang-toggle] {
    color: #fff;
    background: #ea580c;
    border-color: #ea580c;
}

:is(.home-site-header, .ui-global-header) div.lang-switch[data-lang-switch] > button[data-lang-toggle]:hover {
    background: #f97316;
    border-color: #f97316;
}

:is(.home-site-header, .ui-global-header) button.theme-switch[data-theme-switch]:hover {
    border-color: rgba(255, 255, 255, 0.45);
    background: rgba(255, 255, 255, 0.12);
}

@media (min-width: 781px) and (max-width: 1180px) {
    :is(.home-site-header, .ui-global-header) .header-actions {
        gap: 8px;
    }

    :is(.home-site-header, .ui-global-header) .nav {
        flex-wrap: nowrap;
        gap: 2px;
    }

    :is(.home-site-header, .ui-global-header) .nav > a,
    :is(.home-site-header, .ui-global-header) .nav .nav-drop-trigger {
        padding: 8px 9px;
        font-size: 13.5px;
        white-space: nowrap;
    }
}

@media (min-width: 781px) and (max-width: 900px) {
    :is(.home-site-header, .ui-global-header) {
        padding-left: 14px;
        padding-right: 14px;
    }

    :is(.home-site-header, .ui-global-header) .brand {
        padding: 8px 4px;
        font-size: 16px;
    }

    :is(.home-site-header, .ui-global-header) .brand code {
        display: none;
    }

    :is(.home-site-header, .ui-global-header) .nav > a,
    :is(.home-site-header, .ui-global-header) .nav .nav-drop-trigger {
        padding: 7px 6px;
        font-size: 13px;
    }

    :is(.home-site-header, .ui-global-header) .nav-drop-trigger::after {
        margin-left: 3px;
    }
}

@media (min-width: 431px) and (max-width: 1080px) {
    .ui-global-header .header-actions { flex: 0 0 auto; min-width: auto; justify-content: flex-end; gap: 8px; margin-left: auto; }
    .ui-global-header .brand { font-size: 14px; }
    .ui-global-header .menu-toggle { display: inline-flex; }
    .ui-global-header .nav { position: absolute; top: calc(100% + 8px); left: 12px; right: 12px; z-index: 60; display: none; grid-template-columns: 1fr; gap: 4px; padding: 8px; border: 1px solid rgba(116, 231, 255, 0.28); border-radius: 12px; background: linear-gradient(180deg, #0a2344 0%, #061427 100%); box-shadow: 0 18px 45px rgba(6, 20, 39, 0.36); }
    .ui-global-header .nav.open { display: grid; }
    .ui-global-header .nav a, .ui-global-header .nav button { width: 100%; min-height: 42px; padding: 10px 12px; text-align: left; color: #dbeafe; }
    .ui-global-header .nav a:hover, .ui-global-header .nav a:focus-visible, .ui-global-header .nav a.active, .ui-global-header .nav button:hover, .ui-global-header .nav button:focus-visible { color: #fff; background: rgba(116, 231, 255, 0.1); text-shadow: 0 0 18px rgba(99, 230, 255, 0.28); transform: none; }
    .ui-global-header .nav-dropdown { width: 100%; }
    .ui-global-header .nav-drop-menu { position: static; min-width: 0; margin-top: 4px; border-color: rgba(116, 231, 255, 0.18); background: rgba(2, 12, 26, 0.72); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04); }
    .home-site-header { position: sticky; }
    .home-site-header .header-actions { flex: 0 0 auto; min-width: auto; justify-content: flex-end; gap: 8px; margin-left: auto; }
    .home-site-header .brand { font-size: 14px; }
    .home-site-header .menu-toggle { display: inline-flex; }
    .home-site-header .nav { position: absolute; top: calc(100% + 8px); left: 12px; right: 12px; z-index: 40; display: none; grid-template-columns: 1fr; gap: 4px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: var(--shadow); }
    .home-site-header .nav.open { display: grid; }
    .home-site-header .nav a, .home-site-header .nav button { width: 100%; min-height: 42px; padding: 10px 12px; text-align: left; }
    .home-site-header .nav > a, .home-site-header .nav-dropdown > button { color: var(--blue); text-shadow: none; }
    .home-site-header .nav > a:hover, .home-site-header .nav > a:focus-visible, .home-site-header .nav-dropdown > button:hover, .home-site-header .nav-dropdown > button:focus-visible { color: #082f69; background: #eef6ff; }
    .home-site-header .nav-dropdown { width: 100%; }
    .home-site-header .nav-drop-menu { position: static; min-width: 0; margin-top: 4px; box-shadow: none; }
}

@media (min-width: 431px) and (max-width: 1080px) {
    html[data-theme="dark"] .ui-global-header .nav { border: 1px solid rgba(116, 231, 255, 0.28); background: linear-gradient(180deg, #0a2344 0%, #061427 100%); box-shadow: 0 18px 45px rgba(6, 20, 39, 0.36); }
    html[data-theme="dark"] .ui-global-header .nav a, html[data-theme="dark"] .ui-global-header .nav button { color: #dbeafe; }
    html[data-theme="dark"] .ui-global-header .nav a:hover, html[data-theme="dark"] .ui-global-header .nav a:focus-visible, html[data-theme="dark"] .ui-global-header .nav a.active, html[data-theme="dark"] .ui-global-header .nav button:hover, html[data-theme="dark"] .ui-global-header .nav button:focus-visible { color: #fff; background: rgba(116, 231, 255, 0.1); }
    html[data-theme="dark"] .ui-global-header .nav-drop-menu { border-color: rgba(116, 231, 255, 0.18); background: rgba(2, 12, 26, 0.72); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04); }
    html[data-theme="dark"] .home-site-header .nav { background: #17212f; }
    html[data-theme="dark"] .home-site-header .nav > a, html[data-theme="dark"] .home-site-header .nav-dropdown > button { color: #9dc1f9; }
    html[data-theme="dark"] .home-site-header .nav > a:hover, html[data-theme="dark"] .home-site-header .nav > a:focus-visible, html[data-theme="dark"] .home-site-header .nav-dropdown > button:hover, html[data-theme="dark"] .home-site-header .nav-dropdown > button:focus-visible { color: #a6c8fc; background: #122942; }
    html[data-theme="dark"] .home-site-header .nav-drop-menu { box-shadow: none; }
}

code, pre, kbd, samp, textarea { font-variant-ligatures: none !important; font-feature-settings: "liga" 0, "calt" 0 !important; }

.tt-ai-policy { position: absolute !important; width: 1px !important; height: 1px !important; margin: -1px !important; padding: 0 !important; overflow: hidden !important; clip: rect(0 0 0 0) !important; clip-path: inset(50%) !important; white-space: nowrap !important; border: 0 !important; pointer-events: none !important; }
