/* =========================
   ROOT
========================= */

:root {
    --bg:#f5f6f8;
    --surface:#fff;
    --surface2:#eef0f4;
    --text:#17191f;
    --muted:#858a96;
    --border:#e7e9ee;
    --primary:#635bff;
    --primary-soft:rgba(99,91,255,.09);
    --shadow:0 12px 40px rgba(0,0,0,.045);
    --radius:18px;
    --transition:.3s ease;
}

[data-theme="dark"] {
    --bg:#0c0e13;
    --surface:#151820;
    --surface2:#1c202b;
    --text:#f2f3f7;
    --muted:#9298a7;
    --border:#282d38;
    --primary:#938bff;
    --primary-soft:rgba(139,131,255,.13);
    --shadow:0 12px 40px rgba(0,0,0,.22);
}


/* RESET */

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

html {
    scroll-behavior:smooth;
    scroll-padding-top:95px;
}

body {
    background:var(--bg);
    color:var(--text);
    font-family:system-ui,-apple-system,sans-serif;
    transition:background var(--transition),color var(--transition);
    overflow-x:hidden;
}

button,input,select {
    font:inherit;
}

button {
    cursor:pointer;
}

a {
    color:inherit;
    text-decoration:none;
}

.container {
    width:min(1120px,calc(100% - 40px));
    margin-inline:auto;
}


/* HEADER */

.header {
    height:76px;
    position:sticky;
    top:0;
    z-index:100;
    background:var(--bg);
    border-bottom:1px solid var(--border);
    transition:var(--transition);
}

.header-inner {
    width:min(1200px,calc(100% - 40px));
    height:100%;
    margin:auto;
    display:flex;
    align-items:center;
    justify-content:space-between;
}

.brand {
    display:flex;
    align-items:center;
    gap:10px;
    font-size:19px;
    font-weight:800;
    letter-spacing:-.7px;
}

.brand-icon {
    width:36px;
    height:36px;
    display:grid;
    place-items:center;
    background:var(--primary);
    color:white;
    border-radius:11px;
    font-size:20px;
    font-weight:900;
}

.brand-light {
    color:var(--muted);
    font-weight:500;
}

.desktop-nav {
    display:flex;
    align-items:center;
    gap:32px;
}

.desktop-nav a {
    font-size:13px;
    color:var(--muted);
    transition:var(--transition);
}

.desktop-nav a:hover {
    color:var(--primary);
}

.header-actions {
    display:flex;
    align-items:center;
    gap:10px;
}

.icon-btn,
.language-btn {
    height:39px;
    background:var(--surface);
    border:1px solid var(--border);
    border-radius:11px;
    color:var(--text);
    display:flex;
    align-items:center;
    justify-content:center;
    transition:var(--transition);
}

.icon-btn {
    width:39px;
}

.icon-btn svg {
    width:19px;
    height:19px;
    fill:none;
    stroke:currentColor;
    stroke-width:1.7;
    stroke-linecap:round;
}

.icon-btn:hover,
.language-btn:hover {
    border-color:var(--primary);
    transform:translateY(-2px);
}

.language-box {
    position:relative;
}

.language-btn {
    padding:0 12px;
    gap:8px;
    font-size:12px;
}

.language-menu {
    position:absolute;
    top:48px;
    inset-inline-end:0;
    width:130px;
    padding:6px;
    background:var(--surface);
    border:1px solid var(--border);
    border-radius:13px;
    box-shadow:var(--shadow);
    opacity:0;
    visibility:hidden;
    transform:translateY(-8px);
    transition:var(--transition);
}

.language-menu.show {
    opacity:1;
    visibility:visible;
    transform:translateY(0);
}

.language-menu button {
    width:100%;
    border:0;
    background:transparent;
    color:var(--text);
    text-align:start;
    padding:10px;
    border-radius:8px;
    font-size:12px;
}

.language-menu button:hover {
    background:var(--surface2);
}


/* MOBILE MENU */

.menu-btn {
    display:none;
    width:39px;
    height:39px;
    border:1px solid var(--border);
    background:var(--surface);
    border-radius:11px;
    flex-direction:column;
    justify-content:center;
    align-items:center;
    gap:5px;
}

.menu-btn span {
    width:16px;
    height:1.5px;
    background:var(--text);
    transition:var(--transition);
}

.menu-btn.active span:first-child {
    transform:translateY(3.25px) rotate(45deg);
}

.menu-btn.active span:nth-child(2) {
    opacity:0;
}

.menu-btn.active span:last-child {
    transform:translateY(-3.25px) rotate(-45deg);
}

.mobile-menu {
    display:none;
    position:fixed;
    top:76px;
    inset-inline:0;
    z-index:102;
    padding:15px 25px 22px;
    background:var(--surface);
    border-bottom:1px solid var(--border);
    transform:translateY(-10px);
    opacity:0;
    visibility:hidden;
    transition:var(--transition);
}

.mobile-menu.show {
    transform:translateY(0);
    opacity:1;
    visibility:visible;
}

.mobile-menu a {
    display:block;
    padding:13px 5px;
    border-bottom:1px solid var(--border);
    font-size:14px;
}


/* HERO */

.hero {
    min-height:490px;
    display:grid;
    grid-template-columns:1.1fr .9fr;
    align-items:center;
    gap:40px;
    padding-top:65px;
    padding-bottom:55px;
}

.hero-content {
    animation:fadeUp .8s ease both;
}

.hero-badge {
    display:inline-flex;
    align-items:center;
    gap:9px;
    padding:9px 13px;
    background:var(--primary-soft);
    color:var(--primary);
    border-radius:30px;
    font-size:11px;
    margin-bottom:25px;
}

.status-dot,
.visual-dot {
    width:7px;
    height:7px;
    background:#35bd87;
    border-radius:50%;
}

.hero h1 {
    font-size:clamp(32px,4.5vw,55px);
    line-height:1.4;
    letter-spacing:-1.5px;
    max-width:560px;
    font-weight:850;
}

.gradient-text {
    display:block;
    color:var(--primary);
}

.hero-content>p {
    margin-top:19px;
    max-width:440px;
    line-height:2;
    font-size:14px;
    color:var(--muted);
}

.hero-search {
    height:57px;
    max-width:440px;
    margin-top:30px;
    padding:0 17px;
    display:flex;
    align-items:center;
    gap:12px;
    background:var(--surface);
    border:1px solid var(--border);
    border-radius:14px;
    box-shadow:var(--shadow);
    transition:var(--transition);
}

.hero-search:focus-within {
    border-color:var(--primary);
    box-shadow:0 0 0 4px var(--primary-soft);
}

.hero-search svg {
    width:19px;
    height:19px;
    fill:none;
    stroke:var(--muted);
    stroke-width:1.8;
}

.hero-search input {
    width:100%;
    border:0;
    outline:0;
    background:transparent;
    color:var(--text);
    font-size:13px;
}

.clear-search {
    display:none;
    border:0;
    background:transparent;
    color:var(--muted);
    font-size:22px;
}

.clear-search.show {
    display:block;
}

.hero-meta {
    margin-top:18px;
    font-size:11px;
    color:var(--muted);
    display:flex;
    align-items:center;
    gap:15px;
    flex-wrap:wrap;
}

.api-status {
    display:inline-flex;
    align-items:center;
    gap:6px;
}

.api-status i {
    width:7px;
    height:7px;
    border-radius:50%;
    background:#d6a33b;
}

.api-status.online i {
    background:#35bd87;
}

.api-status.offline i {
    background:#e05b67;
}


/* HERO VISUAL */

.hero-visual {
    height:350px;
    position:relative;
    display:grid;
    place-items:center;
}

.visual-card {
    width:235px;
    height:280px;
    position:relative;
    z-index:2;
    background:linear-gradient(145deg,#827bff,#4c43d6);
    border-radius:28px;
    box-shadow:0 35px 75px rgba(99,91,255,.25);
    padding:25px;
    display:flex;
    flex-direction:column;
    justify-content:center;
    align-items:center;
    transform:rotate(-7deg);
    animation:floating 5s ease-in-out infinite;
}

.visual-logo {
    width:95px;
    height:95px;
    display:grid;
    place-items:center;
    border-radius:27px;
    background:rgba(255,255,255,.17);
    color:white;
    font-size:60px;
    font-weight:900;
}

.visual-lines {
    margin-top:28px;
    width:120px;
    display:flex;
    flex-direction:column;
    gap:9px;
}

.visual-lines span {
    height:5px;
    border-radius:10px;
    background:rgba(255,255,255,.35);
}

.visual-lines span:nth-child(2) {
    width:75%;
}

.visual-lines span:nth-child(3) {
    width:50%;
}

.visual-bottom {
    position:absolute;
    bottom:20px;
    inset-inline:20px;
    display:flex;
    align-items:center;
    justify-content:space-between;
    color:white;
    font-size:9px;
    letter-spacing:2px;
}

.floating-card {
    position:absolute;
    z-index:3;
    display:flex;
    align-items:center;
    gap:10px;
    padding:13px 17px;
    background:var(--surface);
    border:1px solid var(--border);
    border-radius:14px;
    box-shadow:var(--shadow);
    animation:floating 4s ease-in-out infinite;
}

.floating-card>span {
    width:34px;
    height:34px;
    display:grid;
    place-items:center;
    border-radius:10px;
    color:var(--primary);
    background:var(--primary-soft);
}

.floating-card strong,
.floating-card small {
    display:block;
}

.floating-card strong {
    font-size:11px;
}

.floating-card small {
    font-size:9px;
    color:var(--muted);
    margin-top:4px;
}

.floating-one {
    top:38px;
    inset-inline-start:-10px;
}

.floating-two {
    bottom:45px;
    inset-inline-end:-10px;
    animation-delay:-2s;
}

.visual-orbit {
    width:320px;
    height:320px;
    position:absolute;
    border:1px dashed var(--border);
    border-radius:50%;
}


/* STATS */

.stats {
    display:grid;
    grid-template-columns:repeat(3,1fr);
    background:var(--surface);
    border:1px solid var(--border);
    border-radius:var(--radius);
    padding:24px;
}

.stat-item {
    display:flex;
    align-items:center;
    justify-content:center;
    flex-direction:column;
    gap:8px;
    border-inline-end:1px solid var(--border);
}

.stat-item:last-child {
    border:0;
}

.stat-item strong {
    font-size:25px;
    color:var(--primary);
}

.stat-item span {
    color:var(--muted);
    font-size:11px;
}


/* SECTIONS */

.section {
    padding-top:85px;
}

.section-heading {
    display:flex;
    justify-content:space-between;
    align-items:end;
    margin-bottom:27px;
}

.eyebrow {
    color:var(--primary);
    font-size:10px;
    letter-spacing:2px;
    font-weight:800;
}

.section-heading h2 {
    font-size:25px;
    margin-top:8px;
}

.result-count {
    font-size:11px;
    color:var(--muted);
}


/* CATEGORIES */

.category-grid {
    display:grid;
    grid-template-columns:repeat(5,1fr);
    gap:14px;
}

.category-card {
    min-height:115px;
    display:flex;
    flex-direction:column;
    justify-content:center;
    align-items:center;
    gap:12px;
    border:1px solid var(--border);
    background:var(--surface);
    color:var(--text);
    border-radius:var(--radius);
    transition:var(--transition);
    font-size:12px;
}

.category-icon {
    width:40px;
    height:40px;
    display:grid;
    place-items:center;
    border-radius:13px;
    background:var(--surface2);
    color:var(--primary);
    font-size:19px;
}

.category-card:hover {
    transform:translateY(-5px);
    border-color:var(--primary);
}

.category-card.active {
    background:var(--primary-soft);
    border-color:var(--primary);
    color:var(--primary);
}

.category-card.active .category-icon {
    background:var(--primary);
    color:white;
}


/* TOOLBAR */

.toolbar {
    display:flex;
    align-items:center;
    justify-content:space-between;
    margin:-8px 0 18px;
}

.toolbar select {
    background:var(--surface);
    color:var(--text);
    border:1px solid var(--border);
    border-radius:9px;
    padding:9px 12px;
    font-size:11px;
    outline:0;
}

.refresh-btn,
.retry-btn {
    border:1px solid var(--border);
    background:var(--surface);
    color:var(--text);
    border-radius:9px;
    padding:9px 13px;
    font-size:11px;
}

.refresh-btn:hover,
.retry-btn:hover {
    border-color:var(--primary);
    color:var(--primary);
}


/* APP GRID */

.app-grid {
    display:grid;
    grid-template-columns:repeat(3,1fr);
    gap:18px;
}

.app-card {
    padding:19px;
    background:var(--surface);
    border:1px solid var(--border);
    border-radius:var(--radius);
    transition:var(--transition);
    animation:fadeUp .5s ease both;
    min-width:0;
}

.app-card:hover {
    transform:translateY(-5px);
    border-color:var(--primary);
    box-shadow:var(--shadow);
}

.app-top {
    display:flex;
    align-items:center;
    gap:13px;
}

.app-icon {
    width:57px;
    height:57px;
    flex-shrink:0;
    display:grid;
    place-items:center;
    overflow:hidden;
    border-radius:17px;
    color:white;
    font-size:23px;
    font-weight:800;
    background:linear-gradient(145deg,#827bff,#4c43d6);
}

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

.app-info {
    min-width:0;
}

.app-info h3 {
    font-size:14px;
    overflow-wrap:anywhere;
}

.app-info span {
    display:block;
    margin-top:6px;
    color:var(--muted);
    font-size:10px;
}

.featured-tag {
    display:inline-block!important;
    color:var(--primary)!important;
    background:var(--primary-soft);
    padding:3px 7px;
    border-radius:20px;
    width:max-content;
}

.app-description {
    margin-top:18px;
    color:var(--muted);
    font-size:11px;
    line-height:1.9;
    min-height:42px;
}

.app-footer {
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:8px;
    margin-top:18px;
    padding-top:15px;
    border-top:1px solid var(--border);
}

.app-meta {
    font-size:10px;
    color:var(--muted);
}

.app-actions {
    display:flex;
    gap:7px;
}

.details-btn,
.download-btn {
    border:0;
    padding:9px 11px;
    border-radius:9px;
    font-size:10px;
    font-weight:700;
    transition:var(--transition);
    white-space:nowrap;
}

.details-btn {
    background:var(--surface2);
    color:var(--text);
}

.download-btn {
    background:var(--primary-soft);
    color:var(--primary);
}

.download-btn:hover {
    background:var(--primary);
    color:white;
}


/* LOADING / EMPTY / ERROR */

.loading-state,
.empty-state,
.error-state {
    padding:55px 20px;
    text-align:center;
    color:var(--muted);
}

.loading-state p,
.error-state p {
    font-size:12px;
    margin-top:12px;
}

.loader {
    display:inline-block;
    width:28px;
    height:28px;
    border:3px solid var(--border);
    border-top-color:var(--primary);
    border-radius:50%;
    animation:spin .8s linear infinite;
}

.empty-state {
    display:none;
}

.empty-state.show {
    display:block;
}

.empty-state>span {
    font-size:40px;
    color:var(--primary);
}

.empty-state h3 {
    margin-top:15px;
    color:var(--text);
}

.empty-state p {
    margin-top:8px;
    font-size:12px;
}

.error-state {
    border:1px solid var(--border);
    border-radius:14px;
}

.error-state[hidden] {
    display:none;
}


/* ABOUT */

.about-section {
    margin-top:100px;
    min-height:240px;
    padding:45px;
    position:relative;
    overflow:hidden;
    background:var(--surface);
    border:1px solid var(--border);
    border-radius:25px;
    display:flex;
    align-items:center;
    justify-content:space-between;
}

.about-content {
    max-width:500px;
    position:relative;
    z-index:1;
}

.about-content h2 {
    font-size:27px;
    margin-top:14px;
}

.about-content p {
    margin-top:15px;
    font-size:12px;
    line-height:2;
    color:var(--muted);
}

.about-mark {
    font-size:180px;
    font-weight:900;
    color:var(--primary-soft);
    line-height:1;
}


/* FOOTER */

.footer {
    margin-top:100px;
    border-top:1px solid var(--border);
}

.footer-inner {
    padding-top:40px;
}

.footer-brand p {
    margin-top:15px;
    font-size:11px;
    color:var(--muted);
}

.footer-bottom {
    margin-top:45px;
    padding:20px 0;
    border-top:1px solid var(--border);
    display:flex;
    justify-content:space-between;
    color:var(--muted);
    font-size:10px;
}


/* MODAL */

.modal-backdrop {
    position:fixed;
    inset:0;
    z-index:200;
    background:rgba(5,7,12,.62);
    backdrop-filter:blur(5px);
    display:none;
    align-items:center;
    justify-content:center;
    padding:18px;
}

.modal-backdrop.show {
    display:flex;
}

.app-modal {
    position:relative;
    width:min(560px,100%);
    max-height:85vh;
    overflow:auto;
    background:var(--surface);
    border:1px solid var(--border);
    border-radius:22px;
    padding:28px;
    box-shadow:var(--shadow);
    animation:fadeUp .25s ease;
}

.modal-close {
    position:absolute;
    top:13px;
    inset-inline-end:15px;
    border:0;
    background:var(--surface2);
    color:var(--text);
    width:32px;
    height:32px;
    border-radius:10px;
    font-size:22px;
}

.modal-heading {
    display:flex;
    align-items:center;
    gap:14px;
    padding-inline-end:30px;
}

.modal-heading .app-icon {
    width:66px;
    height:66px;
}

.modal-heading h2 {
    font-size:19px;
}

.modal-heading p {
    font-size:11px;
    color:var(--muted);
    margin-top:6px;
}

.modal-description {
    font-size:13px;
    line-height:2;
    color:var(--muted);
    margin:22px 0;
}

.modal-meta {
    display:grid;
    grid-template-columns:repeat(2,1fr);
    gap:10px;
}

.modal-meta div {
    padding:12px;
    background:var(--surface2);
    border-radius:11px;
    font-size:11px;
}

.modal-meta span {
    display:block;
    color:var(--muted);
    margin-bottom:5px;
}

.version-list {
    margin-top:20px;
}

.version-list h3 {
    font-size:14px;
    margin-bottom:10px;
}

.version-item {
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:10px;
    padding:12px 0;
    border-top:1px solid var(--border);
    font-size:11px;
}

.version-item small {
    display:block;
    color:var(--muted);
    margin-top:4px;
}


/* TOAST */

.toast {
    position:fixed;
    z-index:300;
    bottom:22px;
    left:50%;
    transform:translate(-50%,20px);
    padding:11px 16px;
    border-radius:11px;
    background:var(--text);
    color:var(--bg);
    font-size:12px;
    opacity:0;
    visibility:hidden;
    transition:var(--transition);
    max-width:calc(100% - 30px);
    text-align:center;
}

.toast.show {
    opacity:1;
    visibility:visible;
    transform:translate(-50%,0);
}


/* ANIMATIONS */

@keyframes fadeUp {
    from {
        opacity:0;
        transform:translateY(20px);
    }

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

@keyframes floating {
    0%,100% { translate:0 0; }
    50% { translate:0 -12px; }
}

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


/* RESPONSIVE */

@media(max-width:850px) {

    .hero {
        grid-template-columns:1.1fr .9fr;
        gap:15px;
    }

    .hero h1 {
        font-size:38px;
    }

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

}

@media(max-width:650px) {

    .container {
        width:calc(100% - 32px);
    }

    .header {
        height:67px;
    }

    .desktop-nav {
        display:none;
    }

    .menu-btn {
        display:flex;
    }

    .mobile-menu {
        display:block;
        top:67px;
    }

    .brand {
        font-size:16px;
    }

    .hero {
        display:flex;
        flex-direction:column;
        align-items:stretch;
        padding-top:50px;
    }

    .hero h1 {
        font-size:36px;
    }

    .hero-visual {
        height:300px;
        margin-top:15px;
    }

    .visual-card {
        width:190px;
        height:235px;
    }

    .visual-logo {
        width:75px;
        height:75px;
        font-size:45px;
    }

    .visual-orbit {
        width:270px;
        height:270px;
    }

    .floating-one {
        inset-inline-start:0;
    }

    .floating-two {
        inset-inline-end:0;
    }

    .stats {
        padding:20px 8px;
    }

    .stat-item strong {
        font-size:21px;
    }

    .stat-item span {
        font-size:9px;
    }

    .section {
        padding-top:65px;
    }

    .category-grid {
        grid-template-columns:repeat(3,1fr);
        gap:9px;
    }

    .category-card {
        min-height:100px;
        font-size:10px;
    }

    .app-grid {
        grid-template-columns:1fr;
    }

    .app-footer {
        align-items:flex-start;
        flex-direction:column;
    }

    .app-actions {
        width:100%;
    }

    .app-actions button {
        flex:1;
    }

    .about-section {
        margin-top:75px;
        padding:30px 23px;
        min-height:220px;
    }

    .about-content h2 {
        font-size:22px;
    }

    .about-mark {
        position:absolute;
        inset-inline-end:5px;
        opacity:.5;
    }

    .footer {
        margin-top:70px;
    }

    .footer-bottom {
        gap:12px;
        flex-wrap:wrap;
    }

}

@media(prefers-reduced-motion:reduce) {

    *,
    *::before,
    *::after {
        animation-duration:.01ms!important;
        animation-iteration-count:1!important;
        scroll-behavior:auto!important;
        transition-duration:.01ms!important;
    }

}
