:root {
    color-scheme: dark;
    --bg: #030816;
    --panel: #101827;
    --panel-soft: #151e31;
    --line: rgba(151, 171, 214, .18);
    --text: #f6f8ff;
    --muted: #aab5c8;
    --cyan: #20c7ff;
    --pink: #ff4dd8;
    --blue: #2563eb;
    --green: #20d39b;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: radial-gradient(circle at top right, rgba(87, 45, 190, .25), transparent 34rem), var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

img {
    max-width: 100%;
    display: block;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: auto 1fr minmax(220px, 340px);
    gap: 24px;
    align-items: center;
    padding: 18px clamp(18px, 5vw, 80px);
    background: rgba(3, 8, 22, .9);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(18px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 1.55rem;
    font-weight: 900;
    letter-spacing: 0;
}

.brand span span {
    color: #a855f7;
}

.brand-mark {
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
    border-radius: 7px;
    background: linear-gradient(135deg, var(--cyan), var(--pink));
    color: #06101f;
    font-weight: 900;
}

.main-nav {
    display: flex;
    gap: 22px;
    justify-content: center;
    color: #d4d9e7;
    font-size: .95rem;
}

.main-nav a:hover,
.sort-links a:hover,
.footer-links a:hover {
    color: var(--cyan);
}

.search {
    display: flex;
    border: 1px solid var(--line);
    background: #111827;
    border-radius: 999px;
    overflow: hidden;
}

.search input,
.login-card input {
    width: 100%;
    border: 0;
    color: var(--text);
    background: transparent;
    padding: 13px 16px;
    outline: 0;
}

.search button {
    border: 0;
    background: transparent;
    color: var(--muted);
    padding: 0 16px;
    cursor: pointer;
}

.hero {
    min-height: 460px;
    background-position: center right;
    background-size: cover;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    padding: 56px clamp(18px, 8vw, 112px);
}

.hero-content {
    width: min(620px, 100%);
}

.eyebrow,
.section-kicker {
    display: inline-flex;
    color: #cbd7ff;
    border: 1px solid rgba(32, 199, 255, .45);
    background: rgba(37, 99, 235, .16);
    border-radius: 999px;
    padding: 6px 12px;
    text-transform: uppercase;
    font-size: .76rem;
    font-weight: 800;
    letter-spacing: .06em;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

.hero h1 {
    margin: 14px 0;
    font-size: clamp(2.4rem, 5vw, 4.8rem);
    line-height: .98;
    letter-spacing: 0;
}

.hero h1::first-line {
    color: #fff;
}

.hero p {
    color: #c7d0df;
    font-size: 1.08rem;
    line-height: 1.6;
    max-width: 560px;
}

.hero-actions,
.sort-links,
.footer-links,
.detail-meta,
.trust-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.primary-action,
.secondary-action,
.download-button {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-weight: 800;
}

.primary-action,
.download-button {
    background: linear-gradient(135deg, #1d6dff, #f34bd8);
    color: white;
    padding: 0 18px;
    border: 0;
}

.secondary-action {
    border: 1px solid rgba(210, 220, 255, .3);
    color: #e6ebff;
    padding: 0 18px;
    background: rgba(8, 13, 29, .62);
}

.trust-row {
    margin-top: 22px;
    color: #d8deec;
    font-size: .92rem;
}

.trust-row span {
    padding-right: 16px;
    border-right: 1px solid var(--line);
}

.market-layout {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 28px;
    padding: 28px clamp(18px, 5vw, 80px) 56px;
}

.sidebar {
    display: grid;
    align-content: start;
    gap: 18px;
}

.panel,
.app-card,
.ranking-row,
.release-card,
.login-card,
.stat-card {
    border: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(21, 30, 49, .96), rgba(9, 15, 28, .96));
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .2);
}

.panel {
    padding: 18px;
}

.panel h2,
.section h2 {
    margin-bottom: 16px;
}

.category-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    color: #dfe6f6;
    border-bottom: 1px solid var(--line);
}

.category-row span {
    color: #9fb0cd;
    background: rgba(255, 255, 255, .08);
    border-radius: 999px;
    padding: 2px 9px;
}

.compact p {
    color: var(--muted);
    margin-bottom: 8px;
}

.content-stack,
.section {
    display: grid;
    gap: 24px;
}

.section {
    margin-bottom: 28px;
}

.section-heading {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: end;
}

.section-kicker {
    border: 0;
    background: transparent;
    color: #92c5ff;
    padding: 0;
}

.section-heading h1,
.section-heading h2 {
    margin: 4px 0 0;
}

.app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.app-card {
    padding: 10px;
}

.app-image {
    display: block;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    border-radius: 6px;
    background: #080d18;
}

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

.app-card-body {
    display: grid;
    grid-template-columns: 48px 1fr;
    gap: 12px;
    align-items: center;
    padding: 12px 0 8px;
}

.app-icon {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 8px;
}

.app-card h3 {
    margin: 0 0 4px;
    font-size: 1rem;
}

.app-card p,
.metrics,
.ranking-row span,
.release-card small,
.details-list,
.simple-page p,
.detail-copy p {
    color: var(--muted);
}

.metrics {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: .92rem;
}

.download-button {
    width: 100%;
}

.ranking-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 10px;
}

.ranking-row {
    display: grid;
    grid-template-columns: 28px 44px 1fr auto;
    gap: 10px;
    align-items: center;
    padding: 10px;
}

.ranking-row img,
.release-card img,
.admin-table img {
    width: 44px;
    height: 44px;
    object-fit: cover;
    border-radius: 7px;
}

.rank {
    color: #f7c948;
    font-size: 1.25rem;
    font-weight: 900;
}

.release-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}

.release-card {
    display: grid;
    gap: 10px;
    justify-items: start;
    padding: 14px;
}

.app-detail,
.simple-page,
.admin-page {
    padding: 36px clamp(18px, 5vw, 80px) 64px;
}

.detail-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 540px);
    gap: 32px;
    align-items: center;
    margin-bottom: 32px;
}

.detail-copy {
    display: grid;
    grid-template-columns: 86px 1fr;
    gap: 18px;
}

.detail-icon {
    width: 86px;
    height: 86px;
    border-radius: 16px;
    object-fit: cover;
}

.detail-copy h1,
.simple-page h1 {
    font-size: clamp(2rem, 4vw, 4rem);
    margin: 10px 0;
}

.detail-meta {
    margin: 18px 0;
}

.detail-meta span {
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .06);
    padding: 8px 10px;
    border-radius: 8px;
}

.detail-featured {
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    background: #080d18;
}

.detail-featured img {
    width: 100%;
    aspect-ratio: 16 / 11;
    object-fit: cover;
}

.screenshot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
}

.screenshot-grid a,
.screenshot-tile {
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    background: #090f1c;
}

.screenshot-tile {
    display: block;
    padding: 0;
    color: inherit;
    cursor: zoom-in;
}

.screenshot-grid img {
    width: 100%;
    aspect-ratio: 9 / 16;
    object-fit: cover;
}

.lightbox-open {
    overflow: hidden;
}

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr) 64px;
    grid-template-rows: 64px minmax(0, 1fr) 48px;
    align-items: center;
    justify-items: center;
    gap: 12px;
    padding: 18px;
    background: rgba(2, 6, 18, .92);
    backdrop-filter: blur(16px);
}

.lightbox[hidden] {
    display: none;
}

.lightbox-image {
    grid-column: 2;
    grid-row: 2;
    max-width: min(92vw, 900px);
    max-height: 78vh;
    border-radius: 8px;
    box-shadow: 0 24px 100px rgba(0, 0, 0, .58);
}

.lightbox-close,
.lightbox-nav {
    border: 1px solid rgba(255, 255, 255, .2);
    background: rgba(17, 24, 39, .82);
    color: white;
    cursor: pointer;
}

.lightbox-close {
    grid-column: 3;
    grid-row: 1;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    font-weight: 900;
}

.lightbox-nav {
    width: 48px;
    height: 68px;
    border-radius: 8px;
    font-size: 2.4rem;
    line-height: 1;
}

.lightbox-prev {
    grid-column: 1;
    grid-row: 2;
}

.lightbox-next {
    grid-column: 3;
    grid-row: 2;
}

.lightbox-count {
    grid-column: 2;
    grid-row: 3;
    color: #dbe7ff;
}

.info-grid {
    grid-template-columns: 1.3fr .7fr;
}

.reviews-layout {
    grid-template-columns: .7fr 1.3fr;
}

.review-summary strong {
    display: block;
    margin: 8px 0;
    font-size: 3rem;
}

.review-form {
    display: grid;
    gap: 14px;
}

.review-form label {
    display: grid;
    gap: 7px;
    color: #d8e0ef;
}

.review-form input,
.review-form select,
.review-form textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, .06);
    color: var(--text);
    padding: 12px;
    font: inherit;
}

.review-form option {
    background: #101827;
}

.honeypot {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.success {
    color: var(--green);
}

.comments-list {
    display: grid;
    gap: 12px;
}

.comment-card {
    border: 1px solid var(--line);
    background: rgba(15, 23, 42, .72);
    border-radius: 8px;
    padding: 16px;
}

.comment-card div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.comment-card span,
.comment-card small {
    color: var(--muted);
}

.details-list {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px 18px;
}

.details-list dt {
    color: #e8edff;
    font-weight: 800;
}

.simple-page {
    max-width: 920px;
}

.policy-block {
    border-top: 1px solid var(--line);
    padding-top: 22px;
    margin-top: 22px;
}

.admin-page {
    display: grid;
    gap: 24px;
}

.login-card {
    width: min(460px, 100%);
    padding: 24px;
    margin: 36px auto;
    display: grid;
    gap: 14px;
}

.login-card label {
    display: grid;
    gap: 8px;
    color: #d8e0ef;
}

.login-card input {
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .06);
    border-radius: 8px;
}

.error {
    color: #ff9bba;
}

.admin-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

.stat-card {
    padding: 18px;
}

.stat-card span {
    color: var(--muted);
}

.stat-card strong {
    display: block;
    margin-top: 6px;
    font-size: 2rem;
}

.admin-table,
.review-admin-list {
    display: grid;
}

.table-row {
    display: grid;
    grid-template-columns: 1.4fr .7fr .7fr .7fr;
    gap: 14px;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}

.table-row span:first-child {
    display: flex;
    align-items: center;
    gap: 10px;
}

.table-head {
    color: #93c5fd;
    font-weight: 900;
}

.admin-review {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 14px;
    align-items: start;
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
}

.admin-review p {
    color: var(--muted);
    margin-bottom: 6px;
}

.admin-review button {
    border: 1px solid rgba(255, 130, 170, .45);
    background: rgba(255, 78, 130, .12);
    color: #ffb4c9;
    border-radius: 8px;
    padding: 10px 12px;
    cursor: pointer;
}

.site-footer {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    padding: 24px clamp(18px, 5vw, 80px);
    border-top: 1px solid var(--line);
    color: var(--muted);
    background: rgba(3, 8, 22, .7);
}

.site-footer strong {
    color: #fff;
    margin-right: 12px;
}

@media (max-width: 980px) {
    .site-header {
        grid-template-columns: 1fr;
    }

    .main-nav {
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: 2px;
    }

    .market-layout,
    .detail-hero,
    .info-grid,
    .reviews-layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        order: 2;
    }
}

@media (max-width: 640px) {
    .hero {
        min-height: 520px;
        align-items: end;
        padding-top: 140px;
    }

    .section-heading,
    .site-footer {
        align-items: start;
        flex-direction: column;
    }

    .detail-copy {
        grid-template-columns: 1fr;
    }

    .admin-stats,
    .table-row,
    .admin-review {
        grid-template-columns: 1fr;
    }

    .lightbox {
        grid-template-columns: 48px minmax(0, 1fr) 48px;
        padding: 10px;
    }
}
