/* Jogando: sem cursor sobre o mundo (teclado/controle). Menus, árvore e cercado aceitam o mouse. */
body.in-game canvas#gameCanvas { cursor: none; }
button, .sk-node, .pt-card, .menu-btn, .char-card, .sk-slot, .shop-item-card { cursor: pointer; }

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

body {
    background-color: #06080c;
    color: #d1d5db;
    font-family: 'Cinzel', 'Georgia', 'Segoe UI', serif;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    display: flex;
    justify-content: center;
    align-items: center;
}

#game-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #06080c;
    overflow: hidden;
    margin: 0;
    padding: 0;
    border: none;
    box-shadow: none;
}

canvas#gameCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
    cursor: none;
}

/* Telas / Modais */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(8, 10, 15, 0.94);
    backdrop-filter: blur(8px);
    z-index: 50;
    transition: opacity 0.3s ease;
}

.hidden, .screen.hidden {
    display: none !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Menu de Seleção */
.title-container {
    text-align: center;
    margin-bottom: 20px;
}

.title-container h1 {
    font-size: 3rem;
    font-weight: 900;
    letter-spacing: 6px;
    color: #e9c46a;
    text-shadow: 0 0 25px rgba(233, 196, 106, 0.6), 0 0 45px rgba(231, 111, 81, 0.3);
    text-transform: uppercase;
}

.title-container p {
    font-size: 0.95rem;
    color: #a8a29e;
    letter-spacing: 2px;
    margin-top: 6px;
}

.class-grid {
    display: flex;
    gap: 20px;
    margin-bottom: 25px;
}

.class-card {
    background: #14110f;
    border: 2px solid #574131;
    border-radius: 8px;
    padding: 18px;
    width: 250px;
    cursor: pointer;
    transition: all 0.25s ease;
    text-align: center;
}

.class-card:hover {
    transform: translateY(-6px);
    border-color: #e9c46a;
    box-shadow: 0 8px 25px rgba(233, 196, 106, 0.25);
}

.class-card.selected {
    border-color: #f4a261;
    box-shadow: 0 0 25px rgba(244, 162, 97, 0.45);
    background: #1f1915;
}

.class-avatar {
    width: 75px;
    height: 75px;
    margin: 0 auto 12px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2.3rem;
    box-shadow: 0 0 15px rgba(0,0,0,0.6);
}

.warrior-avatar { background: radial-gradient(circle, #9d0208, #370617); border: 2px solid #dc2f02; }
.mage-avatar { background: radial-gradient(circle, #2b2d42, #141b2d); border: 2px solid #64dfdf; }
.archer-avatar { background: radial-gradient(circle, #2d6a4f, #1b4332); border: 2px solid #74c69d; }

.class-card h3 {
    font-size: 1.35rem;
    color: #fefae0;
    margin-bottom: 6px;
}

.class-desc {
    font-size: 0.8rem;
    color: #b5a89f;
    margin-bottom: 12px;
    line-height: 1.3;
    height: 38px;
}

.class-skills-list {
    text-align: left;
    font-size: 0.75rem;
    color: #d6ccc2;
    border-top: 1px solid rgba(255,255,255,0.08);
    padding-top: 10px;
}

.class-skills-list li {
    list-style: none;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
}

.class-skills-list .badge {
    background: #000;
    color: #e9c46a;
    border: 1px solid #574131;
    font-size: 0.65rem;
    padding: 2px 5px;
    border-radius: 3px;
    margin-right: 6px;
    font-weight: bold;
}

.btn-primary {
    background: linear-gradient(135deg, #c58940, #e5ba73);
    color: #1a120b;
    font-size: 1.1rem;
    font-weight: 800;
    padding: 12px 35px;
    border: 2px solid #faab78;
    border-radius: 6px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 2px;
    box-shadow: 0 0 20px rgba(229, 186, 115, 0.35);
    transition: all 0.2s ease;
}

.btn-primary:hover {
    transform: scale(1.04);
    box-shadow: 0 0 30px rgba(250, 171, 120, 0.6);
}

/* HUD Superior e Inferior */
#game-hud {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

.top-bar {
    position: absolute;
    top: 15px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.player-status {
    background: rgba(20, 17, 15, 0.88);
    border: 2px solid #574131;
    border-radius: 6px;
    padding: 10px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 250px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.6);
}

.status-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: bold;
    color: #e9c46a;
}

.gold-display {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.95rem;
    font-weight: bold;
    color: #ffd166;
    margin-top: 2px;
}

.bar-wrap {
    width: 100%;
    height: 12px;
    background: #0b0908;
    border-radius: 3px;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(255,255,255,0.08);
}

.bar-fill {
    height: 100%;
    width: 100%;
    transition: width 0.15s ease;
}

.hp-fill {
    background: linear-gradient(90deg, #9d0208, #d00000);
    box-shadow: 0 0 10px rgba(208, 0, 0, 0.5);
}

.shield-fill {
    background: linear-gradient(90deg, #3a86ff, #64dfdf);
}

.charge-wrap {
    height: 6px;
    background: #111827;
    border-radius: 3px;
    margin-top: 3px;
    overflow: hidden;
}

.charge-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #0ea5e9, #38bdf8, #ffd166);
    box-shadow: 0 0 8px rgba(56, 189, 248, 0.6);
    transition: width 0.05s linear;
}

.hud-fs-btn {
    margin-top: 6px;
    background: #1e1b18;
    border: 1px solid #78593a;
    color: #e9c46a;
    font-size: 0.72rem;
    font-family: inherit;
    padding: 3px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    pointer-events: auto;
}

.hud-fs-btn:hover {
    background: #3e2e1e;
    border-color: #ffd166;
    color: #ffffff;
    box-shadow: 0 0 10px rgba(255, 209, 102, 0.4);
}

.biome-tracker {
    background: rgba(20, 17, 15, 0.88);
    border: 2px solid #574131;
    border-radius: 6px;
    padding: 8px 18px;
    text-align: center;
    box-shadow: 0 0 15px rgba(0,0,0,0.5);
}

.biome-title {
    font-size: 1.05rem;
    font-weight: 900;
    color: #e9c46a;
    letter-spacing: 1px;
}

.biome-sub {
    font-size: 0.75rem;
    color: #a8a29e;
}

/* Minimapa Cozy no Canto Superior Direito */
.minimap-container {
    width: 120px;
    height: 120px;
    background: rgba(10, 8, 6, 0.9);
    border: 2px solid #574131;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.6);
}

#miniMapCanvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* Barra de Habilidades Inferior */
.bottom-bar {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 12px;
    background: rgba(20, 17, 15, 0.92);
    padding: 8px 16px;
    border-radius: 8px;
    border: 2px solid #574131;
    align-items: center;
}

.skill-slot {
    width: 54px;
    height: 54px;
    background: #14110f;
    border: 2px solid #574131;
    border-radius: 6px;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-size: 1.4rem;
    overflow: hidden;
}

.skill-slot .key-badge {
    position: absolute;
    top: 2px;
    right: 3px;
    font-size: 0.65rem;
    font-weight: bold;
    color: #e9c46a;
    background: rgba(0,0,0,0.7);
    padding: 1px 4px;
    border-radius: 3px;
    display: flex;
    align-items: center;
    gap: 3px;
}

.skill-cooldown-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 0%;
    background: rgba(0, 0, 0, 0.75);
    transition: height 0.05s linear;
}

.skill-slot.ready {
    border-color: #e9c46a;
    box-shadow: 0 0 8px rgba(233, 196, 106, 0.3);
}

.hud-btn-hint {
    color: #d1d5db;
    font-size: 0.75rem;
    background: #2b1d14;
    border: 1px solid #574131;
    padding: 4px 8px;
    border-radius: 4px;
    margin-left: 5px;
}

/* Prompt de Interação no Centro da Tela */
#interact-prompt {
    position: absolute;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(20, 17, 15, 0.92);
    border: 2px solid #e9c46a;
    color: #fefae0;
    font-weight: bold;
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 0.9rem;
    box-shadow: 0 0 20px rgba(233, 196, 106, 0.4);
    pointer-events: none;
    transition: opacity 0.2s ease;
}

#interact-prompt.hidden {
    opacity: 0;
    display: none;
}

/* MODAL DE INVENTÁRIO (TECLA I ou TAB) */
#inventory-modal {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 650px;
    background: #14110f;
    border: 3px solid #8c6d48;
    border-radius: 8px;
    padding: 25px;
    box-shadow: 0 0 50px rgba(0,0,0,0.9);
    z-index: 60;
}

.inv-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #3d2f25;
    padding-bottom: 12px;
    margin-bottom: 20px;
}

.inv-header h2 {
    color: #e9c46a;
    font-size: 1.5rem;
    letter-spacing: 2px;
}

.inv-layout {
    display: flex;
    gap: 25px;
}

.equip-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.equip-slot {
    background: #1f1915;
    border: 2px solid #574131;
    border-radius: 6px;
    padding: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.equip-icon {
    font-size: 2rem;
    width: 45px;
    height: 45px;
    background: #0d0a08;
    border-radius: 6px;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1px solid #3d2f25;
}

.equip-info h4 {
    color: #fefae0;
    font-size: 0.95rem;
    margin-bottom: 3px;
}

.equip-info p {
    color: #a8a29e;
    font-size: 0.75rem;
}

.stats-panel {
    flex: 1;
    background: #1a1512;
    border: 2px solid #3d2f25;
    border-radius: 6px;
    padding: 15px;
    font-size: 0.85rem;
    line-height: 2;
}

.stats-panel h3 {
    color: #e9c46a;
    font-size: 1.1rem;
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    padding-bottom: 5px;
}

.stats-panel span.val {
    color: #64dfdf;
    font-weight: bold;
    float: right;
}

/* MODAL DO MERCADOR (FOGUEIRA & ITENS) */
#shop-modal {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 720px;
    background: #14110f;
    border: 3px solid #e9c46a;
    border-radius: 8px;
    padding: 25px;
    box-shadow: 0 0 60px rgba(0,0,0,0.95);
    z-index: 60;
}

.shop-dialogue {
    font-style: italic;
    color: #d6ccc2;
    font-size: 0.9rem;
    background: #1f1915;
    padding: 10px 15px;
    border-left: 3px solid #e9c46a;
    margin-bottom: 20px;
    border-radius: 4px;
}

.shop-items-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.shop-item-card {
    background: #1a1512;
    border: 2px solid #574131;
    border-radius: 6px;
    padding: 12px;
    text-align: center;
    transition: all 0.2s ease;
}

.shop-item-card.selected {
    border-color: #ffd166;
    background: #2b1f16;
    box-shadow: 0 0 15px rgba(255, 209, 102, 0.3);
}

.shop-item-card .icon {
    font-size: 2.2rem;
    margin-bottom: 8px;
}

.shop-item-card h4 {
    font-size: 0.95rem;
    color: #fefae0;
    margin-bottom: 4px;
}

.shop-item-card .desc {
    font-size: 0.75rem;
    color: #a8a29e;
    margin-bottom: 10px;
    height: 32px;
}

.shop-item-card .price {
    font-size: 0.9rem;
    color: #ffd166;
    font-weight: bold;
}

/* Badges de Botões PS2 */
.ps-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #111;
    border: 1.5px solid #555;
    font-weight: 900;
    font-size: 0.7rem;
}

.ps-square { color: #ff66aa; border-color: #ff66aa; }
.ps-triangle { color: #00ff99; border-color: #00ff99; }
.ps-circle { color: #ff4455; border-color: #ff4455; }
.ps-cross { color: #5599ff; border-color: #5599ff; }

/* Controles de Som / Dica */
.controls-hint {
    margin-top: 15px;
    font-size: 0.8rem;
    color: #d1d5db;
    text-align: center;
    background: rgba(0,0,0,0.5);
    padding: 8px 16px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.08);
    line-height: 1.5;
}

/* Telas de Vitória / Derrota */
.game-over-title {
    color: #d00000;
    font-size: 3rem;
    font-weight: 900;
    letter-spacing: 4px;
    text-shadow: 0 0 25px rgba(208, 0, 0, 0.7);
    margin-bottom: 10px;
}

.victory-title {
    color: #ffd166;
    font-size: 3rem;
    font-weight: 900;
    letter-spacing: 4px;
    text-shadow: 0 0 30px rgba(255, 209, 102, 0.7);
    margin-bottom: 10px;
}

.stats-box {
    background: #14110f;
    border: 2px solid #574131;
    border-radius: 6px;
    padding: 15px 30px;
    margin: 15px 0 20px;
    text-align: left;
    min-width: 320px;
    line-height: 1.8;
}

.stats-box div {
    display: flex;
    justify-content: space-between;
}

.stats-box span.val {
    color: #e9c46a;
    font-weight: bold;
}

/* BANNER DO NARRADOR POÉTICO (CHILDREN OF MORTA STYLE) */
#narrator-banner {
    position: absolute;
    top: 65px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(14, 11, 9, 0.92);
    border: 1px solid #c58940;
    border-radius: 20px;
    padding: 8px 24px;
    color: #fefae0;
    font-style: italic;
    font-size: 0.95rem;
    box-shadow: 0 4px 25px rgba(0,0,0,0.8), 0 0 15px rgba(197, 137, 64, 0.3);
    z-index: 25;
    pointer-events: none;
    transition: opacity 0.5s ease, transform 0.5s ease;
    text-shadow: 0 1px 3px #000;
}

#narrator-banner.hidden {
    opacity: 0;
    transform: translate(-50%, -10px);
}

/* BARRA DE HABILIDADE SUPREMA (ULTIMATE) */
.ultimate-wrap {
    width: 100%;
    height: 8px;
    background: #0b0908;
    border-radius: 3px;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(255, 209, 102, 0.3);
    margin-top: 4px;
}

.ultimate-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #d97706, #ffd166, #f59e0b);
    box-shadow: 0 0 10px rgba(255, 209, 102, 0.6);
    transition: width 0.2s ease;
}

.skill-slot.ultimate-ready {
    border-color: #ffd166 !important;
    box-shadow: 0 0 15px rgba(255, 209, 102, 0.7) !important;
    animation: pulseUltimate 1.2s infinite alternate;
}

@keyframes pulseUltimate {
    0% { transform: scale(1); }
    100% { transform: scale(1.08); box-shadow: 0 0 25px rgba(255, 209, 102, 0.9); }
}

.menu-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.btn-secondary {
    background: linear-gradient(135deg, #2b1f16, #423023);
    color: #ffd166;
    font-size: 1rem;
    font-weight: 800;
    padding: 12px 25px;
    border: 2px solid #ffd166;
    border-radius: 6px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 0 15px rgba(0,0,0,0.5);
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    transform: scale(1.04);
    box-shadow: 0 0 25px rgba(255, 209, 102, 0.4);
}


/* ===================== BÊNÇÃOS DA MASMORRA ===================== */
.xp-wrap { height: 6px; }
.xp-fill { background: linear-gradient(90deg, #6d4bd8, #c9a8ff); box-shadow: 0 0 6px rgba(201, 168, 255, 0.6); transition: width 0.2s ease; }

#blessing-bar {
    position: absolute;
    left: 15px;
    bottom: 92px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-width: 330px;
    pointer-events: none;
}
.bless-mini {
    position: relative;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    box-shadow: 0 0 0 2px var(--rc), 0 2px 6px rgba(0,0,0,0.6);
}
.bless-mini canvas { width: 36px; height: 36px; display: block; }
.bless-mini span {
    position: absolute; right: -4px; bottom: -4px;
    background: #20150e; color: #ffd166; border: 1px solid var(--rc);
    font: bold 11px Georgia, serif; border-radius: 8px; padding: 0 4px;
}

#levelup-screen {
    position: absolute; inset: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    background: radial-gradient(ellipse at center, rgba(30, 18, 48, 0.82), rgba(5, 4, 10, 0.93));
    z-index: 60;
    animation: lvlFade 0.25s ease;
}
@keyframes lvlFade { from { opacity: 0; } to { opacity: 1; } }
.lvl-title { font: bold 2rem Georgia, serif; color: #ffd166; letter-spacing: 3px; text-shadow: 0 0 18px rgba(255, 209, 102, 0.55); }
.lvl-sub { color: #d8ccef; margin: 6px 0 22px; font-family: Georgia, serif; }
.lvl-cards { display: flex; gap: 22px; }
.bless-card {
    width: 210px; min-height: 300px;
    padding: 16px 14px 14px;
    display: flex; flex-direction: column; align-items: center; text-align: center;
    background: linear-gradient(180deg, #2c2233, #1a1420);
    border: 2px solid #4a3a52;
    border-radius: 14px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.6);
    transform: translateY(0) scale(0.96);
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    font-family: Georgia, serif;
}
.bless-card.selected {
    border-color: var(--rc);
    transform: translateY(-10px) scale(1.04);
    box-shadow: 0 0 0 2px var(--rc), 0 0 28px var(--rg), 0 14px 30px rgba(0,0,0,0.7);
}
.bless-rarity { font-size: 0.72rem; letter-spacing: 2px; text-transform: uppercase; color: var(--rc); margin-bottom: 8px; }
.bless-icon { width: 112px; height: 112px; margin-bottom: 10px; filter: drop-shadow(0 4px 6px rgba(0,0,0,0.6)); }
.bless-name { font-size: 1.15rem; font-weight: bold; color: #fff3d6; margin-bottom: 8px; }
.bless-desc { font-size: 0.86rem; color: #cfc4dd; line-height: 1.35; flex: 1; }
.bless-stack { margin-top: 10px; color: var(--rc); letter-spacing: 2px; font-size: 0.8rem; }
.lvl-hint { margin-top: 24px; color: #a99fbd; font-size: 0.82rem; font-family: Georgia, serif; }
.lvl-hint b { color: #ffd166; }

/* ===== Portal das Expedições (escolha de fase) ===== */
#expedition-board {
    background: radial-gradient(ellipse at center, rgba(12, 38, 40, 0.88), rgba(4, 6, 10, 0.95));
    padding: 16px;
    overflow-y: auto;
    justify-content: flex-start;
    padding-top: 4vh;
}
.board-title { font: bold 2rem Georgia, serif; color: #7ee8dd; letter-spacing: 4px; text-shadow: 0 0 18px rgba(45, 212, 191, 0.55); text-align: center; }
.board-sub { color: #cfe7e3; font-family: Georgia, serif; margin: 6px 0 18px; text-align: center; font-size: 0.9rem; }
#board-biomes { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; max-width: 100%; }
.board-biome {
    width: 250px; max-width: 100%;
    background: linear-gradient(180deg, rgba(30, 26, 22, 0.95), rgba(16, 14, 12, 0.95));
    border: 2px solid #574131; border-radius: 14px; padding: 12px;
    display: flex; flex-direction: column; gap: 8px;
}
.board-biome.biome-forest { border-color: #3f6b3a; }
.board-biome.biome-dungeon { border-color: #6b4f8a; }
.board-biome.biome-snow { border-color: #4f7ea0; }
.board-biome.locked { opacity: 0.5; filter: grayscale(0.7); }
.board-biome-name { font: bold 1rem Georgia, serif; color: #ffd166; text-align: center; letter-spacing: 1px; margin-bottom: 2px; }
.board-phase {
    border: 2px solid #3b3128; border-radius: 10px; padding: 8px 10px;
    background: rgba(255, 255, 255, 0.03);
    font-family: Georgia, serif;
    transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}
.board-phase.final { background: linear-gradient(180deg, rgba(120, 30, 30, 0.25), rgba(40, 10, 10, 0.2)); border-color: #6b2b2b; }
.board-phase.done { border-color: #3f7a4f; }
.board-phase.locked { opacity: 0.55; }
.board-phase.selected {
    border-color: #7ee8dd; transform: scale(1.04);
    box-shadow: 0 0 0 2px rgba(126, 232, 221, 0.6), 0 0 20px rgba(45, 212, 191, 0.4);
}
.ph-top { display: flex; justify-content: space-between; align-items: center; font-size: 0.72rem; letter-spacing: 2px; text-transform: uppercase; color: #b9a98f; }
.board-phase.final .ph-num { color: #ff8a65; font-weight: bold; }
.ph-check { color: #74c69d; font-size: 1.1rem; font-weight: bold; }
.ph-new { color: #ffd166; font-size: 0.68rem; letter-spacing: 1px; }
.ph-lock { font-size: 0.9rem; }
.ph-name { color: #fff3d6; font-weight: bold; margin: 3px 0 2px; }
.ph-info { color: #cbbfa8; font-size: 0.78rem; line-height: 1.3; }
.board-hint { margin-top: 16px; color: #e9f5f3; font-family: Georgia, serif; text-align: center; min-height: 1.2em; }
.board-keys { margin-top: 8px; color: #8fb3ae; font-family: Georgia, serif; font-size: 0.8rem; text-align: center; }
.board-keys b { color: #7ee8dd; }


/* ===================================================================== HUD NOVO */
.hero-panel {
    display: flex; align-items: center; gap: 12px;
    background: linear-gradient(180deg, rgba(30,24,19,0.92), rgba(18,14,11,0.92));
    border: 2px solid #6b5038; border-radius: 14px; padding: 8px 14px 8px 8px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,220,160,0.08);
}
.hero-portrait { position: relative; width: 74px; height: 74px; flex: none; }
.hero-portrait img { width: 74px; height: 74px; border-radius: 50%; border: 3px solid #e9c46a; box-shadow: 0 0 0 2px #2a1d12, 0 4px 10px rgba(0,0,0,0.6); object-fit: cover; background: #f4ead8; }
#hero-level-badge {
    position: absolute; right: -4px; bottom: -4px; min-width: 28px; height: 28px; padding: 0 5px;
    border-radius: 14px; background: radial-gradient(circle at 35% 30%, #ffe6a3, #d79a2b); color: #2a1a08;
    border: 2px solid #2a1d12; font: bold 15px Georgia, serif; display: flex; align-items: center; justify-content: center;
}
.hero-bars { display: flex; flex-direction: column; gap: 5px; width: 240px; }
.hero-name { display: flex; justify-content: space-between; align-items: center; font-size: 0.85rem; color: #f2dfb6; letter-spacing: 0.5px; }
#hero-points-badge { font: bold 11px Georgia, serif; color: #2a1a08; background: #ffd166; border-radius: 9px; padding: 1px 8px; animation: hudPulse 1.4s ease-in-out infinite; }
@keyframes hudPulse { 50% { box-shadow: 0 0 10px #ffd166; } }
.hbar { position: relative; height: 18px; border-radius: 9px; background: #1b1310; border: 2px solid #3d2b1d; overflow: hidden; }
.hbar.ess { height: 12px; border-radius: 6px; }
.hbar-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; transition: width 0.18s ease-out; }
.hbar.hp .hbar-fill { background: linear-gradient(180deg, #ff6b6b, #c1121f 60%, #8f0d18); }
.hbar-shield { position: absolute; left: 0; top: 0; height: 5px; width: 0; background: linear-gradient(90deg, #b9f6ca, #74c69d); box-shadow: 0 0 6px #74c69d; z-index: 1; }
.hbar.ess .hbar-fill { background: linear-gradient(180deg, #d5b4ff, #8b5cf6); }
.hbar span { position: relative; z-index: 2; display: block; text-align: center; font: bold 11px Georgia, serif; color: #fff; text-shadow: 0 1px 2px #000; line-height: 14px; }
.hbar.ess span { font-size: 9px; line-height: 8px; color: #f3e9ff; }
.hero-row { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font: bold 12px Georgia, serif; color: #f2dfb6; background: rgba(0,0,0,0.35); border: 1px solid #4a3626; border-radius: 10px; padding: 1px 8px; }
.chip small { color: #a99a80; font-weight: normal; }

.bottom-hud { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; }
.slot-bar { display: flex; gap: 10px; padding: 8px 12px; background: rgba(18,14,11,0.82); border: 2px solid #6b5038; border-radius: 14px; box-shadow: 0 6px 18px rgba(0,0,0,0.55); }
.hslot { position: relative; width: 64px; height: 64px; border-radius: 12px; background: radial-gradient(circle at 50% 35%, #3a2a1d, #1b1310); border: 2px solid #8a6a46; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.hslot.basic { border-color: #e9c46a; }
.hslot.empty { opacity: 0.45; border-style: dashed; }
.hslot.ult { border-color: #ffd166; }
.hslot.glow { box-shadow: 0 0 14px #ffd166, inset 0 0 10px rgba(255,209,102,0.6); border-color: #fff1c2; }
.hslot kbd { position: absolute; top: 2px; left: 4px; z-index: 6; font: bold 12px Georgia, serif; color: #ffe6a3; text-shadow: 0 1px 2px #000; }
.hs-ic { font-size: 28px; z-index: 3; filter: drop-shadow(0 2px 2px rgba(0,0,0,0.6)); margin-top: -8px; }
.hslot small { position: absolute; bottom: 2px; left: 0; right: 0; z-index: 6; text-align: center; font: 9px Georgia, serif; color: #e8dcc4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 2px; text-shadow: 0 1px 2px #000; }
.hs-cd { position: absolute; left: 0; right: 0; top: 0; height: 0; background: rgba(5,5,10,0.72); z-index: 5; }
.hs-fill { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: linear-gradient(0deg, rgba(255,209,102,0.55), rgba(255,209,102,0.12)); z-index: 2; }
.hero-xp { position: relative; width: 420px; height: 14px; border-radius: 7px; background: #1b1310; border: 2px solid #3d2b1d; overflow: hidden; }
#hero-xp-bar { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: linear-gradient(180deg, #ffe6a3, #e9a23b); transition: width 0.25s; }
#hero-xp-text { position: relative; z-index: 2; display: block; text-align: center; font: bold 10px Georgia, serif; line-height: 10px; color: #fff4d6; text-shadow: 0 1px 2px #000, 0 0 3px #000; }
.bottom-hud .hud-btn-hint { font-size: 0.72rem; color: #cbbd9f; text-shadow: 0 1px 2px #000; }

/* ===================================================================== ÁRVORE DE HABILIDADES */
#skills-modal, #pets-modal { position: absolute; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; background: rgba(6,6,10,0.72); backdrop-filter: blur(4px); }
.sk-panel, .pt-panel { width: min(1080px, 94vw); max-height: 92vh; overflow: auto; background: linear-gradient(180deg, #1d1712, #120e0b); border: 3px solid #e9c46a; border-radius: 16px; padding: 18px 22px; box-shadow: 0 0 60px rgba(0,0,0,0.9); color: #e8dcc4; }
.sk-head { display: flex; align-items: center; gap: 24px; margin-bottom: 12px; }
.sk-title, .pt-title { font-size: 1.5rem; color: #ffd166; letter-spacing: 1px; }
.sk-level { flex: 1; display: flex; align-items: center; gap: 10px; font-weight: bold; }
.sk-xp { flex: 1; height: 12px; border-radius: 6px; background: #2a1d14; border: 1px solid #5a4330; overflow: hidden; }
#sk-xp-fill { height: 100%; width: 0; background: linear-gradient(90deg, #ffe6a3, #e9a23b); }
#sk-xp-txt { font: 12px Georgia, serif; color: #cbbd9f; }
.sk-points { font-size: 1rem; background: #2a1d14; border: 1px solid #e9c46a; border-radius: 10px; padding: 4px 12px; }
.sk-points b { color: #ffd166; font-size: 1.3rem; }
.sk-body { display: flex; gap: 18px; }
.sk-tree { flex: 1; }
.sk-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.sk-col { background: rgba(0,0,0,0.25); border: 1px solid #3d2b1d; border-top: 3px solid var(--bc); border-radius: 12px; padding: 8px; }
.sk-bname { text-align: center; color: var(--bc); font-size: 1.05rem; margin-bottom: 6px; }
.sk-bname small { display: block; font: italic 11px Georgia, serif; color: #a99a80; }
.sk-row { position: relative; display: flex; justify-content: center; gap: 10px; padding: 14px 0 12px; border-top: 1px dashed rgba(255,255,255,0.06); }
.sk-tier { position: absolute; left: 2px; top: 2px; font: 9px Georgia, serif; color: #7d6c55; }
.sk-node { position: relative; width: 68px; height: 68px; border-radius: 14px; background: radial-gradient(circle at 50% 35%, #3a2a1d, #1b1310); border: 2px solid #4a3626; display: flex; align-items: center; justify-content: center; transition: transform 0.1s; }
.sk-node .sk-ic { font-size: 30px; }
.sk-node .sk-rk { position: absolute; bottom: 2px; right: 6px; font: bold 11px Georgia, serif; color: #e8dcc4; text-shadow: 0 1px 2px #000; }
.sk-node .sk-act { position: absolute; top: 3px; left: 0; right: 0; text-align: center; font: 8px Georgia, serif; color: #ffd166; text-transform: uppercase; letter-spacing: 1px; }
.sk-node.passive { border-radius: 50%; }
.sk-node.locked { filter: grayscale(0.85) brightness(0.55); }
.sk-node.can { border-color: #ffd166; box-shadow: 0 0 10px rgba(255,209,102,0.55); animation: hudPulse 1.6s infinite; }
.sk-node.learned { border-color: #74c69d; }
.sk-node.learned.can { border-color: #ffd166; }
.sk-node.maxed { border-color: #74c69d; box-shadow: 0 0 10px rgba(116,198,157,0.5); }
.sk-node.sel { transform: scale(1.12); outline: 3px solid #fff1c2; outline-offset: 2px; z-index: 2; }
.sk-ult-row { position: relative; display: flex; justify-content: center; margin-top: 12px; padding: 14px 10px 10px; border: 1px solid #3d2b1d; border-top: 3px solid #ffd166; border-radius: 12px; background: rgba(255,209,102,0.05); }
.sk-node.ult { width: 84px; height: 84px; }
.sk-node.ult .sk-ic { font-size: 40px; }
.sk-side { width: 300px; display: flex; flex-direction: column; gap: 8px; }
.sk-detail { background: rgba(0,0,0,0.3); border: 1px solid #4a3626; border-radius: 12px; padding: 12px; min-height: 230px; }
.sk-d-ic { font-size: 40px; text-align: center; }
.sk-d-name { text-align: center; font-size: 1.15rem; color: #ffd166; }
.sk-d-type { text-align: center; font: italic 11px Georgia, serif; color: #a99a80; margin: 2px 0 8px; }
.sk-d-desc { font: 14px Georgia, serif; line-height: 1.35; }
.sk-d-per { font: 12px Georgia, serif; color: #cbbd9f; margin-top: 8px; }
.sk-d-ok { margin-top: 10px; color: #74c69d; text-align: center; }
.sk-d-why { margin-top: 6px; font: italic 12px Georgia, serif; color: #ff9b85; text-align: center; }
.sk-learn, .sk-respec { width: 100%; margin-top: 10px; padding: 8px; border-radius: 10px; border: 2px solid #e9c46a; background: linear-gradient(180deg, #ffd166, #d79a2b); color: #2a1a08; font: bold 14px Georgia, serif; }
.sk-learn:disabled, .sk-respec:disabled { filter: grayscale(1) brightness(0.6); cursor: default; }
.sk-respec { background: #2a1d14; color: #e8dcc4; border-color: #6b5038; font-size: 12px; }
.sk-slots-title { font-size: 0.85rem; color: #ffd166; }
.sk-slots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.sk-slot { position: relative; background: #1b1310; border: 2px solid #8a6a46; border-radius: 10px; padding: 8px 2px 4px; text-align: center; }
.sk-slot.fixed { border-color: #e9c46a; cursor: default; }
.sk-slot.empty { border-style: dashed; opacity: 0.7; }
.sk-slot kbd { position: absolute; top: 1px; left: 4px; font: bold 11px Georgia, serif; color: #ffe6a3; }
.sk-slot span { display: block; font-size: 22px; }
.sk-slot small { display: block; font: 9px Georgia, serif; color: #cbbd9f; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sk-msg { min-height: 18px; font: italic 12px Georgia, serif; color: #ffd166; text-align: center; }
.sk-help, .pt-help { margin-top: 12px; text-align: center; font: 12px Georgia, serif; color: #a99a80; }

/* ===================================================================== CERCADO DOS ESPÍRITOS */
.pt-head { display: flex; justify-content: space-between; align-items: center; }
.pt-gold { font-size: 1.2rem; color: #ffd166; }
.pt-sub { font: italic 13px Georgia, serif; color: #cbbd9f; margin: 4px 0 12px; }
.pt-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.pt-card { background: radial-gradient(circle at 50% 20%, rgba(255,255,255,0.06), rgba(0,0,0,0.3)); border: 2px solid #4a3626; border-top: 4px solid var(--pc); border-radius: 12px; padding: 8px; text-align: center; }
.pt-card canvas { width: 120px; height: 90px; display: block; margin: 0 auto; }
.pt-card h4 { color: var(--pc); font-size: 0.95rem; }
.pt-role { font: bold 10px Georgia, serif; color: #a99a80; text-transform: uppercase; letter-spacing: 1px; }
.pt-card p { font: 12px Georgia, serif; line-height: 1.3; min-height: 64px; margin: 4px 0; color: #e8dcc4; }
.pt-state { font: bold 13px Georgia, serif; color: #ffd166; }
.pt-card.owned .pt-state { color: #b9f6ca; }
.pt-card.active { box-shadow: 0 0 14px rgba(116,198,157,0.6); border-color: #74c69d; }
.pt-card.selected { outline: 3px solid #fff1c2; outline-offset: 2px; transform: translateY(-2px); }
.pt-msg { min-height: 20px; text-align: center; margin-top: 10px; font: italic 13px Georgia, serif; color: #ffd166; }


/* ===================================================================== ABERTURA E ESCOLHA DE PERSONAGEM */
#title-screen, #menu-screen {
    background: radial-gradient(ellipse at 30% 40%, rgba(70,110,60,0.35), rgba(0,0,0,0) 60%),
                radial-gradient(ellipse at 80% 70%, rgba(233,196,106,0.12), rgba(0,0,0,0) 55%),
                linear-gradient(180deg, #0d1410, #06080c);
}
#title-screen { flex-direction: row; gap: 4vw; }
.title-art { height: 78vh; display: flex; align-items: flex-end; filter: drop-shadow(0 18px 30px rgba(0,0,0,0.7)); animation: titleFloat 5s ease-in-out infinite; }
.title-art img { height: 100%; }
@keyframes titleFloat { 50% { transform: translateY(-8px); } }
.title-main { max-width: 560px; display: flex; flex-direction: column; align-items: flex-start; gap: 14px; }
.game-logo { font-size: clamp(2.6rem, 6vw, 4.6rem); letter-spacing: 6px; color: #ffd166; text-shadow: 0 0 24px rgba(255,209,102,0.45), 0 4px 0 #6b4a1f, 0 8px 18px rgba(0,0,0,0.8); }
.game-tagline { font: 1.05rem/1.55 Georgia, serif; color: #e8dcc4; text-shadow: 0 2px 4px #000; }
.menu-list { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; width: 320px; }
.menu-btn { padding: 14px 20px; border-radius: 12px; border: 2px solid #6b5038; background: rgba(30,22,16,0.9); color: #f2dfb6; font: bold 1.2rem Georgia, serif; text-align: left; transition: transform 0.1s; }
.menu-btn small { font: italic 0.8rem Georgia, serif; color: #a99a80; margin-left: 8px; }
.menu-btn.selected { border-color: #ffd166; background: linear-gradient(180deg, #3a2a1a, #241910); box-shadow: 0 0 16px rgba(255,209,102,0.35); transform: translateX(6px); }
.menu-btn.selected::before { content: '▶ '; color: #ffd166; }
.menu-btn.locked { opacity: 0.55; }
.menu-msg { min-height: 22px; font: italic 0.95rem Georgia, serif; color: #ffd166; }
.menu-help { font: 0.85rem Georgia, serif; color: #8f8068; }

.select-title { font-size: 2rem; color: #ffd166; letter-spacing: 2px; margin-bottom: 18px; text-shadow: 0 3px 8px #000; }
#menu-screen .class-grid { display: flex; gap: 22px; align-items: stretch; }
.char-card { width: 260px; padding: 14px; border-radius: 16px; background: linear-gradient(180deg, rgba(40,30,22,0.95), rgba(18,14,11,0.95)); border: 2px solid #4a3626; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.char-card.selected { border-color: #ffd166; box-shadow: 0 0 26px rgba(255,209,102,0.35); transform: translateY(-4px); }
.char-art { position: relative; height: 300px; width: 100%; display: flex; align-items: flex-end; justify-content: center; border-radius: 12px; background: radial-gradient(ellipse at 50% 80%, rgba(116,198,157,0.25), rgba(0,0,0,0) 70%); }
.char-art img { max-height: 100%; max-width: 100%; object-fit: contain; filter: drop-shadow(0 10px 14px rgba(0,0,0,0.6)); }
.char-card.locked .char-art img { filter: brightness(0) opacity(0.55); }
.char-card.locked { opacity: 0.75; }
.char-card .lock { position: absolute; top: 40%; left: 50%; transform: translate(-50%, -50%); font-size: 3rem; filter: drop-shadow(0 3px 6px #000); }
.char-card h3 { color: #ffd166; font-size: 1.3rem; }
.char-card.locked h3 { color: #8f8068; }
.char-card .class-desc { font: 0.9rem/1.4 Georgia, serif; color: #e8dcc4; }
.char-tags { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.char-tags span { font: bold 0.72rem Georgia, serif; color: #2a1a08; background: #e9c46a; border-radius: 8px; padding: 1px 8px; }
#menu-screen .menu-buttons { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 18px; }
#menu-screen .btn-primary { font-size: 1.15rem; padding: 14px 40px; }
.btn-secondary { padding: 8px 18px; border-radius: 10px; border: 1px solid #6b5038; background: rgba(30,22,16,0.9); color: #cbbd9f; font: 0.85rem Georgia, serif; }
.char-card .class-desc { height: auto; margin-bottom: 4px; }
.char-card.locked:hover { transform: none; border-color: #4a3626; box-shadow: none; cursor: default; }


/* ===================================================================== ÁRVORE v2 (caminhos com elemento, linhas) */
.sk-panel { width: min(1120px, 96vw); }
.sk-tree { flex: none; overflow: hidden; }
.sk-canvas { position: relative; margin: 0 auto; }
.sk-branch { position: absolute; top: 0; bottom: 58px; border-radius: 14px; border: 1px solid #3d2b1d;
    border-top: 3px solid var(--bc);
    background: linear-gradient(180deg, color-mix(in srgb, var(--bc) 16%, transparent), rgba(0,0,0,0.25) 40%, rgba(0,0,0,0.35)); }
.sk-bname { margin-top: 6px; text-align: center; color: var(--bc); font-size: 1.1rem; letter-spacing: 1px; text-shadow: 0 2px 6px #000; }
.sk-bicon { margin-right: 6px; filter: drop-shadow(0 0 6px var(--bc)); }
.sk-bname small { display: block; font: italic 11px Georgia, serif; color: #b5a589; letter-spacing: 0; }
.sk-tierline { position: absolute; left: 10px; font: 10px Georgia, serif; color: #8f7a5c; z-index: 1; }
.sk-tierline.ult { color: #ffd166; font-weight: bold; transform: translateY(-50%); }
.sk-lines { position: absolute; left: 0; top: 0; pointer-events: none; z-index: 1; }
.sk-canvas .sk-node { position: absolute; width: 60px; height: 60px; transform: translate(-50%, -50%); z-index: 2;
    background: radial-gradient(circle at 50% 30%, #3e2e20, #160f0b); border: 2px solid #4a3626; }
.sk-canvas .sk-node .sk-ic { font-size: 28px; }
.sk-canvas .sk-node.can { border-color: var(--nc); box-shadow: 0 0 14px var(--nc); }
.sk-canvas .sk-node.learned, .sk-canvas .sk-node.maxed { border-color: var(--nc); background: radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--nc) 45%, #2a1d14), #160f0b); }
.sk-canvas .sk-node.maxed { box-shadow: 0 0 12px var(--nc), inset 0 0 10px color-mix(in srgb, var(--nc) 40%, transparent); }
.sk-canvas .sk-node.learned.can { box-shadow: 0 0 14px var(--nc); }
.sk-canvas .sk-node.sel { transform: translate(-50%, -50%) scale(1.14); outline: 3px solid #fff1c2; outline-offset: 3px; z-index: 3; }
.sk-canvas .sk-node.ult { width: 78px; height: 78px; border-width: 3px; }
.sk-canvas .sk-node.ult .sk-ic { font-size: 38px; }
.sk-canvas .sk-node .sk-act { top: -9px; left: 50%; right: auto; transform: translateX(-50%); background: #2a1d14; border: 1px solid #6b5038; border-radius: 6px; padding: 0 4px; font-size: 8px; }
.sk-canvas .sk-node .sk-rk { bottom: -8px; right: 50%; transform: translateX(50%); background: #120d09; border: 1px solid #6b5038; border-radius: 7px; padding: 0 5px; font-size: 10px; }
.sk-d-ic { width: 64px; height: 64px; margin: 0 auto; display: flex; align-items: center; justify-content: center; border-radius: 16px;
    border: 2px solid var(--nc); background: radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--nc) 40%, #2a1d14), #160f0b); box-shadow: 0 0 16px var(--nc); }
.sk-pips { display: flex; gap: 5px; justify-content: center; margin-top: 10px; }
.sk-pips span { width: 14px; height: 14px; border-radius: 50%; border: 2px solid #6b5038; background: #1b1310; }
.sk-pips span.on { background: var(--nc); border-color: #fff1c2; box-shadow: 0 0 8px var(--nc); }
.hs-fill.fire { background: linear-gradient(0deg, rgba(255,120,40,0.7), rgba(255,209,102,0.15)); }

.sk-side { width: 270px; }
.sk-panel { padding: 16px 18px; }
.sk-side { width: 252px; }
.sk-body { gap: 14px; }
.sk-panel { overflow-x: hidden; }


/* ===================================================================== ATIVA x PASSIVA */
.sk-legend { display: flex; gap: 22px; justify-content: center; flex-wrap: wrap; margin: -4px 0 10px; padding: 6px 10px; border-radius: 10px; background: rgba(0,0,0,0.3); border: 1px solid #3d2b1d; font: 13px Georgia, serif; color: #e8dcc4; }
.sk-legend b { color: #ffd166; }
.sk-legend kbd, .sk-keys kbd { font: bold 11px Georgia, serif; color: #2a1a08; background: #ffd166; border-radius: 4px; padding: 0 5px; }
i.lg { display: inline-block; width: 16px; height: 16px; margin-right: 6px; vertical-align: -3px; border: 2px solid #ffd166; background: #2a1d14; }
i.lg.act { border-radius: 4px; box-shadow: inset 0 0 0 2px #2a1d14, inset 0 0 0 4px rgba(255,209,102,0.6); }
i.lg.pas { border-radius: 50%; border-color: #b9c7a8; }
.sk-canvas .sk-node.active { border-radius: 10px; box-shadow: inset 0 0 0 3px rgba(0,0,0,0.5), inset 0 0 0 5px rgba(255,209,102,0.35); }
.sk-canvas .sk-node.active.can, .sk-canvas .sk-node.active.learned.can { box-shadow: 0 0 14px var(--nc), inset 0 0 0 3px rgba(0,0,0,0.5), inset 0 0 0 5px rgba(255,209,102,0.35); }
.sk-canvas .sk-node.passive { border-radius: 50%; }
.sk-canvas .sk-node .sk-act.pas { color: #cfd8c2; border-color: #55634a; }
.sk-canvas .sk-node .sk-act.act { color: #ffd166; }
.sk-canvas .sk-node .sk-act.warn { color: #ffb4a2; border-color: #a04a3a; background: #3a1712; }
.sk-canvas .sk-node .sk-act.key1 { color: #ffb37a; border-color: #a85a2a; }
.sk-key { position: absolute; top: -10px; right: -10px; width: 24px; height: 24px; border-radius: 6px; background: linear-gradient(180deg, #ffe6a3, #e9a23b); color: #2a1a08; border: 2px solid #2a1d12; font: bold 14px Georgia, serif; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 6px rgba(0,0,0,0.6); z-index: 4; }
.sk-d-kind { margin: 6px auto 0; padding: 5px 8px; border-radius: 8px; font: 12.5px Georgia, serif; text-align: center; background: rgba(0,0,0,0.35); border: 1px solid #4a3626; }
.sk-d-kind b { color: #ffd166; }
.sk-d-kind.pas b { color: #cfe3b8; }
.sk-keys-title { margin-top: 10px; font: bold 12px Georgia, serif; color: #ffd166; text-align: center; }
.sk-keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 4px; }
.sk-keybtn { padding: 5px 2px; border-radius: 10px; border: 2px solid #8a6a46; background: #1b1310; color: #e8dcc4; }
.sk-keybtn b { display: block; font: bold 18px Georgia, serif; color: #ffe6a3; }
.sk-keybtn small { font: 10px Georgia, serif; color: #cbbd9f; }
.sk-keybtn.on { border-color: #ffd166; background: linear-gradient(180deg, #4a3520, #241910); box-shadow: 0 0 10px rgba(255,209,102,0.45); }
.sk-keybtn:hover { border-color: #ffd166; }
.sk-keys-note { margin-top: 10px; font: italic 12px Georgia, serif; color: #cbbd9f; text-align: center; }
.sk-detail { min-height: 300px; }
.sk-canvas .sk-node .sk-act { white-space: nowrap; }
.sk-slots { gap: 4px; }
.sk-slot small { font-size: 8.5px; }

/* relógio do vilarejo */
.world-clock { margin-top: 4px; font: bold 13px Georgia, serif; color: #ffe6a3; text-shadow: 0 1px 2px #000; }

/* ===================================================================== MODO CONSTRUÇÃO */
#build-bar { position: absolute; left: 50%; bottom: 128px; transform: translateX(-50%); width: min(720px, 92vw); background: rgba(18,14,11,0.92);
    border: 2px solid #e9c46a; border-radius: 14px; padding: 10px 14px; box-shadow: 0 8px 22px rgba(0,0,0,0.6); color: #e8dcc4; text-align: center; }
#build-bar .bb-title { font-size: 1rem; color: #ffd166; margin-bottom: 6px; }
#build-bar .bb-cards { display: flex; gap: 10px; justify-content: center; }
#build-bar .bb-card { width: 170px; padding: 6px; border-radius: 10px; border: 2px solid #4a3626; background: rgba(0,0,0,0.3); display: flex; flex-direction: column; align-items: center; gap: 2px; }
#build-bar .bb-card img { height: 64px; object-fit: contain; filter: drop-shadow(0 3px 4px rgba(0,0,0,0.6)); }
#build-bar .bb-card b { color: #ffe6a3; font-size: 0.9rem; }
#build-bar .bb-card small { font: 11px Georgia, serif; color: #cbbd9f; min-height: 28px; }
#build-bar .bb-card span { font: bold 12px Georgia, serif; color: #f2dfb6; }
#build-bar .bb-card.sel { border-color: #ffd166; box-shadow: 0 0 12px rgba(255,209,102,0.5); background: rgba(60,45,25,0.6); }
#build-bar .bb-card.poor span { color: #ff9b85; }
#build-bar .bb-msg { min-height: 18px; margin-top: 6px; font: italic 13px Georgia, serif; color: #ffd166; }
#build-bar .bb-help { font: 11px Georgia, serif; color: #a99a80; }

.hslot.village { border-color: #74c69d; }
.hslot.village kbd { font-size: 11px; }

/* ===================================================================== ALDEÕES: conversa e painel */
#talk-modal, #village-panel { position: absolute; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 150px; pointer-events: none; }
#village-panel { align-items: center; padding-bottom: 0; background: rgba(6,6,10,0.55); }
.tk-panel, .vp-panel { pointer-events: auto; background: linear-gradient(180deg, #1d1712, #120e0b); border: 3px solid #e9c46a; border-radius: 16px; padding: 14px 18px; color: #e8dcc4; box-shadow: 0 10px 30px rgba(0,0,0,0.8); }
.tk-panel { width: min(460px, 92vw); }
.tk-name { color: #ffd166; font-size: 1.2rem; }
.tk-line { font: italic 14px Georgia, serif; margin: 4px 0 10px; color: #f2e6cc; }
.tk-list, .vp-list { display: flex; flex-direction: column; gap: 6px; }
.tk-opt, .vp-row { position: relative; display: grid; grid-template-columns: 32px 110px 1fr auto; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 10px; border: 2px solid #4a3626; background: rgba(0,0,0,0.3); }
.tk-opt span, .vp-row span { font-size: 20px; text-align: center; }
.tk-opt b, .vp-row b { color: #ffe6a3; }
.tk-opt small, .vp-row small { font: 12px Georgia, serif; color: #cbbd9f; }
.tk-opt em { font: bold 10px Georgia, serif; color: #2a1a08; background: #74c69d; border-radius: 8px; padding: 1px 6px; font-style: normal; }
.tk-opt.sel, .vp-row.sel { border-color: #ffd166; box-shadow: 0 0 10px rgba(255,209,102,0.45); background: rgba(60,45,25,0.6); }
.tk-help, .vp-help { margin-top: 10px; text-align: center; font: 11px Georgia, serif; color: #a99a80; }
.vp-panel { width: min(560px, 94vw); }
.vp-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.vp-title { color: #ffd166; font-size: 1.3rem; }
.vp-pop { font: bold 14px Georgia, serif; }
.vp-pop .hungry { color: #ff9b85; }
.vp-count { font: bold 16px Georgia, serif; color: #f2dfb6; }
.vp-count strong { display: inline-block; min-width: 26px; text-align: center; color: #ffd166; }
.vp-row.recruit { border-color: #74c69d; }
.vp-row.recruit.off { opacity: 0.7; }
.vp-row.recruit small { grid-column: 3 / 5; }
.vp-msg { min-height: 18px; margin-top: 8px; text-align: center; font: italic 13px Georgia, serif; color: #ffd166; }
/* o aviso de interação fica acima da barra de atalhos (não por baixo dela) */
#interact-prompt { bottom: 150px; }

#build-bar { width: min(940px, 96vw); }
#build-bar .bb-card { width: 150px; }
#build-bar .bb-count { font: 12px Georgia, serif; color: #cbbd9f; margin-left: 8px; }
#build-bar .bb-arrow { align-self: center; color: #ffd166; font-size: 1.1rem; padding: 0 2px; }
#build-bar .bb-arrow.off { opacity: 0.15; }

.raid-warn { margin-top: 4px; font: bold 13px Georgia, serif; color: #ffb4a2; text-shadow: 0 1px 2px #000; }
.raid-warn.active { color: #ff6b5b; animation: raidPulse 1s ease-in-out infinite; }
@keyframes raidPulse { 50% { opacity: 0.55; } }

#build-bar .bb-card.locked { opacity: 0.55; }
#build-bar .bb-card.locked img { filter: grayscale(1) brightness(0.7); }
.vp-row.center { border-color: #d9b15a; }
.tech-panel .tk-list { max-height: 52vh; overflow-y: auto; }
.tk-opt.tech.done { opacity: 0.6; }
.tk-opt.tech.locked { opacity: 0.45; }

/* barra do dia (vilarejo): noite, amanhecer, dia, entardecer; marcador de agora e do ataque */
.day-bar { margin-top: 17px; width: 230px; margin-left: auto; margin-right: auto; }
.day-bar .db-track { position: relative; height: 12px; border-radius: 7px; border: 2px solid rgba(20,12,6,0.85);
    box-shadow: 0 1px 4px rgba(0,0,0,0.6), inset 0 1px 2px rgba(0,0,0,0.4);
    background: linear-gradient(90deg, #1b2547 0%, #1b2547 20.8%, #e98a4f 25%, #f4d27a 29.2%, #f7e7a8 52%, #f4d27a 75%, #d9643a 79%, #2b2a55 83.3%, #1b2547 100%); }
.day-bar .db-now { position: absolute; top: -5px; width: 4px; height: 18px; margin-left: -2px; border-radius: 2px; background: #fff; box-shadow: 0 0 0 1.5px #2a1a10, 0 0 8px rgba(255,255,255,0.8); }
.day-bar .db-raid { position: absolute; top: -17px; transform: translateX(-50%); font-size: 15px; line-height: 1; filter: drop-shadow(0 1px 2px #000); }
.day-bar .db-raid::after { content: ''; position: absolute; left: 50%; top: 15px; width: 2px; height: 16px; margin-left: -1px; background: #ff5b4b; box-shadow: 0 0 6px #ff5b4b; }
.day-bar .db-raid.soon { animation: raidPulse 1s ease-in-out infinite; }
.day-bar .db-ticks { display: flex; justify-content: space-between; font: 10px Georgia, serif; color: #cbbd9f; text-shadow: 0 1px 2px #000; margin-top: 1px; }
.chip.rare { border-color: rgba(140,220,255,0.6); }

/* janela de construção (B): uma linha por categoria, setas escolhem */
#build-menu { position: absolute; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; pointer-events: none; background: rgba(8,6,4,0.35); }
#build-menu.hidden { display: none; }
#build-menu .bm-panel { pointer-events: auto; width: min(1060px, 96vw); max-height: 92vh; overflow: hidden; background: linear-gradient(180deg, #1d1712, #120e0b);
    border: 3px solid #e9c46a; border-radius: 16px; padding: 12px 16px; color: #e8dcc4; box-shadow: 0 10px 30px rgba(0,0,0,0.8); font-family: Georgia, serif; }
#build-menu .bm-title { font-size: 1.15rem; color: #ffd166; margin-bottom: 8px; }
#build-menu .bm-row { display: flex; align-items: stretch; gap: 8px; margin-bottom: 8px; }
#build-menu .bm-cat { width: 58px; flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 22px;
    border-radius: 10px; background: rgba(255,209,102,0.08); border: 1px solid rgba(233,196,106,0.25); }
#build-menu .bm-cat span { font: bold 11px Georgia, serif; color: #e9c46a; margin-top: 2px; }
#build-menu .bm-cards { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; flex: 1; }
#build-menu .bm-card { padding: 5px 4px; border-radius: 10px; border: 2px solid #4a3626; background: rgba(0,0,0,0.3); display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; min-width: 0; }
#build-menu .bm-card img { height: 52px; max-width: 100%; object-fit: contain; filter: drop-shadow(0 3px 4px rgba(0,0,0,0.6)); }
#build-menu .bm-card b { color: #ffe6a3; font-size: 0.74rem; line-height: 1.1; }
#build-menu .bm-card span { font: bold 10.5px Georgia, serif; color: #f2dfb6; line-height: 1.25; }
#build-menu .bm-card.sel { border-color: #ffd166; box-shadow: 0 0 14px rgba(255,209,102,0.55); background: rgba(70,52,28,0.75); transform: scale(1.04); }
#build-menu .bm-card.locked { opacity: 0.5; }
#build-menu .bm-card.locked img { filter: grayscale(1) brightness(0.7); }
#build-menu .bm-card.poor { opacity: 0.8; }
#build-menu i, #build-bar i { font-style: normal; white-space: nowrap; }
#build-menu i.rare, #build-bar i.rare { color: #aeeaff; }
#build-menu i.miss, #build-bar i.miss { color: #ff8f7a; }
#build-menu .bm-info { display: flex; gap: 14px; align-items: center; margin-top: 4px; padding: 8px 10px; border-radius: 12px; background: rgba(255,255,255,0.04); border: 1px solid rgba(233,196,106,0.3); }
#build-menu .bm-info img { height: 84px; width: 110px; object-fit: contain; filter: drop-shadow(0 3px 5px rgba(0,0,0,0.6)); }
#build-menu .bm-info b { color: #ffd166; font-size: 1.05rem; }
#build-menu .bm-info small { color: #a99a80; }
#build-menu .bm-info p { margin: 2px 0 4px; font-size: 0.85rem; color: #e8dcc4; }
#build-menu .bm-cost { font: bold 13px Georgia, serif; }
#build-menu .bm-status { margin-top: 3px; font: italic 13px Georgia, serif; }
#build-menu .bm-status.ok { color: #b7e4a0; }
#build-menu .bm-status.bad { color: #ffb4a2; }
#build-menu .bm-help { margin-top: 8px; font-size: 11.5px; color: #a99a80; text-align: center; }
/* colocando o prédio: barra pequena embaixo */
#build-bar { width: min(620px, 94vw); }
#build-bar .bb-one { display: flex; align-items: center; gap: 12px; text-align: left; }
#build-bar .bb-one img { height: 54px; width: 70px; object-fit: contain; filter: drop-shadow(0 3px 4px rgba(0,0,0,0.6)); }
#build-bar .bb-one b { color: #ffd166; }
#build-bar .bb-cost { font: bold 12px Georgia, serif; margin-left: 6px; }

/* próximo objetivo (vilarejo) e aviso de estoque cheio no painel dos aldeões */
.goal-line { margin-top: 5px; max-width: 300px; margin-left: auto; margin-right: auto; font: italic 12px Georgia, serif; color: #f2dfb6; text-shadow: 0 1px 2px #000; line-height: 1.3; }
.vp-full { color: #ffb4a2; font-style: normal; }

/* painel dos aldeões: treino */
#village-panel .vp-list { max-height: 52vh; overflow-y: auto; }
.vp-sec { margin: 8px 0 3px; font: bold 12px Georgia, serif; color: #e9c46a; border-top: 1px solid rgba(233,196,106,0.3); padding-top: 6px; }
.vp-lv { display: inline-block; min-width: 16px; height: 16px; line-height: 16px; border-radius: 8px; text-align: center; font: bold 10px Georgia, serif; font-style: normal; color: #2a1a10; border: 1px solid #2a1a10; margin-left: 4px; }
.vp-gold { margin-top: 4px; font: bold 12px Georgia, serif; color: #ffd166; text-align: right; }

/* coluna da esquerda: painel da heroína e, embaixo, o relógio do vilarejo (compacto) */
.left-stack { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.village-clock { align-self: flex-start; width: 250px; padding: 6px 10px 6px; border-radius: 10px; background: rgba(18,14,11,0.82);
    border: 1.5px solid #574131; box-shadow: 0 4px 12px rgba(0,0,0,0.45); text-align: left; }
.village-clock.hidden { display: none; }
.village-clock .world-clock { margin: 0; font-size: 12px; }
.village-clock .day-bar { margin: 13px 0 0; width: 100%; }
.village-clock .day-bar .db-track { height: 8px; border-width: 1.5px; }
.village-clock .day-bar .db-now { top: -4px; height: 13px; width: 3px; margin-left: -1.5px; }
.village-clock .day-bar .db-raid { top: -14px; font-size: 11px; }
.village-clock .day-bar .db-raid::after { top: 11px; height: 11px; }
.village-clock .day-bar .db-ticks { font-size: 8.5px; margin-top: 0; }
.village-clock .raid-warn { margin-top: 2px; font-size: 11px; }
.village-clock .goal-line { margin: 3px 0 0; max-width: none; font-size: 11px; }
/* barra do vilarejo: tecla antiga pequena e aviso de aldeões à toa */
.hslot .hs-alt { position: absolute; top: 2px; right: 4px; font: bold 8.5px Georgia, serif; font-style: normal; color: #a99a80; opacity: 0.85; }
.hslot { position: relative; }
.hslot .hs-badge { position: absolute; top: -9px; left: 50%; transform: translateX(-50%); white-space: nowrap; font: bold 10px Georgia, serif;
    color: #2a1a10; background: #cfe8ff; border: 1.5px solid #2a1a10; border-radius: 8px; padding: 0 5px; }
.hslot .hs-badge.hidden { display: none; }
.hslot.warn { box-shadow: 0 0 0 2px #cfe8ff, 0 0 12px rgba(160,210,255,0.6); animation: hudPulse 1.6s ease-in-out infinite; }

.hslot.village { overflow: visible; }

/* construção: cartão de ferramenta (emoji no lugar da arte) */
.bm-emoji { height: 52px; display: flex; align-items: center; justify-content: center; font-size: 36px; filter: drop-shadow(0 3px 4px rgba(0,0,0,0.6)); }
.bm-emoji.big { height: 84px; width: 110px; font-size: 56px; }
#build-bar .bm-emoji { height: 54px; width: 70px; font-size: 38px; }

/* Continuar: lista dos jogos salvos */
#saves-screen { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; }
#saves-screen.hidden { display: none; }
.saves-list { display: flex; flex-direction: column; gap: 10px; width: min(640px, 92vw); max-height: 62vh; overflow-y: auto; }
.save-card { display: flex; gap: 14px; align-items: center; padding: 10px 14px; border-radius: 14px; border: 2px solid #4a3626; background: rgba(18,14,11,0.85); color: #e8dcc4; font-family: Georgia, serif; }
.save-card img { width: 64px; height: 64px; border-radius: 50%; border: 3px solid #e9c46a; object-fit: cover; background: #f4ead8; }
.save-card b { display: block; color: #ffd166; font-size: 1.05rem; }
.save-card small { display: block; color: #cbbd9f; font-size: 0.82rem; margin-top: 2px; }
.save-card em { display: block; color: #a99a80; font-size: 0.75rem; margin-top: 2px; }
.save-card.sel { border-color: #ffd166; box-shadow: 0 0 14px rgba(255,209,102,0.45); background: rgba(60,45,25,0.9); }
.save-card.del { border-color: #ff6b5b; box-shadow: 0 0 14px rgba(255,107,91,0.55); }

/* conversa com aldeão: quem ele é, o que melhora e o treino */
.tk-who { font: 12px Georgia, serif; color: #cbbd9f; margin-left: 6px; }
.tk-now { font: 12px Georgia, serif; color: #b7e4a0; margin: 2px 0 4px; }
.tk-opt.train b { color: #ffd166; }
.tk-opt.off { opacity: 0.55; }
.tk-msg { min-height: 16px; font: italic 12px Georgia, serif; color: #ffd166; margin-top: 4px; }

/* painel do Centro: lista do que falta para a próxima era */
.cc-list { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 14px; margin: 4px 0 8px; font: 12px Georgia, serif; }
.cc-item { color: #ffb4a2; }
.cc-item.ok { color: #b7e4a0; }
.center-panel { width: min(560px, 94vw); }

/* ---------- tela dos aldeões (3): trabalhos à esquerda, aldeões à direita ---------- */
.vp-panel { width: min(880px, 96vw); }
.vp-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 720px) { .vp-cols { grid-template-columns: 1fr; } }
.vp-col .vp-sec { margin: 0 0 6px; border-top: 0; padding-top: 0; font-size: 13px; }
.vp-jobs, .vp-crewlist { display: flex; flex-direction: column; gap: 5px; }
.vp-crewlist { max-height: 52vh; overflow-y: auto; padding-right: 4px; }
.vp-job, .vp-crew { display: grid; grid-template-columns: 30px 1fr auto; grid-template-rows: auto auto; column-gap: 8px; align-items: center;
    padding: 5px 10px; border-radius: 10px; border: 2px solid #4a3626; background: rgba(0,0,0,0.3); }
.vp-job > span, .vp-crew > span.vc-ic { grid-row: 1 / 3; font-size: 20px; text-align: center; }
.vp-job b, .vp-crew b { color: #ffe6a3; font-size: 14px; }
.vp-job small, .vp-crew small { grid-column: 2; font: 12px Georgia, serif; color: #cbbd9f; }
.vp-job .vp-count { grid-column: 3; grid-row: 1 / 3; font: bold 16px Georgia, serif; color: #f2dfb6; }
.vp-job .vp-count i { font-style: normal; opacity: 0.5; }
.vp-job.sel .vp-count i { opacity: 1; color: #ffd166; }
.vp-crew .vc-arrows { grid-column: 3; grid-row: 1 / 3; font: bold 13px Georgia, serif; color: #ffd166; }
.vp-job.sel, .vp-crew.sel { border-color: #ffd166; box-shadow: 0 0 10px rgba(255,209,102,0.45); background: rgba(60,45,25,0.6); }
.vp-job.warn { border-color: #e07a5f; }
.vp-job.warn strong { color: #ff9b85; }
.vp-crew.idle small { color: #ffb4a2; }
.vp-full { color: #ffb4a2; font: italic 12px Georgia, serif; }
.vp-empty { padding: 14px; text-align: center; font: italic 13px Georgia, serif; color: #a99a80; border: 2px dashed #4a3626; border-radius: 10px; }
/* ---------- resumo dos aldeões no HUD (debaixo do relógio) ---------- */
.village-crew { margin-top: 5px; padding-top: 4px; border-top: 1px solid rgba(233,196,106,0.25); font: 12px Georgia, serif; color: #e8dcc4;
    display: flex; flex-wrap: wrap; gap: 3px 8px; align-items: center; }
.village-crew:empty { display: none; }
.village-crew .vc-pop b, .village-crew .vc-job b { color: #ffd166; margin-left: 2px; }
.village-crew .vc-idle { flex-basis: 100%; color: #ffb4a2; }
.village-crew .vc-idle kbd { font: bold 10px Georgia, serif; padding: 0 4px; border: 1px solid #a07a50; border-radius: 4px; color: #ffe6a3; }
.village-crew .vc-none { color: #cbbd9f; font-style: italic; }

/* ---------- janela Construir: categorias numa coluna e só a categoria escolhida (cabe em telas baixas) ---------- */
#build-menu .bm-panel { width: min(900px, 96vw); max-height: 96vh; overflow-y: auto; }
#build-menu .bm-body { display: grid; grid-template-columns: 150px 1fr; gap: 10px; align-items: start; }
#build-menu .bm-cats { display: flex; flex-direction: column; gap: 4px; }
#build-menu .bm-catrow { display: grid; grid-template-columns: 26px 1fr auto; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 9px;
    border: 1px solid rgba(233,196,106,0.2); background: rgba(255,209,102,0.05); }
#build-menu .bm-catrow span { font-size: 18px; text-align: center; }
#build-menu .bm-catrow b { font: bold 12.5px Georgia, serif; color: #e9c46a; }
#build-menu .bm-catrow small { font: 11px Georgia, serif; color: #a99a80; }
#build-menu .bm-catrow.sel { border-color: #ffd166; background: rgba(70,52,28,0.75); box-shadow: 0 0 10px rgba(255,209,102,0.35); }
#build-menu .bm-catrow.sel b { color: #ffe6a3; }
#build-menu .bm-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
@media (max-height: 640px) { #build-menu .bm-card img { height: 40px; } #build-menu .bm-info img { height: 60px; width: 80px; } #build-menu .bm-info p { font-size: 0.78rem; } }
@media (max-width: 720px) { #build-menu .bm-body { grid-template-columns: 1fr; } #build-menu .bm-cats { flex-direction: row; flex-wrap: wrap; } #build-menu .bm-grid { grid-template-columns: repeat(3, 1fr); } }
/* ---------- conversas e listas: nunca passam da altura da tela (rolam por dentro) ---------- */
#talk-modal { padding: 12px 0 min(150px, 16vh); }
.tk-panel { max-height: calc(100vh - 24px - min(150px, 16vh)); overflow-y: auto; }
#village-panel .vp-panel { max-height: 94vh; overflow-y: auto; }

.village-crew .vc-req { flex-basis: 100%; color: #ffe6a3; }
.village-crew .vc-req.done { color: #b7e4a0; }
/* mercador: agora com recursos da vila também (8 itens), cabe em telas baixas */
#shop-modal { width: min(780px, 94vw); max-height: 94vh; overflow-y: auto; padding: 16px 20px; }
#shop-modal .shop-dialogue { margin-bottom: 12px; }
#shop-modal .shop-items-grid { grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 10px; }
#shop-modal .shop-item-card { padding: 8px; }
#shop-modal .shop-item-card .icon { font-size: 1.7rem; }
@media (max-width: 720px) { #shop-modal .shop-items-grid { grid-template-columns: repeat(2, 1fr); } }

/* ---------- painel do ataque (topo da tela) ---------- */
#raid-bar { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 30; width: min(520px, 60vw); padding: 7px 12px 8px;
    border-radius: 12px; background: rgba(28,10,10,0.88); border: 2px solid #c1121f; box-shadow: 0 0 18px rgba(193,18,31,0.45); color: #ffe6d6;
    font: 12px Georgia, serif; pointer-events: none; }
#raid-bar.hidden { display: none; }
#raid-bar .rb-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; flex-wrap: wrap; }
#raid-bar .rb-top b { color: #ffb4a2; font-size: 14px; }
#raid-bar .rb-top span { color: #e8c8b8; font-size: 11.5px; }
#raid-bar .rb-bar { height: 8px; margin: 5px 0 4px; border-radius: 4px; background: #3a0d12; overflow: hidden; border: 1px solid rgba(255,180,160,0.35); }
#raid-bar .rb-bar i { display: block; height: 100%; background: linear-gradient(90deg, #ffd166, #8bc34a); transition: width 0.4s; }
#raid-bar .rb-info { display: flex; gap: 12px; flex-wrap: wrap; justify-content: space-between; }
#raid-bar .rb-info b { color: #fff; }
#raid-bar .rb-bad { color: #ff8a7a; }

@media (max-width: 1100px) { #raid-bar { top: 150px; right: 12px; left: auto; transform: none; width: min(320px, 46vw); } #raid-bar .rb-top { flex-direction: column; gap: 0; } }

/* Santuário das Bênçãos */
.shrine-panel { width: min(560px, 94vw); }
.shrine-list { max-height: 56vh; overflow-y: auto; }
.shrine-list .tk-opt { grid-template-columns: 22px 1fr; }
.shrine-list .tk-opt small { grid-column: 1 / 3; }
.shrine-list .tk-opt.off { opacity: 0.85; }

/* ---------- tela de carregamento ---------- */
#loading-screen { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center;
    background: radial-gradient(ellipse at center, #1b2416 0%, #0a0d08 70%); color: #e8dcc4; font-family: Georgia, serif; }
#loading-screen.hidden { display: none; }
#loading-screen .ld-box { width: min(460px, 86vw); text-align: center; }
#loading-screen .ld-title { font-size: 2.2rem; letter-spacing: 4px; color: #ffd166; text-shadow: 0 3px 0 #5a3a14, 0 0 18px rgba(255,209,102,0.35); margin-bottom: 18px; }
#loading-screen .ld-msg { font-size: 1rem; margin-bottom: 10px; }
#loading-screen .ld-bar { height: 10px; border-radius: 6px; background: rgba(255,255,255,0.08); border: 1px solid rgba(233,196,106,0.45); overflow: hidden; }
#loading-screen .ld-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #e9c46a, #f4a261); transition: width 0.2s; }
#loading-screen .ld-bar.busy i { width: 35%; animation: ldbusy 1.1s ease-in-out infinite; }
@keyframes ldbusy { 0% { transform: translateX(-110%); } 100% { transform: translateX(320%); } }
#loading-screen .ld-tip { margin-top: 16px; font-size: 0.85rem; font-style: italic; color: #b9ab8f; }

/* ---------- tela 3 dos aldeões (gestão) ---------- */
#village-panel .vp-panel.v3 { width: min(880px, 96vw); max-height: 94vh; display: flex; flex-direction: column; overflow: hidden; }
.v3-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.v3-pop { font: 13px Georgia, serif; color: #e8dcc4; }
.v3-pop .hungry { color: #ff8a7a; font-weight: bold; }
.v3-chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 6px; }
.v3-chip { font: bold 13px Georgia, serif; padding: 3px 9px; border-radius: 12px; background: rgba(233,196,106,0.12); border: 1px solid rgba(233,196,106,0.4); }
.v3-chip.zero { opacity: 0.4; }
.v3-chip.warn { background: rgba(255,159,67,0.18); border-color: #ff9f43; color: #ffc48a; }
.v3-req { font: italic 12px Georgia, serif; color: #ffe6a3; margin-bottom: 6px; }
.v3-cols { display: grid; grid-template-columns: minmax(230px, 0.9fr) 1.3fr; gap: 12px; min-height: 0; flex: 1; }
.v3-list { display: flex; flex-direction: column; gap: 5px; overflow-y: auto; max-height: 60vh; padding-right: 4px; }
.v3-row { display: grid; grid-template-columns: 42px 1fr auto; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 10px; border: 2px solid #4a3626; background: rgba(0,0,0,0.3); }
.v3-row b { font: bold 14px Georgia, serif; color: #f2dfb6; }
.v3-row small { display: block; font: 12px Georgia, serif; color: #c9b896; }
.v3-row.sel { border-color: #ffd166; background: rgba(255,209,102,0.14); box-shadow: 0 0 0 2px rgba(255,209,102,0.25); }
.v3-row.sel.dim { box-shadow: none; background: rgba(255,209,102,0.07); }
.v3-row.idle small { color: #9fc4e8; }
.v3-row.warn { border-color: #a05a20; }
.v3-row.warn small { color: #ffb070; }
.v3-row.recruit b { color: #b7e4a0; }
.v3-row.off { opacity: 0.6; }
.v3-arrows { color: #ffd166; font-size: 11px; }
.v3-prof { font-size: 12px; }
.v3-face { width: 40px; height: 40px; border-radius: 50%; overflow: hidden; background: radial-gradient(circle at 50% 40%, #6b8a52, #2c3d1d); border: 2px solid #2a1a10; display: flex; align-items: flex-end; justify-content: center; }
.v3-face img { width: 118%; margin-bottom: -6%; }
.v3-face.plus { background: rgba(183,228,160,0.15); border-color: #6b8a52; align-items: center; font-size: 18px; }
.v3-face.big { width: 72px; height: 72px; flex: 0 0 auto; }
.v3-detail { min-height: 0; overflow-y: auto; }
.v3-card { background: rgba(0,0,0,0.28); border: 2px solid #4a3626; border-radius: 12px; padding: 12px 14px; }
.v3-top { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; }
.v3-name { font: bold 20px Georgia, serif; color: #ffd166; }
.v3-title { font: 13px Georgia, serif; color: #e8dcc4; margin-top: 2px; }
.v3-big.plus { font-size: 34px; text-align: center; }
.v3-line { font: 13px Georgia, serif; margin: 4px 0; }
.v3-line.small { font-size: 12px; color: #c9b896; }
.v3-block { margin: 6px 0; padding: 6px 9px; border-radius: 8px; background: rgba(255,159,67,0.14); border: 1px solid #a05a20; color: #ffc48a; font: 13px Georgia, serif; }
.v3-block.soft { background: rgba(159,196,232,0.12); border-color: #4f6f8f; color: #cfe3f5; }
.v3-ok { margin-top: 8px; color: #b7e4a0; font: bold 13px Georgia, serif; }
.v3-stats { display: flex; gap: 12px; flex-wrap: wrap; font: 12px Georgia, serif; color: #d8c8a4; margin: 6px 0; }
.v3-sec { margin: 10px 0 5px; font: bold 12px Georgia, serif; color: #e9c46a; border-top: 1px solid rgba(233,196,106,0.3); padding-top: 6px; }
.v3-acts { display: flex; flex-direction: column; gap: 5px; }
.v3-act { display: grid; grid-template-columns: 26px 118px 1fr; align-items: center; gap: 6px; padding: 6px 9px; border-radius: 9px; border: 2px solid #4a3626; background: rgba(0,0,0,0.25); font: 13px Georgia, serif; }
.v3-act b { color: #f2dfb6; }
.v3-act small { color: #c9b896; font-size: 12px; }
.v3-act.job small { color: #ffe6a3; font-weight: bold; font-size: 13px; }
.v3-act.sel { border-color: #ffd166; background: rgba(255,209,102,0.14); }
.v3-act.off { opacity: 0.55; }
.tk-now.tk-warn { color: #ffc48a; }
@media (max-width: 720px) { .v3-cols { grid-template-columns: 1fr; } .v3-list { max-height: 30vh; } }

/* ---------- resumo do fim do ataque ---------- */
#raid-summary { position: absolute; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center; pointer-events: none; }
#raid-summary.hidden { display: none; }
#raid-summary .rs-box { pointer-events: auto; width: min(460px, 92vw); background: linear-gradient(180deg, #1d1712, #120e0b); border: 3px solid #e9c46a; border-radius: 16px; padding: 16px 20px; color: #e8dcc4; box-shadow: 0 10px 30px rgba(0,0,0,0.8); font-family: Georgia, serif; }
#raid-summary .rs-box.lose { border-color: #b23a3a; }
#raid-summary .rs-title { font-size: 1.35rem; color: #ffd166; margin-bottom: 2px; }
#raid-summary .rs-box.lose .rs-title { color: #ff8a7a; }
#raid-summary .rs-sub { font-size: 12px; color: #b9ab8f; margin-bottom: 10px; }
#raid-summary .rs-row { display: grid; grid-template-columns: 26px 1fr; gap: 6px; padding: 5px 0; border-top: 1px solid rgba(233,196,106,0.18); font-size: 14px; }
#raid-summary .rs-row.good span:last-child { color: #b7e4a0; }
#raid-summary .rs-row.bad span:last-child { color: #ffb4a2; }
#raid-summary .rs-help { margin-top: 10px; font-size: 12px; color: #b9ab8f; text-align: center; }

/* mapa grande aberto (tecla M): o HUD sai da frente */
body.map-open #game-hud, body.map-open #interact-prompt, body.map-open #narrator-banner { visibility: hidden; }

/* ---------- menu de pausa e tela de controles ---------- */
#pause-menu, #controls-screen { position: absolute; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; background: rgba(6,6,10,0.72); font-family: Georgia, serif; color: #e8dcc4; }
#controls-screen { z-index: 90; }
#pause-menu.hidden, #controls-screen.hidden { display: none; }
.pm-box, .cs-box { width: min(520px, 92vw); background: linear-gradient(180deg, #1d1712, #120e0b); border: 3px solid #e9c46a; border-radius: 16px; padding: 16px 20px; box-shadow: 0 10px 30px rgba(0,0,0,0.8); }
.cs-box { width: min(820px, 94vw); max-height: 92vh; overflow-y: auto; }
.pm-title, .cs-title { font-size: 1.5rem; color: #ffd166; margin-bottom: 4px; }
.pm-sub { font-size: 12px; color: #b9ab8f; margin-bottom: 10px; }
.pm-row { display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: 8px; padding: 8px 10px; margin: 4px 0; border-radius: 10px; border: 2px solid #4a3626; background: rgba(0,0,0,0.3); }
.pm-row.sel { border-color: #ffd166; background: rgba(255,209,102,0.14); }
.pm-name { font-weight: bold; }
.pm-x { font-size: 13px; color: #d8c8a4; display: flex; align-items: center; gap: 6px; }
.pm-x em { color: #ffb4a2; font-style: normal; }
.pm-bar { display: inline-block; width: 110px; height: 8px; border-radius: 4px; background: rgba(255,255,255,0.1); overflow: hidden; }
.pm-bar i { display: block; height: 100%; background: linear-gradient(90deg, #e9c46a, #f4a261); }
.pm-help, .cs-help { margin-top: 10px; font-size: 12px; color: #b9ab8f; text-align: center; }
.cs-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.cs-sec { color: #e9c46a; font-weight: bold; margin: 10px 0 4px; border-top: 1px solid rgba(233,196,106,0.3); padding-top: 6px; }
.cs-row { display: grid; grid-template-columns: 150px 1fr; gap: 8px; font-size: 13px; padding: 3px 0; }
.cs-k { color: #ffe6a3; font-weight: bold; }
.cs-tip { margin-top: 8px; font-size: 12px; color: #b9ab8f; font-style: italic; }
@media (max-width: 720px) { .cs-cols { grid-template-columns: 1fr; } }

/* árvore de habilidades: tela pequena */
/* o painel fica no tamanho natural e o skills.js (fit) aplica um scale() para caber inteiro na tela, sem rolagem */
#skills-modal { overflow: hidden; }
#skills-modal .sk-panel { width: max-content; max-width: none; max-height: none; overflow: visible; flex: none; transform-origin: 50% 50%; padding: 14px 18px 12px; }
#skills-modal .sk-head { margin-bottom: 10px; }
#skills-modal .sk-body { align-items: stretch; }
#skills-modal .sk-side { width: 250px; gap: 6px; }
#skills-modal .sk-detail { min-height: 0; flex: 1 1 auto; padding: 9px 12px; overflow: hidden; }
#skills-modal .sk-d-ic { width: 52px; height: 52px; font-size: 32px; border-radius: 14px; }
#skills-modal .sk-d-desc { font-size: 13.5px; line-height: 1.3; }
#skills-modal .sk-d-type { margin: 2px 0 6px; }
#skills-modal .sk-pips { margin-top: 8px; }
#skills-modal .sk-learn { margin-top: 8px; padding: 6px; }
#skills-modal .sk-keys-note { margin-top: 8px; }
#skills-modal .sk-slot.on { border-color: #ffd166; box-shadow: 0 0 10px rgba(255,209,102,0.5); }
#skills-modal .sk-msg { min-height: 16px; }
#skills-modal .sk-respec { margin-top: 0; padding: 6px; }
#skills-modal .sk-respec.armed { border-color: #ff9b85; color: #ffd6cc; background: #4a1f16; box-shadow: 0 0 10px rgba(255,120,90,0.5); }
#skills-modal .sk-help { margin-top: 8px; }
/* rótulos de nível na faixa da esquerda (não cobrem os selos ATIVA/PASSIVA da primeira coluna) */
#skills-modal .sk-tierline { left: 0; text-align: center; transform: translateY(-50%); line-height: 1.1; font-size: 9px; color: #7d6c55; }
#skills-modal .sk-tierline b { display: block; font: bold 15px Georgia, serif; color: #8f7a5c; }
#skills-modal .sk-tierline.on b { color: #e9c46a; }
#skills-modal .sk-tierline.ult { width: auto; text-align: left; font-size: 10px; color: #ffd166; }
#skills-modal .sk-key.wide { width: auto; min-width: 24px; padding: 0 3px; font-size: 12px; }
#skills-modal .sk-key.glyph { font: bold 17px "Segoe UI Symbol", "Noto Sans Symbols 2", sans-serif; }
#skills-modal .sk-slot kbd, #skills-modal .sk-legend kbd { font-family: Georgia, "Segoe UI Symbol", serif; }
#skills-modal .sk-d-top { display: flex; align-items: center; gap: 10px; }
#skills-modal .sk-d-top .sk-d-ic { flex: none; margin: 0; width: 48px; height: 48px; font-size: 28px; }
#skills-modal .sk-d-top .sk-d-name { text-align: left; line-height: 1.15; }
#skills-modal .sk-d-top .sk-d-type { text-align: left; margin: 2px 0 0; }
#skills-modal .sk-d-kind { margin: 8px 0 8px; }
#skills-modal .sk-msg { min-height: 0; height: 18px; line-height: 18px; margin-top: 6px; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#skills-modal .sk-help { margin-top: 2px; }

/* polimento: teclado x controle, balão do narrador e HUD da masmorra */
body:not(.pad-mode) .pad-only { display: none; }
body.pad-mode .kb-only { display: none; }
#narrator-banner { top: auto; bottom: 205px; max-width: min(560px, 86vw); text-align: center; }
body.in-dungeon .res-row .chip.vres { display: none; }
body.in-dungeon .res-row:not(:has(.chip:not(.hidden):not(.vres))) { display: none; }
.vc-nohome { font-style: normal; font-size: 11px; color: #ffb4a2; margin-left: 2px; }

/* tela inicial com a arte de capa (assets/ui/title_bg.jpg): menu à esquerda sobre um degradê, a arqueira da arte à direita */
#title-screen {
    background: linear-gradient(90deg, rgba(6,8,12,0.88) 0%, rgba(6,8,12,0.62) 34%, rgba(6,8,12,0.08) 58%, rgba(6,8,12,0) 70%),
                url('assets/ui/title_bg.jpg') 62% center / cover no-repeat, #06080c;
    justify-content: flex-start; padding-left: 6vw; backdrop-filter: none;
}
#title-screen .title-art { display: none; }
#title-screen .title-main { max-width: min(560px, 46vw); }


/* aviso de interação em cima da arqueira, com a tecla num quadradinho */
#interact-prompt.near { z-index: 45; bottom: auto; transform: translate(-50%, -100%); padding: 5px 12px 5px 6px; font-size: 0.82rem; white-space: nowrap;
    max-width: 92vw; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 7px; border-radius: 14px; transition: opacity 0.15s ease; }
#interact-prompt.near.hidden { opacity: 0; }
#interact-prompt .ip-key { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 6px;
    background: #ffd166; color: #2a1a08; font: bold 13px Georgia, serif; box-shadow: 0 2px 0 #8a5a12; }
#interact-prompt .ip-hold { font: italic 11px Georgia, serif; color: #ffd166; margin-left: -2px; }
#interact-prompt.near::after { content: ''; position: absolute; left: 50%; bottom: -7px; transform: translateX(-50%); border: 6px solid transparent; border-top-color: #e9c46a; border-bottom: 0; }
/* barra com todas as teclas */
.hud-btn-hint { white-space: normal; max-width: min(860px, 96vw); text-align: center; line-height: 1.9; }
.hud-btn-hint .hk { display: inline-flex; align-items: center; gap: 4px; margin: 0 7px; white-space: nowrap; }
.hud-btn-hint .hk kbd { font: bold 11px Georgia, serif; color: #2a1a08; background: #e9c46a; border-radius: 4px; padding: 0 5px; line-height: 16px; box-shadow: 0 1px 0 #8a5a12; }


/* ===================================================================== CELULAR (toque, deitado) — ver touch.js */
body.touch, body.touch #game-container { touch-action: none; overscroll-behavior: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
#touch-ui { position: fixed; inset: 0; z-index: 90; pointer-events: none; font-family: Georgia, serif; }
#touch-ui button { pointer-events: auto; touch-action: none; -webkit-tap-highlight-color: transparent; font-family: Georgia, serif; }
/* joystick: a área é a parte de baixo da metade esquerda; o círculo aparece onde o dedo encosta */
#t-joy { position: absolute; left: 0; bottom: 0; width: 40vw; height: 62vh; pointer-events: auto; touch-action: none; display: none; }
body.t-joy-on #t-joy { display: block; }
#t-joy-base { position: fixed; left: 15vw; top: calc(100% - 100px); width: 116px; height: 116px; transform: translate(-50%, -50%); border-radius: 50%;
    background: rgba(20,14,8,0.32); border: 2px solid rgba(233,196,106,0.5); opacity: 0.4; transition: opacity 0.15s; }
#t-joy-base.on { opacity: 0.95; }
#t-joy-knob { position: absolute; left: 50%; top: 50%; width: 50px; height: 50px; transform: translate(-50%, -50%); border-radius: 50%;
    background: radial-gradient(circle at 40% 35%, #ffe6a3, #d79a2b); border: 2px solid #5a3a12; box-shadow: 0 3px 8px rgba(0,0,0,0.5); }
/* botões redondos do lado direito */
#t-act { position: absolute; right: 0; bottom: 0; width: 300px; height: 250px; }
.t-btn { position: absolute; width: 58px; height: 58px; border-radius: 50%; border: 2px solid rgba(233,196,106,0.75); background: rgba(24,17,11,0.62);
    color: #ffe6a3; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; padding: 0; box-shadow: 0 3px 10px rgba(0,0,0,0.45);
    background-image: conic-gradient(rgba(0,0,0,0.62) calc(var(--cd, 0) * 360deg), transparent 0); }
.t-btn.on { background-color: rgba(233,196,106,0.45); transform: scale(0.94); }
.t-btn .t-ic { font-size: 22px; line-height: 1; }
.t-btn .t-lb { font-size: 9.5px; line-height: 1.1; margin-top: 2px; text-shadow: 0 1px 2px #000; }
.t-btn.big { width: 86px; height: 86px; right: 20px; bottom: 24px; border-width: 3px; }
.t-btn.big .t-ic { font-size: 32px; }
.t-btn.b1 { right: 118px; bottom: 18px; }
.t-btn.b2 { right: 112px; bottom: 92px; }
.t-btn.b3 { right: 34px; bottom: 122px; }
.t-btn.b4 { right: 186px; bottom: 16px; width: 50px; height: 50px; }
.t-btn.b5 { right: 182px; bottom: 80px; }
.t-btn.b6 { right: 36px; bottom: 192px; width: 46px; height: 46px; }
.t-btn.sk .t-ic { font-size: 26px; }
/* direcional dos menus (canto de baixo à esquerda) */
.t-dpad { position: absolute; left: 18px; bottom: 18px; width: 168px; height: 168px; }
.t-dpad .t-btn { width: 56px; height: 56px; border-radius: 12px; }
.t-dpad .t-btn .t-lb { font-size: 20px; margin: 0; }
.t-dpad .up { left: 56px; top: 0; } .t-dpad .down { left: 56px; bottom: 0; } .t-dpad .left { left: 0; top: 56px; } .t-dpad .right { right: 0; top: 56px; }
/* mapa e pausa: embaixo do minimapa */
#t-top { position: absolute; right: 10px; top: 92px; display: flex; flex-direction: column; gap: 8px; }
.t-mini { width: 42px; height: 42px; border-radius: 10px; border: 2px solid rgba(233,196,106,0.7); background: rgba(24,17,11,0.7); color: #ffe6a3; font-size: 18px; }
body[data-tmode="none"] #touch-ui { display: none; }
/* toque no mundo: anel rápido onde tocou */
.t-ring { position: fixed; z-index: 95; width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%; border: 3px solid #fff; pointer-events: none; animation: tRing 0.45s ease-out forwards; }
@keyframes tRing { from { transform: scale(0.4); opacity: 1; } to { transform: scale(1.6); opacity: 0; } }
/* celular em pé: pede para girar */
#rotate-hint { display: none; position: fixed; inset: 0; z-index: 200; background: #0b0d10; color: #ffe6a3; font: 18px Georgia, serif; flex-direction: column; align-items: center; justify-content: center; gap: 16px; text-align: center; padding: 30px; }
#rotate-hint .rh-phone { font-size: 64px; animation: rhTurn 1.6s ease-in-out infinite; }
@keyframes rhTurn { 0%, 30% { transform: rotate(0deg); } 60%, 100% { transform: rotate(-90deg); } }
@media (orientation: portrait) { body.touch #rotate-hint { display: flex; } }
/* HUD compacto: os botões da tela substituem a barra de atalhos e a lista de teclas */
body.touch .top-bar { top: 6px; left: 8px; right: 8px; zoom: 0.62; }
body.touch .bottom-hud .slot-bar, body.touch .bottom-hud .hud-btn-hint { display: none; }
body.touch .bottom-hud { bottom: 4px; zoom: 0.75; }
body.touch #blessing-bar { zoom: 0.7; }
body.touch #narrator-banner { bottom: 34vh; max-width: min(460px, 60vw); font-size: 0.85rem; }
body.touch .hud-fs-btn { display: none; }
@media (max-height: 560px) {
    body.touch #village-panel, body.touch #talk-modal, body.touch #build-menu, body.touch #build-bar, body.touch #shop-modal, body.touch #pets-modal,
    body.touch #levelup-screen, body.touch #expedition-board, body.touch #pause-menu, body.touch #controls-screen, body.touch #raid-summary,
    body.touch #saves-screen, body.touch #menu-screen, body.touch #game-over-screen, body.touch #victory-screen { zoom: 0.68; }
    body.touch #title-screen .title-main { zoom: 0.75; }
}
@media (max-height: 560px) {
    body.touch #title-screen .game-tagline { display: none; }
    body.touch #title-screen .title-main { zoom: 0.8; }
}
@media (max-height: 560px) {
    body.touch #menu-screen { zoom: 0.55; }
    body.touch #menu-screen .controls-hint, body.touch #menu-screen .menu-msg:empty { display: none; }
}

/* celular: mapa e pausa ao lado do minimapa; direcional menor; narrador no topo */
#t-top { top: 8px; right: 92px; flex-direction: row; }
.t-dpad { width: 144px; height: 144px; left: 14px; bottom: 14px; }
.t-dpad .t-btn { width: 48px; height: 48px; }
.t-dpad .up, .t-dpad .down { left: 48px; } .t-dpad .left, .t-dpad .right { top: 48px; }
body.touch #narrator-banner { top: 58px; bottom: auto; max-width: min(440px, 56vw); font-size: 0.8rem; padding: 6px 16px; }


/* ===================================================================== conta (login) e saves na nuvem — ver cloud.js */
#auth-screen { position: fixed; inset: 0; z-index: 150; display: flex; align-items: center; justify-content: center; background: rgba(6,8,12,0.78); backdrop-filter: blur(4px); padding: 16px; }
#auth-screen.hidden { display: none; }
.auth-box { width: min(420px, 100%); background: linear-gradient(180deg, #1d1712, #120e0b); border: 3px solid #e9c46a; border-radius: 16px; padding: 22px 24px; color: #e8dcc4;
    font-family: Georgia, serif; box-shadow: 0 0 50px rgba(0,0,0,0.9); display: flex; flex-direction: column; gap: 10px; max-height: 96vh; overflow: auto; }
.auth-title { font-size: 1.35rem; color: #ffd166; font-weight: bold; text-align: center; }
.auth-sub, .auth-help { font-size: 0.85rem; color: #cbbd9f; text-align: center; line-height: 1.4; }
.auth-box label { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; color: #e9c46a; }
.auth-box input { font: 16px Georgia, serif; padding: 9px 12px; border-radius: 10px; border: 2px solid #6b5038; background: #0f0b08; color: #fff3d6; outline: none; }
.auth-box input:focus { border-color: #e9c46a; }
.auth-msg { min-height: 18px; font-size: 0.85rem; color: #ffb4a2; text-align: center; }
.auth-btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.auth-btns button { min-width: 140px; }
.auth-list { margin: 0; padding-left: 20px; font-size: 0.85rem; color: #fff3d6; line-height: 1.6; }
#cloud-status { position: fixed; right: 14px; bottom: 10px; z-index: 40; font: 12px Georgia, serif; color: #cfe8c0; background: rgba(10,8,6,0.7); padding: 4px 10px; border-radius: 10px; pointer-events: none; }
#cloud-status.hidden, #cloud-status:empty { display: none; }
#title-menu .menu-btn.small { padding-top: 6px; padding-bottom: 6px; font-size: 0.85em; opacity: 0.9; }
@media (max-height: 560px) { body.touch .auth-box { zoom: 0.8; } }


/* tela de controles: lista de ações com a tecla de cada uma */
.cs-binds { display: flex; flex-direction: column; gap: 3px; max-height: 52vh; overflow-y: auto; padding-right: 4px; }
.cs-bind { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 5px 10px; border-radius: 8px; border: 1px solid transparent; cursor: pointer; font-size: 13px; }
.cs-bind.sel { border-color: #e9c46a; background: rgba(233,196,106,0.14); }
.cs-bind kbd { min-width: 46px; text-align: center; font: bold 12px Georgia, serif; color: #2a1a08; background: #e9c46a; border-radius: 5px; padding: 2px 8px; box-shadow: 0 1px 0 #8a5a12; }
.cs-bind kbd.changed { background: #9fe6a0; box-shadow: 0 1px 0 #3a7a3b; }
.cs-bind.cs-btn { justify-content: center; font-weight: bold; color: #ffd166; margin-top: 4px; }
.cs-msg { min-height: 18px; margin-top: 6px; font: italic 12px Georgia, serif; color: #ffd166; }


/* ===================================================================== HUD separado: barra do vilarejo × painel da heroína */
#village-bar { position: absolute; top: 0; left: 0; right: 0; height: 44px; display: flex; align-items: center; gap: 14px; padding: 0 14px;
    background: linear-gradient(180deg, rgba(28,20,13,0.96), rgba(18,13,9,0.92)); border-bottom: 2px solid #6b5038; box-shadow: 0 3px 12px rgba(0,0,0,0.55);
    pointer-events: none; z-index: 11; font-family: Georgia, serif; color: #e8dcc4; }
#village-bar.hidden { display: none; }
#village-bar .vb-name { display: flex; flex-direction: column; line-height: 1.05; white-space: nowrap; padding-right: 12px; border-right: 1px solid #4a3828; }
#village-bar .vb-name b { color: #ffd166; font-size: 14px; letter-spacing: 0.5px; }
#village-bar .vb-name small { color: #b9a988; font-size: 11px; }
#village-bar .vb-res { display: flex; gap: 6px; align-items: center; flex-wrap: nowrap; }
#village-bar .chip { background: rgba(0,0,0,0.35); border: 1px solid #4a3828; border-radius: 8px; padding: 3px 8px; font-size: 13px; white-space: nowrap; }
#village-bar .vb-time { margin-left: auto; display: flex; align-items: center; gap: 10px; white-space: nowrap; }
#village-bar .world-clock { font-size: 13px; color: #ffe6a3; }
#village-bar .day-bar { width: 150px; }
#village-bar .db-ticks { display: none; }
#village-bar .raid-warn { margin: 0; font-size: 12px; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
/* com a barra do vilarejo, o resto do HUD de cima desce; o título do bioma só aparece na masmorra */
body:not(.in-dungeon) .top-bar { top: 56px; }
body:not(.in-dungeon) .biome-tracker { display: none; }
body:not(.in-dungeon) #gold-chip { display: none; }
body:not(.in-dungeon) #raid-bar { top: 56px; }
.dg-row:not(:has(.chip:not(.hidden))) { display: none; }
body:not(.in-dungeon) .dg-row { display: none; }
/* caixinha do vilarejo: objetivo e aldeões */
.village-clock { width: 260px; }
/* barra de teclas compacta (desktop) */
.hud-btn-hint { font-size: 11px; line-height: 1.4; opacity: 0.82; padding: 3px 10px; max-width: none; white-space: nowrap; }
.hud-btn-hint .hk { margin: 0 5px; gap: 3px; }
.hud-btn-hint .hk kbd { font-size: 10px; line-height: 14px; padding: 0 4px; }
/* celular: barra do vilarejo menor e os botões de mapa/pausa na ponta direita dela */
body.touch #village-bar { zoom: 0.72; padding-right: 150px; }
body.touch:not(.in-dungeon) .top-bar { top: 36px; }
@media (max-width: 900px) { #village-bar .day-bar { display: none; } }


/* aviso "Jogo salvo" (canto de baixo à direita, some sozinho) */
#save-toast { position: fixed; right: 16px; bottom: 16px; z-index: 96; padding: 6px 12px; border-radius: 10px; background: rgba(14,11,9,0.88); border: 1px solid #6b8f5a;
    color: #cfe8c0; font: 12px Georgia, serif; opacity: 0; transform: translateY(6px); transition: opacity 0.3s, transform 0.3s; pointer-events: none; }
#save-toast.on { opacity: 1; transform: none; }
body.touch #save-toast { bottom: auto; top: 8px; right: 50%; transform: translateX(50%); }
body.touch #save-toast.on { transform: translateX(50%); }
#save-toast { bottom: 58px; }
@media (max-width: 1000px) {
    #village-bar { gap: 8px; padding: 0 8px; }
    #village-bar .vb-name small { display: none; }
    #village-bar .chip { padding: 2px 6px; font-size: 12px; }
    #village-bar .raid-warn { max-width: 150px; }
}


/* celular: correções do teste (painéis roláveis com o dedo, botão Voltar no canto, aviso de interação só jogando) */
body.touch .bm-panel, body.touch .vp-panel, body.touch .tk-panel, body.touch .sk-panel, body.touch .pm-box, body.touch .cs-binds,
body.touch #expedition-board, body.touch .board-grid, body.touch .saves-list, body.touch .shop-items-grid { touch-action: pan-y; overflow-y: auto; }
.t-btn.corner { left: 12px; top: 12px; right: auto; bottom: auto; position: fixed; }
body.touch[data-tmode="menu"] #interact-prompt, body.touch[data-tmode="build"] #interact-prompt, body.touch[data-tmode="back"] #interact-prompt { display: none; }
body.touch .t-dpad .t-btn { opacity: 0.8; }
@media (max-height: 560px) { body.touch #expedition-board { zoom: 0.58; } }

.auth-files { display: flex; flex-direction: column; gap: 6px; align-items: center; border-top: 1px solid #4a3828; padding-top: 10px; margin-top: 4px; }
.auth-files button.small { font-size: 13px; padding: 6px 12px; min-width: 0; }


/* janela "Enviar feedback" */
#feedback-screen { position: fixed; inset: 0; z-index: 85; display: flex; align-items: center; justify-content: center; background: rgba(6,6,10,0.74); padding: 16px; font-family: Georgia, serif; }
#feedback-screen.hidden { display: none; }
.fb-box { width: min(440px, 100%); background: linear-gradient(180deg, #1d1712, #120e0b); border: 3px solid #e9c46a; border-radius: 16px; padding: 22px; color: #e8dcc4;
    display: flex; flex-direction: column; gap: 12px; align-items: center; text-align: center; box-shadow: 0 0 50px rgba(0,0,0,0.9); }
.fb-title { font-size: 1.3rem; color: #ffd166; font-weight: bold; }
.fb-text { font-size: 0.9rem; color: #cbbd9f; }
.fb-mail { font-size: 1.05rem; color: #fff3d6; background: rgba(0,0,0,0.35); border: 1px solid #6b5038; border-radius: 10px; padding: 8px 14px; user-select: all; word-break: break-all; }
.fb-btns { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.fb-box button.sel { outline: 3px solid #fff1c2; outline-offset: 2px; }
.fb-msg { min-height: 18px; font-size: 0.85rem; color: #9fe6a0; }
.fb-close { font-size: 0.85rem; padding: 6px 18px; }
.auth-msg.ok { color: #9fe6a0; }
@media (max-height: 560px) { body.touch .fb-box { zoom: 0.8; } }


/* ===================================================================== CELULAR: topo reorganizado (sem nada se cortando) */
/* botões de mapa e menu: fileira fixa no canto de cima à direita */
body.touch #t-top { top: 4px; right: 6px; flex-direction: row; gap: 6px; }
body.touch .t-mini { width: 38px; height: 34px; font-size: 16px; border-radius: 9px; }
/* barra do vilarejo: da esquerda até antes dos botões, fina, sem zoom */
body.touch #village-bar { zoom: 1; height: 38px; right: 96px; padding: 0 8px; gap: 8px; border-radius: 0 0 10px 0; }
body.touch #village-bar .vb-name { padding-right: 8px; }
body.touch #village-bar .vb-name b { font-size: 12px; }
body.touch #village-bar .vb-name small, body.touch #village-bar .day-bar { display: none; }
body.touch #village-bar .chip { font-size: 11px; padding: 2px 5px; }
body.touch #village-bar .vb-res { gap: 4px; }
body.touch #village-bar .vb-time { gap: 6px; min-width: 0; }
body.touch #village-bar .world-clock { font-size: 11px; }
body.touch #village-bar .raid-warn { font-size: 10px; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* painel da heroína, caixinha do vilarejo e minimapa: abaixo da barra / dos botões */
body.touch .top-bar { zoom: 0.62; left: 6px; right: 6px; }
body.touch:not(.in-dungeon) .top-bar { top: calc(44px / 0.62); }
body.touch.in-dungeon .top-bar { top: calc(4px / 0.62); }
body.touch.in-dungeon .minimap-container { margin-top: calc(40px / 0.62); }
body.touch .biome-tracker { margin-right: calc(4px / 0.62); }
/* ataque: o painel do ataque desce junto */
body.touch:not(.in-dungeon) #raid-bar { top: 44px; zoom: 0.8; }
/* nada de teclas de computador no celular: os botões da tela fazem tudo */
body.touch .tk-help, body.touch .bm-help, body.touch .bb-help, body.touch .rs-help, body.touch .pm-help, body.touch .cs-help, body.touch .pt-help,
body.touch .vp-help, body.touch .menu-help, body.touch .board-keys, body.touch .lvl-hint, body.touch .sk-help, body.touch .hud-btn-hint,
body.touch .kb-only, body.touch .pad-only, body.touch .hud-fs-btn, body.touch #save-toast .kbd { display: none !important; }
body.touch #hero-points-badge { font-size: 0; }
body.touch #hero-points-badge::before { content: '+ pontos'; font-size: 11px; }

/* ===================================================================== CELULAR deitado: janelas entre o direcional (esquerda) e os botões (direita) */
@media (max-height: 560px) {
    body.touch #build-menu, body.touch #village-panel, body.touch #talk-modal, body.touch #shop-modal, body.touch #pets-modal,
    body.touch #levelup-screen, body.touch #pause-menu, body.touch #raid-summary, body.touch #saves-screen, body.touch #controls-screen {
        box-sizing: border-box; padding-left: calc(168px / 0.68); padding-right: calc(132px / 0.68);
    }
    body.touch #expedition-board { box-sizing: border-box; padding-left: calc(168px / 0.58); padding-right: calc(132px / 0.58); }
    body.touch #feedback-screen { padding-left: 170px; padding-right: 130px; }
    /* Construir: categorias numa faixa em cima, cartões menores, informação sempre à vista */
    body.touch #build-menu .bm-panel { width: 100%; max-height: 96vh; padding: 10px 12px; }
    body.touch #build-menu .bm-body { grid-template-columns: 1fr; gap: 6px; }
    body.touch #build-menu .bm-cats { flex-direction: row; flex-wrap: wrap; gap: 4px; }
    body.touch #build-menu .bm-cats > * { padding: 4px 8px; font-size: 12px; }
    body.touch #build-menu .bm-grid { grid-template-columns: repeat(5, 1fr); }
    body.touch #build-menu .bm-card img { height: 40px; }
    body.touch #build-menu .bm-info img, body.touch #build-menu .bm-info .bm-emoji.big { display: none; }
    body.touch #build-menu .bm-info { padding: 6px 8px; margin-top: 2px; }
    body.touch #talk-modal { padding-bottom: 8px; align-items: center; }
}
@media (max-height: 560px) {
    body.touch #expedition-board { zoom: 0.5; padding-left: calc(168px / 0.5); padding-right: calc(132px / 0.5); }
    body.touch #board-biomes { flex-wrap: nowrap; }
    body.touch .board-title { margin-top: 0; }
}

#village-bar .raid-warn { max-width: 340px; }

.stats-box div { display: flex; justify-content: space-between; gap: 14px; }

#build-tag { position: absolute; left: 12px; bottom: 8px; font: 11px Georgia, serif; color: rgba(232,220,196,0.55); pointer-events: none; }


/* barra do vilarejo nunca passa da tela: recursos encolhem, a hora e o ataque ficam sempre à vista */
#village-bar { overflow: hidden; }
#village-bar .vb-name { flex: none; }
#village-bar .vb-res { flex: 1 1 auto; min-width: 0; overflow: hidden; }
#village-bar .vb-time { flex: none; }
#village-bar .raid-warn { max-width: 300px; }
@media (max-width: 1350px) { #village-bar .day-bar { display: none; } #village-bar .vb-name small { display: none; } }
/* vitória: texto com largura de leitura */
#victory-desc { max-width: 620px; margin: 0 auto 14px; padding: 0 16px; line-height: 1.5; text-align: center; }
