﻿/*
    fileName: style.css
    Descrição: Estilos completos - Tema Retro 16-bit / Tibia Style (UPSCALED)
    Modificação: Interface aumentada (Barras, Ícones, Fontes) para monitores HD/FullHD.
*/

:root {
    /* Paleta Retro / Tibia Stone */
    --ui-bg: #3f3f3f;            /* Fundo cinza pedra */
    --ui-bg-dark: #2d2d2d;       /* Fundo de slots/inputs */
    --ui-border-light: #6d6d6d;  /* Borda 3D clara */
    --ui-border-dark: #1a1a1a;   /* Borda 3D escura */
    
    --color-text-main: #d4d4d4;  /* Texto cinza claro */
    --color-text-highlight: #ffffff;
    
    /* Cores Funcionais Retro */
    --success-green: #00c800;
    --gold: #ffcc00;
    --danger-red: #d60000;
    --mana-blue: #0044cc;
    
    /* Fontes */
    --font-pixel: 'Verdana', 'Tahoma', sans-serif;
    --font-mono: 'Courier New', monospace;

    /* --- VARIÁVEIS DE TAMANHO (ESCALA AUMENTADA) --- */
    --icon-size: 28px; /* Mesmo tamanho dos botões da hotbar (.hotbar-slot), para manter padrão visual */
    --slot-size: 48px;   /* Aumentado de 36px */
    --inv-slot-size: 52px; /* Slots de item (parte de baixo do inventário), um pouco maiores que --slot-size */
    --font-base: 14px;   /* Aumentado de 12px */
}

/* --- SCROLLBAR GLOBAL (estilo sutil, replicado em todas as scrollbars do jogo) --- */
* {
    scrollbar-width: thin;          /* Firefox */
    scrollbar-color: #555 transparent; /* Firefox */
}
*::-webkit-scrollbar {
    width: 4px !important;
    height: 4px !important;
}
*::-webkit-scrollbar-track {
    background: transparent !important;
}
*::-webkit-scrollbar-thumb {
    background: #555 !important;
    border-radius: 2px !important;
}
*::-webkit-scrollbar-thumb:hover {
    background: #777 !important;
}

/* --- RESET BÁSICO --- */
html, body {
    width: 100%;
    /* MUDANÇA: '100dvh' garante que a barra do navegador não empurre o jogo */
    height: 100dvh; 
    overflow: hidden;
    margin: 0;
    padding: 0;
    background: #000;
    color: var(--color-text-main);
    font-family: var(--font-pixel);
    font-size: var(--font-base);
    touch-action: none; /* Impede zoom e gestos do navegador */
    image-rendering: pixelated;
    position: fixed; /* Trava a rolagem elástica no iPhone/Android */
    top: 0;
    left: 0;
    
    /* Desativa a seleção de texto e o realce azul ao tocar (Mobile) */
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* O restante do seu CSS continua igual abaixo... */

canvas {
    image-rendering: optimizeSpeed;             /* Firefox                        */
    image-rendering: -moz-crisp-edges;          /* Firefox                        */
    image-rendering: -webkit-optimize-contrast; /* Chrome (and Safari)            */
    image-rendering: optimize-contrast;         /* CSS3 Proposed                  */
    image-rendering: -webkit-crisp-edges;       /* Safari                         */
    image-rendering: pixelated;                 /* Chrome                         */
    image-rendering: crisp-edges;               /* Native                         */
    -ms-interpolation-mode: nearest-neighbor;   /* IE                             */
    border: none;
}

#gameCanvas {
    width: 100vw;
    height: 100vh;
    display: block;
    background-color: #000;
    cursor: default;
}

#melee-fx-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    pointer-events: none;
}

#browser-zoom-blackout {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 2147483000;
}

#install-pwa-btn {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 2147482900;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: linear-gradient(180deg, #3a6ea5, #1b3a5f);
    color: #fff;
    border: 2px solid #7fb3d5;
    border-radius: 8px;
    font-family: 'Silkscreen', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.55);
    user-select: none;
}

#install-pwa-btn:hover {
    filter: brightness(1.15);
}

#install-pwa-btn:active {
    filter: brightness(0.9);
}

.pwa-install-icon {
    width: 26px;
    height: 26px;
    image-rendering: pixelated;
    border-radius: 4px;
    pointer-events: none;
}

/* Só mostra o botão de instalação fora do jogo (login/seleção/criação).
   O body ganha a classe "in-game" ao entrar no jogo. */
body.in-game #install-pwa-btn,
body.in-game .pwa-install-icon {
    display: none !important;
    pointer-events: none;
}

/* Modal do guia de instalação do iPhone (conteúdo em inglês) */
#install-pwa-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.65);
    z-index: 2147483000;
    padding: 16px;
}
#install-pwa-modal.visible { display: flex; }
#install-pwa-guide-box {
    max-width: 340px;
    width: 100%;
    text-align: left;
}
#install-pwa-guide-box h3 { text-align: center; }
#install-pwa-guide-box ol {
    margin: 8px 0 14px 0;
    padding-left: 20px;
    font-size: 11px;
    line-height: 1.7;
    color: #ddd;
}
#install-pwa-guide-box ol li { margin-bottom: 8px; }
#install-pwa-guide-box strong { color: var(--gold); }
#install-pwa-guide-box .share-icon {
    color: #aaa;
    font-style: normal;
    font-size: 10px;
}
#install-pwa-close {
    display: block;
    margin: 0 auto;
}

canvas.selection-mode {
    cursor: crosshair !important;
}

#game-ui-wrapper {
    display: none;
    pointer-events: auto;
}

/* --- CLASSE UTILITÁRIA DE JANELA RETRO --- */
.retro-window {
    background-color: var(--ui-bg);
    border-top: 3px solid var(--ui-border-light); /* Borda mais grossa */
    border-left: 3px solid var(--ui-border-light);
    border-right: 3px solid var(--ui-border-dark);
    border-bottom: 3px solid var(--ui-border-dark);
    box-shadow: 2px 2px 0px #000;
    image-rendering: pixelated;
}

/* --- HUD DE FIM DE COMBATE (glassmorphism) --- */
.battle-summary-glass {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 320px;
    max-width: 90vw;
    max-height: 82vh;
    overflow-y: auto;
    padding: 16px 18px;
    pointer-events: auto;
    background: rgba(45, 45, 45, 0.55);
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    font-family: var(--font-pixel);
    color: var(--color-text-main);
}

.bsg-close-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 26px;
    height: 26px;
    padding: 0;
    line-height: 1;
    font-size: 16px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: var(--color-text-main);
}

.bsg-title {
    text-align: center;
    color: var(--gold);
    font-size: 17px;
    font-weight: bold;
    text-shadow: 0 0 12px rgba(255, 204, 0, 0.4);
    margin: 0 0 2px;
}

.bsg-subtitle {
    text-align: center;
    color: #aaa;
    font-size: 11px;
    margin: 0 0 14px;
}

.bsg-players {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.bsg-player-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 10px;
    padding: 10px;
}

.bsg-player-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.bsg-avatar-wrap {
    position: relative;
    flex-shrink: 0;
}

.bsg-avatar {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.12);
    image-rendering: pixelated;
}

.bsg-level-badge {
    position: absolute;
    bottom: -5px;
    right: -5px;
    background: var(--gold);
    color: #3a2a05;
    font-size: 9px;
    font-weight: bold;
    padding: 1px 5px;
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.3);
}

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

.bsg-name-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.bsg-name {
    font-weight: bold;
    font-size: 13px;
    color: var(--color-text-highlight);
}

.bsg-levelup-badge {
    font-size: 9px;
    color: #3a2a05;
    background: var(--gold);
    padding: 1px 5px;
    border-radius: 5px;
    text-transform: uppercase;
}

.bsg-exp-track {
    position: relative;
    height: 10px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.bsg-exp-fill {
    position: relative;
    height: 100%;
    width: 0%;
    border-radius: 6px;
    background: linear-gradient(90deg, #009e00, var(--success-green));
    box-shadow: 0 0 8px rgba(0, 200, 0, 0.6);
    transition: width 1.2s cubic-bezier(.22, 1, .36, 1);
    overflow: hidden;
}

.bsg-exp-fill::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 35%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent);
    animation: bsgShimmer 2.2s ease-in-out infinite;
}

@keyframes bsgShimmer {
    0% { transform: translateX(-120%); }
    100% { transform: translateX(320%); }
}

.bsg-exp-text {
    display: block;
    font-size: 9px;
    color: #aaa;
    margin-top: 3px;
}

.bsg-exp-gain {
    color: var(--success-green);
}

.bsg-drops-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.bsg-drop-item {
    position: relative;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.14);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.12s ease;
}

.bsg-drop-item:hover {
    transform: translateY(-2px);
    border-color: var(--gold);
}

.bsg-drop-item img {
    width: 22px;
    height: 22px;
    image-rendering: pixelated;
    pointer-events: none;
}

.bsg-drop-qty {
    position: absolute;
    bottom: -4px;
    right: -4px;
    background: #1a1a1a;
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: #fff;
    font-size: 9px;
    font-weight: bold;
    padding: 0 3px;
    border-radius: 5px;
}

.bsg-no-drops {
    font-size: 11px;
    color: #888;
}

.bsg-section-label {
    font-size: 10px;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 16px 0 6px 2px;
}

.bsg-kills {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 10px;
    padding: 4px 10px;
}

.bsg-kill-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 12px;
}

.bsg-kill-row:last-child {
    border-bottom: none;
}

.bsg-kill-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.bsg-kill-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.3);
    image-rendering: pixelated;
}

.bsg-kill-lvl {
    color: #aaa;
    font-size: 11px;
}

/* Botões Retro Genéricos */
button {
    background: var(--ui-bg);
    border-top: 3px solid var(--ui-border-light);
    border-left: 3px solid var(--ui-border-light);
    border-right: 3px solid var(--ui-border-dark);
    border-bottom: 3px solid var(--ui-border-dark);
    color: var(--color-text-main);
    font-family: var(--font-pixel);
    font-weight: bold;
    cursor: pointer;
    font-size: 13px; /* Fonte do botão maior */
    padding: 6px 10px;
}

/* Estado "pressionado" sem mover o layout: usa box-shadow inset (em vez de
   trocar a espessura das bordas ou aplicar translate), então o botão NÃO
   desloca nem cresce — nada do layout interno de janelas/overlays flex se
   move ao clicar. Feedback fica só na cor/brilho. */
button:active {
    filter: brightness(0.86);
    box-shadow: inset 0 0 0 3px var(--ui-border-dark), inset 0 0 0 6px var(--ui-border-light);
    transform: none;
}

button:disabled {
    color: #555;
    cursor: not-allowed;
}

/* --- TELA DE LOADING --- */
#loading-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: #121212 url('/assets/Interface/Fundos/backgroundlogin.png') no-repeat center center;
    background-size: 100% 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    z-index: 102;
}

/* --- TELA PRETA DE CONEXÃO (entre Play e o carregamento do mapa) ---
   Totalmente preta com o connectingicon.png no centro. Fica ACIMA da
   seleção de personagem (z-index 9997) e some quando o init chega. */
#connecting-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: #000;
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    pointer-events: auto;
}

#connecting-overlay img {
    max-width: min(40vw, 320px);
    max-height: 40vh;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
}

/* HUD de conexão perdida — acima de tudo (modal-confirm é 100000). */
#connection-lost-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.72);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100001;
    pointer-events: auto;
}

#connection-lost-overlay.hidden {
    display: none !important;
}

#connection-lost-overlay .modal-box {
    min-width: 260px;
}

#connection-lost-overlay .modal-btn {
    margin-top: 12px;
}

#connection-lost-overlay .modal-btn:disabled {
    opacity: 0.45;
    cursor: default;
}

#connection-lost-overlay .modal-btn:disabled:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
}

#loading-container {
    width: 450px; /* Mais largo */
    padding: 20px;
    background: rgba(25, 25, 25, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    align-items: center;
}

#loading-title {
    font-size: 20px;
    margin: 0 auto 16px auto;
    font-family: var(--font-pixel);
    font-weight: bold;
    color: #fff;
    text-transform: none;
    text-shadow: 1px 1px 0 #000;
}
#loading-progress-bar-outer {
    width: 100%;
    height: 18px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.18);
    margin-bottom: 15px;
}

#loading-progress-bar-inner {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, rgba(26, 115, 232, 0.9), rgba(64, 169, 255, 0.9));
    transition: width 0.1s steps(10);
}

#loading-status-text {
    font-size: 12px;
    color: var(--color-text-main);
    text-align: center;
    font-family: var(--font-mono);
}

/* --- TELA DE LOGIN --- */
#login-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: #121212 url('/assets/Interface/Fundos/backgroundlogin.png') no-repeat center center;
    background-size: 100% 100%;
    /* background-size: repeat; Removido para evitar conflito com 'cover' */
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    z-index: 5000;
}

body.logged-in #login-overlay {
    display: none !important;
}

#login-container {
    width: 320px;
    max-width: 88vw;
    padding: 20px 20px;
    margin-top: 160px;
    background: rgba(30, 30, 34, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(18px) saturate(150%);
    -webkit-backdrop-filter: blur(18px) saturate(150%);
    display: flex;
    flex-direction: column;
}

/* Botões sociais (Instagram / Discord) no canto superior da tela de login */
#login-social-buttons {
    position: fixed;
    top: 16px;
    right: 16px;
    display: flex;
    gap: 10px;
    z-index: 5001;
}

.login-social-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    font-family: var(--font-mono);
    font-size: 13px;
    color: #fff;
    text-decoration: none;
    background: rgba(30, 30, 34, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 30px;
    backdrop-filter: blur(18px) saturate(150%);
    -webkit-backdrop-filter: blur(18px) saturate(150%);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease, background 0.15s ease;
    cursor: pointer;
}

.login-social-btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.login-social-btn:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.35);
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.login-social-btn[aria-label="Instagram"] svg {
    color: #e4405f;
}

.login-social-btn[aria-label="Discord"] svg {
    color: #5865f2;
}

@media (max-width: 768px) {
    #login-social-buttons {
        top: 10px;
        right: 10px;
        gap: 8px;
    }

    .login-social-btn {
        padding: 7px 11px;
        font-size: 12px;
    }

    .login-social-btn span {
        display: none;
    }

    .login-social-btn svg {
        width: 20px;
        height: 20px;
    }
}

/* Otimização Mobile para Login e Registro */
@media (max-width: 768px) {
    #login-container {
        width: 88%;
        padding: 16px 14px;
        border-radius: 14px;
        margin-top: 130px;
    }

    #login-title {
        font-size: 20px;
        margin-bottom: 14px;
    }

    .auth-form {
        gap: 10px;
    }

    .auth-input {
        padding: 10px 12px;
        font-size: 16px; /* Mantido 16px para evitar zoom automático do iOS */
    }

    .auth-button {
        padding: 11px;
        font-size: 13px;
        margin-top: 4px;
    }

    #auth-tabs-wrapper {
        margin-bottom: 16px;
    }

    .auth-tab-btn {
        padding: 8px;
        font-size: 12px;
    }

    #auth-error-message {
        font-size: 11px;
        margin-bottom: 8px;
        padding: 6px;
    }
}

/* Celular em modo paisagem (landscape): HUD de login reduzida pela metade
   pra caber na tela baixa, centralizada na tela */
@media (max-width: 932px) and (orientation: landscape) {
    #login-overlay {
        justify-content: center;
        padding-bottom: 0;
    }

    #login-container {
        width: 34%;
        max-width: 200px;
        padding: 5px 8px;
        margin-top: 0;
        border-radius: 8px;
    }

    #login-title {
        font-size: 10px;
        margin: 0 0 3px 0;
        line-height: 1.1;
    }

    .auth-form {
        gap: 2px;
    }

    .auth-label {
        display: none; /* placeholder já indica o campo, economiza altura */
    }

    .auth-input {
        padding: 2px 5px;
        font-size: 9px;
        border-radius: 5px;
        line-height: 1.3;
    }

    .auth-remember-label {
        font-size: 7px;
        gap: 3px;
        margin-top: 0;
        line-height: 1;
    }

    .auth-remember-label input[type="checkbox"] {
        width: 8px;
        height: 8px;
    }

    .auth-button {
        padding: 3px;
        font-size: 8px;
        margin-top: 1px;
        line-height: 1.2;
    }

    #auth-tabs-wrapper {
        margin-bottom: 3px;
        gap: 3px;
        padding: 2px;
    }

    .auth-tab-btn {
        padding: 2px;
        font-size: 7px;
        line-height: 1.2;
    }

    #auth-error-message {
        font-size: 7px;
        margin-bottom: 0;
        padding: 0;
        line-height: 1;
    }

    #auth-error-message:empty {
        display: none;
    }
}

#login-title {
    font-size: 26px;
    margin: 0 0 22px 0;
    font-family: var(--font-pixel);
    font-weight: bold;
    letter-spacing: 1px;
    color: #fff;
    text-shadow: 0 2px 14px rgba(120, 170, 255, 0.35);
    text-align: center;
}

#auth-tabs-wrapper {
    width: 100%;
    display: flex;
    gap: 5px;
    margin-bottom: 14px;
    padding: 3px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 11px;
}

.auth-tab-btn {
    flex: 1;
    padding: 8px;
    font-size: 12px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.55);
    font-family: var(--font-pixel);
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.auth-tab-btn:active {
    transform: none;
}

.auth-tab-btn.active {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.auth-form {
    display: none;
    flex-direction: column;
    gap: 10px;
}

.auth-form.visible {
    display: flex;
}

.auth-label {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    font-family: var(--font-mono);
}

.auth-input {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 9px;
    color: #fff;
    padding: 9px 12px;
    font-family: var(--font-mono);
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
    user-select: text; /* Permite seleção apenas em inputs */
    -webkit-user-select: text;
}

.auth-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.auth-input:focus {
    background: rgba(0, 0, 0, 0.42);
    border-color: rgba(120, 170, 255, 0.6);
    box-shadow: 0 0 0 3px rgba(95, 133, 255, 0.18);
}

.auth-remember-label {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    font-family: var(--font-mono);
    cursor: pointer;
    margin-top: -2px;
    user-select: none;
}

.auth-remember-label input[type="checkbox"] {
    width: 14px;
    height: 14px;
    margin: 0;
    accent-color: rgba(120, 170, 255, 0.9);
    cursor: pointer;
}

.auth-button {
    margin-top: 4px;
    padding: 10px;
    font-size: 13px;
    font-family: var(--font-pixel);
    font-weight: bold;
    color: #fff;
    background: linear-gradient(180deg, rgba(95, 133, 255, 0.9), rgba(62, 95, 209, 0.9));
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(62, 95, 209, 0.35);
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.auth-button:hover {
    background: linear-gradient(180deg, rgba(110, 148, 255, 0.95), rgba(75, 108, 220, 0.95));
    box-shadow: 0 10px 26px rgba(62, 95, 209, 0.45);
    transform: translateY(-1px);
}

.auth-button:active {
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(62, 95, 209, 0.35);
}

.auth-link {
    align-self: center;
    margin-top: 2px;
    font-size: 12px;
    font-family: var(--font-mono);
    color: rgba(140, 175, 255, 0.85);
    text-decoration: none;
    cursor: pointer;
}

.auth-link:hover {
    color: #fff;
    text-decoration: underline;
}

.auth-note {
    margin: 0;
    font-size: 12px;
    font-family: var(--font-mono);
    line-height: 1.45;
    color: rgba(255, 255, 255, 0.55);
}

#auth-error-message {
    color: #ff8080;
    text-align: center;
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 14px;
    padding: 8px;
    background: rgba(214, 0, 0, 0.12);
    border: 1px solid rgba(255, 107, 107, 0.3);
    border-radius: 8px;
}

#auth-error-message:empty {
    display: none;
    padding: 0;
    margin: 0;
    border: none;
    background: transparent;
}

#auth-error-message.success {
    color: #7be08f;
    background: rgba(20, 160, 90, 0.12);
    border-color: rgba(90, 220, 140, 0.35);
}

/* --- SELEÇÃO DE CLASSE --- */
#class-selection-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: #121212 url('/assets/Interface/Fundos/backgroundlogin.png') no-repeat center center;
    background-size: 100% 100%;
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 100;
    flex-direction: column;
    box-sizing: border-box;
    padding: env(safe-area-inset-top, 8px) env(safe-area-inset-right, 8px)
             env(safe-area-inset-bottom, 8px) env(safe-area-inset-left, 8px);
}

#class-container {
    width: min(420px, 92vw);
    max-height: 92dvh;
    max-height: 92vh; /* fallback para navegadores sem suporte a dvh */
    overflow-y: auto;
    box-sizing: border-box;
    padding: clamp(10px, 3vw, 16px);
    background: rgba(25, 25, 25, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    align-items: center;
}

#class-title {
    font-family: var(--font-pixel);
    color: var(--gold);
    text-shadow: 2px 2px #000;
    margin-bottom: clamp(4px, 1.5vw, 8px);
    font-size: clamp(13px, 3.6vw, 16px);
    text-align: center;
}

#class-preview-canvas {
    width: clamp(80px, 22vw, 140px);
    height: clamp(80px, 22vw, 140px);
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    margin-bottom: clamp(4px, 1.5vw, 8px);
    flex-shrink: 0;
}

#class-compact {
    display: flex;
    flex-direction: column;
    gap: clamp(4px, 1.2vw, 6px);
    margin: 4px 0 6px 0;
    width: 100%;
    align-items: center;
}

.class-row {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(25, 25, 25, 0.28);
    border: 1px solid rgba(255, 255, 255, 0.14);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: clamp(3px, 1vw, 4px) 6px;
    width: 100%;
    box-sizing: border-box;
    justify-content: center;
}

.class-row-label {
    min-width: 52px;
    font-size: clamp(10px, 2.6vw, 12px);
    color: #bbb;
    flex-shrink: 0;
}

#character-name-input {
    flex: 1;
    min-width: 0;
    max-width: 200px;
    padding: 4px 6px;
    text-align: center;
    height: 24px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #fff;
    font-size: clamp(11px, 2.6vw, 13px);
    box-sizing: border-box;
}

.class-row-appearance {
    flex-wrap: wrap;
    gap: 6px;
    row-gap: 6px;
}

.mini-select {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(20, 20, 20, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.14);
    padding: 2px 6px;
    border-radius: 6px;
    flex: 1 1 auto;
    justify-content: center;
    min-width: 0;
}

.mini-label {
    font-size: clamp(9px, 2.3vw, 11px);
    color: #bbb;
    min-width: 30px;
    flex-shrink: 0;
}

#body-label,
#hair-label,
#outfit-label {
    min-width: 0;
    text-align: center;
    font-size: clamp(10px, 2.6vw, 12px);
    color: #fff;
    white-space: nowrap;
}

#class-label {
    min-width: 0;
    text-align: center;
    font-size: clamp(10px, 2.6vw, 12px);
    color: #fff;
    white-space: nowrap;
}

.class-row button,
.mini-select button,
#class-actions button {
    background: rgba(60, 60, 60, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #fff;
    border-radius: 6px;
    height: clamp(20px, 5.5vw, 24px);
    min-width: clamp(20px, 5.5vw, 24px);
    padding: 0 8px;
    font-size: clamp(10px, 2.6vw, 12px);
    flex-shrink: 0;
}

.class-row button:hover,
.mini-select button:hover,
#class-actions button:hover {
    background: rgba(80, 80, 80, 0.65);
}

#class-prev,
#class-next {
    width: clamp(18px, 5vw, 22px);
    height: clamp(18px, 5vw, 22px);
    padding: 0;
}

#class-actions {
    width: 100%;
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-top: 8px;
    align-items: stretch;
    flex-shrink: 0;
}

#class-actions button {
    flex: 1;
    height: clamp(22px, 6vw, 24px);
    padding: 0;
    font-size: clamp(10px, 2.6vw, 12px);
    margin-top: 0;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
}

#class-actions .auth-button {
    margin-top: 0;
    padding: 0;
}

/* Distribuição de Atributos */
.class-row-attributes {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: rgba(25, 25, 25, 0.28);
    border: 1px solid rgba(255, 255, 255, 0.14);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 8px 6px;
    width: 100%;
    box-sizing: border-box;
}

.attribute-row {
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: space-between;
}

.attribute-label {
    min-width: 80px;
    font-size: clamp(9px, 2.3vw, 11px);
    color: #bbb;
    flex-shrink: 0;
}

.attribute-dots {
    display: flex;
    gap: 3px;
    flex: 1;
    justify-content: center;
}

.attr-dot {
    width: clamp(10px, 2.8vw, 14px);
    height: clamp(10px, 2.8vw, 14px);
    border: 1px solid #666;
    border-radius: 2px;
    background: #000;
    transition: all 0.2s ease;
}

.attr-dot.active {
    background: #90EE90; /* Verde claro (quase chroma) */
    border-color: #7CCD7C;
}

.attr-btn {
    background: rgba(60, 60, 60, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #fff;
    border-radius: 4px;
    width: clamp(18px, 5vw, 22px);
    height: clamp(18px, 5vw, 22px);
    padding: 0;
    font-size: clamp(10px, 2.6vw, 12px);
    flex-shrink: 0;
    cursor: pointer;
}

.attr-btn:hover {
    background: rgba(80, 80, 80, 0.65);
}

.attr-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.attribute-points {
    text-align: center;
    font-size: clamp(10px, 2.6vw, 12px);
    color: #bbb;
    margin-top: 4px;
}

.attribute-points span {
    color: var(--gold);
    font-weight: bold;
}

/* Seleção de Classe Inicial */
.class-row-initial-class {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: rgba(25, 25, 25, 0.28);
    border: 1px solid rgba(255, 255, 255, 0.14);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 8px 6px;
    width: 100%;
    box-sizing: border-box;
}

.initial-class-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
}

.initial-class-btn {
    background: rgba(60, 60, 60, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #fff;
    border-radius: 6px;
    padding: 6px 4px;
    font-size: clamp(9px, 2.3vw, 11px);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.initial-class-btn:hover {
    background: rgba(80, 80, 80, 0.65);
}

.initial-class-btn.selected {
    background: rgba(100, 180, 100, 0.6);
    border-color: rgba(150, 220, 150, 0.8);
    color: #fff;
}

/* Bônus da Classe Selecionada */
.class-row-class-bonus {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px;
    background: rgba(40, 40, 40, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 4px;
    box-sizing: border-box;
}

#class-bonus-display {
    font-size: clamp(9px, 2.2vw, 11px);
    color: #ccc;
    line-height: 1.4;
}

#class-bonus-display .bonus-skills {
    margin-bottom: 6px;
}

#class-bonus-display .bonus-skill {
    display: inline-block;
    background: rgba(100, 150, 200, 0.3);
    border: 1px solid rgba(100, 150, 200, 0.5);
    padding: 2px 6px;
    margin: 2px;
    border-radius: 3px;
    font-size: clamp(8px, 2vw, 10px);
}

#class-bonus-display .bonus-items {
    margin-top: 4px;
}

#class-bonus-display .bonus-item {
    display: inline-block;
    background: rgba(200, 150, 100, 0.3);
    border: 1px solid rgba(200, 150, 100, 0.5);
    padding: 2px 6px;
    margin: 2px;
    border-radius: 3px;
    font-size: clamp(8px, 2vw, 10px);
}

/* Telas bem pequenas em retrato (a maioria dos celulares) */
@media (max-width: 480px) {
    #class-container {
        width: 94vw;
        padding: 10px;
    }

    .class-row-appearance {
        flex-direction: column;
    }

    .mini-select {
        width: 100%;
    }

    /* Tela bem estreita: encolhe mais um pouco a hotbar para garantir
       que os 11 slots (ataque + 0-9) caibam numa linha só.
       Só se aplica no layout padrão (linha única); os layouts em
       grade mantêm o tamanho normal dos slots. */
    #hotbar-container:not(.hotbar-layout-grid-1):not(.hotbar-layout-grid-2):not(.hotbar-layout-vertical) {
        gap: 2px !important;
    }

    #hotbar-container:not(.hotbar-layout-grid-1):not(.hotbar-layout-grid-2):not(.hotbar-layout-vertical) .hotbar-slot {
        width: 26px !important;
        height: 26px !important;
        min-width: 26px !important;
        padding: 1px !important;
    }

    .hotbar-icon {
        width: 15px !important;
        height: 15px !important;
    }
}

/* Celular em paisagem com pouca altura: comprime tudo verticalmente
   e permite rolagem para não estourar a tela */
@media (max-height: 480px) and (orientation: landscape) {
    #class-container {
        max-height: 96dvh;
        max-height: 96vh;
        padding: 6px 12px;
        gap: 0;
    }

    #class-title {
        font-size: 12px;
        margin-bottom: 3px;
    }

    #class-preview-canvas {
        width: 44px;
        height: 44px;
        margin-bottom: 3px;
    }

    #class-compact {
        gap: 3px;
        margin: 2px 0 3px 0;
    }

    .class-row {
        padding: 2px 6px;
    }

    #class-actions {
        margin-top: 4px;
    }
}

/* --- HUD: HP / PA / PM / XP (CENTRALIZADO) --- */
#central-stats-wrapper {
    position: fixed;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    gap: 5px; /* Pequeno respiro entre as duas cápsulas de vidro */
    background: none !important; /* Remove o fundo cinza escuro */
    border: none !important; /* Remove a borda pesada */
    padding: 0;
    opacity: 1; /* Opacidade controlada pelos containers internos */
}

#hp-mp-container {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 4px;
    background: rgba(15, 15, 18, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.12);
    padding: 5px 8px;
    border-radius: 10px;
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

#stats-bars-column {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

#day-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    margin-left: 4px;
    flex-shrink: 0;
}

#day-indicator-canvas {
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

#day-phase-text {
    display: none; /* nome da fase do dia removido — só a imagem fica visível */
}

#hp-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

#mp-row {
    width: 100%;
    box-sizing: border-box;
    margin-top: 2px;
}

#mp-bar {
    width: 100%;
}

#mp-bar-fill {
    background: linear-gradient(180deg, #5f9fff, #3e6fd1);
    border-right: 1px solid rgba(255, 255, 255, 0.3);
}

#xp-container {
    width: 100%;
    box-sizing: border-box;
}

/* Ajuste para as barras individuais */
.stat-bar {
    width: 120px;
    height: 15px; /* Mais fina e elegante */
    background-color: rgba(0, 0, 0, 0.3); /* Fundo da barra mais discreto */
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-sizing: border-box;
    position: relative;
    border-radius: 4px;
    overflow: hidden;
}

/* Sobrescreve a largura para as barras de HP, MP e XP */
#hp-bar, #mp-bar, #xp-container .stat-bar {
    width: 100%;
}

.stat-bar {
    /* Removido o width: 100% e height: 24px que agora estão no bloco anterior */
}

.stat-bar-fill {
    height: 100%;
    width: 100%;
    transition: width 0.1s linear;
}

#hp-bar-fill {
    background: linear-gradient(180deg, #ff5f5f, #d13e3e);
    border-right: 1px solid rgba(255, 255, 255, 0.3);
}

#xp-bar-fill {
    background: linear-gradient(90deg, #00c800, #00ff00);
    border-right: 2px solid #00ff00;
    box-shadow: 0 0 10px rgba(0, 200, 0, 0.8);
}

#hunger-thirst-container {
    width: 100%;
    box-sizing: border-box;
    margin-top: 2px;
}

#hunger-row, #thirst-row {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 2px;
}

.status-icon {
    flex-shrink: 0;
}

#hunger-bar, #thirst-bar {
    flex: 1;
    height: 6px;
}

#hunger-bar-fill {
    background: linear-gradient(90deg, #e6b800, #ffd700);
    border-right: 1px solid rgba(255, 255, 255, 0.3);
}

#thirst-bar-fill {
    background: linear-gradient(90deg, #5bc0de, #87ceeb);
    border-right: 1px solid rgba(255, 255, 255, 0.3);
}

/* --- Barra de progresso da skill selecionada no Skillbook --- */
#skill-progress-hud {
    width: calc(100% - 4px);
    margin: 0 auto;
    box-sizing: border-box;
}

#skill-progress-hud.hidden {
    display: none;
}

.skill-progress-bar {
    position: relative;
    width: 100%;
    height: 12px;
    background: rgba(15, 15, 18, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    overflow: hidden;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.skill-progress-fill {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0%;
    background: linear-gradient(90deg, #7d2ae8, #b05cff);
    transition: width 0.3s ease;
    box-shadow: 0 0 8px rgba(157, 78, 221, 0.55);
}

.skill-progress-text {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: bold;
    line-height: 1;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
    white-space: nowrap;
    pointer-events: none;
}

/* --- Knight Passive Gauge (Fury/PA): escudo+espada glassmorph com líquido --- */
.hud-top-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
}

.knight-passive-gauge.hidden {
    display: none;
}

.knight-passive-gauge {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    position: relative;
    cursor: help;
}

.knight-passive-svg {
    width: 30px;
    height: 30px;
    overflow: visible;
}

/* Base translúcida do escudo (efeito vidro) */
.knight-shield-glass {
    fill: rgba(255, 255, 255, 0.06);
    stroke: none;
}

/* Contorno nítido do escudo, por cima do líquido */
.knight-shield-outline {
    fill: none;
    stroke: rgba(255, 255, 255, 0.55);
    stroke-width: 2;
    stroke-linejoin: round;
}

/* Líquido que sobe conforme o progresso da passiva (y/height controlados via JS).
   Efeito "prismático": as cores giram continuamente em vez de um gradiente fixo. */
#knight-passive-liquid-rect {
    transition: y 0.25s ease-out, height 0.25s ease-out;
    animation: knight-prismatic-hue 5s linear infinite;
}

@keyframes knight-prismatic-hue {
    0% {
        filter: hue-rotate(0deg) saturate(1.5) drop-shadow(0 0 4px rgba(255, 255, 255, 0.5));
    }
    100% {
        filter: hue-rotate(360deg) saturate(1.5) drop-shadow(0 0 4px rgba(255, 255, 255, 0.5));
    }
}

/* Brilho de vidro que desliza por cima do líquido, reforçando a leitura de "líquido" */
.knight-liquid-shine-sweep {
    pointer-events: none;
    mix-blend-mode: overlay;
    animation: knight-shine-sweep 3.2s ease-in-out infinite;
}

@keyframes knight-shine-sweep {
    0% {
        transform: translateX(0px);
    }
    100% {
        transform: translateX(140px);
    }
}

/* Espada sobreposta ao escudo, com leve efeito de vidro/metal */
.knight-sword-blade,
.knight-sword-guard,
.knight-sword-hilt,
.knight-sword-pommel {
    fill: rgba(255, 255, 255, 0.8);
    stroke: rgba(20, 20, 20, 0.45);
    stroke-width: 0.6;
    stroke-linejoin: round;
}

.knight-sword {
    opacity: 0.92;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.5));
}

/* Knight Passive Tooltip */
#knight-passive-tooltip {
    position: fixed;
    background: rgba(20, 20, 25, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 8px;
    color: #fff;
    padding: 8px 10px;
    z-index: 2000;
    display: none;
    pointer-events: none;
    font-family: var(--font-mono);
    font-size: 11px;
    max-width: 220px;
    line-height: 1.5;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}

.knight-passive-tooltip-title {
    font-weight: bold;
    color: #ffd700;
    font-size: 12px;
    margin-bottom: 4px;
}

.knight-passive-tooltip-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
}

.knight-passive-tooltip-label {
    color: #aaa;
}

.knight-passive-tooltip-value {
    color: #fff;
    font-weight: bold;
}

.knight-passive-tooltip-bonus {
    color: #7dff7d;
}

/* ── Black Mage Passive Gauge ── */

.black-mage-passive-gauge.hidden {
    display: none;
}

.black-mage-passive-gauge {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    position: relative;
    cursor: help;
}

.black-mage-passive-svg {
    width: 28px;
    height: 30px;
    overflow: visible;
}

.bm-prism-glass {
    fill: rgba(255, 255, 255, 0.06);
    stroke: none;
}

.bm-prism-outline {
    fill: none;
    stroke: rgba(180, 130, 255, 0.55);
    stroke-width: 2;
    stroke-linejoin: round;
}

#bm-passive-liquid-rect {
    transition: y 0.25s ease-out, height 0.25s ease-out;
    animation: bm-prismatic-hue 5s linear infinite;
}

@keyframes bm-prismatic-hue {
    0% { filter: hue-rotate(0deg) saturate(1.5) drop-shadow(0 0 4px rgba(180,130,255,0.5)); }
    100% { filter: hue-rotate(360deg) saturate(1.5) drop-shadow(0 0 4px rgba(180,130,255,0.5)); }
}

.bm-liquid-shine-sweep {
    pointer-events: none;
    mix-blend-mode: overlay;
    animation: bm-shine-sweep 3.2s ease-in-out infinite;
}

@keyframes bm-shine-sweep {
    0% { transform: translateX(0px); }
    100% { transform: translateX(140px); }
}

#black-mage-passive-tooltip {
    position: fixed;
    background: rgba(20, 20, 25, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(180, 130, 255, 0.3);
    border-radius: 8px;
    color: #fff;
    padding: 8px 10px;
    z-index: 2000;
    display: none;
    pointer-events: none;
    font-family: var(--font-mono);
    font-size: 11px;
    max-width: 220px;
    line-height: 1.5;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}

/* ── Archer Passive Gauge ── */

.archer-passive-gauge.hidden {
    display: none;
}

.archer-passive-gauge {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    position: relative;
    cursor: help;
}

.archer-passive-svg {
    width: 28px;
    height: 30px;
    overflow: visible;
}

.archer-boot-glass {
    fill: rgba(255, 255, 255, 0.06);
    stroke: none;
}

.archer-boot-outline {
    fill: none;
    stroke: rgba(50, 205, 50, 0.55);
    stroke-width: 2;
    stroke-linejoin: round;
}

#archer-passive-liquid-rect {
    transition: y 0.25s ease-out, height 0.25s ease-out;
    animation: archer-prismatic-hue 5s linear infinite;
}

@keyframes archer-prismatic-hue {
    0% { filter: hue-rotate(0deg) saturate(1.5) drop-shadow(0 0 4px rgba(50,205,50,0.5)); }
    100% { filter: hue-rotate(360deg) saturate(1.5) drop-shadow(0 0 4px rgba(50,205,50,0.5)); }
}

.archer-liquid-shine-sweep {
    pointer-events: none;
    mix-blend-mode: overlay;
    animation: archer-shine-sweep 3.2s ease-in-out infinite;
}

@keyframes archer-shine-sweep {
    0% { transform: translateX(0px); }
    100% { transform: translateX(140px); }
}

#archer-passive-tooltip {
    position: fixed;
    background: rgba(20, 20, 25, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(50, 205, 50, 0.3);
    border-radius: 8px;
    color: #fff;
    padding: 8px 10px;
    z-index: 2000;
    display: none;
    pointer-events: none;
    font-family: var(--font-mono);
    font-size: 11px;
    max-width: 220px;
    line-height: 1.5;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}

/* ── White Mage Passive Gauge ── */

.white-mage-passive-gauge.hidden {
    display: none;
}

.white-mage-passive-gauge {
    width: 60px;
    height: 40px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    box-sizing: border-box;
    position: relative;
    cursor: help;
}

.white-mage-heart-svg,
.white-mage-wing-svg {
    width: 26px;
    height: 30px;
    overflow: visible;
}

.wm-heart-glass,
.wm-wing-glass {
    fill: rgba(255, 255, 255, 0.06);
    stroke: none;
}

.wm-heart-outline {
    fill: none;
    stroke: rgba(255, 105, 180, 0.55);
    stroke-width: 2;
    stroke-linejoin: round;
}

.wm-wing-outline {
    fill: none;
    stroke: rgba(138, 43, 226, 0.55);
    stroke-width: 2;
    stroke-linejoin: round;
}

#wm-heart-liquid-rect {
    transition: y 0.25s ease-out, height 0.25s ease-out;
    animation: wm-heart-hue 5s linear infinite;
}

@keyframes wm-heart-hue {
    0% { filter: hue-rotate(0deg) saturate(1.5) drop-shadow(0 0 4px rgba(255,105,180,0.5)); }
    100% { filter: hue-rotate(360deg) saturate(1.5) drop-shadow(0 0 4px rgba(255,105,180,0.5)); }
}

#wm-wing-liquid-rect {
    transition: y 0.25s ease-out, height 0.25s ease-out;
    animation: wm-wing-hue 5s linear infinite;
}

@keyframes wm-wing-hue {
    0% { filter: hue-rotate(0deg) saturate(1.5) drop-shadow(0 0 4px rgba(138,43,226,0.5)); }
    100% { filter: hue-rotate(360deg) saturate(1.5) drop-shadow(0 0 4px rgba(138,43,226,0.5)); }
}

.wm-heart-shine-sweep {
    pointer-events: none;
    mix-blend-mode: overlay;
    animation: wm-heart-shine-sweep 3.2s ease-in-out infinite;
}

@keyframes wm-heart-shine-sweep {
    0% { transform: translateX(0px); }
    100% { transform: translateX(140px); }
}

.wm-wing-shine-sweep {
    pointer-events: none;
    mix-blend-mode: overlay;
    animation: wm-wing-shine-sweep 3.2s ease-in-out infinite;
}

@keyframes wm-wing-shine-sweep {
    0% { transform: translateX(0px); }
    100% { transform: translateX(140px); }
}

/* ── Rogue Passive Gauge (6 Combo Orbs) ── */
.rogue-passive-gauge.hidden {
    display: none;
}

.rogue-passive-gauge {
    width: 80px;
    height: 24px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    position: relative;
    cursor: help;
}

.rogue-combo-orbs-row {
    display: flex;
    gap: 4px;
    align-items: center;
}

.rogue-combo-orb {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 1.5px solid rgba(255, 215, 0, 0.4);
    transition: all 0.3s ease;
}

.rogue-combo-orb.empty {
    background: rgba(255, 215, 0, 0.08);
    box-shadow: none;
}

.rogue-combo-orb.filled {
    background: radial-gradient(circle at 35% 35%, #ffd700, #b8860b);
    border-color: #ffd700;
    box-shadow: 0 0 6px rgba(255, 215, 0, 0.6), 0 0 12px rgba(255, 215, 0, 0.3);
    animation: rogue-orb-pulse 0.6s ease-in-out;
}

@keyframes rogue-orb-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.35); }
    100% { transform: scale(1); }
}

#rogue-passive-tooltip {
    position: fixed;
    background: rgba(20, 20, 25, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 8px;
    color: #fff;
    padding: 8px 10px;
    z-index: 2000;
    display: none;
    pointer-events: none;
    font-family: var(--font-mono);
    font-size: 11px;
    max-width: 220px;
    line-height: 1.5;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}

/* ── Warlock Passive Gauge (Skull) ── */

.warlock-passive-gauge.hidden {
    display: none;
}

.warlock-passive-gauge {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    position: relative;
    cursor: pointer;
}

.warlock-passive-svg {
    width: 28px;
    height: 30px;
    overflow: visible;
}

.warlock-skull-glass {
    fill: rgba(255, 255, 255, 0.06);
    stroke: none;
}

.warlock-skull-outline {
    fill: none;
    stroke: rgba(125, 42, 232, 0.65);
    stroke-width: 2;
    stroke-linejoin: round;
}

.warlock-skull-eye {
    fill: rgba(10, 0, 20, 0.85);
    pointer-events: none;
}

.warlock-skull-nose {
    fill: rgba(10, 0, 20, 0.7);
    pointer-events: none;
}

#warlock-passive-liquid-rect {
    transition: y 0.25s ease-out, height 0.25s ease-out;
    animation: warlock-prismatic-hue 5s linear infinite;
}

@keyframes warlock-prismatic-hue {
    0% { filter: hue-rotate(0deg) saturate(1.5) drop-shadow(0 0 4px rgba(125, 42, 232, 0.6)); }
    100% { filter: hue-rotate(360deg) saturate(1.5) drop-shadow(0 0 4px rgba(125, 42, 232, 0.6)); }
}

.warlock-liquid-shine-sweep {
    pointer-events: none;
    mix-blend-mode: overlay;
    animation: warlock-shine-sweep 3.2s ease-in-out infinite;
}

@keyframes warlock-shine-sweep {
    0% { transform: translateX(0px); }
    100% { transform: translateX(140px); }
}

#warlock-passive-tooltip {
    position: fixed;
    background: rgba(20, 20, 25, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(125, 42, 232, 0.4);
    border-radius: 8px;
    color: #fff;
    padding: 8px 10px;
    z-index: 2000;
    display: none;
    pointer-events: none;
    font-family: var(--font-mono);
    font-size: 11px;
    max-width: 220px;
    line-height: 1.5;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}

.warlock-passive-tooltip-title {
    color: #c896ff;
}

/* ── Druid Passive Gauge (único, folha de vidro / glassmorphism) ──
   Antes eram 4 "rostos" de forma, só aparecendo o da forma ativa. Agora é um
   único gauge que fica sempre visível durante a batalha (não só quando
   transformado): quando o jogador está transformado, o líquido usa a cor da
   forma ativa (data-form no JS); fora de forma, mostra a forma com mais
   progresso acumulado. O "vidro" é uma folha em CSS puro (formato de folha
   via border-radius, com nervura central), com fundo semi-transparente e
   blur — visual glassmorphism, sem sprite. */

.druid-passive-gauge.hidden {
    display: none;
}

.druid-passive-gauge {
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    padding: 3px 6px;
    flex-shrink: 0;
    position: relative;
    cursor: help;
}

.druid-gauge-glass {
    position: relative;
    width: 36px;
    height: 40px;
    isolation: isolate;
    overflow: hidden;
    border-radius: 0% 100% 0% 100%;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.28),
        inset 0 1px 4px rgba(255, 255, 255, 0.15),
        0 4px 10px rgba(0, 0, 0, 0.3);
    transition: box-shadow 0.3s ease;
}

/* Nervura central da folha, por cima do líquido */
.druid-gauge-glass::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 3px;
    bottom: 8px;
    width: 2px;
    transform: translateX(-50%);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.08));
    z-index: 3;
}

/* Peciolo (cabinho) da folha, por cima do líquido */
.druid-gauge-glass::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 0;
    width: 3px;
    height: 8px;
    transform: translateX(-50%);
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.22);
    z-index: 3;
}

/* Líquido que preenche a folha de baixo pra cima, recortado no formato dela
   (overflow hidden no .druid-gauge-glass). A altura é controlada via JS
   pela porcentagem do gauge; a cor muda pela forma exibida (data-form). */
.druid-gauge-liquid {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 0%;
    pointer-events: none;
    z-index: 1;
    transition: height 0.3s ease-out, background 0.3s ease, box-shadow 0.3s ease;
    background: linear-gradient(180deg, rgba(212, 242, 207, 0.85), rgba(108, 154, 94, 0.85));
    box-shadow: 0 0 8px rgba(108, 154, 94, 0.55);
}

/* Leve brilho translúcido varrendo o vidro, reforçando o efeito glass */
.druid-gauge-liquid-sweep {
    position: absolute;
    left: -30px;
    top: 0;
    width: 20px;
    height: 100%;
    background: linear-gradient(115deg, transparent, rgba(255, 255, 255, 0.35), transparent);
    transform: skewX(-18deg);
    z-index: 2;
    pointer-events: none;
}

/* Cores temáticas por forma (aplicadas via dataset.form no JS) */
.druid-passive-gauge[data-form="bear"] .druid-gauge-liquid {
    background: linear-gradient(180deg, rgba(255, 232, 176, 0.85), rgba(255, 179, 71, 0.85));
    box-shadow: 0 0 8px rgba(255, 179, 71, 0.6);
}
.druid-passive-gauge[data-form="reptile"] .druid-gauge-liquid {
    background: linear-gradient(180deg, rgba(200, 255, 200, 0.85), rgba(76, 175, 80, 0.85));
    box-shadow: 0 0 8px rgba(76, 175, 80, 0.6);
}
.druid-passive-gauge[data-form="mithra"] .druid-gauge-liquid {
    background: linear-gradient(180deg, rgba(255, 208, 208, 0.85), rgba(224, 106, 106, 0.85));
    box-shadow: 0 0 8px rgba(224, 106, 106, 0.6);
}
.druid-passive-gauge[data-form="dryad"] .druid-gauge-liquid {
    background: linear-gradient(180deg, rgba(212, 242, 207, 0.85), rgba(108, 154, 94, 0.85));
    box-shadow: 0 0 8px rgba(108, 154, 94, 0.6);
}

/* Quando uma forma está de fato ativa (transformado), a folha ganha um
   contorno mais vivo pra reforçar que o bônus está sendo usado agora. */
.druid-passive-gauge[data-active-form]:not([data-active-form=""]) .druid-gauge-glass {
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.5),
        inset 0 1px 4px rgba(255, 255, 255, 0.2),
        0 0 10px rgba(255, 255, 255, 0.25),
        0 4px 10px rgba(0, 0, 0, 0.3);
}

#druid-passive-tooltip {
    position: fixed;
    background: rgba(20, 20, 25, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(150, 220, 150, 0.35);
    border-radius: 8px;
    color: #fff;
    padding: 8px 10px;
    z-index: 2000;
    display: none;
    pointer-events: none;
    font-family: var(--font-mono);
    font-size: 11px;
    max-width: 240px;
    line-height: 1.5;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}

.druid-passive-tooltip-title {
    color: #a8e6a0;
    font-weight: bold;
    margin-bottom: 4px;
}

.druid-passive-tooltip-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.druid-passive-tooltip-label {
    color: #aaa;
}

.druid-passive-tooltip-value {
    color: #fff;
}

.druid-passive-tooltip-bonus {
    color: #8aff8a;
}

.druid-passive-tooltip-note {
    color: #888;
    margin-top: 4px;
    font-size: 10px;
}

/* ── Time Mage passive gauge: relógio de bolso (Chronos) ──
   Um único gauge sempre visível durante a batalha pra classe Time Mage.
   O relógio enche de baixo pra cima com "cronoplasma" azul; o ponteiro de
   minutos gira conforme o progresso (ver updateTimeMagePassiveGauge). */
.time-mage-passive-gauge.hidden {
    display: none;
}

.time-mage-passive-gauge {
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    padding: 3px 6px;
    flex-shrink: 0;
    position: relative;
    cursor: help;
}

.time-mage-passive-svg {
    width: 40px;
    height: 40px;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.45));
}

.time-mage-clock-glass {
    fill: rgba(255, 255, 255, 0.06);
}

.time-mage-clock-outline {
    fill: none;
    stroke: rgba(165, 243, 252, 0.55);
    stroke-width: 1.5;
}

.time-mage-clock-tick {
    stroke: rgba(165, 243, 252, 0.5);
    stroke-width: 1.2;
}

.time-mage-clock-hour {
    stroke: rgba(240, 249, 255, 0.75);
    stroke-width: 2;
    stroke-linecap: round;
}

.time-mage-clock-minute {
    stroke: rgba(147, 197, 253, 0.9);
    stroke-width: 1.6;
    stroke-linecap: round;
    transition: transform 0.4s ease-out;
    transform-origin: 32px 32px;
}

.time-mage-clock-pin {
    fill: #f0f9ff;
}

.time-mage-liquid-shine-sweep {
    fill: url(#time-mage-liquid-shine);
    animation: timeMageShineSweep 2.6s ease-in-out infinite;
}

@keyframes timeMageShineSweep {
    0%, 100% { transform: translateX(0); opacity: 0.4; }
    50% { transform: translateX(54px); opacity: 0.9; }
}

#time-mage-passive-tooltip {
    position: fixed;
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(147, 197, 253, 0.4);
    border-radius: 8px;
    color: #fff;
    padding: 8px 10px;
    z-index: 2000;
    display: none;
    pointer-events: none;
    font-family: var(--font-mono);
    font-size: 11px;
    max-width: 240px;
    line-height: 1.5;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}

.time-mage-passive-tooltip-title {
    color: #93c5fd;
    font-weight: bold;
    margin-bottom: 4px;
}

.time-mage-passive-tooltip-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.time-mage-passive-tooltip-label {
    color: #aaa;
}

.time-mage-passive-tooltip-value {
    color: #fff;
}

.time-mage-passive-tooltip-note {
    color: #888;
    margin-top: 4px;
    font-size: 10px;
}

/* ── Bard Passive Gauge (Performance) ──
   Disco dourado com uma nota musical; o líquido sobe conforme o gauge enche
   (cada canção de cura/buff +25, máx 100). Ao chegar em 100 a próxima canção
   é amplificada em +50% e o líquido zera (ver updateBardPassiveGauge). */

.bard-passive-gauge.hidden {
    display: none;
}

.bard-passive-gauge {
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    padding: 3px 6px;
    flex-shrink: 0;
    position: relative;
    cursor: help;
}

.bard-passive-svg {
    width: 40px;
    height: 40px;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.45));
}

.bard-note-glass {
    fill: rgba(255, 255, 255, 0.06);
}

.bard-note-outline {
    fill: none;
    stroke: rgba(251, 191, 36, 0.55);
    stroke-width: 1.5;
}

.bard-note-head {
    fill: rgba(253, 230, 138, 0.9);
    stroke: rgba(217, 119, 6, 0.8);
    stroke-width: 1;
}

.bard-note-stem {
    stroke: rgba(253, 230, 138, 0.9);
    stroke-width: 2;
    stroke-linecap: round;
}

.bard-note-pin {
    fill: #fef3c7;
}

.bard-empowered-star {
    fill: rgba(251, 191, 36, 0.9);
}

.bard-liquid-shine-sweep {
    fill: url(#bard-liquid-shine);
    animation: bardShineSweep 2.6s ease-in-out infinite;
}

@keyframes bardShineSweep {
    0%, 100% { transform: translateX(0); opacity: 0.4; }
    50% { transform: translateX(54px); opacity: 0.9; }
}

#bard-passive-tooltip {
    position: fixed;
    background: rgba(28, 25, 23, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(251, 191, 36, 0.4);
    border-radius: 8px;
    color: #fff;
    padding: 8px 10px;
    z-index: 2000;
    display: none;
    pointer-events: none;
    font-family: var(--font-mono);
    font-size: 11px;
    max-width: 240px;
    line-height: 1.5;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}

.bard-passive-tooltip-title {
    color: #fbbf24;
    font-weight: bold;
    margin-bottom: 4px;
}

.bard-passive-tooltip-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.bard-passive-tooltip-label {
    color: #aaa;
}

.bard-passive-tooltip-value {
    color: #fff;
}

.bard-passive-tooltip-note {
    color: #888;
    margin-top: 4px;
    font-size: 10px;
}

/* ── Glamber Passive (Luck Gauge) ── */
.glamber-passive-gauge.hidden {
    display: none;
}

.glamber-passive-gauge {
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    padding: 3px 6px;
    flex-shrink: 0;
    position: relative;
    cursor: help;
}

.glamber-passive-svg {
    width: 40px;
    height: 40px;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.45));
}

.glamber-dice-glass {
    fill: rgba(255, 255, 255, 0.06);
}

.glamber-dice-outline {
    fill: none;
    stroke: rgba(52, 211, 153, 0.55);
    stroke-width: 1.5;
}

.glamber-dice-pip {
    fill: rgba(110, 231, 183, 0.9);
}

.glamber-dice-pin {
    fill: #ecfdf5;
}

.glamber-bonus-star {
    fill: rgba(251, 191, 36, 0.9);
}

.glamber-liquid-shine-sweep {
    fill: url(#glamber-liquid-shine);
    animation: glamberShineSweep 2.6s ease-in-out infinite;
}

@keyframes glamberShineSweep {
    0%, 100% { transform: translateX(0); opacity: 0.4; }
    50% { transform: translateX(54px); opacity: 0.9; }
}

#glamber-passive-tooltip {
    position: fixed;
    background: rgba(28, 25, 23, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(52, 211, 153, 0.4);
    border-radius: 8px;
    color: #fff;
    padding: 8px 10px;
    z-index: 2000;
    display: none;
    pointer-events: none;
    font-family: var(--font-mono);
    font-size: 11px;
    max-width: 240px;
    line-height: 1.5;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}

.glamber-passive-tooltip-title {
    color: #34d399;
    font-weight: bold;
    margin-bottom: 4px;
}

.glamber-passive-tooltip-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.glamber-passive-tooltip-label {
    color: #aaa;
}

.glamber-passive-tooltip-value {
    color: #fff;
}

.glamber-passive-tooltip-note {
    color: #888;
    margin-top: 4px;
    font-size: 10px;
}

/* ── Warlock Summon Hotbar (5 slots) ──
   Antes era um painel flutuante próprio (position: fixed, bottom: 90px),
   aberto ao clicar na caveira da passiva. Agora vive grudada dentro de
   #hotbar-wrapper, como mais um grupo de slots na mesma barra - por isso
   não tem mais posicionamento/fundo próprio, só um separador sutil pra
   distinguir visualmente do grupo de magias. */

.warlock-summon-hotbar.hidden {
    display: none;
}

.warlock-summon-hotbar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding-left: 10px;
    margin-left: 4px;
    border-left: 1px solid rgba(125, 42, 232, 0.4);
}

.warlock-summon-slot {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 2px solid rgba(125, 42, 232, 0.35);
    background: rgba(46, 8, 84, 0.35);
    background-size: cover;
    background-position: center;
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Frame estático do monstro capturado/invocado, desenhado via
   drawBattleMonsterIcon (mesma função dos chips da timeline de turnos).
   Sem animação — só redesenha quando o estado do slot muda. */
.warlock-summon-slot-canvas {
    display: block;
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    pointer-events: none;
}

.warlock-summon-slot.occupied {
    border-color: rgba(57, 255, 136, 0.8);
    box-shadow: 0 0 8px rgba(57, 255, 136, 0.4);
    cursor: pointer;
}

/* Botão X de remover a criatura capturada do acervo de Demonic Pact
   (ver refreshSummonSlotRemoveButton no client). Só aparece quando o slot
   tem uma criatura capturada — se o slot estiver vazio, some. Fica sempre
   no canto superior direito do slot, no mesmo estilo glassmorphism roxo da
   hotbar de invocação. */
.warlock-summon-slot-remove {
    position: absolute;
    top: 1px;
    right: 1px;
    width: 13px;
    height: 13px;
    line-height: 11px;
    font-size: 10px;
    font-weight: bold;
    text-align: center;
    color: #fff;
    background: rgba(125, 42, 232, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, 0.55);
    border-radius: 50%;
    cursor: pointer;
    z-index: 3;
    padding: 0;
    box-sizing: border-box;
    display: none;
    transition: background 0.15s ease, transform 0.15s ease;
}

.warlock-summon-slot-remove.visible {
    display: block;
}

.warlock-summon-slot-remove:hover {
    background: rgba(255, 60, 90, 0.85);
    transform: scale(1.15);
}

.warlock-summon-slot-remove:active {
    transform: scale(0.95);
}

/* Criatura capturada via Demonic Pact, disponível pra invocar (Rise) mas
   ainda não invocada em campo. Cor diferente de .occupied (invocação viva)
   pra não confundir os dois estados. */
.warlock-summon-slot.captured {
    border-color: rgba(255, 180, 60, 0.75);
    box-shadow: 0 0 6px rgba(255, 180, 60, 0.35);
    cursor: pointer;
}

/* Criatura capturada selecionada como alvo do próximo cast de Rise (ver
   setupWarlockSummonHotbarClicks). Sempre aplicada em cima de .captured —
   borda mais clara + pulso sutil pra deixar óbvio qual criatura vai ser
   invocada no próximo clique de tile. */
.warlock-summon-slot.captured.selected-for-rise {
    border-color: rgba(255, 220, 140, 0.95);
    box-shadow: 0 0 10px rgba(255, 200, 90, 0.65);
    animation: warlock-rise-pulse 1.1s ease-in-out infinite;
}

@keyframes warlock-rise-pulse {
    0%, 100% { box-shadow: 0 0 10px rgba(255, 200, 90, 0.65); }
    50% { box-shadow: 0 0 16px rgba(255, 200, 90, 0.9); }
}

/* Tooltip com as infos do monstro ao passar o mouse (ou tocar, no mobile)
   num slot da hotbar de invocação - ver showWarlockSummonTooltip. Mesmo
   estilo glassmorphism roxo das outras tooltips do Warlock. */
#warlock-summon-tooltip {
    position: fixed;
    background: rgba(20, 20, 25, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(125, 42, 232, 0.4);
    border-radius: 8px;
    color: #fff;
    padding: 8px 10px;
    z-index: 2000;
    display: none;
    pointer-events: none;
    font-family: var(--font-mono);
    font-size: 11px;
    max-width: 220px;
    line-height: 1.5;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}

#white-mage-passive-tooltip {
    position: fixed;
    background: rgba(20, 20, 25, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 8px;
    color: #fff;
    padding: 8px 10px;
    z-index: 2000;
    display: none;
    pointer-events: none;
    font-family: var(--font-mono);
    font-size: 11px;
    max-width: 220px;
    line-height: 1.5;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}

.stat-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px; /* Reduzido para caber melhor */
    font-family: var(--font-mono);
    font-weight: bold;
    color: white;
    text-shadow: 1px 1px 0 #000; /* Sombra reduzida para menos volume */
    white-space: nowrap; /* Garante que o texto não quebre a linha */
    z-index: 2;
}

/* --- HUD: PARTY (Grupo) — painel único glassmorphism, arrastável --- */
#party-hud {
    position: fixed;
    top: 90px;
    left: 14px;
    display: none; /* alternado via JS: flex quando há grupo, none quando não há */
    flex-direction: column;
    gap: 0;
    min-width: 190px;
    max-width: 230px;
    background: rgba(15, 15, 18, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    overflow: hidden;
    pointer-events: auto;
    z-index: 2000;
    --party-icon-size: 34px;
}

.party-hud-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.06);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    cursor: grab;
    user-select: none;
    touch-action: none;
}

.party-hud-header:active {
    cursor: grabbing;
}

.party-hud-grip {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.45);
    line-height: 1;
    letter-spacing: -1px;
}

.party-hud-title {
    font-family: var(--font-pixel);
    font-size: 11px;
    color: #fff;
    text-shadow: 1px 1px 0 #000;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#party-hud-list {
    display: flex;
    flex-direction: column;
    padding: 6px;
    gap: 4px;
}

.party-entry-wrap {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    font-family: var(--font-pixel);
    text-shadow: 1px 1px 0 #000;
    color: #fff;
    position: relative;
    pointer-events: auto;
    padding: 5px 6px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    transition: background 0.15s;
}

.party-entry-wrap:hover {
    background: rgba(255, 255, 255, 0.08);
}

.party-entry {
    flex: 0 0 auto;
    width: var(--party-icon-size);
    height: var(--party-icon-size);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    box-shadow: inset 2px 2px 4px #000;
    overflow: hidden;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    position: relative;
}

.party-entry-info {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.party-leader-icon {
    position: absolute;
    left: -2px;
    top: -2px;
    color: var(--gold);
    font-size: 10px;
    line-height: 1;
    z-index: 2;
}

.party-leader-level {
    font-size: 9px;
    color: #ffd36a;
    line-height: 1;
    white-space: nowrap;
}

.party-bonus-row {
    display: flex;
    align-items: center;
    gap: 3px;
    flex-wrap: wrap;
}

.party-bonus-tag {
    font-size: 8px;
    color: #ffd36a;
    background: rgba(0, 0, 0, 0.35);
    padding: 1px 3px;
    border-radius: 3px;
    line-height: 1.3;
    pointer-events: none;
    white-space: nowrap;
}

.party-drop-tag {
    font-size: 8px;
    color: #8fd3ff;
    background: rgba(0, 0, 0, 0.35);
    padding: 1px 3px;
    border-radius: 3px;
    line-height: 1.3;
    pointer-events: none;
    white-space: nowrap;
}

.party-entry-name {
    font-size: 10px;
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 4px;
}

.party-entry-hpbar {
    width: 100%;
    height: 5px;
    border-radius: 3px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.15);
    overflow: hidden;
}

.party-entry-hpbar-fill {
    height: 100%;
    background: linear-gradient(180deg, #ff6b6b, #d13e3e);
    border-radius: 2px 0 0 2px;
    transition: width 0.2s ease;
}

.party-leave-btn {
    position: absolute;
    right: 4px;
    top: 4px;
    font-size: 8px;
    line-height: 1;
    color: #fff;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 14px;
    height: 14px;
    padding: 0;
    cursor: pointer;
    z-index: 2;
    pointer-events: auto;
    flex: 0 0 auto;
}

.party-leave-btn:hover {
    background: rgba(210, 60, 60, 0.7);
}

.party-kick-btn {
    border-color: rgba(210, 90, 90, 0.4);
}

.party-kick-btn:hover {
    background: rgba(210, 60, 60, 0.85);
}

#party-tooltip {
    position: fixed;
    background: rgba(0, 0, 0, 0.9);
    border: 2px solid #fff;
    color: #fff;
    padding: 6px 8px;
    font-family: var(--font-pixel);
    font-size: 11px;
    z-index: 1200;
    pointer-events: none;
    white-space: nowrap;
}

/* --- Target frame (popup de alvo estilo WoW) ---
   Agora é uma classe, não um id: vários mobs podem ter popup aberto ao
   mesmo tempo, um elemento .target-frame por mob. Cada um é arrastável
   (via makeDraggable, mesmo helper usado no resto da HUD de batalha) -
   por isso cursor "move" no corpo do popup e "pointer" só no botão de
   fechar, que o helper de drag já ignora. */
.target-frame {
    position: fixed;
    min-width: 200px;
    max-width: 260px;
    background: rgba(20, 20, 20, 0.55);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 10px 12px;
    color: #fff;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    z-index: 1500;
    display: none;
    pointer-events: auto;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
    max-height: calc(100vh - 110px);
    overflow-y: auto;
    cursor: move;
    user-select: none;
}
.target-frame-close {
    float: right;
    background: none;
    border: none;
    color: #ccc;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 0;
}
.target-frame-close:hover {
    color: #fff;
}
.target-frame-preview-wrap {
    display: flex;
    justify-content: center;
    clear: both;
    margin: 2px 0 8px;
}
.target-frame-preview {
    width: 64px;
    height: 64px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    image-rendering: pixelated;
}
.target-frame-threat-section {
    margin-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    padding-top: 6px;
}
.target-frame-threat-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 3px;
    flex-wrap: wrap;
}
.target-frame-threat-name {
    min-width: 0;
    flex: 0 1 auto;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.target-frame-threat-bar-bg {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    min-width: 40px;
}
.target-frame-threat-bar-fill {
    height: 100%;
}
.target-frame-threat-pct {
    flex: 0 0 auto;
    font-size: 10px;
    color: #ccc;
}
.target-frame-gap {
    font-size: 10px;
    color: #ffc800;
    width: 100%;
}

.hp-fill { background: #d13e3e; }
.mp-fill { background: #3e5fd1; }

/* --- JANELAS FLUTUANTES (Upscaled) --- */
#status-container,
.ui-scroll-window {
    position: fixed;
    background: var(--ui-bg);
    border: 3px outset var(--ui-border-light);
    box-shadow: 3px 3px 5px rgba(0, 0, 0, 0.5);
    pointer-events: auto;
    z-index: 99;
    display: flex;
    flex-direction: column;
    font-family: var(--font-pixel);
    color: var(--color-text-main);
}

#chat-container {
    position: fixed;
    top: 8px;
    left: 12px;
    right: auto;
    width: 460px;
    max-width: min(480px, calc(100vw - 24px));
    z-index: 900;
    display: flex;
    flex-direction: column;
    pointer-events: auto;
    font-family: var(--font-pixel);
    color: var(--color-text-main);
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

#chat-container.hidden { display: none; }

/* Estado minimizado: só a prévia da última mensagem (1 linha). Clicar expande. */
#chat-container.collapsed {
    height: 26px;
}
#chat-container.collapsed #chat-log,
#chat-container.collapsed #chat-input-row {
    display: none;
}
#chat-container.collapsed #chat-preview {
    display: flex;
}

/* Estado expandido: log único rolável + linha de digitação */
#chat-container.expanded #chat-log {
    display: block;
}
#chat-container.expanded #chat-input-row {
    display: flex;
}
#chat-container.expanded #chat-preview {
    display: none;
}

/* Prévia (estado minimizado): mostra a última mensagem recebida, sem edição */
#chat-preview {
    display: none;
    align-items: center;
    height: 100%;
    padding: 0 10px;
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 12px;
    color: rgba(255, 255, 255, 0.75);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background 0.15s ease;
}
#chat-preview:hover {
    background: rgba(255, 255, 255, 0.06);
}

/* Log único: todas as mensagens juntas, cor por canal (estilo Mystera) */
#chat-log {
    display: none;
    flex: 0 1 auto;
    max-height: 180px;
    min-height: 56px;
    overflow-y: auto;
    padding: 6px 8px;
    scrollbar-width: thin;
    scrollbar-color: #666 #000;
    font-family: var(--font-mono);
    background: rgba(0, 0, 0, 0.2);
}

.chat-line {
    margin: 0 0 4px 0;
    font-size: 12px;
    line-height: 1.35;
    word-wrap: break-word;
    color: #e8e8e8;
    text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.8);
    animation: chatLineIn 0.15s ease;
    transition: opacity 0.8s ease;
}
.chat-line.chat-fading { opacity: 0.2; }

@keyframes chatLineIn {
    from { opacity: 0; transform: translateY(2px); }
    to   { opacity: 1; transform: none; }
}

.chat-line .chat-name { font-weight: bold; }

.chat-line.chat-local   { color: #e8e8e8; }
.chat-line.chat-party   { color: #7cf59b; }
.chat-line.chat-guild   { color: #ffa94d; }
.chat-line.chat-global  { color: #c77dff; }
.chat-line.chat-whisper { color: #5ef2a0; }
.chat-line.chat-system  { color: #ffd27a; }
.chat-line.chat-error   { color: #ff6b6b; }

#status-container {
    /* 10px(top) + ~40px(HP/MP) + 6px(gap) + ~30px(XP) + 10px(gap) = ~96px */
    top: 96px;
    left: 10px;
    right: auto;
    /* Encolhe até abraçar o conteúdo: sem borda/sobra sobrando */
    width: auto;
    min-width: 132px;
    max-width: 240px;
    max-height: 300px;
    z-index: 98;
    background: rgba(15, 15, 18, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    overflow: hidden;
}

#status-container.hidden { display: none; }

/* --- SKILLS WINDOW (Skillbook) --- */
#skills-window {
    width: 240px;
    max-height: 260px;
    min-height: 0;
    /* Ao lado da janela de status (max-width 240px @ left 10px) */
    left: 262px;
    top: 96px;
    z-index: 98;
    background: rgba(15, 15, 18, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#skillbook-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

#skillbook-list::-webkit-scrollbar {
    width: 6px;
}

#skillbook-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

#skillbook-list::-webkit-scrollbar-track {
    background: transparent;
}

.skillbook-empty {
    font-size: 11px;
    color: #9a9a9a;
    text-align: center;
    padding: 10px 4px;
}

.skillbook-row {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    padding: 5px 8px;
    cursor: pointer;
}

.skillbook-row.selected {
    outline: 1px solid #9b30ff;
    outline-offset: 0;
    background: rgba(157, 78, 221, 0.12);
}

.skillbook-lvl {
    min-width: 26px;
    text-align: center;
    font-size: 13px;
    color: #fff;
    text-shadow: 1px 1px 0 #000;
}

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

.skillbook-name {
    display: block;
    font-size: 11px;
    color: #eaeaea;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Títulos de seção da janela de skills (Combat / Professions) */
.skillbook-section-title {
    font-size: 10px;
    font-weight: bold;
    letter-spacing: 1px;
    color: #f0c96b;
    border-bottom: 1px solid rgba(240, 201, 107, 0.35);
    padding: 6px 4px 3px;
    margin-top: 4px;
    text-shadow: 1px 1px 0 #000;
}

.skillbook-bar {
    position: relative;
    height: 11px;
    margin-top: 3px;
    background: #101010;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 3px;
    overflow: hidden;
}

.skillbook-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(180deg, #7ec4ff 0%, #3a7bd5 100%);
    transition: width 0.2s ease;
}

.skillbook-bar-pct {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    line-height: 1;
    color: #fff;
    text-shadow: 1px 1px 0 #000;
    pointer-events: none;
}

.ui-scroll-window {
    top: 100px;
    left: 100px;
    transform: none;
    width: 400px;
    min-height: 250px;
    z-index: 150;
}

#skills-window.hidden { display: none !important; }
.ui-scroll-window.hidden { display: none; }

/* --- WORLD MAP (Minimapa do mundo / fog of war Tibia) --- */
#worldmap-window {
    width: 500px;
    height: 250px;
    max-width: 92vw;
    max-height: 82vh;
    min-width: 280px;
    min-height: 170px;
    right: 10px;
    left: auto;
    top: 165px;
    padding: 0;
    background: rgba(10, 12, 16, 0.76);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    overflow: hidden;
}
#worldmap-window.hidden { display: none !important; }
#worldmap-window .ui-scroll-header {
    background: rgba(25, 28, 34, 0.7);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px 8px 0 0;
    padding: 3px 6px;
    gap: 6px;
    cursor: move;
    touch-action: none;
}
#worldmap-window .worldmap-title {
    font-size: 12px;
    letter-spacing: 2px;
    white-space: nowrap;
}
.worldmap-tools {
    display: flex;
    align-items: center;
    gap: 3px;
    margin-left: auto;
}
.worldmap-coords {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.55);
    font-family: var(--font-mono);
    white-space: nowrap;
    margin-right: 4px;
    min-width: 42px;
    text-align: right;
}
.worldmap-tool-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #fff;
    width: 22px;
    height: 20px;
    line-height: 1;
    font-size: 14px;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-pixel);
}
.worldmap-tool-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.35);
}
#worldmap-window .ui-scroll-close {
    width: 22px;
    height: 20px;
    font-size: 12px;
}
#worldmap-canvas-wrap {
    position: relative;
    flex: 1;
    overflow: hidden;
}
#worldmap-canvas {
    display: block;
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
    cursor: grab;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}
#worldmap-canvas.dragging { cursor: grabbing; }
#worldmap-resize-handle {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 18px;
    height: 18px;
    cursor: nwse-resize;
    z-index: 5;
    touch-action: none;
    border-bottom-right-radius: 8px;
    background: linear-gradient(135deg,
        transparent 0,
        transparent 45%,
        rgba(255, 255, 255, 0.35) 45%,
        rgba(255, 255, 255, 0.35) 55%,
        transparent 55%,
        transparent 100%);
}
#worldmap-coords-overlay {
    position: absolute;
    left: 5px;
    bottom: 21px;
    font-size: 10px;
    font-family: var(--font-mono);
    color: rgba(255, 255, 255, 0.6);
    text-shadow: 1px 1px 0 #000;
    pointer-events: none;
    display: none;
    background: rgba(0, 0, 0, 0.35);
    padding: 2px 5px;
    border-radius: 4px;
}

#status-header,
.ui-scroll-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(30, 30, 30, 0.4);
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    padding: 5px 8px;
    color: #fff;
    font-weight: bold;
    font-size: 13px;
    text-shadow: 1px 1px 0 #000;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

#status-header {
    background: rgba(25, 25, 30, 0.6);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px 10px 0 0;
}

#settings-window {
    right: 10px;
    left: auto;
    top: 100px;
    background: rgba(15, 15, 18, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    overflow: hidden;
}

#settings-window .ui-scroll-header {
    background: rgba(25, 25, 30, 0.6);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px 10px 0 0;
}

#settings-content {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* --- OPEN TICKET: glassmorphism alinhado às demais HUDs --- */
#ticket-window {
    right: 10px;
    left: auto;
    top: 100px;
    background: rgba(15, 15, 18, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    overflow: hidden;
}

#ticket-window .ui-scroll-header {
    background: rgba(25, 25, 30, 0.6);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px 10px 0 0;
}

#ticket-content {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 70vh;
    overflow-y: auto;
}

.ticket-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ticket-field label {
    color: #fff;
    font-weight: bold;
    font-size: 13px;
    text-shadow: 1px 1px 0 #000;
}

.ticket-field select,
.ticket-field textarea,
.ticket-field input[type="file"] {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: #fff;
    padding: 8px 10px;
    outline: none;
    font-family: inherit;
}

.ticket-field select:focus,
.ticket-field textarea:focus {
    border-color: rgba(100, 180, 255, 0.5);
}

.ticket-field textarea {
    resize: vertical;
    min-height: 80px;
}

.ticket-file-name {
    color: #bbb;
    font-size: 12px;
    word-break: break-all;
}

.ticket-email-display {
    color: #bbb;
    font-size: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px dashed rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    padding: 8px 10px;
}

.ticket-status {
    color: #ffd166;
    font-size: 13px;
    font-weight: bold;
    min-height: 16px;
}

.ticket-status.success { color: #6bcb77; }
.ticket-status.error { color: #ff7b7b; }

/* --- HUD "My House": glassmorphism alinhado às demais HUDs --- */
#house-mine-window {
    right: 10px;
    left: auto;
    top: 100px;
    background: rgba(15, 15, 18, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    overflow: hidden;
}

#house-mine-window .ui-scroll-header {
    background: rgba(25, 25, 30, 0.6);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px 10px 0 0;
}

#house-mine-content {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 60vh;
    overflow-y: auto;
}

.house-mine-section-title {
    color: #fff;
    font-weight: bold;
    font-size: 13px;
    text-shadow: 1px 1px 0 #000;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    padding-bottom: 4px;
    margin-bottom: 2px;
}

.house-mine-add-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.house-mine-add-row input[type="text"] {
    flex: 1;
    min-width: 120px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: #fff;
    font-family: var(--font-pixel);
    padding: 6px 8px;
    font-size: 12px;
}

.house-mine-add-row input[type="text"]::placeholder { color: rgba(255, 255, 255, 0.45); }

.house-mine-add-row .house-mine-check {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #fff;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
}

.house-mine-add-row .house-mine-check input[type="checkbox"] {
    cursor: pointer;
    accent-color: #6480ff;
}

.house-mine-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 6px 8px;
    margin-bottom: 6px;
}

.house-mine-row-name {
    color: #fff;
    font-size: 12px;
    font-weight: bold;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.house-mine-row-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.house-mine-row-actions label {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    color: #ddd;
    font-size: 11px;
    cursor: pointer;
}

.house-mine-row-actions input[type="checkbox"] { cursor: pointer; accent-color: #6480ff; }

.settings-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    font-weight: bold;
    padding: 8px 10px;
    cursor: pointer;
    text-align: center;
    border-radius: 6px;
}

.settings-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.settings-btn:active { border-style: inset; }

.settings-btn.active {
    background: rgba(100, 180, 255, 0.25);
    border-color: rgba(100, 180, 255, 0.5);
}

.settings-btn.danger {
    background: rgba(184, 50, 50, 0.8);
    border-color: rgba(255, 120, 120, 0.3);
    color: #fff;
}

/* --- WHO'S ONLINE? (HUD de jogadores online) --- */
#whos-online-window {
    right: 10px;
    left: auto;
    top: 100px;
    width: 320px;
    background: rgba(15, 15, 18, 0.78);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    overflow: hidden;
}

#whos-online-window .ui-scroll-header {
    background: rgba(25, 25, 30, 0.6);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px 10px 0 0;
}

.whos-online-count {
    font-size: 11px;
    font-weight: 400;
    color: #4caf50;
}

#whos-online-body {
    display: flex;
    flex-direction: column;
    padding: 8px;
}

#whos-online-list {
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    height: 300px;
    min-height: 80px;
    padding-right: 2px;
}

#whos-online-foot {
    margin-top: 8px;
    display: flex;
}

#whos-online-search {
    width: 100%;
    box-sizing: border-box;
    padding: 6px 8px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 6px;
    color: #fff;
    font-family: var(--font-pixel);
    font-size: 11px;
    outline: none;
}
#whos-online-search:focus { border-color: rgba(255, 255, 255, 0.35); }

.whos-online-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 6px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    flex-shrink: 0;
}

.whos-online-avatar {
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    image-rendering: pixelated;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

.whos-online-mid {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.whos-online-name {
    font-size: 12px;
    font-weight: bold;
    color: #e8e8e8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.whos-online-guild {
    font-size: 10px;
    color: #8ab4f8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.whos-online-btns {
    flex-shrink: 0;
    display: flex;
    gap: 4px;
}
.whos-online-action {
    padding: 2px 6px;
    font-size: 10px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #fff;
    border-radius: 4px;
}
.whos-online-action:hover { background: rgba(255, 255, 255, 0.18); }
.whos-online-action.profile-btn { color: #ffd700; }
.whos-online-action.pm-btn { color: #9bd4ff; }

.whos-online-empty {
    color: #999;
    font-size: 12px;
    text-align: center;
    padding: 24px 0;
}

/* --- RANKING (HUD de classificação) --- */
/* --- HUD DE RANKING (abre por cima do jogo, tela escurecida e centralizada) --- */
#ranking-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.45);
    z-index: 9999;
    pointer-events: auto;
}
#ranking-overlay.hidden { display: none; }

#ranking-window {
    position: relative;
    top: auto;
    left: auto;
    width: 400px !important;
    max-width: 92vw;
    height: 480px !important;
    max-height: 76vh;
    flex: 0 0 480px;
    background: rgba(20, 20, 24, 0.82);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    font-family: var(--font-pixel);
    color: var(--color-text-main);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
#ranking-window .ui-scroll-header {
    gap: 6px;
}
.ranking-nav-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-family: var(--font-pixel);
    font-size: 13px;
    line-height: 1;
    padding: 3px 8px;
}
.ranking-nav-btn:hover { background: rgba(255, 255, 255, 0.18); }
/* Anula o efeito :active global (translate + bordas 3px) que empurrava a hud
   interna ao clicar num botão de navegação do ranking. */
.ranking-nav-btn:active {
    transform: none;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.22);
}
#ranking-title {
    flex: 1;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
#ranking-body {
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    min-height: 0;
    overflow: hidden;
    padding: 8px;
}
#ranking-list {
    overflow-y: auto;
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-right: 2px;
}
.ranking-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 6px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    flex-shrink: 0;
}
.ranking-row.ranking-mine {
    background: rgba(255, 215, 0, 0.12);
    border-color: rgba(255, 215, 0, 0.45);
}
.ranking-row-pos {
    width: 24px;
    flex-shrink: 0;
    text-align: right;
    font-size: 12px;
    font-weight: bold;
    color: #c9c9c9;
}
.ranking-row.pos-1 .ranking-row-pos { color: #ffd700; }
.ranking-row.pos-2 .ranking-row-pos { color: #c0c0c0; }
.ranking-row.pos-3 .ranking-row-pos { color: #cd7f32; }
.ranking-avatar {
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    image-rendering: pixelated;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}
.ranking-row-mid {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
}
.ranking-row-name {
    font-size: 12px;
    font-weight: bold;
    color: #e8e8e8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ranking-row-val {
    flex-shrink: 0;
    font-size: 12px;
    font-weight: bold;
    color: #8be08b;
}
.ranking-empty {
    color: #999;
    font-size: 12px;
    text-align: center;
    padding: 24px 0;
}

#settings-volume {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    padding: 10px;
}

#settings-volume-label {
    font-size: 12px;
    color: #bbb;
    margin-bottom: 6px;
}

#settings-volume-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

#settings-volume-slider {
    flex: 1;
    accent-color: var(--danger-red);
}

#settings-zoom {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    padding: 10px;
}

#settings-zoom-label {
    font-size: 12px;
    color: #bbb;
    margin-bottom: 6px;
}

#settings-zoom-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

#settings-zoom-slider {
    flex: 1;
    accent-color: var(--danger-red);
}

.settings-volume-btn {
    width: 32px;
    height: 28px;
    padding: 0;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    border-radius: 6px;
}

#status-close-btn,
.ui-scroll-close {
    background: #c0392b;
    border: 1px solid #000;
    color: #fff;
    font-weight: bold;
    width: 20px;
    height: 20px;
    cursor: pointer;
    line-height: 18px;
    padding: 0;
    font-family: monospace;
    font-size: 12px;
}

#status-close-btn:hover,
.ui-scroll-close:hover {
    background: #e74c3c;
}

#status-header {
    position: relative;
    justify-content: center;
}

#status-title {
    margin: 0;
    width: 100%;
    text-align: center;
    pointer-events: none;
    font-size: 11px; /* -2px do padrão do header (13px) */
}

#status-close-btn {
    position: absolute;
    right: 6px;
}

/* --- CHAT STYLES --- */

.quest-log-tab {
    flex: 1;
    padding: 6px;
    background: #333;
    color: #888;
    border: 1px solid #000;
    cursor: pointer;
    font-family: var(--font-pixel);
    font-weight: normal;
    font-size: 11px;
}

.quest-log-tab.active {
    background: var(--ui-bg, #2f80ed);
    color: #fff;
    font-weight: bold;
}

#chat-input-row {
    display: none;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.25);
    flex-shrink: 0;
}

#chat-form {
    flex: 1;
    margin: 0;
}

#chat-input {
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.06);
    padding: 5px 8px;
    box-sizing: border-box;
    font-family: var(--font-mono);
    font-size: 12px;
    color: #fff;
    outline: none;
}

#chat-input:focus {
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
}

/* Indicador do canal atual: clicar alterna (trecho "C" do Mystera). */
#chat-channel-badge {
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-family: var(--font-mono);
    font-size: 11px;
    padding: 4px 8px;
    cursor: pointer;
    max-width: 92px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.8);
}
#chat-channel-badge:hover { background: rgba(255, 255, 255, 0.16); }
#chat-channel-badge.badge-local   { color: #e8e8e8; }
#chat-channel-badge.badge-party   { color: #7cf59b; }
#chat-channel-badge.badge-guild   { color: #ffa94d; }
#chat-channel-badge.badge-global  { color: #c77dff; }

/* Pin do chat: fixa as mensagens (perma-chat), em vez do fade-out padrão. */
#chat-pin-btn {
    flex-shrink: 0;
    width: 28px;
    padding: 4px 0;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
}
#chat-pin-btn:hover { background: rgba(255, 255, 255, 0.16); }
#chat-pin-btn.on {
    background: rgba(255, 215, 64, 0.25);
    color: #ffd740;
    border-color: rgba(255, 215, 64, 0.5);
}

/* --- LISTAS (Status) --- */
#status-content {
    padding: 6px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.2);
    min-height: 0;
    flex-shrink: 0;
}

.status-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.status-row {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    font-size: 12px;
}

.status-key {
    color: #e6e6e6;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.status-value {
    text-align: right;
    color: #fff;
}

.status-points-row {
    margin-top: 8px;
    display: grid;
    grid-template-columns: 1fr 70px;
    align-items: center;
    padding: 4px 6px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    font-weight: normal;
    color: #fff;
    font-size: 12px;
}

.status-points-label {
    color: #e6e6e6;
}

.reset-stat-btn {
    margin: 6px auto 0 auto;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-weight: bold;
    cursor: pointer;
    padding: 4px 10px;
    font-size: 12px;
    border-radius: 6px;
}

.reset-stat-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.reset-stat-btn:active { border-style: inset; }

.status-divider {
    margin: 8px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
}

/* --- CHARACTER SELECT FOOTER (PREMIUM TIMER) --- */
.character-select-footer {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
}

.premium-counter {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(25, 25, 25, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 4px 6px;
    min-height: 28px;
    width: 100%;
    box-sizing: border-box;
}

.premium-counter-label {
    font-size: 12px;
    color: #e0e0e0;
    white-space: nowrap;
    line-height: 1;
}

.premium-counter-text {
    font-size: 12px;
    color: #9aa3a9;
    line-height: 1;
}

/* --- CHARACTER SELECT GLASS --- */
#character-select-overlay {
    background: #121212 url('/assets/Interface/Fundos/backgroundlogin.png') no-repeat center center;
    background-size: 100% 100%;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.character-glass-window {
    background: rgba(25, 25, 25, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.character-glass-modal {
    min-width: 280px;
}

.character-select-title {
    font-weight: bold;
    margin-bottom: 10px;
    font-size: 16px;
    text-shadow: 1px 1px 0 #000;
}

.character-glass-card {
    background: rgba(25, 25, 25, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.character-card-title {
    font-weight: bold;
}

.character-card-meta {
    font-size: 12px;
    color: #d7d7d7;
}

.character-card-meta.is-empty {
    color: #b1b1b1;
}

.character-card-actions {
    display: flex;
    gap: 6px;
    margin-top: auto;
}

.character-card-header {
    display: flex;
    gap: 8px;
    align-items: center;
}

.character-preview-canvas {
    width: 80px;
    height: 80px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    image-rendering: pixelated;
}

.character-card-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.character-glass-btn {
    background: rgba(60, 60, 60, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 6px;
    color: #fff;
    font-weight: bold;
    cursor: pointer;
    padding: 6px 12px;
}

.character-glass-btn:hover {
    background: rgba(80, 80, 80, 0.7);
}

.character-glass-btn-danger {
    background: rgba(160, 40, 40, 0.6);
    border-color: rgba(255, 120, 120, 0.35);
}

.character-glass-btn-danger:hover {
    background: rgba(190, 50, 50, 0.7);
}

.character-delete-input {
    width: 100%;
    box-sizing: border-box;
    padding: 9px 12px;
    margin-bottom: 10px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 8px;
    color: #fff;
    font-family: var(--font-mono);
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.character-delete-input:focus {
    background: rgba(0, 0, 0, 0.42);
    border-color: rgba(255, 120, 120, 0.5);
    box-shadow: 0 0 0 3px rgba(190, 50, 50, 0.18);
}


.add-stat-btn {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-weight: bold;
    cursor: pointer;
    margin-left: 0;
    padding: 0 6px;
    font-size: 12px;
    height: 20px;
    border-radius: 4px;
}

.add-stat-btn:active { border-style: inset; }

/* --- BOTÕES HUD (Canto Inferior Direito - AUMENTADO) --- */
#hud-buttons {
    position: fixed;
    bottom: 25px; /* Mais alto por causa da XP bar */
    right: 15px;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: flex-end;
    gap: 8px;
    pointer-events: auto;
    z-index: 95;
    width: auto;
}
#btn-skills.hidden { display: none; }
#btn-house.hidden { display: none; }

/* Botão de abrir o painel de Admin/Mapa: agora vive dentro da própria
   fileira de botões do HUD (#hud-buttons), então nunca fica "solto"
   fora de ordem nem sobrepõe os outros botões. Some por padrão e só
   aparece via JS para contas de admin. */
#tab-toggle-button {
    display: none;
}

.hud-icon {
    width: var(--icon-size);   /* 54px */
    height: var(--icon-size);  /* 54px */
    min-width: var(--icon-size);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

.hud-icon:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
}

.hud-icon:active { 
    transform: scale(0.95);
    background: rgba(255, 255, 255, 0.05);
}

.hud-icon img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    image-rendering: pixelated;
    display: block;
}

/* --- BOTÃO ☰: no PC mostra/esconde a fileira de botões; no mobile abre o leque --- */
/* Estrutura visual herdada do .hud-icon (glassmorphism, quinas arredondadas). */
#hud-fan-toggle {
    order: 999; /* vai pro fim da fileira, como o antigo botão ocultar */
    font-family: var(--font-pixel);
    font-size: 15px;
    line-height: 1;
    user-select: none;
}

#hud-fan-toggle.active {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.45);
}

body.hud-buttons-collapsed .hud-icon-hideable,
body.hud-buttons-collapsed #pvp-toggle-btn {
    display: none !important;
}


/* --- GUILDA (Criar Guild + Editor de Brasão) --- */
.guild-window {
    width: 640px;
    max-width: 92vw;
    background: rgba(15, 15, 18, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    overflow: hidden;
}
.guild-window.guild-window-compact {
    width: 320px;
    min-height: 0;
}
.guild-window .ui-scroll-header {
    background: rgba(25, 25, 30, 0.6);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px 10px 0 0;
}
.guild-create-content {
    padding: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}
.guild-tab {
    width: 100%;
    text-align: center;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    font-weight: bold;
    color: #fff;
    text-shadow: 1px 1px 0 #000;
    font-size: 13px;
    letter-spacing: 0.5px;
    box-sizing: border-box;
}

/* Layout topo: brasão + nome/lvl */
#guild-my-guild-view {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.guild-panel-top {
    width: 100%;
    display: flex;
    align-items: stretch;
    gap: 10px;
}
.guild-crest-display {
    flex: 0 0 64px;
    width: 64px;
    height: 64px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.guild-crest-display.empty {
    font-size: 26px;
    opacity: 0.5;
}
.guild-crest-display canvas {
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
}
.guild-panel-top-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.guild-name-banner {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 204, 0, 0.35);
    border-radius: 10px;
    font-size: 16px;
    font-weight: bold;
    color: var(--gold);
    text-shadow: 1px 1px 0 #000;
    letter-spacing: 0.5px;
    text-align: center;
}
.guild-level-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.guild-level-badge {
    flex: 0 0 auto;
    padding: 5px 10px;
    background: rgba(255, 204, 0, 0.14);
    border: 1px solid rgba(255, 204, 0, 0.45);
    border-radius: 8px;
    font-size: 11px;
    color: var(--gold);
    text-align: center;
    font-weight: bold;
    white-space: nowrap;
}

/* Descrição */
.guild-desc-box {
    width: 100%;
    box-sizing: border-box;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    font-size: 12px;
    color: #ccc;
    min-height: 34px;
}
.guild-desc-edit-btn {
    flex: 0 0 auto;
    background: rgba(255, 204, 0, 0.12);
    border: 1px solid rgba(255, 204, 0, 0.4);
    color: var(--gold);
    border-radius: 6px;
    padding: 2px 7px;
    cursor: pointer;
    font-size: 11px;
}
.guild-desc-edit-btn:hover {
    background: rgba(255, 204, 0, 0.25);
}

/* Barra de EXP (embutida no cabeçalho, ao lado do nível) */
.guild-exp-bar-container {
    position: relative;
    flex: 1;
    box-sizing: border-box;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.15);
    height: 20px;
    border-radius: 10px;
    overflow: hidden;
}
#guild-exp-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #ffd700, #ff8c00);
    transition: width 0.3s;
}
.guild-exp-bar-label {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
    color: #fff;
    text-shadow: 1px 1px 1px rgba(0,0,0,0.9);
    pointer-events: none;
}

/* Lista de membros (tabela) */
.guild-members-label {
    width: 100%;
    box-sizing: border-box;
    text-align: center;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    font-weight: bold;
    color: #fff;
    text-shadow: 1px 1px 0 #000;
    font-size: 12px;
    letter-spacing: 0.5px;
}
.guild-table-wrap {
    width: 100%;
    box-sizing: border-box;
    max-height: 260px;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.25);
}
.guild-members-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 11px;
    color: #ddd;
}
.guild-members-table thead th {
    position: sticky;
    top: 0;
    background: rgba(30, 30, 34, 0.95);
    color: #ffd700;
    text-shadow: 1px 1px 0 #000;
    font-size: 11px;
    padding: 6px 4px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    z-index: 1;
}
.guild-members-table td {
    padding: 5px 4px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    vertical-align: middle;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.guild-members-table tr.guild-member-row:hover td {
    background: rgba(255, 255, 255, 0.05);
}
.guild-members-table .col-char { width: 34px; font-size: 14px; }
.guild-members-table .col-name { width: auto; text-align: left; padding-left: 8px; }
.guild-members-table .col-lvl { width: 36px; }
.guild-members-table .col-rank { width: 100px; }
.guild-members-table .col-pexp { width: 46px; }
.guild-members-table .col-exp { width: 60px; }
.guild-members-table .col-note { width: 130px; }
.guild-status-dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.25);
    box-sizing: border-box;
}
.guild-status-dot.guild-status-online {
    background: #3fdc5a;
    box-shadow: 0 0 4px #3fdc5a;
    border-color: rgba(63, 220, 90, 0.5);
}
.guild-status-dot.guild-status-away {
    background: #ff9800;
    box-shadow: 0 0 4px #ff9800;
    border-color: rgba(255, 152, 0, 0.5);
}
.guild-status-dot.guild-status-offline {
    background: #111;
}
.guild-note-text {
    color: #aaa;
    font-style: italic;
}
.guild-note-edit-btn {
    background: none;
    border: none;
    color: #ffd700;
    cursor: pointer;
    font-size: 10px;
    margin-left: 3px;
    padding: 0 2px;
}
.guild-note-edit-btn:hover {
    color: #fff;
}
.guild-rank-select {
    background: rgba(0,0,0,0.4);
    color: #ddd;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 4px;
    padding: 1px 4px;
    font-size: 10px;
    max-width: 95px;
}
.guild-kick-btn {
    font-size: 10px;
    padding: 1px 6px;
    background: #a33;
    color: #fff;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    margin-left: 3px;
}
.guild-kick-btn:hover {
    background: #c33 !important;
}

/* Ações + contribuição */
.guild-actions-row-btns {
    width: 100%;
    box-sizing: border-box;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.guild-actions-row-btns .guild-btn-create,
.guild-actions-row-btns .guild-btn-cancel {
    flex: 1;
    min-width: 0;
    font-size: 11px;
    padding: 6px 4px;
}
.guild-pexp-edit-btn {
    background: none;
    border: none;
    color: #ffd700;
    cursor: pointer;
    font-size: 10px;
    margin-left: 3px;
    padding: 0 2px;
}
.guild-pexp-edit-btn:hover {
    color: #fff;
}

.guild-crest-window {
    top: 90px;
    left: 50%;
    transform: translateX(-50%);
    width: 460px;
    background: rgba(15, 15, 18, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 14px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    overflow: hidden;
    z-index: 160;
}
.guild-crest-window .ui-scroll-header {
    background: rgba(25, 25, 30, 0.6);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px 14px 0 0;
    justify-content: center;
    position: relative;
}
.guild-crest-window .ui-scroll-header span {
    letter-spacing: 1px;
}
.guild-crest-window .ui-scroll-close {
    position: absolute;
    right: 8px;
}
.guild-crest-content {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.guild-name-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.guild-name-row label {
    color: #ddd;
    font-size: 13px;
    font-weight: bold;
    text-shadow: 1px 1px 0 #000;
}
.guild-input {
    flex: 1;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    padding: 6px 10px;
    color: #fff;
    font-family: var(--font-pixel);
    font-size: 13px;
    box-sizing: border-box;
}
.guild-input:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.45);
}
.guild-editor-row {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    justify-content: center;
}
.guild-canvas-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
.guild-crest-grid {
    --guild-cell-size: 26px;
    display: grid;
    grid-template-columns: repeat(12, var(--guild-cell-size));
    grid-template-rows: repeat(12, var(--guild-cell-size));
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 8px;
    padding: 4px;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
    user-select: none;
}
.guild-crest-cell {
    width: var(--guild-cell-size);
    height: var(--guild-cell-size);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-sizing: border-box;
    cursor: crosshair;
}
.guild-crest-cell:hover {
    border-color: rgba(255, 255, 255, 0.35);
}
.guild-palette-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 110px;
}
.guild-palette-title {
    text-align: center;
    font-size: 12px;
    font-weight: bold;
    color: #ddd;
    text-shadow: 1px 1px 0 #000;
    line-height: 1.3;
}
.guild-color-wheel {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    cursor: crosshair;
    border: 2px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}
.guild-brightness-slider {
    width: 100px;
    accent-color: var(--gold);
    cursor: pointer;
}
.guild-color-preview {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.35);
    box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.5);
    background: #d60000;
}
.guild-color-preview.eraser-active {
    background-image:
        linear-gradient(45deg, #666 25%, transparent 25%, transparent 75%, #666 75%),
        linear-gradient(45deg, #666 25%, #444 25%, #444 75%, #666 75%);
    background-size: 8px 8px;
    background-position: 0 0, 4px 4px;
}
.guild-clear-btn {
    background: rgba(214, 0, 0, 0.25);
    border: 1px solid rgba(255, 120, 120, 0.4);
    color: #fff;
    font-size: 11px;
    padding: 5px 8px;
    border-radius: 6px;
    cursor: pointer;
    font-family: var(--font-pixel);
    width: 100%;
}
.guild-clear-btn:hover {
    background: rgba(214, 0, 0, 0.4);
}
.guild-actions-row {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 4px;
}
.guild-btn-cancel,
.guild-btn-create {
    min-width: 100px;
    padding: 8px 18px;
    border-radius: 20px;
    font-weight: bold;
    font-family: var(--font-pixel);
    font-size: 13px;
    cursor: pointer;
    text-align: center;
    transition: all 0.15s ease;
}
.guild-btn-cancel {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 120, 120, 0.5);
    color: #ff8a8a;
}
.guild-btn-cancel:hover {
    background: rgba(214, 0, 0, 0.2);
}
.guild-btn-create {
    background: rgba(255, 204, 0, 0.12);
    border: 1px solid rgba(255, 204, 0, 0.55);
    color: var(--gold);
}
.guild-btn-create:hover {
    background: rgba(255, 204, 0, 0.25);
}

/* --- INVENTÁRIO (GRID Aumentado) --- */
#inventory-window {
    width: 610px;
    background: rgba(15, 15, 18, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    overflow: hidden;
}

/* --- BANCO (BAU DE DEPÓSITO) --- */
#bank-window {
    width: 650px;
    background: rgba(15, 15, 18, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    overflow: hidden;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 5000;
    max-height: 85vh;
}

#bank-container {
    display: flex;
    flex: 1;
    overflow: hidden;
    gap: 4px;
    padding: 8px;
}

#bank-inventory-section,
#bank-storage-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.bank-section-title {
    font-size: 11px;
    color: rgba(255,255,255,0.7);
    text-align: center;
    padding: 4px 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.bank-count {
    color: rgba(255, 215, 0, 0.75);
    letter-spacing: 0;
    text-transform: none;
    font-size: 10px;
}

#bank-hint {
    flex-shrink: 0;
    text-align: center;
    font-size: 10px;
    color: rgba(255,255,255,0.4);
    padding: 6px 8px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.bank-grid-empty {
    width: 100%;
    text-align: center;
    font-size: 11px;
    color: rgba(255,255,255,0.35);
    font-style: italic;
    padding: 24px 8px;
}

#bank-divider {
    width: 2px;
    background: rgba(255,255,255,0.08);
    border-radius: 2px;
    flex-shrink: 0;
}

.bank-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    overflow-y: auto;
    flex: 1;
    align-content: flex-start;
    padding: 2px;
    min-height: 200px;
}

.bank-grid::-webkit-scrollbar { width: 8px; }
.bank-grid::-webkit-scrollbar-track { background: rgba(0,0,0,0.2); border-radius: 4px; }
.bank-grid::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }
.bank-grid::-webkit-scrollbar-thumb:hover { background: rgba(255, 215, 0, 0.35); }

.bank-grid .bank-slot {
    width: 36px;
    height: 36px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    position: relative;
    cursor: pointer;
    flex-shrink: 0;
    transition: border-color 0.15s, background 0.15s, transform 0.1s;
}

.bank-grid .bank-slot:hover {
    border-color: rgba(255, 215, 0, 0.5);
    background: rgba(255, 215, 0, 0.05);
    transform: translateY(-1px);
}

.bank-grid .bank-slot:active {
    transform: translateY(0);
}

.bank-grid .bank-slot img {
    max-width: 34px;
    max-height: 34px;
    image-rendering: pixelated;
}

.bank-grid .bank-slot .bank-qtd {
    position: absolute;
    bottom: 1px;
    right: 2px;
    font-size: 9px;
    color: #fff;
    text-shadow: 1px 1px 0 #000;
    pointer-events: none;
}

#cash-shop-window {
    background: rgba(15, 15, 18, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    overflow: hidden;
}

#cash-shop-window .ui-scroll-header {
    position: relative;
    justify-content: center;
    background: rgba(25, 25, 30, 0.6);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px 10px 0 0;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

#cash-shop-window .ui-scroll-header span {
    width: 100%;
    text-align: center;
    pointer-events: none;
}

#cash-shop-window .ui-scroll-close {
    position: absolute;
    right: 6px;
}

#inventory-top-section {
    display: flex;
    gap: 10px;
    padding: 10px;
    background: rgba(0,0,0,0.12);
    margin: 5px;
    border-radius: 4px;
    align-items: flex-start;
    justify-content: center; /* Centraliza os blocos restantes (special/equipment/appearance) */
}

#special-slots {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 6px;
    background: rgba(0, 0, 0, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 4px;
}

#equipment-slots {
    margin: 0;
    padding: 6px;
    background: rgba(0, 0, 0, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 4px;
}

#inventory-grid {
    display: grid;
    /* minmax garante o tamanho mínimo do slot; o 1fr faz cada coluna
       crescer igualmente até ocupar 100% da largura disponível,
       eliminando a faixa vazia à direita sem sobrepor os slots */
    grid-template-columns: repeat(10, minmax(var(--inv-slot-size), 1fr));
    grid-auto-rows: var(--inv-slot-size);
    gap: 3px;
    padding: 8px;
    max-height: 320px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    margin: 8px;
    justify-content: stretch;
    align-content: start;
}

#inventory-window .ui-scroll-header {
    background: rgba(25, 25, 30, 0.6);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px 10px 0 0;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.inventory-glass-panel {
    background: rgba(25, 25, 25, 0.28);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 8px;
    padding: 8px;
    min-width: 190px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

#appearance-preview {
    width: 72px;
    height: 72px;
    align-self: center;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 8px;
    image-rendering: pixelated;
}

.appearance-title {
    font-size: 12px;
    font-weight: bold;
    text-align: center;
    color: #fff;
    text-shadow: 1px 1px 0 #000;
}

.appearance-title-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.appearance-nick-color-swatch {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.5);
    box-shadow: inset 0 0 3px rgba(0, 0, 0, 0.5);
    background: #fff;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
}

.appearance-nick-color-swatch:hover:not(:disabled) {
    border-color: var(--gold, #ffd700);
}

.appearance-nick-color-swatch:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.nick-color-popup {
    width: auto;
}

#nick-color-wheel {
    width: 64px;
    height: 64px;
}

.nick-color-popup .hair-color-popup-body {
    flex-direction: column;
    align-items: center;
    padding: 8px;
    gap: 8px;
}

#nick-color-reset {
    margin: 0 auto;
    display: block;
}

.appearance-row {
    display: grid;
    grid-template-columns: 48px 22px 1fr 22px;
    align-items: center;
    gap: 6px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    padding: 4px 6px;
}

.appearance-label {
    font-size: 11px;
    color: #cfcfcf;
}

.appearance-value {
    font-size: 11px;
    color: #fff;
    text-align: center;
}

.appearance-btn {
    width: 22px;
    height: 22px;
    padding: 0;
    background: rgba(60, 60, 60, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    border-radius: 6px;
    cursor: pointer;
}

.appearance-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.appearance-note {
    font-size: 10px;
    text-align: center;
    color: #ffb4b4;
}

#appearance-panel {
    position: relative;
}

.hair-color-swatch {
    width: 22px;
    height: 22px;
    border-radius: 5px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.5);
    background: #999;
    cursor: pointer;
    padding: 0;
    margin-left: 4px;
    flex-shrink: 0;
}
.hair-color-swatch:hover {
    border-color: var(--gold, #ffd700);
}
.hair-color-popup {
    position: fixed;
    z-index: 10500;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    background: rgba(20, 18, 24, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.hair-color-popup.hidden {
    display: none;
}
.hair-color-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    font-weight: bold;
    color: #fff;
    gap: 12px;
}
.hair-color-popup-close {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    padding: 0 2px;
}
.hair-color-popup-close:hover {
    color: var(--gold, #ffd700);
}
.hair-color-popup-body {
    display: flex;
    align-items: center;
    gap: 8px;
}
.hair-color-wheel {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    cursor: crosshair;
    border: 2px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}
.hair-color-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}
.hair-brightness-slider {
    width: 80px;
    accent-color: var(--gold);
    cursor: pointer;
}
.hair-slider-label {
    width: 80px;
    font-size: 9px;
    color: rgba(255, 255, 255, 0.65);
    text-align: left;
    margin-bottom: -4px;
}
.hair-whiten-slider {
    accent-color: #ffffff;
    background: linear-gradient(to right, rgba(255,255,255,0.08), rgba(255,255,255,0.9));
    border-radius: 4px;
}
.hair-color-reset-btn {
    font-size: 10px !important;
    padding: 2px 8px !important;
    min-width: auto !important;
}
#npc-editor-hair-color-popup,
#npc-editor-outfit-color-popup,
#npc-editor-sprite-color-popup {
    z-index: 10001;
}

.inv-slot {
    width: 100%;   /* Preenche toda a célula da grid (coluna) */
    height: 100%;  /* Preenche toda a célula da grid (linha) */
    min-width: var(--inv-slot-size);
    min-height: var(--inv-slot-size);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    box-sizing: border-box;
    transition: all 0.2s ease;
}

/* Indicador de Soul Binding: símbolo cinza no canto inferior direito do slot */
.soulbound-mark {
    position: absolute;
    right: 2px;
    bottom: 0px;
    font-size: 11px;
    line-height: 1;
    color: #9a9a9a;
    text-shadow: 0 0 2px #000, 0 0 3px #000;
    pointer-events: none;
    z-index: 3;
}

.special-slot {
    width: var(--slot-size);
    height: var(--slot-size);
    background: #333;
    border: 2px solid #555;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    box-shadow: inset 2px 2px 4px #000;
}

.special-slot:empty {
    opacity: 0.45;
    filter: grayscale(100%);
}

.inv-slot:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.inv-slot.selected {
    border: 2px solid #fff;
    box-shadow: 0 0 0 2px #000;
}

.inv-slot:hover {
    background-color: #444;
}

.equip-slot img,
.special-slot img {
    max-width: 42px; /* Ícone dentro do slot maior */
    max-height: 42px;
}

.inv-slot img {
    max-width: 46px; /* Ícone um pouco maior, acompanhando o slot de item maior */
    max-height: 46px;
}

.inv-qtd {
    position: absolute;
    bottom: 2px;
    right: 2px;
    font-size: 12px;
    font-family: var(--font-mono);
    font-weight: bold;
    color: #fff;
    text-shadow: 1px 1px 0 #000;
}

/* --- SISTEMA DE TROCA (TRADE) --- */
#trade-window {
    width: 500px !important;
    background: rgba(15, 15, 18, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    overflow: hidden;
}

#trade-window .ui-scroll-header {
    background: rgba(25, 25, 30, 0.6);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px 10px 0 0;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

#trade-window .ui-scroll-close {
    background: rgba(160, 40, 40, 0.6);
    border: 1px solid rgba(255, 120, 120, 0.35);
    border-radius: 6px;
    color: #fff;
}

#trade-window .ui-scroll-close:hover {
    background: rgba(190, 50, 50, 0.7);
}

.trade-area {
    display: flex;
    gap: 15px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    justify-content: space-between;
    margin: 8px;
}

.trade-side {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    padding: 8px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
}

.trade-side h4 {
    margin: 0 0 8px 0;
    color: #fff;
    font-size: 13px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    width: 100%;
    text-align: center;
    padding-bottom: 6px;
}

.trade-slots-grid {
    background: rgba(0, 0, 0, 0.3);
    padding: 5px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    width: 100%;
    box-sizing: border-box;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: 42px;
    gap: 4px;
    /* Slots ilimitados: o grid cresce conforme itens são adicionados,
       com scroll vertical para não estourar a janela de trade. */
    max-height: 220px;
    overflow-y: auto;
}

.trade-slot {
    width: 42px;
    height: 42px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    border-radius: 4px;
    position: relative;
    cursor: pointer;
}

.trade-actions {
    display: flex;
    gap: 8px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.15);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.trade-btn {
    flex: 1;
    padding: 8px;
    font-size: 12px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 6px;
    color: #fff;
    font-weight: bold;
    cursor: pointer;
}

.trade-btn:hover {
    background: rgba(255, 255, 255, 0.16);
}

/* --- HUD DE CONVITE DE PARTY/TRADE AO CLICAR EM UM ALIADO (glassmorphism, mesmo padrão das outras HUDs) --- */
#ally-invite-hud {
    position: fixed;
    background: rgba(15, 15, 18, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    padding: 6px 2px;
    z-index: 2000;
    min-width: 40px;
    display: none;
    pointer-events: auto;
}

#ally-invite-name {
    font-family: var(--font-pixel);
    font-size: 12px;
    color: #fff;
    text-shadow: 1px 1px 0 #000;
    margin-bottom: 5px;
}

#ally-invite-btn,
#ally-profile-btn,
#ally-shop-btn {
    width: 100%;
    padding: 5px 2px;
    font-family: var(--font-pixel);
    font-size: 11px;
    cursor: pointer;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #fff;
    font-weight: bold;
}

#ally-invite-btn {
    background: rgba(47, 125, 50, 0.7);
}

#ally-invite-btn:hover {
    background: rgba(62, 154, 66, 0.8);
}

#ally-profile-btn {
    margin-top: 4px;
    background: rgba(120, 80, 140, 0.7);
}

#ally-profile-btn:hover {
    background: rgba(150, 100, 175, 0.8);
}

#ally-shop-btn {
    margin-top: 4px;
}

.pvp-indicator {
    color: #ff4444;
    font-weight: bold;
    font-size: 10px;
    margin-left: 4px;
    text-shadow: 0 0 4px rgba(255, 0, 0, 0.5);
}

.hud-icon-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

#pvp-toggle-btn {
    font-family: var(--font-pixel);
    font-size: 20px;
    line-height: 1;
    color: #fff;
    font-weight: bold;
    position: relative;
    background: rgba(120, 30, 30, 0.35);
}

#pvp-toggle-btn:hover {
    background: rgba(140, 40, 40, 0.5);
}

#pvp-toggle-btn .pvp-btn-sword {
    display: block;
    pointer-events: none;
    width: 24px;
    height: 24px;
    object-fit: contain;
}

#pvp-toggle-btn .pvp-btn-off-x {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 22px;
    font-weight: 900;
    color: #ff2222;
    text-shadow: 0 0 3px #000, 0 0 6px rgba(255, 0, 0, 0.7);
    pointer-events: none;
}

#pvp-toggle-btn.active .pvp-btn-off-x {
    display: none;
}

#pvp-toggle-btn.active {
    background: rgba(30, 130, 30, 0.35);
}

#pvp-toggle-btn.active:hover {
    background: rgba(40, 170, 40, 0.5);
}

.pvp-confirm-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    pointer-events: auto;
}

.pvp-confirm-window {
    background: rgba(15, 15, 18, 0.85);
    border: 1px solid rgba(255, 60, 60, 0.3);
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    padding: 16px 20px;
    min-width: 260px;
    text-align: center;
}

.pvp-confirm-window .pvp-confirm-title {
    font-family: var(--font-pixel);
    font-size: 13px;
    color: #ff5555;
    margin-bottom: 10px;
}

.pvp-confirm-window .pvp-confirm-text {
    font-family: var(--font-pixel);
    font-size: 11px;
    color: #ddd;
    margin-bottom: 14px;
}

.pvp-confirm-window .pvp-confirm-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.pvp-confirm-window .pvp-confirm-buttons button {
    padding: 6px 18px;
    font-family: var(--font-pixel);
    font-size: 11px;
    cursor: pointer;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #fff;
    font-weight: bold;
}

.pvp-confirm-accept {
    background: rgba(180, 30, 30, 0.7);
}

.pvp-confirm-accept:hover {
    background: rgba(220, 40, 40, 0.85);
}

.pvp-confirm-decline {
    background: rgba(80, 80, 80, 0.7);
}

.pvp-confirm-decline:hover {
    background: rgba(100, 100, 100, 0.85);
}

/* --- PERFIL DO PERSONAGEM (glassmorphism) --- */
#player-profile-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.45);
    z-index: 9999;
    pointer-events: auto;
}
#player-profile-overlay.hidden { display: none; }

#player-profile-window {
    width: 340px;
    max-width: 92vw;
    background: rgba(20, 20, 24, 0.82);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    font-family: var(--font-pixel);
    color: var(--color-text-main);
    overflow: hidden;
}

#profile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.06);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

#profile-title {
    font-weight: bold;
    font-size: 13px;
    color: #fff;
    text-shadow: 1px 1px 0 #000;
}

#profile-close-btn {
    background: #c0392b;
    border: 1px solid #000;
    color: #fff;
    font-weight: bold;
    width: 20px;
    height: 20px;
    cursor: pointer;
    line-height: 18px;
    padding: 0;
    font-family: monospace;
    font-size: 12px;
}
#profile-close-btn:hover { background: #e74c3c; }

#profile-content {
    padding: 12px;
}

#profile-top-row {
    display: flex;
    gap: 12px;
    align-items: center;
}

#profile-avatar-canvas {
    width: 72px;
    height: 72px;
    border: 2px solid rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.3);
    image-rendering: pixelated;
    flex-shrink: 0;
}

#profile-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

#profile-name {
    font-weight: bold;
    font-size: 15px;
    color: var(--gold);
    text-shadow: 1px 1px 0 #000;
}

#profile-class-level {
    font-size: 12px;
    color: #ccc;
}

#profile-guild-row {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: #8ab4f8;
    margin-top: 2px;
}

#profile-guild-crest-canvas {
    width: 18px;
    height: 18px;
    border-radius: 3px;
    image-rendering: pixelated;
    flex-shrink: 0;
}

#profile-guild-name {
    font-weight: bold;
}

#profile-guild-rank {
    color: #999;
    font-weight: normal;
}

#profile-creation-date {
    font-size: 10px;
    color: #888;
    margin-top: 2px;
}

#profile-divider, #profile-divider2, #profile-divider3 {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin: 10px 0;
}

#profile-message-section {
    position: relative;
}

#profile-message-label {
    font-size: 10px;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

#profile-message-text {
    font-size: 12px;
    color: #ddd;
    min-height: 20px;
    padding: 4px 6px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    word-wrap: break-word;
}

#profile-message-input {
    width: 100%;
    min-height: 40px;
    padding: 6px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: #fff;
    font-family: var(--font-pixel);
    font-size: 12px;
    resize: vertical;
    box-sizing: border-box;
    outline: none;
}
#profile-message-input:focus {
    border-color: rgba(255, 255, 255, 0.35);
}

#profile-message-edit-btn, #profile-message-save-btn, #profile-message-cancel-btn {
    margin-top: 4px;
    padding: 3px 10px;
    font-size: 11px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    border-radius: 6px;
    cursor: pointer;
}
#profile-message-edit-btn:hover, #profile-message-save-btn:hover, #profile-message-cancel-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

#profile-message-edit-btn.hidden,
#profile-message-save-btn.hidden,
#profile-message-cancel-btn.hidden,
#profile-message-input.hidden {
    display: none;
}

#profile-counters {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.profile-counter-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
}

.profile-counter-label {
    font-size: 12px;
    color: #bbb;
}

.profile-counter-value {
    font-size: 14px;
    font-weight: bold;
    color: var(--gold);
}

.profile-counter-value-pvp {
    color: #e74c3c;
    text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.6);
}

/* --- SEÇÃO DE MEDALHAS (perfil) --- */
#profile-medals-section {
    margin-top: 10px;
}

#profile-medals-label {
    font-size: 10px;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
    text-align: center;
}

#profile-medals-hud {
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 2px;
    scrollbar-width: thin; /* Scrollbar discreta */
    scrollbar-color: #555 transparent;
}
#profile-medals-hud::-webkit-scrollbar {
    height: 4px;
}
#profile-medals-hud::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 2px;
}
#profile-medals-hud::-webkit-scrollbar-track {
    background: transparent;
}

#profile-medals-track {
    display: inline-flex;
    gap: 4px;
    padding: 2px 2px 4px 2px;
}

.profile-medal {
    position: relative;
    width: 11px;
    height: 20px;
    flex-shrink: 0;
    border-radius: 2px;
    image-rendering: pixelated;
    overflow: hidden;
}
.profile-medal img {
    width: auto;
    height: 100%;
    image-rendering: pixelated;
    display: block;
}

/* --- PROGRESSÃO PARA IMORTALIDADE (perfil) --- */
#profile-immortality-section {
    margin-top: 16px;
}

#profile-immortality-title {
    font-size: 10px;
    color: #c8a84e;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    text-align: center;
    font-weight: bold;
}

#profile-immortality-container {
    display: flex;
    width: 100%;
    height: 18px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 9px;
    background: rgba(0, 0, 0, 0.45);
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6);
}

#profile-immortality-fill {
    width: 0%;
    height: 100%;
    background: radial-gradient(circle at center, #ffe680 0%, #ffd700 28%, #e0a800 54%, #b8860b 76%, #7a5a00 100%);
    border-radius: 9px;
    transition: width 0.4s ease;
}

#profile-immortality-text {
    margin-top: 6px;
    font-size: 10px;
    color: #cfc08a;
    line-height: 1.4;
    text-align: center;
}

/* --- MENU FLUTUANTE DE AÇÕES DO NPC (Sell/Buy/Dialog/Quest) — glassmorphism, mesmo padrão das outras HUDs --- */
#npc-action-menu {
    position: fixed;
    display: none;
    flex-direction: column;
    gap: 4px;
    background: rgba(15, 15, 18, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    padding: 6px;
    z-index: 2500;
    min-width: 110px;
    transform: translate(-50%, -100%);
    pointer-events: auto;
}

.npc-action-btn {
    width: 100%;
    padding: 6px 10px;
    font-family: var(--font-pixel);
    font-size: 12px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    color: #fff;
    text-align: left;
    transition: background 0.15s, border-color 0.15s;
}

.npc-action-btn:hover {
    background: rgba(62, 95, 209, 0.75);
    border-color: rgba(255, 255, 255, 0.3);
    color: #fff;
}
/* --- HUD DE CONVITE DE PARTY / TRADE (glassmorphism, mesmo padrão da HUD de guilda) --- */
#party-invite-request,

#trade-invite-request {
    position: fixed;
    left: 50%;
    bottom: 40px;
    transform: translateX(-50%);
    background: rgba(15, 15, 18, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    padding: 12px 14px;
    z-index: 2000;
    min-width: 260px;
    text-align: center;
    display: none;
    pointer-events: auto;
}

#trade-invite-request {
    bottom: 110px;
}
#party-invite-text,

#trade-invite-text {
    font-family: var(--font-pixel);
    font-size: 12px;
    color: #fff;
    text-shadow: 1px 1px 0 #000;
    margin-bottom: 10px;
}

/* --- HUD DE CONVITE DE GUILDA (glassmorphism, padrão das outras janelas de guilda) --- */
#guild-invite-request {
    position: fixed;
    left: 50%;
    bottom: 40px;
    transform: translateX(-50%);
    background: rgba(15, 15, 18, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    padding: 12px 14px;
    z-index: 2000;
    min-width: 260px;
    text-align: center;
    display: none;
    pointer-events: auto;
}

#guild-invite-text {
    font-family: var(--font-pixel);
    font-size: 12px;
    color: #fff;
    text-shadow: 1px 1px 0 #000;
    margin-bottom: 10px;
}

#guild-invite-accept,
#guild-invite-decline {
    padding: 6px 10px;
    font-family: var(--font-pixel);
    font-size: 12px;
    cursor: pointer;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #fff;
    font-weight: bold;
}

#guild-invite-accept {
    background: rgba(47, 125, 50, 0.7);
}

#guild-invite-accept:hover {
    background: rgba(62, 154, 66, 0.8);
}

#guild-invite-decline {
    background: rgba(160, 40, 40, 0.6);
    border-color: rgba(255, 120, 120, 0.35);
}

#guild-invite-decline:hover {
    background: rgba(190, 50, 50, 0.7);
}

.party-invite-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
}

#party-invite-accept,
#party-invite-decline,
#trade-invite-accept,
#trade-invite-decline {
    padding: 6px 10px;
    font-family: var(--font-pixel);
    font-size: 12px;
    cursor: pointer;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #fff;
    font-weight: bold;
}

#party-invite-accept,
#trade-invite-accept {
    background: rgba(47, 125, 50, 0.7);
}

#party-invite-decline,
#trade-invite-decline {
    background: rgba(160, 40, 40, 0.6);
    border-color: rgba(255, 120, 120, 0.35);
}

#party-invite-accept:hover,
#trade-invite-accept:hover {
    background: rgba(62, 154, 66, 0.8);
}

#party-invite-decline:hover,
#trade-invite-decline:hover {
    background: rgba(190, 50, 50, 0.7);
}

/* --- BARRA DE XP (Visível) --- */

/* --- TOOLTIPS --- */
#item-tooltip {
    position: fixed;
    background: rgba(0, 0, 0, 0.95);
    border: 2px solid #fff;
    color: white;
    padding: 8px;
    pointer-events: none;
    z-index: 20000 !important;
    display: none;
    font-size: 13px;
    font-family: var(--font-pixel);
    max-width: 250px;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
}

/* ===== ITEM ACTION BAR ===== */
#item-action-bar {
    position: fixed;
    display: flex;
    gap: 3px;
    background: rgba(15, 15, 18, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    padding: 4px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 30000;
    pointer-events: auto;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.item-action-btn {
    padding: 3px 8px;
    font-family: var(--font-pixel);
    font-size: 10px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    color: #fff;
    text-align: center;
    transition: background 0.15s;
    white-space: nowrap;
}

.item-action-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

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

/* ===== ITEM INFO POPUP ===== */
#item-info-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100000;
}

.item-info-box {
    background: rgba(20, 20, 25, 0.8);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 0;
    min-width: 240px;
    max-width: 300px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    color: #eee;
    overflow: hidden;
}

.item-info-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    gap: 10px;
}

.item-info-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.item-info-icon-frame {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 215, 0, 0.35);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.item-info-icon {
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: pixelated;
}

.item-info-title {
    font-size: 13px;
    color: var(--gold);
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-info-close {
    width: 22px;
    height: 22px;
    padding: 0;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: #fff;
    cursor: pointer;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.item-info-close:hover {
    background: rgba(255, 60, 60, 0.3);
    border-color: rgba(255, 60, 60, 0.5);
}

.item-info-body {
    padding: 12px;
    font-size: 12px;
    max-height: 400px;
    overflow-y: auto;
}

/* --- EQUIPAMENTOS --- */
#equipment-slots {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: center;
    background: rgba(0, 0, 0, 0.18);
    padding: 6px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 4px;
    margin: 0;
}

.equip-slot {
    width: var(--slot-size); /* 48px */
    height: var(--slot-size);
    background: #333;
    border: 2px solid #555;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    box-shadow: inset 2px 2px 4px #000;
}

.equip-slot:hover { border-color: #fff; }

.equip-slot:empty {
    opacity: 0.4;
    filter: grayscale(100%);
}

/* --- HOTBAR (REFEITA) --- */
#hotbar-wrapper {
    position: fixed;
    bottom: 15px; /* Um pouco mais baixo */
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 98;
    max-width: calc(100% - 20px);
    transition: opacity 0.3s;
}

#hotbar-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px; /* Gap reduzido */
    background: none;
    padding: 0;
    border: none;
    transition: opacity 0.3s;
}

/* Variante do Warlock: antes tinha uma "chapa" translúcida roxa por trás
   dos dois grupos de slots (magias + invocação); removida a pedido - agora
   fica só com os slots mesmos, sem fundo/borda cobrindo a tela. O
   reposicionamento pro topo central em si é feito via JS
   (applyWarlockHotbarLayout), com !important inline, pra sempre vencer uma
   posição de arraste salva antes de sabermos a classe (ver initHotbarDrag)
   - uma classe CSS sozinha não venceria isso. */
#hotbar-wrapper.hotbar-wrapper-warlock {
    flex-wrap: wrap;
    justify-content: center;
    row-gap: 6px;
}

/* Slots só um pouco maiores que o padrão (28px), pra caber o ícone da
   invocação sem destoar muito do resto da hotbar. */
.hotbar-wrapper-warlock .hotbar-slot {
    width: 30px;
    height: 30px;
    min-width: 30px;
}

.hotbar-wrapper-warlock .warlock-summon-slot {
    width: 34px;
    height: 34px;
}

/* Empilhada acima da barra de magias (própria linha, centralizada) em vez
   de lateral (grudada do lado, mesma linha) - vira flex-basis: 100%
   dentro do #hotbar-wrapper (que já tem flex-wrap na variante warlock),
   forçada pro topo via order:-1. Sem borda separadora (ver acima, painel
   de fundo removido) - só um espaço embaixo pra separar das duas linhas. */
.hotbar-wrapper-warlock .warlock-summon-hotbar {
    flex: 0 0 100%;
    order: -1;
    justify-content: center;
    border-left: none;
    padding-left: 0;
    margin-left: 0;
    margin-bottom: 6px;
}

/* Botão lateral para alternar o layout da hotbar */
#hotbar-layout-btn {
    flex: 0 0 auto;
    width: 22px;
    height: 28px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.7);
    font-family: var(--font-pixel);
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: auto !important;
}

#hotbar-layout-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    color: #fff;
    transform: translateY(-2px);
}

#hotbar-layout-btn:active {
    transform: scale(0.9);
}

/* Layouts alternativos em grade (alternados pelo botão lateral) */
#hotbar-container.hotbar-layout-grid-1,
#hotbar-container.hotbar-layout-grid-2 {
    display: grid;
    flex-wrap: nowrap;
    justify-content: center;
    align-content: center;
    gap: 6px;
}

#hotbar-container.hotbar-layout-grid-1 {
    grid-template-columns: repeat(5, 28px);
    grid-template-rows: repeat(3, 28px);
}
#hotbar-container.hotbar-layout-grid-1 .hotbar-slot[data-key="1"] { grid-column: 1; grid-row: 1; }
#hotbar-container.hotbar-layout-grid-1 .hotbar-slot[data-key="2"] { grid-column: 2; grid-row: 1; }
#hotbar-container.hotbar-layout-grid-1 .hotbar-slot[data-key="3"] { grid-column: 3; grid-row: 1; }
#hotbar-container.hotbar-layout-grid-1 .hotbar-slot[data-key="4"] { grid-column: 4; grid-row: 1; }
#hotbar-container.hotbar-layout-grid-1 .hotbar-slot[data-key="5"] { grid-column: 5; grid-row: 1; }
#hotbar-container.hotbar-layout-grid-1 .hotbar-slot[data-key="attack"] { grid-column: 3; grid-row: 2; }
#hotbar-container.hotbar-layout-grid-1 .hotbar-slot[data-key="6"] { grid-column: 1; grid-row: 3; }
#hotbar-container.hotbar-layout-grid-1 .hotbar-slot[data-key="7"] { grid-column: 2; grid-row: 3; }
#hotbar-container.hotbar-layout-grid-1 .hotbar-slot[data-key="8"] { grid-column: 3; grid-row: 3; }
#hotbar-container.hotbar-layout-grid-1 .hotbar-slot[data-key="9"] { grid-column: 4; grid-row: 3; }
#hotbar-container.hotbar-layout-grid-1 .hotbar-slot[data-key="0"] { grid-column: 5; grid-row: 3; }

#hotbar-container.hotbar-layout-grid-2 {
    grid-template-columns: repeat(4, 28px);
    grid-template-rows: repeat(3, 28px);
}
#hotbar-container.hotbar-layout-grid-2 .hotbar-slot[data-key="1"] { grid-column: 1; grid-row: 1; }
#hotbar-container.hotbar-layout-grid-2 .hotbar-slot[data-key="2"] { grid-column: 2; grid-row: 1; }
#hotbar-container.hotbar-layout-grid-2 .hotbar-slot[data-key="3"] { grid-column: 3; grid-row: 1; }
#hotbar-container.hotbar-layout-grid-2 .hotbar-slot[data-key="4"] { grid-column: 4; grid-row: 1; }
#hotbar-container.hotbar-layout-grid-2 .hotbar-slot[data-key="attack"] { grid-column: 2; grid-row: 2; }
#hotbar-container.hotbar-layout-grid-2 .hotbar-slot[data-key="6"] { grid-column: 3; grid-row: 2; }
#hotbar-container.hotbar-layout-grid-2 .hotbar-slot[data-key="7"] { grid-column: 1; grid-row: 3; }
#hotbar-container.hotbar-layout-grid-2 .hotbar-slot[data-key="8"] { grid-column: 2; grid-row: 3; }
#hotbar-container.hotbar-layout-grid-2 .hotbar-slot[data-key="9"] { grid-column: 3; grid-row: 3; }
#hotbar-container.hotbar-layout-grid-2 .hotbar-slot[data-key="0"] { grid-column: 4; grid-row: 3; }

/* Layout vertical: todos os slots empilhados numa coluna única */
#hotbar-container.hotbar-layout-vertical {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: center;
    gap: 6px;
    max-height: 80vh;
    max-height: 80dvh;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
}

/* Quando a hotbar está no layout vertical, o wrapper também vira coluna
   (botão de alternar layout fica acima/abaixo dos slots em vez de do lado) */
#hotbar-wrapper.hotbar-wrapper-vertical {
    flex-direction: column;
}

#battle-ui {
    position: fixed;
    bottom: 70px;
    left: 50%;
    transform: translateX(-50%);
    display: none;
    gap: 6px;
    z-index: 99;
    pointer-events: auto;
    padding: 10px 12px;
    background: rgba(80, 80, 80, 0.7);
    border: 1px solid rgba(0, 0, 0, 0.6);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    cursor: move;
}

#battle-ui .battle-btn {
    width: 72px;
    height: 36px;
    background: rgba(35, 35, 35, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    color: #fff;
    font-family: var(--font-pixel);
    font-size: 11px;
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 2px 2px 4px #000;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

#battle-ui .battle-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

#battle-ui .battle-btn-text {
    pointer-events: none;
}

#turn-tracker {
    position: fixed;
    top: 90px;
    right: 14px;
    display: none;
    flex-direction: column;
    gap: 10px;
    z-index: 99;
    pointer-events: auto;
    --icon-size: 36px;
    padding: 10px 8px;
    background: rgba(45, 45, 45, 0.55);
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    cursor: move;
}

.turn-entry-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.turn-entry {
    width: var(--icon-size);
    height: var(--icon-size);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    box-shadow: inset 2px 2px 4px #000;
    overflow: hidden;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.turn-entry-dim {
    opacity: 0.8;
}

.turn-entry-timer {
    width: var(--icon-size);
    height: 14px;
    display: block;
}

/* --- Battle Timeline (HUD de turno estilo Dofus/Wakfu) --- */
#battle-timeline {
    position: fixed;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    display: none;
    flex-direction: row;
    align-items: flex-start;
    gap: 6px;
    z-index: 150;
    padding: 2px 4px;
    background: rgba(20, 20, 20, 0.55);
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    cursor: move;
    max-width: 92vw;
    pointer-events: auto;
}

/* Botão pra alternar a HUD de turno entre horizontal (padrão) e vertical,
   igual o botão que troca o layout da hotbar. Fica sem fundo/borda
   próprios (só o ícone) pra não parecer uma caixinha separada "mordendo"
   o canto arredondado do HUD - só acende no hover. */
#battle-timeline-orientation-btn {
    flex: 0 0 auto;
    align-self: center;
    width: 16px;
    height: 16px;
    margin-left: 6px;
    margin-right: 2px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: rgba(255, 255, 255, 0.5);
    font-family: var(--font-pixel);
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease, background 0.2s ease;
    pointer-events: auto !important;
}

#battle-timeline-orientation-btn:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
}

#battle-timeline-orientation-btn:active {
    transform: scale(0.85);
}

/* Container que recebe os chips de turno em si - a orientação (linha ou
   coluna) é controlada aqui, separado do botão de alternar acima.
   Padding aqui é necessário: o chip do turno atual cresce (transform:
   scale) e tem um brilho (box-shadow) que passa da caixa de conteúdo
   normal - sem essa folga, o overflow-x/overflow-y (necessários pro
   scroll quando tem muitos combatentes) cortava esse brilho/crescimento
   bem na borda do container, principalmente quando o card em turno é o
   primeiro/último da fileira ou quando o brilho estoura por cima/baixo. */
#battle-timeline-chips {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 6px;
    padding: 12px 10px;
    overflow-x: auto;
    overflow-y: hidden;
    max-width: 100%;
}

/* Modo vertical: HUD de turno vira coluna (botão em cima, chips
   empilhados embaixo), igual o comportamento do hotbar-wrapper-vertical. */
#battle-timeline.battle-timeline-vertical {
    flex-direction: column;
    align-items: center;
    max-width: none;
    max-height: 80vh;
    max-height: 80dvh;
}

#battle-timeline.battle-timeline-vertical #battle-timeline-orientation-btn {
    margin-left: 0;
    margin-right: 0;
    margin-bottom: 2px;
}

#battle-timeline.battle-timeline-vertical #battle-timeline-chips {
    flex-direction: column;
    align-items: center;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: thin;
    max-height: 100%;
}

.timeline-chip-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    flex-shrink: 0;
    width: 40px;
}

/* O chip do turno atual cresce (transform: scale) e sem isso ficava
   "por baixo" do próximo card na ordem do DOM, dando a impressão de que
   o vizinho mordia um pedaço dele. z-index funciona aqui sem precisar de
   position porque .timeline-chip-wrap já é item flex de #battle-timeline-chips. */
.timeline-chip-wrap-current {
    z-index: 5;
}

.timeline-chip {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-pixel);
    font-size: 10px;
    font-weight: bold;
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(255, 255, 255, 0.25);
    box-shadow: inset 2px 2px 4px #000;
    cursor: default;
    overflow: hidden;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.timeline-chip-canvas {
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    pointer-events: none;
}

.timeline-chip-player { border-color: #4ea3ff; }
.timeline-chip-monster { border-color: #ff5f5f; }
/* Invocação do Warlock: aliada, mas vem de state.monsters (mesma origem de
   dados de um mob inimigo) - usa branco pra ficar claramente diferente
   tanto do azul de aliado "de verdade" quanto do vermelho de inimigo. */
.timeline-chip-summon { border-color: #ffffff; }
/* "Self" não tem mais cor própria - você é um aliado igual aos outros
   (azul). O dourado fica reservado só pra indicar de quem é a vez
   (.timeline-chip-current), sem se misturar com "quem é você". */

.timeline-chip-current {
    transform: scale(1.15);
    box-shadow: 0 0 10px 2px rgba(255, 210, 63, 0.7), inset 2px 2px 4px #000;
    border-color: #ffd23f;
}

.timeline-hp-bar-outer {
    width: 100%;
    height: 4px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 3px;
    overflow: hidden;
}

.timeline-hp-bar-inner {
    height: 100%;
    background: linear-gradient(90deg, #ff5f5f, #ff9d5f);
    transition: width 0.2s ease;
}

.timeline-badges-row {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    justify-content: center;
    max-width: 40px;
}

.timeline-badge {
    position: relative;
    width: 14px;
    height: 14px;
    border-radius: 3px;
    font-size: 7px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    line-height: 1;
    overflow: hidden;
}

.timeline-badge-buff {
    background: rgba(46, 204, 113, 0.85);
    border: 1px solid #2ecc71;
}

.timeline-badge-debuff {
    background: rgba(162, 59, 200, 0.85);
    border: 1px solid #a23bc8;
}

.timeline-badge-more {
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.5);
    font-size: 6.5px;
}

.timeline-badge-count {
    position: absolute;
    bottom: -3px;
    right: -3px;
    background: #1b1b1b;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    font-size: 6px;
    min-width: 8px;
    height: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 1px;
}

.timeline-turn-timer {
    font-family: var(--font-pixel);
    font-size: 9px;
    color: #ffd23f;
    font-weight: bold;
}

#battle-timeline-tooltip {
    position: fixed;
    background: #1b1b1b;
    border: 2px solid #6d6d6d;
    color: #fff;
    padding: 6px 8px;
    border-radius: 6px;
    z-index: 2000;
    display: none;
    pointer-events: none;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    max-width: 220px;
}

#battle-flee-dialog .battle-flee-title {
    font-family: var(--font-pixel);
    font-size: 13px;
    color: #fff;
    margin-bottom: 6px;
    text-align: center;
}

#battle-flee-dialog .battle-flee-text {
    font-family: var(--font-pixel);
    font-size: 11px;
    color: #e6e6e6;
    margin-bottom: 10px;
    text-align: center;
}

#battle-flee-dialog .battle-flee-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
}

#hotbar-wrapper:hover {
    opacity: 1;
}

.hotbar-slot {
    width: 28px;
    height: 28px;
    min-width: 28px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    position: relative;
    cursor: pointer;
    padding: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    pointer-events: auto !important;
}

.hotbar-slot:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
}

.hotbar-slot.drag-over {
    background: rgba(255, 204, 0, 0.2);
    border-color: var(--gold);
    transform: scale(1.1);
}

.hotbar-slot.clicked {
    transform: scale(0.9);
    background: rgba(255, 255, 255, 0.3);
}

.hotbar-slot.has-item {
    background: rgba(255, 255, 255, 0.1);
}

.hotbar-slot.is-spell {
    border-color: rgba(0, 123, 255, 0.4);
    box-shadow: inset 0 0 10px rgba(0, 123, 255, 0.2);
}

.hotbar-slot-attack {
    border-color: rgba(255, 204, 0, 0.4);
    box-shadow: inset 0 0 8px rgba(255, 204, 0, 0.2);
}

.hotbar-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
    pointer-events: none;
}

.hotbar-emoji {
    font-size: 22px;
    line-height: 1;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
    pointer-events: none;
}

.key-label {
    display: block;
    position: absolute;
    top: 2px;
    left: 4px;
    font-size: 10px;
    font-weight: bold;
    color: rgba(255, 255, 255, 0.7);
    text-shadow: 1px 1px 2px #000;
    pointer-events: none;
    font-family: var(--font-pixel);
}

.hotbar-slot:hover .key-label {
    color: #fff;
}

/* --- COOLDOWN OVERLAY --- */
.hotbar-cooldown-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 10px;
    pointer-events: none;
    transition: opacity 0.05s linear;
}

.hotbar-cooldown-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-pixel);
    font-size: 13px;
    color: #fff;
    text-shadow: 1px 1px 2px #000;
}

.hotbar-slot.on-cooldown {
    filter: brightness(0.6);
}

/* --- STATUS EFFECTS (BUFFS/DEBUFFS) --- */
.status-effects-hud {
    position: relative;
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
    margin-top: 8px;
    z-index: 50;
    pointer-events: auto;
}

.status-effect-icon {
    width: 23px;
    height: 22px;
    background: transparent;
    border: none;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    opacity: 0.75;
    transition: opacity 0.2s ease;
}

.status-effect-icon:hover {
    opacity: 1;
}

.status-effect-icon img {
    width: 23px;
    height: 22px;
    object-fit: contain;
    pointer-events: none;
}

.status-effect-duration {
    position: absolute;
    bottom: -8px;
    right: -2px;
    background: transparent;
    color: #fff;
    font-size: 9px;
    padding: 0;
    border-radius: 0;
    font-weight: bold;
    pointer-events: none;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

/* --- PREMIUM ICON (CP 30 Dias) --- */
.status-bonus-row {
    position: fixed;
    top: 67px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: nowrap;
    z-index: 100;
    pointer-events: none;
}

.premium-status {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.8;
    pointer-events: auto;
    cursor: help;
}

.premium-status.hidden {
    display: none;
}

.premium-status img {
    width: 24px;
    height: 24px;
    image-rendering: pixelated;
}

/* Ícones de PZ e Fight Mode são pequenos por natureza (10x13 / 19x11);
   não deixa o 24x24 do premium esticá-los. */
#pz-status-row img,
#fight-mode-status-container img {
    width: 16px;
    height: 16px;
    object-fit: contain;
    image-rendering: auto;
}

.boost-exp-status {
    display: flex;
    align-items: center;
    opacity: 0.85;
    pointer-events: auto;
    cursor: help;
}

.boost-exp-status img {
    width: 24px;
    height: 24px;
    image-rendering: pixelated;
}

#boost-drop-status-container img {
    width: 24px;
    height: 24px;
    image-rendering: pixelated;
}

.boost-exp-status.hidden {
    display: none;
}

/* --- NPC & SHOPS --- */
/* (estilos consolidados mais abaixo, em "ESTILOS DA LOJA DE NPC") */

/* --- CASH SHOP PREMIUM --- */
.cash-shop-premium {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    text-align: center;
}

.cash-premium-title {
    font-weight: bold;
    font-size: 14px;
    color: #fff;
}

.cash-premium-sub {
    font-size: 12px;
    color: #c9c9c9;
}

.cash-premium-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 4px;
}

#cash-exp-boost-icon {
    width: auto;
    height: auto;
    max-width: 64px;
    max-height: 64px;
    image-rendering: pixelated;
    cursor: help;
}

#cash-drop-boost-icon {
    width: auto;
    height: auto;
    max-width: 64px;
    max-height: 64px;
    image-rendering: pixelated;
    cursor: help;
}

.cash-premium-divider {
    height: 1px;
    background: rgba(255,255,255,0.08);
    margin: 10px 0 6px;
}

#cash-premium-icon {
    width: auto;
    height: auto;
    max-width: 64px;
    max-height: 64px;
    image-rendering: pixelated;
    cursor: help;
}

.cash-premium-btn {
    background: #2e7d32;
    color: #fff;
    border: 2px outset #2e7d32;
    font-weight: bold;
    cursor: pointer;
    padding: 6px 10px;
    font-size: 12px;
}

.cash-premium-btn:active { border-style: inset; }

.cash-premium-btn.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    filter: grayscale(0.2);
}

/* --- CASH --- */

/* Janela Cash Shop */
.cash-shop-tabs {
    background: #222;
    padding: 4px;
    gap: 4px;
}

.cash-tab {
    background: #333;
    color: #888;
    border: 2px outset #555;
    font-size: 12px;
    padding: 6px;
}

.cash-tab.active {
    background: var(--ui-bg);
    color: #fff;
    border-bottom: none;
}

.cash-item-card {
    background: #2d2d2d;
    border: 2px solid #555;
    box-shadow: 2px 2px 0 #000;
}

/* --- MAP EDITOR TOOLS --- */
#tileset-hub-container {
    position: fixed;
    top: 10px;
    right: 10px;
    width: 460px;
    max-height: 88vh;
    background: rgba(25, 25, 25, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 150;
    display: none;
    flex-direction: column;
    overflow: hidden;
    pointer-events: auto;
}

#map-editor-backups-panel.hidden {
    display: none;
}

/* --- PAINEL FLUTUANTE DE TILESET --- */
#tileset-viewer-panel {
    position: fixed;
    top: 80px;
    left: 50px;
    width: 640px;
    min-width: 280px;
    min-height: 200px;
    background: rgba(20, 20, 20, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 160;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    resize: both;
    pointer-events: auto;
}

#tileset-viewer-panel.hidden {
    display: none !important;
}

#tileset-viewer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: bold;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 1px;
    background: rgba(30, 30, 30, 0.45);
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    cursor: move;
    user-select: none;
    flex-shrink: 0;
}

#tileset-viewer-close {
    width: 20px;
    height: 20px;
    padding: 0;
    font-size: 11px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: #aaa;
    border: none;
    cursor: pointer;
}
#tileset-viewer-close:hover {
    color: #fff;
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
}

#tileset-viewer-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 6px;
    overflow: hidden;
    flex: 1;
    min-height: 0;
}

#tileset-viewer-content #tileset-image-wrapper {
    flex: 1;
    min-height: 40px;
    max-height: none;
    overflow: auto;
    position: relative;
}

#tileset-viewer-content #tileset-image-wrapper img {
    height: auto;
    display: block;
}

/* resize handle visível */
#tileset-viewer-panel::-webkit-resizer {
    width: 12px;
    height: 12px;
    background: rgba(255,255,255,0.15);
    border-radius: 0 0 7px 0;
}
#tileset-viewer-panel::-moz-resizer {
    width: 12px;
    height: 12px;
    background: rgba(255,255,255,0.15);
}

#tileset-hub-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 8px;
    font-size: 11px;
    font-weight: bold;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 1px;
    background: rgba(30, 30, 30, 0.45);
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    cursor: move;
    user-select: none;
    gap: 6px;
}
.editor-header-title {
    flex-shrink: 0;
}
.editor-header-actions {
    display: flex;
    gap: 3px;
}
#map-editor-save-status {
    font-size: 9px;
    opacity: 0.8;
    flex: 1;
    text-align: center;
}

#tileset-hub-content {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 6px;
    padding: 6px;
    overflow: auto;
}

#tileset-hub-main {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}

/* --- MINIMIZAR O EDITOR DE MAPA ---
   Com a classe .minimized, esconde todo o conteúdo do hub e encolhe para
   mostrar só a barra do topo (título + ações). */
#tileset-hub-container.minimized {
    height: auto;
    max-height: none;
    width: auto;
}
#tileset-hub-container.minimized #tileset-hub-content,
#tileset-hub-container.minimized #map-editor-backups-panel {
    display: none !important;
}

/* Melhoria para Mobile Horizontal */
@media (max-width: 932px) and (orientation: landscape) {
    #tileset-hub-container {
        width: 420px;
        max-height: 80vh;
        background: rgba(15, 15, 15, 0.5);
        font-size: 12px;
    }

    #tileset-hub-content {
        grid-template-columns: 1fr;
    }

    #tileset-hub-main {
        order: -1;
    }
}

/* --- MONSTER EDITOR --- */
#monster-editor-window {
    width: 880px;
    max-height: 85vh;
    z-index: 10000;
    background: rgba(15, 15, 18, 0.65);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.6);
}
#monster-editor-window .ui-scroll-header {
    background: rgba(25,25,30,0.6);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px 10px 0 0;
    padding: 5px 10px;
    font-size: 11px;
    letter-spacing: 1.5px;
    flex-shrink: 0;
}
#monster-editor-window .ui-scroll-content {
    padding: 8px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}
.monster-editor-body {
    display: flex;
    gap: 8px;
}
.monster-editor-sidebar {
    width: 180px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

/* --- NPC EDITOR (glass style) --- */
#npc-editor-window {
    max-height: 85vh;
    background: rgba(15, 15, 18, 0.65);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.6);
}
#npc-editor-window .ui-scroll-header {
    background: rgba(25,25,30,0.6);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px 10px 0 0;
    padding: 5px 10px;
    font-size: 11px;
    letter-spacing: 1.5px;
    flex-shrink: 0;
}
#npc-editor-window .ui-scroll-content {
    padding: 8px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

/* --- SET EDITOR (glass style) --- */
#set-editor-window {
    max-height: 85vh;
    background: rgba(15, 15, 18, 0.65);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.6);
}
#set-editor-window .ui-scroll-header {
    background: rgba(25,25,30,0.6);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px 10px 0 0;
    padding: 5px 10px;
    font-size: 11px;
    letter-spacing: 1.5px;
    flex-shrink: 0;
}
#set-editor-window .ui-scroll-content {
    padding: 8px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

/* --- ITEM EDITOR (glass style) --- */
#item-editor-window {
    width: 720px;
    max-width: 95vw;
    max-height: 85vh;
    background: rgba(15, 15, 18, 0.65);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.6);
    resize: both;
    overflow: auto;
}
#item-editor-window .ui-scroll-header {
    background: rgba(25,25,30,0.6);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px 10px 0 0;
    padding: 5px 10px;
    font-size: 11px;
    letter-spacing: 1.5px;
    flex-shrink: 0;
}
#item-editor-window .ui-scroll-content {
    padding: 8px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

/* --- TELEPORT (glass style, mesmo padrão das outras HUDs de editor) --- */
#teleport-window {
    background: rgba(15, 15, 18, 0.65);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.6);
}
#door-window {
    background: rgba(15, 15, 18, 0.65);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.6);
}
#teleport-window .ui-scroll-header,
#door-window .ui-scroll-header {
    background: rgba(25,25,30,0.6);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px 10px 0 0;
    padding: 5px 10px;
    font-size: 11px;
    letter-spacing: 1.5px;
    flex-shrink: 0;
    cursor: move;
}
#teleport-window .ui-scroll-content,
#door-window .ui-scroll-content {
    padding: 10px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}
#teleport-editor-content input[type="text"],
#teleport-editor-content input[type="number"],
#teleport-editor-content select,
#door-editor-content input[type="text"],
#door-editor-content input[type="number"],
#door-editor-content select {
    background: rgba(0,0,0,0.4) !important;
    border: 1px solid rgba(255,255,255,0.1) !important;
    border-radius: 4px !important;
    color: #eee !important;
    padding: 3px 6px !important;
    font-size: 10px;
    font-family: var(--font-pixel), monospace;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.15s ease;
}
#teleport-editor-content input[type="text"]:focus,
#teleport-editor-content input[type="number"]:focus,
#teleport-editor-content select:focus,
#door-editor-content input[type="text"]:focus,
#door-editor-content input[type="number"]:focus,
#door-editor-content select:focus {
    border-color: rgba(255,255,255,0.25) !important;
}
#teleport-editor-content select,
#door-editor-content select {
    cursor: pointer;
}
#teleport-editor-content input[type="checkbox"],
#door-editor-content input[type="checkbox"] {
    accent-color: #4a9eff;
    cursor: pointer;
}
#teleport-editor-content .editor-btn,
#door-editor-content .editor-btn {
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.15);
    transition: filter 0.15s ease;
    font-family: var(--font-pixel), monospace;
}
#teleport-editor-content .editor-btn:hover,
#door-editor-content .editor-btn:hover {
    filter: brightness(1.15);
}
#teleport-editor-content .teleport-btn-ok,
#door-editor-content .teleport-btn-ok {
    background: rgba(40, 167, 69, 0.75);
    color: #fff;
}
#teleport-editor-content .teleport-btn-clear,
#door-editor-content .teleport-btn-clear {
    background: rgba(85, 85, 85, 0.75);
    color: #fff;
}
#teleport-editor-content .teleport-btn-remove,
#door-editor-content .teleport-btn-remove {
    background: rgba(184, 50, 50, 0.75);
    color: #fff;
}

/* --- NPC EDITOR / QUEST EDITOR / QUEST LOG glass style --- */

/* Header button inside glass scroll windows */
.ui-scroll-header-btn {
    background: rgba(47,128,237,0.25);
    border: 1px solid rgba(255,255,255,0.15);
    color: #8ab4f8;
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 10px;
    font-family: inherit;
    cursor: pointer;
    letter-spacing: 0.5px;
    margin-left: auto;
    margin-right: 4px;
    transition: background 0.15s;
}
.ui-scroll-header-btn:hover {
    background: rgba(47,128,237,0.45);
}

/* Base inputs inside editors - all get glass style */
:is(#npc-editor-content, #quest-editor-content, #quest-log-content, #item-editor-content, #set-editor-content) input[type="text"],
:is(#npc-editor-content, #quest-editor-content, #quest-log-content, #item-editor-content, #set-editor-content) input[type="number"],
:is(#npc-editor-content, #quest-editor-content, #quest-log-content, #item-editor-content, #set-editor-content) select,
:is(#npc-editor-content, #quest-editor-content, #quest-log-content, #item-editor-content, #set-editor-content) textarea {
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 2px;
    color: #eee;
    padding: 0 5px;
    font-size: 10px;
    font-family: var(--font-pixel), monospace;
    outline: none;
    box-sizing: border-box;
}
:is(#npc-editor-content, #quest-editor-content, #quest-log-content, #item-editor-content, #set-editor-content) input[type="text"]:focus,
:is(#npc-editor-content, #quest-editor-content, #quest-log-content, #item-editor-content, #set-editor-content) input[type="number"]:focus,
:is(#npc-editor-content, #quest-editor-content, #quest-log-content, #item-editor-content, #set-editor-content) select:focus,
:is(#npc-editor-content, #quest-editor-content, #quest-log-content, #item-editor-content, #set-editor-content) textarea:focus {
    border-color: rgba(255,255,255,0.25);
}
:is(#npc-editor-content, #quest-editor-content, #quest-log-content) select {
    cursor: pointer;
}
:is(#npc-editor-content, #quest-editor-content, #quest-log-content) input[type="checkbox"] {
    accent-color: #4a9eff;
    cursor: pointer;
}
:is(#npc-editor-content, #quest-editor-content, #quest-log-content) textarea {
    padding: 4px;
    resize: vertical;
    min-height: 50px;
}

/* Layout */
.npc-editor-body {
    display: flex;
    gap: 12px;
}
.npc-editor-sidebar {
    width: 200px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.npc-editor-search {
    width: 100% !important;
    height: 22px !important;
    background: rgba(0,0,0,0.4) !important;
    border: 1px solid rgba(255,255,255,0.1) !important;
    border-radius: 3px !important;
    color: #eee !important;
    padding: 0 6px !important;
    font-size: 10px !important;
    font-family: var(--font-pixel), monospace !important;
    outline: none !important;
    box-sizing: border-box !important;
}
.npc-editor-search:focus {
    border-color: rgba(255,255,255,0.25) !important;
}
.npc-editor-list {
    flex: 1;
    height: 360px;
    overflow: auto;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 3px;
    background: rgba(0,0,0,0.3);
}
.npc-editor-sidebar-actions {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}
.npc-editor-sidebar-actions .editor-btn {
    flex: 1;
    height: 22px;
    font-size: 9px;
}
.npc-editor-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* Name row */
.npc-editor-name-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.npc-editor-name-row label {
    font-size: 10px;
    color: #ccc;
}
.npc-editor-name-row input {
    width: 65% !important;
    height: 20px !important;
}

/* Preview area */
.npc-editor-preview-area {
    display: flex;
    gap: 16px;
    margin: 10px 0;
}
.npc-editor-preview-frame {
    width: 140px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}
.npc-editor-preview-frame canvas {
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 4px;
}
.npc-editor-preview-label {
    font-size: 10px;
    color: #888;
}
.npc-editor-preview-controls {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    justify-content: center;
}
.npc-editor-appearance-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.npc-editor-appearance-row label {
    font-size: 10px;
    color: #ccc;
}
.npc-editor-appearance-row .appearance-value {
    min-width: 80px;
    text-align: center;
    font-size: 10px;
    color: #eee;
}

/* Section dividers */
.npc-editor-section {
    margin-top: 14px;
    border-top: 1px solid rgba(255,255,255,0.08);
    padding-top: 10px;
}
.npc-editor-section-title {
    display: block;
    margin-bottom: 6px;
    font-size: 11px;
    color: #aaa;
    letter-spacing: 0.3px;
}

/* Role checkboxes */
.npc-editor-role-grid {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}
.npc-editor-role-grid label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: #ccc;
    cursor: pointer;
}

/* MapChat grid */
.npc-editor-mapchat-grid {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Walk settings */
.npc-editor-walk-settings {
    display: flex;
    gap: 12px;
    margin-left: 22px;
}
.npc-editor-walk-row {
    display: flex;
    align-items: center;
    gap: 4px;
}
.npc-editor-walk-row label {
    font-size: 10px;
    color: #aaa;
    white-space: nowrap;
}
.npc-editor-walk-row input {
    width: 60px !important;
    height: 20px !important;
}
.npc-editor-walk-hint {
    font-size: 9px;
    color: #777;
}

/* Sprite mode toggle */
#npc-editor-assembled-controls.hidden,
#npc-editor-single-controls.hidden {
    display: none;
}

/* Shop sections */
.npc-editor-shop-section {
    margin-top: 10px;
}
.npc-editor-shop-add-row {
    display: flex;
    gap: 6px;
    margin-bottom: 6px;
}
.npc-editor-shop-add-row select {
    flex: 1 !important;
    height: 22px !important;
}
.npc-editor-shop-add-row input {
    width: 80px !important;
    height: 22px !important;
}
.npc-editor-shop-list {
    max-height: 120px;
    overflow: auto;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 3px;
    background: rgba(0,0,0,0.3);
}

/* Shop list items (JS dynamic) */
.npc-editor-shop-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 6px;
    font-size: 11px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.npc-editor-shop-item-price {
    color: #ffd54f;
}
.npc-editor-list-empty {
    padding: 8px;
    font-size: 11px;
    color: #777;
}

/* NPC list items (JS dynamic) */
.npc-editor-list-item {
    padding: 5px 8px;
    cursor: pointer;
    font-size: 11px;
    color: #ccc;
}
.npc-editor-list-item:hover {
    background: rgba(255,255,255,0.05);
}
.npc-editor-list-item.selected {
    color: #fff;
    background: #2f80ed;
}

/* Actions */
.npc-editor-actions {
    display: flex;
    gap: 8px;
    margin-top: 14px;
}
.npc-editor-actions .editor-btn {
    flex: 1;
    height: 24px;
    font-size: 10px;
}
.npc-editor-hint {
    font-size: 10px;
    color: #777;
    margin-top: 8px;
}

/* --- QUEST EDITOR WINDOW (glass) --- */
#quest-editor-window {
    width: 720px;
    min-width: 480px;
    min-height: 400px;
    max-width: 95vw;
    max-height: 85vh;
    z-index: 10000;
    background: rgba(15, 15, 18, 0.65);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.6);
    resize: both;
    overflow: auto;
}
#quest-editor-window .ui-scroll-header {
    background: rgba(25,25,30,0.6);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px 10px 0 0;
    padding: 5px 10px;
    font-size: 11px;
    letter-spacing: 1.5px;
    flex-shrink: 0;
}
#quest-editor-window .ui-scroll-content {
    padding: 8px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

/* Quest editor layout */
.quest-editor-body {
    display: flex;
    gap: 12px;
}
.quest-editor-sidebar {
    width: 200px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.quest-editor-search {
    width: 100% !important;
    height: 22px !important;
    background: rgba(0,0,0,0.4) !important;
    border: 1px solid rgba(255,255,255,0.1) !important;
    border-radius: 3px !important;
    color: #eee !important;
    padding: 0 6px !important;
    font-size: 10px !important;
    font-family: var(--font-pixel), monospace !important;
    outline: none !important;
    box-sizing: border-box !important;
}
.quest-editor-search:focus {
    border-color: rgba(255,255,255,0.25) !important;
}
.quest-editor-list {
    flex: 1;
    height: 400px;
    overflow: auto;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 3px;
    background: rgba(0,0,0,0.3);
}
.quest-editor-sidebar-actions {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}
.quest-editor-sidebar-actions .editor-btn {
    flex: 1;
    height: 22px;
    font-size: 9px;
}
.quest-editor-list-item {
    padding: 5px 8px;
    cursor: pointer;
    font-size: 11px;
    color: #ccc;
}
.quest-editor-list-item:hover {
    background: rgba(255,255,255,0.05);
}
.quest-editor-list-item.selected {
    color: #fff;
    background: #2f80ed;
}
.quest-editor-list-empty {
    padding: 8px;
    font-size: 11px;
    color: #777;
}
.quest-editor-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* Event Chest editor list */
.echest-editor-list-item {
    padding: 5px 8px;
    cursor: pointer;
    font-size: 11px;
    color: #ccc;
}
.echest-editor-list-item:hover {
    background: rgba(255,255,255,0.05);
}
.echest-editor-list-item.selected {
    color: #fff;
    background: #2f80ed;
}
.echest-editor-list-empty {
    padding: 8px;
    font-size: 11px;
    color: #777;
}

/* Event Chest editor - grid de sprites (lidas de public/assets/Tileset/Chests) */
.echest-sprite-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-height: 150px;
    overflow-y: auto;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 3px;
    padding: 6px;
    background: rgba(0,0,0,0.25);
}
.echest-sprite-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    width: 56px;
    padding: 4px 2px;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 3px;
    background: rgba(255,255,255,0.03);
    cursor: pointer;
    box-sizing: border-box;
}
.echest-sprite-option:hover {
    border-color: rgba(255,255,255,0.4);
    background: rgba(255,255,255,0.08);
}
.echest-sprite-option.selected {
    border-color: #2f80ed;
    background: rgba(47,128,237,0.25);
}
.echest-sprite-option img {
    width: 32px;
    height: 32px;
    object-fit: contain;
    image-rendering: pixelated;
    margin-bottom: 3px;
}
.echest-sprite-option span {
    font-size: 8px;
    color: #ccc;
    text-align: center;
    word-break: break-word;
    line-height: 1.1;
}
.echest-sprite-option.selected span {
    color: #fff;
}
.echest-sprite-empty {
    padding: 8px;
    font-size: 11px;
    color: #777;
}

/* Quest editor form rows */
.quest-editor-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.quest-editor-row label {
    font-size: 10px;
    color: #ccc;
    flex-shrink: 0;
}
.quest-editor-row input[type="text"] {
    width: 65% !important;
    height: 20px !important;
}

/* Quest editor full-width rows (description, selects) */
.quest-editor-field {
    margin-bottom: 8px;
}
.quest-editor-field label {
    display: block;
    margin-bottom: 4px;
    font-size: 10px;
    color: #ccc;
}
.quest-editor-field select {
    width: 100% !important;
    height: 22px !important;
}
.quest-editor-field textarea {
    width: 100% !important;
}

/* Quest editor fields row */
.quest-editor-fields-row {
    display: flex;
    gap: 10px;
    margin-bottom: 8px;
}
.quest-editor-fields-row > div {
    flex: 1;
}

/* Quest editor hint text */
.quest-editor-hint {
    font-size: 10px;
    color: #999;
    margin: -4px 0 8px 0;
}

/* Quest editor reward section */
.quest-editor-reward-section {
    margin-top: 10px;
    border-top: 1px solid rgba(255,255,255,0.08);
    padding-top: 10px;
}
.quest-editor-reward-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.quest-editor-reward-row label {
    min-width: 60px;
    font-size: 10px;
    color: #ccc;
}
.quest-editor-reward-row input {
    width: 120px !important;
    height: 20px !important;
}

/* Quest editor reward items list */
.quest-editor-reward-items-list {
    max-height: 100px;
    overflow: auto;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 3px;
    background: rgba(0,0,0,0.3);
}
.quest-editor-reward-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 6px;
    font-size: 11px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

/* Quest editor save/hint */
.quest-editor-actions {
    display: flex;
    gap: 8px;
    margin-top: 14px;
}
.quest-editor-actions .editor-btn {
    flex: 1;
    height: 24px;
    font-size: 10px;
}
.quest-editor-footer-hint {
    font-size: 10px;
    color: #777;
    margin-top: 8px;
}

/* --- QUEST LOG WINDOW (glass) --- */
#quest-log-window {
    max-height: 80vh;
    z-index: 10000;
    background: rgba(15, 15, 18, 0.65);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.6);
}
#quest-log-window .ui-scroll-header {
    background: rgba(25,25,30,0.6);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px 10px 0 0;
    padding: 5px 10px;
    font-size: 11px;
    letter-spacing: 1.5px;
    flex-shrink: 0;
}
#quest-log-window .ui-scroll-content {
    padding: 0;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

/* Quest log tabs */
.quest-log-tabs {
    display: flex;
    gap: 6px;
    padding: 8px 8px 0 8px;
    flex-shrink: 0;
}

/* Override existing quest-log-tab retro style with glass */
.quest-log-tab {
    flex: 1;
    padding: 6px;
    background: rgba(255,255,255,0.05);
    color: #888;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 3px 3px 0 0;
    cursor: pointer;
    font-family: var(--font-pixel);
    font-weight: normal;
    font-size: 11px;
    transition: background 0.15s, color 0.15s;
}
.quest-log-tab:hover {
    background: rgba(255,255,255,0.1);
    color: #ccc;
}
.quest-log-tab.active {
    background: rgba(255,255,255,0.12);
    color: #fff;
    font-weight: bold;
    border-bottom-color: transparent;
}

/* Quest log list */
.quest-log-list {
    padding: 8px;
    flex: 1;
    overflow-y: auto;
}

/* Quest log card */
.quest-log-card {
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(0,0,0,0.3);
    padding: 8px;
    border-radius: 6px;
    margin-bottom: 8px;
}
.quest-log-card.completed {
    opacity: 0.8;
}
.quest-log-card-name {
    font-weight: bold;
    font-size: 12px;
    color: #eee;
}
.quest-log-card-desc {
    font-size: 11px;
    color: #bbb;
    margin: 2px 0 6px 0;
}
.quest-log-card-progress {
    font-size: 11px;
}
.quest-log-card-progress.ready {
    color: #7fd;
}
.quest-log-card-progress.pending {
    color: #ffd166;
}
.quest-log-card-bar-bg {
    background: rgba(0,0,0,0.4);
    border-radius: 3px;
    height: 6px;
    margin-top: 4px;
    overflow: hidden;
}
.quest-log-card-bar {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s;
}
.quest-log-card-bar.ready {
    background: #28a745;
}
.quest-log-card-bar.pending {
    background: #2f80ed;
}
.quest-log-card-ready-text {
    font-size: 10px;
    color: #7fd;
    margin-top: 4px;
}
.quest-log-card-date {
    font-size: 10px;
    color: #999;
    margin-top: 2px;
}
.quest-log-empty {
    font-size: 12px;
    color: #999;
    text-align: center;
    padding: 12px;
}

/* Quest abandon button */
.quest-abandon-btn {
    margin-top: 6px;
    width: 100%;
    padding: 4px;
    font-size: 10px;
    font-family: var(--font-pixel), monospace;
    background: rgba(170,50,50,0.7);
    color: #fff;
    border: 1px solid rgba(255,80,80,0.3);
    border-radius: 3px;
    cursor: pointer;
    transition: background 0.15s;
}
.quest-abandon-btn:hover {
    background: rgba(170,50,50,0.9);
}

.monster-editor-search {
    width: 100%;
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 3px;
    color: #fff;
    padding: 4px 6px;
    font-size: 10px;
    font-family: var(--font-pixel), monospace;
    outline: none;
    box-sizing: border-box;
}
.monster-editor-search:focus {
    border-color: rgba(255,255,255,0.25);
}
#monster-list {
    flex: 1;
    min-height: 150px;
    max-height: 320px;
    overflow: auto;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 3px;
    background: rgba(0,0,0,0.3);
}
.monster-editor-sidebar-actions {
    display: flex;
    gap: 4px;
}
.monster-editor-sidebar-actions .editor-btn {
    flex: 1;
    height: 22px;
    font-size: 9px;
}
.monster-editor-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.monster-editor-tabs {
    display: flex;
    gap: 3px;
    margin-bottom: 6px;
    flex-shrink: 0;
}
.monster-editor-tab {
    flex: 1;
    padding: 4px 8px;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 1px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 4px 4px 0 0;
    color: #777;
    cursor: pointer;
    font-family: var(--font-pixel), monospace;
    text-align: center;
    transition: background 0.15s;
}
.monster-editor-tab:hover {
    background: rgba(255,255,255,0.08);
    color: #aaa;
}
.monster-editor-tab.active {
    background: rgba(255,255,255,0.1);
    color: #fff;
    border-color: rgba(255,255,255,0.15);
}
.monster-editor-card {
    background: rgba(0,0,0,0.25);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 5px;
    padding: 7px 8px;
}
.monster-editor-card-title {
    font-size: 8px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(255,255,255,0.5);
    font-weight: bold;
    margin-bottom: 5px;
    padding-bottom: 3px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.monster-editor-card-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3px 10px;
}
.monster-field {
    display: flex;
    align-items: center;
    gap: 4px;
    min-height: 18px;
}
.monster-field label {
    font-size: 9px;
    color: #999;
    min-width: 28px;
    text-transform: uppercase;
    letter-spacing: 0.2px;
    flex-shrink: 0;
}
.monster-field .field-label-wide {
    min-width: 40px;
}
.monster-field input,
.monster-field select {
    flex: 1;
    min-width: 0;
    height: 18px;
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 2px;
    color: #eee;
    padding: 0 5px;
    font-family: var(--font-pixel), monospace;
    font-size: 10px;
    outline: none;
    box-sizing: border-box;
}
.monster-field input:focus,
.monster-field select:focus {
    border-color: rgba(255,255,255,0.25);
}
.monster-field select {
    cursor: pointer;
    padding: 0 3px;
}
.monster-field input[type="checkbox"] {
    flex: none;
    width: 12px;
    height: 12px;
    margin: 0;
    accent-color: #4a9eff;
    cursor: pointer;
}
.monster-preview-area {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-top: 1px;
}
.monster-preview-frame {
    width: 56px;
    height: 56px;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 4px;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
#monster-preview-canvas {
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}
#monster-preview-empty {
    font-size: 9px;
    color: #777;
}
.monster-preview-config {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.monster-preview-config-row {
    display: flex;
    gap: 4px;
    align-items: center;
}
.monster-preview-config-row .monster-field {
    flex: 1;
}
#monster-preview-info {
    font-size: 9px;
    color: #999;
    margin-top: 1px;
}
.monster-editor-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 5px;
    margin-bottom: 5px;
}
.monster-editor-actions {
    display: flex;
    gap: 6px;
    margin-top: 6px;
    flex-shrink: 0;
}
.monster-editor-actions .editor-btn {
    flex: 1;
    height: 24px;
    font-size: 10px;
}
#monster-tab-spells-content,
#monster-tab-loot-content {
    min-height: 120px;
}
.monster-loot-header {
    display: grid;
    grid-template-columns: 1.6fr 0.8fr 0.8fr 0.8fr 0.8fr auto;
    gap: 4px;
    font-size: 9px;
    color: #888;
    padding: 0 4px;
    margin-bottom: 3px;
}
#monster-huntingloot-row {
    display: grid;
    grid-template-columns: 1.6fr 0.8fr 0.8fr 0.8fr 0.8fr auto;
    gap: 4px;
    align-items: center;
}

@media (max-width: 932px) and (orientation: landscape) {
    #special-tools {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 6px !important;
    }

    .special-tool-btn {
        height: 35px !important;
        font-size: 10px !important;
        border-radius: 4px !important;
        background: #333 !important;
        color: #eee !important;
        border: 1px solid #555 !important;
    }

    .special-tool-btn.active {
        background: #ffcc00 !important;
        color: #000 !important;
        border-color: #fff !important;
        font-weight: bold;
    }

    #layer-selector {
        gap: 4px !important;
    }

    .layer-btn {
        flex: 1;
        height: 30px !important;
        font-size: 11px !important;
        background: #444 !important;
        border: 1px solid #666 !important;
    }

    .layer-btn.active {
        background: #007bff !important;
        border-color: #fff !important;
    }

    #tileset-viewer-content #tileset-image-wrapper {
        max-height: 120px !important;
    }

    .entity-tool-row {
        margin-bottom: 5px !important;
    }

    .entity-tool-row select {
        padding: 4px !important;
        font-size: 11px !important;
        background: #222 !important;
        color: #fff !important;
        border: 1px solid #444 !important;
    }
}

/* --- BASE STYLES: EDITOR TOOLS (DESKTOP) --- */
.special-tool-btn {
    height: 28px;
    font-size: 10px;
    border-radius: 4px;
    background: #333;
    color: #eee;
    border: 1px solid #555;
    cursor: pointer;
    font-family: var(--font-pixel), monospace;
    font-weight: bold;
    padding: 0 6px;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s;
}
.special-tool-btn:hover {
    background: #444;
    border-color: #888;
}
.special-tool-btn.active {
    background: #ffcc00;
    color: #000;
    border-color: #fff;
}

.layer-btn {
    height: 26px;
    font-size: 10px;
    border-radius: 4px;
    background: #444;
    color: #ccc;
    border: 1px solid #666;
    cursor: pointer;
    font-family: var(--font-pixel), monospace;
    font-weight: bold;
    padding: 0 8px;
    transition: background 0.15s;
}
.layer-btn:hover {
    background: #555;
}
.layer-btn.active {
    background: #007bff;
    color: #fff;
    border-color: #fff;
}

.tileset-layer-btn.active {
    background: #007bff;
    color: #fff;
    border-color: #fff;
}

.editor-btn {
    height: 24px;
    font-size: 10px;
    border-radius: 3px;
    background: #444;
    color: #eee;
    border: 1px solid #666;
    cursor: pointer;
    font-family: var(--font-pixel), monospace;
    padding: 0 6px;
    white-space: nowrap;
}
.editor-btn:hover {
    background: #555;
}

#entity-editor-container .editor-btn {
    width: 100%;
}

#tileset-image-wrapper {
    position: relative;
    border: 1px solid #000;
    background: #111;
    overflow: auto;
    border-radius: 3px;
    min-height: 40px;
}

#tileset-image-wrapper img {
    display: block;
    max-width: none;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

#tileset-zoom-row {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    color: #aaa;
}
#tileset-zoom-label {
    flex: 1;
}
#tileset-zoom-value {
    color: #fff;
    font-weight: bold;
}
#tileset-zoom-row .editor-btn {
    width: 22px;
    height: 22px;
    padding: 0;
    font-size: 14px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

#tileset-selector {
    position: absolute;
    width: 32px;
    height: 32px;
    border: 2px solid #ffcc00;
    background: rgba(255, 204, 0, 0.3);
    pointer-events: none;
    display: none;
    z-index: 10;
    box-shadow: 0 0 5px #ffcc00;
}

/* --- TILE ANIMADO: overlay de numeração no tileset --- */
#tileset-anim-badges {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 11;
}
.anim-frame-badge {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 60, 60, 0.35);
    border: 2px solid #ff3c3c;
    color: #fff;
    font-family: var(--font-pixel), monospace;
    font-weight: bold;
    font-size: 11px;
    text-shadow: 0 0 3px #000, 0 0 3px #000;
    box-sizing: border-box;
}

#tool-anim-select.active {
    background: #ff3c3c;
    color: #fff;
    border-color: #fff;
}

#anim-builder-panel {
    margin-top: 6px;
    padding: 6px;
    border: 1px solid #555;
    border-radius: 4px;
    background: #1c1c1c;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
#anim-builder-panel.hidden {
    display: none;
}
#anim-builder-header {
    font-size: 10px;
    font-weight: bold;
    color: #ff8c8c;
    font-family: var(--font-pixel), monospace;
}
#anim-frame-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    min-height: 30px;
    max-height: 100px;
    overflow-y: auto;
    padding: 4px;
    background: #111;
    border-radius: 3px;
    border: 1px solid #333;
}
.anim-frame-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #292929;
    border: 1px solid #444;
    border-radius: 3px;
    padding: 2px;
    width: 34px;
}
.anim-frame-thumb {
    width: 24px;
    height: 24px;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    background: #000;
    border-radius: 2px;
}
.anim-frame-order {
    font-size: 8px;
    color: #ccc;
    font-family: var(--font-pixel), monospace;
    margin-top: 1px;
}
.anim-frame-remove {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 14px;
    height: 14px;
    line-height: 12px;
    padding: 0;
    font-size: 9px;
    border-radius: 50%;
    background: #a00;
    color: #fff;
    border: 1px solid #fff;
    cursor: pointer;
}
#anim-builder-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 10px;
    color: #aaa;
}
#anim-builder-row input[type="number"] {
    width: 60px;
    background: #222;
    color: #fff;
    border: 1px solid #555;
    border-radius: 3px;
    padding: 2px 4px;
    font-family: var(--font-pixel), monospace;
    font-size: 10px;
}
#anim-builder-actions {
    display: flex;
    gap: 4px;
}
#anim-builder-actions .editor-btn {
    flex: 1;
}
#anim-builder-actions .editor-btn.primary {
    background: #ff3c3c;
    border-color: #fff;
    color: #fff;
}
#anim-builder-actions .editor-btn.primary:hover {
    background: #ff6060;
}
#anim-builder-actions .editor-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

#special-tools {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 3px;
}

#layer-selector {
    display: flex;
    gap: 3px;
}

#layer-selector .layer-btn {
    flex: 1;
}

#layer-visibility {
    display: flex;
    justify-content: center;
    gap: 6px;
    background: rgba(255,255,255,0.05);
    padding: 3px 5px;
    border-radius: 3px;
    font-size: 9px;
}

#layer-visibility label {
    margin-left: 1px;
    color: #aaa;
    cursor: pointer;
}

#map-name-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 2px 2px;
}

#map-name-row label {
    font-size: 10px;
    color: #aaa;
    white-space: nowrap;
}

#map-name-input {
    flex: 1;
    min-width: 0;
    background: #fff;
    color: #111;
    border: 2px solid #111;
    border-radius: 10px;
    padding: 3px 8px;
    font-family: var(--font-pixel);
    font-size: 10px;
    outline: none;
}

#map-name-input:focus {
    border-color: var(--gold);
}

#map-name-input.map-name-saved {
    border-color: #7fdc7f;
}

#map-name-input.map-name-error {
    border-color: #ff6b6b;
}

#map-ambient-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 2px 2px;
}

#map-ambient-row label {
    font-size: 10px;
    color: #aaa;
    white-space: nowrap;
}

#map-ambient-preset {
    flex: 1;
    min-width: 0;
    background: #fff;
    color: #111;
    border: 2px solid #111;
    border-radius: 10px;
    padding: 3px 4px;
    font-family: var(--font-pixel);
    font-size: 9px;
    outline: none;
}

#map-ambient-intensity {
    width: 70px;
    flex-shrink: 0;
}

#map-ambient-color {
    width: 26px;
    height: 22px;
    padding: 0;
    border: 2px solid #111;
    border-radius: 6px;
    flex-shrink: 0;
    background: none;
    cursor: pointer;
}

#map-daynight-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 2px 2px;
}

#map-ignore-daynight-label {
    font-size: 10px;
    color: #aaa;
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

#map-ignore-daynight {
    width: 12px;
    height: 12px;
    accent-color: #f0c040;
}

#light-radius-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 2px 2px;
}

#light-radius-row label {
    font-size: 10px;
    color: #aaa;
    white-space: nowrap;
}

#light-radius-slider {
    width: 70px;
    flex-shrink: 0;
}

#light-radius-value {
    font-size: 10px;
    color: #f0c040;
    min-width: 14px;
    text-align: center;
}

.tool-active-light .special-tool-btn#tool-light {
    background: #f0c040;
    color: #111;
}

#map-goto-row {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 2px 2px;
    flex-wrap: wrap;
}

#map-goto-row label {
    font-size: 10px;
    color: #aaa;
    white-space: nowrap;
}

#map-goto-row input[type="number"] {
    width: 48px;
    min-width: 0;
    background: #fff;
    color: #111;
    border: 2px solid #111;
    border-radius: 10px;
    padding: 3px 4px;
    font-family: var(--font-pixel);
    font-size: 10px;
    outline: none;
}

#map-goto-row input[type="number"]:focus {
    border-color: var(--gold);
}

#map-goto-btn {
    flex: 1;
    min-width: 72px;
}

#map-replace-btn {
    flex: 1;
    min-width: 64px;
    background: #4a1f1f;
    border-color: #ff6b6b;
}

#map-replace-btn:hover {
    background: #5f2626;
}

#map-create-row {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 2px 2px 6px;
    flex-wrap: wrap;
}

.map-create-line {
    display: flex;
    align-items: center;
    gap: 4px;
}

#map-create-row label {
    font-size: 10px;
    color: #aaa;
    white-space: nowrap;
}

#map-create-row input[type="number"],
#map-create-row input[type="text"] {
    width: 48px;
    min-width: 0;
    background: #fff;
    color: #111;
    border: 2px solid #111;
    border-radius: 10px;
    padding: 3px 4px;
    font-family: var(--font-pixel);
    font-size: 10px;
    outline: none;
}

#map-create-row input[type="number"]:focus,
#map-create-row input[type="text"]:focus {
    border-color: var(--gold);
}

#map-create-btn {
    flex: 1;
    min-width: 72px;
}

#map-create-info {
    font-size: 11px;
    color: #9be29b;
    margin-left: 8px;
    white-space: nowrap;
}

#tileset-select-row {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 5px;
    background: rgba(255,255,255,0.05);
    border-radius: 3px;
    font-size: 10px;
    color: #ddd;
}

#tileset-brush-row {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 3px 5px;
    margin-bottom: 3px;
    background: rgba(255,255,255,0.05);
    border-radius: 3px;
}

#tileset-scatter-options {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}
#tileset-scatter-options.hidden {
    display: none;
}
.tileset-scatter-input {
    width: 30px;
    padding: 2px 2px;
    background: #111;
    color: #fff;
    border: 1px solid #444;
    border-radius: 3px;
    text-align: center;
    font-size: 10px;
    font-family: inherit;
    -moz-appearance: textfield;
    appearance: textfield;
}
.tileset-scatter-input::-webkit-inner-spin-button,
.tileset-scatter-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.tileset-brush-label {
    font-size: 10px;
    color: #ddd;
    margin-right: 2px;
    letter-spacing: 0.5px;
}

.tileset-brush-btn {
    min-width: 26px;
    padding: 2px 5px;
    font-size: 11px;
    line-height: 1.4;
    opacity: 0.75;
}

.tileset-brush-btn:hover {
    opacity: 1;
}

.tileset-brush-btn.active {
    opacity: 1;
    background: var(--gold, #ffd700);
    color: #1a1a1a;
    border-color: var(--gold, #ffd700);
    font-weight: bold;
}

#tileset-select-row select {
    flex: 1;
    background: #111;
    color: #fff;
    border: 1px solid #444;
    padding: 2px 4px;
    border-radius: 3px;
    font-size: 10px;
}

#tileset-color-swatch {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: #999;
    cursor: pointer;
    flex-shrink: 0;
}
#tileset-color-swatch:hover {
    border-color: var(--gold, #ffd700);
}

#tileset-color-popup {
    position: fixed;
    z-index: 5000;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px;
    background: rgba(20, 18, 24, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
#tileset-color-popup.hidden {
    display: none;
}
#tileset-color-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    font-weight: bold;
    color: #fff;
    gap: 12px;
}
#tileset-color-popup-close {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    padding: 0 2px;
}
#tileset-color-popup-close:hover {
    color: var(--gold, #ffd700);
}
#tileset-color-wheel {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    cursor: crosshair;
    border: 2px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}
#tileset-brightness-row,
#tileset-whiten-row {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 9px;
    color: rgba(255,255,255,0.65);
}
#tileset-brightness-row input,
#tileset-whiten-row input {
    flex: 1;
    accent-color: var(--gold);
    cursor: pointer;
}
#tileset-whiten-row input {
    accent-color: #ffffff;
    background: linear-gradient(to right, rgba(255,255,255,0.08), rgba(255,255,255,0.9));
    border-radius: 4px;
}
#tileset-color-actions {
    display: flex;
    justify-content: center;
}
#tileset-color-reset {
    font-size: 10px !important;
    padding: 2px 8px !important;
    min-width: auto !important;
}


/* --- DEBUG INFO --- */
#debug-info {
    position: fixed;       /* Fixa na tela */
    top: 10px;             /* Distância do topo */
    left: 50%;             /* Centraliza horizontalmente */
    transform: translateX(-50%);
    z-index: 2000;         /* Garante que fique acima de tudo (Canvas e UI) */
    
    background: rgba(0, 0, 0, 0.7); /* Fundo semi-transparente para leitura */
    color: #ffff00;        /* Texto Amarelo */
    border: 2px solid #fff;
    padding: 5px 10px;
    
    font-family: var(--font-mono); /* Usa a fonte definida no root */
    font-size: 14px;
    font-weight: bold;
    text-shadow: 1px 1px 0 #000;
    pointer-events: none;  /* Permite clicar através dele */
    display: none;         /* Começa invisível (o JS ativa depois) */
}



	/* ===== SKILLS HUD ===== */
#skills-container {
    position: fixed;
    top: 150px;
    right: 20px;
    width: 280px; /* Aumentado de 220px para 280px */
    background: rgba(25, 25, 25, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    padding: 0;
    z-index: 100;
    font-family: var(--font-pixel);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    left: auto;
    bottom: auto;
    pointer-events: auto !important;
    overflow: hidden;
}

#skills-container.hidden {
    display: none !important;
}

.skills-title {
    text-align: center;
    color: #fff;
    background: rgba(30, 30, 30, 0.4);
    font-weight: bold;
    font-size: 11px;
    padding: 6px 0;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    cursor: move;
    user-select: none;
}

/* Estilos de skill unificados e alinhados */
.skill-item {
    display: flex;
    align-items: center;
    padding: 6px 10px; /* Aumentado o padding */
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    gap: 10px;
    background: rgba(0, 0, 0, 0.2);
    height: 32px; /* Aumentado de 24px para 32px */
    cursor: help;
}

.skill-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.skill-name {
    width: 100px; /* Aumentado de 75px para 100px */
    flex-shrink: 0;
    color: #eee;
    font-size: 11px; /* Aumentado de 10px para 11px */
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.skill-level {
    width: 45px; /* Aumentado de 35px para 45px */
    text-align: right;
    flex-shrink: 0;
    color: var(--gold);
    font-size: 11px; /* Aumentado de 10px para 11px */
    font-weight: bold;
}

.skill-bar {
    flex-grow: 1;
    height: 12px; /* Aumentado de 8px para 12px */
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    border-radius: 6px;
    overflow: hidden;
}

.skill-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #3498db, #2980b9);
    width: 0%;
    transition: width 0.3s ease;
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.5);
}


/* --- TOOLTIP DE SKILL --- */
.skill-entry {
    position: relative; /* Para posicionar o tooltip */
}

#skill-tooltip {
    position: fixed;
    background: rgba(0, 0, 0, 0.9);
    border: 2px solid var(--ui-border-light);
    padding: 8px;
    color: var(--color-text-main);
    font-family: var(--font-mono);
    font-size: 12px;
    z-index: 600;
    pointer-events: none;
    display: none;
    min-width: 150px;
    text-align: center;
    box-shadow: 3px 3px 0 #000;
}

#skill-tooltip strong {
    color: var(--gold);
    font-weight: bold;
}

/* --- ESTILOS DA LOJA DE NPC (mesmo tema "vidro" das outras janelas: cantos arredondados + blur) --- */
#npc-window {
    width: 380px;
    background: rgba(15, 15, 18, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    overflow: hidden;
}

#npc-window .ui-scroll-header {
    background: rgba(25, 25, 30, 0.6);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px 10px 0 0;
}

.npc-shop-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 6px;
    padding: 8px;
    max-height: 320px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    margin: 8px;
}

.shop-item-card {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 4px;
    padding: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.shop-item-card:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.3);
}

.shop-item-icon {
    width: 32px;
    height: 32px;
    object-fit: contain;
    image-rendering: pixelated;
    margin-bottom: 4px;
}

.shop-item-name {
    font-weight: bold;
    font-size: 11px;
    color: var(--color-text-highlight);
    margin-bottom: 2px;
    line-height: 1.2;
}

.shop-item-price {
    font-size: 11px;
    color: var(--gold);
    margin-bottom: 6px;
}

.shop-btn-buy {
    width: 100%;
    padding: 4px;
    font-size: 11px;
    background: rgba(47, 125, 50, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    color: #fff;
    cursor: pointer;
}

.shop-btn-buy:hover {
    background: rgba(62, 154, 66, 0.9);
}

.shop-btn-buy:active {
    filter: brightness(0.9);
}

/* --- ESTILOS DO FERREIRO (blacksmith) --- */
.blacksmith-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    margin-bottom: 5px;
    background: #333;
    border: 1px solid #555;
}

.blacksmith-upgrade-btn {
    padding: 5px 10px;
    font-size: 12px;
}

/* --- ESTILOS DA GUILDA --- */
.guild-form {
    padding: 20px;
    text-align: center;
}

.guild-input {
    width: 80%;
    padding: 8px;
    margin: 10px 0;
    background: #000;
    border: 3px inset var(--ui-border-light);
    color: #fff;
    font-family: var(--font-mono);
    font-size: 14px;
}

/* --- HUD: SKILLS  --- */
#skills-container {
    position: fixed;
    top: 10px;
    right: 10px; /* Posicionamento no canto superior direito */
    width: 250px;
    background: rgba(25, 25, 25, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    pointer-events: auto;
    z-index: 99;
    display: flex;
    flex-direction: column;
    font-family: var(--font-pixel);
    color: var(--color-text-main);
}

#skills-container.hidden {
    display: none !important; /* Garante que a classe hidden funcione */
}

.skills-title {
    background: rgba(30, 30, 30, 0.4);
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    padding: 5px 8px;
    color: #fff;
    font-weight: bold;
    text-align: center;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* Estilos removidos para evitar duplicidade */

/* --- AJUSTES DO EDITOR DE RECURSOS --- */
#entity-editor-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    padding: 4px;
}

#entity-tool-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3px;
    padding: 2px 0 4px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 2px;
}
#entity-tool-buttons .special-tool-btn {
    height: 24px;
    font-size: 9px;
    padding: 0 4px;
}

.entity-tool-row {
    display: flex;
    flex-direction: row;
    gap: 4px;
    padding: 2px 4px;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.entity-tool-row select {
    background: #000;
    color: #fff;
    border: 1px solid var(--ui-border-light);
    padding: 2px 4px;
    font-family: var(--font-pixel);
    font-size: 10px;
    cursor: pointer;
    outline: none;
    flex: 1;
    min-width: 0;
}

.entity-tool-row select:hover {
    border-color: var(--gold);
}

.entity-tool-row input[type="number"] {
    background: #000;
    color: #fff;
    border: 1px solid var(--ui-border-light);
    padding: 2px 4px;
    font-family: var(--font-pixel);
    font-size: 10px;
    width: 48px;
    min-width: 0;
    outline: none;
}

.entity-tool-row input[type="number"]:hover {
    border-color: var(--gold);
}

#resourceSelect option {
    background: #222;
}

/* --- JOYSTICK VIRTUAL (dinâmico, transparente, só mobile) ---
   Só aparece enquanto o dedo está arrastado (ver game.js: startVirtualJoystick /
   updateVirtualJoystick / hideVirtualJoystick). Fica puramente decorativo —
   pointer-events: none — porque quem escuta o toque é o próprio canvas do jogo. */
#virtual-joystick-base {
    position: fixed;
    width: 84px;
    height: 84px;
    margin-left: -42px;
    margin-top: -42px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 0 12px rgba(0, 0, 0, 0.25) inset;
    z-index: 900;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease-out;
}

#virtual-joystick-base.is-visible {
    opacity: 1;
}

#virtual-joystick-knob {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 40px;
    height: 40px;
    margin-left: -20px;
    margin-top: -20px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
}

/* Só deve existir no mobile — trava extra, além do controle já feito em JS
   (isMobileDevice), pra garantir que nunca apareça em desktop. */
body:not(.is-mobile-device) #virtual-joystick-base {
    display: none !important;
}

/* --- BOTÕES DE AÇÃO MOBILE (Ataque / Pick Up) — fosco --- */
.mobile-ctrl-btn {
    position: fixed;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 1px solid rgba(150, 160, 175, 0.18);
    background: rgba(70, 78, 92, 0.32);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    z-index: 950;
    transition: transform 0.1s ease, background 0.15s ease;
}

.mobile-ctrl-btn:active {
    transform: scale(0.88);
    background: rgba(92, 102, 118, 0.45);
}

/* Ataque: canto inferior direito, +10px à esquerda (55->65) e -30px
   pra baixo (81->51) */
#mobile-attack-btn {
    right: 65px;
    bottom: 51px;
    width: 79px;
    height: 79px;
}

#mobile-attack-btn img {
    width: 34px;
    height: 34px;
    object-fit: contain;
    image-rendering: pixelated;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.55));
}

/* Auto ataque ligado: brilho azul sutil no botão de ataque */
#mobile-attack-btn.auto-attack-active {
    border-color: #5aa8ff;
    background: rgba(52, 92, 140, 0.5);
    box-shadow: 0 0 14px rgba(90, 168, 255, 0.7), inset 0 0 10px rgba(90, 168, 255, 0.4);
}

/* Pick up: na diagonal direita superior, acompanha o ataque: +10px à
   esquerda (34->44) e -30px pra baixo (195->165) */
#mobile-pickup-btn {
    right: 44px;
    bottom: 165px;
    width: 39px;
    height: 39px;
}

#mobile-pickup-btn svg {
    width: 60%;
    height: 60%;
}

/* Trocar alvo: entre o ataque e o pick up */
#mobile-target-btn {
    right: 58px;
    bottom: 108px;
    width: 46px;
    height: 46px;
}

#mobile-target-btn svg {
    width: 60%;
    height: 60%;
}

/* Só deve existir no mobile */
body:not(.is-mobile-device) .mobile-ctrl-btn {
    display: none !important;
}

#chat-container {
    top: 8px;
    bottom: auto;
    left: 8px;
    right: auto;
    transform: none;
    width: min(340px, calc(100vw - 16px));
    z-index: 100;
    background: rgba(0, 0, 0, 0.5) !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 8px;
}

/* Garantir que a UI não bloqueie o joystick em dispositivos móveis */
@media (max-width: 768px) {
    #joystick-container {
        bottom: 20px;
        left: 20px;
    }
}

/* --- OTIMIZAÇÃO MOBILE (HUD & INVENTÁRIO) --- */
@media (max-width: 1024px) {
    :root {
        --icon-size: 28px;
        --slot-size: 28px;
        --inv-slot-size: 32px; /* Slots de item um pouco maiores no mobile também */
    }

    /* Ajuste do Inventário para Mobile (Janela Flutuante Compacta) */
    #inventory-window {
        position: fixed !important;
        top: 50%;
        left: 50%;
        right: auto;
        bottom: auto;
        transform: translate(-50%, -50%);
        width: 64vw !important;
        max-width: 420px !important;
        height: auto !important;
        max-height: 78vh !important;
        border: 1px solid rgba(255, 255, 255, 0.18) !important;
        box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45) !important;
        display: flex !important;
        flex-direction: column;
        z-index: 9999 !important;
        background: rgba(25, 25, 25, 0.35) !important;
        backdrop-filter: blur(10px);
        pointer-events: auto !important;
        padding: 2px !important;
        margin: 0 !important;
        user-select: none !important;
        border-radius: 6px !important;
    }

    #inventory-window.hidden {
        display: none !important;
        pointer-events: none !important;
    }

    /* Garante que os popups de cor de cabelo/outfit fiquem acima do inventário no mobile */
    .hair-color-popup {
        z-index: 10500 !important;
    }

    /* Estilo da Grade de Inventário no Mobile Compacto */
    #inventory-grid {
        display: grid !important;
        grid-template-columns: repeat(6, minmax(var(--inv-slot-size), 1fr)) !important;
        grid-auto-rows: var(--inv-slot-size) !important;
        gap: 2px !important;
        flex-grow: 0 !important;
        overflow-y: auto;
        margin: 2px !important;
        padding: 3px !important;
        max-height: 28vh !important;
        background: rgba(0, 0, 0, 0.3) !important;
        align-content: start !important;
        justify-content: stretch !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
        border-radius: 4px !important;
    }

    #inventory-top-section {
        padding: 3px !important;
        margin: 2px !important;
        display: flex !important;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 2px !important;
        align-items: flex-start;
        justify-content: center;
        background: rgba(0, 0, 0, 0.12) !important;
        border-radius: 4px !important;
    }

    .ui-scroll-header {
        padding: 3px 6px !important;
        font-size: 11px !important;
        min-height: 18px !important;
        background: rgba(30, 30, 30, 0.45) !important;
        margin-bottom: 2px !important;
    }

    .ui-scroll-header span {
        line-height: 1 !important;
    }

    .ui-scroll-close {
        width: 22px !important;
        height: 22px !important;
        min-width: 22px !important;
        font-size: 12px !important;
        line-height: 22px !important;
        display: flex !important;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        box-sizing: border-box;
        z-index: 3100 !important;
        position: relative;
    }

    /* Ajuste dos Slots de Equipamento */
    #equipment-slots,
    #special-slots {
        padding: 2px !important;
        gap: 2px !important;
        margin: 0 !important;
    }

    #appearance-panel {
        display: flex !important;
        flex: 1 1 auto;
        min-width: 120px;
        max-width: 160px;
        padding: 4px !important;
        gap: 3px !important;
    }

    #appearance-preview {
        width: 52px;
        height: 52px;
    }

    .appearance-row {
        grid-template-columns: 36px 20px 1fr 20px;
        padding: 2px 4px;
    }

    #inventory-grid {
        margin-top: 6px !important;
        max-height: 28vh !important;
    }

    .equip-row {
        gap: 4px !important;
        margin-bottom: 4px !important;
    }

    .equip-slot {
        width: var(--slot-size) !important;
        height: var(--slot-size) !important;
        min-width: var(--slot-size) !important;
        min-height: var(--slot-size) !important;
        max-width: var(--slot-size) !important;
        max-height: var(--slot-size) !important;
        border-radius: 4px !important;
        margin: 0 !important;
        padding: 0 !important;
        box-sizing: border-box !important;
    }

    .inv-slot {
        width: 100% !important;
        height: 100% !important;
        min-width: var(--inv-slot-size) !important;
        min-height: var(--inv-slot-size) !important;
        border-radius: 4px !important;
        margin: 0 !important;
        padding: 0 !important;
        box-sizing: border-box !important;
    }

    .equip-slot img, .special-slot img {
        max-width: 20px !important;
        max-height: 20px !important;
    }

    .inv-slot img {
        max-width: 22px !important;
        max-height: 22px !important;
    }

    /* Hotbar: força tudo em UMA linha só, encolhendo os slots o quanto
       for preciso para caber (evita quebrar o "0" para uma 2ª/3ª linha
       em cima do personagem). Só se aplica no layout padrão; os
       layouts em grade já são compactos por natureza e não precisam
       encolher. */
    #hotbar-wrapper {
        bottom: 10px !important;
        max-width: calc(100% - 12px) !important;
    }

    #hotbar-container:not(.hotbar-layout-grid-1):not(.hotbar-layout-grid-2):not(.hotbar-layout-vertical) {
        flex-wrap: nowrap !important;
        gap: 3px !important;
    }

    /* Tamanho fluido: encolhe conforme a largura da tela para garantir
       que os 11 slots (ataque + 0-9) sempre caibam numa linha só, sem
       nunca precisar quebrar linha (o que causava slots sobrepostos) */
    #hotbar-container:not(.hotbar-layout-grid-1):not(.hotbar-layout-grid-2):not(.hotbar-layout-vertical) .hotbar-slot {
        width: clamp(22px, calc((100vw - 42px) / 11), 30px) !important;
        height: clamp(22px, calc((100vw - 42px) / 11), 30px) !important;
        min-width: clamp(22px, calc((100vw - 42px) / 11), 30px) !important;
        padding: 2px !important;
    }

    .hotbar-icon {
        width: 18px !important;
        height: 18px !important;
    }

    .hotbar-emoji {
        font-size: 13px !important;
    }

    .key-label {
        font-size: 8px !important;
        top: 1px !important;
        left: 2px !important;
    }

    /* Estilo Ultra-Minimalista para TODOS os Botões HUD no Mobile */
.hud-icon {
        background: none !important;
        border: none !important;
        opacity: 0.75 !important;
        width: 22px !important; /* Reduzido para deixar os botões bem compactos */
        height: 22px !important;
        padding: 0 !important;
        cursor: pointer;
        filter: drop-shadow(1px 1px 2px rgba(0,0,0,0.6));
        transition: transform 0.1s ease, opacity 0.1s ease;
    }

    .hud-icon img {
        width: 100% !important;
        height: 100% !important;
        object-fit: contain !important;
    }

    .hud-icon:active {
        transform: scale(0.85) !important;
        opacity: 1 !important;
    }

/* MENU LEQUE (mobile): um único botão no canto inferior esquerdo; ao tocar,
       os outros botões abrem num arco (fan) ao redor dele. Fechado, o palco
       não intercepta toques (pointer-events: none) — só o botão central. */
    #hud-buttons {
        position: fixed !important;
        top: auto !important;
        left: 8px !important;
        right: auto !important;
        bottom: 8px !important;
        width: 165px !important;
        height: 165px !important;
        display: block !important;
        pointer-events: none !important;
        background: none !important;
        padding: 0 !important;
        border-radius: 0 !important;
        z-index: 1000 !important;
    }

    /* Botão central (único visível quando fechado) */
    #hud-fan-toggle {
        width: 28px !important;
        height: 28px !important;
        position: absolute !important;
        left: 0 !important;
        bottom: 0 !important;
        display: flex !important;
        pointer-events: auto !important;
        background: rgba(0,0,0,0.45) !important;
        border: 1px solid rgba(255,255,255,0.25) !important;
        border-radius: 8px !important;
        z-index: 3 !important;
        transition: transform 0.2s ease;
    }
    #hud-fan-toggle.fan-open-toggle {
        transform: rotate(45deg);
        background: rgba(80, 120, 200, 0.55) !important;
    }

    /* Itens do leque: ancorados na dobradiça (canto). Posição = rotate + translateX.
       O JS define --fan-a (ângulo), --fan-r (raio) e --i (delay em cascata). */
    #hud-buttons .hud-icon:not(#hud-fan-toggle) {
        --fan-r: 98px;
        --fan-a: -10deg;
        position: absolute !important;
        left: 0 !important;
        bottom: 0 !important;
        margin: 0 !important;
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
        transform: rotate(var(--fan-a)) translateX(0) rotate(calc(var(--fan-a) * -1)) !important;
        transition: transform 0.22s cubic-bezier(0.2, 0.7, 0.3, 1.1), opacity 0.2s ease;
        z-index: 2 !important;
    }
    #hud-buttons.fan-open .hud-icon:not(#hud-fan-toggle) {
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
        transform: rotate(var(--fan-a)) translateX(var(--fan-r)) rotate(calc(var(--fan-a) * -1)) !important;
        transition-delay: calc(var(--i, 0) * 24ms);
    }

    /* O wrapper .hud-icon-stack (pvp/eye/settings) vira ponto zero: nada a empilhar */
    #hud-buttons .hud-icon-stack,
    #hud-buttons .hud-icon-toprow {
        position: absolute !important;
        left: 0 !important;
        bottom: 0 !important;
        width: 0 !important;
        height: 0 !important;
        display: block !important;
        margin: 0 !important;
        gap: 0 !important;
    }

    /* O botão do painel admin não participa do leque */
    #hud-buttons #tab-toggle-button {
        display: none !important;
    }

    /* Botão de Interação Mobile (Tecla E) */
    .mobile-action-btn {
        position: fixed !important;
        bottom: 40px !important;
        right: 40px !important;
        width: 70px !important;
        height: 70px !important;
        background: none !important;
        border: none !important;
        padding: 0 !important;
        z-index: 1001 !important;
        cursor: pointer;
        display: flex !important;
        align-items: center;
        justify-content: center;
        opacity: 0.75 !important;
        transition: transform 0.1s ease, opacity 0.1s ease;
        -webkit-tap-highlight-color: transparent;
    }

    .mobile-action-btn.hidden {
        display: none !important;
    }

    .btn-circle {
        width: 100% !important;
        height: 100% !important;
        background: rgba(200, 200, 200, 0.2) !important; /* Cinza claro transparente */
        border: 2px solid rgba(255, 255, 255, 0.3) !important;
        border-radius: 50% !important;
        display: flex !important;
        align-items: center;
        justify-content: center;
        backdrop-filter: blur(2px);
    }

    .mobile-action-btn img {
        width: 50% !important;
        height: 50% !important;
        object-fit: contain !important;
        filter: drop-shadow(0 0 2px rgba(0,0,0,0.5));
    }

    .mobile-action-btn:active {
        transform: scale(0.9) !important;
        opacity: 1 !important;
    }

/* Chat Moderno, Transparente e Legível */
    #chat-container {
        width: 240px !important;
        max-height: 45vh;
        top: 8px !important;
        bottom: auto !important;
        left: 8px !important;
        right: auto !important;
        transform: none;
        background: rgba(0, 0, 0, 0.4) !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
        border-radius: 10px !important;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5) !important;
        backdrop-filter: blur(10px);
        display: flex !important;
        flex-direction: column;
        pointer-events: auto !important;
        z-index: 900 !important; /* Abaixo dos botões HUD */
    }

    #chat-container.hidden {
        display: none !important;
    }

    #chat-log {
        flex-grow: 1;
        overflow-y: auto;
        padding: 6px !important;
        font-family: var(--font-mono);
        font-size: 11px !important;
        max-height: 38vh;
        /* Legibilidade Máxima: Contorno Preto nas Letras */
        text-shadow: 
            -1px -1px 0 #000,  
             1px -1px 0 #000,
            -1px  1px 0 #000,
             1px  1px 0 #000,
             2px  2px 2px rgba(0,0,0,0.8);
        color: #fff;
    }

    #chat-preview {
        font-size: 11px !important;
        text-shadow: 1px 1px 1px #000;
        padding: 0 8px !important;
    }

    #chat-input {
        background: transparent !important;
        border: none !important;
        color: #fff !important;
        text-shadow: 1px 1px 1px #000;
        width: 100%;
        font-size: 11px !important;
    }

    #chat-channel-badge {
        font-size: 10px !important;
        padding: 3px 5px !important;
        max-width: 70px;
    }
    #chat-pin-btn {
        width: 24px !important;
        font-size: 11px !important;
    }

    /* Estado minimizado também no mobile: só a prévia aparece */
    #chat-container.collapsed {
        height: 26px !important;
        width: 160px !important;
    }
    #chat-container.collapsed #chat-log,
    #chat-container.collapsed #chat-input-row {
        display: none !important;
    }

    #status-container {
        top: 80px;
        left: 10px;
        width: auto;
        min-width: 120px;
        max-width: 200px;
    }

    #status-container.status-show-talents {
        width: min(680px, 96vw);
        max-width: none;
        max-height: 86vh;
    }
}

/* Ajustes específicos para Modo Paisagem no Mobile */
@media (max-width: 1024px) and (orientation: landscape) {
    /* Em paisagem sobra LARGURA e falta ALTURA, então trocamos o
       empilhamento vertical (header > top-section > grid) por um
       layout em grade: header no topo ocupando as 2 colunas, e
       embaixo uma faixa lateral fixa (330px) com prisma/special/
       equipment/appearance lado a lado (linha única, sem quebrar),
       e o grid de itens ocupando o resto da largura/altura. */
    #inventory-window {
        position: fixed !important;
        top: 50%;
        left: 50%;
        right: auto;
        bottom: auto;
        transform: translate(-50%, -50%);
        width: 90vw !important;
        max-width: 640px !important;
        height: 86vh !important;
        max-height: 86vh !important;
        border: 1px solid rgba(255, 255, 255, 0.18) !important;
        box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45) !important;
        display: grid !important;
        grid-template-rows: auto 1fr;
        grid-template-columns: 330px 1fr;
        grid-template-areas:
            "header header"
            "top grid";
        z-index: 9999 !important;
        background: rgba(25, 25, 25, 0.35) !important;
        backdrop-filter: blur(10px);
        pointer-events: auto !important;
        padding: 2px !important;
        margin: 0 !important;
        user-select: none !important;
        border-radius: 6px !important;
        overflow: hidden;
    }

    #inventory-window .ui-scroll-header {
        grid-area: header;
    }

    /* special/equipment/appearance ficam lado a lado (como no
       desktop), só que compactados, para caber na altura sem precisar
       rolar. Nada de empilhar em coluna aqui. */
    #inventory-window #inventory-top-section {
        grid-area: top;
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: flex-start !important;
        justify-content: center !important;
        width: 330px !important;
        max-width: 330px !important;
        height: 100%;
        overflow: hidden;
        gap: 5px !important;
        padding: 3px !important;
        margin: 2px !important;
    }

    #inventory-window #special-slots,
    #inventory-window #equipment-slots {
        flex: 0 0 auto !important;
    }

    #inventory-window #inventory-grid {
        grid-area: grid;
        max-height: none !important;
        height: 100%;
        width: 100%;
        margin: 2px 2px 2px 0 !important;
        /* auto-fill deixa o grid usar toda a largura disponível ao
           invés de travar em 6 colunas fixas, já que agora sobra
           bem mais espaço horizontal nesse layout */
        grid-template-columns: repeat(auto-fill, minmax(var(--inv-slot-size), 1fr)) !important;
    }

    #inventory-window #appearance-panel {
        flex: 0 0 128px;
        width: 128px;
        max-width: 128px;
        min-width: 0;
    }

    #inventory-window #appearance-preview {
        width: 44px;
        height: 44px;
    }

    #inventory-window .appearance-row {
        grid-template-columns: 26px 16px 1fr 16px;
        gap: 3px;
        padding: 2px 3px;
    }

    #inventory-window .appearance-label,
    #inventory-window .appearance-value {
        font-size: 9px;
    }

    #inventory-window .appearance-btn {
        width: 16px;
        height: 16px;
    }

    #inventory-window .appearance-title {
        font-size: 10px;
    }

    #inventory-window .appearance-note {
        font-size: 8px;
    }

#chat-container {
        width: 280px;
        max-height: 38vh;
    }

    #central-stats-wrapper {
        top: 5px;
        zoom: 0.8;
    }

    /* Ajuste da HUD de Spells para Mobile Landscape */
    #spells-hud {
        width: 220px !important; /* Reduzido de 250px */
        height: 200px !important; /* Reduzido de 300px */
        background: rgba(25, 25, 25, 0.45) !important;
        border: 1px solid rgba(255, 255, 255, 0.18) !important;
        border-radius: 8px !important;
        box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45) !important;
        backdrop-filter: blur(10px) !important;
        -webkit-backdrop-filter: blur(10px) !important;
    }

    .spells-grid {
        background: rgba(0, 0, 0, 0.3) !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
        padding: 4px !important;
        gap: 4px !important;
    }

    .spell-card {
        background: rgba(255, 255, 255, 0.06) !important;
        border: 1px solid rgba(255, 255, 255, 0.12) !important;
        border-radius: 6px !important;
        padding: 4px !important;
    }

    .spell-card img {
        width: 24px !important; /* Ícones menores */
        height: 24px !important;
    }

    .spell-name {
        font-size: 10px !important;
    }

    .spell-words {
        font-size: 9px !important;
    }

    /* Ajuste da HUD de Status (Char) para Mobile Landscape */
    #status-container {
        width: auto !important; /* Abraça o conteúdo, sem sobra */
        min-width: 120px !important;
        max-width: 200px !important;
        max-height: 250px !important; /* Altura controlada */
        background: rgba(25, 25, 25, 0.45) !important;
        border: 1px solid rgba(255, 255, 255, 0.18) !important;
        border-radius: 8px !important;
        box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45) !important;
        backdrop-filter: blur(10px) !important;
        -webkit-backdrop-filter: blur(10px) !important;
        top: 40px !important; /* Posicionamento simétrico */
        left: 10px !important;
    }

    #status-container.status-show-talents {
        width: 94vw !important;
        max-width: none !important;
        max-height: 88vh !important;
    }

    #status-container.status-show-talents #status-content {
        flex: 0 0 210px;
    }

    #status-content {
        background: rgba(0, 0, 0, 0.3) !important;
        padding: 4px !important;
    }

    .status-row {
        font-size: 10px !important;
        padding: 3px 6px !important;
    }

    .status-points-row {
        font-size: 11px !important;
        margin-top: 4px !important;
    }

    .add-stat-btn {
        height: 18px !important;
        font-size: 10px !important;
        padding: 0 4px !important;
    }

    #status-header {
        background: linear-gradient(to bottom, #444, #222) !important;
        padding: 3px 8px !important;
        min-height: 20px !important;
    }

    #status-header h3 {
        font-size: 11px !important;
        margin: 0 !important;
    }

    #status-close-btn {
        width: 18px !important;
        height: 18px !important;
        font-size: 10px !important;
        line-height: 18px !important;
    }

    /* Ajuste da HUD de Skills (Coleta) para Mobile Landscape */
    #skills-container {
        width: 200px !important; /* Ainda mais estreito */
        max-height: 120px !important; /* Altura fixa reduzida para forçar rolagem */
        background: rgba(30, 30, 30, 0.95) !important;
        border: 2px solid #444 !important;
        border-radius: 8px !important;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6) !important;
        right: 10px !important;
        top: 40px !important;
        overflow-y: auto !important; /* Habilita rolagem vertical */
        scrollbar-width: thin; /* Scrollbar discreta */
        scrollbar-color: #555 transparent;
    }

    /* Estilo da barra de rolagem para navegadores Webkit (Chrome/Safari) */
    #skills-container::-webkit-scrollbar {
        width: 4px;
    }
    #skills-container::-webkit-scrollbar-thumb {
        background: #555;
        border-radius: 2px;
    }

    .skills-title {
        background: linear-gradient(to bottom, #444, #222) !important;
        padding: 4px 0 !important;
        font-size: 10px !important;
        position: sticky; /* Mantém o título fixo no topo ao rolar */
        top: 0;
        z-index: 1;
    }

    .skill-item {
        padding: 4px 8px !important;
        height: 28px !important; /* Reduzido de 32px */
        background: rgba(0, 0, 0, 0.2) !important;
        gap: 6px !important;
    }

    .skill-name {
        width: 80px !important; /* Reduzido de 100px */
        font-size: 10px !important;
    }

    .skill-level {
        width: 35px !important;
        font-size: 10px !important;
    }

    .skill-bar {
        height: 10px !important; /* Reduzido de 12px */
    }

    /* Ajuste da barra de botões de batalha (Start/Pass/Flee/Leave) para Mobile Landscape */
    #battle-ui {
        gap: 4px !important;
        padding: 6px 8px !important;
        bottom: 50px !important;
        border-radius: 6px !important;
    }

    #battle-ui .battle-btn {
        width: 50px !important;
        height: 26px !important;
        font-size: 9px !important;
        border-radius: 4px !important;
    }

    /* Ajuste dos cards de turno (turn-tracker) para Mobile Landscape */
    #turn-tracker {
        top: 40px !important;
        right: 8px !important;
        gap: 6px !important;
        padding: 6px 5px !important;
        border-radius: 10px !important;
        --icon-size: 24px !important;
    }

    .turn-entry-wrap {
        gap: 2px !important;
    }

    .turn-entry {
        border-radius: 4px !important;
    }

    .turn-entry-timer {
        height: 9px !important;
    }

    /* Ajuste da battle-timeline para Mobile Landscape */
    #battle-timeline {
        top: 4px !important;
        padding: 5px 6px !important;
        gap: 4px !important;
        border-radius: 10px !important;
    }

    .timeline-chip-wrap {
        width: 28px !important;
    }

    .timeline-chip {
        width: 22px !important;
        height: 22px !important;
        font-size: 8px !important;
        border-radius: 5px !important;
    }

    .timeline-badges-row {
        max-width: 28px !important;
    }

    .timeline-badge {
        width: 11px !important;
        height: 11px !important;
        font-size: 6px !important;
    }
}

@media (max-width: 1024px) {
    /* Cabeçalho do Inventário Compacto para Mobile */
    .ui-scroll-header {
        height: 40px !important;
        padding: 0 10px !important;
        cursor: move !important;
        touch-action: none !important; /* Impede o scroll do navegador ao arrastar */
        user-select: none !important;
    }

    .ui-scroll-header span {
        font-size: 13px !important; /* Letras menores */
    }

    /* Ajuste dos slots para toque */
    .inv-slot {
        border-width: 3px;
    }

    .inv-qtd {
        font-size: 8px;
        bottom: 1px;
        right: 1px;
        max-width: calc(100% - 2px);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/* ===== MODAIS (CONFIRMAÇÃO E QUANTIDADE) ===== */
#modal-confirm, #quantity-modal, #stat-add-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4); /* Fundo escurecido leve */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100000;
    pointer-events: auto; /* Garante que cliques fora fechem ou sejam bloqueados apenas aqui */
}

#icon-browser-modal.hidden { display: none !important; }

#icon-spritesheet-viewport::-webkit-scrollbar { width: 8px; height: 8px; }
#icon-spritesheet-viewport::-webkit-scrollbar-track { background: #111; }
#icon-spritesheet-viewport::-webkit-scrollbar-thumb { background: #444; border-radius: 4px; }
#icon-spritesheet-viewport::-webkit-scrollbar-thumb:hover { background: #555; }

#icon-spritesheet-img { cursor: crosshair; }
#icon-spritesheet-highlight { transition: left 0.05s, top 0.05s; }

#modal-confirm.hidden, #quantity-modal.hidden, #stat-add-modal.hidden {
    display: none !important;
    pointer-events: none;
}

.modal-box {
    background: rgba(30, 30, 30, 0.75); /* Mais escuro e sofisticado */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 12px;
    min-width: 200px; /* Mais compacta */
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
    border-radius: 8px;
    color: #eee;
    image-rendering: auto;
}

.modal-box h3 {
    margin: 0 0 8px 0;
    font-size: 13px; /* Menor e discreto */
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--gold);
    opacity: 0.9;
}

.modal-box p {
    margin: 5px 0;
    font-size: 11px;
    color: #bbb;
}

.modal-btn {
    padding: 5px 12px;
    min-width: 60px;
    cursor: pointer;
    font-family: var(--font-pixel);
    font-size: 11px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: #fff;
    transition: all 0.2s ease;
}

.modal-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.4);
}

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

#quantity-input,
#stat-add-input {
    width: 60px !important;
    padding: 4px !important;
    background: rgba(0, 0, 0, 0.4) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    border-radius: 4px !important;
    color: var(--gold) !important;
    font-size: 16px !important;
    margin: 10px 0 !important;
    outline: none;
}




/* ===================================
   ESTILOS PARA OBJETOS INTERATIVOS (PLACAS)
   =================================== */

#interactable-dialog,
#interactable-creation-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(92vw, 620px);
    max-height: 78vh;
    z-index: 10000;
    background: rgba(30, 30, 30, 0.74);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 10px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #eee;
    overflow: hidden;
    animation: interactableGlassIn 0.18s ease-out;
}

#interactable-creation-dialog {
    z-index: 10001;
}

@keyframes interactableGlassIn {
    from {
        opacity: 0;
        transform: translate(-50%, -54%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.interactable-dialog-body,
.interactable-creation-body {
    padding: 14px;
}

.interactable-dialog-title {
    margin: 0 0 12px 0;
    color: #fff;
    font-size: 16px;
    font-weight: bold;
    letter-spacing: 0.4px;
    text-shadow: 1px 1px 0 #000;
    text-align: center;
}
.interactable-dialog-text {
    margin: 0;
    padding: 10px;
    max-height: 44vh;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.55;
    text-align: center;
    white-space: pre-wrap;
    word-break: break-word;
    color: #d8d8d8;
}

.interactable-dialog-actions {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
}

.interactable-dialog-btn {
    min-width: 110px;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-family: var(--font-pixel);
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
}

.interactable-dialog-btn:hover {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.3);
}

.interactable-dialog-btn-secondary {
    background: rgba(0, 0, 0, 0.25);
}

.interactable-form-group {
    margin-bottom: 10px;
}

.interactable-form-label {
    display: block;
    margin-bottom: 4px;
    color: #e5e5e5;
    font-size: 12px;
    font-weight: bold;
}

.interactable-form-input,
.interactable-form-textarea {
    width: 100%;
    box-sizing: border-box;
    background: rgba(0, 0, 0, 0.28);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 10px;
    font-size: 13px;
    font-family: var(--font-pixel);
    outline: none;
}

.interactable-form-input:focus,
.interactable-form-textarea:focus {
    border-color: rgba(255, 255, 255, 0.34);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.08);
}

.interactable-form-textarea {
    min-height: 132px;
    max-height: 38vh;
    resize: vertical;
    line-height: 1.45;
}

.interactable-char-count {
    margin: 5px 0 0 0;
    font-size: 11px;
    color: #bcbcbc;
    text-align: right;
}

#interactable-dialog::-webkit-scrollbar,
.interactable-dialog-text::-webkit-scrollbar,
.interactable-form-textarea::-webkit-scrollbar {
    width: 8px;
}

#interactable-dialog::-webkit-scrollbar-thumb,
.interactable-dialog-text::-webkit-scrollbar-thumb,
.interactable-form-textarea::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.22);
    border-radius: 8px;
}

#interactable-dialog::-webkit-scrollbar-track,
.interactable-dialog-text::-webkit-scrollbar-track,
.interactable-form-textarea::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.08);
}

@media (max-width: 600px) {
    #interactable-dialog,
    #interactable-creation-dialog {
        width: 95vw;
        max-height: 84vh;
    }

    .interactable-dialog-title {
        font-size: 14px;
    }

    .interactable-dialog-body,
    .interactable-creation-body {
        padding: 10px;
    }

    .interactable-form-textarea {
        min-height: 110px;
    }
}

/* =================================== */
/* SISTEMA DIA/NOITE - CÓDIGO ADICIONAL */
/* =================================== */

#daynight-container {
    position: fixed;
    pointer-events: none; /* Não interfere com cliques */
    z-index: 50; /* Acima do canvas, abaixo de janelas */
    
    /* Aplicando fundo cinza transparente e bordas arredondadas */
    background: rgba(200, 200, 200, 0.2); /* Cinza claro transparente */
    border-radius: 5px; /* Arredondamento */
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
    padding: 3px; /* Adicionando padding para a imagem não encostar na borda */
    
    /* Oculto por padrão, aparece com a UI do jogo */
    display: none;
    
}

/* Mostra o container quando a UI do jogo está ativa */
body.game-active #daynight-container {
    display: block;
}

#daynight-image {
    display: block;
    width: 16px;
    height: 46px; /* Revertido para a altura original da imagem */
    image-rendering: pixelated; /* Mantém o estilo pixel art */
    opacity: 0.75; /* Opacidade de 75% para combinar com a HUD */
}

/* --- POSICIONAMENTO PC (Telas maiores que 768px) --- */
@media screen and (min-width: 1025px) {
    #skills-window {
        max-height: 520px;
    }

    #daynight-container {
        /* Ajustes do Usuário para PC */
        top: 2.80%; 
        left: 44%;
        transform: translate(250px, -40%); 
    }
}

/* Ajuste para telas mobile */
@media screen and (max-width: 1024px) {
    /* --- POSICIONAMENTO MOBILE: Colado na HUD Central --- */
    #daynight-container {
        /* Mesma altura do top da HUD mobile (5px) */
        top: 4.3px !important; 
        left: 48.48% !important;
        /* Ajuste: 120px é uma estimativa para metade da largura da HUD mobile (240px) */
        transform: translate(120px, 0) !important; 
        right: auto !important;
    }
}

/* --- NOVO LAYOUT DE EQUIPAMENTOS (10 SLOTS) --- */
#equipment-slots {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 6px;
    background: rgba(0, 0, 0, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 4px;
    margin-bottom: 0;
    width: fit-content;
}

.equip-row {
    display: flex;
    gap: 6px;
    justify-content: center;
}

/* Centraliza o slot de bota na última linha */
.equip-slot-center {
    margin: 0 auto;
}

/* Estilização base dos slots para garantir alinhamento */
.equip-slot {
    width: var(--slot-size);
    height: var(--slot-size);
    background-color: #333;
    border: 2px solid #555;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    cursor: pointer;
    box-shadow: inset 2px 2px 4px #000;
}

.equip-slot:hover {
    background-color: #4a4a4a;
    border-color: var(--gold);
}

/* --- HUD DE MAGIAS --- */
#spells-hud {
    width: 250px;
    height: 300px;
    top: 100px;
    right: 10px;
    background: rgba(15, 15, 18, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    overflow: hidden;
}

#spells-hud .ui-scroll-header {
    background: rgba(25, 25, 30, 0.6);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px 10px 0 0;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* --- TALENTOS DO KNIGHT (integrados à janela de Status) --- */
#status-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

#status-container.status-show-talents {
    width: min(920px, 96vw);
    max-width: none;
}

#status-container.status-show-talents #status-content {
    flex: 0 0 280px;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

#status-talents {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

#status-talents.hidden { display: none; }

#talents-toolbar {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 8px 12px;
    background: rgba(25, 25, 30, 0.6);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px 10px 0 0;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    font-size: 13px;
    color: #d4d4d4;
}
.talent-toolbar-item b { color: #ffcc00; font-size: 15px; margin-left: 4px; }
#talents-reset-btn {
    margin-left: auto;
    background: rgba(255, 255, 255, 0.08);
    color: #ffcc00;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 6px;
    font-size: 12px;
    font-weight: bold;
    padding: 5px 12px;
    cursor: pointer;
    font-family: inherit;
}
#talents-reset-btn:hover { background: rgba(255, 255, 255, 0.16); }

#talents-body {
    display: flex;
    flex: 1;
    overflow: hidden;
    padding: 8px;
    gap: 8px;
}
.talent-branch {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    overflow-y: auto;
    scrollbar-width: thin;
}
.talent-branch-head {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: sticky;
    top: 0;
    z-index: 5;
    background: rgba(15, 15, 18, 0.9);
}
.talent-branch-badge {
    border: 3px solid;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    border-radius: 6px;
}
.talent-branch-head b { font-size: 13px; letter-spacing: 1px; margin-top: 4px; }
.talent-branch-head small { font-size: 10px; color: #aaa; }
.talent-branch-spent { margin-top: 3px; font-size: 11px; color: #ffcc00; font-weight: bold; }

.talent-tier {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 6px 4px;
}
.talent-tier:not(:last-child)::after {
    content: '';
    width: 2px;
    height: 8px;
    background: rgba(255, 255, 255, 0.18);
    display: block;
}
.talent-tier-label { font-size: 9px; color: #8a8a8a; letter-spacing: 1px; }
.talent-node-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.talent-item { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.talent-node {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.06);
    border: 2px solid rgba(255, 255, 255, 0.18);
    border-radius: 6px;
    position: relative;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #fff;
    user-select: none;
    transition: all 0.15s ease;
}
.talent-node:hover { background: rgba(255, 255, 255, 0.14); transform: translateY(-1px); }
.talent-node .talent-glyph {
    width: 24px;
    height: 24px;
    position: relative;
}
.talent-node .talent-glyph img.talent-spell-icon {
    width: 24px;
    height: 24px;
    display: block;
    image-rendering: pixelated;
}
.talent-node .talent-glyph img.talent-frame {
    position: absolute;
    top: 0;
    left: 0;
    width: 24px;
    height: 24px;
    image-rendering: pixelated;
    pointer-events: none;
}
/* talento não aprendido: acinzentado */
.talent-node:not(.talent-learn) .talent-glyph img {
    filter: grayscale(1) brightness(0.4);
}
.talent-node.talent-locked { opacity: 0.35; cursor: not-allowed; }
.talent-node.talent-locked:hover { transform: none; }
.talent-node.talent-locked::after {
    content: '\1F512';
    position: absolute;
    right: -2px;
    bottom: -2px;
    font-size: 10px;
    filter: none;
}
.talent-node.talent-learn .talent-glyph img { filter: none; }
.talent-node .talent-prereq {
    position: absolute;
    left: -3px;
    top: -3px;
    font-size: 10px;
    filter: none;
    opacity: 0.9;
}
.talent-pips { display: flex; gap: 3px; height: 6px; }
.talent-pip {
    width: 7px;
    height: 6px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 1px;
}
.talent-pip.talent-pip-on { background: #ffcc00; border-color: #fff; }
.talent-pip.talent-pip-empty { background: rgba(255, 255, 255, 0.35); }

#talents-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(25, 25, 30, 0.6);
    font-size: 11px;
    color: #bbb;
    border-radius: 0 0 10px 10px;
}
.talent-footer-tip { font-style: italic; }

#talent-tooltip {
    position: fixed;
    width: 260px;
    z-index: 3000;
    pointer-events: none;
    display: none;
    padding: 8px 10px;
    background: rgba(20, 20, 24, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
    font-size: 12px;
    color: #c9c9c9;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
#talent-tooltip b { color: #fff; font-size: 13px; }
#talent-tooltip .talent-tt-type {
    font-size: 9px;
    font-weight: bold;
    letter-spacing: 1px;
    padding: 1px 4px;
    border: 1px solid;
    margin-left: 4px;
    border-radius: 3px;
    vertical-align: 2px;
}
#talent-tooltip .talent-tt-type.tt-pas { color: #7fbf7f; border-color: #7fbf7f; }
#talent-tooltip .talent-tt-type.tt-mel { color: #7fb4e8; border-color: #7fb4e8; }
#talent-tooltip .talent-tt-type.tt-ati { color: #e8b07f; border-color: #e8b07f; }
#talent-tooltip .talent-tt-desc { color: #c9c9c9; margin-top: 4px; line-height: 1.35; }
#talent-tooltip .talent-tt-rank { color: #ffcc00; margin-top: 5px; font-size: 11px; }
#talent-tooltip .talent-tt-req { color: #ff9d66; margin-top: 4px; font-size: 11px; }
#talent-tooltip .talent-tt-req.met { color: #7fbf7f; }
#talent-tooltip .talent-tt-hint { color: #888; font-size: 10px; margin-top: 5px; font-style: italic; }

.spells-grid {
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
    flex-grow: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    margin: 4px;
}

.spell-card {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    padding: 6px;
    cursor: pointer;
    user-select: none;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.spell-card:hover {
    background: rgba(255, 255, 255, 0.12);
}

.spell-card img {
    width: 24px;
    height: 24px;
    image-rendering: pixelated;
}

.spell-info {
    display: flex;
    flex-direction: column;
}

.spell-name {
    font-size: 12px;
    font-weight: bold;
    color: var(--gold);
}

.spell-words {
    font-size: 10px;
    color: #aaa;
    font-style: italic;
}

.spell-card.dragging {
    opacity: 0.5;
}

.spell-card.locked {
    filter: brightness(0.4) grayscale(0.6);
    cursor: not-allowed;
    opacity: 0.7;
}

.spell-card.locked:hover {
    background: rgba(255, 255, 255, 0.06);
}

.spell-card.locked img {
    opacity: 0.5;
}

#crafting-window, #melting-window, #carpentry-window, #forging-window, #trapdisarming-window, #cooking-window, #tailoring-window, #shopkeeping-window {
    width: 420px !important; /* Mais compacto */
    height: 320px;
    background: rgba(15, 15, 18, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    overflow: hidden;
}

#crafting-window .ui-scroll-header, #melting-window .ui-scroll-header, #carpentry-window .ui-scroll-header,
#forging-window .ui-scroll-header, #trapdisarming-window .ui-scroll-header, #cooking-window .ui-scroll-header,
#tailoring-window .ui-scroll-header {
    background: rgba(25, 25, 30, 0.6);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px 10px 0 0;
}

#crafting-container, #melting-container, #carpentry-container, #forging-container, #trapdisarming-container, #cooking-container, #tailoring-container {
    display: flex;
    height: calc(100% - 35px); /* Ajuste para o header */
    background: rgba(20, 20, 20, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

#crafting-list, #melting-list, #carpentry-list, #forging-list, #trapdisarming-list, #cooking-list, #tailoring-list {
    width: 150px; /* Mais estreito */
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.3);
}

.craft-item-row {
    padding: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 11px;
    transition: background 0.2s;
}

.craft-item-row:hover { background: rgba(255, 255, 255, 0.05); }
.craft-item-row.selected { 
    background: rgba(255, 204, 0, 0.1); 
    border-left: 3px solid var(--gold);
}

.craft-item-row img { 
    width: 28px; 
    height: 28px; 
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

#crafting-details, #melting-details, #carpentry-details, #forging-details, #trapdisarming-details, #cooking-details, #tailoring-details {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.craft-header { 
    text-align: center; 
    margin-bottom: 10px; 
    width: 100%;
}
.craft-header img { 
    width: 48px; 
    height: 48px; 
    margin-bottom: 4px; 
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.5));
}
.craft-header h3 { 
    color: var(--gold); 
    margin: 0; 
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.craft-materials {
    width: 100%;
    background: rgba(0,0,0,0.4);
    padding: 8px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 10px;
}

.material-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
    font-size: 11px;
    color: #ccc;
}

.material-info { display: flex; align-items: center; gap: 6px; }
.material-info img { width: 20px; height: 20px; }

.btn-craft {
    background: linear-gradient(180deg, rgba(40, 167, 69, 0.6), rgba(30, 126, 52, 0.6));
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    color: #fff;
    width: 100%; /* Ocupa a largura total do container de detalhes */
    max-width: 180px;
    height: 36px;
    font-size: 13px;
    font-family: var(--font-pixel);
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

.btn-craft:hover:not(:disabled) {
    background: linear-gradient(180deg, rgba(40, 167, 69, 0.8), rgba(30, 126, 52, 0.8));
    transform: translateY(-1px);
    box-shadow: 0 6px 12px rgba(40, 167, 69, 0.4);
    border-color: rgba(255, 255, 255, 0.5);
}

.btn-craft:active:not(:disabled) {
    transform: scale(0.95);
}

.btn-craft:disabled { 
    background: rgba(108, 117, 125, 0.2); 
    border-color: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.3);
    cursor: not-allowed;
}



/* Desabilita tooltips em imagens das janelas de craft */
.no-tooltip {
    pointer-events: none !important;
}

.no-skill-tooltip * {
    pointer-events: auto !important;
}

.no-skill-tooltip .skill-item, 
.no-skill-tooltip .skill-entry {
    cursor: default !important;
}



/* --- OTIMIZAÇÃO MOBILE: Quest Log, Shop, Config e Janelas de Craft --- */
/* Estas HUDs usavam apenas o posicionamento fixo de desktop (top/left absolutos),
   o que as jogava parcialmente fora da tela em celulares. Agora ficam centralizadas
   e dimensionadas em vw/vh, mantendo o visual "glass" já aplicado no desktop. */
@media (max-width: 1024px) {
    #quest-log-window {
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        right: auto !important;
        bottom: auto !important;
        transform: translate(-50%, -50%) !important;
        width: 92vw !important;
        max-width: 420px !important;
        max-height: 82vh !important;
        margin: 0 !important;
        z-index: 9999 !important;
    }

    #cash-shop-window {
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        right: auto !important;
        bottom: auto !important;
        transform: translate(-50%, -50%) !important;
        width: 90vw !important;
        max-width: 380px !important;
        height: auto !important;
        max-height: 80vh !important;
        overflow-y: auto !important;
        margin: 0 !important;
        z-index: 9999 !important;
    }

    #settings-window {
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        right: auto !important;
        bottom: auto !important;
        transform: translate(-50%, -50%) !important;
        width: 85vw !important;
        max-width: 320px !important;
        height: auto !important;
        max-height: 80vh !important;
        overflow-y: auto !important;
        margin: 0 !important;
        z-index: 9999 !important;
    }

    #crafting-window, #melting-window, #carpentry-window, #forging-window,
    #trapdisarming-window, #cooking-window, #tailoring-window {
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        right: auto !important;
        bottom: auto !important;
        transform: translate(-50%, -50%) !important;
        width: 92vw !important;
        max-width: 380px !important;
        height: auto !important;
        max-height: 74vh !important;
        margin: 0 !important;
        z-index: 9999 !important;
    }

    #crafting-container, #melting-container, #carpentry-container, #forging-container,
    #trapdisarming-container, #cooking-container, #tailoring-container {
        height: calc(74vh - 40px) !important;
    }

    #crafting-list, #melting-list, #carpentry-list, #forging-list,
    #trapdisarming-list, #cooking-list, #tailoring-list {
        width: 100px !important;
        flex-shrink: 0;
    }

    .craft-item-row {
        padding: 6px !important;
        gap: 6px !important;
        font-size: 10px !important;
    }

    .craft-item-row img {
        width: 22px !important;
        height: 22px !important;
    }

    #crafting-details, #melting-details, #carpentry-details, #forging-details,
    #trapdisarming-details, #cooking-details, #tailoring-details {
        padding: 8px !important;
    }

    .craft-header img {
        width: 40px !important;
        height: 40px !important;
    }

    /* --- HUD DE GUILDA (Criação, Info e Editor de Brasão) para Mobile --- */
    #guild-create-window {
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        right: auto !important;
        bottom: auto !important;
        transform: translate(-50%, -50%) !important;
        width: 88vw !important;
        max-width: 300px !important;
        height: auto !important;
        margin: 0 !important;
        z-index: 9999 !important;
    }

    #guild-info-window {
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        right: auto !important;
        bottom: auto !important;
        transform: translate(-50%, -50%) !important;
        width: 94vw !important;
        max-width: 400px !important;
        height: auto !important;
        max-height: 85vh !important;
        margin: 0 !important;
        z-index: 9999 !important;
    }

    #guild-info-window .guild-create-content {
        padding: 8px !important;
        gap: 8px !important;
        overflow-y: auto !important;
        max-height: calc(85vh - 40px) !important;
        box-sizing: border-box;
    }

    #guild-crest-window {
        top: 50% !important;
        transform: translate(-50%, -50%) !important;
        width: 92vw !important;
        max-width: 340px !important;
        height: auto !important;
        max-height: 88vh !important;
        z-index: 9999 !important;
    }

    #guild-crest-window .guild-crest-content {
        padding: 10px !important;
        gap: 10px !important;
        overflow-y: auto !important;
        max-height: calc(88vh - 40px) !important;
        box-sizing: border-box;
    }

    /* Painel superior (brasão + nome/nível) mais compacto */
    .guild-crest-display {
        flex: 0 0 48px !important;
        width: 48px !important;
        height: 48px !important;
    }

    .guild-name-banner {
        font-size: 13px !important;
        padding: 6px 8px !important;
    }

    .guild-level-badge {
        font-size: 10px !important;
        padding: 4px 7px !important;
    }

    .guild-exp-bar-container {
        height: 16px !important;
    }

    .guild-exp-bar-label {
        font-size: 9px !important;
    }

    .guild-desc-box {
        font-size: 11px !important;
        padding: 6px 8px !important;
    }

    /* Tabela de membros: colunas reduzidas + scroll horizontal de segurança */
    .guild-table-wrap {
        overflow-x: auto !important;
        max-height: 200px !important;
    }

    .guild-members-table {
        font-size: 9px !important;
    }

    .guild-members-table thead th,
    .guild-members-table td {
        padding: 4px 2px !important;
    }

    .guild-members-table .col-char { width: 20px !important; }
    .guild-members-table .col-lvl { width: 24px !important; }
    .guild-members-table .col-rank { width: 60px !important; }
    .guild-members-table .col-pexp { width: 32px !important; }
    .guild-members-table .col-exp { width: 40px !important; }
    .guild-members-table .col-note { width: 54px !important; }

    .guild-actions-row-btns .guild-btn-create,
    .guild-actions-row-btns .guild-btn-cancel {
        font-size: 10px !important;
        padding: 6px 3px !important;
    }

    /* Editor de brasão: empilha o grid e a paleta de cores em vez de lado a lado */
    .guild-editor-row {
        flex-direction: column !important;
        align-items: center !important;
        gap: 10px !important;
    }

    .guild-crest-grid {
        --guild-cell-size: 20px !important;
    }

    .guild-palette-wrap {
        width: 100% !important;
    }

    .guild-name-row {
        flex-wrap: wrap !important;
    }

    .guild-name-row label {
        font-size: 12px !important;
    }
}

/* --- BOTÃO DE INTERAÇÃO (Simula Tecla E) --- */
#interaction-button-container {
    position: fixed;
    bottom: 40px;
    right: 40px;
    width: 120px;
    height: 120px;
    z-index: 1000;
    pointer-events: auto;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Otimização Mobile para o Botão de Interação */
@media (max-width: 768px) {
    #interaction-button-container {
        bottom: 20px;
        right: 20px;
        width: 100px;
        height: 100px;
    }
}













/* ===== Espectador voluntário de batalha (olhinho + HUD) ===== */
.hud-icon-toprow {
    display: flex;
    flex-direction: row;
    gap: 8px;
}

#spectator-eye-btn {
    font-size: 18px;
    background: rgba(255, 215, 0, 0.12);
    border-color: rgba(255, 215, 0, 0.5);
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.35), 0 4px 15px rgba(0, 0, 0, 0.3);
    animation: spectatorEyePulse 1.8s ease-in-out infinite;
}

#spectator-eye-btn:hover {
    background: rgba(255, 215, 0, 0.22);
}

#spectator-eye-btn.hidden { display: none; }

@keyframes spectatorEyePulse {
    0%, 100% { box-shadow: 0 0 8px rgba(255, 215, 0, 0.3), 0 8px 20px rgba(0,0,0,0.5); }
    50% { box-shadow: 0 0 16px rgba(255, 215, 0, 0.7), 0 8px 20px rgba(0,0,0,0.5); }
}

#spectator-hud-panel {
    position: fixed;
    top: 140px;
    right: 14px;
    width: 260px;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    background: rgba(15, 15, 18, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    z-index: 2001;
    overflow: hidden;
}

#spectator-hud-panel.hidden { display: none; }

.spectator-hud-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.06);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-family: var(--font-pixel);
    font-size: 11px;
    color: #fff;
    text-shadow: 1px 1px 0 #000;
}

#spectator-hud-close, #spectator-hud-back {
    cursor: pointer;
    color: rgba(255, 255, 255, 0.65);
}

#spectator-hud-close:hover { color: #fff; }

#spectator-hud-list-view {
    overflow-y: auto;
    max-height: calc(70vh - 40px);
}

#spectator-hud-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px;
}

.spectator-battle-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 6px 8px;
    font-family: var(--font-pixel);
    font-size: 10px;
    color: #fff;
    text-shadow: 1px 1px 0 #000;
}

.spectator-battle-card-title {
    color: var(--gold, #ffd700);
    margin-bottom: 4px;
    font-size: 10px;
}

.spectator-battle-side {
    line-height: 1.6;
    word-break: break-word;
}

.spectator-battle-vs {
    text-align: center;
    color: rgba(255,255,255,0.4);
    margin: 2px 0;
}

.spectator-watch-btn {
    margin-top: 6px;
    width: 100%;
    text-align: center;
    background: rgba(255, 215, 0, 0.15);
    border: 1px solid rgba(255, 215, 0, 0.4);
    border-radius: 6px;
    padding: 4px 0;
    cursor: pointer;
    color: #ffe27a;
}

.spectator-watch-btn:hover {
    background: rgba(255, 215, 0, 0.28);
}

#spectator-hud-grid-view {
    padding: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

#spectator-hud-grid-view.hidden { display: none; }

#spectator-hud-grid-info {
    width: 100%;
    font-family: var(--font-pixel);
    font-size: 10px;
    color: #fff;
    text-shadow: 1px 1px 0 #000;
    text-align: center;
    line-height: 1.5;
}

#spectator-hud-canvas {
    background: #10160f;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 6px;
    image-rendering: pixelated;
}

#spectator-hud-back {
    font-family: var(--font-pixel);
    font-size: 10px;
    color: rgba(255,255,255,0.65);
    margin-top: 2px;
}

#spectator-hud-back:hover { color: #fff; }

/* =========================================================================
   FORÇAR ORIENTAÇÃO PAISAGEM NO MOBILE (a partir do clique em "Play")
   =========================================================================
   Em navegadores que suportam a Screen Orientation API (Chrome/Android),
   a orientação é travada via JS (ver lockOrientationLandscape() em game.js).
   Em navegadores que NÃO suportam (Safari/iOS), este overlay cobre a tela
   inteira e pede pro jogador girar o aparelho manualmente. Ele só é ativado
   depois que o <body> recebe a classe "in-game" (clique no botão Play). */

#rotate-device-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: #000;
    color: #fff;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 24px;
}

#rotate-device-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    max-width: 320px;
}

#rotate-device-icon {
    font-size: 56px;
    line-height: 1;
    animation: rotate-device-spin 1.6s ease-in-out infinite;
}

#rotate-device-content p {
    font-family: var(--font-pixel);
    font-size: 13px;
    line-height: 1.6;
    color: #fff;
    margin: 0;
}

@keyframes rotate-device-spin {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(90deg); }
}

/* Só mostra o overlay depois que o jogo começou (classe "in-game" no body)
   E o aparelho estiver em modo retrato numa tela pequena (mobile). */
@media (max-width: 932px) and (orientation: portrait) {
    body.in-game #rotate-device-overlay {
        display: flex;
    }
}

/* ======== SHOPKEEPING HUD ======== */
#shopkeeping-window {
    width: 400px;
    height: 380px;
}
#shopkeeping-tabs {
    display: flex;
    gap: 4px;
    padding: 6px 10px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.shop-tab {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 4px;
    color: #ccc;
    padding: 4px 16px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
}
.shop-tab.active {
    background: rgba(255,200,50,0.25);
    border-color: rgba(255,200,50,0.5);
    color: #ffd700;
}
#shopkeeping-tax {
    margin-left: auto;
    font-size: 11px;
    color: #e67e22;
    align-self: center;
}
#shopkeeping-slots {
    padding: 8px;
    overflow-y: auto;
    max-height: 300px;
}
.shop-slots-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.shop-slot {
    width: 108px;
    height: 60px;
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
    padding: 4px;
    box-sizing: border-box;
}
.shop-slot:hover { border-color: rgba(255,200,50,0.5); }
.shop-slot.empty { justify-content: center; align-items: center; cursor: pointer; }
.shop-slot-plus { font-size: 24px; color: #555; }
.shop-slot-icon { width: 32px; height: 32px; object-fit: contain; margin-right: 4px; }
.shop-slot-info { flex: 1; overflow: hidden; }
.shop-slot-name { font-size: 10px; color: #ddd; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shop-slot-price { font-size: 11px; color: #ffd700; font-weight: bold; }
.shop-slot-qty { font-size: 10px; color: #aaa; }
.shop-slot-remove {
    position: absolute; top: 2px; right: 2px;
    background: rgba(200,0,0,0.6); border: none; color: #fff;
    border-radius: 3px; cursor: pointer; font-size: 9px;
    width: 16px; height: 16px; line-height: 16px; text-align: center; padding: 0;
}
.shop-slot-remove:hover { background: rgba(255,0,0,0.8); }

/* Item picker */
#shop-item-picker {
    width: 300px;
    max-height: 350px;
}
#shop-item-picker-list {
    padding: 6px;
    overflow-y: auto;
    max-height: 300px;
}
.shop-picker-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    color: #ddd;
}
.shop-picker-item:hover { background: rgba(255,200,50,0.15); }

/* Price dialog */
#shop-price-dialog {
    width: 280px;
    height: auto;
    min-height: 200px;
}
#shop-price-dialog-content {
    padding: 12px;
}
#shop-price-dialog-content label {
    display: block;
    font-size: 11px;
    color: #aaa;
    margin-top: 8px;
    margin-bottom: 2px;
}
#shop-price-dialog-content input {
    width: 100%;
    padding: 6px;
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 4px;
    color: #fff;
    font-size: 14px;
    box-sizing: border-box;
}
#shop-price-item-preview {
    margin-bottom: 6px;
    color: #ffd700;
    font-size: 13px;
}
#shop-price-dialog-buttons, #shop-buy-dialog-buttons {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}
#shop-price-dialog-buttons button, #shop-buy-dialog-buttons button {
    flex: 1;
    padding: 6px;
    border-radius: 4px;
    border: 1px solid rgba(255,255,255,0.2);
    cursor: pointer;
    font-weight: bold;
    font-size: 12px;
}
#shop-price-dialog-buttons button:first-child {
    background: rgba(46,204,113,0.3);
    color: #2ecc71;
}
#shop-price-dialog-buttons button:last-child, #shop-buy-dialog-buttons button:last-child {
    background: rgba(255,255,255,0.08);
    color: #aaa;
}
#shop-buy-dialog-buttons button:first-child {
    background: rgba(230,126,34,0.3);
    color: #e67e22;
}

/* Buy dialog */
#shop-buy-dialog {
    width: 280px;
    height: auto;
    min-height: 180px;
}
#shop-buy-dialog-content {
    padding: 12px;
}
#shop-buy-dialog-content label {
    display: block;
    font-size: 11px;
    color: #aaa;
    margin-top: 8px;
    margin-bottom: 2px;
}
#shop-buy-dialog-content input {
    width: 100%;
    padding: 6px;
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 4px;
    color: #fff;
    font-size: 14px;
    box-sizing: border-box;
}
#shop-buy-item-preview {
    color: #ffd700;
    font-size: 13px;
}
#shop-buy-total {
    margin-top: 8px;
    font-size: 12px;
    color: #e67e22;
    font-weight: bold;
}

/* Purchase confirmation modal (centralizado, estilo bank-window) */
#house-purchase-modal {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20000;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
#house-purchase-modal.hidden { display: none; }
#house-purchase-modal-inner {
    background: rgba(30, 30, 30, 0.95);
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 12px;
    padding: 20px 24px;
    min-width: 280px;
    max-width: 90vw;
    text-align: center;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.6);
}
#house-purchase-modal-title {
    font-size: 16px;
    font-weight: bold;
    color: #ffd700;
    margin-bottom: 12px;
    text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}
#house-purchase-modal-body {
    font-size: 13px;
    color: #d4d4d4;
    margin-bottom: 16px;
    line-height: 1.5;
}
#house-purchase-modal-buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
}
#house-purchase-modal-buttons button {
    padding: 8px 24px;
    font-size: 13px;
    font-weight: bold;
    border-radius: 6px;
    cursor: pointer;
    border: 1px solid rgba(255,255,255,0.2);
    font-family: var(--font-pixel);
}
#house-purchase-yes {
    background: linear-gradient(180deg, rgba(0,200,0,0.85), rgba(0,160,0,0.85));
    color: #fff;
}
#house-purchase-yes:hover {
    background: linear-gradient(180deg, rgba(0,220,0,0.95), rgba(0,180,0,0.95));
}
#house-purchase-no {
    background: rgba(60,60,60,0.7);
    color: #ccc;
}
#house-purchase-no:hover {
    background: rgba(80,80,80,0.8);
}
.active-btn-highlight {
    background: #ffcc00 !important;
    color: #000 !important;
    border-color: #fff !important;
}

/* ===========================================================================
   MOBILE: DESLIGA BACKDROP-FILTER
   Blur/saturate atrás de painéis é um dos maiores geradores de jank em
   Android (re-litiga o conteúdo atrás a cada frame). Os painéis mantêm o
   fundo semitransparente (rgba), então seguem legíveis sem o desfoque.
   Gate duplo: classe is-mobile-device (setada pelo game.js) + pointer grosso
   (touch), assim PCs/notebooks 2-em-1 e "desktop mode" de iPad (UA de
   desktop) não perdem o visual glass.
=========================================================================== */
@media (hover: none) and (pointer: coarse) {
    body.is-mobile-device * {
        -webkit-backdrop-filter: none !important;
        backdrop-filter: none !important;
    }
}


/* ===== Seletor de bandeiras BR/US no login ===== */
.login-language-switcher {
  position: absolute;
  top: 12px;
  left: 14px;
  z-index: 40;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.login-language-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 30px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  box-shadow: none;
}
.login-language-toggle:hover { opacity: 0.85; }
.login-language-flag-img {
  display: block;
  width: 26px;
  height: 26px;
  object-fit: cover;
  border-radius: 4px;
}
.login-language-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px;
  background: rgba(11, 18, 30, 0.55);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border: 1px solid rgba(120, 210, 255, 0.35);
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.5);
}
.login-language-menu.hidden { display: none; }
.login-language-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: none;
  background: transparent;
  color: #e6f2ff;
  font-size: 14px;
  text-align: left;
  border-radius: 6px;
  cursor: pointer;
}
.login-language-flag { display: flex; align-items: center; line-height: 1; }
.login-language-option:hover { background: rgba(122, 210, 255, 0.15); }
