:root {
    /* Default Dark Theme */
    --primary: #8bc34a;
    --primary-light: #e5edef;
    --background: #2a2a2a;
    --surface: #3a3a3a;
    --text: #e0e0e0;
    --border: #4a4a4a;
}

[data-theme="light"] {
    --primary: #689f38;
    --primary-light: #e5edef;
    --background: #e8e8e8;
    --surface: #ffffff;
    --text: #212121;
    --border: #e0e0e0;
}

/* Keep color scheme variations */
[data-color="blue"] {
    --primary: #2196f3 !important;
    --primary-light: #42a5f5 !important;
}

[data-color="purple"] {
    --primary: #9c27b0 !important;
    --primary-light: #ab47bc !important;
}

[data-color="red"] {
    --primary: #f44336 !important;
    --primary-light: #ef5350 !important;
}

[data-color="gold"] {
    --primary: #ffc107 !important;
    --primary-light: #ffca28 !important;
}
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
    max-width: 100%;
}

body {
    font-family: 'Courier New', monospace;
    background: var(--background);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
    max-width: 100%;
}

/* Top Bar */
.top-bar {
    background: var(--surface);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 3px solid #444;
    position: sticky;
    top: 0;
    z-index: 900;
}

.top-bar > :first-child {
    flex: 0 0 auto; /* Don't grow */
}

.top-bar .game-title {
    flex: 1;
    text-align: center;
}

.top-bar > :last-child {
    flex: 0 0 auto; /* Don't grow */
}

.game-title {
    font-size: 24px;
    font-weight: bold;
    color: var(--primary);
    letter-spacing: 2px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.top-btn {
    background: var(--background);
    border: 2px solid #4a4a4a;
    color: var(--text);
    font-size: 24px;
    width: 45px;
    height: 45px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.top-btn:hover {
    background: #4a4a4a;
    border-color: var(--primary);
    transform: scale(1.05);
}

.stats-bar {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--surface);
    border: 3px solid #4a4a4a;
    border-radius: 12px;
    padding: 12px 20px;
    display: flex;
    flex-wrap: wrap; /* ← ADD THIS */
    justify-content: center; /* ← ADD THIS */
    gap: 25px;
    z-index: 9999;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
    max-width: 90vw; /* ← ADD THIS - prevents overflow */
}

/* Mobile optimization */
@media (max-width: 768px) {
    .stats-bar {
        gap: 0;
        padding: 5px 4px;
        bottom: 10px;
        flex-wrap: nowrap;
        max-width: 98vw;
        border-width: 2px;
        align-items: center;
        justify-content: space-evenly;
    }

    .stats-bar-item {
        flex: 1;
        flex-direction: column;
        align-items: center;
        padding: 1px 2px;
        gap: 1px;
        min-width: 0;
    }

    .stats-bar-item img {
        width: 20px !important;
        height: 20px !important;
    }

    .stats-bar-icon {
        font-size: 12px;
        line-height: 1;
    }

    .stats-bar-value {
        font-size: 8px;
        font-weight: bold;
        min-width: 0;
        white-space: nowrap;
        text-align: center;
        color: var(--primary);
    }

    .homestead-level-display {
        min-width: 0 !important;
    }

    .xp-bar-container {
        display: none;
    }
}

.stats-bar-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px;
    border-radius: 6px;
    transition: all 0.2s;
    cursor: pointer;
}

.stats-bar-item:hover {
    background: #4a4a4a;
}

.stats-bar-icon {
    font-size: 24px;
}

.stats-bar-value {
    font-size: 16px;
    font-weight: bold;
    color: var(--primary);
    min-width: 50px;
    text-align: center;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: var(--background);
}

::-webkit-scrollbar-thumb {
    background: #4a4a4a;
    border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}