.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 10px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-content h2 {
    color: #667eea;
    margin-bottom: 20px;
}

.player-input {
    margin: 10px 0;
}

.player-input input {
    width: 100%;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 5px;
    font-size: 14px;
}

.player-input label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
}

.team-input-group {
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px solid #e0e0e0;
    cursor: move;
    transition: all 0.3s;
    position: relative;
}

.team-input-group:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.team-input-group h3 {
    color: #667eea;
    margin-bottom: 10px;
    font-size: 16px;
}

.drag-handle {
    position: absolute;
    left: -5px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 20px;
    color: #999;
    cursor: grab;
}

.drag-handle:active {
    cursor: grabbing;
}

.player-duo {
    display: flex;
    gap: 10px;
}

.player-duo input {
    flex: 1;
    padding: 12px;
    border: 2px solid #667eea;
    border-radius: 5px;
    font-size: 14px;
}

.modal-content button {
    margin: 10px 5px 0 0;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.modal-large {
    max-width: 900px;
    max-height: 85vh;
}

#startTournament,
#startGroupStage {
    background: #667eea;
    color: white;
}

#cancelSetup,
#cancelGroupSetup,
#closeMatch {
    background: #6c757d;
    color: white;
}

.score-input {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin: 20px 0;
}

.player-score {
    flex: 1;
    text-align: center;
}

.player-score label {
    display: block;
    font-weight: bold;
    margin-bottom: 10px;
    color: #667eea;
    font-size: 16px;
}

.player-score input {
    width: 100%;
    padding: 15px;
    font-size: 24px;
    text-align: center;
    border: 2px solid #667eea;
    border-radius: 8px;
    font-weight: bold;
}

.score-vs {
    font-size: 20px;
    font-weight: bold;
    color: #999;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

#submitScore {
    background: #28a745;
    color: white;
    flex: 1;
}

.match-modal-large {
    max-width: 700px;
}

.team-vs-team {
    display: flex;
    align-items: center;
    gap: 30px;
    margin: 30px 0;
}

.team-section {
    flex: 1;
    text-align: center;
}

.team-section h3 {
    color: #667eea;
    font-size: 22px;
    margin-bottom: 15px;
    font-weight: bold;
}

.score-display input {
    width: 100%;
    max-width: 150px;
    padding: 20px;
    font-size: 36px;
    text-align: center;
    border: 3px solid #667eea;
    border-radius: 10px;
    font-weight: bold;
    color: #333;
}

.vs-divider {
    font-size: 28px;
    font-weight: bold;
    color: #999;
    padding: 0 20px;
}

/* ============================================
   RESPONSIVE - MOBILE
   ============================================ */
@media (max-width: 768px) {
    .modal-content {
        padding: 20px;
        width: 95%;
        max-height: 85vh;
    }
    
    .modal-content h2 {
        font-size: 20px;
        margin-bottom: 15px;
    }
    
    .modal-large,
    .match-modal-large {
        max-width: 95%;
    }
    
    .team-input-group {
        padding: 12px;
        margin: 15px 0;
    }
    
    .team-input-group h3 {
        font-size: 14px;
        margin-bottom: 8px;
    }
    
    .player-duo {
        flex-direction: column;
        gap: 8px;
    }
    
    .player-duo input {
        padding: 10px;
        font-size: 13px;
    }
    
    .team-vs-team {
        flex-direction: column;
        gap: 20px;
        margin: 20px 0;
    }
    
    .team-section h3 {
        font-size: 18px;
        margin-bottom: 12px;
    }
    
    .score-display input {
        max-width: 120px;
        padding: 15px;
        font-size: 28px;
    }
    
    .vs-divider {
        font-size: 22px;
        padding: 0;
    }
    
    .player-score label {
        font-size: 14px;
        margin-bottom: 8px;
    }
    
    .player-score input {
        padding: 12px;
        font-size: 20px;
    }
    
    .score-vs {
        font-size: 18px;
    }
    
    .modal-buttons {
        flex-direction: column;
    }
    
    .modal-content button {
        padding: 12px 18px;
        font-size: 14px;
        width: 100%;
    }
    
    #groupInputs {
        max-height: 50vh;
    }
}

@media (max-width: 480px) {
    .modal-content {
        padding: 15px;
        width: 98%;
    }
    
    .modal-content h2 {
        font-size: 18px;
    }
    
    .team-input-group {
        padding: 10px;
    }
    
    .team-input-group h3 {
        font-size: 13px;
    }
    
    .player-duo input {
        padding: 8px;
        font-size: 12px;
    }
    
    .team-section h3 {
        font-size: 16px;
    }
    
    .score-display input {
        max-width: 100px;
        padding: 12px;
        font-size: 24px;
    }
    
    .drag-handle {
        font-size: 16px;
        left: -3px;
    }
}
