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

body {
    font-family: 'Fredoka', sans-serif;
    background: linear-gradient(180deg, #1a0f0a 0%, #0d0705 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow: hidden;
}

/* ===== INTRO CUTSCENE ===== */
#intro-screen {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: #87CEEB;
    display: flex;
    justify-content: center;
    align-items: center;
}

#intro-screen.hidden {
    display: none;
}

#intro-scene {
    position: relative;
    width: 100%;
    min-width: 1200px;
    height: 100vh;
    min-height: 900px;
    overflow: hidden;
}

#intro-sky {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 60%;
    background: linear-gradient(180deg, #4a90c2 0%, #87CEEB 60%, #a8d8ea 100%);
}

.intro-sun {
    position: absolute;
    top: 60px;
    right: 150px;
    font-size: 160px;
    animation: sun-pulse 3s ease-in-out infinite;
}

.intro-cloud {
    position: absolute;
    font-size: 120px;
    opacity: 0.9;
}

.cloud1 {
    top: 80px;
    left: 10%;
    animation: cloud-float 15s ease-in-out infinite;
}

.cloud2 {
    top: 180px;
    left: 50%;
    animation: cloud-float 20s ease-in-out infinite reverse;
}

@keyframes cloud-float {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(30px); }
}

#intro-ground {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40%;
    background: linear-gradient(180deg, #7cb342 0%, #558b2f 30%, #33691e 100%);
}

/* House */
#intro-house {
    position: absolute;
    bottom: 38%;
    right: 15%;
    width: 200px;
    height: 180px;
}

.house-body {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 120px;
    background: linear-gradient(135deg, #8d6e63 0%, #6d4c41 100%);
    border-radius: 5px;
}

.house-roof {
    position: absolute;
    bottom: 115px;
    left: -20px;
    width: 0;
    height: 0;
    border-left: 120px solid transparent;
    border-right: 120px solid transparent;
    border-bottom: 80px solid #5d4037;
}

.house-window {
    position: absolute;
    top: 20px;
    left: 25px;
    width: 50px;
    height: 40px;
    background: linear-gradient(135deg, #bbdefb 0%, #64b5f6 100%);
    border: 4px solid #4e342e;
    border-radius: 3px;
}

.house-door {
    position: absolute;
    bottom: 0;
    right: 30px;
    width: 45px;
    height: 70px;
    background: linear-gradient(135deg, #5d4037 0%, #3e2723 100%);
    border-radius: 3px 3px 0 0;
}

.house-door::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 8px;
    width: 8px;
    height: 8px;
    background: #ffd700;
    border-radius: 50%;
}

.house-chimney {
    position: absolute;
    bottom: 160px;
    right: 40px;
    width: 30px;
    height: 50px;
    background: #795548;
}

/* Wooden Board */
#wooden-board {
    position: absolute;
    bottom: 38%;
    left: 25%;
    transform: translateX(-50%);
}

.board-post {
    position: absolute;
    bottom: -60px;
    left: 50%;
    transform: translateX(-50%);
    width: 15px;
    height: 120px;
    background: linear-gradient(90deg, #5d4037 0%, #8d6e63 50%, #5d4037 100%);
    border-radius: 3px;
}

.board-sign {
    position: relative;
    width: 180px;
    height: 140px;
    background: linear-gradient(135deg, #a1887f 0%, #8d6e63 50%, #6d4c41 100%);
    border: 6px solid #5d4037;
    border-radius: 5px;
    padding: 10px;
    box-shadow: 3px 3px 10px rgba(0,0,0,0.3);
}

#death-marks {
    position: absolute;
    top: 8px;
    left: 10px;
    font-family: 'Caveat', cursive;
    font-size: 32px;
    font-weight: bold;
    color: #3e2723;
    opacity: 0;
}

#sale-paper {
    position: absolute;
    top: 35px;
    left: 50%;
    transform: translateX(-50%) rotate(-2deg);
    width: 140px;
    background: #fffef0;
    padding: 8px;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.2);
    opacity: 0;
    transform-origin: top center;
}

.paper-pin {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 20px;
}

.paper-content {
    font-family: 'Caveat', cursive;
    text-align: center;
    color: #2e2e2e;
}

.sale-title {
    font-size: 22px;
    font-weight: bold;
    color: #c62828;
    margin-bottom: 2px;
}

.sale-price {
    font-size: 18px;
    font-weight: bold;
    color: #2e7d32;
}

.sale-desc {
    font-size: 14px;
    line-height: 1.2;
    margin: 4px 0;
}

.chest-drawing {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
    margin-top: 5px;
}

.drawn-chest {
    font-size: 28px;
}

.drawn-money {
    font-size: 20px;
    animation: money-bounce 0.5s ease-in-out infinite;
}

@keyframes money-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

/* Truck */
#intro-truck {
    position: absolute;
    bottom: 32%;
    left: -250px;
    width: 200px;
    height: 100px;
}

#intro-truck.drive-in {
    animation: truck-drive-in 3s ease-out forwards;
}

@keyframes truck-drive-in {
    0% { left: -250px; }
    100% { left: 5%; }
}

.truck-cabin {
    position: absolute;
    bottom: 25px;
    left: 0;
    width: 80px;
    height: 60px;
    background: linear-gradient(135deg, #e53935 0%, #c62828 100%);
    border-radius: 10px 10px 5px 5px;
}

.truck-window {
    position: absolute;
    top: 8px;
    left: 10px;
    width: 55px;
    height: 30px;
    background: linear-gradient(135deg, #bbdefb 0%, #64b5f6 100%);
    border-radius: 5px 5px 0 0;
}

.truck-bed {
    position: absolute;
    bottom: 25px;
    left: 75px;
    width: 110px;
    height: 45px;
    background: linear-gradient(135deg, #c62828 0%, #b71c1c 100%);
    border-radius: 3px;
}

.truck-wheel {
    position: absolute;
    bottom: 5px;
    width: 40px;
    height: 40px;
    background: radial-gradient(circle, #424242 60%, #212121 100%);
    border-radius: 50%;
    border: 4px solid #616161;
}

.wheel-front { left: 15px; }
.wheel-back { left: 130px; }

#intro-truck.drive-in .truck-wheel {
    animation: wheel-spin 0.5s linear infinite;
}

@keyframes wheel-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Man Character */
#intro-man {
    position: absolute;
    bottom: 35%;
    left: 8%;
    width: 60px;
    height: 100px;
    opacity: 0;
    transform: scale(0.9);
}

#intro-man.exit-truck {
    animation: man-exit 1s ease-out forwards;
}

@keyframes man-exit {
    0% { opacity: 0; transform: scale(0.8) translateX(-20px); }
    100% { opacity: 1; transform: scale(1) translateX(0); }
}

#intro-man.walk-to-board {
    animation: man-walk 2.5s ease-in-out forwards;
}

@keyframes man-walk {
    0% { left: 8%; }
    100% { left: 20%; }
}

#intro-man.walking .man-leg.left {
    animation: leg-walk-left 0.4s ease-in-out infinite;
}

#intro-man.walking .man-leg.right {
    animation: leg-walk-right 0.4s ease-in-out infinite;
}

@keyframes leg-walk-left {
    0%, 100% { transform: rotate(-20deg); }
    50% { transform: rotate(20deg); }
}

@keyframes leg-walk-right {
    0%, 100% { transform: rotate(20deg); }
    50% { transform: rotate(-20deg); }
}

.man-head {
    position: relative;
    width: 35px;
    height: 35px;
    margin: 0 auto;
}

.man-face {
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, #ffcc99 0%, #e6b380 100%);
    border-radius: 50% 50% 45% 45%;
}

.man-face::before {
    content: '';
    position: absolute;
    top: 40%;
    left: 20%;
    width: 8px;
    height: 6px;
    background: #2a2a2a;
    border-radius: 50%;
    box-shadow: 15px 0 0 #2a2a2a;
}

.man-hat {
    position: absolute;
    top: -8px;
    left: -3px;
    width: 41px;
    height: 20px;
    background: linear-gradient(180deg, #8B4513 0%, #6b3410 100%);
    border-radius: 50% 50% 0 0;
}

.man-body {
    width: 30px;
    height: 35px;
    margin: 3px auto 0;
    background: linear-gradient(180deg, #1565c0 0%, #0d47a1 100%);
    border-radius: 5px 5px 0 0;
}

.man-arm {
    position: absolute;
    top: 40px;
    right: 0;
    width: 30px;
    height: 12px;
    background: #1565c0;
    border-radius: 6px;
    transform-origin: left center;
}

.man-marker {
    position: absolute;
    right: -5px;
    top: -8px;
    font-size: 18px;
    opacity: 0;
}

#intro-man.writing .man-marker {
    opacity: 1;
}

#intro-man.writing .man-arm {
    animation: arm-write 0.8s ease-in-out infinite;
}

@keyframes arm-write {
    0%, 100% { transform: rotate(-30deg); }
    50% { transform: rotate(-50deg); }
}

.man-legs {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-top: 2px;
}

.man-leg {
    width: 10px;
    height: 28px;
    background: linear-gradient(180deg, #5d4037 0%, #3e2723 100%);
    border-radius: 0 0 4px 4px;
    transform-origin: top center;
}

/* Skip button */
#skip-intro {
    position: absolute;
    bottom: 30px;
    right: 30px;
    padding: 12px 24px;
    font-family: 'Fredoka', sans-serif;
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 1001;
}

#skip-intro:hover {
    background: rgba(0, 0, 0, 0.7);
    border-color: rgba(255, 255, 255, 0.5);
}

/* Death mark animation */
@keyframes mark-appear {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); opacity: 1; }
}

/* Paper pin animation */
@keyframes paper-pin {
    0% { 
        transform: translateX(-50%) rotate(-2deg) translateY(-30px);
        opacity: 0;
    }
    60% { 
        transform: translateX(-50%) rotate(3deg) translateY(5px);
    }
    100% { 
        transform: translateX(-50%) rotate(-2deg) translateY(0);
        opacity: 1;
    }
}

/* ===== GAME STYLES ===== */
#game-container {
    position: relative;
    width: 100%;
    min-width: 1200px;
    max-width: 1400px;
    height: 100vh;
    min-height: 1000px;
    overflow: hidden;
    background: #87CEEB;
}

/* Workshop Building */
#workshop {
    position: fixed;
    top: 120px;
    left: 60px;
    z-index: 60;
}

.workshop-building {
    position: relative;
    width: 240px;
}

.workshop-roof {
    width: 0;
    height: 0;
    border-left: 130px solid transparent;
    border-right: 130px solid transparent;
    border-bottom: 80px solid #8B4513;
    margin-left: -10px;
}

.workshop-body {
    width: 240px;
    height: 160px;
    background: linear-gradient(135deg, #deb887 0%, #d2a679 50%, #c4956a 100%);
    border: 5px solid #8B4513;
    border-radius: 0 0 10px 10px;
    position: relative;
}

.workshop-sign {
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: #5d4037;
    color: #ffd700;
    padding: 8px 20px;
    border-radius: 8px;
    font-size: 24px;
    font-weight: bold;
    white-space: nowrap;
}

.workshop-window {
    position: absolute;
    top: 25px;
    left: 25px;
    width: 70px;
    height: 55px;
    background: linear-gradient(135deg, #87CEEB 0%, #64b5f6 100%);
    border: 5px solid #5d4037;
    border-radius: 8px;
}

.workshop-counter {
    position: absolute;
    bottom: 0;
    right: 20px;
    width: 100px;
    height: 70px;
    background: linear-gradient(180deg, #8d6e63 0%, #6d4c41 100%);
    border-radius: 8px 8px 0 0;
}

.workshop-counter::after {
    content: '🧑‍🔧';
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 56px;
}

#shop-prompt {
    text-align: center;
    margin-top: 20px;
    padding: 14px 28px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    border-radius: 25px;
    font-size: 22px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#shop-prompt.visible {
    opacity: 1;
}

#shop-prompt .key {
    display: inline-block;
    background: #ffd700;
    color: #000;
    padding: 4px 14px;
    border-radius: 8px;
    font-weight: bold;
    margin: 0 8px;
    font-size: 24px;
}

/* Shop Modal */
#shop-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 500;
}

#shop-modal.active {
    display: flex;
}

.shop-content {
    background: linear-gradient(135deg, #4a3728 0%, #2d2118 100%);
    border: 8px solid #8B4513;
    border-radius: 24px;
    padding: 40px;
    min-width: 500px;
    max-width: 600px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
}

.shop-content h2 {
    color: #ffd700;
    font-size: 32px;
    text-align: center;
    margin-bottom: 20px;
}

#shop-inventory {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 20px;
    max-height: 300px;
    overflow-y: auto;
}

.shop-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
}

.shop-item:last-child {
    margin-bottom: 0;
}

.shop-item-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.shop-item-icon {
    font-size: 32px;
}

.shop-item-name {
    color: #f4e4bc;
    font-size: 18px;
}

.shop-item-count {
    color: #aaa;
    font-size: 14px;
}

.shop-item-value {
    color: #4caf50;
    font-size: 20px;
    font-weight: bold;
}

.shop-empty {
    color: #888;
    text-align: center;
    padding: 30px;
    font-size: 18px;
}

.shop-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: rgba(255, 215, 0, 0.2);
    border-radius: 10px;
    margin-bottom: 20px;
}

.shop-total span:first-child {
    color: #f4e4bc;
    font-size: 20px;
}

#shop-total-value {
    color: #4caf50;
    font-size: 28px;
    font-weight: bold;
}

.shop-buttons {
    display: flex;
    gap: 15px;
}

.shop-buttons button {
    flex: 1;
    padding: 15px;
    font-family: 'Fredoka', sans-serif;
    font-size: 20px;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

#sell-all-btn {
    background: linear-gradient(180deg, #4caf50 0%, #388e3c 100%);
    color: #fff;
}

#sell-all-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(76, 175, 80, 0.4);
}

#sell-all-btn:disabled {
    background: #555;
    cursor: not-allowed;
    transform: none;
}

#close-shop-btn {
    background: linear-gradient(180deg, #757575 0%, #616161 100%);
    color: #fff;
}

#close-shop-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

/* Surface Area */
#surface-area {
    position: relative;
    height: 280px;
    background: linear-gradient(180deg, 
        transparent 0%,
        transparent 60%,
        #7cb342 60%,
        #558b2f 100%
    );
}

.grass-surface {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 110px;
    background: linear-gradient(180deg, #8bc34a 0%, #689f38 100%);
}

.mine-entrance {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(180deg, #5d4037 0%, #3e2723 100%);
    color: #ffd700;
    padding: 20px 40px;
    border-radius: 14px 14px 0 0;
    font-size: 28px;
    font-weight: bold;
    border: 5px solid #8B4513;
    border-bottom: none;
}

.inventory-stat {
    background: rgba(139, 69, 19, 0.3);
    padding: 5px 15px;
    border-radius: 20px;
}

/* Upgrade Shop Building */
#upgrade-shop {
    position: fixed;
    top: 120px;
    right: 60px;
    z-index: 60;
}

.upgrade-building {
    position: relative;
    width: 240px;
}

.upgrade-roof {
    width: 0;
    height: 0;
    border-left: 130px solid transparent;
    border-right: 130px solid transparent;
    border-bottom: 80px solid #546e7a;
    margin-left: -10px;
}

.upgrade-body {
    width: 240px;
    height: 160px;
    background: linear-gradient(135deg, #78909c 0%, #607d8b 50%, #546e7a 100%);
    border: 5px solid #455a64;
    border-radius: 0 0 10px 10px;
    position: relative;
}

.upgrade-sign {
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: #37474f;
    color: #ffeb3b;
    padding: 8px 20px;
    border-radius: 8px;
    font-size: 22px;
    font-weight: bold;
    white-space: nowrap;
}

.upgrade-window {
    position: absolute;
    top: 25px;
    left: 25px;
    width: 70px;
    height: 55px;
    background: linear-gradient(135deg, #ffeb3b 0%, #ffc107 100%);
    border: 5px solid #455a64;
    border-radius: 8px;
}

.upgrade-anvil {
    position: absolute;
    bottom: 15px;
    right: 30px;
    font-size: 72px;
}

#upgrade-prompt {
    text-align: center;
    margin-top: 20px;
    padding: 14px 28px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    border-radius: 25px;
    font-size: 22px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#upgrade-prompt.visible {
    opacity: 1;
}

#upgrade-prompt .key {
    display: inline-block;
    background: #ffeb3b;
    color: #000;
    padding: 4px 14px;
    border-radius: 8px;
    font-weight: bold;
    margin: 0 8px;
    font-size: 24px;
}

/* Upgrade Modal */
#upgrade-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 500;
}

#upgrade-modal.active {
    display: flex;
}

.upgrade-content {
    background: linear-gradient(135deg, #37474f 0%, #263238 100%);
    border: 8px solid #546e7a;
    border-radius: 24px;
    padding: 40px;
    min-width: 550px;
    max-width: 650px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
}

.upgrade-content h2 {
    color: #ffeb3b;
    font-size: 40px;
    text-align: center;
    margin-bottom: 20px;
}

.upgrade-money {
    text-align: center;
    color: #81c784;
    font-size: 30px;
    margin-bottom: 25px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
}

#upgrade-money-display {
    font-weight: bold;
}

#upgrades-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.upgrade-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    border: 2px solid transparent;
    transition: all 0.2s ease;
}

.upgrade-item:hover {
    border-color: rgba(255, 235, 59, 0.5);
    background: rgba(255, 255, 255, 0.15);
}

.upgrade-icon {
    font-size: 64px;
    width: 80px;
    text-align: center;
}

.upgrade-info {
    flex: 1;
}

.upgrade-name {
    color: #fff;
    font-size: 26px;
    font-weight: bold;
    margin-bottom: 8px;
}

.upgrade-desc {
    color: #b0bec5;
    font-size: 18px;
    margin-bottom: 8px;
}

.upgrade-level {
    color: #ffeb3b;
    font-size: 18px;
    font-weight: bold;
}

.upgrade-buy-btn {
    padding: 16px 28px;
    font-family: 'Fredoka', sans-serif;
    font-size: 24px;
    font-weight: bold;
    background: linear-gradient(180deg, #4caf50 0%, #388e3c 100%);
    color: #fff;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 100px;
}

.upgrade-buy-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.4);
}

.upgrade-buy-btn:disabled {
    background: linear-gradient(180deg, #616161 0%, #424242 100%);
    cursor: not-allowed;
}

.upgrade-buy-btn.maxed {
    background: linear-gradient(180deg, #ff9800 0%, #f57c00 100%);
}

.upgrade-price {
    display: block;
}

#close-upgrade-btn {
    width: 100%;
    padding: 15px;
    font-family: 'Fredoka', sans-serif;
    font-size: 20px;
    font-weight: 600;
    background: linear-gradient(180deg, #757575 0%, #616161 100%);
    color: #fff;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

#close-upgrade-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

/* Jetpack flame effect */
.jetpack-flame {
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 24px;
    animation: flame-flicker 0.1s infinite;
}

@keyframes flame-flicker {
    0%, 100% { opacity: 1; transform: translateX(-50%) scaleY(1); }
    50% { opacity: 0.8; transform: translateX(-50%) scaleY(0.8); }
}

/* Dynamite explosion effect */
.explosion {
    position: fixed;
    font-size: 80px;
    pointer-events: none;
    z-index: 200;
    animation: explode 0.5s ease-out forwards;
}

@keyframes explode {
    0% { transform: scale(0); opacity: 1; }
    50% { transform: scale(1.5); opacity: 1; }
    100% { transform: scale(2); opacity: 0; }
}

#sky {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 180px;
    background: linear-gradient(180deg, 
        #4a90c2 0%, 
        #87CEEB 40%,
        #a8d8ea 70%,
        #c9e4ca 100%
    );
    z-index: 1;
}

#sky::before {
    content: '☀️';
    position: absolute;
    top: 30px;
    right: 80px;
    font-size: 100px;
    filter: drop-shadow(0 0 30px rgba(255, 200, 50, 0.8));
    animation: sun-pulse 3s ease-in-out infinite;
}

@keyframes sun-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

#sky::after {
    content: '☁️  ☁️';
    position: absolute;
    top: 40px;
    left: 60px;
    font-size: 72px;
    animation: clouds-drift 20s linear infinite;
    opacity: 0.9;
}

@keyframes clouds-drift {
    0% { transform: translateX(0); }
    100% { transform: translateX(50px); }
}

#ui-panel {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 40px;
    padding: 24px 48px;
    background: rgba(45, 30, 20, 0.95);
    border-radius: 60px;
    border: 5px solid #8B4513;
    box-shadow: 
        0 6px 20px rgba(0, 0, 0, 0.4),
        inset 0 3px 6px rgba(255, 255, 255, 0.1);
    z-index: 100;
}

.stat {
    display: flex;
    align-items: center;
    gap: 16px;
    color: #f4e4bc;
    font-size: 32px;
    font-weight: 600;
}

.stat-icon {
    font-size: 44px;
}

#game-world {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    transition: transform 0.15s ease-out;
}

#blocks-container {
    position: relative;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 2px;
    padding: 2px;
    background: #1a1008;
}

.block {
    aspect-ratio: 1;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.1s ease;
    position: relative;
    overflow: hidden;
    min-height: 150px;
}

.block:hover:not(.empty):not(.treasure) {
    transform: scale(1.05);
    filter: brightness(1.2);
    z-index: 10;
}

.block:active:not(.empty):not(.treasure) {
    transform: scale(0.95);
}

/* Grass block */
.block.grass {
    background: linear-gradient(180deg, 
        #4a8f3c 0%, 
        #3d7a32 30%, 
        #8B6914 35%, 
        #725a12 100%
    );
    box-shadow: inset 0 -4px 8px rgba(0, 0, 0, 0.3);
}

.block.grass::before {
    content: '';
    position: absolute;
    top: 0;
    left: 10%;
    right: 10%;
    height: 8px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        #5cb347 20%, 
        #4a9a3a 50%, 
        #5cb347 80%, 
        transparent 100%
    );
    border-radius: 0 0 4px 4px;
}

/* Dirt block */
.block.dirt {
    background: linear-gradient(135deg, 
        #8B6914 0%, 
        #725a12 50%, 
        #5c4a0f 100%
    );
    box-shadow: 
        inset 0 2px 4px rgba(255, 255, 255, 0.1),
        inset 0 -4px 8px rgba(0, 0, 0, 0.3);
}

.block.dirt::before {
    content: '';
    position: absolute;
    top: 20%;
    left: 15%;
    width: 25%;
    height: 25%;
    background: #9a7516;
    border-radius: 50%;
    opacity: 0.5;
}

.block.dirt::after {
    content: '';
    position: absolute;
    bottom: 20%;
    right: 20%;
    width: 20%;
    height: 20%;
    background: #5c4a0f;
    border-radius: 50%;
    opacity: 0.6;
}

/* Stone block */
.block.stone {
    background: linear-gradient(135deg, 
        #6b6b6b 0%, 
        #555555 50%, 
        #404040 100%
    );
    box-shadow: 
        inset 0 2px 4px rgba(255, 255, 255, 0.15),
        inset 0 -4px 8px rgba(0, 0, 0, 0.4);
}

.block.stone::before {
    content: '';
    position: absolute;
    top: 10%;
    left: 10%;
    width: 40%;
    height: 30%;
    background: #7a7a7a;
    border-radius: 4px;
    opacity: 0.6;
}

.block.stone::after {
    content: '';
    position: absolute;
    bottom: 15%;
    right: 15%;
    width: 35%;
    height: 35%;
    background: #353535;
    border-radius: 4px;
    opacity: 0.5;
}

/* Hard rock block */
.block.hardrock {
    background: linear-gradient(135deg, 
        #4a4a5a 0%, 
        #35354a 50%, 
        #252535 100%
    );
    box-shadow: 
        inset 0 2px 4px rgba(150, 150, 200, 0.15),
        inset 0 -4px 8px rgba(0, 0, 0, 0.5);
}

.block.hardrock::before {
    content: '';
    position: absolute;
    inset: 4px;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 4px,
        rgba(100, 100, 150, 0.1) 4px,
        rgba(100, 100, 150, 0.1) 8px
    );
    border-radius: 4px;
}

/* Bedrock block - hardest */
.block.bedrock {
    background: linear-gradient(135deg, 
        #1a1a22 0%, 
        #12121a 50%, 
        #0a0a10 100%
    );
    box-shadow: 
        inset 0 2px 4px rgba(80, 80, 120, 0.2),
        inset 0 -4px 8px rgba(0, 0, 0, 0.6);
}

.block.bedrock::before {
    content: '';
    position: absolute;
    inset: 3px;
    background: repeating-linear-gradient(
        -45deg,
        transparent,
        transparent 3px,
        rgba(60, 60, 90, 0.15) 3px,
        rgba(60, 60, 90, 0.15) 6px
    );
    border-radius: 4px;
}

/* ===== COLLECTIBLES ===== */

/* Coal (0-5m) */
.block.coal {
    background: linear-gradient(135deg, 
        #725a12 0%, 
        #5c4a0f 100%
    );
}

.block.coal::before {
    content: '⬛';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 48px;
    filter: brightness(0.9);
    animation: coal-glimmer 3s ease-in-out infinite;
}

@keyframes coal-glimmer {
    0%, 100% { filter: brightness(0.9); }
    50% { filter: brightness(1.1) drop-shadow(0 0 4px rgba(50, 50, 50, 0.5)); }
}

/* Iron (6-10m) */
.block.iron {
    background: linear-gradient(135deg, 
        #6b6b6b 0%, 
        #555555 100%
    );
}

.block.iron::before {
    content: '🔩';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 48px;
    animation: iron-gleam 3s ease-in-out infinite;
}

@keyframes iron-gleam {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.2) drop-shadow(0 0 5px rgba(180, 180, 180, 0.5)); }
}

/* Silver (11-20m) */
.block.silver {
    background: linear-gradient(135deg, 
        #6b6b6b 0%, 
        #555555 100%
    );
}

.block.silver::before {
    content: '⬜';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 44px;
    animation: silver-shine 2s ease-in-out infinite;
}

@keyframes silver-shine {
    0%, 100% { 
        filter: brightness(1);
        transform: translate(-50%, -50%) scale(1);
    }
    50% { 
        filter: brightness(1.3) drop-shadow(0 0 8px rgba(200, 200, 200, 0.8));
        transform: translate(-50%, -50%) scale(1.05);
    }
}

/* Money $10 (11-20m) */
.block.money10 {
    background: linear-gradient(135deg, 
        #725a12 0%, 
        #5c4a0f 100%
    );
}

.block.money10::before {
    content: '💵';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 48px;
    animation: money-float 2s ease-in-out infinite;
}

@keyframes money-float {
    0%, 100% { transform: translate(-50%, -50%) translateY(0); }
    50% { transform: translate(-50%, -50%) translateY(-3px); }
}

/* Platinum (20-50m) */
.block.platinum {
    background: linear-gradient(135deg, 
        #4a4a5a 0%, 
        #35354a 100%
    );
}

.block.platinum::before {
    content: '💠';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 48px;
    animation: platinum-pulse 2.5s ease-in-out infinite;
}

@keyframes platinum-pulse {
    0%, 100% { 
        transform: translate(-50%, -50%) scale(1);
        filter: brightness(1);
    }
    50% { 
        transform: translate(-50%, -50%) scale(1.1);
        filter: brightness(1.4) drop-shadow(0 0 12px rgba(200, 220, 255, 0.9));
    }
}

/* Diamond (50-100m) */
.block.diamond {
    background: linear-gradient(135deg, 
        #35354a 0%, 
        #252535 100%
    );
}

.block.diamond::before {
    content: '💎';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 52px;
    animation: diamond-sparkle 1.5s ease-in-out infinite;
}

@keyframes diamond-sparkle {
    0%, 100% { 
        transform: translate(-50%, -50%) scale(1);
        filter: brightness(1);
    }
    50% { 
        transform: translate(-50%, -50%) scale(1.15);
        filter: brightness(1.5) drop-shadow(0 0 15px rgba(100, 200, 255, 1));
    }
}

/* Mini Chest (50-100m) */
.block.minichest {
    background: linear-gradient(135deg, 
        #35354a 0%, 
        #252535 100%
    );
}

.block.minichest::before {
    content: '🎁';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 52px;
    animation: chest-bounce 1s ease-in-out infinite;
}

@keyframes chest-bounce {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.1) rotate(-5deg); }
}

/* Money Sack $50 (50-100m) */
.block.moneysack {
    background: linear-gradient(135deg, 
        #35354a 0%, 
        #252535 100%
    );
}

.block.moneysack::before {
    content: '💰';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 52px;
    animation: sack-glow 2s ease-in-out infinite;
}

@keyframes sack-glow {
    0%, 100% { 
        filter: brightness(1);
        transform: translate(-50%, -50%) scale(1);
    }
    50% { 
        filter: brightness(1.3) drop-shadow(0 0 12px rgba(100, 200, 100, 0.8));
        transform: translate(-50%, -50%) scale(1.1);
    }
}

/* Treasure block */
.block.treasure {
    background: linear-gradient(135deg, 
        #3d3020 0%, 
        #2a2015 100%
    );
    animation: treasure-glow 2s ease-in-out infinite;
}

.block.treasure::before {
    content: '📦';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 64px;
}

@keyframes treasure-glow {
    0%, 100% { 
        box-shadow: 0 0 20px rgba(255, 200, 50, 0.5);
    }
    50% { 
        box-shadow: 0 0 40px rgba(255, 200, 50, 0.9);
    }
}

/* Empty block (dug out) */
.block.empty {
    background: linear-gradient(180deg, 
        #1a1008 0%, 
        #120a05 100%
    );
    cursor: default;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8);
}

/* Digging animation */
.block.digging {
    animation: dig-shake 0.15s ease-in-out;
}

@keyframes dig-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-3px) rotate(-2deg); }
    75% { transform: translateX(3px) rotate(2deg); }
}

.block.breaking {
    animation: block-break 0.3s ease-out forwards;
}

@keyframes block-break {
    0% { 
        transform: scale(1);
        opacity: 1;
    }
    50% { 
        transform: scale(1.1);
    }
    100% { 
        transform: scale(0);
        opacity: 0;
    }
}

/* Player */
#player {
    position: absolute;
    width: calc(100% / 8);
    height: calc(100% / 8);
    z-index: 50;
    transition: all 0.15s ease-out;
    pointer-events: none;
}

.player-body {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.player-head {
    width: 70%;
    height: 70%;
    background: linear-gradient(180deg, 
        #ffcc99 0%, 
        #e6b380 100%
    );
    border-radius: 50% 50% 45% 45%;
    position: relative;
    box-shadow: 
        inset 0 -5px 10px rgba(0, 0, 0, 0.2),
        0 3px 10px rgba(0, 0, 0, 0.3);
}

.player-head::before {
    content: '';
    position: absolute;
    top: 35%;
    left: 20%;
    width: 20%;
    height: 15%;
    background: #2a2a2a;
    border-radius: 50%;
    box-shadow: 
        calc(100% - 10px) 0 0 #2a2a2a;
}

.player-head::after {
    content: '';
    position: absolute;
    top: -15%;
    left: 10%;
    right: 10%;
    height: 40%;
    background: linear-gradient(180deg, 
        #8B4513 0%, 
        #6b3410 100%
    );
    border-radius: 50% 50% 0 0;
}

.player-pickaxe {
    position: absolute;
    right: -20px;
    top: 50%;
    transform: translateY(-50%) rotate(-45deg);
    font-size: 44px;
    transition: transform 0.1s ease;
}

#player.digging .player-pickaxe {
    animation: pickaxe-swing 0.2s ease-in-out;
}

@keyframes pickaxe-swing {
    0%, 100% { transform: translateY(-50%) rotate(-45deg); }
    50% { transform: translateY(-50%) rotate(-90deg) scale(1.2); }
}

/* Particles */
.particle {
    position: absolute;
    pointer-events: none;
    border-radius: 2px;
    animation: particle-fly 0.5s ease-out forwards;
}

@keyframes particle-fly {
    0% {
        opacity: 1;
        transform: translate(0, 0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(var(--tx), var(--ty)) scale(0);
    }
}

/* Victory screen */
#victory-screen {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 200;
}

#victory-screen.active {
    display: flex;
    animation: victory-fade-in 0.5s ease-out;
}

@keyframes victory-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.victory-content {
    text-align: center;
    color: #f4e4bc;
}

.treasure-found {
    font-size: 80px;
    animation: victory-bounce 0.6s ease-out;
}

@keyframes victory-bounce {
    0% { transform: scale(0); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

.victory-content h1 {
    font-size: 48px;
    margin: 20px 0;
    background: linear-gradient(180deg, #ffd700, #ff9500);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 40px rgba(255, 200, 50, 0.5);
}

.chest-animation {
    font-size: 64px;
    margin: 20px 0;
    animation: chest-open 1s ease-out infinite;
}

@keyframes chest-open {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.victory-content p {
    font-size: 24px;
    margin: 10px 0;
}

#play-again {
    margin-top: 30px;
    padding: 15px 40px;
    font-family: 'Fredoka', sans-serif;
    font-size: 24px;
    font-weight: 600;
    color: #1a1008;
    background: linear-gradient(180deg, #ffd700, #ff9500);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 6px 20px rgba(255, 150, 0, 0.4);
}

#play-again:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(255, 150, 0, 0.6);
}

#play-again:active {
    transform: translateY(0);
}

/* Collected animation */
.collected {
    position: fixed;
    font-size: 32px;
    pointer-events: none;
    z-index: 150;
    animation: collect-fly 0.8s ease-out forwards;
}

@keyframes collect-fly {
    0% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
    100% {
        opacity: 0;
        transform: scale(1.5) translateY(-100px);
    }
}

/* Depth indicator */
.depth-marker {
    position: absolute;
    left: -30px;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.3);
    font-weight: 600;
}

