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

:root {
    --primary: #4A90D9;
    --primary-dark: #357ABD;
    --success: #5CB85C;
    --warning: #F0AD4E;
    --danger: #D9534F;
    --bg: #F5F7FA;
    --card-bg: #FFFFFF;
    --text: #2C3E50;
    --text-light: #7F8C8D;
    --border: #E1E8ED;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --radius: 12px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* Navigation */
.nav-bar {
    display: flex;
    align-items: center;
    padding: 0 24px;
    height: 60px;
    background: var(--card-bg);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    margin-right: 32px;
}

.nav-links {
    display: flex;
    gap: 8px;
}

.nav-link {
    text-decoration: none;
    color: var(--text-light);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-link:hover {
    background: var(--bg);
    color: var(--text);
}

.nav-link.active {
    background: var(--primary);
    color: white;
}

.nav-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    margin-left: auto;
    color: var(--text);
}

/* Main Content */
.main-content {
    max-width: 900px;
    margin: 24px auto;
    padding: 0 16px;
}

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}

.card-header {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text);
}

/* Dashboard */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

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

.stat-number {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    font-size: 13px;
    color: var(--text-light);
    margin-top: 4px;
}

/* Word Card */
.word-card-container {
    perspective: 1000px;
    margin: 24px 0;
}

.word-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 32px;
    min-height: 300px;
    transition: transform 0.3s;
    position: relative;
}

.word-card .word-main {
    text-align: center;
    margin-bottom: 24px;
}

.word-card .word-text {
    font-size: 36px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}

.word-card .word-pos {
    font-size: 14px;
    color: var(--text-light);
    font-style: italic;
}

.word-card .word-definition {
    font-size: 20px;
    text-align: center;
    color: var(--primary-dark);
    margin-bottom: 24px;
}

.word-card .word-section {
    margin-bottom: 16px;
    padding: 12px 16px;
    background: var(--bg);
    border-radius: 8px;
}

.word-card .word-section-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.word-card .word-section-content {
    font-size: 15px;
    line-height: 1.8;
}

.word-card .root-analysis {
    color: var(--primary-dark);
    font-weight: 500;
}

.word-card .phrase-item {
    display: block;
    padding: 2px 0;
}

.word-card .example-en {
    font-style: italic;
    margin-bottom: 4px;
}

.word-card .example-cn {
    color: var(--text-light);
    font-size: 14px;
}

.word-card .example-grammar {
    font-size: 13px;
    color: var(--warning);
    background: #FFF8E1;
    padding: 4px 8px;
    border-radius: 4px;
    margin-top: 8px;
    display: inline-block;
}

.recall-card {
    min-height: 340px;
}

.recall-panel {
    max-width: 560px;
    margin: 0 auto;
}

.recall-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}

.recall-input {
    width: 100%;
    min-height: 92px;
    resize: vertical;
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: 14px 16px;
    font-size: 17px;
    line-height: 1.6;
    color: var(--text);
    background: #fff;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.recall-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.14);
}

.recall-hint {
    margin-top: 8px;
    font-size: 13px;
    color: var(--text-light);
}

.answer-feedback {
    max-width: 560px;
    margin: 18px auto 0;
    padding: 14px 16px;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.answer-feedback.correct {
    background: #E8F5E9;
    border-color: rgba(92, 184, 92, 0.35);
    color: #2E7D32;
}

.answer-feedback.wrong {
    background: #FFF3E0;
    border-color: rgba(240, 173, 78, 0.35);
    color: #8A5200;
}

.answer-feedback-title {
    font-weight: 700;
    margin-bottom: 4px;
}

.answer-feedback-detail {
    font-size: 14px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-warning {
    background: var(--warning);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--border);
    color: var(--text);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-lg {
    padding: 16px 32px;
    font-size: 17px;
}

.btn-block {
    display: flex;
    width: 100%;
}

/* Action buttons row */
.action-row {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 24px;
    flex-wrap: wrap;
}

/* Review rating buttons */
.rating-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-top: 24px;
}

.rating-btn {
    padding: 12px 8px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.rating-btn.forgot { background: #FFEBEE; color: var(--danger); }
.rating-btn.hard { background: #FFF3E0; color: #E65100; }
.rating-btn.good { background: #E8F5E9; color: #2E7D32; }
.rating-btn.easy { background: #E3F2FD; color: #1565C0; }

.rating-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

/* Test mode */
.test-question {
    text-align: center;
    font-size: 20px;
    margin-bottom: 24px;
    padding: 20px;
}

.test-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.test-option {
    padding: 16px;
    border: 2px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    text-align: center;
    font-size: 15px;
    transition: all 0.2s;
}

.test-option:hover {
    border-color: var(--primary);
    background: #F0F7FF;
}

.test-option.correct {
    border-color: var(--success);
    background: #E8F5E9;
}

.test-option.wrong {
    border-color: var(--danger);
    background: #FFEBEE;
}

.test-input {
    width: 100%;
    padding: 16px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 18px;
    text-align: center;
    outline: none;
    transition: border-color 0.2s;
}

.test-input:focus {
    border-color: var(--primary);
}

.test-score {
    text-align: center;
    padding: 32px;
}

.test-score .score-number {
    font-size: 48px;
    font-weight: 700;
    color: var(--primary);
}

/* Word list browser */
.word-list {
    list-style: none;
}

.word-list-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.2s;
}

.word-list-item:hover {
    background: var(--bg);
}

.word-list-item .wl-word {
    font-weight: 600;
    min-width: 140px;
}

.word-list-item .wl-pos {
    color: var(--text-light);
    font-size: 13px;
    min-width: 50px;
}

.word-list-item .wl-def {
    color: var(--text-light);
    font-size: 14px;
    flex: 1;
}

.word-list-item .wl-status {
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 4px;
}

.wl-status.new { background: #E3F2FD; color: #1565C0; }
.wl-status.learning { background: #FFF3E0; color: #E65100; }
.wl-status.mastered { background: #E8F5E9; color: #2E7D32; }

/* Search */
.search-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.search-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
    outline: none;
}

.search-input:focus {
    border-color: var(--primary);
}

.filter-select {
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    background: white;
}

/* Progress bar */
.progress-bar {
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin: 8px 0;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    transition: width 0.3s;
}

.progress-fill.success { background: var(--success); }

/* Settings */
.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}

.setting-label {
    font-weight: 500;
}

.setting-value {
    display: flex;
    align-items: center;
    gap: 8px;
}

.setting-input {
    width: 80px;
    padding: 8px;
    border: 2px solid var(--border);
    border-radius: 6px;
    text-align: center;
    font-size: 15px;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.empty-state-text {
    font-size: 16px;
    margin-bottom: 24px;
}

/* Session counter */
.session-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg);
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
}

.session-count {
    font-weight: 600;
    color: var(--primary);
}

/* Mobile responsive */
@media (max-width: 768px) {
    .nav-links {
        display: none;
        position: absolute;
        top: 60px;
        left: 0;
        right: 0;
        background: var(--card-bg);
        flex-direction: column;
        padding: 16px;
        box-shadow: var(--shadow);
    }

    .nav-links.show {
        display: flex;
    }

    .nav-menu-btn {
        display: block;
    }

    .main-content {
        margin: 16px auto;
    }

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

    .test-options {
        grid-template-columns: 1fr;
    }

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

    .word-card .word-text {
        font-size: 28px;
    }

    .word-card {
        padding: 20px;
    }

    .word-list-item .wl-def {
        display: none;
    }
}

@media (max-width: 480px) {
    .nav-bar {
        padding: 0 16px;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .stat-card {
        padding: 12px;
    }

    .stat-number {
        font-size: 24px;
    }
}

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

.fade-in {
    animation: fadeIn 0.3s ease;
}

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

.slide-up {
    animation: slideUp 0.4s ease;
}

/* Word detail modal overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 16px;
}

.modal-content {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 32px;
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.modal-close {
    float: right;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-light);
}

/* Pronounce button */
.pronounce-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
    margin-left: 10px;
    vertical-align: middle;
    padding: 0;
    line-height: 1;
}

.pronounce-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    transform: scale(1.1);
}

.pronounce-btn:active {
    transform: scale(0.95);
}

/* Word text row (word + pronounce button) */
.word-text-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-bottom: 6px;
}

/* Phonetic transcription */
.word-phonetic {
    font-size: 17px;
    color: var(--text-light);
    text-align: center;
    font-family: 'Times New Roman', 'Apple Symbols', serif;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}
