/* Воксельный стиль и текстуры */
:root {
    --bg-color: #5d4037;
    --grid-bg: #3e2723;
    --cell-bg: #4e342e;
    --text-color: #ffffff;
    --primary-color: #4CAF50;
    --grid-size: 8;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
    font-family: 'Press Start 2P', cursive;
}

body {
    font-family: 'Press Start 2P', cursive;
    background-color: #202020;
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100dvh;
    margin: 0;
    overflow: hidden;
    touch-action: none;
    justify-content: flex-start;
    padding-top: max(env(safe-area-inset-top, 20px), 10px);
    
    /* ФОН ДЫШИТ */
    background-image: url('../assets/textures/bg_stone.png');
    background-size: 64px 64px;
    image-rendering: auto; /* Вернул сглаживание или оставим как есть */
    animation: bgBreathe 20s infinite alternate ease-in-out;
}

@keyframes bgBreathe {
    0% { transform: scale(1.0); filter: brightness(1.0); }
    100% { transform: scale(1.05); filter: brightness(0.85); }
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 400px;
    padding: 10px;
}

.score-box {
    background-color: rgba(33, 33, 33, 0.9);
    padding: 15px;
    border: 4px solid #757575;
    text-align: center;
    min-width: 120px;
    box-shadow: inset 4px 4px 0px rgba(255, 255, 255, 0.2), inset -4px -4px 0px rgba(0, 0, 0, 0.5);
}

.score-label {
    font-size: 8px;
    color: #ccc;
    margin-bottom: 8px;
    line-height: 1.5;
}

.score-value {
    font-size: 16px;
    color: #FFD700;
}

#game-board {
    width: min(90vw, 55vh);
    max-width: 400px;
    height: min(90vw, 55vh);
    max-height: 400px;
    background-color: var(--grid-bg);
    border: 4px solid #212121;
    padding: 4px;
    display: grid;
    grid-template-columns: repeat(var(--grid-size), 1fr);
    grid-template-rows: repeat(var(--grid-size), 1fr);
    gap: 2px;
    position: relative;
    box-shadow: 10px 10px 0px rgba(0,0,0,0.5);
}

.cell {
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    box-shadow: inset 1px 1px 0px rgba(0, 0, 0, 0.8), inset -1px -1px 0px rgba(255, 255, 255, 0.1);
    transition: background-color 0.1s, transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    background-size: cover;
    background-repeat: no-repeat;
    image-rendering: pixelated; /* четкие пиксели майнкрафта */
    position: relative;
}

.cell-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: white;
    opacity: 0;
    pointer-events: none;
    z-index: 5;
    transition: opacity 0.1s ease-out;
}

.flash-white {
    opacity: 0.8 !important;
}

.cell.filled {
    box-shadow: inset 3px 3px 0px rgba(255, 255, 255, 0.4), inset -3px -3px 0px rgba(0, 0, 0, 0.4);
    background-size: cover;
    image-rendering: pixelated;
}

.cell.preview {
    background-color: rgba(255, 255, 255, 0.4) !important;
    background-image: none !important;
    box-shadow: none;
}

.cell.clearing {
    animation: clearAnim 0.3s forwards;
}

@keyframes clearAnim {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.8; }
    100% { transform: scale(0); opacity: 0; }
}

#tray {
    display: flex;
    justify-content: space-around;
    align-items: center;
    width: 100%;
    max-width: 500px;
    height: 100px;
    margin-top: 5px;
    padding: 0 10px;
}

.shape-container, #hold-slot {
    width: 80px;
    height: 80px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    background-color: #8b8b8b;
    border: 4px solid;
    border-top-color: #ffffff;
    border-left-color: #ffffff;
    border-bottom-color: #373737;
    border-right-color: #373737;
    box-shadow: inset 2px 2px 0px rgba(0,0,0,0.1), inset -2px -2px 0px rgba(255,255,255,0.1);
}

.shape {
    display: grid;
    gap: 2px;
    cursor: grab;
}

.shape-block {
    box-shadow: inset 3px 3px 0px rgba(255, 255, 255, 0.4), inset -3px -3px 0px rgba(0, 0, 0, 0.4);
    background-size: cover;
    image-rendering: pixelated;
}

.shape-spawn {
    animation: spawnBounce 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}
@keyframes spawnBounce {
    0% { transform: scale(0.1); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.shape.dragging {
    position: fixed;
    pointer-events: none;
    z-index: 1000;
    transform: scale(1.1);
    transition: transform 0.1s;
    filter: drop-shadow(5px 5px 0px rgba(0, 0, 0, 0.5));
}

.invalid-drag {
    filter: brightness(0.6) sepia(1) hue-rotate(-50deg) saturate(5) drop-shadow(5px 5px 0px rgba(0, 0, 0, 0.5)) !important;
}

#hold-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 10px;
    width: 80px;
}

.hold-label {
    font-size: 8px;
    color: #ccc;
    margin-bottom: 5px;
    text-shadow: 1px 1px 0 #000;
}

#hold-slot {
    cursor: pointer;
    transition: transform 0.1s;
}

#hold-slot:active {
    transform: scale(0.95);
}

#pocket-fuse-container {
    width: 100%;
    height: 4px;
    background: #333;
    margin-top: 5px;
    border-radius: 2px;
    overflow: hidden;
}

#pocket-fuse {
    width: 100%;
    height: 100%;
    background: #ffab00;
    transition: width 0.3s linear, background-color 0.3s;
}

.mc-death-screen {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(150, 0, 0, 0.5); /* Red tint */
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.mc-menu {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-image: url('../assets/textures/bg_dirt.png');
    background-size: 64px 64px;
    background-color: #202020;
    box-shadow: inset 0 0 150px rgba(0,0,0,0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 3000;
    transition: opacity 0.5s;
    pointer-events: all;
}
.mc-menu.hidden {
    opacity: 0;
    pointer-events: none;
}
.mc-menu-content { 
    display: flex; flex-direction: column; align-items: center;
}
.mc-logo {
    font-size: 36px;
    color: #fff;
    text-shadow: 4px 4px 0px #3f3f3f;
    margin-bottom: 10px;
}
.mc-splash {
    color: #ffff55;
    font-size: 10px;
    text-shadow: 2px 2px 0px #3f3f3f;
    transform: rotate(-15deg);
    margin-bottom: 20px;
    margin-left: 100px;
    animation: splashBounce 0.5s infinite alternate ease-in-out;
}
@keyframes splashBounce {
    from { transform: rotate(-15deg) scale(1); }
    to { transform: rotate(-15deg) scale(1.1); }
}
.mc-death-screen.visible { display: flex; }
.mc-death-title {
    color: #ffffff;
    text-shadow: 4px 4px 0px #3f3f3f;
    font-size: 32px;
    margin-bottom: 20px;
    text-align: center;
}
/* Modal Styles */
.modal-content {
    background-color: #c6c6c6;
    border: 4px solid #000;
    border-top-color: #ffffff;
    border-left-color: #ffffff;
    border-bottom-color: #555555;
    border-right-color: #555555;
    padding: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 10px 10px 0 rgba(0,0,0,0.5);
}
.modal-content.hidden {
    display: none !important;
}
.hidden {
    display: none !important;
}
.modal-title {
    color: #333;
    text-shadow: 2px 2px 0px #fff;
    font-size: 24px;
}

/* Sliders */
.settings-group { margin-bottom: 20px; width: 280px; text-align: center; }
.settings-group label { display: block; color: #333; font-size: 12px; margin-bottom: 10px; text-shadow: 1px 1px 0px #fff; }
.mc-slider {
    -webkit-appearance: none;
    width: 100%; height: 20px;
    background: #000;
    outline: none;
    border: 2px solid #555; border-bottom-color: #fff; border-right-color: #fff;
}
.mc-slider::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none;
    width: 20px; height: 35px;
    background: #c6c6c6; cursor: pointer;
    border: 3px solid #000; border-top-color:#fff; border-left-color:#fff;
    box-shadow: 2px 2px 0 rgba(0,0,0,0.5);
}
.mc-death-score {
    color: #ffff55; /* Minecraft Yellow */
    text-shadow: 2px 2px 0px #3f3f3f;
    margin-bottom: 40px;
    font-size: 16px;
}
.mc-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.mc-btn {
    background-color: #c6c6c6;
    border: 3px solid #000;
    border-top-color: #ffffff;
    border-left-color: #ffffff;
    border-bottom-color: #555555;
    border-right-color: #555555;
    color: #000;
    padding: 15px 20px;
    font-family: inherit;
    font-size: 12px;
    width: 300px;
    text-shadow: 1px 1px 0px #fff;
    cursor: pointer;
    text-align: center;
}
.mc-btn:active {
    border-top-color: #555555;
    border-left-color: #555555;
    border-bottom-color: #ffffff;
    border-right-color: #ffffff;
}

/* Эффекты */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px) rotate(-1deg); }
    40%, 80% { transform: translateX(5px) rotate(1deg); }
}

.shake {
    animation: shake 0.3s;
}

.particle {
    position: absolute;
    width: 16px;
    height: 16px;
    pointer-events: none;
    z-index: 1500;
    box-shadow: inset 2px 2px 0px rgba(255, 255, 255, 0.4), inset -2px -2px 0px rgba(0, 0, 0, 0.4);
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.4s ease-out;
    background-size: cover;
    image-rendering: pixelated;
}

.xp-orb {
    position: absolute;
    width: 6px;
    height: 6px;
    background-color: #55FF55;
    box-shadow: 0 0 6px #55FF55;
    z-index: 1000;
    transition: left 0.6s cubic-bezier(0.25, 0.1, 0.25, 1), top 0.6s cubic-bezier(0.25, 0.1, 0.25, 1), opacity 0.5s;
    pointer-events: none;
    transform: translate(-50%, -50%);
}

.score-pulse {
    animation: scorePulse 0.2s ease-out;
}

@keyframes scorePulse {
    0% { transform: scale(1); color: #FFD700; }
    50% { transform: scale(1.5); color: #55FF55; }
    100% { transform: scale(1); color: #FFD700; }
}

.floating-text {
    position: absolute;
    color: #FFD700;
    font-size: 16px;
    text-shadow: 2px 2px 0 #000, -2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000;
    pointer-events: none;
    z-index: 2000;
    text-align: center;
    white-space: pre-line;
    animation: floatUp 1.2s forwards;
}

@keyframes floatUp {
    0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
    20% { transform: translate(-50%, -100%) scale(1.2); opacity: 1; }
    80% { transform: translate(-50%, -150%) scale(1.0); opacity: 1; }
    100% { transform: translate(-50%, -200%) scale(0.8); opacity: 0; }
}

.mega-text {
    font-size: 24px;
    color: #ffaa00;
    text-shadow: 2px 2px 0px #000, 0 0 15px #ff0000;
    animation: megaFloatUp 1.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes megaFloatUp {
    0% { transform: translate(-50%, -50%) scale(0.1) rotate(-10deg); opacity: 0; }
    15% { transform: translate(-50%, -100%) scale(1.5) rotate(5deg); opacity: 1; text-shadow: 2px 2px 0px #000, 0 0 30px #ffffff; }
    30% { transform: translate(-50%, -120%) scale(1.2) rotate(0deg); opacity: 1; }
    80% { transform: translate(-50%, -150%) scale(1.2); opacity: 1; }
    100% { transform: translate(-50%, -250%) scale(0.5); opacity: 0; }
}

.controls {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 100;
}

.icon-btn {
    background: #212121;
    border: 2px solid #757575;
    color: #fff;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    font-size: 16px;
    box-shadow: inset 2px 2px 0px rgba(255, 255, 255, 0.2), inset -2px -2px 0px rgba(0, 0, 0, 0.5);
}

.record-item {
    background-color: rgba(0,0,0,0.5);
    border: 2px solid #555;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.record-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.record-title {
    color: #FFD700;
    font-size: 10px;
    line-height: 1.4;
    text-shadow: 1px 1px 0 #000;
    flex: 1;
}
.record-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}
.play-btn {
    background: #333;
    border: 2px solid #aaa;
    color: white;
    width: 30px; height: 30px;
    cursor: pointer;
    font-size: 12px;
}
.track-slider {
    flex: 1;
    -webkit-appearance: none;
    height: 8px; background: #000; border: 2px solid #555; border-bottom-color:#fff; border-right-color:#fff;
}
.track-slider::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none;
    width: 10px; height: 20px; background: #c6c6c6; border: 2px solid #000; border-top-color:#fff; border-left-color:#fff;
    cursor: pointer;
}

/* Экономика и Опыт */
.diamond-box {
    background-color: #2b2b2b;
    border: 2px solid #555;
    padding: 2px 10px;
    border-radius: 4px;
    color: #55FF55;
    font-size: 10px;
    text-shadow: 1px 1px 0px #000;
}

.consumable-btn {
    width: 60px;
    height: 60px;
    background-color: #c6c6c6;
    border: 4px solid;
    border-top-color: #ffffff;
    border-left-color: #ffffff;
    border-bottom-color: #555555;
    border-right-color: #555555;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    cursor: pointer;
    box-shadow: 2px 2px 0 rgba(0,0,0,0.5);
    align-self: flex-end;
}
.consumable-btn.active {
    border-top-color: #555555;
    border-left-color: #555555;
    border-bottom-color: #ffffff;
    border-right-color: #ffffff;
    background-color: #e0e0e0;
    box-shadow: inset 3px 3px 0 rgba(0,0,0,0.3);
}
.consumable-btn:active {
    border-top-color: #555555;
    border-left-color: #555555;
    border-bottom-color: #ffffff;
    border-right-color: #ffffff;
}
.consumable-count {
    position: absolute;
    bottom: -5px; right: -5px;
    background: #000; color: #fff;
    font-size: 8px; padding: 2px 4px;
    border: 1px solid #757575;
}

#xp-bar-container {
    width: 90vw;
    max-width: 400px;
    height: 12px;
    background-color: #222;
    border: 2px solid #000;
    margin-top: 10px;
    position: relative;
}
#xp-bar-fill {
    width: 0%;
    height: 100%;
    background-color: #55FF55;
    box-shadow: inset 0px 4px 0px rgba(255,255,255,0.4), inset 0px -2px 0px rgba(0,0,0,0.2);
    transition: width 0.3s ease-out;
}
#xp-bar-text {
    position: absolute;
    top: -2px; left: 0; width: 100%; text-align: center;
    color: #fff; font-size: 8px; line-height: 14px;
    text-shadow: 1px 1px 0px #000, -1px -1px 0px #000, 1px -1px 0px #000, -1px 1px 0px #000;
}

/* ROULETTE STYLES */
#roulette-container {
    width: 100%;
    height: 60px;
    background: #111;
    border: 2px solid #555;
    position: relative;
    overflow: hidden;
    margin-bottom: 10px;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.8);
}
#roulette-container.hidden {
    display: none;
}
.roulette-cursor {
    position: absolute;
    left: 50%;
    top: 0;
    width: 2px;
    height: 100%;
    background: #FFD700;
    z-index: 10;
    transform: translateX(-50%);
    box-shadow: 0 0 5px #FFD700;
}
#roulette-track {
    display: flex;
    height: 100%;
    position: absolute;
    left: 50%; /* Стартовая позиция по центру окна */
    transform: translateX(0px);
}
.roulette-item-card {
    width: 50px;
    height: 50px;
    margin: 5px;
    background: #333;
    border: 2px solid #666;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    flex-shrink: 0;
    box-shadow: inset 2px 2px 0 rgba(255,255,255,0.1), inset -2px -2px 0 rgba(0,0,0,0.5);
}
.rarity-common { border-color: #aaa; background: linear-gradient(135deg, #444, #222); }
.rarity-rare { border-color: #5555FF; background: linear-gradient(135deg, #44f, #118); }
.rarity-epic { border-color: #AA00AA; background: linear-gradient(135deg, #a0a, #404); }
.rarity-legendary { border-color: #FFAA00; background: linear-gradient(135deg, #fa0, #850); }

/* SHOP & INVENTORY V2 */
.shop-diamonds-bar {
    text-align: center;
    margin-bottom: 15px;
    font-size: 16px;
    color: #55FFFF;
    background: #333;
    border: 3px solid #000;
    border-top-color: #555;
    border-left-color: #555;
    padding: 6px;
    text-shadow: 2px 2px 0 #000;
}

.shop-toggle-btn {
    width: 100%;
    margin-bottom: 15px;
    font-size: 10px !important;
    padding: 10px 0 !important;
    background: #444 !important;
    border: 4px solid #888 !important;
    color: #fff !important;
    cursor: pointer;
    transition: all 0.2s;
}
.shop-toggle-btn.active {
    background: #2e7d32 !important;
    border-color: #4caf50 !important;
    box-shadow: inset 4px 4px 0 rgba(0,0,0,0.3);
}

.shop-card {
    background: #222;
    border: 4px solid #555;
    border-top-color: #777;
    border-left-color: #777;
    padding: 15px;
    text-align: center;
    margin-bottom: 15px;
}
.shop-card-header {
    font-size: 13px;
    font-weight: bold;
    text-shadow: 2px 2px 0 #000;
    margin-bottom: 5px;
}

.shop-section-title {
    color: #aaa;
    font-size: 12px;
    text-align: center;
    margin: 15px 0 10px;
    text-shadow: 1px 1px 0 #000;
}
.shop-list {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.shop-timer {
    color: #FF5555;
    font-size: 11px;
    margin-top: 8px;
    text-shadow: 1px 1px 0 #000;
}

/* Donation packs (Black Market) */
.donation-pack {
    background: #2a2a2a;
    border: 3px solid #555;
    border-top-color: #777;
    border-left-color: #777;
    padding: 10px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    transition: transform 0.1s;
    cursor: pointer;
}
.donation-pack:hover {
    transform: scale(1.02);
    filter: brightness(1.15);
}
.pack-info {
    display: flex;
    align-items: center;
    gap: 10px;
}
.pack-icon {
    font-size: 26px;
}
.pack-name {
    color: #fff;
    font-size: 13px;
    font-weight: bold;
    text-shadow: 1px 1px 0 #000;
}
.pack-desc {
    color: #55FFFF;
    font-size: 11px;
}

/* Inventory consumable cards */
.inv-consumables-row {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 15px;
}
.inv-item-card {
    background: #333;
    border: 3px solid #555;
    border-top-color: #777;
    border-left-color: #777;
    padding: 12px 20px;
    text-align: center;
    min-width: 100px;
    box-shadow: inset 2px 2px 0 rgba(255,255,255,0.05);
}
.inv-item-emoji {
    font-size: 32px;
    display: block;
    margin-bottom: 4px;
}
.inv-item-label {
    color: #aaa;
    font-size: 10px;
    margin-bottom: 2px;
}
.inv-item-qty {
    color: #55FF55;
    font-size: 18px;
    font-weight: bold;
    text-shadow: 1px 1px 0 #000;
}

/* Drag Preview for Consumables */
.cell.preview-tnt { background-color: rgba(255, 0, 0, 0.3) !important; border: 2px solid #ff4040; }
.cell.preview-pickaxe { background-color: rgba(0, 200, 255, 0.3) !important; border: 2px solid #00c8ff; }

/* Diamond floating reward */
.diamond-float {
    position: fixed;
    font-size: 18px;
    color: #55FFFF;
    z-index: 9999;
    pointer-events: none;
    animation: diamondFloatUp 1.5s ease-out forwards;
    text-shadow: 2px 2px 0 #000, -1px -1px 0 #000;
}
@keyframes diamondFloatUp {
    0% { opacity: 1; transform: translateY(0) scale(1); }
    60% { opacity: 1; transform: translateY(-40px) scale(1.3); }
    100% { opacity: 0; transform: translateY(-80px) scale(0.8); }
}

/* ==================== TUTORIAL ==================== */
.tutorial-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    animation: tutFadeIn 0.3s ease forwards;
}
@keyframes tutFadeIn {
    to { opacity: 1; }
}

.tutorial-card {
    background: #3c3c3c;
    border: 6px solid #555;
    border-top-color: #888;
    border-left-color: #888;
    border-bottom-color: #222;
    border-right-color: #222;
    width: 340px;
    max-width: 90vw;
    padding: 25px 20px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0,0,0,0.6);
}

.tutorial-emoji {
    font-size: 48px;
    margin-bottom: 12px;
    display: block;
}

.tutorial-title {
    color: #FFD700;
    font-size: 18px;
    font-weight: bold;
    text-shadow: 2px 2px 0 #000;
    margin-bottom: 10px;
}

.tutorial-text {
    color: #ccc;
    font-size: 12px;
    line-height: 1.6;
    margin-bottom: 20px;
    text-shadow: 1px 1px 0 #000;
}

.tutorial-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.tutorial-dots {
    display: flex;
    gap: 6px;
    justify-content: center;
}
.tutorial-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #555;
    transition: background 0.2s;
}
.tutorial-dot.active {
    background: #FFD700;
}

.tutorial-btn {
    background: #555;
    border: 3px solid #777;
    border-top-color: #999;
    border-left-color: #999;
    border-bottom-color: #333;
    border-right-color: #333;
    color: #fff;
    font-size: 11px;
    padding: 8px 16px;
    cursor: pointer;
    text-shadow: 1px 1px 0 #000;
    min-width: 70px;
}
.tutorial-btn:hover {
    filter: brightness(1.2);
}
.tutorial-btn:active {
    border-top-color: #333;
    border-left-color: #333;
    border-bottom-color: #999;
    border-right-color: #999;
}
.tutorial-btn.primary {
    background: #2e7d32;
    border-color: #4caf50;
    border-top-color: #66bb6a;
    border-left-color: #66bb6a;
    border-bottom-color: #1b5e20;
    border-right-color: #1b5e20;
}

/* ==================== DISABLED BUTTONS ==================== */
.mc-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(0.5);
}

/* ==================== LEADERBOARD ==================== */
.lb-list {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.lb-row {
    display: flex;
    align-items: center;
    background: #333;
    border: 2px solid #555;
    border-top-color: #666;
    border-left-color: #666;
    padding: 8px 12px;
    gap: 10px;
}
.lb-row:nth-child(1) { background: linear-gradient(135deg, #5a4a00, #333); border-color: #FFD700; }
.lb-row:nth-child(2) { background: linear-gradient(135deg, #3a3a3a, #333); border-color: #C0C0C0; }
.lb-row:nth-child(3) { background: linear-gradient(135deg, #3a2500, #333); border-color: #CD7F32; }

.lb-rank {
    font-size: 14px;
    min-width: 35px;
    text-align: center;
    color: #FFD700;
    text-shadow: 1px 1px 0 #000;
}
.lb-name {
    flex: 1;
    font-size: 10px;
    color: #fff;
    text-shadow: 1px 1px 0 #000;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.lb-score {
    font-size: 12px;
    color: #55FF55;
    font-weight: bold;
    text-shadow: 1px 1px 0 #000;
}
.lb-player-rank {
    text-align: center;
    color: #55FFFF;
    font-size: 12px;
    margin-top: 12px;
    padding: 8px;
    background: #222;
    border: 2px solid #444;
    text-shadow: 1px 1px 0 #000;
}

/* ==================== BACKPACK BAR ==================== */
#backpack-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    max-width: 400px;
    margin-bottom: 8px;
    padding: 4px 8px;
    box-sizing: border-box;
}
#backpack-icon {
    font-size: 18px;
    filter: drop-shadow(1px 1px 0 #000);
}
#backpack-progress {
    flex: 1;
    height: 16px;
    background: #333;
    border: 2px solid #555;
    border-top-color: #444;
    border-left-color: #444;
    position: relative;
    overflow: hidden;
}
#backpack-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(180deg, #8B6914, #6B4F0A);
    transition: width 0.3s ease;
}
#backpack-fill.full {
    background: linear-gradient(180deg, #FFD700, #FFA500);
    animation: backpackPulse 1s infinite;
}
#backpack-text {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    color: #fff;
    text-shadow: 1px 1px 0 #000;
}
.exit-mine-btn {
    padding: 4px 10px !important;
    font-size: 8px !important;
    white-space: nowrap;
    animation: exitPulse 1.5s infinite;
}
@keyframes backpackPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}
@keyframes exitPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 rgba(85, 255, 85, 0); }
    50% { transform: scale(1.05); box-shadow: 0 0 10px rgba(85, 255, 85, 0.5); }
}

/* ==================== EXTRACTION RESULTS ==================== */
.extraction-results {
    width: 100%;
    max-width: 280px;
    margin: 10px auto;
}
.extraction-section {
    margin-bottom: 8px;
    padding: 6px 8px;
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid #555;
}
.extraction-section.lost {
    border-color: #AA3333;
    background: rgba(170, 50, 50, 0.2);
}
.extraction-section.saved {
    border-color: #33AA33;
    background: rgba(50, 170, 50, 0.2);
}
.extraction-label {
    font-size: 9px;
    color: #aaa;
    margin-bottom: 4px;
    text-shadow: 1px 1px 0 #000;
}
.extraction-section.lost .extraction-label { color: #FF6666; }
.extraction-section.saved .extraction-label { color: #66FF66; }

.ore-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.ore-item {
    display: flex;
    align-items: center;
    gap: 2px;
    font-size: 11px;
    color: #fff;
    text-shadow: 1px 1px 0 #000;
}
.ore-item .ore-emoji { font-size: 14px; }
.ore-item .ore-count { font-size: 10px; color: #FFD700; }
.ore-item.lost-ore .ore-count { color: #FF6666; text-decoration: line-through; }

/* ==================== COINS DISPLAY ==================== */
.menu-coins-display {
    color: #FFD700;
    font-size: 16px;
    text-shadow: 2px 2px 0px #000;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

/* ==================== WAREHOUSE MODAL ==================== */
.warehouse-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: rgba(0,0,0,0.3);
    border: 2px solid #555;
    margin-bottom: 10px;
    font-size: 11px;
    color: #FFD700;
    text-shadow: 1px 1px 0 #000;
}
.warehouse-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px;
    background: rgba(0,0,0,0.2);
    border: 2px solid #444;
    min-height: 60px;
}
.warehouse-grid .ore-item {
    background: rgba(0,0,0,0.3);
    padding: 4px 8px;
    border: 1px solid #555;
}

/* ==================== FURNACE STYLES ==================== */
.furnace-coal-info {
    text-align: center;
    font-size: 11px;
    color: #aaa;
    margin-bottom: 10px;
    text-shadow: 1px 1px 0 #000;
}
.furnace-slot {
    background: rgba(0,0,0,0.4);
    border: 2px solid #555;
    padding: 10px;
    margin-bottom: 8px;
    position: relative;
}
.furnace-slot.active {
    border-color: #FF6600;
    box-shadow: 0 0 8px rgba(255, 102, 0, 0.3);
}
.furnace-slot.locked {
    border-color: #333;
    opacity: 0.5;
}
.furnace-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}
.furnace-title {
    font-size: 11px;
    color: #FFD700;
    text-shadow: 1px 1px 0 #000;
}
.furnace-status {
    font-size: 9px;
    color: #aaa;
}
.furnace-progress-bar {
    height: 14px;
    background: #333;
    border: 1px solid #555;
    position: relative;
    overflow: hidden;
    margin-bottom: 6px;
}
.furnace-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(180deg, #FF6600, #CC4400);
    transition: width 0.5s ease;
}
.furnace-progress-text {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 7px;
    color: #fff;
    text-shadow: 1px 1px 0 #000;
}
.furnace-bellows {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.bellows-btn {
    padding: 6px 14px;
    background: linear-gradient(180deg, #8B4513, #654321);
    border: 2px solid #A0522D;
    border-bottom-color: #3E2723;
    border-right-color: #3E2723;
    color: #FFD700;
    font-size: 10px;
    cursor: pointer;
    text-shadow: 1px 1px 0 #000;
    transition: transform 0.1s;
}
.bellows-btn:active {
    transform: scale(0.95);
    background: linear-gradient(180deg, #654321, #4E3119);
}
.bellows-speed {
    font-size: 9px;
    color: #FF9900;
    text-shadow: 1px 1px 0 #000;
}
.furnace-load-btn {
    width: 100%;
    padding: 6px;
    font-size: 9px !important;
}
.furnace-ore-select {
    background: rgba(0,0,0,0.3);
    border: 2px solid #555;
    padding: 8px;
    margin-top: 8px;
}
.furnace-ore-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}
.furnace-ore-option {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: rgba(0,0,0,0.4);
    border: 2px solid #555;
    cursor: pointer;
    font-size: 10px;
    color: #fff;
    text-shadow: 1px 1px 0 #000;
    transition: border-color 0.2s;
}
.furnace-ore-option:hover {
    border-color: #FF6600;
}
.furnace-ore-option .ore-time {
    font-size: 8px;
    color: #888;
}
@keyframes furnaceFire {
    0%, 100% { text-shadow: 0 0 4px #FF6600, 0 0 8px #FF3300; }
    50% { text-shadow: 0 0 8px #FF9900, 0 0 16px #FF6600; }
}
.furnace-fire-icon {
    animation: furnaceFire 1s infinite;
}

/* ==================== CRAFTING STYLES ==================== */
.crafting-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.craft-card {
    background: rgba(0,0,0,0.4);
    border: 2px solid #555;
    padding: 10px;
    transition: border-color 0.2s;
}
.craft-card.can-craft {
    border-color: #55FF55;
}
.craft-card.cannot-craft {
    opacity: 0.6;
}
.craft-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}
.craft-emoji { font-size: 20px; }
.craft-info { flex: 1; }
.craft-name {
    font-size: 11px;
    color: #FFD700;
    text-shadow: 1px 1px 0 #000;
}
.craft-desc {
    font-size: 8px;
    color: #888;
}
.craft-ingredients {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 8px;
}
.craft-ing {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 2px 6px;
    background: rgba(0,0,0,0.3);
    border: 1px solid #444;
    font-size: 9px;
    color: #ccc;
    text-shadow: 1px 1px 0 #000;
}
.craft-ing.has {
    color: #55FF55;
    border-color: #33AA33;
}
.craft-ing.missing {
    color: #FF6666;
    border-color: #AA3333;
}
.craft-btn {
    width: 100%;
    padding: 6px;
    font-size: 9px !important;
}

/* ==================== TRADER STYLES ==================== */
.trader-coins-bar {
    text-align: center;
    font-size: 14px;
    color: #FFD700;
    margin-bottom: 10px;
    text-shadow: 1px 1px 0 #000;
}
.trader-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.trader-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: rgba(0,0,0,0.4);
    border: 2px solid #555;
}
.trader-item.affordable {
    border-color: #8B6914;
}
.trader-item.too-expensive {
    opacity: 0.5;
}
.trader-emoji { font-size: 20px; }
.trader-info { flex: 1; }
.trader-name {
    font-size: 11px;
    color: #fff;
    text-shadow: 1px 1px 0 #000;
}
.trader-desc {
    font-size: 8px;
    color: #888;
}
.trader-buy-btn {
    padding: 4px 10px !important;
    font-size: 9px !important;
    white-space: nowrap;
}
.trader-price {
    font-size: 9px;
    color: #FFD700;
    text-shadow: 1px 1px 0 #000;
}

/* ============================================================
   HUB SCENE — Visual camp with pixel art sprites
   ============================================================ */

.hub-scene {
    background: linear-gradient(180deg, 
        #0a0a2e 0%, #1a1a4e 12%, #1e1440 25%,
        #2d1b3e 40%, #3a2520 55%, #4a3520 70%,
        #3e2c18 85%, #2c1a0e 100%) !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding: 0 !important;
    position: relative;
}

.hub-hud {
    position: sticky; top: 0; z-index: 100; width: 100%;
    display: flex; align-items: center; gap: 8px;
    padding: 6px 10px;
    background: rgba(0,0,0,0.75);
    border-bottom: 2px solid #333;
}
.hub-hud-item { font-size: 10px; color: #FFD700; text-shadow: 1px 1px 0 #000; }
.hub-hud-right { margin-left: auto; display: flex; gap: 6px; }
.hub-icon-btn {
    width: 30px; height: 30px;
    background: rgba(0,0,0,0.5); border: 2px solid #555;
    font-size: 13px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: border-color 0.2s;
}
.hub-icon-btn:hover { border-color: #FFD700; }

.hub-sky {
    position: absolute; top: 0; left: 0; right: 0;
    height: 45%; overflow: hidden; pointer-events: none;
}
.hub-cloud {
    position: absolute; background: rgba(255,255,255,0.06);
    border-radius: 50%; filter: blur(10px);
}
.cloud-1 { width: 140px; height: 35px; top: 12%; animation: cloudDrift 30s linear infinite; }
.cloud-2 { width: 90px; height: 22px; top: 22%; animation: cloudDrift 42s linear infinite reverse; animation-delay: -12s; }
.cloud-3 { width: 170px; height: 40px; top: 8%; animation: cloudDrift 50s linear infinite; animation-delay: -25s; }
@keyframes cloudDrift { 0% { left: -180px; } 100% { left: calc(100% + 30px); } }

.hub-stars {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background-image: 
        radial-gradient(1px 1px at 15% 8%, rgba(255,255,255,0.7), transparent),
        radial-gradient(1px 1px at 45% 4%, rgba(255,255,255,0.5), transparent),
        radial-gradient(1px 1px at 75% 12%, rgba(255,255,255,0.6), transparent),
        radial-gradient(1px 1px at 60% 6%, rgba(255,255,255,0.8), transparent),
        radial-gradient(2px 2px at 52% 2%, rgba(255,255,200,0.9), transparent),
        radial-gradient(1px 1px at 88% 20%, rgba(255,255,255,0.5), transparent);
    animation: starsTwinkle 4s ease-in-out infinite alternate;
}
@keyframes starsTwinkle { 0% { opacity: 0.5; } 100% { opacity: 1; } }

.hub-title {
    font-size: 22px; color: #FFD700;
    text-shadow: 3px 3px 0 #000, -1px -1px 0 #000, 0 0 20px rgba(255,215,0,0.5);
    margin-top: 45px; z-index: 10; letter-spacing: 4px;
    animation: titleGlow 2.5s ease-in-out infinite alternate;
}
@keyframes titleGlow {
    0% { text-shadow: 3px 3px 0 #000, 0 0 10px rgba(255,215,0,0.2); }
    100% { text-shadow: 3px 3px 0 #000, 0 0 30px rgba(255,215,0,0.7), 0 0 60px rgba(255,165,0,0.3); }
}
.hub-splash {
    font-size: 7px; color: #FFFF55; text-shadow: 1px 1px 0 #000;
    margin-bottom: 10px; z-index: 10;
    animation: splashBob 0.8s ease-in-out infinite alternate;
}
@keyframes splashBob {
    0% { transform: rotate(-2deg) scale(1); }
    100% { transform: rotate(2deg) scale(1.05); }
}

.hub-ground {
    width: 100%; max-width: 400px;
    padding: 5px 10px 25px; z-index: 10;
    display: flex; flex-direction: column; gap: 6px;
}
.hub-buildings-row {
    display: flex; gap: 6px; justify-content: center;
}

/* === BUILDINGS — transparent, sprite-based === */
.hub-building {
    flex: 1; max-width: 180px;
    background: none; border: none; padding: 4px;
    cursor: pointer; position: relative;
    display: flex; flex-direction: column;
    align-items: center; justify-content: flex-end;
    transition: transform 0.2s ease, filter 0.2s ease;
}
.hub-building:hover {
    transform: scale(1.08) translateY(-4px);
    filter: drop-shadow(0 4px 12px rgba(255,165,0,0.5)) brightness(1.15);
}
.hub-building:active {
    transform: scale(0.95);
    filter: brightness(0.9);
}
.hub-building.hub-primary { max-width: 220px; }

.hub-sprite {
    width: 100%; max-width: 160px; height: auto;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    pointer-events: none;
}
.hub-primary .hub-sprite { max-width: 200px; }

.hub-label {
    font-size: 7px; color: #FFD700; letter-spacing: 1px;
    text-shadow: 1px 1px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000;
    text-align: center; margin-top: 2px;
    padding: 2px 6px; background: rgba(0,0,0,0.5); border-radius: 2px;
}

.hub-small-text {
    max-width: 100px; min-height: 50px;
    background: rgba(0,0,0,0.4); border: 2px solid #444;
    padding: 6px; justify-content: center;
}
.hub-small-text:hover { border-color: #FFD700; background: rgba(255,215,0,0.1); }
.hub-small-icon { font-size: 22px; margin-bottom: 2px; }
.hub-row-small { gap: 8px; }

.hub-hidden-btn {
    position: absolute; opacity: 0;
    width: 100%; height: 100%; top: 0; left: 0;
    cursor: pointer; z-index: 5;
}

.hub-particles {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none; z-index: 1; overflow: hidden;
}
.hub-particle {
    position: absolute; width: 2px; height: 2px;
    background: rgba(255,215,0,0.3); border-radius: 50%;
    animation: particleFloat linear infinite;
}
@keyframes particleFloat {
    0% { opacity: 0; transform: translateY(100vh); }
    10% { opacity: 0.8; }
    90% { opacity: 0.8; }
    100% { opacity: 0; transform: translateY(-20px) translateX(20px); }
}

.hub-scene.mc-menu {
    justify-content: flex-start !important;
    background-image: none !important;
}

