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

:root {
    --bg-primary: #000000;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #2a2a2a;
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0a0;
    --accent: #4a9eff;
    --accent-hover: #5aaeff;
    --border: #333333;
    --success: #4caf50;
    --error: #f44336;
    --warning: #ff9800;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #000000 0%, #1a0033 25%, #000033 50%, #1a0033 75%, #000000 100%);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    z-index: -1;
}

body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 50%, rgba(74, 158, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(138, 43, 226, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 20%, rgba(0, 191, 255, 0.08) 0%, transparent 50%);
    animation: pulseGlow 8s ease-in-out infinite;
    z-index: -1;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes pulseGlow {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 0.8; }
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px 20px;
    border-bottom: 1px solid rgba(74, 158, 255, 0.2);
    margin-bottom: 40px;
    animation: headerFadeIn 0.6s ease-out;
    position: relative;
}

.header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    animation: headerLineExpand 1s ease-out 0.5s forwards;
}

@keyframes headerFadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes headerLineExpand {
    to {
        width: 80%;
    }
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 20px;
}

.logo-wrapper {
    background: rgba(74, 158, 255, 0.15);
    padding: 12px;
    border-radius: 12px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(74, 158, 255, 0.3);
    box-shadow: 
        0 0 20px rgba(74, 158, 255, 0.2),
        inset 0 0 20px rgba(74, 158, 255, 0.1);
    display: inline-block;
    animation: logoWrapperGlow 3s ease-in-out infinite;
}

@keyframes logoWrapperGlow {
    0%, 100% {
        box-shadow: 
            0 0 20px rgba(74, 158, 255, 0.2),
            inset 0 0 20px rgba(74, 158, 255, 0.1);
    }
    50% {
        box-shadow: 
            0 0 30px rgba(74, 158, 255, 0.4),
            inset 0 0 30px rgba(74, 158, 255, 0.2);
    }
}

.logo {
    height: 60px;
    width: auto;
    display: block;
    animation: logoFloat 4s ease-in-out infinite;
    filter: 
        brightness(1.3) 
        contrast(1.2)
        drop-shadow(0 0 10px rgba(255, 255, 255, 0.5))
        drop-shadow(0 0 20px rgba(74, 158, 255, 0.6))
        drop-shadow(0 0 30px rgba(74, 158, 255, 0.3));
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

@keyframes logoFloat {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    50% {
        transform: translateY(-5px) rotate(2deg);
    }
}

.title {
    font-size: 2rem;
    font-weight: 600;
    color: var(--text-primary);
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.choice-container {
    width: 100%;
    max-width: 1000px;
    padding: 40px;
}

.welcome-section {
    text-align: center;
    margin-bottom: 60px;
}

.welcome-section h2 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    color: var(--text-primary);
    animation: titleFadeIn 0.8s ease-out;
    text-shadow: 0 0 20px rgba(74, 158, 255, 0.3);
}

.subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    animation: subtitleFadeIn 1s ease-out;
}

@keyframes titleFadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes subtitleFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.choice-cards {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-top: 40px;
    flex-wrap: wrap;
}

.language-cards {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: nowrap;
}

@media (max-width: 1200px) {
    .language-cards {
        flex-wrap: wrap;
    }
}

.choice-card {
    background: rgba(26, 26, 26, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(74, 158, 255, 0.3);
    border-radius: 16px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    flex: 1;
    min-width: 320px;
    max-width: 450px;
    position: relative;
    overflow: hidden;
    animation: cardFadeIn 0.6s ease-out;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

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

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

.choice-card:hover {
    transform: translateY(-10px) scale(1.02);
    border-color: var(--accent);
    box-shadow: 0 20px 40px rgba(74, 158, 255, 0.3), 0 0 20px rgba(74, 158, 255, 0.1);
    background: rgba(26, 26, 26, 0.95);
}

.choice-card:active {
    transform: translateY(-5px) scale(0.98);
}

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

.card-icon {
    color: var(--accent);
    margin-bottom: 10px;
    transition: all 0.4s ease;
    animation: iconFloat 3s ease-in-out infinite;
}

.choice-card:hover .card-icon {
    transform: scale(1.1) rotate(5deg);
    filter: drop-shadow(0 0 15px rgba(74, 158, 255, 0.6));
}

.flag-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 120px;
    height: 120px;
    margin: 0 auto 15px;
    position: relative;
}

.flag-img,
.flag-svg {
    width: 80px;
    height: 60px;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.4s ease;
    margin-bottom: 10px;
    border: 1px solid rgba(74, 158, 255, 0.2);
    object-fit: cover;
}

.flag-img {
    display: block;
}

.flag-svg {
    display: block;
}

.flag-code {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 2px;
    transition: all 0.4s ease;
    text-shadow: 0 0 10px rgba(74, 158, 255, 0.5);
}

.choice-card:hover .flag-img,
.choice-card:hover .flag-svg {
    transform: scale(1.15);
    box-shadow: 0 4px 15px rgba(74, 158, 255, 0.4);
    border-color: var(--accent);
}

.choice-card:hover .flag-code {
    transform: scale(1.1);
    color: var(--accent-hover);
    text-shadow: 0 0 15px rgba(74, 158, 255, 0.7);
}

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

.choice-card h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.choice-card p {
    color: var(--text-secondary);
    line-height: 1.6;
    flex: 1;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent) 0%, #5aaeff 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    margin-top: auto;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(74, 158, 255, 0.3);
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-primary:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--accent-hover) 0%, #6abfff 100%);
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(74, 158, 255, 0.5);
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-back {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.btn-back:hover {
    color: var(--text-primary);
    border-color: var(--accent);
}

.language-page-header {
    width: 100%;
    max-width: 1000px;
    margin-bottom: 20px;
    text-align: left;
}

.chat-container, .voice-chat-container {
    width: 100%;
    max-width: 900px;
    height: calc(100vh - 200px);
    display: flex;
    flex-direction: column;
    background: rgba(26, 26, 26, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(74, 158, 255, 0.3);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(74, 158, 255, 0.1);
    animation: containerFadeIn 0.5s ease-out;
}

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

.chat-header, .voice-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid rgba(74, 158, 255, 0.2);
    background: rgba(42, 42, 42, 0.5);
    backdrop-filter: blur(5px);
}

.chat-header h2, .voice-chat-header h2 {
    font-size: 1.5rem;
    flex: 1;
    text-align: center;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-secondary);
    animation: pulse 2s infinite;
}

.status-dot.connected {
    background: var(--success);
}

.status-dot.disconnected {
    background: var(--error);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--accent) 0%, var(--accent-hover) 100%);
    border-radius: 4px;
}

.message {
    padding: 12px 16px;
    border-radius: 8px;
    max-width: 70%;
    word-wrap: break-word;
    animation: messageSlideIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
}

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

.message.user {
    background: linear-gradient(135deg, var(--accent) 0%, #5aaeff 100%);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 15px rgba(74, 158, 255, 0.3);
}

.message.assistant {
    background: rgba(42, 42, 42, 0.8);
    backdrop-filter: blur(5px);
    color: var(--text-primary);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    border-left: 3px solid var(--accent);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.message pre.json-message {
    margin: 0;
    padding: 0;
    background: transparent;
    color: var(--text-primary);
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-x: auto;
    max-width: 100%;
}

.message pre.json-message::-webkit-scrollbar {
    height: 6px;
}

.message pre.json-message::-webkit-scrollbar-thumb {
    background: rgba(74, 158, 255, 0.5);
    border-radius: 3px;
}

.message.system {
    background: transparent;
    color: var(--text-secondary);
    align-self: center;
    font-style: italic;
    text-align: center;
    max-width: 100%;
}

.typing-indicator {
    background: rgba(42, 42, 42, 0.8);
    backdrop-filter: blur(5px);
    padding: 12px 16px;
    border-radius: 8px;
    border-left: 3px solid var(--accent);
}

.typing-indicator p {
    display: flex;
    gap: 4px;
    align-items: center;
    margin: 0;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    animation: typingDot 1.4s infinite;
}

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

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

@keyframes typingDot {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

.chat-input-container {
    display: flex;
    gap: 10px;
    padding: 20px;
    border-top: 1px solid rgba(74, 158, 255, 0.2);
    background: rgba(42, 42, 42, 0.5);
    backdrop-filter: blur(5px);
    animation: inputSlideUp 0.5s ease-out;
}

@keyframes inputSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#messageInput {
    flex: 1;
    background: rgba(26, 26, 26, 0.8);
    border: 1px solid rgba(74, 158, 255, 0.3);
    color: var(--text-primary);
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
}

#messageInput:focus {
    border-color: var(--accent);
    box-shadow: 0 0 15px rgba(74, 158, 255, 0.3);
    background: rgba(26, 26, 26, 0.95);
}

.btn-send {
    background: linear-gradient(135deg, var(--accent) 0%, #5aaeff 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(74, 158, 255, 0.3);
}

.btn-send:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--accent-hover) 0%, #6abfff 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(74, 158, 255, 0.5);
}

.btn-send:active:not(:disabled) {
    transform: translateY(0);
}

.btn-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.voice-controls {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    gap: 30px;
    animation: voiceControlsFadeIn 0.6s ease-out;
}

@keyframes voiceControlsFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.mic-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.mic-button {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 3px solid var(--border);
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    justify-content: center;
    outline: none;
    position: relative;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.mic-button::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid var(--accent);
    opacity: 0;
    transition: all 0.4s ease;
    transform: scale(1.2);
}

.mic-button:hover:not(:disabled)::before {
    opacity: 0.5;
    transform: scale(1.3);
}

.mic-button:hover:not(:disabled) {
    border-color: var(--accent);
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
    transform: scale(1.1);
    box-shadow: 0 8px 25px rgba(74, 158, 255, 0.4);
}

.mic-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.mic-button.recording {
    border-color: var(--error);
    background: linear-gradient(135deg, rgba(244, 67, 54, 0.2) 0%, rgba(244, 67, 54, 0.1) 100%);
    animation: recordingPulse 1.5s infinite;
    box-shadow: 0 0 30px rgba(244, 67, 54, 0.5);
}

.mic-button.recording::before {
    border-color: var(--error);
    opacity: 0.8;
    animation: recordingRipple 1.5s infinite;
}

@keyframes recordingPulse {
    0%, 100% { 
        transform: scale(1);
        box-shadow: 0 0 30px rgba(244, 67, 54, 0.5);
    }
    50% { 
        transform: scale(1.1);
        box-shadow: 0 0 50px rgba(244, 67, 54, 0.8);
    }
}

@keyframes recordingRipple {
    0% {
        transform: scale(1.2);
        opacity: 0.8;
    }
    100% {
        transform: scale(1.8);
        opacity: 0;
    }
}

@keyframes micButtonReady {
    0% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

#micStatus {
    color: var(--text-secondary);
    font-size: 1rem;
    text-align: center;
}

.voice-messages {
    width: 100%;
    max-width: 600px;
    max-height: 300px;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    scroll-behavior: smooth;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    border-radius: 12px;
    border: 1px solid rgba(74, 158, 255, 0.2);
    animation: messagesFadeIn 0.5s ease-out;
}

@keyframes messagesFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.footer {
    text-align: center;
    padding: 30px 20px;
    border-top: 1px solid rgba(74, 158, 255, 0.2);
    margin-top: 40px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    animation: footerFadeIn 0.8s ease-out;
    position: relative;
}

.footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    animation: footerLineExpand 1s ease-out 0.3s forwards;
}

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

@keyframes footerLineExpand {
    to {
        width: 60%;
    }
}

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border);
}

@media (max-width: 768px) {
    .choice-cards {
        flex-direction: column;
        align-items: center;
    }
    
    .choice-card {
        min-width: 100%;
        max-width: 100%;
    }
    
    .chat-container, .voice-chat-container {
        height: calc(100vh - 150px);
    }
    
    .title {
        font-size: 1.5rem;
    }
    
    .welcome-section h2 {
        font-size: 2rem;
    }
}

