/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Light mode colors */
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --accent-primary: #3b82f6;
    --accent-secondary: #06b6d4;
    --border-color: #e2e8f0;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --card-bg: #ffffff;
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --info-color: #3b82f6;
    --neutral-color: #6b7280;
}

[data-theme="dark"] {
    /* Dark mode colors */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --accent-primary: #3b82f6;
    --accent-secondary: #06b6d4;
    --border-color: #334155;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --card-bg: #1e293b;
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --info-color: #3b82f6;
    --neutral-color: #6b7280;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-primary);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background: var(--bg-secondary);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--card-shadow);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-primary);
}

.header-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.settings-btn,
.theme-toggle {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.2s ease;
    color: var(--text-secondary);
}

.settings-btn:hover,
.theme-toggle:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    transform: scale(1.1);
}

.settings-btn:active,
.theme-toggle:active {
    transform: scale(0.95);
}

/* Main Content */
.main {
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
}

/* Progress Section */
.progress-section {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-color);
}

.level-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.current-level {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--accent-primary);
}

.progress-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

/* Flashcard Container */
.flashcard-container {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
    perspective: 1000px;
}

.flashcard {
    width: 100%;
    max-width: 500px;
    height: 300px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s ease;
    cursor: pointer;
    user-select: none;
}

.flashcard:hover {
    transform: translateY(-4px);
}

.flashcard.flipped {
    transform: rotateY(180deg);
}

.flashcard.flipped:hover {
    transform: rotateY(180deg) translateY(-4px);
}

.card-front,
.card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 20px;
    box-shadow: var(--card-shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    border: 1px solid var(--border-color);
}

.card-front {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    color: white;
}

.card-back {
    background: var(--card-bg);
    color: var(--text-primary);
    transform: rotateY(180deg);
}

.card-content {
    text-align: center;
    width: 100%;
}

.word-display {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 1rem;
    word-wrap: break-word;
    line-height: 1.2;
    text-align: center;
}

.word-display .article {
    font-size: 1.6rem;
    opacity: 0.8;
    margin-right: 0.3rem;
}

.voice-btn {
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 1rem;
    position: relative;
    z-index: 10;
    outline: none;
}

.card-front .voice-btn {
    background: rgba(255, 255, 255, 0.2);
}

.card-front .voice-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.card-front .voice-btn:active {
    background: rgba(255, 255, 255, 0.4);
    transform: scale(0.95);
}

.card-back .voice-btn {
    background: var(--accent-primary);
    color: white;
}

.card-back .voice-btn:hover {
    background: var(--accent-secondary);
    transform: scale(1.05);
}

.card-back .voice-btn:active {
    background: var(--accent-primary);
    transform: scale(0.95);
}

.translation {
    font-size: 1.8rem;
    font-weight: 500;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.word-info {
    font-size: 1rem;
    color: var(--text-secondary);
    font-style: italic;
    margin-bottom: 1rem;
}

/* Controls */
.controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.start-btn {
    background: linear-gradient(135deg, #4c51bf 0%, #667eea 100%);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(76, 81, 191, 0.3);
}

.start-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 81, 191, 0.4);
}

.learning-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.flip-btn {
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid #4c51bf;
    color: #4c51bf;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.flip-btn:hover {
    background: #4c51bf;
    color: white;
}

.difficulty-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.diff-btn {
    padding: 0.75rem 1rem;
    border-radius: 12px;
    border: none;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 80px;
    font-size: 0.875rem;
}

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

.diff-btn.easy {
    background: #22c55e;
    color: white;
}

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

.diff-btn.hard {
    background: #f97316;
    color: white;
}

.diff-btn.very-hard {
    background: var(--error-color);
    color: white;
}

.diff-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px var(--shadow-color);
    opacity: 0.9;
}


/* Navigation Tabs */
.navigation-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--border-color);
}

.nav-tab {
    background: none;
    border: none;
    padding: 1rem 1.5rem;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
    border-bottom: 3px solid transparent;
    transition: all 0.2s ease;
}

.nav-tab:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.nav-tab.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
}

/* Dashboard View */
.dashboard-view {
    width: 100%;
}

.overall-progress {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-color);
}

.overall-progress h2 {
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    text-align: center;
}

.progress-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.stat-item {
    text-align: center;
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: 12px;
}

.stat-value {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-primary);
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Levels Container */
.levels-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.level-section {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-color);
}

.level-section.locked {
    opacity: 0.6;
    pointer-events: none;
}

.level-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.level-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.level-lock {
    font-size: 1.5rem;
}

.level-progress {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.level-progress-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.level-progress-bar {
    width: 100%;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
}

.level-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* Parts Grid */
.parts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.part-card {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

/* Removed duplicate hover - handled by :not(.locked):hover above */

.part-card.completed {
    border-color: var(--success-color);
    background: linear-gradient(135deg, var(--success-color)10, transparent);
}

.part-card.locked {
    opacity: 0.5;
    pointer-events: none;
    cursor: not-allowed;
}

.part-card:not(.locked) {
    cursor: pointer;
}

.part-card:not(.locked):hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow-color);
}

.part-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.part-title {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1rem;
}

.part-status {
    font-size: 1.2rem;
}

.part-info {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.part-progress {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.part-progress-bar {
    width: 60%;
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    overflow: hidden;
}

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

/* Practice View */
.practice-view {
    width: 100%;
}

/* Statistics View */
.statistics-view {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.statistics-header {
    text-align: center;
    margin-bottom: 3rem;
}

.statistics-header h2 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.statistics-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin: 0;
}

/* Quick Stats Grid */
.quick-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.stat-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-card.primary {
    border-left: 4px solid var(--accent-primary);
}

.stat-card.success {
    border-left: 4px solid var(--success-color);
}

.stat-card.warning {
    border-left: 4px solid var(--warning-color);
}

.stat-card.info {
    border-left: 4px solid var(--info-color);
}

.stat-icon {
    font-size: 2.5rem;
    opacity: 0.8;
}

.stat-content {
    flex: 1;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 1rem;
    color: var(--text-secondary);
    margin: 0;
}

/* Stats Sections */
.stats-section {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-color);
}

.section-header {
    text-align: center;
    margin-bottom: 2rem;
}

.section-header h3 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.section-header p {
    color: var(--text-secondary);
    margin: 0;
}

/* Heatmap Container */
.heatmap-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

/* Study Patterns */
.study-patterns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.pattern-card {
    background: var(--bg-tertiary);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    transition: transform 0.2s ease;
}

.pattern-card:hover {
    transform: translateY(-2px);
}

.pattern-icon {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.pattern-number {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--accent-primary);
    margin-bottom: 0.5rem;
}

.pattern-label {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.pattern-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Level Progress Stats */
.level-progress-stats {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.level-stat-item {
    background: var(--bg-tertiary);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.level-stat-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.level-stat-icon {
    font-size: 1.5rem;
}

.level-stat-details h4 {
    margin: 0 0 0.25rem 0;
    color: var(--text-primary);
}

.level-stat-details p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.level-stat-progress {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 200px;
}

.level-progress-bar {
    flex: 1;
    height: 8px;
    background: var(--bg-primary);
    border-radius: 4px;
    overflow: hidden;
}

.level-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.level-stat-percentage {
    font-weight: 600;
    color: var(--accent-primary);
    min-width: 45px;
    text-align: right;
}

/* Learning Controls */
.learning-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}


/* Heatmap */
.heatmap-section {
    margin-top: 2rem;
}

.heatmap-section h3 {
    margin-bottom: 1rem;
    color: #2d3748;
}

.heatmap {
    display: grid;
    grid-template-columns: repeat(53, 1fr);
    gap: 2px;
    margin-bottom: 1rem;
}

.heatmap-cell {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    background: #edf2f7;
    transition: all 0.2s ease;
}

.heatmap-cell:hover {
    transform: scale(1.2);
}

.heatmap-cell[data-level="0"] { background: #edf2f7; }
.heatmap-cell[data-level="1"] { background: #c6f6d5; }
.heatmap-cell[data-level="2"] { background: #9ae6b4; }
.heatmap-cell[data-level="3"] { background: #68d391; }
.heatmap-cell[data-level="4"] { background: #48bb78; }

.heatmap-legend {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: #666;
}

.legend-colors {
    display: flex;
    gap: 2px;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

.legend-color[data-level="0"] { background: #edf2f7; }
.legend-color[data-level="1"] { background: #c6f6d5; }
.legend-color[data-level="2"] { background: #9ae6b4; }
.legend-color[data-level="3"] { background: #68d391; }
.legend-color[data-level="4"] { background: #48bb78; }

/* Settings Panel */
.settings-panel {
    position: fixed;
    top: 80px;
    right: 20px;
    width: 320px;
    max-width: calc(100vw - 40px);
    max-height: calc(100vh - 120px);
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-color);
    overflow-y: auto;
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: top right;
}

.settings-panel.show {
    animation: slideInRight 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.settings-panel.hide {
    animation: slideOutRight 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.settings-panel h2 {
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    font-size: 1.5rem;
}

.setting-group {
    margin-bottom: 1.5rem;
}

.setting-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 500;
    color: var(--text-primary);
}

.setting-label select,
.setting-label input[type="number"] {
    padding: 0.5rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9rem;
    min-width: 150px;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.setting-label input[type="checkbox"] {
    transform: scale(1.2);
}

/* Sync Controls */
.sync-btn {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--accent-primary);
    background: var(--accent-primary);
    color: white;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 0.5rem 0;
}

.sync-btn:hover {
    background: var(--accent-secondary);
    border-color: var(--accent-secondary);
    transform: translateY(-1px);
}

.sync-btn:active {
    transform: translateY(0);
}

.logout-btn {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #dc3545;
    background: #dc3545;
    color: white;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 0.5rem 0;
}

.logout-btn:hover {
    background: #c82333;
    border-color: #c82333;
    transform: translateY(-1px);
}

.logout-btn:active {
    transform: translateY(0);
}

.sync-info {
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: 8px;
    margin-top: 0.5rem;
}

/* Loading Indicator */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e2e8f0;
    border-top: 4px solid #4c51bf;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

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

@keyframes slideInRight {
    0% {
        transform: translateX(100%) scale(0.95);
        opacity: 0;
    }
    100% {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    0% {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translateX(100%) scale(0.95);
        opacity: 0;
    }
}

@keyframes slideInLeft {
    0% {
        transform: translateX(-100%) scale(0.95);
        opacity: 0;
    }
    100% {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
}

@keyframes slideOutLeft {
    0% {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translateX(-100%) scale(0.95);
        opacity: 0;
    }
}

@keyframes fadeIn {
    0% {
        opacity: 0;
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Panel Backdrop */
.panel-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(2px);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.panel-backdrop.show {
    opacity: 1;
    pointer-events: all;
}

/* Responsive Design */
@media (max-width: 768px) {
    .main {
        padding: 1rem;
    }
    
    .header-content {
        padding: 1rem;
    }
    
    .flashcard {
        height: 250px;
    }
    
    .word-display {
        font-size: 1.5rem;
    }
    
    .translation {
        font-size: 1.3rem;
    }
    
    .difficulty-buttons {
        flex-direction: column;
        width: 100%;
    }
    
    .diff-btn {
        width: 100%;
    }
    
    .quick-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .stat-card {
        padding: 1.5rem;
    }
    
    .statistics-header h2 {
        font-size: 2rem;
    }
    
    .study-patterns {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .heatmap {
        grid-template-columns: repeat(26, 1fr);
    }
    
    .setting-label {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }
    
    /* Mobile panel adjustments */
    .settings-panel {
        top: 70px;
        left: 10px;
        right: 10px;
        width: auto;
        max-width: none;
        max-height: calc(100vh - 90px);
        padding: 1.5rem;
        transform-origin: top center;
    }
    
    .settings-panel.show {
        animation: slideInMobile 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    .settings-panel.hide {
        animation: slideOutMobile 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
}

@keyframes slideInMobile {
    0% {
        transform: translateY(-30px) scale(0.9);
        opacity: 0;
    }
    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

@keyframes slideOutMobile {
    0% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translateY(-30px) scale(0.9);
        opacity: 0;
    }
}

@media (max-width: 480px) {
    .quick-stats {
        grid-template-columns: 1fr;
    }
    
    .stat-card {
        padding: 1rem;
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }
    
    .stat-icon {
        font-size: 2rem;
    }
    
    .level-stat-item {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .level-stat-progress {
        min-width: auto;
        width: 100%;
    }
    
    .heatmap {
        grid-template-columns: repeat(15, 1fr);
    }
    
    .heatmap-cell {
        width: 10px;
        height: 10px;
    }
}

/* Auth Modal Styles */
.auth-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    backdrop-filter: blur(8px);
}

.auth-container {
    background: var(--card-bg);
    padding: 2.5rem;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    width: 90%;
    max-width: 450px;
    text-align: center;
    animation: modalSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalSlideIn {
    0% {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.auth-header h2 {
    margin: 0 0 0.5rem 0;
    color: var(--primary-color);
    font-size: 2rem;
    font-weight: 600;
}

.auth-header p {
    margin: 0 0 2rem 0;
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.4;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.9rem;
}

.form-group input {
    width: 100%;
    padding: 0.875rem;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-color);
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group input:invalid {
    border-color: #ef4444;
}

.auth-btn {
    background: linear-gradient(135deg, var(--primary-color), #1d4ed8);
    color: white;
    border: none;
    padding: 0.875rem 1.5rem;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.auth-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
    background: linear-gradient(135deg, #1d4ed8, var(--primary-color));
}

.auth-btn:active {
    transform: translateY(0);
}

.auth-btn:disabled {
    background: var(--text-secondary);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.auth-btn.secondary {
    background: transparent;
    border: 2px solid var(--border-color);
    color: var(--text-primary);
    box-shadow: none;
    margin: 0.5rem;
}

.auth-btn.secondary:hover {
    background: var(--card-bg);
    border-color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.auth-switch {
    margin: 1rem 0 0 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.auth-switch a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.auth-switch a:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

.auth-status {
    margin-top: 1rem;
    padding: 0.75rem;
    border-radius: 8px;
    font-size: 0.9rem;
    text-align: center;
    transition: all 0.3s ease;
}

.auth-status.success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.auth-status.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.auth-status.loading {
    background: var(--card-bg);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.auth-status.info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

/* Email Verification Notice */
.verification-notice {
    text-align: center;
    padding: 1rem;
}

.verification-notice .verification-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.verification-notice h3 {
    margin: 0 0 1rem 0;
    color: var(--text-primary);
    font-size: 1.3rem;
}

.verification-notice p {
    margin: 0.5rem 0;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* User info in header */
.user-info {
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin-right: 1rem;
    padding: 0.25rem 0.5rem;
    background: var(--card-bg);
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

/* Hide main app when auth modal is shown */
.auth-modal.show ~ .app {
    filter: blur(5px);
    pointer-events: none;
}

/* Responsive auth modal */
@media (max-width: 768px) {
    .auth-container {
        padding: 2rem;
        margin: 1rem;
        border-radius: 16px;
    }
    
    .auth-header h2 {
        font-size: 1.8rem;
    }
    
    .user-info {
        display: none;
    }
}

@media (max-width: 480px) {
    .auth-container {
        padding: 1.5rem;
    }
    
    .auth-header h2 {
        font-size: 1.6rem;
    }
}

/* Learned Words Chart Styles */
.learned-words-chart {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.level-word-card {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.level-word-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.15);
}

.level-word-card.active {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.1), rgba(37, 99, 235, 0.05));
}

.level-word-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.level-word-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.level-word-count {
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.level-word-progress {
    width: 100%;
    height: 8px;
    background: var(--bg-secondary);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.level-word-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-primary));
    border-radius: 4px;
    transition: width 0.3s ease;
}

.level-word-details {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
}

/* Session Completion Modal Styles */
.session-complete-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(10px);
    overflow-y: auto;
    padding: 1rem;
    box-sizing: border-box;
    transition: opacity 0.3s ease;
}

.session-complete-container {
    background: var(--card-bg);
    padding: 3rem;
    border-radius: 24px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-color);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    text-align: center;
    animation: modalSlideIn 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow-y: auto;
}

.modal-close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
}

.modal-close-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
    transform: scale(1.1);
}

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

.modal-close-btn svg {
    width: 20px;
    height: 20px;
}

.completion-animation {
    position: relative;
    margin-bottom: 2rem;
}

.completion-circle {
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, #10b981, #059669);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto;
    animation: scaleIn 0.6s cubic-bezier(0.4, 0, 0.2, 1) 0.3s both;
}

.checkmark {
    font-size: 3rem;
    color: white;
    font-weight: bold;
    animation: checkmarkDraw 0.4s ease 0.9s both;
}

.celebration-particles {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.particle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--primary-color);
    border-radius: 50%;
    animation: particleExplode 1.2s ease-out 0.6s both;
}

.particle:nth-child(1) { animation-delay: 0.6s; transform: rotate(0deg) translateX(60px); }
.particle:nth-child(2) { animation-delay: 0.7s; transform: rotate(72deg) translateX(60px); }
.particle:nth-child(3) { animation-delay: 0.8s; transform: rotate(144deg) translateX(60px); }
.particle:nth-child(4) { animation-delay: 0.9s; transform: rotate(216deg) translateX(60px); }
.particle:nth-child(5) { animation-delay: 1s; transform: rotate(288deg) translateX(60px); }

@keyframes scaleIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes checkmarkDraw {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes particleExplode {
    0% {
        opacity: 1;
        transform: rotate(var(--angle, 0deg)) translateX(0);
    }
    100% {
        opacity: 0;
        transform: rotate(var(--angle, 0deg)) translateX(100px);
    }
}

.completion-content h2 {
    margin: 0 0 0.5rem 0;
    color: var(--text-primary);
    font-size: 2rem;
    font-weight: 700;
}

.completion-content p {
    margin: 0 0 2rem 0;
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.session-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--bg-secondary);
    border-radius: 16px;
}

.session-stats .stat-item {
    text-align: center;
}

.session-stats .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.25rem;
}

.session-stats .stat-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.difficulty-breakdown {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.difficulty-breakdown h3 {
    margin: 0 0 1rem 0;
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
}

.difficulty-stats {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.difficulty-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border-radius: 12px;
    transition: all 0.3s ease;
}

.difficulty-item:hover {
    background: var(--card-bg);
}

.difficulty-emoji {
    font-size: 1.2rem;
    margin-right: 0.75rem;
}

.difficulty-label {
    flex: 1;
    text-align: left;
    font-weight: 500;
    color: var(--text-primary);
}

.difficulty-count {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-color);
    background: var(--primary-color-light);
    padding: 0.25rem 0.75rem;
    border-radius: 8px;
    min-width: 2rem;
    text-align: center;
}

.completion-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.primary-btn, .secondary-btn {
    padding: 0.875rem 1.5rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    min-width: 140px;
}

.primary-btn {
    background: linear-gradient(135deg, var(--primary-color), #1d4ed8);
    color: white;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

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

.secondary-btn:hover {
    background: var(--card-bg);
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

/* Responsive completion modal */
@media (max-width: 768px) {
    .session-complete-modal {
        padding: 0.5rem;
        align-items: flex-start;
        padding-top: 2rem;
    }
    
    .session-complete-container {
        padding: 1.5rem;
        margin: 0;
        width: 100%;
        max-width: 100%;
        max-height: 90vh;
        border-radius: 16px;
    }
    
    .modal-close-btn {
        top: 0.5rem;
        right: 0.5rem;
        padding: 0.25rem;
    }
    
    .modal-close-btn svg {
        width: 18px;
        height: 18px;
    }
    
    .completion-animation {
        margin-bottom: 1rem;
    }
    
    .completion-circle {
        width: 60px;
        height: 60px;
    }
    
    .checkmark {
        font-size: 1.5rem;
    }
    
    .session-stats {
        grid-template-columns: 1fr;
        gap: 0.5rem;
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .difficulty-breakdown {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .difficulty-breakdown h3 {
        font-size: 1rem;
        margin-bottom: 0.75rem;
    }
    
    .difficulty-item {
        padding: 0.5rem 0.75rem;
    }
    
    .difficulty-emoji {
        font-size: 1rem;
        margin-right: 0.5rem;
    }
    
    .completion-actions {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .primary-btn, .secondary-btn {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
        min-width: auto;
        width: 100%;
    }
    
    .learned-words-chart {
        grid-template-columns: 1fr;
    }
}

/* Level Statistics Modal */
.level-stats-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(10px);
    overflow-y: auto;
    padding: 1rem;
    box-sizing: border-box;
    transition: opacity 0.3s ease;
}

.level-stats-container {
    background: var(--card-bg);
    border-radius: 20px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    width: 90%;
    max-width: 700px;
    max-height: 90vh;
    position: relative;
    overflow-y: auto;
    animation: modalSlideIn 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.level-stats-header {
    padding: 2rem 2rem 1rem 2rem;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.level-stats-header h2 {
    margin: 0 0 0.5rem 0;
    color: var(--text-primary);
    font-size: 1.5rem;
    font-weight: 700;
}

.level-stats-header p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.level-stats-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    padding: 2rem;
    border-bottom: 1px solid var(--border-color);
}

.summary-card {
    text-align: center;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: 12px;
    transition: transform 0.2s ease;
}

.summary-card:hover {
    transform: translateY(-2px);
}

.summary-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.25rem;
}

.summary-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.difficulty-chart-section {
    padding: 2rem;
    border-bottom: 1px solid var(--border-color);
}

.difficulty-chart-section h3 {
    margin: 0 0 0.5rem 0;
    color: var(--text-primary);
    font-size: 1.2rem;
    font-weight: 600;
}

.difficulty-chart-section p {
    margin: 0 0 1.5rem 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.difficulty-chart {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    height: 200px;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: 16px;
    overflow-x: auto;
}

.chart-bar {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 80px;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1;
}

.chart-bar:hover {
    transform: translateY(-5px);
}

.chart-bar-container {
    width: 100%;
    height: 150px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    margin-bottom: 0.5rem;
}

.chart-bar-fill {
    width: 60%;
    min-height: 4px;
    border-radius: 6px 6px 0 0;
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.8rem;
    padding-bottom: 0.25rem;
}

.chart-bar-fill:hover {
    filter: brightness(1.1);
    transform: scaleX(1.1);
}

.chart-bar-label {
    font-size: 0.8rem;
    color: var(--text-primary);
    font-weight: 500;
    text-align: center;
    margin-bottom: 0.25rem;
}

.chart-bar-count {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-align: center;
}

/* Difficulty level colors */
.difficulty-very-hard { background: linear-gradient(135deg, #dc2626, #991b1b); }
.difficulty-hard { background: linear-gradient(135deg, #ea580c, #c2410c); }
.difficulty-medium { background: linear-gradient(135deg, #2563eb, #1d4ed8); }
.difficulty-easy { background: linear-gradient(135deg, #16a34a, #15803d); }
.difficulty-very-easy { background: linear-gradient(135deg, #ec4899, #be185d); }

.level-stats-actions {
    padding: 2rem;
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.level-stats-actions .primary-btn,
.level-stats-actions .secondary-btn {
    min-width: 160px;
}

/* Responsive design for level stats modal */
@media (max-width: 768px) {
    .level-stats-modal {
        padding: 0.5rem;
        align-items: flex-start;
        padding-top: 2rem;
    }
    
    .level-stats-container {
        width: 100%;
        max-width: 100%;
        border-radius: 16px;
    }
    
    .level-stats-header {
        padding: 1.5rem 1rem 1rem 1rem;
    }
    
    .level-stats-summary {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
        padding: 1.5rem 1rem;
    }
    
    .summary-card {
        padding: 0.75rem;
    }
    
    .summary-value {
        font-size: 1.4rem;
    }
    
    .difficulty-chart-section {
        padding: 1.5rem 1rem;
    }
    
    .difficulty-chart {
        height: 160px;
        gap: 0.5rem;
        padding: 0.75rem;
    }
    
    .chart-bar {
        min-width: 60px;
    }
    
    .chart-bar-container {
        height: 120px;
    }
    
    .chart-bar-fill {
        width: 80%;
        font-size: 0.7rem;
    }
    
    .level-stats-actions {
        padding: 1.5rem 1rem;
        flex-direction: column;
    }
    
    .level-stats-actions .primary-btn,
    .level-stats-actions .secondary-btn {
        width: 100%;
        min-width: auto;
    }
}