/* ============================================
   Variables
   ============================================ */
:root {
    --color-primary: #2563eb;
    --color-primary-dark: #1d4ed8;
    --color-secondary: #64748b;
    --color-success: #22c55e;
    --color-error: #ef4444;
    --color-warning: #f59e0b;
    
    --color-bg: #f8fafc;
    --color-white: #ffffff;
    --color-text: #1e293b;
    --color-text-light: #64748b;
    --color-border: #e2e8f0;
    
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
}

/* ============================================
   Reset & Base
   ============================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--color-text);
    background: var(--color-bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Liens : aucun soulignement par defaut. Les composants UI (cards, btns,
   nav) gerent leur propre feedback visuel (transform, ombre, couleur).
   Le soulignement au hover est reserve aux liens textuels via un opt-in
   par classe `.prose` ou `.text-content` -- cf doc/STYLEGUIDE.md (a creer).

   Pourquoi ce changement : `a:hover { text-decoration: underline }` global
   contaminait les liens-composants (ex: `<a class="game-card">` voyait son
   contenu entier souligne au survol). Plutot que de fixer chaque composant
   avec un override defensif, on retourne la regle : le soulignement est
   opt-in, pas opt-out. */
a {
    color: var(--color-primary);
    text-decoration: none;
}

/* Opt-in pour les liens textuels : dans un conteneur `.prose` ou
   `.text-content`, les liens recoivent le soulignement au survol pour
   l'accessibilite (WCAG 2.4.4) et la lisibilite. */
.prose a:hover,
.text-content a:hover {
    text-decoration: underline;
}

/* ============================================
   Layout
   ============================================ */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.main {
    flex: 1;
    padding: 2rem 0;
}

/* ============================================
   Header
   ============================================ */
.header {
    background: var(--color-white);
    border-bottom: 1px solid var(--color-border);
    padding: 1rem 0;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.logo:hover {
    text-decoration: none;
}

.nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* ============================================
   Footer
   ============================================ */
.footer {
    background: var(--color-white);
    border-top: 1px solid var(--color-border);
    padding: 1rem 0;
    text-align: center;
    color: var(--color-text-light);
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.btn:hover {
    text-decoration: none;
}

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

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

.btn-secondary {
    background: var(--color-white);
    color: var(--color-text);
    border: 1px solid var(--color-border);
}

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

.btn-sm {
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1.125rem;
}

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

/* ============================================
   Forms
   ============================================ */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-primary);
}

.form-group small {
    display: block;
    margin-top: 0.25rem;
    color: var(--color-text-light);
    font-size: 0.875rem;
}

.form-group .error {
    display: block;
    margin-top: 0.25rem;
    color: var(--color-error);
    font-size: 0.875rem;
}

/* ============================================
   Alerts
   ============================================ */
.alert {
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

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

.alert-warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

/* ============================================
   Auth Forms
   ============================================ */
.auth-form {
    max-width: 400px;
    margin: 2rem auto;
    background: var(--color-white);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.auth-form h1 {
    margin-bottom: 1.5rem;
    text-align: center;
}

.auth-links {
    margin-top: 1.5rem;
    text-align: center;
    color: var(--color-text-light);
}

/* ============================================
   Hero
   ============================================ */
.hero {
    text-align: center;
    padding: 4rem 0;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.hero p {
    font-size: 1.25rem;
    color: var(--color-text-light);
    margin-bottom: 2rem;
}

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

/* ============================================
   Features
   ============================================ */
.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    padding: 2rem 0;
}

.feature {
    background: var(--color-white);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
}

.feature h3 {
    margin-bottom: 0.5rem;
}

.feature p {
    color: var(--color-text-light);
}

/* ============================================
   Dashboard
   ============================================ */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--color-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.empty-state p {
    color: var(--color-text-light);
    margin-bottom: 1rem;
}

.empty-state .btn {
    margin-top: 1rem;
}

/* ============================================
   Error Page
   ============================================ */
.error-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    text-align: center;
}

.error-page h1 {
    font-size: 6rem;
    color: var(--color-primary);
}

.error-page p {
    font-size: 1.5rem;
    color: var(--color-text-light);
    margin-bottom: 2rem;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
    .header .container {
        flex-direction: column;
        gap: 1rem;
    }

    .nav {
        width: 100%;
        justify-content: center;
    }

    .hero h1 {
        font-size: 1.75rem;
    }

    .dashboard-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .group-header {
        flex-direction: column;
        text-align: center;
    }

    .group-header-info {
        flex-direction: column;
    }

    .member-card {
        flex-direction: column;
        gap: 1rem;
    }
}

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

.group-card {
    display: block;
    background: var(--color-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    color: var(--color-text);
}

.group-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    text-decoration: none;
}

.group-card-header {
    height: 120px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
}

.group-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.group-image-placeholder {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
}

.group-image-placeholder.large {
    width: 100px;
    height: 100px;
    font-size: 2.5rem;
    background: var(--color-primary);
}

.group-image-large {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
}

.group-card-body {
    padding: 1rem;
}

.group-card-body h3 {
    margin-bottom: 0.5rem;
    font-size: 1.125rem;
}

.group-description {
    color: var(--color-text-light);
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.group-stats {
    display: flex;
    gap: 1rem;
    font-size: 0.875rem;
    color: var(--color-text-light);
    margin-bottom: 0.5rem;
}

.group-role {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.role-admin {
    background: #dbeafe;
    color: #1e40af;
}

.role-editor {
    background: #fef3c7;
    color: #92400e;
}

.role-member {
    background: #f1f5f9;
    color: #475569;
}

/* ============================================
   Group Detail
   ============================================ */
.group-detail {
    max-width: 900px;
    margin: 0 auto;
}

.group-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    background: var(--color-white);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.group-header-info {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.group-header-info h1 {
    margin-bottom: 0.5rem;
}

.group-meta {
    font-size: 0.875rem;
    color: var(--color-text-light);
}

.group-actions {
    display: flex;
    gap: 0.5rem;
}

/* ============================================
   Group Sections
   ============================================ */
.group-section {
    background: var(--color-white);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

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

.section-header h2 {
    font-size: 1.25rem;
}

/* ============================================
   Members List
   ============================================ */
.members-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.member-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: var(--color-bg);
    border-radius: var(--radius);
}

.member-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.member-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.member-avatar-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--color-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.member-name {
    font-weight: 500;
    margin-right: 0.5rem;
}

.member-role {
    font-size: 0.75rem;
}

.member-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.member-actions select {
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-size: 0.875rem;
}

.inline-form {
    display: inline;
}

/* ============================================
   Invite Section
   ============================================ */
.invite-section {
    background: var(--color-white);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

.invite-box {
    max-width: 500px;
}

.invite-box label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.invite-input-group {
    display: flex;
    gap: 0.5rem;
}

.invite-input-group input {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 0.875rem;
}

/* ============================================
   Invite Preview
   ============================================ */
.invite-preview {
    text-align: center;
    margin-bottom: 2rem;
}

.invite-preview h2 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

/* ============================================
   Action Buttons
   ============================================ */
.action-buttons {
    display: flex;
    gap: 1rem;
}

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

.btn-danger:hover {
    background: #dc2626;
}

/* ============================================
   Error Box
   ============================================ */
.error-box {
    text-align: center;
    padding: 2rem;
    background: #fee2e2;
    border-radius: var(--radius);
    color: #991b1b;
}

.error-box p {
    margin-bottom: 0.5rem;
}

/* ============================================
   Text Utilities
   ============================================ */
.text-muted {
    color: var(--color-text-light);
}

/* ============================================
   Words Page
   ============================================ */
.words-page {
    max-width: 1200px;
    margin: 0 auto;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

.header-left {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.back-link {
    font-size: 0.875rem;
    color: var(--color-text-light);
}

.back-link:hover {
    color: var(--color-primary);
}

.header-actions {
    display: flex;
    gap: 0.5rem;
}

/* Stats Bar */
.stats-bar {
    display: flex;
    gap: 1.5rem;
    padding: 1rem;
    background: var(--color-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    /* Padding + radius pour les `.stat.difficulty-*` qui heritent du
       background colore des regles `.difficulty-easy/medium/hard` (regles
       partagees avec `.difficulty-badge` du tableau). Sans padding, le
       texte touche les bords du background. Appliquer sur tous les
       `.stat` pour preserver l'alignement vertical entre stats colorees
       et stats neutres. */
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--color-text-light);
    text-transform: uppercase;
}

.stat.difficulty-easy .stat-value { color: #22c55e; }
.stat.difficulty-medium .stat-value { color: #f59e0b; }
.stat.difficulty-hard .stat-value { color: #ef4444; }

/* Filters */
.filters-form {
    background: var(--color-white);
    padding: 1rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

.filters-row {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.filter-group {
    flex: 1;
    min-width: 150px;
}

.filter-input,
.filter-select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 0.875rem;
}

.btn-link {
    background: none;
    border: none;
    color: var(--color-text-light);
    padding: 0.5rem;
}

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

/* Words Table */
.words-table-container {
    background: var(--color-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.words-table {
    width: 100%;
    border-collapse: collapse;
}

.words-table th,
.words-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

.words-table th {
    background: var(--color-bg);
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--color-text-light);
}

.words-table th a {
    color: inherit;
    text-decoration: none;
}

.words-table th a:hover {
    color: var(--color-primary);
}

.words-table tbody tr:hover {
    background: var(--color-bg);
}

.col-word {
    width: 20%;
    font-weight: 500;
}

.word-text {
    font-family: monospace;
    font-size: 1rem;
}

.word-length {
    font-size: 0.75rem;
    color: var(--color-text-light);
    margin-left: 0.5rem;
}

.col-definition {
    width: 40%;
}

.col-category,
.col-difficulty {
    width: 12%;
}

.col-actions {
    width: 16%;
    text-align: right;
}

.col-actions .btn {
    margin-left: 0.25rem;
}

/* Badges */
.category-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: var(--color-bg);
    border-radius: 4px;
    font-size: 0.75rem;
}

.difficulty-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.difficulty-easy {
    background: #dcfce7;
    color: #166534;
}

.difficulty-medium {
    background: #fef3c7;
    color: #92400e;
}

.difficulty-hard {
    background: #fee2e2;
    color: #991b1b;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
}

.pagination-info {
    color: var(--color-text-light);
}

/* Word Form */
.word-form-page {
    max-width: 600px;
    margin: 0 auto;
}

.form-container {
    background: var(--color-white);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.form-row {
    display: flex;
    gap: 1rem;
}

.form-row .form-group {
    flex: 1;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.word-meta {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--color-border);
    font-size: 0.875rem;
    color: var(--color-text-light);
}

.word-meta p {
    margin: 0.25rem 0;
}

/* Import */
.import-info {
    margin-bottom: 2rem;
}

.import-info h3 {
    margin-bottom: 1rem;
}

.import-info ol {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.import-info li {
    margin-bottom: 0.5rem;
}

.example-box {
    background: var(--color-bg);
    padding: 1rem;
    border-radius: var(--radius);
    margin: 1rem 0;
}

.example-box h4 {
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.example-box pre {
    font-family: monospace;
    font-size: 0.875rem;
    white-space: pre-wrap;
    margin: 0;
}

.note {
    font-size: 0.875rem;
    color: var(--color-text-light);
    font-style: italic;
}

/* Responsive Words */
@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
        gap: 1rem;
    }

    .header-actions {
        width: 100%;
    }

    .header-actions .btn {
        flex: 1;
    }

    .stats-bar {
        flex-wrap: wrap;
        justify-content: center;
    }

    .filters-row {
        flex-direction: column;
    }

    .filter-group {
        width: 100%;
    }

    .words-table-container {
        overflow-x: auto;
    }

    .col-category,
    .col-difficulty {
        display: none;
    }

    .form-row {
        flex-direction: column;
    }

    .conversation-page {
        height: calc(100vh - 140px);
    }

    .messages-container {
        height: calc(100% - 100px);
    }
}

/* ============================================
   Conversation Page
   ============================================ */
.conversation-page {
    max-width: 900px;
    margin: 0 auto;
    height: calc(100vh - 180px);
    display: flex;
    flex-direction: column;
}

.conversation-header {
    margin-bottom: 1rem;
}

.conversation-header h1 {
    margin-top: 0.5rem;
    font-size: 1.5rem;
}

.conversation-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--color-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

/* Messages Container */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.messages-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.no-messages {
    text-align: center;
    padding: 3rem;
    color: var(--color-text-light);
}

/* Message */
.message {
    display: flex;
    gap: 0.75rem;
    max-width: 85%;
}

.message-own {
    margin-left: auto;
    flex-direction: row-reverse;
}

.message-avatar-container {
    flex-shrink: 0;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.message-avatar-placeholder {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--color-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
}

.message-content {
    flex: 1;
    min-width: 0;
}

.message-header {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.message-author {
    font-weight: 600;
    font-size: 0.875rem;
}

.message-time {
    font-size: 0.75rem;
    color: var(--color-text-light);
}

.message-text {
    background: var(--color-bg);
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    word-wrap: break-word;
}

.message-own .message-text {
    background: var(--color-primary);
    color: white;
}

.message-own .message-header {
    flex-direction: row-reverse;
}

/* System Message */
.message-system {
    max-width: 100%;
    justify-content: center;
}

.message-system-content {
    font-size: 0.875rem;
    color: var(--color-text-light);
    text-align: center;
    padding: 0.5rem 1rem;
    background: var(--color-bg);
    border-radius: var(--radius);
}

.message-system-content .message-time {
    margin-left: 0.5rem;
}

/* Message Form */
.message-form-container {
    padding: 1rem;
    border-top: 1px solid var(--color-border);
    background: var(--color-bg);
}

.message-form {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
}

.message-form textarea {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: inherit;
    resize: none;
    min-height: 42px;
    max-height: 120px;
}

.message-form textarea:focus {
    outline: none;
    border-color: var(--color-primary);
}

.message-form .btn {
    flex-shrink: 0;
}

.char-count {
    text-align: right;
    font-size: 0.75rem;
    color: var(--color-text-light);
    margin-top: 0.25rem;
}

/* ============================================
   Grids Page
   ============================================ */
.grids-page {
    max-width: 1000px;
    margin: 0 auto;
}

.grids-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.grid-card {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background: var(--color-white);
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.grid-preview {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.grid-size {
    color: white;
    font-weight: 700;
    font-size: 1.25rem;
}

.grid-info {
    flex: 1;
}

.grid-name {
    font-size: 1.125rem;
    margin-bottom: 0.25rem;
}

.grid-name a {
    color: var(--color-text);
    text-decoration: none;
}

.grid-name a:hover {
    color: var(--color-primary);
}

.grid-meta {
    font-size: 0.875rem;
    color: var(--color-text-light);
    margin: 0;
}

.grid-actions {
    display: flex;
    gap: 0.5rem;
}

/* Grid Form */
.grid-form-page {
    max-width: 600px;
    margin: 0 auto;
}

.info-box {
    background: var(--color-bg);
    padding: 1.5rem;
    border-radius: var(--radius);
    margin-top: 1.5rem;
}

.info-box h3 {
    margin-bottom: 1rem;
}

.info-box ul {
    margin-left: 1.5rem;
}

.info-box li {
    margin-bottom: 0.5rem;
    color: var(--color-text-light);
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

.btn-disabled {
    background: var(--color-border);
    color: var(--color-text-light);
    cursor: not-allowed;
}

/* Grid View */
.grid-view-page {
    max-width: 1200px;
    margin: 0 auto;
}

.grid-container {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

.crossword-grid {
    display: grid;
    grid-template-columns: repeat(var(--grid-width), 32px);
    grid-template-rows: repeat(var(--grid-height), 32px);
    gap: 0;
    border: 2px solid var(--color-text);
    flex-shrink: 0;
}

.grid-cell {
    width: 32px;
    height: 32px;
    border: 1px solid var(--color-border);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cell-black {
    background-color: var(--color-text);
}

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

.cell-number {
    position: absolute;
    top: 1px;
    left: 2px;
    font-size: 0.5rem;
    font-weight: 700;
    color: var(--color-primary);
}

.cell-letter {
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
}

/* Definitions */
.definitions-container {
    flex: 1;
    display: flex;
    gap: 2rem;
}

.definitions-column {
    flex: 1;
}

.definitions-column h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--color-primary);
}

.definitions-list {
    margin-left: 1.5rem;
}

.definitions-list li {
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    line-height: 1.4;
}

.definition-answer {
    color: var(--color-text-light);
    font-style: italic;
    font-size: 0.8rem;
}

/* Empty state icon */
.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

/* Responsive Grids */
@media (max-width: 900px) {
    .grid-container {
        flex-direction: column;
    }

    .crossword-grid {
        align-self: center;
        overflow-x: auto;
    }

    .definitions-container {
        flex-direction: column;
        gap: 1.5rem;
    }
}

@media (max-width: 600px) {
    .grid-card {
        flex-direction: column;
        text-align: center;
    }

    .grid-actions {
        width: 100%;
        justify-content: center;
    }
}

/* ============================================
   Percentage Slider (IA/Group)
   ============================================ */
.percentage-slider {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.percentage-slider input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(to right, var(--color-secondary) 0%, var(--color-primary) 100%);
    outline: none;
    cursor: pointer;
}

.percentage-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--color-white);
    border: 2px solid var(--color-primary);
    cursor: pointer;
    box-shadow: var(--shadow);
}

.percentage-slider input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--color-white);
    border: 2px solid var(--color-primary);
    cursor: pointer;
    box-shadow: var(--shadow);
}

.percentage-slider input[type="range"]:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.percentage-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
}

.label-ia {
    color: var(--color-secondary);
    font-weight: 500;
}

.label-group {
    color: var(--color-primary);
    font-weight: 500;
}

.stat-ia {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 1px solid #bae6fd;
}

.stat-ia .stat-value {
    color: #0284c7;
}

.stat-ia .stat-label {
    color: #0369a1;
}

/* ============================================
   Grille Mots-Fléchés
   ============================================ */
.grid-wrapper {
    overflow-x: auto;
    padding: 1rem 0;
}

.fleches-grid {
    display: grid;
    grid-template-columns: repeat(var(--grid-cols), 60px);
    gap: 1px;
    background: #333;
    border: 2px solid #333;
    width: fit-content;
    margin: 0 auto;
}

.fleches-cell {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: Arial, sans-serif;
    position: relative;
}

/* Case lettre (blanche) */
.fleches-cell.cell-letter {
    background: #fff;
    border: 1px solid #ccc;
}

.fleches-cell.cell-letter .letter {
    font-size: 1.5rem;
    font-weight: bold;
    color: #333;
    text-transform: uppercase;
}

/* Case noire vide */
.fleches-cell.cell-black {
    background: #1a1a2e;
}

/* Case définition (avec texte et flèche) */
.fleches-cell.cell-definition {
    background: #1a1a2e;
    color: #fff;
    padding: 2px;
    font-size: 0.55rem;
    line-height: 1.1;
    text-align: center;
}

/* Définition simple (une seule direction) */
.def-single {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 2px;
}

.def-single .def-text {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    overflow: hidden;
    word-break: break-word;
}

.def-single .def-arrow {
    font-size: 1rem;
    font-weight: bold;
    color: #ffd700;
}

.def-horizontal .def-arrow {
    align-self: flex-end;
    margin-right: 2px;
}

.def-vertical .def-arrow {
    align-self: center;
    margin-top: 2px;
}

/* Définition double (deux directions) */
.def-dual {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
}

.def-dual .def-right,
.def-dual .def-down {
    flex: 1;
    display: flex;
    align-items: center;
    padding: 1px;
    font-size: 0.45rem;
}

.def-dual .def-right {
    border-bottom: 1px solid #444;
}

.def-dual .def-text {
    flex: 1;
    text-align: center;
    overflow: hidden;
}

.def-dual .def-arrow {
    font-size: 0.7rem;
    font-weight: bold;
    color: #ffd700;
    margin-left: 2px;
}

/* Liste des mots solution */
.solution-list {
    margin-top: 2rem;
    padding: 1.5rem;
    background: var(--color-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.solution-list h3 {
    margin-bottom: 1rem;
    color: var(--color-text);
}

.words-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 0.5rem;
}

.word-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--color-bg);
    border-radius: 4px;
    font-size: 0.875rem;
}

.word-item .word-text {
    font-weight: bold;
    color: var(--color-primary);
    min-width: 80px;
}

.word-item .word-def {
    flex: 1;
    color: var(--color-text-light);
}

.word-item .word-dir {
    color: var(--color-secondary);
    font-size: 1rem;
}

/* Responsive */
@media (max-width: 768px) {
    .fleches-grid {
        grid-template-columns: repeat(var(--grid-cols), 45px);
    }
    
    .fleches-cell {
        width: 45px;
        height: 45px;
    }
    
    .fleches-cell.cell-definition {
        font-size: 0.4rem;
    }
    
    .fleches-cell.cell-letter .letter {
        font-size: 1.1rem;
    }
    
    .def-dual .def-right,
    .def-dual .def-down {
        font-size: 0.35rem;
    }
}

/* ============================================
   Modal
   ============================================ */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}

.modal-content {
    position: relative;
    background: var(--color-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

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

.modal-header h2 {
    font-size: 1.25rem;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--color-text-light);
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    color: var(--color-text);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.modal-hint {
    color: var(--color-text-light);
    font-size: 0.875rem;
    margin-bottom: 1rem;
    text-align: center;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--color-border);
}

/* ============================================
   Suggestions de mots
   ============================================ */
.input-with-button {
    display: flex;
    gap: 0.5rem;
}

.input-with-button input {
    flex: 1;
}

.btn-sm {
    padding: 0.4rem 0.75rem;
    font-size: 0.875rem;
}

.suggestions-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}

.suggestion-word {
    background: var(--color-bg);
    border: 2px solid var(--color-border);
    border-radius: var(--radius);
    padding: 0.75rem 1.25rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text);
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
}

.suggestion-word:hover {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
    transform: translateY(-2px);
}

.suggestions-list .loading {
    color: var(--color-text-light);
    padding: 2rem;
}

.suggestions-list .no-suggestions,
.suggestions-list .error {
    color: var(--color-text-light);
    padding: 2rem;
    text-align: center;
}

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

.btn-outline:hover {
    background: var(--color-bg);
}

/* ============================================
   IA Badge
   ============================================ */
.ia-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--color-primary);
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
    border: none;
    cursor: pointer;
    margin-left: 4px;
    transition: all 0.2s;
    vertical-align: middle;
}

.ia-badge:hover {
    background: var(--color-primary-dark);
    transform: scale(1.1);
}

.ia-badge-sm {
    width: 14px;
    height: 14px;
    font-size: 0.6rem;
    margin-left: 2px;
}

/* Modal small variant */
.modal-sm {
    max-width: 450px;
}

.license-box {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-top: 1rem;
}

.license-box p {
    margin: 0.5rem 0;
}

.license-details {
    font-size: 0.85rem;
    color: var(--color-text-light);
}

/* IA source tag in word list */
.word-source-ia {
    font-size: 0.7rem;
    background: #e0e7ff;
    color: #4338ca;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
    white-space: nowrap;
}

/* ============================================
   Landing Page - word-games.ch
   ============================================ */
.landing-body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.landing-body .header {
    background: transparent;
    box-shadow: none;
}

.landing-body .logo {
    color: white;
    font-size: 1.5rem;
}

.landing-body .nav a {
    color: rgba(255, 255, 255, 0.9);
}

.landing-body .footer {
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
}

.landing-page {
    padding: 2rem 0;
}

.landing-hero {
    text-align: center;
    padding: 3rem 0 4rem;
    color: white;
}

.landing-hero h1 {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.landing-tagline {
    font-size: 1.5rem;
    opacity: 0.9;
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.game-card {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    text-decoration: none;
    color: var(--color-text);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.game-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.game-card-featured {
    grid-column: span 2;
    background: linear-gradient(135deg, #fff 0%, #f0f4ff 100%);
    border: 2px solid var(--color-primary);
}

.game-card-coming {
    opacity: 0.7;
    cursor: default;
}

.game-card-coming:hover {
    transform: none;
}

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

.game-card h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--color-text);
}

.game-card p {
    color: var(--color-text-light);
    margin-bottom: 1rem;
}

.game-features {
    list-style: none;
    padding: 0;
    margin: 1rem 0;
}

.game-features li {
    padding: 0.25rem 0;
    color: var(--color-text-light);
}

.game-cta {
    display: inline-block;
    color: var(--color-primary);
    font-weight: 600;
    margin-top: 1rem;
}

.game-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--color-text-light);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
}

.landing-about {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 2rem;
    color: white;
    text-align: center;
}

.landing-about h2 {
    color: white;
    margin-bottom: 1rem;
}

.landing-about p {
    max-width: 600px;
    margin: 0 auto 1rem;
    opacity: 0.9;
}

.landing-location {
    font-size: 1.1rem;
    margin-top: 1.5rem !important;
}

@media (max-width: 768px) {
    .landing-hero h1 {
        font-size: 2.5rem;
    }
    
    .game-card-featured {
        grid-column: span 1;
    }
}

/* ===========================================
   Difficulty Mix Sliders
   =========================================== */
.difficulty-mix {
    background: var(--bg-tertiary);
    border-radius: 8px;
    padding: 1rem;
    margin-top: 0.5rem;
}

.difficulty-slider-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.difficulty-slider-row:last-child {
    margin-bottom: 0;
}

.difficulty-label {
    min-width: 100px;
    font-weight: 500;
    font-size: 0.9rem;
}

.difficulty-easy-label { color: #22c55e; }
.difficulty-medium-label { color: #eab308; }
.difficulty-hard-label { color: #ef4444; }

.difficulty-slider {
    flex: 1;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    border-radius: 4px;
    outline: none;
    cursor: pointer;
}

.difficulty-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.difficulty-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.slider-easy {
    background: linear-gradient(to right, #dcfce7, #22c55e);
}
.slider-easy::-webkit-slider-thumb { background: #22c55e; }
.slider-easy::-moz-range-thumb { background: #22c55e; }

.slider-medium {
    background: linear-gradient(to right, #fef9c3, #eab308);
}
.slider-medium::-webkit-slider-thumb { background: #eab308; }
.slider-medium::-moz-range-thumb { background: #eab308; }

.slider-hard {
    background: linear-gradient(to right, #fecaca, #ef4444);
}
.slider-hard::-webkit-slider-thumb { background: #ef4444; }
.slider-hard::-moz-range-thumb { background: #ef4444; }

.difficulty-value {
    min-width: 50px;
    text-align: right;
    font-weight: 600;
    font-size: 0.9rem;
}

#diff_total {
    color: var(--primary);
}
