/* ========================================= */
/* RESET & BASE                              */
/* ========================================= */
:root {
    --bg: #000000;
    --surface: #111111;
    --surface-hover: #1a1a1a;
    --primary: #00d4ff;
    --secondary: #a855f7;
    --text-main: #ffffff;
    --text-muted: #888888;
    --border: #222222;
    --glow: rgba(0, 212, 255, 0.3);
    --future: #ffaa00;
    --success: #00ff88;
    --danger: #ff4444;
    --icon-scale: 1;
    --dd-top: 64px;
}

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

body {
    font-family: -apple-system, 'Segoe UI', Roboto, sans-serif;
    color: var(--text-main);
    line-height: 1.6;
    background: var(--bg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(0, 100, 180, 0.15), transparent),
        radial-gradient(ellipse 60% 40% at 80% 80%, rgba(120, 40, 180, 0.08), transparent),
        radial-gradient(ellipse 50% 30% at 10% 60%, rgba(0, 180, 120, 0.06), transparent);
}

#bgCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* ========================================= */
/* NAVBAR                                    */
/* ========================================= */
.navbar {
    position: relative;
    z-index: 100;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(16px) saturate(1.4);
    padding: 0 20px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(0, 212, 255, 0.12);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.4);
    flex-shrink: 0;
}

.navbar.scrolled {
    background: rgba(0, 0, 0, 0.9);
    box-shadow: 0 4px 40px rgba(0, 212, 255, 0.08);
}

.navbar-left {
    display: flex;
    align-items: center;
    gap: 24px;
    min-width: 0;
}

.navbar .logo {
    font-size: 20px;
    font-weight: bold;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
    text-shadow: 0 0 10px var(--glow);
    text-decoration: none;
    z-index: 101;
    white-space: nowrap;
    transition: text-shadow 0.3s;
}

.navbar .logo:hover {
    text-shadow: 0 0 20px var(--primary), 0 0 40px rgba(0, 212, 255, 0.4);
}

.navbar-right {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}

.control-btn {
    background: rgba(15, 15, 15, 0.85);
    border: 1px solid var(--border);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.25s ease;
    font-size: 12px;
    font-weight: bold;
    white-space: nowrap;
}

.control-btn:hover {
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0, 212, 255, 0.25);
}

.control-btn:active {
    transform: scale(0.96);
}

.control-btn svg {
    width: 16px;
    height: 16px;
    fill: var(--primary);
}

/* Language Selector */
.lang-selector {
    display: flex;
    gap: 4px;
    background: rgba(0, 0, 0, 0.65);
    padding: 3px;
    border-radius: 24px;
    border: 1px solid var(--border);
}

.lang-btn {
    background: transparent;
    color: #aaa;
    border: none;
    padding: 5px 10px;
    border-radius: 18px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    transition: 0.25s;
    display: flex;
    align-items: center;
    gap: 5px;
}

.lang-btn .flag {
    width: 22px;
    height: 15px;
    object-fit: cover;
    border-radius: 2px;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.3);
    display: block;
}

.lang-btn .lang-code {
    font-size: 12px;
    letter-spacing: 0.5px;
}

.lang-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
}

.lang-btn.active {
    background: var(--primary);
    color: #000;
    box-shadow: 0 0 14px rgba(0, 212, 255, 0.5);
}

.lang-btn.active .lang-code {
    color: #000;
}

.mode-btn {
    min-width: 86px;
    font-size: 12px;
}

.install-btn {
    background: rgba(0, 255, 136, 0.15);
    border-color: rgba(0, 255, 136, 0.4);
    color: #00ff88;
}

.install-btn:hover {
    background: rgba(0, 255, 136, 0.25);
}

.user-btn {
    background: rgba(0, 212, 255, 0.12);
    border-color: rgba(0, 212, 255, 0.35);
}

.user-btn.logged-in {
    background: rgba(0, 255, 136, 0.12);
    border-color: rgba(0, 255, 136, 0.4);
}

/* ========================================= */
/* TOP MENU BAR (DROPDOWN)                   */
/* ========================================= */
.top-menu-bar {
    display: flex;
    gap: 4px;
    align-items: center;
    height: 100%;
    overflow-x: auto;
    scrollbar-width: none;
}

.top-menu-bar::-webkit-scrollbar {
    display: none;
}

.menu-group {
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.menu-group-title {
    font-size: 13px;
    font-weight: bold;
    color: var(--text-muted);
    padding: 6px 11px;
    border-radius: 8px;
    cursor: pointer;
    transition: 0.25s;
    white-space: nowrap;
}

.menu-group:hover .menu-group-title,
.menu-group.hov .menu-group-title,
.menu-group.active .menu-group-title {
    color: var(--primary);
    background: rgba(0, 212, 255, 0.1);
}

.menu-dropdown {
    position: fixed;
    top: 58px;
    left: auto;
    background: rgba(14, 16, 24, 0.98);
    border: 1px solid var(--primary);
    border-radius: 12px;
    padding: 8px;
    display: none;
    flex-direction: column;
    gap: 2px;
    min-width: 220px;
    max-width: 320px;
    max-height: calc(100dvh - 110px);
    overflow-y: auto;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.85);
    z-index: 300;
}

.menu-dropdown::before {
    content: '';
    position: absolute;
    top: -24px;
    left: 0;
    right: 0;
    height: 24px;
    background: transparent;
}

.menu-group:hover .menu-dropdown,
.menu-group.hov .menu-dropdown,
.menu-group.active .menu-dropdown {
    display: flex;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    color: white;
    text-decoration: none;
    transition: 0.2s;
    font-size: 13px;
}

.menu-item:hover {
    background: rgba(0, 212, 255, 0.18);
    color: var(--primary);
}

.menu-item img {
    width: 20px;
    height: 20px;
    max-width: 20px;
    max-height: 20px;
    object-fit: contain;
    flex-shrink: 0;
}

.menu-badge {
    font-style: normal;
    font-size: 10px;
    font-weight: 800;
    padding: 1px 6px;
    border-radius: 999px;
    background: rgba(0, 212, 255, 0.18);
    color: var(--primary);
    margin-left: auto;
}

/* ========================================= */
/* THANH TÌM KIẾM NHANH & KẾT QUẢ           */
/* ========================================= */
.phone-search-bar {
    display: none;
    position: relative;
    z-index: 95;
    padding: 10px 16px;
    background: rgba(6, 8, 14, 0.92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0, 212, 255, 0.15);
    flex-shrink: 0;
}

.phone-search-bar.active,
.phone-mode .phone-search-bar {
    display: block;
}

.search-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    max-width: 720px;
    margin: 0 auto;
}

.phone-search-bar input {
    width: 100%;
    padding: 11px 38px 11px 16px;
    background: #11141d;
    border: 1px solid var(--border);
    border-radius: 14px;
    color: white;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.phone-search-bar input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.15);
}

.phone-search-bar input::placeholder {
    color: #6b7280;
}

.clear-search-btn {
    position: absolute;
    right: 10px;
    background: transparent;
    border: none;
    color: #9ca3af;
    font-size: 14px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
}

.clear-search-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.quick-search-results {
    display: none;
    max-width: 720px;
    margin: 8px auto 0;
    background: rgba(12, 15, 24, 0.98);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 14px;
    overflow: hidden;
    max-height: 280px;
    overflow-y: auto;
}

.quick-search-results.open {
    display: block;
}

.search-result-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.search-result-row:last-child {
    border-bottom: none;
}

.search-go-btn {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: transparent;
    border: none;
    color: #fff;
    text-align: left;
    cursor: pointer;
}

.search-go-btn:hover {
    background: rgba(0, 212, 255, 0.1);
}

.search-go-btn img {
    width: 28px;
    height: 28px;
    max-width: 28px;
    max-height: 28px;
    object-fit: contain;
    flex-shrink: 0;
}

.search-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.search-meta strong {
    font-size: 13px;
    color: #fff;
}

.search-meta small {
    font-size: 11px;
    color: var(--text-muted);
}

.search-pin-btn {
    background: transparent;
    border: none;
    padding: 10px 14px;
    cursor: pointer;
    font-size: 15px;
    opacity: 0.75;
}

.search-pin-btn:hover,
.search-pin-btn.pinned {
    opacity: 1;
}

.search-empty {
    padding: 14px;
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
}

/* ========================================= */
/* KHU VỰC CHÍNH (VŨ TRỤ & LƯỚI)            */
/* ========================================= */
.main-content {
    position: relative;
    flex: 1;
    width: 100%;
    overflow: hidden;
    z-index: 1;
}

/* ===== MẶT TRỜI CHIRI — ÁNH SÁNG VÀNG NẮNG ẤM ===== */
.sun-chiri {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    width: 168px;
    height: 168px;
    background: radial-gradient(
        circle,
        rgba(255, 236, 150, 0.55) 0%,
        rgba(255, 200, 60, 0.35) 28%,
        rgba(255, 140, 0, 0.18) 48%,
        rgba(255, 90, 0, 0.06) 65%,
        transparent 75%
    );
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow:
        0 0 80px rgba(255, 210, 80, 0.55),
        0 0 160px rgba(255, 180, 40, 0.35),
        0 0 260px rgba(255, 140, 0, 0.18);
    pointer-events: none;
    animation: sunWarmPulse 5s ease-in-out infinite alternate;
}

.sun-chiri img {
    width: 104px;
    height: 104px;
    max-width: 104px;
    max-height: 104px;
    object-fit: contain;
    filter: drop-shadow(0 0 24px #ffcc00);
}

/* SVG lõi CHIRI AI — đồng bộ ở mọi vị trí */
.sun-chiri .chiri-ai-svg {
    display: block;
    position: relative;
    z-index: 2;
    width: 124px;
    height: 124px;
    max-width: 100%;
    filter: drop-shadow(0 0 20px rgba(255, 200, 80, 0.65))
            drop-shadow(0 0 44px rgba(255, 160, 40, 0.32));
}

@keyframes sunPulse {
    from {
        box-shadow: 0 0 80px rgba(255, 204, 0, 0.3);
        transform: translate(-50%, -50%) scale(1);
    }
    to {
        box-shadow: 0 0 150px rgba(255, 204, 0, 0.6);
        transform: translate(-50%, -50%) scale(1.05);
    }
}

@keyframes sunWarmPulse {
    from {
        box-shadow:
            0 0 70px rgba(255, 210, 80, 0.45),
            0 0 140px rgba(255, 180, 40, 0.28),
            0 0 220px rgba(255, 140, 0, 0.14);
        transform: translate(-50%, -50%) scale(1);
    }
    to {
        box-shadow:
            0 0 100px rgba(255, 220, 100, 0.65),
            0 0 200px rgba(255, 190, 50, 0.42),
            0 0 300px rgba(255, 150, 20, 0.22);
        transform: translate(-50%, -50%) scale(1.04);
    }
}

/* ===== HÀNH TINH MẸ (menu chính) ===== */
.floating-item {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    text-decoration: none;
    z-index: 5;
    transition: filter 0.3s, opacity 0.35s ease, transform 0.3s;
    will-change: left, top, transform;
    transform-origin: center center;
}

.floating-item.search-hidden,
.floating-item.profile-hidden {
    display: none;
}

.item-content {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.feature-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    z-index: 4;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.4px;
    padding: 2px 7px;
    border-radius: 999px;
    background: linear-gradient(135deg, #00d4ff, #00ff88);
    color: #000;
    box-shadow: 0 2px 10px rgba(0, 212, 255, 0.45);
    pointer-events: none;
}

.floating-item:hover {
    z-index: 30;
    filter: drop-shadow(0 0 25px var(--primary));
}

.floating-item:hover .item-content {
    transform: scale(1.08);
}

.floating-item.paused {
    opacity: 0.92;
}

.hex-icon {
    width: 86px;
    height: 86px;
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.15) 0%, rgba(20, 20, 20, 0.95) 60%);
    border: 2px solid var(--border);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.3s, box-shadow 0.3s;
    position: relative;
    box-shadow:
        inset -10px -10px 20px rgba(0, 0, 0, 0.8),
        inset 10px 10px 20px rgba(255, 255, 255, 0.05),
        0 0 15px rgba(0, 0, 0, 0.5);
}

.floating-item:hover .hex-icon {
    border-color: var(--primary);
    box-shadow:
        inset -10px -10px 20px rgba(0, 0, 0, 0.8),
        inset 10px 10px 20px rgba(255, 255, 255, 0.15),
        0 0 30px var(--glow);
}

.hex-icon img {
    width: 46px;
    height: 46px;
    max-width: 46px;
    max-height: 46px;
    object-fit: contain;
    display: block;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

.floating-item .label {
    font-size: 12px;
    font-weight: 800;
    margin-top: 8px;
    color: #ffffff;
    text-shadow: 0 0 5px rgba(0, 0, 0, 1);
    background: rgba(0, 0, 0, 0.85);
    padding: 3px 10px;
    border-radius: 8px;
    white-space: nowrap;
    border: 1px solid rgba(255, 255, 255, 0.1);
    letter-spacing: 0.4px;
    transition: all 0.25s ease;
}

.floating-item:hover .label {
    background: var(--primary);
    color: #000;
    border-color: var(--primary);
}

.floating-item.future .hex-icon {
    border-color: rgba(255, 170, 0, 0.35);
}

.floating-item.future:hover .hex-icon {
    border-color: var(--future);
    box-shadow: 0 0 20px rgba(255, 170, 0, 0.4);
}

.floating-item.future:hover .label {
    background: var(--future);
    color: #000;
    border-color: var(--future);
}

.floating-item.impact {
    transform: scale(1.3) !important;
    filter: drop-shadow(0 0 30px #ffffff) !important;
    z-index: 50 !important;
}

/* ===== HÀNH TINH CHÍNH — lớn, nổi bật ===== */
.main-planet-item .hex-icon.main-hex,
.main-planet-item .hex-icon {
    width: 96px !important;
    height: 96px !important;
    border-width: 2.5px;
    background: radial-gradient(circle at 32% 28%, rgba(255,255,255,0.22) 0%, rgba(12,16,28,0.96) 55%);
    box-shadow:
        inset -8px -8px 18px rgba(0,0,0,0.75),
        inset 8px 8px 16px rgba(255,255,255,0.06),
        0 0 28px rgba(0, 212, 255, 0.25);
}
.main-planet-item .hex-icon img {
    width: 48px !important;
    height: 48px !important;
}
.main-planet-item .label {
    font-size: 13px !important;
    font-weight: 800;
    padding: 4px 12px;
    letter-spacing: 0.3px;
    background: rgba(0,0,0,0.9);
    border: 1px solid rgba(0, 212, 255, 0.35);
}
.main-planet-item.group-focused .hex-icon,
.main-planet-item:hover .hex-icon {
    border-color: var(--primary);
    box-shadow:
        inset -8px -8px 18px rgba(0,0,0,0.75),
        0 0 0 3px rgba(0, 212, 255, 0.15),
        0 0 40px rgba(0, 212, 255, 0.55),
        0 0 80px rgba(0, 212, 255, 0.2);
    transform: scale(1.08);
}
.main-planet-item.group-focused .label {
    background: var(--primary);
    color: #000;
    border-color: var(--primary);
}

/* ===== VỆ TINH (menu con) — NHỎ HƠN hành tinh mẹ ===== */
.moon-item {
    pointer-events: auto;
    will-change: left, top, transform;
}
.moon-item .item-content {
    transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.moon-item:hover .item-content {
    transform: scale(1.15);
}
.moon-item .hex-icon {
    width: 58px !important;
    height: 58px !important;
    border-radius: 50%;
    border-width: 1.5px;
    background: radial-gradient(circle at 32% 28%, rgba(255,255,255,0.14) 0%, rgba(16,20,32,0.96) 60%);
    box-shadow:
        inset -6px -6px 12px rgba(0,0,0,0.7),
        inset 6px 6px 10px rgba(255,255,255,0.05),
        0 0 12px rgba(0, 212, 255, 0.18);
}
.moon-item .hex-icon img {
    width: 30px !important;
    height: 30px !important;
}
.moon-item .label {
    font-size: 10px !important;
    padding: 1px 6px;
    max-width: 92px;
    overflow: hidden;
    text-overflow: ellipsis;
    background: rgba(0,0,0,0.88);
    border: 1px solid rgba(255,255,255,0.1);
    font-weight: 700;
}
.moon-item.group-dimmed {
    filter: grayscale(0.35) brightness(0.75);
    pointer-events: auto;
}
.moon-item:hover {
    z-index: 60 !important;
    filter: drop-shadow(0 0 18px var(--primary)) !important;
}
.moon-item:hover .hex-icon {
    transform: scale(1.15) translateY(-2px);
    border-color: var(--primary);
}

/* Trái đất & Mặt trăng */
.decor-item {
    position: absolute;
    pointer-events: none;
    z-index: 2;
}

.earth-decor {
    width: 48px;
    height: 48px;
    /* Hành tinh xanh tự vẽ (SVG của CHIRI), tự quay bằng cách cuộn họa tiết + đổ bóng cầu */
    background:
        radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.35) 0%, rgba(255, 255, 255, 0) 38%),
        radial-gradient(circle at 70% 70%, rgba(0, 0, 20, 0.6) 0%, rgba(0, 0, 20, 0) 62%),
        url('/media/planet-tex.svg') repeat-x 0 0 / 96px 48px;
    border-radius: 50%;
    box-shadow: inset -5px -5px 12px rgba(0, 0, 30, 0.55), 0 0 14px rgba(0, 190, 255, 0.55);
    animation: planetSpin 28s linear infinite;
    z-index: 3;
}

.moon-decor {
    width: 16px;
    height: 16px;
    background:
        radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.4) 0%, rgba(255, 255, 255, 0) 45%),
        radial-gradient(circle at 72% 72%, rgba(0, 0, 20, 0.55) 0%, rgba(0, 0, 20, 0) 65%),
        url('/media/moon-tex.svg') repeat-x 0 0 / 32px 16px;
    border-radius: 50%;
    box-shadow: 0 0 7px rgba(255, 255, 255, 0.45);
    animation: moonSpin 40s linear infinite;
    z-index: 3;
}

@keyframes planetSpin { to { background-position: 0 0, 0 0, -96px 0; } }
@keyframes moonSpin { to { background-position: 0 0, 0 0, -32px 0; } }

/* Thanh lối tắt ghim nhanh */
.pinned-shortcuts-bar {
    position: fixed;
    bottom: 74px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 40;
    display: flex;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(8, 12, 22, 0.88);
    border: 1px solid rgba(0, 212, 255, 0.28);
    backdrop-filter: blur(12px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45), 0 0 24px rgba(0, 212, 255, 0.08);
    max-width: calc(100vw - 24px);
    overflow-x: auto;
    scrollbar-width: none;
}

.pinned-shortcuts-bar:empty {
    display: none;
}

.pinned-shortcuts-bar::-webkit-scrollbar {
    display: none;
}

.pinned-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 11px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: 0.2s;
}

.pinned-chip:hover {
    background: rgba(0, 212, 255, 0.18);
    border-color: var(--primary);
    transform: translateY(-1px);
}

.pinned-chip img {
    width: 18px;
    height: 18px;
    max-width: 18px;
    max-height: 18px;
    object-fit: contain;
    flex-shrink: 0;
}

/* ========================================= */
/* CHẾ ĐỘ PHONE & LƯỚI (GRID MODE)           */
/* ========================================= */
.phone-mode,
.grid-mode {
    background: linear-gradient(180deg, #0a0a12 0%, #000000 100%);
}

.phone-mode .main-content,
.grid-mode .main-content {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px 12px;
    padding: 20px 20px 64px;
    align-content: start;
    overflow-y: auto;
    overflow-x: hidden;
}

.grid-mode .main-content {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    max-width: 1120px;
    margin: 0 auto;
}

.phone-mode .sun-chiri,
.phone-mode .decor-item,
.phone-mode .astronaut,
.grid-mode .sun-chiri,
.grid-mode .decor-item,
.grid-mode .astronaut {
    display: none;
}

.phone-mode #itemsContainer,
.grid-mode #itemsContainer {
    display: contents;
}

.phone-mode .floating-item,
.grid-mode .floating-item {
    position: relative;
    left: auto;
    top: auto;
    transform: none;
    width: 100%;
    max-width: 100%;
    margin: 0;
    opacity: 1;
    z-index: auto;
    filter: none;
    padding: 8px 4px;
    border-radius: 18px;
}

.phone-mode .hex-icon,
.grid-mode .hex-icon {
    width: 84px;
    height: 84px;
    border-radius: 20px;
    background: linear-gradient(145deg, #242938, #141720);
    border: 1px solid rgba(255, 255, 255, 0.08);
    margin: 0 auto 8px;
}

.phone-mode .hex-icon img,
.grid-mode .hex-icon img {
    width: 44px;
    height: 44px;
    max-width: 44px;
    max-height: 44px;
    object-fit: contain;
}

.phone-mode .label,
.grid-mode .label {
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.25;
    color: #e8e8e8;
    background: transparent;
    border: none;
    padding: 0 4px;
    margin-top: 0;
    white-space: normal;
}

.phone-category-header {
    grid-column: 1 / -1;
    font-size: 11px;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding: 16px 6px 6px;
    border-bottom: 1px solid rgba(0, 212, 255, 0.18);
    margin-bottom: 4px;
    opacity: 0.9;
}

/* ========================================= */
/* PHI HÀNH GIA                              */
/* ========================================= */
.astronaut {
    position: absolute;
    width: 60px;
    height: 60px;
    z-index: 15;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.astronaut-svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 0 10px var(--glow));
}

.astronaut-body {
    transition: fill 0.3s;
}

.astronaut-label {
    position: absolute;
    top: 110%;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    background: rgba(0, 0, 0, 0.85);
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
    border: 1px solid;
    pointer-events: none;
}

/* ========================================= */
/* SETTINGS MODAL & SELECT                   */
/* ========================================= */
.settings-modal {
    position: fixed;
    top: 70px;
    right: 20px;
    background: rgba(8, 10, 18, 0.95);
    backdrop-filter: blur(20px) saturate(1.3);
    border: 1px solid rgba(0, 212, 255, 0.25);
    border-radius: 15px;
    padding: 22px;
    width: 350px;
    max-width: calc(100vw - 24px);
    z-index: 10000;
    display: none;
    flex-direction: column;
    gap: 14px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 40px rgba(0, 212, 255, 0.1);
    max-height: 82vh;
    overflow-y: auto;
}

.settings-modal.active {
    display: flex;
}

.settings-modal h3 {
    color: var(--primary);
    margin-bottom: 4px;
    font-size: 18px;
    text-align: center;
}

.setting-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.settings-modal label {
    font-size: 13px;
    color: var(--text-muted);
    display: block;
}

.settings-modal input[type="text"],
.setting-select {
    width: 100%;
    padding: 10px;
    background: #05070d;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: white;
    font-size: 13px;
}

.settings-modal input[type="text"]:focus,
.setting-select:focus {
    border-color: var(--primary);
    outline: none;
}

.avatar-upload-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar-preview {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #222;
    border: 2px solid var(--primary);
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
}

.avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.btn-upload {
    background: #222;
    color: white;
    border: 1px solid #444;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
}

.btn-upload:hover {
    background: var(--primary);
    color: black;
}

.color-options {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.color-option {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: 0.2s;
}

.color-option:hover,
.color-option.selected {
    border-color: white;
    transform: scale(1.1);
}

.slider-group-modal {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.slider-group-modal input[type=range] {
    width: 100%;
    -webkit-appearance: none;
    height: 6px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 5px;
    outline: none;
}

.slider-group-modal input[type=range]::-webkit-slider-thumb {
    height: 16px;
    width: 16px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    -webkit-appearance: none;
    box-shadow: 0 0 10px var(--primary);
}

.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.btn-save-settings {
    background: var(--primary);
    color: #000;
    border: none;
    padding: 11px;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    font-size: 14px;
    transition: 0.3s;
}

.btn-save-settings:hover {
    background: var(--success);
    box-shadow: 0 0 15px var(--success);
}

.btn-cancel-settings {
    background: transparent;
    color: #888;
    border: 1px solid #444;
    padding: 9px;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    font-size: 13px;
    transition: 0.3s;
}

.btn-cancel-settings:hover {
    background: #222;
    color: white;
}

/* ========================================= */
/* HIỆU ỨNG PHI THUYỀN, NỔ, MODAL, TOAST    */
/* ========================================= */
.ship {
    position: fixed;
    z-index: 9999;
    width: 56px;
    height: 56px;
    background: url('/media/icons/ship.svg') no-repeat center center;
    background-size: contain;
    pointer-events: none;
    display: none;
    transform-origin: center;
    filter: drop-shadow(0 0 20px #ffaa00);
}

.explosion {
    position: fixed;
    z-index: 9999;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: radial-gradient(circle, #fff, #ffaa00, #ff4444, transparent);
    pointer-events: none;
    display: none;
    transform: scale(0);
    animation: explodeAnim 0.6s forwards;
}

@keyframes explodeAnim {
    0% { transform: scale(0); opacity: 1; }
    100% { transform: scale(3); opacity: 0; }
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 10000;
    display: none;
    justify-content: center;
    align-items: center;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: rgba(12, 14, 22, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 20px;
    padding: 32px;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.7);
}

.toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(15, 15, 20, 0.95);
    border: 1px solid var(--primary);
    color: white;
    padding: 11px 22px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 500;
    z-index: 20000;
    opacity: 0;
    pointer-events: none;
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 8px 30px rgba(0, 212, 255, 0.2);
    max-width: 90%;
    text-align: center;
    backdrop-filter: blur(10px);
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.feature-tooltip {
    position: fixed;
    z-index: 5000;
    background: rgba(10, 12, 20, 0.95);
    border: 1px solid rgba(0, 212, 255, 0.35);
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 12px;
    color: #ddd;
    max-width: 240px;
    pointer-events: none;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.2s, transform 0.2s;
    backdrop-filter: blur(12px);
}

.feature-tooltip.show {
    opacity: 1;
    transform: translateY(0);
}

.feature-tooltip b {
    color: var(--primary);
    display: block;
    margin-bottom: 3px;
    font-size: 13px;
}

.mode-transition-overlay {
    position: fixed;
    inset: 0;
    z-index: 8000;
    background: #000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.mode-transition-overlay.active {
    opacity: 0.5;
    pointer-events: all;
}

/* ========================================= */
/* SPLASH, MARQUEE & FOOTER                 */
/* ========================================= */
.splash-screen {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.6s ease, visibility 0.6s;
}

.splash-screen.hide {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.splash-content {
    text-align: center;
}

.splash-logo {
    font-size: 64px;
    animation: none; /* logo tự xoay ngược chiều kim đồng hồ (trong icons/chiri-galaxy.svg), không phóng to/thu nhỏ */
}

.splash-title {
    font-size: 28px;
    font-weight: 800;
    color: var(--primary);
    margin: 12px 0 24px;
    letter-spacing: 1px;
    text-shadow: 0 0 30px var(--glow);
}

.splash-bar {
    width: 180px;
    height: 4px;
    background: #222;
    border-radius: 4px;
    margin: 0 auto 16px;
    overflow: hidden;
}

.splash-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary), #00ff88);
    border-radius: 4px;
    animation: splashLoad 1.8s ease-out forwards;
}

.splash-text {
    color: #666;
    font-size: 13px;
}

@keyframes splashPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

@keyframes splashLoad {
    0% { width: 0%; }
    100% { width: 100%; }
}

.bottom-marquee {
    width: 100%;
    overflow: hidden;
    white-space: nowrap;
    background: #000;
    border-top: 1px solid var(--border);
    padding: 7px 0;
    position: relative;
    z-index: 100;
    flex-shrink: 0;
    mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}

.bottom-marquee-content {
    display: inline-block;
    animation: marquee-bottom 25s linear infinite;
    color: #888;
    font-size: 13px;
    font-family: monospace;
}

@keyframes marquee-bottom {
    0% { transform: translateX(100vw); }
    100% { transform: translateX(-100%); }
}

.site-footer {
    flex-shrink: 0;
    background: #000;
    border-top: 1px solid var(--border);
    padding: 8px 16px;
    z-index: 100;
}

.footer-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 12px;
    color: #666;
}

.footer-links a {
    color: #888;
    text-decoration: none;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--primary);
}

.footer-copy {
    color: #555;
}

/* ========================================= */
/* BẢO VỆ GIAO DIỆN & PWA STANDALONE         */
/* ========================================= */
body, .main-content, .navbar, .floating-item, .hex-icon, .label,
.sun-chiri, .bottom-marquee, .site-footer, .splash-screen {
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

input, textarea, [contenteditable="true"] {
    -webkit-user-select: text;
    user-select: text;
}

img {
    -webkit-user-drag: none;
    user-drag: none;
}

.ui-watermark {
    position: fixed;
    bottom: 48px;
    right: 12px;
    z-index: 50;
    font-size: 11px;
    color: rgba(0, 212, 255, 0.22);
    font-weight: 600;
    letter-spacing: 1px;
    pointer-events: none;
}

@media all and (display-mode: standalone) {
    .install-btn { display: none !important; }
    body { overscroll-behavior: none; }
}

/* ========================================= */
/* RESPONSIVE (TABLET & MOBILE)              */
/* ========================================= */
@media (max-width: 1024px) {
    .control-btn .btn-label { display: none; }
}

@media (max-width: 768px) {
    .sun-chiri { width: 120px; height: 120px; }
    .sun-chiri img { width: 76px; height: 76px; max-width: 76px; max-height: 76px; }
    .sun-chiri .chiri-ai-svg { width: 92px; height: 92px; }
    .hex-icon { width: 76px; height: 76px; }
    .hex-icon img { width: 40px; height: 40px; max-width: 40px; max-height: 40px; }
    .floating-item .label { font-size: 11px; padding: 2px 6px; }
    .settings-modal { width: 92%; right: 4%; }
    .navbar {
        padding: 8px 10px;
        flex-wrap: wrap;
        height: auto;
        gap: 8px;
    }
    .navbar-left { display: contents; }
    .navbar .logo { order: 1; }
    .navbar-right { order: 2; gap: 6px; }
    body:not(.phone-mode) .top-menu-bar {
        display: flex;
        order: 3;
        width: 100%;
        height: auto;
        gap: 4px;
        padding: 2px 0;
    }
    .phone-mode .top-menu-bar { display: none; }
    .menu-group { height: auto; }
    .menu-group-title { padding: 7px 11px; font-size: 13px; }
    body:not(.phone-mode) .menu-group:hover .menu-dropdown { display: none; }
    body:not(.phone-mode) .menu-group.active .menu-dropdown {
        display: flex;
        left: 10px;
        right: 10px;
        max-width: none;
    }
    .phone-mode .site-footer,
    .phone-mode .bottom-marquee { display: none; }
    .phone-mode .main-content {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 14px 8px;
        padding: 16px 10px 30px;
    }
    .phone-mode .hex-icon { width: 74px; height: 74px; border-radius: 18px; }
    .phone-mode .hex-icon img { width: 38px; height: 38px; max-width: 38px; max-height: 38px; }
}

@media (max-width: 420px) {
    .phone-mode .main-content {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 12px 6px;
        padding: 12px 6px 24px;
    }
    .phone-mode .hex-icon { width: 66px; height: 66px; border-radius: 16px; }
    .phone-mode .hex-icon img { width: 34px; height: 34px; max-width: 34px; max-height: 34px; }
}

@media (prefers-reduced-motion: reduce) {
    .sun-chiri,
    .splash-logo,
    .floating-item,
    .bottom-marquee-content {
        animation: none !important;
    }
}

/* ===== Vòng quỹ đạo AI (tông vàng ấm) ===== */
.ai-orbit-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 158px;
    height: 158px;
    border-radius: 50%;
    border: 1.5px dashed rgba(255, 200, 80, 0.5);
    animation: aiSpin 18s linear infinite;
    pointer-events: none;
    z-index: 1;
}

@keyframes aiSpin {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* ===== Quỹ đạo guide (viền mờ) ===== */
.main-content::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    width: min(78vw, 820px);
    height: min(42vw, 440px);
    transform: translate(-50%, -50%);
    border: 1px solid rgba(255, 200, 80, 0.07);
    border-radius: 50%;
    pointer-events: none;
    z-index: 1;
    box-shadow:
        0 0 0 1px rgba(255, 200, 80, 0.04),
        inset 0 0 60px rgba(255, 160, 40, 0.03);
}

/* ===== Lõi CHIRI AI — robot tương lai (tông xanh neon) ===== */
.sun-chiri {
    box-shadow:
        0 0 70px rgba(0, 187, 249, 0.45),
        0 0 150px rgba(0, 245, 212, 0.22),
        0 0 240px rgba(155, 92, 255, 0.18) !important;
    background: radial-gradient(circle, rgba(0, 187, 249, 0.18) 0%, rgba(8, 14, 30, 0) 70%) !important;
    animation: aiCorePulse 4s ease-in-out infinite alternate !important;
}
.sun-chiri .chiri-ai-svg {
    width: 148px;
    height: 148px;
    filter: drop-shadow(0 0 16px rgba(0, 187, 249, 0.7)) drop-shadow(0 0 36px rgba(155, 92, 255, 0.35));
}
.sun-chiri .ai-hud-ring { transform-origin: 80px 80px; animation: aiHudSpin 14s linear infinite; }
.sun-chiri .ai-eyes { animation: aiBlink 5s infinite; transform-origin: 80px 75px; }
.sun-chiri .ai-antenna { animation: aiAntenna 1.6s ease-in-out infinite alternate; }
.ai-orbit-ring {
    width: 190px;
    height: 190px;
    border: 1.5px dashed rgba(0, 187, 249, 0.45);
    animation-duration: 24s;
    animation-direction: reverse;
}
.main-content::after { border-color: rgba(0, 187, 249, 0.09); }
@keyframes aiHudSpin { to { transform: rotate(360deg); } }
@keyframes aiBlink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(0.1); } }
@keyframes aiAntenna { from { opacity: 0.35; } to { opacity: 1; } }
@keyframes aiCorePulse {
    from { transform: translate(-50%, -50%) scale(1); }
    to { transform: translate(-50%, -50%) scale(1.04); }
}
@media (max-width: 1099px) {
    .sun-chiri .chiri-ai-svg { width: 92px; height: 92px; }
    .ai-orbit-ring { width: 120px; height: 120px; }
}
