body.theme-dark {
    --card: rgba(17, 24, 39, 0.92);
    --card2: rgba(31, 41, 55, 0.96);
    --border: #374151;
    --text: #e5e7eb;
    --muted: #9ca3af;
}

body.theme-dark #mathml-flow {
    border-color: #1f2937;
    background:
        linear-gradient(180deg, rgba(17, 24, 39, 0.8), rgba(17, 17, 17, 0.35)),
        #101418;
}

body.theme-dark .mflow-item {
    color: #e5e7eb;
}

body.theme-cream {
    --card: #fffaf2;
    --card2: #f3efe5;
    --border: #ddd0bd;
    --text: #1f2933;
    --muted: #687383;
    background: #f7f1e8;
    color: var(--text);
}

body.theme-cream > header {
    background: rgba(255, 250, 242, 0.94);
    border-bottom: 1px solid #ded2c1;
    color: var(--text);
    box-shadow: 0 6px 22px rgba(82, 68, 48, 0.10);
}

body.theme-cream .hamburger span {
    background: #243244;
}

body.theme-cream .brand,
body.theme-cream a {
    color: #16609e;
}

body.theme-cream .tag {
    background: #e7f0f7;
    color: #42647d;
}

body.theme-cream .site-search input,
body.theme-cream .lab-search-form .lab-search-input,
body.theme-cream .lab-search-select {
    background: #fffdf8;
    border-color: #d8cbb7;
    color: var(--text);
}

body.theme-cream .site-search button,
body.theme-cream .lab-search-form button,
body.theme-cream .lab-button {
    background: #1f6fb2;
    border-color: #1f6fb2;
    color: #fff;
}

body.theme-cream > nav {
    background: #fff8ed;
    border-right-color: #ded2c1;
    color: var(--text);
    box-shadow: 12px 0 22px rgba(82, 68, 48, 0.16);
}

body.theme-cream > nav li {
    border-bottom-color: rgba(111, 91, 64, 0.15);
}

body.theme-cream > nav a {
    color: #263446;
}

body.theme-cream > nav a.active {
    background: #e7f0f7;
    color: #0f4d82;
}

body.theme-cream > nav a:hover {
    background: #f2eadc;
    color: #142235;
}

body.theme-cream > nav .nav-children {
    background: rgba(49, 112, 143, 0.07);
}

body.theme-cream > nav .nav-children a {
    color: #4b5b6e;
}

body.theme-cream > nav .nav-children a::before {
    background: #1f6fb2;
}

body.theme-cream #mathml-flow {
    border-color: #ded2c1;
    background:
        linear-gradient(180deg, rgba(255, 250, 242, 0.82), rgba(231, 240, 247, 0.46)),
        #fbf5ea;
}

body.theme-cream .mflow-item {
    color: #1f2933;
}

body.theme-cream .home-notice,
body.theme-cream .home-latest-item,
body.theme-cream .lab-content-card,
body.theme-cream .lab-year-group,
body.theme-cream .profile-resume__section,
body.theme-cream .profile-resume__attrs div,
body.theme-cream .command-window,
body.theme-cream .profile-note,
body.theme-cream .profile-career,
body.theme-cream .status-box,
body.theme-cream a.card {
    background: var(--card);
    border-color: var(--border);
    color: var(--text);
}

body.theme-cream .lab-empty,
body.theme-cream .home-empty,
body.theme-cream .j-empty {
    background: #fffaf2;
    border-color: #d8cbb7;
    color: var(--muted);
}

body.theme-cream .home-notice {
    color: #17445f;
}

body.theme-cream .home-latest-item__meta,
body.theme-cream .lab-page__meta,
body.theme-cream .lab-list-meta,
body.theme-cream .lab-app-meta,
body.theme-cream .profile-resume__hero p,
body.theme-cream .profile-role,
body.theme-cream .profile-career .year,
body.theme-cream .status-row .label,
body.theme-cream .j-card__meta,
body.theme-cream .j-modal__sub {
    color: var(--muted);
}

body.theme-cream .home-latest-item__action,
body.theme-cream .lab-action,
body.theme-cream .profile-resume__attrs dt,
body.theme-cream .profile-resume__links a {
    color: #1769aa;
}

body.theme-cream .lab-list-item,
body.theme-cream .j-card {
    background: #fffdf8;
    border-color: #d8cbb7;
    color: var(--text);
    box-shadow: 0 12px 28px rgba(82, 68, 48, 0.10);
}

body.theme-cream .lab-list-item:active,
body.theme-cream .j-card:hover {
    background: #f2eadc;
}

body.theme-cream .tag-pill,
body.theme-cream .lab-list-tag,
body.theme-cream .j-pill {
    background: #e7f7f0;
    border-color: #9dd8bf;
    color: #166044;
}

body.theme-cream .profile-resume__section h2,
body.theme-cream .profile-resume__attrs dd,
body.theme-cream .profile-career .text,
body.theme-cream .status-row .value,
body.theme-cream .card-title {
    color: var(--text);
}

body.theme-cream .profile-resume__photo,
body.theme-cream .profile-avatar {
    border-color: #fffaf2;
    background: #f3efe5;
    box-shadow: 0 14px 30px rgba(82, 68, 48, 0.18);
}

body.theme-cream .profile-resume__links a {
    background: #eef6fb;
    border-color: #c5dceb;
}

body.theme-cream .j-modal__overlay {
    background: rgba(31, 41, 51, 0.46);
}

body.theme-cream .j-modal__panel {
    background: #fffaf2;
    border-color: var(--border);
    box-shadow: 0 28px 90px rgba(82, 68, 48, 0.28);
}

body.theme-cream .j-modal__head {
    border-bottom-color: var(--border);
}

body.theme-cream .j-modal__close {
    background: #fffdf8;
    border-color: var(--border);
    color: var(--text);
}

body.theme-cream .j-modal__body a {
    color: #145f9c;
}

body.theme-cream mark {
    background: #fff0a6;
    color: #1f2933;
}

@media (max-width: 932px) and (orientation: landscape) {
    body.theme-cream > nav {
        border-bottom-color: #ded2c1;
        box-shadow: 0 14px 24px rgba(82, 68, 48, 0.18);
    }

    body.theme-cream > nav a {
        background: #fffdf8;
        border-color: #d8cbb7;
    }

    body.theme-cream > nav .nav-children a {
        background: #eef6fb;
    }
}
