body {
    margin: 0;
    padding: 0;
    background-color: #000;
    color: #fff;
    font-family: 'IBM Plex Mono', monospace;
    display: flex;
    justify-content: center;
    align-items: flex-start; /* Align items to the top */
    min-height: 100vh;
    overflow-y: auto; /* Allow scrolling on smaller screens */
}

#game-container {
    width: 100%;
    max-width: 600px; /* Max width for larger screens */
    padding: 20px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 15px; /* Space between elements */
}

h1, h2, h3 {
    color: #fff;
    text-align: center;
    margin-top: 0;
    margin-bottom: 15px;
}

button {
    display: block; /* Make buttons full width in their container */
    width: 100%;
    padding: 15px 20px;
    margin-bottom: 10px; /* Space between buttons */
    background-color: #fff;
    color: #000;
    border: 2px solid #fff;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 1rem;
    cursor: pointer;
    text-align: center;
    text-transform: uppercase;
    transition: background-color 0.1s ease, color 0.1s ease;
}

button:hover, button:focus {
    background-color: #ddd; /* Slightly grey on hover */
    outline: none;
}

button:active {
    background-color: #bbb; /* Even darker on active */
}

button:disabled {
    background-color: #222;
    color: #555;
    border-color: #555;
    cursor: not-allowed;
}

.section-title {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 1px dashed #555;
}

.game-state {
    margin-bottom: 20px;
    padding: 10px;
    border: 1px dashed #555;
    text-align: center;
    font-size: 0.9rem;
}

.car-list, .upgrade-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.car-item, .upgrade-item {
    border: 1px solid #555;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.car-item h3, .upgrade-item h3 {
    margin: 0;
    font-size: 1.1rem;
    margin-bottom: 5px;
}

.car-stats, .upgrade-details {
    font-size: 0.9rem;
    color: #ccc;
}

.car-actions, .upgrade-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.car-actions button, .upgrade-actions button {
    flex-grow: 1; /* Make buttons share space */
    width: auto; /* Override full width for actions */
    margin-bottom: 0;
    padding: 10px;
    font-size: 0.9rem;
}

.back-button {
    margin-top: 20px;
    background-color: #333;
    color: #fff;
    border-color: #fff;
}

.back-button:hover, .back-button:focus {
     background-color: #555;
}

.race-result {
    text-align: center;
    margin-top: 20px;
}

.race-result h2 {
    margin-bottom: 10px;
}

.race-result p {
    margin-bottom: 15px;
    font-size: 1rem;
}

/* Specific styles for monochrome */
button.buy-button {
    background-color: #00cc00; /* Greenish for buy */
    color: #000;
    border-color: #00cc00;
}
button.buy-button:hover {
    background-color: #00aa00;
}

button.upgrade-button {
     background-color: #ffaa00; /* Orangeish for upgrade */
    color: #000;
    border-color: #ffaa00;
}
button.upgrade-button:hover {
    background-color: #dd9900;
}

button.select-button {
    background-color: #00cccc; /* Cyanish for select */
    color: #000;
    border-color: #00cccc;
}
button.select-button:hover {
    background-color: #00aaaa;
}

.current-car-info {
    margin-top: 20px;
    padding: 10px;
    border: 1px dashed #fff;
}

.current-car-info h3 {
    text-align: center;
}

.current-car-info p {
    text-align: center;
    margin: 5px 0;
}

.current-car-info .upgrades-list-title {
    margin-top: 10px;
    margin-bottom: 5px;
    font-weight: bold;
    text-align: left; /* Align left for list */
}

.current-car-info .upgrades-list {
    list-style: none; /* Remove default bullet points */
    padding: 0;
    margin: 0;
    text-align: left; /* Align list items left */
}

.current-car-info .upgrades-list li {
    margin-bottom: 2px;
    font-size: 0.9rem;
    color: #ccc;
}


/* Simple monospace table-like display for stats */
.stats-display {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 5px;
    margin-top: 10px;
    font-size: 0.9rem;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px dashed #333;
    padding-bottom: 2px;
}

.stat-name {
    font-weight: bold;
}

.achievement-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.achievement-item {
    border: 1px solid #555;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.achievement-item.unlocked {
    border-color: #00cc00;
    background-color: #001100;
}

.achievement-item.locked {
    border-color: #333;
    background-color: #111;
    color: #666;
}

.achievement-item h3 {
    margin: 0;
    font-size: 1.1rem;
    margin-bottom: 5px;
}

.settings-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.setting-item {
    border: 1px solid #555;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.setting-item h3 {
    margin: 0;
    font-size: 1.1rem;
}

.setting-buttons {
    display: flex;
    gap: 10px;
}

.setting-buttons button {
    flex: 1;
    margin-bottom: 0;
    padding: 8px;
    font-size: 0.9rem;
}

.race-interface {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 20px;
    border: 2px solid #fff;
    margin: 20px 0;
}

.race-status {
    text-align: center;
}

.race-track {
    position: relative;
    height: 120px;
    border: 1px dashed #555;
    background: linear-gradient(to right, #111 0%, #222 50%, #111 100%);
}

.race-position {
    position: relative;
    height: 80px;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    padding: 10px 0;
}

.car-icon {
    position: absolute;
    left: 0%;
    transition: left 0.1s ease;
    font-size: 1.2rem;
    padding: 5px;
    background-color: #333;
    border: 1px solid #fff;
    border-radius: 3px;
    min-width: 80px;
    text-align: center;
}

#player-car {
    top: 5px;
    background-color: #004400;
}

#opponent-car {
    top: 45px;
    background-color: #440000;
}

.progress-bar {
    position: absolute;
    bottom: 5px;
    left: 0;
    width: 100%;
    height: 20px;
    background-color: #222;
    border: 1px solid #555;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(to right, #ff0000 0%, #ffff00 50%, #00ff00 100%);
    width: 0%;
    transition: width 0.1s ease;
}

.race-commentary {
    text-align: center;
    min-height: 50px;
    padding: 10px;
    border: 1px dashed #555;
    background-color: #111;
}

.race-commentary p {
    margin: 0;
    font-weight: bold;
    color: #00cccc;
    animation: commentary-flash 0.5s ease;
}

@keyframes commentary-flash {
    0% { opacity: 0; transform: scale(0.9); }
    100% { opacity: 1; transform: scale(1); }
}

.race-environment-selection {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
}

.race-environment-selection button {
    flex: 1;
    min-width: 150px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: #333;
    color: #fff;
    border: 1px solid #555;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.race-environment-selection button small {
    font-size: 0.7rem;
    color: #aaa;
    margin-top: 5px;
    text-align: center;
}

.race-environment-selection button.selected,
.race-environment-selection button:hover {
    background-color: #00cccc;
    color: #000;
}

.race-environment-selection button:disabled {
    background-color: #222;
    color: #555;
    cursor: not-allowed;
}

#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    font-family: 'IBM Plex Mono', monospace;
    z-index: 1000;
}

#loading-progress-container {
    width: 80%;
    max-width: 400px;
    height: 30px;
    background-color: #222;
    border: 2px solid #fff;
    margin: 20px 0;
    overflow: hidden;
}

#loading-progress-bar {
    width: 0%;
    height: 100%;
    background-color: #00cc00;
    transition: width 0.5s ease;
}

#start-game-btn {
    padding: 15px 30px;
    font-size: 1rem;
    background-color: #00cccc;
    color: #000;
    border: 2px solid #fff;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

#start-game-btn:disabled {
    background-color: #333;
    color: #666;
    cursor: not-allowed;
}

#start-game-btn:hover:not(:disabled) {
    background-color: #00aaaa;
}

.store-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.store-item {
    border: 1px solid #555;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.store-item h3 {
    margin: 0;
    font-size: 1.1rem;
    margin-bottom: 5px;
}

.store-item p {
    margin: 2px 0;
    font-size: 0.9rem;
    color: #ccc;
}

.store-item button {
    margin-top: 10px;
    width: 100%;
    padding: 10px;
    font-size: 0.9rem;
}

#continue-without-assets {
    padding: 10px 20px;
    font-size: 0.9rem;
    background-color: #ff4444;
    color: #fff;
    border: 2px solid #fff;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

#continue-without-assets:hover {
    background-color: #dd3333;
}

/* Ensure mobile responsiveness */
@media (max-width: 600px) {
    #game-container {
        padding: 10px;
        gap: 10px;
    }

    button {
        padding: 12px 15px;
        font-size: 0.95rem;
    }

    .section-title {
        font-size: 1.1rem;
    }

    .game-state {
        font-size: 0.85rem;
    }

    .car-item, .upgrade-item {
        padding: 8px;
    }

    .car-item h3, .upgrade-item h3 {
        font-size: 1rem;
    }

    .car-stats, .upgrade-details {
        font-size: 0.8rem;
    }

    .car-actions button, .upgrade-actions button {
        padding: 8px;
        font-size: 0.85rem;
    }

    .stats-display {
        grid-template-columns: 1fr; /* Stack stats on very small screens */
    }
}