.translation-container {
    max-width: min(800px, 95vw);
    margin: 0 auto;
    background: white;
    padding: clamp(20px, 5vw, 30px);
    border-radius: clamp(10px, 2.5vw, 15px);
    box-shadow: 0 2px 10px #eee;
    display: none;
    width: 100%;
    box-sizing: border-box;
}

.translation-title {
    text-align: center;
    margin-bottom: clamp(15px, 4vw, 20px);
    color: #333;
    font-size: clamp(20px, 4.5vw, 24px);
    font-weight: 600;
}

.lang-selector {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: clamp(8px, 2vw, 15px);
    margin: clamp(15px, 4vw, 20px) 0;
    flex-wrap: wrap;
}

.lang-select {
    padding: clamp(8px, 2vw, 12px) clamp(12px, 3vw, 15px);
    border: 1px solid #ddd;
    border-radius: clamp(15px, 4vw, 20px);
    font-size: clamp(12px, 2.5vw, 14px);
    background: white;
    cursor: pointer;
    min-width: 80px;
    max-width: 100%;
}

.swap-btn {
    background: #e6f2ff;
    border: none;
    width: clamp(36px, 8vw, 40px);
    height: clamp(36px, 8vw, 40px);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(16px, 3.5vw, 20px);
    flex-shrink: 0;
}

.swap-btn:hover {
    background: #cfe6ff;
}

.translation-boxes {
    display: flex;
    gap: clamp(15px, 3vw, 20px);
    margin: clamp(15px, 4vw, 20px) 0;
    flex-direction: row;
    width: 100%;
}

.text-box {
    flex: 1;
    min-width: 0;
}

.text-label {
    margin-bottom: clamp(6px, 1.5vw, 8px);
    color: #666;
    font-size: clamp(12px, 2.5vw, 14px);
    font-weight: 500;
}

#source-text, #result-text {
    width: 100%;
    height: clamp(150px, 40vh, 200px);
    padding: clamp(10px, 2.5vw, 15px);
    border: 1px solid #ddd;
    border-radius: clamp(8px, 2vw, 10px);
    resize: vertical;
    font-size: clamp(14px, 2.8vw, 16px);
    box-sizing: border-box;
    line-height: 1.6;
    font-family: inherit;
}

#result-text {
    background: #f9f9f9;
}

.translate-btn {
    display: block;
    margin: clamp(15px, 4vw, 20px) auto;
    padding: clamp(10px, 2.5vw, 12px) clamp(25px, 6vw, 30px);
    background: #4096ff;
    color: white;
    border: none;
    border-radius: clamp(20px, 5vw, 25px);
    cursor: pointer;
    font-size: clamp(14px, 2.8vw, 16px);
    font-weight: 500;
    transition: background 0.3s;
    width: auto;
    max-width: 100%;
}

.translate-btn:hover {
    background: #3086ff;
}

.back-btn {
    display: block;
    margin: clamp(8px, 2vw, 10px) auto;
    padding: clamp(8px, 2vw, 10px) clamp(18px, 4vw, 20px);
    background: #f0f0f0;
    border: none;
    border-radius: clamp(18px, 4.5vw, 20px);
    cursor: pointer;
    color: #666;
    font-size: clamp(13px, 2.6vw, 14px);
    transition: background 0.3s;
    width: auto;
    max-width: 100%;
}

.back-btn:hover {
    background: #e0e0e0;
}

@media (max-width: 768px) {
    .translation-container {
        padding: clamp(15px, 4vw, 20px);
    }
    
    .translation-boxes {
        flex-direction: column;
        gap: clamp(15px, 4vw, 20px);
    }
    
    #source-text, #result-text {
        height: clamp(120px, 35vh, 160px);
    }
    
    .lang-selector {
        gap: clamp(6px, 1.5vw, 10px);
    }
}

@media (max-width: 480px) {
    .translation-container {
        padding: clamp(12px, 3vw, 15px);
        border-radius: clamp(8px, 2vw, 10px);
    }
    
    .lang-selector {
        gap: clamp(8px, 2vw, 12px);
    }
    
    .lang-select {
        flex: 1;
        min-width: 100px;
        max-width: calc(50% - 25px);
    }
    
    #source-text, #result-text {
        height: clamp(100px, 30vh, 140px);
        padding: clamp(8px, 2vw, 10px);
    }
    
    .translate-btn, .back-btn {
        width: 100%;
        padding-left: 20px;
        padding-right: 20px;
    }
}

@media (orientation: landscape) and (max-height: 600px) {
    .translation-boxes {
        flex-direction: row;
    }
    
    #source-text, #result-text {
        height: clamp(80px, 35vh, 120px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .translate-btn, .back-btn, .swap-btn {
        transition: none !important;
    }
}
