:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --secondary: #ec4899;
    --bg-dark: #0f172a;
    --sidebar-bg: #1e293b;
    --card-bg: rgba(30, 41, 59, 0.7);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: rgba(255, 255, 255, 0.1);
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body.light-mode {
    --bg-dark: #f1f5f9;
    --sidebar-bg: #ffffff;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #475569;
    --border: rgba(0, 0, 0, 0.08);
    --glass-bg: rgba(0, 0, 0, 0.03);
    --glass-border: rgba(0, 0, 0, 0.08);
}

/* Light mode - Sidebar */
body.light-mode .sidebar { background: #ffffff; border-right: 1px solid #e2e8f0; }
body.light-mode .nav-item { color: #475569; }
body.light-mode .nav-item:hover { background: #f1f5f9; color: #1e293b; }
body.light-mode .nav-item.active { background: linear-gradient(135deg, #6366f1, #ec4899); color: white; }

/* Light mode - Header */
body.light-mode .top-header { background: #ffffff; border-bottom: 1px solid #e2e8f0; }
body.light-mode .search-bar input { background: #f1f5f9; color: #1e293b; border-color: #e2e8f0; }
body.light-mode .search-bar input::placeholder { color: #94a3b8; }
body.light-mode #theme-toggle { color: #475569; }

/* Light mode - Cards */
body.light-mode .card { background: #ffffff; box-shadow: 0 2px 8px rgba(0,0,0,0.06); border-color: #e2e8f0; }
body.light-mode .word { color: #1e293b; }
body.light-mode .meaning { color: #475569; }
body.light-mode .example { background: #f8fafc; color: #334155; border: 1px solid #e2e8f0; }

/* Light mode - Stat cards */
body.light-mode .stat-card { background: #ffffff; box-shadow: 0 2px 8px rgba(0,0,0,0.06); border-color: #e2e8f0; }
body.light-mode .stat-card h3 { color: #1e293b; }
body.light-mode .stat-card p { color: #475569; }

/* Light mode - Filters & Controls */
body.light-mode .filter-btn { background: #f1f5f9; color: #475569; border-color: #e2e8f0; }
body.light-mode .filter-btn:hover { background: #e2e8f0; }
body.light-mode .filter-btn.active { background: #6366f1; color: white; border-color: #6366f1; }
body.light-mode .vocab-controls { background: #ffffff; border-color: #e2e8f0; }
body.light-mode .switch-container { color: #475569; }

/* Light mode - Scenario */
body.light-mode .scenario-tabs { background: #ffffff; border-color: #e2e8f0; }
body.light-mode .scenario-tab { background: #f1f5f9; color: #475569; border-color: #e2e8f0; }
body.light-mode .scenario-tab:hover { background: #e2e8f0; }
body.light-mode .scenario-tab.active { background: linear-gradient(135deg, #6366f1, #ec4899); color: white; }

/* Light mode - Sentences */
body.light-mode .sent-item { background: #ffffff; border-color: #e2e8f0; box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
body.light-mode .sent-vn { color: #1e293b; }
body.light-mode .sent-en { color: #475569; }
body.light-mode .sent-cn { color: #7c3aed; }
body.light-mode .long-sent { background: #ffffff; border-color: #e2e8f0; }

/* Light mode - Buttons */
body.light-mode .spk-btn { border-color: #6366f1; color: #6366f1; }
body.light-mode .spk-btn:hover { background: #6366f1; color: white; }
body.light-mode .learned-btn { border-color: #94a3b8; color: #475569; }

/* Light mode - Phonetic */
body.light-mode .phoneme-card { background: #ffffff; border-color: #e2e8f0; box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
body.light-mode .phoneme-card .symbol { color: #1e293b; }
body.light-mode .phoneme-card .desc { color: #475569; }

/* Light mode - Section headers */
body.light-mode h1, body.light-mode h2, body.light-mode h3 { color: #1e293b; }
body.light-mode .lang-toggle .lang-btn { color: #475569; border-color: #e2e8f0; }
body.light-mode .lang-toggle .lang-btn.active { background: #6366f1; color: white; border-color: #6366f1; }

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', 'Outfit', sans-serif;
}

body {
    background: var(--bg-dark);
    color: var(--text-main);
    overflow: hidden;
    height: 100vh;
}

.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar Styling */
.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 24px;
    z-index: 100;
    overflow-y: auto;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 40px;
    font-family: 'Outfit', sans-serif;
    justify-content: space-between;
}

.logo .theme-toggle {
    margin-left: auto;
    font-size: 1rem;
    padding: 6px 8px;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-muted);
    transition: var(--transition);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    flex-shrink: 0;
}

.logo .theme-toggle:hover {
    background: rgba(255,255,255,0.1);
    color: var(--text-main);
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.nav-item {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 12px 16px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: var(--transition);
    text-align: left;
}

.nav-item:hover {
    background: var(--glass-bg);
    color: var(--text-main);
}

.nav-item.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.nav-item i {
    font-size: 1.1rem;
}

.lang-switch-container {
    margin-top: auto;
    background: var(--glass-bg);
    padding: 16px;
    border-radius: var(--radius);
    border: 1px solid var(--glass-border);
}

.lang-switch-container p {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.lang-buttons {
    display: flex;
    gap: 6px;
}

.lang-buttons button {
    flex: 1;
    padding: 6px 2px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.85rem;
    transition: var(--transition);
}

.lang-buttons button.active {
    background: white;
    color: var(--bg-dark);
    font-weight: 600;
}

/* Main Content Styling */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    background: radial-gradient(circle at top right, rgba(99, 102, 241, 0.05), transparent 400px),
                radial-gradient(circle at bottom left, rgba(236, 72, 153, 0.05), transparent 400px);
}

.top-header {
    height: 80px;
    padding: 0 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
}

.search-bar {
    position: relative;
    width: 400px;
}

.search-bar i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-bar input {
    width: 100%;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 10px 16px 10px 44px;
    border-radius: 20px;
    color: var(--text-main);
    outline: none;
    transition: var(--transition);
}

.search-bar input:focus {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.05);
}

.mobile-lang-switch {
    display: none;
    gap: 8px;
    margin: 0 10px;
}

.lang-btn-mini {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    cursor: pointer;
}

.lang-btn-mini.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.mobile-theme-toggle {
    display: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 1.1rem;
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    transition: var(--transition);
    flex-shrink: 0;
}

.mobile-theme-toggle:hover {
    color: var(--text-main);
    background: rgba(255,255,255,0.1);
}

.theme-toggle {
    cursor: pointer;
    color: var(--text-muted);
    font-size: 1.2rem;
}

/* Section Styling */
.content-section {
    display: none;
    flex: 1;
    overflow-y: auto;
    padding: 40px;
    animation: fadeIn 0.4s ease-out;
}

.content-section.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.section-header {
    margin-bottom: 32px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 8px;
    font-family: 'Outfit', sans-serif;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1rem;
}

.badge {
    background: var(--primary);
    font-size: 0.8rem;
    padding: 4px 10px;
    border-radius: 20px;
    vertical-align: middle;
    margin-left: 12px;
}

.filters {
    display: flex;
    gap: 8px;
}

.filter-btn {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    padding: 6px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: var(--transition);
}

.filter-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.filter-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    font-weight: 600;
}

.vocab-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    align-items: center;
    background: var(--glass-bg);
    padding: 20px;
    border-radius: var(--radius);
    border: 1px solid var(--glass-border);
}

.filters-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.filters-group p {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
}

/* Switch */
.switch-container {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-muted);
    user-select: none;
}

.switch-container input { display: none; }
.slider {
    width: 34px;
    height: 20px;
    background: #ccc;
    border-radius: 20px;
    position: relative;
    transition: .4s;
}

.slider:before {
    content: "";
    position: absolute;
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: .4s;
}

input:checked + .slider { background: var(--primary); }
input:checked + .slider:before { transform: translateX(14px); }

/* Learned status on cards */
.card.learned {
    opacity: 0.6;
    border-color: #10b981;
}

.card.learned::after {
    content: '\f058';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: 10px;
    left: 10px;
    color: #10b981;
    font-size: 1.2rem;
}

.learned-btn {
    background: transparent;
    border: 1px solid var(--text-muted);
    color: var(--text-muted);
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: var(--transition);
}

.learned-btn.active {
    background: #10b981;
    color: white;
    border-color: #10b981;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--card-bg);
    padding: 20px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    text-align: center;
}

.stat-card h3 {
    font-size: 1.8rem;
    color: var(--primary);
    margin-bottom: 4px;
}

.stat-card p {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Card Grid */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 24px;
    position: relative;
    transition: var(--transition);
    cursor: default;
}

.card:hover {
    transform: translateY(-4px);
    background: rgba(30, 41, 59, 0.9);
    border-color: var(--primary);
    box-shadow: 0 12px 24px rgba(0,0,0,0.2);
}

.card .cat-badge {
    position: absolute;
    top: 24px;
    right: 24px;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: 700;
}

.badge-基础词 { background: #10b981; }
.badge-生活词 { background: #3b82f6; }
.badge-场景词 { background: #f59e0b; }
.badge-商务词 { background: #8b5cf6; }
.badge-学术词 { background: #ef4444; }

.word {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 4px;
    color: white;
}

.pinyin {
    font-size: 0.95rem;
    color: var(--secondary);
    margin-bottom: 8px;
    font-family: 'Inter', sans-serif;
    opacity: 0.9;
}

.meaning {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 16px;
    line-height: 1.5;
}

.example-block {
    position: relative;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 12px 40px 12px 16px;
    margin-bottom: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.example {
    font-size: 0.9rem;
    color: var(--text-main);
    font-style: italic;
    line-height: 1.4;
}

.example-cn {
    font-size: 0.8rem;
    color: var(--secondary);
    margin-top: 6px;
    opacity: 0.8;
}

.example-pinyin {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
    opacity: 0.7;
}

.example-spk {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    padding: 6px !important;
    border-radius: 50% !important;
    width: 32px;
    height: 32px;
    justify-content: center;
}

body.light-mode .example-block {
    background: #f8fafc;
    border-color: #e2e8f0;
}

body.light-mode .example-cn {
    color: #7c3aed;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.level-badge {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--primary);
}

.spk-btn {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
}

.spk-btn:hover {
    background: var(--primary);
    color: white;
}

/* Scenario Tabs - Multi-row grid */
.scenario-layout {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.scenario-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 20px;
    background: var(--glass-bg);
    border-radius: var(--radius);
    border: 1px solid var(--glass-border);
}

.scenario-tab {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    padding: 10px 16px;
    border-radius: 10px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
    font-size: 0.85rem;
    white-space: nowrap;
}

.scenario-tab:hover { background: rgba(255,255,255,0.08); }
.scenario-tab.active {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    font-weight: 600;
}

.scenario-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: 600px;
    overflow-y: auto;
    padding-right: 8px;
}

/* Scenario List */
.sent-item {
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 20px;
    margin-bottom: 16px;
    display: grid;
    grid-template-columns: 1fr 100px;
    gap: 20px;
    transition: var(--transition);
}

.sent-item:hover { border-color: var(--glass-border); background: rgba(255,255,255,0.02); }

.sent-texts {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sent-vn { font-size: 1.1rem; font-weight: 600; color: white; }
.sent-en { font-size: 0.95rem; color: var(--text-muted); }
.sent-cn { font-size: 0.9rem; color: var(--secondary); opacity: 0.8; }

.sent-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Phonetic Grid */
.phoneme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.phoneme-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    padding: 20px;
    border-radius: var(--radius);
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

.phoneme-card:hover { transform: scale(1.05); border-color: var(--primary); }

.phoneme-card .symbol { font-size: 1.8rem; font-weight: 700; color: var(--primary); margin-bottom: 4px; }
.phoneme-card .ipa { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 8px; }
.phoneme-card .desc { font-size: 0.75rem; color: var(--text-main); }

/* Long Sentences */
.long-sent {
    background: var(--card-bg);
    border: 1px solid var(--border);
    padding: 24px;
    border-radius: var(--radius);
    margin-bottom: 24px;
    border-left: 4px solid var(--primary);
}

/* === TONE CARD STYLES === */
.tone-section {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
}

.tone-section::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
}

.tone-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.tone-symbol-big {
    font-size: 3.5rem;
    font-weight: 900;
    color: var(--primary);
    line-height: 1;
    min-width: 60px;
    text-align: center;
}

.tone-info h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 4px;
}

.tone-info .tone-mark {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.tone-pitch {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.3);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.82rem;
    color: var(--primary);
    font-weight: 600;
    margin-right: 8px;
}

.tone-icon {
    font-size: 1.2rem;
    font-weight: 700;
}

.tone-desc {
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 16px;
    padding: 10px 14px;
    background: var(--glass-bg);
    border-radius: 8px;
    border-left: 3px solid var(--secondary);
}

.tone-words-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    margin-bottom: 10px;
}

.tone-words-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
}

.tone-word-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 12px 8px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

.tone-word-card:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
    transform: translateY(-2px);
}

.tone-word-card .tw-word {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 4px;
}

.tone-word-card .tw-meaning {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.tone-word-card .tw-spk {
    margin-top: 6px;
    font-size: 0.7rem;
    color: var(--secondary);
    opacity: 0.7;
}

body.light-mode .tone-section {
    background: #ffffff;
    border-color: #e2e8f0;
}

body.light-mode .tone-word-card {
    background: #f8fafc;
    border-color: #e2e8f0;
}

body.light-mode .tone-word-card:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.08);
}


/* Audio Pulse Animation */
.audio-pulse {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: var(--primary);
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 20px var(--primary);
    z-index: 1000;
}

.audio-pulse::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: inherit;
    border-radius: inherit;
    animation: pulse 1.5s infinite;
    opacity: 0.5;
}
/* ==========================================
   RESPONSIVE DESIGN (MOBILE)
   ========================================== */

@media (max-width: 1024px) {
    .sidebar {
        width: 80px;
        padding: 20px 10px;
    }
    .sidebar .logo span, .nav-item span, .lang-switch-container {
        display: none;
    }
    .logo .theme-toggle {
        margin-left: 0;
    }
    .nav-item {
        justify-content: center;
        padding: 12px;
    }
    .content-section {
        padding: 24px;
    }
}

@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }
    
    .sidebar {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 64px;
        flex-direction: row;
        padding: 0;
        z-index: 1000;
        border-right: none;
        border-top: 1px solid var(--border);
        box-shadow: 0 -4px 20px rgba(0,0,0,0.2);
        backdrop-filter: blur(12px);
    }
    
    .sidebar .logo, .lang-switch-container {
        display: none;
    }
    
    .nav-menu {
        flex-direction: row;
        width: 100%;
        height: 100%;
        justify-content: space-around;
        gap: 0;
        padding: 0;
    }
    
    .nav-item {
        flex-direction: column;
        height: 100%;
        flex: 1;
        border-radius: 0;
        font-size: 0.65rem;
        gap: 3px;
        padding: 8px 4px 4px;
    }
    
    .nav-item.active {
        background: transparent;
        color: var(--primary);
        box-shadow: inset 0 2px 0 var(--primary);
    }

    .nav-item i {
        font-size: 1.3rem;
    }
    
    .nav-item span {
        display: block;
    }
    
    .main-content {
        margin-left: 0;
        padding-bottom: 72px;
        overflow-y: auto;
    }
    
    .top-header {
        padding: 10px 16px;
        height: 60px;
        position: sticky;
        top: 0;
        z-index: 900;
        background: var(--sidebar-bg);
    }

    .header {
        padding: 16px 16px 0 !important;
    }
    
    .header h1 {
        font-size: 1.4rem;
    }

    .header p {
        font-size: 0.8rem;
    }
    
    .content-section {
        padding: 16px;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        margin-bottom: 20px;
    }

    h1 { font-size: 1.5rem; }

    .vocab-controls {
        width: 100%;
        gap: 12px;
    }
    
    .filters-group {
        width: 100%;
        flex-wrap: wrap;
    }
    
    .filters {
        flex-wrap: wrap;
        gap: 6px;
    }
    
    .filter-btn {
        padding: 5px 12px;
        font-size: 0.78rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        margin-bottom: 20px;
    }

    .stat-card { padding: 14px; }
    .stat-card h3 { font-size: 1.4rem; }
    
    .card-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .card { padding: 16px; }
    .word { font-size: 1.2rem; }

    /* Scenario - tabs as horizontal scroll */
    .scenario-tabs {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        gap: 8px;
        padding: 12px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        margin-bottom: 16px;
    }
    .scenario-tabs::-webkit-scrollbar { display: none; }
    
    .scenario-tab {
        flex: 0 0 auto;
        font-size: 0.82rem;
        white-space: nowrap;
        padding: 8px 14px;
    }
    
    .scenario-list {
        max-height: none;
    }

    .sent-item {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .sent-actions {
        flex-direction: row;
        width: 100%;
    }

    .sent-vn { font-size: 1rem; }
    .sent-en { font-size: 0.88rem; }
    .sent-cn { font-size: 0.82rem; }

    /* Phonetic */
    .phoneme-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 10px;
    }

    .phoneme-card { padding: 14px 10px; }
    .phoneme-card .symbol { font-size: 1.5rem; }

    /* Tone cards */
    .tone-section {
        margin-bottom: 24px;
    }

    .tone-words-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    /* Long sentence */
    .long-sent { padding: 16px; }

    .search-bar {
        max-width: 100%;
        flex: 1;
    }

    .mobile-lang-switch {
        display: flex;
    }

    .search-bar input {
        width: 100%;
        font-size: 0.85rem;
    }

    /* Hide sidebar theme toggle on mobile, show mobile version */
    .logo .theme-toggle { display: none; }
    .mobile-theme-toggle { display: flex; align-items: center; }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .tone-words-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .top-header {
        padding: 8px 12px;
    }

    .content-section { padding: 12px; }

    h1 { font-size: 1.3rem; }
}
@keyframes pulse {
    0% { transform: scale(1); opacity: 0.5; }
    100% { transform: scale(2); opacity: 0; }
}

/* Loading Spinner */
.loading-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Custom Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }


/* ======== Floating Voice Bar ======== */
.voice-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 900;
    background: rgba(20, 20, 40, 0.92);
    backdrop-filter: blur(12px);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding: 10px 20px;
}

body.light-mode .voice-bar {
    background: rgba(255, 255, 255, 0.95);
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.voice-bar-inner {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 16px;
}

.vb-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}

.vb-cards {
    display: flex;
    gap: 8px;
    flex: 1;
    overflow-x: auto;
}

.vc-card {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

body.light-mode .vc-card {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.08);
}

.vc-card:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary);
    transform: translateY(-1px);
}

body.light-mode .vc-card:hover {
    background: rgba(99, 102, 241, 0.06);
}

.vc-card.active {
    background: rgba(99, 102, 241, 0.15);
    border-color: var(--primary);
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.15);
}

body.light-mode .vc-card.active {
    background: rgba(99, 102, 241, 0.1);
}

.vc-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.vc-card.active .vc-icon {
    background: var(--primary);
    color: white;
}

.vc-info {
    display: flex;
    flex-direction: column;
}

.vc-name {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-main);
}

.vc-gender {
    font-size: 0.62rem;
    color: var(--text-muted);
}

.vc-check {
    color: var(--primary);
    font-size: 0.7rem;
    margin-left: 4px;
}

/* Give main content bottom padding — smaller now that voice bar is removed */
.main-content {
    padding-bottom: 20px !important;
}

@media (max-width: 768px) {
    .voice-bar {
        display: none; /* 底部浮动条已删除，不需要移动端样式 */
    }
}

/* ============================================================
   SIDEBAR VOICE PANEL
   ============================================================ */
.sidebar-voice-panel {
    margin-top: 12px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 14px;
    flex-shrink: 0;
}

.svp-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
    margin-bottom: 10px;
}

.svp-lang-tag {
    background: var(--primary);
    color: white;
    padding: 1px 7px;
    border-radius: 20px;
    font-size: 0.68rem;
    text-transform: none;
    letter-spacing: 0;
}

.svp-cards {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 220px;
    overflow-y: auto;
}

/* Sidebar voice cards — compact vertical layout */
.vc-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.07);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

body.light-mode .vc-card {
    background: rgba(0,0,0,0.03);
    border-color: rgba(0,0,0,0.07);
}

.vc-card:hover {
    background: rgba(99,102,241,0.1);
    border-color: var(--primary);
    transform: translateX(2px);
}

.vc-card.active {
    background: rgba(99,102,241,0.15);
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(99,102,241,0.2);
}

.vc-avatar {
    font-size: 1.4rem;
    line-height: 1;
    flex-shrink: 0;
}

.vc-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.vc-name {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vc-meta {
    font-size: 0.65rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
}

.vc-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}

.vc-dot.local  { background: #10b981; }
.vc-dot.online { background: #f59e0b; }

.vc-active-mark {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    flex-shrink: 0;
}

.vc-empty {
    color: var(--text-muted);
    font-size: 0.75rem;
    text-align: center;
    padding: 10px 4px;
    line-height: 1.4;
}

/* 屏蔽侧边栏折叠时的音色面板 */
@media (max-width: 1024px) {
    .sidebar-voice-panel { display: none; }
}

/* ============================================================
   PHONEME CARD DETAIL STYLES
   ============================================================ */
.phoneme-example {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 6px;
    font-style: italic;
    opacity: 0.75;
    line-height: 1.3;
}

.phoneme-tips {
    font-size: 0.68rem;
    margin-top: 4px;
    color: var(--secondary);
    opacity: 0.8;
}

.phoneme-play {
    margin-top: 8px;
    font-size: 0.68rem;
    color: var(--primary);
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.2s;
}

.phoneme-card:hover .phoneme-play {
    opacity: 1;
}

/* ============================================================
   MOBILE VOICE BUTTON & MODAL
   ============================================================ */
#mobile-voice-btn {
    display: none;
    position: fixed;
    bottom: 80px;
    right: 16px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    box-shadow: 0 4px 20px rgba(99,102,241,0.45);
    z-index: 990;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
}
#mobile-voice-btn:hover { transform: scale(1.1); box-shadow: 0 6px 24px rgba(99,102,241,0.6); }

@media (max-width: 1024px) {
    #mobile-voice-btn { display: flex; }
}
@media (max-width: 768px) {
    #mobile-voice-btn { bottom: 76px; }
}

#voice-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 1100;
    align-items: flex-end;
    justify-content: center;
    backdrop-filter: blur(4px);
}
#voice-modal-overlay.open { display: flex; }

#voice-modal {
    background: var(--sidebar-bg);
    width: 100%;
    max-width: 520px;
    border-radius: 20px 20px 0 0;
    padding: 0 0 24px;
    animation: slideUp 0.3s ease;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
}
@keyframes slideUp {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

#voice-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
}
#voice-modal-close {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    width: 30px; height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}

#voice-modal-body {
    padding: 14px 16px;
    overflow-y: auto;
    flex: 1;
}

/* ============================================================
   PHONETIC LEARNING MODULE — NEW STYLES
   ============================================================ */
.ph-intro {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    background: linear-gradient(135deg, rgba(99,102,241,0.12), rgba(236,72,153,0.08));
    border: 1px solid rgba(99,102,241,0.25);
    border-radius: 14px;
    padding: 18px 20px;
    margin-bottom: 28px;
    line-height: 1.6;
    font-size: 0.9rem;
    color: var(--text-main);
}
.ph-intro-text { color: var(--text-main); }
body.light-mode .ph-intro { background: rgba(99,102,241,0.06); }

.ph-section { margin-bottom: 40px; }

.ph-cat-title {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--primary);
    margin: 0 0 6px;
    font-family: 'Outfit', sans-serif;
}
.ph-cat-desc {
    color: var(--text-muted);
    font-size: 0.88rem;
    margin-bottom: 18px;
    line-height: 1.5;
}

/* Tone Cards */
.ph-tones-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}
.ph-tone-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 18px;
    transition: var(--transition);
    border-top: 3px solid var(--primary);
}
.ph-tone-card:hover { transform: translateY(-3px); border-color: var(--primary); }
.ph-tone-top { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 12px; }
.ph-tone-char {
    font-size: 3rem;
    font-weight: 900;
    color: var(--primary);
    cursor: pointer;
    line-height: 1;
    min-width: 60px;
    text-align: center;
    transition: transform 0.15s;
}
.ph-tone-char:hover { transform: scale(1.15); }
.ph-tone-meta { flex: 1; }
.ph-tone-name  { font-size: 1rem; font-weight: 700; color: var(--text-main); margin-bottom: 3px; }
.ph-tone-mark  { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 4px; }
.ph-tone-pitch { font-size: 0.82rem; color: var(--primary); font-weight: 600; }
.ph-tone-desc  { font-size: 0.85rem; color: var(--text-muted); line-height: 1.5; margin-bottom: 14px; padding: 10px 12px; background: var(--glass-bg); border-radius: 8px; border-left: 3px solid var(--secondary); }
.ph-tone-words { display: flex; flex-wrap: wrap; gap: 8px; }
.ph-tw {
    display: flex; flex-direction: column; align-items: center;
    background: var(--glass-bg); border: 1px solid var(--glass-border);
    border-radius: 10px; padding: 8px 12px; cursor: pointer;
    transition: var(--transition); min-width: 60px;
}
.ph-tw:hover { background: rgba(99,102,241,0.12); border-color: var(--primary); transform: translateY(-2px); }
.ph-tw-w { font-size: 1rem; font-weight: 700; color: var(--primary); }
.ph-tw-m { font-size: 0.68rem; color: var(--text-muted); margin-top: 2px; }

/* Phoneme Cards */
.ph-phoneme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 12px;
}
.ph-ph-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 14px;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}
.ph-ph-card:hover { transform: translateY(-3px); border-color: var(--primary); background: rgba(99,102,241,0.06); }
.ph-ph-sym  { font-size: 1.8rem; font-weight: 800; color: var(--primary); margin-bottom: 4px; }
.ph-ph-snd  { font-size: 0.8rem; color: var(--secondary); margin-bottom: 6px; font-weight: 600; }
.ph-ph-cn   { font-size: 0.78rem; color: var(--text-main); line-height: 1.4; margin-bottom: 6px; }
.ph-ph-ex   { font-size: 0.7rem; color: var(--text-muted); font-style: italic; margin-bottom: 4px; line-height: 1.3; }
.ph-ph-tip  { font-size: 0.68rem; color: #f59e0b; line-height: 1.3; margin-bottom: 4px; }
.ph-ph-play { font-size: 1rem; color: var(--primary); opacity: 0; transition: opacity 0.2s; position: absolute; bottom: 10px; right: 12px; }
.ph-ph-card:hover .ph-ph-play { opacity: 1; }

@media (max-width: 768px) {
    .ph-tones-grid { grid-template-columns: 1fr; }
    .ph-phoneme-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
    .ph-tone-char { font-size: 2.2rem; }
}

/* ============================================================
   KARAOKE WORD HIGHLIGHTING
   ============================================================ */
.kw {
    display: inline;
    transition: all 0.15s ease;
    border-radius: 3px;
    padding: 0 1px;
}
.kw-on {
    color: var(--primary) !important;
    background: rgba(99,102,241,0.18);
    border-radius: 4px;
    padding: 1px 3px;
    font-weight: 700;
    text-shadow: 0 0 12px rgba(99,102,241,0.6);
    animation: kwPulse 0.3s ease;
}
@keyframes kwPulse {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* ============================================================
   SCENARIO ITEM — NEW KARAOKE DESIGN
   ============================================================ */
.karaoke-box {
    cursor: pointer;
    position: relative;
}
.karaoke-box::after {
    content: '▶';
    position: absolute;
    top: 12px;
    right: 14px;
    font-size: 0.75rem;
    color: var(--primary);
    opacity: 0;
    transition: opacity 0.2s;
}
.karaoke-box:hover::after { opacity: 1; }
.karaoke-box:hover { border-color: var(--primary) !important; }

.scenario-item.karaoke-box {
    background: rgba(255,255,255,0.03);
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 12px;
    border: 1px solid rgba(255,255,255,0.06);
    transition: all 0.2s;
}
body.light-mode .scenario-item.karaoke-box {
    background: rgba(0,0,0,0.02);
    border-color: rgba(0,0,0,0.07);
}
.si-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.si-play-icon {
    color: var(--primary);
    font-size: 0.9rem;
    margin-left: auto;
    opacity: 0.5;
    transition: opacity 0.2s;
}
.karaoke-box:hover .si-play-icon { opacity: 1; }
.lang-label-main {
    background: var(--primary);
    color: white;
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
}
.lang-label-sub {
    background: rgba(255,255,255,0.1);
    color: var(--text-muted);
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
}
.si-target {
    font-size: 1.1rem;
    color: var(--text-main);
    font-weight: 500;
    line-height: 1.6;
    margin-bottom: 4px;
}
.si-pinyin {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: 8px;
    margin-left: 2px;
}
.si-source {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-top: 6px;
}
.si-src-text {
    font-size: 0.9rem;
    color: var(--text-muted);
    flex: 1;
    line-height: 1.4;
}
.ls-play-hint {
    font-size: 0.7rem;
    color: var(--primary);
    opacity: 0.6;
    margin-top: 10px;
    text-align: right;
}
.long-sent.karaoke-box {
    transition: border-color 0.2s, box-shadow 0.2s;
}
.long-sent.karaoke-box:hover {
    border-color: rgba(99,102,241,0.4) !important;
    box-shadow: 0 2px 16px rgba(99,102,241,0.12);
}

/* ============================================================
   UNIFIED PLAY ICON (matches app icon system)
   ============================================================ */
.spk-btn, .spk-btn-mini {
    background: linear-gradient(135deg, rgba(99,102,241,0.15), rgba(236,72,153,0.1));
    border: 1px solid rgba(99,102,241,0.3);
    color: var(--primary);
    border-radius: 8px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 0.82rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}
.spk-btn:hover, .spk-btn-mini:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99,102,241,0.3);
}
