:root {
    --background-primary: #36393F; /* 主要背景，深灰 */
    --background-secondary: #2F3136; /* 次要背景，如侧边栏，稍浅灰 */
    --background-tertiary: #202225; /* 第三层背景，如用户区域，更深灰 */
    --background-floating: #18191C; /* 浮动元素背景，如模态框、卡片 */

    --header-primary: #FFFFFF; /* 主要标题/文字颜色 */
    --header-secondary: #B9BBBE; /* 次要文字/图标颜色 */
    --text-normal: #DCDEE0; /* 普通文本颜色 */
    --text-muted: #72767D;  /* 静音/不活动文本颜色 */

    --interactive-normal: #B9BBBE; /* 默认交互元素颜色 */
    --interactive-hover: #DCDEE0; /* 悬停时交互元素颜色 */
    --interactive-active: #FFFFFF; /* 激活时交互元素颜色 */
    --interactive-muted: #4F545C; /* 禁用/静音交互元素颜色 */

    --background-modifier-hover: rgba(79,84,92,0.16);
    --background-modifier-active: rgba(79,84,92,0.24);

    --channels-default: #8E9297; /* 频道默认颜色 */
    --brand-color: #5865F2; /* Discord Blurple */
    --green-360: #2DC770; /* 绿色，用于在线/说话状态 */
    --green-400: #23A55A; /* 深绿色，用于连接成功状态 */
    --red-400: #F23F42; /* 红色，用于挂断/错误 */
    --red-500: #DA373C; /* 深红色，用于连接失败状态 */
    --yellow-400: #FEE75C; /* 黄色，用于连接中状态 */
    --orange-400: #F0B132; /* 橙色，用于重连状态 */

    --border-color: #27292D;
    --input-background: #202225; /* 输入框背景 */

    --card-border-radius: 12px; /* 卡片圆角 */
    --button-border-radius: 8px; /* 按钮圆角 */

    /* 新增渐变色 */
    --gradient-brand: linear-gradient(135deg, #5865F2 0%, #7289DA 100%);
    --gradient-success: linear-gradient(135deg, #2DC770 0%, #23A55A 100%);
    --gradient-danger: linear-gradient(135deg, #F23F42 0%, #DA373C 100%);

    /* 阴影 */
    --shadow-small: 0 2px 8px rgba(0, 0, 0, 0.15);
    --shadow-medium: 0 4px 16px rgba(0, 0, 0, 0.2);
    --shadow-large: 0 8px 32px rgba(0, 0, 0, 0.3);
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'gg sans', 'Noto Sans SC', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background: var(--gradient-brand);
    color: var(--text-normal);
    margin: 0;
    display: flex;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--background-primary);
    z-index: -1;
}

.app-container {
    display: flex;
    width: 100%;
    height: 100%;
}

/* Sidebar (Left Column) */
.sidebar {
    width: 260px;
    background: linear-gradient(180deg, var(--background-secondary) 0%, var(--background-tertiary) 100%);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    border-right: 1px solid var(--border-color);
    box-shadow: var(--shadow-medium);
    position: relative;
    z-index: 10;
}

.sidebar-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    font-size: 18px;
    color: var(--header-primary);
    background: var(--gradient-brand);
    box-shadow: var(--shadow-small);
    z-index: 2;
    position: relative;
}

.sidebar-header::before {
    content: '👥';
    margin-right: 8px;
    font-size: 20px;
}

#room-name-display {
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}

.channels {
    padding: 16px 8px 16px 16px;
    flex-grow: 1;
    overflow-y: auto;
}

.channel-category {
    padding: 12px 0 4px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--channels-default);
}

/* 动画定义 */
@keyframes slide-in {
    from {
        opacity: 0;
        transform: translateX(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes pulse-speaking {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 2px var(--green-360);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 4px var(--green-360);
    }
}

@keyframes pulse-connecting {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.6;
        transform: scale(0.9);
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-2px); }
    75% { transform: translateX(2px); }
}

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px var(--brand-color);
    }
    50% {
        box-shadow: 0 0 20px var(--brand-color), 0 0 30px var(--brand-color);
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-4px);
    }
}

.user-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    margin: 2px 8px;
    border-radius: var(--button-border-radius);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    animation: slide-in 0.4s ease-out forwards;
    position: relative;
    cursor: pointer;
}

.sidebar-user:hover {
    background-color: var(--background-modifier-hover);
    transform: translateX(4px);
    box-shadow: var(--shadow-small);
}

.sidebar-user .avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gradient-brand);
    flex-shrink: 0;
    position: relative;
    border: 3px solid transparent;
    transition: all 0.2s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    color: white;
}

.sidebar-user .avatar::before {
    content: attr(data-initial);
    text-transform: uppercase;
}

.sidebar-user .avatar.speaking {
    border-color: var(--green-360);
    box-shadow: 0 0 0 2px var(--green-360);
    animation: pulse-speaking 1.5s ease-in-out infinite;
}

.sidebar-user .user-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.sidebar-user .username {
    color: var(--text-normal);
    font-weight: 500;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.2s ease;
}

.sidebar-user.me .username {
    color: #FFD700; /* Gold */
    font-weight: 600;
}

/* WebRTC连接状态指示器 */
.sidebar-user .connection-status {
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.2s ease;
}

.sidebar-user .connection-status.connected {
    color: var(--green-400);
}

.sidebar-user .connection-status.connecting {
    color: var(--yellow-400);
    animation: pulse-connecting 2s ease-in-out infinite;
}

.sidebar-user .connection-status.disconnected {
    color: var(--red-500);
}

.sidebar-user .connection-status.failed {
    color: var(--red-400);
}

/* 连接状态指示点 */
.sidebar-user .status-indicator {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--background-secondary);
    transition: all 0.2s ease;
}

.sidebar-user .status-indicator.connected {
    background-color: var(--green-400);
    box-shadow: 0 0 0 2px var(--green-400);
}

.sidebar-user .status-indicator.connecting {
    background-color: var(--yellow-400);
    animation: pulse-connecting 2s ease-in-out infinite;
}

.sidebar-user .status-indicator.disconnected {
    background-color: var(--red-500);
}

.sidebar-user .status-indicator.failed {
    background-color: var(--red-400);
    animation: shake 0.5s ease-in-out;
}

/* User Controls (Bottom Left) */
.user-controls {
    padding: 12px;
    background: linear-gradient(135deg, var(--background-tertiary) 0%, var(--background-floating) 100%);
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

.user-profile-card {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-grow: 1;
    padding: 12px;
    background: var(--gradient-brand);
    border-radius: var(--card-border-radius);
    box-shadow: var(--shadow-medium);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.user-profile-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    transition: left 0.5s ease;
}

.user-profile-card:hover::before {
    left: 100%;
}

.user-profile-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-large);
}

.user-info {
    flex-grow: 1;
    overflow: hidden;
    display: grid;
    grid-template-areas:
        "state"
        "name"
        "status";
    grid-template-rows: auto 1fr auto;
    align-items: center;
}

.connection-state {
    grid-area: state;
    font-size: 12px;
    font-weight: bold;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.connection-state.connected {
    color: var(--green-360);
}

.user-info .username {
    grid-area: name;
    font-size: 14px;
    font-weight: 600;
    color: var(--header-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.connection-status {
    grid-area: status;
    font-size: 11px;
    color: var(--header-secondary);
    display: flex;
    gap: 8px;
    font-weight: 500;
}

.connection-status span {
    background-color: rgba(88, 101, 242, 0.1);
    color: var(--header-primary);
    padding: 3px 8px;
    border-radius: 6px;
    font-weight: 600;
    border: 1px solid rgba(88, 101, 242, 0.2);
}

.avatar.my-avatar {
    background: var(--gradient-success);
    border: 3px solid rgba(255, 255, 255, 0.2);
    animation: float 3s ease-in-out infinite;
    box-shadow: 0 0 20px rgba(45, 199, 112, 0.3);
}

.avatar.my-avatar.speaking {
    animation: pulse-speaking 1s ease-in-out infinite, float 3s ease-in-out infinite;
    border-color: rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 30px rgba(45, 199, 112, 0.5);
}



.control-buttons {
    display: flex;
    gap: 4px; /* 按钮之间的间距 */
}

.control-button {
    width: 32px;
    height: 32px;
    background-color: var(--background-tertiary); /* 按钮背景色 */
    border: none;
    color: var(--interactive-normal);
    cursor: pointer;
    font-size: 18px; /* 调整字体大小 */
    border-radius: var(--button-border-radius); /* 使用变量 */
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.control-button:hover {
    background-color: var(--background-modifier-hover);
    color: var(--interactive-hover);
}

.control-button.muted {
    color: var(--red-400);
    background-color: var(--background-modifier-active); /* 静音按钮背景色 */
}

.control-button.muted::after {
    content: '/';
    position: absolute;
    transform: rotate(15deg);
    font-weight: bold;
    font-size: 24px;
    color: var(--red-400); /* 确保斜线颜色与按钮一致 */
}

.control-button.muted {
    color: var(--red-400);
    background-color: transparent !important;
}

.control-button.muted::after {
    content: '/';
    position: absolute;
    transform: rotate(15deg);
    font-weight: bold;
    font-size: 24px;
}



/* Main Content Area */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--background-primary);
}

.main-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    color: var(--header-primary);
    box-shadow: var(--shadow-small);
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, var(--background-primary) 0%, var(--background-secondary) 100%);
    position: relative;
    z-index: 5;
}

.main-header .channel-icon {
    font-size: 20px;
    color: var(--brand-color);
    animation: float 3s ease-in-out infinite;
}

.main-header #channel-name-main {
    flex: 1;
    font-size: 18px;
}

.header-actions {
    display: flex;
    gap: 8px;
}

.header-button {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--header-secondary);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.header-button:hover {
    background: var(--background-modifier-hover);
    color: var(--header-primary);
    transform: scale(1.1);
}

#remote-audio-container {
    flex-grow: 1;
    padding: 24px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 24px;
    align-content: flex-start;
    overflow-y: auto;
}

.audio-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px; /* 增加内边距 */
    background-color: var(--background-secondary); /* 卡片背景色 */
    border-radius: var(--card-border-radius); /* 圆角 */
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2); /* 阴影 */
    transition: transform 0.2s ease; /* 添加过渡效果 */
    height: auto; /* 允许内容决定高度 */
}

.audio-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 24px; /* 增加内边距让卡片更大 */
    background-color: var(--background-secondary); /* 卡片背景色 */
    border-radius: var(--card-border-radius); /* 圆角 */
    box-shadow: var(--shadow-medium); /* 阴影 */
    transition: transform 0.2s ease, box-shadow 0.2s ease; /* 添加过渡效果 */
    height: auto; /* 允许内容决定高度 */
    animation: slide-in 0.4s ease-out forwards;
    min-width: 200px; /* 最小宽度 */
    position: relative;
    border: 1px solid var(--border-color);
}

.audio-card:hover {
    transform: translateY(-4px); /* 悬停时轻微上浮 */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3); /* 悬停时阴影更明显 */
}

.avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--gradient-brand); /* 使用渐变背景 */
    flex-shrink: 0;
    position: relative;
    border: 3px solid transparent;
    transition: all 0.2s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
    color: white;
    box-shadow: var(--shadow-small);
}

.avatar.speaking {
    border-color: var(--green-360);
}

.peer-info {
    font-size: 16px;
    font-weight: 500;
    color: var(--header-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.peer-info.my-name {
    color: #FFD700;
    font-weight: 600;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

.audio-card.my-card {
    border: 2px solid #FFD700;
    background: linear-gradient(135deg, var(--background-secondary) 0%, rgba(255, 215, 0, 0.1) 100%);
}

/* 用户信息容器 */
.user-info-container {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    justify-content: center;
}

/* 本地音频标识 */
.local-audio-label {
    color: var(--green-360);
    font-size: 14px;
    padding: 4px;
    border-radius: 4px;
    background: rgba(45, 199, 112, 0.1);
    border: 1px solid rgba(45, 199, 112, 0.3);
}

/* 音量按钮样式 */
.volume-button {
    width: 28px;
    height: 28px;
    border: none;
    background: var(--background-floating);
    color: var(--header-secondary);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 12px;
    border: 1px solid var(--border-color);
}

.volume-button:hover {
    background: var(--background-modifier-hover);
    color: var(--brand-color);
    transform: scale(1.1);
}

/* 音量面板样式 */
.volume-panel {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 8px;
    background: var(--background-floating);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    box-shadow: var(--shadow-medium);
    z-index: 100;
    min-width: 200px;
    animation: volume-panel-show 0.2s ease-out;
}

.volume-panel.hidden {
    display: none;
}

@keyframes volume-panel-show {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.volume-slider-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.volume-icon {
    color: var(--header-secondary);
    font-size: 14px;
    min-width: 16px;
}

.volume-slider {
    flex: 1;
    height: 4px;
    background: var(--background-tertiary);
    border-radius: 2px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--brand-color);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
}

.volume-slider::-webkit-slider-thumb:hover {
    background: var(--interactive-hover);
    transform: scale(1.2);
}

.volume-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--brand-color);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.volume-value {
    font-size: 12px;
    color: var(--text-muted);
    min-width: 35px;
    text-align: right;
    font-weight: 500;
}

@keyframes new-message-animation {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Chat Area (Integrated at the bottom of main content for simplicity) */
.chat-area {
    padding: 0 16px 24px 16px;
    margin-top: auto;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1); /* 更平滑的过渡 */
    max-height: 300px; /* 限制最大高度 */
}

.chat-area.hidden {
    opacity: 0;
    pointer-events: none;
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    margin-top: 0;
    overflow: hidden;
}
#chat-messages {
    height: 150px;
    overflow-y: auto;
    padding-right: 10px;
    margin-bottom: 16px;
}
.chat-message {
    margin-bottom: 12px;
    line-height: 1.4;
    animation: new-message-animation 0.3s ease-out forwards;
}
.chat-message .timestamp {
    color: var(--text-muted);
    font-size: 12px;
    margin-right: 8px;
}
.chat-message .peer-id {
    font-weight: bold;
    color: var(--header-secondary);
    margin-right: 8px;
}
.chat-input-area {
    display: flex;
}
#chat-input {
    flex-grow: 1;
    background-color: var(--input-background);
    color: var(--text-normal);
    border: none;
    padding: 10px;
    border-radius: 5px;
    outline: none;
}
#chat-input:disabled {
    cursor: not-allowed;
    background-color: var(--background-tertiary);
}
#send-button {
    display: none; /* We will send on Enter key press */
}

/* Main Content Footer (Floating Buttons) */
.main-content-footer {
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(180deg, transparent 0%, var(--background-primary) 20%);
    padding: 20px 24px;
    display: flex;
    justify-content: center;
    gap: 20px;
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
    z-index: 10;
    backdrop-filter: blur(10px);
}

.footer-button {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--gradient-brand);
    border: none;
    color: white;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: var(--shadow-medium);
    position: relative;
    overflow: hidden;
}

.footer-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

.footer-button:hover::before {
    left: 100%;
}

.footer-button:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: var(--shadow-large);
    animation: glow 2s ease-in-out infinite;
}

.footer-button:active {
    transform: translateY(-2px) scale(0.98);
}

.footer-button.muted {
    background: var(--gradient-danger);
    animation: shake 0.5s ease-in-out;
}

.footer-button.disconnect {
    background: var(--gradient-danger);
}

.footer-button.disconnect:hover {
    background: linear-gradient(135deg, #DA373C 0%, #B91C1C 100%);
}

/* Login/Join Modal */
.login-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(0,0,0,0.8) 0%, rgba(88,101,242,0.2) 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    backdrop-filter: blur(10px);
    animation: fadeIn 0.3s ease-out;
}

.login-modal {
    background: linear-gradient(135deg, var(--background-secondary) 0%, var(--background-tertiary) 100%);
    padding: 32px;
    border-radius: var(--card-border-radius);
    width: 480px;
    max-width: 90vw;
    text-align: center;
    box-shadow: var(--shadow-large);
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
    animation: slideUp 0.4s ease-out;
}

.login-modal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-brand);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 16px;
}

.modal-icon {
    font-size: 32px;
    color: var(--brand-color);
    animation: pulse-speaking 2s ease-in-out infinite;
}

.login-modal h2 {
    color: var(--header-primary);
    margin: 0;
    font-size: 24px;
    font-weight: 600;
}

.login-modal p {
    color: var(--header-secondary);
    margin: 0 0 24px;
    line-height: 1.5;
}

.input-group {
    position: relative;
    margin-bottom: 20px;
}

.input-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--header-secondary);
    font-size: 16px;
    z-index: 1;
}

.login-input {
    width: 100%;
    padding: 14px 14px 14px 44px;
    box-sizing: border-box;
    border: 2px solid var(--border-color);
    background-color: var(--input-background);
    color: var(--text-normal);
    border-radius: var(--button-border-radius);
    font-size: 16px;
    transition: all 0.3s ease;
    outline: none;
}

.login-input:focus {
    border-color: var(--brand-color);
    box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.1);
    transform: translateY(-1px);
}

.login-input:focus + .input-icon {
    color: var(--brand-color);
}

/* 服务器选择样式 */
.server-selection {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.server-label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--header-secondary);
    font-size: 14px;
    font-weight: 500;
    min-width: 80px;
}

.server-select {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    background-color: var(--input-background);
    color: var(--text-normal);
    border-radius: var(--button-border-radius);
    font-size: 14px;
    transition: all 0.3s ease;
    outline: none;
    cursor: pointer;
}

.server-select:focus {
    border-color: var(--brand-color);
    box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.1);
}

.server-select option {
    background-color: var(--input-background);
    color: var(--text-normal);
    padding: 8px;
}

.server-info-btn {
    width: 36px;
    height: 36px;
    border: 2px solid var(--border-color);
    background: transparent;
    color: var(--header-secondary);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 14px;
}

.server-info-btn:hover {
    border-color: var(--brand-color);
    color: var(--brand-color);
    background: rgba(88, 101, 242, 0.1);
    transform: scale(1.05);
}

#joinButton {
    width: 100%;
    padding: 16px;
    border: none;
    background: var(--gradient-brand);
    color: white;
    border-radius: var(--button-border-radius);
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

#joinButton::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

#joinButton:hover::before {
    left: 100%;
}

#joinButton:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

#joinButton:active {
    transform: translateY(0);
}

#joinButton:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* IP泄露警告样式 */
.ip-warning {
    margin: 12px 0;
    padding: 8px 12px;
    color: #FF4757;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    animation: ip-warning-pulse 2s ease-in-out infinite;
}

.ip-warning i {
    font-size: 14px;
    animation: ip-warning-shake 1s ease-in-out infinite;
}

@keyframes ip-warning-pulse {
    0%, 100% {
        opacity: 0.8;
    }
    50% {
        opacity: 1;
    }
}

@keyframes ip-warning-shake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-1px);
    }
    75% {
        transform: translateX(1px);
    }
}

/* WebRTC技术提示样式 */
.webrtc-message {
    margin: 16px 0;
    padding: 16px;
    background: linear-gradient(135deg, #2ECC71 0%, #27AE60 50%, #2ECC71 100%);
    border-radius: var(--card-border-radius);
    border: 2px solid #27AE60;
    box-shadow:
        0 0 20px rgba(46, 204, 113, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
    animation: webrtc-glow 3s ease-in-out infinite alternate;
}

.webrtc-message::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: webrtc-shine 2.5s ease-in-out infinite;
}

.webrtc-text {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    position: relative;
    z-index: 1;
}

.webrtc-icon {
    font-size: 20px;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    animation: webrtc-bounce 2.5s ease-in-out infinite;
}

.webrtc-slogan {
    color: white;
    font-weight: 700;
    font-size: 15px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    text-align: center;
    line-height: 1.3;
    letter-spacing: 0.3px;
}

@keyframes webrtc-glow {
    0% {
        box-shadow:
            0 0 20px rgba(46, 204, 113, 0.4),
            inset 0 1px 0 rgba(255, 255, 255, 0.2);
    }
    100% {
        box-shadow:
            0 0 30px rgba(46, 204, 113, 0.6),
            0 0 40px rgba(46, 204, 113, 0.3),
            inset 0 1px 0 rgba(255, 255, 255, 0.2);
    }
}

@keyframes webrtc-shine {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

@keyframes webrtc-bounce {
    0%, 100% {
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(-2px) scale(1.05);
    }
}

/* 自由言论提示样式 */
.freedom-message {
    margin: 16px 0 20px 0;
    padding: 16px;
    background: linear-gradient(135deg, #FF6B6B 0%, #FF8E53 50%, #FF6B6B 100%);
    border-radius: var(--card-border-radius);
    border: 2px solid #FF4757;
    box-shadow:
        0 0 20px rgba(255, 107, 107, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
    animation: freedom-glow 3s ease-in-out infinite alternate;
}

.freedom-message::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: freedom-shine 2s ease-in-out infinite;
}

.freedom-text {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    position: relative;
    z-index: 1;
}

.freedom-icon {
    font-size: 20px;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    animation: freedom-bounce 2s ease-in-out infinite;
}

.freedom-slogan {
    color: white;
    font-weight: 700;
    font-size: 16px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    text-align: center;
    line-height: 1.3;
    letter-spacing: 0.5px;
}

@keyframes freedom-glow {
    0% {
        box-shadow:
            0 0 20px rgba(255, 107, 107, 0.4),
            inset 0 1px 0 rgba(255, 255, 255, 0.2);
    }
    100% {
        box-shadow:
            0 0 30px rgba(255, 107, 107, 0.6),
            0 0 40px rgba(255, 107, 107, 0.3),
            inset 0 1px 0 rgba(255, 255, 255, 0.2);
    }
}

@keyframes freedom-shine {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

@keyframes freedom-bounce {
    0%, 100% {
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(-3px) scale(1.1);
    }
}

.status-text {
    margin-top: 16px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 14px;
}

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

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* 服务器信息模态框 */
.server-info-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease-out;
}

.server-info-modal {
    background: linear-gradient(135deg, var(--background-secondary) 0%, var(--background-tertiary) 100%);
    padding: 24px;
    border-radius: var(--card-border-radius);
    width: 600px;
    max-width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-large);
    border: 1px solid var(--border-color);
    position: relative;
    animation: slideUp 0.4s ease-out;
}

.server-info-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.server-info-modal h3 {
    color: var(--header-primary);
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.close-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--header-secondary);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 16px;
}

.close-btn:hover {
    background: var(--background-modifier-hover);
    color: var(--header-primary);
    transform: scale(1.1);
}

.server-info-content {
    color: var(--text-normal);
    line-height: 1.6;
}

.server-group {
    margin-bottom: 24px;
    padding: 16px;
    background: var(--background-floating);
    border-radius: var(--button-border-radius);
    border: 1px solid var(--border-color);
}

.server-group h4 {
    color: var(--header-primary);
    margin: 0 0 12px 0;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.server-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.server-list li {
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.server-list li:last-child {
    border-bottom: none;
}

.server-name {
    font-weight: 500;
    color: var(--text-normal);
}

.server-location {
    font-size: 12px;
    color: var(--text-muted);
    background: var(--background-modifier-hover);
    padding: 2px 8px;
    border-radius: 12px;
}

.hidden {
    display: none;
}
/* --- Responsive Design for Mobile --- */

/* 平板设备 */
@media (max-width: 1024px) {
    .sidebar {
        width: 220px;
    }

    #remote-audio-container {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 16px;
        padding: 16px;
    }
}

/* 移动端设备 */
@media (max-width: 768px) {
    body {
        flex-direction: column;
    }

    .app-container {
        flex-direction: column;
        height: 100vh;
    }

    .sidebar {
        width: 100%;
        height: auto;
        max-height: 40vh;
        order: 2;
        border-right: none;
        border-top: 1px solid var(--border-color);
        background: var(--background-secondary);
    }

    .sidebar-header {
        padding: 12px 16px;
        font-size: 16px;
        text-align: center;
    }

    .channels {
        padding: 8px;
        max-height: 200px;
        overflow-y: auto;
    }

    .user-list {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 8px;
    }

    .sidebar-user {
        flex-direction: column;
        text-align: center;
        padding: 8px;
        margin: 0;
        gap: 6px;
    }

    .sidebar-user .user-info {
        align-items: center;
    }

    .sidebar-user .username {
        font-size: 12px;
    }

    .sidebar-user .connection-status {
        font-size: 10px;
    }

    .user-controls {
        padding: 8px;
        order: 3;
    }

    .user-profile-card {
        padding: 8px;
        gap: 8px;
        overflow: hidden; /* 防止内容溢出 */
    }

    .connection-state {
        font-size: 10px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .connection-status {
        font-size: 9px;
        flex-wrap: wrap;
    }

    .connection-status span {
        padding: 1px 4px;
        font-size: 8px;
        margin: 1px;
    }

    .avatar.my-avatar {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }

    .main-content {
        order: 1;
        flex: 1;
        min-height: 0;
    }

    .main-header {
        padding: 12px 16px;
        font-size: 16px;
    }

    #remote-audio-container {
        grid-template-columns: 1fr;
        padding: 12px;
        gap: 12px;
        flex: 1;
        overflow-y: auto;
    }

    .audio-card {
        padding: 16px;
        gap: 12px;
        min-width: 160px;
    }

    .avatar {
        width: 48px;
        height: 48px;
        font-size: 18px;
    }

    .chat-area {
        padding: 0 12px 12px 12px;
        max-height: 200px;
    }

    #chat-messages {
        height: 100px;
    }

    .main-content-footer {
        padding: 12px 16px;
        gap: 16px;
        order: 4;
        position: sticky;
        bottom: 0;
    }

    .footer-button {
        width: 48px;
        height: 48px;
        font-size: 20px;
    }

    .login-modal {
        width: 90%;
        max-width: 400px;
        padding: 20px;
        margin: 20px;
    }

    .login-input {
        font-size: 16px; /* 防止iOS缩放 */
    }

    /* 移动端IP警告优化 */
    .ip-warning {
        margin: 8px 0;
        padding: 6px 8px;
        font-size: 12px;
    }

    .ip-warning i {
        font-size: 12px;
    }

    /* 移动端WebRTC提示优化 */
    .webrtc-message {
        margin: 12px 0;
        padding: 12px;
    }

    .webrtc-slogan {
        font-size: 13px;
        line-height: 1.4;
    }

    .webrtc-icon {
        font-size: 18px;
    }

    /* 移动端自由言论提示优化 */
    .freedom-message {
        margin: 12px 0 16px 0;
        padding: 12px;
    }

    .freedom-slogan {
        font-size: 14px;
        line-height: 1.4;
    }

    .freedom-icon {
        font-size: 18px;
    }

    /* 移动端音量控制优化 */
    .volume-button {
        width: 24px;
        height: 24px;
        font-size: 10px;
    }

    .volume-panel {
        min-width: 160px;
        padding: 8px;
    }

    .volume-slider-container {
        gap: 6px;
    }

    .volume-value {
        font-size: 10px;
        min-width: 30px;
    }

    .local-audio-label {
        font-size: 12px;
        padding: 2px 4px;
    }
}

/* 小屏幕手机 */
@media (max-width: 480px) {
    .sidebar-header {
        font-size: 14px;
        padding: 10px 12px;
    }

    .user-list {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    }

    .sidebar-user .avatar {
        width: 28px;
        height: 28px;
    }

    .main-content-footer {
        padding: 8px 12px;
        gap: 12px;
    }

    .footer-button {
        width: 44px;
        height: 44px;
        font-size: 18px;
    }

    #remote-audio-container {
        padding: 8px;
        gap: 8px;
    }

    .audio-card {
        padding: 12px;
        gap: 8px;
        min-width: 140px;
    }

    .avatar {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    .login-modal {
        width: 95%;
        padding: 16px;
        margin: 10px;
    }
}

/* 横屏模式优化 */
@media (max-width: 768px) and (orientation: landscape) {
    .sidebar {
        max-height: 30vh;
    }

    .user-list {
        grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    }

    .sidebar-user {
        padding: 6px;
        gap: 4px;
    }

    .sidebar-user .username {
        font-size: 11px;
    }

    .main-content-footer {
        padding: 8px 16px;
    }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    .sidebar-user:hover {
        transform: none;
        background-color: var(--background-modifier-active);
    }

    .footer-button:hover {
        transform: none;
        animation: none;
    }

    .footer-button:active {
        transform: scale(0.95);
        transition: transform 0.1s ease;
    }

    .audio-card:hover {
        transform: none;
        box-shadow: var(--shadow-small);
    }
}