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

:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary-color: #8b5cf6;
    --success-color: #10b981;
    --success-light: #34d399;
    --danger-color: #ef4444;
    --danger-light: #f87171;
    --warning-color: #f59e0b;
    --bg-color: #f8fafc;
    --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --card-bg: #ffffff;
    --text-color: #1e293b;
    --text-light: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-md: 0 10px 15px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 20px 25px rgba(0, 0, 0, 0.1);
    --radius: 16px;
    --radius-sm: 12px;
    --nav-height: 70px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    background-attachment: fixed;
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    padding-top: var(--nav-height);
    /* Prevent text selection on mobile for better UX */
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* Allow text selection in inputs */
input, textarea {
    -webkit-user-select: text;
    user-select: text;
}

/* Global Navigation */
.global-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: var(--card-bg);
    box-shadow: var(--shadow-md);
    z-index: 1000;
    border-bottom: 1px solid var(--border-color);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-color);
}

.nav-icon {
    font-size: 1.75rem;
}

.nav-title {
    background: var(--bg-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-actions {
    display: flex;
    gap: 1rem;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    background: var(--bg-gradient);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: var(--shadow);
}

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

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

#app {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    min-height: calc(100vh - var(--nav-height));
}

.view {
    display: none;
    animation: fadeIn 0.3s ease-in;
}

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

.view.active {
    display: block;
}

/* Page Headers */
.page-header {
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
}

.page-header h1 {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.page-header h2 {
    font-size: 1.875rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.page-subtitle {
    font-size: 1.125rem;
    color: var(--text-light);
    font-weight: 400;
}

/* Breadcrumb Navigation */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1rem;
    margin-bottom: 1rem;
}

.breadcrumb-link {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    padding: 0.5rem 0;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.breadcrumb-link:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.breadcrumb-separator {
    color: var(--text-light);
    font-weight: 300;
}

.breadcrumb-current {
    color: var(--text-color);
    font-weight: 600;
}

/* Final Test Banner */
.final-test-banner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 2px solid var(--warning-color);
    border-radius: var(--radius);
    margin-top: 1rem;
    box-shadow: var(--shadow);
}

.banner-icon {
    font-size: 1.5rem;
}

.banner-text {
    font-weight: 600;
    color: #92400e;
    font-size: 1.0625rem;
}

/* Question Stats Bar */
.question-stats-bar {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.stat-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9375rem;
    box-shadow: var(--shadow-sm);
}

.stat-badge.correct-badge {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #065f46;
}

.stat-badge.incorrect-badge {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #991b1b;
}

.stat-icon {
    font-size: 1.125rem;
}

/* Book Selector */
.book-selector {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 2.5rem;
    flex-wrap: wrap;
}

.book-btn {
    padding: 1.25rem 3rem;
    border: none;
    background: var(--card-bg);
    color: var(--text-color);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 1.125rem;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.book-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--bg-gradient);
    transition: left 0.3s;
    z-index: 0;
}

.book-btn span {
    position: relative;
    z-index: 1;
}

.book-btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.book-btn:hover::before {
    left: 0;
}

.book-btn.active {
    background: var(--bg-gradient);
    color: white;
    box-shadow: var(--shadow-md);
}

.book-btn.active::before {
    left: 0;
}

/* Global Stats */
.global-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat-item {
    background: var(--card-bg);
    padding: 2rem 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
    transition: all 0.3s;
    border-top: 4px solid var(--primary-color);
    position: relative;
    overflow: hidden;
}

.stat-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--bg-gradient);
}

.stat-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.stat-label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-light);
    margin-bottom: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    display: block;
    font-size: 2.75rem;
    font-weight: 700;
    background: var(--bg-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Lessons List */
.lessons-list {
    display: grid;
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.lesson-card {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    padding: 2rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.lesson-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 5px;
    height: 100%;
    background: var(--primary-color);
    transform: scaleY(0);
    transition: transform 0.3s;
}

.lesson-card:hover:not(.locked)::before {
    transform: scaleY(1);
}

.lesson-card:hover:not(.locked) {
    border-color: var(--primary-color);
    transform: translateX(8px);
    box-shadow: var(--shadow-md);
}

.lesson-card.locked {
    opacity: 0.6;
    cursor: not-allowed;
    background: #f1f5f9;
}

.lesson-card.completed {
    border-color: var(--success-color);
    background: linear-gradient(135deg, #ffffff 0%, #f0fdf4 100%);
}

.lesson-card.completed::before {
    background: var(--success-color);
    transform: scaleY(1);
}

.lesson-card.in-progress {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, #ffffff 0%, #eef2ff 100%);
}

.lesson-card.in-progress::before {
    transform: scaleY(1);
}

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

.lesson-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-color);
}

.lesson-status {
    padding: 0.5rem 1.25rem;
    border-radius: 25px;
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    box-shadow: var(--shadow-sm);
}

.lesson-status.locked {
    background: var(--text-light);
    color: white;
}

.lesson-status.in-progress {
    background: var(--primary-color);
    color: white;
}

.lesson-status.completed {
    background: var(--success-color);
    color: white;
}

.lesson-stats {
    font-size: 1rem;
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

/* Buttons */
.btn {
    padding: 1rem 2.25rem;
    border: none;
    border-radius: var(--radius);
    font-size: 1.0625rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

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

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

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

.btn-primary:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

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

.btn-secondary:hover {
    background: #7c3aed;
}

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

.btn-success:hover {
    background: var(--success-light);
}

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

.btn-danger:hover {
    background: var(--danger-light);
}

.actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.lesson-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 2rem;
}

/* Progress Bar */
/* Mode Progress Container */
.mode-progress-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.mode-progress-card {
    background: var(--card-bg);
    padding: 1.75rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 2px solid var(--border-color);
    transition: all 0.3s ease;
}

.mode-progress-card.completed {
    border-color: var(--success-color);
    background: linear-gradient(135deg, #ffffff 0%, #f0fdf4 100%);
}

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

.mode-progress-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
}

.btn-go {
    padding: 0.625rem 1.5rem;
    font-size: 0.9375rem;
    min-width: 80px;
}

.btn-go:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: var(--success-color);
    color: white;
}

.progress-bar {
    width: 100%;
    height: 16px;
    background: var(--border-color);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 0.75rem;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.progress-fill {
    height: 100%;
    background: var(--bg-gradient);
    border-radius: 10px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    width: 0%;
    position: relative;
    overflow: hidden;
}

.mode-progress-card.completed .progress-fill {
    background: var(--success-color);
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: shimmer 2s infinite;
}

.mode-progress-card.completed .progress-fill::after {
    display: none;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

.progress-text {
    text-align: center;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-color);
}

.mode-progress-card.completed .progress-text {
    color: var(--success-color);
}

.progress-text {
    text-align: center;
    font-size: 1rem;
    color: var(--text-light);
    font-weight: 500;
}

/* Mode Selector */
.mode-selector {
    margin-bottom: 2rem;
    background: var(--card-bg);
    padding: 1.75rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.mode-selector label {
    display: block;
    margin-bottom: 0.875rem;
    font-weight: 600;
    color: var(--text-color);
    font-size: 1.125rem;
}

.mode-selector select {
    width: 100%;
    padding: 1rem 1.25rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 1.0625rem;
    background: var(--card-bg);
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.2s;
}

.mode-selector select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

/* Question View */
.question-container {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 3rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

.prompt {
    font-size: 2rem;
    margin-bottom: 3rem;
    text-align: center;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2.5rem;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-radius: var(--radius);
    border: 2px solid var(--border-color);
    font-weight: 600;
}

.prompt.arabic {
    direction: rtl;
    text-align: right;
    font-family: 'Arial', 'Times New Roman', serif;
    font-size: 3rem;
    line-height: 2.2;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
}

/* MCQ Options */
.mcq-options {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin-bottom: 2.5rem;
}

.mcq-option {
    display: flex;
    align-items: center;
    padding: 1.5rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    background: var(--card-bg);
    box-shadow: var(--shadow-sm);
}

.mcq-option:hover {
    border-color: var(--primary-color);
    background: #f8fafc;
    transform: translateX(6px);
    box-shadow: var(--shadow);
}

.mcq-option input[type="radio"] {
    margin-right: 1.25rem;
    width: 24px;
    height: 24px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.mcq-option-label {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.mcq-option .arabic-text {
    direction: rtl;
    font-family: 'Arial', 'Times New Roman', serif;
    font-size: 2rem;
    flex: 1;
    text-align: right;
}

.mcq-option.selected {
    border-color: var(--primary-color);
    background: #eef2ff;
    box-shadow: var(--shadow);
}

.mcq-option.correct {
    border-color: var(--success-color);
    background: #d1fae5;
    animation: correctPulse 0.5s;
}

.mcq-option.incorrect {
    border-color: var(--danger-color);
    background: #fee2e2;
    animation: incorrectShake 0.5s;
}

@keyframes correctPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

@keyframes incorrectShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Typing Input */
.typing-input-container {
    margin-bottom: 2.5rem;
}

#answer-input {
    width: 100%;
    padding: 1.5rem;
    font-size: 1.5rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    text-align: center;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
    font-weight: 500;
}

#answer-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
    transform: scale(1.01);
}

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

/* Feedback */
.feedback {
    margin-top: 2.5rem;
    padding: 2rem;
    border-radius: var(--radius);
    text-align: center;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    animation: slideIn 0.3s ease-out;
}

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

.feedback.correct {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #065f46;
    border: 2px solid var(--success-color);
    box-shadow: var(--shadow);
}

.feedback.incorrect {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #991b1b;
    border: 2px solid var(--danger-color);
    box-shadow: var(--shadow);
}

.feedback strong {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.feedback .correct-answer {
    margin-top: 1.5rem;
    font-size: 1.25rem;
    padding-top: 1.5rem;
    border-top: 2px solid rgba(0, 0, 0, 0.1);
    width: 100%;
}

.feedback .correct-answer .arabic-text {
    direction: rtl;
    font-family: 'Arial', 'Times New Roman', serif;
    font-size: 2rem;
    margin-top: 0.75rem;
    color: var(--text-color);
}

/* Summary View */
.summary-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    background: var(--card-bg);
    padding: 2.5rem 2rem;
    border-radius: var(--radius);
    text-align: center;
    box-shadow: var(--shadow);
    transition: all 0.3s;
    border-top: 4px solid var(--primary-color);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.stat-card.correct {
    border-top-color: var(--success-color);
    background: linear-gradient(135deg, #ffffff 0%, #f0fdf4 100%);
}

.stat-card.incorrect {
    border-top-color: var(--danger-color);
    background: linear-gradient(135deg, #ffffff 0%, #fef2f2 100%);
}

.stat-number {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    background: var(--bg-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-card.correct .stat-number {
    color: var(--success-color);
    -webkit-text-fill-color: var(--success-color);
}

.stat-card.incorrect .stat-number {
    color: var(--danger-color);
    -webkit-text-fill-color: var(--danger-color);
}

.stat-label {
    font-size: 0.9375rem;
    color: var(--text-light);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.weak-words-list {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 2.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

.weak-words-list h3 {
    margin-bottom: 2rem;
    color: var(--text-color);
    font-size: 1.5rem;
    font-weight: 600;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.weak-word-item {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
}

.weak-word-item:hover {
    background: #f8fafc;
    padding-left: 2rem;
}

.weak-word-item:last-child {
    border-bottom: none;
}

.weak-word-item .english {
    font-weight: 600;
    font-size: 1.125rem;
}

.weak-word-item .arabic-text {
    direction: rtl;
    font-family: 'Arial', 'Times New Roman', serif;
    font-size: 1.75rem;
    margin-left: 1rem;
}

.summary-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .nav-container {
        padding: 0 1rem;
    }
    
    .nav-title {
        font-size: 1rem;
    }
    
    .nav-btn span:last-child {
        display: none;
    }
    
    #app {
        padding: 1.5rem 1rem;
    }
    
    .page-header h1 {
        font-size: 1.75rem;
    }
    
    .page-header h2 {
        font-size: 1.5rem;
    }
    
    .prompt.arabic {
        font-size: 2.25rem;
    }
    
    .mcq-option .arabic-text {
        font-size: 1.75rem;
    }
    
    .global-stats {
        grid-template-columns: 1fr;
    }
    
    .summary-stats {
        grid-template-columns: 1fr;
    }
    
    .question-stats-bar {
        flex-direction: column;
    }
    
    .weak-word-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .question-container {
        padding: 2rem 1.5rem;
    }
    
    .lesson-card {
        padding: 1.5rem;
    }
    
    .breadcrumb {
        flex-wrap: wrap;
    }
}

/* Smooth scroll */
html {
    scroll-behavior: smooth;
}

/* Selection color */
::selection {
    background: var(--primary-light);
    color: white;
}

/* User Menu */
.user-menu {
    position: relative;
}

.user-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 44px; /* Touch target */
    min-height: 44px;
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    z-index: 1000;
    overflow: hidden;
}

.user-info {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.user-info div {
    font-size: 0.875rem;
    color: var(--text-light);
}

#dropdown-user-name {
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.25rem;
}

.dropdown-item {
    width: 100%;
    padding: 0.75rem 1rem;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    font-size: 0.9375rem;
    color: var(--text-color);
    transition: background-color 0.2s;
    min-height: 44px; /* Touch target */
}

.dropdown-item:hover {
    background: var(--bg-color);
}

/* Login View */
#login-view {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem 1rem;
    padding-top: calc(var(--nav-height) + 2rem);
}

.login-container {
    width: 100%;
    max-width: 400px;
}

.login-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.login-header {
    margin-bottom: 2rem;
}

.login-header .login-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 1rem;
}

.login-header h1 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.login-header p {
    color: var(--text-light);
    font-size: 0.9375rem;
}

.login-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.login-btn {
    width: 100%;
    padding: 1rem 1.5rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--card-bg);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    transition: all 0.3s;
    min-height: 56px; /* Large touch target */
}

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

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

.google-btn {
    border-color: #4285f4;
    color: #4285f4;
}

.google-btn:hover {
    background: #f8f9ff;
    border-color: #357ae8;
}

.apple-btn {
    border-color: #000;
    color: #000;
    background: #000;
    color: white;
}

.apple-btn:hover {
    background: #333;
    border-color: #333;
}

.login-footer {
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.login-note {
    font-size: 0.8125rem;
    color: var(--text-light);
    margin-bottom: 1rem;
    line-height: 1.5;
}

.skip-btn {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 0.9375rem;
    cursor: pointer;
    text-decoration: underline;
    padding: 0.5rem;
    min-height: 44px; /* Touch target */
}

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

/* Mobile Touch Improvements */
@media (max-width: 768px) {
    .btn {
        min-height: 48px; /* Larger touch targets on mobile */
        padding: 1rem 1.5rem;
    }
    
    .lesson-card {
        min-height: 80px; /* Easier to tap */
    }
    
    .mcq-option {
        min-height: 56px; /* Larger option buttons */
        padding: 1rem 1.25rem;
    }
    
    #answer-input {
        min-height: 48px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .nav-btn {
        min-width: 44px;
        min-height: 44px;
        padding: 0.5rem;
    }
    
    /* Swipe gestures hint */
    .question-container {
        touch-action: pan-y;
    }
}

/* Safe area for notched devices */
@supports (padding: max(0px)) {
    body {
        padding-left: max(0px, env(safe-area-inset-left));
        padding-right: max(0px, env(safe-area-inset-right));
    }
    
    .global-nav {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }
}
