﻿        /* Variables CSS - Palette Afrique moderne raffinée */
        :root {
            --or-chaud: #D4A437;
            --or-clair: #E6C25C;
            --terre-cuite: #C97B4F;
            --vert-profond: #1F3D2A;
            --vert-clair: #3F6147;
            --bleu-nuit: #14143C;
            --rouge-teranga: #C8342E;
            --beige-sable: #F5E9D4;
            --beige-clair: #FBF5E9;
            --ivoire: #FFFCF5;
            --ombre: rgba(20, 20, 60, 0.18);
            --ombre-douce: rgba(20, 20, 60, 0.08);
            --ombre-forte: rgba(20, 20, 60, 0.32);

            --font-display: 'Playfair Display', 'Georgia', serif;
            --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

            --radius-sm: 12px;
            --radius-md: 18px;
            --radius-lg: 24px;
            --radius-pill: 999px;

            --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
            --ease-bounce: cubic-bezier(0.68, -0.4, 0.265, 1.45);
        }

        /* Reset et base */
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        /* Dark mode */
        body.dark-mode {
            background:
                radial-gradient(ellipse at top left, rgba(212, 164, 55, 0.12) 0%, transparent 55%),
                radial-gradient(ellipse at bottom right, rgba(31, 61, 42, 0.4) 0%, transparent 55%),
                linear-gradient(160deg, #0E0E2A 0%, #1A2D24 100%);
            color: var(--beige-sable);
        }
        body.dark-mode::before { opacity: 0.18; }

        body.dark-mode .header-logo {
            box-shadow: 0 12px 32px -10px rgba(0, 0, 0, 0.5);
        }
        body.dark-mode .header p { color: var(--or-clair); opacity: 0.5; }

        body.dark-mode .game-container {
            background: rgba(20, 20, 60, 0.5);
            border-color: rgba(212, 164, 55, 0.15);
            box-shadow:
                0 1px 0 rgba(255, 255, 255, 0.06) inset,
                0 30px 60px -20px rgba(0, 0, 0, 0.6);
        }

        body.dark-mode .match-counter {
            background: rgba(212, 164, 55, 0.06);
            border-color: rgba(212, 164, 55, 0.2);
            color: var(--or-clair);
        }
        body.dark-mode .counter-value { color: var(--or-clair); }

        body.dark-mode .current-player { color: var(--ivoire); }
        body.dark-mode .current-player.animate { color: var(--or-clair); }
        body.dark-mode .phase-info {
            background: rgba(212, 164, 55, 0.1);
            color: var(--or-clair);
        }

        body.dark-mode .game-board {
            background: radial-gradient(circle at 50% 50%, #2A3D32 0%, #1A2820 100%);
            border-color: rgba(212, 164, 55, 0.35);
            box-shadow:
                0 1px 0 rgba(212, 164, 55, 0.1) inset,
                0 0 0 6px rgba(212, 164, 55, 0.06),
                inset 0 0 40px rgba(0, 0, 0, 0.3),
                0 14px 30px -10px rgba(0, 0, 0, 0.6);
        }

        body.dark-mode .line {
            background: linear-gradient(90deg,
                rgba(212, 164, 55, 0) 0%,
                rgba(212, 164, 55, 0.4) 15%,
                rgba(212, 164, 55, 0.4) 85%,
                rgba(212, 164, 55, 0) 100%);
        }
        body.dark-mode .line.vertical {
            background: linear-gradient(180deg,
                rgba(212, 164, 55, 0) 0%,
                rgba(212, 164, 55, 0.4) 15%,
                rgba(212, 164, 55, 0.4) 85%,
                rgba(212, 164, 55, 0) 100%);
        }

        body.dark-mode .intersection {
            background: rgba(20, 20, 40, 0.6);
            border-color: rgba(212, 164, 55, 0.4);
            box-shadow:
                0 1px 0 rgba(255, 255, 255, 0.05) inset,
                0 2px 6px rgba(0, 0, 0, 0.3);
        }
        body.dark-mode .intersection:hover {
            background: rgba(212, 164, 55, 0.12);
            border-color: var(--or-clair);
        }
        body.dark-mode .intersection.occupied {
            background: transparent;
            box-shadow: none;
        }
        body.dark-mode .intersection.selected {
            border-color: var(--rouge-teranga);
            background: rgba(200, 52, 46, 0.15);
        }
        body.dark-mode .intersection.drag-valid {
            background: rgba(63, 97, 71, 0.4);
            border-color: var(--vert-clair);
        }
        body.dark-mode .intersection.drag-over {
            background: rgba(212, 164, 55, 0.2);
            border-color: var(--or-clair);
        }

        body.dark-mode .game-mode-selector {
            background: rgba(212, 164, 55, 0.04);
            border-color: rgba(212, 164, 55, 0.18);
        }
        body.dark-mode .mode-title { color: var(--or-clair); }
        body.dark-mode .mode-btn {
            background: rgba(255, 255, 255, 0.05);
            color: var(--ivoire);
            border-color: rgba(212, 164, 55, 0.2);
        }
        body.dark-mode .mode-btn:hover {
            background: rgba(255, 255, 255, 0.08);
            border-color: var(--or-clair);
        }
        body.dark-mode .mode-btn.active {
            background: linear-gradient(135deg, var(--or-chaud), var(--terre-cuite));
            color: white;
        }

        body.dark-mode .btn-tertiary {
            background: rgba(255, 255, 255, 0.06) !important;
            color: var(--ivoire) !important;
            border-color: rgba(212, 164, 55, 0.2);
        }
        body.dark-mode .btn-tertiary:hover {
            background: rgba(255, 255, 255, 0.1) !important;
        }

        body.dark-mode .victory-message {
            background: linear-gradient(160deg, rgba(31, 61, 42, 0.35), rgba(20, 20, 60, 0.35));
            color: var(--beige-sable);
            border-color: rgba(212, 164, 55, 0.25);
        }
        body.dark-mode .victory-message p { color: var(--ivoire); opacity: 0.85; }

        body {
            font-family: var(--font-body);
            color: var(--bleu-nuit);
            background:
                radial-gradient(ellipse at top left, rgba(212, 164, 55, 0.18) 0%, transparent 55%),
                radial-gradient(ellipse at bottom right, rgba(201, 123, 79, 0.18) 0%, transparent 55%),
                linear-gradient(160deg, var(--beige-clair) 0%, var(--beige-sable) 100%);
            background-attachment: fixed;
            min-height: 100vh;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            padding: 28px 18px;
            position: relative;
        }

        /* Motif wax discret en overlay */
        body::before {
            content: '';
            position: fixed;
            inset: 0;
            pointer-events: none;
            opacity: 0.35;
            background-image:
                radial-gradient(circle at 20px 20px, rgba(212, 164, 55, 0.4) 1px, transparent 1.5px),
                radial-gradient(circle at 80px 80px, rgba(31, 61, 42, 0.35) 1px, transparent 1.5px);
            background-size: 100px 100px;
            z-index: 0;
        }

        /* En-tête */
        .header {
            text-align: center;
            margin-bottom: 28px;
            color: var(--bleu-nuit);
            position: relative;
            z-index: 1;
        }

        /* Accessibilité — texte caché visuellement mais lu par les lecteurs d'écran */
        .visually-hidden {
            position: absolute;
            width: 1px;
            height: 1px;
            padding: 0;
            margin: -1px;
            overflow: hidden;
            clip: rect(0 0 0 0);
            white-space: nowrap;
            border: 0;
        }

        .header-logo {
            display: block;
            width: clamp(220px, 55vw, 340px);
            height: auto;
            margin: 0 auto 8px;
            border-radius: var(--radius-sm);
            box-shadow: 0 10px 30px -12px var(--ombre-douce);
            transition: transform 0.4s var(--ease-out);
        }

        .header-logo:hover {
            transform: translateY(-2px) scale(1.02);
        }

        /* Bascule entre les versions du logo selon le mode */
        .header-logo.dark-only { display: none; }
        body.dark-mode .header-logo.light-only { display: none; }
        body.dark-mode .header-logo.dark-only { display: block; }

        .header p {
            font-size: 0.85rem;
            font-weight: 500;
            letter-spacing: 0.18em;
            text-transform: uppercase;
            opacity: 0.6;
            color: var(--vert-profond);
        }

        /* Container principal */
        .game-container {
            background: rgba(255, 252, 245, 0.85);
            border: 1px solid rgba(255, 255, 255, 0.6);
            border-radius: var(--radius-lg);
            padding: 32px;
            box-shadow:
                0 1px 0 rgba(255, 255, 255, 0.8) inset,
                0 30px 60px -20px var(--ombre),
                0 12px 24px -12px var(--ombre-douce);
            backdrop-filter: blur(20px) saturate(1.4);
            -webkit-backdrop-filter: blur(20px) saturate(1.4);
            max-width: 580px;
            width: 100%;
            position: relative;
            z-index: 1;
        }

        /* Zone des scores */
        .scoreboard {
            display: grid;
            grid-template-columns: 1fr auto 1fr;
            align-items: stretch;
            background: linear-gradient(135deg, var(--bleu-nuit) 0%, #1F2454 50%, var(--vert-profond) 100%);
            border-radius: var(--radius-md);
            padding: 22px 18px;
            margin-bottom: 14px;
            box-shadow:
                0 1px 0 rgba(255, 255, 255, 0.08) inset,
                0 12px 28px -12px rgba(20, 20, 60, 0.5);
            position: relative;
            overflow: hidden;
        }

        .scoreboard::before {
            content: '';
            position: absolute;
            inset: 0;
            background: linear-gradient(115deg,
                transparent 40%,
                rgba(230, 194, 92, 0.12) 50%,
                transparent 60%);
            animation: shimmer 6s ease-in-out infinite;
            pointer-events: none;
        }

        @keyframes shimmer {
            0% { transform: translateX(-120%); }
            100% { transform: translateX(120%); }
        }

        .score-section {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 6px;
            color: rgba(255, 255, 255, 0.92);
            position: relative;
            z-index: 2;
            padding: 4px 8px;
            border-radius: var(--radius-sm);
            transition: all 0.4s var(--ease-out);
        }

        .score-section.current-turn {
            background: rgba(212, 164, 55, 0.12);
            box-shadow: 0 0 0 1px rgba(212, 164, 55, 0.4) inset;
        }

        .score-section.winner {
            background: rgba(212, 164, 55, 0.22);
            box-shadow: 0 0 0 1px rgba(230, 194, 92, 0.6) inset;
            animation: winner-glow 1.6s var(--ease-out) infinite;
        }

        @keyframes winner-glow {
            0%, 100% { box-shadow: 0 0 0 1px rgba(230, 194, 92, 0.6) inset, 0 0 0 0 rgba(230, 194, 92, 0); }
            50% { box-shadow: 0 0 0 1px rgba(230, 194, 92, 0.8) inset, 0 0 24px 4px rgba(230, 194, 92, 0.25); }
        }

        .player-name {
            font-size: 0.7rem;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 0.18em;
            opacity: 0.7;
        }

        .player-symbol {
            font-size: 2rem;
            line-height: 1;
            filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.4));
        }

        .player1-symbol { color: var(--or-clair); }
        .player2-symbol { color: var(--rouge-teranga); }

        .score-value {
            font-family: var(--font-display);
            font-size: 2.2rem;
            font-weight: 700;
            color: var(--or-clair);
            line-height: 1;
            text-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
        }

        @keyframes score-pulse {
            0% { transform: scale(1); }
            50% { transform: scale(1.25); color: #fff; }
            100% { transform: scale(1); }
        }

        .score-divider {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 8px;
            padding: 0 18px;
            position: relative;
            z-index: 2;
        }

        .score-divider .vs-badge {
            font-family: var(--font-display);
            font-style: italic;
            font-weight: 500;
            font-size: 0.95rem;
            color: var(--or-clair);
            letter-spacing: 0.05em;
            opacity: 0.85;
        }

        .score-divider .divider-line {
            width: 1px;
            flex: 1;
            background: linear-gradient(to bottom, transparent, rgba(255, 255, 255, 0.25), transparent);
        }

        /* Compteur de parties — pill discret */
        .match-counter {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            margin: 0 auto 22px;
            padding: 6px 16px;
            background: rgba(212, 164, 55, 0.08);
            border: 1px solid rgba(212, 164, 55, 0.25);
            border-radius: var(--radius-pill);
            color: var(--vert-profond);
            font-size: 0.82rem;
            font-weight: 500;
            text-align: center;
            width: fit-content;
            display: flex;
            justify-content: center;
        }

        .match-counter .counter-label {
            opacity: 0.7;
            text-transform: uppercase;
            letter-spacing: 0.1em;
            font-size: 0.7rem;
        }

        .match-counter .counter-value {
            font-family: var(--font-display);
            font-size: 1rem;
            font-weight: 700;
            color: var(--terre-cuite);
        }

        /* Sélecteur de mode de jeu */
        .game-mode-selector {
            background: rgba(31, 61, 42, 0.05);
            border: 1px solid rgba(31, 61, 42, 0.15);
            border-radius: var(--radius-md);
            padding: 22px;
            margin-bottom: 20px;
            text-align: center;
            animation: fade-in 0.4s var(--ease-out);
        }

        @keyframes fade-in {
            from { opacity: 0; transform: translateY(-6px); }
            to { opacity: 1; transform: translateY(0); }
        }

        .mode-title {
            font-family: var(--font-display);
            font-size: 1.1rem;
            font-weight: 500;
            font-style: italic;
            color: var(--bleu-nuit);
            margin-bottom: 16px;
        }

        .mode-buttons {
            display: flex;
            gap: 8px;
            justify-content: center;
            flex-wrap: wrap;
        }

        .mode-btn {
            background: rgba(255, 255, 255, 0.7);
            color: var(--vert-profond);
            border: 1px solid rgba(31, 61, 42, 0.18);
            padding: 9px 16px;
            font-family: var(--font-body);
            font-size: 0.85rem;
            font-weight: 500;
            border-radius: var(--radius-pill);
            cursor: pointer;
            transition: all 0.25s var(--ease-out);
            box-shadow: 0 1px 2px rgba(20, 20, 60, 0.04);
        }

        .mode-btn:hover {
            transform: translateY(-1px);
            background: rgba(255, 255, 255, 1);
            box-shadow: 0 4px 12px rgba(20, 20, 60, 0.1);
            border-color: rgba(31, 61, 42, 0.3);
        }

        .mode-btn.active {
            background: linear-gradient(135deg, var(--or-chaud), var(--terre-cuite));
            color: white;
            border-color: transparent;
            box-shadow: 0 4px 14px rgba(212, 164, 55, 0.4);
        }

        .difficulty-indicator {
            display: flex;
            justify-content: center;
            gap: 3px;
            margin-top: 5px;
        }

        .difficulty-dot {
            width: 6px;
            height: 6px;
            border-radius: 50%;
            background: rgba(255, 255, 255, 0.3);
        }

        .difficulty-dot.active {
            background: var(--rouge-teranga);
        }

        /* Indicateur IA en train de réfléchir */
        .ai-thinking {
            position: fixed;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            background: rgba(20, 20, 60, 0.92);
            color: white;
            padding: 18px 26px;
            border-radius: var(--radius-md);
            font-size: 0.95rem;
            font-weight: 500;
            display: inline-flex;
            align-items: center;
            gap: 10px;
            box-shadow: 0 20px 50px rgba(20, 20, 60, 0.4);
            backdrop-filter: blur(8px);
            z-index: 999;
            animation: thinking-pulse 1.8s ease-in-out infinite;
        }

        .ai-thinking .icon {
            color: var(--or-clair);
        }

        @keyframes thinking-pulse {
            0%, 100% { opacity: 0.8; transform: translate(-50%, -50%) scale(1); }
            50% { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }
        }

        .thinking-dots {
            display: inline-block;
            margin-left: 5px;
        }

        .thinking-dots::after {
            content: '';
            animation: thinking-dots 1.5s linear infinite;
        }

        @keyframes thinking-dots {
            0% { content: ''; }
            25% { content: '.'; }
            50% { content: '..'; }
            75% { content: '...'; }
            100% { content: ''; }
        }

        /* Zone de statut */
        .status-area {
            text-align: center;
            margin-bottom: 22px;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 10px;
        }

        .current-player {
            font-family: var(--font-display);
            font-size: 1.35rem;
            font-weight: 500;
            color: var(--bleu-nuit);
            display: inline-flex;
            align-items: center;
            gap: 8px;
            transition: all 0.4s var(--ease-out);
        }

        .current-player.animate {
            transform: translateY(-2px);
            color: var(--rouge-teranga);
        }

        .phase-info {
            display: inline-block;
            font-size: 0.78rem;
            font-weight: 500;
            color: var(--vert-profond);
            background: rgba(31, 61, 42, 0.08);
            padding: 5px 14px;
            border-radius: var(--radius-pill);
            letter-spacing: 0.04em;
        }

        /* Grille de jeu — taille fluide entre 260px (mini phone)
           et 480px (tablette/desktop). Le aspect-ratio garde le carré
           si max-width clippe sur très petit écran. */
        .game-board {
            position: relative;
            width: clamp(260px, min(86vw, 65vh), 480px);
            aspect-ratio: 1;
            max-width: 100%;
            margin: 0 auto 26px;
            background:
                radial-gradient(circle at 50% 50%, var(--ivoire) 0%, var(--beige-sable) 100%);
            border: 1px solid rgba(212, 164, 55, 0.4);
            border-radius: var(--radius-lg);
            box-shadow:
                0 1px 0 rgba(255, 255, 255, 0.8) inset,
                0 0 0 6px rgba(212, 164, 55, 0.08),
                inset 0 0 40px rgba(201, 123, 79, 0.1),
                0 14px 30px -10px var(--ombre);
        }

        /* Lignes de la grille */
        .grid-lines {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            pointer-events: none;
        }

        /* Lignes du plateau */
        .line {
            position: absolute;
            background: linear-gradient(90deg,
                rgba(31, 61, 42, 0) 0%,
                rgba(31, 61, 42, 0.55) 15%,
                rgba(31, 61, 42, 0.55) 85%,
                rgba(31, 61, 42, 0) 100%);
            transition: all 0.3s ease;
        }
        .line.vertical {
            background: linear-gradient(180deg,
                rgba(31, 61, 42, 0) 0%,
                rgba(31, 61, 42, 0.55) 15%,
                rgba(31, 61, 42, 0.55) 85%,
                rgba(31, 61, 42, 0) 100%);
        }

        /* Lignes horizontales et verticales — toutes proportionnelles
           au plateau (1/6, 1/2, 5/6 = 16.667%, 50%, 83.333%) */
        .line.horizontal {
            height: 2px;
            width: 66.667%;       /* 200/300 */
            left: 16.667%;        /* 50/300 */
        }

        .line.vertical {
            width: 2px;
            height: 66.667%;
            top: 16.667%;
        }

        .line.h3 { top: 16.667%; }   /* haute */
        .line.h1 { top: 50%; }       /* milieu */
        .line.h2 { top: 83.333%; }   /* basse */
        .line.v3 { left: 16.667%; }  /* gauche */
        .line.v1 { left: 50%; }      /* milieu */
        .line.v2 { left: 83.333%; }  /* droite */

        /* Lignes diagonales — longueur = √2 × 2/3 du plateau ≈ 94.28% */
        .line.diagonal {
            width: 94.28%;
            height: 2px;
            transform-origin: left center;
        }

        .line.d1 {
            top: 16.667%;
            left: 16.667%;
            transform: rotate(45deg);
        }

        .line.d2 {
            top: 83.333%;
            left: 16.667%;
            transform: rotate(-45deg);
        }

        /* Intersections — taille fluide, plancher 40px (cible tactile),
           plafond 56px (desktop). 14% du plateau entre les deux. */
        .intersection {
            position: absolute;
            width: clamp(40px, 14%, 56px);
            height: clamp(40px, 14%, 56px);
            border: 1.5px solid rgba(31, 61, 42, 0.35);
            border-radius: 50%;
            background: var(--ivoire);
            cursor: pointer;
            transition: all 0.3s var(--ease-out);
            display: flex;
            align-items: center;
            justify-content: center;
            transform: translate(-50%, -50%);
            box-shadow:
                0 1px 0 rgba(255, 255, 255, 0.8) inset,
                0 2px 6px rgba(20, 20, 60, 0.08);
        }

        .intersection:hover {
            background: var(--beige-clair);
            transform: translate(-50%, -50%) scale(1.08);
            border-color: var(--or-chaud);
            box-shadow:
                0 1px 0 rgba(255, 255, 255, 0.9) inset,
                0 6px 18px rgba(212, 164, 55, 0.3);
        }

        .intersection.occupied {
            cursor: default;
            border-color: transparent;
            background: transparent;
            box-shadow: none;
        }

        .intersection.occupied:hover {
            transform: translate(-50%, -50%);
            background: transparent;
        }

        .intersection.selected {
            animation: pulse-selected 1.2s var(--ease-out) infinite;
            border-color: var(--rouge-teranga);
            background: rgba(200, 52, 46, 0.08);
        }

        @keyframes pulse-selected {
            0%, 100% { transform: translate(-50%, -50%) scale(1); box-shadow: 0 0 0 0 rgba(200, 52, 46, 0.4); }
            50% { transform: translate(-50%, -50%) scale(1.15); box-shadow: 0 0 0 8px rgba(200, 52, 46, 0); }
        }

        /* Positions des intersections — proportionnelles
           (lignes haute/centre/basse = 16.667% / 50% / 83.333%) */
        .pos-0 { top: 16.667%; left: 16.667%; }
        .pos-1 { top: 16.667%; left: 50%; }
        .pos-2 { top: 16.667%; left: 83.333%; }
        .pos-3 { top: 50%;     left: 16.667%; }
        .pos-4 { top: 50%;     left: 50%; }
        .pos-5 { top: 50%;     left: 83.333%; }
        .pos-6 { top: 83.333%; left: 16.667%; }
        .pos-7 { top: 83.333%; left: 50%; }
        .pos-8 { top: 83.333%; left: 83.333%; }

        /* Pions — proportionnels à l'intersection parente */
        .piece {
            width: 75%;
            height: 75%;
            border-radius: 50%;
            transition: all 0.4s var(--ease-bounce);
            animation: piece-appear 0.5s var(--ease-bounce);
            position: relative;
        }

        .piece::before {
            content: '';
            position: absolute;
            top: 15%;
            left: 22%;
            width: 28%;
            height: 28%;
            border-radius: 50%;
            background: rgba(255, 255, 255, 0.45);
            filter: blur(2px);
            pointer-events: none;
        }

        @keyframes piece-appear {
            0% { transform: scale(0) rotate(-180deg); opacity: 0; }
            60% { transform: scale(1.15) rotate(0deg); opacity: 1; }
            100% { transform: scale(1) rotate(0deg); opacity: 1; }
        }

        .piece.player1 {
            background: radial-gradient(circle at 35% 30%, #F0CC6A 0%, var(--or-chaud) 50%, #9F7E1F 100%);
            box-shadow:
                0 0 0 1px rgba(159, 126, 31, 0.4),
                0 4px 10px rgba(159, 126, 31, 0.45),
                inset 0 -2px 4px rgba(159, 126, 31, 0.5);
        }

        .piece.player2 {
            background: linear-gradient(135deg, #E04A45 0%, var(--rouge-teranga) 50%, #8E1F1B 100%);
            border-radius: 22%;
            box-shadow:
                0 0 0 1px rgba(142, 31, 27, 0.4),
                0 4px 10px rgba(200, 52, 46, 0.4),
                inset 0 -2px 4px rgba(142, 31, 27, 0.5);
        }

        .piece.player2::before {
            border-radius: 18%;
        }

        .piece.moving {
            animation: piece-move 0.6s var(--ease-out);
        }

        @keyframes piece-move {
            0%, 100% { transform: scale(1); }
            50% { transform: scale(1.25); }
        }

        /* Styles pour le drag and drop */
        .piece.draggable {
            cursor: grab;
        }

        .piece.dragging {
            cursor: grabbing;
            opacity: 0.8;
            transform: scale(1.1);
            z-index: 1000;
            pointer-events: none;
        }

        .intersection.drag-over {
            background: rgba(218, 165, 32, 0.3);
            border-color: var(--or-chaud);
            transform: translate(-50%, -50%) scale(1.15);
        }

        .intersection.drag-valid {
            background: rgba(34, 139, 34, 0.3);
            border-color: #228B22;
        }

        .intersection.drag-invalid {
            background: rgba(220, 20, 60, 0.3);
            border-color: var(--rouge-teranga);
        }

        /* Lignes de victoire */
        .winning-line {
            position: absolute;
            height: 4px;
            background: var(--rouge-teranga);
            animation: victory-line 1s ease-in-out;
            border-radius: 2px;
            box-shadow: 0 0 10px var(--rouge-teranga);
        }

        @keyframes victory-line {
            0% { width: 0; opacity: 0; }
            100% { width: 100%; opacity: 1; }
        }

        /* Contrôles */
        .controls {
            display: flex;
            flex-wrap: wrap;
            justify-content: center;
            gap: 10px;
        }

        .btn {
            background: linear-gradient(135deg, var(--or-chaud), var(--terre-cuite));
            color: white;
            border: none;
            padding: 11px 22px;
            font-family: var(--font-body);
            font-size: 0.92rem;
            font-weight: 600;
            letter-spacing: 0.01em;
            border-radius: var(--radius-pill);
            cursor: pointer;
            transition: all 0.25s var(--ease-out);
            box-shadow:
                0 1px 0 rgba(255, 255, 255, 0.3) inset,
                0 4px 14px rgba(212, 164, 55, 0.35);
            display: inline-flex;
            align-items: center;
            gap: 8px;
        }

        .btn:hover {
            transform: translateY(-2px);
            box-shadow:
                0 1px 0 rgba(255, 255, 255, 0.3) inset,
                0 8px 22px rgba(212, 164, 55, 0.45);
        }

        .btn:active {
            transform: translateY(0);
            box-shadow:
                0 1px 0 rgba(255, 255, 255, 0.2) inset,
                0 2px 8px rgba(212, 164, 55, 0.3);
        }

        .btn-secondary {
            background: linear-gradient(135deg, var(--rouge-teranga), #8E1F1B) !important;
            box-shadow:
                0 1px 0 rgba(255, 255, 255, 0.2) inset,
                0 4px 14px rgba(200, 52, 46, 0.3) !important;
        }

        .btn-secondary:hover {
            box-shadow:
                0 1px 0 rgba(255, 255, 255, 0.2) inset,
                0 8px 22px rgba(200, 52, 46, 0.4) !important;
        }

        .btn-tertiary {
            background: rgba(255, 255, 255, 0.7) !important;
            color: var(--vert-profond) !important;
            border: 1px solid rgba(31, 61, 42, 0.18);
            box-shadow: 0 2px 8px rgba(20, 20, 60, 0.06) !important;
        }

        .btn-tertiary:hover {
            background: white !important;
            box-shadow: 0 6px 18px rgba(20, 20, 60, 0.12) !important;
        }

        /* Message de victoire */
        .victory-message {
            position: fixed;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            background: linear-gradient(160deg, rgba(255, 252, 245, 0.35), rgba(245, 233, 212, 0.35));
            color: var(--bleu-nuit);
            padding: 36px 32px;
            border-radius: var(--radius-lg);
            font-family: var(--font-body);
            font-size: 1.05rem;
            text-align: center;
            box-shadow:
                0 1px 0 rgba(255, 255, 255, 0.5) inset,
                0 30px 80px -20px rgba(20, 20, 60, 0.25);
            backdrop-filter: blur(24px) saturate(1.4);
            -webkit-backdrop-filter: blur(24px) saturate(1.4);
            border: 1px solid rgba(255, 255, 255, 0.4);
            animation: victory-appear 0.6s var(--ease-bounce);
            z-index: 1000;
            width: 88%;
            max-width: 420px;
        }

        .victory-message h2 {
            font-family: var(--font-display);
            font-weight: 700;
            font-size: 2rem;
            margin-bottom: 12px;
            display: inline-flex;
            align-items: center;
            gap: 10px;
            background: linear-gradient(135deg, var(--or-chaud), var(--terre-cuite));
            -webkit-background-clip: text;
            background-clip: text;
            color: transparent;
        }

        .victory-message h2 .icon {
            color: var(--or-chaud);
        }

        .victory-message p {
            color: var(--vert-profond);
        }

        .victory-message .btn {
            margin-top: 8px;
        }

        @keyframes victory-appear {
            0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
            100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
        }

        /* Responsive — téléphones standards */
        @media (max-width: 480px) {
            body { padding: 16px 12px; }
            .game-container { padding: 22px 18px; }
            .header { margin-bottom: 22px; }
            .header-logo { width: clamp(200px, 70vw, 300px); }
            .header p { font-size: 0.72rem; letter-spacing: 0.15em; }

            .scoreboard { padding: 18px 14px; }
            .score-divider { padding: 0 10px; }
            .score-value { font-size: 1.9rem; }
            .player-symbol { font-size: 1.7rem; }

            .controls { gap: 8px; }
            .btn { padding: 10px 16px; font-size: 0.85rem; }

            .floating-btn { width: 42px; height: 42px; }
            #darkModeToggle.floating-btn { top: 14px; right: 14px; }
            .sound-toggle { bottom: 14px; right: 14px; }
        }

        /* Tablettes & desktops — légère bonification */
        @media (min-width: 768px) {
            .game-container { padding: 36px; max-width: 620px; }
            .game-board { margin-bottom: 32px; }
            .controls { gap: 12px; }
            .btn { padding: 12px 24px; font-size: 0.95rem; }
        }

        /* Animation pour les mouvements stratégiques */
        @keyframes strategic-move {
            0% { box-shadow: 0 0 0 0 rgba(218, 165, 32, 0.7); }
            70% { box-shadow: 0 0 0 10px rgba(218, 165, 32, 0); }
            100% { box-shadow: 0 0 0 0 rgba(218, 165, 32, 0); }
        }

        .strategic-move {
            animation: strategic-move 1.5s infinite;
        }

        /* Boutons flottants */
        .floating-btn {
            position: fixed;
            background: rgba(255, 252, 245, 0.7);
            backdrop-filter: blur(20px) saturate(1.4);
            -webkit-backdrop-filter: blur(20px) saturate(1.4);
            color: var(--bleu-nuit);
            border: 1px solid rgba(255, 255, 255, 0.6);
            border-radius: 50%;
            width: 46px;
            height: 46px;
            cursor: pointer;
            box-shadow:
                0 1px 0 rgba(255, 255, 255, 0.8) inset,
                0 8px 24px rgba(20, 20, 60, 0.15);
            z-index: 100;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            transition: all 0.25s var(--ease-out);
        }

        .floating-btn:hover {
            transform: translateY(-2px) scale(1.05);
            box-shadow:
                0 1px 0 rgba(255, 255, 255, 0.8) inset,
                0 12px 32px rgba(20, 20, 60, 0.22);
        }

        body.dark-mode .floating-btn {
            background: rgba(31, 61, 42, 0.6);
            border-color: rgba(212, 164, 55, 0.3);
            color: var(--or-clair);
        }

        /* Icônes SVG */
        .icon {
            width: 1.1em;
            height: 1.1em;
            vertical-align: -0.2em;
            fill: none;
            stroke: currentColor;
            stroke-width: 2;
            stroke-linecap: round;
            stroke-linejoin: round;
            display: inline-block;
        }
        .icon-lg { width: 1.4em; height: 1.4em; }
        .icon-xl { width: 1.6em; height: 1.6em; }

        /* Bouton son (utilise .floating-btn) */
        .sound-toggle { bottom: 20px; right: 20px; }
        #darkModeToggle.floating-btn { top: 20px; right: 20px; }

        /* Bouton installation PWA (s'affiche uniquement quand l'installation est possible) */
        .install-btn {
            bottom: 20px;
            left: 20px;
            color: var(--terre-cuite);
        }

        body.dark-mode .install-btn {
            color: var(--or-clair);
        }
