:root {
    --primary-color: #4CAF50;
    --primary-hover: #45a049;
    --secondary-color: #2196F3;
    --secondary-hover: #0b7dda;
    --text-color: #e0e0e0;
    --bg-color: #121212;
    --card-bg: #1e1e1e;
    --border-radius: 8px;
    --box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    --spacing-unit: clamp(0.5rem, 2vw, 1rem);
    --input-bg: #2d2d2d;
    --input-border: #444;
    --output-bg: #252525;
    --output-border: #333;
    --warning-color: #ff9800;
    --success-color: #8bc34a;
    --error-color: #f44336;
}

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

html, body {
    height: 100%;
    width: 100%;
    overflow: hidden;
}

body {
    font-family: sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px;
}

.container {
    width: min(95%, 800px);
    min-height: min(80vh, 600px);
    max-height: 90vh;
    background-color: var(--card-bg);
    padding: clamp(0.8rem, 3vw, 1.5rem);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

h1 {
    color: var(--text-color);
    text-align: center;
    font-size: clamp(1.3rem, 4vw, 1.8rem);
    margin-bottom: var(--spacing-unit);
}

textarea {
    width: 100%;
    height: clamp(100px, 25vh, 200px);
    min-height: 100px;
    padding: 0.8rem;
    margin-bottom: var(--spacing-unit);
    border: 1px solid var(--input-border);
    border-radius: calc(var(--border-radius) / 2);
    resize: none;
    font-family: inherit;
    font-size: clamp(0.85rem, 3vw, 1rem);
    background-color: var(--input-bg);
    color: var(--text-color);
    overflow-y: auto;
}

textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.controls {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-unit);
    margin: var(--spacing-unit) 0;
    width: 100%;
}

.button-row {
    display: flex;
    gap: var(--spacing-unit);
    justify-content: center;
}

button {
    flex: 1;
    min-width: 120px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: calc(var(--border-radius) / 2);
    cursor: pointer;
    font-size: clamp(0.85rem, 3vw, 1rem);
    transition: background-color 0.2s;
    max-width: 200px;
    height: clamp(2.5rem, 6vw, 3rem);
}

button:hover {
    background-color: var(--primary-hover);
}

button.copy {
    background-color: var(--secondary-color);
}

button.copy:hover {
    background-color: var(--secondary-hover);
}

.output-container {
    width: 100%;
    margin-bottom: var(--spacing-unit);
}

.output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

#output {
    width: 100%;
    background-color: var(--output-bg);
    padding: 0.8rem;
    border-radius: calc(var(--border-radius) / 2);
    height: clamp(100px, 25vh, 200px);
    min-height: 100px;
    font-size: clamp(0.85rem, 3vw, 1rem);
    border: 1px solid var(--output-border);
    white-space: pre-wrap;
    color: var(--text-color);
    line-height: 1.5;
    overflow-y: auto;
    overflow-x: hidden;
    word-break: break-word;
}

.status-container {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
    justify-content: center;
}

.status-box {
    font-size: clamp(0.7rem, 3vw, 0.8rem);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    text-align: center;
    white-space: nowrap;
}

.translation-direction {
    color: var(--secondary-color);
    background-color: rgba(33, 150, 243, 0.1);
}

.warning {
    color: var(--warning-color);
    background-color: rgba(255, 152, 0, 0.1);
    display: none;
}

.error {
    color: var(--error-color);
    background-color: rgba(244, 67, 54, 0.1);
    display: none;
}

.success {
    color: var(--success-color);
    background-color: rgba(139, 195, 74, 0.1);
}

@media (max-width: 600px) {
    .container {
        width: 100%;
        padding: 1rem;
        min-height: min(90vh, 500px);
        max-height: 95vh;
    }
    
    .button-row {
        flex-direction: column;
        align-items: center;
    }
    
    button {
        width: 100%;
        max-width: none;
    }
    
    textarea, #output {
        height: clamp(80px, 20vh, 150px);
        min-height: 80px;
    }
}

@media (max-height: 600px) {
    .container {
        min-height: 95vh;
    }
    
    textarea, #output {
        height: clamp(70px, 15vh, 120px);
        min-height: 70px;
    }
}