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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f5f5;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

header {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e0e0e0;
}

header h1 {
    color: #333;
    font-size: 2.5em;
    margin-bottom: 10px;
}

header p {
    color: #666;
    font-size: 1.1em;
}

section {
    margin-bottom: 40px;
    padding: 25px;
    background: white;
    border-radius: 10px;
    border: 1px solid #e8e8e8;
}

section h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.8em;
}

section h3 {
    color: #555;
    margin-bottom: 15px;
    font-size: 1.3em;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 600;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1em;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

#player-names-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.player-name-input {
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1em;
}

.btn {
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    font-size: 0.85em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-right: 5px;
}

.btn-primary {
    background: #333;
    color: white;
}

.btn-primary:hover {
    background: #555;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-warning {
    background: #ffc107;
    color: #333;
}

.btn-warning:hover {
    background: #e0a800;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

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

.btn-small {
    padding: 6px 12px;
    font-size: 0.9em;
}

#recent-games-list {
    display: grid;
    gap: 15px;
}

.game-item {
    background: white;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #667eea;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: transform 0.2s;
}

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

.game-item-info {
    flex: 1;
}

.game-item-title {
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.game-item-meta {
    color: #666;
    font-size: 0.9em;
}

.game-item-actions {
    display: flex;
    gap: 10px;
}

/* Page de jeu */
.game-container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.game-header {
    background: #333;
    color: white;
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.game-info h1 {
    font-size: 1.3em;
    margin-bottom: 2px;
}

.game-info p {
    font-size: 0.85em;
}

.game-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.game-board {
    padding: 0;
}

#score-sheet-container {
    position: relative;
    overflow: auto;
    background: #f8f9fa;
    border-radius: 0;
    padding: 0;
    margin-bottom: 0;
    width: 100%;
    max-width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

#score-canvas {
    cursor: pointer;
    display: block;
    max-width: 100%;
    max-height: calc(100vh - 140px);
    width: auto;
    height: auto;
    object-fit: contain;
}

/* Responsive - Mode portrait téléphone */
@media (max-width: 768px) and (orientation: portrait) {
    .game-header {
        padding: 8px 10px;
        gap: 5px;
    }
    
    .game-info h1 {
        font-size: 1.1em;
    }
    
    .game-info p {
        font-size: 0.75em;
    }
    
    .btn {
        padding: 6px 10px;
        font-size: 0.75em;
        margin-right: 3px;
    }
    
    .btn-small {
        padding: 4px 8px;
        font-size: 0.7em;
    }
    
    .game-actions {
        gap: 5px;
    }
    
    .game-board {
        padding: 2px;
    }
    
    #score-sheet-container {
        padding: 2px;
        border-radius: 3px;
    }
    
    #score-canvas {
        max-height: calc(100vh - 120px);
    }
}

/* Mode paysage téléphone */
@media (max-width: 768px) and (orientation: landscape) {
    .game-header {
        padding: 5px 10px;
    }
    
    .game-info h1 {
        font-size: 1em;
    }
    
    .btn {
        padding: 5px 8px;
        font-size: 0.7em;
    }
    
    #score-canvas {
        max-height: calc(100vh - 80px);
    }
}

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

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    min-width: 400px;
    max-width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.modal-large {
    min-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-content h3 {
    margin-bottom: 20px;
    color: #333;
}

.modal-content input {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1.2em;
    margin: 15px 0;
}

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

#history-content {
    max-height: 500px;
    overflow-y: auto;
}

.history-item {
    padding: 10px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-item:last-child {
    border-bottom: none;
}

.history-time {
    color: #999;
    font-size: 0.85em;
}

/* Responsive */
@media (max-width: 768px) {
    .game-header {
        /*flex-direction: column;*/
        align-items: flex-start;
    }
    
    .modal-content {
        min-width: 300px;
    }
    
    .modal-large {
        min-width: 90%;
    }
}
