body {
    background: #222;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
}
canvas {
    background: #b8e6f5;
    border: 8px solid #8b4513;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    max-width: 100%;
    height: auto;
}
#scoreBoard {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 40px;
    color: white;
    font-size: 20px;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
    z-index: 10;
}
#scoreBoard span {
    color: #ffd700;
}
#teamSelectionScreen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
    color: white;
}
#teamSelectionScreen.hidden {
    display: none;
}
.selection-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 20px auto;
    padding: 30px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    max-width: 800px;
    width: 90%;
}
.players-selection {
    display: flex;
    gap: 40px;
    width: 100%;
    margin-bottom: 20px;
}
.player-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.player-section h3 {
    margin: 0 0 15px 0;
    font-size: 20px;
}
.player-selected {
    margin-top: 10px;
    font-size: 14px;
    min-height: 25px;
}
.teams-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin: 15px 0;
    width: 100%;
}
.team-card {
    width: 140px;
    height: 140px;
    border: 3px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    background: rgba(255, 255, 255, 0.1);
}
.team-card:hover {
    transform: scale(1.1);
    border-color: #ffd700;
}
.team-card.selected {
    border-color: #00ff00;
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.5);
}
.team-card.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.team-icon {
    width: 100px;
    height: 100px;
    border-radius: 10px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    overflow: hidden;
}
.team-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 8px;
}
.team-name {
    font-size: 14px;
    font-weight: bold;
}
#startButton {
    margin-top: 30px;
    padding: 15px 40px;
    font-size: 20px;
    font-weight: bold;
    background: #00ff00;
    color: #000;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
}
#startButton:hover:not(:disabled) {
    background: #00cc00;
    transform: scale(1.05);
}
#startButton:disabled {
    background: #666;
    cursor: not-allowed;
}
.instructions {
    margin-top: 10px;
    font-size: 14px;
    color: #aaa;
    text-align: center;
}
#winScreen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 200;
}
#winScreen.show {
    display: flex;
}
#winScreen img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}
#instructionsButton {
    padding: 10px 20px;
    font-size: 16px;
    font-weight: bold;
    background: #0066cc;
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 20px;
}
#instructionsButton:hover {
    background: #0052a3;
    transform: scale(1.05);
}
#instructionsButtonGame {
    position: absolute;
    top: 20px;
    right: 20px;
    padding: 10px 20px;
    font-size: 16px;
    font-weight: bold;
    background: #0066cc;
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
    z-index: 50;
}
#instructionsButtonGame:hover {
    background: #0052a3;
    transform: scale(1.05);
}
#instructionsScreen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 150;
}
#instructionsScreen.show {
    display: flex;
}
#instructionsScreen img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}
#closeInstructions {
    position: absolute;
    top: 20px;
    right: 20px;
    padding: 10px 20px;
    font-size: 16px;
    font-weight: bold;
    background: #dc143c;
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
}
#closeInstructions:hover {
    background: #b01030;
    transform: scale(1.05);
}
#logo {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 250;
    max-width: 200px;
    max-height: 80px;
}
#logo img {
    width: 100%;
    height: auto;
}
#mobileControls1 {
    position: fixed;
    bottom: 15px;
    left: 15px;
    z-index: 100;
    display: none;
}
#mobileControls1.show {
    display: grid;
}
.control-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 8px;
    width: 180px;
    height: 180px;
}
.control-btn {
    background: rgba(255, 255, 255, 0.9);
    border: 4px solid #333;
    border-radius: 12px;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    touch-action: none;
    color: #000;
    box-shadow: 0 4px 8px rgba(0,0,0,0.4);
    min-width: 50px;
    min-height: 50px;
    -webkit-tap-highlight-color: transparent;
}
.control-btn:active {
    background: rgba(180, 180, 180, 0.95);
    transform: scale(0.9);
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}
.control-btn.empty {
    background: transparent;
    border: none;
    box-shadow: none;
    pointer-events: none;
}
#mobileControls2 {
    position: fixed;
    bottom: 15px;
    right: 15px;
    z-index: 100;
    display: none;
}
#mobileControls2.show {
    display: grid;
}
@media (max-width: 768px) {
    body {
        padding: 5px;
    }
    canvas {
        width: 90vw !important;
        max-width: 90vw !important;
        height: auto !important;
        border-width: 4px;
        margin: 0 auto;
    }
    #scoreBoard {
        top: 10px;
        font-size: 14px;
        gap: 20px;
    }
    #logo {
        max-width: 100px !important;
        max-height: 40px !important;
        top: 10px;
        left: 10px;
    }
    #instructionsButtonGame {
        top: 10px;
        right: 10px;
        padding: 8px 16px;
        font-size: 14px;
    }
    #teamSelectionScreen h1 {
        font-size: 24px !important;
        margin-bottom: 15px !important;
    }
    .selection-container {
        padding: 15px !important;
        max-width: 95% !important;
    }
    .team-card {
        width: 100px !important;
        height: 100px !important;
    }
    .team-icon {
        width: 70px !important;
        height: 70px !important;
    }
    .team-name {
        font-size: 12px !important;
    }
    .players-selection {
        gap: 20px !important;
    }
    .player-section h3 {
        font-size: 16px !important;
    }
    #startButton {
        padding: 12px 30px !important;
        font-size: 16px !important;
    }
    .control-grid {
        width: 140px;
        height: 140px;
    }
    .control-btn {
        font-size: 28px;
        min-width: 40px;
        min-height: 40px;
        border-width: 3px;
    }
    #mobileControls1 {
        bottom: 10px;
        left: 10px;
    }
    #mobileControls2 {
        bottom: 10px;
        right: 10px;
    }
    #mobileControls1.show, #mobileControls2.show {
        display: grid !important;
    }
}
@media (min-width: 769px) {
    #mobileControls1, #mobileControls2 {
        display: none !important;
    }
}

