:root {
    --bg-color: #f2f2f6; /* iOS typical grey background */
    --surface-color: #ffffff;
    --text-primary: #000000;
    --text-secondary: #8e8e93;
    --accent-color: #007aff; /* iOS blue */
    --accent-color-hover: #0056b3;
    --gold: #f7b731;
    --divider: #e5e5ea;
    --card-bg: #ffffff;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #000000;
        --surface-color: #1c1c1e;
        --text-primary: #ffffff;
        --text-secondary: #98989d;
        --accent-color: #0a84ff;
        --accent-color-hover: #0066cc;
        --divider: #38383a;
        --card-bg: #1c1c1e;
    }
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: '-apple-system', 'BlinkMacSystemFont', 'Inter', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
}

/* Responsive Main Container */
.container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px;
}

@media (max-width: 600px) {
    .container {
        padding: 20px 16px;
    }
}

/* Header */
.app-header {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
}

.app-icon {
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, #FFDF00, #D4AF37);
    border-radius: 22%;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border: 1px solid rgba(0,0,0,0.05);
    flex-shrink: 0;
}

@media (max-width: 400px) {
    .app-icon {
        width: 80px;
        height: 80px;
    }
    .icon-text {
        font-size: 2.2rem;
    }
}

.icon-text {
    font-size: 3rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.app-meta {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex: 1;
}

.app-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
    letter-spacing: 0.5px;
}

.app-release-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.app-developer {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.app-stats {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: auto;
}

.stat {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
}

.stat-label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat.divider {
    color: var(--divider);
    font-size: 20px;
    line-height: 1;
}

/* Promo Video */
.promo-video-container {
    width: 100%;
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 24px;
    background: #000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.promo-video {
    width: 100%;
    max-height: 55vh;
    display: block;
    object-fit: contain;
}

/* Action Bar */
.action-bar {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 30px;
    border-bottom: 1px solid var(--divider);
    padding-bottom: 24px;
}

.install-button {
    background-color: var(--accent-color);
    color: #ffffff;
    font-size: 16px;
    font-weight: 700;
    text-align: center;
    padding: 14px 24px;
    border-radius: 24px;
    text-decoration: none;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 100%; /* Can span full width on small screens */
    transition: background-color 0.2s, transform 0.1s;
    height: 52px;
}

@media (min-width: 600px) {
    .install-button {
        max-width: 300px; /* Limit width on larger screens */
    }
    .action-bar {
        align-items: flex-start; /* Align naturally instead of stacking center */
    }
    .version-info, .error-message {
        text-align: left;
        margin-left: 10px;
    }
}

.install-button:active {
    background-color: var(--accent-color-hover);
    transform: scale(0.98);
}

.install-button.loading {
    background-color: var(--divider);
    color: var(--text-secondary);
    pointer-events: none;
}

.loader {
    display: none;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: var(--text-secondary);
    animation: spin 1s ease-in-out infinite;
}

.install-button.loading .loader {
    display: block;
}

.install-button.loading .btn-text {
    display: none;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.version-info {
    font-size: 13px;
    color: var(--text-secondary);
    text-align: center;
}

.error-message {
    font-size: 13px;
    color: #ff3b30;
    text-align: center;
    display: none;
}

/* Sections */
.section {
    margin-bottom: 30px;
}

.section-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.instructions-card {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 16px;
    border: 1px solid var(--divider);
}

.section-text {
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
}

.section-text strong {
    font-weight: 600;
}

.screenshots-section {
    margin-top: 10px;
}

.screenshots-container {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 16px;
    padding-bottom: 16px; /* space for scrollbar */
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
}

.screenshots-container::-webkit-scrollbar {
    display: none; /* Safari and Chrome */
}

.screenshot {
    height: 480px; /* Standard phone height ratio */
    width: auto;
    border-radius: 16px;
    scroll-snap-align: center;
    border: 1px solid var(--divider);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    background-color: var(--card-bg);
}

@media (max-width: 600px) {
    .screenshot {
        height: 400px;
    }
}
@media (max-width: 400px) {
    .screenshot {
        height: 340px;
    }
}

/* Fullscreen Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.show {
    opacity: 1;
}

.modal-content {
    margin: auto;
    display: block;
    max-width: 90%;
    max-height: 85vh;
    border-radius: 12px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    object-fit: contain;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.close-modal {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 101;
    transition: color 0.2s;
    user-select: none;
}

.close-modal:hover,
.close-modal:focus {
    color: #bbb;
    text-decoration: none;
}

.nav-btn {
    cursor: pointer;
    position: absolute;
    top: 50%;
    width: auto;
    padding: 20px;
    margin-top: -30px;
    color: white;
    font-weight: bold;
    font-size: 30px;
    transition: 0.3s ease;
    border-radius: 0 5px 5px 0;
    user-select: none;
    z-index: 101;
    background-color: rgba(0,0,0,0.3);
}

.nav-btn:hover {
    background-color: rgba(0,0,0,0.8);
}

.prev-btn {
    left: 10px;
    border-radius: 5px;
}

.next-btn {
    right: 10px;
    border-radius: 5px;
}

.modal-caption {
    margin: auto;
    display: block;
    width: 80%;
    max-width: 700px;
    text-align: center;
    color: #ccc;
    padding: 10px 0;
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 16px;
}

@media only screen and (max-width: 600px) {
    .modal-content {
        max-width: 95%;
    }
    .nav-btn {
        padding: 15px 10px;
        font-size: 24px;
    }
    .prev-btn { left: 0px; }
    .next-btn { right: 0px; }
}
