:root {
    --bg-color: #080a10;
    --card-bg: rgba(17, 24, 39, 0.6);
    --border-color: rgba(255, 255, 255, 0.06);
    --text-primary: #f9fafb;
    --text-secondary: #9ca3af;
    --accent-color: #4f46e5;
    --accent-hover: #6366f1;
    --accent-glow: rgba(99, 102, 241, 0.2);
    --success-color: #10b981;
    --android-color: #3ddc84;
    --win-color: #0078d4;
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-sans);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    overflow-x: hidden;
    position: relative;
}

/* Cosmic ambient glows */
body::before {
    content: '';
    position: absolute;
    top: -20%;
    left: 10%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(79, 70, 229, 0.15) 0%, rgba(0,0,0,0) 70%);
    z-index: -1;
    filter: blur(80px);
    pointer-events: none;
}

body::after {
    content: '';
    position: absolute;
    bottom: -10%;
    right: 10%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.08) 0%, rgba(0,0,0,0) 70%);
    z-index: -1;
    filter: blur(80px);
    pointer-events: none;
}

.container {
    max-width: 1000px;
    width: 100%;
    padding: 3rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    transition: color 0.2s ease;
}

.back-link:hover {
    color: var(--text-primary);
}

.brand {
    font-size: 0.9rem;
    font-weight: 800;
    letter-spacing: 2px;
    color: var(--accent-hover);
    background: rgba(99, 102, 241, 0.08);
    padding: 0.4rem 1.2rem;
    border-radius: 50px;
    border: 1px solid rgba(99, 102, 241, 0.15);
    display: inline-block;
    margin-bottom: 1rem;
}

h1 {
    font-size: 2.75rem;
    font-weight: 800;
    background: linear-gradient(135deg, #ffffff 40%, #c7d2fe 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.75rem;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
}

/* App Grid */
.app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

/* Premium App Card */
.app-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 1.75rem;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.app-card:hover {
    transform: translateY(-6px);
    border-color: rgba(99, 102, 241, 0.25);
    box-shadow: 0 15px 35px rgba(99, 102, 241, 0.1);
}

.app-icon-wrapper {
    width: 64px;
    height: 64px;
    border-radius: 14px;
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
    border: 1px solid rgba(255,255,255,0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.05);
}

.app-info h2 {
    font-size: 1.35rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.app-tags {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.tag {
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-weight: 600;
}

.tag-android {
    background: rgba(61, 220, 132, 0.1);
    color: var(--android-color);
}

.tag-windows {
    background: rgba(0, 120, 212, 0.1);
    color: var(--win-color);
}

.tag-version {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
}

.app-desc {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.btn-arrow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
    color: var(--accent-hover);
    font-size: 0.95rem;
    margin-top: auto;
    padding-top: 0.5rem;
}

/* 2nd-Level Detail Page Layout */
.app-detail {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2.5rem;
    align-items: start;
}

@media (max-width: 768px) {
    .app-detail {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

.detail-sidebar {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1.5rem;
    backdrop-filter: blur(16px);
}

.detail-sidebar .app-icon-wrapper {
    width: 96px;
    height: 96px;
    font-size: 3rem;
    border-radius: 20px;
}

.detail-sidebar h2 {
    font-size: 1.75rem;
    font-weight: 700;
}

.detail-sidebar .app-tags {
    justify-content: center;
}

.download-box {
    width: 100%;
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.btn-download {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    background: var(--accent-color);
    color: white;
    text-decoration: none;
    font-weight: 600;
    padding: 0.9rem 1.5rem;
    border-radius: 12px;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.3);
}

.btn-download:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.download-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Detail Content Area */
.detail-content {
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
}

.content-section {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 1.75rem;
    backdrop-filter: blur(16px);
}

.content-section h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 1rem;
    border-left: 3px solid var(--accent-hover);
    padding-left: 0.75rem;
}

.content-section p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 1rem;
}

/* Screenshot carousel */
.screenshot-carousel {
    position: relative;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 42px;
    align-items: center;
    gap: 0.75rem;
}

.carousel-viewport {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(220px, 300px);
    gap: 1rem;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none;
    padding: 0.25rem 0 0.75rem;
}

.carousel-viewport::-webkit-scrollbar {
    display: none;
}

.screenshot-slide {
    scroll-snap-align: center;
    background: rgba(15, 19, 34, 0.92);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 22px;
    padding: 0.8rem;
    box-shadow: 0 14px 30px rgba(0,0,0,0.28);
}

.screenshot-slide img {
    width: 100%;
    aspect-ratio: 1080 / 2376;
    object-fit: cover;
    object-position: top center;
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.08);
    display: block;
    background: #050712;
}

.screenshot-slide figcaption {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.9rem 0.3rem 0.25rem;
}

.screenshot-slide figcaption strong {
    color: var(--text-primary);
    font-size: 0.98rem;
}

.screenshot-slide figcaption span {
    color: var(--text-secondary);
    font-size: 0.84rem;
    line-height: 1.45;
}

.carousel-button {
    width: 42px;
    height: 42px;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 50%;
    background: rgba(15, 19, 34, 0.9);
    color: var(--text-primary);
    font-size: 2rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.carousel-button:hover {
    transform: translateY(-1px);
    border-color: rgba(99, 102, 241, 0.45);
    background: rgba(79, 70, 229, 0.24);
}

.carousel-dots {
    display: flex;
    justify-content: center;
    gap: 0.45rem;
    margin-top: 0.65rem;
}

.carousel-dot {
    width: 8px;
    height: 8px;
    border: 0;
    border-radius: 999px;
    background: rgba(255,255,255,0.22);
    padding: 0;
    cursor: pointer;
    transition: width 0.2s ease, background 0.2s ease;
}

.carousel-dot.is-active {
    width: 24px;
    background: var(--accent-hover);
}

.carousel-hint {
    text-align: center;
    font-size: 0.82rem;
    margin: 0.7rem 0 0;
}

@media (max-width: 768px) {
    .screenshot-carousel {
        grid-template-columns: 1fr;
    }

    .carousel-viewport {
        grid-auto-columns: minmax(250px, 82vw);
        padding-inline: calc((100vw - 82vw - 3rem) / 2);
        margin-inline: -0.75rem;
    }

    .carousel-button {
        display: none;
    }
}

.hero-section {
    border-color: rgba(99, 102, 241, 0.24);
    box-shadow: 0 20px 45px rgba(79, 70, 229, 0.12);
}

.changelog-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.changelog-list li {
    display: flex;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.changelog-list li::before {
    content: "•";
    color: var(--accent-hover);
    font-weight: bold;
}

/* Footer */
footer {
    text-align: center;
    margin-top: 3rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
}
