:root {
    --primary-color: #d4af37;
    --primary-dark: #b8860b;
    --secondary-color: #8b4513;
    --accent-color: #ff6b35;
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --background-light: #fafafa;
    --background-white: #ffffff;
    --border-color: #e0e0e0;
    --shadow-light: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-medium: 0 4px 20px rgba(0, 0, 0, 0.15);
    --border-radius: 12px;
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans SC', sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--background-light);
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1500px;
    margin: 0 auto;
    padding: 0 15px;
}

/* Header Styles */
.header {
    background: var(--background-white);
    box-shadow: var(--shadow-light);
    position: sticky;
    top: 0;
    z-index: 1000;
    flex-shrink: 0;
}

.navbar {
    padding: 1rem 0;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo {
    width: 40px;
    height: 40px;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    font-family: 'Noto Serif SC', serif;
}

.nav-menu {
    display: flex;
    gap: 2rem;
}

.nav-link {
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 500;
    transition: var(--transition);
    position: relative;
}

.nav-link:hover {
    color: var(--primary-color);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary-color);
    transition: var(--transition);
}

.nav-link:hover::after {
    width: 100%;
}

.nav-toggle {
    display: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-primary);
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 1.5rem 0;
    text-align: center;
    flex-shrink: 0;
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    font-family: 'Noto Serif SC', serif;
}

.hero-subtitle {
    font-size: 1.1rem;
    max-width: 800px;
    margin: 0 auto;
    opacity: 0.9;
    line-height: 1.6;
}

/* Translator Section */
.translator {
    padding: 0.5rem 0;
    flex: 1;
    overflow: auto;
}

.translator-card {
    background: var(--background-white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-medium);
    padding: 0.75rem 0.25rem;
    margin-bottom: 0;
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
    height: 580px !important;
    min-height: 580px !important;
}

.language-selectors {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1rem;
    margin-bottom: 0.75rem;
    align-items: end;
}

.language-selector {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.language-selector label {
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.lang-select {
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    background: var(--background-white);
    transition: var(--transition);
    cursor: pointer;
}

.lang-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
}

.swap-languages {
    display: flex;
    align-items: center;
    justify-content: center;
}

.swap-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.swap-btn:hover {
    background: var(--primary-dark);
    transform: rotate(180deg);
}

.translation-area {
    display: grid;
    grid-template-columns: 1fr 90px 1fr;
    gap: 1rem;
    align-items: start;
}

.input-section,
.output-section {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.text-area-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.25rem 0;
}

.language-label {
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.clear-btn,
.tool-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: var(--transition);
}

.clear-btn:hover,
.tool-btn:hover {
    background: var(--background-light);
    color: var(--text-primary);
}

.text-input {
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 0.75rem;
    font-size: 1rem;
    font-family: inherit;
    resize: none;
    height: 320px !important;
    min-height: 320px !important;
    max-height: 320px !important;
    overflow-y: auto;
    transition: var(--transition);
}

.text-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
}

.input-tools {
    display: flex;
    align-items: center;
    padding: 0.25rem 0;
    gap: 0.5rem;
}

.input-tools .char-count {
    margin-left: auto;
}

.input-tools .tool-btn {
    padding: 0.5rem 0.75rem;
}

.char-count {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.translate-button-container {
    display: flex;
    align-items: center;
    justify-content: center;
}

.translate-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: var(--shadow-light);
    white-space: nowrap;
    width: 90px;
    min-width: 90px;
    max-width: 90px;
}

.translate-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

.translate-btn:active {
    transform: translateY(0);
}

.translate-btn:disabled {
    background: var(--text-secondary);
    cursor: not-allowed;
    transform: none;
}

.output-tools {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.text-output {
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 0.75rem;
    background: var(--background-white);
    font-size: 1rem;
    line-height: 1.6;
    overflow-y: auto;
    height: 320px !important;
    min-height: 320px !important;
    max-height: 320px !important;
}

.text-output .placeholder {
    color: var(--text-secondary);
    font-style: italic;
}

.confidence-score {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.alternative-translations {
    color: var(--text-secondary);
}

#alternatives {
    margin-top: 0.5rem;
}

.alternative-item {
    background: var(--background-white);
    padding: 0.5rem;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: var(--transition);
}

.alternative-item:hover {
    background: var(--primary-color);
    color: white;
}

/* Footer */
.footer-simple {
    background: var(--text-primary);
    color: white;
    padding: 0.5rem 0;
    margin-top: 0;
    text-align: center;
    flex-shrink: 0;
}

.footer-simple p {
    margin: 0;
    color: #bdc3c7;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .translator-card {
        padding: 1rem;
        max-width: none;
    }
    
    .text-input,
    .text-output {
        height: 280px !important;
        min-height: 280px !important;
        max-height: 280px !important;
    }
}

@media (max-width: 768px) {
    .nav-menu {
        display: none;
    }
    
    .nav-toggle {
        display: block;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    .hero {
        padding: 1rem 0;
    }
    
    .translator {
        flex: 1;
    }
    
    .language-selectors {
        grid-template-columns: 1fr;
        gap: 0.5rem;
        margin-bottom: 0.5rem;
    }
    
    .swap-languages {
        order: 3;
        margin-top: 0.5rem;
    }
    
    .translation-area {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .translate-button-container {
        order: 2;
    }
    
    .output-section {
        order: 3;
    }
    
    .translator-card {
        padding: 0.75rem;
    }

    .output-tools {
        flex-wrap: wrap;
        gap: 0.3rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }
    
    .hero {
        padding: 0.75rem 0;
    }
    
    .translator {
        flex: 1;
        padding: 0.25rem 0;
    }
    
    .translator-card {
        padding: 0.5rem;
    }
    
    .text-input,
    .text-output {
        height: 240px !important;
        min-height: 240px !important;
        max-height: 240px !important;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    :root {
        --text-primary: #ecf0f1;
        --text-secondary: #bdc3c7;
        --background-light: #2c3e50;
        --background-white: #34495e;
        --border-color: #4a5568;
    }
    
    body {
        background-color: var(--background-light);
    }
}

/* Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus styles for keyboard navigation */
.nav-link:focus,
.lang-select:focus,
.swap-btn:focus,
.translate-btn:focus,
.tool-btn:focus,
.clear-btn:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Message Styles */
.message {
    position: fixed;
    top: 80px;
    right: 20px;
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-medium);
    z-index: 10000;
    font-weight: 500;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
    max-width: 300px;
}

.message.show {
    opacity: 1;
    transform: translateX(0);
}

.message-success {
    background: #d4edda;
    color: #155724;
    border-left: 4px solid #28a745;
}

.message-error {
    background: #f8d7da;
    color: #721c24;
    border-left: 4px solid #dc3545;
}

.message-warning {
    background: #fff3cd;
    color: #856404;
    border-left: 4px solid #ffc107;
}

.message-info {
    background: #d1ecf1;
    color: #0c5460;
    border-left: 4px solid #17a2b8;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --primary-color: #b8860b;
        --text-primary: #000000;
        --text-secondary: #333333;
        --border-color: #666666;
    }
}

/* 朗读进度高亮样式 */
.speech-highlight {
    transition: background-color 0.2s ease, color 0.2s ease, opacity 0.2s ease;
    display: inline;
    position: relative;
    line-height: 1.6;
}

.speech-highlight.current {
    background-color: #007bff;
    color: #ffffff;
    padding: 3px 6px;
    border-radius: 4px;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.3);
}

.speech-highlight.completed {
    background-color: rgba(40, 167, 69, 0.1);
    color: #28a745;
    padding: 1px 2px;
    border-radius: 2px;
    opacity: 0.8;
}

.speech-highlight.pending {
    background-color: transparent;
    color: inherit;
    opacity: 0.6;
}

/* 深色模式下的朗读高亮样式 */
@media (prefers-color-scheme: dark) {
    .speech-highlight.current {
        background-color: #4dabf7;
        color: #000;
        box-shadow: 0 2px 4px rgba(77, 171, 247, 0.4);
    }
    
    .speech-highlight.completed {
        background-color: rgba(64, 192, 87, 0.2);
        color: #51cf66;
    }
    
    .speech-highlight.pending {
        color: inherit;
        opacity: 0.5;
    }
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}