* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', 'Segoe UI', sans-serif;
    user-select: none;
}

body {
    background-color: #0b0c10;
    color: #c5c6c7;
    font-size: 16px;
    overflow: hidden;
}

#canvas-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
    background: radial-gradient(circle at center, #1f2833 0%, #0b0c10 100%);
}

#hud {
    position: fixed; /* Fixed para garantir que fique centralizado independente do scroll */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    pointer-events: none;
    z-index: 5;
    width: 100%;
}

/* MOBILE RESPONSIVE QUERIES MOVED TO THE BOTTOM OF FILE FOR CASCADE HIERARCHY */

#result-text {
    font-size: 80px;
    font-weight: 900;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 5px;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    opacity: 0;
    transform: translateY(20px) scale(0.8);
    text-shadow: 0 0 20px rgba(102, 252, 241, 0.5);
}

#result-text.show {
    opacity: 1;
    transform: translateY(0) scale(1);
    text-shadow: 0 0 20px #66fcf1, 0 0 40px #66fcf1;
}

/* Partículas e Efeitos HUD */
#floating-money {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 15;
}

.money-pop {
    position: absolute;
    color: #45a29e;
    font-weight: bold;
    font-size: 24px;
    text-shadow: 0 0 5px #000;
    animation: floatUp 1s ease-out forwards;
}

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

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

/* =========================================
   EFEITOS DE BATALHA MULTIPLAYER TÁTICA
   ========================================= */
@keyframes shake-devastation {
    0% { transform: translate(1px, 1px) rotate(0deg); }
    10% { transform: translate(-10px, -10px) rotate(-2deg); }
    20% { transform: translate(-15px, 0px) rotate(2deg); }
    30% { transform: translate(15px, 10px) rotate(0deg); }
    40% { transform: translate(5px, -10px) rotate(2deg); }
    50% { transform: translate(-5px, 10px) rotate(-2deg); }
    60% { transform: translate(-15px, 5px) rotate(0deg); }
    70% { transform: translate(15px, 5px) rotate(-2deg); }
    80% { transform: translate(-5px, -5px) rotate(2deg); }
    90% { transform: translate(5px, 10px) rotate(0deg); }
    100% { transform: translate(1px, -2px) rotate(-2deg); }
}

.body-shake {
    animation: shake-devastation 0.4s;
    animation-iteration-count: 2; /* 2 solavancos sísmicos na tela */
}

.hit-red-filter {
    background-color: #bb0000 !important;
    transition: background-color 0.1s !important;
}

.freeze-blue-filter {
    background-color: #0033aa !important;
    transition: background-color 0.1s !important;
}

/* Toggles e Utils */
.flex-spacer {
    flex-grow: 1;
}

#toggle-shop {
    position: absolute;
    right: 20px;
    top: 20px;
    z-index: 20;
    padding: 10px 15px;
    background: #1f2833;
    border: 2px solid #45a29e;
    border-radius: 8px;
    color: #45a29e;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
    width: auto; /* Garante que não herda 100% */
    height: auto;
}

#toggle-shop:hover {
    background: #45a29e;
    color: #1f2833;
}

#terror-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.1s;
    display: flex;
    justify-content: center;
    align-items: center;
}

#terror-text {
    color: #ff0000;
    font-size: 100px;
    font-family: 'Courier New', Courier, monospace;
    text-shadow: 0 0 20px #ff0000;
    font-weight: bold;
}

/* =========================================
   MULTIPLAYER ARENA OVERRIDES (V10)
   ========================================= */
body.mp-active::after {
    content: ''; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    box-shadow: inset 0 0 150px rgba(255, 0, 85, 0.4); /* Aura Vermelha de Batalha */
    pointer-events: none; z-index: -1;
}
/* Esconder recursos inúteis na hora da porradaria */
body.mp-active .tab[data-target="shop-quests"],
body.mp-active .tab[data-target="shop-vip"] {
    display: none !important;
}
body.mp-active .profile-actions-mini,
body.mp-active #hide-gui-btn { 
    display: none !important; /* Esconde menu de Logout e Botão Clean GUI na arena */
}

/* Animação do CountDown Modal */
@keyframes pumpNumber {
    0% { transform: scale(1); opacity: 0; }
    50% { transform: scale(1.5); opacity: 1; }
    100% { transform: scale(1); opacity: 0; }
}
#countdown-text.pump {
    animation: pumpNumber 1s ease-in-out;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: rgba(11, 12, 16, 0.4);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #45a29e, #66fcf1);
    border-radius: 5px;
    box-shadow: inset 0 0 5px rgba(0,0,0,0.5);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #66fcf1, #00ffcc);
}
/* Autenticação Overlay */
#login-overlay, #parental-overlay, #account-overlay {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  background: rgba(11, 12, 16, 0.6);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  z-index: 99999;
  display: flex;
  justify-content: center;
  align-items: center;
  animation: fadeIn 0.5s ease-out;
  overflow-y: auto; /* Garante que o fundo role se a caixa for maior que a tela */
  padding: 20px 0;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.auth-box, .parental-box, .account-box {
  background: rgba(11, 12, 16, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(0, 255, 0, 0.4);
  border-radius: 20px;
  padding: 40px;
  width: 440px;
  max-width: 90vw; /* Ajuste crítico para mobile */
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.8), inset 0 0 20px rgba(0, 255, 128, 0.1);
  display: flex;
  flex-direction: column;
  margin: auto;
}

.auth-title {
  color: #00ff00;
  text-align: center;
  margin-bottom: 25px;
  font-size: 26px;
  font-weight: 900;
  letter-spacing: 2px;
  text-shadow: 0 0 15px rgba(0, 255, 0, 0.6);
}

/* Abas de Login/Registro */
.login-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
}

.tab-btn {
    background: #0b0c10;
    border: 1px solid #1f2833;
    color: #45a29e;
    padding: 8px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: 0.3s;
    font-size: 14px;
}

.tab-btn:hover {
    border-color: #00ff00;
    color: #00ff00;
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.2);
}

.tab-btn.active {
    background: rgba(0, 255, 0, 0.1);
    border-color: #00ff00;
    color: #00ff00;
    text-shadow: 0 0 5px #00ff00;
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.3);
}

.auth-input {
  background: rgba(11, 12, 16, 0.8);
  border: 1px solid #1f2833;
  color: #fff;
  padding: 15px;
  margin-bottom: 15px;
  border-radius: 8px;
  font-size: 16px;
  transition: 0.3s;
}

.auth-input:focus {
  outline: none;
  border-color: #66fcf1;
  box-shadow: 0 0 10px rgba(102, 252, 241, 0.3);
}

.auth-btn {
  width: 100%;
  padding: 15px;
  margin-top: 10px;
  font-size: 18px;
  background: #000;
  border: 2px solid #00ff00;
  color: #00ff00;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 2px;
  transition: 0.3s;
}

.auth-btn:hover {
  background: #00ff00;
  color: #000;
  box-shadow: 0 0 20px rgba(0, 255, 0, 0.6);
}

.btn {
    background: #000;
    border: 2px solid #00ff00;
    color: #00ff00;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: 0.3s;
}

.btn:hover {
    background: rgba(0, 255, 0, 0.1);
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.3);
}

.auth-switch {
  text-align: center;
  margin-top: 20px;
  font-size: 14px;
}

.auth-switch span {
  color: #66fcf1;
  cursor: pointer;
  text-decoration: underline;
}

.auth-error {
  color: #ff4444;
  font-size: 14px;
  text-align: center;
  margin-bottom: 15px;
  min-height: 20px;
}

/* SUBIR FIX: Avatares Gigantes */
.avatar-grid {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 15px 0;
    flex-wrap: wrap;
}

.avatar-opt {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    border: 2px solid #1f2833;
    padding: 5px;
    cursor: pointer;
    transition: 0.3s;
    background: rgba(0,0,0,0.3);
}

.avatar-opt:hover {
    border-color: #66fcf1;
    transform: scale(1.1);
}

.avatar-opt.active {
    border-color: #00ff00;
    background: rgba(0, 255, 0, 0.1);
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.3);
}

.avatar-selection {
  display: flex;
  justify-content: space-between;
  margin-bottom: 20px;
}

.avatar-option {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: 0.3s;
  background: #1f2833;
}

.avatar-option:hover {
  transform: scale(1.1);
}

.avatar-option.selected {
  border-color: #66fcf1;
  box-shadow: 0 0 15px rgba(102, 252, 241, 0.5);
}

.progress-bar-container {
  width: 100%;
  height: 10px;
  background: #1f2833;
  border-radius: 5px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: #00ff00;
  transition: width 0.3s ease;
}

/* Profile HUD */
.profile-container {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 15px;
  background: rgba(11, 12, 16, 0.7);
  padding: 10px;
  border-radius: 12px;
  border: 1px solid #1f2833;
}

.profile-container img {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: #1f2833;
  border: 2px solid #66fcf1;
}

.profile-info {
  display: flex;
  flex-direction: column;
}

#ui-username {
  font-weight: bold;
  font-size: 16px;
  color: #fff;
  display: flex;
  align-items: center;
}

.vip-badge-plus {
    background: rgba(0, 123, 255, 0.2);
    color: #007bff;
    border: 1px solid #007bff;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: bold;
    margin-left: 8px;
    text-shadow: 0 0 5px #007bff;
    box-shadow: 0 0 10px rgba(0, 123, 255, 0.3);
}

.vip-badge-silicom {
    background: rgba(255, 215, 0, 0.2);
    color: #ffd700;
    border: 1px solid #ffd700;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: bold;
    margin-left: 8px;
    text-shadow: 0 0 5px #ffd700;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
    animation: goldPulse 1.5s infinite;
}

@keyframes goldPulse {
    0% { box-shadow: 0 0 5px rgba(255, 215, 0, 0.4); }
    50% { box-shadow: 0 0 20px rgba(255, 215, 0, 0.8); }
    100% { box-shadow: 0 0 5px rgba(255, 215, 0, 0.4); }
}

.xp-bar-container {
  width: 100%;
  height: 6px;
  background: #1f2833;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 20px;
}

.xp-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #45a29e, #66fcf1);
  transition: width 0.5s ease;
}

/* Modals Padrão (Glassmorphism) */
.glass-modal {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  background: rgba(11, 12, 16, 0.8);
  backdrop-filter: blur(10px);
  z-index: 100000;
  display: none;          /* oculto por padrão — JS usa el.style.display='flex' para abrir */
  justify-content: center;
  align-items: center;
}


.modal-content {
  background: rgba(31, 40, 51, 0.95);
  border: 2px solid #45a29e;
  border-radius: 15px;
  padding: 30px;
  width: 500px;
  max-width: 90%;
  box-shadow: 0 0 30px rgba(69, 162, 158, 0.3);
  display: flex;
  flex-direction: column;
}

/* MODO HACKER ADM 2.0 */
#admin-terminal {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(20px);
    z-index: 100000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.terminal-box {
    width: 800px;
    height: 600px;
    max-width: 90vw;
    background: #0b0c10;
    border: 2px solid #00ff00;
    box-shadow: 0 0 40px rgba(0, 255, 0, 0.3), inset 0 0 20px rgba(0, 255, 0, 0.1);
    border-radius: 12px;
    padding: 30px;
    display: flex;
    flex-direction: column;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    position: relative;
    overflow: hidden;
}

.terminal-box::before {
    content: "";
    position: absolute;
    top: 0; left: 0; width: 100%; height: 2px;
    background: linear-gradient(90deg, transparent, #00ff00, transparent);
    animation: scanline 3s linear infinite;
    pointer-events: none;
    z-index: 5;
}

@keyframes scanline {
    0% { transform: translateY(0); }
    100% { transform: translateY(600px); }
}

.terminal-box h2 {
    color: #00ff00;
    font-size: 20px;
    margin-bottom: 20px;
    text-shadow: 0 0 10px #00ff00;
    border-bottom: 1px solid #1f2833;
    padding-bottom: 10px;
    text-align: center;
}

.log-box {
    flex-grow: 1;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid #1f2833;
    border-radius: 6px;
    padding: 15px;
    color: #00ff00;
    font-size: 14px;
    line-height: 1.6;
    overflow-y: auto;
    margin-bottom: 25px;
    box-shadow: inset 0 0 10px #000;
}

.admin-controls {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    background: rgba(31, 40, 51, 0.3);
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #1f2833;
}

.exit-terminal {
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent !important;
    border: 1px solid #ff0055 !important;
    color: #ff0055 !important;
    padding: 5px 15px !important;
    font-size: 12px !important;
    cursor: pointer;
}

.exit-terminal:hover {
    background: #ff0055 !important;
    color: white !important;
}

/* Tema Multiplayer */
.mp-theme {
  border-color: #ff0055;
  box-shadow: 0 0 40px rgba(255, 0, 85, 0.2);
}

.stat-edit-row {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.stat-edit-row i {
    font-size: 30px;
    width: 40px;
    color: #fff;
    text-shadow: 2px 2px 0 #000;
}

.stat-edit-row input {
    flex: 1;
    min-width: 0; /* IMPEDE OVERFLOW EM LINHAS DUPLAS */
    background: #eef2f3;
    border: 1px solid #000;
    padding: 8px;
    font-weight: bold;
    border-radius: 4px;
    color: #333;
}

/* NOVAS CLASSES V4.2.1+ REFINADAS */
.stat-row-compact {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
    margin-bottom: 15px !important;
}
.stat-row-compact input {
    width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
}
.adm-edit-inner {
    max-height: 80vh;
    overflow-y: auto;
    padding-right: 5px;
}
/* Scrollbar custom para o modal adm */
.adm-edit-inner::-webkit-scrollbar { width: 5px; }
.adm-edit-inner::-webkit-scrollbar-thumb { background: #b000ff; border-radius: 10px; }

.adm-tool-btn {
    width: 100%;
    border: none;
    color: #fff;
    padding: 10px;
    font-weight: bold;
    font-size: 18px;
    cursor: pointer;
    border-radius: 6px;
    text-align: center;
    box-shadow: inset 0 0 5px rgba(0,0,0,0.5);
}

.adm-tool-btn:hover {
    filter: brightness(1.2);
}

.mp-modes {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.mode-btn {
  flex: 1;
  font-size: 12px;
  padding: 10px;
  border-color: #888;
  color: #888;
}

.mode-btn.active {
  border-color: #ff0055;
  color: #fff;
  background: #ff0055;
}

.versus-board {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #1f2833;
  padding: 20px;
  border-radius: 12px;
  border: 1px solid #ff0055;
}

.player-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

/* =========================================
   SISTEMA FLUIDO DE PAINÉIS (MASTER OMNIFORMAT)
   ========================================= */

/* 1. Base Padrão Fluida: TABLET HORIZONTAL E LAPTOPS PEQUENOS (769px a 1199px) */
#left-panel, #right-panel {
    position: absolute;
    top: 2vh;
    bottom: 2vh;
    /* Painéis crescem baseados na tela, variando de 280px a 340px, garantindo que o 3D nunca suma na meiúca */
    width: clamp(280px, 30vw, 340px);
    background: rgba(11, 12, 16, 0.75);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(102, 252, 241, 0.2);
    border-radius: 16px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    z-index: 10;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.4s, visibility 0.4s;
    box-sizing: border-box;
    overflow-y: auto; /* PERMITE AOS DESKTOPS EXTREMAMENTE BAIXOS ROLAR PELAS OPCOES DA ESQ/DIR */
    overflow-x: hidden;
}

#left-panel { left: 15px; }

#right-panel {
    right: 15px;
    transform: translateX(120%);
    visibility: hidden;
    opacity: 0;
}

#right-panel.open {
    transform: translateX(0);
    visibility: visible;
    opacity: 1;
}

/* 2. OVERRIDE: MONITORES LARGOS E TVS (Acima de 1200px) */
@media screen and (min-width: 1200px) {
    #left-panel, #right-panel {
        width: 380px; /* Caixas robustas fixas em PCs/TVs para não ficarem ridículas de largas */
        padding: 25px;
        top: 25px; bottom: 25px;
        background: rgba(11, 12, 16, 0.85);
    }
    #left-panel { left: 25px; }
    #right-panel { right: 25px; top: 80px; } /* Loja desce pro botão Toggle caber com folga */
}

/* 3. OVERRIDE: SMARTPHONES - PAISAGEM / DEITADO (Altura < 500px, Ex: iPhone Horizontal Gamer Mode) */
@media screen and (max-height: 500px) and (orientation: landscape) {
    #left-panel {
        width: 250px;
        left: 0; top: 0; bottom: 0;
        border-radius: 0 16px 16px 0; /* Cola na lateral inteira */
        padding: 10px;
        overflow-y: auto !important; /* GARANTIA ROLAVEL EM LANDSCAPE */
    }
    #right-panel {
        width: 280px;
        right: 0; top: 0; bottom: 0;
        border-radius: 16px 0 0 16px; 
        overflow-y: auto !important; /* GARANTIA ROLAVEL EM LANDSCAPE */
    }
    #hud { top: 15%; }
    #result-text { font-size: 30px; margin-top: 10px; }
    .panel-title { display: none; }
    /* Mostrar a Loja via botão de formato reduzido */
    #toggle-shop { display: block; top: 5px; right: 5px; padding: 5px 10px; font-size: 10px; z-index: 1000; }
    .profile-container img { width: 35px; height: 35px; }
    .controls-container > div {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
    }
    #spin-btn { font-size: 14px; padding: 10px; }
}

/* 4. OVERRIDE SUPREMO: SMARTPHONES - EM PÉ / RETRATO (A Cockpit V5 Apple Proofed) */
@media screen and (max-width: 768px) and (orientation: portrait) {
    #left-panel {
        position: absolute !important;
        width: 100vw !important;
        left: 0 !important;
        bottom: 0 !important;
        top: auto !important;
        height: 60vh !important; /* Aumentei um pouco para caber os status sem clipping */
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        pointer-events: none !important; 
        display: flex;
        flex-direction: column;
        justify-content: flex-end;
        z-index: 10;
        padding: 0;
        border-radius: 0;
    }
    
    #left-panel > * {
        pointer-events: auto;
    }

    .panel-title { display: none !important; }

    /* HUD Header (Perfil e Stats) em 100% da LARGURA */
    .profile-container {
        margin: 0 !important;
        background: rgba(11, 12, 16, 0.95);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        padding: 6px 10px;
        border-radius: 0;
        border-top: 1px solid #45a29e;
        display: flex;
        flex-direction: row;
        align-items: center;
        width: 100% !important;
    }

    .profile-container img { width: 32px; height: 32px; flex-shrink: 0; }
    #ui-username {
        font-size: 12px;
        margin-left: 8px;
        max-width: 110px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    #ui-level { font-size: 10px !important; margin-left: 8px; }

    /* Botões conta/sair sempre visíveis e clicáveis no mobile */
    .profile-actions-mini {
        margin-left: auto !important;
        display: flex !important;
        gap: 12px !important;
        align-items: center;
    }
    .profile-actions-mini button {
        font-size: 18px !important;
        color: #66fcf1 !important;
        padding: 6px !important;
        min-width: 36px;
        min-height: 36px;
        display: flex !important;
        align-items: center;
        justify-content: center;
        background: rgba(102,252,241,.08) !important;
        border-radius: 8px;
    }
    .profile-actions-mini button:last-child { color: #ff6666 !important; background: rgba(255,102,102,.08) !important; }

    .xp-bar-container {
        margin: 0 !important;
        height: 3px;
        border-radius: 0;
        width: 100%;
    }

    .stats-container {
        background: rgba(11, 12, 16, 0.98) !important;
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 2px !important;
        padding: 4px 6px !important;
        border-radius: 0;
        border: none !important;
        border-bottom: 1px solid rgba(102, 252, 241, 0.3) !important;
        width: 100vw !important;
        box-sizing: border-box;
    }

    .stat-row {
        font-size: 8px !important;
        padding: 4px !important;
        margin: 0 !important;
        background: rgba(255,255,255,0.05) !important;
        border-radius: 4px;
        text-align: center;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        min-height: 45px !important; /* Fix for visibility */
        overflow: visible !important;
    }
    .stat-value { 
        font-size: 10px !important; 
        margin-top: 2px; 
        color: #fff !important; 
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    /* Inputs ciberpunk com Auto-Zoom Prevenção do Safari (Fix iOS Zooming bug) */
    .auth-input { 
         font-size: 16px !important; 
    }
    
    /* Prevenir empacotamentos em Modais pequenos */
    .stat-edit-row {
         flex-wrap: wrap !important;
    }
    
    /* Controles (Agregada Metade Inferior V3.1.1 -> 100% LARGURA ABSOLUTA!) */
    .controls-container {
        position: absolute !important;
        bottom: 0 !important;
        left: 0 !important;
        width: 100vw !important;
        max-width: 100vw !important;
        height: calc(50vh - 80px) !important; /* Desconta a area do Grid superior */
        background: rgba(11, 12, 16, 0.85);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        padding: 10px 15px 80px !important; /* Pad inferior p/ não colidir com botões fixos */
        border-radius: 0;
        margin: 0 !important;
        border: none;
        border-top: 1px solid #45a29e;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        overflow-y: auto !important; 
        overflow-x: hidden !important;
        gap: 8px !important;
        box-sizing: border-box;
    }

    #spin-btn {
        font-size: 15px !important;
        padding: 12px 5px !important;
        flex: none; 
        min-height: 60px; /* Protege contra esmagamento garantindo área tocável */
    }

    .controls-container > div {
        display: grid;
        grid-template-columns: 1fr 1fr; /* Botoes menores embaixo emparelhados */
        gap: 6px;
    }
    
    .controls-container .btn {
        font-size: 10px !important;
        padding: 12px 4px !important;
        height: 40px;
    }
    #auto-btn { grid-column: span 2; } /* Auto ocupa linha do meio */

    /* BOTÃO FAB P/ CHAMAR LOJA E IA MISSÕES NO CELULAR (Revivido na V3.1.1) */
    #toggle-shop { 
        display: flex !important; 
        justify-content: center;
        align-items: center;
        position: fixed !important;
        top: 20px !important; 
        right: 20px !important; 
        bottom: auto !important;
        border-radius: 50% !important; 
        width: 50px !important; 
        height: 50px !important; 
        font-size: 20px !important; 
        background: #0b0c10 !important;
        box-shadow: 0 0 25px rgba(69,162,158, 0.6) !important;
        z-index: 40 !important;
    }
    .hide-mobile { display: none !important; }

    /* LEVANTA TEXTOS DO HUD PARA CASAS ACIMA */
    #hud { top: 22% !important; } 
    #result-text { font-size: 45px !important; margin-top: -30px; }

    /* LOJA E MISSÕES IA OVERLAY (SLIDE UP CIBERPUNK 100% TELA) Safari Proof V3.1.1 */
    #right-panel {
        width: 100vw !important;
        max-width: 100vw !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        top: auto !important;
        height: 85vh !important;  /* Cobrira a tela inteira com bordas no topo */
        border-radius: 20px 20px 0 0 !important;
        border: none;
        border-top: 3px solid #66fcf1;
        transform: translateY(110vh) !important;  /* Comeca FORA da Tela Embaixo */
        visibility: hidden !important;
        opacity: 1 !important;
        transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), visibility 0.4s !important;
        z-index: 55 !important;
        background: rgba(8, 10, 14, 0.98) !important;
        padding: 15px !important;
        box-shadow: 0 -15px 40px rgba(69, 162, 158, 0.4) !important;
        display: flex;
        flex-direction: column;
        box-sizing: border-box;
    }

    #right-panel.open {
        transform: translateY(0) !important;
        visibility: visible !important;
    }

    #close-shop {
        position: fixed !important; /* Desprende do overflow da div root #right-panel */
        left: auto !important;
        right: 20px !important;
        top: 20px !important;
        width: 50px !important;
        height: 50px !important;
        border-radius: 50% !important;
        font-size: 22px !important;
        border: 2px solid white !important;
        box-shadow: 0 0 20px rgba(255,0,85,0.8) !important;
        display: flex !important;
        justify-content: center;
        align-items: center;
        z-index: 10000 !important;
    }

    .tab-container {
        margin-bottom: 6px !important;
        display: flex;
        flex-wrap: wrap !important; /* Abas vao quebrar de linha em vez de empurrar o layout pra esquerda! */
        justify-content: space-around;
        gap: 2px !important;
        border-bottom: 1px solid rgba(102,252,241,0.2) !important;
        padding-bottom: 5px;
    }
    
    .tab { 
        font-size: 9px !important; 
        padding: 6px !important; 
        flex: 1 1 30%; 
        text-align: center;
        border: 1px solid #1f2833;
        border-radius: 4px;
    }
    .tab.active { background: rgba(102,252,241,0.2); border-color: #66fcf1; }
    
    .shop-content {
        flex-grow: 1;
        overflow-y: auto;
        gap: 8px;
        padding-right: 2px;
    }
    
    .shop-content.active {
        display: flex !important;
    }
    
    .shop-item { padding: 8px !important; display: flex; flex-direction: column; justify-content: space-between; }
    .shop-item h3 { font-size: 11px !important; margin-bottom: 4px; text-align: center; }
    .shop-item p { font-size: 9px !important; margin-bottom: 6px; text-align: center; }
    .shop-item button { font-size: 10px !important; padding: 6px !important; margin-top: auto; }

    /* ESCONDER A BARRA DE SCROLL NO MOBILE PARA DESIGN MAIS LIMPO */
    ::-webkit-scrollbar { display: none; }
}

/* =========================================
   CINEMATIC MODE (HIDE GUI)
   ========================================= */
body.cinematic-mode #left-panel,
body.cinematic-mode #right-panel,
body.cinematic-mode #toggle-shop {
    opacity: 0 !important;
    pointer-events: none !important;
    transition: opacity 0.3s ease-out;
}

body.cinematic-mode #hide-gui-btn {
    border-color: #ff0055 !important;
    color: #ff0055 !important;
    box-shadow: 0 0 15px rgba(255, 0, 85, 0.5) !important;
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
    z-index: 9999999 !important;
}

#hide-gui-btn {
    transition: all 0.3s ease;
}

#right-panel {
    /* ... existing props ... */
    visibility: hidden; /* Evita cliques fantasmas quando fechado */
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), visibility 0.4s;
}

.panel-title {
    color: #66fcf1;
    font-size: 24px;
    font-weight: 900;
    text-align: center;
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 0 10px rgba(102, 252, 241, 0.4);
}

.controls-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 15px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    font-size: 14px;
}

.stat-value {
    font-weight: bold;
    color: #fff;
    font-family: monospace;
    font-size: 16px;
}

/* Tabs da loja */
.tab-container {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    border-bottom: 2px solid rgba(102, 252, 241, 0.1);
}

.tab {
    padding: 10px 0;
    cursor: pointer;
    color: #888;
    font-weight: bold;
    font-size: 13px;
    transition: 0.3s;
    flex: 1;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.tab:hover {
    color: #c5c6c7;
}

.tab.active {
    color: #66fcf1;
    border-bottom: 2px solid #66fcf1;
    text-shadow: 0 0 5px rgba(102, 252, 241, 0.5);
}

.shop-content {
    display: none;
    flex-direction: column;
    gap: 15px;
    overflow-y: auto;
    padding-right: 5px;
    flex-grow: 1;
}

.shop-content.active {
    display: flex;
}

.shop-item {
    background: rgba(31, 40, 51, 0.7);
    padding: 15px;
    border-radius: 12px;
    border: 1px solid rgba(102, 252, 241, 0.1);
    transition: all 0.3s ease;
}

.shop-item:hover {
    border-color: #45a29e;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(69, 162, 158, 0.2);
}

.shop-item h3 {
    color: #fff;
    font-size: 16px;
    margin-bottom: 8px;
}

/* V4.6.3: Mobile UX Optimization */
@media screen and (max-width: 768px) {
    #shop-mobile-hud { display: flex !important; }
    #close-shop {
        left: auto !important;
        right: 10px !important;
        top: calc(15vh + 15px) !important; z-index: 1000002 !important;
        border-radius: 5px !important;
        width: 35px !important;
        height: 35px !important;
        padding: 0 !important;
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        z-index: 1000001 !important; /* Acima de tudo */
        box-shadow: 0 0 10px rgba(0,0,0,0.5) !important;
        border: 1px solid rgba(255,255,255,0.2) !important;
    }
    #right-panel .tab-container {
        margin-top: 10px;
        padding-right: 40px;
        flex-wrap: wrap;
        gap: 5px;
    }
    #right-panel .tab {
        font-size: 10px;
        padding: 5px 8px;
    }
}

/* =========================================
   REBIRTH UPGRADES SHOP V4.7.9
   ========================================= */
.rebirth-upg-card {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(255,0,85,0.3);
    border-radius: 10px;
    padding: 12px;
    transition: all 0.3s;
    margin-bottom: 8px;
}
.rebirth-upg-card.available {
    border-color: rgba(255, 80, 0, 0.6);
    box-shadow: 0 0 10px rgba(255,80,0,0.15);
}
.rebirth-upg-card.owned {
    border-color: rgba(0, 255, 80, 0.4);
    opacity: 0.75;
}
.rebirth-upg-card.locked {
    opacity: 0.6;
}
.rebirth-upg-icon {
    font-size: 24px;
    min-width: 36px;
    text-align: center;
    padding-top: 2px;
    color: #ff5000;
}
.rebirth-upg-info {
    flex: 1;
}
.rebirth-upg-name {
    font-weight: 800;
    font-size: 13px;
    color: #ff9900;
    margin-bottom: 4px;
}
.rebirth-upg-desc {
    font-size: 11px;
    color: #aaa;
    line-height: 1.5;
    margin-bottom: 8px;
}
.rebirth-upg-costs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.rebirth-buy-btn {
    background: linear-gradient(135deg, #ff5000, #cc3300);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}
.rebirth-buy-btn:hover:not(.disabled) {
    filter: brightness(1.2);
    transform: scale(1.03);
}
.rebirth-buy-btn.disabled {
    background: rgba(255,255,255,0.1);
    color: #555;
    cursor: not-allowed;
}
.rebirth-buy-btn.diamond {
    background: linear-gradient(135deg, #4400a0, #220080);
    color: #b888ff;
}
.rebirth-upg-owned-badge {
    color: #00ff80;
    font-size: 11px;
    font-weight: 700;
}
#rebirth-upgrades-container {
    padding: 8px 0;
}

/* =========================================
   RESPONSIVIDADE V4.7.9 — TODOS OS TAMANHOS
   ========================================= */

/* DESKTOP GRANDE (1200px+) */
@media screen and (min-width: 1200px) {
    .rebirth-upg-card { padding: 16px; gap: 16px; }
    .rebirth-upg-name { font-size: 14px; }
    .rebirth-upg-desc { font-size: 12px; }
    .rebirth-buy-btn { padding: 8px 16px; font-size: 12px; }
    .rebirth-upg-icon { font-size: 28px; min-width: 40px; }
    #nexus-modal-box { max-width: 480px !important; padding: 40px !important; }
}

/* MOBILE PORTRAIT (ate 768px) */
@media screen and (max-width: 768px) {
    .rebirth-upg-card { flex-direction: row; padding: 10px; gap: 10px; }
    .rebirth-upg-icon { font-size: 20px; min-width: 28px; }
    .rebirth-upg-name { font-size: 12px; }
    .rebirth-upg-desc { font-size: 10px; margin-bottom: 6px; }
    .rebirth-upg-costs { flex-direction: column; gap: 5px; }
    .rebirth-buy-btn { width: 100%; text-align: center; padding: 7px 10px; font-size: 11px; }
    #nexus-modal-box { width: 95vw !important; max-width: 95vw !important; padding: 22px 18px !important; border-radius: 12px !important; }
    #nexus-modal-title { font-size: 15px !important; }
    #nexus-modal-msg { font-size: 13px !important; }
    #nexus-modal-icon { font-size: 32px !important; margin-bottom: 10px !important; }
    #nexus-modal-buttons { flex-direction: column !important; gap: 8px !important; }
    .nexus-btn-confirm, .nexus-btn-cancel, .nexus-btn-danger, .nexus-btn-warn { width: 100% !important; padding: 12px !important; font-size: 13px !important; }
}

/* MOBILE PEQUENO (ate 480px) */
@media screen and (max-width: 480px) {
    .rebirth-upg-card { padding: 8px; gap: 8px; }
    .rebirth-upg-icon { font-size: 18px; min-width: 24px; }
    .rebirth-upg-name { font-size: 11px; }
    .rebirth-upg-desc { font-size: 10px; margin-bottom: 5px; }
    .rebirth-buy-btn { font-size: 10px; padding: 6px 8px; }
    #nexus-modal-box { padding: 18px 14px !important; }
    #nexus-modal-title { font-size: 14px !important; letter-spacing: 1px !important; }
    #nexus-modal-msg { font-size: 12px !important; }
    #nexus-modal-icon { font-size: 28px !important; }
}

/* LANDSCAPE MOBILE (altura ate 500px) */
@media screen and (max-height: 500px) and (orientation: landscape) {
    #nexus-modal-box { max-height: 85vh !important; overflow-y: auto !important; padding: 16px !important; }
    #nexus-modal-icon { font-size: 24px !important; margin-bottom: 8px !important; }
    .rebirth-upg-card { padding: 8px; gap: 8px; }
    .rebirth-upg-costs { flex-direction: row; }
    .rebirth-buy-btn { width: auto; }
}

/* =========================================
   SISTEMA DE AMBIENTES V4.8.1
   ========================================= */
@keyframes envNamePop {
    0%   { opacity: 0; transform: translateX(-50%) translateY(8px); }
    20%  { opacity: 1; transform: translateX(-50%) translateY(0); }
    70%  { opacity: 1; transform: translateX(-50%) translateY(0); }
    100% { opacity: 0; transform: translateX(-50%) translateY(-8px); }
}

#env-transition-overlay {
    display: flex !important;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* Mobile: overlay text menor */
@media screen and (max-width: 480px) {
    #env-transition-name { font-size: 24px !important; letter-spacing: 2px !important; }
    #env-name-display { font-size: 9px !important; bottom: 55px !important; }
}

/* OVERLAY DE AMBIENTE V4.8.2 — RESPONSIVO */
#env-transition-overlay {
    display: flex !important;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    pointer-events: none; /* Não bloqueia cliques */
}

/* Mobile portrait */
@media screen and (max-width: 768px) {
    #env-transition-name {
        font-size: clamp(20px, 6vw, 32px) !important;
        letter-spacing: 2px !important;
        padding: 0 20px;
        text-align: center;
    }
    #env-transition-idx {
        font-size: 11px !important;
        letter-spacing: 2px !important;
    }
    #env-name-display {
        bottom: 50px !important;
        font-size: 10px !important;
        letter-spacing: 2px !important;
        max-width: 90vw;
        text-align: center;
    }
}

/* Mobile pequeno */
@media screen and (max-width: 480px) {
    #env-transition-name { font-size: 20px !important; }
    #env-name-display { font-size: 9px !important; bottom: 45px !important; }
}

/* Landscape mobile */
@media screen and (max-height: 500px) and (orientation: landscape) {
    #env-transition-name { font-size: 20px !important; }
    #env-transition-idx { display: none; }
    #env-name-display { bottom: 30px !important; font-size: 9px !important; }
}

/* =========================================
   FAQ & HELP SYSTEM V4.8.3
   ========================================= */
.faq-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.faq-item {
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,204,0,0.1);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s;
}
.faq-item:hover {
    border-color: rgba(255,204,0,0.4);
}
.faq-question {
    padding: 18px 20px;
    color: #fff;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: color 0.3s;
}
.faq-question:hover {
    color: #ffcc00;
}
.faq-question i {
    font-size: 12px;
    opacity: 0.5;
    transition: transform 0.3s;
}
.faq-answer {
    padding: 0 20px;
    max-height: 0;
    overflow: hidden;
    color: #aaa;
    font-size: 13px;
    line-height: 1.6;
    transition: max-height 0.3s ease-out, padding 0.3s ease-out;
}
.faq-item.active {
    background: rgba(255,204,0,0.05);
    border-color: rgba(255,204,0,0.5);
}
.faq-item.active .faq-answer {
    padding: 0 20px 20px 20px;
    max-height: 500px;
}
.faq-item.active .faq-question i {
    transform: rotate(180deg);
}

/* Mobile Adjustments Help */
@media screen and (max-width: 600px) {
    .help-content {
        padding: 20px !important;
        border-radius: 15px !important;
    }
    .faq-question {
        padding: 15px !important;
        font-size: 14px !important;
    }
    .faq-answer {
        font-size: 12px !important;
    }
}

/* =========================================
   LOJA DE DIAMANTES V4.9.0
   ========================================= */
/* Grid Responsivo p/ Upgrades de Diamante v4.9.9.11 */
.dia-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 15px;
    padding: 5px;
}

.dia-upg-card {
    display: flex;
    flex-direction: row;
    gap: 15px;
    background: rgba(11, 12, 16, 0.4);
    border: 1px solid rgba(0, 255, 255, 0.1);
    border-radius: 12px;
    padding: 15px;
    transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    overflow: hidden;
    position: relative;
    height: 100%;
}
.dia-upg-card:hover {
    border-color: rgba(0, 255, 255, 0.6);
    background: rgba(0, 255, 255, 0.05);
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 255, 255, 0.15);
}
.dia-upg-icon {
    width: 50px;
    height: 50px;
    background: rgba(0, 255, 255, 0.1);
    color: #00ffff;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.1);
}
.dia-upg-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}
.dia-upg-name {
    color: #fff;
    font-weight: 900;
    font-size: 15px;
    margin-bottom: 4px;
    letter-spacing: 0.5px;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}
.dia-upg-desc {
    color: #aaa;
    font-size: 12px;
    line-height: 1.4;
    margin-bottom: 15px;
}
.dia-upg-btn {
    background: rgba(0, 255, 255, 0.1);
    color: #00ffff;
    border: 1px solid #00ffff;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    transition: 0.2s;
    width: 100%;
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.dia-upg-btn:hover:not(:disabled) {
    background: #00ffff;
    color: #000;
    box-shadow: 0 0 15px #00ffff;
}
.dia-upg-btn.bought {
    background: rgba(0, 255, 0, 0.15);
    color: #00ff00;
    border-color: #00ff00;
    cursor: default;
    box-shadow: none;
}

/* Mobile adjustments (Extreme Optimization) */
@media screen and (max-width: 768px) {
    .dia-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .dia-upg-card { padding: 12px; gap: 12px; }
    .dia-upg-icon { width: 40px; height: 40px; font-size: 18px; }
    .dia-upg-name { font-size: 14px; }
    .dia-upg-desc { font-size: 11px; margin-bottom: 10px; }
}

/* TABBAR FIX V4.9.1 */
.tab-container {
    display: flex;
    overflow-x: auto;
    gap: 10px;
    padding: 10px 5px;
    margin-bottom: 20px;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    border-bottom: 1px solid rgba(102, 252, 241, 0.1);
}
.tab-container::-webkit-scrollbar { display: none; } /* Chrome/Safari */

.tab {
    flex-shrink: 0;
    padding: 8px 12px;
    font-size: 11px;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: 0.3s;
}
.tab.active {
    border-color: #66fcf1;
    background: rgba(102, 252, 241, 0.05);
}

/* =========================================
   OMNIFORMAT RESPONSIVE ENGINE (V4.9.9.2)
   ========================================= */

@media screen and (max-width: 1024px) {
    #left-panel, #right-panel {
        width: 320px;
    }
}

@media screen and (max-width: 768px) {
    #left-panel {
        left: 10px;
        top: 10px;
        bottom: auto;
        height: auto;
        width: calc(100% - 20px);
        max-height: 40vh;
        z-index: 100;
        background: rgba(11, 12, 16, 0.9);
    }
    
    #right-panel {
        right: 0;
        top: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
        z-index: 1000;
        transform: translateY(100%);
    }

    #right-panel.open {
        transform: translateY(0);
    }

    /* REPOSICIONAMENTO BOTÕES SISTEMA MOBILE v4.11.0 */
    .system-btns-group {
        bottom: auto !important;
        top: 80px !important;
        left: 20px !important;
        right: auto !important;
        flex-direction: column !important;
    }

    #hud {
        top: 60%;
    }

    #result-text {
        font-size: 50px;
    }
    
    .stats-container {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 5px;
    }
    
    .stat-row {
        font-size: 11px;
    }
}

@media screen and (max-width: 480px) {
    #result-text {
        font-size: 40px;
    }
    
    .auth-box {
        padding: 20px;
        width: 95vw;
    }
    
    .btn {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .panel-title {
        font-size: 18px;
    }
}
@media screen and (max-width: 600px) {
    /* BOTÃO TOGGLE SHOP MOBILE FIX CRITICAL */
    #toggle-shop {
        position: fixed !important;
        right: 15px !important;
        top: 15px !important;
        width: 50px !important;
        height: 50px !important;
        padding: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 22px !important;
        border-radius: 50% !important;
        z-index: 1000 !important; /* Baixando Z p/ não cobrir a loja aberta */
        background: rgba(102, 252, 241, 0.9) !important;
        color: #0b0c10 !important;
        box-shadow: 0 0 15px rgba(102, 252, 241, 0.5) !important;
        border: none !important;
    }
    #toggle-shop span { display: none !important; }

    /* FIX: Esconde toggle-shop quando a loja está aberta — evita sobrepor close-shop */
    body:has(#right-panel.open) #toggle-shop {
        display: none !important;
    }
    /* Fallback pra browsers sem :has() */
    #right-panel.open + #toggle-shop,
    #right-panel.open ~ #toggle-shop {
        display: none !important;
    }
    /* Garante que close-shop fique na frente */
    #right-panel.open #close-shop {
        z-index: 10000 !important;
        background: rgba(255, 0, 85, 1) !important;
        box-shadow: 0 0 20px rgba(255,0,85,.8), 0 4px 12px rgba(0,0,0,.6) !important;
    }

    /* REFORMULAÇÃO MOBILE v4.11.0: LOJA SLIDE-UP */
    #right-panel {
        display: none !important; /* Escondido por padrão no mobile */
        visibility: hidden !important;
        opacity: 0 !important;
        transform: translateY(100%) !important;
        top: 0 !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        border-radius: 0 !important;
        border: none !important;
        background: #0b0c10 !important;
        padding-top: 70px !important; 
        z-index: 99999 !important;
        transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
    }

    #right-panel.open {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        transform: translateY(0) !important;
    }

    /* NEXUS RECOVERY v4.12.0: MODAL PRECEDENCE */
    #mp-lobby, #admin-terminal, #account-overlay, .glass-modal {
        z-index: 100000 !important;
    }

    #cloud-loading-overlay {
        z-index: 10000000 !important;
    }

    .tab-container {
        position: fixed !important;
        /* SUBIDO acima da safe-area do iPhone (barra inferior do Safari + home indicator) */
        bottom: max(20px, env(safe-area-inset-bottom)) !important;
        left: 0 !important;
        width: 100% !important;
        height: 70px !important;
        background: rgba(10, 10, 15, 0.98) !important;
        backdrop-filter: blur(30px) !important;
        -webkit-backdrop-filter: blur(30px) !important;
        border-top: 1px solid rgba(0, 255, 255, 0.3) !important;
        border-bottom: 1px solid rgba(0, 255, 255, 0.15) !important;
        display: flex !important;
        justify-content: space-around !important;
        align-items: center !important;
        z-index: 999999 !important;
        overflow-x: auto !important;
        white-space: nowrap !important;
        box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.5) !important;
    }

    .tab {
        flex-direction: column !important;
        gap: 2px !important;
        min-width: 60px !important;
        flex-shrink: 0 !important;
        padding: 5px !important;
        font-size: 10px !important;
        border: none !important;
        color: #888 !important;
        height: 100% !important;
        justify-content: center !important;
    }

    .tab i {
        font-size: 20px !important;
        margin-bottom: 2px !important;
        display: block !important;
    }

    .tab.active {
        color: #00ffff !important;
        background: transparent !important;
        transform: scale(1.1) !important;
    }

    .shop-content {
        /* Espaço extra embaixo: 70px tab-bar + 30px safe-area + 30px folga */
        padding-bottom: 140px !important;
        height: calc(100vh - 180px) !important;
        mask-image: linear-gradient(to bottom, black 93%, transparent 100%);
    }

    #left-panel { width: 100% !important; padding: 10px !important; }
}

/* Desktop Icon Optimization */
.tab i { font-size: 1.2rem; }
.tab:hover { background: rgba(102, 252, 241, 0.1); }

/* UI HINTS V4.9.3 */
#shop-scroll-hint { animation: pulseGhost 2s infinite; }
@keyframes pulseGhost { 0%, 100% { opacity: 0.2; } 50% { opacity: 0.5; } }

/* TAB CONTENT VISIBILITY FIX v4.9.9.12 */
.shop-content { display: none; width: 100%; transition: opacity 0.3s; }
.shop-content.active { display: block !important; opacity: 1; min-height: 200px; }

#rebirth-btn { position: relative; z-index: 1000 !important; }
/* =========================================
   DIAMOND SHOP UPGRADES V4.9.9
   ========================================= */
#diamond-upgrades-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 10px 5px;
}

.dia-upg-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.dia-upg-card:hover {
    background: rgba(255, 255, 255, 0.06);
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.2);
}

.dia-upg-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.dia-upg-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.dia-upg-name {
    font-size: 14px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.dia-upg-desc {
    font-size: 11px;
    color: #888;
    line-height: 1.3;
}

.dia-upg-btn {
    margin-top: 10px;
    padding: 8px 12px;
    border-radius: 6px;
    background: rgba(0, 255, 255, 0.1);
    border: 1px solid #00ffff;
    color: #00ffff;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.dia-upg-btn:hover:not([disabled]) {
    background: #00ffff;
    color: #000;
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.5);
}

.dia-upg-btn.bought {
    border-color: #00ff00 !important;
    color: #00ff00 !important;
    background: rgba(0, 255, 0, 0.1) !important;
}
