* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #10b981;
    --primary-hover: #059669;
    --bg: #fafafa;
    --card: #ffffff;
    --text: #1f2937;
    --text-secondary: #6b7280;
    --border: #e5e7eb;
    --accent: #8b5cf6;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --success-bg: rgba(16, 185, 129, 0.05);
    --danger-bg: rgba(239, 68, 68, 0.05);
    --input-bg: var(--bg);
    --shadow: rgba(0, 0, 0, 0.05);
    --modal-backdrop: rgba(0, 0, 0, 0.5);
    --bronze: #cd7f32;
    --silver: #c0c0c0;
    --gold: #ffd700;
    --platinum: #e5e4e2;
    --diamond: #b9f2ff;
    --master: #ff6b6b;
    --grandmaster: #9f7aea;
}

[data-theme="dark"] {
    --primary: #34d399;
    --primary-hover: #10b981;
    --bg: #0f172a;
    --card: #1e293b;
    --text: #f1f5f9;
    --text-secondary: #94a3b8;
    --border: #334155;
    --accent: #a78bfa;
    --danger: #f87171;
    --warning: #fbbf24;
    --info: #60a5fa;
    --success-bg: rgba(52, 211, 153, 0.1);
    --danger-bg: rgba(248, 113, 113, 0.1);
    --input-bg: #0f172a;
    --shadow: rgba(0, 0, 0, 0.3);
    --modal-backdrop: rgba(0, 0, 0, 0.7);
}

html,
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    height: 100vh;
    width: 100vw;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: background 0.3s, color 0.3s;
}

/* 头部 - 固定高度 */
.header {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 3px var(--shadow);
    transition: background 0.3s, border-color 0.3s;
    flex-shrink: 0;
    height: 64px;
    min-height: 64px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.menu-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    padding: 8px;
    border-radius: 8px;
    transition: background 0.2s;
}

.menu-btn:hover {
    background: var(--bg);
}

.menu-btn span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: background 0.3s;
}

.unit-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    transition: color 0.3s;
}

.progress-text {
    color: var(--text-secondary);
    font-size: 14px;
    margin-left: 8px;
    transition: color 0.3s;
}

.header-center {
    display: flex;
    align-items: center;
    gap: 12px;
}

.select-wrapper {
    position: relative;
}

select {
    appearance: none;
    background: var(--input-bg);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 32px 8px 12px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    outline: none;
    min-width: 150px;
    transition: all 0.3s;
}

select:hover {
    border-color: var(--text-secondary);
}

.select-arrow {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    font-size: 12px;
    color: var(--text-secondary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.icon-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.2s;
    color: var(--text);
}

.icon-btn:hover {
    background: var(--bg);
    transform: scale(1.1);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: var(--text-secondary);
    transition: color 0.3s;
}

.stat-value {
    font-weight: 700;
    color: var(--text);
    font-size: 18px;
    transition: color 0.3s;
}

/* 进度条 */
.progress-bar {
    height: 3px;
    background: var(--border);
    position: relative;
    transition: background 0.3s;
    flex-shrink: 0;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    transition: width 0.3s ease, background 0.3s;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
}

/* 主容器 - 使用flex布局，避免滚动条 */
.main-container {
    flex: 1;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    justify-content: center;
    padding: 16px 20px;
    gap: 16px;
    position: relative;
    overflow: hidden;
    min-height: 0;
}

/* 学习卡片 - 自适应高度，内部可滚动 */
.learning-card {
    flex: 1;
    max-width: 600px;
    background: var(--card);
    border-radius: 16px;
    padding: 24px 28px;
    box-shadow: 0 4px 6px -1px var(--shadow), 0 2px 4px -1px var(--shadow);
    text-align: center;
    position: relative;
    animation: slideIn 0.3s ease;
    transition: background 0.3s, box-shadow 0.3s;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mode-badge {
    display: inline-block;
    padding: 4px 12px;
    background: var(--accent);
    color: white;
    font-size: 12px;
    border-radius: 20px;
    margin-bottom: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

.word-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
    transition: color 0.3s;
    flex-shrink: 0;
}

.word-display {
    font-size: 36px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
    line-height: 1.2;
    transition: color 0.3s;
    flex-shrink: 0;
}

.sentence-display {
    font-size: 20px;
    line-height: 1.5;
    color: var(--text);
    margin-bottom: 10px;
    font-weight: 500;
    transition: color 0.3s;
    flex-shrink: 0;
}

.phonetic {
    font-size: 16px;
    color: var(--accent);
    font-family: "Courier New", monospace;
    margin-bottom: 12px;
    transition: color 0.3s;
    flex-shrink: 0;
}

.hint-text {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 6px;
    font-style: italic;
    transition: color 0.3s;
    flex-shrink: 0;
}

/* 音频可视化 */
.audio-visualizer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    height: 24px;
    margin: 8px 0;
    opacity: 0;
    transition: opacity 0.3s;
    flex-shrink: 0;
}

.audio-visualizer.playing {
    opacity: 1;
}

.audio-visualizer.recording {
    opacity: 1;
}

.audio-visualizer.recording .bar {
    background: #ef4444;
    animation-duration: 0.3s;
}

.bar {
    width: 4px;
    background: var(--accent);
    border-radius: 2px;
    animation: sound 0.5s ease-in-out infinite;
}

.bar:nth-child(1) {
    animation-delay: 0s;
    height: 20%;
}

.bar:nth-child(2) {
    animation-delay: 0.1s;
    height: 40%;
}

.bar:nth-child(3) {
    animation-delay: 0.2s;
    height: 60%;
}

.bar:nth-child(4) {
    animation-delay: 0.3s;
    height: 40%;
}

.bar:nth-child(5) {
    animation-delay: 0.4s;
    height: 20%;
}

@keyframes sound {

    0%,
    100% {
        transform: scaleY(0.5);
    }

    50% {
        transform: scaleY(1);
    }
}

/* 输入区域 */
.input-area {
    position: relative;
    margin: 16px 0;
    flex-shrink: 0;
    padding: 6px;
    border-radius: 22px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(16, 185, 129, 0.15));
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.1);
}

.input-area:focus-within {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.25), rgba(16, 185, 129, 0.25));
    box-shadow: 0 6px 24px rgba(139, 92, 246, 0.2);
}

.word-input {
    width: 100%;
    padding: 18px 24px;
    font-size: 22px;
    font-weight: 700;
    color: var(--primary);
    border: 2px solid var(--border);
    border-radius: 16px;
    text-align: center;
    outline: none;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    background: linear-gradient(135deg, var(--card), var(--input-bg));
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.5);
    letter-spacing: 1px;
}

.word-input::placeholder {
    color: var(--text-secondary);
    font-weight: 500;
    opacity: 0.6;
}

.word-input:hover {
    border-color: var(--accent);
    box-shadow: 0 6px 16px rgba(139, 92, 246, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
}

.word-input:focus {
    border-color: var(--accent);
    background: var(--card);
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.15), 0 8px 24px rgba(139, 92, 246, 0.2);
    transform: translateY(-2px) scale(1.02);
}

.word-input.correct {
    border-color: var(--primary);
    background: linear-gradient(135deg, var(--success-bg), rgba(16, 185, 129, 0.1));
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.2), 0 4px 12px rgba(16, 185, 129, 0.15);
    animation: correctPulse 0.5s ease;
}

.word-input.wrong {
    border-color: var(--danger);
    background: linear-gradient(135deg, var(--danger-bg), rgba(239, 68, 68, 0.1));
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.2), 0 4px 12px rgba(239, 68, 68, 0.15);
    animation: shakeInput 0.4s ease;
}

@keyframes correctPulse {
    0% {
        transform: translateY(-2px) scale(1.02);
    }

    50% {
        transform: translateY(-2px) scale(1.05);
        box-shadow: 0 0 0 6px rgba(16, 185, 129, 0.3), 0 8px 24px rgba(16, 185, 129, 0.25);
    }

    100% {
        transform: translateY(-2px) scale(1.02);
    }
}

@keyframes shakeInput {

    0%,
    100% {
        transform: translateY(-2px) scale(1.02) translateX(0);
    }

    25% {
        transform: translateY(-2px) scale(1.02) translateX(-5px);
    }

    75% {
        transform: translateY(-2px) scale(1.02) translateX(5px);
    }
}

/* 答案显示 */
.answer-reveal {
    font-size: 20px;
    color: var(--accent);
    font-weight: 600;
    margin-top: 8px;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s;
    flex-shrink: 0;
}

.answer-reveal.show {
    opacity: 1;
    transform: translateY(0);
}

/* 提示文字 */
#hint {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 8px;
    flex-shrink: 0;
}

/* 跟读区域 - 重新设计为紧凑布局 */
.shadowing-area {
    flex: 1;
    min-height: 0;
    margin-top: 12px;
    padding: 16px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.05), rgba(16, 185, 129, 0.05));
    border-radius: 12px;
    border: 2px dashed var(--border);
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.shadowing-area:hover {
    border-color: var(--accent);
}

.shadowing-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 8px;
    flex-shrink: 0;
}

.shadowing-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.shadowing-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(139, 92, 246, 0.4);
}

.shadowing-btn.recording {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
    }

    50% {
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }
}

.shadowing-hint {
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
    flex-shrink: 0;
    margin-bottom: 8px;
}

/* 跟读结果 - 内部滚动 */
.shadowing-result {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s;
}

.shadowing-result.show {
    opacity: 1;
    transform: translateY(0);
}

.shadowing-score {
    background: var(--card);
    border-radius: 10px;
    padding: 12px;
    box-shadow: 0 2px 8px var(--shadow);
}

.score-excellent {
    border-left: 4px solid #10b981;
}

.score-good {
    border-left: 4px solid #34d399;
}

.score-fair {
    border-left: 4px solid #f59e0b;
}

.score-poor {
    border-left: 4px solid #ef4444;
}

.word-score-item {
    transition: all 0.2s;
}

.word-score-item:hover {
    transform: scale(1.02);
}

/* 底部控制按钮 - 固定高度 */
.controls {
    background: var(--card);
    border-top: 1px solid var(--border);
    padding: 12px 20px;
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    transition: background 0.3s, border-color 0.3s;
    flex-shrink: 0;
    min-height: 64px;
    max-height: 80px;
}

.control-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 14px;
    border: 1px solid var(--border);
    background: var(--card);
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text);
    transition: all 0.2s;
    user-select: none;
    height: 40px;
}

.control-btn:hover {
    background: var(--bg);
    border-color: var(--text-secondary);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px var(--shadow);
}

.control-btn:active {
    transform: translateY(0);
}

.control-btn.primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.control-btn.primary:hover {
    background: var(--primary-hover);
}

.control-btn.danger {
    color: var(--danger);
    border-color: var(--danger);
}

.control-btn.danger:hover {
    background: var(--danger-bg);
}

.control-btn.recording {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    border-color: #ef4444;
    animation: pulse 1.5s ease-in-out infinite;
}

/* 按钮按下时的样式 - 快捷键触发 */
.control-btn.pressed {
    transform: translateY(2px) scale(0.95);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15);
    background: var(--bg);
    border-color: var(--accent);
}

.control-btn.primary.pressed {
    background: var(--primary-hover);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.control-btn.danger.pressed {
    background: var(--danger-bg);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15);
}

.shortcut {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    color: var(--text-secondary);
    background: var(--bg);
    padding: 2px 4px;
    border-radius: 4px;
    border: 1px solid var(--border);
    font-family: monospace;
    transition: all 0.3s;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--modal-backdrop);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--card);
    border-radius: 16px;
    width: 90%;
    max-width: 900px;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: scaleIn 0.3s ease;
    transition: background 0.3s;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: border-color 0.3s;
}

.modal-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    transition: color 0.3s;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    transition: border-color 0.3s;
}

.close-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg);
    border-radius: 8px;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    transition: all 0.3s;
}

.close-btn:hover {
    background: var(--border);
}

.tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    border-bottom: 2px solid var(--border);
    transition: border-color 0.3s;
}

.tab {
    padding: 12px 20px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}

.tab:hover {
    color: var(--text);
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    transition: color 0.3s;
}

input[type="text"],
textarea,
select {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: all 0.3s;
    background: var(--input-bg);
    color: var(--text);
}

input[type="text"]:focus,
textarea:focus,
select:focus {
    border-color: var(--accent);
}

textarea {
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
}

.help-text {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
    transition: color 0.3s;
}

.table-container {
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    transition: border-color 0.3s;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

th {
    background: var(--bg);
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    transition: all 0.3s;
}

td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    transition: all 0.3s;
}

tr:hover {
    background: var(--bg);
}

/* 禁用状态的行样式 */
tr.disabled {
    opacity: 0.5;
    background: var(--bg);
}

tr.disabled td {
    color: var(--text-secondary);
}

.action-btns {
    display: flex;
    gap: 8px;
}

.icon-action {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: var(--text);
    transition: all 0.2s;
}

.icon-action:hover {
    background: var(--border);
}

.icon-action.edit {
    color: var(--info);
}

.icon-action.delete {
    color: var(--danger);
}

/* 启用/禁用按钮样式 */
.icon-action.toggle-enable {
    font-weight: 700;
    font-size: 14px;
}

.icon-action.toggle-enable.enabled {
    background: var(--success-bg);
    color: var(--primary);
    border: 1px solid var(--primary);
}

.icon-action.toggle-enable.enabled:hover {
    background: var(--primary);
    color: white;
}

.icon-action.toggle-enable.disabled {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid var(--danger);
}

.icon-action.toggle-enable.disabled:hover {
    background: var(--danger);
    color: white;
}

.import-area {
    background: var(--bg);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    transition: background 0.3s;
}

.import-tabs {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.import-tab {
    padding: 8px 16px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.import-tab.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.format-hint {
    background: var(--card);
    padding: 12px;
    border-radius: 6px;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    font-family: monospace;
    border: 1px dashed var(--border);
    transition: all 0.3s;
}

.btn-group {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-text {
    background: transparent;
    color: var(--accent);
    padding: 6px 12px;
}

.btn-text:hover {
    background: rgba(139, 92, 246, 0.1);
}

.voice-settings {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 24px;
}

.voice-settings h3 {
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.voice-option {
    background: rgba(255, 255, 255, 0.1);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 12px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.voice-option:hover {
    background: rgba(255, 255, 255, 0.2);
}

.voice-option.selected {
    border-color: white;
    background: rgba(255, 255, 255, 0.25);
}

.voice-option-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.voice-option-desc {
    font-size: 13px;
    opacity: 0.9;
}

.api-key-input {
    margin-top: 12px;
    display: none;
}

.api-key-input.show {
    display: block;
}

.api-key-input input {
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.toast {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: var(--text);
    color: var(--bg);
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s;
    z-index: 2000;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin: 24px 0;
}

.stat-box {
    background: var(--bg);
    padding: 6px;
    border-radius: 12px;
    transition: background 0.3s;
}

.stat-box-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
    transition: color 0.3s;
}

.stat-box-number {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
}

/* 段位系统样式 */
.rank-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.rank-bronze {
    background: linear-gradient(135deg, #cd7f32, #b87333);
    color: white;
}

.rank-silver {
    background: linear-gradient(135deg, #c0c0c0, #a8a8a8);
    color: white;
}

.rank-gold {
    background: linear-gradient(135deg, #ffd700, #daa520);
    color: #333;
}

.rank-platinum {
    background: linear-gradient(135deg, #e5e4e2, #b8b8b8);
    color: #333;
}

.rank-diamond {
    background: linear-gradient(135deg, #b9f2ff, #87ceeb);
    color: #0066cc;
}

.rank-master {
    background: linear-gradient(135deg, #ff6b6b, #ee5a6f);
    color: white;
}

.rank-grandmaster {
    background: linear-gradient(135deg, #9f7aea, #667eea);
    color: white;
}

.rank-display {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: var(--bg);
    border-radius: 12px;
    margin-bottom: 20px;
}

.rank-icon {
    font-size: 32px;
}

.rank-info {
    flex: 1;
}

.rank-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

.rank-points {
    font-size: 14px;
    color: var(--text-secondary);
}

.progress-ring {
    width: 60px;
    height: 60px;
    position: relative;
}

.progress-ring svg {
    transform: rotate(-90deg);
}

.progress-ring-circle {
    fill: none;
    stroke: var(--border);
    stroke-width: 4;
}

.progress-ring-circle-progress {
    fill: none;
    stroke: var(--primary);
    stroke-width: 4;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.3s;
}

.progress-ring-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    font-weight: 700;
    color: var(--text);
}

.learner-selector {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg);
    border-radius: 12px;
    margin-bottom: 20px;
}

.learner-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--primary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: white;
    font-weight: 700;
}

.learner-info {
    flex: 1;
}

.learner-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}

.learner-rank {
    font-size: 12px;
    color: var(--text-secondary);
}

.learner-switch-btn {
    padding: 8px 16px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text);
    transition: all 0.2s;
}

.learner-switch-btn:hover {
    background: var(--border);
}

.log-entry {
    padding: 16px;
    background: var(--bg);
    border-radius: 12px;
    margin-bottom: 12px;
    border-left: 4px solid var(--primary);
}

.log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.log-date {
    font-size: 12px;
    color: var(--text-secondary);
}

.log-points {
    font-size: 14px;
    font-weight: 700;
    color: var(--primary);
}

.log-content {
    font-size: 14px;
    color: var(--text);
}

.log-stats {
    display: flex;
    gap: 16px;
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

.points-breakdown {
    background: var(--bg);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.points-breakdown h4 {
    margin-bottom: 12px;
    color: var(--text);
}

.points-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

.points-item:last-child {
    border-bottom: none;
    font-weight: 700;
    color: var(--primary);
    margin-top: 8px;
    padding-top: 12px;
    border-top: 2px solid var(--border);
}

.streak-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: linear-gradient(135deg, #ff6b6b, #ffa500);
    color: white;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
}

.theme-toggle {
    position: relative;
}

.theme-icon {
    transition: transform 0.3s;
}

[data-theme="dark"] .theme-icon {
    transform: rotate(180deg);
}

.status-filter {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    padding: 16px;
    background: var(--bg);
    border-radius: 12px;
    margin-bottom: 20px;
    transition: background 0.3s;
    border: 1px solid var(--primary);
}

.status-filter-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    transition: color 0.3s;
}

.status-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 6px;
    background: var(--card);
    border: 1px solid var(--border);
    transition: all 0.2s;
    user-select: none;
}

.status-checkbox:hover {
    border-color: var(--accent);
}

.status-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary);
}

.status-checkbox.new {
    color: var(--text-secondary);
}

.status-checkbox.learning {
    color: var(--warning);
    border-color: var(--warning);
}

.status-checkbox.mastered {
    color: var(--primary);
    border-color: var(--primary);
}

.status-checkbox.active {
    background: var(--success-bg);
}

.filter-info {
    font-size: 12px;
    color: var(--text-secondary);
    margin-left: auto;
    transition: color 0.3s;
}

/* ==================== 收听学习模式样式 - 优化版 ==================== */
.listening-settings {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* 区块标签样式 */
.section-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 12px;
}

.label-icon {
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--bg);
    border-radius: 8px;
}

.label-badge {
    font-size: 11px;
    padding: 2px 8px;
    background: var(--accent);
    color: white;
    border-radius: 12px;
    font-weight: 500;
    margin-left: auto;
}

/* 设置行布局 */
.settings-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.settings-group {
    display: flex;
    flex-direction: column;
}

/* 自定义选择框 */
.custom-select-wrapper {
    position: relative;
}

.custom-select {
    width: 100%;
    padding: 10px 36px 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--card);
    color: var(--text);
    font-size: 14px;
    cursor: pointer;
    outline: none;
    appearance: none;
    transition: all 0.2s;
}

.custom-select:hover,
.custom-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.custom-select-wrapper .select-arrow {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    font-size: 10px;
    color: var(--text-secondary);
}

/* 状态筛选优化 */
.listening-status-filter {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.listening-status-filter .status-checkbox {
    flex: 1;
    min-width: 90px;
    padding: 10px 14px;
    border-radius: 10px;
    background: var(--bg);
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.listening-status-filter .status-checkbox:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow);
    border-color: var(--accent);
}

.listening-status-filter .status-checkbox input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.checkmark {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.checkmark::after {
    content: '✓';
    font-size: 12px;
    color: white;
    opacity: 0;
    transform: scale(0);
    transition: all 0.2s;
}

.listening-status-filter .status-checkbox input:checked~.checkmark {
    background: var(--primary);
    border-color: var(--primary);
}

.listening-status-filter .status-checkbox input:checked~.checkmark::after {
    opacity: 1;
    transform: scale(1);
}

.listening-status-filter .status-checkbox.new input:checked~.checkmark {
    background: var(--text-secondary);
    border-color: var(--text-secondary);
}

.listening-status-filter .status-checkbox.learning input:checked~.checkmark {
    background: var(--warning);
    border-color: var(--warning);
}

.listening-status-filter .status-checkbox.mastered input:checked~.checkmark {
    background: var(--primary);
    border-color: var(--primary);
}

.label-text {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
}

/* 步进器控件 */
.stepper-control {
    display: flex;
    align-items: center;
    gap: 12px;
}

.stepper-btn {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    background: var(--card);
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    transition: all 0.2s;
}

.stepper-btn:hover:not(:disabled) {
    background: var(--bg);
    border-color: var(--accent);
    color: var(--accent);
    transform: scale(1.05);
}

.stepper-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.stepper-btn.minus:hover:not(:disabled) {
    border-color: var(--danger);
    color: var(--danger);
}

.stepper-btn.plus:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
}

.stepper-input {
    width: 50px;
    text-align: center;
    font-weight: 700;
    font-size: 16px;
    border: none;
    background: transparent;
    color: var(--text);
    pointer-events: none;
}

.stepper-unit {
    font-size: 13px;
    color: var(--text-secondary);
    margin-left: -6px;
}

/* 统计卡片 */
.stats-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 20px;
    background: linear-gradient(135deg, var(--bg), var(--card));
    border-radius: 14px;
    border: 1px solid var(--border);
    transition: all 0.3s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px var(--shadow);
    border-color: var(--accent);
}

.stat-icon {
    font-size: 28px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card);
    border-radius: 12px;
    box-shadow: 0 2px 8px var(--shadow);
}

.stat-info {
    flex: 1;
}

.stat-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 2px;
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
}

/* 多单元选择 - 优化版 */
.unit-multi-select {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
    max-height: 240px;
    overflow-y: auto;
    padding: 16px;
    background: var(--bg);
    border-radius: 14px;
    border: 2px solid var(--border);
}

.unit-select-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--card);
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.25s;
    position: relative;
    box-shadow: 0 2px 6px var(--shadow);
}

.unit-select-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px var(--shadow);
    border-color: var(--accent);
}

.unit-select-card.selected {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.08), rgba(16, 185, 129, 0.02));
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15);
}

.unit-select-card .unit-checkbox {
    width: 22px;
    height: 22px;
    border: 2px solid var(--border);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    background: var(--card);
}

.unit-select-card.selected .unit-checkbox {
    background: var(--primary);
    border-color: var(--primary);
}

.unit-select-card.selected .unit-checkbox::after {
    content: '✓';
    color: white;
    font-size: 13px;
    font-weight: 700;
}

.unit-select-card .unit-info {
    flex: 1;
    min-width: 0;
}

.unit-select-card .unit-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 3px;
}

.unit-select-card .unit-meta {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.unit-select-card .unit-type-badge {
    font-size: 10px;
    padding: 3px 10px;
    border-radius: 20px;
    background: var(--accent);
    color: white;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.selected-units-info {
    margin-top: 14px;
    padding: 12px 18px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(139, 92, 246, 0.1));
    border-radius: 10px;
    font-size: 14px;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.info-icon {
    color: var(--primary);
    font-weight: 700;
}

/* 播放预览 - 优化版 */
.listening-preview {
    margin-top: 8px;
    background: var(--bg);
    border-radius: 16px;
    border: 1px solid var(--border);
    overflow: hidden;
    box-shadow: 0 4px 12px var(--shadow);
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px;
    background: var(--card);
    border-bottom: 1px solid var(--border);
}

.preview-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.preview-icon {
    font-size: 20px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    border-radius: 10px;
}

.preview-title h4 {
    font-size: 16px;
    color: var(--text);
    font-weight: 600;
}

.preview-count {
    font-size: 12px;
    padding: 4px 10px;
    background: var(--bg);
    color: var(--text-secondary);
    border-radius: 20px;
    margin-left: 8px;
    font-weight: 500;
}

.preview-legend {
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: var(--text-secondary);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.legend-dot.english {
    background: var(--accent);
}

.legend-dot.chinese {
    background: var(--warning);
}

.legend-icon {
    font-size: 14px;
}

.preview-list {
    max-height: 320px;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.preview-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: var(--card);
    border-radius: 12px;
    border: 1px solid var(--border);
    transition: all 0.25s;
    position: relative;
}

.preview-item:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 12px var(--shadow);
    transform: translateX(4px);
}

.preview-item.playing {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.08), rgba(16, 185, 129, 0.02));
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.preview-number {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    color: white;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
}

.preview-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.preview-english {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.preview-chinese {
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.preview-unit-tag {
    font-size: 11px;
    padding: 4px 10px;
    background: var(--bg);
    color: var(--text-secondary);
    border-radius: 20px;
    font-weight: 600;
    white-space: nowrap;
    border: 1px solid var(--border);
}

.preview-repeat-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(16, 185, 129, 0.2));
    color: var(--primary);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

.preview-footer {
    padding: 14px 20px;
    background: var(--card);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.preview-more {
    font-size: 13px;
    color: var(--text-secondary);
    font-style: italic;
}

.expand-icon {
    transition: transform 0.3s;
}

.btn-text.expanded .expand-icon {
    transform: rotate(180deg);
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-secondary);
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.6;
}

.empty-state p {
    font-size: 14px;
}

/* 进度区域 */
.listening-progress-area {
    margin-top: 20px;
    padding: 20px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(139, 92, 246, 0.1));
    border-radius: 14px;
    border: 2px solid var(--primary);
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 14px;
    color: var(--text);
    font-weight: 500;
}

#listeningProgressPercent {
    font-weight: 700;
    color: var(--primary);
    font-size: 16px;
}

.progress-bar-container {
    height: 10px;
    background: var(--border);
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 14px;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 5px;
    transition: width 0.3s ease;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
}

.current-playing {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--card);
    border-radius: 10px;
    font-size: 14px;
    box-shadow: 0 2px 8px var(--shadow);
}

.playing-label {
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.playing-content {
    flex: 1;
    font-weight: 600;
    color: var(--primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 响应式适配 */
@media (max-width: 1024px) {
    .main-container {
        flex-direction: column;
        padding: 12px;
        gap: 12px;
    }

    .learning-card {
        max-width: 100%;
        width: 100%;
        padding: 20px;
    }

    .word-display {
        font-size: 28px;
    }

    .sentence-display {
        font-size: 18px;
    }

    .shadowing-area {
        margin-top: 8px;
        padding: 12px;
    }

    .settings-row {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .stats-cards {
        grid-template-columns: 1fr;
    }

    .unit-multi-select {
        grid-template-columns: 1fr;
        max-height: 280px;
    }

    .preview-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .preview-legend {
        width: 100%;
        justify-content: flex-start;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 10px 12px;
        height: 56px;
        min-height: 56px;
    }

    .unit-title {
        font-size: 14px;
    }

    .learning-card {
        padding: 16px;
    }

    .word-display {
        font-size: 24px;
    }

    .sentence-display {
        font-size: 16px;
    }

    .word-input {
        padding: 14px 20px;
        font-size: 18px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: 95%;
        max-height: 90vh;
    }

    th,
    td {
        padding: 8px;
        font-size: 13px;
    }

    .status-filter {
        flex-direction: column;
        align-items: flex-start;
    }

    .filter-info {
        margin-left: 0;
        margin-top: 8px;
    }

    .rank-display {
        flex-direction: column;
        text-align: center;
    }

    .shadowing-area {
        padding: 10px;
    }

    .shadowing-btn {
        padding: 8px 16px;
        font-size: 13px;
    }

    .controls {
        padding: 8px;
        gap: 6px;
        min-height: auto;
        max-height: none;
    }

    .control-btn {
        padding: 6px 10px;
        font-size: 12px;
        height: 36px;
    }

    .shortcut {
        display: none;
    }

    .listening-status-filter {
        flex-direction: column;
    }

    .listening-status-filter .status-checkbox {
        width: 100%;
    }

    .preview-item {
        flex-wrap: wrap;
    }

    .preview-unit-tag {
        order: -1;
        margin-bottom: 4px;
    }

    .stats-cards {
        grid-template-columns: 1fr;
    }
}

/* 动画 */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.preview-item {
    animation: slideInUp 0.3s ease;
}

/* 滚动条美化 */
.preview-list::-webkit-scrollbar,
.unit-multi-select::-webkit-scrollbar {
    width: 6px;
}

.preview-list::-webkit-scrollbar-track,
.unit-multi-select::-webkit-scrollbar-track {
    background: transparent;
}

.preview-list::-webkit-scrollbar-thumb,
.unit-multi-select::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.preview-list::-webkit-scrollbar-thumb:hover,
.unit-multi-select::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* ==================== 单词消消乐游戏样式 ==================== */

.game-container {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 24px;
    min-height: 0;
}

.game-settings-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
    max-height: 65vh;
}

.game-section {
    background: var(--bg);
    padding: 16px;
    border-radius: 12px;
    border: 1px solid var(--border);
    flex-shrink: 0;
}

.game-section .section-label {
    margin-bottom: 12px;
    font-size: 14px;
}

/* 难度选择器 */
.difficulty-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.difficulty-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 8px;
    border: 2px solid var(--border);
    background: var(--card);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.difficulty-btn:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.difficulty-btn.active {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(16, 185, 129, 0.05));
}

.diff-icon {
    font-size: 24px;
}

.diff-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.diff-desc {
    font-size: 11px;
    color: var(--text-secondary);
}

.difficulty-info {
    margin-top: 12px;
    padding: 10px;
    background: var(--card);
    border-radius: 8px;
    font-size: 12px;
}

.difficulty-detail {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.diff-tag {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.diff-tag.easy {
    background: #10b981;
    color: white;
}

.diff-tag.normal {
    background: #3b82f6;
    color: white;
}

.diff-tag.hard {
    background: #f59e0b;
    color: white;
}

.diff-tag.expert {
    background: #ef4444;
    color: white;
}

.diff-stats {
    color: var(--text-secondary);
    font-size: 11px;
}

/* 游戏单元选择 */
.game-unit-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 180px;
    overflow-y: auto;
}

.game-unit-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: var(--card);
    border: 2px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.game-unit-card:hover:not(.disabled) {
    border-color: var(--accent);
    transform: translateX(4px);
}

.game-unit-card.selected {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.08), rgba(16, 185, 129, 0.02));
}

.game-unit-card.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--bg);
}

.game-unit-icon {
    font-size: 20px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    border-radius: 8px;
}

.game-unit-info {
    flex: 1;
    min-width: 0;
}

.game-unit-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.game-unit-count {
    font-size: 11px;
    color: var(--text-secondary);
}

.game-unit-count.insufficient {
    color: var(--danger);
}

.selected-mark {
    width: 22px;
    height: 22px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
}

/* 游戏控制按钮 */
.game-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}

.btn-large {
    padding: 14px 24px;
    font-size: 15px;
    justify-content: center;
}

/* 游戏区域 */
.game-play-area {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 0;
}

/* 游戏状态栏 */
.game-status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    border-radius: 12px;
    color: white;
    flex-shrink: 0;
}

.status-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.status-item.score .status-value {
    font-size: 20px;
    font-weight: 700;
    color: #ffd700;
}

.status-icon {
    font-size: 16px;
}

.status-label {
    font-size: 10px;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-value {
    font-size: 16px;
    font-weight: 700;
}

.status-item.combo {
    position: relative;
}

.status-item.combo .combo-active {
    animation: comboPulse 0.5s ease;
    color: #ffd700;
    font-size: 18px;
    font-weight: 800;
}

@keyframes comboPulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.3);
    }
}

/* 游戏板 */
.game-board {
    flex: 1;
    display: grid;
    gap: 12px;
    padding: 16px;
    background: var(--bg);
    border-radius: 12px;
    border: 2px solid var(--border);
    min-height: 0;
    overflow: visible;
    position: relative;
}

/* 暂停遮罩 - 使用真实DOM元素而非伪元素 */
.game-pause-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
    border-radius: 10px;
    backdrop-filter: blur(4px);
    z-index: 100;
    cursor: pointer;
    user-select: none;
}

.game-pause-overlay.show {
    display: flex;
}

.game-board.paused .game-pause-overlay {
    display: flex;
}


/* 游戏卡片 */
.game-card {
    aspect-ratio: 1 / 1.15;
    perspective: 1000px;
    cursor: pointer;
    animation: cardAppear 0.4s ease backwards;
    min-height: 70px;
    max-height: 120px;
}

@keyframes cardAppear {
    from {
        opacity: 0;
        transform: scale(0.5) rotateY(180deg);
    }

    to {
        opacity: 1;
        transform: scale(1) rotateY(0);
    }
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.game-card.flipped .card-inner,
.game-card.matched .card-inner {
    transform: rotateY(180deg);
}

.card-front,
.card-back {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px;
    box-shadow: 0 2px 8px var(--shadow);
}

.card-front {
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    color: white;
}

.card-pattern {
    font-size: 28px;
    opacity: 0.8;
}

.card-back {
    background: var(--card);
    transform: rotateY(180deg);
    border: 2px solid var(--border);
    text-align: center;
}

.card-back.english {
    border-color: var(--accent);
    background: linear-gradient(135deg, var(--card), rgba(139, 92, 246, 0.05));
}

.card-back.chinese {
    border-color: var(--primary);
    background: linear-gradient(135deg, var(--card), rgba(16, 185, 129, 0.05));
}

.card-content {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
    word-break: break-word;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.card-phonetic {
    font-size: 10px;
    color: var(--accent);
    margin-top: 3px;
    font-family: monospace;
}

.card-hint {
    font-size: 9px;
    color: var(--text-secondary);
    margin-top: 2px;
    padding: 2px 5px;
    background: var(--bg);
    border-radius: 3px;
}

.card-type-icon {
    position: absolute;
    top: 5px;
    right: 5px;
    font-size: 11px;
    opacity: 0.6;
}

/* 匹配动画 */
.game-card.matched {
    animation: matchSuccess 0.6s ease;
}

@keyframes matchSuccess {
    0% {
        transform: scale(1);
    }

    25% {
        transform: scale(1.1);
        box-shadow: 0 0 20px var(--primary);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

.game-card.match-success .card-back {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(16, 185, 129, 0.1));
    border-color: var(--primary);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.4);
}

.game-card.match-fail .card-back {
    animation: shake 0.4s ease;
    border-color: var(--danger);
}

@keyframes shake {

    0%,
    100% {
        transform: rotateY(180deg) translateX(0);
    }

    25% {
        transform: rotateY(180deg) translateX(-5px);
    }

    75% {
        transform: rotateY(180deg) translateX(5px);
    }
}

/* 连击特效 */
.combo-effect {
    position: fixed;
    font-size: 26px;
    font-weight: 800;
    color: #ffd700;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    animation: comboFloat 1s ease forwards;
    z-index: 9999;
}

@keyframes comboFloat {
    0% {
        opacity: 1;
        transform: translate(-50%, 0) scale(0.5);
    }

    50% {
        transform: translate(-50%, -30px) scale(1.2);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -60px) scale(1);
    }
}

/* 游戏占位符 */
.game-placeholder {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--text-secondary);
    text-align: center;
}

.placeholder-icon {
    font-size: 56px;
    margin-bottom: 16px;
    opacity: 0.6;
}

.game-tips {
    margin-top: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tip-item {
    font-size: 13px;
    padding: 8px 16px;
    background: var(--card);
    border-radius: 8px;
    border: 1px dashed var(--border);
}

/* 游戏结果 */
.game-result {
    text-align: center;
}

.result-rating {
    margin-bottom: 20px;
}

.rating-stars {
    font-size: 32px;
    letter-spacing: 4px;
    margin-bottom: 8px;
}

.rating-text {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
}

.perfect-badge {
    display: inline-block;
    margin-top: 8px;
    padding: 6px 16px;
    background: linear-gradient(135deg, #ffd700, #ffa500);
    color: #333;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
}

.result-score-board {
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    color: white;
    padding: 24px;
    border-radius: 16px;
    margin-bottom: 20px;
}

.result-final-score {
    font-size: 48px;
    font-weight: 800;
    line-height: 1;
}

.result-score-label {
    font-size: 14px;
    opacity: 0.9;
    margin-top: 4px;
}

.result-breakdown {
    background: var(--bg);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
}

.breakdown-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

.breakdown-item:last-child {
    border-bottom: none;
}

.breakdown-item.bonus {
    color: var(--primary);
    font-weight: 600;
}

.result-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.result-stat {
    background: var(--bg);
    padding: 16px 8px;
    border-radius: 10px;
}

.result-stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

.result-stat-label {
    font-size: 11px;
    color: var(--text-secondary);
}

/* 响应式 */
@media (max-width: 900px) {
    .game-container {
        grid-template-columns: 1fr;
    }

    .game-settings-panel {
        max-height: none;
        order: 2;
    }

    .game-play-area {
        order: 1;
    }

    .difficulty-selector {
        grid-template-columns: repeat(4, 1fr);
    }

    .diff-name,
    .diff-desc {
        display: none;
    }

    .game-board {
        gap: 8px;
        padding: 12px;
    }

    .game-card {
        min-height: 60px;
        max-height: 100px;
    }

    .card-content {
        font-size: 12px;
    }

    .result-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 滚动条美化 */
.game-settings-panel::-webkit-scrollbar,
.game-unit-list::-webkit-scrollbar {
    width: 4px;
}

.game-settings-panel::-webkit-scrollbar-track,
.game-unit-list::-webkit-scrollbar-track {
    background: transparent;
}

.game-settings-panel::-webkit-scrollbar-thumb,
.game-unit-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

/* ==================== 语音模式选择器样式 ==================== */

.voice-mode-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.voice-mode-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 8px;
    border: 2px solid var(--border);
    background: var(--card);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.voice-mode-btn:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.voice-mode-btn.active {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(16, 185, 129, 0.05));
}

.voice-icon {
    font-size: 24px;
}

.voice-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.voice-desc {
    font-size: 11px;
    color: var(--text-secondary);
}

/* 响应式适配 */
@media (max-width: 900px) {
    .voice-mode-selector {
        grid-template-columns: 1fr;
    }
}

/* ==================== 文件导入区域样式 ==================== */

.file-drop-zone {
    border: 2px dashed var(--border);
    border-radius: 16px;
    padding: 28px 32px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: var(--bg);
}

.file-drop-zone:hover {
    border-color: var(--accent);
    background: rgba(139, 92, 246, 0.05);
}

.file-drop-zone.drag-over {
    border-color: var(--primary);
    background: rgba(16, 185, 129, 0.1);
    transform: scale(1.02);
}

.drop-zone-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.6;
}

.drop-zone-text {
    font-size: 16px;
    color: var(--text);
    font-weight: 600;
    margin-bottom: 8px;
}

.drop-zone-hint {
    font-size: 13px;
    color: var(--text-secondary);
}

.import-progress {
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.import-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    width: 0%;
    transition: width 0.3s ease;
}

.import-status-text {
    text-align: center;
    margin-top: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

/* ==================== 学习资源加工页样式 ==================== */

.processor-section {
    background: var(--bg);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.processor-toolbar {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.processor-items-container {
    max-height: 320px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.processor-item {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px;
    transition: all 0.2s;
}

.processor-item:hover {
    border-color: var(--accent);
    box-shadow: 0 2px 8px var(--shadow);
}

.processor-item-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.processor-item-row:last-child {
    margin-bottom: 0;
}

.processor-input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    background: var(--input-bg);
    color: var(--text);
    outline: none;
    transition: all 0.2s;
}

.processor-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.processor-input.english {
    font-weight: 600;
}

.processor-input.phonetic {
    font-family: monospace;
    font-size: 13px;
}

.processor-delete-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--danger-bg);
    color: var(--danger);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s;
}

.processor-delete-btn:hover {
    background: var(--danger);
    color: white;
}

.processor-preview {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
}

.preview-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.preview-row {
    display: flex;
    align-items: center;
    font-size: 14px;
}

.preview-label {
    color: var(--text-secondary);
    width: 80px;
    flex-shrink: 0;
}

.preview-value {
    color: var(--text);
    font-weight: 600;
}

/* 响应式适配 */
@media (max-width: 768px) {
    .file-drop-zone {
        padding: 32px 20px;
    }

    .drop-zone-icon {
        font-size: 36px;
    }

    .drop-zone-text {
        font-size: 14px;
    }

    .processor-item-row {
        flex-direction: column;
    }

    .processor-delete-btn {
        width: 100%;
        height: 32px;
    }
}

/* ==================== 游戏模态框超紧凑布局 - 修复版 ==================== */

.game-compact-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 16px;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

/* 左侧栏 - 固定宽度，flex布局确保按钮始终在底部 */
.game-left-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
    height: 100%;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
}

/* 紧凑区块 */
.game-section-compact {
    background: var(--bg);
    border-radius: 10px;
    padding: 10px;
    border: 1px solid var(--border);
    flex-shrink: 0;
}

.game-section-compact:last-of-type {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* 区块标题行 */
.section-title-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.section-icon {
    font-size: 14px;
}

.section-title-text {
    font-size: 12px;
}

/* 难度网格 - 超紧凑 */
.difficulty-grid-compact {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
}

.diff-btn-compact {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 4px;
    border: 2px solid var(--border);
    background: var(--card);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 60px;
}

.diff-btn-compact:hover {
    border-color: var(--accent);
}

.diff-btn-compact.active {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(16, 185, 129, 0.05));
}

.diff-emoji {
    font-size: 20px;
    line-height: 1;
}

.diff-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.2;
}

.diff-pair {
    font-size: 10px;
    color: var(--text-secondary);
    line-height: 1;
}

/* 难度信息 - 紧凑 */
.difficulty-info-compact {
    margin-top: 8px;
    padding: 6px 8px;
    background: var(--card);
    border-radius: 6px;
    font-size: 10px;
    color: var(--text-secondary);
}

.difficulty-info-compact .diff-tag {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    margin-right: 4px;
}

.difficulty-info-compact .diff-tag.easy {
    background: #10b981;
    color: white;
}

.difficulty-info-compact .diff-tag.normal {
    background: #3b82f6;
    color: white;
}

.difficulty-info-compact .diff-tag.hard {
    background: #f59e0b;
    color: white;
}

.difficulty-info-compact .diff-tag.expert {
    background: #ef4444;
    color: white;
}

.difficulty-info-compact .high-score {
    margin-top: 4px;
    padding: 4px 8px;
    background: linear-gradient(135deg, #ffd700, #ffa500);
    border-radius: 6px;
    color: #333;
    font-weight: 600;
    font-size: 11px;
    text-align: center;
}

/* 语音网格 - 紧凑 */
.voice-grid-compact {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
}

.voice-btn-compact {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px;
    border: 2px solid var(--border);
    background: var(--card);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.voice-btn-compact:hover {
    border-color: var(--accent);
}

.voice-btn-compact.active {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(16, 185, 129, 0.05));
}

.voice-emoji {
    font-size: 16px;
}

.voice-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text);
}

/* 单元列表 - 紧凑可滚动 */
.unit-list-compact {
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    min-height: 0;
}

.unit-list-compact .game-unit-card {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: var(--card);
    border: 2px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.unit-list-compact .game-unit-card:hover:not(.disabled) {
    border-color: var(--accent);
}

.unit-list-compact .game-unit-card.selected {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.08), rgba(16, 185, 129, 0.02));
}

.unit-list-compact .game-unit-card.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.unit-list-compact .game-unit-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    border-radius: 6px;
    font-size: 14px;
}

.unit-list-compact .game-unit-info {
    flex: 1;
    min-width: 0;
}

.unit-list-compact .game-unit-name {
    font-size: 11px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.unit-list-compact .game-unit-count {
    font-size: 10px;
    color: var(--text-secondary);
}

.unit-list-compact .game-unit-count.insufficient {
    color: var(--danger);
}

.unit-list-compact .selected-mark {
    width: 18px;
    height: 18px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
}

/* 固定底部控制区 - 确保始终可见 */
.game-controls-fixed {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    background: var(--card);
    border-radius: 8px;
    padding: 10px;
}

.btn-start-game {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
}

.btn-start-game:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-start-game:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-control {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px;
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
}

.btn-control:hover {
    background: var(--border);
}

.keyboard-hint {
    text-align: center;
    font-size: 11px;
    color: var(--text-secondary);
    padding: 4px;
}

/* 右侧游戏区域 */
.game-right-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.game-board-container {
    flex: 1;
    background: var(--bg);
    border-radius: 12px;
    border: 2px solid var(--border);
    padding: 12px;
    overflow: hidden;
    position: relative;
}

.game-board {
    display: grid;
    gap: 10px;
    width: 100%;
    height: 100%;
    overflow-y: auto;
}

/* 游戏状态栏 */
.game-status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    border-radius: 10px;
    color: white;
    margin-bottom: 12px;
    flex-shrink: 0;
}

.status-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.status-item.score .status-value {
    font-size: 20px;
    font-weight: 700;
    color: #ffd700;
}

.status-icon {
    font-size: 16px;
}

.status-label {
    font-size: 10px;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-value {
    font-size: 16px;
    font-weight: 700;
}

.status-item.combo {
    position: relative;
}

.status-item.combo .combo-active {
    animation: comboPulse 0.5s ease;
    color: #ffd700;
    font-size: 18px;
    font-weight: 800;
}

@keyframes comboPulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.3);
    }
}

/* 游戏卡片 */
.game-card {
    aspect-ratio: 1 / 1.15;
    perspective: 1000px;
    cursor: pointer;
    animation: cardAppear 0.4s ease backwards;
    min-height: 70px;
    max-height: 120px;
}

@keyframes cardAppear {
    from {
        opacity: 0;
        transform: scale(0.5) rotateY(180deg);
    }

    to {
        opacity: 1;
        transform: scale(1) rotateY(0);
    }
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.game-card.flipped .card-inner,
.game-card.matched .card-inner {
    transform: rotateY(180deg);
}

.card-front,
.card-back {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px;
    box-shadow: 0 2px 8px var(--shadow);
}

.card-front {
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    color: white;
}

.card-pattern {
    font-size: 28px;
    opacity: 0.8;
}

.card-back {
    background: var(--card);
    transform: rotateY(180deg);
    border: 2px solid var(--border);
    text-align: center;
}

.card-back.english {
    border-color: var(--accent);
    background: linear-gradient(135deg, var(--card), rgba(139, 92, 246, 0.05));
}

.card-back.chinese {
    border-color: var(--primary);
    background: linear-gradient(135deg, var(--card), rgba(16, 185, 129, 0.05));
}

.card-content {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
    word-break: break-word;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.card-phonetic {
    font-size: 10px;
    color: var(--accent);
    margin-top: 3px;
    font-family: monospace;
}

.card-hint {
    font-size: 9px;
    color: var(--text-secondary);
    margin-top: 2px;
    padding: 2px 5px;
    background: var(--bg);
    border-radius: 3px;
}

.card-type-icon {
    position: absolute;
    top: 5px;
    right: 5px;
    font-size: 11px;
    opacity: 0.6;
}

/* 匹配动画 */
.game-card.matched {
    animation: matchSuccess 0.6s ease;
}

@keyframes matchSuccess {
    0% {
        transform: scale(1);
    }

    25% {
        transform: scale(1.1);
        box-shadow: 0 0 20px var(--primary);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

.game-card.match-success .card-back {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(16, 185, 129, 0.1));
    border-color: var(--primary);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.4);
}

.game-card.match-fail .card-back {
    animation: shake 0.4s ease;
    border-color: var(--danger);
}

@keyframes shake {

    0%,
    100% {
        transform: rotateY(180deg) translateX(0);
    }

    25% {
        transform: rotateY(180deg) translateX(-5px);
    }

    75% {
        transform: rotateY(180deg) translateX(5px);
    }
}

/* 连击特效 */
.combo-effect {
    position: fixed;
    font-size: 26px;
    font-weight: 800;
    color: #ffd700;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    animation: comboFloat 1s ease forwards;
    z-index: 9999;
}

@keyframes comboFloat {
    0% {
        opacity: 1;
        transform: translate(-50%, 0) scale(0.5);
    }

    50% {
        transform: translate(-50%, -30px) scale(1.2);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -60px) scale(1);
    }
}

/* 游戏占位符 */
.game-placeholder {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--text-secondary);
    text-align: center;
    height: 100%;
}

.placeholder-icon {
    font-size: 56px;
    margin-bottom: 16px;
    opacity: 0.6;
}

.game-tips {
    margin-top: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tip-item {
    font-size: 13px;
    padding: 8px 16px;
    background: var(--card);
    border-radius: 8px;
    border: 1px dashed var(--border);
}

/* 暂停遮罩 */
.game-pause-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
    border-radius: 10px;
    backdrop-filter: blur(4px);
    z-index: 100;
    cursor: pointer;
    user-select: none;
}

.game-pause-overlay.show {
    display: flex;
}

.game-board.paused .game-pause-overlay {
    display: flex;
}

/* 响应式 - 小屏幕改为上下布局 */
@media (max-width: 768px) {
    .game-compact-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
        overflow: visible;
    }

    .game-left-panel {
        flex-direction: row;
        flex-wrap: wrap;
        overflow-x: auto;
        overflow-y: hidden;
        padding-right: 0;
        padding-bottom: 8px;
        max-height: none;
    }

    .game-section-compact {
        flex: 1;
        min-width: 140px;
    }

    .game-section-compact:last-of-type {
        flex: 2;
        min-width: 200px;
        max-height: 150px;
    }

    .unit-list-compact {
        max-height: 120px;
    }

    .game-controls-fixed {
        width: 100%;
        flex-direction: row;
        padding-top: 8px;
    }

    .btn-start-game,
    .btn-control {
        flex: 1;
    }

    .keyboard-hint {
        display: none;
    }

    .game-right-panel {
        min-height: 300px;
    }
}

/* 滚动条美化 */
.unit-list-compact::-webkit-scrollbar {
    width: 4px;
}

.unit-list-compact::-webkit-scrollbar-track {
    background: transparent;
}

.unit-list-compact::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

.game-board::-webkit-scrollbar {
    width: 6px;
}

.game-board::-webkit-scrollbar-track {
    background: transparent;
}

.game-board::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}