* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #667eea;
    --primary-dark: #5568d3;
    --primary-light: #8b9ef8;
    --secondary-color: #764ba2;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-light: #9ca3af;
    --bg-light: #f9fafb;
    --bg-white: #ffffff;
    --bg-glass: rgba(255, 255, 255, 0.95);
    --border-color: #e5e7eb;
    --border-light: #f3f4f6;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-glow: 0 0 20px rgba(102, 126, 234, 0.15);
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 18px;
    --radius-xl: 26px;
    --transition-base: cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: cubic-bezier(0.34, 1.56, 0.64, 1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', 'PingFang SC', 'Hiragino Sans GB', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-attachment: fixed;
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 50%, rgba(102, 126, 234, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(118, 75, 162, 0.15) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 12px;
    position: relative;
    z-index: 1;
}

/* 头部优化 */
.header {
    text-align: center;
    color: white;
    margin-bottom: 16px;
    position: relative;
    padding: 16px 0;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.header-top {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 10px;
}

.ui-language-selector {
    display: inline-flex;
    gap: 6px;
    background: rgba(255, 255, 255, 0.2);
    padding: 5px;
    border-radius: var(--radius-xl);
    backdrop-filter: blur(20px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.ui-lang-btn {
    padding: 8px 20px;
    border: none;
    background: transparent;
    color: white;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}

.ui-lang-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}

.ui-lang-btn.active {
    background: white;
    color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.header h1 {
    font-size: clamp(1.3rem, 3.5vw, 1.8rem);
    margin-bottom: 4px;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
    font-weight: 700;
    letter-spacing: -0.5px;
}

.subtitle {
    font-size: clamp(0.8rem, 1.8vw, 0.95rem);
    opacity: 0.95;
    font-weight: 500;
}

/* 主内容布局 - 响应式优化 */
.main-content {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
    gap: 16px;
    align-items: start;
}


/* 翻译和学习区域容器 */
.translation-section,
.learning-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.learning-section {
    position: sticky;
    top: 12px;
    max-height: calc(100vh - 24px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* 卡片通用样式 */
.translator-card,
.vocabulary-card,
.phrases-card,
.vocabulary-learn-card,
.grammar-card,
.practice-card,
.custom-card {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-md);
    padding: 18px;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255, 255, 255, 0.6);
    transition: all 0.4s var(--transition-base);
    position: relative;
    overflow: hidden;
}

.translator-card::before,
.vocabulary-card::before,
.phrases-card::before,
.vocabulary-learn-card::before,
.grammar-card::before,
.practice-card::before,
.custom-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    opacity: 0;
    transition: opacity 0.3s var(--transition-base);
}

.translator-card:hover,
.vocabulary-card:hover,
.phrases-card:hover,
.vocabulary-learn-card:hover,
.grammar-card:hover,
.practice-card:hover,
.custom-card:hover {
    box-shadow: var(--shadow-xl), var(--shadow-glow);
    transform: translateY(-2px);
    border-color: rgba(102, 126, 234, 0.3);
}

.translator-card:hover::before,
.vocabulary-card:hover::before,
.phrases-card:hover::before,
.vocabulary-learn-card:hover::before,
.grammar-card:hover::before,
.practice-card:hover::before,
.custom-card:hover::before {
    opacity: 1;
}

/* 翻译器卡片 */
.language-selector {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.lang-btn {
    padding: 10px 24px;
    border: 2px solid var(--border-color);
    background: white;
    border-radius: var(--radius-xl);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s var(--transition-smooth);
    color: var(--text-primary);
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.lang-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(102, 126, 234, 0.1);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.lang-btn:hover::before {
    width: 300px;
    height: 300px;
}

.lang-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.lang-btn.active {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.35);
    transform: translateY(-2px);
}

.swap-btn {
    padding: 8px 10px;
    border: none;
    background: var(--bg-light);
    border-radius: 50%;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.swap-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: rotate(180deg);
    box-shadow: var(--shadow-sm);
}

/* 语音设置优化 */
.voice-settings {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    padding: 12px;
    border-radius: var(--radius-md);
    margin-bottom: 14px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    align-items: center;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
}

.voice-setting-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.voice-setting-item label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 600;
    min-width: 60px;
}

.voice-setting-item input[type="range"] {
    flex: 1;
    min-width: 70px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.voice-setting-item span {
    font-size: 0.8rem;
    color: var(--primary-color);
    font-weight: 700;
    min-width: 40px;
}

.test-voice-btn {
    padding: 8px 16px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-xl);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}

.test-voice-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.test-voice-btn:active {
    transform: translateY(0);
}

.voice-status {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: white;
    border-radius: var(--radius-xl);
    font-size: 0.8rem;
    border: 1px solid var(--border-color);
    white-space: nowrap;
}

.voice-status.playing {
    background: #e8f5e9;
    border-color: var(--success-color);
}

.voice-status.playing .status-icon {
    animation: pulse 1s infinite;
}

.status-text {
    color: var(--text-secondary);
    font-weight: 600;
}

.voice-status.playing .status-text {
    color: var(--success-color);
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.15); opacity: 0.8; }
}

/* 翻译区域优化 */
.translation-area {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
}

.input-box,
.output-box {
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px;
    background: var(--bg-white);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 220px;
    display: flex;
    flex-direction: column;
}

.input-box:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.input-box textarea {
    width: 100%;
    flex: 1;
    border: none;
    outline: none;
    resize: none;
    font-size: 0.9rem;
    font-family: inherit;
    color: var(--text-primary);
    line-height: 1.5;
}

.input-box textarea::placeholder {
    color: var(--text-light);
}

.output-content {
    flex: 1;
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-primary);
    word-wrap: break-word;
    overflow-y: auto;
}

.input-actions,
.output-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
}

.action-btn {
    padding: 6px 10px;
    border: none;
    background: var(--bg-light);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 1rem;
    color: var(--text-secondary);
}

.action-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.action-btn:active {
    transform: translateY(0);
}

.char-count {
    margin-left: auto;
    font-size: 0.85rem;
    color: var(--text-light);
    font-weight: 500;
}


/* 生词本优化 */
.vocabulary-card {
    margin-top: 20px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border-color);
}

.card-header h3 {
    font-size: 1.1rem;
    color: var(--text-primary);
    font-weight: 700;
}

.small-btn {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text-secondary);
}

.small-btn:hover {
    background: var(--bg-light);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.vocab-list {
    max-height: 320px;
    overflow-y: auto;
    padding-right: 4px;
}

.vocab-item {
    padding: 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--bg-white);
}

.vocab-item:hover {
    background: var(--bg-light);
    border-color: var(--primary-color);
    transform: translateX(4px);
    box-shadow: var(--shadow-sm);
}

.vocab-text {
    flex: 1;
}

.vocab-text .original {
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
    font-size: 1rem;
}

.vocab-text .translation {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.delete-vocab-btn {
    padding: 6px 12px;
    border: none;
    background: var(--error-color);
    color: white;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.delete-vocab-btn:hover {
    background: #d32f2f;
    transform: scale(1.05);
}

.empty-msg {
    text-align: center;
    color: var(--text-light);
    padding: 48px 20px;
    font-size: 1rem;
}

/* 学习导航优化 */
.learning-nav {
    display: flex;
    gap: 6px;
    margin-bottom: 14px;
    flex-wrap: wrap;
    padding: 10px;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: var(--shadow-sm);
}

.nav-btn {
    padding: 8px 14px;
    border: 2px solid transparent;
    background: white;
    border-radius: var(--radius-xl);
    cursor: pointer;
    transition: all 0.3s var(--transition-smooth);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.nav-btn::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--primary-color);
    transform: translateX(-50%);
    transition: width 0.3s var(--transition-base);
}

.nav-btn:hover {
    border-color: rgba(102, 126, 234, 0.3);
    color: var(--primary-color);
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.nav-btn:hover::after {
    width: 80%;
}

.nav-btn.active {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.35);
    transform: translateY(-2px);
}

.nav-btn.active::after {
    display: none;
}

.learning-module {
    display: none;
    animation: fadeIn 0.3s ease;
}

.learning-module.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.module-header {
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 2px solid transparent;
    background: linear-gradient(to right, var(--border-color), transparent);
    background-position: 0 100%;
    background-size: 100% 2px;
    background-repeat: no-repeat;
    position: relative;
}

.module-header::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 50px;
    height: 2px;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
    border-radius: 2px;
}

.module-header h3 {
    font-size: 1.15rem;
    color: var(--text-primary);
    margin-bottom: 4px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.module-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* 标签页优化 */
.tabs,
.grammar-tabs,
.practice-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.tabs.scrollable,
.grammar-tabs.scrollable {
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    flex-wrap: nowrap;
    padding-bottom: 8px;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) var(--bg-light);
}

.tabs.scrollable::-webkit-scrollbar,
.grammar-tabs.scrollable::-webkit-scrollbar {
    height: 6px;
}

.tabs.scrollable::-webkit-scrollbar-track,
.grammar-tabs.scrollable::-webkit-scrollbar-track {
    background: var(--bg-light);
    border-radius: 3px;
}

.tabs.scrollable::-webkit-scrollbar-thumb,
.grammar-tabs.scrollable::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

.tab-btn,
.vocab-tab-btn,
.grammar-tab-btn,
.practice-tab-btn {
    padding: 7px 14px;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: var(--radius-xl);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.tab-btn:hover,
.vocab-tab-btn:hover,
.grammar-tab-btn:hover,
.practice-tab-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: rgba(102, 126, 234, 0.05);
}

.tab-btn.active,
.vocab-tab-btn.active,
.grammar-tab-btn.active,
.practice-tab-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}


/* 搜索框优化 */
.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    padding: 10px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.03) 0%, rgba(118, 75, 162, 0.03) 100%);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
}

.search-input {
    flex: 1;
    padding: 8px 12px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-xl);
    font-size: 0.85rem;
    outline: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: white;
    color: var(--text-primary);
}

.search-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.search-input::placeholder {
    color: var(--text-light);
}

.search-btn {
    padding: 8px 16px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-xl);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}

.search-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.clear-search-btn {
    padding: 8px;
    background: var(--error-color);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 36px;
    height: 36px;
    display: none;
    align-items: center;
    justify-content: center;
}

.clear-search-btn.show {
    display: flex;
}

.clear-search-btn:hover {
    background: #d32f2f;
    transform: rotate(90deg) scale(1.1);
}

.search-count {
    font-size: 0.9rem;
    color: var(--primary-color);
    font-weight: 700;
    min-width: 90px;
    text-align: right;
    white-space: nowrap;
}

/* 搜索高亮 */
.phrase-item.search-result,
.vocab-learn-item.search-result {
    border-color: var(--primary-color);
    background: rgba(102, 126, 234, 0.05);
}

.phrase-item.search-highlight,
.vocab-learn-item.search-highlight {
    animation: highlight-pulse 1s ease;
}

@keyframes highlight-pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.4);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(102, 126, 234, 0);
    }
}

.search-match {
    background: #fff59d;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* 短语内容优化 */
.phrases-content,
.vocabulary-learn-content,
.grammar-content,
.custom-entries-list {
    max-height: 440px;
    overflow-y: auto;
    padding-right: 4px;
}

.phrase-item {
    padding: 12px 14px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s var(--transition-smooth);
    background: white;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.phrase-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    transform: translateX(-4px);
    transition: transform 0.3s var(--transition-smooth);
}

.phrase-item:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.04) 0%, rgba(118, 75, 162, 0.04) 100%);
    border-color: var(--primary-color);
    transform: translateX(8px);
    box-shadow: var(--shadow-md);
}

.phrase-item:hover::before {
    transform: translateX(0);
}

.phrase-zh {
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
    font-size: 0.9rem;
}

.phrase-id {
    color: var(--secondary-color);
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 3px;
}

.phrase-pinyin {
    color: var(--text-light);
    font-size: 0.75rem;
    font-style: italic;
    display: block;
    margin-top: 4px;
}

/* 词汇学习优化 */
.vocabulary-learn-content {
    max-height: 440px;
}

.vocab-category-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary-color);
}

.vocab-learn-item {
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--bg-white);
}

.vocab-learn-item:hover {
    background: var(--bg-light);
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
    transform: translateY(-2px);
}

.vocab-main {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.vocab-zh {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
}

.vocab-arrow {
    color: var(--primary-color);
    font-weight: 700;
    font-size: 0.95rem;
}

.vocab-id {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--secondary-color);
}

.vocab-usage {
    font-size: 0.8rem;
    color: var(--text-secondary);
    padding-left: 8px;
    border-left: 2px solid var(--border-color);
    line-height: 1.5;
}

.usage-label {
    color: var(--text-light);
    font-weight: 700;
    margin-right: 6px;
}

.vocab-speak-btn {
    position: absolute;
    right: 12px;
    top: 12px;
    padding: 6px 10px;
    border: none;
    background: var(--bg-light);
    border-radius: var(--radius-xl);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.9rem;
}

.vocab-speak-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: scale(1.1);
    box-shadow: var(--shadow-sm);
}


/* 语法讲解优化 */
.grammar-content {
    max-height: 500px;
    line-height: 1.8;
}

.grammar-section {
    margin-bottom: 24px;
}

.grammar-section h4 {
    color: var(--primary-color);
    margin-bottom: 14px;
    font-size: 1.15rem;
    font-weight: 700;
}

.grammar-section p {
    color: var(--text-secondary);
    margin-bottom: 12px;
    line-height: 1.7;
}

.grammar-example {
    background: var(--bg-light);
    padding: 14px 16px;
    border-left: 4px solid var(--primary-color);
    margin: 12px 0;
    border-radius: var(--radius-sm);
}

.grammar-example .example-label {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 6px;
    font-weight: 600;
}

.grammar-example .example-text {
    color: var(--text-primary);
    font-weight: 600;
}

/* 练习模块优化 */
.practice-translation,
.practice-choice,
.practice-fill {
    padding: 20px;
}

.practice-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
}

.practice-translation h4,
.practice-choice h4,
.practice-fill h4 {
    font-size: 1.2rem;
    color: var(--text-primary);
    margin: 0;
    font-weight: 700;
}

.practice-stats {
    display: flex;
    gap: 16px;
    font-size: 0.85rem;
}

.practice-progress {
    color: var(--text-secondary);
    font-weight: 600;
}

.practice-score {
    color: var(--primary-color);
    font-weight: 700;
}

.practice-category {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
}

.category-tag {
    display: inline-block;
    padding: 4px 12px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    color: var(--primary-color);
    border-radius: var(--radius-xl);
    font-size: 0.75rem;
    font-weight: 700;
}

.difficulty-tag {
    display: inline-block;
    padding: 4px 10px;
    border-radius: var(--radius-xl);
    font-size: 0.7rem;
}

.difficulty-tag.difficulty-1 {
    background: #e8f5e9;
    color: var(--success-color);
}

.difficulty-tag.difficulty-2 {
    background: #fff3e0;
    color: var(--warning-color);
}

.difficulty-tag.difficulty-3 {
    background: #ffebee;
    color: var(--error-color);
}

.practice-hint {
    color: var(--text-secondary);
    margin-bottom: 14px;
    font-size: 0.9rem;
    font-weight: 500;
}

.practice-question {
    padding: 18px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05), rgba(118, 75, 162, 0.05));
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    border: 2px solid var(--border-light);
}

.question-text {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.6;
}

.practice-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-family: inherit;
    resize: vertical;
    min-height: 90px;
    margin-bottom: 14px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: white;
}

.practice-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.practice-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.practice-btn {
    padding: 10px 20px;
    border: none;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: white;
    border-radius: var(--radius-xl);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 700;
    transition: all 0.3s var(--transition-smooth);
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.practice-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.practice-btn:hover::before {
    left: 100%;
}

.practice-btn:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
}

.practice-btn:active {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.practice-btn.secondary {
    background: white;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.practice-btn.secondary:hover {
    background: var(--bg-light);
    transform: translateY(-2px);
}

.practice-btn.secondary::before {
    display: none;
}

.practice-result {
    padding: 14px 16px;
    border-radius: var(--radius-md);
    margin-top: 14px;
    font-size: 0.9rem;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    font-weight: 600;
}

.practice-result.show {
    opacity: 1;
    transform: translateY(0);
}

.result-correct {
    color: var(--success-color);
    background: #e8f5e9;
    padding: 12px;
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--success-color);
}

.result-wrong {
    color: var(--error-color);
    background: #ffebee;
    padding: 12px;
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--error-color);
}

.result-answer {
    color: var(--primary-color);
    background: rgba(102, 126, 234, 0.1);
    padding: 12px;
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--primary-color);
}

.result-correct small,
.result-wrong small,
.result-answer small {
    display: block;
    margin-top: 6px;
    font-size: 0.8rem;
    opacity: 0.9;
}

/* 选择题优化 */
.choice-question {
    padding: 14px 0;
}

.question-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 18px;
    padding: 14px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05), rgba(118, 75, 162, 0.05));
    border-radius: var(--radius-md);
    border-left: 4px solid var(--primary-color);
}

.choice-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.choice-btn {
    padding: 14px 18px;
    border: 2px solid var(--border-color);
    background: white;
    border-radius: var(--radius-md);
    text-align: left;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text-primary);
}

.choice-btn:hover:not(:disabled) {
    border-color: var(--primary-color);
    background: rgba(102, 126, 234, 0.05);
    transform: translateX(6px);
}

.choice-btn.selected {
    background: rgba(102, 126, 234, 0.1);
    border-color: var(--primary-color);
}

.choice-btn.correct {
    border-color: var(--success-color);
    background: #e8f5e9;
    color: var(--success-color);
    font-weight: 700;
}

.choice-btn.wrong {
    border-color: var(--error-color);
    background: #ffebee;
    color: var(--error-color);
}

.choice-btn:disabled {
    cursor: not-allowed;
}

/* 填空题优化 */
.fill-question {
    padding: 14px 0;
}

.fill-question p {
    font-size: 1rem;
    margin-bottom: 12px;
    line-height: 1.7;
}

.fill-input {
    padding: 6px 12px;
    border: 2px solid var(--primary-color);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    width: 140px;
    text-align: center;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: #fffef7;
}

.fill-input:focus {
    outline: none;
    border-color: var(--primary-dark);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
    background: white;
}

.hint-text {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-style: italic;
    margin-top: 8px;
    padding-left: 24px;
    position: relative;
}

.translation-text {
    color: var(--text-light);
    font-size: 0.85rem;
    margin-top: 6px;
    padding-left: 24px;
}

/* 拼音提示样式 */
.pinyin-hint {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.75);
    font-style: italic;
    font-weight: normal;
    margin-left: 6px;
}

.module-desc .pinyin-hint {
    color: var(--text-light);
}

.phrase-pinyin {
    display: block;
    font-size: 0.85rem;
    color: var(--text-light);
    font-style: italic;
    margin-top: 6px;
}


/* 自定义词条模块优化 */
.custom-form {
    background: var(--bg-light);
    padding: 26px;
    border-radius: var(--radius-md);
    margin-bottom: 28px;
    border: 1px solid var(--border-color);
}

.form-group {
    margin-bottom: 22px;
}

.form-group label {
    display: block;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
    font-size: 1rem;
}

.required {
    color: var(--error-color);
    font-weight: bold;
}

.custom-input,
.custom-select {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: white;
}

.custom-input:focus,
.custom-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.form-hint {
    display: block;
    margin-top: 8px;
    font-size: 0.85rem;
    color: var(--text-light);
    font-style: italic;
    line-height: 1.5;
}

.add-custom-btn {
    width: 100%;
    padding: 16px 28px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border: none;
    border-radius: var(--radius-xl);
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-md);
}

.add-custom-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
}

.add-custom-btn:active {
    transform: translateY(-1px);
}

.custom-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 2px solid var(--border-color);
}

.custom-list-header h4 {
    font-size: 1.25rem;
    color: var(--text-primary);
    font-weight: 700;
}

.clear-custom-btn {
    padding: 10px 18px;
    background: var(--error-color);
    color: white;
    border: none;
    border-radius: var(--radius-xl);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.clear-custom-btn:hover {
    background: #d32f2f;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(244, 67, 54, 0.3);
}

.custom-entries-list {
    max-height: 420px;
}

.custom-entry-item {
    background: white;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    margin-bottom: 14px;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.custom-entry-item:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
    transform: translateY(-2px);
}

.custom-entry-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 14px;
}

.custom-entry-main {
    flex: 1;
}

.custom-entry-lang {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.custom-zh {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
}

.custom-id {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--secondary-color);
}

.custom-pinyin-display {
    font-size: 0.95rem;
    color: var(--primary-color);
    font-style: italic;
    font-weight: 600;
}

.custom-category-tag {
    display: inline-block;
    padding: 6px 14px;
    background: rgba(102, 126, 234, 0.1);
    color: var(--primary-color);
    border-radius: var(--radius-xl);
    font-size: 0.85rem;
    font-weight: 700;
}

.custom-usage {
    margin-top: 10px;
    padding-left: 14px;
    border-left: 3px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
}

.custom-entry-actions {
    display: flex;
    gap: 10px;
}

.custom-action-btn {
    padding: 8px 14px;
    border: none;
    border-radius: var(--radius-xl);
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.speak-custom-btn {
    background: rgba(102, 126, 234, 0.1);
    color: var(--primary-color);
}

.speak-custom-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: scale(1.05);
}

.delete-custom-btn {
    background: rgba(244, 67, 54, 0.1);
    color: var(--error-color);
}

.delete-custom-btn:hover {
    background: var(--error-color);
    color: white;
    transform: scale(1.05);
}

/* 通用滚动条美化 */
.vocab-list::-webkit-scrollbar,
.phrases-content::-webkit-scrollbar,
.vocabulary-learn-content::-webkit-scrollbar,
.grammar-content::-webkit-scrollbar,
.custom-entries-list::-webkit-scrollbar {
    width: 8px;
}

.vocab-list::-webkit-scrollbar-track,
.phrases-content::-webkit-scrollbar-track,
.vocabulary-learn-content::-webkit-scrollbar-track,
.grammar-content::-webkit-scrollbar-track,
.custom-entries-list::-webkit-scrollbar-track {
    background: var(--bg-light);
    border-radius: 4px;
}

.vocab-list::-webkit-scrollbar-thumb,
.phrases-content::-webkit-scrollbar-thumb,
.vocabulary-learn-content::-webkit-scrollbar-thumb,
.grammar-content::-webkit-scrollbar-thumb,
.custom-entries-list::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

.vocab-list::-webkit-scrollbar-thumb:hover,
.phrases-content::-webkit-scrollbar-thumb:hover,
.vocabulary-learn-content::-webkit-scrollbar-thumb:hover,
.grammar-content::-webkit-scrollbar-thumb:hover,
.custom-entries-list::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* 响应式设计优化 */
@media (max-width: 1400px) {
    .container {
        padding: 18px;
    }
    
    .main-content {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: 20px;
    }
    
    .learning-section {
        position: static;
        max-height: none;
    }
    
    .translator-card,
    .vocabulary-card,
    .phrases-card,
    .vocabulary-learn-card,
    .grammar-card,
    .practice-card,
    .custom-card {
        padding: 24px;
    }
}

@media (max-width: 1024px) {
    .container {
        padding: 12px;
    }
    
    .main-content {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .translation-area {
        grid-template-columns: 1fr;
    }
    
    .voice-settings {
        grid-template-columns: 1fr;
    }
    
    .learning-section {
        position: static;
        max-height: none;
    }
    
    .nav-btn {
        font-size: 0.85rem;
        padding: 8px 14px;
    }
    
    .phrases-content,
    .vocabulary-learn-content,
    .grammar-content,
    .custom-entries-list {
        max-height: 400px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 8px;
    }
    
    .header {
        margin-bottom: 16px;
        padding: 12px 0;
    }
    
    .header h1 {
        font-size: 1.5rem;
    }
    
    .subtitle {
        font-size: 0.9rem;
    }
    
    .language-selector {
        flex-direction: column;
        gap: 12px;
    }
    
    .lang-btn {
        width: 100%;
        padding: 14px 24px;
    }
    
    .translator-card,
    .vocabulary-card,
    .phrases-card,
    .vocabulary-learn-card,
    .grammar-card,
    .practice-card,
    .custom-card {
        padding: 16px;
        border-radius: var(--radius-md);
    }
    
    .voice-settings {
        grid-template-columns: 1fr;
        padding: 12px;
    }
    
    .test-voice-btn,
    .voice-status {
        width: 100%;
        justify-content: center;
    }
    
    .learning-nav {
        padding: 8px;
        gap: 6px;
    }
    
    .nav-btn {
        font-size: 0.8rem;
        padding: 8px 12px;
    }
    
    .tabs,
    .grammar-tabs,
    .practice-tabs {
        gap: 6px;
    }
    
    .tab-btn,
    .vocab-tab-btn,
    .grammar-tab-btn,
    .practice-tab-btn {
        padding: 8px 14px;
        font-size: 0.85rem;
    }
    
    .search-box {
        flex-wrap: wrap;
        padding: 10px;
    }
    
    .search-btn {
        flex: 1;
        min-width: 80px;
    }
    
    .search-count {
        width: 100%;
        text-align: center;
    }
    
    .pinyin-hint {
        display: none;
    }
    
    .module-header h3 {
        font-size: 1.2rem;
    }
    
    .practice-actions {
        flex-direction: column;
    }
    
    .practice-btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .ui-language-selector {
        flex-direction: column;
        width: 100%;
    }
    
    .ui-lang-btn {
        width: 100%;
        justify-content: center;
    }
    
    .input-box,
    .output-box {
        min-height: 200px;
    }
    
    .action-btn {
        font-size: 1rem;
        padding: 6px 10px;
    }
    
    .char-count {
        font-size: 0.75rem;
    }
}

/* 打印样式 */
@media print {
    body {
        background: white;
    }
    
    .header-top,
    .learning-nav,
    .action-btn,
    .search-box,
    .practice-actions {
        display: none;
    }
    
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .translator-card,
    .vocabulary-card,
    .phrases-card,
    .vocabulary-learn-card,
    .grammar-card,
    .practice-card,
    .custom-card {
        box-shadow: none;
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }
}
