/* === CORE LAYOUT & VARIABLES === */
:root {
    --color-background: #0A0F1E; --color-primary-cyan: #00E5FF; --color-accent-gold: #F59E0B; --color-secondary-purple: #8E2DE2;
    --color-accent-red: #ef4444; --color-text-primary: #E2E8F0; --color-text-secondary: #94A3B8; --color-primary-cyan-transparent: rgba(0, 229, 255, 0.3);
    --color-border: rgba(0, 229, 255, 0.25);
}

html, body { height: 100%; overflow: hidden; }
body { font-family: 'Roboto', sans-serif; color: var(--color-text-primary); background-color: #000; }
#game-container {
    /* Thay width: 100%; height: 100%; bằng dòng dưới đây: */
    width: 100vw; 
    height: 100vh;
    
    background-color: var(--color-background);
    /* box-shadow: 0 0 50px ... (Giữ nguyên hoặc xóa nếu muốn full màn hình không viền) */
    border: none; /* Xóa viền để liền mạch */
    position: relative;
    perspective: 1000px;
    overflow: hidden;
}
/* === BACKGROUND & AMBIENCE EFFECTS === */
#game-container::after {
    content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background-image: radial-gradient(1px 1px at 10% 20%, white, transparent), radial-gradient(1.5px 1.5px at 80% 30%, white, transparent), radial-gradient(1px 1px at 50% 50%, white, transparent), radial-gradient(2px 2px at 30% 80%, white, transparent), radial-gradient(1.5px 1.5px at 90% 90%, white, transparent);
    background-size: 400px 400px; background-repeat: repeat;
    animation: move-stars 150s linear infinite; z-index: 0; transition: opacity 0.5s ease-out;
}
#game-container::before {
    content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background-image: radial-gradient(2px 2px at 20% 30%, var(--color-secondary-purple), transparent), radial-gradient(1.5px 1.5px at 70% 80%, var(--color-secondary-purple), transparent), radial-gradient(2px 2px at 50% 50%, var(--color-accent-gold), transparent), radial-gradient(2.5px 2.5px at 90% 10%, var(--color-accent-gold), transparent);
    background-size: 500px 500px; background-repeat: repeat;
    animation: twinkle 7s ease-in-out infinite alternate; z-index: 0; transition: opacity 0.5s ease-out;
}

/* Lưới Neon 3D (Mặc định) */
.neon-grid-overlay {
    position: absolute; left: -50%; width: 200%; height: 100%;
    --grid-color: var(--color-border);
    --grid-thickness: 1px;
    background-image: 
        linear-gradient(var(--grid-color) var(--grid-thickness), transparent var(--grid-thickness)),
        linear-gradient(90deg, var(--grid-color) var(--grid-thickness), transparent var(--grid-thickness));
    background-size: 3rem 8rem; 
    animation: background-pan 30s linear infinite; z-index: 1; 
    transition: transform 1.5s cubic-bezier(0.25, 0.1, 0.25, 1), opacity 0.5s ease-out, filter 0.5s ease-in-out, box-shadow 0.5s ease-in-out, background-image 0.5s ease-out;
}
.neon-grid-overlay.is-floor { top: 60%; transform-origin: top center; transform: rotateX(75deg) scale(1); mask-image: linear-gradient(to top, rgba(0,0,0,1) 10%, rgba(0,0,0,0) 80%); }
.neon-grid-overlay.is-ceiling { bottom: 60%; transform-origin: bottom center; transform: rotateX(-75deg) scale(1); mask-image: linear-gradient(to bottom, rgba(0,0,0,1) 10%, rgba(0,0,0,0) 80%); }

/* === COMPONENT DÙNG CHUNG: UPGRADE BOX (Đã chuyển từ các file con sang) === */
.upgrade-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
    padding: 1rem 0.5rem;
    border-bottom: 1px solid var(--color-border);
}
.upgrade-box:last-child {
    border-bottom: none;
}
@media (min-width: 640px) {
    .upgrade-box {
        flex-direction: row;
    }
}

/* === GENERAL ANIMATIONS & GLOBAL COMPONENTS === */
@keyframes move-stars { from { background-position: 0 0; } to { background-position: 0 -400px; } }
@keyframes twinkle { 0% { opacity: 0; } 50% { opacity: 0.6; } 100% { opacity: 0; } }
@keyframes background-pan { from { background-position: 0 0; } to { background-position: 0 96rem; } }

.screen { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: flex; flex-direction: column; opacity: 0; visibility: hidden; z-index: 10; transition: opacity 0.4s ease-in-out, visibility 0s linear 0.4s; }
.screen.active { opacity: 1; visibility: visible; z-index: 10; transition-delay: 0s; transform: scale(1); }
.screen-main { flex-grow: 1; overflow-y: auto; min-height: 0; position: relative; display: flex; flex-direction: column; padding-bottom: 80px; box-sizing: border-box; }
.screen.transition-out { opacity: 0; transform: scale(0.95); transition: opacity 0.5s ease-out, transform 0.5s ease-out, visibility 0s linear 0.5s; }
.screen.transition-in { opacity: 1; transform: scale(1); transition: opacity 0.5s ease-in 0.3s, transform 0.5s ease-in 0.3s; }
.screen-header { border-bottom: 1px solid var(--color-border); background-color: rgba(10, 15, 30, 0.8); backdrop-filter: blur(5px); z-index: 20; }
.resource-display { background-color: rgba(0,0,0,0.3); border: 1px solid var(--color-border); padding: 0.5rem 1rem; border-radius: 4px; display: flex; align-items: center; gap: 0.75rem; font-weight: bold; }
.resource-display i { font-size: 1.1rem; }
#main-nav-bar { 
    position: absolute; 
    bottom: 0; 
    left: 0; 
    right: 0; 
    height: 60px; 
    display: none;
    justify-content: space-around; 
    align-items: center; 
    background-color: rgba(10, 15, 30, 0.95); 
    backdrop-filter: blur(10px); 
    border-top: 1px solid var(--color-border); 
    
    /* === SỬA LỖI KHÔNG CLICK ĐƯỢC === */
    z-index: 9999 !important;  /* Ép buộc lớp cao nhất */
    pointer-events: auto !important; /* Ép buộc nhận chuột */
    transform: translateZ(0); /* Mẹo nhỏ để trình duyệt ưu tiên render lớp này */
    
    transition: opacity 0.3s, visibility 0.3s; 
}
#login-screen.active ~ #main-nav-bar, #register-screen.active ~ #main-nav-bar, #email-verification-screen.active ~ #main-nav-bar { opacity: 0; visibility: hidden; }
.nav-btn { color: var(--color-text-secondary); width: 65px; display: flex; flex-direction: column; align-items: center; justify-content: center; transition: all 0.3s ease; position: relative; background: none; border: none; cursor: pointer; height: 100%; }
.nav-btn i { font-size: 1.25rem; }
.nav-btn::before { content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 0; height: 3px; background-color: var(--color-primary-cyan); box-shadow: 0 0 10px var(--color-primary-cyan); transition: width 0.3s ease; }
.nav-btn.active::before, .nav-btn:hover::before { width: 80%; }
.nav-btn.active, .nav-btn:hover { color: var(--color-primary-cyan); text-shadow: 0 0 10px var(--color-primary-cyan); }
.nav-btn::after { content: attr(data-label); font-size: 0.7rem; margin-top: 2px; }
.modal-backdrop { background-color: rgba(0, 0, 0, 0.7); backdrop-filter: blur(5px); }

/* --- SỬA MODAL NHỎ GỌN --- */
.tech-modal-content {
    background-color: var(--color-background);
    border: 1px solid var(--color-primary-cyan);
    box-shadow: 0 0 25px var(--color-primary-cyan);
    border-radius: 12px;
    width: min(90%, 400px); /* Tối đa 400px */
    height: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    animation: modal-pop-in 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes modal-pop-in {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.tab-nav { border-bottom: 1px solid var(--color-border); }
.tab-btn { border: none; background: none; padding: 0.75rem 1rem; color: var(--color-text-secondary); position: relative; transition: color 0.3s; }
.tab-btn.active { color: var(--color-primary-cyan); }
.tab-btn.active::after { content: ''; position: absolute; bottom: -1px; left: 0; right: 0; height: 2px; background-color: var(--color-primary-cyan); box-shadow: 0 0 10px var(--color-primary-cyan); }
.tab-content { display: none; }
.tab-content.active { display: block; }
.font-title { font-family: 'Roboto', sans-serif; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--color-text-primary); text-shadow: 0 0 8px var(--color-primary-cyan); }
.futuristic-btn { background: transparent; border: 2px solid var(--color-primary-cyan); color: var(--color-text-primary); padding: 0.75rem 1.5rem; border-radius: 4px; font-weight: 600; text-transform: uppercase; transition: all 0.3s ease; box-shadow: 0 0 5px var(--color-primary-cyan), inset 0 0 5px var(--color-primary-cyan); text-shadow: 0 0 3px rgba(255, 255, 255, 0.7); cursor: pointer; }
.futuristic-btn:hover:not(:disabled) { background-color: var(--color-primary-cyan); color: #0A0F1E; box-shadow: 0 0 15px var(--color-primary-cyan), 0 0 25px var(--color-primary-cyan); transform: translateY(-2px); text-shadow: none; }
.futuristic-btn:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }
.tech-input { background-color: rgba(0,0,0,0.5); border: 1px solid var(--color-border); border-radius: 4px; color: var(--color-text-primary); padding: 0.75rem 1rem; transition: all 0.3s ease; }
.tech-input:focus { border-color: var(--color-primary-cyan); box-shadow: 0 0 15px var(--color-primary-cyan), inset 0 0 10px rgba(0, 229, 255, 0.2); background-color: rgba(0, 20, 40, 0.7); outline: none; }
.gold-text { color: var(--color-accent-gold); text-shadow: 0 0 8px var(--color-accent-gold); }

#hexa-cube-container { width: 250px; height: 250px; perspective: 1000px; }
.hexa-cube { width: 100%; height: 100%; position: relative; transform-style: preserve-3d; animation: rotate-cube 20s infinite linear; }
.hexa-cube.is-opening { animation: spin-fast 1.5s ease-out forwards; }
.face { position: absolute; } 
.hexa-cube .face { width: 150px; height: 150px; background-color: rgba(0, 229, 255, 0.1); border: 1px solid var(--color-primary-cyan); display: flex; align-items: center; justify-content: center; font-size: 2rem; }
.hexa-cube .face.front  { transform: rotateY(0deg) translateZ(75px); }
.hexa-cube .face.back   { transform: rotateY(180deg) translateZ(75px); }
.hexa-cube .face.right  { transform: rotateY(90deg) translateZ(75px); }
.hexa-cube .face.left   { transform: rotateY(-90deg) translateZ(75px); }
.hexa-cube .face.top    { transform: rotateX(90deg) translateZ(75px); }
.hexa-cube .face.bottom { transform: rotateX(-90deg) translateZ(75px); }
@keyframes rotate-cube { from { transform: rotateY(0deg) rotateX(0deg); } to { transform: rotateY(360deg) rotateX(360deg); } }
@keyframes spin-fast { 0% { transform: rotateY(0) rotateX(0) scale(1); } 50% { transform: rotateY(1080deg) rotateX(360deg) scale(1.5); } 100% { transform: rotateY(1440deg) rotateX(720deg) scale(0); opacity: 0; } }

/* === SỬA LỖI QUAN TRỌNG: Ẩn Overlay mặc định === */
/* Code này nằm ở cuối cùng để đảm bảo an toàn */
#hyperspace-loading-overlay {
    display: none;
}
/* Khi bấm vào icon, nó sẽ xuyên qua và bấm trúng nút button ở dưới */
.nav-btn i,
.nav-btn span {
    pointer-events: none !important;
}
/* Style cho nút bị khóa */
.nav-btn.is-locked {
    opacity: 0.7;
    cursor: not-allowed;
    filter: grayscale(100%);
}

.nav-btn.is-locked:hover {
    background: transparent !important;
    box-shadow: none !important;
    transform: none !important;
}

/* Icon ổ khóa */
.lock-icon {
    z-index: 50;
    pointer-events: none;
    animation: fadeIn 0.3s ease-out;
}
/* --- SMART QUEST HUD --- */
.smart-quest-hud {
    background: linear-gradient(90deg, rgba(0,0,0,0) 0%, rgba(0, 229, 255, 0.15) 50%, rgba(0,0,0,0) 100%);
    border-top: 1px solid rgba(0, 229, 255, 0.3);
    border-bottom: 1px solid rgba(0, 229, 255, 0.3);
    padding: 10px 0;
    margin-bottom: 15px;
    text-align: center;
    animation: fadeIn 0.5s ease-out;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
}

.smart-quest-hud:hover {
    background: linear-gradient(90deg, rgba(0,0,0,0) 0%, rgba(0, 229, 255, 0.25) 50%, rgba(0,0,0,0) 100%);
}

.quest-label {
    font-family: 'Orbitron', sans-serif;
    color: var(--color-primary-cyan);
    font-size: 0.8rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    display: block;
    margin-bottom: 4px;
}

.quest-instruction {
    color: #fff;
    font-size: 1rem;
    font-weight: bold;
    text-shadow: 0 0 10px var(--color-primary-cyan);
}

/* --- BÀN TAY CHỈ LỐI --- */
.guiding-hand {
    position: absolute;
    z-index: 9999;
    pointer-events: none;
    filter: drop-shadow(0 0 5px var(--color-primary-cyan));
    animation: pointMove 1.5s infinite ease-in-out;
    font-size: 2rem;
    color: white;
}

@keyframes pointMove {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(10px); }
}

.target-highlight {
    position: relative;
    z-index: 50;
    box-shadow: 0 0 15px var(--color-primary-cyan), inset 0 0 10px var(--color-primary-cyan) !important;
    border-color: var(--color-primary-cyan) !important;
    animation: pulseBorder 1.5s infinite;
}

@keyframes pulseBorder {
    0% { box-shadow: 0 0 0 0 rgba(0, 229, 255, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(0, 229, 255, 0); }
    100% { box-shadow: 0 0 0 0 rgba(0, 229, 255, 0); }
}
/* [THÊM VÀO CUỐI FILE css/main.css] */

/* === VISUAL POINTER (Bàn tay chỉ lối) === */
.guiding-hand {
    position: absolute;
    z-index: 99999; /* Cao hơn tất cả mọi thứ */
    pointer-events: none; /* Cho phép click xuyên qua */
    filter: drop-shadow(0 0 8px var(--color-primary-cyan));
    animation: pointMove 1.5s infinite ease-in-out;
    font-size: 2.5rem; /* Kích thước tay */
    color: white;
    transition: top 0.3s ease, left 0.3s ease;
}

/* Animation ngón tay trỏ lên xuống */
@keyframes pointMove {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(15px); }
}

/* === TARGET HIGHLIGHT (Hiệu ứng làm nổi bật nút mục tiêu) === */
.target-highlight {
    position: relative;
    z-index: 50 !important; /* Nổi lên trên các element khác */
    box-shadow: 0 0 0 2px var(--color-primary-cyan), 0 0 20px var(--color-primary-cyan) !important;
    animation: pulseBorder 1.5s infinite;
}

/* Animation viền nhấp nháy thu hút sự chú ý */
@keyframes pulseBorder {
    0% { box-shadow: 0 0 0 0 rgba(0, 229, 255, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(0, 229, 255, 0); }
    100% { box-shadow: 0 0 0 0 rgba(0, 229, 255, 0); }
}
/* css/main.css */

.screen-help-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text-secondary);
    transition: color 0.3s, transform 0.3s;
    position: relative;
    z-index: 50; /* [QUAN TRỌNG] Đảm bảo nổi lên trên */
    padding: 5px; /* Tăng diện tích bấm */
}

.screen-help-btn:hover {
    color: var(--color-primary-cyan);
    transform: scale(1.1);
}

/* Định vị nút help trong Header */
.screen-header .screen-help-btn.absolute {
    top: 50%;
    transform: translateY(-50%);
    right: 1rem; /* Cách lề phải */
}
.screen-header .screen-help-btn.absolute:hover {
    transform: translateY(-50%) scale(1.1);
}
/* === MAINTENANCE OVERLAY === */
.maintenance-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    /* Nền vũ trụ tối */
    background: radial-gradient(circle at center, #1a0b2e 0%, #000000 100%);
    z-index: 999999; /* Cao nhất hệ mặt trời */
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    text-align: center;
}

.maintenance-overlay.hidden {
    display: none !important;
}

.maintenance-content {
    background: rgba(20, 10, 10, 0.95);
    border: 2px solid var(--color-accent-red);
    box-shadow: 0 0 50px rgba(239, 68, 68, 0.4), inset 0 0 20px rgba(239, 68, 68, 0.2);
    padding: 3rem;
    border-radius: 16px;
    max-width: 500px;
    width: 90%;
    animation: pulseRedBorder 3s infinite;
}

.maintenance-icon {
    font-size: 4rem;
    color: var(--color-accent-red);
    margin-bottom: 1.5rem;
}

@keyframes pulseRedBorder {
    0% { box-shadow: 0 0 20px rgba(239, 68, 68, 0.3); }
    50% { box-shadow: 0 0 50px rgba(239, 68, 68, 0.6); }
    100% { box-shadow: 0 0 20px rgba(239, 68, 68, 0.3); }
}