* {
    font-family: sans-serif;
    font-size: 14px;
    touch-action: manipulation; /* Prevent double-tap zoom */
}

html, body {
    background-color: #222;
    overflow: hidden;
}

html, body, canvas {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    background: rgba(0, 0, 0, 0.4);

}

canvas, #cvs {
    touch-action: none; /* Prevent all touch gestures on canvas (pinch zoom, double-tap zoom) */
}

div {
    -webkit-user-select: none; /* webkit (safari, chrome) browsers */
    -moz-user-select: none; /* mozilla browsers */
    -khtml-user-select: none; /* webkit (konqueror) browsers */
    -ms-user-select: none; /* IE10+ */
}

#split, #feed {
    touch-action: manipulation; /* Prevent double-tap zoom */
    -webkit-tap-highlight-color: transparent; /* Remove tap highlight on mobile */
}

#split {
    position: absolute;
    bottom: 10px;
    left: 10px;
    width: 100px;
    height: 100px;
    padding: 5px;
    border: none;
}

#feed {
    position: absolute;
    bottom: 10px;
    right: 10px;
    width: 100px;
    height: 100px;
    padding: 5px;
    border: none;
}

.zoomBtn {
    position: absolute;
    width: 60px;
    height: 60px;
    border: none;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.6);
    color: white;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    touch-action: manipulation; /* Prevent double-tap zoom */
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0;
    text-align: center;
}

.zoomBtn:active {
    background-color: rgba(0, 0, 0, 0.8);
    transform: scale(0.95);
}

#zoomIn {
    bottom: 120px;
    right: 10px;
}

#zoomOut {
    bottom: 200px;
    right: 10px;
}

#skinSelector {
    margin: 10px 0;
}

#skinSelector label {
    display: block;
    margin-bottom: 5px;
    color: #333;
    font-weight: bold;
}

#skinCarousel {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    gap: 10px;
}

#skinPreview {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 120px;
}

#skinPreviewImg {
    width: 80px;
    height: 80px;
    object-fit: contain;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.1);
}

#skinName {
    margin-top: 5px;
    font-size: 12px;
    color: #333;
    text-align: center;
    max-width: 120px;
    word-wrap: break-word;
}

.skinNav {
    width: 40px;
    height: 40px;
    font-size: 24px;
    border: 1px solid #dcdcdc;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.skinNav:hover {
    background: #f0f0f0;
}

.skinNav:active {
    background: #e0e0e0;
}

#skinDropdownWrapper {
    position: relative;
    max-width: 250px;
    margin: 0 auto;
}

#skinSearch {
    width: 100%;
    padding: 8px;
    margin-bottom: 5px;
    border: solid 1px #dcdcdc;
    background: #fff;
    color: #333;
    border-radius: 4px;
    box-sizing: border-box;
    transition: box-shadow 0.3s, border 0.3s;
}

#skinSearch:focus {
    outline: none;
    border: solid 1px #CCCCCC;
    box-shadow: 0 0 3px 1px #DDDDDD;
}

#skinSelect {
    width: 100%;
    padding: 5px;
    border: solid 1px #dcdcdc;
    background: #fff;
    color: #333;
    border-radius: 4px;
    max-height: 90px;
    overflow-y: auto;
    box-sizing: border-box;
}

#skinSelect option {
    padding: 5px;
    background: #fff;
}

#skinSelect option:hover,
#skinSelect option:focus {
    background: #f0f0f0;
}

.leaderboard-skin {
    width: 20px;
    height: 20px;
    vertical-align: middle;
    margin-right: 5px;
    border-radius: 50%;
    touch-action: manipulation; /* Prevent double-tap zoom */
}

#status {
    position: absolute;
    padding: 10px;
    background: rgba(0, 0, 0, 0.4);
    color: #FFF;
    font-size: 16.1px;
    top: 10px;
    right: 10px;
    font-weight: bold;
    text-align: center;
    touch-action: manipulation; /* Prevent double-tap zoom */
}

#status .title {
    font-size: 25px;
}

#status .me {
    color: #FF8888;
    font-size: 16.1px;
}

.chatbox {
    position: absolute;
    width: 300px;
    height: 320px;
    background: rgba(22, 22, 22, 0.7);
    bottom: 5px;
    left: 5px;
    border-radius: 5px;
    pointer-events: none;
}

.chatbox .chat-list {
    padding: 5px;
    margin: 0;
    list-style: none;
    box-sizing: border-box;
    height: 285px;
    overflow: hidden;
}

.chatbox .chat-list li {
    padding: 2px;
    margin: 3px;
}

.chatbox .chat-list li.me b {
    color: #ea6153;
}

.chatbox .chat-list li.friend b {
    color: #2ecc71;
}

.chatbox .chat-list li.system {
    color: #9b59b6;
    font-style: italic;
}

.chatbox .chat-list li.system:before {
    content: "» ";
}

.chatbox .chat-input {
    pointer-events: all;
    box-sizing: border-box;
    width: 100%;
    padding: 8px;
    background: transparent;
    border: none;
    border-top: 1px solid #DDD;
    outline: none;
}

#startMenu {
    position: relative;
    margin: auto;
    margin-top: 70px; /* Account for navbar (50px) + spacing */
    width: 90%;
    max-width: 350px;
    padding: 20px;
    max-height: calc(85vh - 70px); /* Account for navbar */
    overflow-y: auto;
    border-radius: 5px;
    -moz-border-radius: 5px;
    -webkit-border-radius: 5px;
    background-color: rgba(255, 255, 255, 0.95); /* Semi-transparent white overlay for readability */
    box-sizing: border-box;
    background-image: url('../img/background.PNG');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-blend-mode: overlay; /* Blend background with overlay */
}

.startMenu-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.startMenu-left,
.startMenu-right {
    width: 100%;
}

/* Play button positioning */
.startMenu-playButton-mobile {
    display: none; /* Hidden on desktop */
    flex-direction: column;
    gap: 10px;
}

.leaderboard-button-mobile {
    width: 100%;
    height: 40px;
    box-sizing: border-box;
    font-size: large;
    color: white;
    text-align: center;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
    background: #3498db;
    border: 0;
    border-bottom: 2px solid #2980b9;
    cursor: pointer;
    -webkit-box-shadow: inset 0 -2px #2980b9;
    box-shadow: inset 0 -2px #2980b9;
    border-radius: 5px;
    -moz-border-radius: 5px;
    -webkit-border-radius: 5px;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.leaderboard-button-mobile:active, .leaderboard-button-mobile:hover {
    background: #5dade2;
    outline: none;
    -webkit-box-shadow: none;
    box-shadow: none;
    transform: translateY(1px);
}

.startMenu-playButton-desktop {
    display: block;
}

.startMenu-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 10px;
}

.startMenu-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

#startMenu p {
    padding: 0;
    text-align: center;
    font-size: x-large;
    font-weight: bold;
    margin: 0;
}

#playerCount {
    text-align: center;
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
    font-weight: normal;
}

#playerNameInput {
    width: 100%;
    text-align: center;
    padding: 10px;
    border: solid 1px #dcdcdc;
    transition: box-shadow 0.3s, border 0.3s;
    box-sizing: border-box;
    border-radius: 5px;
    -moz-border-radius: 5px;
    -webkit-border-radius: 5px;
    margin-bottom: 10px;
    outline: none;
}

#playerNameInput:focus, #playerNameInput.focus {
    border: solid 1px #CCCCCC;
    box-shadow: 0 0 3px 1px #DDDDDD;
}

#startButton, #startButtonDesktop, #spectateButton {
    position: relative;
    margin: auto;
    margin-top: 10px;
    width: 100%;
    height: 40px;
    box-sizing: border-box;
    font-size: large;
    color: white;
    text-align: center;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
    background: #2ecc71;
    border: 0;
    border-bottom: 2px solid #28be68;
    cursor: pointer;
    -webkit-box-shadow: inset 0 -2px #28be68;
    box-shadow: inset 0 -2px #28be68;
    border-radius: 5px;
    -moz-border-radius: 5px;
    -webkit-border-radius: 5px;
    margin-bottom: 10px;
}

#spectateButton:active, #spectateButton:hover,
#startButton:active, #startButton:hover,
#startButtonDesktop:active, #startButtonDesktop:hover {
    top: 1px;
    background: #55D88B;
    outline: none;
    -webkit-box-shadow: none;
    box-shadow: none;
}

#settingsButton {
    position: relative;
    margin: auto;
    margin-top: 10px;
    width: 100%;
    height: 40px;
    box-sizing: border-box;
    font-size: large;
    color: white;
    text-align: center;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
    background: #2ecc71;
    border: 0;
    border-bottom: 2px solid #28be68;
    cursor: pointer;
    -webkit-box-shadow: inset 0 -2px #28be68;
    box-shadow: inset 0 -2px #28be68;
    border-radius: 5px;
    -moz-border-radius: 5px;
    -webkit-border-radius: 5px;
    margin-bottom: 10px;
}

#settingsButton:active, #settingsButton:hover {
    top: 1px;
    background: #55D88B;
    outline: none;
    -webkit-box-shadow: none;
    box-shadow: none;
}


/* Hide navbar when start menu wrapper is collapsed */
#startMenuWrapper {
    overflow: hidden;
}

/* Ensure navbar is hidden when start menu is collapsed */
#startMenuWrapper[style*="max-height: 0px"] #gameNavbar,
#startMenuWrapper[style*="max-height:0px"] #gameNavbar {
    display: none !important;
    visibility: hidden;
}

#settings {
    max-height: 0;
}

#startMenu h3 {
    padding-bottom: 0;
    margin-bottom: 0;
}

#startMenu ul {
    margin: 10px;
    padding: 10px;
    margin-top: 0;
}

#startMenu .input-error {
    color: red;
    opacity: 0;
    font-size : 12px;
}

#startMenuWrapper {
    z-index: 2;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow-y: auto;
    background-color: rgba(73, 72, 72, 0.75);
    background-image: url('../img/background.PNG');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-blend-mode: overlay; /* Blend background with overlay */
}

#gameAreaWrapper {
    position: absolute !important;
    top: 0;
    left: 0;
    opacity: 0;
    width: 100%;
    height: 100%;
}

/* Navbar Styles - Only visible on start menu, hidden on mobile */
#gameNavbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 50px;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    box-sizing: border-box;
    z-index: 3;
    pointer-events: auto;
}

/* Hide navbar on mobile */
@media only screen and (max-width: 768px) {
    #gameNavbar {
        display: none !important;
    }
    
    /* Adjust start menu when navbar is hidden */
    #startMenu {
        margin-top: 20px;
        max-height: 90vh;
    }
}

.navbar-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.navbar-logo {
    width: 35px;
    height: 35px;
    object-fit: contain;
}

.navbar-title {
    color: #FFF;
    font-size: 18px;
    font-weight: bold;
}

.navbar-title-link {
    color: #FFF;
    font-size: 18px;
    font-weight: bold;
    text-decoration: none;
    margin-left: 10px;
    transition: opacity 0.2s;
}

.navbar-title-link:hover {
    opacity: 0.8;
}

.navbar-tabs {
    display: flex;
    gap: 15px;
    align-items: center;
}

.navbar-tab {
    color: #FFF;
    text-decoration: none;
    font-size: 14px;
    padding: 8px 15px;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.navbar-tab:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

#deathOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.1);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

#deathMessage {
    font-size: 48px;
    font-weight: bold;
    color: #3d0f0f;
    text-shadow: 2px 2px 4px rgba(255, 255, 255, 0.8);
    text-align: center;
    position: absolute;
    top: 30%;
    left: 50%;
    transform: translateX(-50%);
}

#errorOverlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 11;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

#errorMessage {
    font-size: 24px;
    font-weight: bold;
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    text-align: center;
    max-width: 90%;
    word-wrap: break-word;
    overflow-wrap: break-word;
    margin-bottom: 30px;
    line-height: 1.4;
}

.refreshBtn {
    padding: 15px 30px;
    font-size: 18px;
    font-weight: bold;
    color: white;
    background-color: #4CAF50;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    touch-action: manipulation; /* Prevent double-tap zoom */
    transition: background-color 0.3s;
}

.refreshBtn:hover {
    background-color: #45a049;
}

.refreshBtn:active {
    background-color: #3d8b40;
    transform: scale(0.95);
}

@media only screen  and (min-width : 1224px) {
#mobile {
display: none;
	}
}

@media only screen  and (max-width : 1224px) {
#chatbox {
display: none;
        }
}

/* Responsive design for mobile */
@media only screen and (max-width: 768px) {
    #startMenu {
        margin-top: 20px;
        padding: 15px;
        max-height: 90vh;
    }
    
    .startMenu-logo {
        width: 30px;
        height: 30px;
    }
    
    #startMenu p {
        font-size: large;
    }
    
    #gameNavbar {
        height: 45px;
        padding: 0 10px;
    }
    
    .navbar-logo {
        width: 28px;
        height: 28px;
    }
    
    .navbar-title,
    .navbar-title-link {
        font-size: 16px;
    }
    
    .navbar-tab {
        font-size: 12px;
        padding: 6px 12px;
    }
    
    #skinCarousel {
        margin: 10px 0;
    }
    
    #skinDropdownWrapper {
        margin: 10px 0;
    }
    
    #skinSelect {
        font-size: 12px;
    }
    
    /* Show mobile play button, hide desktop one */
    .startMenu-playButton-mobile {
        display: block;
        margin: 15px 0;
        width: 100%;
    }
    
    .startMenu-playButton-desktop {
        display: none;
    }
    
    #startButtonDesktop {
        display: none;
    }
}

@media only screen and (max-width: 480px) {
    #startMenu {
        margin-top: 10px;
        padding: 12px;
        max-height: 95vh;
    }
    
    .startMenu-logo {
        width: 25px;
        height: 25px;
    }
    
    #startMenu p {
        font-size: medium;
    }
    
    #gameNavbar {
        height: 40px;
        padding: 0 8px;
    }
    
    .navbar-logo {
        width: 24px;
        height: 24px;
    }
    
    .navbar-title,
    .navbar-title-link {
        font-size: 14px;
    }
    
    .navbar-tab {
        font-size: 11px;
        padding: 5px 10px;
    }
}

/* Landscape layout for mobile (width > height) - accounts for phones with large width but small height */
@media only screen and (orientation: landscape) and (max-height: 600px) {
    #startMenu {
        max-width: 90%;
        width: 90%;
        max-width: 800px;
        margin-top: 20px;
        max-height: 90vh;
    }
    
    .startMenu-content {
        flex-direction: row;
        gap: 30px;
        align-items: flex-start;
    }
    
    .startMenu-left {
        flex: 1;
        min-width: 0;
    }
    
    .startMenu-right {
        flex: 1;
        min-width: 0;
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    
    #skinCarousel {
        margin-bottom: 15px;
    }
    
    #skinDropdownWrapper {
        margin-bottom: 15px;
    }
    
    #startButton {
        margin-bottom: 15px;
    }
    
    #instructions {
        text-align: center;
    }
    
    /* Show mobile play button, hide desktop one in landscape */
    .startMenu-playButton-mobile {
        display: flex;
        margin: 15px 0;
        width: 100%;
    }
    
    .startMenu-playButton-desktop {
        display: none;
    }
    
    #startButtonDesktop {
        display: none;
    }
}

/* Also handle landscape for smaller screens */
@media only screen and (max-width: 768px) and (orientation: landscape) {
    #startMenu {
        max-width: 90%;
        width: 90%;
        max-width: 800px;
        margin-top: 20px;
        max-height: 90vh;
    }
    
    .startMenu-content {
        flex-direction: row;
        gap: 30px;
        align-items: flex-start;
    }
    
    .startMenu-left {
        flex: 1;
        min-width: 0;
    }
    
    .startMenu-right {
        flex: 1;
        min-width: 0;
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    
    #skinCarousel {
        margin-bottom: 15px;
    }
    
    #skinDropdownWrapper {
        margin-bottom: 15px;
    }
    
    #startButton {
        margin-bottom: 15px;
    }
    
    #instructions {
        text-align: center;
    }
    
    /* Show mobile play button, hide desktop one in landscape */
    .startMenu-playButton-mobile {
        display: flex;
        margin: 15px 0;
        width: 100%;
    }
    
    .startMenu-playButton-desktop {
        display: none;
    }
    
    #startButtonDesktop {
        display: none;
    }
}

@media only screen and (max-width: 480px) and (orientation: landscape) {
    #startMenu {
        max-width: 95%;
        margin-top: 10px;
        padding: 15px;
        max-height: 95vh;
    }
    
    .startMenu-content {
        gap: 20px;
    }
    
    #skinSelect {
        font-size: 11px;
    }
}

input [type="image"]:focus{
 border:none;
 outline: 1px solid transparent;
 border-style: none;
}

*:focus {
 outline: 1px solid transparent;
 border-style: none;
}
