:root {
    --bg: #000000;

    --surface: #373737;
    --surface-hover: #6e6e6e;
    --border: #6e6e6e;

    --text: #aaaaaa;
    --text-secondary: #a0a0a0;
    --text-muted: #6e6e6e;

    --accent: #3bff00;
    --accent-hover: #3bff00;

    --success: #3bff00;
    --warning: #a0a0a0;

    --radius: 12px;
    --container-width: 1200px;
}


* {
    box-sizing: border-box;
}


html {
    scroll-behavior: smooth;
}


body {
    margin: 0;

    background: var(--bg);
    color: var(--text);

    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Helvetica,
        Arial,
        sans-serif;

    line-height: 1.5;
}

body {
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: "";

    position: fixed;
    inset: 0;

    z-index: -2;

    background-image:
        url("../assets/background/PSVitaAlive_Store_logo_psvita.png");

    background-repeat: no-repeat;
    background-position: center;
    background-size: min(900px, 80vw);

    opacity: 0.5;

    filter: blur(2px);

    pointer-events: none;
}

body::after {
    content: "";

    position: fixed;
    inset: 0;

    z-index: -1;

    background: rgba(0, 0, 0, 0.35);

    pointer-events: none;
}


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


button,
input {
    font: inherit;
}


.container {
    width: min(
        calc(100% - 40px),
        var(--container-width)
    );

    margin-inline: auto;
}


/* Header */

.site-header {
    position: sticky;
    top: 0;
    z-index: 100;

    background: rgba(0, 0, 0, 0.92);

    border-bottom: 1px solid var(--border);

    backdrop-filter: blur(12px);
}


.header-inner {
    min-height: 72px;

    display: flex;
    align-items: center;
    gap: 32px;
}


.site-logo {
    display: flex;
    align-items: center;
}

.site-logo img {
    display: block;

    width: auto;
    height: 42px;

    max-width: 220px;

    object-fit: contain;
}


.main-nav {
    display: flex;
    align-items: center;
    gap: 24px;

    color: var(--text-secondary);

    font-size: 0.95rem;
}


.main-nav a {
    transition: color 0.2s ease;
}


.main-nav a:hover {
    color: var(--text);
}


.header-search {
    margin-left: auto;
}


.header-search input {
    width: 220px;

    padding: 10px 14px;

    border: 1px solid var(--border);
    border-radius: 8px;

    background: var(--surface);
    color: var(--text);

    outline: none;
}


.header-search input:focus {
    border-color: var(--accent);
}


/* ========================================
   Hero
======================================== */

.hero {
    position: relative;

    min-height: 520px;

    display: flex;

    align-items: center;

    overflow: hidden;

    border-bottom: 1px solid var(--border);

    background:
        linear-gradient(
            180deg,
            rgba(0, 0, 0, 0.10),
            rgba(0, 0, 0, 0.45)
        );
}


.hero-inner {
    position: relative;

    z-index: 1;

    padding-top: 30px;

    padding-bottom: 30px;
}


.hero-label {
    display: inline-flex;

    align-items: center;

    gap: 9px;

    color: var(--accent);

    font-size: 0.72rem;

    font-weight: 900;

    letter-spacing: 0.16em;

    text-transform: uppercase;
}


.hero-label::before {
    content: "";

    display: block;

    width: 26px;
    height: 2px;

    background: var(--accent);

    box-shadow:
        0 0 10px rgba(
            59,
            255,
            0,
            0.35
        );
}


.hero h1 {
    max-width: 820px;

    margin: 16px 0 22px;

    color: #ffffff;

    font-size: clamp(
        3.2rem,
        7vw,
        5.8rem
    );

    font-weight: 900;

    line-height: 0.95;

    letter-spacing: -0.06em;
}


.hero-description {
    max-width: 650px;

    margin: 0;

    color: #aaaaaa;

    font-size: 1.05rem;

    line-height: 1.75;
}


.hero-actions {
    display: flex;

    flex-wrap: wrap;

    gap: 12px;

    margin-top: 34px;
}


.hero-button {
    display: inline-flex;

    align-items: center;

    justify-content: center;

    min-height: 48px;

    padding: 12px 22px;

    border-radius: 7px;

    font-size: 0.84rem;

    font-weight: 900;

    letter-spacing: 0.02em;

    cursor: pointer;

    transition:
        transform 0.2s ease,
        background 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}


.hero-button:hover {
    transform: translateY(-2px);
}


.hero-button-primary {
    background: var(--accent);

    border: 1px solid var(--accent);

    color: #000000;

    box-shadow:
        0 0 20px rgba(
            59,
            255,
            0,
            0.14
        );
}


.hero-button-primary:hover {
    background: #ffffff;

    border-color: #ffffff;

    box-shadow:
        0 0 25px rgba(
            59,
            255,
            0,
            0.20
        );
}


.hero-button-secondary {
    background: rgba(
        55,
        55,
        55,
        0.75
    );

    border: 1px solid #6e6e6e;

    color: #ffffff;
}


.hero-button-secondary:hover {
    background: #373737;

    border-color: var(--accent);

    color: var(--accent);

    box-shadow:
        0 0 16px rgba(
            59,
            255,
            0,
            0.08
        );
}


.hero-label {
    color: var(--accent);

    font-size: 0.8rem;
    font-weight: 700;

    text-transform: uppercase;
    letter-spacing: 0.08em;
}


.hero h1 {
    max-width: 700px;

    margin: 12px 0 16px;

    font-size: clamp(2.5rem, 6vw, 4.5rem);
    line-height: 1.05;

    letter-spacing: -0.05em;
}


.hero p {
    max-width: 620px;

    margin: 0;

    color: var(--text-secondary);

    font-size: 1.15rem;
}


/* Sections */

.categories-section,
.apps-section {
    padding: 64px 0;
}


.section-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;

    gap: 20px;

    margin-bottom: 24px;
}


.section-header h2 {
    margin: 0;

    font-size: 1.6rem;
}


.section-header p {
    margin: 6px 0 0;

    color: var(--text-secondary);
}


.section-header > a {
    color: var(--accent);

    font-size: 0.9rem;
    font-weight: 600;
}


/* Categories */

.categories-grid {
    display: grid;

    grid-template-columns:
        repeat(3, minmax(0, 1fr));

    gap: 16px;
}


.category-card {
    display: flex;
    align-items: center;

    gap: 16px;

    padding: 20px;

    background: var(--surface);

    border: 1px solid var(--border);
    border-radius: var(--radius);

    transition:
        background 0.2s ease,
        border-color 0.2s ease,
        transform 0.2s ease;
}


.category-card:hover {
    background: var(--surface-hover);

    border-color: var(--accent);

    transform: translateY(-2px);
}


.category-card-icon {
    width: 48px;
    height: 48px;

    flex: 0 0 48px;

    display: grid;
    place-items: center;

    border-radius: 10px;

    background: var(--surface-hover);

    font-size: 1.4rem;
}


.category-card h3 {
    margin: 0 0 4px;

    font-size: 1rem;
}


.category-card p {
    margin: 0;

    color: var(--text-secondary);

    font-size: 0.85rem;
}

/* ========================================
   Catalog switcher
======================================== */

.catalog-switcher {
    display: flex;

    flex-wrap: wrap;

    gap: 10px;

    margin-bottom: 24px;
}


.catalog-switch-button {
    padding: 10px 18px;

    background: var(--surface);

    border: 1px solid var(--border);

    border-radius: 8px;

    color: #ffffff;

    font-size: 0.9rem;

    font-weight: 800;

    cursor: pointer;

    transition:
        background 0.2s ease,
        border-color 0.2s ease,
        color 0.2s ease,
        transform 0.2s ease;
}


.catalog-switch-button:hover {
    background: var(--surface-hover);

    border-color: var(--accent);

    color: var(--accent);

    transform: translateY(-1px);
}


.catalog-switch-button.active {
    background: var(--accent);

    border-color: var(--accent);

    color: #000000;

    box-shadow:
        0 0 0 1px rgba(
            59,
            255,
            0,
            0.25
        ),
        0 0 18px rgba(
            59,
            255,
            0,
            0.2
        );
}


.catalog-switch-button.active:hover {
    background: #ffffff;

    color: #000000;
}

/* Applications */

.apps-grid {
    display: grid;

    grid-template-columns:
        repeat(5, minmax(0, 1fr));

    gap: 16px;
}


.app-card {
    display: grid;

    grid-template-columns: 64px minmax(0, 1fr);

    align-items: start;

    min-width: 0;

    padding: 16px;

    background: var(--surface);

    border: 1px solid var(--border);
    border-radius: var(--radius);

    transition:
        background 0.2s ease,
        border-color 0.2s ease,
        transform 0.2s ease;
}


.app-card:hover {
    background: var(--surface-hover);

    border-color: var(--accent);

    transform: translateY(-2px);
}


.app-card-icon {
    width: 64px;
    height: 64px;

    flex: 0 0 64px;

    margin-right: 14px;

    overflow: hidden;

    border-radius: 10px;

    background: var(--surface-hover);
}

.app-card-icon img {
    width: 100%;
    height: 100%;

    max-width: 100%;
    max-height: 100%;

    display: block;

    object-fit: contain;
}


.placeholder-icon {
    width: 100%;
    height: 100%;

    display: grid;
    place-items: center;

    color: var(--text-muted);

    font-size: 0.7rem;
    font-weight: 700;
}


.app-card-content {
    min-width: 0;
    overflow: hidden;
}


.app-card-top {
    margin-bottom: 5px;
}


.status-badge {
    display: inline-block;

    padding: 3px 7px;

    border-radius: 5px;

    background: rgba(0, 212, 255, 0.12);

    color: var(--success);

    font-size: 0.68rem;
    font-weight: 700;

    text-transform: uppercase;
    letter-spacing: 0.04em;
}


.app-card h3 {
    overflow: hidden;

    margin: 0 0 6px;

    font-size: 1rem;

    white-space: nowrap;
    text-overflow: ellipsis;
}


.app-card-description {
    display: -webkit-box;

    overflow: hidden;

    margin: 0 0 10px;

    color: var(--text-secondary);

    font-size: 0.82rem;

    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}


.app-card-meta {
    display: flex;
    flex-wrap: wrap;

    gap: 6px 10px;

    color: var(--text-muted);

    font-size: 0.72rem;
}

/* App card links */

.app-card-meta span + span::before {
    content: "•";

    margin-right: 10px;

    color: var(--border);
}

    .app-card-authors {
        display: block;

        margin-top: 3px;
        margin-bottom: 8px;

        line-height: 1.4;
    }

    .app-card-author {
        display: inline-block;

        margin-top: 3px;
        margin-bottom: 8px;

        color: var(--accent);
        font-size: 0.85rem;
        font-weight: 700;

        text-decoration: none;

        transition: opacity 0.2s ease;
    }

    .app-card-author:hover {
        opacity: 0.8;
    }

    .app-card-author-separator {
    color: var(--accent);
    font-size: 0.85rem;
    font-weight: 700;
    }

    .app-card-category {
        color: inherit;

        font-weight: 700;

        text-decoration: none;
    }

    .app-card-category:hover {
        text-decoration: underline;
    }


/* Footer */

.site-footer {
    padding: 32px 0;

    border-top: 1px solid var(--border);

    color: var(--text-muted);

    font-size: 0.8rem;
}


/* Responsive */

@media (max-width: 900px) {

    .header-inner {
        gap: 20px;
    }


    .header-search input {
        width: 180px;
    }


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


    .apps-grid {
    grid-template-columns:
        repeat(3, minmax(0, 1fr));

    gap: 12px;
}

}


@media (max-width: 640px) {

    .container {
        width: min(
            calc(100% - 24px),
            var(--container-width)
        );
    }


    .header-inner {
        min-height: auto;

        padding: 14px 0;

        flex-wrap: wrap;
    }


    .main-nav {
        order: 3;

        width: 100%;

        justify-content: center;

        padding-top: 4px;
    }


    .header-search {
        margin-left: auto;
    }


    .header-search input {
        width: 150px;
    }


    .hero {
    min-height: 560px;
}


.hero::before {
    width: 380px;
    height: 380px;

    right: -110px;

    opacity: 0.055;
}


.hero::after {
    left: 40%;

    width: 380px;
    height: 240px;
}


.hero h1 {
    max-width: 100%;

    font-size: clamp(
        2.8rem,
        14vw,
        4.2rem
    );
}


.hero-description {
    max-width: 100%;

    font-size: 0.95rem;
}


.hero-actions {
    flex-direction: column;

    align-items: stretch;

    margin-top: 28px;
}


.hero-button {
    width: 100%;
}


    .categories-section,
    .apps-section {
        padding: 48px 0;
    }


    .section-header {
        align-items: flex-start;
    }


    .section-header > a {
        white-space: nowrap;
    }


    .categories-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));

        gap: 10px;
    }


    .category-card {
        padding: 14px;

        gap: 10px;

        flex-direction: column;
        align-items: flex-start;
    }


    .app-card {
        display: block;

        padding: 12px;
    }


    .app-card-icon {
        width: 100%;
        height: auto;

        aspect-ratio: 1 / 1;

        margin: 0 0 12px;
    }


    .app-card h3 {
        white-space: normal;
    }


    .app-card-description {
        font-size: 0.76rem;
    }


    .app-card-meta {
        font-size: 0.66rem;
    }

}

/* ========================================
   Official PS Vita games
======================================== */

.official-game-cover {
    aspect-ratio: 2 / 3;
}


.official-game-cover img {
    width: 100%;
    height: 100%;

    display: block;

    object-fit: cover;
}


.official-game-badge {
    background: rgba(
        59,
        255,
        0,
        0.12
    );

    color: var(--accent);
}


.catalog-error {
    grid-column: 1 / -1;

    padding: 32px;

    color: #ffffff;

    text-align: center;
}

/* ========================================
   Featured Homebrew
======================================== */

.featured-section {
    padding: 54px 0 60px;
}


.section-heading {
    display: flex;

    justify-content: space-between;

    align-items: flex-end;

    margin-bottom: 24px;
}


.section-label {
    display: inline-block;

    margin-bottom: 7px;

    color: var(--accent);

    font-size: 0.72rem;

    font-weight: 900;

    letter-spacing: 0.14em;

    text-transform: uppercase;
}


.section-heading h2 {
    margin: 0;

    color: #ffffff;

    font-size: clamp(
        1.7rem,
        3vw,
        2.4rem
    );

    line-height: 1.1;

    letter-spacing: -0.035em;
}


.section-heading p {
    margin: 8px 0 0;

    color: var(--text-secondary);

    font-size: 0.92rem;
}


/* ========================================
   Featured grid
======================================== */

.featured-homebrew-grid {
    display: grid;

    grid-template-columns:
        repeat(3, minmax(0, 1fr));

    gap: 16px;
}


/*
 * Slight visual emphasis for featured cards.
 */

.featured-app-card {
    position: relative;

    overflow: hidden;
}


.featured-app-card::before {
    content: "";

    position: absolute;

    top: 0;
    left: 0;
    right: 0;

    height: 2px;

    background: var(--accent);

    opacity: 0.8;
}


/* ========================================
   Responsive
======================================== */

@media (max-width: 480px) {

    .featured-homebrew-grid {
        grid-template-columns:
            repeat(3, minmax(0, 1fr));

        gap: 10px;
    }

}

@media (max-width: 640px) {

    .featured-section {
        padding: 40px 0 46px;
    }


    .section-heading {
        align-items: flex-start;

        flex-direction: column;
    }


    .featured-homebrew-grid {
        grid-template-columns:
            repeat(3, minmax(0, 1fr));

        gap: 10px;
    }

}


@media (max-width: 480px) {

    .featured-homebrew-grid {
        grid-template-columns:
            1fr;
    }

}

#random-homebrew.disabled {
    opacity: 0.4;

    cursor: not-allowed;

    transform: none;
}

#random-homebrew.disabled:hover {
    transform: none;
}

.catalog-empty {
    grid-column: 1 / -1;

    padding: 60px 25px;

    background: var(--surface);

    border: 1px solid var(--border);

    border-radius: var(--radius);

    text-align: center;
}


.catalog-empty h3 {
    margin: 0 0 10px;

    color: #ffffff;

    font-size: 1.5rem;

    font-weight: 900;
}


.catalog-empty p {
    margin: 0;

    color: #bdbdbd;

    font-size: 0.95rem;

    line-height: 1.6;
}