/* ========== GLOBAL CHAT BUTTON ========== */
#globalChatBtn {
    position: relative;
    width: 42px;
    height: 42px;
    padding: 0;
    background: linear-gradient(135deg, rgba(60, 45, 30, 0.9), rgba(40, 30, 20, 0.9));
    border: 1px solid var(--gold-dark, #8b7355);
    border-radius: 6px;
    color: var(--gold-light, #f8e6c8);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
    transition: all 0.3s;
}

#globalChatBtn:hover {
    background: linear-gradient(135deg, rgba(80, 60, 40, 1), rgba(60, 45, 30, 1));
    border-color: var(--gold-primary, #d4af37);
    transform: scale(1.05);
}

#globalChatBtn svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    fill: none;
}

.global-chat-online-badge {
    position: absolute;
    top: -6px;
    right: -2px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    border: 2px solid rgba(0, 0, 0, 0.4);
    border-radius: 999px;
    color: #f4fff6;
    font-size: 9px;
    font-weight: 700;
    font-family: 'Roboto', sans-serif;
    line-height: 12px;
    text-align: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

.global-chat-badge {
    position: absolute;
    top: -4px;
    right: 18px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    border: 2px solid rgba(0, 0, 0, 0.5);
    border-radius: 9px;
    color: #fff;
    font-size: 10px;
    font-weight: bold;
    font-family: 'Roboto', sans-serif;
    line-height: 14px;
    text-align: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
    animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {

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

    50% {
        transform: scale(1.1);
    }
}

/* ========== GLOBAL CHAT MODAL - DESKTOP ========== */
.global-chat-modal {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 380px;
    max-width: 95vw;
    height: 480px;
    max-height: 80vh;
    z-index: 1500;
    display: flex;
    flex-direction: column;
    /* Transparência sem blur (melhor performance) */
    background: linear-gradient(135deg, rgba(43, 34, 24, 0.92), rgba(26, 20, 15, 0.95));
    border: 2px solid var(--border-gold, #8b7355);
    border-radius: 10px;
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.8),
        0 8px 32px rgba(0, 0, 0, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    /* Evitar mudanças de tamanho */
    box-sizing: border-box;
}

.global-chat-modal .window-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: linear-gradient(180deg, rgba(60, 50, 40, 0.7), rgba(30, 25, 20, 0.8));
    border-bottom: 1px solid rgba(139, 115, 85, 0.5);
    border-radius: 8px 8px 0 0;
    cursor: move;
    user-select: none;
    -webkit-user-select: none;
    flex-shrink: 0;
    touch-action: none;
}

.global-chat-modal .window-header strong {
    color: var(--gold-light, #f8e6c8);
    font-family: 'MedievalSharp', cursive;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.global-chat-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Toggle de Overlay - Olho */
.global-chat-overlay-toggle {
    width: auto;
    height: 26px;
    padding: 0 8px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(139, 115, 85, 0.5);
    border-radius: 5px;
    color: var(--text-muted, #a09080);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    gap: 6px;
    font-size: 11px;
    font-family: 'Roboto', sans-serif;
    font-weight: 500;
    text-transform: none;
    white-space: nowrap;
    min-width: 110px;
    flex-shrink: 0;
}

.global-chat-overlay-toggle svg {
    flex-shrink: 0;
    pointer-events: none;
}

.global-chat-overlay-toggle span {
    display: inline-block;
    font-size: 10px;
    line-height: 1;
    color: inherit;
    margin-top: 1px;
}

.global-chat-overlay-toggle:hover {
    background: rgba(60, 50, 40, 0.6);
    border-color: rgba(139, 115, 85, 0.7);
    color: var(--gold-light, #f8e6c8);
}

/* Quando ATIVO (overlay visível) - olho aberto, dourado */
.global-chat-overlay-toggle.active {
    background: rgba(212, 175, 55, 0.2);
    border-color: var(--gold-primary, #d4af37);
    color: var(--gold-primary, #d4af37);
    box-shadow: 0 0 8px rgba(212, 175, 55, 0.4);
}


/* Linha riscando o olho quando inativo */
.global-chat-overlay-toggle::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 2px;
    background: currentColor;
    transform: rotate(-45deg);
    opacity: 1;
    transition: opacity 0.2s ease;
}

/* Remove a linha quando ativo */
.global-chat-overlay-toggle.active::after {
    opacity: 0;
}

/* ========== BOTÃO FECHAR PADRÃO ========== */
.global-chat-modal .window-close-btn,
.global-chat-modal #closeGlobalChatBtn {
    width: 26px;
    height: 26px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(139, 115, 85, 0.5);
    border-radius: 5px;
    color: var(--text-muted, #a09080);
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.global-chat-modal .window-close-btn:hover,
.global-chat-modal #closeGlobalChatBtn:hover {
    background: rgba(60, 50, 40, 0.6);
    border-color: var(--gold-primary, #d4af37);
    color: var(--gold-primary, #d4af37);
}

/* ========== TABS ========== */
.global-chat-tabs {
    display: flex;
    padding: 0 10px;
    background: rgba(0, 0, 0, 0.25);
    border-bottom: 1px solid rgba(139, 115, 85, 0.3);
    flex-shrink: 0;
}

.global-chat-tab {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 10px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted, #a09080);
    font-family: 'Roboto', sans-serif;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.global-chat-tab:hover {
    color: var(--gold-light, #f8e6c8);
    background: rgba(212, 175, 55, 0.08);
}

.global-chat-tab.active {
    color: var(--gold-light, #f8e6c8);
    border-bottom-color: var(--gold-primary, #d4af37);
    background: rgba(212, 175, 55, 0.05);
}

.global-chat-tab svg {
    opacity: 0.7;
    width: 14px;
    height: 14px;
    display: inline-block;
    vertical-align: middle;
    fill: currentColor;
    flex-shrink: 0;
    pointer-events: none;
}

.global-chat-modal svg {
    display: block;
}

.global-chat-modal button svg {
    fill: currentColor;
    color: inherit;
    flex-shrink: 0;
}

.global-chat-modal button svg[fill="none"] {
    fill: none;
    stroke: currentColor;
}

.global-chat-modal svg path {
    fill: currentColor;
    stroke: currentColor;
}

.global-chat-modal svg [fill="none"] {
    fill: none;
}

.global-chat-modal svg [stroke="none"] {
    stroke: none;
}

.global-chat-tab.active svg {
    opacity: 1;
}

.online-count {
    background: rgba(40, 167, 69, 0.25);
    border: 1px solid rgba(40, 167, 69, 0.5);
    border-radius: 10px;
    padding: 2px 7px;
    font-size: 10px;
    font-weight: bold;
    color: #5fd97f;
}

/* ========== CONTENT ========== */
.global-chat-content {
    flex: 1;
    overflow: hidden;
    position: relative;
    min-height: 0;
}

.global-chat-messages {
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    /* Scrollbar sempre visível */
    scrollbar-width: thin;
    scrollbar-color: rgba(139, 115, 85, 0.6) rgba(30, 24, 18, 0.4);
    scrollbar-gutter: stable;
}

.global-chat-messages::-webkit-scrollbar {
    width: 8px;
}

.global-chat-messages::-webkit-scrollbar-track {
    background: rgba(30, 24, 18, 0.4);
    border-radius: 4px;
}

.global-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(139, 115, 85, 0.6);
    border-radius: 4px;
}

.global-chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(139, 115, 85, 0.8);
}

/* ========== MESSAGE ========== */
.global-chat-message {
    flex-direction: column;
    gap: 4px;
    padding: 6px 8px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 6px;
    border-left: 2px solid transparent;
    font-size: 13px;
    line-height: 1.5;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.global-chat-message:hover {
    background: rgba(0, 0, 0, 0.4);
    border-left-color: rgba(212, 175, 55, 0.5);
}

.global-chat-message.mention {
    background: rgba(86, 64, 30, 0.45);
    border-left-color: rgba(230, 200, 120, 0.8);
}

.global-chat-message.mention .global-chat-name {
    color: #f8e6c8;
}

.global-chat-message-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.global-chat-time {
    color: rgba(160, 144, 128, 0.6);
    font-size: 10px;
    font-family: 'Roboto Mono', monospace;
    flex-shrink: 0;
}

.global-chat-name {
    color: var(--gold-primary, #d4af37);
    font-weight: 600;
    flex-shrink: 0;
}

.global-chat-name.staff {
    color: #e74c3c;
}

.global-chat-name.king {
    color: #9b59b6;
}

.global-chat-text {
    color: var(--text-main, #f0e6d6);
    word-break: break-word;
    width: 100%;
}

.global-chat-message img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin-top: 5px;
    display: block;
}

/* Broadcast messages */
.global-chat-message.broadcast {
    background: rgba(139, 69, 69, 0.3);
    border-left-color: #e74c3c;
}

.broadcast-text {
    color: #ff8888;
    font-weight: 500;
}

/* ========== PLAYERS LIST ========== */
.global-chat-players {
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    /* Scrollbar sempre visível */
    scrollbar-width: thin;
    scrollbar-color: rgba(139, 115, 85, 0.6) rgba(30, 24, 18, 0.4);
    scrollbar-gutter: stable;
}

.global-chat-bonus-hint {
    font-size: 11px;
    color: rgba(224, 210, 180, 0.7);
    text-align: center;
    padding: 4px 6px;
    border: 1px dashed rgba(139, 115, 85, 0.35);
    border-radius: 6px;
    background: rgba(20, 16, 12, 0.35);
}

.global-chat-players::-webkit-scrollbar {
    width: 8px;
}

.global-chat-players::-webkit-scrollbar-track {
    background: rgba(30, 24, 18, 0.4);
    border-radius: 4px;
}

.global-chat-players::-webkit-scrollbar-thumb {
    background: rgba(139, 115, 85, 0.6);
    border-radius: 4px;
}

.global-chat-player {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 8px;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.global-chat-player:hover {
    background: rgba(0, 0, 0, 0.4);
    border-color: rgba(139, 115, 85, 0.4);
}

.player-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #3a3020, #252015);
    border: 2px solid rgba(139, 115, 85, 0.5);
    border-radius: 50%;
    flex-shrink: 0;
    overflow: hidden;
}

.player-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 0%;
    transform: scale(2.0);
    transform-origin: center 15%;
}

.player-avatar.ai-avatar img {
    object-fit: contain;
    transform: none;
    padding: 2px;
    background: rgba(0, 0, 0, 0.2);
}

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

.player-name {
    color: var(--gold-light, #f8e6c8);
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-title {
    color: var(--text-muted, #a09080);
    font-size: 11px;
}

.global-chat-group-btn {
    margin-left: auto;
    padding: 6px 8px;
    font-size: 11px;
    font-weight: 600;
    color: var(--gold-light, #f8e6c8);
    background: rgba(139, 115, 85, 0.25);
    border: 1px solid rgba(139, 115, 85, 0.45);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.global-chat-group-btn:hover {
    background: rgba(139, 115, 85, 0.4);
    border-color: rgba(201, 160, 110, 0.6);
}

.global-chat-group-btn.kick {
    background: rgba(120, 40, 30, 0.35);
    border-color: rgba(180, 70, 50, 0.6);
    color: #f7d8c8;
}

.global-chat-group-btn.kick:hover {
    background: rgba(150, 55, 40, 0.45);
    border-color: rgba(200, 90, 70, 0.7);
}

.global-chat-no-players {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted, #a09080);
    font-style: italic;
}

/* ========== INPUT ========== */
.global-chat-input-container {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    background: rgba(0, 0, 0, 0.4);
    border-top: 1px solid rgba(139, 115, 85, 0.3);
    border-radius: 0 0 10px 10px;
    flex-shrink: 0;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.global-chat-mention-btn {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: var(--gold-light, #f8e6c8);
    background: rgba(139, 115, 85, 0.25);
    border: 1px solid rgba(139, 115, 85, 0.45);
    border-radius: 6px;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.global-chat-mention-btn:hover {
    background: rgba(139, 115, 85, 0.35);
    border-color: rgba(201, 160, 110, 0.6);
}

.global-chat-mention-list {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 52px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px;
    background: rgba(20, 15, 10, 0.96);
    border: 1px solid rgba(139, 115, 85, 0.5);
    border-radius: 8px;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.6);
    max-height: 160px;
    overflow-y: auto;
    z-index: 2;
}

.global-chat-mention-item {
    text-align: left;
    padding: 6px 8px;
    font-size: 12px;
    color: var(--text-main, #f6e9d5);
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
}

.global-chat-mention-item.active,
.global-chat-mention-item:hover {
    border-color: rgba(201, 160, 110, 0.6);
    background: rgba(139, 115, 85, 0.35);
}

#globalChatInput {
    flex: 1;
    min-width: 0;
    height: 32px;
    padding: 0 10px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(139, 115, 85, 0.4);
    border-radius: 6px;
    color: var(--text-main, #f0e6d6);
    font-family: 'Roboto', sans-serif;
    font-size: 13px;
    outline: none;
    transition: all 0.2s ease;
}

#globalChatInput:focus {
    border-color: var(--gold-primary, #d4af37);
    box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.2);
}

#globalChatInput::placeholder {
    color: rgba(160, 144, 128, 0.5);
}

#globalChatSendBtn {
    width: 36px;
    height: 32px;
    background: linear-gradient(135deg, var(--gold-primary, #d4af37), #a67c52);
    border: 1px solid rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    color: #1a120b;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

#globalChatSendBtn svg {
    width: 24px !important;
    height: 24px !important;
    min-width: 24px;
    min-height: 24px;
    fill: #1a120b;
    display: inline-block;
    flex-shrink: 0;
    pointer-events: none;
}

#globalChatSendBtn svg {
    width: 24px !important;
    height: 24px !important;
    min-width: 24px;
    min-height: 24px;
}

#globalChatSendBtn:hover {
    background: linear-gradient(135deg, #e5c04b, #b88c5c);
    transform: scale(1.05);
}

#globalChatSendBtn:active {
    transform: scale(0.95);
}

/* ========== OVERLAY (Always visible chat) ========== */
.global-chat-overlay {
    position: fixed;
    top: 16px;
    left: 190px;
    /* À direita do minimapa (160px + margem) */
    width: 320px;
    max-width: calc(100vw - 210px);
    /* Não sobrepor UI direita */
    /* max-height: 280px; REMOVED to allow expansion */
    z-index: 400;
    pointer-events: none;
    /* overflow: hidden; REMOVED */
}

.global-chat-overlay-messages {
    display: flex;
    flex-direction: column-reverse;
    /* Novas mensagens em cima */
    gap: 4px;
    /* max-height: 280px; REMOVED */
    /* overflow: hidden; REMOVED */
}

.global-chat-overlay-message {
    display: flex;
    align-items: baseline;
    gap: 6px;
    padding: 3px 6px;
    background: transparent;
    border-radius: 4px;
    font-size: 14px;
    /* Aumentado de 13px */
    font-weight: 500;
    text-shadow:
        -1px -1px 0 #000,
        1px -1px 0 #000,
        -1px 1px 0 #000,
        1px 1px 0 #000;
    animation: overlayFadeIn 0.3s ease;
}

.global-chat-overlay-message.mention {
    color: #9be27b;
}

.global-chat-overlay-message.fading {
    animation: overlayFadeOut 2s ease forwards;
}

@keyframes overlayFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
        /* Animação vinda de cima */
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes overlayFadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

.overlay-time {
    color: rgba(160, 144, 128, 0.6);
    font-size: 10px;
    flex-shrink: 0;
}

.overlay-name {
    color: var(--gold-primary, #d4af37);
    font-weight: 600;
    flex-shrink: 0;
}

.overlay-text {
    color: rgba(240, 230, 214, 0.9);
    word-break: break-word;
}

/* King Announcement messages */
.global-chat-message.king-announcement {
    background: rgba(60, 40, 20, 0.6);
    border-left-color: #d4af37;
}

.global-chat-message.king-announcement .global-chat-text {
    color: #ffd700;
    font-weight: 500;
}

.global-chat-overlay-message.king-announcement .overlay-text {
    color: #ffd700;
    font-weight: bold;
    text-shadow: 0 0 4px rgba(0, 0, 0, 0.9);
}

/* ========== MOBILE - TAMANHO FIXO, DRAG PERMITIDO ========== */
@media (max-width: 768px) {
    .global-chat-modal {
        /* POSIÇÃO INICIAL - centralizado horizontalmente, um pouco acima do centro vertical */
        position: fixed;
        left: 50%;
        top: 50%;
        right: auto;
        bottom: auto;
        transform: translate(-50%, -50%);
        margin-left: 0;
        margin-top: -5vh;
        /* Leve ajuste pra cima */

        /* TAMANHO FIXO - !important para não mudar ao trocar abas */
        width: 94vw !important;
        max-width: 420px !important;
        height: 55vh !important;
        max-height: 480px !important;
        min-height: 260px !important;

        /* Visual sem blur para performance no mobile */
        border-radius: 12px;
        background: linear-gradient(135deg, rgba(43, 34, 24, 0.96), rgba(26, 20, 15, 0.98));
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.8);

        /* Transição suave para qualquer mudança de posição */
        transition: margin-top 0.25s ease, height 0.25s ease;
    }

    /* Quando teclado está aberto - apenas ajustar margem, não mudar top/left */
    .global-chat-modal.keyboard-open {
        margin-top: -15vh;
        /* Sobe um pouco mais para não ficar atrás do teclado */
        height: 50vh !important;
        max-height: 420px !important;
    }

    /* Header com cursor move para indicar drag */
    .global-chat-modal .window-header {
        cursor: move;
        padding: 10px 12px;
        touch-action: none;
    }

    /* Header title */
    .global-chat-modal .window-header strong {
        font-size: 14px;
    }

    /* Conteúdo */
    .global-chat-content {
        flex: 1;
        min-height: 0;
    }

    .global-chat-messages {
        height: 100%;
        padding: 8px;
        gap: 6px;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-y;
        overscroll-behavior: contain;
    }

    .global-chat-players {
        height: 100%;
        padding: 8px;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-y;
        overscroll-behavior: contain;
    }

    /* Mensagens compactas */
    .global-chat-message {
        font-size: 12px;
        padding: 5px 7px;
        gap: 3px;
    }

    .global-chat-message-header {
        gap: 6px;
    }

    .global-chat-time {
        font-size: 9px;
    }

    .global-chat-name {
        font-size: 12px;
        max-width: 100px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .global-chat-text {
        font-size: 12px;
        line-height: 1.4;
    }

    /* Players list */
    .global-chat-player {
        padding: 5px 7px;
        gap: 8px;
    }

    .player-avatar {
        width: 28px;
        height: 28px;
    }

    .player-name {
        font-size: 12px;
    }

    .player-title {
        font-size: 10px;
    }

    /* Input */
    .global-chat-input-container {
        padding: 8px 10px;
        gap: 8px;
    }

    #globalChatInput {
        height: 38px;
        font-size: 16px;
        /* Previne zoom no iOS */
        padding: 0 12px;
    }

    #globalChatSendBtn {
        width: 44px;
        height: 38px;
    }

    #globalChatSendBtn svg {
        width: 22px !important;
        height: 22px !important;
    }

    /* Botões do header maiores para toque */
    #closeGlobalChatBtn {
        width: 32px;
        height: 32px;
        font-size: 20px;
    }

    .global-chat-overlay-toggle {
        height: 32px;
        padding: 0 8px;
        min-width: auto;
    }

    .global-chat-overlay-toggle span {
        display: none;
    }

    /* Tabs compactas */
    .global-chat-tabs {
        padding: 0 6px;
    }

    .global-chat-tab {
        padding: 8px 6px;
        font-size: 11px;
        gap: 4px;
    }

    /* Overlay no mobile portrait - abaixo do minimapa */
    .global-chat-overlay {
        top: 160px;
        /* Minimapa (120px) + botoes zoom (40px) */
        left: 10px;
        max-width: 60vw;
        width: auto;
        max-height: 120px;
    }

    .global-chat-overlay-message {
        font-size: 13px;
        /* Aumentado de 11px */
        padding: 3px 6px;
    }

    .overlay-name,
    .overlay-text {
        font-size: 13px;
        /* Aumentado de 11px */
    }
}

/* ========== MOBILE PEQUENO ========== */
@media (max-width: 400px) {
    .global-chat-modal {
        width: 96vw !important;
        max-width: none !important;
    }

    .global-chat-name {
        max-width: 70px;
    }
}

/* ========== MOBILE LANDSCAPE ========== */
@media (orientation: landscape) and (max-height: 500px) {
    .global-chat-modal {
        height: 80vh !important;
        max-height: none !important;
        width: 70vw !important;
        max-width: 500px !important;
    }

    /* Landscape - overlay à direita do minimapa */
    .global-chat-overlay {
        top: 10px;
        left: 140px;
        /* Minimapa landscape é menor */
        max-width: 40vw;
        max-height: 100px;
    }
}

/* ========== PADRÃO DE BOTÃO FECHAR GLOBAL ========== */
.floating-window .window-close-btn,
.floating-window .close-btn,
.floating-window [id$="CloseBtn"],
.floating-window [id^="close"] {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(139, 115, 85, 0.5);
    border-radius: 5px;
    color: var(--text-muted, #a09080);
    cursor: pointer;
    transition: all 0.2s ease;
}

.floating-window .window-close-btn:hover,
.floating-window .close-btn:hover,
.floating-window [id$="CloseBtn"]:hover,
.floating-window [id^="close"]:hover {
    background: rgba(60, 50, 40, 0.6);
    border-color: var(--gold-primary, #d4af37);
    color: var(--gold-primary, #d4af37);
}

/* ========== AUDIO MESSAGES ========== */

/* Botão de microfone no input */
.global-chat-mic-btn {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--gold-light, #f8e6c8);
    background: rgba(139, 115, 85, 0.25);
    border: 1px solid rgba(139, 115, 85, 0.45);
    border-radius: 6px;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.global-chat-mic-btn svg {
    width: 18px !important;
    height: 18px !important;
    fill: #f8e6c8 !important;
    display: inline-block !important;
    flex-shrink: 0;
    pointer-events: none;
}

#globalChatMicBtn svg {
    width: 18px !important;
    height: 18px !important;
    fill: #f8e6c8 !important;
    display: inline-block !important;
    flex-shrink: 0;
    pointer-events: none;
}

.global-chat-mic-btn:hover {
    background: rgba(139, 115, 85, 0.35);
    border-color: rgba(201, 160, 110, 0.6);
}

.global-chat-mic-btn.recording {
    background: rgba(231, 76, 60, 0.4);
    border-color: #e74c3c;
    color: #ff8888;
    animation: micPulse 1s ease-in-out infinite;
}

@keyframes micPulse {

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

    50% {
        transform: scale(1.1);
    }
}

/* Botão de mensagem na lista de players */
.global-chat-player-msg-btn {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted, #a09080);
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(139, 115, 85, 0.35);
    border-radius: 5px;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s ease;
    margin-left: 4px;
}

.global-chat-player-msg-btn svg {
    width: 14px;
    height: 14px;
    fill: #a09080 !important;
    display: inline-block !important;
    flex-shrink: 0;
    pointer-events: none;
}

.global-chat-player-msg-btn:hover svg {
    fill: #f8e6c8 !important;
}

.global-chat-player-msg-btn:hover {
    background: rgba(139, 115, 85, 0.35);
    border-color: rgba(201, 160, 110, 0.6);
    color: var(--gold-light, #f8e6c8);
}

/* ========== PRIVATE CHAT ========== */
.global-chat-private {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.private-chat-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(139, 115, 85, 0.3);
}

.private-chat-back {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(139, 115, 85, 0.5);
    border-radius: 5px;
    color: var(--text-muted, #a09080);
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.private-chat-back svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.private-chat-back:hover {
    background: rgba(139, 115, 85, 0.35);
    color: var(--gold-light, #f8e6c8);
}

.private-chat-target-name {
    font-weight: 600;
    color: var(--gold-primary, #d4af37);
    font-size: 14px;
}

.private-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.private-chat-empty {
    text-align: center;
    color: var(--text-muted, #a09080);
    font-style: italic;
    padding: 20px;
}

.private-chat-message {
    max-width: 80%;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 13px;
}

.private-chat-message.own {
    align-self: flex-end;
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.3), rgba(166, 124, 82, 0.3));
    border: 1px solid rgba(212, 175, 55, 0.4);
    color: var(--gold-light, #f8e6c8);
}

.private-chat-message.other {
    align-self: flex-start;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(139, 115, 85, 0.3);
    color: var(--text-light, #e8e0d5);
}

.private-audio-player {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Toggle de autoplay - mesmo estilo do overlay toggle */
.global-chat-autoplay-toggle {
    width: 26px;
    height: 26px;
    padding: 0;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(139, 115, 85, 0.5);
    border-radius: 5px;
    color: var(--text-muted, #a09080);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.global-chat-autoplay-toggle svg {
    width: 14px;
    height: 14px;
    display: inline-block;
    flex-shrink: 0;
    pointer-events: none;
}

.global-chat-autoplay-toggle:hover {
    background: rgba(60, 50, 40, 0.6);
    border-color: rgba(139, 115, 85, 0.7);
    color: var(--gold-light, #f8e6c8);
}

/* Quando ATIVO - dourado como overlay toggle */
.global-chat-autoplay-toggle.active {
    background: rgba(212, 175, 55, 0.2);
    border-color: var(--gold-primary, #d4af37);
    color: var(--gold-primary, #d4af37);
    box-shadow: 0 0 8px rgba(212, 175, 55, 0.4);
}

/* Container de gravação (substitui input durante gravação) */
.global-chat-recording-container {
    flex: 1;
    height: 40px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 12px;
    background: rgba(231, 76, 60, 0.15);
    border: 1px solid rgba(231, 76, 60, 0.5);
    border-radius: 8px;
}

.global-chat-recording-timer {
    font-family: 'Roboto Mono', monospace;
    font-size: 14px;
    font-weight: 600;
    color: #ff8888;
    min-width: 45px;
}

/* Barra de amplitude animada estilo WhatsApp */
.global-chat-recording-waveform {
    flex: 1;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
}

.global-chat-recording-bar {
    width: 3px;
    height: 4px;
    background: #ff8888;
    border-radius: 2px;
    transition: height 0.05s ease;
}

/* Botões de ação durante gravação */
.global-chat-recording-actions {
    display: flex;
    gap: 8px;
}

.global-chat-recording-cancel,
.global-chat-recording-send {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.global-chat-recording-cancel svg,
.global-chat-recording-send svg {
    width: 14px;
    height: 14px;
    display: inline-block;
    flex-shrink: 0;
    pointer-events: none;
}

.global-chat-recording-cancel {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(139, 115, 85, 0.5);
    color: var(--text-muted, #a09080);
}

.global-chat-recording-cancel:hover {
    background: rgba(231, 76, 60, 0.3);
    border-color: #e74c3c;
    color: #ff8888;
}

.global-chat-recording-send {
    background: linear-gradient(135deg, var(--gold-primary, #d4af37), #a67c52);
    border: none;
    color: #1a120b;
}

.global-chat-recording-send:hover {
    background: linear-gradient(135deg, #e5c04b, #b88c5c);
    transform: scale(1.1);
}

/* Estilos para o player de áudio unificado nas mensagens */
.audio-message-player.unified-audio-player {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(139, 115, 85, 0.2);
    border-radius: 10px;
    margin-top: 6px;
    min-width: 160px;
}

.audio-waveform-progress .waveform-bar {
    width: 3px;
    height: 6px;
    background: rgba(139, 115, 85, 0.4);
    border-radius: 1px;
    transition: all 0.2s ease;
}

.audio-waveform-progress .waveform-bar.played {
    background: var(--gold-primary, #d4af37);
    box-shadow: 0 0 4px rgba(212, 175, 55, 0.3);
}

.audio-message-duration {
    font-family: 'Roboto Mono', monospace;
    font-size: 11px;
    color: var(--text-muted, #a09080);
    min-width: 35px;
    text-align: right;
}

/* Audio Message Play Button */
.audio-message-play-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(212, 175, 55, 0.15);
    border: 1px solid rgba(212, 175, 55, 0.4);
    color: var(--gold-light, #f8e6c8);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.audio-message-play-btn:hover {
    background: rgba(212, 175, 55, 0.3);
    border-color: var(--gold-primary, #d4af37);
    transform: scale(1.05);
    /* Slight grow */
}

.audio-message-play-btn svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
    display: block;
}

.audio-message-play-btn.playing {
    background: rgba(212, 175, 55, 0.25);
    color: #fff;
    border-color: var(--gold-primary, #d4af37);
    box-shadow: 0 0 8px rgba(212, 175, 55, 0.3);
}

/* ========== PRIVATE NOTIFICATIONS ========== */
.private-chat-notify-container {
    position: fixed;
    top: 72px;
    right: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 450;
    pointer-events: none;
    max-width: min(320px, 90vw);
}

.private-chat-notify {
    background: rgba(15, 12, 10, 0.9);
    border: 1px solid rgba(139, 115, 85, 0.5);
    border-left: 3px solid #9b59b6;
    border-radius: 8px;
    padding: 8px 10px;
    color: #f0e6d6;
    font-size: 12px;
    line-height: 1.4;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.private-chat-notify.show {
    opacity: 1;
    transform: translateY(0);
}

.private-chat-notify.hide {
    opacity: 0;
    transform: translateY(-6px);
}

.private-chat-notify-title {
    font-size: 10px;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: rgba(248, 230, 200, 0.75);
    margin-bottom: 2px;
}

.private-chat-notify-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.private-chat-notify-name {
    font-weight: 600;
    color: #f8e6c8;
}

.private-chat-notify-text,
.private-chat-notify-audio {
    color: rgba(240, 230, 214, 0.85);
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .global-chat-mic-btn {
        width: 38px;
        height: 38px;
    }

    .global-chat-autoplay-toggle span {
        display: none;
    }

    .global-chat-recording-container {
        height: 38px;
        padding: 0 8px;
        gap: 6px;
    }

    .global-chat-recording-timer {
        font-size: 12px;
        min-width: 40px;
    }

    .audio-message-player {
        padding: 6px 8px;
    }

    .audio-message-play-btn {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }

    .audio-message-duration {
        font-size: 10px;
    }
}

.unified-audio-player {
    display: flex;
    align-items: center;
    gap: 8px;
}

.audio-waveform-progress {
    display: flex;
    align-items: center;
    gap: 2px;
    height: 14px;
    cursor: default;
}

.audio-waveform-progress .waveform-bar {
    width: 3px;
    height: 6px;
    background: rgba(139, 115, 85, 0.4);
    border-radius: 1px;
    transition: all 0.2s ease;
}

/* Quando o áudio já passou pela barra */
.audio-waveform-progress .waveform-bar.played {
    background: var(--gold-primary, #d4af37);
}

/* Animação quando está TOCANDO */
.unified-audio-player.playing .waveform-bar,
.overlay-audio-message.playing .waveform-bar {
    animation: unifiedWaveAnim 0.6s ease-in-out infinite alternate;
}

.unified-audio-player.playing .waveform-bar:nth-child(even),
.overlay-audio-message.playing .waveform-bar:nth-child(even) {
    animation-delay: 0.1s;
}

.unified-audio-player.playing .waveform-bar:nth-child(3n),
.overlay-audio-message.playing .waveform-bar:nth-child(3n) {
    animation-delay: 0.2s;
}

@keyframes unifiedWaveAnim {
    0% {
        height: 4px;
    }

    100% {
        height: 14px;
    }
}

/* Tamanhos específicos para o overlay */
.overlay-audio-player .audio-waveform-progress {
    height: 12px;
}

.overlay-audio-player .waveform-bar {
    width: 2px;
    height: 4px;
}

/* ========== OVERLAY AUDIO PLAYER ========== */
.overlay-audio-message {
    display: flex;
    align-items: center;
    gap: 6px;
}

.overlay-audio-player {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 100px;
    max-width: 140px;
}

.overlay-audio-waveform {
    display: flex;
    align-items: center;
    gap: 2px;
    height: 16px;
}

.overlay-audio-bar {
    width: 2px;
    height: 4px;
    background: rgba(212, 175, 55, 0.5);
    border-radius: 1px;
    transition: height 0.1s ease;
}

/* Animação quando tocando */
.overlay-audio-message.playing .overlay-audio-bar {
    animation: overlayWaveAnim 0.5s ease-in-out infinite alternate;
    background: var(--gold-primary, #d4af37);
}

.overlay-audio-message.playing .overlay-audio-bar:nth-child(1) {
    animation-delay: 0s;
    height: 8px;
}

.overlay-audio-message.playing .overlay-audio-bar:nth-child(2) {
    animation-delay: 0.05s;
    height: 12px;
}

.overlay-audio-message.playing .overlay-audio-bar:nth-child(3) {
    animation-delay: 0.1s;
    height: 6px;
}

.overlay-audio-message.playing .overlay-audio-bar:nth-child(4) {
    animation-delay: 0.15s;
    height: 14px;
}

.overlay-audio-message.playing .overlay-audio-bar:nth-child(5) {
    animation-delay: 0.2s;
    height: 8px;
}

.overlay-audio-message.playing .overlay-audio-bar:nth-child(6) {
    animation-delay: 0.25s;
    height: 10px;
}

.overlay-audio-message.playing .overlay-audio-bar:nth-child(7) {
    animation-delay: 0.3s;
    height: 14px;
}

.overlay-audio-message.playing .overlay-audio-bar:nth-child(8) {
    animation-delay: 0.35s;
    height: 6px;
}

.overlay-audio-message.playing .overlay-audio-bar:nth-child(9) {
    animation-delay: 0.4s;
    height: 12px;
}

.overlay-audio-message.playing .overlay-audio-bar:nth-child(10) {
    animation-delay: 0.45s;
    height: 8px;
}

.overlay-audio-message.playing .overlay-audio-bar:nth-child(11) {
    animation-delay: 0.5s;
    height: 10px;
}

.overlay-audio-message.playing .overlay-audio-bar:nth-child(12) {
    animation-delay: 0.55s;
    height: 6px;
}

@keyframes overlayWaveAnim {
    0% {
        transform: scaleY(0.6);
    }

    100% {
        transform: scaleY(1.4);
    }
}

.overlay-audio-progress {
    flex: 1;
    height: 3px;
    background: rgba(139, 115, 85, 0.4);
    border-radius: 2px;
    overflow: hidden;
}

.overlay-audio-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--gold-primary, #d4af37), #e5c04b);
    border-radius: 2px;
    transition: width 0.1s linear;
}