.display-mode-button {
    --mode-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M20.8 14.1A9 9 0 0 1 9.9 3.2 9.1 9.1 0 1 0 20.8 14.1Z'/%3E%3C/svg%3E");
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-width: 4.3rem;
    min-height: 32px;
    padding: 3px 9px;
    border: 1px solid #4a475d;
    border-radius: 8px;
    background: #211f2f;
    color: #f2efff;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
}
.display-mode-button[aria-checked="false"] {
    --mode-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='4'/%3E%3Cpath fill='none' stroke='black' stroke-width='2' stroke-linecap='round' d='M12 2v2m0 16v2M2 12h2m16 0h2M5 5l1.5 1.5m11 11L19 19M19 5l-1.5 1.5m-11 11L5 19'/%3E%3C/svg%3E");
}
.display-mode-button::before {
    content: "";
    flex: none;
    width: 14px;
    height: 14px;
    background-color: currentColor;
    -webkit-mask: var(--mode-icon) center / contain no-repeat;
    mask: var(--mode-icon) center / contain no-repeat;
}
.display-mode-button:hover { border-color: #988bd1; }
.display-mode-button:focus-visible { outline: 2px solid #8b76ea; outline-offset: 2px; }
.nav-compact .display-mode-button { min-height: 26px; }
#mobileMenu .display-mode-button { margin: 2px 12px 6px; min-height: 40px; }
@media (max-width: 767px) { .display-mode-desktop { display: none; } }

:root[data-display-mode="light"] {
    color-scheme: light;
    --bg: #f7f7fc; --bg-2: #fff; --panel: #fff;
    --line: #d8d9e7; --line-2: #babed3;
    --text: #202136; --muted: #4e536e; --faint: #60657b;
    --brand-ink: #4a3c96; --ok: #116e50;
}
:root[data-display-mode="light"] .display-mode-button { background: #f4f3fa; color: #30294d; border-color: #bcb8cc; }
:root[data-display-mode="light"] body:not(.k12-scope) {
    --fable-background: var(--bg); --fable-panel: var(--panel); --fable-line: var(--line);
    --fable-text: var(--text); --fable-muted: var(--muted);
    background-color: var(--bg); color: var(--text);
}
:root[data-display-mode="light"] body:not(.k12-scope) :is(#mainNav, #nav, #mobileMenu, #menu, #userDropdown, .dropdown-dark) {
    color: var(--text); background: rgba(255,255,255,.98); border-color: var(--line);
}
:root[data-display-mode="light"] body:not(.k12-scope) #mainNav :is(.nav-logo-text, .nav-link:hover) { color: var(--text); }
:root[data-display-mode="light"] body:not(.k12-scope) #mainNav .nav-credits {
    background: #fffbeb;
    border-color: #e4b44e;
    color: #713f12;
}
:root[data-display-mode="light"] body:not(.k12-scope) #mainNav .nav-credits :is(#navCredits, i) {
    background: none;
    color: inherit;
}
:root[data-display-mode="light"] body:not(.k12-scope) #main-content.hero-bg {
    background: radial-gradient(ellipse 80% 480px at 50% -180px, #e4e0fa, transparent 85%);
}
:root[data-display-mode="light"] body:not(.k12-scope) :is(#main-content .search-glow, #featuredTools > button, #homeSectionsRow .grid > a, #nativeAppsGrid > a, .tool-card:not(.game-illustrated-card), .step-card) {
    color: var(--text); background: #fff; border-color: var(--line);
}
:root[data-display-mode="light"] body:not(.k12-scope) :is(.dashboard-heading span, #main-content .search-kbd, #homeFeaturedRow > p, #homepageTabs .home-tab:hover) {
    background: none; color: var(--brand-ink);
}

/* Leave artwork, solid action buttons, dark previews and editors in their own palettes. */
@scope (:root[data-display-mode="light"] body:not(.k12-scope)) to (:is(pre, canvas, [class*="bg-gradient-to-"][class*="00 to-"], .game-illustrated-card, .nav-logo-icon, .nav-right-btn, .sg-studio, [class~="bg-black"], [class~="bg-gray-900"], [class~="bg-slate-900"], [class*="bg-[#0"], [class*="bg-[#1"])) {
    :is(.bg-white\/5, .bg-white\/\[0\.03\], .bg-white\/\[0\.04\], .bg-white\/\[0\.05\], .bg-white\/\[0\.06\]) { background-color: #fff; }
    :is(.bg-white\/10, .bg-white\/15, .bg-white\/20) { background-color: #e7e8f2; }
    :is([class^="border-white/"], [class*=" border-white/"]) { border-color: var(--line); }
    :is(.text-white, .text-gray-100, .text-gray-200, .text-gray-300) { color: var(--text); }
    :is([class^="text-white/"], [class*=" text-white/"], .text-gray-400, .text-gray-500) { color: var(--muted); }
    :is(.text-brand-300, .text-brand-400, .text-indigo-300, .text-indigo-400, .text-violet-300, .text-purple-300) { color: var(--brand-ink); }
    :is(.text-amber-300, .text-amber-400, .text-yellow-400) { color: #85500b; }
    :is(.text-emerald-300, .text-emerald-400, .text-teal-400) { color: #09694f; }
    :is(.hover\:text-white:hover, .hover\:text-white\/80:hover) { color: var(--text); }
    :is(.hover\:bg-white\/5:hover, .hover\:bg-white\/10:hover) { background-color: #e7e8f2; }
    :is(input, textarea)::placeholder { color: var(--faint); }
    select, select option { color: var(--text); background-color: #fff; }
}
:root[data-display-mode="light"] #main-content pre[class*="bg-black/"] { background-color: #161724; color-scheme: dark; }
:root[data-display-mode="light"] body:not(.k12-scope) #mainNav :is(.nav-right-btn, .nav-logo-icon) { color: white; }

/* Public homepage has its own navigation and semantic colour tokens. */
:root[data-display-mode="light"] .public-tools-home :is(.brand, .txt > b, .eyebrow b, .tool h3, .tier-n, .tier h3, .card h3, .faq summary, .results-note strong, .palette input) { color: var(--text); }
:root[data-display-mode="light"] .public-tools-home :is(.nav-links a:hover, .nav-icon:hover, .link:hover, .eyebrow:hover, .search-clear:hover, .foot a:hover, .foot-base a:hover, .hub li a:hover, .tabs button:hover, .tabs button[aria-selected="true"]) { color: var(--brand-ink); background-color: #eeedf7; }
:root[data-display-mode="light"] .public-tools-home :is(.palette, .results) { background: #fff; border-color: var(--line-2); }
:root[data-display-mode="light"] .public-tools-home h1 .grad { background-image: linear-gradient(100deg, #4338a1, #784197); }

:root[data-display-mode="light"] .public-tools-home :is(.k12 .sub, .role .txt > span) { color: #344e48; }
:root[data-display-mode="light"] .public-tools-home .k12 .kicker { color: #086449; }
:root[data-display-mode="light"] .public-tools-home .board { background: #163932; color: #fff; }
.public-tools-home .menu .display-mode-button { margin-block: 5px; min-height: 40px; }
@media (max-width: 559px) { .public-tools-home .nav-end .display-mode-button { display: none; } }
@media (min-width: 560px) { .public-tools-home .menu .display-mode-button { display: none; } }

:root[data-display-mode="light"] .public-tools-home :is(.kicker, .hit mark, .search-box > .i, .hub-head:hover .i, .tool:hover .tool-top .i) { color: var(--brand-ink); }
:root[data-display-mode="light"] .public-tools-home .badge.free { color: #09694f; }
:root[data-display-mode="light"] .public-tools-home .badge.account { color: #234e93; }
:root[data-display-mode="light"] .public-tools-home .badge.pro { color: #85500b; }

/* Signed-in actions need more room than the desktop links have on tablets. */
@media (min-width: 768px) and (max-width: 1023px) {
    body:not(.k12-scope) #mainNav:has(.nav-user-btn) :is(.nav-desktop-links, .nav-desktop-actions, .display-mode-desktop) { display: none; }
    body:not(.k12-scope) #mainNav:has(.nav-user-btn) .nav-mobile-actions { display: flex; }
    body:not(.k12-scope) #mainNav:has(.nav-user-btn) #mobileMenu:not(.hidden) { display: block; }
}
