@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    /* Palette violet pastel moderne */
    --primary: #a68dd2;
    --primary-hover: #8f76c7;
    --primary-light: #a78bfa;
    --primary-ultralight: #f3f0ff;
    
    --secondary: #7ea3ff;
    --secondary-light: #f472b6;
    
    --accent: #06b6d4;
    --accent-light: #22d3ee;
    
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    
    /* Backgrounds */
    --bg-primary: #fefefe;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #ffffff;
    --bg-card: #ffffff;
    
    /* Text colors */
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-tertiary: #94a3b8;
    --text-white: #ffffff;
    
    /* Borders */
    --border-light: #e2e8f0;
    --border-medium: #cbd5e1;
    --border-strong: #94a3b8;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(139, 92, 246, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(139, 92, 246, 0.1), 0 2px 4px -1px rgba(139, 92, 246, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(139, 92, 246, 0.1), 0 4px 6px -2px rgba(139, 92, 246, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(139, 92, 246, 0.1), 0 10px 10px -5px rgba(139, 92, 246, 0.04);
    --shadow-hover: 0 20px 25px -5px rgba(139, 92, 246, 0.15), 0 10px 10px -5px rgba(139, 92, 246, 0.08);
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    --gradient-card: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
    --gradient-hover: linear-gradient(135deg, var(--primary-hover) 0%, #d946ef 100%);
}

html.dark {
    --primary: #bb86fc;
    --primary-hover: #9b6fe7;
    --primary-light: #c4b5fd;
    --primary-ultralight: #1e1b24;
    
    --secondary: #f472b6;
    --secondary-light: #ec4899;
    
    --bg-primary: #1e1b24;
    --bg-secondary: #1a1a35;
    --bg-tertiary: #252547;
    --bg-card: #2a2733;
    
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-tertiary: #94a3b8;
    
    --border-light: #334155;
    --border-medium: #475569;
    --border-strong: #64748b;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
    --shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.3);
    
    --gradient-card: linear-gradient(145deg, var(--bg-card) 0%, var(--bg-tertiary) 100%);
}

/* ===== BASE STYLES ===== */
html, body {
    margin: 0;
    padding: 0;
    padding-top: 80px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===== CONTAINER PRINCIPAL ===== */
header + main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2.5rem 2rem;
}

/* ===== TITRE PRINCIPAL ===== */
h1 {
    margin-bottom: 1rem;
    font-weight: 800;
    font-size: clamp(2.5rem, 4vw, 3.2rem);
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.03em;
    line-height: 1.1;
    text-transform: capitalize;
    max-width: 700px;
}

/* ===== DESCRIPTION ===== */
p.description {
    color: var(--text-secondary);
    font-size: 1.3rem;
    margin-bottom: 3rem;
    line-height: 1.6;
    max-width: 700px;
    font-weight: 500;
    letter-spacing: 0.02em;
    border-left: 4px solid var(--primary);
    padding: 1.25rem 1.5rem;
    padding-left: 1.5rem;
    font-style: italic;
    background: var(--gradient-card);
    box-shadow: var(--shadow-sm);
    border-radius: 12px;
    border: 1px solid var(--border-light);
}

p.description:empty {
    display: none;
}

/* ===== MODES DE JEU ===== */
.modes {
    margin: 2.5rem 0;
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.modes a {
    background: var(--gradient-primary);
    padding: 16px 32px;
    color: var(--text-white);
    border-radius: 30px;
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow-md);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    letter-spacing: -0.01em;
    position: relative;
    overflow: hidden;
}

.modes a::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--gradient-hover);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modes a:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-3px);
}

.modes a:hover::before {
    opacity: 1;
}

.modes a > * {
    position: relative;
    z-index: 1;
}

.modes a:active {
    transform: translateY(-1px);
}

/* ===== TITRE SECTION ===== */
h2 {
    margin-top: 3rem;
    margin-bottom: 1.5rem;
    font-weight: 700;
    font-size: 1.8rem;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

/* ===== GRILLE DES CARTES ===== */
.card-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
    max-width: 1100px;
}

.card {
    background: var(--gradient-card);
    padding: 2rem;
    border-radius: 16px;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: default;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    min-height: 160px;
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-primary);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-4px);
    border-color: var(--primary-light);
}

.card:hover::before {
    transform: scaleX(1);
}

/* ===== TERME ET DÉFINITION ===== */
.term {
    font-weight: 700;
    font-size: 1.3rem;
    color: var(--primary);
    margin: 0;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary-ultralight);
    user-select: text;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

.definition {
    font-size: 1rem;
    color: var(--text-primary);
    line-height: 1.5;
    user-select: text;
    flex-grow: 1;
    margin: 0;
    font-weight: 400;
}

/* ===== ÉTAT VIDE ===== */
p.no-cards {
    font-style: italic;
    color: var(--text-secondary);
    font-size: 1.2rem;
    text-align: center;
    padding: 3rem 2rem;
    background: var(--gradient-card);
    border: 2px dashed var(--border-medium);
    border-radius: 16px;
    margin: 2rem 0;
}

p.no-cards::before {
    content: '📚';
    display: block;
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

/* ===== ANIMATIONS ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.card {
    animation: fadeInUp 0.5s cubic-bezier(0.4, 0, 0.2, 1) backwards;
}

.card:nth-child(1) { animation-delay: 0.1s; }
.card:nth-child(2) { animation-delay: 0.15s; }
.card:nth-child(3) { animation-delay: 0.2s; }
.card:nth-child(4) { animation-delay: 0.25s; }
.card:nth-child(5) { animation-delay: 0.3s; }
.card:nth-child(6) { animation-delay: 0.35s; }

.modes a {
    animation: slideInRight 0.5s cubic-bezier(0.4, 0, 0.2, 1) backwards;
}

.modes a:nth-child(1) { animation-delay: 0.1s; }
.modes a:nth-child(2) { animation-delay: 0.2s; }
.modes a:nth-child(3) { animation-delay: 0.3s; }

/* ===== RESPONSIVE DESIGN PERFECTIONNÉ ===== */
@media (max-width: 1024px) {
    header + main {
        max-width: calc(100vw - 2rem);
        padding: 2rem 1.5rem;
    }
    
    .card-list {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
}

@media (max-width: 768px) {
    header + main {
        max-width: calc(100vw - 1.5rem);
        padding: 1.5rem 1rem;
        margin: 0 auto;
    }
    
    h1 {
        font-size: 2.5rem;
        text-align: center;
    }
    
    p.description {
        font-size: 1.2rem;
        padding: 1rem 1.25rem;
        margin-bottom: 2rem;
        text-align: left;
    }
    
    .modes {
        justify-content: center;
        gap: 1rem;
    }
    
    .card-list {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }
    
    .card {
        padding: 1.5rem;
        min-height: 140px;
    }
    
    .term {
        font-size: 1.2rem;
    }
}

@media (max-width: 600px) {
    header + main {
        max-width: calc(100vw - 1rem);
        padding: 1.25rem 0.75rem;
    }
    
    h1 {
        font-size: 2.2rem;
        margin-bottom: 1rem;
    }
    
    p.description {
        font-size: 1.1rem;
        padding: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .modes {
        flex-direction: column;
        align-items: center;
        gap: 0.75rem;
    }
    
    .modes a {
        padding: 14px 28px;
        font-size: 1rem;
        width: 100%;
        max-width: 280px;
        justify-content: center;
    }
    
    .card {
        padding: 1.25rem;
    }
    
    .term {
        font-size: 1.1rem;
    }
    
    .definition {
        font-size: 0.95rem;
    }
}

@media (max-width: 480px) {
    header + main {
        max-width: calc(100vw - 0.5rem);
        padding: 1rem 0.5rem;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    h2 {
        font-size: 1.6rem;
    }
    
    p.description {
        font-size: 1rem;
        padding: 0.875rem;
    }
    
    .card {
        padding: 1rem;
        gap: 1rem;
    }
    
    p.no-cards {
        padding: 2rem 1rem;
        font-size: 1.1rem;
    }
}

/* ===== MICRO-INTERACTIONS ===== */
.card:active {
    transform: translateY(-2px) scale(0.98);
    transition: transform 0.1s ease;
}

.modes a:focus,
.card:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(166, 141, 210, 0.3);
}

/* ===== SÉLECTION DE TEXTE ===== */
.term::selection,
.definition::selection {
    background: var(--primary-ultralight);
    color: var(--primary);
}

/* ===== PRÉFÉRENCES UTILISATEUR ===== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}