* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif;
    background: white;
    color: black;
    line-height: 1.6;
    overflow-x: hidden;
}

#game-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 20px;
    height: 100vh;
    overflow: hidden;
}

/* Column 1: Flavor text on left */
#flavor-text-container {
    padding: 15px;
    border-right: 1px solid #ccc;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.flavor-text-line {
    padding: 5px 0;
    opacity: 0.7;
    font-size: 0.85rem;
}

/* Column 2: Button area */
#button-area {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
    padding-top: 20px;
}

/* Column 3: Counts and map */
#counts-area {
    display: flex;
    flex-direction: column;
    gap: 15px;
    overflow-y: auto;
}

/* Column 4: Upgrades area */
#upgrades-area {
    overflow-y: auto;
    padding-right: 10px;
}

/* Phase indicator at top */
#phase-indicator {
    text-align: center;
    font-size: 0.85rem;
    opacity: 0.6;
    height: 18px;
}

/* Smaller, more responsive melt button */
#main-action-btn {
    background: black;
    color: white;
    border: none;
    padding: 8px 16px;
    font-size: 1rem;
    cursor: pointer;
    border-radius: 4px;
    transition: opacity 0.1s;
    font-weight: 600;
    width: 100px;
    height: 40px;
    align-self: center;
    user-select: none; /* Prevent text selection on rapid clicks */
}

#main-action-btn:hover {
    opacity: 0.8;
}

#main-action-btn:active {
    transform: scale(0.95);
    opacity: 0.9;
}

#main-action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#main-action-btn.hidden {
    visibility: hidden;
}

/* Resources section */
#resources {
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: center;
    min-height: 60px;
}

.resource {
    font-size: 0.95rem;
}

.resource-name {
    font-weight: 600;
}

.resource-value {
    font-weight: 400;
}

.resource-rate {
    font-size: 0.85rem;
    opacity: 0.7;
}

/* Map */
#map-container {
    width: 100%;
    max-width: 350px;
    margin: 0 auto;
    display: none;
}

#minnesota-map {
    width: 100%;
    height: auto;
}

/* Smaller, more compact upgrades */
#upgrades {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.upgrade {
    background: white;
    border: 2px solid black;
    padding: 10px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.upgrade:hover:not(.disabled):not(.owned):not(.lake-detail) {
    background: black;
    color: white;
}

.upgrade:active:not(.disabled):not(.owned):not(.lake-detail) {
    transform: scale(0.98);
    opacity: 0.9;
}

.upgrade.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    border-color: #ccc;
}

.upgrade.owned {
    opacity: 0.7;
    cursor: default;
    border-color: #999;
    background: #ccc;
}

.upgrade.owned:hover {
    background: #ccc;
    color: black;
}

.upgrade.lake-detail {
    cursor: default;
    border-color: #666;
}

.upgrade.lake-detail:hover {
    background: white;
    color: black;
}

.upgrade-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.upgrade-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.auto-buy-toggle {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    user-select: none;
}

.auto-buy-toggle input[type="checkbox"] {
    cursor: pointer;
}

.upgrade-cost {
    font-size: 0.8rem;
    opacity: 0.8;
}

.upgrade-effect {
    font-size: 0.8rem;
    font-style: italic;
}

.upgrade-count {
    font-size: 0.75rem;
    opacity: 0.6;
}

/* Lake upgrade buttons */
.lake-upgrade-btn {
    background: white;
    border: 1px solid black;
    padding: 4px 8px;
    margin: 2px;
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.2s;
}

.lake-upgrade-btn:hover:not(.disabled) {
    background: black;
    color: white;
}

.lake-upgrade-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    border-color: #ccc;
}

/* Lake dots on map */
.lake-dot {
    fill: #ccc;
    transition: all 0.3s;
}

.lake-dot.stocked {
    fill: #666;
}

.lake-dot.activated {
    fill: black;
    stroke: black;
    stroke-width: 2;
}

/* Minnesota outline */
.mn-outline {
    fill: none;
    stroke: black;
    stroke-width: 2;
}

/* Progress bars */
.progress-bar {
    width: 100%;
    height: 20px;
    border: 2px solid black;
    margin-top: 10px;
}

.progress-fill {
    height: 100%;
    background: black;
    transition: width 0.3s ease;
}

/* Fade animations */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

.fade-out {
    animation: fadeOut 0.5s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* Mobile responsive - stack vertically */
@media (max-width: 1000px) {
    #game-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto 1fr;
        height: auto;
    }
    
    #flavor-text-container {
        border-right: none;
        border-bottom: 1px solid #ccc;
        max-height: 150px;
        padding-bottom: 15px;
        margin-bottom: 15px;
    }
    
    #button-area {
        order: 1;
    }
    
    #counts-area {
        order: 2;
    }
    
    #upgrades-area {
        order: 3;
    }
    
    #main-action-btn {
        padding: 10px 20px;
        font-size: 1rem;
        width: 120px;
        height: 45px;
    }
    
    .upgrade {
        padding: 8px;
    }
}

