﻿/* =================~~~~~~~~~~~~~~~~============ */
/* 0. Google Dark Mode Core Variables & Reset    */
/* ============================================= */
:root {
    /* Google Material 3 Dark Theme Colors */
    --md-sys-color-background: #121212;
    /* Deep dark background */
    --md-sys-color-surface: #1E1E1E;
    /* Slightly lighter surface */
    --md-sys-color-surface-variant: #2C2C2C;
    /* UI Elements background */

    --md-sys-color-primary: #A8C7FA;
    /* Google Blue (Light) */
    --md-sys-color-on-primary: #002F6C;
    --md-sys-color-primary-container: #0047AB;
    --md-sys-color-on-primary-container: #D6E3FF;

    --md-sys-color-secondary: #C4C6D0;
    --md-sys-color-on-surface: #E3E3E3;
    /* Primary Text */
    --md-sys-color-on-surface-variant: #C4C7C5;
    /* Secondary Text */

    --md-sys-color-error: #FFB4AB;
    --md-sys-color-error-container: #93000A;

    --radius-small: 8px;
    --radius-medium: 16px;
    --radius-large: 24px;
    --radius-full: 9999px;

    --font-google: 'Roboto', 'Google Sans', sans-serif;
}

/* Base Body Styles */
body {
    margin: 0;
    font-family: var(--font-google);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background-color: var(--md-sys-color-background);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    color: var(--md-sys-color-on-surface);
    overflow: hidden;
}

/* ============================================= */
/* 1. App Container (Full Screen Mobile)         */
/* ============================================= */
#ezxai-app-container {
    width: 100%;
    height: 100vh;
    background-color: var(--md-sys-color-background);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* 澶撮儴 Header & 瀵艰埅 Nav-tabs */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background-color: var(--md-sys-color-background);
    /* Seamless header */
    flex-shrink: 0;
    z-index: 10;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--md-sys-color-surface-variant);
    background-image: url('https://ui-avatars.com/api/?name=User&background=random');
    /* Placeholder */
    background-size: cover;
    cursor: pointer;
}

.user-avatar::before {
    content: '';
}

/* Remove text placeholder */

.nav-tabs {
    display: flex;
    gap: 20px;
    font-size: 16px;
    font-weight: 500;
}

.nav-tab {
    color: var(--md-sys-color-on-surface-variant);
    cursor: pointer;
    position: relative;
    transition: color 0.2s;
}

.nav-tab.active {
    color: var(--md-sys-color-on-surface);
}

.nav-tab.active::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--md-sys-color-primary);
    border-radius: 2px;
}

.notification-bell {
    position: relative;
    font-size: 1.2em;
    color: var(--md-sys-color-on-surface-variant);
    cursor: pointer;
    padding: 8px;
}

.notification-bell .badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background-color: var(--md-sys-color-error);
    border: 2px solid var(--md-sys-color-background);
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

/* ============================================= */
/* 2. Chat Area & Bubbles                       */
/* ============================================= */
.chat-area {
    flex-grow: 1;
    overflow-y: scroll;
    padding: 15px;
    background-color: var(--ios-dark-bg-level2);
    display: flex;
    flex-direction: column;
    position: relative;
}

.message-bubble {
    z-index: 1;
    position: relative;
    width: calc(100% - 6px);
    /* Full width minus 3px margin on each side */
    margin-left: 3px;
    margin-right: 3px;
    padding: 12px 16px;
    border-radius: var(--radius-medium);
    margin-bottom: 8px;
    line-height: 1.5;
    word-wrap: break-word;
    color: var(--md-sys-color-on-surface);
    font-size: 16px;
    box-sizing: border-box;
}

.user-message {
    align-self: center;
    background-color: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    border-radius: var(--radius-large) var(--radius-small) var(--radius-large) var(--radius-large);
}

.ai-message {
    display: flex;
    flex-direction: column;
    align-self: center;
    background-color: var(--md-sys-color-surface-variant);
    border-radius: var(--radius-small) var(--radius-large) var(--radius-large) var(--radius-large);
    color: var(--md-sys-color-on-surface);
}

.ai-message.message-error {
    background-color: var(--md-sys-color-error-container);
    color: var(--md-sys-color-error);
}

.ai-message .ai-marker {
    display: none;
}

/* Hide marker for cleaner look */

.ai-content {
    width: 100%;
}

/* Action Bar Styles */
.message-actions {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.action-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 14px;
    padding: 4px;
    transition: color 0.2s;
}

.action-btn:hover {
    color: var(--md-sys-color-primary);
}

/* Markdown 浼樺寲 */
.ai-message code {
    background-color: rgba(120, 120, 128, 0.3);
    border-radius: var(--radius-small);
    padding: 2px 5px;
    font-size: .95em;
    font-family: Menlo, Monaco, Consolas, "Courier New", monospace, monospace;
    color: var(--ios-dark-text-primary);
}

.ai-message pre {
    background-color: rgba(120, 120, 128, 0.2);
    border-radius: var(--radius-medium);
    padding: 10px;
    margin: 8px 0;
    overflow-x: auto;
    white-space: pre-wrap;
    color: var(--ios-dark-text-primary);
    border: 0.5px solid var(--ios-dark-border-translucent);
}

.ai-message pre code {
    background: none;
    padding: 0;
}

.ai-message ul,
.ai-message ol {
    padding-inline-start: 22px;
    margin-top: 5px;
    margin-bottom: 5px;
    color: var(--ios-dark-text-primary);
}

.ai-message li {
    margin-bottom: 3px;
}

/* AI 鎬濊€冩寚绀哄櫒 */
.ai-thinking {
    align-self: flex-start;
    z-index: 1;
    color: var(--ios-dark-text-secondary);
    padding: 8px 12px;
    font-style: italic;
    font-size: 0.9em;
}

.ai-thinking i {
    /* 鍏抽敭锛氳缃浉瀵瑰畾浣嶏紝鍏佽 children 鍏冪礌浣跨敤 fixed 瀹氫綅骞朵互 App Container 涓哄弬鑰冪偣 */
    position: relative;
}

#xiaoling-avatar-container {
    width: 280px;
    height: 280px;
    /* FIX: 瀹氫綅绛栫暐 - FIXED to viewport, aligned to Parent (.ezxai-app-container) */
    position: fixed;
    /* 1. 纭繚鍦ㄧ獎灞忎笂涔熻兘澶熷眳涓細璺濈灞忓箷椤堕儴鐨勭櫨鍒嗘瘮/楂樺害 */
    top: calc(50% - 140px);
    /* Adjust to middle half of vertical screen */
    left: 50%;
    /* Start at center of viewport */

    display: block;
    opacity: 0.35;
    transition: opacity 0.8s ease, transform 1s ease;
    z-index: 0;

    /* 2. 鏈€閲嶈鐨勪慨姝ｏ細浣跨敤 translateX 鏉ヨˉ鍋垮浐瀹氬畾浣嶅甫鏉ョ殑瑙嗗彛灞呬腑閿欎綅 */
    transform: translateX(-50%);

    /* ********* 
       FIX D3: 鍙湁褰撴暣涓鍣ㄨ秴杩?min-width / max-width 鏃舵墠闇€瑕佸鏉傜殑 fixed/calc 绛栫暐 
       浣嗗鏋滀綘鍦?Chrome 绛夋祻瑙堝櫒璋冭瘯鏃跺簲鐢?`left: 50%; transform: translateX(-50%);` 鏄畬缇庣殑灞呬腑銆?       鎴戜滑绉婚櫎鏃嬭浆鍔ㄧ敾涓殑 `translate(-50%)` 鍙傛暟锛屽彧淇濈暀涓€涓紝閬垮厤鍙犲姞瀵艰嚧褰㈠彉銆?    */
}

/* 瑙ｅ喅鍥哄畾瀹氫綅鍦ㄥ睆骞曚腑蹇冩椂濡傛灉 App瀹瑰櫒涓嶅湪宸﹁竟璧风偣鐨勬樉绀洪棶棰?*/
@media screen and (min-width: 451px) {
    #xiaoling-avatar-container {
        /* 褰?App 瀹瑰櫒灞呬腑 (max-width: 450px) 鏃讹紝 fixed 瀹氫綅闇€瑕佸湪姘村钩鏂瑰悜杩涜淇 */
        left: calc(50% + 0px);
        /* 50% 灞忓箷浣嶇疆锛?App Container 鐨勫彸杈圭晫锛?*/
        transform: translate(calc(-50% - (var(--max-width, 450px) - 140px) / 2), 0);
        /* 鐢变簬姝ゅ鐨?CSS 鐜鏈夐檺锛岄噰鐢ㄩ粯璁ょ殑 full screen灞呬腑 + 閫忔槑搴︽ā寮忥紝涓嶈繘琛岃闆滅殑 media query 閫傞厤 */
    }
}

#xiaoling-avatar-container.hidden {
    opacity: 0 !important;
    /* 淇浜唗ransform灞炴€э紝閬垮厤鍜屽姩鐢讳簰鐩稿啿绐?*/
    transform: translate(-50%, 0) scale(0.6);
}

.xiaoling-orb {
    position: absolute;
    /* 淇鍦嗚鍙樻垚鏂瑰潡鐨勬牳蹇冿細闇€瑕?box-sizing 鍜岀‘淇濊竟鐣岃冻澶燂紝浣嗛€氬父 border-radius 100% 瓒冲 */
    border-radius: 100%;
    opacity: 0.8;
    filter: blur(85px);
    /* 杩涗竴姝ュ寮烘ā绯婏紝娑堥櫎纭竟 */
    pointer-events: none;
}

/* 棰滆壊鍜屼綅缃井璋?*/
.xiaoling-orb.orb1 {
    width: 220px;
    height: 220px;
    background: radial-gradient(circle at 30% 30%, #4A70D7f0, #323F7050);
    top: -20px;
    left: -20px;
}

/* 澧炲己閫忔槑搴﹀拰鎵╂暎 */
.xiaoling-orb.orb2 {
    width: 200px;
    height: 200px;
    background: radial-gradient(circle at 70% 70%, #7653A9f0, #492E7350);
    top: 50px;
    right: -20px;
}

.xiaoling-orb.orb3 {
    width: 170px;
    height: 170px;
    background: radial-gradient(circle at 50% 50%, #afc7fbf0, #7d96ed50);
    bottom: -20px;
    left: 30%;
}

/* 鐘舵€佸姩鐢诲井璋冿細绉婚櫎鍔ㄧ敾涓 translateZ 鐨勫彲鑳藉啿绐侊紝鍙鐞嗘棆杞拰缂╂斁 */
@keyframes cont-float {
    0% {
        transform: translateX(-50%) rotate(0deg);
        opacity: 0.35;
    }

    100% {
        transform: translateX(-50%) rotate(-360deg);
        opacity: 0.35;
    }

    /* 纭繚灞呬腑涓€鐩村瓨鍦?*/
}

@keyframes orb-flow {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.05);
        opacity: 0.9;
    }
}

@keyframes thinking-pulse {
    0% {
        transform: scale(1);
        filter: blur(85px);
    }

    50% {
        transform: scale(0.9);
        opacity: 0.85;
        filter: blur(110px);
    }
}

@keyframes output-burst {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.6;
    }

    50% {
        transform: scale(1.08);
        opacity: 0.6;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0.2;
    }

    to {
        opacity: 1;
    }
}

#xiaoling-avatar-container.state-idle {
    animation: cont-float 70s linear infinite;
    opacity: 0.35;
}

/* 浣跨敤鎴戜滑淇灞呬腑鐨勫姩鐢诲悕绉?*/
#xiaoling-avatar-container.state-idle .xiaoling-orb {
    animation: orb-flow 15s ease-in-out infinite alternate;
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.05);
}

/* 娉ㄦ剰锛氬湪 state-thinking/outputting 鏃讹紝transform 闇€瑕佸彔鍔犳垨瑕嗙洊鏂扮殑杩愬姩 */
#xiaoling-avatar-container.state-thinking {
    animation: none;
    /* 绂佺敤鍩虹鑷棆 */
    opacity: 0.55;
    transform: translateX(-50%);
}

#xiaoling-avatar-container.state-thinking .xiaoling-orb {
    animation: thinking-pulse 1.5s ease-out infinite alternate;
    box-shadow: 0 0 30px rgba(10, 132, 255, 0.5);
}

#xiaoling-avatar-container.state-outputting {
    animation: none;
    /* 绂佺敤鍩虹鑷棆 */
    opacity: 0.6;
    transform: translateX(-50%);
}

#xiaoling-avatar-container.state-outputting .xiaoling-orb {
    animation: fadeIn 0.5s ease-out forwards;
    box-shadow: 0 0 35px rgba(10, 132, 255, 0.7), 0 0 15px rgba(255, 255, 255, 0.4);
}



/* ============================================= */
/* 6. Memory Modal Styles 锛堜繚鎸佷笂姝ヤ慨澶嶇粨鏋滐級     */
/* ============================================= */
.modal-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    pointer-events: none;
    visibility: hidden;
}

/* Modal Content and components styles are truncated here for brevity but remain identical to the previous step. */
.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(var(--ios-dark-glass-blur-strength));
    opacity: 0;
    transition: opacity .3s cubic-bezier(0.2, 0, 0, 1);
}

.modal-content {
    background-color: var(--md-sys-color-surface);
    margin: 5% auto;
    padding: 0;
    width: 90%;
    max-width: 600px;
    height: 80%;
    border-radius: var(--radius-large);
    position: relative;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--md-sys-color-outline-variant);
    overflow: hidden;
    /* Ensure content stays within rounded corners */
    transform: translateY(110%);
    transition: transform .4s cubic-bezier(0.23, 1, 0.32, 1);
}

.modal-container.active {
    pointer-events: auto;
    visibility: visible
}

.modal-container.active .modal-overlay {
    opacity: 1
}

.modal-container.active .modal-content {
    transform: translateY(0)
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: top;
    padding: 18px 20px 10px;
    background-color: var(--ios-dark-bg-level3);
    border-bottom: none;
    flex-shrink: 0;
}

.modal-header h3 {
    font-size: 1.4em;
    font-weight: 700;
    color: var(--ios-dark-text-primary);
    margin: 0;
}

.close-modal-button {
    background: none;
    border: none;
    font-weight: 300;
    color: var(--ios-dark-text-secondary);
    font-size: 2.8em;
    line-height: 1;
    cursor: pointer;
    position: relative;
    top: -5px;
    right: -5px;
    padding: 5px;
    transition: color 0.2s;
}

.close-modal-button:hover {
    color: var(--ios-dark-text-primary);
    transform: rotate(5deg) scale(1.1);
}

.modal-tabs {
    display: flex;
    justify-content: flex-start;
    padding: 0 20px;
    background-color: var(--ios-dark-bg-level2);
    border-bottom: 1px solid var(--ios-dark-separator-line);
    flex-shrink: 0;
}

.modal-tab-button {
    background: none;
    border: none;
    outline: none;
    padding: 10px 15px;
    margin-right: 15px;
    color: var(--ios-dark-text-secondary);
    font-size: 1.05em;
    font-weight: 600;
    border-bottom: 3px solid transparent;
    transition: all 0.2s ease-out;
    cursor: pointer;
}

.modal-tab-button.active {
    color: var(--ios-dark-text-primary);
    border-bottom-color: var(--ios-dark-accent-blue);
}

.modal-body {
    padding: 0 20px;
    overflow-y: auto;
    flex-grow: 1;
}

#profile-form {
    display: flex;
    flex-direction: column;
}

.form-group {
    margin-bottom: 18px;
    display: flex;
    flex-direction: column;
}

#profile-form label {
    margin-bottom: 6px;
    font-size: 0.9em;
    font-weight: 500;
    color: var(--ios-dark-text-secondary);
}

#profile-form input[type=text],
#profile-form input[type=number],
#profile-form textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--ios-dark-border-translucent);
    border-radius: var(--radius-small);
    font-size: 1em;
    color: var(--ios-dark-text-primary);
    background-color: var(--ios-dark-bg-level3);
    box-sizing: border-box;
}

#profile-form input:focus,
#profile-form textarea:focus {
    border-color: var(--ios-dark-accent-blue);
    background-color: var(--ios-dark-bg-level4-float);
    box-shadow: 0 0 0 1px var(--ios-dark-accent-blue);
    outline: none;
}

#save-profile-button {
    background-color: var(--ios-dark-accent-blue);
    color: var(--ios-dark-text-primary);
    border: none;
    border-radius: var(--radius-medium);
    font-size: 1.1em;
    padding: 14px;
    margin: 25px 0 10px;
}

/* 鑱婂ぉ鍘嗗彶璁板綍鏍峰紡 */
.history-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.history-list .chat-turn-item {
    border-bottom: 1px dashed var(--ios-dark-separator-line);
    padding-bottom: 20px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
}

.history-list .chat-message-item {
    display: flex;
    align-items: flex-start;
    margin-bottom: 10px;
    max-width: 90%;
    font-size: 0.9em;
}

.history-list .sender-user {
    margin-left: auto;
    flex-direction: row-reverse;
}

.history-list .message-content {
    max-width: 78%;
    padding: 10px 13px;
    border-radius: var(--radius-bubble);
    line-height: 1.4;
    box-shadow: 0 0 0 0.5px var(--ios-dark-border-translucent);
    color: var(--ios-dark-text-primary);
}

.history-list .sender-user .message-content {
    background-color: var(--ios-dark-accent-blue);
    border-radius: var(--radius-bubble) var(--radius-bubble) calc(var(--radius-bubble) - 4px) var(--radius-bubble);
}

.history-list .custom-placeholder,
.history-list .custom-error {
    text-align: center;
    padding: 20px 0;
    color: var(--ios-dark-text-secondary);
}

.history-list .turn-header {
    display: flex;
    justify-content: center;
    margin-bottom: 10px;
    font-size: 0.75em;
    color: var(--ios-dark-text-secondary);
}

.history-list .turn-header span {
    background: var(--md-sys-color-surface-variant);
    padding: 2px 8px;
    border-radius: var(--radius-small);
}

/* Persona Modal Styles */
.persona-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-bottom: 70px;
    /* Space for sticky button */
}

.persona-item {
    background-color: var(--md-sys-color-surface-variant);
    border-radius: var(--radius-medium);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
}

.persona-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    color: var(--md-sys-color-on-surface-variant);
    font-weight: 500;
}

.persona-item-content {
    font-size: 16px;
    color: var(--md-sys-color-on-surface);
    border: none;
    background: transparent;
    width: 100%;
    font-family: var(--font-google);
    resize: none;
}

.persona-item-content:focus {
    outline: none;
    border-bottom: 1px solid var(--md-sys-color-primary);
}

.persona-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 8px;
}

.persona-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    color: var(--md-sys-color-primary);
}

.persona-btn.delete {
    color: var(--md-sys-color-error);
}

.ability-toggle {
    background-color: var(--md-sys-color-surface-variant);
    color: var(--md-sys-color-on-surface-variant);
    border: 1px solid var(--md-sys-color-outline);
    border-radius: 20px;
    padding: 6px 16px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 50px;
}

.ability-toggle.active {
    background-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    border-color: var(--md-sys-color-primary);
}

.ability-toggle:hover {
    opacity: 0.8;
}

/* Ability Card Styles */
.ability-card {
    background-color: var(--md-sys-color-surface-variant);
    border-radius: var(--radius-medium);
    padding: 16px;
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ability-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ability-card-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 500;
    color: var(--md-sys-color-on-surface);
}

.ability-card-title i {
    font-size: 18px;
    color: var(--md-sys-color-primary);
}

.ability-card-description {
    font-size: 14px;
    color: var(--md-sys-color-on-surface-variant);
    line-height: 1.4;
}

.ability-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.add-item-button {
    position: sticky;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 15px;
    background-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    border: none;
    border-radius: 0;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.add-item-button:hover {
    background-color: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
}

/* Xiaoling Avatar Halo Animation */
#xiaoling-avatar-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    height: 200px;
    pointer-events: none;
    z-index: 0;
}

.xiaoling-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(40px);
    opacity: 0.6;
}

.xiaoling-orb.orb1 {
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, rgba(10, 132, 255, 0.8), rgba(10, 132, 255, 0));
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: pulse-orb1 4s ease-in-out infinite;
}

.xiaoling-orb.orb2 {
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, rgba(168, 199, 250, 0.6), rgba(168, 199, 250, 0));
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: pulse-orb2 3s ease-in-out infinite 0.5s;
}

.xiaoling-orb.orb3 {
    width: 80px;
    height: 80px;
    background: radial-gradient(circle, rgba(100, 181, 246, 0.5), rgba(100, 181, 246, 0));
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: pulse-orb3 3.5s ease-in-out infinite 1s;
}

@keyframes pulse-orb1 {

    0%,
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.6;
    }

    50% {
        transform: translate(-50%, -50%) scale(1.3);
        opacity: 0.8;
    }
}

@keyframes pulse-orb2 {

    0%,
    100% {
        transform: translate(-50%, -50%) scale(1) rotate(0deg);
        opacity: 0.5;
    }

    50% {
        transform: translate(-50%, -50%) scale(1.4) rotate(180deg);
        opacity: 0.7;
    }
}

@keyframes pulse-orb3 {

    0%,
    100% {
        transform: translate(-50%, -50%) scale(1) rotate(0deg);
        opacity: 0.4;
    }

    50% {
        transform: translate(-50%, -50%) scale(1.5) rotate(-180deg);
        opacity: 0.6;
    }
}

#xiaoling-avatar-container.state-thinking .xiaoling-orb {
    animation-duration: 2s;
}

#xiaoling-avatar-container.state-responding .xiaoling-orb {
    animation-duration: 1.5s;
}

/* Video Mode Overlay */
.video-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.video-overlay.hidden-overlay {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}


/* Modal Tabs Logic */
.modal-tab-content {
    display: none;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
}

.modal-tab-content.active {
    display: flex;
}

/* User Profile Form Styles */
#profile-content {
    padding-bottom: 60px;
    /* Space for sticky button */
    position: relative;
}

#save-profile-button {
    position: sticky;
    bottom: 0;
    left: 0;
    width: 100%;
    margin-top: auto;
    padding: 15px;
    background-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    border: none;
    font-size: 16px;
    font-weight: 500;
    text-align: center;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
    z-index: 10;
    border-radius: 0;
    /* Full width */
}

/* History List Styles */
.history-list {
    list-style: none;
    padding: 0;
    margin: 0;
    padding-bottom: 70px;
    /* Space for sticky button */
}

.history-session-item {
    background-color: var(--md-sys-color-surface-variant);
    margin-bottom: 10px;
    padding: 15px;
    border-radius: var(--radius-medium);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.2s;
}

.history-session-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.session-info {
    flex: 1;
}

.session-date {
    font-size: 12px;
    color: var(--md-sys-color-on-surface-variant);
    margin-bottom: 4px;
}

.session-preview {
    font-size: 14px;
    color: var(--md-sys-color-on-surface);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.session-delete-btn {
    background: none;
    border: none;
    color: var(--md-sys-color-error);
    padding: 8px;
    font-size: 16px;
    cursor: pointer;
    margin-left: 10px;
}

.session-delete-btn:hover {
    opacity: 0.8;
}

.sticky-bottom-button {
    position: sticky;
    bottom: 0;
    left: 0;
    width: 100%;
    margin-top: auto;
    padding: 15px;
    background-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    border: none;
    font-size: 16px;
    font-weight: 500;
    text-align: center;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
    z-index: 10;
    border-radius: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.video-container {
    flex: 1;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.remote-video {
    text-align: center;
    color: white;
}

.avatar-large-display {
    position: relative;
    width: 150px;
    height: 150px;
    margin: 0 auto 20px;
}

.avatar-large-display img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    position: relative;
    z-index: 2;
}

.pulsing-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(10, 132, 255, 0.3);
    animation: pulse-ring 2s infinite;
    z-index: 1;
}

@keyframes pulse-ring {
    0% {
        width: 100%;
        height: 100%;
        opacity: 0.8;
    }

    100% {
        width: 200%;
        height: 200%;
        opacity: 0;
    }
}

.connection-status {
    font-size: 18px;
    font-weight: 500;
    opacity: 0.8;
}

.local-video-preview {
    position: absolute;
    bottom: 120px;
    right: 20px;
    width: 100px;
    height: 140px;
    background-color: #333;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.2);
    display: flex;
    justify-content: center;
    align-items: center;
}

.camera-placeholder {
    font-size: 40px;
    color: #666;
}

.video-controls {
    padding: 30px;
    display: flex;
    justify-content: center;
    gap: 30px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
}

.control-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 24px;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
}

.control-btn:active {
    background-color: rgba(255, 255, 255, 0.4);
}

.control-btn.end-call {
    background-color: #ff3b30;
    width: 70px;
    height: 70px;
}

.control-btn.end-call:active {
    background-color: #d70015;
}

/* ============================================= */
/* 鐐僵浜戦浘绮掑瓙杈圭紭鏁堟灉                          */
/* ============================================= */
.breathing-border {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.8s ease-in-out;
    overflow: hidden;
}

/* 婵€娲荤姸鎬?*/
.breathing-border.active {
    opacity: 1;
}

/* 椤堕儴浜戦浘绮掑瓙鏁堟灉 */
.breathing-border::before {
    content: '';
    position: absolute;
    top: -2.5px;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg,
            rgba(255, 0, 255, 0.9),
            rgba(0, 255, 255, 0.9),
            rgba(255, 255, 0, 0.9),
            rgba(0, 255, 0, 0.9),
            rgba(255, 0, 255, 0.9));
    background-size: 300% 100%;
    filter: blur(12px);
    animation: cloud-flow-top 4s ease-in-out infinite, breathing-fade 3s ease-in-out infinite;
    opacity: 0.85;
}

/* 搴曢儴浜戦浘绮掑瓙鏁堟灉 */
.breathing-border::after {
    content: '';
    position: absolute;
    bottom: -2.5px;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg,
            rgba(0, 255, 255, 0.9),
            rgba(255, 0, 255, 0.9),
            rgba(0, 255, 0, 0.9),
            rgba(255, 255, 0, 0.9),
            rgba(0, 255, 255, 0.9));
    background-size: 300% 100%;
    filter: blur(12px);
    animation: cloud-flow-bottom 4s ease-in-out infinite reverse, breathing-fade 3s ease-in-out infinite 0.5s;
    opacity: 0.85;
}

/* 浜戦浘娴佸姩鍔ㄧ敾 - 椤堕儴 */
@keyframes cloud-flow-top {

    0%,
    100% {
        background-position: 0% 50%;
        transform: translateY(0) scaleX(1);
    }

    50% {
        background-position: 100% 50%;
        transform: translateY(10px) scaleX(1.1);
    }
}

/* 浜戦浘娴佸姩鍔ㄧ敾 - 搴曢儴 */
@keyframes cloud-flow-bottom {

    0%,
    100% {
        background-position: 0% 50%;
        transform: translateY(0) scaleX(1);
    }

    50% {
        background-position: 100% 50%;
        transform: translateY(-10px) scaleX(1.1);
    }
}

/* 鍛煎惛娣″叆娣″嚭 */
@keyframes breathing-fade {

    0%,
    100% {
        opacity: 0.75;
        filter: blur(12px) brightness(1);
    }

    50% {
        opacity: 0.95;
        filter: blur(10px) brightness(1.5);
    }
}

/* 宸︿晶浜戦浘绮掑瓙鏁堟灉 */
.cloud-left {
    position: absolute;
    left: -2.5px;
    top: 0;
    bottom: 0;
    width: 5px;
    background: linear-gradient(180deg,
            rgba(255, 0, 255, 0.9),
            rgba(0, 255, 255, 0.9),
            rgba(0, 255, 0, 0.9),
            rgba(255, 255, 0, 0.9),
            rgba(255, 0, 255, 0.9));
    background-size: 100% 300%;
    filter: blur(12px);
    animation: cloud-flow-left 4.5s ease-in-out infinite, breathing-fade 3s ease-in-out infinite 1s;
    opacity: 0.85;
}

/* 鍙充晶浜戦浘绮掑瓙鏁堟灉 */
.cloud-right {
    position: absolute;
    right: -2.5px;
    top: 0;
    bottom: 0;
    width: 5px;
    background: linear-gradient(180deg,
            rgba(0, 255, 255, 0.9),
            rgba(255, 0, 255, 0.9),
            rgba(255, 255, 0, 0.9),
            rgba(0, 255, 0, 0.9),
            rgba(0, 255, 255, 0.9));
    background-size: 100% 300%;
    filter: blur(12px);
    animation: cloud-flow-right 4.5s ease-in-out infinite reverse, breathing-fade 3s ease-in-out infinite 1.5s;
    opacity: 0.85;
}

/* 浜戦浘娴佸姩鍔ㄧ敾 - 宸︿晶 */
@keyframes cloud-flow-left {

    0%,
    100% {
        background-position: 50% 0%;
        transform: translateX(0) scaleY(1);
    }

    50% {
        background-position: 50% 100%;
        transform: translateX(10px) scaleY(1.1);
    }
}

/* 浜戦浘娴佸姩鍔ㄧ敾 - 鍙充晶 */
@keyframes cloud-flow-right {

    0%,
    100% {
        background-position: 50% 0%;
        transform: translateX(0) scaleY(1);
    }

    50% {
        background-position: 50% 100%;
        transform: translateX(-10px) scaleY(1.1);
    }
}

/* Toast 鎻愮ず妗嗘牱寮?*/
.toast-notification {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background-color: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 12px 24px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 500;
    z-index: 10000;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
}

.toast-notification.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* X撟Uv_5pEx=v噒=?Q頪-Wes蛽餦!} */
.session-detail-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.session-detail-modal.active {
    opacity: 1;
}

.session-detail-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
}

.session-detail-content {
    position: relative;
    background-color: var(--md-sys-color-surface);
    border-radius: var(--radius-large);
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.session-detail-modal.active .session-detail-content {
    transform: scale(1);
}

.session-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.session-detail-header h3 {
    margin: 0;
    font-size: 1.3em;
    color: var(--md-sys-color-on-surface);
}

.close-detail-btn {
    background: none;
    border: none;
    font-size: 2em;
    color: var(--md-sys-color-on-surface-variant);
    cursor: pointer;
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.close-detail-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    transform: rotate(90deg);
}

.session-detail-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.detail-info {
    background-color: var(--md-sys-color-surface-variant);
    border-radius: var(--radius-medium);
    padding: 15px;
    margin-bottom: 20px;
}

.detail-info>div {
    margin-bottom: 8px;
    font-size: 0.95em;
    color: var(--md-sys-color-on-surface-variant);
}

.detail-info>div:last-child {
    margin-bottom: 0;
}

.detail-messages {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.detail-message {
    border-radius: var(--radius-medium);
    padding: 12px;
}

.user-detail {
    background-color: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    margin-left: 20px;
}

.ai-detail {
    background-color: var(--md-sys-color-surface-variant);
    color: var(--md-sys-color-on-surface);
    margin-right: 20px;
}

.detail-sender {
    font-size: 0.85em;
    font-weight: 600;
    margin-bottom: 6px;
    opacity: 0.8;
}

.detail-text {
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.session-detail-footer {
    padding: 15px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: flex-end;
}

.restore-detail-btn {
    background-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 1em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.restore-detail-btn:hover {
    background-color: var(--md-sys-color-primary-container);
    transform: scale(1.05);
}

/* X撟Uv_|m3l=vW?朮瞤馷 */
.session-info {
    flex: 1;
    cursor: pointer;
}

.session-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.session-stats {
    font-size: 11px;
    color: var(--md-sys-color-on-surface-variant);
    opacity: 0.7;
}

.session-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.session-view-btn {
    background: none;
    border: none;
    color: var(--md-sys-color-primary);
    padding: 8px;
    font-size: 16px;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.2s;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.session-view-btn:hover {
    background-color: rgba(168, 199, 250, 0.1);
    transform: scale(1.1);
}

/* ============================================= */
/* 闊充箰鎾斁鍣ㄦ牱寮?                               */
/* ============================================= */

/* 杩蜂綘鎾斁鍣?- 鎮诞搴曢儴 */
/* ===== 闊充箰鎾斁鍣ㄦ牱寮?===== */

/* 瀹屾暣鎾斁鍣?*/
.music-player {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 380px;
    background: linear-gradient(135deg, rgba(26, 26, 46, 0.95), rgba(46, 26, 46, 0.95));
    backdrop-filter: blur(20px);
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.1);
    z-index: 1500;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.music-player.hidden {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
}

/* 鎾斁鍣ㄥご閮?*/
.player-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.player-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.player-header h3 i {
    color: #a78bfa;
}

.player-header-actions {
    display: flex;
    gap: 8px;
}

.minimize-btn,
.close-player-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.minimize-btn:hover {
    background: rgba(168, 139, 250, 0.3);
    transform: scale(1.1);
}

.close-player-btn:hover {
    background: rgba(239, 68, 68, 0.3);
    transform: scale(1.1);
}

/* 鎾斁鍣ㄤ富浣?*/
.player-body {
    padding: 24px 20px;
}

/* 涓撹緫灏侀潰/鍏夌 */
.album-cover-container {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
}

.album-cover {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 40px rgba(102, 126, 234, 0.4);
    position: relative;
}

.album-cover i {
    font-size: 80px;
    color: rgba(255, 255, 255, 0.9);
}

/* 鏃嬭浆鍔ㄧ敾 */
.rotating {
    animation: rotate 10s linear infinite;
}

.rotating.paused {
    animation-play-state: paused;
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* 姝屾洸淇℃伅 */
.song-info {
    text-align: center;
    margin-bottom: 20px;
}

.song-title {
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.song-artist {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
}

/* 杩涘害鏉?*/
.progress-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.current-time,
.total-time {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    min-width: 40px;
}

.progress-bar-wrapper {
    flex: 1;
    position: relative;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.seek-bar {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.progress-fill {
    position: absolute;
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 3px;
    width: 0%;
    transition: width 0.1s linear;
    pointer-events: none;
}

/* 鎺у埗鎸夐挳 */
.player-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.player-controls button {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.play-btn {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
}

.player-controls button:hover {
    transform: scale(1.1);
    background: rgba(255, 255, 255, 0.2);
}

.play-btn:hover {
    background: linear-gradient(135deg, #7c8ff0, #8b5bb8);
    box-shadow: 0 12px 32px rgba(102, 126, 234, 0.6);
}

.mode-btn.active {
    color: #a78bfa;
}

/* 闊抽噺鎺у埗 */
.volume-control {
    margin-bottom: 20px;
    padding: 0 10px;
    transition: all 0.3s;
}

.volume-control.hidden {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
}

.volume-bar {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
    -webkit-appearance: none;
}

.volume-bar::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #a78bfa;
    cursor: pointer;
}

/* 鎾斁鍒楄〃 */
.playlist-container {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 16px;
    max-height: 200px;
    overflow-y: auto;
}

.playlist-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
}

.playlist-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.playlist-item {
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 12px;
}

.playlist-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(4px);
}

.playlist-item.active {
    background: linear-gradient(90deg, rgba(102, 126, 234, 0.3), rgba(118, 75, 162, 0.3));
    border-left: 3px solid #a78bfa;
}

.playlist-item-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
}

.playlist-item-info {
    flex: 1;
    overflow: hidden;
}

.playlist-item-name {
    font-size: 14px;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.playlist-item-duration {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
}

/* ===== 绠€鍖栨í鏉℃挱鏀惧櫒 ===== */
.mini-player {
    position: fixed;
    bottom: 70px;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    height: 60px;
    background: linear-gradient(135deg, rgba(26, 26, 46, 0.95), rgba(46, 26, 46, 0.95));
    backdrop-filter: blur(20px);
    border-radius: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1);
    z-index: 1400;
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 12px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.mini-player.hidden {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
    pointer-events: none;
}

/* 绠€鍖栨í鏉?- 鏃嬭浆鍏夌 */
.mini-disc-container {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.mini-disc-container i {
    font-size: 20px;
    color: rgba(255, 255, 255, 0.9);
}

/* 绠€鍖栨í鏉?- 鎺у埗鎸夐挳 */
.mini-player button {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.mini-player button:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.mini-play {
    background: linear-gradient(135deg, #667eea, #764ba2) !important;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* 绠€鍖栨í鏉?- 淇℃伅鍖哄煙 */
.mini-info {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mini-song-name {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mini-lyrics-scroll {
    height: 18px;
    overflow: hidden;
    position: relative;
}

.lyrics-text {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    display: inline-block;
    white-space: nowrap;
    animation: scroll-lyrics 15s linear infinite;
}

@keyframes scroll-lyrics {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-100%);
    }
}

/* 灞曞紑鎸夐挳 */
.expand-btn {
    color: #a78bfa !important;
}

/* 婊氬姩鏉℃牱寮?*/
.playlist-container::-webkit-scrollbar {
    width: 6px;
}

.playlist-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.playlist-container::-webkit-scrollbar-thumb {
    background: rgba(168, 139, 250, 0.5);
    border-radius: 3px;
}

.playlist-container::-webkit-scrollbar-thumb:hover {
    background: rgba(168, 139, 250, 0.7);
}

/* 鍝嶅簲寮忚皟鏁?*/
@media (max-width: 768px) {
    .music-player {
        width: calc(100% - 40px);
        right: 20px;
        left: 20px;
        bottom: 70px;
    }

    .mini-player {
        width: calc(100% - 40px);
        bottom: 10px;
    }
}

/ *   F i l e   P r e v i e w   C o n t a i n e r   * /     . f i l e - p r e v i e w - c o n t a i n e r    {
                 d i s p l a y :    f l e x ;
                 f l e x - w r a p :    w r a p ;
                 g a p :    1 0 p x ;
                 p a d d i n g :    0   1 0 p x ;
                 m a r g i n - b o t t o m :    5 p x ;
                 w i d t h :    1 0 0 % ;
         
}

         . f i l e - p r e v i e w - i t e m    {
                 p o s i t i o n :    r e l a t i v e ;
                 w i d t h :    6 0 p x ;
                 h e i g h t :    6 0 p x ;
                 b o r d e r - r a d i u s :    8 p x ;
                 o v e r f l o w :    h i d d e n ;
                 b o r d e r :    1 p x   s o l i d   r g b a ( 2 5 5 ,    2 5 5 ,    2 5 5 ,    0 . 2 ) ;
                 b a c k g r o u n d - c o l o r :    r g b a ( 0 ,    0 ,    0 ,    0 . 3 ) ;
         
}

         . f i l e - p r e v i e w - i t e m   i m g    {
                 w i d t h :    1 0 0 % ;
                 h e i g h t :    1 0 0 % ;
                 o b j e c t - f i t :    c o v e r ;
         
}

         . f i l e - p r e v i e w - i t e m   . f i l e - i c o n    {
                 w i d t h :    1 0 0 % ;
                 h e i g h t :    1 0 0 % ;
                 d i s p l a y :    f l e x ;
                 a l i g n - i t e m s :    c e n t e r ;
                 j u s t i f y - c o n t e n t :    c e n t e r ;
                 f o n t - s i z e :    2 4 p x ;
                 c o l o r :    v a r ( - - m d - s y s - c o l o r - o n - s u r f a c e ) ;
         
}

         . f i l e - p r e v i e w - r e m o v e    {
                 p o s i t i o n :    a b s o l u t e ;
                 t o p :    2 p x ;
                 r i g h t :    2 p x ;
                 w i d t h :    1 6 p x ;
                 h e i g h t :    1 6 p x ;
                 b a c k g r o u n d - c o l o r :    r g b a ( 0 ,    0 ,    0 ,    0 . 6 ) ;
                 c o l o r :    w h i t e ;
                 b o r d e r - r a d i u s :    5 0 % ;
                 d i s p l a y :    f l e x ;
                 a l i g n - i t e m s :    c e n t e r ;
                 j u s t i f y - c o n t e n t :    c e n t e r ;
                 f o n t - s i z e :    1 0 p x ;
                 c u r s o r :    p o i n t e r ;
                 b o r d e r :    n o n e ;
         
}

         . f i l e - p r e v i e w - r e m o v e : h o v e r    {
                 b a c k g r o u n d - c o l o r :    r g b a ( 2 5 5 ,    0 ,    0 ,    0 . 8 ) ;
         
}

         / *   U p d a t e   i n p u t   w r a p p e r   t o   h a n d l e   s t a c k i n g   * /     . c h a t - i n p u t - c o n t a i n e r    {
                 d i s p l a y :    f l e x ;
                 f l e x - d i r e c t i o n :    c o l u m n ;
                 w i d t h :    1 0 0 % ;
                 b a c k g r o u n d - c o l o r :    v a r ( - - m d - s y s - c o l o r - s u r f a c e ) ;
                 / *   E n s u r e   b a c k g r o u n d   c o v e r s   c o n t e n t   b e h i n d   * /             b o r d e r - r a d i u s :    2 4 p x ;
                 p a d d i n g :    5 p x ;
         
}

         . i n p u t - w r a p p e r    {
                 d i s p l a y :    f l e x ;
                 a l i g n - i t e m s :    c e n t e r ;
                 w i d t h :    1 0 0 % ;
                 g a p :    8 p x ;
         
}

         / *   E n s u r e   t e x t a r e a   g r o w s   c o r r e c t l y   * /     # m e s s a g e - i n p u t    {
                 f l e x :    1 ;
                 m a x - h e i g h t :    1 5 0 p x ;
                 o v e r f l o w - y :    a u t o ;
         
}

         
/* ============================================= */
/* Generated Image Styles                        */
/* ============================================= */

.generated-image-container {
    max-width: 600px;
    margin: 16px 0;
    border-radius: var(--radius-medium);
    overflow: hidden;
    background: var(--md-sys-color-surface-variant);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.generated-image-container:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.generated-image {
    width: 100%;
    height: auto;
    display: block;
    cursor: pointer;
    transition: opacity 0.3s ease;
}

.generated-image:hover {
    opacity: 0.95;
}

.image-info {
    padding: 12px 16px;
    background: var(--md-sys-color-surface);
}

.image-prompt {
    font-size: 14px;
    color: var(--md-sys-color-on-surface);
    margin-bottom: 8px;
    line-height: 1.4;
}

.image-meta {
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: var(--md-sys-color-on-surface-variant);
}

.image-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Image loading animation */
@keyframes imageLoading {

    0%,
    100% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
    }
}

.generated-image[loading="lazy"] {
    animation: imageLoading 1.5s ease-in-out infinite;
}

/* ============================================= */
/* Collapsible Thinking Process and Tool Calls  */
/* ============================================= */

/* Thinking Process Card */
.thinking-card {
    background: var(--md-sys-color-surface-variant);
    border-radius: var(--radius-medium);
    padding: 12px 16px;
    margin: 8px 0;
    cursor: pointer;
    transition: all 0.3s ease;
}

.thinking-card:hover {
    background: #333;
}

.thinking-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.thinking-status {
    flex: 1;
    font-size: 14px;
    color: var(--md-sys-color-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.thinking-icon {
    font-size: 16px;
}

.thinking-toggle {
    font-size: 12px;
    color: var(--md-sys-color-on-surface-variant);
    transition: transform 0.3s ease;
}

.thinking-toggle.expanded {
    transform: rotate(180deg);
}

.thinking-progress {
    height: 4px;
    background: var(--md-sys-color-surface);
    border-radius: 2px;
    margin-top: 8px;
    overflow: hidden;
}

.thinking-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--md-sys-color-primary), #0A84FF);
    transition: width 0.3s ease;
    animation: progressPulse 1.5s ease-in-out infinite;
}

@keyframes progressPulse {

    0%,
    100% {
        opacity: 0.8;
    }

    50% {
        opacity: 1;
    }
}

.thinking-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    opacity: 0;
}

.thinking-content.expanded {
    max-height: 500px;
    overflow-y: auto;
    margin-top: 12px;
    opacity: 1;
    padding-top: 8px;
    border-top: 1px solid var(--md-sys-color-surface);
}

.thinking-text {
    font-size: 13px;
    line-height: 1.6;
    color: var(--md-sys-color-on-surface-variant);
    white-space: pre-wrap;
}

/* Tool Calls Card */
.tool-calls-card {
    background: var(--md-sys-color-surface-variant);
    border-radius: var(--radius-medium);
    padding: 12px 16px;
    margin: 8px 0;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tool-calls-card:hover {
    background: #333;
}

.tool-calls-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.tool-calls-summary {
    font-size: 14px;
    color: var(--md-sys-color-on-surface);
}

.tool-calls-list {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    opacity: 0;
}

.tool-calls-list.expanded {
    max-height: 400px;
    overflow-y: auto;
    margin-top: 12px;
    opacity: 1;
}

.tool-call-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    font-size: 14px;
    color: var(--md-sys-color-on-surface-variant);
}

.tool-call-icon {
    width: 20px;
    height: 20px;
    font-size: 16px;
}

.tool-call-status {
    color: #4CAF50;
    margin-right: 4px;
}

.tool-call-name {
    flex: 1;
}

/* Completed State */
.thinking-card.completed .thinking-status {
    color: #4CAF50;
}

.thinking-card.completed .thinking-progress {
    display: none;
}


/* ============================================= */
/* 15. Image Generation Loading Animation        */
/* ============================================= */
.image-loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background-color: var(--md-sys-color-surface-variant);
    border-radius: var(--radius-medium);
    min-width: 250px;
    min-height: 250px;
    position: relative;
    overflow: hidden;
}

.progress-ring {
    width: 120px;
    height: 120px;
}

.progress-ring__circle {
    transition: stroke-dashoffset 0.35s;
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
    stroke: var(--md-sys-color-primary);
}

.loading-text {
    margin-top: 15px;
    font-size: 1.2em;
    font-weight: 500;
    color: var(--md-sys-color-on-surface);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.loading-percentage {
    font-size: 2em;
    font-weight: bold;
    color: var(--md-sys-color-primary);
    font-family: monospace;
}

.loading-status {
    font-size: 0.9em;
    color: var(--md-sys-color-on-surface-variant);
    opacity: 0.8;
}

/* Optional: Pulse animation for the container */
@keyframes pulse-bg {
    0% {
        background-color: var(--md-sys-color-surface-variant);
    }

    50% {
        background-color: rgba(168, 199, 250, 0.1);
    }

    /* Light blue tint */
    100% {
        background-color: var(--md-sys-color-surface-variant);
    }
}

.image-loading-container {
    animation: pulse-bg 2s infinite ease-in-out;
}