:root {
    --bg-color: #ecf0f1;
    --text-color: #2c3e50;
    --container-bg-color: #ffffff;
    --game-area-bg-color: #bdc3c7;
    --target-color: #e74c3c;
    --button-bg-color: #e74c3c;
    --button-hover-bg-color: #c0392b;
    --game-over-color: #2c3e50;
}

body.dark-mode {
    --bg-color: #2c3e50;
    --text-color: #ecf0f1;
    --container-bg-color: #34495e;
    --game-area-bg-color: #2c3e50;
    --target-color: #e74c3c; /* Target color can remain the same or change */
    --button-bg-color: #e74c3c;
    --button-hover-bg-color: #c0392b;
    --game-over-color: #ecf0f1;
}

body {
    font-family: 'Malgun Gothic', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    text-align: center;
    margin-top: 0; /* Adjusted */
    transition: background-color 0.3s, color 0.3s;
}

/* Main Layout for Game and Leaderboard */
.main-layout {
    display: flex;
    justify-content: center; /* Center the entire layout */
    gap: 30px; /* Space between game and leaderboard */
    margin-top: 50px; /* Adjust top margin as body margin is now less relevant */
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
}


/* Leaderboard Container */
#leaderboard-container {
    width: 300px; /* Fixed width for leaderboard */
    padding: 20px;
    background-color: var(--container-bg-color); /* Use theme variable */
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    color: var(--text-color); /* Use theme variable */
    transition: background-color 0.3s, color 0.3s;
}

#leaderboard-container h2 {
    color: var(--text-color); /* Use theme variable */
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 1.5em;
}

#leaderboard-list {
    list-style: none;
    padding: 0;
    text-align: left;
}

#leaderboard-list li {
    padding: 10px 0;
    border-bottom: 1px solid var(--game-area-bg-color); /* Use a subtle border */
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.1em;
}

#leaderboard-list li:last-child {
    border-bottom: none;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    background-color: var(--container-bg-color);
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    transition: background-color 0.3s;
}

#game-area {
    width: 100%;
    height: 400px;
    background-color: var(--game-area-bg-color);
    border-radius: 5px;
    position: relative;
    overflow: hidden;
    cursor: crosshair;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.3s;
}

.target {
    width: 50px;
    height: 50px;
    background-color: var(--target-color);
    border-radius: 50%;
    position: absolute;
    transition: all 0.1s ease;
}

.info {
    display: flex;
    justify-content: space-around;
    margin-top: 20px;
    font-size: 1.2em;
}

#start-btn {
    padding: 10px 20px;
    font-size: 16px;
    margin-top: 20px;
    cursor: pointer;
    border: none;
    border-radius: 5px;
    background-color: var(--button-bg-color);
    color: white;
    font-weight: bold;
    transition: background-color 0.3s;
}

#start-btn:hover {
    background-color: var(--button-hover-bg-color);
}

.game-over {
    color: var(--game-over-color);
    font-size: 2em;
}

/* Theme Switch CSS */
.theme-switch-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 20px 0;
}

.theme-switch {
    display: inline-block;
    height: 34px;
    position: relative;
    width: 60px;
}

.theme-switch input {
    display: none;
}

.slider {
    background-color: #ccc;
    bottom: 0;
    cursor: pointer;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
    transition: .4s;
}

.slider:before {
    background-color: #fff;
    bottom: 4px;
    content: "";
    height: 26px;
    left: 4px;
    position: absolute;
    transition: .4s;
    width: 26px;
}

input:checked + .slider {
    background-color: #2196F3;
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

.theme-switch-wrapper em {
    margin-left: 10px;
    font-style: normal;
}
