body {
    font-family: Arial, sans-serif;
    background: linear-gradient(to bottom, #061342, #1a3a7f);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    font-size: 1.1em; /* Increased base font size */
}

/* Responsive game container for sidescroller */
.game-container {
    width: 60vw;
    aspect-ratio: 4/3;
    margin: 0 auto;
    border: 1px solid black;
    max-width: 100%;
}

/* Base touch controls styles */
.touch-controls {
    position: absolute;
    bottom: 20px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 20px;
}

.touch-controls button {
    width: 80px;
    height: 60px;
    font-size: 20px;
}

/* Base styles - default to desktop behavior */
.game-container {
    width: 60vw;
    aspect-ratio: 4/3;
    margin: 0 auto;
    border: 1px solid black;
    max-width: 100%;
}

/* Mobile detection - portrait orientation (height > width) */
@media (orientation: portrait) and (max-width: 1200px) {
    .game-container {
        width: 95vw;
        max-width: 100%;
    }
    
    .touch-controls {
        position: fixed;
        bottom: 20px;
        left: 0;
        right: 0;
        display: flex;
        justify-content: center;
        gap: 15px;
        z-index: 1000;
        padding: 0 10px;
        box-sizing: border-box;
    }
    
    .touch-controls button {
        width: 70px;
        height: 50px;
        font-size: 18px;
        border: none;
        border-radius: 8px;
        background-color: rgba(255, 255, 255, 0.9);
        color: #333;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        touch-action: manipulation;
    }
    
    .touch-controls button:active {
        background-color: rgba(200, 200, 200, 0.9);
        transform: scale(0.95);
    }
}

/* Base touch controls for desktop */
.touch-controls {
    position: absolute;
    bottom: 20px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 20px;
}

.touch-controls button {
    width: 80px;
    height: 60px;
    font-size: 20px;
}

.container {
    background-color: #ffffff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    text-align: center;
    width: 90%;
    max-width: 600px;
}

h1 {
    color: #333;
    margin-bottom: 20px;
}

.score {
    font-size: 1.1em;
    color: #555;
    margin-bottom: 20px;
}

.phrase-container {
    background-color: #e9e9e9;
    padding: 20px;
    border-radius: 5px;
    margin-bottom: 30px;
}

.price-display {
    font-size: 1.2em;
    font-weight: bold;
    color: #4CAF50; /* Money green color */
    margin-bottom: 10px;
}

.phrase {
    font-size: 1.5em;
    color: #333;
    min-height: 50px; /* Ensure space for the hidden word */
}

.hidden-word {
    color: #ccc;
    text-decoration: underline;
}

.correct-word-revealed {
    color: #28a745;
    font-weight: bold;
    text-decoration: underline;
}

.options {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

.option-button {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 5px 10px; /* Increased padding */
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.3em; /* Adjusted to match body or slightly larger */
    transition: background-color 0.3s ease;
    font-family: sans-serif;
}

.option-button:hover {
    background-color: #0056b3;
}

.option-button.selected {
    background-color: #28a745;
}

.submit-button {
    background-color: #6c757d;
    color: white;
    border: none;
    padding: 18px 35px; /* Increased padding */
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.2em; /* Adjusted to match body or slightly larger */
    font-family: sans-serif;
    transition: background-color 0.3s ease;
}

.submit-button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.submit-button:hover:not(:disabled) {
    background-color: #5a6268;
}

.feedback {
    font-weight: bold;
    margin-top: 15px;
    padding: 10px;
    border-radius: 5px;
}

.feedback.correct {
    color: #28a745;
    background-color: #d4edda;
}

.feedback.incorrect {
    color: #dc3545;
    background-color: #f8d7da;
}

.final-score {
    font-size: 1.8em;
    color: #333;
    margin-bottom: 30px;
}

.play-again-button {
    background-color: #007bff;
    color: white;
    text-decoration: none;
    padding: 20px 40px; /* Increased padding */
    border-radius: 5px;
    font-size: 1.3em; /* Adjusted to match body or slightly larger */
    font-family: sans-serif;
    transition: background-color 0.3s ease;
}

.play-again-button:hover {
    background-color: #0056b3;
}

.username-input {
    padding: 15px;
    font-size: 1.2em;
    border: 2px solid #ddd;
    border-radius: 5px;
    margin-bottom: 20px;
    width: 100%;
    max-width: 300px;
    box-sizing: border-box;
}

.welcome-text {
    font-size: 1.3em;
    color: #555;
    margin-bottom: 30px;
}

.username-display {
    font-size: 1.2em;
    color: #555;
    margin-bottom: 30px;
}

.flash-message {
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
    font-size: 1.1em;
    text-align: center;
    animation: fadeIn 0.3s ease;
}

.flash-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 2px solid #bee5eb;
}

.flash-success {
    background-color: #d4edda;
    color: #155724;
    border: 2px solid #c3e6cb;
}

.flash-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 2px solid #f5c6cb;
}

.flash-warning {
    background-color: #fff3cd;
    color: #856404;
    border: 2px solid #ffeeba;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.game-card {
    background-color: #f8f9fa;
    padding: 25px;
    border-radius: 8px;
    text-decoration: none;
    color: #333;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 2px solid #e9e9e9;
}

.game-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    border-color: #007bff;
}

.game-card h2 {
    color: #007bff;
    margin-bottom: 10px;
}

.game-card p {
    color: #666;
    margin: 0;
}

.leaderboard-link {
    display: inline-block;
    background-color: #6c757d;
    color: white;
    text-decoration: none;
    padding: 15px 30px;
    border-radius: 5px;
    font-size: 1.1em;
    transition: background-color 0.3s ease;
    margin-top: 20px;
}

.leaderboard-link:hover {
    background-color: #5a6268;
}

.leaderboard-section {
    margin-bottom: 40px;
}

.leaderboard-section h2 {
    color: #333;
    margin-bottom: 15px;
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    background-color: white;
}

.leaderboard-table th,
.leaderboard-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.leaderboard-table th {
    background-color: #007bff;
    color: white;
    font-weight: bold;
}

.leaderboard-table tr:hover {
    background-color: #f5f5f5;
}

.leaderboard-table tr.current-user {
    background-color: #d4edda;
    font-weight: bold;
}

.leaderboard-actions {
    margin-top: 30px;
}

.endgame-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.leaderboard-button {
    background-color: #6c757d;
}

.leaderboard-button:hover {
    background-color: #5a6268;
}

.no-scores {
    color: #666;
    font-style: italic;
    padding: 20px;
    text-align: center;
}

#gameOver {
    width: 60vw;
    aspect-ratio: 4/3;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    font-family: sans-serif;
    z-index: 100;
    pointer-events: none;
    display: flex; /* Add this */
    flex-direction: column; /* Add this */
    justify-content: center; /* Add this */
    align-items: center; /* Add this */
}


#gameOver > * {
    pointer-events: auto; /* Re-enable clicks for child elements (button, text) */
}

#gameOver h1 {
    font-size: 2.5em;
    margin-bottom: 20px;
    text-align: center;
}

#gameOver p {
    font-size: 1.5em;
    margin-bottom: 30px;
    text-align: center;
}

#restartButton {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 20px 40px;
    border-radius: 5px;
    font-size: 1.3em;
    cursor: pointer;
    transition: background-color 0.3s ease;
    font-family: sans-serif;
    margin: 0 auto;
}

#restartButton:hover {
    background-color: #0056b3;
}


#finishLevel {
    width: 60vw;
    aspect-ratio: 4/3;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    font-family: sans-serif;
    z-index: 100;
    pointer-events: none;
    display: flex; /* Add this */
    flex-direction: column; /* Add this */
    justify-content: center; /* Add this */
    align-items: center; /* Add this */
}


#finishLevel > * {
    pointer-events: auto; /* Re-enable clicks for child elements (button, text) */
}

#finishLevel h1 {
    font-size: 2.5em;
    margin-bottom: 20px;
    text-align: center;
}

#finishLevel p {
    font-size: 1.5em;
    margin-bottom: 30px;
    text-align: center;
}

#continueButton {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 20px 40px;
    border-radius: 5px;
    font-size: 1.3em;
    cursor: pointer;
    transition: background-color 0.3s ease;
    font-family: sans-serif;
    margin: 0 auto;
}

#leaderBoardButton {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 20px 40px;
    border-radius: 5px;
    font-size: 1.3em;
    cursor: pointer;
    transition: background-color 0.3s ease;
    font-family: sans-serif;
    margin: 0 auto;
}

#restartButton:hover {
    background-color: #0056b3;
}

/* Wheel styles */
.wheel-container {
    position: relative;
    width: 300px;
    height: 300px;
    margin: 30px auto;
}

.wheel {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    position: relative;
    overflow: hidden;
    border: 4px solid #333;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
    transform: rotate(0deg);
}

.wheel-slice {
    position: absolute;
    width: 100%;
    height: 100%;
    transform-origin: 50% 50%;
    left: 0%;
    top: 0%;
    font-weight: bold;
    font-size: 1.2em;
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

.wheel-slice .slice-text {
    position: absolute;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1;
    pointer-events: none;
    white-space: nowrap;
}

/* Wheel slice rotation is set dynamically via JavaScript */

.wheel-arrow {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 15px solid transparent;
    border-right: 15px solid transparent;
    border-top: 30px solid #333;
    z-index: 10;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.spin-button {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 5px;
    font-size: 1.2em;
    cursor: pointer;
    transition: background-color 0.3s ease;
    font-family: sans-serif;
    margin-top: 20px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.spin-button:hover:not(:disabled) {
    background-color: #0056b3;
}

.spin-button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

/* Candidate result styles */
.candidate-result {
    margin-top: 30px;
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 8px;
    text-align: center;
    animation: fadeIn 0.5s ease;
}

.candidate-image-container {
    margin-bottom: 20px;
}

.candidate-picture {
    max-width: 200px;
    max-height: 200px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    object-fit: cover;
}

.candidate-name {
    color: #333;
    font-size: 1.8em;
    margin-bottom: 10px;
}

.candidate-title {
    color: #666;
    font-size: 1.2em;
    font-style: italic;
    margin: 0;
}