/* Reset e Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    /* Configurações para melhor performance mobile */
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    touch-action: manipulation;
}

html, body {
    height: 100%;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    overflow-x: hidden;
}

/* Layout Principal */
.scoreboard-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 1rem;
    max-width: 100vw;
}

/* Container dos Times */
.teams-container {
    flex: 1;
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    min-height: 0;
    width: 100%;
}

/* Seções dos Times */
.team-section {
    flex: 0 0 calc(50% - 0.5rem);
    width: calc(50% - 0.5rem);
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 1rem;
    padding: 1rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    min-height: 0;
}

/* Removidos estilos hover da team-section para evitar confusão */

/* Nome do Time */
.team-name {
    font-size: clamp(1.2rem, 4vw, 1.8rem);
    font-weight: bold;
    text-align: center;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(255, 255, 255, 0.3);
    width: 100%;
    min-width: 0;
}

.team-name:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.team-name:active {
    transform: translateY(0);
    background: rgba(255, 255, 255, 0.2);
}

/* Controles de Pontuação */
.score-controls {
    display: flex;
    align-items: center;
    justify-content: space-evenly;
    gap: clamp(0.5rem, 2vw, 1rem);
    margin: auto 0;
    width: 100%;
}

.score {
    font-size: clamp(4rem, 15vw, 8rem);
    font-weight: 900;
    text-align: center;
    line-height: 1;
    text-shadow: 4px 4px 8px rgba(0, 0, 0, 0.4);
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    flex: 1;
    min-width: clamp(80px, 20vw, 160px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.25rem;
}

/* Controles de Sets */
.sets-controls {
    display: flex;
    align-items: center;
    justify-content: space-evenly;
    gap: clamp(0.5rem, 2vw, 1rem);
    margin-top: 0.5rem;
    width: 100%;
}

.sets-display {
    font-size: clamp(1rem, 3vw, 1.4rem);
    font-weight: bold;
    text-align: center;
    padding: 0.5rem;
    border-radius: 0.5rem;
    background: rgba(0, 0, 0, 0.1);
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Botões de Controle +/- */
.btn-control {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.4);
    color: currentColor;
    border-radius: 50%;
    width: clamp(44px, 8vw, 60px);
    height: clamp(44px, 8vw, 60px);
    min-width: 44px;
    min-height: 44px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: clamp(1rem, 3vw, 1.5rem);
    font-weight: bold;
    backdrop-filter: blur(5px);
}

.btn-control:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.6);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.btn-control:active {
    transform: translateY(0);
    background: rgba(255, 255, 255, 0.4);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.btn-plus {
    background: rgba(46, 204, 113, 0.8);
    border-color: rgba(46, 204, 113, 1);
}

.btn-plus:hover {
    background: rgba(46, 204, 113, 0.9);
    border-color: rgba(46, 204, 113, 1);
}

.btn-minus {
    background: rgba(231, 76, 60, 0.8);
    border-color: rgba(231, 76, 60, 1);
}

.btn-minus:hover {
    background: rgba(231, 76, 60, 0.9);
    border-color: rgba(231, 76, 60, 1);
}

/* Mobile Portrait - Layout Vertical e Botões abaixo dos números */
@media (max-width: 768px) and (orientation: portrait) {
    /* Container dos times em layout vertical */
    .teams-container {
        flex-direction: column;
        gap: 1rem;
        margin-bottom: 1rem;
    }
    
    /* Cada seção de time ocupa toda a largura */
    .team-section {
        flex: 1;
        width: 100%;
        min-height: 200px;
        padding: 1rem;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
    }
    
    /* Controles de pontuação em linha (- número +) */
    .score-controls {
        flex-direction: row;
        gap: 0.5rem;
        align-items: center;
        justify-content: space-between;
        width: 100%;
    }
    
    .score {
        font-size: clamp(6rem, 25vw, 12rem);
        padding: 0.5rem;
        flex: 1;
        order: 0;
        text-align: center;
        min-width: 0;
        line-height: 1;
        font-weight: 900;
    }
    
    .score-buttons {
        display: contents; /* Faz os botões se comportarem como filhos diretos */
    }
    
    .score-buttons .btn-minus {
        order: -1; /* Botão - fica antes do número */
    }
    
    .score-buttons .btn-plus {
        order: 1; /* Botão + fica depois do número */
    }
    
    .sets-controls {
        gap: clamp(0.5rem, 2vw, 1rem);
        margin-top: 0.5rem;
    }
    
    /* Botões de pontuação - tamanho maior */
    .score-controls .btn-control {
        /* Área de toque maior no mobile */
        min-width: 60px;
        min-height: 60px;
        width: clamp(60px, 15vw, 80px);
        height: clamp(60px, 15vw, 80px);
        font-size: clamp(1.4rem, 4vw, 2rem);
        flex-shrink: 0;
        /* Remove delays e melhora responsividade */
        -webkit-tap-highlight-color: rgba(255, 255, 255, 0.2);
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
    }
    
    /* Botões de sets - tamanho menor */
    .sets-controls .btn-control {
        min-width: 50px;
        min-height: 50px;
        width: clamp(50px, 12vw, 65px);
        height: clamp(50px, 12vw, 65px);
        font-size: clamp(1.1rem, 3vw, 1.6rem);
        flex-shrink: 0;
        -webkit-tap-highlight-color: rgba(255, 255, 255, 0.2);
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
    }
    
    .btn-control:active {
        /* Feedback visual imediato no mobile */
        transform: scale(0.95);
        background: rgba(255, 255, 255, 0.4);
    }
    
    /* Remove hover em dispositivos touch */
    .btn-control:hover {
        background: rgba(255, 255, 255, 0.2);
        transform: none;
        box-shadow: none;
    }
    
    .team-name:hover {
        background: rgba(255, 255, 255, 0.1);
        transform: none;
        box-shadow: none;
    }
    
    /* Ajuste do container principal para melhor aproveitamento do espaço */
    .scoreboard-container {
        padding: 0.75rem;
        gap: 0.75rem;
    }
    
    /* Times container ocupa mais espaço vertical */
    .teams-container {
        flex: 1;
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
        margin-bottom: 0.75rem;
        min-height: 0;
    }
    
    /* Controles principais mais compactos */
    .controls-container {
        padding: 0.75rem;
        margin-top: 0.5rem;
    }
    
    .timer-section {
        padding: 0.75rem;
        margin-bottom: 0.75rem;
        font-size: clamp(1.3rem, 4vw, 2rem);
    }
    
    .action-buttons {
        gap: 0.5rem;
    }
    
    .btn {
        padding: 0.6rem 0.8rem;
        font-size: clamp(0.85rem, 2.2vw, 1rem);
        min-height: 44px;
    }
}

/* Mobile Landscape - Layout horizontal tradicional */
@media (max-width: 768px) and (orientation: landscape) {
    .score-controls {
        flex-direction: row;
        gap: clamp(0.25rem, 1.5vw, 0.75rem);
        align-items: center;
        justify-content: space-evenly;
    }
    
    .score {
        font-size: clamp(3.5rem, 12vw, 6rem);
        padding: 0;
        min-width: clamp(60px, 18vw, 120px);
        flex: 1;
        order: 0; /* Número no meio */
    }
    
    .score-buttons {
        display: contents; /* Faz os botões se comportarem como filhos diretos do score-controls */
    }
    
    .score-buttons .btn-minus {
        order: -1; /* Botão - fica antes do número */
    }
    
    .score-buttons .btn-plus {
        order: 1; /* Botão + fica depois do número */
    }
    
    .sets-controls {
        gap: clamp(0.25rem, 1.5vw, 0.75rem);
    }
    
    /* Botões de pontuação - landscape mobile */
    .score-controls .btn-control {
        /* Área de toque maior no mobile */
        min-width: 40px;
        min-height: 40px;
        width: clamp(40px, 7vw, 50px);
        height: clamp(40px, 7vw, 50px);
        font-size: clamp(0.9rem, 2.5vw, 1.2rem);
        /* Remove delays e melhora responsividade */
        -webkit-tap-highlight-color: rgba(255, 255, 255, 0.2);
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
    }
    
    /* Botões de sets - landscape mobile (menores) */
    .sets-controls .btn-control {
        min-width: 35px;
        min-height: 35px;
        width: clamp(35px, 6vw, 42px);
        height: clamp(35px, 6vw, 42px);
        font-size: clamp(0.8rem, 2vw, 1rem);
        -webkit-tap-highlight-color: rgba(255, 255, 255, 0.2);
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
    }
    
    .btn-control:active {
        /* Feedback visual imediato no mobile */
        transform: scale(0.95);
        background: rgba(255, 255, 255, 0.4);
    }
    
    /* Remove hover em dispositivos touch */
    .btn-control:hover {
        background: rgba(255, 255, 255, 0.2);
        transform: none;
        box-shadow: none;
    }
    
    .team-name:hover {
        background: rgba(255, 255, 255, 0.1);
        transform: none;
        box-shadow: none;
    }
}

/* Container de Controles */
.controls-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 1rem;
    padding: 1rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    width: 100%;
    box-sizing: border-box;
}

/* Seção do Timer */
.timer-section {
    text-align: center;
    font-size: clamp(1.5rem, 5vw, 2.5rem);
    font-weight: bold;
    color: #333;
    cursor: pointer;
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    background: rgba(108, 99, 255, 0.1);
    border: 2px solid rgba(108, 99, 255, 0.2);
}

.timer-section:hover {
    background: rgba(108, 99, 255, 0.2);
    transform: translateY(-1px);
}

.timer-section i {
    margin-right: 0.5rem;
    color: #6c63ff;
}

/* Botões de Ação */
.action-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.btn {
    flex: 1;
    min-height: 48px;
    border: none;
    border-radius: 0.5rem;
    font-size: clamp(0.9rem, 2.5vw, 1.1rem);
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0.75rem 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-width: 120px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    color: white;
}

.btn-secondary {
    background: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%);
    color: white;
}

.btn-success {
    background: linear-gradient(135deg, #00b894 0%, #00a085 100%);
    color: white;
}

.btn-warning {
    background: linear-gradient(135deg, #fdcb6e 0%, #e17055 100%);
    color: white;
}

.btn-info {
    background: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%);
    color: white;
}

/* Modais */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-content {
    background: white;
    border-radius: 1rem;
    max-width: 90vw;
    max-height: 90vh;
    width: 100%;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #eee;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 1rem 1rem 0 0;
}

.modal-header h3 {
    margin: 0;
    font-size: clamp(1.2rem, 4vw, 1.6rem);
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.25rem;
    transition: background 0.2s ease;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.modal-body {
    padding: 1.5rem;
}

/* Lista de Times */
.teams-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.team-item {
    display: flex;
    flex-direction: column;
    position: relative;
    padding: 1rem;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    font-weight: bold;
    min-height: 80px;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* Área do nome do time - não clicável para facilitar scroll */
.team-info-area {
    flex: 1;
    display: flex;
    align-items: center;
    padding-bottom: 0.5rem;
}

/* Botões de ação no canto inferior direito */
.team-actions {
    position: absolute;
    bottom: 0.5rem;
    right: 0.5rem;
    display: flex;
    gap: 0.25rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 0.5rem;
    padding: 0.25rem;
    backdrop-filter: blur(4px);
}

/* Estilos específicos para os botões de ação */
.team-actions .btn-icon {
    width: 32px;
    height: 32px;
    padding: 0.5rem;
    border-radius: 0.25rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
}

.team-actions .btn-icon i {
    font-size: 0.875rem;
    pointer-events: none;
}

.team-actions .select-btn {
    background: rgba(40, 167, 69, 0.8);
    color: white;
}

.team-actions .select-btn:hover {
    background: rgba(40, 167, 69, 1);
    transform: scale(1.1);
}

.team-actions .edit-btn {
    background: rgba(255, 193, 7, 0.8);
    color: white;
}

.team-actions .edit-btn:hover {
    background: rgba(255, 193, 7, 1);
    transform: scale(1.1);
}

.team-actions .delete-btn {
    background: rgba(220, 53, 69, 0.8);
    color: white;
}

.team-actions .delete-btn:hover {
    background: rgba(220, 53, 69, 1);
    transform: scale(1.1);
}

/* Feedback visual especial para touch em tablets */
@media (pointer: coarse) {
    .team-item:active {
        background-color: rgba(255, 255, 255, 0.1) !important;
    }
    
    .team-name:active {
        background: rgba(255, 255, 255, 0.3) !important;
    }
}

.team-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 0.25rem;
    min-width: 0;
    overflow: hidden;
    padding-right: 120px; /* Espaço para os botões de ação */
}

/* Nome do time na lista de seleção */
.team-info .team-name {
    font-size: clamp(1rem, 4vw, 2.1rem);
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.team-sets {
    font-size: 0.9rem;
    opacity: 0.8;
    font-weight: normal;
    background: rgba(0, 0, 0, 0.1);
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    display: inline-block;
    width: fit-content;
}

.team-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-icon {
    background: rgba(0, 0, 0, 0.2);
    border: none;
    color: currentColor;
    padding: 0.5rem;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.3);
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.btn-icon:hover {
    background: rgba(0, 0, 0, 0.3);
    transform: translateY(-1px);
}

.btn-icon:active {
    transform: translateY(0);
    background: rgba(0, 0, 0, 0.4);
}

.new-team-btn {
    margin-top: 1rem;
    width: 100%;
}

/* Formulários */
.team-form, .menu-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: bold;
    color: #333;
}

.form-group input, .form-group select {
    padding: 0.75rem;
    border: 2px solid #ddd;
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.radio-label, .checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: normal;
}

.preview-team {
    padding: 1rem;
    border-radius: 0.5rem;
    text-align: center;
    font-weight: bold;
    margin: 0.5rem 0;
}

.form-buttons {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.form-buttons .btn {
    flex: 1;
}

/* Presets de Tempo */
.time-presets {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 0.5rem;
    margin: 0.5rem 0;
}

.preset-btn {
    padding: 0.75rem 0.5rem;
    border: 2px solid #ddd;
    border-radius: 0.5rem;
    background: white;
    color: #333;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    text-align: center;
    min-height: 48px;
}

.preset-btn:hover {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.1);
}

.preset-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.preset-btn:focus {
    outline: 3px solid rgba(102, 126, 234, 0.3);
    outline-offset: 2px;
}

/* Menu Modal */
.menu-modal .modal-content {
    max-width: 400px;
}

.menu-btn {
    width: 100%;
    margin-bottom: 0.5rem;
}

/* Modal de Confirmação */
.confirm-modal .modal-content {
    max-width: 400px;
}

.confirm-modal .modal-body {
    text-align: center;
}

.confirm-modal .modal-body p {
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    color: #333;
}

/* Animações */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Responsividade Landscape */
@media (orientation: landscape) and (max-height: 600px) {
    .scoreboard-container {
        padding: 0.5rem;
    }
    
    .teams-container {
        margin-bottom: 0.5rem;
    }
    
    .team-section {
        padding: 0.5rem;
    }
    
    .controls-container {
        padding: 0.5rem;
    }
    
    .timer-section {
        padding: 0.5rem;
        margin-bottom: 0.5rem;
    }
    
    .score {
        font-size: clamp(2.5rem, 10vw, 5rem);
        padding: 0;
        min-width: clamp(50px, 15vw, 100px);
    }
    
    .action-buttons {
        gap: 0.25rem;
    }
    
    .btn {
        padding: 0.5rem;
        min-height: 40px;
        font-size: clamp(0.8rem, 2vw, 1rem);
    }
    
    /* Botões de pontuação - landscape baixo */
    .score-controls .btn-control {
        width: clamp(35px, 6vw, 50px);
        height: clamp(35px, 6vw, 50px);
        font-size: clamp(0.9rem, 2.5vw, 1.3rem);
    }
    
    /* Botões de sets - landscape baixo (menores) */
    .sets-controls .btn-control {
        width: clamp(30px, 5vw, 42px);
        height: clamp(30px, 5vw, 42px);
        font-size: clamp(0.8rem, 2vw, 1.1rem);
    }
    
    .score-controls, .sets-controls {
        gap: clamp(0.2rem, 1vw, 0.4rem);
    }
}

/* Tablet Portrait */
@media (min-width: 768px) and (orientation: portrait) {
    .scoreboard-container {
        max-width: 90vw;
        margin: 0 auto;
    }
    
    .team-section {
        flex: 0 0 calc(50% - 0.5rem);
        width: calc(50% - 0.5rem);
    }
    
    /* Tablets mantêm layout horizontal com ajustes para caber no card */
    .score-controls {
        flex-direction: row;
        gap: clamp(0.75rem, 2vw, 1.5rem);
        align-items: center;
        justify-content: space-between;
        width: 100%;
        padding: 0 0.5rem;
    }
    
    .score {
        font-size: clamp(8rem, 30vw, 14rem);
        flex: 1;
        order: 0;
        text-align: center;
        min-width: 0;
        line-height: 1;
        font-weight: 900;
        padding: 0.5rem;
    }
    
    .score-buttons {
        display: contents;
    }
    
    .score-buttons .btn-minus {
        order: -1;
        flex-shrink: 0;
    }
    
    .score-buttons .btn-plus {
        order: 1;
        flex-shrink: 0;
    }
    
    /* Melhorias específicas para seleção de times em tablets */
    .team-item {
        min-height: 90px;
        padding: 1.25rem;
        -webkit-tap-highlight-color: transparent;
    }
    
    .team-actions .btn-icon {
        width: 40px;
        height: 40px;
        padding: 0.625rem;
    }
    
    .team-info {
        padding-right: 140px; /* Mais espaço para botões maiores no mobile */
    }
    
    .team-info .team-name {
        font-size: clamp(1.2rem, 3vw, 2.1rem);
    }
    
    .team-name {
        padding: 0.75rem;
        min-height: 48px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .btn-icon {
        min-width: 48px;
        min-height: 48px;
        padding: 0.75rem;
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.2);
    }
    
    /* Botões de pontuação - tablet */
    .score-controls .btn-control {
        width: clamp(70px, 8vw, 90px);
        height: clamp(70px, 8vw, 90px);
        font-size: clamp(1.6rem, 3.5vw, 2.2rem);
        min-width: 70px;
        min-height: 70px;
        flex-shrink: 0;
    }
    
    /* Botões de sets - tablet (menores) */
    .sets-controls .btn-control {
        width: clamp(55px, 6vw, 70px);
        height: clamp(55px, 6vw, 70px);
        font-size: clamp(1.2rem, 2.8vw, 1.8rem);
        min-width: 55px;
        min-height: 55px;
        flex-shrink: 0;
    }
    
    .sets-controls {
        gap: clamp(1rem, 2.5vw, 2rem);
        justify-content: space-between;
        padding: 0 0.5rem;
    }
}

/* Desktop e Tablet Landscape */
@media (min-width: 1024px) {
    .scoreboard-container {
        max-width: 1200px;
        margin: 0 auto;
        padding: 2rem;
    }
    
    .teams-container {
        gap: 1rem;
    }
    
    .team-section {
        padding: 3rem 2rem;
        flex: 0 0 calc(50% - 0.5rem);
        width: calc(50% - 0.5rem);
    }
    
    .controls-container {
        padding: 2rem;
    }
    
    .modal-content {
        max-width: 500px;
    }
    
    /* Desktop mantém layout horizontal tradicional */
    .score-controls {
        flex-direction: row;
        gap: clamp(2rem, 4vw, 4rem);
        align-items: center;
        justify-content: space-evenly;
    }
    
    .score {
        flex: 1;
        order: 0;
    }
    
    .score-buttons {
        display: contents;
    }
    
    .score-buttons .btn-minus {
        order: -1;
    }
    
    .score-buttons .btn-plus {
        order: 1;
    }
    
    /* Melhorias específicas para tablets em landscape */
    .team-item {
        min-height: 95px;
        padding: 1.5rem;
        transition: all 0.2s ease;
        -webkit-tap-highlight-color: transparent;
    }
    
    .team-actions .btn-icon {
        width: 36px;
        height: 36px;
        padding: 0.75rem;
    }
    
    .team-info {
        padding-right: 130px; /* Espaço adequado para desktop */
    }
    
    .team-info .team-name {
        font-size: clamp(1.4rem, 2.5vw, 2.1rem);
    }
    
    .btn-icon {
        min-width: 50px;
        min-height: 50px;
        padding: 0.875rem;
    }
    
    /* Botões de pontuação - desktop */
    .score-controls .btn-control {
        width: clamp(70px, 6vw, 100px);
        height: clamp(70px, 6vw, 100px);
        font-size: clamp(1.6rem, 3vw, 2.5rem);
        min-width: 70px;
        min-height: 70px;
    }
    
    /* Botões de sets - desktop (menores) */
    .sets-controls .btn-control {
        width: clamp(55px, 5vw, 80px);
        height: clamp(55px, 5vw, 80px);
        font-size: clamp(1.3rem, 2.5vw, 2rem);
        min-width: 55px;
        min-height: 55px;
    }
    
    .score-controls {
        gap: clamp(2rem, 4vw, 4rem);
        justify-content: space-evenly;
    }
    
    .sets-controls {
        gap: clamp(2rem, 4vw, 4rem);
        justify-content: space-evenly;
    }
    
    .score {
        min-width: clamp(120px, 25vw, 250px);
    }
}

/* Melhorias de Acessibilidade */
.btn:focus, .team-name:focus, .timer-section:focus, .sets-display:focus, .score:focus, .team-item:focus, .btn-control:focus {
    outline: 3px solid #667eea;
    outline-offset: 2px;
}

.btn-icon:focus {
    outline: 3px solid #667eea;
    outline-offset: 2px;
    background: rgba(0, 0, 0, 0.3);
}

.btn-control:focus {
    outline: 3px solid #667eea;
    outline-offset: 2px;
    transform: translateY(-2px);
}

/* Suporte para navegação por teclado */
.team-item:focus {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Estados de Loading/Disabled */
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn:disabled:hover {
    transform: none;
    box-shadow: none;
}

/* Feedback Visual para Long Press */
.long-press-active {
    animation: longPressScale 0.5s ease;
}

@keyframes longPressScale {
    0% { transform: scale(1); }
    50% { transform: scale(0.95); }
    100% { transform: scale(1); }
}

/* Cores padrão dos times */
.team-a-default {
    background-color: #e53935 !important;
    color: #ffffff !important;
}

.team-b-default {
    background-color: #1e88e5 !important;
    color: #ffffff !important;
}

/* Melhorias específicas para áudio e feedback tátil */
.audio-feedback {
    transition: transform 0.1s ease;
}

.audio-feedback:active {
    transform: scale(0.98);
}

/* Indicador visual quando som é reproduzido */
@keyframes audioFeedback {
    0% { background-color: rgba(255, 255, 255, 0.1); }
    50% { background-color: rgba(255, 255, 255, 0.3); }
    100% { background-color: rgba(255, 255, 255, 0.1); }
}

.playing-sound {
    animation: audioFeedback 0.3s ease;
}

/* Melhorias para iOS Safari */
@supports (-webkit-touch-callout: none) {
    .btn-control, .team-name, .btn {
        -webkit-tap-highlight-color: rgba(255, 255, 255, 0.2);
        -webkit-user-select: none;
        -webkit-touch-callout: none;
        user-select: none;
    }
    
    /* Força hardware acceleration em iOS */
    .team-section, .modal-content, .btn-control {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
    }
}

/* Otimizações para Android Chrome */
@media screen and (-webkit-min-device-pixel-ratio: 1) and (orientation: portrait) {
    .btn-control {
        /* Área de toque maior para dedos maiores */
        min-width: 48px;
        min-height: 48px;
    }
}

/* Melhorias específicas para tablets */
@media (min-width: 768px) and (max-width: 1024px) {
    .btn-control {
        /* Área de toque otimizada para tablets */
        min-width: 56px;
        min-height: 56px;
        font-size: clamp(1.2rem, 3vw, 1.8rem);
    }
    
    .team-name {
        /* Melhor area de toque para seleção de times */
        min-height: 56px;
        padding: 0.75rem 1rem;
    }
    
    .timer-section {
        /* Timer mais responsivo em tablets */
        padding: 1.5rem;
        font-size: clamp(2rem, 4vw, 3rem);
    }
}



/* Linha do cronômetro com botões ao lado */
.timer-row {
  display: flex;
  gap: 0.6rem;
  align-items: stretch;
  margin-bottom: 1rem;
}

/* o timer ocupa o espaço principal */
.timer-row .timer-section {
  flex: 1;
  margin: 0;            /* remove a margem inferior antiga */
}

/* coluna dos botões à direita do timer */
.ctrl-side {
  display: flex;
  flex-direction: row;  /* em telas estreitas, lado a lado */
  gap: 0.5rem;
  align-items: center;
}

/* botões redondos */
.circle-btn {
  width: 48px;
  height: 48px;
  min-width: 48px;
  min-height: 48px;
  border-radius: 50%;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: #eee;
  color: #333;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
  transition: transform .15s ease, box-shadow .15s ease, background .2s ease, color .2s ease;
}

.circle-btn i { font-size: 1.1rem; }

.circle-btn:active { transform: scale(0.97); }

/* status: desconectado (vermelho) / conectado (verde) */
.status-btn.disconnected { background: #ff6b6b; color: #fff; }
.status-btn.connected    { background: #2ecc71; color: #fff; }

/* settings */
.settings-btn { background: #6c63ff; color: #fff; }

/* responsivo: em telas muito estreitas, empilhar verticalmente os dois botões */
@media (max-width: 420px) {
  .ctrl-side { flex-direction: column; }
}
