:root {
    --gold-light: #F5D76E;
    --gold-main: #C5A023;
    /* Deeper, more royal gold */
    --gold-dark: #8E6B15;
    --bg: #FDFDFD;
    /* Slightly off-white for luxury feel */
    --text-black: #0F0F0F;
    --text-gray: #636366;
    --card-bg: #FFFFFF;
    --glass-bg: rgba(255, 255, 255, 0.85);
    --gold-gradient: linear-gradient(135deg, #D4AF37 0%, #F5D76E 50%, #B8860B 100%);
    --spring: cubic-bezier(0.23, 1, 0.32, 1);
    /* Faster, more modern easing */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Manrope', sans-serif;
    background: var(--bg);
    color: var(--text-black);
    overflow: hidden;
    height: 100vh;
    letter-spacing: -0.2px;
    perspective: 2000px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.05) 0%, transparent 70%);
    z-index: -1;
    animation: rotateBg 25s linear infinite;
}

@keyframes rotateBg {
    to {
        transform: rotate(360deg);
    }
}

header {
    padding: 40px 24px 15px;
    background: transparent;
    transform-style: preserve-3d;
    backface-visibility: hidden;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

@media (max-width: 480px) {
    header {
        padding: 30px 20px 10px;
    }
}

.header-title {
    font-family: 'Outfit';
    font-weight: 900;
    font-size: 42px;
    letter-spacing: -2px;
    background: linear-gradient(135deg, #C5A023 0%, #F5D76E 50%, #8E6B15 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    transform: translateZ(50px);
    -webkit-font-smoothing: antialiased;
    white-space: nowrap;
    overflow: hidden;
    width: 0;
    animation: typing 2s steps(20) forwards;
}

@keyframes typing {
    from {
        width: 0
    }

    to {
        width: 100%
    }
}

.search-container {
    padding: 10px 28px 10px;
    position: sticky;
    top: 0;
    background: transparent;
    z-index: 50;
    perspective: 1000px;
}

.search-box {
    background: var(--glass-bg);
    border-radius: 24px;
    padding: 18px 24px;
    display: flex;
    align-items: center;
    gap: 15px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(15px);
    /* Reduced blur for performance */
    -webkit-backdrop-filter: blur(15px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.08);
    transition: all 0.5s var(--spring);
    transform: rotateX(5deg);
    backface-visibility: hidden;
}

.search-box:focus-within {
    transform: rotateX(0deg) scale(1.02);
    border-color: #1A1A1A;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.12);
}

.search-input {
    border: none;
    background: transparent;
    outline: none;
    flex: 1;
    font-size: 17px;
    font-weight: 700;
    color: var(--text-black);
    -webkit-font-smoothing: antialiased;
}


#tab-content-wrapper {
    height: calc(100vh - 260px);
    overflow-y: auto;
    padding-top: 20px;
    padding-bottom: 120px;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: auto;
    /* Changed from smooth for faster response */
}

#tab-content-wrapper::-webkit-scrollbar {
    display: none;
}

.section-group {
    margin-bottom: 40px;
}

.section-header {
    font-family: 'Outfit';
    font-weight: 800;
    font-size: 22px;
    padding: 0 28px 15px;
    color: var(--text-black);
    letter-spacing: -0.8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-see-all {
    font-size: 13px;
    font-weight: 800;
    color: var(--gold-main);
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    padding: 6px 14px;
    border-radius: 12px;
    background: rgba(212, 175, 55, 0.05);
    transition: all 0.3s var(--spring);
    border: 1px solid transparent;
}

.btn-see-all:hover {
    background: rgba(212, 175, 55, 0.1);
    border-color: rgba(212, 175, 55, 0.2);
    transform: translateX(3px);
}

.back-container {
    padding: 0 28px 15px;
    display: none;
    align-items: center;
}

.btn-back {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 800;
    color: var(--gold-main);
    cursor: pointer;
    background: rgba(0, 0, 0, 0.03);
    padding: 8px 16px;
    border-radius: 12px;
    transition: all 0.3s var(--spring);
}

.btn-back:hover {
    background: rgba(0, 0, 0, 0.06);
    transform: translateX(-5px);
}

.sub-filter-wrapper {
    padding: 0 28px 20px;
    display: flex;
    gap: 10px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.sub-filter-wrapper::-webkit-scrollbar {
    display: none;
}

.sub-filter-item {
    padding: 8px 18px;
    border-radius: 12px;
    background: #f5f5f5;
    color: var(--text-gray);
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.3s var(--spring);
    border: 1px solid transparent;
}

.sub-filter-item.active {
    background: #1A1A1A;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.sub-filter-item:hover:not(.active) {
    background: #eee;
    transform: translateY(-1px);
}

@media (max-width: 480px) {
    .section-header {
        font-size: 19px;
        padding: 0 16px 12px;
    }

    .btn-see-all {
        font-size: 11px;
        padding: 4px 10px;
    }
}

.grid-layout {
    padding: 0 28px;
    display: grid;
    gap: 20px;
    transform-style: preserve-3d;
}

@media (max-width: 480px) {
    .grid-layout {
        padding: 0 16px;
        gap: 12px;
    }

    .grid-mode {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

.app-item {
    position: relative;
    display: flex;
    align-items: center;
    padding: 20px;
    border-radius: 28px;
    background: #fff;
    transition: all 0.4s var(--spring);
    /* Faster transition */
    cursor: pointer;
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
    transform-style: preserve-3d;
    transform: perspective(1200px) rotateY(0deg);
    backface-visibility: hidden;
    will-change: transform, opacity;
    isolation: isolate;
    /* Create clean stacking context */
}

@media (max-width: 480px) {
    .app-item {
        padding: 15px;
        border-radius: 24px;
    }

    /* GRID MODE FOR GAMES & DISCOVERY */
    .grid-mode .app-item {
        flex-direction: column;
        text-align: center;
        padding: 20px 15px;
        gap: 12px;
    }
}

.app-item::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 32px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0));
    z-index: 0;
    pointer-events: none;
    opacity: 0.8;
}

.app-item:hover {
    transform: perspective(1200px) rotateY(-5deg) translateY(-8px);
    /* Refined, less aggressive */
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.1);
    border-color: rgba(212, 175, 55, 0.3);
    /* Golden border on hover */
    z-index: 10;
}

.app-item:active {
    transform: scale(0.98) translateZ(-10px);
}

.app-icon {
    width: 76px;
    height: 76px;
    border-radius: 20px;
    margin-right: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    flex-shrink: 0;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.12);
    border: 0.5px solid rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transform: translateZ(50px);
    transition: all 0.4s var(--spring);
    image-rendering: -webkit-optimize-contrast;
    backface-visibility: hidden;
}

@media (max-width: 480px) {
    .app-icon {
        width: 62px;
        height: 62px;
        border-radius: 16px;
        margin-right: 14px;
    }

    .grid-mode .app-icon {
        margin-right: 0;
        width: 85px;
        height: 85px;
        border-radius: 22px;
    }
}

.app-item:hover .app-icon {
    transform: translateZ(80px) rotate(8deg);
}

.app-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.info-col {
    flex: 1;
    overflow: hidden;
    transform: translateZ(30px);
    backface-visibility: hidden;
}

.item-name {
    font-family: 'Outfit';
    font-weight: 900;
    font-size: 20px;
    color: var(--text-black);
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

@media (max-width: 480px) {
    .item-name {
        font-size: 17px;
    }
}

.item-meta {
    font-size: 13px;
    color: var(--text-black);
    font-weight: 700;
    opacity: 0.6;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    letter-spacing: 0.2px;
    line-height: 1.3;
}

@media (max-width: 480px) {
    .item-meta {
        font-size: 11px;
        -webkit-line-clamp: 2;
        line-clamp: 2;
    }
}

.btn-action {
    background: #000;
    color: white;
    font-weight: 800;
    font-size: 11px;
    padding: 12px 22px;
    border-radius: 100px;
    /* Pill shape */
    border: none;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    transform: translateZ(40px);
    transition: all 0.3s var(--spring);
    backface-visibility: hidden;
    position: relative;
    overflow: hidden;
}

.btn-action::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transform: rotate(45deg);
    transition: 0.5s;
}

.btn-action:hover::after {
    left: 100%;
}

.app-item:hover .btn-action {
    transform: translateZ(70px) scale(1.1);
}

.btn-action:active {
    transform: scale(0.9);
    box-shadow: none;
}

@media (max-width: 480px) {
    .grid-mode .btn-action {
        width: 100%;
        padding: 10px;
        margin-top: 5px;
        font-size: 10px;
    }
}

.nav-bar {
    position: fixed;
    bottom: 25px;
    left: 24px;
    right: 24px;
    height: 85px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    /* Reduced from 40px */
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    justify-content: space-around;
    align-items: center;
    border-radius: 30px;
    border: 1.5px solid rgba(212, 175, 55, 0.25);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.12);
    z-index: 100;
    backface-visibility: hidden;
    will-change: transform;
    /* Hint for compositor */
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    transition: all 0.4s;
    color: var(--text-gray);
}

.nav-item.active {
    color: #1A1A1A;
    transform: translateY(-8px) translateZ(30px);
}

.nav-icon {
    font-size: 28px;
    filter: drop-shadow(0 5px 5px rgba(0, 0, 0, 0.1));
    margin-bottom: 0;
}

.nav-text {
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* 3D DENSE STARFIELD - PURE WHITE */
#loader {
    position: fixed;
    inset: 0;
    background: #000;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    perspective: 1000px;
    transition: all 1.2s cubic-bezier(0.9, 0, 0.1, 1);
}

/* HIGH PERFORMANCE CANVAS GALAXY */
#galaxy-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

/* LOADER TEXT - PURE WHITE SILVER */
.loader-text {
    position: relative;
    font-family: 'Outfit';
    font-weight: 900;
    font-size: 28px;
    color: #FFFFFF;
    letter-spacing: 15px;
    text-transform: uppercase;
    z-index: 10;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
    animation: textGlow 2s ease-in-out infinite;
    pointer-events: none;
}

@keyframes textGlow {

    0%,
    100% {
        opacity: 0.4;
        filter: blur(1px);
    }

    50% {
        opacity: 1;
        filter: blur(0);
    }
}

.warp-effect {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, transparent 0%, #000 90%);
    z-index: 5;
    pointer-events: none;
}

.search-hint {
    font-size: 12px;
    color: #1A1A1A;
    font-weight: 700;
    background: rgba(0, 0, 0, 0.05);
    padding: 4px 10px;
    border-radius: 8px;
    margin-top: 10px;
    display: none;
    text-align: center;
}

.btn-request {
    font-family: 'Outfit';
    font-weight: 700;
    font-size: 11px;
    border: 1.5px solid rgba(212, 175, 55, 0.3);
    background: transparent;
    color: var(--gold-main);
    padding: 8px 16px;
    border-radius: 100px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.3s var(--spring);
    white-space: nowrap;
    display: none; /* Hidden by default, shown via JS */
}

.btn-request:hover {
    background: var(--gold-gradient);
    color: #000;
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(212, 175, 55, 0.2);
}

/* SKELETON LOADING EFFECTS */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #f8f8f8 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeletonLoading 1.5s infinite;
    border-radius: 12px;
}

@keyframes skeletonLoading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.skeleton-card {
    height: 120px;
    border-radius: 28px;
    background: #fff;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    border: 1px solid rgba(0, 0, 0, 0.03);
}

.skeleton-icon {
    width: 62px;
    height: 62px;
    border-radius: 16px;
    background: #f0f0f0;
}

.skeleton-text-group {
    flex: 1;
}

.skeleton-title {
    height: 18px;
    width: 60%;
    margin-bottom: 10px;
}

.skeleton-meta {
    height: 12px;
    width: 80%;
}

/* TAP FEEDBACK FOR CORPORATE FEEL */
@media (hover: none) {
    .app-item:active {
        background: #fcfcfc;
        transform: scale(0.97) !important;
        transition: transform 0.1s ease-out;
    }
}

.nav-item:active {
    opacity: 0.7;
    transform: scale(0.9);
}

/* ROYAL MODAL STYLES */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.4s var(--spring);
}

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

.modal-content {
    background: var(--card-bg);
    width: 90%;
    max-width: 420px;
    padding: 32px;
    border-radius: 32px;
    border: 1px solid rgba(212, 175, 55, 0.2);
    box-shadow: 0 40px 100px rgba(0,0,0,0.15);
    transform: translateY(40px) scale(0.95);
    transition: all 0.5s var(--spring);
    position: relative;
}

.modal-overlay.active .modal-content {
    transform: translateY(0) scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.modal-header h3 {
    font-family: 'Outfit';
    font-weight: 800;
    font-size: 24px;
    color: var(--text-black);
    letter-spacing: -0.5px;
}

.close-modal {
    font-size: 20px;
    color: var(--text-gray);
    cursor: pointer;
    padding: 8px;
    transition: color 0.3s;
}

.close-modal:hover {
    color: var(--gold-main);
}

.modal-subtitle {
    font-size: 14px;
    color: var(--text-gray);
    line-height: 1.5;
    margin-bottom: 24px;
}

.modal-input {
    width: 100%;
    background: #F2F2F7;
    border: 2px solid transparent;
    padding: 16px 20px;
    border-radius: 16px;
    font-family: inherit;
    font-size: 16px;
    color: var(--text-black);
    outline: none;
    transition: all 0.3s;
}

.modal-input:focus {
    background: #FFF;
    border-color: var(--gold-light);
    box-shadow: 0 10px 25px rgba(212, 175, 55, 0.1);
}

.modal-footer {
    margin-top: 32px;
}

.btn-submit-request {
    width: 100%;
    background: var(--gold-gradient);
    color: #000;
    border: none;
    padding: 16px;
    border-radius: 18px;
    font-family: 'Outfit';
    font-weight: 800;
    font-size: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s var(--spring);
}

.btn-submit-request:hover {
    transform: translateY(-4px);
    box-shadow: 0 15px 30px rgba(212, 175, 55, 0.3);
}

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

@media (max-width: 480px) {
    .modal-content {
        padding: 24px;
        border-radius: 28px;
    }
}