/* ===== PROFESSIONAL DICTIOQUIZ PWA ===== */

/* ===== PERFORMANCE OPTIMIZATIONS ===== */
/* Performance optimization - Enhanced for better performance */
.no-animate *,
.loading * {
    animation-duration: 0s !important;
    animation-delay: 0s !important;
    transition-duration: 0s !important;
    transition-delay: 0s !important;
}

.loading {
    pointer-events: none;
}

/* Hardware acceleration for smooth animations */
.welcome-screen,
.modal,
.word-card,
.quiz-option,
.btn,
.progress-fill,
.tab-content {
    will-change: transform, opacity;
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Optimize transitions for 60fps */
.word-card {
    transition: transform 0.2s cubic-bezier(0.4, 0.0, 0.2, 1),
                box-shadow 0.2s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.quiz-option {
    transition: all 0.15s cubic-bezier(0.4, 0.0, 0.2, 1);
}

/* Use transform instead of width for progress bar */
.progress-fill {
    transform-origin: left center;
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

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

:root {
    /* ===== LIGHT MODE (DEFAULT) ===== */
    /* Primary Brand Colors */
    --primary-50: #faf5ff;
    --primary-100: #f3e8ff;
    --primary-200: #e9d5ff;
    --primary-300: #d8b4fe;
    --primary-400: #c084fc;
    --primary-500: #a855f7;
    --primary-600: #6e1e99;
    --primary-700: #5b1a7a;
    --primary-800: #4c1565;
    --primary-900: #3b0f52;
    
    /* Accent Colors */
    --accent-purple: #b78fcc;
    --accent-emerald: #10b981;
    --accent-amber: #f59e0b;
    --accent-rose: #f43f5e;
    
    /* Semantic Colors */
    --success: #22c55e;
    --success-light: #dcfce7;
    --success-dark: #166534;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --warning-dark: #92400e;
    --error: #ef4444;
    --error-light: #fecaca;
    --error-dark: #991b1b;
    --info: #6e1e99;
    --info-light: #f3e8ff;
    --info-dark: #3b0f52;
    
    /* Light Mode Surface Colors */
    --surface-0: #ffffff;
    --surface-1: #fafafa;
    --surface-2: #f5f5f5;
    --surface-3: #f0f0f0;
    --surface-secondary: #f8fafc;
    --surface-tertiary: #f1f5f9;
    
    /* Light Mode Text Colors */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-tertiary: #64748b;
    --text-disabled: #94a3b8;
    --text-on-primary: #ffffff;
    --text-on-surface: #0f172a;
    --text-muted: #6b7280;
    
    /* Light Mode Border Colors */
    --border-light: #e2e8f0;
    --border-medium: #cbd5e1;
    --border-strong: #94a3b8;
    --border-focus: #3b82f6;
    
    /* Light Mode Shadows */
    --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);
    --shadow-glow: 0 0 20px rgb(59 130 246 / 0.15);
    
    /* Radius */
    --radius-xs: 4px;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-2xl: 20px;
    --radius-full: 9999px;
    
    /* Spacing */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;
    --space-16: 64px;
    --space-20: 80px;
    
    /* Typography */
    --font-family-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    
    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-theme: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    
    /* App Layout */
    --header-height: 64px;
    --bottom-nav-height: 60px;
    --content-max-width: 768px;
    
    /* Theme specific gradients */
    --gradient-primary: linear-gradient(135deg, #6e1e99 0%, #b78fcc 50%, #a855f7 100%);
    --gradient-surface: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    --gradient-card: linear-gradient(135deg, #ffffff 0%, #fafafa 100%);
}

/* Base Styles */
html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-family-sans);
    background: var(--surface-1);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 16px;
    font-weight: 400;
    overflow-x: hidden;
}

/* ===== WELCOME SCREEN ===== */
.welcome-screen {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, #3b0f52 0%, #4c1565 25%, #6e1e99 50%, #5b1a7a 75%, #b78fcc 100%);
    background-size: 400% 400%;
    animation: gradientShift 8s ease-in-out infinite;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: var(--space-3);
    overflow: hidden;
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height for mobile */
}

.welcome-screen::before {
    content: '';
    position: absolute;
    inset: 0;
    background: 
        radial-gradient(circle at 20% 20%, rgba(59, 130, 246, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(139, 92, 246, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 60%, rgba(16, 185, 129, 0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: 1;
}

.welcome-container {
    width: 100%;
    max-width: 320px;
    text-align: center;
    position: relative;
    z-index: 2;
    padding: var(--space-1);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    overflow: hidden;
    min-height: 0;
    transform-origin: center center;
    gap: var(--space-1);
}

.welcome-header {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin-bottom: var(--space-2);
    opacity: 0;
    transform: translateY(50px);
    animation: fadeInUp 0.4s ease-out 0s forwards !important;
}

.app-logo {
    position: relative;
    margin: 0;
}

.logo-container {
    position: relative;
    display: inline-block;
    margin-bottom: var(--space-2);
}

.logo-image {
    width: 72px;
    height: 72px;
    border-radius: var(--radius-2xl);
    box-shadow: 
        var(--shadow-2xl),
        0 0 40px rgba(59, 130, 246, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    animation: logoFloat 3s ease-in-out infinite;
    position: relative;
    z-index: 2;
    border: 3px solid rgba(255, 255, 255, 0.1);
}

.logo-glow {
    position: absolute;
    inset: -12px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.3) 0%, rgba(139, 92, 246, 0.2) 50%, transparent 70%);
    border-radius: var(--radius-2xl);
    animation: glow 2s ease-in-out infinite alternate;
    z-index: 1;
    filter: blur(8px);
}

.welcome-header h1 {
    color: #f8fafc;
    font-size: 2.25rem;
    font-weight: 800;
    margin-bottom: var(--space-1);
    text-shadow: 
        0 2px 4px rgba(0,0,0,0.4),
        0 4px 8px rgba(0,0,0,0.2);
    letter-spacing: -0.025em;
    line-height: 1.1;
}

.welcome-header p {
    color: rgba(248, 250, 252, 0.85);
    font-size: 0.95rem;
    font-weight: 400;
    line-height: 1.4;
    opacity: 0.9;
    margin-bottom: var(--space-1);
}

.welcome-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 0;
    margin: 0;
    flex: 1;
    width: 100%;
    gap: var(--space-1);
}

.welcome-preview {
    display: grid;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
    flex-shrink: 0;
    opacity: 0;
    transform: translateY(50px);
    animation: fadeInUp 1s ease-out 0s forwards !important;
}

.preview-step {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    background: rgba(248, 250, 252, 0.08);
    border-radius: var(--radius-md);
    text-align: left;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(248, 250, 252, 0.1);
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateY(40px);
}

.preview-step:nth-child(1) {
    animation: fadeInUp 1s ease-out 0s forwards !important;
}

.preview-step:nth-child(2) {
    animation: fadeInUp 1s ease-out 0.2s forwards !important;
}

.preview-step:nth-child(3) {
    animation: fadeInUp 1s ease-out 0.4s forwards !important;
}

.step-number {
    width: 26px;
    height: 26px;
    background: rgba(59, 130, 246, 0.15);
    color: rgba(96, 165, 250, 0.95);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    flex-shrink: 0;
}

.step-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.step-content strong {
    color: #ffffff;
    font-weight: 600;
    margin-bottom: 2px;
    font-size: 0.9rem;
}

.step-content span {
    color: rgba(248, 250, 252, 0.75);
    font-size: 0.8rem;
    line-height: 1.2;
}

.dark-mode .preview-step {
    background: rgba(15, 23, 42, 0.2);
}

.auth-buttons {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    flex-shrink: 0;
    opacity: 0;
    transform: translateY(30px);
    animation: fadeInUp 0.6s ease-out 0s forwards !important;
}

.privacy-notice {
    color: rgba(248, 250, 252, 0.65);
    font-size: 0.75rem;
    line-height: 1.3;
    margin: var(--space-2) 0 0 0;
    padding: 0;
    text-align: center;
    max-width: 280px;
    margin-left: auto;
    margin-right: auto;
}

.privacy-link {
    color: rgba(248, 250, 252, 0.8);
    text-decoration: underline;
    text-underline-offset: 1px;
    font-weight: 400;
    transition: all var(--transition-normal);
}

.privacy-link:hover {
    color: #ffffff;
    text-decoration-color: rgba(59, 130, 246, 0.6);
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-6);
    border: none;
    border-radius: var(--radius-lg);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
    min-height: 48px;
    touch-action: manipulation;
    user-select: none;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary-600);
    color: var(--text-on-primary);
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-700);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--surface-0);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--surface-2);
    border-color: var(--border-medium);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-google {
    background: var(--surface-0);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    font-weight: 500;
}

.btn-google:hover:not(:disabled) {
    background: var(--surface-2);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.google-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.btn-text {
    background: transparent;
    color: rgba(255, 255, 255, 0.8);
    padding: var(--space-3) var(--space-4);
    font-weight: 500;
}

.btn-text:hover:not(:disabled) {
    color: rgba(255, 255, 255, 1);
    background: rgba(255, 255, 255, 0.1);
}

.btn-block {
    width: 100%;
}

.btn .material-symbols-rounded {
    font-size: 20px;
}

.divider {
    position: relative;
    text-align: center;
    margin: var(--space-3) 0;
}

.divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(255, 255, 255, 0.2);
}

.divider span {
    background: inherit;
    padding: 0 var(--space-4);
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.875rem;
    font-weight: 500;
}

/* ===== MODALS ===== */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: var(--space-4);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.modal:not(.hidden) {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--surface-0);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-2xl);
    width: 100%;
    max-width: 420px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.95) translateY(20px);
    transition: transform var(--transition-normal);
}

.modal:not(.hidden) .modal-content {
    transform: scale(1) translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-6) var(--space-6) var(--space-4);
    border-bottom: 1px solid var(--border-light);
}

.modal-header h2 {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-header h2 .material-symbols-rounded {
    font-size: 24px;
    color: var(--primary-600);
}

.close-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    color: var(--text-tertiary);
}

.close-btn:hover {
    background: var(--surface-2);
    color: var(--text-primary);
}

.close-btn .material-symbols-rounded {
    font-size: 20px;
}

/* ===== FORMS ===== */
.auth-form,
.word-form {
    padding: var(--space-6);
}

.input-group {
    margin-bottom: var(--space-5);
}

.input-group label {
    display: block;
    margin-bottom: var(--space-2);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.input-group input,
.input-group textarea {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    font-family: inherit;
    font-size: 1rem;
    background: var(--surface-0);
    color: var(--text-primary);
    transition: all var(--transition-fast);
    min-height: 48px;
}

.input-group input:focus,
.input-group textarea:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.input-group textarea {
    resize: vertical;
    min-height: 96px;
    line-height: 1.5;
}

.auth-switch {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.auth-switch-register {
    margin-bottom: var(--space-5);
}

.auth-links {
    text-align: center;
    margin-bottom: var(--space-5);
}

.auth-links .link-btn {
    font-size: 0.875rem;
    color: var(--primary-600);
}

.auth-links .link-btn:hover {
    color: var(--primary-700);
    text-decoration: underline;
}

.link-btn {
    background: none;
    border: none;
    color: var(--primary-600);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    transition: color var(--transition-fast);
}

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

/* ===== MAIN APP ===== */
.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(20px);
    transition: all var(--transition-slow);
}

.app-container:not(.hidden) {
    opacity: 1;
    transform: translateY(0);
}

/* ===== MOBILE-FIRST RESPONSIVE DESIGN FOR WELCOME SCREEN ===== */
/* Default mobile optimization - screens up to 700px height */
@media (max-height: 700px) and (max-width: 768px) {
    .welcome-container {
        max-width: 340px;
        padding: var(--space-1);
        transform: scale(0.98);
        gap: var(--space-1);
    }
    
    .welcome-header h1 {
        font-size: 1.8rem;
    }
    
    .logo-image {
        width: 56px;
        height: 56px;
    }
    
    .welcome-header p {
        font-size: 0.85rem;
        margin-bottom: 3px;
    }
    
    .welcome-preview {
        margin-bottom: var(--space-2);
        gap: var(--space-1);
    }
    
    .preview-step {
        padding: var(--space-2) var(--space-2);
        min-height: 40px;
    }
    
    .step-content strong {
        font-size: 0.85rem;
    }
    
    .step-content span {
        font-size: 0.75rem;
    }
    
    .auth-buttons {
        gap: var(--space-2);
    }
    
    .privacy-notice {
        font-size: 0.75rem;
        margin-top: var(--space-2);
    }
}

/* Compact mobile screens */
@media (max-height: 650px) and (max-width: 768px) {
    .welcome-container {
        transform: scale(0.95);
        max-width: 330px;
        gap: 6px;
    }
    
    .logo-image {
        width: 52px;
        height: 52px;
    }
    
    .welcome-header h1 {
        font-size: 1.7rem;
    }
    
    .welcome-preview {
        gap: 6px;
    }
    
    .preview-step {
        min-height: 38px;
        padding: 6px var(--space-2);
    }
    
    .privacy-notice {
        font-size: 0.72rem;
        line-height: 1.3;
    }
}

/* Very compact mobile screens */
@media (max-height: 600px) and (max-width: 768px) {
    .welcome-container {
        transform: scale(0.92);
        max-width: 320px;
        gap: 4px;
    }
    
    .logo-image {
        width: 50px;
        height: 50px;
    }
    
    .welcome-header h1 {
        font-size: 1.6rem;
    }
    
    .privacy-notice {
        font-size: 0.7rem;
        margin-top: 6px;
        line-height: 1.2;
    }
}

/* Ultra compact mobile screens */
@media (max-height: 550px) and (max-width: 768px) {
    .welcome-container {
        transform: scale(0.88);
        max-width: 310px;
        gap: 3px;
    }
    
    .logo-image {
        width: 48px;
        height: 48px;
    }
    
    .welcome-header h1 {
        font-size: 1.5rem;
    }
    
    .welcome-header p {
        font-size: 0.8rem;
        margin-bottom: 2px;
    }
    
    .privacy-notice {
        font-size: 0.68rem;
        line-height: 1.2;
        margin-top: 4px;
    }
}

/* Responsive styles to prevent resize on wide screens */
@media (min-width: 768px) {
    .welcome-screen {
        padding: 32px;
    }
    .welcome-container {
        max-width: 340px;
        transform: scale(0.95);
    }
}

/* ===== MOBILE HEADER ===== */
.mobile-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--surface-0);
    border-bottom: 1px solid var(--border-light);
    backdrop-filter: blur(12px);
    height: var(--header-height);
    display: flex;
    align-items: center;
}

.header-content {
    width: 100%;
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: 0 var(--space-4);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex: 1;
    min-width: 0;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--primary-500), var(--accent-purple));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    flex-shrink: 0;
    overflow: hidden;
    position: relative;
}

.avatar .material-symbols-rounded {
    font-size: 24px;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
}

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

.user-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-email {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.settings-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    color: var(--text-secondary);
    position: relative;
}

.settings-btn:hover {
    background: var(--surface-2);
    color: var(--text-primary);
}

.settings-btn .material-symbols-rounded {
    font-size: 20px;
}

/* Cloud sync status styles */
.sync-synced {
    color: var(--success) !important;
}

.sync-not-synced {
    color: var(--error) !important;
}

.sync-loading {
    color: var(--text-tertiary) !important;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* Install button styles */
.install-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    border: none;
    background: linear-gradient(135deg, #a855f7 0%, #6e1e99 100%);
    color: white;
    border-radius: var(--radius-xl);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 
        0 4px 12px rgba(168, 85, 247, 0.15),
        0 2px 4px rgba(168, 85, 247, 0.1);
    min-height: 44px;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.install-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.install-btn:hover::before {
    left: 100%;
}

.install-btn:hover {
    background: linear-gradient(135deg, #9333ea 0%, #581c87 100%);
    transform: translateY(-2px);
    box-shadow: 
        0 8px 20px rgba(168, 85, 247, 0.25),
        0 4px 8px rgba(168, 85, 247, 0.15);
}

.install-btn:active {
    transform: translateY(-1px);
    transition: transform 0.1s;
}

.install-btn .material-symbols-rounded {
    font-size: 20px;
    font-weight: 500;
}

.install-text {
    font-size: 14px;
    letter-spacing: 0.025em;
}

/* Center install button in header when shown */
.header-content.show-install {
    justify-content: center;
    padding: 0 var(--space-4);
}

.header-content.show-install .user-profile {
    display: none;
}

.header-content.show-install .settings-btn {
    display: none;
}

/* Responsive install button */
@media (max-width: 480px) {
    .install-btn {
        padding: var(--space-2) var(--space-3);
        font-size: 13px;
        min-height: 40px;
        gap: var(--space-1);
    }
    
    .install-text {
        font-size: 13px;
    }
    
    .install-btn .material-symbols-rounded {
        font-size: 18px;
    }
    
    .header-content.show-install {
        padding: 0 var(--space-3);
    }
}

@media (max-width: 360px) {
    .install-btn {
        padding: var(--space-2);
        font-size: 12px;
        min-height: 36px;
    }
    
    .install-text {
        font-size: 12px;
    }
    
    .install-btn .material-symbols-rounded {
        font-size: 16px;
    }
}

/* ===== CONTENT CONTAINER ===== */
.content-container {
    flex: 1;
    padding-bottom: var(--bottom-nav-height);
    position: relative;
}

.tab-content {
    display: none;
    padding: var(--space-6) var(--space-4);
    max-width: var(--content-max-width);
    margin: 0 auto;
    animation: fadeIn 0.3s ease-out;
    min-height: calc(100vh - var(--bottom-nav-height) - var(--header-height));
}

.tab-content.active {
    display: flex;
    flex-direction: column;
}

.tab-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-8);
    padding-bottom: var(--space-4);
    border-bottom: 2px solid var(--surface-secondary);
}

.tab-header h2 {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: 1.875rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.025em;
    margin: 0;
}

.tab-header h2 .material-symbols-rounded {
    font-size: 32px;
    color: var(--primary-600);
    background: var(--primary-50);
    padding: var(--space-2);
    border-radius: var(--radius-lg);
}

/* ===== WORDS TAB ===== */
.add-word-btn {
    width: 56px;
    height: 56px;
    border: none;
    background: var(--primary-600);
    color: white;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.add-word-btn:hover {
    background: var(--primary-700);
    transform: translateY(-3px);
    box-shadow: var(--shadow-xl);
}

.add-word-btn:active {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.add-word-btn .material-symbols-rounded {
    font-size: 28px;
    font-weight: 600;
}

.search-container {
    margin-bottom: var(--space-6);
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--surface-0);
    border-radius: var(--radius-lg);
    border: 1.5px solid var(--border-light);
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-xs);
}

.search-box:focus-within {
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.08), var(--shadow-sm);
}

.search-box input {
    width: 100%;
    padding: var(--space-4) var(--space-12) var(--space-4) var(--space-12);
    border: none;
    border-radius: var(--radius-lg);
    font-size: 1rem;
    background: transparent;
    color: var(--text-primary);
    outline: none;
    font-weight: 500;
}

.search-box input::placeholder {
    color: var(--text-tertiary);
    font-weight: 400;
}

.search-icon {
    position: absolute;
    left: var(--space-4);
    color: var(--text-secondary);
    pointer-events: none;
    z-index: 2;
    font-size: 20px;
}

.search-clear {
    position: absolute;
    right: var(--space-3);
    width: 28px;
    height: 28px;
    border: none;
    background: var(--surface-2);
    color: var(--text-secondary);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    opacity: 0;
    pointer-events: none;
    font-size: 18px;
}

.search-clear:hover {
    background: var(--surface-3);
    color: var(--text-primary);
    transform: scale(1.05);
}

.words-grid {
    display: grid;
    gap: var(--space-5);
    grid-template-columns: 1fr;
}

@media (min-width: 640px) {
    .words-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .words-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.word-card {
    background: var(--surface-0);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-2xl);
    padding: var(--space-6);
    position: relative;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    overflow: hidden;
}

.word-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-500), var(--primary-600));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--transition-normal);
}

.word-card:hover {
    box-shadow: var(--shadow-xl);
    border-color: var(--primary-200);
    transform: translateY(-4px);
}

.word-card:hover::before {
    transform: scaleX(1);
}

.word-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: var(--space-4);
}

.word-title {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    flex: 1;
    word-break: break-word;
    margin: 0;
}

.word-actions {
    display: flex;
    gap: var(--space-2);
    flex-shrink: 0;
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.word-card:hover .word-actions {
    opacity: 1;
}

.word-action-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    color: var(--text-tertiary);
}

.word-action-btn:hover {
    background: var(--surface-2);
    color: var(--text-primary);
}

.word-action-btn.danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
}

.word-definition {
    color: var(--text-secondary);
    line-height: 1.6;
    font-size: 0.9375rem;
    margin-top: var(--space-2);
    padding-top: var(--space-3);
    border-top: 1px solid var(--border-light);
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    max-width: 100%;
}

/* ===== QUIZ TAB ===== */
.quiz-setup {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    padding: 0;
    gap: var(--space-3);
}

#quiz-tab {
    overflow: hidden;
}

#quiz-tab .tab-content {
    overflow: hidden;
    padding: var(--space-3);
    height: calc(100vh - var(--bottom-nav-height));
    height: calc(100dvh - var(--bottom-nav-height));
}

.quiz-stats {
    display: flex;
    justify-content: center;
    margin-bottom: var(--space-4);
    flex-shrink: 0;
}

.quiz-stats .stat-item {
    max-width: 200px;
    width: 100%;
}

.stat-item {
    text-align: center;
    padding: var(--space-3);
    background: linear-gradient(135deg, var(--surface-0) 0%, var(--surface-secondary) 100%);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.stat-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-500), var(--primary-600));
}

.stat-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-200);
}

.stat-number {
    display: block;
    font-size: 2rem;
    font-weight: 900;
    color: var(--primary-600);
    line-height: 1.1;
    margin-bottom: var(--space-1);
}

.stat-label {
    font-size: 0.8125rem;
    color: var(--text-tertiary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.075em;
}

.quiz-options {
    margin-bottom: var(--space-4);
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    max-height: calc(100% - var(--space-8));
}

.quiz-options::-webkit-scrollbar {
    display: none;
}

.option-group {
    margin-bottom: 0;
    background: var(--surface-0);
    padding: var(--space-3);
    border-radius: var(--radius-xl);
    border: 2px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}

.quiz-actions {
    flex-shrink: 0;
    padding-top: var(--space-3);
    margin-top: auto;
}

.quiz-actions .btn {
    width: 100%;
    padding: var(--space-3);
    font-size: 1rem;
    font-weight: 700;
}

/* Mobile optimizations for quiz setup */
@media (max-height: 700px) {
    .quiz-setup {
        gap: var(--space-2);
    }
    
    .quiz-stats {
        margin-bottom: var(--space-2);
    }
    
    .quiz-stats .stat-item {
        max-width: 180px;
    }
    
    .stat-item {
        padding: var(--space-2);
    }
    
    .stat-number {
        font-size: 1.5rem;
    }
    
    .option-group {
        padding: var(--space-2);
    }
    
    .option-group label {
        font-size: 1rem;
        margin-bottom: var(--space-2);
    }
    
    .quiz-actions .btn {
        padding: var(--space-2);
        font-size: 0.95rem;
    }
}

@media (max-height: 600px) {
    .quiz-setup {
        gap: var(--space-1);
    }
    
    .quiz-stats {
        margin-bottom: var(--space-1);
    }
    
    .quiz-stats .stat-item {
        max-width: 160px;
    }
    
    .stat-item {
        padding: var(--space-1);
    }
    
    .stat-number {
        font-size: 1.25rem;
    }
    
    .stat-label {
        font-size: 0.75rem;
    }
    
    .option-group {
        padding: var(--space-2);
    }
    
    .option-group label {
        font-size: 0.9rem;
        margin-bottom: var(--space-1);
    }
    
    .quiz-actions .btn {
        padding: var(--space-2);
        font-size: 0.9rem;
    }
}

/* ===== QUIZ CONTAINER ===== */
.quiz-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--header-height) - var(--bottom-nav-height));
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: 0 var(--space-4);
    overflow: hidden;
    max-height: calc(100vh - var(--header-height) - var(--bottom-nav-height));
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
}

.quiz-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) 0;
    position: sticky;
    top: 0;
    z-index: 10;
    flex-shrink: 0;
}

.quiz-progress {
    flex: 1;
    display: flex;
    align-items: center;
    gap: var(--space-5);
    margin-right: var(--space-4);
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: var(--surface-2);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-500), var(--accent-purple));
    border-radius: inherit;
    transition: width var(--transition-slow);
    min-width: 8px;
}

.progress-text {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}

.quit-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--surface-2);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    color: var(--text-tertiary);
}

.quit-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
}

.quiz-question {
    text-align: center;
    padding: var(--space-6) var(--space-4);
    background: var(--surface-0);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: calc(var(--space-4) * 2 + 60px);
    z-index: 9;
    flex-shrink: 0;
    margin-bottom: var(--space-4);
}

.quiz-question h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
}

.quiz-options {
    display: grid;
    gap: var(--space-3);
    width: 100%;
    max-width: 100%;
    flex: 1;
    align-content: center;
    padding: var(--space-2) 0;
    overflow: hidden;
    min-height: 0;
}

.quiz-option {
    padding: var(--space-4);
    border: 1px solid var(--border-light);
    background: var(--surface-0);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: left;
    font-size: 1rem;
    line-height: 1.5;
    box-shadow: var(--shadow-sm);
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.quiz-option:hover {
    border-color: var(--primary-300);
    background: var(--primary-50);
    box-shadow: var(--shadow-md);
}

.quiz-option.selected {
    border-color: var(--primary-500);
    background: var(--primary-100);
    color: var(--primary-800);
}

.quiz-option.correct {
    border-color: var(--success);
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
}

.quiz-option.incorrect {
    border-color: var(--error);
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
}

.quiz-controls {
    text-align: center;
    padding: var(--space-2) var(--space-4);
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10;
    flex-shrink: 0;
}

/* ===== QUIZ RESULTS ===== */
.quiz-results {
    text-align: center;
    padding: var(--space-4);
    background: var(--surface-0);
    border-radius: var(--radius-2xl);
    border: 2px solid var(--border-light);
    box-shadow: var(--shadow-xl);
    margin-bottom: var(--space-8);
    position: relative;
    overflow: hidden;
    animation: slideInUp 0.6s ease-out;
    max-height: calc(100vh - var(--header-height) - var(--bottom-nav-height) - var(--space-8));
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.quiz-results::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-500), var(--accent-purple), var(--primary-600));
}

.results-header {
    margin-bottom: var(--space-5);
    position: relative;
    flex-shrink: 0;
}

.score-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: conic-gradient(from calc(360deg - var(--score-percentage, 75) * 1.8deg), #6E1E99 0deg, #6E1E99 calc(var(--score-percentage, 75) * 3.6deg), #b78fcc calc(var(--score-percentage, 75) * 3.6deg));
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-3);
    box-shadow: var(--shadow-xl);
    position: relative;
    animation: scoreReveal 1s ease-out 0.3s both;
    flex-shrink: 0;
}

.score-circle::before {
    content: '';
    position: absolute;
    width: 100px;
    height: 100px;
    background: var(--surface-0);
    border-radius: 50%;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.1);
}

.score-circle span {
    font-size: 2.2rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
    z-index: 2;
    line-height: 1;
}

.results-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    animation: fadeInUp 0.6s ease-out 0.5s both;
}

.results-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-3);
    margin-bottom: var(--space-5);
    animation: fadeInUp 0.6s ease-out 0.7s both;
    flex-shrink: 0;
}

.result-stat {
    padding: var(--space-3);
    background: linear-gradient(135deg, var(--surface-0) 0%, var(--surface-secondary) 100%);
    border-radius: var(--radius-lg);
    border: 2px solid var(--border-light);
    box-shadow: var(--shadow-md);
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.result-stat::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-500), var(--accent-purple));
}

.result-stat:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-200);
}

.stat-value {
    display: block;
    font-size: 1.375rem;
    font-weight: 900;
    color: var(--primary-600);
    margin-bottom: 2px;
    line-height: 1.1;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    line-height: 1.2;
}

.results-actions {
    display: flex;
    gap: var(--space-3);
    justify-content: center;
    animation: fadeInUp 0.6s ease-out 0.9s both;
    flex-shrink: 0;
}

.results-actions .btn {
    min-width: 120px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    border-radius: var(--radius-lg);
    position: relative;
    overflow: hidden;
    padding: var(--space-3) var(--space-4);
    font-size: 0.875rem;
}

.results-actions .btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

.results-actions .btn:hover::before {
    left: 100%;
}

/* Chart Enhancement Styles */
.quiz-chart {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: conic-gradient(
        var(--success) 0deg,
        var(--success) calc(var(--correct-percentage, 0) * 3.6deg),
        var(--error) calc(var(--correct-percentage, 0) * 3.6deg),
        var(--error) calc((var(--correct-percentage, 0) + var(--incorrect-percentage, 0)) * 3.6deg),
        var(--surface-2) calc((var(--correct-percentage, 0) + var(--incorrect-percentage, 0)) * 3.6deg)
    );
    position: absolute;
    top: 50%;
    right: var(--space-4);
    transform: translateY(-50%);
    animation: chartSpin 1s ease-out 0.5s both;
}

/* Animation Keyframes */
@keyframes scoreReveal {
    from {
        transform: scale(0) rotate(-180deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.1) rotate(0deg);
        opacity: 1;
    }
    to {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

@keyframes chartSpin {
    from {
        transform: translateY(-50%) rotate(-90deg) scale(0);
        opacity: 0;
    }
    to {
        transform: translateY(-50%) rotate(0deg) scale(1);
        opacity: 1;
    }
}

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

@keyframes welcomeContainerFadeIn {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Ensure welcome screen elements are visible after animation */
.welcome-screen .welcome-header,
.welcome-screen .welcome-preview,
.welcome-screen .preview-step,
.welcome-screen .auth-buttons {
    animation-fill-mode: forwards !important;
}

/* Safety fallback - show content after 2 seconds if animations fail */
@media (prefers-reduced-motion: reduce), (max-width: 0px) {
    .welcome-header,
    .welcome-preview,
    .preview-step,
    .auth-buttons {
        opacity: 1 !important;
        transform: translateY(0) !important;
        animation: none !important;
    }
}

/* Ensure welcome screen animation works with high specificity */
.welcome-screen .welcome-container {
    animation: welcomeContainerFadeIn 0.8s ease-out 0.2s forwards !important;
}

/* Mobile Optimizations */
@media (max-width: 480px) {
    .quiz-results {
        padding: var(--space-4);
        margin: var(--space-2);
    }
    
    .score-circle {
        width: 160px;
        height: 160px;
        margin-bottom: var(--space-5);
    }
    
    .score-circle::before {
        width: 136px;
        height: 136px;
    }
    
    .score-circle span {
        font-size: 2.5rem;
    }
    
    .results-header h2 {
        font-size: 1.3rem;
        margin-bottom: var(--space-2);
    }
    
    .results-stats {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-2);
        margin-bottom: var(--space-6);
    }
    
    .result-stat {
        padding: var(--space-3);
        text-align: center;
    }
    
    .result-stat::before {
        height: 2px;
    }
    
    .stat-value {
        font-size: 1.25rem;
        margin-bottom: 2px;
        line-height: 1;
    }
    
    .stat-label {
        font-size: 0.7rem;
        line-height: 1.2;
    }
    
    .results-actions {
        flex-direction: column;
        gap: var(--space-3);
    }
    
    .results-actions .btn {
        width: 100%;
        padding: var(--space-3) var(--space-4);
        font-size: 0.95rem;
    }
}

@media (max-width: 360px) {
    .score-circle {
        width: 140px;
        height: 140px;
    }
    
    .score-circle::before {
        width: 120px;
        height: 120px;
    }
    
    .score-circle span {
        font-size: 2.2rem;
    }
    
    .result-stat {
        padding: var(--space-2);
    }
    
    .stat-value {
        font-size: 1.1rem;
    }
    
    .stat-label {
        font-size: 0.65rem;
    }
}

@media (max-height: 700px) {
    .quiz-results {
        padding: var(--space-3);
    }
    
    .score-circle {
        width: 120px;
        height: 120px;
        margin-bottom: var(--space-3);
    }
    
    .score-circle::before {
        width: 100px;
        height: 100px;
    }
    
    .score-circle span {
        font-size: 2rem;
    }
    
    .results-header {
        margin-bottom: var(--space-4);
    }
    
    .results-header h2 {
        font-size: 1.2rem;
    }
    
    .results-stats {
        margin-bottom: var(--space-4);
    }
    
    .result-stat {
        padding: var(--space-2);
    }
    
    .stat-value {
        font-size: 1.2rem;
    }
}

@media (max-height: 600px) {
    .score-circle {
        width: 100px;
        height: 100px;
    }
    
    .score-circle::before {
        width: 84px;
        height: 84px;
    }
    
    .score-circle span {
        font-size: 1.8rem;
    }
    
    .results-header h2 {
        font-size: 1.1rem;
    }
}

/* ===== BOTTOM NAVIGATION ===== */
.bottom-nav {
    position: fixed !important;
    bottom: 0 !important;
    left: 0;
    right: 0;
    width: 100%;
    height: 60px;
    background: var(--surface-0);
    border-top: 1px solid var(--border-light);
    backdrop-filter: blur(12px);
    display: none;
    align-items: center;
    z-index: 1000;
    padding-bottom: env(safe-area-inset-bottom);
}

.bottom-nav-content {
    width: 100%;
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: 0 var(--space-4);
    display: flex;
    align-items: center;
    justify-content: space-around;
    height: 100%;
}

.bottom-nav:not(.hidden) {
    display: flex; /* Show when not hidden */
}

.nav-item {
    width: 35px;
    height: 35px;
    border: none;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text-tertiary);
    position: relative;
    border-radius: 8px;
}

.nav-item.active {
    color: var(--primary-100);
    background: var(--primary-600);
}

.nav-item:hover:not(.active) {
    color: var(--text-secondary);
    background: var(--surface-2);
}

.nav-icon {
    font-size: 24px !important;
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-item.active .nav-icon {
    font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24;
}

.nav-icon {
    font-size: 26px !important;
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24; /* Default outline */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-item.active .nav-icon {
    font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24; /* Filled for active */
}

/* Hide text labels for minimal design */
.nav-label {
    display: none;
}

/* Remove indicator since we have background highlight */
.nav-indicator {
    display: none;
}

/* ===== HISTORY TAB ===== */
.history-stats {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-5);
    margin-bottom: var(--space-10);
}

@media (min-width: 640px) {
    .history-stats {
        grid-template-columns: repeat(3, 1fr);
    }
}

.stat-card {
    background: linear-gradient(135deg, var(--surface-0) 0%, var(--surface-secondary) 100%);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-2xl);
    padding: var(--space-6);
    display: flex;
    align-items: center;
    gap: var(--space-4);
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

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

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary-200);
}

.stat-icon {
    width: 56px;
    height: 56px;
    background: var(--primary-100);
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon .material-symbols-rounded {
    font-size: 28px;
    color: var(--primary-600);
}

.stat-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.stat-card .stat-number {
    font-size: 1.875rem;
    font-weight: 900;
    color: var(--primary-600);
    line-height: 1.1;
    margin-bottom: var(--space-1);
}

.stat-card .stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.history-item {
    background: var(--surface-0);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-xl);
    padding: var(--space-5);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-sm);
}

.history-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-200);
}

.history-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.history-date {
    font-size: 0.875rem;
    color: var(--text-tertiary);
    font-weight: 500;
}

.history-details {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.history-score {
    font-size: 1.5rem;
    font-weight: 800;
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-lg);
    min-width: 80px;
    text-align: center;
}

.history-score.excellent {
    background: var(--success-100);
    color: var(--success-700);
}

.history-score.good {
    background: var(--warning-100);
    color: var(--warning-700);
}

.history-score.poor {
    background: var(--error-100);
    color: var(--error-700);
}

/* ===== SETTINGS TAB ===== */
.settings-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.setting-item {
    background: var(--surface-0);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-xl);
    padding: var(--space-5);
    display: flex;
    align-items: center;
    gap: var(--space-4);
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-sm);
}

.setting-item.clickable {
    cursor: pointer;
    user-select: none;
}

.setting-item:hover,
.setting-item.clickable:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-200);
}

.setting-item.clickable:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
    border-color: var(--primary-300);
}

.setting-icon {
    width: 48px;
    height: 48px;
    background: var(--primary-100);
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.setting-icon .material-symbols-rounded {
    font-size: 24px;
    color: var(--primary-600);
}

.setting-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.setting-title {
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
}

.setting-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.setting-action {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--surface-secondary);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-normal);
    flex-shrink: 0;
}

.setting-action:hover {
    background: var(--surface-tertiary);
    transform: scale(1.05);
}

.setting-action.danger {
    background: var(--error-100);
    color: var(--error-600);
}

.setting-action.danger:hover {
    background: var(--error-200);
    color: var(--error-700);
}

.setting-action .material-symbols-rounded {
    font-size: 20px;
    color: var(--text-secondary);
}

.setting-action.danger .material-symbols-rounded {
    color: var(--error-600);
}

/* ===== EMPTY STATES ===== */
.empty-state {
    text-align: center;
    padding: var(--space-16) var(--space-4);
    animation: fadeIn 0.6s ease-out;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

.empty-icon {
    width: 96px;
    height: 96px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--primary-50) 0%, var(--primary-100) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-6);
    box-shadow: var(--shadow-lg);
    border: 3px solid var(--primary-200);
}

.empty-icon .material-symbols-rounded {
    font-size: 48px;
    color: var(--primary-600);
}

.empty-state h3 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: var(--space-3);
    letter-spacing: -0.025em;
}

.empty-state p {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-8);
    max-width: 400px;
    line-height: 1.6;
}

.search-empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: var(--space-16) var(--space-4);
    animation: fadeIn 0.6s ease-out;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

.search-empty-state .empty-icon {
    width: 96px;
    height: 96px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--primary-50) 0%, var(--primary-100) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-6);
    box-shadow: var(--shadow-lg);
    border: 3px solid var(--primary-200);
}

.search-empty-state .empty-icon .material-symbols-rounded {
    font-size: 48px;
    color: var(--primary-600);
}

.search-empty-state h3 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: var(--space-3);
    letter-spacing: -0.025em;
}

.search-empty-state p {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-8);
    max-width: 400px;
    line-height: 1.6;
}

/* ===== LOADING SPINNER ===== */
.loading-spinner {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    gap: var(--space-4);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--surface-2);
    border-top: 4px solid var(--primary-600);
    border-radius: var(--radius-full);
    animation: spin 1s linear infinite;
}

.loading-spinner p {
    color: var(--text-secondary);
    font-weight: 500;
}

/* ===== TOAST NOTIFICATIONS ===== */
.toast-container {
    position: fixed;
    top: var(--space-4);
    right: var(--space-4);
    z-index: 4000;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.toast {
    background: var(--surface-0);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    max-width: 320px;
    animation: slideInRight 0.3s ease-out;
}

.toast.success {
    border-color: var(--success);
    background: rgba(34, 197, 94, 0.05);
}

.toast.error {
    border-color: var(--error);
    background: rgba(239, 68, 68, 0.05);
}

.toast-icon {
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
    font-size: 0.9rem;
    line-height: 1.4;
}

/* ===== ENHANCED ANIMATIONS ===== */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes shimmer {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

/* Component entrance animations with staggered delays */
.word-card {
    animation: slideInUp 0.4s ease-out both;
}

.word-card:nth-child(1) { animation-delay: 0.1s; }
.word-card:nth-child(2) { animation-delay: 0.2s; }
.word-card:nth-child(3) { animation-delay: 0.3s; }
.word-card:nth-child(4) { animation-delay: 0.4s; }
.word-card:nth-child(5) { animation-delay: 0.5s; }
.word-card:nth-child(6) { animation-delay: 0.6s; }

.stat-item, .stat-card {
    animation: scaleIn 0.5s ease-out both;
}

.stat-item:nth-child(1), .stat-card:nth-child(1) { animation-delay: 0.1s; }
.stat-item:nth-child(2), .stat-card:nth-child(2) { animation-delay: 0.2s; }
.stat-item:nth-child(3), .stat-card:nth-child(3) { animation-delay: 0.3s; }

.setting-item {
    animation: slideInUp 0.3s ease-out both;
}

.setting-item:nth-child(1) { animation-delay: 0.05s; }
.setting-item:nth-child(2) { animation-delay: 0.1s; }
.setting-item:nth-child(3) { animation-delay: 0.15s; }
.setting-item:nth-child(4) { animation-delay: 0.2s; }
.setting-item:nth-child(5) { animation-delay: 0.25s; }
.setting-item:nth-child(6) { animation-delay: 0.3s; }

.history-item {
    animation: slideInUp 0.4s ease-out both;
}

.history-item:nth-child(1) { animation-delay: 0.1s; }
.history-item:nth-child(2) { animation-delay: 0.2s; }
.history-item:nth-child(3) { animation-delay: 0.3s; }
.history-item:nth-child(4) { animation-delay: 0.4s; }
.history-item:nth-child(5) { animation-delay: 0.5s; }

.option-group {
    animation: fadeInUp 0.4s ease-out both;
}

.option-group:nth-child(1) { animation-delay: 0.1s; }
.option-group:nth-child(2) { animation-delay: 0.2s; }

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

@keyframes logoFloat {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

@keyframes glow {
    from { opacity: 0.3; }
    to { opacity: 0.8; }
}

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

/* ===== RESPONSIVE DESIGN ===== */
@media (max-height: 700px) {
    .welcome-container {
        max-width: 320px;
        padding: var(--space-1);
    }
    
    .welcome-header h1 {
        font-size: 2rem;
    }
    
    .logo-image {
        width: 64px;
        height: 64px;
    }
    
    .welcome-preview {
        margin-bottom: var(--space-3);
        gap: var(--space-1);
    }
    
    .preview-step {
        padding: var(--space-2) var(--space-2);
        min-height: 40px;
    }
    
    .step-content strong {
        font-size: 0.85rem;
    }
    
    .step-content span {
        font-size: 0.75rem;
    }
    
    .welcome-header {
        margin-bottom: var(--space-3);
    }
    
    .auth-buttons {
        gap: var(--space-2);
    }
    
    .privacy-notice {
        font-size: 0.75rem;
        margin-top: var(--space-2);
    }
}

/* Compact mobile screens */
@media (max-height: 650px) and (max-width: 768px) {
    .welcome-container {
        transform: scale(0.95);
        max-width: 330px;
    }
    
    .logo-image {
        width: 52px;
        height: 52px;
    }
    
    .welcome-header h1 {
        font-size: 1.7rem;
    }
    
    .welcome-preview {
        gap: 6px;
    }
    
    .preview-step {
        min-height: 38px;
        padding: 6px var(--space-2);
    }
    
    .privacy-notice {
        font-size: 0.72rem;
        line-height: 1.3;
    }
}

@media (max-height: 600px) {
    .welcome-screen {
        padding: var(--space-2);
    }
    
    .welcome-container {
        max-width: 300px;
        padding: 0;
        transform: scale(0.9);
    }
    
    .welcome-header h1 {
        font-size: 1.6rem;
    }
    
    .welcome-header p {
        font-size: 0.8rem;
    }
    
    .logo-image {
        width: 48px;
        height: 48px;
    }
    
    .preview-step {
        min-height: 36px;
        padding: 4px var(--space-2);
    }
    
    .step-content strong {
        font-size: 0.8rem;
    }
    
    .step-content span {
        font-size: 0.7rem;
    }
    
    .welcome-header {
        margin-bottom: var(--space-2);
    }
    
    .welcome-preview {
        margin-bottom: var(--space-2);
        gap: 4px;
    }
    
    .privacy-notice {
        font-size: 0.6rem;
        margin: var(--space-1) 0 0 0;
    }
}

@media (max-height: 500px) {
    .welcome-container {
        transform: scale(0.85);
        max-width: 280px;
    }
    
    .welcome-header h1 {
        font-size: 1.4rem;
    }
    
    .welcome-header p {
        font-size: 0.75rem;
    }
    
    .logo-image {
        width: 42px;
        height: 42px;
    }
    
    .welcome-preview {
        display: none; /* Hide steps on very small screens */
    }
    
    .privacy-notice {
        font-size: 0.55rem;
        margin: var(--space-1) 0 0 0;
    }
}

@media (min-width: 480px) {
    .words-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
    
    .button-group {
        grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    }
}

@media (min-width: 768px) {
    .mobile-header {
        padding: 0 var(--space-6);
    }
    
    .tab-content {
        padding: var(--space-8) var(--space-6);
    }
    
    .welcome-screen {
        padding: var(--space-8);
    }
    
    .modal {
        padding: var(--space-8);
    }
    
    .quiz-container {
        padding: var(--space-8) var(--space-6);
    }
    .quiz-controls {
        padding: var(--space-8) var(--space-6);
    }
}


/* ===== EDIT WORD DIALOG ===== */
.edit-word-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: var(--space-4);
}

.edit-word-dialog.active {
    display: flex;
}

.edit-word-content {
    background: var(--surface-0);
    border-radius: var(--radius-2xl);
    padding: var(--space-8);
    width: 100%;
    max-width: 500px;
    box-shadow: var(--shadow-2xl);
    border: 1px solid var(--border-light);
    position: relative;
    animation: editDialogSlideIn 0.3s ease-out;
}

@keyframes editDialogSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.edit-dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-6);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--border-light);
}

.edit-dialog-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.edit-dialog-close {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--surface-2);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    color: var(--text-tertiary);
}

.edit-dialog-close:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
}

.edit-word-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
}

.edit-form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.edit-form-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-1);
}

.edit-form-input {
    padding: var(--space-4);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-lg);
    font-size: 1rem;
    background: var(--surface-0);
    color: var(--text-primary);
    transition: all var(--transition-fast);
    font-family: var(--font-family-sans);
}

.edit-form-input:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.1);
}

.edit-form-textarea {
    padding: var(--space-4);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-lg);
    font-size: 1rem;
    background: var(--surface-0);
    color: var(--text-primary);
    transition: all var(--transition-fast);
    font-family: var(--font-family-sans);
    resize: vertical;
    min-height: 100px;
    line-height: 1.5;
}

.edit-form-textarea:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.1);
}

.edit-dialog-actions {
    display: flex;
    gap: var(--space-3);
    justify-content: flex-end;
    margin-top: var(--space-6);
    padding-top: var(--space-4);
    border-top: 1px solid var(--border-light);
}

.edit-cancel-btn {
    padding: var(--space-3) var(--space-6);
    border: 2px solid var(--border-medium);
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-lg);
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: var(--font-family-sans);
}

.edit-cancel-btn:hover {
    border-color: var(--border-strong);
    background: var(--surface-2);
    color: var(--text-primary);
}

.edit-save-btn {
    padding: var(--space-3) var(--space-6);
    border: none;
    background: var(--primary-600);
    color: var(--text-on-primary);
    border-radius: var(--radius-lg);
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: var(--font-family-sans);
    box-shadow: var(--shadow-sm);
}

.edit-save-btn:hover {
    background: var(--primary-700);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.edit-save-btn:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

body.dark-mode .edit-save-btn {
    color: var(--text-primary) !important;
}


/* Dark mode adjustments for quiz elements */
body.dark-mode .quiz-option {
    color: var(--text-primary);
    background: var(--surface-secondary);
    border-color: var(--border-medium);
}

body.dark-mode .quiz-option:hover {
    background: var(--surface-tertiary);
    border-color: var(--primary-400);
    color: var(--text-primary);
}

body.dark-mode .quiz-option.selected {
    background: var(--primary-200);
    border-color: var(--primary-500);
    color: var(--primary-900);
}

body.dark-mode .quiz-option.correct {
    background: rgba(34, 197, 94, 0.2);
    border-color: var(--success);
    color: var(--success);
}

body.dark-mode .quiz-option.incorrect {
    background: rgba(239, 68, 68, 0.2);
    border-color: var(--error);
    color: var(--error);
}



body.dark-mode .btn-primary {
    color: var(--text-primary) !important;
}

body.dark-mode .btn-secondary {
    color: var(--text-primary) !important;
    background: var(--surface-secondary);
    border-color: var(--border-medium);
}

body.dark-mode .btn-secondary:hover {
    background: var(--surface-tertiary);
    color: var(--text-primary) !important;
}

body.dark-mode .stat-number,
body.dark-mode .stat-card .stat-number {
    color: var(--primary-400);
}

/* ===== OPTION BUTTONS & BUTTON GROUPS ===== */
.button-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
    gap: var(--space-2);
    width: 100%;
    margin-top: var(--space-2);
}

.option-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-3) var(--space-2);
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    white-space: nowrap;
    color: var(--text-secondary);
    background: var(--surface-0);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-normal);
    min-height: 44px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.option-btn:hover {
    border-color: var(--primary-300);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    background: linear-gradient(135deg, var(--primary-50) 0%, var(--primary-100) 100%);
}


.option-btn:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.option-btn:focus {
    outline: none;
    box-shadow: var(--shadow-md), 0 0 0 3px var(--primary-100);
    border-color: var(--primary-400);
}

.option-btn.active {
    color: var(--text-on-primary);
    background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-700) 100%);
    border-color: var(--primary-700);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
    font-weight: 700;
    position: relative;
    z-index: 1;
}


/* Disabled option button styles */
.option-btn:disabled,
.option-btn.disabled {
    position: relative;
    opacity: 0.6;
    cursor: not-allowed;
    color: var(--text-disabled);
    background: var(--surface-0);
    border-color: var(--border-light);
    pointer-events: none;
}


/* Button text wrapper for better positioning */
.option-btn .button-text {
    position: relative;
    z-index: 1;
}

.option-btn .coming-soon {
    position: absolute;
    top: -1px;
    right: -3px;
    background: linear-gradient(135deg, var(--primary-500) 0%, var(--primary-600) 100%);
    color: white;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 3px 6px;
    border-radius: var(--radius-full);
    letter-spacing: 0.02em;
    text-transform: uppercase;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
    z-index: 2;
    line-height: 1;
    white-space: nowrap;
}

/* Add X cursor and visual feedback for disabled state */
.option-btn:disabled:hover,
.option-btn.disabled:hover {
    cursor: not-allowed;
    opacity: 0.4;
}

body.dark-mode .option-btn:hover {
    color: var(--text-on-primary);
}

/* Dark mode styles for active option buttons */
body.dark-mode .option-btn.active {
    color: var(--text-primary);
}


/* Dark mode styles for disabled buttons */
body.dark-mode .option-btn:disabled,
body.dark-mode .option-btn.disabled {
    color: var(--text-disabled);
    background: var(--surface-1);
    border-color: var(--border-medium);
}

body.dark-mode .option-btn .coming-soon {
    background: linear-gradient(135deg, var(--primary-400) 0%, var(--primary-500) 100%);
    color: var(--text-primary);
    box-shadow: 0 2px 8px rgba(168, 85, 247, 0.3);
}

/* ===== ACCOUNT PAGE STYLES ===== */

.account-page {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--surface-0);
    z-index: 100;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.98);
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.account-page.show {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}

.account-page.hidden {
    opacity: 0;
    visibility: hidden;
    transform: scale(0.98);
    pointer-events: none;
}

/* Account Header */
.account-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--surface-0);
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    height: var(--header-height);
}

.account-header-content {
    width: 100%;
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: 0 var(--space-4);
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}

.back-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    background: var(--surface-2);
    color: var(--text-primary);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all 0.2s ease;
    touch-action: manipulation;
}

.back-button:hover {
    background: var(--surface-3);
    transform: scale(1.05);
}

.back-button:active {
    transform: scale(0.95);
}

.account-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.header-spacer {
    width: 40px;
}

/* Account Content */
.account-content {
    flex: 1;
    overflow-y: auto;
    padding-bottom: var(--bottom-nav-height);
}

.account-content-inner {
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: var(--space-6) var(--space-4);
    padding-bottom: var(--space-20);
}

.account-section {
    margin-bottom: var(--space-8);
}

.section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-4);
    padding: 0 var(--space-2);
}

/* Profile Card */
.profile-card {
    background: var(--surface-0);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-4);
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
    text-align: center;
}

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

.profile-avatar {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    overflow: hidden;
}

.avatar-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}

.avatar-image.show {
    display: block;
}

.avatar-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-500), var(--accent-purple));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 24px;
}

.avatar-placeholder.hidden {
    display: none;
}

.profile-info {
    flex: 1;
    text-align: center;
}

.profile-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 var(--space-1) 0;
    line-height: 1.2;
}

.profile-email {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin: 0 0 var(--space-2) 0;
}

.profile-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
}

.status-indicator {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: var(--radius-full);
    box-shadow: 0 0 0 2px var(--success-light);
}

.status-text {
    font-size: 0.875rem;
    color: var(--success-dark);
    font-weight: 500;
}

/* Account Actions */
.account-actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.account-action-item {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4);
    background: var(--surface-0);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    width: 100%;
}

.account-action-item:hover {
    background: var(--surface-1);
    border-color: var(--border-medium);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.account-action-item:active {
    transform: translateY(0);
}

.action-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--surface-2);
    border-radius: var(--radius-lg);
    color: var(--text-secondary);
}

.action-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

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

.action-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.action-arrow {
    color: var(--text-tertiary);
    font-size: 1.25rem;
}

/* Danger Zone */
.danger-section {
    border: 1px solid var(--error-light);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    background: var(--error-light);
}

.danger-title {
    color: var(--error-dark);
    margin-bottom: var(--space-3);
}

.danger-item {
    background: var(--surface-0);
    border-color: var(--error);
}

.danger-item:hover {
    background: var(--error-light);
    border-color: var(--error-dark);
}

.danger-icon {
    background: var(--error-light);
    color: var(--error);
}

.danger-item .action-title {
    color: var(--error-dark);
}

/* About Us Page Specific Styles */
.about-description {
    color: var(--text-secondary);
    line-height: 1.6;
}

.about-description h4 {
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
    margin: 24px 0 12px 0;
}

.about-description p {
    margin: 16px 0;
}

.feature-list {
    list-style: none;
    padding: 0;
    margin: 12px 0;
}

.feature-list li {
    padding: 8px 0;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.app-stats {
    display: flex;
    justify-content: space-around;
    margin: 24px 0 16px 0;
    padding: 20px;
    background: var(--surface-2);
    border-radius: 12px;
    border: 1px solid var(--border);
}

.stat-item {
    text-align: center;
    flex: 1;
}

.stat-number {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.credits-content {
    color: var(--text-secondary);
    line-height: 1.6;
}

.credits-content p {
    margin: 12px 0;
}

/* Dark Mode Styles */
.dark-mode {
    /* Dark Mode Surface Colors */
    --surface-0: #0f172a;
    --surface-1: #1e293b;
    --surface-2: #334155;
    --surface-3: #475569;
    --surface-secondary: #1e293b;
    --surface-tertiary: #334155;
    
    /* Dark Mode Text Colors */
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-tertiary: #94a3b8;
    --text-disabled: #64748b;
    --text-on-primary: #0f172a;
    --text-on-surface: #f8fafc;
    --text-muted: #9ca3af;
    
    /* Dark Mode Border Colors */
    --border-light: #334155;
    --border-medium: #475569;
    --border-strong: #64748b;
    --border-focus: #60a5fa;
    
    /* Dark Mode Shadows */
    --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.4);
    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.5), 0 1px 2px -1px rgb(0 0 0 / 0.5);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.5), 0 4px 6px -4px rgb(0 0 0 / 0.5);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.5), 0 8px 10px -6px rgb(0 0 0 / 0.5);
    --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.7);
    --shadow-glow: 0 0 20px rgb(96 165 250 / 0.25);
    
    /* Dark Mode Semantic Colors */
    --success-light: #166534;
    --success-dark: #dcfce7;
    --warning-light: #92400e;
    --warning-dark: #fef3c7;
    --error-light: #991b1b;
    --error-dark: #fecaca;
    --info-light: #1e40af;
    --info-dark: #dbeafe;
    
    /* Dark Mode Gradients */
    --gradient-primary: linear-gradient(135deg, #3b0f52 0%, #4c1565 50%, #6e1e99 100%);
    --gradient-surface: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    --gradient-card: linear-gradient(135deg, #1e293b 0%, #334155 100%);
}

/* ===== ENHANCED THEME TOGGLE ===== */
.theme-toggle-container {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

/* Enhanced notification toggle */
.toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    width: 50px;
    height: 28px;
    background: var(--surface-2);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all var(--transition-theme);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.toggle:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--border-medium);
}

.toggle input[type="checkbox"] {
    opacity: 0;
    position: absolute;
    width: 100%;
    height: 100%;
    margin: 0;
    cursor: pointer;
    z-index: 3;
}

.toggle::before {
    content: '';
    position: absolute;
    inset: 2px;
    width: 20px;
    height: 20px;
    background: var(--surface-0);
    border-radius: var(--radius-full);
    transform: translateX(0);
    transition: all var(--transition-theme);
    z-index: 1;
    box-shadow: var(--shadow-sm);
}

.toggle input[type="checkbox"]:checked + .toggle::before,
.toggle:has(input[type="checkbox"]:checked)::before {
    background: var(--primary-600);
    transform: translateX(22px);
    box-shadow: var(--shadow-md);
}

.toggle:has(input[type="checkbox"]:checked) {
    background: var(--primary-100);
    border-color: var(--primary-300);
}

.theme-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    width: 60px;
    height: 32px;
    background: var(--surface-2);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all var(--transition-theme);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.theme-toggle:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--border-medium);
}

.theme-toggle::before {
    content: '';
    position: absolute;
    inset: 2px;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    border-radius: var(--radius-full);
    transform: translateX(0);
    transition: all var(--transition-theme);
    z-index: 1;
}

.dark-mode .theme-toggle::before {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    transform: translateX(26px);
}

.theme-toggle-input {
    opacity: 0;
    position: absolute;
    width: 100%;
    height: 100%;
    margin: 0;
    cursor: pointer;
    z-index: 3;
}

.theme-toggle-icons {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-2);
    z-index: 2;
}

.theme-icon {
    font-size: 16px !important;
    transition: all var(--transition-theme);
    color: white;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.theme-icon.sun {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

.theme-icon.moon {
    opacity: 0;
    transform: rotate(180deg) scale(0.8);
}

.dark-mode .theme-icon.sun {
    opacity: 0;
    transform: rotate(-180deg) scale(0.8);
}

.dark-mode .theme-icon.moon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

/* Enhanced Setting Item for Theme */
.setting-item.theme-setting {
    background: var(--surface-0);
    border: 2px solid var(--border-light);
    position: relative;
    overflow: hidden;
}

.theme-setting-icon {
    width: 48px;
    height: 48px;
    background: var(--primary-100);
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all var(--transition-theme);
    position: relative;
    overflow: hidden;
}

.theme-setting-icon::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity var(--transition-theme);
}

.setting-item.theme-setting:hover .theme-setting-icon::before {
    opacity: 0.1;
}

.theme-setting-icon .material-symbols-rounded {
    font-size: 24px;
    color: var(--primary-600);
    transition: all var(--transition-theme);
    z-index: 1;
    position: relative;
}

/* ===== EMERGENCY PERFORMANCE FIX - OVERRIDE ALL EXPENSIVE TRANSITIONS ===== */

/* Remove ALL "transition: all" declarations for instant loading */
.btn,
.btn-primary,
.btn-secondary,
.btn-google,
.btn-text,
.btn-large,
.close-btn,
.input-group input,
.input-group textarea,
.link-btn,
.app-container,
.settings-btn,
.search-box,
.search-clear,
.word-card,
.word-action-btn,
.stat-item,
.quiz-option,
.quit-btn,
.stat-card,
.history-item,
.setting-item,
.setting-action,
.nav-item,
.nav-icon,
.nav-indicator,
.theme-toggle,
.theme-toggle::before,
.theme-icon,
.theme-setting-icon,
.modal,
.modal-content,
.add-word-btn {
    transition: none !important;
}

/* Only allow essential theme toggle animation */
.theme-toggle::before {
    transition: transform 200ms ease !important;
}

.theme-icon {
    transition: opacity 200ms ease, transform 200ms ease !important;
}

/* Minimal hover effects for better UX */
.btn:hover,
.word-card:hover,
.setting-item:hover {
    transition: transform 100ms ease !important;
}

/* Remove all entrance animations for instant loading */
.word-card,
.stat-item,
.stat-card,
.setting-item,
.history-item,
.option-group {
    animation: none !important;
    animation-delay: 0s !important;
}

/* Disable all nth-child animation delays */
.word-card:nth-child(n),
.stat-item:nth-child(n),
.stat-card:nth-child(n),
.setting-item:nth-child(n),
.history-item:nth-child(n) {
    animation: none !important;
    animation-delay: 0s !important;
}

/* Performance mode - disable all transitions temporarily */
.performance-mode * {
    transition: none !important;
    animation: none !important;
}

/* Quiz content wrapper for proper mobile layout */
.quiz-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

.quiz-main {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

/* Creator Section Styles */
.creator-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 32px 24px;
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: 16px;
    margin-bottom: 8px;
    box-shadow: var(--shadow-sm);
}

.creator-avatar {
    position: relative;
    width: 200px;
    height: 200px;
    margin-bottom: 20px;
}

.creator-image {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--primary);
    box-shadow: var(--shadow-lg);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.creator-image:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-xl);
}

.creator-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.creator-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.2;
}

.creator-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    margin: 0;
    font-weight: 400;
}

/* Dark mode creator styles */
body.dark-mode .creator-card {
    background: var(--surface-1);
    border-color: var(--border-light);
}

body.dark-mode .creator-image {
    border-color: var(--primary);
}

/* Creator Essay Styles */
.creator-essay {
    margin-top: 16px;
}

.essay-text {
    padding: 24px;
    border: 2px solid var(--border);
    border-radius: 12px;
    background: var(--surface-1);
    font-family: Georgia, 'Times New Roman', Times, serif;
    font-style: italic;
    box-shadow: var(--shadow-sm);
}

.essay-date {
    text-align: center;
    color: var(--text-tertiary);
    font-size: 1.1rem;
    font-weight: 500;
}

.essay-content {
    color: var(--text-primary);
    font-size: 1.2rem;
    line-height: 1.8;
    margin: 0;
    text-align: justify;
}

/* Dark mode essay styles */
body.dark-mode .essay-text {
    background: var(--surface-1);
    border-color: var(--border-light);
}

body.dark-mode .essay-date {
    color: var(--text-tertiary);
}

body.dark-mode .essay-content {
    color: var(--text-primary);
}

/* ===== APP COPYRIGHT ===== */
.app-copyright {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    text-align: center;
    margin: 12px 0 0 0;
    line-height: 1.4;
    opacity: 0.8;
}

/* Dark mode adjustments for app copyright */
body.dark-mode .app-copyright {
    color: var(--text-secondary);
    opacity: 0.9;
}
body.dark-mode .quiz-results .stat-value {
    color: #b78fcc;
}
body.dark-mode .quiz-results #final-score {
    color: #b78fcc !important;
    background: none !important;
    -webkit-background-clip: unset !important;
    -webkit-text-fill-color: unset !important;
    background-clip: unset !important;
}

/* ===== PRIVACY POLICY STYLES ===== */
.privacy-content {
    padding: 0;
}

.privacy-updated {
    font-size: 0.875rem;
    color: var(--text-tertiary);
    font-style: italic;
    margin-bottom: 24px;
    text-align: center;
}

.privacy-section {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-light);
}

.privacy-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.privacy-section h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.privacy-section p {
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.privacy-section p:last-child {
    margin-bottom: 0;
}

.privacy-section ul {
    list-style: none;
    padding-left: 0;
    margin: 12px 0;
}

.privacy-section ul li {
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 8px;
    padding-left: 16px;
    position: relative;
}

.privacy-section ul li:before {
    content: "•";
    color: var(--primary-600);
    position: absolute;
    left: 0;
    font-weight: 600;
}

.privacy-section strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* Dark mode adjustments for privacy policy */
body.dark-mode .privacy-updated {
    color: var(--text-secondary);
}

body.dark-mode .privacy-section {
    border-bottom-color: var(--border-primary);
}

body.dark-mode .privacy-section h3 {
    color: var(--text-primary);
}

body.dark-mode .privacy-section p {
    color: var(--text-secondary);
}

body.dark-mode .privacy-section ul li {
    color: var(--text-secondary);
}

body.dark-mode .privacy-section ul li:before {
    color: var(--primary-400);
}

body.dark-mode .privacy-section strong {
    color: var(--text-primary);
}