/* ===== SUPPORT EDGE-TO-EDGE ANDROID 15+ ===== */
:root {
    --safe-area-top: env(safe-area-inset-top, 0px);
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
    --safe-area-left: env(safe-area-inset-left, 0px);
    --safe-area-right: env(safe-area-inset-right, 0px);
}

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

body {
    /* Désactiver la sélection de texte et le menu contextuel sur mobile */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100dvh; /* dvh pour dynamic viewport - support edge-to-edge */
    /* Support des safe areas pour Android 15+ */
    padding-top: max(20px, var(--safe-area-top));
    padding-bottom: max(20px, var(--safe-area-bottom));
    padding-left: max(20px, var(--safe-area-left));
    padding-right: max(20px, var(--safe-area-right));
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Permettre la sélection uniquement dans les champs de saisie */
input, textarea {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
    -webkit-touch-callout: default;
}

.container {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    max-width: 900px;
    width: 100%;
    animation: fadeIn 0.5s ease-in;
}

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

.header {
    background: linear-gradient(135deg, #ff6b6b 0%, #ff8e8e 100%);
    color: white;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    margin-bottom: 30px;
    position: relative;
    box-shadow: 0 10px 30px rgba(255, 107, 107, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 150px;
}

.header-logo {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 25px;
}

.header-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding-left: 40px;
}

.header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.header p {
    font-size: 1.1em;
    opacity: 0.95;
}

.version {
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 9px;
    opacity: 0.85;
}

.author {
    position: absolute;
    bottom: 10px;
    right: 20px;
    font-size: 9px;
    opacity: 0.85;
}

.save-status {
    font-size: 12px;
    opacity: 0.95;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.2);
    padding: 5px 12px;
    border-radius: 20px;
    margin-bottom: 10px;
}

.save-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #4CAF50;
    animation: pulse 2s infinite;
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(0.9); }
}

/* CLAVIER VIRTUEL STYLE ANDROID - COMPACT */
.android-keyboard {
    position: fixed;
    bottom: max(8px, var(--safe-area-bottom)); /* Support edge-to-edge */
    left: 50%;
    transform: translateX(-50%);
    background: #E8EAED;
    border: 1px solid #DADCE0;
    border-radius: 16px;
    padding: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.25);
    display: none;
    z-index: 3000;
    animation: slideUpKeyboard 0.2s ease-out;
    max-width: 280px;
    width: 85%;
}

@keyframes slideUpKeyboard {
    from {
        transform: translateX(-50%) translateY(120%);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

.android-keyboard.active {
    display: block;
}

.android-keyboard-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin: 0 auto;
}

.android-key {
    background: #FFFFFF;
    border: none;
    border-radius: 10px;
    padding: 14px 8px;
    font-size: 22px;
    font-weight: 500;
    color: #202124;
    cursor: pointer;
    transition: all 0.1s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.12);
    user-select: none;
    font-family: 'Roboto', 'Segoe UI', sans-serif;
    min-height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.android-key:active {
    background: #E8EAED;
    transform: scale(0.95);
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.android-key.backspace {
    background: #DADCE0;
    font-size: 18px;
    grid-column: span 2;
}

.android-key.backspace:active {
    background: #BDC1C6;
}

.android-key-close {
    grid-column: span 3;
    background: #f44336 !important;
    color: white;
    font-weight: 600;
    font-size: 16px;
}

.android-key-close:active {
    background: #d32f2f !important;
}

/* Style pour les inputs en lecture seule */
.readonly-input {
    cursor: pointer;
    background: #f8f9fa !important;
    caret-color: transparent;
}

.readonly-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.readonly-input.keyboard-active {
    border-color: #667eea;
    background: white !important;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.setup-screen, .game-screen {
    animation: fadeIn 0.3s ease-in;
}

.input-group {
    margin-bottom: 25px;
}

.input-group label {
    display: block;
    margin-bottom: 10px;
    color: #333;
    font-weight: 600;
    font-size: 1.1em;
}

.input-group input,
.input-group select {
    width: 100%;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1em;
    transition: all 0.3s ease;
    background: white;
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.btn {
    padding: 15px 30px;
    border: none;
    border-radius: 10px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.btn:active {
    transform: translateY(2px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    width: 100%;
    margin-top: 10px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, #56ab2f 0%, #a8e063 100%);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);
    color: white;
}

.btn-secondary {
    background: linear-gradient(135deg, #757F9A 0%, #D7DDE8 100%);
    color: #333;
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.9em;
}

.game-screen {
    display: none;
}

.players-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.player-card {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    color: white;
    position: relative;
    transition: transform 0.3s ease;
}

.player-card:hover {
    transform: translateY(-5px);
}

.player-card h3 {
    font-size: 1.8em;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.score-display {
    font-size: 3em;
    font-weight: bold;
    margin: 20px 0;
    text-shadow: 3px 3px 6px rgba(0,0,0,0.3);
}

.score-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.score-controls input {
    flex: 1;
    padding: 12px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 8px;
    font-size: 1.1em;
    background: rgba(255,255,255,0.9);
    text-align: center;
}

.score-controls button {
    padding: 12px 20px;
    background: rgba(255,255,255,0.2);
    border: 2px solid rgba(255,255,255,0.5);
    border-radius: 8px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.score-controls button:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.05);
}

.actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.game-controls {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 25px;
}

.game-controls .btn {
    padding: 10px 20px;
    font-size: 0.95em;
    min-width: 140px;
}

.game-controls-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
}

.game-controls-row .btn {
    flex: 1;
    min-width: 130px;
    max-width: 200px;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 1000;
    animation: fadeIn 0.3s ease-in;
}

.modal-content {
    position: relative;
    background: white;
    margin: 50px auto;
    padding: 40px;
    border-radius: 20px;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-content h2 {
    color: #667eea;
    margin-bottom: 20px;
}

.close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 35px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close:hover {
    color: #333;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.history-table th,
.history-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.history-table th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 600;
}

.history-table tr:hover {
    background: #f5f5f5;
}

.ranking-table {
    width: 100%;
    margin-top: 20px;
}

.ranking-table td {
    padding: 15px;
    border-bottom: 1px solid #e0e0e0;
}

.ranking-number {
    font-size: 2em;
    font-weight: bold;
    color: #667eea;
}

.ranking-name {
    font-size: 1.5em;
    font-weight: 600;
}

.ranking-score {
    font-size: 1.2em;
    color: #666;
}

.trophy {
    font-size: 2em;
    margin-right: 10px;
}

.no-history {
    text-align: center;
    padding: 40px;
    color: #999;
    font-size: 1.2em;
}

.restore-section {
    background: #fff3cd;
    border: 2px solid #ffc107;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}

.restore-section h3 {
    color: #856404;
    margin-bottom: 10px;
}

.player-inputs-container {
    display: grid;
    gap: 15px;
    margin-bottom: 20px;
}

.player-input-card {
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s ease;
    cursor: move;
}

.player-input-card:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.player-input-card.dragging {
    opacity: 0.5;
    transform: scale(0.95);
}

.player-input-card.drag-over {
    border-color: #667eea;
    background: #e8eaff;
    border-style: dashed;
}

.player-number {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2em;
    flex-shrink: 0;
}

.player-input-card input {
    flex: 1;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1em;
    transition: all 0.3s ease;
}

.player-input-card input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.arrow-controls {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.arrow-btn-setup {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 6px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.arrow-btn-setup:hover:not(:disabled) {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.arrow-btn-setup:active:not(:disabled) {
    transform: scale(0.95);
}

.arrow-btn-setup:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.drag-handle {
    color: #999;
    font-size: 20px;
    cursor: move;
    padding: 0 8px;
}

.player-card-game {
    position: relative;
}

.arrow-controls-game {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 5px;
}

.arrow-btn-game {
    background: rgba(255,255,255,0.2);
    border: 2px solid rgba(255,255,255,0.5);
    color: white;
    border-radius: 6px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s ease;
}

.arrow-btn-game:hover:not(:disabled) {
    background: rgba(255,255,255,0.3);
    transform: scale(1.1);
}

.arrow-btn-game:active:not(:disabled) {
    transform: scale(0.95);
}

.arrow-btn-game:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

@media (max-width: 768px) {
    .container {
        padding: 20px;
    }

    .header h1 {
        font-size: 1.8em;
    }

    .header-logo {
        width: 60px;
        height: 60px;
        font-size: 35px;
        left: 10px;
    }

    .header-content {
        padding-left: 20px;
    }

    .players-grid {
        grid-template-columns: 1fr;
    }

    .score-display {
        font-size: 2.5em;
    }

    .game-controls {
        flex-direction: column;
    }
    
    .game-controls-row {
        flex-direction: row;
    }
    
    .game-controls-row .btn {
        max-width: 50%;
        min-width: 0;
        font-size: 13px;
        padding: 10px 8px;
    }

    .game-controls .btn {
        padding: 10px 15px;
        font-size: 14px;
    }

    .btn {
        width: 100%;
    }
    
    .restore-buttons {
        flex-direction: row;
    }
    
    .restore-buttons .btn {
        max-width: 50%;
    }

    .player-input-card {
        flex-wrap: wrap;
        padding: 12px 15px;
        gap: 12px;
    }

    .arrow-controls {
        flex-direction: row;
        width: 100%;
        order: 3;
    }

    .arrow-btn-setup {
        flex: 1;
    }

    .drag-handle {
        font-size: 20px;
    }

    .player-number {
        width: 32px;
        height: 32px;
        font-size: 1em;
    }

    .reorder-arrows-setup {
        display: none;
    }

    .btn-small {
        padding: 14px 32px;
        font-size: 16px;
    }

    .close {
        font-size: 24px;
        top: 10px;
        right: 15px;
    }

    .player-inputs {
        grid-template-columns: 1fr;
    }

    .header {
        padding: 20px 15px;
        min-height: 120px;
    }

    .header p {
        font-size: 0.95em;
    }

    .modal-content h2 {
        font-size: 1.5em;
        margin-bottom: 20px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    .header h1 {
        font-size: 1.5em;
    }

    .header p {
        font-size: 0.9em;
    }

    .score-display {
        font-size: 2em;
    }

    .player-card h3 {
        font-size: 1.4em;
    }
}

.setup-screen {
    text-align: center;
}

.setup-screen h2 {
    color: #333;
    font-size: 2em;
    margin-bottom: 30px;
    font-weight: 600;
}

.restore-section {
    background: linear-gradient(135deg, #e8f5e8 0%, #d4edda 100%);
    border: 2px solid #4CAF50;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 30px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.2);
}

.restore-section h3 {
    margin: 0 0 15px 0;
    color: #4CAF50;
    font-size: 1.5em;
}

.restore-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 15px;
}

.restore-buttons .btn {
    flex: 1;
    max-width: 200px;
}

.form-group {
    margin-bottom: 25px;
}

label {
    display: block;
    margin-bottom: 12px;
    color: #555;
    font-weight: 600;
    font-size: 1.1em;
}

select, input[type="number"], input[type="text"] {
    width: 100%;
    max-width: 350px;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: #fafafa;
}

select:focus, input:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

input::placeholder {
    color: #aaa;
}

.player-inputs {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin: 25px auto;
    max-width: 600px;
}

.player-input-card {
    background: linear-gradient(135deg, #f9f9f9 0%, #ffffff 100%);
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all 0.3s ease;
    cursor: move;
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);
}

.player-input-card:hover {
    border-color: #667eea;
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.2);
    transform: translateY(-2px);
}

.player-input-card.dragging {
    opacity: 0.4;
    transform: scale(0.98);
}

.player-input-card.drag-over {
    border-color: #4CAF50;
    background: linear-gradient(135deg, #e8f5e9 0%, #ffffff 100%);
    border-width: 3px;
}

.drag-handle {
    font-size: 24px;
    color: #667eea;
    cursor: grab;
    user-select: none;
    line-height: 1;
    padding: 5px;
}

.drag-handle:active {
    cursor: grabbing;
}

.player-number {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1em;
    flex-shrink: 0;
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.3);
}

.player-input-card input {
    flex: 1;
    max-width: none;
    margin: 0;
}

.reorder-arrows-setup {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.arrow-btn-setup {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.arrow-btn-setup:hover:not(:disabled) {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.arrow-btn-setup:active:not(:disabled) {
    transform: scale(0.95);
}

.arrow-btn-setup:disabled {
    background: linear-gradient(135deg, #e0e0e0, #bdbdbd);
    cursor: not-allowed;
    opacity: 0.4;
}

.setup-helper {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    border: 2px solid #ff9800;
    border-radius: 12px;
    padding: 15px 20px;
    margin: 20px auto;
    max-width: 600px;
    text-align: center;
}

.setup-helper-title {
    font-size: 1.1em;
    font-weight: 700;
    color: #f57c00;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.setup-helper-text {
    color: #e65100;
    font-size: 0.95em;
    line-height: 1.5;
}

.btn {
    padding: 14px 32px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

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

.btn-primary { background: linear-gradient(135deg, #4CAF50, #45a049); color: white; }
.btn-secondary { background: linear-gradient(135deg, #2196F3, #1976D2); color: white; }
.btn-danger { background: linear-gradient(135deg, #f44336, #d32f2f); color: white; }
.btn-warning { background: linear-gradient(135deg, #ff9800, #f57c00); color: white; }
.btn-success { background: linear-gradient(135deg, #4CAF50, #45a049); color: white; }

.btn-small {
    padding: 10px 32px;
    font-size: 16px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    white-space: nowrap;
}

.btn-group {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
    flex-wrap: wrap;
}

.game-screen { display: none; }

.players-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    padding-bottom: 20px;
    transition: padding-bottom 0.3s ease;
}

.players-grid.keyboard-active {
    padding-bottom: 450px !important;
}

.player-card {
    background: linear-gradient(135deg, #f9f9f9 0%, #ffffff 100%);
    border-radius: 15px;
    padding: 25px;
    border: 2px solid #e0e0e0;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    position: relative;
}

.player-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    border-color: #667eea;
}

.player-name {
    font-size: 1.4em;
    font-weight: 700;
    color: #333;
    margin-bottom: 20px;
    text-align: center;
}

.score-display {
    font-size: 3.5em;
    font-weight: 800;
    background: linear-gradient(135deg, #4CAF50, #45a049);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-align: center;
    margin: 25px 0;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

.score-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 15px;
}

.score-controls input {
    max-width: none;
}

.button-row {
    display: flex;
    gap: 12px;
    width: 100%;
}

.button-row .btn { 
    flex: 1;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 600;
}

.add-score-btn {
    background: linear-gradient(135deg, #4CAF50, #45a049) !important;
}

.subtract-score-btn {
    background: linear-gradient(135deg, #f44336, #d32f2f) !important;
}

.add-score-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(76, 175, 80, 0.4);
}

.subtract-score-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(244, 67, 54, 0.4);
}

.history-btn { width: 100%; margin-top: 12px; }

.actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.entry-count {
    display: inline-block;
    background: rgba(255, 255, 255, 0.3);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.9em;
    font-weight: 700;
    margin-left: 4px;
}

.arrow-controls-game {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 5px;
}

.arrow-btn-game {
    background: rgba(255,255,255,0.2);
    border: 2px solid rgba(255,255,255,0.5);
    color: white;
    border-radius: 6px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s ease;
}

.arrow-btn-game:hover:not(:disabled) {
    background: rgba(255,255,255,0.3);
    transform: scale(1.1);
}

.arrow-btn-game:active:not(:disabled) {
    transform: scale(0.95);
}

.arrow-btn-game:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 1000;
    overflow-y: auto;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: white;
    margin: 50px auto;
    padding: 40px;
    border-radius: 20px;
    max-width: 750px;
    width: 90%;
    position: relative;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-30px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-content h2 {
    color: #333;
    font-size: 2em;
    margin-bottom: 25px;
    text-align: center;
}

.close {
    position: absolute;
    top: 20px;
    right: 25px;
    font-size: 32px;
    cursor: pointer;
    color: #999;
    transition: all 0.3s ease;
}

.close:hover {
    color: #333;
    transform: rotate(90deg);
}

.custom-alert {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 2000;
    backdrop-filter: blur(5px);
    align-items: center;
    justify-content: center;
}

.custom-alert-content {
    background: white;
    padding: 35px 40px;
    border-radius: 15px;
    max-width: 450px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
    animation: alertPop 0.3s ease;
    text-align: center;
}

@keyframes alertPop {
    0% { opacity: 0; transform: scale(0.8); }
    100% { opacity: 1; transform: scale(1); }
}

.custom-alert-message {
    font-size: 1.2em;
    color: #333;
    margin-bottom: 25px;
    line-height: 1.5;
}

.custom-alert-button {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 12px 35px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.custom-alert-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.custom-confirm {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 2000;
    backdrop-filter: blur(5px);
    align-items: center;
    justify-content: center;
}

.custom-confirm-content {
    background: white;
    padding: 35px 40px;
    border-radius: 15px;
    max-width: 450px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
    animation: alertPop 0.3s ease;
    text-align: center;
}

.custom-confirm-message {
    font-size: 1.2em;
    color: #333;
    margin-bottom: 25px;
    line-height: 1.5;
}

.custom-confirm-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.custom-confirm-button {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.confirm-yes {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.confirm-yes:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

.confirm-no {
    background: linear-gradient(135deg, #f44336, #d32f2f);
    color: white;
    box-shadow: 0 4px 15px rgba(244, 67, 54, 0.3);
}

.confirm-no:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(244, 67, 54, 0.4);
}

.winner-section {
    text-align: center;
    margin: 25px 0;
    padding: 30px;
    background: linear-gradient(135deg, #e8f5e8 0%, #d4edda 100%);
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(76, 175, 80, 0.2);
}

.winner-text {
    font-size: 1.8em;
    font-weight: 700;
    color: #4CAF50;
    margin-bottom: 15px;
}

.final-results { margin-top: 25px; }

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px;
    margin: 12px 0;
    border-radius: 10px;
    font-weight: 600;
    font-size: 1.1em;
    transition: all 0.3s ease;
}

.result-item:hover {
    transform: translateX(5px);
}

.result-winner {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    box-shadow: 0 5px 20px rgba(76, 175, 80, 0.3);
}

.result-player {
    background: #f5f5f5;
    color: #333;
}

.hidden { display: none; }

/* Wrapper scrollable pour le tableau sur mobile */
.history-table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Tableau d'historique avec en-tête violet */
.history-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 25px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: table;
}

.history-table thead {
    background: linear-gradient(135deg, #7c68ee, #9b7fed);
    display: table-header-group;
}

.history-table thead tr {
    display: table-row;
}

.history-table th {
    color: white;
    padding: 12px 8px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    text-transform: capitalize;
    display: table-cell;
}

.history-table th:first-child {
    border-top-left-radius: 12px;
}

.history-table th:last-child {
    border-top-right-radius: 12px;
    text-align: center;
}

.history-table tbody {
    display: table-row-group;
}

.history-table tbody tr {
    background: white;
    border-bottom: 1px solid #f0f0f0;
    display: table-row;
}

.history-table tbody tr:last-child {
    border-bottom: none;
}

.history-table tbody tr:hover {
    background: #f9f9ff;
}

.history-table td {
    padding: 12px 8px;
    font-size: 13px;
    color: #333;
    vertical-align: middle;
    display: table-cell;
}

.history-table .date-col {
    font-size: 12px;
    color: #666;
    white-space: nowrap;
}

.history-table .players-col {
    color: #333;
    font-size: 13px;
    white-space: nowrap;
}

.history-table .winner-col {
    font-weight: 700;
    color: #4CAF50;
    font-size: 13px;
    white-space: nowrap;
}

.history-table .actions-col {
    text-align: center;
    padding: 8px;
    white-space: nowrap;
}

/* Bouton Reprendre bleu dans le tableau */
.btn-reprendre {
    background: linear-gradient(135deg, #2196F3, #1976D2);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.3);
    white-space: nowrap;
}

.btn-reprendre:hover {
    background: linear-gradient(135deg, #1976D2, #1565C0);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.4);
}

.btn-reprendre:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(33, 150, 243, 0.3);
}

/* Responsive pour mobile */

.no-history {
    text-align: center;
    padding: 60px 20px;
    color: #999;
    font-size: 1.2em;
}

.winner-selection-list {
    margin: 25px 0;
}

.winner-selection-list label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    margin: 10px 0;
    background: #f9f9f9;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.winner-selection-list label:hover {
    background: #f0f0f0;
    border-color: #4CAF50;
    transform: translateX(5px);
}

.winner-selection-list input[type="radio"] {
    width: auto;
    margin: 0;
    cursor: pointer;
    transform: scale(1.2);
}

.winner-selection-list .player-name-score {
    display: flex;
    align-items: center;
    gap: 20px;
    flex: 1;
    margin-left: 20px;
}

.winner-selection-list .player-name {
    flex: 1;
    text-align: left;
    font-weight: 600;
    font-size: 1.1em;
}

.winner-selection-list .player-score {
    font-weight: 700;
    color: #4CAF50;
    min-width: 90px;
    text-align: right;
    font-size: 1.2em;
}

#remaining-points > div {
    display: flex;
    align-items: center;
    gap: 15px;
    margin: 12px 0;
}

#remaining-points label {
    min-width: 150px;
    text-align: left;
    margin: 0;
}

#remaining-points input {
    flex: 1;
    max-width: 200px;
}

#history-modal .modal-content {
    max-width: 580px;
    width: 96%;
    padding: 20px 12px;
    margin: 20px auto;
    box-sizing: border-box;
}

/* Modal plus étroit pour l'historique individuel */
#history-modal .modal-content.player-history-modal {
    max-width: 280px;
    width: 95%;
    padding: 15px 10px;
}

#history-content {
    margin: 15px 0 25px;
    overflow-x: auto;
}

/* Rendre le tableau historique individuel plus compact */
.history-table {
    width: 100%;
    max-width: 240px;
    margin: 20px auto;
}

.history-table th,
.history-table td {
    padding: 8px 4px;
    text-align: center;
    font-size: 12px;
}

.history-table th {
    font-size: 11px;
}

.history-table th:first-child,
.history-table td:first-child {
    width: 50px;
}

.history-table th:nth-child(2),
.history-table td:nth-child(2) {
    width: 70px;
}

.history-table th:last-child,
.history-table td:last-child {
    width: 70px;
}

/* Style pour le titre du modal historique */
.history-modal-title {
    font-size: 1.3em !important;
    margin-top: 10px !important;
    margin-bottom: 15px !important;
    color: #667eea !important;
}

/* Centrer le nom du joueur dans l'historique individuel */
#history-content h3 {
    text-align: center !important;
}

.history-table-simple {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.12);
}

.history-table-simple th,
.history-table-simple td {
    padding: 12px 10px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.history-table-simple th {
    background: #6a5acd;
    color: white;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.4px;
}

.history-table-simple th:last-child {
    text-align: center;
}

.history-table-simple td.date-col {
    color: #555;
    white-space: nowrap;
    font-size: 12.5px;
}

.history-table-simple td.players-col {
    font-weight: 500;
}

.history-table-simple td.winner-col {
    font-weight: bold;
    color: #2e7d32;
    white-space: nowrap;
}

.history-table-simple .action-cell {
    text-align: center;
    white-space: nowrap;
}

.btn-restore-simple {
    background: #1976d2;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 7px 14px;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-restore-simple:hover {
    background: #1565c0;
    transform: translateY(-1px);
}

.btn-clear-history {
    background: #d32f2f;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(211,47,47,0.3);
    display: block;
    margin: 0 auto;
}

.btn-clear-history:hover {
    background: #b71c1c;
}

.no-history-message {
    text-align: center;
    padding: 80px 20px;
    color: #888;
    font-size: 1.2em;
    font-style: italic;
}

/* Centrer les boutons dans le modal Fin de Partie */
.modal-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 25px;
}

/* Media queries pour l'historique général sur mobile */
@media (max-width: 480px) {
    #history-modal .modal-content {
        width: 96vw;
        max-width: 96vw;
        margin: 10px auto;
        padding: 12px 8px;
    }

    .history-table-simple {
        font-size: 11px;
        table-layout: fixed;
        width: 100%;
    }

    .history-table-simple th,
    .history-table-simple td {
        padding: 8px 4px;
        font-size: 11px;
    }

    .history-table-simple th {
        font-size: 10px;
        padding: 10px 4px;
    }

    .history-table-simple .date-col {
        font-size: 10px;
    }

    .history-table-simple .players-col {
        font-size: 10.5px;
    }

    .history-table-simple .winner-col {
        font-size: 10.5px;
    }

    .btn-restore-simple {
        padding: 5px 8px;
        font-size: 10px;
        white-space: nowrap;
    }

    .history-modal-title {
        font-size: 1.2em !important;
    }

    .btn-clear-history {
        padding: 8px 16px;
        font-size: 12px;
    }
}
/* ============================================
   STYLES POUR LA NOTIFICATION DE MISE À JOUR
   ============================================ */

.update-notification {
    position: fixed;
    top: -200px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    max-width: 90%;
    width: 400px;
    transition: top 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.update-notification.show {
    top: 20px;
}

.update-notification-content {
    display: flex;
    align-items: center;
    gap: 15px;
    position: relative;
}

.update-icon {
    font-size: 2em;
    animation: rotate 2s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.update-text {
    flex: 1;
}

.update-text strong {
    display: block;
    font-size: 1.1em;
    margin-bottom: 5px;
}

.update-text p {
    font-size: 0.9em;
    opacity: 0.9;
    margin: 0;
}

.btn-update {
    background: white;
    color: #667eea;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.95em;
}

.btn-update:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(255, 255, 255, 0.3);
}

.btn-update:active {
    transform: scale(0.95);
}

.btn-close-update {
    position: absolute;
    top: -10px;
    right: -10px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.5em;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.btn-close-update:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* Responsive pour mobile */
@media (max-width: 600px) {
    .update-notification {
        width: calc(100% - 40px);
        padding: 15px;
    }

    .update-notification-content {
        flex-wrap: wrap;
        gap: 10px;
    }

    .update-icon {
        font-size: 1.5em;
    }

    .update-text {
        flex: 1 1 100%;
        order: 2;
    }

    .btn-update {
        flex: 1 1 100%;
        order: 3;
        margin-top: 10px;
    }

    .update-text strong {
        font-size: 1em;
    }

    .update-text p {
        font-size: 0.85em;
    }
}

/* Animation de pulsation pour attirer l'attention */
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.update-notification.pulse {
    animation: pulse 2s infinite;
}
