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

:root {
    --primary: #2563eb;
    --secondary: #64748b;
    --success: #10b981;
    --danger: #ef4444;
    --dark: #1e293b;
    --light: #f8fafc;
    --border: #e2e8f0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--dark);
    -webkit-font-smoothing: antialiased;
}

/* Écrans */
.screen {
    display: none;
    min-height: 100vh;
    padding: 1rem;
}

.screen.active {
    display: block;
}

.container {
    max-width: 600px;
    margin: 0 auto;
}

/* Écran de démarrage */
#startScreen h1 {
    font-size: 3rem;
    color: white;
    text-align: center;
    margin: 2rem 0 0.5rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.subtitle {
    text-align: center;
    color: rgba(255,255,255,0.9);
    font-size: 1.2rem;
    margin-bottom: 2rem;
}

.players-setup {
    background: white;
    border-radius: 1rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.players-setup h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--dark);
}

#playersList {
    margin-bottom: 1rem;
}

.player-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: var(--light);
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
}

.player-item input {
    flex: 1;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 0.5rem;
    font-size: 1rem;
}

.player-item button {
    background: var(--danger);
    color: white;
    border: none;
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
    cursor: pointer;
}

.voice-info {
    background: rgba(255,255,255,0.95);
    border-radius: 1rem;
    padding: 1.5rem;
    margin-top: 1.5rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.voice-info ul {
    list-style: none;
    margin-top: 1rem;
}

.voice-info li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}

.voice-info li:last-child {
    border-bottom: none;
}

/* Boutons */
.btn {
    width: 100%;
    padding: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

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

.btn-primary:active {
    transform: scale(0.98);
}

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

.btn-link {
    background: none;
    border: none;
    color: white;
    text-decoration: underline;
    cursor: pointer;
    padding: 0.5rem;
    font-size: 0.9rem;
}

.btn-icon {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    font-size: 1.5rem;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.5rem;
    cursor: pointer;
}

/* Écran de jeu */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    margin-bottom: 1rem;
}

.game-header h2 {
    color: white;
    font-size: 1.5rem;
}

/* Tableau de score */
.scoreboard {
    background: white;
    border-radius: 1rem;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    overflow-x: auto;
}

#scoreTable {
    width: 100%;
    border-collapse: collapse;
}

#scoreTable th {
    padding: 0.75rem 0.5rem;
    text-align: center;
    font-weight: 600;
    border-bottom: 2px solid var(--border);
    position: sticky;
    top: 0;
    background: white;
}

#scoreTable td {
    padding: 0.75rem 0.5rem;
    text-align: center;
    border-bottom: 1px solid var(--border);
}

.target-col {
    font-weight: 700;
    color: var(--primary);
}

.score-cell {
    position: relative;
    min-width: 60px;
}

.hits {
    font-size: 1.5rem;
    color: var(--primary);
}

.points {
    font-size: 0.75rem;
    color: var(--secondary);
    display: block;
    margin-top: 0.25rem;
}

.closed {
    background: var(--success);
    color: white;
    font-weight: 700;
}

.score-cell.clickable {
    transition: all 0.2s;
    position: relative;
}

.score-cell.clickable:hover {
    background: rgba(37, 99, 235, 0.1);
    transform: scale(1.05);
}

.score-cell.clickable:active {
    background: rgba(37, 99, 235, 0.2);
    transform: scale(0.98);
}

.score-cell.clickable::after {
    content: '👆';
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 0.7rem;
    opacity: 0.3;
}

/* Joueur actuel */
.current-player {
    background: rgba(255,255,255,0.95);
    border-radius: 1rem;
    padding: 1rem;
    margin-bottom: 1rem;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.player-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.dart-count {
    color: var(--secondary);
    font-size: 1rem;
}

/* Zone vocale */
.voice-zone {
    text-align: center;
    margin: 2rem 0;
}

.voice-button {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--primary), var(--success));
    color: white;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin: 0 auto;
}

.voice-button:active {
    transform: scale(0.95);
}

.voice-button.listening {
    animation: pulse 1.5s infinite;
    background: linear-gradient(135deg, var(--danger), #f97316);
}

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

.mic-icon {
    font-size: 3rem;
}

.voice-result {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(255,255,255,0.9);
    border-radius: 0.75rem;
    min-height: 3rem;
    font-size: 1.1rem;
    color: var(--dark);
}

/* Saisie manuelle */
.manual-input {
    text-align: center;
    margin: 1rem 0;
}

.manual-panel {
    background: white;
    border-radius: 1rem;
    padding: 1rem;
    margin-top: 1rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.manual-panel.hidden {
    display: none;
}

.number-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.num-btn {
    padding: 1rem;
    border: 2px solid var(--border);
    background: white;
    border-radius: 0.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

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

.multiplier-btns {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.mult-btn {
    flex: 1;
    padding: 0.75rem;
    border: 2px solid var(--border);
    background: white;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
}

.mult-btn.active {
    background: var(--secondary);
    color: white;
    border-color: var(--secondary);
}

/* Historique */
.history {
    background: rgba(255,255,255,0.95);
    border-radius: 1rem;
    padding: 1rem;
    margin-top: 1rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.history h3 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
    color: var(--dark);
}

#historyList {
    max-height: 150px;
    overflow-y: auto;
}

.history-item {
    padding: 0.5rem;
    background: var(--light);
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
}

.history-item:last-child {
    margin-bottom: 0;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    border-radius: 1rem;
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    text-align: center;
}

.modal-content h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--primary);
}

#winnerInfo {
    font-size: 1.25rem;
    margin: 1.5rem 0;
    color: var(--dark);
}

/* Responsive */
@media (min-width: 768px) {
    .voice-button {
        width: 180px;
        height: 180px;
    }

    .mic-icon {
        font-size: 4rem;
    }
}
