:root {
    --bg-color-light: #f0f2f5;
    --text-color-light: #333;
    --container-bg-light: rgba(255, 255, 255, 0.7);
    --border-color-light: #fff;
    --accent-color-light: #007bff;

    --bg-color-dark: #121212;
    --text-color-dark: #f0f2f5;
    --container-bg-dark: rgba(0, 0, 0, 0.2);
    --border-color-dark: rgba(255, 255, 255, 0.1);
    --accent-color-dark: #00aaff;
}

body {
    font-family: 'Roboto', sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    transition: background-color 0.3s, color 0.3s;
}

body.light-theme {
    background-color: var(--bg-color-light);
    color: var(--text-color-light);
}

body.dark-theme {
    background-color: var(--bg-color-dark);
    color: var(--text-color-dark);
}

.modal {
    display: none;
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.6);
}

.modal-content {
    background-color: #2a2a2a;
    margin: 15% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 600px;
    border-radius: 15px;
    position: relative;
}

.light-theme .modal-content {
    background-color: #fefefe;
}

.close-button {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

#series-winner-banner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: var(--accent-color-dark);
    color: white;
    text-align: center;
    padding: 1rem;
    font-size: 1.5rem;
    z-index: 200;
}

.top-bar {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 1rem;
    align-items: center;
}

#theme-switcher-container {
    cursor: pointer;
}

#sun-icon, #moon-icon {
    transition: opacity 0.3s, transform 0.3s;
}

.dark-theme #sun-icon {
    display: none;
}

.light-theme #moon-icon {
    display: none;
}

#help-button {
    background: none;
    border: 1px solid;
    color: inherit;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
}

.light-theme #help-button { border-color: #ccc; }
.dark-theme #help-button { border-color: #555; }

header .logo h1 {
    font-family: 'Orbitron', sans-serif;
    font-size: 3rem;
    margin: 2rem 0;
    color: var(--accent-color-dark);
}

.light-theme header .logo h1 { color: var(--accent-color-light); }

.game-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.settings-panel, .history-container {
    width: 90%;
    max-width: 800px;
}

.history-container {
    margin-top: 2rem;
    padding: 1rem;
    border-radius: 15px;
    background-color: var(--container-bg-dark);
    border: 1px solid var(--border-color-dark);
}

.light-theme .history-container { 
    background-color: var(--container-bg-light);
    border-color: var(--border-color-light);
}

#history-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 150px;
    overflow-y: auto;
}

#history-list li {
    padding: 5px 0;
    border-bottom: 1px solid;
}

.light-theme #history-list li { border-color: #eee; }
.dark-theme #history-list li { border-color: #444; }

.game-container {
    padding: 2rem;
    border-radius: 25px;
    text-align: center;
    width: 100%;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border: 1px solid;
    transition: background-color 0.3s, border-color 0.3s;
}

.light-theme .game-container {
    background-color: var(--container-bg-light);
    border-color: var(--border-color-light);
}

.dark-theme .game-container {
    background-color: var(--container-bg-dark);
    border-color: var(--border-color-dark);
}

.choice-card.winner-glow {
    box-shadow: 0 0 20px 5px var(--accent-color-dark);
}

.light-theme .choice-card.winner-glow {
    box-shadow: 0 0 20px 5px var(--accent-color-light);
}

/* ... (rest of the styles are similar, with minor tweaks for the new elements) ... */

.settings-panel {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.player-name-container, .game-mode-container {
    display: flex;
    flex-direction: column;
}

.settings-panel label {
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.settings-panel input, .settings-panel select {
    padding: 8px;
    border-radius: 5px;
    border: 1px solid;
    background-color: transparent;
    color: inherit;
}

.light-theme .settings-panel input, .light-theme .settings-panel select {
    border-color: #ccc;
}

.dark-theme .settings-panel input, .dark-theme .settings-panel select {
    border-color: #555;
}

.dark-theme .settings-panel select option {
    background-color: #333;
    color: var(--text-color-dark);
}

.score-board {
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin-bottom: 2rem;
}

.score-container h2 {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.5rem;
    margin: 0;
}

.score-container p {
    font-family: 'Orbitron', sans-serif;
    font-size: 3rem;
    margin: 0;
}

.vs-separator {
    font-family: 'Orbitron', sans-serif;
    font-size: 2rem;
}

.choices-container {
    perspective: 1000px;
}

.choices {
    display: flex;
    justify-content: center;
    flex-wrap: wrap; /* Added for responsiveness */
    gap: 1rem; /* Adjusted gap */
    align-items: center; /* Added for vertical alignment when wrapping */
}

.choice-card {
    width: 150px;
    height: 200px;
    cursor: pointer;
}

.choice-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.6s;
}

.choice-card:hover .choice-card-inner {
    transform: rotateY(180deg);
}

.choice-card-front, .choice-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.choice-card-front {
    border: 2px solid;
}

.light-theme .choice-card-front {
    border-color: #ccc;
}

.dark-theme .choice-card-front {
    border-color: #555;
}

.choice-card-back {
    background-color: var(--accent-color-dark);
    color: white;
    transform: rotateY(180deg);
    font-size: 1.5rem;
    font-weight: bold;
}

.light-theme .choice-card-back { background-color: var(--accent-color-light); }

.choice-card img {
    width: 80px;
    height: 80px;
}



.result-container {
    margin-top: 2rem;
    min-height: 5rem;
}

#result {
    font-size: 1.8rem;
    font-weight: bold;
}

#computer-choice-display {
    margin-top: 1rem;
}

#play-again {
    background-color: var(--accent-color-dark);
    color: white;
    border: none;
    padding: 1rem 2.5rem;
    font-size: 1.2rem;
    border-radius: 50px;
    cursor: pointer;
    margin-top: 1.5rem;
    transition: all 0.3s ease;
    font-weight: bold;
}

.light-theme #play-again { background-color: var(--accent-color-light); }

#play-again:hover {
    transform: scale(1.05);
}

.hidden {
    display: none;
}

footer {
    margin-top: auto;
    padding: 1rem;
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    header .logo h1 {
        font-size: 2rem;
    }

    .settings-panel {
        flex-direction: column;
        gap: 1rem;
    }

    .choices {
        gap: 0.5rem; /* Further reduce gap for very small screens */
    }

    .choice-card {
        width: calc(33% - 1rem); /* Allow 3 cards per row on small screens, accounting for gap */
        max-width: 100px; /* Keep a max width to prevent them from getting too big */
        height: 120px; /* Slightly reduce height */
    }

    .choice-card img {
        width: 50px;
        height: 50px;
    }
}

#pre-round-animation {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    font-size: 4rem;
    font-family: 'Orbitron', sans-serif;
    color: white;
    text-shadow: 0 0 10px var(--accent-color-dark);
}

.light-theme #pre-round-animation {
    background-color: rgba(255, 255, 255, 0.7);
    color: var(--text-color-light);
    text-shadow: 0 0 10px var(--accent-color-light);
}

#animation-text {
    animation: pulse 1s infinite alternate;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(1.1); opacity: 1; }
}

.shake {
    animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
    transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
    perspective: 1000px;
}

@keyframes shake {
    10%, 90% {
        transform: translate3d(-1px, 0, 0);
    }
    20%, 80% {
        transform: translate3d(2px, 0, 0);
    }
    30%, 50%, 70% {
        transform: translate3d(-4px, 0, 0);
    }
    40%, 60% {
        transform: translate3d(4px, 0, 0);
    }
}

/* Confetti Styles */
#confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Allow clicks to pass through */
    overflow: hidden;
    z-index: 9999;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background-color: #f00; /* Default color, will be randomized */
    opacity: 0;
    animation: confetti-fall 3s ease-out forwards;
}

@keyframes confetti-fall {
    0% {
        transform: translateY(-100vh) rotateZ(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotateZ(720deg);
        opacity: 0;
    }
}
