@font-face {
    font-family: 'MinecraftSeven';
    src: url('Minecraft Seven_2.ttf') format('truetype');
}

body {
    background-color: black;
    margin: 0;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    width: 100vw;
    user-select: none;
}

img {
    user-select: none;
}

#banner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: #585858;
    border-bottom: 2px solid #000;
    z-index: 12;
    overflow: hidden;
    white-space: nowrap;
    padding: 5px 0;
    box-sizing: border-box;
}

#banner p {
    margin: 0;
    display: inline-block;
    color: white;
    font-family: 'MinecraftSeven', 'Courier New', Courier, monospace;
    font-size: 20px;
    text-shadow: 2px 2px #222;
    animation: scroll-left 15s linear infinite;
    padding-left: 100%;
}

@keyframes scroll-left {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-100%);
    }
}

#game-container {
    background-image: linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5)), url('stone.png');
    background-size: 64px;
    image-rendering: pixelated;
    aspect-ratio: 9 / 16;
    max-width: 100vw;
    max-height: 100vh;
    height: 100%;
    position: relative;
    overflow: hidden;
}

#game-container[data-dimension="summer"] {
    background-image: linear-gradient(rgba(0,0,0,0.1), rgba(0,0,0,0.1)), url('sand.webp');
}

#game-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    box-shadow: inset 0 0 100px rgba(0,0,0,0.5);
    pointer-events: none;
}

#rain-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.raining-stone {
    position: absolute;
    width: 32px;
    height: 32px;
    background-image: url('stone.png');
    background-size: contain;
    image-rendering: pixelated;
    opacity: 0.5;
    animation: fall linear forwards;
    top: -32px; /* Start off-screen */
}

@keyframes fall {
    to {
        transform: translateY(100vh) rotate(var(--rotation-end, 360deg));
        opacity: 0;
    }
}

#resource-display {
    position: absolute;
    top: 20px;
    left: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 10;
}

#resource-counter, #summer-token-counter {
    display: flex;
    align-items: center;
    color: white;
    font-family: 'MinecraftSeven', 'Courier New', Courier, monospace;
    font-size: 28px;
    text-shadow: 2px 2px 2px #000000;
    background-color: rgba(16, 16, 16, 0.6);
    padding: 8px 12px;
    border: 2px solid #000;
    box-shadow: inset 0 0 0 2px #585858;
}

.resource-icon {
    width: 32px;
    height: 32px;
    margin-right: 10px;
    image-rendering: pixelated;
}

#stone-block {
    position: absolute;
    bottom: 32px;
    right: 32px;
    width: 256px;
    height: 256px;
    image-rendering: pixelated;
    z-index: 1;
}

#destroy-overlay {
    position: absolute;
    bottom: 32px;
    right: 32px;
    width: 256px;
    height: 256px;
    image-rendering: pixelated;
    z-index: 2;
    visibility: hidden;
}

#pickaxe {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 256px;
    image-rendering: pixelated;
    transition: transform 0.3s ease-in-out;
    transform-origin: bottom left;
    z-index: 3;
}

#upgrade-button {
    position: absolute;
    top: 20px;
    right: 20px;
    left: auto;
    transform: none;
    padding: 10px 16px;
    font-family: 'MinecraftSeven', sans-serif;
    font-size: 20px;
    color: white;
    text-shadow: 2px 2px #333;
    background-color: #48D1CC; /* Teal from beachball */
    border: 2px solid #000;
    box-shadow: inset -2px -4px 0px 0px #308A8A, inset 2px 2px 0px 0px #8CF2EE; /* Darker/Lighter Teal */
    cursor: pointer;
    z-index: 20;
}

#upgrade-button:active {
    box-shadow: inset 2px 2px 0px 0px #308A8A;
    text-shadow: 1px 1px #222;
}

#upgrade-menu {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: linear-gradient(rgba(0,0,0,0.7), rgba(0,0,0,0.7)), url('stone.png');
    background-size: 64px;
    image-rendering: pixelated;
    display: none; /* Changed from transform */
    z-index: 15;
    box-sizing: border-box;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

#upgrade-menu.open {
    display: flex; /* Changed from transform */
}

#upgrade-menu-panel {
    background-color: #C6C6C6;
    border: 2px solid #000000;
    box-shadow: inset 0 0 0 4px #585858;
    width: 100%;
    height: 100%;
    max-width: 500px;
    max-height: 700px;
    display: flex;
    flex-direction: column;
    padding: 15px;
    box-sizing: border-box;
}

#upgrade-tabs {
    display: flex;
    gap: 5px;
    border-bottom: 4px solid #585858;
    padding-bottom: 5px;
    margin-bottom: 10px;
}

.tab-button {
    padding: 8px 12px;
    font-family: 'MinecraftSeven', sans-serif;
    font-size: 16px;
    color: white;
    text-shadow: 2px 2px #333;
    background-color: #585858;
    border: 2px solid #000;
    box-shadow: inset -2px -4px 0px 0px #333, inset 2px 2px 0px 0px #9e9e9e;
    cursor: pointer;
    flex-grow: 1;
}

.tab-button.active {
    background-color: #7f7f7f;
    box-shadow: inset -2px -4px 0px 0px #585858, inset 2px 2px 0px 0px #c6c6c6;
}

.tab-button:active:not(.active) {
    box-shadow: inset 2px 2px 0px 0px #333;
}

#upgrade-panels {
    width: 100%;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    padding: 10px 5px 5px 5px;
    box-sizing: border-box;
    background-color: #8b8b8b;
    border: 2px solid #000000;
    box-shadow: inset 2px 3px 0px 0px #585858;
}

/* Custom Scrollbar */
#upgrade-panels::-webkit-scrollbar {
    width: 18px;
}

#upgrade-panels::-webkit-scrollbar-track {
    background: #585858;
    border-left: 2px solid #000;
    border-top: 2px solid #000;
    border-bottom: 2px solid #000;
}

#upgrade-panels::-webkit-scrollbar-thumb {
    background-color: #C6C6C6;
    border: 2px solid #000;
    box-shadow: inset -2px -4px 0px 0px #8b8b8b, inset 2px 2px 0px 0px #ffffff;
}

.tab-content {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 100%;
}

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

#copper-ore-upgrade,
#iron-ore-upgrade,
#gold-ore-upgrade,
#ancient-debris-upgrade,
#golden-pickaxe-upgrade,
#diamond-pickaxe-upgrade,
#netherite-pickaxe-upgrade,
#nether-dimension-upgrade,
#quarry-dimension-upgrade {
    display: none; /* Hidden by default until prerequisites are met */
}

.upgrade-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 10px;
    background-color: #c6c6c6;
    border: 2px solid #000;
    padding: 10px;
    font-family: 'MinecraftSeven', sans-serif;
    color: #3a3a3a;
    box-shadow: inset -2px -2px 0 0 #8B8B8B, inset 2px 2px 0 0 #FFFFFF;
    width: 100%;
    box-sizing: border-box;
}

.upgrade-item.owned {
    background-color: #a9a9a9;
    box-shadow: inset -2px -2px 0 0 #808080, inset 2px 2px 0 0 #dcdcdc;
}

.upgrade-item-slot {
    width: 64px;
    height: 64px;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #8b8b8b;
    border: 2px solid #000000;
    box-shadow: inset 2px 3px 0px 0px #585858;
}

.upgrade-item img {
    width: 52px;
    height: 52px;
    image-rendering: pixelated;
}

.upgrade-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex-grow: 1;
}

.upgrade-info h3 {
    margin: 0;
    font-size: 20px;
    color: black;
    text-shadow: 2px 2px #ddd;
    display: flex;
    align-items: center;
    gap: 10px;
}

.limited-tag {
    background-color: #ff5555;
    color: white;
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 4px;
    text-shadow: 1px 1px #800000;
    font-family: sans-serif;
    font-weight: bold;
}

.upgrade-info p {
    margin: 5px 0 0 0;
    font-size: 14px;
}

.upgrade-info .cost {
    display: flex;
    align-items: center;
    font-weight: bold;
    height: 21px; /* Reserve space to prevent layout shift */
}

.resource-icon-small {
    width: 16px;
    height: 16px;
    image-rendering: pixelated;
    margin-left: 5px;
}

.buy-button {
    margin-left: auto;
    padding: 8px 16px;
    font-family: 'MinecraftSeven', sans-serif;
    font-size: 16px;
    color: white;
    text-shadow: 2px 2px #333;
    background-color: #7f7f7f;
    border: 2px solid #000;
    box-shadow: inset -2px -4px 0px 0px #585858, inset 2px 2px 0px 0px #c6c6c6;
    cursor: pointer;
    align-self: center;
    white-space: nowrap;
}

.buy-button:active {
    box-shadow: inset 2px 2px 0px 0px #585858;
    text-shadow: 1px 1px #222;
}

.buy-button.disabled {
    background-color: #585858;
    color: #9e9e9e;
    text-shadow: 1px 1px #222;
    cursor: not-allowed;
    box-shadow: inset 2px 2px 0px 0px #333;
}

#secret-button {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100px;
    height: 100px;
    z-index: 999;
}

#pickaxe:hover {
    transform: translate(-50%, -50%) scale(1.1);
}

#pickaxe.swing {
    animation: swing ease-in-out;
    animation-duration: 1s; /* Default duration */
}

@keyframes swing {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    25% { transform: translate(-50%, -50%) rotate(45deg); }
    50% { transform: translate(-50%, -50%) rotate(-25deg); }
    75% { transform: translate(-50%, -50%) rotate(45deg); }
    100% { transform: translate(-50%, -50%) rotate(0deg); }
}

#update-animation-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 2000;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-family: 'MinecraftSeven', 'Courier New', Courier, monospace;
    color: white;
    text-shadow: 4px 4px #222;
    text-align: center;
    opacity: 1;
    transition: opacity 0.5s ease-out;
}

#update-animation-overlay.fade-out {
    opacity: 0;
    pointer-events: none;
}

#update-title {
    font-size: 4vw;
    margin-bottom: 5vh;
    animation: fadeIn 1s ease-out forwards;
}

#update-content-container {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 10vw;
    width: 100%;
}

.update-showcase-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2vh;
    animation: dropIn 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.update-showcase-item.hidden, #update-title.hidden {
    opacity: 0;
    visibility: hidden;
}

.update-showcase-item h2 {
    font-size: 3vw;
    margin: 0;
}
.update-showcase-item h3 {
    font-size: 2.5vw;
    margin: 0;
    color: #FFAA00; /* Gold color */
    text-shadow: 3px 3px #332200;
}

.update-showcase-item img {
    width: 15vw;
    height: 15vw;
    max-width: 200px;
    max-height: 200px;
    image-rendering: pixelated;
    border: 4px solid #585858;
    background-color: #C6C6C6;
    box-shadow: 4px 4px 0 #000, inset 4px 4px 0 #8B8B8B;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes dropIn {
    from { opacity: 0; transform: translateY(-50px) scale(0.5); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

#splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #000;
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    cursor: pointer;
    opacity: 1;
    transition: opacity 0.5s ease-out;
}

#splash-screen.visible {
    display: flex;
}

#splash-screen.hiding {
    opacity: 0;
}

#splash-screen img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    image-rendering: pixelated;
}

#confetti-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}