/* Color variables for Light & Dark modes */
:root {
    /* Light Mode (default) */
    --page-bg: #EEE;
    --text-color: #333;
    --container-bg: #EEE;
    --btn-bg: #4a571c;
    --btn-text: #a2c132;
    --link-bg: #1e90ff;
    --link-hover: #1c82e6;
    --input-bg: #FFF;
    --input-border: #a2c132;
    --name-color: #4a571c;
}

body[data-theme="dark"] {
    /* Dark Mode */
    --page-bg: #333;
    --text-color: #FFF;
    --container-bg: #333;
    --btn-bg: #a2c132;
    --btn-text: #4a571c;
    --link-bg: #1e90ff;
    --link-hover: #1c82e6;
    --input-bg: #555;
    --input-border: #a2c132;
    --name-color: #a2c132;
}

/* --- General Body Styles --- */
body {
    font-family: 'Arial', sans-serif;
    background-color: var(--page-bg);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0;
    height: 100vh;
    overflow: hidden; 
    transition: background-color 0.3s, color 0.3s;
}

/* --- Start Screen Styles --- */
#start-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
    color: #FFF; /* This stays white for contrast */
}
#start-screen h2 {
    font-size: 2rem;
    margin-bottom: 20px;
}
#start-screen input {
    font-size: 1.2rem;
    padding: 10px;
    border: 2px solid var(--input-border);
    border-radius: 5px;
    text-align: center;
    background-color: var(--input-bg);
    color: var(--text-color);
}
#start-screen button {
    font-size: 1.2rem;
    padding: 10px 20px;
    margin-top: 20px;
    background-color: var(--btn-bg);
    color: var(--btn-text);
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
}

/* Mode selector styles */
.mode-selector {
    margin-top: 20px;
    font-size: 1.2rem;
    text-align: center; /* UPDATED */
}
.mode-selector label {
    margin: 0 10px;
    cursor: pointer;
}
.mode-selector input {
    margin-right: 5px;
}

/* Skin selector styles */
.skin-selector {
    margin-top: 15px;
    font-size: 1.2rem;
    text-align: center; /* UPDATED */
}

/* NEW: Title for selectors */
.selector-title {
    font-size: 0.9rem;
    margin-bottom: 8px;
    color: #DDD;
    font-weight: normal;
}

.skin-selector label {
    margin: 0 10px;
    cursor: pointer;
}
.skin-selector input {
    margin-right: 5px;
}


/* --- Game Container Styles --- */
#game-container {
    padding: 20px;
    background-color: var(--container-bg);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: background-color 0.3s;
}

h1 {
    font-weight: normal;
    margin-top: 0;
}

.score-container {
    font-size: 1.5rem;
    margin-bottom: 10px;
}
#playerNameDisplay {
    color: var(--name-color);
    font-weight: bold;
}

#gameCanvas {
    /* Background is set by JS */
    border: 4px solid var(--btn-bg);
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    max-width: 90vw; 
    height: auto;
}

/* --- Color Legend Styles --- */
.color-legend {
    margin-top: 20px;
    text-align: center;
    width: 90%;
    max-width: 400px;
}
.legend-title {
    font-size: 0.9rem;
    margin-bottom: 8px;
    color: var(--text-color);
    font-weight: normal;
}
.legend-colors {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
}
.legend-item {
    width: 25px;
    height: 25px;
    border: 1px solid var(--text-color);
    border-radius: 4px;
    display: inline-block;
}

/* --- Share Button --- */
#shareBtn {
    font-size: 1rem;
    padding: 10px 15px;
    margin-top: 10px;
    background-color: var(--link-bg);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
}
#shareBtn:hover {
    background-color: var(--link-hover);
}


/* --- Mobile Control Styles --- */
.mobile-controls {
    display: none; /* Hidden on desktop */
    margin-top: 20px;
}
.control-row {
    display: flex;
    justify-content: center;
}
.mobile-controls button {
    width: 70px;
    height: 70px;
    margin: 5px;
    font-size: 2rem;
    background-color: var(--btn-bg);
    color: var(--btn-text);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}
.mobile-controls button:active {
    background-color: var(--name-color);
}

/* Media query to show controls on small screens */
@media (max-width: 600px) {
    .mobile-controls {
        display: block; 
    }
}