* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    height: 100vh;
    background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #e0e0e0;
    overflow: hidden;
}

.app {
    height: 100vh;
    display: flex;
    flex-direction: column;
    max-width: 600px;
    margin: 0 auto;
}

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.header h1 {
    font-size: 18px;
    font-weight: 600;
    background: linear-gradient(90deg, #a78bfa, #60a5fa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.conn-status {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 20px;
}

.conn-status.disconnected {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

.conn-status.connecting {
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
}

.conn-status.connected {
    background: rgba(52, 211, 153, 0.15);
    color: #34d399;
}

.hidden {
    display: none !important;
}

.setup-panel {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.setup-card {
    width: 100%;
    max-width: 360px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 32px 24px;
}

.setup-card h2 {
    text-align: center;
    font-size: 20px;
    margin-bottom: 24px;
    color: #e0e0e0;
}

.setup-row {
    margin-bottom: 16px;
}

.setup-row label {
    display: block;
    font-size: 12px;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
}

.setup-row select,
.setup-row input[type="text"] {
    width: 100%;
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.08);
    color: #e0e0e0;
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s;
}

.setup-row select {
    appearance: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%239ca3af' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.setup-row select:focus,
.setup-row input:focus {
    border-color: rgba(167, 139, 250, 0.5);
}

.join-row {
    display: flex;
    gap: 8px;
}

.join-row input {
    flex: 1;
}

.btn-primary {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #a78bfa, #7c3aed);
    color: white;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary:hover {
    box-shadow: 0 4px 20px rgba(124, 58, 237, 0.4);
}

.btn-secondary {
    padding: 10px 20px;
    border: none;
    border-radius: 12px;
    background: rgba(167, 139, 250, 0.2);
    color: #a78bfa;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-secondary:hover {
    background: rgba(167, 139, 250, 0.3);
}

.divider {
    text-align: center;
    margin: 16px 0;
    position: relative;
    color: #6b7280;
    font-size: 13px;
}

.divider::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
}

.divider span {
    background: rgba(30, 25, 55, 1);
    padding: 0 12px;
    position: relative;
}

.setup-status {
    text-align: center;
    font-size: 13px;
    min-height: 20px;
    margin-top: 12px;
    color: #6b7280;
}

.setup-status.error {
    color: #f87171;
}

.chat-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.room-info {
    text-align: center;
    padding: 8px;
    font-size: 13px;
    color: #9ca3af;
    background: rgba(0, 0, 0, 0.15);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.room-info strong {
    color: #a78bfa;
    font-family: monospace;
    font-size: 15px;
}

.copy-room-btn {
    padding: 2px 10px;
    border: 1px solid rgba(167, 139, 250, 0.3);
    border-radius: 8px;
    background: transparent;
    color: #a78bfa;
    font-size: 11px;
    cursor: pointer;
}

.lang-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.lang-bar-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.lang-bar-item label {
    font-size: 10px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.lang-bar-item select {
    padding: 6px 10px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.06);
    color: #e0e0e0;
    font-size: 13px;
    outline: none;
    appearance: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%239ca3af' stroke-width='1.2' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
}

.lang-bar-item select:focus {
    border-color: rgba(167, 139, 250, 0.4);
}

.lang-swap-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid rgba(167, 139, 250, 0.3);
    background: rgba(167, 139, 250, 0.1);
    color: #a78bfa;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    margin-top: 14px;
    transition: all 0.2s;
}

.lang-swap-btn:hover {
    background: rgba(167, 139, 250, 0.2);
    transform: scale(1.1);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-messages::-webkit-scrollbar {
    width: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
}

.msg.mine {
    align-self: flex-end;
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    border-bottom-right-radius: 4px;
}

.msg.peer {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.1);
    border-bottom-left-radius: 4px;
}

.msg-sender {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 4px;
}

.msg-original {
    margin-bottom: 4px;
}

.msg-translated {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 4px;
    margin-top: 4px;
}

.msg.mine .msg-translated {
    border-top-color: rgba(255, 255, 255, 0.15);
}

.msg-system {
    align-self: center;
    font-size: 12px;
    color: #6b7280;
    background: rgba(255, 255, 255, 0.05);
    padding: 4px 14px;
    border-radius: 20px;
}

.msg-typing {
    align-self: flex-start;
    display: flex;
    gap: 4px;
    padding: 10px 16px;
}

.msg-typing span {
    width: 6px;
    height: 6px;
    background: #6b7280;
    border-radius: 50%;
    animation: typing-dot 1.4s infinite;
}

.msg-typing span:nth-child(2) {
    animation-delay: 0.2s;
}

.msg-typing span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing-dot {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-6px);
        opacity: 1;
    }
}

.input-bar {
    display: flex;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.input-bar input {
    flex: 1;
    padding: 10px 14px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.06);
    color: #e0e0e0;
    font-size: 14px;
    outline: none;
}

.input-bar input:focus {
    border-color: rgba(167, 139, 250, 0.4);
}

.send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #a78bfa, #7c3aed);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.send-btn:hover {
    box-shadow: 0 2px 12px rgba(124, 58, 237, 0.4);
}

.call-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 24px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.3);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.mic-btn {
    position: relative;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #a78bfa, #7c3aed);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 16px rgba(124, 58, 237, 0.3);
}

.mic-btn:hover {
    transform: scale(1.05);
}

.mic-btn.recording {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.4);
}

.mic-pulse {
    display: none;
    position: absolute;
    inset: -5px;
    border-radius: 50%;
    border: 2px solid rgba(239, 68, 68, 0.4);
    animation: pulse-ring 1.5s ease-out infinite;
}

.mic-btn.recording .mic-pulse {
    display: block;
}

@keyframes pulse-ring {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(1.4); opacity: 0; }
}

.hangup-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: #dc2626;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.hangup-btn:hover {
    background: #b91c1c;
    transform: scale(1.05);
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 16px;
    }
    .msg {
        max-width: 90%;
    }
}
