﻿/* 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: #000000;
    overflow: hidden;
    position: fixed;
    /* width: 100vw; */
    /* max-width: 100vw; */
}

/* Layout Principal */
.scoreboard-container {
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height para mobile */
    display: flex;
    flex-direction: column;
    padding: 0;
    width: 100vw;
    max-width: 100vw;
    background: #000000;
    overflow: hidden;
    box-sizing: border-box;
}

/* Header */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100vw;
    max-width: 100vw;
    z-index: 1000;
    background: #000000;
    color: #ffffff;
    padding: clamp(0.4rem, 1.5vw, 0.6rem) clamp(0.5rem, 2vw, 0.75rem);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    min-height: 44px;
    max-height: 44px;
    box-sizing: border-box;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.app-icon {
    width: clamp(28px, 6vw, 32px);
    height: clamp(28px, 6vw, 32px);
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
}

.app-title {
    font-size: clamp(0.9rem, 2.5vw, 1.1rem);
    font-weight: 600;
    color: #ffffff;
    white-space: nowrap;
}

.header-right {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.header-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #ffffff;
    padding: clamp(0.35rem, 1.5vw, 0.5rem);
    border-radius: 0.5rem;
    font-size: clamp(0.75rem, 2vw, 0.85rem);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(0.3rem, 1.5vw, 0.5rem);
    transition: background 0.2s ease;
    min-height: 36px;
    max-height: 36px;
    min-width: 36px;
    width: 36px;
    white-space: nowrap;
    box-sizing: border-box;
}

.sport-btn {
    width: auto !important;
    min-width: auto !important;
    padding-left: clamp(0.5rem, 2vw, 0.65rem) !important;
    padding-right: clamp(0.5rem, 2vw, 0.65rem) !important;
}

.header-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.header-btn:active {
    background: rgba(255, 255, 255, 0.3);
}

.header-btn i {
    font-size: clamp(0.7rem, 1.8vw, 0.8rem);
}

.sport-btn span {
    font-size: clamp(0.75rem, 2vw, 0.85rem);
}

/* Container dos Times */
.teams-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0;
    margin: 0;
    padding-left: 0;
    padding-right: 0;
    min-height: 0;
    width: 100vw;
    max-width: 100vw;
    overflow-x: hidden;
    overflow-y: auto;
    padding-top: 50px; /* Espaço para header fixo */
    padding-bottom: 110px; /* Espaço para botão ZERAR (~60px) + bottom bar (~70px) fixos */
    box-sizing: border-box;
}

/* SeÃ§Ãµes dos Times */
.team-section {
    flex: 1 1 0;
    width: calc(100vw - 1rem);
    max-width: calc(100vw - 1rem);
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: #E53935;
    border-radius: clamp(0.5rem, 2vw, 1rem);
    padding: clamp(0.3rem, 1.2vw, 0.6rem);
    margin: clamp(0.25rem, 1vw, 0.4rem) 0.5rem;
    transition: all 0.3s ease;
    justify-content: space-between;
    box-sizing: border-box;
    overflow: hidden;
    position: relative;
}

.team-section.team-b {
    background: #1E88E5;
}

/* Removidos estilos hover da team-section para evitar confusÃ£o */

/* Nome do Time */
.team-name {
    position: absolute;
    font-size: clamp(0.85rem, 2.5vw, 1.1rem);
    font-weight: bold;
    text-align: center;
    margin-bottom: clamp(0.25rem, 1vw, 0.5rem);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    padding: clamp(0.25rem, 1vw, 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: calc(100% - 20px);
    min-width: 0;
    color: #ffffff;
    flex-shrink: 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: center;
    gap: clamp(0.25rem, 1vw, 0.5rem);
    margin: 0;
    width: 100%;
    flex: 1;
    min-height: 0;
    max-height: calc(100% - 55px); /* Reserva espaço para sets */
    padding: clamp(0.2rem, 1vw, 0.4rem);
    box-sizing: border-box;
}

.score {
    font-size: clamp(4rem, 18vh, 12rem);
    font-weight: 900;
    text-align: center;
    line-height: 0.75;
    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;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
    color: #ffffff;
    flex: 1;
    min-width: 0;
    max-height: 100%;
    max-width: 100%;
    /* overflow: hidden; */
    transform: scale(0.95);
    word-break: keep-all;
    box-sizing: border-box;
}

/* Controles de Sets */
.sets-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(0.3rem, 1.2vw, 0.6rem);
    /* margin-top: clamp(0.15rem, 0.8vw, 0.3rem); */
    width: 100%;
    flex-shrink: 0;
    /*padding-top: clamp(0.15rem, 0.8vw, 0.3rem); /* Espaço extra para evitar sobreposição */
}

.sets-display {
    font-size: clamp(0.75rem, 1.8vw, 0.95rem);
    font-weight: bold;
    text-align: center;
    padding: clamp(0.15rem, 0.7vw, 0.35rem) clamp(0.35rem, 1.3vw, 0.65rem);
    border-radius: 0.35rem;
    background: rgba(0, 0, 0, 0.1);
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    min-width: clamp(50px, 11vw, 70px);
}

.sets-controls .btn-control {
    width: clamp(30px, 6.5vw, 38px);
    height: clamp(30px, 6.5vw, 38px);
    min-width: 30px;
    min-height: 30px;
    max-width: 38px;
    max-height: 38px;
    font-size: clamp(0.75rem, 1.8vw, 0.95rem);
}

/* BotÃµes de Controle +/- */
.btn-control {
    background: #ffffff;
    border: none;
    color: #000000;
    border-radius: 50%;
    width: clamp(42px, 9vw, 55px);
    height: clamp(42px, 9vw, 55px);
    min-width: 42px;
    min-height: 42px;
    max-width: 55px;
    max-height: 55px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: clamp(0.95rem, 3.2vw, 1.4rem);
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: transform 0.1s ease, box-shadow 0.1s ease;
    box-sizing: border-box;
}

.btn-control:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.btn-control:active {
    transform: scale(0.95);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.btn-plus {
    background: #2ecc71;
    color: #ffffff;
}

.btn-plus:hover {
    background: #27ae60;
}

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

.btn-minus {
    background: #e74c3c;
    color: #ffffff;
}

.btn-minus:hover {
    background: #c0392b;
}

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

/* 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(4rem, 18vh, 12rem);
        padding: 0;
        margin: 0;
        flex: 1;
        order: 0;
        text-align: center;
        min-width: 0;
        line-height: 5;
        font-weight: 900;
        max-height: 100%;
        max-width: 100%;
        overflow: hidden;
        word-break: keep-all;
        transform: scale(0.95);
        box-sizing: border-box;
    }
    
    .score-controls {
        max-height: calc(100% - 55px);
        padding: clamp(0.2rem, 1vw, 0.4rem);
        gap: clamp(0.25rem, 1vw, 0.5rem);
        box-sizing: border-box;
    }
    
    .score-controls .btn-control {
        width: clamp(42px, 9vw, 55px);
        height: clamp(42px, 9vw, 55px);
        max-width: 55px;
        max-height: 55px;
        font-size: clamp(0.95rem, 3.2vw, 1.4rem);
    }
    
    .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.3rem, 1.2vw, 0.6rem);
        margin-top: clamp(0.15rem, 0.8vw, 0.3rem);
        padding-top: clamp(0.15rem, 0.8vw, 0.3rem);
    }
    
    .sets-display {
        padding: clamp(0.15rem, 0.7vw, 0.35rem) clamp(0.35rem, 1.3vw, 0.65rem);
        font-size: clamp(0.75rem, 1.8vw, 0.95rem);
        min-width: clamp(50px, 11vw, 70px);
    }
    
    .sets-controls .btn-control {
        width: clamp(30px, 6.5vw, 38px);
        height: clamp(30px, 6.5vw, 38px);
        max-width: 38px;
        max-height: 38px;
        font-size: clamp(0.75rem, 1.8vw, 0.95rem);
    }
    
    /* 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.25rem;
        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;
    }
}

/* Bloco landscape antigo removido - Nova versao landscape implementada abaixo */

/* NOVA Mobile Landscape Otimizada - Times lado a lado */
@media (orientation: landscape) and (max-height: 768px) {
    .scoreboard-container {
        display: grid !important;
        grid-template-rows: auto 1fr auto !important;
        grid-template-columns: minmax(auto, 22%) 1fr !important;
        height: 100vh !important;
        height: 100dvh !important;
        padding: 0 !important;
        overflow: hidden !important;
        gap: 0 !important;
        column-gap: clamp(0.4rem, 1vw, 0.6rem) !important;
    }
    
    /* Header ocupa toda a largura */
    .scoreboard-container > .app-header {
        grid-row: 1 !important;
        grid-column: 1 / -1 !important;
    }
    
    /* Teams container ocupa toda a largura */
    .scoreboard-container > .teams-container {
        grid-row: 2 !important;
        grid-column: 1 / -1 !important;
    }
    
    /* ZERAR na esquerda da última linha */
    .scoreboard-container > .btn-reset {
        grid-row: 3 !important;
        grid-column: 1 !important;
    }
    
    /* Bottom bar ocupa o restante da última linha */
    .scoreboard-container > .bottom-bar {
        grid-row: 3 !important;
        grid-column: 2 !important;
    }
    
    .app-header {
        min-height: 36px !important;
        max-height: 36px !important;
        padding: 0.3rem 0.5rem !important;
        flex-shrink: 0 !important;
    }
    
    .app-icon {
        width: 30px !important;
        height: 30px !important;
    }
    
    .app-title {
        font-size: 0.9rem !important;
    }
    
    .header-btn {
        min-height: 36px !important;
        max-height: 36px !important;
        min-width: 36px !important;
        width: auto !important;
    }
    
    .sport-btn {
        padding-left: 0.6rem !important;
        padding-right: 0.6rem !important;
        gap: 0.4rem !important;
    }
    
    .header-right {
        gap: 0.6rem !important;
    }
    
    .teams-container {
        flex: 1 !important;
        display: flex !important;
        flex-direction: row !important;
        gap: clamp(0.4rem, 1vw, 0.6rem) !important;
        padding: clamp(0.4rem, 1vw, 0.6rem) !important;
        padding-top: clamp(2.5rem, 2.5vh, 1.25rem) !important;
        overflow-y: visible !important;
        overflow-x: hidden !important;
        min-height: 0 !important;
        margin: 0 !important;
    }
    
    .team-section {
        flex: 1 !important;
        width: calc(50% - 0.2rem) !important;
        max-width: calc(50% - 0.2rem) !important;
        min-height: clamp(180px, 50vh, 400px) !important;
        height: 100% !important;
        margin: 0 !important;
        padding: clamp(0.6rem, 2vh, 1.2rem) !important;
        border-radius: clamp(0.5rem, 2vw, 1rem) !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: space-between !important;
        overflow: hidden !important;
    }
    
    .team-name {
        font-size: clamp(0.9rem, 2.5vw, 1.2rem) !important;
        font-weight: bold !important;
        margin-bottom: clamp(0.3rem, 1vw, 0.5rem) !important;
        padding: clamp(0.3rem, 1vw, 0.5rem) !important;
        flex-shrink: 0 !important;
        display: block !important;
        text-align: center !important;
        visibility: visible !important;
    }
    
    .score-controls {
        flex-direction: row !important;
        gap: clamp(0.5rem, 2vw, 1rem) !important;
        align-items: center !important;
        justify-content: space-between !important;
        /* padding: clamp(0.5rem, 2vw, 1rem) 0 !important; */
        flex: 1 !important;
        min-height: 0 !important;
        /* margin: clamp(0.5rem, 2vw, 1rem) 0 !important; */
    }
    
    .score {
        font-size: clamp(2.5rem, 100vh, 27rem) !important;
        font-weight: 900 !important;
        padding: 0 !important;
        /* padding-bottom: 40px !important; */
        padding-top: 60px !important;
        flex: 1 !important;
        order: 0 !important;
        min-width: 0 !important;
        line-height: 0.9 !important;
        /* transform: scale(3) !important; */
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        text-shadow: 4px 4px 8px rgba(0, 0, 0, 0.4) !important;
    }
    
    .score-buttons {
        display: contents !important;
    }
    
    .score-buttons .btn-minus {
        order: -1 !important;
    }
    
    .score-buttons .btn-plus {
        order: 1 !important;
    }
    
    .sets-controls {
        gap: clamp(0.4rem, 1.5vw, 0.7rem) !important;
        /* margin-top: clamp(0.3rem, 1vw, 0.5rem) !important; */
        /* padding-top: clamp(0.3rem, 1vw, 0.5rem) !important; */
        flex-shrink: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        visibility: visible !important;
    }
    
    .sets-display {
        font-size: clamp(0.8rem, 2vw, 1rem) !important;
        font-weight: bold !important;
        padding: clamp(0.25rem, 1vw, 0.4rem) clamp(0.5rem, 1.5vw, 0.75rem) !important;
        min-width: clamp(60px, 12vw, 80px) !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        visibility: visible !important;
        border-radius: 0.35rem !important;
        background: rgba(0, 0, 0, 0.1) !important;
    }
    
    .score-controls .btn-control {
        min-width: 50px !important;
        min-height: 50px !important;
        width: clamp(50px, 8vh, 70px) !important;
        height: clamp(50px, 8vh, 70px) !important;
        font-size: clamp(1.2rem, 3vh, 1.8rem) !important;
        font-weight: bold !important;
        flex-shrink: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        visibility: visible !important;
        border-radius: 50% !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2) !important;
    }
    
    .sets-controls .btn-control {
        min-width: 40px !important;
        min-height: 40px !important;
        width: clamp(40px, 7vh, 55px) !important;
        height: clamp(40px, 7vh, 55px) !important;
        font-size: clamp(0.9rem, 2.5vh, 1.2rem) !important;
        font-weight: bold !important;
        flex-shrink: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        visibility: visible !important;
        border-radius: 50% !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2) !important;
    }
    
    /* Botão ZERAR - primeira coluna da linha de controles */
    .btn-reset {
        position: relative !important;
        bottom: auto !important;
        left: auto !important;
        right: auto !important;
        width: auto !important;
        min-width: fit-content !important;
        max-width: 22% !important;
        padding: clamp(0.5rem, 1.5vw, 0.7rem) clamp(0.8rem, 2vw, 1.1rem) !important;
        font-size: clamp(0.7rem, 1.6vw, 0.85rem) !important;
        font-weight: bold !important;
        min-height: 44px !important;
        max-height: 50px !important;
        height: auto !important;
        border-radius: 0.5rem !important;
        margin: 0 0 clamp(0.4rem, 1vw, 0.6rem) clamp(0.4rem, 1vw, 0.6rem) !important;
        white-space: nowrap !important;
        align-self: center !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 0.3rem !important;
    }
    
    /* Bottom bar - segunda coluna da linha de controles */
    .bottom-bar {
        position: relative !important;
        bottom: auto !important;
        left: auto !important;
        right: auto !important;
        width: 100% !important;
        max-width: none !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: flex-start !important;
        padding: clamp(0.4rem, 1.5vw, 0.6rem) clamp(0.5rem, 1.5vw, 0.75rem) !important;
        min-height: 44px !important;
        max-height: 50px !important;
        height: auto !important;
        gap: clamp(0.4rem, 1vw, 0.6rem) !important;
        margin: 0 clamp(0.4rem, 1vw, 0.6rem) clamp(0.4rem, 1vw, 0.6rem) 0 !important;
        border-radius: 0.5rem !important;
        background: #000000 !important;
        border-top: none !important;
        overflow: hidden !important;
    }
    
    .timer-display {
        flex: 1 !important;
        min-width: 0 !important;
        padding: clamp(0.4rem, 1.5vw, 0.6rem) clamp(0.5rem, 1.5vw, 0.7rem) !important;
        font-size: clamp(0.8rem, 2vw, 0.95rem) !important;
        font-weight: bold !important;
        min-height: 40px !important;
        border-radius: 0.4rem !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }
    
    .btn-play {
        width: clamp(40px, 7vw, 44px) !important;
        height: clamp(40px, 7vw, 44px) !important;
        min-width: 40px !important;
        min-height: 40px !important;
        font-size: clamp(0.9rem, 2.2vw, 1.05rem) !important;
        flex-shrink: 0 !important;
    }
    
    .btn-record {
        flex: 0 0 auto !important;
        min-width: fit-content !important;
        max-width: 38% !important;
        padding: clamp(0.4rem, 1.2vw, 0.55rem) clamp(0.6rem, 1.6vw, 0.8rem) !important;
        font-size: clamp(0.7rem, 1.6vw, 0.85rem) !important;
        font-weight: bold !important;
        min-height: 40px !important;
        gap: clamp(0.25rem, 0.7vw, 0.4rem) !important;
        border-radius: 0.4rem !important;
        white-space: nowrap !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    .btn-record i {
        flex-shrink: 0 !important;
        font-size: 1em !important;
    }
    
    .btn-record span {
        display: inline !important;
    }
}

/* Landscape muito baixo (altura < 400px) - Ajustes extras */
@media (orientation: landscape) and (max-height: 400px) {
    .app-header {
        min-height: 32px !important;
        max-height: 32px !important;
        padding: 0.2rem 0.4rem !important;
    }
    
    .app-icon {
        width: 26px !important;
        height: 26px !important;
    }
    
    .app-title {
        font-size: 0.8rem !important;
    }
    
    .header-btn {
        min-height: 32px !important;
        max-height: 32px !important;
        min-width: 32px !important;
    }
    
    .sport-btn {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }
    
    .header-right {
        gap: 0.4rem !important;
    }
    
    .teams-container {
        /* padding-top: clamp(0.6rem, 2vh, 1rem) !important; */
    }
    
    .team-section {
        min-height: 150px !important;
        padding: clamp(0.4rem, 1.5vh, 0.8rem) !important;
    }
    
    .team-name {
        font-size: clamp(0.8rem, 2vw, 1rem) !important;
        margin-bottom: 0.2rem !important;
    }
    
    .score {
        font-size: clamp(2.4rem, 100vh, 10.6rem) !important;
    }
    
    .score-controls .btn-control {
        min-width: 40px !important;
        min-height: 40px !important;
        width: clamp(40px, 6vh, 50px) !important;
        height: clamp(40px, 6vh, 50px) !important;
    }
    
    .sets-controls .btn-control {
        min-width: 32px !important;
        min-height: 32px !important;
        width: clamp(32px, 5vh, 40px) !important;
        height: clamp(32px, 5vh, 40px) !important;
    }
    
    .sets-display {
        font-size: 0.75rem !important;
        padding: 0.2rem 0.4rem !important;
    }
    
    .btn-reset,
    .bottom-bar {
        min-height: 40px !important;
        max-height: 44px !important;
    }
    
    .btn-reset {
        font-size: 0.65rem !important;
        padding: 0.4rem 0.65rem !important;
        max-width: 20% !important;
        min-width: fit-content !important;
    }
    
    .timer-display {
        font-size: 0.7rem !important;
        padding: 0.3rem 0.4rem !important;
        min-width: 0 !important;
    }
    
    .btn-play {
        width: 38px !important;
        height: 38px !important;
        min-width: 38px !important;
        min-height: 38px !important;
    }
    
    .btn-record {
        font-size: 0.6rem !important;
        padding: 0.35rem 0.55rem !important;
        max-width: 35% !important;
        min-width: fit-content !important;
    }
    
    .btn-record span {
        display: inline !important;
    }
}

/* Botão ZERAR */
.btn-reset {
    position: fixed;
    bottom: 70px; /* Acima da bottom bar */
    left: 0.5rem;
    right: 0.5rem;
    width: calc(100vw - 1rem);
    max-width: calc(100vw - 1rem);
    background: #ff6b35;
    color: #ffffff;
    border: none;
    border-radius: 0.5rem;
    padding: clamp(0.75rem, 2vw, 1rem);
    font-size: clamp(0.9rem, 2.5vw, 1.1rem);
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: background 0.2s ease, transform 0.1s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-height: 44px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    z-index: 999;
    box-sizing: border-box;
}

.btn-reset:hover {
    background: #e55a2b;
}

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

/* Barra Inferior */
.bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100vw;
    max-width: 100vw;
    z-index: 1000;
    background: #000000;
    padding: clamp(0.75rem, 2vw, 1rem) clamp(0.5rem, 2vw, 0.75rem);
    display: flex;
    align-items: center;
    gap: clamp(0.5rem, 2vw, 0.75rem);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    min-height: 60px;
    box-sizing: border-box;
    overflow: hidden;
}

.timer-display {
    background: #ffffff;
    color: #000000;
    border-radius: 0.5rem;
    padding: clamp(0.5rem, 2vw, 0.75rem) clamp(0.75rem, 3vw, 1rem);
    font-size: clamp(0.9rem, 2.5vw, 1.2rem);
    font-weight: bold;
    cursor: pointer;
    flex: 1;
    text-align: center;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.timer-display:hover {
    background: #f0f0f0;
}

.timer-display:active {
    background: #e0e0e0;
}

.btn-play {
    width: clamp(44px, 10vw, 50px);
    height: clamp(44px, 10vw, 50px);
    min-width: 44px;
    min-height: 44px;
    border-radius: 50%;
    background: #9b59b6;
    color: #ffffff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(1rem, 3vw, 1.2rem);
    transition: background 0.2s ease, transform 0.1s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.btn-play:hover {
    background: #8e44ad;
}

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

.btn-record {
    color: #ffffff;
    border: none;
    border-radius: 0.5rem;
    padding: clamp(0.5rem, 2vw, 0.75rem) clamp(0.5rem, 2vw, 0.75rem);
    font-size: clamp(0.75rem, 1.8vw, 0.95rem);
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(0.25rem, 1vw, 0.5rem);
    min-height: 44px;
    transition: background 0.2s ease, transform 0.1s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    /* Estado padrão: vermelho (sem câmera) */
    background: #e74c3c;
    flex-shrink: 1;
    white-space: nowrap;
    box-sizing: border-box;
    overflow: hidden;
}

.btn-record:hover {
    background: #c0392b;
}

/* Câmera conectada = verde */
.btn-record.has-camera {
    background: #2ecc71;
}

.btn-record.has-camera:hover {
    background: #27ae60;
}

/* Sem câmera = vermelho (explicitamente) */
.btn-record.no-camera {
    background: #e74c3c;
}

.btn-record.no-camera:hover {
    background: #c0392b;
}

/* Salvando = azul pulsante */
.btn-record.saving {
    background: #3498db;
    pointer-events: none;
    cursor: not-allowed;
    animation: pulse 1s ease infinite;
}

/* Salvo = azul pulsante (mesma cor e efeito) */
.btn-record.saved {
    background: #3498db;
    pointer-events: none;
    cursor: not-allowed;
    animation: pulse 1s ease infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

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

.btn-record:disabled {
    opacity: 0.9;
    cursor: not-allowed;
}

/* 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-overlay {
    backdrop-filter: blur(4px);
    background: rgba(0, 0, 0, 0.7);
}

.menu-modal .modal-content {
    max-width: 480px;
    background: #ffffff;
    border-radius: 1.5rem;
    padding: 0;
    overflow: hidden;
}

.menu-modal .modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    padding: 1rem 1.5rem;
    border-bottom: none;
}

.menu-modal .modal-header h3 {
    color: #ffffff;
}

.menu-modal .modal-body {
    padding: 1.5rem;
}

/* Grid de Cards do Menu */
.menu-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

.menu-card {
    background: #ffffff;
    border: 2px solid rgba(102, 126, 234, 0.2);
    border-radius: 1rem;
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    min-height: 120px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.menu-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.25);
    border-color: rgba(102, 126, 234, 0.6);
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
}

.menu-card:active {
    transform: translateY(-2px);
}

.menu-card-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 1.5rem;
    transition: transform 0.3s ease;
}

.menu-card:hover .menu-card-icon {
    transform: scale(1.1) rotate(5deg);
}

.menu-card-label {
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
    line-height: 1.3;
    color: #333;
}

.menu-card-exit {
    border-color: rgba(231, 76, 60, 0.3);
}

.menu-card-exit:hover {
    border-color: rgba(231, 76, 60, 0.6);
    background: rgba(231, 76, 60, 0.05);
}

.menu-card-exit .menu-card-icon {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
}

/* Opções Avançadas (ocultas) */
.menu-advanced {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 2px solid rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    overflow: hidden;
    transition: all 0.3s ease;
    opacity: 1;
    max-height: 1000px;
}

/* AngularJS ng-show/ng-hide animation */
.menu-advanced.ng-hide-add,
.menu-advanced.ng-hide-remove {
    transition: all 0.3s ease;
}

.menu-advanced.ng-hide {
    opacity: 0;
    max-height: 0;
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

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

.menu-btn-small {
    width: 100%;
    font-size: 0.9rem;
    padding: 0.6rem 1rem;
}

/* Botão Toggle Avançadas */
.btn-toggle-advanced {
    width: 100%;
    background: rgba(102, 126, 234, 0.1);
    border: 2px solid rgba(102, 126, 234, 0.3);
    color: #667eea;
    font-weight: 600;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
    font-size: 0.9rem;
    position: relative;
    z-index: 10;
    pointer-events: auto;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    min-height: 44px;
}

.btn-toggle-advanced:hover {
    background: rgba(102, 126, 234, 0.2);
    border-color: rgba(102, 126, 234, 0.5);
    transform: translateY(-2px);
}

.btn-toggle-advanced:active {
    transform: translateY(0);
    background: rgba(102, 126, 234, 0.3);
}

.btn-toggle-advanced i {
    font-size: 0.8rem;
    pointer-events: none;
}

/* Responsividade do Menu */
@media (max-width: 480px) {
    .menu-modal .modal-content {
        max-width: 95vw;
    }
    
    .menu-grid {
        gap: 0.75rem;
    }
    
    .menu-card {
        min-height: 100px;
        padding: 1rem 0.75rem;
    }
    
    .menu-card-icon {
        width: 48px;
        height: 48px;
        font-size: 1.25rem;
    }
    
    .menu-card-label {
        font-size: 0.85rem;
    }
}

@media (max-width: 360px) {
    .menu-card {
        min-height: 90px;
        padding: 0.75rem 0.5rem;
    }
    
    .menu-card-icon {
        width: 44px;
        height: 44px;
        font-size: 1.1rem;
    }
    
    .menu-card-label {
        font-size: 0.8rem;
    }
}

/* 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;
}

/* Modal de Status das Câmeras */
.camera-status-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1rem;
}

.camera-status-icon {
    font-size: 4rem;
    color: #e74c3c;
    margin-bottom: 1rem;
}

.camera-status-icon i.fa-video {
    color: #27ae60;
}

.camera-status-message h4 {
    margin-bottom: 0.5rem;
    font-size: 1.3rem;
    color: #333;
}

.camera-status-message p {
    margin-bottom: 0.8rem;
    color: #666;
}

.camera-instructions {
    text-align: left;
    max-width: 300px;
    margin: 1rem auto;
}

.camera-instructions li {
    margin-bottom: 0.5rem;
    color: #555;
}

.camera-instructions code {
    background: #f8f9fa;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    border: 1px solid #dee2e6;
    font-family: monospace;
    color: #e83e8c;
    font-weight: bold;
}

.text-muted {
    color: #6c757d !important;
    font-size: 0.9rem;
    font-style: italic;
}

/* 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; }
}
