* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #667eea;
    --primary-dark: #5568d3;
    --secondary-color: #764ba2;
    --success-color: #48bb78;
    --danger-color: #f56565;
    --warning-color: #ed8936;
    --bg-dark: #1a202c;
    --bg-darker: #0f1419;
    --text-light: #ffffff;
    --text-gray: #a0aec0;
    --card-bg: rgba(255, 255, 255, 0.05);
    --shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.4);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-light);
    overflow: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(circle at 20% 50%, rgba(120, 119, 198, 0.3), transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(118, 75, 162, 0.3), transparent 50%);
    animation: gradientShift 15s ease infinite;
    pointer-events: none;
}

@keyframes gradientShift {

    0%,
    100% {
        transform: translate(0, 0);
    }

    50% {
        transform: translate(50px, 50px);
    }
}

.container {
    width: 100%;
    max-width: 480px;
    padding: 20px;
    position: relative;
    z-index: 1;
}

/* 界面切换 */
.screen {
    display: none;
    animation: fadeIn 0.3s ease;
}

.screen.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 角色选择界面 */
#role-selection {
    text-align: center;
}

.app-title {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 10px;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    animation: titlePulse 2s ease-in-out infinite;
}

@keyframes titlePulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

.subtitle {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 15px;
}

.version-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-bottom: 30px;
    font-size: 0.85rem;
}

.version-badge {
    background: linear-gradient(135deg, #48bb78, #38a169);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.75rem;
    box-shadow: 0 2px 8px rgba(72, 187, 120, 0.4);
    animation: versionPulse 2s ease-in-out infinite;
}

@keyframes versionPulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

.update-time {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.75rem;
    text-align: center;
}

.role-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-top: 30px;
}

.role-card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 30px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.role-card:hover {
    transform: translateY(-5px);
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: var(--shadow-lg);
    background: rgba(255, 255, 255, 0.1);
}

.role-card:active {
    transform: translateY(-2px);
}

.role-icon {
    font-size: 3rem;
    margin-bottom: 15px;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    overflow: hidden;
    margin-left: auto;
    margin-right: auto;
}

.role-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.role-card h2 {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.role-card p {
    font-size: 0.9rem;
    color: var(--text-gray);
}

/* 通话界面 */
#call-screen {
    background: rgba(26, 32, 44, 0.8);
    backdrop-filter: blur(20px);
    border-radius: 30px;
    padding: 30px;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    margin-bottom: 30px;
    position: relative;
}

.btn-back {
    justify-self: start;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 8px 16px;
    border-radius: 15px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.btn-back:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateX(-3px);
}

.btn-back:active {
    transform: translateX(-1px);
}

.role-badge {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 1rem;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    justify-self: center;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    justify-self: end;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success-color);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.status-text {
    color: var(--text-gray);
}

/* 通话区域 */
.call-area {
    position: relative;
    min-height: 400px;
}

.call-state {
    display: none;
    text-align: center;
    animation: fadeIn 0.3s ease;
}

.call-state.active {
    display: block;
}

.avatar-large {
    width: 150px;
    height: 150px;
    margin: 30px auto;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.2), rgba(118, 75, 162, 0.2));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.avatar-large.pulse {
    animation: avatarPulse 1.5s ease-in-out infinite;
}

.avatar-large.connected {
    border-color: var(--success-color);
    box-shadow: 0 0 30px rgba(72, 187, 120, 0.6);
}

@keyframes avatarPulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

.role-icon-large {
    font-size: 4rem;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.other-role-name {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.other-role-status {
    font-size: 0.9rem;
    margin-bottom: 30px;
}

.other-role-status.online {
    color: var(--success-color);
}

.other-role-status.offline {
    color: var(--text-gray);
}

.status-message {
    font-size: 1.2rem;
    color: var(--text-gray);
    margin-bottom: 10px;
}

.call-timer {
    font-size: 2rem;
    font-weight: 600;
    margin: 20px 0;
    font-variant-numeric: tabular-nums;
}

/* 按钮 */
.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.btn-large {
    padding: 16px 40px;
    font-size: 1.1rem;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-circle {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    padding: 0;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    justify-content: center;
}

.btn-circle .btn-icon {
    font-size: 1.8rem;
}

.btn-circle.muted {
    background: var(--danger-color);
}

.btn-danger-circle {
    background: var(--danger-color);
    border-color: var(--danger-color);
}

.btn-icon {
    font-size: 1.2rem;
}

.call-controls {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-top: 30px;
}

/* 来电弹窗 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: rgba(26, 32, 44, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 25px;
    padding: 30px;
    max-width: 350px;
    width: 90%;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-content.shake {
    animation: shake 0.5s ease;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-10px);
    }

    75% {
        transform: translateX(10px);
    }
}

.modal-header h3 {
    font-size: 1.5rem;
    text-align: center;
    margin-bottom: 20px;
}

.modal-body {
    margin: 25px 0;
}

.caller-info {
    text-align: center;
}

.avatar-medium {
    width: 100px;
    height: 100px;
    margin: 0 auto 15px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.2), rgba(118, 75, 162, 0.2));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid rgba(255, 255, 255, 0.2);
}

.avatar-medium.pulse {
    animation: avatarPulse 1.5s ease-in-out infinite;
}

.role-icon-medium {
    font-size: 3rem;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.caller-name {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.calling-text {
    color: var(--text-gray);
    font-size: 0.95rem;
}

.modal-actions {
    display: flex;
    gap: 15px;
    margin-top: 25px;
}

.modal-actions .btn {
    flex: 1;
}

/* 提示消息 */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(26, 32, 44, 0.95);
    backdrop-filter: blur(10px);
    padding: 15px 25px;
    border-radius: 15px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 2000;
    opacity: 0;
    transition: all 0.3s ease;
    max-width: 90%;
    text-align: center;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* 响应式设计 */
@media (max-width: 480px) {
    .container {
        padding: 15px;
    }

    #call-screen {
        padding: 20px;
    }

    .app-title {
        font-size: 2.5rem;
    }

    .role-cards {
        gap: 15px;
    }

    .role-card {
        padding: 25px 15px;
    }

    .avatar-large {
        width: 120px;
        height: 120px;
    }

    .role-icon-large {
        font-size: 3rem;
    }

    .call-timer {
        font-size: 1.5rem;
    }

    .btn-circle {
        width: 60px;
        height: 60px;
    }

    .btn-circle .btn-icon {
        font-size: 1.5rem;
    }
}

/* 美化滚动条 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}