:root {
    /* Color Palette */
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #fdfbfb 0%, #ebedee 100%);
    --accent-color: #764ba2;
    --text-main: #2d3748;
    --text-secondary: #718096;
    --bg-body: #f7fafc;
    --bg-card: #ffffff;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius-md: 12px;
    --radius-lg: 20px;
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    line-height: 1.7;
    color: var(--text-main);
    background-color: var(--bg-body);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
}

/* Layout */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Header */
header {
    background: var(--primary-gradient);
    color: white;
    padding: 80px 0 60px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

header::after {
    content: '';
    position: absolute;
    bottom: -50px;
    left: 0;
    width: 100%;
    height: 100px;
    background: var(--bg-body);
    transform: skewY(-3deg);
}

header h1 {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 16px;
    letter-spacing: -0.02em;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.subtitle {
    font-size: 1.25rem;
    opacity: 0.95;
    font-weight: 500;
}

/* App Header (Specific for sub-pages) */
.app-header {
    background: var(--primary-gradient);
    color: white;
    padding: 60px 0 80px;
    /* Extra padding bottom for overlap */
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: -40px;
    /* Negative margin to pull content up */
}

.app-header .app-icon-image {
    width: 100px;
    height: 100px;
    border-radius: 24px;
    margin-bottom: 24px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    border: 4px solid rgba(255, 255, 255, 0.2);
}

.app-header h1 {
    font-size: 2.5rem;
    margin: 0;
}

/* Navigation */
.nav-menu {
    position: relative;
    z-index: 10;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin: 0 auto 40px;
    max-width: 900px;
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.nav-menu ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}

.nav-menu a {
    display: inline-block;
    padding: 10px 24px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.nav-menu a:hover {
    color: var(--accent-color);
    background-color: rgba(118, 75, 162, 0.05);
}

.nav-menu a.active {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 10px rgba(118, 75, 162, 0.3);
}

.back-link {
    display: inline-flex;
    align-items: center;
    margin-bottom: 20px;
    color: white;
    font-weight: 600;
    opacity: 0.9;
}

.back-link:hover {
    opacity: 1;
    transform: translateX(-4px);
}

/* Main Content */
main {
    padding: 40px 0 80px;
}

.intro {
    text-align: center;
    margin-bottom: 80px;
}

.intro h2 {
    font-size: 2.25rem;
    margin-bottom: 24px;
    color: var(--text-main);
    font-weight: 700;
}

.intro p {
    font-size: 1.125rem;
    color: var(--text-secondary);
    max-width: 700px;
    margin: 0 auto;
}

/* App Grid */
.apps h2 {
    font-size: 2rem;
    margin-bottom: 48px;
    text-align: center;
    color: var(--text-main);
    position: relative;
    display: inline-block;
    left: 50%;
    transform: translateX(-50%);
}

.apps h2::after {
    content: '';
    display: block;
    width: 60px;
    height: 4px;
    background: var(--accent-color);
    margin: 12px auto 0;
    border-radius: 2px;
}

.app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 40px;
    padding: 10px;
    /* Prevent shadow clip */
}

.app-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 40px 32px;
    box-shadow: var(--shadow-sm);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-align: center;
    border: 1px solid rgba(0, 0, 0, 0.03);
    position: relative;
    overflow: hidden;
}

.app-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 6px;
    background: var(--primary-gradient);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.app-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
}

.app-card:hover::before {
    opacity: 1;
}

.app-card .app-icon-image {
    width: 96px;
    height: 96px;
    border-radius: 22px;
    margin-bottom: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    object-fit: cover;
}

.app-card h3 {
    font-size: 1.5rem;
    margin-bottom: 16px;
    color: var(--text-main);
    font-weight: 700;
}

.app-card .app-description {
    color: var(--text-secondary);
    margin-bottom: 32px;
    font-size: 1rem;
    min-height: 80px;
    /* Align buttons */
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 32px;
    background: var(--primary-gradient);
    color: white;
    border-radius: 50px;
    font-weight: 600;
    box-shadow: 0 4px 6px rgba(118, 75, 162, 0.25);
    transition: all 0.3s ease;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 7px 14px rgba(118, 75, 162, 0.3);
}

/* Content Pages (Privacy, Terms, etc.) */
.app-content {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 60px;
    margin: 0 auto;
    max-width: 900px;
    box-shadow: var(--shadow-md);
    position: relative;
    z-index: 1;
    /* Ensure above header overlap */
}

.app-content h2 {
    font-size: 1.75rem;
    margin: 48px 0 24px;
    color: var(--text-main);
    border-left: 5px solid var(--accent-color);
    padding-left: 16px;
    line-height: 1.3;
}

.app-content h2:first-of-type {
    margin-top: 0;
}

.app-content h3 {
    font-size: 1.25rem;
    margin: 32px 0 16px;
    color: var(--text-main);
    font-weight: 600;
}

.app-content p {
    margin-bottom: 24px;
    color: var(--text-secondary);
}

.app-content ul,
.app-content ol {
    margin-bottom: 24px;
    padding-left: 24px;
}

.app-content li {
    margin-bottom: 12px;
    color: var(--text-secondary);
    position: relative;
}

.app-content a:not(.btn) {
    color: var(--accent-color);
    font-weight: 500;
    border-bottom: 1px dashed var(--accent-color);
}

.app-content a:not(.btn):hover {
    border-bottom-style: solid;
}

/* Footer */
footer {
    background-color: white;
    color: var(--text-secondary);
    text-align: center;
    padding: 40px 0;
    margin-top: 80px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

footer p {
    font-size: 0.9rem;
}

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

    .app-header h1 {
        font-size: 2rem;
    }

    .app-content {
        padding: 32px 20px;
        margin-top: 20px;
        border-radius: var(--radius-md);
    }

    .nav-menu {
        border-radius: 0;
        margin: 0;
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        white-space: nowrap;
        padding: 16px 20px;
        -webkit-overflow-scrolling: touch;
    }

    .nav-menu ul {
        flex-wrap: nowrap;
        justify-content: flex-start;
    }

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