* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: #1a1a1a;
    color: #fff;
    font-family: 'Courier New', Courier, monospace;
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    position: relative;
    overscroll-behavior-y: contain;
}

.screen {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hidden {
    display: none !important;
}

#home-screen,
#settings-screen {
    justify-content: center;
}

.game-title {
    font-size: 2.5rem;
    text-shadow: 4px 4px 0 #555;
    margin-bottom: 10px;
    color: #FFD700;
    text-align: center;
}

.subtitle {
    margin-bottom: 20px;
    color: #aaa;
    text-align: center;
    padding: 0 10px;
}

.gold-text {
    color: #FFD700;
    font-weight: bold;
}

.screen-title {
    font-size: 1.5rem;
    color: #FFD700;
    margin-bottom: 15px;
    text-align: center;
    text-shadow: 2px 2px 0 #000;
}

.store-title {
    margin-bottom: 10px;
    text-align: center;
}

/* Botões menores */
.btn {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    font-weight: bold;
    padding: 10px 15px;
    margin: 4px;
    border: 3px solid #fff;
    border-radius: 6px;
    cursor: pointer;
    transition: transform 0.1s;
    width: 100%;
    max-width: 260px;
    text-align: center;
    touch-action: manipulation;
}

.btn:active {
    transform: scale(0.95);
}

.primary-btn {
    background-color: #4CAF50;
    color: white;
    border-color: #2E7D32;
    box-shadow: 0 3px 0 #2E7D32;
}

.secondary-btn {
    background-color: #FF9800;
    color: white;
    border-color: #E65100;
    box-shadow: 0 3px 0 #E65100;
}

.trader-btn {
    background-color: #2196F3;
    color: white;
    border-color: #0D47A1;
    box-shadow: 0 3px 0 #0D47A1;
}

.bank-btn {
    background-color: #9C27B0; /* Roxo */
    color: white;
    border-color: #6A1B9A;
    box-shadow: 0 3px 0 #6A1B9A;
}

.settings-btn {
    background-color: #607D8B;
    color: white;
    border-color: #37474F;
    box-shadow: 0 3px 0 #37474F;
}

.danger-btn {
    background-color: #f44336;
    color: white;
    border-color: #B71C1C;
    box-shadow: 0 3px 0 #B71C1C;
    font-size: 0.9rem;
    padding: 8px 15px;
}

.nav-btn {
    font-size: 0.8rem;
    padding: 4px 8px;
    width: auto;
    margin: 0;
    border-width: 2px;
    box-shadow: 0 2px 0 #2E7D32;
}

/* Painel de status compacto */
#ui-panel,
#ui-panel-trader,
#ui-panel-store,
#ui-panel-bank {
    background-color: #333;
    padding: 6px 10px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    flex-wrap: wrap;
    width: 100%;
    border-bottom: 3px solid #555;
    font-size: 12px;
    text-shadow: 1px 1px 0 #000;
}

.stat {
    margin: 2px 4px;
}

#game-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    overflow: hidden;
    background: #1a1a1a;
    padding: 4px 8px;
}

#target-info-bar {
    width: 100%;
    max-width: 800px;
    background: #222;
    border: 2px solid #444;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 0.85rem;
    text-align: center;
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 4px;
}

#mine-grid-wrapper {
    flex: 1;
    width: 100%;
    max-width: 800px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 12px;
}

#mine-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-auto-rows: 1fr;
    gap: 3px;
    width: 100%; /* A largura preenche o wrapper */
    aspect-ratio: 8 / 12; /* Mantém a proporção correta (8 colunas / 12 linhas) */
    background-color: #000;
    padding: 4px;
    border: 4px inset #444;
}

.block {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    border-radius: 2px;
    cursor: pointer;
    image-rendering: pixelated;
    background-size: 100% 100%;
    background-repeat: no-repeat;
    touch-action: manipulation;
    border: 1px solid transparent;
}

.block.selected-target {
    border: 2px solid #FFD700;
    box-shadow: inset 0 0 4px #000, 0 0 6px #FFD700;
    z-index: 5;
}

/* Animação da picareta */
.pickaxe-tool-anim {
    position: absolute;
    font-size: 1.5rem;
    top: -12px;
    right: -14px;
    pointer-events: none;
    z-index: 10;
    transform: rotate(-30deg);
    text-shadow: 2px 2px 1px rgba(0,0,0,0.7);
    transition: transform 0.1s ease;
}

.pickaxe-hitting {
    animation: swingPickaxe 0.18s infinite alternate ease-in-out;
}

@keyframes swingPickaxe {
    0% {
        transform: rotate(-45deg) translate(-4px, 4px);
    }

    100% {
        transform: rotate(15deg) translate(4px, -4px);
    }
}

.hit-anim {
    animation: smoothImpact 0.15s ease-out both;
}

@keyframes smoothImpact {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(0.9);
    }

    100% {
        transform: scale(1);
    }
}

/* Sprites */
.dirt {
    background-image: url('assets/dirt.png');
}

.stone {
    background-image: url('assets/stone.png');
}

.coal {
    background-image: url('assets/coal.png');
}

.iron {
    background-image: url('assets/iron.png');
}

.gold {
    background-image: url('assets/gold.png');
}

.diamond {
    background-image: url('assets/diamond.png');
}

.safira {
    background-image: url('assets/safira.png');
}

.rubi {
    background-image: url('assets/rubi.png');
}

.mined {
    background-image: none;
    background-color: transparent;
    cursor: default;
    border: 1px dashed #222;
}

.hardened {
    border: 2px solid #ff5722; /* Laranja forte para indicar dureza */
    box-shadow: inset 0 0 8px rgba(255, 87, 34, 0.6);
    animation: hardened-pulse 2s infinite alternate;
}

.mine-action-bar {
    display: flex;
    gap: 8px;
    width: 100%;
    max-width: 800px;
    justify-content: center;
    padding: 6px;
    background: #222;
    border-top: 3px solid #444;
}

.mine-action-bar .btn {
    max-width: none;
    flex: 1;
    padding: 12px 10px;
    font-size: 1rem;
    margin: 0;
    border-radius: 8px;
}

.floating-text {
    position: absolute;
    color: #FFD700;
    font-weight: bold;
    font-size: 1.5rem;
    pointer-events: none;
    animation: floatUp 1s ease-out forwards;
    text-shadow: 2px 2px 0 #000;
    z-index: 100;
}

@keyframes floatUp {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }

    100% {
        opacity: 0;
        transform: translateY(-50px) scale(1.5);
    }
}

@keyframes hardened-pulse {
    from {
        box-shadow: inset 0 0 8px rgba(255, 87, 34, 0.5);
    }
    to {
        box-shadow: inset 0 0 12px rgba(255, 87, 34, 0.8), 0 0 5px #ff5722;
    }
}

.store-container,
.trader-container {
    background: #222;
    border: 3px solid #555;
    padding: 10px;
    margin: 5px 0;
    width: 95%;
    max-width: 550px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.trader-subtitle {
    font-size: 0.8rem;
    color: #aaa;
    margin-bottom: 8px;
    text-align: center;
}

.assets-list,
.portfolio-list {
    width: 100%;
    margin-bottom: 10px;
}

.asset-card,
.portfolio-card {
    background: #333;
    margin-bottom: 6px;
    padding: 8px;
    border: 2px solid #444;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
}

.asset-info h4 {
    color: #2196F3;
    margin-bottom: 2px;
    font-size: 0.95rem;
}

.asset-price {
    font-weight: bold;
    color: #FFD700;
}

.price-up {
    color: #4CAF50 !important;
}

.price-down {
    color: #f44336 !important;
}

.trade-btn {
    background: #4CAF50;
    border: none;
    color: white;
    padding: 6px 10px;
    cursor: pointer;
    font-family: inherit;
    font-weight: bold;
    border-radius: 4px;
    font-size: 0.8rem;
}

.trade-btn.sell {
    background: #f44336;
}

.trade-btn:disabled {
    background: #555;
    color: #888;
    cursor: not-allowed;
}

.portfolio-section {
    width: 100%;
    border-top: 2px dashed #444;
    margin-top: 8px;
    padding-top: 8px;
}

.portfolio-section h3 {
    font-size: 0.95rem;
    margin-bottom: 6px;
    color: #FF9800;
}

.store-item {
    background: #333;
    margin-bottom: 8px;
    padding: 8px;
    border: 2px solid #444;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.item-info h3 {
    font-size: 1rem;
    color: #4CAF50;
    margin-bottom: 3px;
}

.item-info p {
    font-size: 0.75rem;
    color: #ccc;
}

.buy-btn {
    background: #FF9800;
    border: none;
    color: white;
    padding: 8px 12px;
    cursor: pointer;
    font-family: inherit;
    font-weight: bold;
    border-radius: 4px;
    font-size: 0.85rem;
}

.buy-btn:hover:not(:disabled) {
    background: #F57C00;
}

.buy-btn:disabled {
    background: #555;
    color: #888;
    cursor: not-allowed;
}

@media (max-width: 600px) {
    .game-title {
        font-size: 2rem;
    }

    #ui-panel,
    #ui-panel-trader {
        font-size: 11px;
        padding: 4px;
        justify-content: center;
        gap: 4px;
    }

    .stat {
        margin: 1px 4px;
        text-align: center;
    }

    #mine-grid {
        gap: 1px;
        padding: 1px;
    }

    .store-item,
    .asset-card,
    .portfolio-card {
        flex-direction: column;
        text-align: center;
        gap: 6px;
    }

    .buy-btn,
    .trade-btn {
        width: 100%;
        padding: 8px;
        font-size: 0.9rem;
    }

    .bank-actions .btn {
        /* Força cada botão a ocupar a largura total, empilhando-os verticalmente */
        flex: 1 1 100%;
    }

    .floating-text {
        font-size: 1.2rem;
    }

    .mine-action-bar .btn {
        font-size: 0.7rem;
        padding: 12px 8px;
    }
}

/* Layout da Tela da Loja */
.store-content-wrapper,
.content-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    overflow: hidden;
    padding: 10px;
}

/* Modal de Notícias */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
    padding: 15px;
}

.modal-content {
    background: #222;
    padding: 20px;
    border-radius: 8px;
    border: 3px solid #555;
    text-align: center;
    max-width: 400px;
    width: 100%;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
}

.modal-content h2 {
    color: #FFD700;
    margin-bottom: 10px;
}

.modal-content p {
    margin-bottom: 15px;
    color: #ddd;
    font-size: 0.9rem;
}

.modal-content #news-impact {
    font-weight: bold;
    font-size: 1rem;
}

.modal-content .btn {
    margin-top: 10px;
}

/* Lista de Venda no Modal */
#inventory-sell-list {
    width: 100%;
    max-height: 60vh;
    overflow-y: auto;
}

/* Estilos para botões do modal de alerta */
#alert-modal-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

#loan-info p {
    background: #222;
    padding: 10px;
    border-radius: 4px;
    border-left: 3px solid #9C27B0;
    font-size: 0.9rem;
    margin-bottom: 15px;
}

#alert-modal-buttons .btn {
    margin: 0; /* Sobrescreve a margem padrão dos botões */
    min-width: 100px;
}