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

:root {
    --bg-cor: #1a1a2e;
    --chao-cor: #16213e;
    --heroi-cor: #00d9ff;
    --inimigo-cor: #ff6b6b;
    --projetil-cor: #ffd93d;
    --xp-cor: #6bcb77;
    --ouro-cor: #ffd93d;
    --texto-cor: #eaeaea;
    --ui-bg: rgba(26, 26, 46, 0.85);
    --ui-borda: #00d9ff;
    --botao-bg: #0f3460;
    --botao-hover: #00d9ff;
    --botao-texto: #eaeaea;
    --joystick-bg: rgba(255, 255, 255, 0.1);
    --joystick-stick: rgba(0, 217, 255, 0.8);
}

@media (prefers-color-scheme: light) {
    :root {
        --bg-cor: #f0f0f5;
        --chao-cor: #d0d0d8;
        --heroi-cor: #0077cc;
        --inimigo-cor: #cc3333;
        --projetil-cor: #cc9900;
        --xp-cor: #228833;
        --ouro-cor: #cc9900;
        --texto-cor: #222;
        --ui-bg: rgba(240, 240, 245, 0.9);
        --ui-borda: #0077cc;
        --botao-bg: #0077cc;
        --botao-hover: #0055aa;
        --botao-texto: #fff;
        --joystick-bg: rgba(0, 0, 0, 0.1);
        --joystick-stick: rgba(0, 119, 204, 0.8);
    }
}

body {
    background: var(--bg-cor);
    color: var(--texto-cor);
    font-family: 'Segoe UI', system-ui, sans-serif;
    overflow: hidden;
    touch-action: none;
    height: 100vh;
    width: 100vw;
}

#canvas {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--chao-cor);
    touch-action: none;
}

#ui {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 10;
}

#hud {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 64px; /* deixa espaco para o botao de som */
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    pointer-events: auto;
}

#hud > div {
    background: var(--ui-bg);
    border: 1px solid var(--ui-borda);
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 14px;
    font-weight: 600;
    backdrop-filter: blur(4px);
    min-width: 100px;
    text-align: center;
}

#joystick {
    position: absolute;
    bottom: 20px;
    left: 20px;
    width: 120px;
    height: 120px;
    pointer-events: auto;
}

#joystick {
    opacity: 0.3; /* parado no canto: só uma dica */
}

#joystick.flutuando {
    opacity: 1;
}

#joystick.hidden {
    display: none;
}

#joystick-base {
    position: absolute;
    width: 100%;
    height: 100%;
    background: var(--joystick-bg);
    border: 2px solid var(--ui-borda);
    border-radius: 50%;
}

#joystick-stick {
    position: absolute;
    width: 50px;
    height: 50px;
    background: var(--joystick-stick);
    border: 2px solid var(--ui-borda);
    border-radius: 50%;
    top: 35px;
    left: 35px;
    transition: transform 0.05s linear;
    pointer-events: none;
}

#btn-mudo {
    position: fixed;
    top: 10px;
    right: 10px;
    width: 44px;
    height: 44px;
    background: var(--ui-bg);
    border: 1px solid var(--ui-borda);
    border-radius: 50%;
    color: var(--texto-cor);
    font-size: 20px;
    cursor: pointer;
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 30;
    transition: all 0.2s;
}

#btn-mudo:hover, #btn-mudo:active {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

#btn-mudo.mudo {
    opacity: 0.5;
}

#btn-tela-cheia {
    position: fixed;
    top: 62px;
    right: 10px;
    width: 44px;
    height: 44px;
    background: var(--ui-bg);
    border: 1px solid var(--ui-borda);
    border-radius: 50%;
    color: var(--texto-cor);
    font-size: 20px;
    cursor: pointer;
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 30;
    opacity: 0.8;
}

#btn-tela-cheia.hidden {
    display: none;
}

#dica-inicial {
    position: absolute;
    left: 50%;
    bottom: 22%;
    transform: translateX(-50%);
    max-width: min(560px, 88vw);
    padding: 12px 18px;
    background: rgba(8, 8, 24, 0.82);
    border: 1px solid var(--ui-borda);
    border-radius: 10px;
    color: var(--texto-cor);
    font-size: 15px;
    line-height: 1.5;
    text-align: center;
    pointer-events: none;
    z-index: 25;
}

#dica-inicial.hidden {
    display: none;
}

#btn-mudo.mudo::after {
    content: '🔇';
}

/* ==================== BARRA DE VIDA DO CHEFE ==================== */
#boss-health-bar {
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    max-width: 800px;
    min-width: 280px;
    height: auto; /* altura fixa espremia o nome do chefe */
    pointer-events: none;
    z-index: 15;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

#boss-health-bar.hidden {
    display: none;
}

#boss-health-name {
    font-size: 12px;
    font-weight: bold;
    text-align: center;
    text-shadow: 0 0 4px #000;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#boss-health-bg {
    position: relative;
    width: 100%;
    height: 20px;
    background: #333;
    border: 2px solid #555;
    border-radius: 10px;
    overflow: hidden;
}

#boss-health-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(90deg, #ff4444, #ff8800);
    border-radius: 8px;
    transition: width 0.3s ease-out;
    box-shadow: 0 0 10px rgba(255, 68, 68, 0.6);
}

@media (max-width: 900px) {
    #boss-health-bar { top: 104px; } /* HUD quebra em 2-3 linhas em telas estreitas */
}

@media (max-width: 600px) {
    #boss-health-bar {
        top: 104px;
        width: 85%;
        height: auto;
    }
    #boss-health-name {
        font-size: 10px;
    }
    #boss-health-bg {
        height: 16px;
    }
}

@keyframes pulsarVidaBaixa {
    0%, 100% { opacity: 1; box-shadow: 0 0 10px rgba(255, 68, 68, 0.6); }
    50% { opacity: 0.7; box-shadow: 0 0 20px rgba(255, 68, 68, 1), 0 0 30px rgba(255, 221, 0, 0.5); }
}

/* ==================== CONFIGURAÇÕES (Etapa 10) ==================== */
.config-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--botao-bg);
    border: 2px solid var(--ui-borda);
    border-radius: 8px;
    padding: 12px 16px;
    margin: 10px 0;
    font-size: 16px;
}

.config-item label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-weight: 500;
}

.config-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--heroi-cor);
    cursor: pointer;
}

/* ==================== MENUS (OVERLAYS) ==================== */
#menus {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 20;
}

#menus .menu {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--ui-bg);
    border: 2px solid var(--ui-borda);
    border-radius: 12px;
    padding: 30px 40px;
    text-align: center;
    pointer-events: auto;
    z-index: 20;
    min-width: 300px;
    backdrop-filter: blur(8px);
    box-shadow: 0 0 30px rgba(0, 217, 255, 0.2);
    display: none; /* oculto por padrão */
}

#menus .menu.ativo {
    display: block; /* só o menu ativo aparece */
}

@media (max-width: 600px) {
    #menus .menu {
        padding: 20px;
        min-width: 280px;
        left: 50%;
        right: auto;
        width: 90%;
        max-width: 90%;
        box-sizing: border-box;
        max-height: 90vh;
        overflow-y: auto;
        transform: translate(-50%, -50%);
    }
}

/* Botoes dos menus (antes sem estilo) */
#menus .menu button {
    background: var(--botao-bg, #0a3d62);
    color: #fff;
    border: 2px solid var(--ui-borda, #00d9ff);
    border-radius: 8px;
    padding: 10px 16px;
    margin: 4px;
    font-size: 15px;
    font-family: inherit;
    cursor: pointer;
    min-height: 44px;
}
#menus .menu button:hover,
#menus .menu button:focus {
    filter: brightness(1.25);
    outline: none;
}

.hidden {
    display: none !important;
}

.tela h1, .tela h2 {
    margin-bottom: 16px;
    color: var(--heroi-cor);
    text-shadow: 0 0 10px var(--heroi-cor);
}

.tela p {
    margin-bottom: 12px;
    line-height: 1.5;
}

.tela button {
    background: var(--botao-bg);
    color: var(--botao-texto);
    border: 2px solid var(--ui-borda);
    border-radius: 8px;
    padding: 12px 28px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    pointer-events: auto;
    transition: all 0.2s;
    min-width: 200px;
}

.tela button:hover, .tela button:focus {
    background: var(--botao-hover);
    color: var(--bg-cor);
    transform: scale(1.05);
    outline: none;
}

.tela button:active {
    transform: scale(0.98);
}

#opcoes-upgrade {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 16px;
}

.opcao-upgrade {
    background: var(--botao-bg);
    border: 2px solid var(--ui-borda);
    border-radius: 8px;
    padding: 16px;
    cursor: pointer;
    pointer-events: auto;
    transition: border-color 0.2s, background 0.2s;
    text-align: left;
}

.opcao-upgrade:hover, .opcao-upgrade:focus {
    border-color: var(--xp-cor);
    background: rgba(107, 203, 119, 0.2);
    outline: none;
}

.opcao-upgrade.selecionado {
    border-color: var(--xp-cor);
    background: rgba(107, 203, 119, 0.3);
}

/* Opção dourada - Evolução de União (Etapa 8) */
.opcao-upgrade.dourado {
    border-color: #ffdd00;
    background: linear-gradient(135deg, rgba(255, 221, 0, 0.3), rgba(255, 180, 0, 0.2));
    box-shadow: 0 0 20px rgba(255, 221, 0, 0.4);
    animation: pulsoDourado 1.5s ease-in-out infinite;
}
@keyframes pulsoDourado {
    0%, 100% { box-shadow: 0 0 20px rgba(255, 221, 0, 0.4); }
    50% { box-shadow: 0 0 30px rgba(255, 221, 0, 0.7), 0 0 40px rgba(255, 180, 0, 0.3); }
}
.opcao-upgrade.dourado h3 {
    color: #ffdd00;
    text-shadow: 0 0 10px #ffdd00, 0 0 20px #ffaa00;
}
.opcao-upgrade.dourado:hover,
.opcao-upgrade.dourado.selecionado {
    border-color: #ffff44;
    background: linear-gradient(135deg, rgba(255, 221, 0, 0.4), rgba(255, 200, 0, 0.3));
}

/* Opção de dica - cinza, não selecionável */
.opcao-upgrade.dica {
    border-color: #555;
    background: rgba(80, 80, 80, 0.3);
    opacity: 0.7;
    pointer-events: none;
}
.opcao-upgrade.dica h3 {
    color: #888;
}
.opcao-upgrade.dica p {
    color: #666;
}

.opcao-upgrade h3 {
    color: var(--xp-cor);
    margin-bottom: 6px;
    font-size: 16px;
}

.opcao-upgrade p {
    font-size: 13px;
    color: #ccc;
    margin: 0;
}

/* Passivos no HUD (Etapa 8) */
#passivos-hud {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    min-height: 32px;
}
.passivo-icone {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--ui-bg);
    border: 2px solid var(--ui-borda);
    border-radius: 6px;
    font-size: 18px;
    backdrop-filter: blur(4px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
}
.passivo-icone:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 16px rgba(0, 217, 255, 0.4);
    border-color: var(--heroi-cor);
    z-index: 10;
}

@media (max-width: 600px) {
    #hud > div {
        font-size: 12px;
        padding: 4px 8px;
        min-width: 80px;
    }
    #joystick {
        bottom: 10px;
        left: 10px;
        width: 100px;
        height: 100px;
    }
    #joystick-stick {
        width: 40px;
        height: 40px;
        top: 30px;
        left: 30px;
    }
    .tela {
        padding: 20px;
        min-width: 280px;
        left: 5%;
        right: 5%;
        transform: translate(-50%, -50%);
    }
    .opcao-upgrade {
        width: 100%;
        max-width: 280px;
    }
}

/* ==================== LOJA E HERÓIS ==================== */
#menu-loja.tela {
    max-width: 600px;
    width: 90%;
    padding: 20px;
}

.loja-topo {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--ui-borda);
}

.ouro-display {
    font-size: 20px;
    font-weight: bold;
    color: var(--ouro-cor);
}

.loja-abas {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    justify-content: center;
}

.loja-abas button {
    background: var(--botao-bg);
    color: var(--botao-texto);
    border: 2px solid var(--ui-borda);
    border-radius: 6px;
    padding: 8px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    min-width: auto;
}

.loja-abas button:hover,
.loja-abas button.aba-ativa {
    background: var(--botao-hover);
    color: var(--bg-cor);
}

.loja-conteudo {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 8px;
}

.aba-conteudo {
    display: none;
}

.aba-conteudo.ativo {
    display: block;
}

.lista-itens {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.item-loja {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--botao-bg);
    border: 2px solid var(--ui-borda);
    border-radius: 8px;
    padding: 12px 16px;
    gap: 16px;
    transition: border-color 0.2s, background 0.2s;
    min-height: 80px;
}

.item-loja:hover {
    border-color: var(--heroi-cor);
    background: rgba(0, 217, 255, 0.1);
}

.item-loja.heroi.desbloqueado {
    border-left: 4px solid var(--xp-cor);
}

.item-loja.heroi.selecionado {
    border-color: var(--xp-cor);
    background: rgba(107, 203, 119, 0.2);
}

.item-loja.heroi.pode-comprar {
    border-left: 4px solid var(--ouro-cor);
}

.item-loja.melhoria.max-nivel {
    opacity: 0.7;
    border-color: var(--xp-cor);
}

.item-loja.melhoria.pode-comprar {
    border-left: 4px solid var(--ouro-cor);
}

.heroi-info, .melhoria-info {
    flex: 1;
    text-align: left;
    min-width: 0;
}

.heroi-info h3, .melhoria-info h3 {
    margin: 0 0 4px 0;
    font-size: 16px;
}

.heroi-desc, .melhoria-desc {
    margin: 0 0 8px 0;
    font-size: 12px;
    color: #aaa;
    line-height: 1.4;
}

.heroi-stats {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 11px;
    color: #888;
}

.heroi-stats span {
    background: rgba(255,255,255,0.05);
    padding: 2px 8px;
    border-radius: 4px;
}

.melhoria-niveis {
    display: flex;
    gap: 4px;
    margin: 8px 0;
}

.nivel-pip {
    width: 14px;
    height: 14px;
    border: 2px solid var(--ui-borda);
    border-radius: 3px;
    background: transparent;
}

.nivel-pip.ativo {
    background: var(--xp-cor);
    border-color: var(--xp-cor);
}

.melhoria-nivel {
    font-size: 12px;
    color: #888;
}

.heroi-acao, .melhoria-acao {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.item-loja .btn-comprar,
.item-loja .btn-selecionar {
    background: var(--botao-bg);
    color: var(--botao-texto);
    border: 2px solid var(--ouro-cor);
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.item-loja .btn-comprar:hover,
.item-loja .btn-selecionar:hover {
    background: var(--ouro-cor);
    color: var(--bg-cor);
}

.item-loja .btn-selecionar {
    border-color: var(--xp-cor);
}

.item-loja .btn-selecionar:hover {
    background: var(--xp-cor);
}

.custo-indisponivel {
    font-size: 13px;
    color: #666;
    white-space: nowrap;
}

.selecionado-tag {
    font-size: 12px;
    color: var(--xp-cor);
    font-weight: bold;
    white-space: nowrap;
}

.max-tag {
    font-size: 12px;
    color: var(--xp-cor);
    font-weight: bold;
    background: rgba(107, 203, 119, 0.2);
    padding: 4px 12px;
    border-radius: 4px;
}

.loja-rodape {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--ui-borda);
    gap: 12px;
}

.btn-perigo {
    background: #8b0000 !important;
    border-color: #ff4444 !important;
    color: #fff !important;
}

.btn-perigo:hover {
    background: #ff4444 !important;
    color: #000 !important;
}

/* ==================== SELEÇÃO DE HERÓIS (Etapa 9) ==================== */
#menu-herois.tela {
    max-width: 800px;
    width: 90%;
    padding: 20px;
}

.herois-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.heroi-card {
    background: var(--botao-bg);
    border: 2px solid var(--ui-borda);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    transition: all 0.2s;
    cursor: pointer;
    position: relative;
    min-height: 240px;
    display: flex;
    flex-direction: column;
}

.heroi-card:hover {
    border-color: var(--heroi-cor);
    background: rgba(0, 217, 255, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 217, 255, 0.15);
}

.heroi-card.selecionado {
    border-color: var(--xp-cor);
    background: rgba(107, 203, 119, 0.2);
    box-shadow: 0 0 20px rgba(107, 203, 119, 0.3);
}

.heroi-card.bloqueado {
    opacity: 0.6;
    cursor: not-allowed;
}

.heroi-card.bloqueado:hover {
    transform: none;
    border-color: var(--ui-borda);
    background: var(--botao-bg);
    box-shadow: none;
}

.heroi-sprite-container {
    width: 64px;
    height: 64px;
    margin: 0 auto 12px;
    position: relative;
    flex-shrink: 0;
}

.heroi-sprite {
    width: 64px;
    height: 64px;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.heroi-card.bloqueado .heroi-sprite {
    filter: brightness(0) saturate(0);
}

.heroi-card.bloqueado .heroi-sprite::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.4) 100%);
    border-radius: 8px;
    pointer-events: none;
}

.heroi-preco-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.85);
    border-radius: 0 0 8px 8px;
    padding: 4px 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: var(--ouro-cor);
    font-weight: bold;
    font-size: 13px;
    border-top: 1px solid var(--ouro-cor);
}

.heroi-preco-overlay::before {
    content: '💰';
    font-size: 14px;
}

.heroi-nome {
    font-size: 16px;
    font-weight: bold;
    margin: 0 0 4px 0;
    color: var(--texto-cor);
}

.heroi-classe {
    font-size: 12px;
    color: var(--heroi-cor);
    margin: 0 0 8px 0;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.heroi-stats-compact {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 8px 0;
    font-size: 11px;
    color: #aaa;
    flex-wrap: wrap;
}

.heroi-stat {
    background: rgba(255,255,255,0.05);
    padding: 2px 8px;
    border-radius: 4px;
    white-space: nowrap;
}

.heroi-desc-compact {
    font-size: 11px;
    color: #888;
    margin: 8px 0 12px;
    line-height: 1.3;
    flex-grow: 1;
}

.heroi-arma {
    font-size: 10px;
    color: var(--xp-cor);
    margin: 0 0 8px 0;
    font-style: italic;
}

/* Retrato do herói com moldura (Etapa 10) */
.heroi-retrato-moldura {
    width: 96px;
    height: 96px;
    margin: 0 auto 12px;
    position: relative;
    background: linear-gradient(135deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
    border: 2px solid var(--ui-borda);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow:
        inset 0 2px 8px rgba(255,255,255,0.1),
        0 4px 16px rgba(0,0,0,0.3);
}

.heroi-retrato-moldura::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(135deg, var(--heroi-cor), var(--ouro-cor), var(--xp-cor));
    border-radius: 14px;
    z-index: -1;
    opacity: 0.5;
    filter: blur(4px);
}

.heroi-retrato-moldura.bloqueado {
    opacity: 0.5;
    border-color: #444;
}

.heroi-retrato-moldura.bloqueado::before {
    opacity: 0.1;
}

.heroi-retrato-moldura canvas {
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.4));
}

.item-loja .heroi-visual {
    flex-shrink: 0;
    margin-right: 16px;
}

@media (max-width: 600px) {
    .heroi-retrato-moldura {
        width: 80px;
        height: 80px;
    }
    .heroi-retrato-moldura canvas {
        width: 80px;
        height: 80px;
    }
}

.heroi-acao-btn {
    margin-top: auto;
    width: 100%;
    padding: 10px;
    font-size: 13px;
}

.heroi-tag-selecionado {
    position: absolute;
    top: -10px;
    right: -10px;
    background: var(--xp-cor);
    color: var(--bg-cor);
    font-size: 10px;
    font-weight: bold;
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(107, 203, 119, 0.5);
}

@media (max-width: 600px) {
    #menu-herois.tela {
        width: 95%;
        padding: 16px;
    }
    .herois-grid {
        grid-template-columns: 1fr;
    }
    .heroi-card {
        min-height: auto;
        padding: 14px;
    }
    .heroi-sprite-container {
        width: 56px;
        height: 56px;
    }
    .heroi-sprite {
        width: 56px;
        height: 56px;
    }
}

/* ==================== CONQUISTAS ==================== */
.lista-conquistas {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 8px;
    margin-top: 16px;
    text-align: left;
}

.item-conquista {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--botao-bg);
    border: 2px solid var(--ui-borda);
    border-radius: 8px;
    padding: 12px 16px;
    transition: border-color 0.2s, background 0.2s;
    min-height: 70px;
}

.item-conquista:hover {
    border-color: var(--heroi-cor);
    background: rgba(0, 217, 255, 0.1);
}

.item-conquista.desbloqueada {
    border-left: 4px solid var(--xp-cor);
    background: rgba(107, 203, 119, 0.1);
}

.conquista-icone {
    font-size: 28px;
    flex-shrink: 0;
    opacity: 0.4;
}

.item-conquista.desbloqueada .conquista-icone {
    opacity: 1;
}

.conquista-info {
    flex: 1;
    min-width: 0;
}

.conquista-info h3 {
    margin: 0 0 4px 0;
    font-size: 15px;
    color: var(--texto-cor);
}

.item-conquista.desbloqueada .conquista-info h3 {
    color: var(--xp-cor);
}

.conquista-desc {
    margin: 0;
    font-size: 12px;
    color: #888;
    line-height: 1.4;
}

.conquista-tag {
    font-size: 11px;
    font-weight: bold;
    padding: 2px 8px;
    border-radius: 4px;
    white-space: nowrap;
    flex-shrink: 0;
}

.item-conquista.desbloqueada .conquista-tag {
    background: rgba(107, 203, 119, 0.3);
    color: var(--xp-cor);
}

.item-conquista:not(.desbloqueada) .conquista-tag {
    background: rgba(255, 255, 255, 0.05);
    color: #666;
}

@media (max-width: 600px) {
    #menu-conquistas.tela {
        width: 95%;
        padding: 16px;
    }
    .item-conquista {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        text-align: left;
    }
    .conquista-tag {
        align-self: flex-end;
    }
}

/* ==================== COLEÇÃO (Etapa 8) ==================== */
#menu-colecao.tela {
    max-width: 700px;
    width: 90%;
    padding: 20px;
}

.lista-colecao {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 450px;
    overflow-y: auto;
    padding-right: 8px;
    margin-top: 16px;
    text-align: left;
}

.colecao-resumo {
    text-align: center;
    padding: 12px;
    background: var(--botao-bg);
    border: 2px solid var(--ouro-cor);
    border-radius: 8px;
    color: var(--ouro-cor);
    font-size: 14px;
    margin-bottom: 8px;
}

.item-colecao {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--botao-bg);
    border: 2px solid var(--ui-borda);
    border-radius: 8px;
    padding: 12px 16px;
    transition: border-color 0.2s, background 0.2s;
    min-height: 80px;
    flex-shrink: 0; /* sem isso os cartões encolhem e o texto sobrepõe */
}

.item-colecao:hover {
    border-color: var(--heroi-cor);
    background: rgba(0, 217, 255, 0.1);
}

.item-colecao.desbloqueada {
    border-left: 4px solid var(--ouro-cor);
    background: rgba(255, 221, 0, 0.1);
}

.colecao-icone {
    font-size: 32px;
    flex-shrink: 0;
    opacity: 0.4;
    filter: grayscale(1);
}

.item-colecao.desbloqueada .colecao-icone {
    opacity: 1;
    filter: grayscale(0);
}

.colecao-info {
    flex: 1;
    min-width: 0;
}

.colecao-info h3 {
    margin: 0 0 4px 0;
    font-size: 16px;
    color: var(--texto-cor);
}

.item-colecao.desbloqueada .colecao-info h3 {
    color: var(--ouro-cor);
}

.colecao-desc {
    margin: 0 0 2px 0;
    font-size: 12px;
    color: #888;
    line-height: 1.4;
}

.colecao-receita {
    margin: 0;
    font-size: 11px;
    color: var(--xp-cor);
    font-style: italic;
}

.colecao-tag {
    font-size: 11px;
    font-weight: bold;
    padding: 2px 8px;
    border-radius: 4px;
    white-space: nowrap;
    flex-shrink: 0;
}

.item-colecao.desbloqueada .colecao-tag {
    background: rgba(255, 221, 0, 0.3);
    color: var(--ouro-cor);
}

.item-colecao:not(.desbloqueada) .colecao-tag {
    background: rgba(255, 255, 255, 0.05);
    color: #666;
}

@media (max-width: 600px) {
    #menu-colecao.tela {
        width: 95%;
        padding: 16px;
    }
    .item-colecao {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        text-align: left;
    }
    .colecao-tag {
        align-self: flex-end;
    }
    .colecao-receita {
        font-size: 10px;
    }
}

/* ==================== ETAPA 12: BOTÕES LEVEL-UP ==================== */
#levelup-botoes {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 16px;
    flex-wrap: wrap;
}

#levelup-botoes button {
    background: var(--botao-bg);
    color: var(--botao-texto);
    border: 2px solid var(--ui-borda);
    border-radius: 6px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    min-height: 36px;
}

#levelup-botoes button:hover:not(:disabled),
#levelup-botoes button:focus:not(:disabled) {
    background: var(--botao-hover);
    color: var(--bg-cor);
    transform: scale(1.05);
    outline: none;
}

#levelup-botoes button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    border-color: #555;
    background: #2a2a3e;
}

#levelup-botoes button#btn-reroll {
    border-color: #ffdd00;
    color: #ffdd00;
}
#levelup-botoes button#btn-reroll:hover:not(:disabled) {
    background: #ffdd00;
    color: #1a1a2e;
}

#levelup-botoes button#btn-skip {
    border-color: var(--ouro-cor);
    color: var(--ouro-cor);
}
#levelup-botoes button#btn-skip:hover:not(:disabled) {
    background: var(--ouro-cor);
    color: var(--bg-cor);
}

#levelup-botoes button#btn-banir {
    border-color: #ff4444;
    color: #ff4444;
}
#levelup-botoes button#btn-banir:hover:not(:disabled) {
    background: #ff4444;
    color: #fff;
}

#levelup-botoes button span {
    margin-left: 4px;
    font-size: 12px;
    font-weight: bold;
    background: rgba(0,0,0,0.3);
    padding: 1px 6px;
    border-radius: 4px;
}

/* ==================== ETAPA 12: REVIVE HUD ==================== */
#revive-hud {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--ui-bg);
    border: 2px solid #ff4444;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 13px;
    font-weight: 600;
    color: #ff4444;
    backdrop-filter: blur(4px);
    animation: revivePulso 2s ease-in-out infinite;
}
#revive-hud.hidden {
    display: none !important;
}
#revive-icon {
    font-size: 16px;
}
#revive-usos {
    background: #ff4444;
    color: #fff;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 11px;
    min-width: 20px;
    text-align: center;
}
@keyframes revivePulso {
    0%, 100% { box-shadow: 0 0 8px rgba(255, 68, 68, 0.4); }
    50% { box-shadow: 0 0 16px rgba(255, 68, 68, 0.8), 0 0 24px rgba(255, 150, 0, 0.4); }
}

/* ==================== ETAPA 12: EVENTO AVISO ==================== */
#evento-aviso {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #8b0000, #4a0000);
    border: 2px solid #ff4444;
    border-radius: 8px;
    padding: 12px 24px;
    font-size: 18px;
    font-weight: bold;
    color: #ffdd00;
    text-align: center;
    text-shadow: 0 0 8px #ff4444;
    z-index: 50;
    pointer-events: none;
    animation: eventoAvisoEntrada 0.5s ease-out, eventoAvisoPulso 1s ease-in-out infinite;
    box-shadow: 0 0 20px rgba(255, 68, 68, 0.5), 0 0 40px rgba(139, 0, 0, 0.3);
    white-space: nowrap;
}
#evento-aviso.hidden {
    display: none !important;
}
@keyframes eventoAvisoEntrada {
    from { opacity: 0; transform: translateX(-50%) translateY(-20px) scale(0.8); }
    to { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}
@keyframes eventoAvisoPulso {
    0%, 100% { box-shadow: 0 0 20px rgba(255, 68, 68, 0.5), 0 0 40px rgba(139, 0, 0, 0.3); }
    50% { box-shadow: 0 0 30px rgba(255, 68, 68, 0.8), 0 0 60px rgba(255, 221, 0, 0.4); }
}

/* ==================== ETAPA 12: INDICADOR DE BAÚ NA BORDA ==================== */
#bau-indicador {
    position: fixed;
    width: 32px;
    height: 32px;
    pointer-events: none;
    z-index: 30;
    transform: translate(-50%, -50%);
    animation: bauIndicadorPulso 1s ease-in-out infinite;
}
#bau-indicador.hidden {
    display: none !important;
}
#bau-indicador::before {
    content: '📦';
    font-size: 24px;
    filter: drop-shadow(0 0 8px #ffdd00) drop-shadow(0 0 16px #ffaa00);
    display: block;
    animation: bauIndicadorRotacao 2s linear infinite;
}
@keyframes bauIndicadorPulso {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    50% { transform: translate(-50%, -50%) scale(1.2); opacity: 0.8; }
}
@keyframes bauIndicadorRotacao {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ==================== ETAPA 12: SELO "NOVO!" NA COLEÇÃO ==================== */
.item-colecao.nova .colecao-tag {
    background: #ffdd00 !important;
    color: #1a1a2e !important;
    animation: novoPulso 1s ease-in-out infinite;
    font-weight: bold;
}
@keyframes novoPulso {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}
/* ==================== LOJA NO CELULAR (cartões de herói mais legíveis) ==================== */
@media (max-width: 600px) {
    .item-loja.heroi { flex-wrap: wrap; gap: 8px; }
    .item-loja.heroi .heroi-visual { flex: 0 0 auto; }
    .item-loja.heroi .heroi-info { flex: 1 1 150px; min-width: 0; }
    .item-loja.heroi .heroi-acao { flex: 1 1 100%; justify-content: center; }
    .item-loja.heroi .heroi-stats { flex-wrap: wrap; gap: 4px; }
}
