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

:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --background: #0a0a0b;
    --surface: #141416;
    --surface-hover: #1c1c1f;
    --text: #fafafa;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --border: #27272a;
    --border-dark: #3f3f46;
    --success: #22c55e;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 4px 6px rgba(0, 0, 0, 0.4), 0 2px 4px rgba(0, 0, 0, 0.3);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--background);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Header */
.header {
    background: var(--background);
    border-bottom: 1px solid var(--border);
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.logo-text {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.025em;
}

.nav {
    display: flex;
    gap: 32px;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: color 0.15s;
}

.nav-link:hover,
.nav-link.active {
    color: var(--text);
}

/* Hero Section */
.hero {
    padding: 64px 0 48px;
    text-align: center;
}

.hero h1 {
    font-size: 2.25rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 12px;
    letter-spacing: -0.025em;
}

.hero p {
    color: var(--text-secondary);
    font-size: 1.125rem;
    margin-bottom: 32px;
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
}

.search-box {
    display: flex;
    max-width: 480px;
    margin: 0 auto;
    background: var(--background);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.search-box:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.search-box input {
    flex: 1;
    padding: 12px 16px;
    border: none;
    background: transparent;
    color: var(--text);
    font-size: 0.9375rem;
    outline: none;
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.search-btn {
    padding: 12px 20px;
    background: var(--surface);
    border: none;
    border-left: 1px solid var(--border);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: background 0.15s, color 0.15s;
}

.search-btn:hover {
    background: var(--surface-hover);
    color: var(--text);
}

/* Filters */
.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    padding: 20px 24px;
    background: var(--surface);
    border-radius: var(--radius-lg);
    margin-bottom: 32px;
    align-items: center;
    border: 1px solid var(--border);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.filter-group h3 {
    font-size: 0.8125rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.filter-buttons {
    display: flex;
    gap: 4px;
}

.filter-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
    font-size: 0.875rem;
    font-weight: 500;
}

.filter-btn:hover {
    background: var(--background);
    color: var(--text);
}

.filter-btn.active {
    background: var(--background);
    border-color: var(--border);
    color: var(--text);
    box-shadow: var(--shadow-sm);
}

.filter-icon {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--surface-hover);
    padding: 2px 6px;
    border-radius: 4px;
}

.filter-btn.active .filter-icon {
    background: #facc15;
    color: #0a0a0b;
}

.category-select,
.sort-select {
    padding: 8px 12px;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.875rem;
    cursor: pointer;
    min-width: 160px;
    transition: border-color 0.15s;
}

.category-select:focus,
.sort-select:focus {
    outline: none;
    border-color: var(--primary);
}

/* Stats */
.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}

.stat-item {
    background: var(--surface);
    padding: 20px;
    border-radius: var(--radius-lg);
    text-align: center;
    border: 1px solid var(--border);
}

.stat-number {
    display: block;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.8125rem;
    font-weight: 500;
}

/* Apps Section */
.apps-section {
    margin-bottom: 64px;
}

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

.section-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text);
}

.results-count {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Apps Grid */
.apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 20px;
}

.app-card {
    background: var(--background);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    transition: border-color 0.15s, box-shadow 0.15s;
    cursor: pointer;
    overflow: hidden;
}

.app-card:hover {
    border-color: var(--border-dark);
    box-shadow: var(--shadow-lg);
}

.app-card-header {
    padding: 20px 20px 16px;
    display: flex;
    gap: 16px;
}

.app-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius);
    background: var(--surface);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    flex-shrink: 0;
    border: 1px solid var(--border);
    overflow: hidden;
}

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

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

.app-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-author {
    color: var(--text-muted);
    font-size: 0.8125rem;
    margin-bottom: 8px;
}

.app-meta {
    display: flex;
    gap: 12px;
    align-items: center;
}

.app-rating {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
}

.app-rating::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #fbbf24;
    border-radius: 50%;
}

.app-downloads {
    color: var(--text-muted);
    font-size: 0.8125rem;
}

.app-size {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
}

.app-size::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #22c55e;
    border-radius: 50%;
}

.app-card-body {
    padding: 0 20px 16px;
}

.app-description {
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.app-card-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--surface);
}

.app-type {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.app-type-icon {
    font-size: 0.6875rem;
    font-weight: 600;
    background: var(--background);
    padding: 3px 6px;
    border-radius: 4px;
    border: 1px solid var(--border);
}

.download-btn {
    padding: 8px 20px;
    background: #facc15;
    border: none;
    border-radius: 9999px;
    color: #0a0a0b;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.download-btn:hover {
    background: #eab308;
}

/* No Results */
.no-results {
    text-align: center;
    padding: 64px 20px;
    color: var(--text-muted);
}

.no-results h3 {
    font-size: 1.125rem;
    margin-bottom: 8px;
    color: var(--text);
    font-weight: 600;
}

.no-results p {
    font-size: 0.9375rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--surface);
    border-radius: var(--radius-lg);
    max-width: 520px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    border: 1px solid var(--border);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    z-index: 10;
}

.modal-close:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.modal-body {
    padding: 28px;
}

.modal-header {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
}

.modal-icon {
    width: 72px;
    height: 72px;
    border-radius: var(--radius-lg);
    background: var(--surface);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    flex-shrink: 0;
    border: 1px solid var(--border);
    overflow: hidden;
}

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

.modal-info h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}

.modal-version {
    color: var(--text-muted);
    font-size: 0.8125rem;
    margin-bottom: 10px;
}

.modal-stats {
    display: flex;
    gap: 16px;
}

.modal-stat {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8125rem;
    font-weight: 500;
}

.modal-stat.rating {
    color: var(--text-secondary);
}

.modal-stat.rating::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #fbbf24;
    border-radius: 50%;
}

.modal-stat.downloads {
    color: var(--text-muted);
}

.modal-description {
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 20px;
    font-size: 0.9375rem;
}

.modal-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 20px;
}

.modal-tag {
    padding: 4px 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.modal-details {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 20px;
}

.modal-detail {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
}

.modal-detail:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.modal-detail:first-child {
    padding-top: 0;
}

.modal-detail-label {
    color: var(--text-muted);
}

.modal-detail-value {
    font-weight: 500;
    color: var(--text);
}

.modal-download-btn {
    width: 100%;
    padding: 14px;
    background: #facc15;
    border: none;
    border-radius: 9999px;
    color: #0a0a0b;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.modal-download-btn:hover {
    background: #eab308;
}

/* Footer */
.footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 24px 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Responsive */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 1.75rem;
    }

    .hero p {
        font-size: 1rem;
    }

    .filters {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .filter-group {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .filter-buttons {
        flex-wrap: wrap;
    }

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

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

    .nav {
        display: none;
    }

    .modal-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .modal-stats {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 16px;
    }

    .stats {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .stat-item {
        padding: 16px;
    }

    .stat-number {
        font-size: 1.25rem;
    }
}
