:root,
[data-theme="dark"] {
    --t-bg: #0a0a0a;
    --t-bg-gradient: linear-gradient(135deg, #0a0a0a 0%, #171717 100%);
    --t-surface: #171717;
    --t-surface-2: #262626;
    --t-surface-3: #1f1f1f;
    --t-text: #fafafa;
    --t-text-muted: #a3a3a3;
    --t-border: #404040;
    --t-accent: #fafafa;
    --t-accent-hover: #e5e5e5;
    --t-accent-text: #0a0a0a;
    --t-dropdown: #262626;
    --t-dropdown-hover: #333333;
    --t-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.5);
    --t-intro: rgba(10, 10, 10, 0.97);
    --t-chat-user: #262626;
    --t-chat-agent: #fafafa;
    --t-chat-agent-text: #0a0a0a;
    --t-code-bg: #000000;
    --t-wipe: #171717;
}

[data-theme="gray"] {
    --t-bg: #d4d4d8;
    --t-bg-gradient: linear-gradient(135deg, #e4e4e7 0%, #d4d4d8 100%);
    --t-surface: #f4f4f5;
    --t-surface-2: #e4e4e7;
    --t-surface-3: #d4d4d8;
    --t-text: #27272a;
    --t-text-muted: #52525b;
    --t-border: #a1a1aa;
    --t-accent: #3f3f46;
    --t-accent-hover: #27272a;
    --t-accent-text: #fafafa;
    --t-dropdown: #f4f4f5;
    --t-dropdown-hover: #e4e4e7;
    --t-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.12);
    --t-intro: rgba(244, 244, 245, 0.97);
    --t-chat-user: #e4e4e7;
    --t-chat-agent: #3f3f46;
    --t-chat-agent-text: #fafafa;
    --t-code-bg: #27272a;
    --t-wipe: #e4e4e7;
}

html {
    background-color: var(--t-bg);
    overscroll-behavior: none;
}

body.themed-page {
    background: var(--t-bg-gradient);
    color: var(--t-text);
    overscroll-behavior: none;
}

html.theme-transitioning body.themed-page,
html.theme-transitioning .themed-surface,
html.theme-transitioning .themed-surface-2,
html.theme-transitioning .themed-card,
html.theme-transitioning .themed-chip,
html.theme-transitioning .themed-input-wrap,
html.theme-transitioning .themed-accent,
html.theme-transitioning .themed-sidebar,
html.theme-transitioning .themed-app,
html.theme-transitioning .themed-shell,
html.theme-transitioning .profile-dropdown,
html.theme-transitioning .lang-dropdown,
html.theme-transitioning .theme-modal-card,
html.theme-transitioning .theme-modal-head,
html.theme-transitioning .theme-modal-list,
html.theme-transitioning .chat-user,
html.theme-transitioning .chat-agent,
html.theme-transitioning #introLogo {
    transition: background 0.75s ease, background-color 0.75s ease, color 0.65s ease, border-color 0.75s ease, box-shadow 0.75s ease;
}

html.theme-transitioning .theme-picker-trigger,
html.theme-transitioning .theme-submenu-item {
    transition: background 0.75s ease, background-color 0.75s ease, color 0.65s ease;
}

.themed-surface { background: var(--t-surface); border-color: var(--t-border); color: var(--t-text); }
.themed-surface-2 { background: var(--t-surface-2); border-color: var(--t-border); color: var(--t-text); }
.themed-muted { color: var(--t-text-muted); }
.themed-border { border-color: var(--t-border); }
.themed-accent {
    background: var(--t-accent);
    color: var(--t-accent-text);
}
.themed-accent:hover { background: var(--t-accent-hover); }

.themed-card {
    background: var(--t-surface);
    border: 1px solid var(--t-border);
    box-shadow: var(--t-shadow);
    color: var(--t-text);
}

.themed-input-wrap {
    background: var(--t-surface-3);
    color: var(--t-text);
}
.themed-input-wrap input::placeholder { color: var(--t-text-muted); }

.themed-nav a { color: var(--t-text-muted); }
.themed-nav a:hover { color: var(--t-text); }

.themed-chip {
    background: var(--t-surface);
    border: 1px solid var(--t-border);
    color: var(--t-text);
}

.themed-shell {
    background: var(--t-bg);
}

.themed-app {
    background: var(--t-surface);
    border-color: var(--t-border);
}

.themed-sidebar {
    background: var(--t-surface-2);
    border-color: var(--t-border);
}

.chat-user { background: var(--t-chat-user) !important; color: var(--t-text) !important; }
.chat-agent { background: var(--t-chat-agent) !important; color: var(--t-chat-agent-text) !important; }

#introLogo { background: var(--t-intro) !important; }

.profile-dropdown,
.logo-dropdown,
.lang-dropdown {
    background: var(--t-dropdown) !important;
    border-color: var(--t-border) !important;
    color: var(--t-text);
}
.profile-dropdown a:hover,
.logo-dropdown button:hover,
.lang-dropdown button:hover {
    background: var(--t-dropdown-hover) !important;
}

.theme-wipe {
    display: none;
}

.theme-wave-layer {
    position: fixed;
    inset: 0;
    z-index: 9998;
    pointer-events: none;
    overflow: hidden;
}

.theme-wave-layer svg {
    position: absolute;
    width: 240%;
    min-width: 240vw;
    height: auto;
    left: -130%;
    top: 22%;
    fill: var(--t-accent);
    opacity: 0.06;
    animation: themeWaveTravel 1.35s cubic-bezier(0.33, 0.86, 0.45, 1) forwards;
}

[data-theme="dark"] .theme-wave-layer svg {
    opacity: 0.04;
}

@keyframes themeWaveTravel {
    from {
        transform: translateX(0) translateY(-6%) rotate(-1deg);
        opacity: 0;
    }
    15% {
        opacity: 0.06;
    }
    85% {
        opacity: 0.04;
    }
    to {
        transform: translateX(58%) translateY(6%) rotate(-1deg);
        opacity: 0;
    }
}

::view-transition-old(root),
::view-transition-new(root) {
    animation-duration: 0.7s;
    animation-timing-function: cubic-bezier(0.33, 0.86, 0.45, 1);
}

::view-transition-old(root) {
    animation-name: themeViewFadeOut;
}

::view-transition-new(root) {
    animation-name: themeViewFadeIn;
}

@keyframes themeViewFadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes themeViewFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

