body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #3a2e25; /* Dark soil brown */
    color: #fdfdfd;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
    overflow: hidden; /* Prevents scrollbars from popping up */
}

#game-container {
    display: flex;
    width: 95vw;
    height: 95vh;
    max-width: 1600px;
    background: rgba(92, 72, 58, 0.65); /* Glassy brown */
    border-radius: 15px;
    box-shadow: 0 0 30px 8px rgba(0,0,0,0.45), 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    border: 3px solid #7a604d;
    backdrop-filter: blur(12px) saturate(120%);
    -webkit-backdrop-filter: blur(12px) saturate(120%);
}

#left-column {
    flex-basis: 30%;
    padding: 20px;
    text-align: center;
}

.column {
    flex-basis: 35%;
    padding: 20px;
    background: rgba(74, 60, 48, 0.55);
    border-radius: 18px;
    margin: 10px;
    overflow-y: auto;
    box-shadow: 0 4px 32px 0 rgba(31, 38, 135, 0.10), 0 1.5px 8px 0 rgba(0,0,0,0.10);
    border: 1.5px solid rgba(255,255,255,0.08);
    backdrop-filter: blur(8px) saturate(120%);
    -webkit-backdrop-filter: blur(8px) saturate(120%);
}

/* Custom scrollbar for columns */
.column::-webkit-scrollbar {
    width: 8px;
}
.column::-webkit-scrollbar-track {
    background: #4a3c30;
    border-radius: 10px;
}
.column::-webkit-scrollbar-thumb {
    background: #8a6d5a;
    border-radius: 10px;
}
.column::-webkit-scrollbar-thumb:hover {
    background: #a8856f;
}


h1, h2 {
    color: #ffc400; /* Golden potato color */
    text-shadow: 2px 2px 3px #000;
}

#potato-container {
    position: relative; /* Needed for text overlay */
    margin-bottom: 20px;
    user-select: none; /* Prevents image dragging */
}

#potato {
    width: 250px;
    cursor: pointer;
    transition: transform 0.1s ease;
    filter: drop-shadow(0 0 15px #ffc400a0);
}

#potato:active {
    transform: scale(0.95);
}

/* Potato shake animation */
#potato.shake {
    animation: shake 0.2s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: scale(1) rotate(0deg); }
    25% { transform: scale(1.1) rotate(-2deg); }
    75% { transform: scale(1.1) rotate(2deg); }
}

#potato-text-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Clicks go through to the potato */
}

.floating-text {
    position: absolute;
    font-size: 24px;
    font-weight: bold;
    color: #ffc400;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
    animation: float-up 2s ease-out forwards;
    user-select: none;
    z-index: 1000;
}

@keyframes float-up {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(-100px) scale(0.8);
    }
}


#stats {
    margin-bottom: 20px;
    font-size: 1.2em;
}

#generators-container, #upgrades-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.generator, .upgrade {
    background: rgba(92, 72, 58, 0.45);
    border: 2px solid #7a604d;
    padding: 14px 12px;
    border-radius: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 2px 16px 0 rgba(31, 38, 135, 0.10), 0 1.5px 8px 0 rgba(0,0,0,0.10);
    transition: background 0.2s, box-shadow 0.2s;
    backdrop-filter: blur(4px) saturate(120%);
    -webkit-backdrop-filter: blur(4px) saturate(120%);
}

.generator.disabled, .upgrade.disabled {
    background-color: #47392e;
    color: #888;
    cursor: not-allowed;
}

.generator:not(.disabled):hover, .upgrade:not(.disabled):hover {
    background: rgba(255, 196, 0, 0.10);
    box-shadow: 0 4px 24px 0 rgba(255, 196, 0, 0.10);
}

.upgrade.purchased {
    border-color: #ffc400;
    background-color: #5c4a3a;
    cursor: default;
}

.upgrade.purchased:hover {
    background-color: #5c4a3a;
}

.generator-info, .upgrade-info {
    flex-grow: 1;
}

.generator-info h3, .upgrade-info h3 {
    margin: 0 0 5px 0;
    color: #ffdf80;
}

.generator-info p, .upgrade-info p {
    margin: 0;
    font-size: 0.9em;
}

.generator-details, .upgrade-details {
    text-align: right;
}

.generator-owned, .upgrade-power {
    font-size: 1.5em;
    font-weight: bold;
}

.cost {
    font-size: 1.1em;
    color: #aaffaa; /* Light green for cost */
}

.upgrade-cost {
    font-size: 1.1em;
    color: #aaffaa; /* Light green for cost */
}

button {
    background-color: #8a6d5a;
    color: white;
    border: 2px solid #a8856f;
    padding: 10px 15px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 16px;
    cursor: pointer;
    border-radius: 5px;
    transition: background-color 0.2s;
}

button:hover:not(:disabled) {
    background-color: #a8856f;
}

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

/* Settings Button */
#settings-button-container {
    margin-top: auto; /* Pushes the button to the bottom */
    padding-top: 20px;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(30, 20, 10, 0.35);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(10px) saturate(120%);
    -webkit-backdrop-filter: blur(10px) saturate(120%);
}

.modal-content {
    background: rgba(92, 72, 58, 0.45);
    padding: 30px;
    border-radius: 22px;
    border: 2.5px solid rgba(255,255,255,0.13);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.20), 0 1.5px 8px 0 rgba(0,0,0,0.10);
    text-align: center;
    position: relative;
    width: 90%;
    max-width: 500px;
    backdrop-filter: blur(16px) saturate(120%);
    -webkit-backdrop-filter: blur(16px) saturate(120%);
}

.modal-content h2 {
    margin-top: 0;
}

.modal-buttons {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 15px;
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 28px;
    font-weight: bold;
    color: #fdfdfd;
    background: none;
    border: none;
    cursor: pointer;
}

.danger {
    background-color: #c0392b;
    border-color: #e74c3c;
}

.danger:hover {
    background-color: #e74c3c;
}

.attribution {
    margin-top: 20px;
    font-size: 0.8em;
    color: #ccc;
}

.attribution a {
    color: #ffc400;
    text-decoration: none;
}

.attribution a:hover {
    text-decoration: underline;
}

/* Golden Potato Styles */
#golden-potato-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000; /* On top of everything */
    pointer-events: none; /* Don't block other interactions */
    overflow: hidden;
}

.golden-potato {
    position: absolute;
    width: 80px; /* Smaller than the main potato */
    height: auto;
    background-image: url('assets/potato.svg');
    background-size: contain;
    filter: grayscale(100%) brightness(2.5) sepia(100%) hue-rotate(-50deg) saturate(5);
    cursor: pointer;
    pointer-events: all; /* It can be clicked */
    animation: shimmer 2s infinite, float-in 0.5s ease-out;
    border-radius: 50%;
    box-shadow: 0 0 25px 10px #ffc400;
}

@keyframes shimmer {
    0%, 100% { filter: grayscale(100%) brightness(2.5) sepia(100%) hue-rotate(-50deg) saturate(5); }
    50% { filter: grayscale(100%) brightness(3.5) sepia(100%) hue-rotate(-50deg) saturate(10); }
}

@keyframes float-in {
    from { transform: scale(0); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* Buff Display */
#buff-display {
    margin-top: 15px;
    padding: 10px;
    min-height: 50px;
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    text-align: center;
}

.buff {
    font-size: 1.1em;
    color: #ffc400;
    text-shadow: 1px 1px 2px #000;
}

/* Achievements Grid */
#achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 10px;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 10px; /* For scrollbar */
}

.achievement-tile {
    width: 70px;
    height: 70px;
    border: 2px solid #7a604d;
    border-radius: 8px;
    position: relative;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-size: 1.2em;
    transition: transform 0.2s, box-shadow 0.2s;
}

.achievement-tile:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.achievement-tile.locked {
    background-color: #4a3c30;
    color: #6d5646;
    border-color: #5d4a3a;
}

.achievement-tile.unlocked {
    background-color: #8a6d5a;
    color: #fff;
    border-color: #ffc400;
    box-shadow: 0 0 10px rgba(255, 196, 0, 0.3);
}

.achievement-icon {
    font-size: 1.8em;
    margin-bottom: 2px;
}

.achievement-tooltip {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #2c1810;
    color: #fdfdfd;
    padding: 10px;
    border-radius: 5px;
    white-space: nowrap;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    border: 1px solid #7a604d;
    max-width: 200px;
    white-space: normal;
    text-align: center;
}

.achievement-tile:hover .achievement-tooltip {
    opacity: 1;
}

.achievement-desc {
    font-size: 0.8em;
    margin: 5px 0;
}

.achievement-reward {
    font-size: 0.7em;
    color: #ffc400;
    font-style: italic;
    margin: 3px 0;
}

.achievement-status {
    font-size: 0.7em;
    font-weight: bold;
    margin-top: 5px;
}

/* Achievement Detail Modal */
.achievement-detail-modal .modal-content {
    max-width: 500px;
    text-align: center;
}

.achievement-detail-content h2 {
    color: #ffc400;
    margin-bottom: 20px;
    font-size: 1.8em;
}

.achievement-detail-body {
    padding: 20px 0;
}

.achievement-desc-large {
    font-size: 1.2em;
    margin-bottom: 15px;
    color: #e0e0e0;
}

.achievement-reward-large {
    font-size: 1.1em;
    color: #ffc400;
    margin-bottom: 20px;
    padding: 10px;
    background-color: #4a3c30;
    border-radius: 8px;
}

.achievement-status-large {
    font-size: 1.3em;
    font-weight: bold;
    padding: 15px;
    border-radius: 10px;
    margin-top: 15px;
}

.achievement-status-large.unlocked {
    background-color: #2d5a2d;
    color: #90ee90;
    border: 2px solid #4caf50;
}

.achievement-status-large.locked {
    background-color: #5a2d2d;
    color: #ff9999;
    border: 2px solid #f44336;
}

/* Achievement Notification */
#achievement-notification {
    position: fixed;
    bottom: 20px;
    right: -400px; /* Start off-screen */
    width: 350px;
    background-color: #5c483a;
    border: 2px solid #ffc400;
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    transition: right 0.5s ease-in-out;
    z-index: 4000;
}

#achievement-notification.show {
    right: 20px;
}

#achievement-notification h3 {
    margin: 0 0 10px 0;
    color: #ffc400;
}

/* Tabs for Middle Column */
.tabs {
    display: flex;
    margin-bottom: 15px;
    border-bottom: 2px solid #7a604d;
}

.tab-link {
    padding: 10px 20px;
    cursor: pointer;
    background-color: transparent;
    border: none;
    color: #c5a88d;
    font-size: 1.1em;
    border-bottom: 3px solid transparent;
}

.tab-link.active {
    color: #ffc400;
    border-bottom: 3px solid #ffc400;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Prestige Styles */
#prestige-tab {
    text-align: center;
}

#prestige-info {
    font-size: 1.2em;
    margin: 20px 0;
}

#prestige-gain {
    color: #ffc400;
    font-weight: bold;
}

#prestige-upgrades-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

.prestige-upgrade {
    background-color: #4a3c30;
    border: 2px solid #7a604d;
    padding: 15px;
    border-radius: 8px;
    text-align: left;
}

.prestige-upgrade.purchased {
    border-color: #ffc400;
}
.prestige-upgrade.purchased .prestige-upgrade-cost {
    color: #8a6d5a;
}

/* Achievement Notification */
.achievement-notification {
    position: fixed;
    bottom: -100px;
    right: 20px;
    background: linear-gradient(135deg, #ffc400, #ff9500);
    color: #2c1810;
    padding: 15px 20px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(255, 196, 0, 0.4);
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 15px;
    min-width: 280px;
    transition: bottom 0.5s ease-out, opacity 0.5s ease-out;
    opacity: 0;
    border: 2px solid #ffdf80;
}

.achievement-notification.show {
    bottom: 20px;
    opacity: 1;
}

.achievement-icon {
    font-size: 2em;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.achievement-text {
    flex: 1;
}

.achievement-title {
    font-weight: bold;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 3px;
}

.achievement-name {
    font-size: 1.1em;
    font-weight: 600;
}

/* Random Event Notification */
.random-event-notification {
    position: fixed;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #8a6d5a, #a8856f);
    color: #fff;
    padding: 20px 30px;
    border-radius: 15px;
    box-shadow: 0 6px 25px rgba(0,0,0,0.4);
    z-index: 10000;
    text-align: center;
    min-width: 300px;
    transition: top 0.5s ease-out, opacity 0.5s ease-out;
    opacity: 0;
    border: 3px solid #ffc400;
}

.random-event-notification.show {
    top: 20px;
    opacity: 1;
}

.event-title {
    font-size: 1.4em;
    font-weight: bold;
    margin-bottom: 8px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.event-description {
    font-size: 1.1em;
    color: #ffdf80;
}

/* Export/Import Modal Styles */
.export-modal-content, .import-modal-content {
    background-color: #4a3c30;
    padding: 30px;
    border-radius: 15px;
    max-width: 600px;
    width: 90%;
    text-align: center;
    border: 3px solid #7a604d;
    box-shadow: 0 10px 40px rgba(0,0,0,0.6);
}

.export-modal-content h2, .import-modal-content h2 {
    color: #ffc400;
    margin-bottom: 20px;
    font-size: 1.8em;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

#export-textarea, #import-textarea {
    background-color: #2e241d;
    color: #fdfdfd;
    border: 2px solid #7a604d;
    border-radius: 8px;
    padding: 10px;
    resize: vertical;
    min-height: 150px;
}

#export-textarea:focus, #import-textarea:focus {
    outline: none;
    border-color: #ffc400;
    box-shadow: 0 0 10px rgba(255, 196, 0, 0.3);
}

#copy-export-btn, #import-confirm-btn {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    margin-right: 10px;
    transition: all 0.3s ease;
}

#copy-export-btn:hover, #import-confirm-btn:hover {
    background: linear-gradient(135deg, #45a049, #3d8b40);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

#close-export-btn, #close-import-btn {
    background: linear-gradient(135deg, #666, #555);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
}

#close-export-btn:hover, #close-import-btn:hover {
    background: linear-gradient(135deg, #555, #444);
    transform: translateY(-2px);
}

/* Quality Control System Styles */
#quality-stats {
    background: linear-gradient(135deg, #4a3c30, #3a2e25);
    border: 2px solid #7a604d;
    border-radius: 10px;
    padding: 15px;
    margin: 15px 0;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

#quality-stats p {
    margin: 8px 0;
    font-size: 0.9em;
}

#quality-inspect-btn, #quality-upgrade-btn {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    margin: 5px;
    transition: all 0.3s ease;
    font-size: 0.8em;
}

#quality-inspect-btn:hover, #quality-upgrade-btn:hover {
    background: linear-gradient(135deg, #45a049, #3d8b40);
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(76, 175, 80, 0.3);
}

#quality-inspect-btn:disabled, #quality-upgrade-btn:disabled {
    background: linear-gradient(135deg, #666, #555);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.quality-level-display {
    color: #ffc400;
    font-weight: bold;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.quality-points-display {
    color: #4CAF50;
    font-weight: bold;
}

.quality-bonus-display {
    color: #ffc400;
    font-weight: bold;
    text-shadow: 0 1px 3px rgba(255, 196, 0, 0.3);
}

.defects-display {
    color: #ff6b6b;
    font-weight: bold;
}

/* Research Lab Styles */
#research-tab {
    text-align: center;
}

#research-stats {
    font-size: 1.2em;
    margin: 20px 0;
    color: #ffc400;
    font-weight: bold;
}

#research-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

.research-project {
    background: rgba(74, 60, 48, 0.45);
    border: 2px solid #7a604d;
    padding: 18px 14px;
    border-radius: 14px;
    text-align: left;
    cursor: pointer;
    box-shadow: 0 2px 16px 0 rgba(31, 38, 135, 0.10), 0 1.5px 8px 0 rgba(0,0,0,0.10);
    transition: background 0.2s, box-shadow 0.2s;
    backdrop-filter: blur(4px) saturate(120%);
    -webkit-backdrop-filter: blur(4px) saturate(120%);
}

.research-project:not(.disabled):not(.completed):hover {
    border-color: #ffc400;
    background: rgba(255, 196, 0, 0.10);
    box-shadow: 0 4px 24px 0 rgba(255, 196, 0, 0.10);
    transform: translateY(-2px);
}

.research-project.disabled {
    background-color: #47392e;
    color: #888;
    cursor: not-allowed;
}

.research-project.completed {
    border-color: #ffc400;
    background-color: #5c4a3a;
    cursor: default;
}

.research-project.active {
    border-color: #4CAF50;
    cursor: default;
}

.research-cost {
    font-size: 1.1em;
    color: #aaffaa;
    margin-top: 10px;
}

.research-duration {
    font-size: 0.9em;
    color: #c5a88d;
}

.research-progress-bar {
    width: 100%;
    background-color: #2e241d;
    border-radius: 5px;
    height: 20px;
    margin-top: 10px;
    overflow: hidden;
}

.research-progress {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #81C784);
    border-radius: 5px;
    transition: width 0.5s ease;
}

.research-time-left {
    font-size: 0.9em;
    color: #90ee90;
    margin-top: 5px;
}

@keyframes item-purchased {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); background-color: #2ecc71; }
    100% { transform: scale(1); }
}

.item-purchased-animation {
    animation: item-purchased 0.4s ease-out;
}
