/* =========================================================
   TRUSTYEN AI LIVE
   COMPLETE DARK / LIGHT THEME SYSTEM
========================================================= */


/* =========================================================
   DARK THEME - DEFAULT
========================================================= */

:root {

    --bg-color: #080b10;
    --bg-color-2: #0d1118;

    --surface-color: rgba(18, 24, 32, 0.88);
    --surface-solid: #111720;
    --surface-soft: rgba(255, 255, 255, 0.045);

    --button-bg: rgba(255,255,255,0.055);
    --button-hover: rgba(255,255,255,0.095);

    --text-color: #f8fafc;
    --text-secondary: #b7c0cb;
    --text-muted: #7d8895;

    --accent-color: #4caf50;
    --accent-color-2: #1f9d55;
    --accent-light: #7cf58a;

    --accent-soft: rgba(76,175,80,.12);
    --accent-glow: rgba(76,175,80,.18);
    --accent-border: rgba(76,175,80,.34);

    --danger-color: #ff4f59;
    --danger-soft: rgba(255,79,89,.12);
    --danger-border: rgba(255,79,89,.35);

    --border-color: rgba(255,255,255,.09);
    --border-strong: rgba(255,255,255,.16);

    --grid-color: rgba(255,255,255,.022);

    --shadow: 0 25px 70px rgba(0,0,0,.46);
    --popup-shadow: 0 35px 100px rgba(0,0,0,.55);

    --user-bubble-1: #315e35;
    --user-bubble-2: #214528;

    --avatar-inner-1: rgba(76,175,80,.18);
    --avatar-inner-2: rgba(8,13,10,.96);

    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}


/* =========================================================
   LIGHT THEME
========================================================= */

html[data-theme="light"] {

    --bg-color: #f3f7f5;
    --bg-color-2: #eaf2ed;

    --surface-color: rgba(255,255,255,.91);
    --surface-solid: #ffffff;
    --surface-soft: rgba(15,23,42,.035);

    --button-bg: rgba(15,23,42,.045);
    --button-hover: rgba(15,23,42,.085);

    --text-color: #16201a;
    --text-secondary: #475569;
    --text-muted: #78858a;

    --accent-color: #16803a;
    --accent-color-2: #0f6b2f;
    --accent-light: #25a94d;

    --accent-soft: rgba(22,128,58,.10);
    --accent-glow: rgba(22,128,58,.16);
    --accent-border: rgba(22,128,58,.28);

    --danger-color: #dc3f49;
    --danger-soft: rgba(220,63,73,.09);
    --danger-border: rgba(220,63,73,.24);

    --border-color: rgba(15,23,42,.10);
    --border-strong: rgba(15,23,42,.16);

    --grid-color: rgba(15,23,42,.032);

    --shadow: 0 25px 70px rgba(15,23,42,.13);
    --popup-shadow: 0 35px 100px rgba(15,23,42,.20);

    --user-bubble-1: #2a8045;
    --user-bubble-2: #1f6937;

    --avatar-inner-1: rgba(22,128,58,.16);
    --avatar-inner-2: rgba(240,249,244,.98);
}


/* =========================================================
   RESET
========================================================= */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;

    -webkit-tap-highlight-color: transparent;
}


html,
body {
    width: 100%;
    height: 100%;
}


html {
    background: var(--bg-color);
}


body {

    overflow: hidden;

    background:
        radial-gradient(
            circle at 50% 35%,
            var(--accent-soft),
            transparent 31%
        ),
        linear-gradient(
            145deg,
            var(--bg-color),
            var(--bg-color-2)
        );

    color: var(--text-color);

    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Arial,
        sans-serif;

    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;

    transition:
        background .38s ease,
        color .38s ease;
}


button,
input {
    font: inherit;
}


button {
    -webkit-user-select: none;
    user-select: none;
}


/* =========================================================
   THEME TRANSITION
========================================================= */

html.theme-switching body {

    animation:
        themePageFlash .48s ease;
}


html.theme-switching .app-container {

    animation:
        themeContainerFlash .48s ease;
}


@keyframes themePageFlash {

    0% {
        filter: brightness(1);
    }

    35% {
        filter: brightness(1.08);
    }

    100% {
        filter: brightness(1);
    }
}


@keyframes themeContainerFlash {

    0% {
        transform: scale(1);
    }

    35% {
        transform: scale(1.004);
    }

    100% {
        transform: scale(1);
    }
}


/* =========================================================
   APP
========================================================= */

.app-container {

    position: relative;

    width: 100%;
    height: 100dvh;
    min-height: 100vh;

    overflow: hidden;

    display: flex;
    flex-direction: column;

    isolation: isolate;

    background: transparent;
}


/* =========================================================
   BACKGROUND
========================================================= */

.background-grid {

    position: absolute;
    inset: 0;

    z-index: -3;

    pointer-events: none;

    opacity: .9;

    background-image:
        linear-gradient(
            var(--grid-color) 1px,
            transparent 1px
        ),
        linear-gradient(
            90deg,
            var(--grid-color) 1px,
            transparent 1px
        );

    background-size: 44px 44px;

    transition:
        background-image .38s ease,
        opacity .38s ease;
}


.background-orb {

    position: absolute;

    border-radius: 50%;

    filter: blur(90px);

    pointer-events: none;

    z-index: -2;

    transition:
        background .38s ease,
        opacity .38s ease;
}


.orb-one {

    width: 300px;
    height: 300px;

    left: 20%;
    top: -160px;

    background:
        var(--accent-glow);

    opacity: .50;

    animation:
        floatOne 9s ease-in-out infinite;
}


.orb-two {

    width: 240px;
    height: 240px;

    right: 10%;
    bottom: -120px;

    background:
        rgba(48,130,246,.045);

    opacity: .70;

    animation:
        floatTwo 10s ease-in-out infinite;
}


/* =========================================================
   TOP BAR
========================================================= */

.top-bar {

    position: relative;

    z-index: 100;

    flex: 0 0 auto;

    min-height: 72px;

    padding:
        calc(9px + var(--safe-top))
        clamp(13px, 3vw, 34px)
        9px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    border-bottom:
        1px solid var(--border-color);

    background:
        var(--surface-color);

    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);

    transition:
        background .38s ease,
        border-color .38s ease,
        color .38s ease;
}


.brand-section {

    display: flex;
    align-items: center;

    gap: 11px;
}


.brand-logo {

    width: 42px;
    height: 42px;

    display: flex;
    align-items: center;
    justify-content: center;

    border:
        1px solid var(--accent-border);

    border-radius: 50%;

    background:
        radial-gradient(
            circle,
            var(--accent-soft),
            transparent 72%
        );

    box-shadow:
        0 0 28px var(--accent-soft);

    transition:
        background .38s ease,
        border-color .38s ease,
        box-shadow .38s ease;
}


.brand-logo svg {

    width: 21px;
    height: 21px;

    fill: none;

    stroke:
        var(--accent-light);

    stroke-width: 1.8;

    stroke-linecap: round;
    stroke-linejoin: round;

    transition:
        stroke .38s ease;
}


.brand-info {
    min-width: 0;
}


.brand-title {

    font-size: 16px;
    font-weight: 700;

    color: var(--text-color);

    transition:
        color .38s ease;
}


.brand-subtitle {

    margin-top: 3px;

    display: flex;
    align-items: center;

    gap: 6px;

    color:
        var(--text-muted);

    font-size: 10px;

    transition:
        color .38s ease;
}


.online-dot {

    width: 6px;
    height: 6px;

    border-radius: 50%;

    background:
        var(--accent-light);

    box-shadow:
        0 0 9px var(--accent-glow);

    animation:
        onlinePulse 2s ease-in-out infinite;
}


.header-actions {

    display: flex;
    align-items: center;

    gap: 7px;
}


/* =========================================================
   CALL BUTTONS
========================================================= */

.connection-btn {

    height: 42px;

    padding: 0 14px;

    display: flex;
    align-items: center;
    justify-content: center;

    gap: 7px;

    border-radius: 13px;

    cursor: pointer;

    transition:
        transform .18s ease,
        background .25s ease,
        border-color .25s ease,
        color .25s ease;
}


.connection-btn:hover {
    transform: translateY(-1px);
}


.connection-btn:active {
    transform: scale(.95);
}


.connection-btn svg {

    width: 18px;
    height: 18px;

    fill: none;

    stroke: currentColor;

    stroke-width: 1.8;

    stroke-linecap: round;
    stroke-linejoin: round;
}


.call-btn {

    color: var(--accent-light);

    background:
        var(--accent-soft);

    border:
        1px solid var(--accent-border);
}


.call-btn:hover {

    background:
        rgba(76,175,80,.19);

}


html[data-theme="light"] .call-btn:hover {

    background:
        rgba(22,128,58,.15);

}


.cut-call-btn {

    color:
        var(--danger-color);

    background:
        var(--danger-soft);

    border:
        1px solid var(--danger-border);
}


.cut-call-btn:hover {

    background:
        rgba(255,79,89,.18);

}


html[data-theme="light"] .cut-call-btn:hover {

    background:
        rgba(220,63,73,.14);

}


/* =========================================================
   THEME BUTTON
========================================================= */

.settings-btn {

    width: 44px;
    height: 44px;

    padding: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    border:
        1px solid var(--border-color);

    border-radius: 14px;

    background:
        var(--button-bg);

    color:
        var(--text-color);

    cursor: pointer;

    overflow: hidden;

    transition:
        transform .2s ease,
        background .28s ease,
        border-color .28s ease,
        color .28s ease,
        box-shadow .28s ease;
}


.settings-btn:hover {

    background:
        var(--button-hover);

    border-color:
        var(--border-strong);

    transform:
        translateY(-1px);

    box-shadow:
        0 8px 25px var(--accent-soft);
}


.settings-btn:active {

    transform:
        scale(.93);
}


.appearance-icon {

    position: relative;

    width: 23px;
    height: 23px;

    display: block;
}


.appearance-icon svg {

    position: absolute;

    inset: 0;

    width: 100%;
    height: 100%;

    fill: none;

    stroke: currentColor;

    stroke-width: 1.75;

    stroke-linecap: round;
    stroke-linejoin: round;

    transition:
        transform .35s ease,
        opacity .3s ease,
        color .3s ease;
}


.appearance-sun {

    opacity: 0;

    transform:
        scale(.55)
        rotate(-45deg);
}


.appearance-moon {

    opacity: 1;

    transform:
        scale(1)
        rotate(0);
}


html[data-theme="light"] .appearance-sun {

    opacity: 1;

    transform:
        scale(1)
        rotate(0);
}


html[data-theme="light"] .appearance-moon {

    opacity: 0;

    transform:
        scale(.55)
        rotate(45deg);
}


.settings-btn:hover .appearance-icon {

    animation:
        themeIconFloat .7s ease;
}


/* =========================================================
   MAIN AREA
========================================================= */

.call-area {

    position: relative;

    flex: 1 1 auto;

    min-height: 0;

    width: 100%;

    overflow: hidden;

    display: flex;
    flex-direction: column;
    align-items: center;
}


/* =========================================================
   AI CENTER
========================================================= */

.ai-center {

    position: relative;

    flex: 1 1 auto;

    width: min(100%, 650px);

    min-height: 235px;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    padding: 20px;

    pointer-events: none;
}


.ai-background-glow {

    position: absolute;

    width: 240px;
    height: 240px;

    border-radius: 50%;

    background:
        var(--accent-soft);

    filter:
        blur(78px);

    animation:
        aiGlow 5s ease-in-out infinite;

    transition:
        background .38s ease;
}


.ai-avatar-container {

    position: relative;

    width: 190px;
    height: 190px;

    display: flex;
    align-items: center;
    justify-content: center;
}


.ai-ring {

    position: absolute;

    border-radius: 50%;

    transition:
        border-color .38s ease;
}


.ring-outer {

    width: 188px;
    height: 188px;

    border:
        1px solid var(--accent-border);

    border-left-color:
        var(--accent-color);

    animation:
        rotateRing 10s linear infinite;
}


.ring-middle {

    width: 156px;
    height: 156px;

    border:
        1px dashed var(--border-color);

    animation:
        rotateRingReverse 14s linear infinite;
}


.ai-avatar {

    position: relative;

    width: 116px;
    height: 116px;

    display: flex;
    align-items: center;
    justify-content: center;

    border:
        1px solid var(--accent-border);

    border-radius: 50%;

    overflow: hidden;

    background:
        radial-gradient(
            circle at 35% 28%,
            rgba(255,255,255,.10),
            transparent 28%
        ),
        radial-gradient(
            circle,
            var(--avatar-inner-1),
            var(--avatar-inner-2) 70%
        );

    box-shadow:
        0 0 60px var(--accent-soft);

    animation:
        avatarFloat 4s ease-in-out infinite;

    transition:
        background .38s ease,
        border-color .38s ease,
        box-shadow .38s ease;
}


.avatar-light {

    position: absolute;

    top: 18px;
    left: 23px;

    width: 50px;
    height: 50px;

    border-radius: 50%;

    background:
        radial-gradient(
            circle,
            rgba(255,255,255,.10),
            transparent 72%
        );
}


.avatar-face {

    display: flex;
    align-items: center;

    gap: 18px;
}


.avatar-eye {

    width: 8px;
    height: 18px;

    border-radius: 50%;

    background:
        var(--accent-light);

    box-shadow:
        0 0 13px var(--accent-glow);

    animation:
        eyeBlink 4s infinite;

    transition:
        background .38s ease;
}


.avatar-eye:nth-child(2) {
    animation-delay: .10s;
}


.avatar-mouth {

    position: absolute;

    left: 50%;
    bottom: 31px;

    width: 23px;
    height: 4px;

    transform:
        translateX(-50%);

    border-radius: 20px;

    background:
        var(--accent-light);

    animation:
        speak 1.1s ease-in-out infinite;

    transition:
        background .38s ease;
}


.ai-title {

    margin-top: 2px;

    font-size: 18px;
    font-weight: 700;

    color:
        var(--text-color);

    transition:
        color .38s ease;
}


.ai-status {

    margin-top: 6px;

    display: flex;
    align-items: center;

    gap: 7px;

    color:
        var(--text-muted);

    font-size: 11px;

    transition:
        color .38s ease;
}


.status-circle {

    width: 6px;
    height: 6px;

    border-radius: 50%;

    background:
        var(--accent-light);

    box-shadow:
        0 0 8px var(--accent-glow);
}


/* =========================================================
   VOICE WAVE
========================================================= */

.voice-wave {

    height: 28px;

    margin-top: 10px;

    display: flex;
    align-items: center;

    gap: 4px;
}


.voice-wave span {

    width: 3px;
    height: 6px;

    border-radius: 20px;

    background:
        var(--accent-light);

    animation:
        wave .8s ease-in-out infinite alternate;

    transition:
        background .38s ease;
}


.voice-wave span:nth-child(2) {
    animation-delay: .08s;
}

.voice-wave span:nth-child(3) {
    animation-delay: .16s;
}

.voice-wave span:nth-child(4) {
    animation-delay: .24s;
}

.voice-wave span:nth-child(5) {
    animation-delay: .32s;
}

.voice-wave span:nth-child(6) {
    animation-delay: .40s;
}

.voice-wave span:nth-child(7) {
    animation-delay: .32s;
}

.voice-wave span:nth-child(8) {
    animation-delay: .24s;
}

.voice-wave span:nth-child(9) {
    animation-delay: .16s;
}


/* =========================================================
   CHAT
========================================================= */

.chat-history {

    position: absolute;

    top: 10px;
    left: 50%;
    bottom: 148px;

    width:
        min(92%, 760px);

    transform:
        translateX(-50%);

    padding: 5px;

    overflow-y: auto;

    display: flex;
    flex-direction: column;

    gap: 9px;

    z-index: 20;

    scrollbar-width: thin;

    scrollbar-color:
        var(--border-strong)
        transparent;
}


.chat-message {

    width: fit-content;

    max-width:
        min(78%, 620px);

    padding:
        11px 14px;

    border:
        1px solid var(--border-color);

    border-radius:
        16px;

    font-size:
        13px;

    line-height:
        1.45;

    word-break:
        break-word;

    animation:
        messageIn .22s ease-out;

    transition:
        background .38s ease,
        border-color .38s ease,
        color .38s ease,
        box-shadow .38s ease;
}


.user-message {

    align-self: flex-end;

    margin-left: 20%;

    color:
        #ffffff;

    background:
        linear-gradient(
            135deg,
            var(--user-bubble-1),
            var(--user-bubble-2)
        );

    border-color:
        rgba(255,255,255,.08);

    box-shadow:
        0 10px 25px rgba(0,0,0,.08);
}


.model-message {

    align-self: flex-start;

    margin-right: 20%;

    color:
        var(--text-color);

    background:
        var(--surface-color);

    backdrop-filter:
        blur(14px);

    -webkit-backdrop-filter:
        blur(14px);
}


.model-message.streaming::after {

    content:
        "▋";

    margin-left:
        3px;

    color:
        var(--accent-light);

    animation:
        blink .8s step-end infinite;
}


/* =========================================================
   VISUALIZER
========================================================= */

.visualizer {

    position: absolute;

    left: 50%;
    bottom: 0;

    width:
        min(760px, 92%);

    height:
        95px;

    transform:
        translateX(-50%);

    z-index:
        5;

    pointer-events:
        none;

    opacity:
        .6;
}


/* =========================================================
   PREVIEWS
========================================================= */

.camera-preview,
.screen-preview {

    position: absolute;

    top: 20px;

    width:
        min(30vw, 300px);

    aspect-ratio:
        16 / 10;

    display:
        none;

    overflow:
        hidden;

    border:
        1px solid var(--border-color);

    border-radius:
        20px;

    background:
        #030405;

    box-shadow:
        var(--shadow);

    z-index:
        70;
}


.camera-preview {
    right:
        20px;
}


.screen-preview {
    left:
        20px;
}


.camera-preview video,
.screen-preview video {

    width:
        100%;

    height:
        100%;

    display:
        block;
}


.camera-preview video {

    object-fit:
        cover;
}


.screen-preview video {

    object-fit:
        contain;
}


.preview-header {

    position:
        absolute;

    top:
        0;

    left:
        0;

    right:
        0;

    height:
        40px;

    padding:
        0 10px;

    display:
        flex;

    align-items:
        center;

    justify-content:
        space-between;

    color:
        #ffffff;

    font-size:
        11px;

    font-weight:
        600;

    background:
        linear-gradient(
            to bottom,
            rgba(0,0,0,.65),
            transparent
        );

    z-index:
        10;
}


.camera-switch-btn {

    width:
        32px;

    height:
        32px;

    display:
        flex;

    align-items:
        center;

    justify-content:
        center;

    border:
        1px solid rgba(255,255,255,.15);

    border-radius:
        50%;

    background:
        rgba(0,0,0,.45);

    color:
        #ffffff;

    cursor:
        pointer;
}


.camera-switch-btn svg {

    width:
        17px;

    height:
        17px;

    fill:
        none;

    stroke:
        currentColor;

    stroke-width:
        1.7;

    stroke-linecap:
        round;

    stroke-linejoin:
        round;
}


/* =========================================================
   CALL CONTROLS
========================================================= */

.call-controls {

    position:
        absolute;

    left:
        50%;

    bottom:
        77px;

    transform:
        translateX(-50%);

    width:
        min(100%, 390px);

    display:
        flex;

    align-items:
        center;

    justify-content:
        center;

    gap:
        10px;

    z-index:
        80;
}


.call-control {

    width:
        58px;

    height:
        58px;

    display:
        flex;

    flex-direction:
        column;

    align-items:
        center;

    justify-content:
        center;

    gap:
        3px;

    border:
        1px solid var(--border-color);

    border-radius:
        18px;

    background:
        var(--button-bg);

    color:
        var(--text-secondary);

    cursor:
        pointer;

    backdrop-filter:
        blur(14px);

    -webkit-backdrop-filter:
        blur(14px);

    transition:
        transform .18s ease,
        background .28s ease,
        color .28s ease,
        border-color .28s ease,
        box-shadow .28s ease;
}


.call-control:hover {

    transform:
        translateY(-2px);

    background:
        var(--button-hover);

    color:
        var(--text-color);

    border-color:
        var(--border-strong);
}


.call-control:active {

    transform:
        scale(.93);
}


.primary-control {

    width:
        66px;

    height:
        66px;

    border-color:
        var(--accent-border);

    color:
        var(--accent-light);

    background:
        radial-gradient(
            circle,
            var(--accent-glow),
            transparent 78%
        );
}


.call-control.active {

    color:
        #ffffff;

    background:
        var(--accent-color);

    border-color:
        var(--accent-color);

    box-shadow:
        0 12px 28px var(--accent-glow);
}


.control-icon {

    width:
        22px;

    height:
        22px;

    display:
        flex;

    align-items:
        center;

    justify-content:
        center;
}


.control-icon svg {

    width:
        21px;

    height:
        21px;

    fill:
        none;

    stroke:
        currentColor;

    stroke-width:
        1.7;

    stroke-linecap:
        round;

    stroke-linejoin:
        round;
}


.control-name {

    font-size:
        8px;

    color:
        var(--text-muted);

    font-weight:
        600;

    transition:
        color .28s ease;
}


.call-control.active .control-name {

    color:
        rgba(255,255,255,.88);
}


/* =========================================================
   INPUT
========================================================= */

.message-area {

    position:
        absolute;

    left:
        50%;

    bottom:
        calc(12px + var(--safe-bottom));

    transform:
        translateX(-50%);

    width:
        min(calc(100% - 28px), 720px);

    z-index:
        90;
}


.text-input-container {

    min-height:
        58px;

    display:
        flex;

    align-items:
        center;

    padding:
        5px 6px 5px 18px;

    border:
        1px solid var(--border-color);

    border-radius:
        20px;

    background:
        var(--surface-color);

    box-shadow:
        0 15px 40px rgba(0,0,0,.12);

    backdrop-filter:
        blur(20px);

    -webkit-backdrop-filter:
        blur(20px);

    transition:
        background .38s ease,
        border-color .38s ease,
        box-shadow .38s ease;
}


.text-input {

    flex:
        1;

    min-width:
        0;

    height:
        46px;

    padding-right:
        8px;

    border:
        none;

    outline:
        none;

    background:
        transparent;

    color:
        var(--text-color);

    font-size:
        14px;

    transition:
        color .38s ease;
}


.text-input::placeholder {

    color:
        var(--text-muted);

    transition:
        color .38s ease;
}


.send-btn {

    width:
        48px;

    height:
        48px;

    flex:
        0 0 48px;

    display:
        flex;

    align-items:
        center;

    justify-content:
        center;

    border:
        none;

    border-radius:
        16px;

    background:
        linear-gradient(
            145deg,
            var(--accent-light),
            var(--accent-color)
        );

    color:
        #061007;

    cursor:
        pointer;

    transition:
        transform .18s ease,
        filter .18s ease,
        box-shadow .28s ease;
}


.send-btn:hover {

    filter:
        brightness(1.07);

    box-shadow:
        0 10px 25px var(--accent-soft);
}


.send-btn:active {

    transform:
        scale(.91);
}


.send-btn svg {

    width:
        20px;

    height:
        20px;

    fill:
        none;

    stroke:
        currentColor;

    stroke-width:
        1.8;

    stroke-linecap:
        round;

    stroke-linejoin:
        round;
}


/* =========================================================
   THEME OVERLAY
========================================================= */

.theme-overlay {

    position:
        fixed;

    inset:
        0;

    background:
        rgba(0,0,0,.62);

    backdrop-filter:
        blur(8px);

    -webkit-backdrop-filter:
        blur(8px);

    opacity:
        0;

    visibility:
        hidden;

    transition:
        opacity .28s ease,
        visibility .28s ease;

    z-index:
        1500;
}


.theme-overlay.active {

    opacity:
        1;

    visibility:
        visible;
}


/* =========================================================
   THEME POPUP
========================================================= */

.theme-popup {

    position:
        fixed;

    left:
        50%;

    top:
        50%;

    width:
        min(92%, 440px);

    padding:
        28px;

    border:
        1px solid var(--border-strong);

    border-radius:
        28px;

    background:
        var(--surface-solid);

    box-shadow:
        var(--popup-shadow);

    color:
        var(--text-color);

    transform:
        translate(-50%,-45%)
        scale(.92);

    opacity:
        0;

    visibility:
        hidden;

    z-index:
        1501;

    overflow:
        hidden;

    transition:
        opacity .28s cubic-bezier(.22,1,.36,1),
        transform .38s cubic-bezier(.22,1,.36,1),
        visibility .28s ease,
        background .38s ease,
        border-color .38s ease,
        color .38s ease;
}


.theme-popup.active {

    opacity:
        1;

    visibility:
        visible;

    transform:
        translate(-50%,-50%)
        scale(1);
}


.theme-popup-glow {

    position:
        absolute;

    width:
        170px;

    height:
        170px;

    left:
        50%;

    top:
        -85px;

    transform:
        translateX(-50%);

    border-radius:
        50%;

    background:
        var(--accent-soft);

    filter:
        blur(55px);

    pointer-events:
        none;
}


/* =========================================================
   POPUP CLOSE
========================================================= */

.theme-close-btn {

    position:
        absolute;

    top:
        14px;

    right:
        14px;

    width:
        36px;

    height:
        36px;

    display:
        flex;

    align-items:
        center;

    justify-content:
        center;

    border:
        1px solid var(--border-color);

    border-radius:
        11px;

    background:
        var(--button-bg);

    color:
        var(--text-secondary);

    cursor:
        pointer;

    transition:
        background .28s ease,
        border-color .28s ease,
        color .28s ease;
}


.theme-close-btn:hover {

    color:
        var(--text-color);

    background:
        var(--button-hover);
}


.theme-close-btn svg {

    width:
        17px;

    height:
        17px;

    fill:
        none;

    stroke:
        currentColor;

    stroke-width:
        1.8;

    stroke-linecap:
        round;
}


/* =========================================================
   POPUP ICON
========================================================= */

.theme-popup-icon {

    position:
        relative;

    width:
        74px;

    height:
        74px;

    margin:
        0 auto 17px;

    display:
        flex;

    align-items:
        center;

    justify-content:
        center;

    border:
        1px solid var(--accent-border);

    border-radius:
        24px;

    background:
        radial-gradient(
            circle,
            var(--accent-soft),
            transparent
        );

    color:
        var(--accent-light);

    animation:
        popupIconIn .55s cubic-bezier(.22,1,.36,1);

    transition:
        background .38s ease,
        border-color .38s ease,
        color .38s ease;
}


.theme-popup-icon svg {

    width:
        30px;

    height:
        30px;

    fill:
        none;

    stroke:
        currentColor;

    stroke-width:
        1.6;

    stroke-linecap:
        round;

    stroke-linejoin:
        round;
}


.theme-popup-sun,
.theme-popup-moon {

    position:
        absolute;

    display:
        flex;

    transition:
        opacity .25s ease,
        transform .25s ease;
}


.theme-popup-moon {

    opacity:
        1;
}


.theme-popup-sun {

    opacity:
        0;

    transform:
        scale(.6);
}


html[data-theme="light"] .theme-popup-moon {

    opacity:
        0;

    transform:
        scale(.6);
}


html[data-theme="light"] .theme-popup-sun {

    opacity:
        1;

    transform:
        scale(1);
}


.theme-icon-orbit {

    position:
        absolute;

    width:
        54px;

    height:
        22px;

    border:
        1px solid var(--accent-border);

    border-radius:
        50%;

    transform:
        rotate(-25deg);

    animation:
        popupOrbit 5s linear infinite;
}


/* =========================================================
   POPUP TEXT
========================================================= */

.theme-popup-title {

    text-align:
        center;

    font-size:
        22px;

    font-weight:
        750;

    letter-spacing:
        -.4px;

    color:
        var(--text-color);
}


.theme-popup-description {

    max-width:
        320px;

    margin:
        7px auto 22px;

    text-align:
        center;

    color:
        var(--text-muted);

    font-size:
        12px;

    line-height:
        1.5;
}


/* =========================================================
   THEME OPTIONS
========================================================= */

.theme-options {

    display:
        flex;

    flex-direction:
        column;

    gap:
        10px;
}


.theme-option {

    position:
        relative;

    width:
        100%;

    min-height:
        92px;

    padding:
        10px;

    display:
        flex;

    align-items:
        center;

    gap:
        12px;

    border:
        1px solid var(--border-color);

    border-radius:
        18px;

    background:
        var(--button-bg);

    color:
        var(--text-color);

    cursor:
        pointer;

    text-align:
        left;

    transition:
        transform .2s ease,
        background .28s ease,
        border-color .28s ease,
        box-shadow .28s ease,
        color .28s ease;
}


.theme-option:hover {

    transform:
        translateY(-2px);

    background:
        var(--button-hover);
}


.theme-option.selected {

    border-color:
        var(--accent-color);

    box-shadow:
        0 0 0 3px var(--accent-soft),
        0 10px 30px var(--accent-soft);
}


.theme-option-preview {

    position:
        relative;

    width:
        88px;

    height:
        65px;

    flex:
        0 0 88px;

    overflow:
        hidden;

    border-radius:
        12px;

    border:
        1px solid rgba(255,255,255,.10);
}


.dark-preview {

    background:
        linear-gradient(
            145deg,
            #0a0e13,
            #151b24
        );
}


.light-preview {

    background:
        linear-gradient(
            145deg,
            #ffffff,
            #eef4f0
        );

    border-color:
        rgba(15,23,42,.10);
}


.preview-top {

    position:
        absolute;

    top:
        0;

    left:
        0;

    right:
        0;

    height:
        10px;

    background:
        rgba(255,255,255,.05);
}


.light-preview .preview-top {

    background:
        rgba(15,23,42,.07);
}


.preview-line {

    position:
        absolute;

    left:
        10px;

    height:
        4px;

    border-radius:
        5px;
}


.dark-preview .preview-line {

    background:
        rgba(255,255,255,.15);
}


.light-preview .preview-line {

    background:
        rgba(15,23,42,.13);
}


.line-one {

    top:
        24px;

    width:
        34px;
}


.line-two {

    top:
        33px;

    width:
        48px;
}


.line-three {

    top:
        42px;

    width:
        26px;
}


.preview-avatar {

    position:
        absolute;

    width:
        24px;

    height:
        24px;

    right:
        9px;

    top:
        24px;

    display:
        flex;

    align-items:
        center;

    justify-content:
        center;

    border-radius:
        50%;

    background:
        rgba(76,175,80,.18);

    color:
        #69e875;

    font-size:
        12px;
}


.theme-option-text {

    min-width:
        0;

    flex:
        1;

    display:
        flex;

    flex-direction:
        column;

    gap:
        4px;
}


.theme-option-text strong {

    font-size:
        13px;
}


.theme-option-text small {

    color:
        var(--text-muted);

    font-size:
        10px;

    line-height:
        1.4;
}


.theme-check {

    width:
        24px;

    height:
        24px;

    flex:
        0 0 24px;

    display:
        flex;

    align-items:
        center;

    justify-content:
        center;

    border:
        1px solid var(--border-color);

    border-radius:
        50%;

    color:
        transparent;

    transition:
        background .25s ease,
        border-color .25s ease,
        color .25s ease;
}


.theme-option.selected .theme-check {

    color:
        #ffffff;

    background:
        var(--accent-color);

    border-color:
        var(--accent-color);
}


.theme-check svg {

    width:
        13px;

    height:
        13px;

    fill:
        none;

    stroke:
        currentColor;

    stroke-width:
        2;

    stroke-linecap:
        round;

    stroke-linejoin:
        round;
}


/* =========================================================
   MOBILE
========================================================= */

@media (max-width: 700px) {

    .top-bar {

        min-height:
            62px;

        padding:
            calc(7px + var(--safe-top))
            11px
            7px;
    }


    .brand-logo {

        width:
            36px;

        height:
            36px;
    }


    .brand-title {

        font-size:
            14px;
    }


    .brand-subtitle {

        font-size:
            9px;
    }


    .connection-btn {

        width:
            39px;

        height:
            39px;

        padding:
            0;

        border-radius:
            12px;
    }


    .connection-btn span {

        display:
            none;
    }


    .settings-btn {

        width:
            39px;

        height:
            39px;

        border-radius:
            12px;
    }


    .ai-avatar-container {

        width:
            148px;

        height:
            148px;
    }


    .ring-outer {

        width:
            144px;

        height:
            144px;
    }


    .ring-middle {

        width:
            121px;

        height:
            121px;
    }


    .ai-avatar {

        width:
            92px;

        height:
            92px;
    }


    .ai-title {

        font-size:
            15px;
    }


    .chat-history {

        top:
            6px;

        bottom:
            128px;

        width:
            calc(100% - 14px);
    }


    .chat-message {

        max-width:
            88%;

        padding:
            9px 11px;

        border-radius:
            14px;

        font-size:
            12px;
    }


    .camera-preview {

        top:
            10px;

        right:
            10px;

        width:
            150px;

        border-radius:
            15px;
    }


    .screen-preview {

        top:
            10px;

        left:
            10px;

        width:
            150px;

        border-radius:
            15px;
    }


    .call-controls {

        bottom:
            68px;

        gap:
            7px;
    }


    .call-control {

        width:
            49px;

        height:
            49px;

        border-radius:
            15px;
    }


    .primary-control {

        width:
            58px;

        height:
            58px;
    }


    .control-name {

        display:
            none;
    }


    .message-area {

        width:
            calc(100% - 14px);

        bottom:
            calc(7px + var(--safe-bottom));
    }


    .text-input-container {

        min-height:
            52px;

        padding-left:
            14px;

        border-radius:
            17px;
    }


    .text-input {

        height:
            42px;
    }


    .send-btn {

        width:
            42px;

        height:
            42px;

        flex-basis:
            42px;

        border-radius:
            13px;
    }


    .theme-popup {

        width:
            calc(100% - 22px);

        padding:
            21px;

        border-radius:
            23px;
    }


    .theme-popup-icon {

        width:
            65px;

        height:
            65px;

        border-radius:
            20px;
    }


    .theme-popup-title {

        font-size:
            19px;
    }


    .theme-popup-description {

        font-size:
            11px;

        margin-bottom:
            18px;
    }


    .theme-option {

        min-height:
            84px;

        padding:
            8px;

        border-radius:
            16px;
    }


    .theme-option-preview {

        width:
            76px;

        height:
            56px;

        flex-basis:
            76px;
    }


    .theme-option-text strong {

        font-size:
            12px;
    }


    .theme-option-text small {

        font-size:
            9px;
    }
}


/* =========================================================
   SMALL PHONES
========================================================= */

@media (max-width: 370px) {

    .brand-subtitle {

        display:
            none;
    }


    .theme-option-preview {

        width:
            65px;

        flex-basis:
            65px;
    }


    .theme-option-text small {

        display:
            none;
    }


    .theme-popup {

        padding:
            18px;
    }
}


/* =========================================================
   LANDSCAPE
========================================================= */

@media (max-height: 520px) and (orientation: landscape) {

    .top-bar {

        min-height:
            53px;
    }


    .ai-center {

        min-height:
            160px;

        flex-direction:
            row;

        gap:
            16px;
    }


    .ai-avatar-container {

        width:
            105px;

        height:
            105px;
    }


    .ring-outer {

        width:
            101px;

        height:
            101px;
    }


    .ring-middle {

        width:
            86px;

        height:
            86px;
    }


    .ai-avatar {

        width:
            69px;

        height:
            69px;
    }


    .chat-history {

        bottom:
            104px;
    }


    .call-controls {

        bottom:
            54px;
    }


    .message-area {

        bottom:
            calc(5px + var(--safe-bottom));
    }
}


/* =========================================================
   ANIMATIONS
========================================================= */

@keyframes floatOne {

    0%,
    100% {
        transform:
            translate(0,0);
    }

    50% {
        transform:
            translate(35px,20px);
    }
}


@keyframes floatTwo {

    0%,
    100% {
        transform:
            translate(0,0);
    }

    50% {
        transform:
            translate(-25px,-18px);
    }
}


@keyframes onlinePulse {

    0%,
    100% {
        opacity:
            .45;
    }

    50% {
        opacity:
            1;
    }
}


@keyframes aiGlow {

    0%,
    100% {

        transform:
            scale(.92);

        opacity:
            .55;
    }

    50% {

        transform:
            scale(1.08);

        opacity:
            1;
    }
}


@keyframes rotateRing {

    from {
        transform:
            rotate(0deg);
    }

    to {
        transform:
            rotate(360deg);
    }
}


@keyframes rotateRingReverse {

    from {
        transform:
            rotate(360deg);
    }

    to {
        transform:
            rotate(0deg);
    }
}


@keyframes avatarFloat {

    0%,
    100% {

        transform:
            translateY(0);
    }

    50% {

        transform:
            translateY(-6px);
    }
}


@keyframes eyeBlink {

    0%,
    44%,
    48%,
    100% {

        transform:
            scaleY(1);
    }

    46% {

        transform:
            scaleY(.15);
    }
}


@keyframes speak {

    0%,
    100% {

        transform:
            translateX(-50%)
            scaleX(.8);
    }

    50% {

        transform:
            translateX(-50%)
            scaleX(1.2);
    }
}


@keyframes wave {

    from {

        height:
            5px;
    }

    to {

        height:
            21px;
    }
}


@keyframes messageIn {

    from {

        opacity:
            0;

        transform:
            translateY(7px);
    }

    to {

        opacity:
            1;

        transform:
            translateY(0);
    }
}


@keyframes blink {

    0%,
    100% {
        opacity:
            1;
    }

    50% {
        opacity:
            0;
    }
}


@keyframes themeIconFloat {

    0% {

        transform:
            scale(1)
            rotate(0);
    }

    50% {

        transform:
            scale(1.12)
            rotate(12deg);
    }

    100% {

        transform:
            scale(1)
            rotate(0);
    }
}


@keyframes popupIconIn {

    from {

        opacity:
            0;

        transform:
            scale(.6)
            rotate(-12deg);
    }

    to {

        opacity:
            1;

        transform:
            scale(1)
            rotate(0);
    }
}


@keyframes popupOrbit {

    from {

        transform:
            rotate(-25deg);
    }

    to {

        transform:
            rotate(335deg);
    }
}


/* =========================================================
   FOCUS / ACCESSIBILITY
========================================================= */

button:focus-visible,
input:focus-visible {

    outline:
        2px solid
        var(--accent-light);

    outline-offset:
        2px;
}


/* =========================================================
   REDUCED MOTION
========================================================= */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {

        animation-duration:
            .001ms !important;

        animation-iteration-count:
            1 !important;

        scroll-behavior:
            auto !important;
    }
}


/* =========================================================
   TOUCH DEVICES
========================================================= */

@media (hover: none) and (pointer: coarse) {

    .connection-btn:hover,
    .call-control:hover,
    .settings-btn:hover {

        transform:
            none;
    }
}