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

:root {
    --apple-blue: #FF8A8A;
    --apple-gray: #F5F5F7;
    --apple-dark-gray: #1D1D1F;
    --apple-text: #1D1D1F;
    --apple-text-light: #86868B;
    --apple-white: #FFFFFF;
    --apple-border: #D2D2D7;
    --apple-hover: #F5F5F7;
}

/* Dark Theme Variables */
[data-theme="dark"] {
    --apple-blue: #FF6B6B;
    --apple-gray: #1C1C1E;
    --apple-dark-gray: #F5F5F7;
    --apple-text: #F5F5F7;
    --apple-text-light: #98989D;
    --apple-white: #000000;
    --apple-border: #38383A;
    --apple-hover: #2C2C2E;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--apple-text);
    background-color: var(--apple-white);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    overflow-y: visible;
    position: relative;
    margin: 0;
    padding: 0;
    padding-bottom: calc(60px + env(safe-area-inset-bottom));
    /* Ensure body fills viewport, but can grow for scrolling */
    min-height: 100vh;
    height: auto;
    display: flex;
    flex-direction: column;
    transition: background-color 0.3s ease, color 0.3s ease, transform 0.2s ease-out;
    -webkit-transition: background-color 0.3s ease, color 0.3s ease, -webkit-transform 0.2s ease-out;
}

body.standalone-mode {
    /* Ensure body fills viewport exactly when content is short */
    min-height: 100vh;
    min-height: 100%;
    height: auto;
    /* Body should not scroll - html is the scroll container */
    overflow-x: hidden;
    overflow-y: visible;
    /* Keep flex layout for proper content flow */
    display: flex;
    flex-direction: column;
    /* Ensure body fills viewport when content is short */
    align-items: stretch;
    /* Ensure body is positioned correctly for fixed children */
    position: relative;
    /* Use viewport units */
    width: 100%;
}

/* Remove borders/outlines from images */
img {
    border: none;
    outline: none;
    display: block;
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    max-width: 100%;
    height: 100%;
    /* Ensure html is the scrolling element */
    position: relative;
}

html.standalone-mode {
    /* Ensure html fills viewport exactly - critical for fixed positioning */
    height: 100%;
    min-height: 100%;
    /* Allow scrolling in standalone mode - html should be the scroll container */
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    /* Ensure html is positioned correctly for fixed children */
    position: relative;
    /* Use viewport units for proper sizing */
    width: 100%;
}

/* Top Header - MUST scroll with content, never sticky */
.top-header,
header.top-header,
#topHeader,
header#topHeader,
body > header.top-header,
body > #topHeader {
    background-color: var(--apple-white) !important;
    border-bottom: 1px solid var(--apple-border) !important;
    position: static !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    z-index: 1000 !important;
    padding: 0 !important;
    padding-left: max(20px, env(safe-area-inset-left)) !important;
    padding-right: max(20px, env(safe-area-inset-right)) !important;
    padding-top: env(safe-area-inset-top) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    transform: none !important;
    -webkit-transform: none !important;
    will-change: auto !important;
    contain: none !important;
    width: 100% !important;
    margin: 0 !important;
    /* Header is a flex item but should scroll naturally with content */
    flex: 0 0 auto !important;
    flex-shrink: 0 !important;
    align-self: stretch !important;
    order: -1 !important;
    /* Key: ensure it has natural height and isn't constrained */
    height: auto !important;
    max-height: none !important;
    min-height: auto !important;
}

/* iOS-specific: Additional enforcement to ensure header scrolls */
@supports (-webkit-touch-callout: none) {
    .top-header,
    header.top-header,
    #topHeader,
    header#topHeader,
    body > header.top-header,
    body > #topHeader {
        /* Force static positioning on iOS with extra specificity */
        position: static !important;
        /* Ensure it's not treated as sticky by iOS Safari */
        -webkit-position: static !important;
        /* Remove any transform that might keep it visible */
        transform: none !important;
        -webkit-transform: none !important;
        /* Ensure it's in normal document flow */
        will-change: auto !important;
        contain: none !important;
        /* On iOS, also ensure it's not constrained by flex */
        flex: 0 0 auto !important;
    }
    
    /* iOS Standalone mode: More aggressive enforcement */
    body.standalone-mode .top-header,
    body.standalone-mode header.top-header,
    body.standalone-mode #topHeader,
    body.standalone-mode header#topHeader {
        /* On iOS standalone, keep as flex item but ensure it scrolls */
        position: static !important;
        /* Keep as flex item but don't allow it to shrink */
        flex: 0 0 auto !important;
        flex-shrink: 0 !important;
        align-self: stretch !important;
        order: -1 !important;
        /* Ensure it's in normal document flow and scrolls */
        width: 100% !important;
        /* Force it to scroll with content */
        transform: none !important;
        -webkit-transform: none !important;
        will-change: auto !important;
        contain: none !important;
    }
}

.top-header.scrolled {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    /* Use transform to hide without layout shift - keep height to prevent jump */
    transform: translateY(-100%) !important;
    -webkit-transform: translateY(-100%) !important;
    /* Don't collapse height - keep it to prevent layout shift */
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
    overflow: hidden !important;
    /* Keep margins/padding to maintain space */
    margin: 0 !important;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
                visibility 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* iOS Standalone: Use same smooth transition as desktop */
@supports (-webkit-touch-callout: none) {
    body.standalone-mode .top-header.scrolled,
    body.standalone-mode header.top-header.scrolled,
    body.standalone-mode #topHeader.scrolled,
    body.standalone-mode header#topHeader.scrolled {
        /* Use same smooth transition - don't use display:none to prevent jump */
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
        transform: translateY(-100%) !important;
        -webkit-transform: translateY(-100%) !important;
        /* Keep height to prevent layout shift */
        height: auto !important;
        min-height: auto !important;
        max-height: none !important;
        overflow: hidden !important;
        margin: 0 !important;
        transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
                    visibility 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                    transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    }
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    min-height: 54px;
    height: 54px;
    position: relative;
    display: flex;
    align-items: center;
    gap: 0;
    justify-content: flex-start;
}

.back-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    font-size: 42px;
    color: var(--apple-blue);
    text-decoration: none;
    line-height: 1;
    transition: opacity 0.2s ease;
    flex-shrink: 0;
    font-weight: 300;
    margin-left: -14px;
    margin-right: 0px;
    margin-top: -2px;
    align-self: center;
    transform: translateY(-3px);
}

.back-arrow:hover {
    opacity: 0.7;
}

.app-title {
    font-size: 34px;
    font-weight: 700;
    color: var(--apple-text);
    letter-spacing: -0.5px;
    margin: 0;
    flex: 0 1 auto;
    margin-left: 0;
    line-height: 1.2;
    display: flex;
    align-items: center;
    align-self: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    text-align: left;
}

/* Scroll Header (hidden by default, shown when scrolling) */
.scroll-header {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    background-color: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 0.5px solid var(--apple-border);
    z-index: 1001;
    padding: 10px 20px;
    padding-top: calc(10px + env(safe-area-inset-top));
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
    opacity: 0;
    visibility: hidden;
    -webkit-transform: translateY(-100%) translateZ(0);
    transform: translateY(-100%) translateZ(0);
    -webkit-transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), -webkit-transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s linear 0.3s;
    -moz-transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s linear 0.3s;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s linear 0.3s;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    box-shadow: 0 1px 10px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .scroll-header {
    background-color: rgba(0, 0, 0, 0.8);
    box-shadow: 0 1px 10px rgba(0, 0, 0, 0.5);
}

.scroll-header.visible {
    opacity: 1;
    visibility: visible;
    -webkit-transform: translateY(0) translateZ(0);
    transform: translateY(0) translateZ(0);
    /* Match the main header transition timing for smooth sync */
    -webkit-transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), -webkit-transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s linear 0s;
    -moz-transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s linear 0s;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s linear 0s;
    /* Ensure it doesn't cause layout shift */
    will-change: transform, opacity;
}

.scroll-header-content {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 44px;
    padding: 0;
}

.scroll-back-link {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 13px;
    color: var(--apple-blue);
    text-decoration: none;
    z-index: 1;
    transition: opacity 0.2s ease;
    line-height: 1;
    display: flex;
    align-items: center;
    height: 100%;
    white-space: nowrap;
    width: auto;
}

.scroll-back-link:hover {
    opacity: 0.7;
}

.scroll-header-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--apple-text);
    letter-spacing: -0.2px;
    margin: 0;
    text-align: center;
    width: 100%;
    padding: 0 80px;
    box-sizing: border-box;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    position: relative;
    z-index: 0;
}

/* Bottom Tab Bar */
.bottom-tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-top: 0.5px solid var(--apple-border);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 8px 0;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    /* Ensure tab bar is not affected by body transforms */
    will-change: transform;
    -webkit-will-change: transform;
}

/* Fix tab bar positioning in standalone mode */
.standalone-mode .bottom-tab-bar {
    bottom: 0 !important;
    position: fixed !important;
    /* Ensure it's positioned relative to viewport, not body */
    transform: translateZ(0) !important;
    -webkit-transform: translateZ(0) !important;
    /* Ensure it's always on top and visible */
    z-index: 10000 !important;
    /* Force it to stay at viewport bottom */
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    /* Ensure it's not affected by parent transforms */
    will-change: transform !important;
    -webkit-will-change: transform !important;
    /* Force hardware acceleration */
    -webkit-backface-visibility: hidden !important;
    backface-visibility: hidden !important;
    /* Ensure it's always visible */
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

[data-theme="dark"] .bottom-tab-bar {
    background-color: rgba(0, 0, 0, 0.85);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.5);
}

.tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--apple-text-light);
    padding: 4px 12px;
    min-width: 60px;
    transition: color 0.2s ease;
    position: relative;
}

.tab-item:hover {
    color: var(--apple-text);
}

.tab-item.active {
    color: var(--apple-blue);
}

.tab-icon {
    width: 24px;
    height: 24px;
    margin-bottom: 4px;
    stroke: currentColor;
    fill: none;
}

.tab-item.active .tab-icon {
    stroke: var(--apple-blue);
}

.tab-label {
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.01em;
    line-height: 1.2;
}

/* Main Content */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
    padding-bottom: calc(80px + env(safe-area-inset-bottom));
    margin-bottom: 0;
    -webkit-overflow-scrolling: touch;
    /* Fill available space in flex container to ensure body fills viewport */
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: visible;
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Ensure last section has proper spacing */
.main-content > section:last-child,
.main-content > .content-section:last-child {
    margin-bottom: 20px;
}

/* Add extra spacing after main content to prevent overlap with tab bar */
.main-content::after {
    content: '';
    display: block;
    flex-shrink: 0;
}

/* Hero Section */
.hero-section {
    margin-bottom: 40px;
}

/* iOSEmus Card */
.iosemus-card {
    background: linear-gradient(135deg, #FF8A8A 0%, #FF6B6B 50%, #E85A5A 100%) !important;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 140px;
    border-radius: 16px;
}

.iosemus-content {
    display: flex;
    align-items: center;
    gap: 30px;
    width: 100%;
    max-width: 1000px;
    padding: 16px 40px;
}

.iosemus-icon-container {
    flex-shrink: 0;
}

.iosemus-icon {
    background-color: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border: none;
}

.iosemus-info {
    flex: 1;
}

.iosemus-info .hero-title {
    font-size: 48px;
    font-weight: 300;
    margin-bottom: 16px;
    color: white;
}

.iosemus-info .hero-description {
    font-size: 20px;
    margin-bottom: 30px;
    opacity: 0.95;
    line-height: 1.5;
}

.iosemus-info .hero-subtitle {
    font-size: 18px;
    margin-bottom: 0;
    opacity: 0.9;
    line-height: 1.4;
    color: white;
}

.iosemus-stats {
    display: flex;
    gap: 40px;
    margin-top: 20px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.stat-number {
    font-size: 32px;
    font-weight: 700;
    color: white;
    line-height: 1;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 14px;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.featured-apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

/* News Section */
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.news-card {
    background-color: var(--apple-gray);
    border-radius: 16px;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 2px solid var(--news-color, #FF6B6B);
    display: flex;
    flex-direction: column;
}

.news-card-clickable {
    cursor: pointer;
}

.news-card-clickable:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.news-image {
    width: 100%;
    height: 200px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-color: var(--apple-gray);
}

.news-content {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.news-date {
    font-size: 12px;
    color: var(--apple-text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.news-title {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 8px 0;
    color: var(--apple-text);
    line-height: 1.2;
}

.news-caption {
    font-size: 14px;
    color: var(--apple-text-light);
    margin: 0;
    line-height: 1.5;
    flex: 1;
}

/* Legacy hero card styles (kept for compatibility) */
.hero-card {
    background: linear-gradient(135deg, #FF8A8A 0%, #FF6B6B 50%, #E85A5A 100%);
    border-radius: 16px;
    padding: 40px;
    color: white;
    position: relative;
    overflow: hidden;
    min-height: 400px;
    display: flex;
    flex-direction: column;
}

.hero-card.has-artwork {
    background: transparent;
    padding: 0;
}

/* Darkening overlay for hero cards with artwork */
.hero-card.has-artwork::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, rgba(0,0,0,0.3) 0%, rgba(0,0,0,0.6) 100%);
    z-index: 1;
    border-radius: 16px;
    pointer-events: none;
}

.hero-card.has-artwork .hero-content {
    position: relative;
    z-index: 2;
    padding: 40px;
    background: transparent;
}

/* Artwork Container */
.artwork-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    border-radius: 16px;
    overflow: hidden;
}

.artwork-container.landscape {
    aspect-ratio: 16 / 9;
}

.artwork-component {
    width: 100%;
    height: 100%;
    position: relative;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-color: var(--apple-gray);
}

.artwork-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

.artwork-image.loaded {
    opacity: 1;
}

.artwork-component picture {
    width: 100%;
    height: 100%;
    display: block;
}

.hero-badge {
    display: inline-block;
    background-color: rgba(255, 255, 255, 0.2);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 16px;
}

.hero-title {
    font-size: 48px;
    font-weight: 700;
    margin-bottom: 12px;
    line-height: 1.1;
}

.hero-description {
    font-size: 20px;
    margin-bottom: 30px;
    opacity: 0.9;
}

.hero-app-card {
    display: flex;
    align-items: center;
    gap: 20px;
    background-color: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    padding: 20px;
    border-radius: 12px;
    max-width: 500px;
}

/* New Apple App Store "Today" Style Hero Card */
.hero-card-today {
    position: relative;
    border-radius: 20px;
    overflow: visible;
    min-height: 500px;
    background-color: var(--card-color, #FF6B6B);
    color: white;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border: 4px solid var(--card-color, #FF6B6B);
    padding: 0;
}

/* Artwork background that fades into card color */
.hero-artwork-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
    overflow: hidden;
    border-radius: 16px;
}

.hero-artwork-image {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
}

/* Fade from image to card color */
.hero-artwork-image::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, 
        transparent 0%, 
        transparent 40%, 
        var(--card-color, #FF6B6B) 100%);
    z-index: 1;
}

/* Darkening overlay - increased darkness */
.hero-artwork-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, 
        rgba(0, 0, 0, 0.4) 0%, 
        rgba(0, 0, 0, 0.6) 100%);
    z-index: 2;
    pointer-events: none;
    border-radius: 16px;
}

/* Content overlay */
.hero-content-today {
    position: relative;
    z-index: 3;
    padding: 40px;
    padding-top: 60px;
    padding-bottom: 40px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    flex: 1;
    min-height: 500px;
    border-radius: 16px;
    overflow: hidden;
}

/* Badge in top left - positioned absolutely to attach to border */
.hero-badge-today {
    position: absolute;
    top: -4px;
    left: -4px;
    display: inline-block;
    background-color: var(--card-color, #FF6B6B);
    padding: 8px 16px;
    border-radius: 0 0 12px 0;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 4;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Text content wrapper - positioned above app section */
.hero-text-content {
    margin-bottom: 24px;
    flex-shrink: 0;
}

/* Subtitle (smaller text above headline) */
.hero-subtitle-today {
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    opacity: 0.9;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

/* Headline (main large text) */
.hero-headline-today {
    font-size: 42px;
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 0;
    margin-top: 0;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
}

/* App section at bottom */
.hero-app-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--card-color, #FF6B6B);
    padding: 16px 20px;
    border-radius: 16px;
    margin-top: 0;
    gap: 16px;
    flex-shrink: 0;
}

.hero-app-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.hero-app-info .app-icon {
    width: 60px;
    height: 60px;
    flex-shrink: 0;
    background-color: transparent;
}

.hero-app-info .app-icon img {
    border-radius: 14px;
    background-color: transparent;
}

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

.hero-app-name {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 4px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hero-app-description {
    font-size: 13px;
    margin: 0;
    opacity: 0.9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hero-view-button {
    padding: 10px 20px;
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
    flex-shrink: 0;
    backdrop-filter: blur(10px);
}

.hero-view-button:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

.hero-view-button:active {
    transform: scale(0.98);
}

.app-icon {
    width: 80px;
    height: 80px;
    border-radius: 18px;
    background-color: var(--apple-gray);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    position: relative;
}

.app-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 18px;
    border: none;
    outline: none;
    display: block;
}

.app-icon.large {
    width: 100px;
    height: 100px;
    border-radius: 22px;
}

.app-icon.large img {
    border-radius: 22px;
    border: none;
    outline: none;
}

.app-icon.small {
    width: 60px;
    height: 60px;
    border-radius: 14px;
}

.app-icon.small img {
    border-radius: 14px;
    border: none;
    outline: none;
}

.app-info h3 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
}

.app-info p {
    font-size: 16px;
    opacity: 0.9;
    margin-bottom: 12px;
}

.view-button {
    background-color: var(--apple-blue);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

.view-button:hover {
    background-color: #FF6B6B;
}

/* Content Sections */
.content-section {
    margin-bottom: 80px;
}

.app-description {
    color: var(--apple-text);
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.app-description br {
    display: block;
    content: "";
    margin-top: 0.5em;
}

.section-header {
    margin-bottom: 30px;
}

.section-badge {
    display: inline-block;
    color: var(--apple-blue);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.section-title {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 12px;
    line-height: 1.2;
}

.section-title-main {
    font-size: 40px;
    font-weight: 700;
    margin-bottom: 8px;
    line-height: 1.2;
}

.section-subtitle {
    font-size: 20px;
    color: var(--apple-text-light);
    margin-bottom: 30px;
}

.section-description {
    font-size: 18px;
    color: var(--apple-text-light);
    margin-bottom: 20px;
}

/* App Cards */
.app-card-large {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 24px;
    background-color: var(--apple-gray);
    border-radius: 16px;
    margin-top: 20px;
}

.app-card-small {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0;
}

.app-details h3,
.app-details h4 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 4px;
}

.app-details p {
    font-size: 14px;
    color: var(--apple-text-light);
    margin-bottom: 12px;
}

.app-info-small h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 2px;
}

.app-info-small p {
    font-size: 13px;
    color: var(--apple-text-light);
}

/* Events Grid */
.events-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    margin-top: 30px;
}

.event-card {
    background-color: var(--apple-gray);
    border-radius: 16px;
    padding: 24px;
    position: relative;
    overflow: hidden;
    min-height: 300px;
}

.event-card.has-artwork {
    background: transparent;
    padding: 0;
}

.event-card.has-artwork .event-content {
    position: relative;
    z-index: 2;
    padding: 24px;
    background: linear-gradient(to bottom, rgba(0,0,0,0.2) 0%, rgba(0,0,0,0.5) 100%);
    border-radius: 16px;
    color: white;
}

.event-card.has-artwork .event-content h3,
.event-card.has-artwork .event-content p,
.event-card.has-artwork .event-content .app-info-small h4,
.event-card.has-artwork .event-content .app-info-small p {
    color: white;
}

.event-card.has-artwork .artwork-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
    border-radius: 16px;
    overflow: hidden;
}

.event-card.has-artwork .artwork-component {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.event-card.has-artwork .artwork-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.event-badge {
    display: inline-block;
    background-color: var(--apple-blue);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.event-badge.rated {
    background-color: #FF3B30;
}

.event-card h3 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
    line-height: 1.3;
}

.event-card p {
    font-size: 16px;
    color: var(--apple-text-light);
    margin-bottom: 16px;
}

/* Arcade Section */
.arcade-section {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border-radius: 16px;
    padding: 40px;
    color: white;
}

.arcade-badge {
    display: inline-block;
    background-color: rgba(255, 255, 255, 0.2);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 16px;
}

.arcade-section .section-title-main,
.arcade-section .section-subtitle {
    color: white;
}

.arcade-feature {
    margin-bottom: 40px;
}

.arcade-feature h3 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 20px;
}

.arcade-feature .app-card-large {
    background-color: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
}

.collection-section {
    margin-top: 40px;
}

.collection-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 20px;
    color: white;
}

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

.app-tile {
    text-align: center;
    padding: 16px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}

.app-tile:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.app-tile .app-icon {
    margin: 0 auto 12px;
}

.app-tile h4 {
    font-size: 14px;
    font-weight: 600;
    color: white;
}

/* Apps Collection */
.apps-collection {
    display: grid;
    gap: 40px;
    margin-top: 30px;
}

.collection-item {
    padding: 24px;
    background-color: var(--apple-gray);
    border-radius: 16px;
}

.collection-badge {
    display: inline-block;
    color: var(--apple-blue);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.collection-item h3 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 16px;
}

.apps-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.apps-row .app-tile {
    background-color: var(--apple-white);
    min-width: 120px;
}

.apps-row .app-tile h4 {
    color: var(--apple-text);
}

/* Editors Favorites */
.editors-favorites {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    margin-top: 30px;
}

.favorite-card {
    background-color: var(--apple-gray);
    border-radius: 16px;
    padding: 24px;
}

.favorite-badge {
    display: inline-block;
    background-color: var(--apple-blue);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.favorite-card h3 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 16px;
    line-height: 1.4;
}

/* Highlights Grid */
.highlights-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    margin-top: 30px;
}

.highlight-card {
    background-color: var(--apple-gray);
    border-radius: 16px;
    padding: 24px;
}

.highlight-badge {
    display: inline-block;
    background-color: var(--apple-blue);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.highlight-badge.limited {
    background-color: #FF9500;
}

.highlight-card h3 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
    line-height: 1.3;
}

.highlight-card p {
    font-size: 16px;
    color: var(--apple-text-light);
    margin-bottom: 16px;
}

/* Hot This Week */
.hot-week-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    margin-top: 30px;
}

.hot-card {
    background-color: var(--apple-gray);
    border-radius: 16px;
    padding: 24px;
}

.hot-badge {
    display: inline-block;
    background-color: var(--apple-blue);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.hot-badge.limited {
    background-color: #FF9500;
}

.hot-card h3 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
    line-height: 1.3;
}

.hot-card p {
    font-size: 16px;
    color: var(--apple-text-light);
    margin-bottom: 16px;
}

/* Featured Grid */
.featured-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    margin-top: 30px;
}

.featured-card {
    background-color: var(--apple-gray);
    border-radius: 16px;
    padding: 24px;
}

.featured-badge {
    display: inline-block;
    color: var(--apple-blue);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.featured-card h3 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
    line-height: 1.3;
}

.featured-card p {
    font-size: 16px;
    color: var(--apple-text-light);
    margin-bottom: 16px;
}

/* Breadcrumb */
.breadcrumb {
    margin-bottom: 20px;
    font-size: 14px;
    color: var(--apple-text-light);
}

.breadcrumb a {
    color: var(--apple-blue);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.breadcrumb span {
    color: var(--apple-text-light);
}

/* Footer */

/* Games Page Specific Styles */
.category-tabs {
    display: flex;
    gap: 20px;
    margin-bottom: 40px;
    overflow-x: auto;
    padding-bottom: 12px;
    -webkit-overflow-scrolling: touch;
}

.category-tab {
    padding: 8px 16px;
    background-color: var(--apple-gray);
    border: none;
    border-radius: 20px;
    font-size: 15px;
    font-weight: 500;
    color: var(--apple-text);
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.2s;
}

.category-tab:hover {
    background-color: var(--apple-border);
}

.category-tab.active {
    background-color: var(--apple-text);
    color: white;
}

[data-theme="dark"] .category-tab.active {
    background-color: var(--apple-blue);
    color: white;
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.game-card {
    background-color: var(--apple-gray);
    border-radius: 16px;
    padding: 16px;
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}

.game-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.game-card .app-icon {
    margin: 0 auto 12px;
}

.game-card h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.game-card p {
    font-size: 13px;
    color: var(--apple-text-light);
}

/* Apps Page Specific Styles */
.apps-category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.category-card {
    background-color: var(--apple-gray);
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    text-decoration: none;
    color: var(--apple-text);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: block;
    min-width: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.category-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.category-card-icon {
    font-size: 48px;
    margin-bottom: 12px;
    line-height: 1;
}

.category-card h3 {
    font-size: 18px;
    font-weight: 600;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    line-height: 1.3;
    margin: 0;
}

/* App Detail Page */
.app-detail-header {
    margin-bottom: 40px;
    background-color: var(--apple-gray);
    border-radius: 16px;
    overflow: visible;
    position: relative;
    padding: 20px;
    min-height: 200px;
}

.app-detail-header-image {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 120px;
    overflow: hidden;
    background-color: var(--apple-gray);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px 16px 0 0;
    z-index: 0;
}

.app-detail-header-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

.app-detail-header-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    z-index: 1;
    padding-top: 0;
    width: 100%;
    box-sizing: border-box;
    gap: 12px;
}

.app-detail-header.has-header-image .app-detail-header-content {
    padding-top: 60px;
}

.app-detail-icon-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
    z-index: 2;
}

.app-detail-header.has-header-image .app-detail-icon-wrapper {
    margin-top: -40px;
}

.app-detail-info {
    flex: 1;
    min-width: 0;
    overflow-wrap: break-word;
    word-wrap: break-word;
    max-width: 100%;
    box-sizing: border-box;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 0 16px;
}

.app-detail-info > * {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.app-detail-info h1 {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 8px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    line-height: 1.2;
    width: 100%;
    max-width: 100%;
    white-space: normal;
    overflow: visible;
}

.app-developer {
    font-size: 18px;
    color: var(--apple-text-light);
    margin-bottom: 16px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    line-height: 1.3;
}

.app-meta {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    align-items: center;
}

.app-price {
    font-size: 20px;
    font-weight: 600;
    color: var(--apple-text);
}

.app-rating {
    font-size: 16px;
    color: var(--apple-text-light);
}

.app-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap;
    width: 100%;
    max-width: 100%;
}

.install-button {
    background-color: var(--apple-blue);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 20px;
    font-size: 16px;
    font-weight: 600;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: background-color 0.2s;
    flex: 1;
    min-width: 0;
    text-align: center;
    white-space: nowrap;
}

.install-button:hover:not(:disabled) {
    background-color: #FF6B6B;
}

.install-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: var(--apple-blue);
}

/* More Options Button and Dropdown */
.more-options-wrapper {
    position: relative;
    display: inline-block;
    flex-shrink: 0;
}

.more-options-button {
    background-color: var(--apple-gray);
    color: var(--apple-text);
    border: 1px solid var(--apple-border);
    padding: 12px;
    border-radius: 20px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
    width: 44px;
    height: 44px;
    -webkit-tap-highlight-color: transparent;
}

.more-options-button:hover {
    background-color: var(--apple-hover);
}

.more-options-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background-color: var(--apple-white);
    border: 1px solid var(--apple-border);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 220px;
    z-index: 1000;
    display: none;
    overflow: hidden;
}

.more-options-dropdown.show {
    display: block;
}

.dropdown-item {
    display: block;
    width: 100%;
    padding: 12px 16px;
    text-align: left;
    background: none;
    border: none;
    color: var(--apple-text);
    font-size: 15px;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.dropdown-item:hover {
    background-color: var(--apple-gray);
}

.dropdown-item:not(:last-child) {
    border-bottom: 0.5px solid var(--apple-border);
}

/* Version selector specific styles */
.dropdown-header {
    font-weight: 600;
    color: var(--apple-text-light);
    font-size: 14px;
    padding: 8px 16px;
    cursor: default;
    border-bottom: none !important;
}

.dropdown-header:hover {
    background-color: transparent;
}

.dropdown-divider {
    height: 1px;
    background-color: var(--apple-border);
    margin: 4px 0;
    border: none;
    padding: 0;
}

.version-selector {
    max-height: 200px;
    overflow-y: auto;
}

.version-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 10px 16px;
    border-bottom: 0.5px solid var(--apple-border);
}

.version-item:last-child {
    border-bottom: none;
}

.version-item.selected {
    background-color: var(--apple-blue);
    color: white;
}

.version-item.selected:hover {
    background-color: var(--apple-blue);
}

.version-label {
    font-weight: 500;
    font-size: 15px;
}

.version-date {
    font-size: 12px;
    color: var(--apple-text-light);
    opacity: 0.8;
}

.version-item.selected .version-date {
    color: rgba(255, 255, 255, 0.9);
}

[data-theme="dark"] .dropdown-item {
    color: var(--apple-text-dark);
}

[data-theme="dark"] .dropdown-item:hover {
    background-color: var(--apple-hover-dark);
}

[data-theme="dark"] .dropdown-header {
    color: var(--apple-text-light-dark);
}

[data-theme="dark"] .version-item.selected {
    background-color: var(--apple-blue);
}

[data-theme="dark"] .version-date {
    color: var(--apple-text-light-dark);
}

[data-theme="dark"] .dropdown-header {
    color: var(--apple-text-light-dark);
}

[data-theme="dark"] .version-item.selected {
    background-color: var(--apple-blue);
}

[data-theme="dark"] .version-date {
    color: var(--apple-text-light-dark);
}

[data-theme="dark"] .more-options-dropdown {
    background-color: var(--apple-gray);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.screenshots-container {
    margin-top: 20px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: 8px;
}

.screenshots-container::-webkit-scrollbar {
    display: none;
}

.screenshots-scroll {
    display: flex;
    gap: 12px;
    padding-right: 20px;
    min-width: max-content;
}

.screenshot-item {
    border-radius: 12px;
    overflow: hidden;
    background-color: var(--apple-gray);
    aspect-ratio: 9/16;
    width: 200px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}

.screenshot-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.screenshot-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: none;
    outline: none;
    display: block;
    border-radius: 12px;
}

[data-theme="dark"] .screenshot-item {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .screenshot-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

/* Screenshot Viewer Modal */
/* DNS Profile Modal */
.dns-profile-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 10001;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    padding-top: max(20px, env(safe-area-inset-top));
    padding-bottom: max(20px, env(safe-area-inset-bottom));
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
}

.dns-profile-modal-content {
    background-color: var(--apple-white);
    border-radius: 20px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    -webkit-overflow-scrolling: touch;
}

[data-theme="dark"] .dns-profile-modal-content {
    background-color: var(--apple-gray);
}

.dns-profile-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border: none;
    background-color: var(--apple-gray);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--apple-text);
    z-index: 10;
    transition: background-color 0.2s;
}

[data-theme="dark"] .dns-profile-modal-close {
    background-color: var(--apple-hover);
}

.dns-profile-modal-close:hover {
    background-color: var(--apple-border);
}

.dns-profile-modal-close svg {
    width: 18px;
    height: 18px;
}

.dns-profile-modal-header {
    padding: 24px 24px 16px;
    border-bottom: 0.5px solid var(--apple-border);
}

.dns-profile-modal-header h2 {
    font-size: 22px;
    font-weight: 600;
    color: var(--apple-text);
    margin: 0;
}

.dns-profile-modal-body {
    padding: 24px;
}

.dns-profile-modal-body p {
    font-size: 15px;
    line-height: 1.5;
    color: var(--apple-text);
    margin-bottom: 16px;
}

.dns-profile-instructions {
    background-color: var(--apple-gray);
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
}

[data-theme="dark"] .dns-profile-instructions {
    background-color: var(--apple-hover);
}

.dns-profile-instructions ol {
    margin: 0;
    padding-left: 20px;
    color: var(--apple-text);
}

.dns-profile-instructions li {
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 12px;
}

.dns-profile-instructions li:last-child {
    margin-bottom: 0;
}

.dns-profile-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

.dns-profile-download-button {
    display: block;
    width: 100%;
    padding: 14px 24px;
    background-color: var(--apple-blue);
    color: white;
    text-align: center;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    transition: opacity 0.2s, transform 0.2s, background-color 0.2s;
    -webkit-tap-highlight-color: transparent;
    border: none;
    cursor: pointer;
}

.dns-profile-download-button:hover {
    background-color: #FF6B6B;
}

.dns-profile-download-button:active {
    opacity: 0.8;
    transform: scale(0.98);
}

.dns-profile-continue-button {
    display: block;
    width: 100%;
    padding: 14px 24px;
    background-color: var(--apple-gray);
    color: var(--apple-text);
    text-align: center;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    transition: background-color 0.2s ease, transform 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.dns-profile-continue-button:hover {
    background-color: var(--apple-hover);
}

.dns-profile-continue-button:active {
    transform: scale(0.98);
}

[data-theme="dark"] .dns-profile-continue-button {
    background-color: var(--apple-gray-dark);
    color: var(--apple-text);
}

[data-theme="dark"] .dns-profile-continue-button:hover {
    background-color: var(--apple-hover-dark);
}

.screenshot-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    padding: 20px;
    padding-top: calc(20px + env(safe-area-inset-top));
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
}

.screenshot-modal.show {
    opacity: 1;
    visibility: visible;
}

.screenshot-modal-content {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.screenshot-modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    z-index: 10001;
    transition: background-color 0.2s ease, transform 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.screenshot-modal-close:hover {
    background-color: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
}

.screenshot-modal-image-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
}

.screenshot-modal-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 12px;
    transition: transform 0.1s ease-out;
    transform-origin: center center;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    -webkit-user-drag: none;
    touch-action: none;
    -webkit-touch-callout: none;
}

.screenshot-modal-image:active {
    cursor: grabbing;
    transition: none;
}

.screenshot-modal-controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 12px;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 8px 16px;
    border-radius: 24px;
    z-index: 10001;
}

.screenshot-zoom-btn {
    background: none;
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
    transition: background-color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.screenshot-zoom-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

@media (max-width: 768px) {
    .screenshot-modal-content {
        max-width: 100vw;
        max-height: 100vh;
    }
    
    .screenshot-modal {
        padding: 10px;
        padding-top: calc(10px + env(safe-area-inset-top));
        padding-bottom: calc(10px + env(safe-area-inset-bottom));
    }
    
    .screenshot-modal-close {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
    }
    
    .screenshot-modal-controls {
        bottom: 10px;
        padding: 6px 12px;
    }
    
    .screenshot-zoom-btn {
        width: 36px;
        height: 36px;
    }
}

.app-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.info-item {
    padding: 12px;
    background-color: var(--apple-gray);
    border-radius: 8px;
}

.info-item strong {
    display: block;
    margin-bottom: 4px;
    color: var(--apple-text-light);
    font-size: 14px;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .main-content {
        padding: 30px 20px;
    }

    .hero-title {
        font-size: 40px;
    }

    .events-grid,
    .highlights-grid,
    .hot-week-grid,
    .featured-grid,
    .editors-favorites {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
}

@media (max-width: 768px) {
    .app-title {
        font-size: 28px;
    }

    .top-header {
        position: static !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        padding-left: max(20px, env(safe-area-inset-left));
        padding-right: max(20px, env(safe-area-inset-right));
        padding-top: env(safe-area-inset-top);
    }
    
    .header-container {
        padding: 0 20px;
        height: 54px;
    }
    
    .scroll-header {
        padding-left: max(20px, env(safe-area-inset-left));
        padding-right: max(20px, env(safe-area-inset-right));
        padding-top: calc(8px + env(safe-area-inset-top));
    }
    
    .back-arrow {
        width: 36px;
        height: 36px;
        font-size: 42px;
        margin-left: -14px;
        margin-right: 0px;
        align-self: center;
    }
    
    .header-container {
        gap: 0;
    }
    
    .scroll-header-title {
        padding: 0 70px;
    }

    .top-header.scrolled .header-container {
        padding: 8px 0;
    }

    .scroll-header {
        padding: 8px 16px;
        padding-top: calc(8px + env(safe-area-inset-top));
    }

    .main-content {
        padding: 20px 16px;
    }

    .hero-card {
        padding: 30px 20px;
        min-height: 300px;
    }

    .hero-card.has-artwork .hero-content {
        padding: 30px 20px;
    }
    
    .hero-card-today {
        min-height: 400px;
        border-radius: 16px;
        border-width: 3px;
    }
    
    .hero-content-today {
        padding: 30px 20px;
        min-height: 400px;
    }
    
    .hero-headline-today {
        font-size: 32px;
    }
    
    .hero-subtitle-today {
        font-size: 12px;
    }
    
    .hero-badge-today {
        top: -3px;
        left: -3px;
        padding: 6px 14px;
        font-size: 11px;
        border-radius: 0 0 10px 0;
    }
    
    .hero-text-content {
        margin-bottom: 20px;
    }
    
    .hero-app-section {
        padding: 14px 16px;
        border-radius: 14px;
    }
    
    .hero-app-info .app-icon {
        width: 50px;
        height: 50px;
    }
    
    .hero-app-name {
        font-size: 14px;
    }
    
    .hero-app-description {
        font-size: 12px;
    }
    
    .hero-view-button {
        padding: 8px 16px;
        font-size: 13px;
    }

    .iosemus-content {
        flex-direction: column;
        text-align: center;
        gap: 16px;
        padding: 16px;
    }

    .iosemus-info .hero-title {
        font-size: 36px;
    }

    .iosemus-info .hero-description {
        font-size: 18px;
    }

    .iosemus-info .hero-subtitle {
        font-size: 16px;
    }

    .iosemus-stats {
        justify-content: center;
        gap: 30px;
    }

    .featured-apps-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 16px;
    }
    
    .news-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 16px;
    }
    
    .news-image {
        height: 180px;
    }
    
    .news-title {
        font-size: 18px;
    }

    .hero-title {
        font-size: 32px;
    }

    .hero-description {
        font-size: 16px;
    }

    .hero-app-card {
        flex-direction: column;
        text-align: center;
        padding: 16px;
    }

    .section-title-main {
        font-size: 28px;
    }

    .section-subtitle {
        font-size: 16px;
    }

    .events-grid,
    .highlights-grid,
    .hot-week-grid,
    .featured-grid,
    .editors-favorites {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .apps-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 12px;
    }

    .app-card-large {
        flex-direction: column;
        text-align: center;
        padding: 20px;
    }

    .arcade-section {
        padding: 24px;
    }

    .arcade-feature h3 {
        font-size: 24px;
    }

    .category-tabs {
        gap: 12px;
        padding-bottom: 8px;
    }

    .category-tab {
        font-size: 14px;
        padding: 6px 14px;
    }

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

    .apps-category-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    .category-card {
        padding: 20px 16px;
    }

    .category-card-icon {
        font-size: 40px;
        margin-bottom: 10px;
    }

    .category-card h3 {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .top-header {
        position: static !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        padding: 0;
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
        padding-top: env(safe-area-inset-top);
    }
    
    .header-container {
        padding: 0 12px;
        height: 54px;
    }

    .app-title {
        font-size: 24px;
    }
    
    .back-arrow {
        width: 32px;
        height: 32px;
        font-size: 42px;
        margin-left: -14px;
        margin-right: 0px;
        align-self: center;
    }
    
    .header-container {
        gap: 0;
    }
    
    .scroll-header-content {
        min-height: 40px;
        padding: 0;
    }
    
    .scroll-back-link {
        left: 6px;
        font-size: 12px;
    }
    
    .scroll-header-title {
        padding: 0 60px;
        max-width: calc(100% - 120px);
    }

    .tab-label {
        font-size: 9px;
    }

    .tab-icon {
        width: 22px;
        height: 22px;
    }

    .hero-card {
        padding: 24px 16px;
        min-height: 250px;
    }

    .hero-card.has-artwork .hero-content {
        padding: 24px 16px;
    }
    
    .hero-card-today {
        min-height: 350px;
        border-radius: 14px;
        border-width: 3px;
    }
    
    .hero-content-today {
        padding: 24px 16px;
        min-height: 350px;
    }
    
    .hero-headline-today {
        font-size: 28px;
    }
    
    .hero-subtitle-today {
        font-size: 11px;
    }
    
    .hero-badge-today {
        top: -3px;
        left: -3px;
        padding: 6px 12px;
        font-size: 10px;
        border-radius: 0 0 8px 0;
    }
    
    .hero-text-content {
        margin-bottom: 16px;
    }
    
    .hero-app-section {
        padding: 12px 14px;
        border-radius: 12px;
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .hero-app-info {
        width: 100%;
    }
    
    .hero-app-info .app-icon {
        width: 48px;
        height: 48px;
    }
    
    .hero-app-name {
        font-size: 13px;
    }
    
    .hero-app-description {
        font-size: 11px;
    }
    
    .hero-view-button {
        width: 100%;
        padding: 10px;
        font-size: 13px;
    }

    .event-card.has-artwork .event-content {
        padding: 20px 16px;
    }

    .iosemus-content {
        gap: 12px;
        padding: 12px;
    }

    .iosemus-info .hero-title {
        font-size: 28px;
    }

    .iosemus-info .hero-description {
        font-size: 16px;
    }

    .iosemus-info .hero-subtitle {
        font-size: 14px;
    }

    .about-icon {
        width: 60px;
        height: 60px;
        border-radius: 14px;
    }

    .iosemus-stats {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 20px;
        justify-content: center;
    }

    .stat-number {
        font-size: 24px;
    }

    .featured-apps-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 12px;
    }
    
    .news-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .news-image {
        height: 160px;
    }
    
    .news-content {
        padding: 16px;
    }
    
    .news-title {
        font-size: 16px;
    }
    
    .news-caption {
        font-size: 13px;
    }

    .hero-title {
        font-size: 24px;
    }

    .hero-description {
        font-size: 14px;
    }

    .section-title-main {
        font-size: 24px;
    }

    .section-subtitle {
        font-size: 14px;
    }

    .content-section {
        margin-bottom: 40px;
    }
    
    .app-description {
        font-size: 15px;
        line-height: 1.5;
    }


    .games-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 12px;
    }

    .apps-category-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .category-card {
        padding: 16px 12px;
    }

    .category-card-icon {
        font-size: 36px;
        margin-bottom: 8px;
    }

    .category-card h3 {
        font-size: 14px;
        line-height: 1.2;
    }

    .category-tabs {
        gap: 8px;
    }

    .category-tab {
        font-size: 13px;
        padding: 5px 12px;
    }

    .app-icon {
        width: 60px;
        height: 60px;
    }

    .app-icon.large {
        width: 80px;
        height: 80px;
    }

    .app-icon.small {
        width: 50px;
        height: 50px;
    }

    .app-detail-header-content {
        flex-direction: column;
        text-align: center;
        align-items: center;
        gap: 12px;
    }
    
    .app-detail-icon-wrapper {
        margin-bottom: 0;
    }
    
    .app-detail-info {
        width: 100%;
        align-items: center;
        text-align: center;
    }
    
    .app-actions {
        flex-wrap: wrap;
        justify-content: center;
        width: 100%;
    }
    
    .install-button {
        flex: 1;
        min-width: 0;
    }
    
    .app-detail-header-image {
        height: 100px;
    }
    
    .app-detail-header.has-header-image .app-detail-header-content {
        padding-top: 50px;
    }
    
    .app-detail-header.has-header-image .app-detail-icon-wrapper {
        margin-top: -30px;
    }

    .app-detail-info h1 {
        font-size: 28px;
    }

    .screenshot-item {
        width: 150px;
    }
    
    .screenshots-scroll {
        gap: 10px;
        padding-right: 16px;
    }
}

/* Settings Page Styles */
.settings-section {
    margin-bottom: 40px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

.settings-section-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 20px;
}

.settings-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background-color: var(--apple-gray);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
    border-radius: 12px;
    gap: 16px;
    margin-bottom: 12px;
    transition: background-color 0.2s ease;
}

.settings-item:hover {
    background-color: var(--apple-hover);
}

.settings-item-label {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.settings-item-label h3 {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--apple-text);
}

.settings-item-label p {
    font-size: 14px;
    color: var(--apple-text-light);
}

/* About Section Icons */
.about-item {
    gap: 20px;
}

.about-item-link {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.about-item-link:hover {
    text-decoration: none;
}

.about-icon {
    width: 70px;
    height: 70px;
    border-radius: 16px;
    background-color: var(--apple-gray);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.about-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 22px;
}

.certificate-settings-item {
    flex-direction: column;
    align-items: stretch;
}

.certificate-settings-item .settings-item-label {
    width: 100%;
    margin-bottom: 12px;
}

.certificate-select {
    padding: 12px 16px;
    font-size: 16px;
    font-weight: 500;
    color: var(--apple-text);
    background-color: var(--apple-gray);
    border: 1px solid var(--apple-border);
    border-radius: 12px;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
    font-family: inherit;
    width: 100%;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%2398989D' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
    margin-top: 0;
    box-sizing: border-box;
}

.certificate-select:hover {
    background-color: var(--apple-hover);
}

.certificate-select:focus {
    outline: none;
    border-color: var(--apple-blue);
    background-color: var(--apple-hover);
}

[data-theme="dark"] .certificate-select {
    background-color: var(--apple-gray-dark);
    border-color: var(--apple-border);
    color: var(--apple-text);
}

[data-theme="dark"] .certificate-select:hover {
    background-color: var(--apple-hover-dark);
}

[data-theme="dark"] .certificate-select:focus {
    border-color: var(--apple-blue);
    background-color: var(--apple-hover-dark);
}

.dns-profile-item {
    text-decoration: none;
    color: inherit;
    display: flex;
}

.dns-profile-item:hover {
    text-decoration: none;
}

.dns-profile-download-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    color: var(--apple-blue);
    transition: color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    flex-shrink: 0;
}

.dns-profile-item:hover .dns-profile-download-icon {
    color: #FF6B6B;
}

.dns-profile-download-icon svg {
    width: 24px;
    height: 24px;
}

/* Icon Selector */
.icon-selector-container {
    margin-top: 16px;
    padding: 0 20px;
}

.icon-selector-scroll {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 8px 0 16px 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

.icon-selector-scroll::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.icon-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    min-width: 80px;
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.icon-option:active {
    transform: scale(0.95);
}

.icon-option.selected {
    opacity: 1;
}

.icon-option:not(.selected) {
    opacity: 0.6;
}

.icon-option-image {
    width: 80px;
    height: 80px;
    border-radius: 18px;
    overflow: hidden;
    background-color: var(--apple-gray);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 3px solid transparent;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.icon-option.selected .icon-option-image {
    border-color: var(--apple-blue);
    box-shadow: 0 2px 12px rgba(255, 138, 138, 0.3);
}

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

.icon-option-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--apple-text);
    text-align: center;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

[data-theme="dark"] .icon-option-image {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .icon-option.selected .icon-option-image {
    box-shadow: 0 2px 12px rgba(255, 107, 107, 0.4);
}

/* Icon Confirmation Modal */
.icon-confirm-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 10001;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.icon-confirm-modal.active {
    display: flex;
}

.icon-confirm-content {
    background-color: var(--apple-white);
    border-radius: 20px;
    padding: 24px;
    max-width: 320px;
    width: 100%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    text-align: center;
}

[data-theme="dark"] .icon-confirm-content {
    background-color: var(--apple-white);
}

.icon-confirm-icon {
    width: 100px;
    height: 100px;
    border-radius: 22px;
    margin: 0 auto 20px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

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

.icon-confirm-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--apple-text);
}

.icon-confirm-message {
    font-size: 15px;
    color: var(--apple-text-light);
    margin-bottom: 24px;
    line-height: 1.5;
}

.icon-confirm-buttons {
    display: flex;
    gap: 12px;
}

.icon-confirm-button {
    flex: 1;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: opacity 0.2s ease, transform 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.icon-confirm-button:active {
    transform: scale(0.98);
}

.icon-confirm-button.cancel {
    background-color: var(--apple-gray);
    color: var(--apple-text);
}

.icon-confirm-button.cancel:hover {
    background-color: var(--apple-hover);
}

.icon-confirm-button.confirm {
    background-color: var(--apple-blue);
    color: white;
}

.icon-confirm-button.confirm:hover {
    opacity: 0.9;
}

/* Add to Home Screen Instructions */
.add-to-home-content {
    max-width: 400px;
}

.add-to-home-steps {
    margin: 20px 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.add-to-home-step {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.step-number {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: var(--apple-blue);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
}

.step-text {
    flex: 1;
    font-size: 15px;
    line-height: 1.5;
    color: var(--apple-text);
    padding-top: 2px;
}

.step-text strong {
    color: var(--apple-text);
    font-weight: 600;
}

[data-theme="dark"] .step-number {
    background-color: var(--apple-blue);
}

/* Repos Section */
.repos-list-container {
    margin: 16px 0;
}

.repo-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background-color: var(--apple-gray);
    border-radius: 12px;
    margin-bottom: 12px;
    transition: background 0.2s ease;
    position: relative;
    --repo-bg-color: var(--apple-gray);
}

.repo-item-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
    cursor: pointer;
}

[data-theme="dark"] .repo-item {
    background-color: var(--apple-hover);
    --repo-bg-color: var(--apple-hover);
}

.repo-item:hover {
    background-color: var(--apple-hover);
}

/* Tint color gradient fade effect at bottom */
.repo-item[data-tint-color] {
    background: linear-gradient(to bottom, 
        var(--repo-bg-color, var(--apple-gray)) 0%, 
        var(--repo-bg-color, var(--apple-gray)) 60%, 
        var(--repo-bg-color, var(--apple-gray)) 80%, 
        var(--tint-color-fade, transparent) 100%) !important;
}

.repo-item[data-tint-color]:hover {
    background: linear-gradient(to bottom, 
        var(--apple-hover) 0%, 
        var(--apple-hover) 60%, 
        var(--apple-hover) 80%, 
        var(--tint-color-fade-hover, transparent) 100%) !important;
}

[data-theme="dark"] .repo-item[data-tint-color] {
    --repo-bg-color: var(--apple-hover);
}


.repo-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    object-fit: cover;
    flex-shrink: 0;
}

.repo-item-details {
    flex: 1;
    min-width: 0;
}

.repo-item-details h4 {
    font-size: 17px;
    font-weight: 600;
    color: var(--apple-text);
    margin: 0 0 4px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.repo-item-details p {
    font-size: 14px;
    color: var(--apple-text-light);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.repo-url {
    font-size: 12px !important;
    color: var(--apple-text-light) !important;
    margin-top: 4px !important;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap !important;
}

.repo-remove-button {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: none;
    background-color: transparent;
    color: var(--apple-text-light);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}

.repo-remove-button:hover {
    background-color: rgba(255, 59, 48, 0.1);
    color: #FF3B30;
}

[data-theme="dark"] .repo-remove-button:hover {
    background-color: rgba(255, 59, 48, 0.2);
}

.repo-copy-toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background-color: var(--apple-text);
    color: var(--apple-white);
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 500;
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-width: calc(100vw - 20px);
    width: -moz-fit-content;
    width: -webkit-fit-content;
    width: fit-content;
    min-width: 120px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    text-align: center;
    line-height: 1.4;
    box-sizing: border-box;
}

.repo-copy-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

[data-theme="dark"] .repo-copy-toast {
    background-color: var(--apple-white);
    color: var(--apple-text);
}

.add-repo-button {
    width: 100%;
    padding: 14px 20px;
    background-color: var(--apple-gray);
    border: none;
    border-radius: 12px;
    color: var(--apple-text);
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
    margin-top: 12px;
    -webkit-tap-highlight-color: transparent;
}

[data-theme="dark"] .add-repo-button {
    background-color: var(--apple-hover);
}

.add-repo-button:hover {
    background-color: var(--apple-hover);
}

.add-repo-button:active {
    transform: scale(0.98);
}

.add-repo-button svg {
    width: 20px;
    height: 20px;
}

/* Add Source Modal Content */
.add-repo-modal-content {
    max-height: 80vh;
    max-width: 400px;
    display: flex;
    flex-direction: column;
}

/* Predefined Sources List */
.predefined-sources-list {
    max-height: 300px;
    overflow-y: auto;
    margin: 16px 0;
    padding-right: 4px;
    -webkit-overflow-scrolling: touch;
}

.predefined-sources-list::-webkit-scrollbar {
    width: 6px;
}

.predefined-sources-list::-webkit-scrollbar-track {
    background: transparent;
}

.predefined-sources-list::-webkit-scrollbar-thumb {
    background: var(--apple-border);
    border-radius: 3px;
}

[data-theme="dark"] .predefined-sources-list::-webkit-scrollbar-thumb {
    background: var(--apple-hover);
}

.predefined-source-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    margin-bottom: 8px;
    background-color: var(--apple-gray);
    border-radius: 12px;
    transition: background-color 0.2s ease;
    gap: 12px;
}

[data-theme="dark"] .predefined-source-item {
    background-color: var(--apple-hover);
}

.predefined-source-item.added {
    opacity: 0.7;
}

.predefined-source-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    overflow: hidden;
    flex-shrink: 0;
    background-color: var(--apple-white);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .predefined-source-icon {
    background-color: var(--apple-gray);
}

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

.predefined-source-info {
    flex: 1;
    min-width: 0;
    text-align: left;
}

.predefined-source-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--apple-text);
    margin: 0 0 4px 0;
}

.predefined-source-url {
    font-size: 13px;
    color: var(--apple-text-light);
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    word-break: break-word;
    line-height: 1.3em;
    max-height: 2.6em; /* Approximately 2 lines */
}

.predefined-source-status {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--apple-blue);
    font-size: 14px;
    font-weight: 500;
    flex-shrink: 0;
}

.predefined-source-status svg {
    width: 20px;
    height: 20px;
    stroke: var(--apple-blue);
}

.predefined-source-add-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: none;
    background-color: var(--apple-blue);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: opacity 0.2s ease, transform 0.2s ease;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}

.predefined-source-add-btn:hover {
    opacity: 0.9;
}

.predefined-source-add-btn:active {
    transform: scale(0.95);
}

.predefined-source-add-btn svg {
    width: 20px;
    height: 20px;
    stroke: white;
}

/* Custom Source Input Section */
.custom-repo-input-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--apple-border);
}

.repo-url-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--apple-border);
    border-radius: 10px;
    font-size: 16px;
    background-color: var(--apple-white);
    color: var(--apple-text);
    margin: 16px 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    box-sizing: border-box;
}

[data-theme="dark"] .repo-url-input {
    background-color: var(--apple-gray);
    border-color: var(--apple-border);
    color: var(--apple-text);
}

.repo-url-input:focus {
    outline: none;
    border-color: var(--apple-blue);
}

.repo-url-input::placeholder {
    color: var(--apple-text-light);
}

/* Repository Add Progress */
.repo-add-progress {
    margin: 20px 0;
    padding: 20px;
    background-color: var(--apple-gray);
    border-radius: 12px;
    text-align: center;
}

[data-theme="dark"] .repo-add-progress {
    background-color: var(--apple-hover);
}

.repo-progress-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--apple-border);
    border-top-color: var(--apple-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

.repo-progress-text {
    font-size: 16px;
    font-weight: 600;
    color: var(--apple-text);
    margin-bottom: 8px;
}

[data-theme="dark"] .repo-progress-text {
    color: var(--apple-text-dark);
}

.repo-progress-details {
    font-size: 14px;
    color: var(--apple-text-light);
    line-height: 1.4;
}

[data-theme="dark"] .repo-progress-details {
    color: var(--apple-text-light-dark);
}

/* Repository Loading Indicators on Apps Page */
.repo-loading-indicators {
    margin-bottom: 16px;
    display: none;
}

.repo-loading-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background-color: var(--apple-gray);
    border-radius: 10px;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--apple-text-light);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

[data-theme="dark"] .repo-loading-item {
    background-color: var(--apple-hover);
    color: var(--apple-text-light-dark);
}

.repo-loading-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--apple-border);
    border-top-color: var(--apple-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

.repo-loading-item.complete .repo-loading-spinner {
    animation: none;
    border-color: var(--apple-blue);
    border-top-color: var(--apple-blue);
}

.repo-loading-text {
    flex: 1;
    font-weight: 500;
}

.repo-loading-item.complete .repo-loading-text {
    color: var(--apple-blue);
}

[data-theme="dark"] .repo-loading-item.complete .repo-loading-text {
    color: var(--apple-blue);
}

/* Theme Toggle Switch */
.theme-toggle {
    position: relative;
    display: inline-block;
    width: 51px;
    height: 31px;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    cursor: pointer;
}

.theme-toggle input[type="checkbox"] {
    position: absolute;
    width: 51px;
    height: 31px;
    margin: 0;
    padding: 0;
    border: 0;
    outline: none;
    opacity: 0.01;
    z-index: 2;
    cursor: pointer;
    /* iOS Safari - remove native checkbox appearance */
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    background: transparent !important;
    /* Ensure it covers the toggle area */
    top: 0;
    left: 0;
}

.theme-toggle-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--apple-border);
    -webkit-transition: background-color 0.3s ease;
    transition: background-color 0.3s ease;
    border-radius: 31px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
    pointer-events: none;
}

.theme-toggle-slider:before {
    position: absolute;
    content: "";
    height: 27px;
    width: 27px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    -webkit-transition: -webkit-transform 0.3s ease;
    transition: transform 0.3s ease;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    -webkit-transform: translateX(0);
    transform: translateX(0);
}

.theme-toggle input:checked + .theme-toggle-slider {
    background-color: var(--apple-blue);
}

.theme-toggle input:checked + .theme-toggle-slider:before {
    -webkit-transform: translateX(20px);
    transform: translateX(20px);
}

.theme-toggle input:focus + .theme-toggle-slider {
    box-shadow: 0 0 0 3px rgba(255, 138, 138, 0.2);
}

/* Dark theme adjustments for toggle */
[data-theme="dark"] .theme-toggle-slider {
    background-color: var(--apple-border);
}

[data-theme="dark"] .theme-toggle-slider:before {
    background-color: var(--apple-text);
}

/* Dark theme adjustments for toggle */
[data-theme="dark"] .theme-toggle-slider {
    background-color: var(--apple-border);
}

[data-theme="dark"] .theme-toggle-slider:before {
    background-color: var(--apple-text);
}

/* Search Page Styles */
.search-container {
    margin-bottom: 40px;
}

.search-form {
    display: flex;
    gap: 12px;
    align-items: center;
}

.search-input-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 16px;
    color: var(--apple-text-light);
    pointer-events: none;
    z-index: 1;
}

.search-input {
    width: 100%;
    padding: 12px 16px 12px 48px;
    border: 1px solid var(--apple-border);
    border-radius: 12px;
    font-size: 16px;
    background-color: var(--apple-gray);
    color: var(--apple-text);
    -webkit-appearance: none;
    appearance: none;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--apple-blue);
    background-color: var(--apple-white);
}

.search-clear {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    color: var(--apple-text-light);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}

.search-clear:hover {
    color: var(--apple-text);
}

.search-button {
    padding: 12px 24px;
    background-color: var(--apple-blue);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.search-button:hover {
    background-color: #FF6B6B;
}

.search-results {
    margin-top: 30px;
}

.search-results-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background-color: var(--apple-gray);
    border-radius: 12px;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.search-result-item:hover {
    background-color: var(--apple-hover);
    transform: translateX(4px);
}

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

.search-result-info h3 {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--apple-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-result-developer {
    font-size: 14px;
    color: var(--apple-text-light);
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-result-genres {
    font-size: 12px;
    color: var(--apple-text-light);
}

.search-no-results {
    text-align: center;
    padding: 60px 20px;
    color: var(--apple-text-light);
}

.search-suggestions {
    margin-top: 12px;
    font-size: 14px;
}

.popular-searches {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 20px;
}

.popular-search-tag {
    padding: 8px 16px;
    background-color: var(--apple-gray);
    border-radius: 20px;
    text-decoration: none;
    color: var(--apple-text);
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.popular-search-tag:hover {
    background-color: var(--apple-hover);
}

/* Swipeable Categories */
.swipeable-categories-wrapper {
    margin-bottom: 30px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: 12px;
}

.swipeable-categories-wrapper::-webkit-scrollbar {
    display: none;
}

.swipeable-categories {
    display: flex;
    gap: 12px;
    padding: 0 20px;
    min-width: max-content;
}

.swipeable-categories .category-tab {
    white-space: nowrap;
    flex-shrink: 0;
}

/* App List Styles */
.apps-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.app-list-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background-color: var(--apple-gray);
    border-radius: 12px;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    position: relative;
    height: 90px;
    box-sizing: border-box;
}

.app-list-item:hover {
    background-color: var(--apple-hover);
    transform: translateX(4px);
}

.app-list-item.pinned {
    background-color: var(--apple-gray);
    border-left: 3px solid var(--apple-blue);
}

.pinned-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 14px;
    opacity: 0.7;
}

.beta-badge {
    display: inline-block;
    background-color: #FF9500;
    color: white;
    font-size: 9px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    line-height: 1.2;
}

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

.app-list-info .beta-badge {
    position: absolute;
    top: -2px;
    left: 0;
    z-index: 1;
}

.app-detail-header-content .beta-badge {
    position: absolute;
    top: 0px;
    right: 0px;
    z-index: 10;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 6px;
}

.app-list-info h3 {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: -2px;
    margin-top: 0;
    padding-top: 0;
    color: var(--apple-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-list-info:has(.beta-badge) h3 {
    padding-top: 12px;
}

.app-list-info p {
    font-size: 14px;
    color: var(--apple-text-light);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-repo-badge {
    position: absolute;
    bottom: 2px;
    right: 8px;
    font-size: 10px;
    color: var(--apple-text-light);
    opacity: 0.6;
    font-weight: 400;
    pointer-events: none;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-list-item.hidden {
    display: none;
}

/* Pull to Refresh Indicator */
.pull-to-refresh-indicator {
    position: fixed;
    top: calc(54px + max(0px, env(safe-area-inset-top)));
    left: 0;
    right: 0;
    width: 100%;
    z-index: 10002;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-100%);
    transition: opacity 0.3s ease, transform 0.3s ease;
    -webkit-transition: opacity 0.3s ease, -webkit-transform 0.3s ease;
}

/* Content transforms when pulling - tab bar stays fixed */
body.pull-to-refresh-active .main-content,
body.pull-to-refresh-active .top-header,
body.pull-to-refresh-active .scroll-header {
    transition: transform 0.2s ease-out;
    -webkit-transition: -webkit-transform 0.2s ease-out;
}

/* Ensure tab bar is never affected by transforms */
.bottom-tab-bar {
    transform: translateZ(0) !important;
    -webkit-transform: translateZ(0) !important;
}

.pull-to-refresh-indicator.active {
    pointer-events: auto;
}

.refresh-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--apple-border);
    border-top-color: var(--apple-blue);
    border-radius: 50%;
    margin-bottom: 8px;
    transition: transform 0.3s ease;
    -webkit-transition: -webkit-transform 0.3s ease;
}

.pull-to-refresh-indicator.loading .refresh-spinner {
    animation: spin 0.6s linear infinite;
    -webkit-animation: spin 0.6s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@-webkit-keyframes spin {
    from {
        -webkit-transform: rotate(0deg);
    }
    to {
        -webkit-transform: rotate(360deg);
    }
}

.refresh-text {
    font-size: 13px;
    font-weight: 500;
    color: var(--apple-text);
    text-align: center;
}

.pull-to-refresh-indicator.ready .refresh-text {
    color: var(--apple-blue);
}

/* Page Transition Overlay */
.page-transition-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--apple-white);
    z-index: 100000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    -webkit-transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] .page-transition-overlay {
    background-color: var(--apple-white);
}

.page-transition-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* Page content fade transition */
body.page-transitioning .main-content,
body.page-transitioning .top-header,
body.page-transitioning .scroll-header {
    transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    -webkit-transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

body.page-transitioning-out .main-content,
body.page-transitioning-out .top-header,
body.page-transitioning-out .scroll-header {
    opacity: 0;
}


.top-header,
.scroll-header,
.bottom-tab-bar {
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

/* Installation Modal */
.install-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #FFFFFF;
    color: #1D1D1F;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    padding-top: calc(20px + env(safe-area-inset-top));
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transition: background-color 0.3s ease, color 0.3s ease;
}

[data-theme="dark"] .install-modal {
    background-color: #000000;
    color: #F5F5F7;
}

.install-modal-content {
    max-width: 500px;
    width: 100%;
    text-align: center;
    padding: 40px 30px;
}

.install-modal-icon {
    width: 120px;
    height: 120px;
    margin: 0 auto 30px;
    border-radius: 26px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

[data-theme="dark"] .install-modal-icon {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

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

.change-icon-link {
    display: block;
    text-align: center;
    font-size: 12px;
    color: var(--apple-blue);
    text-decoration: none;
    margin-top: -28px;
    margin-bottom: 0px;
    padding: 8px;
    transition: opacity 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.change-icon-link:hover {
    opacity: 0.8;
}

[data-theme="dark"] .change-icon-link {
    color: var(--apple-blue);
}

.install-modal-title {
    font-size: 32px;
    font-weight: 700;
    color: #1D1D1F;
    margin-bottom: 12px;
}

[data-theme="dark"] .install-modal-title {
    color: #F5F5F7;
}

.install-modal-description {
    font-size: 18px;
    color: #86868B;
    margin-bottom: 40px;
    line-height: 1.5;
}

[data-theme="dark"] .install-modal-description {
    color: #98989D;
}

.install-steps {
    text-align: left;
    margin-bottom: 30px;
}

.install-step {
    display: flex;
    gap: 20px;
    margin-bottom: 24px;
    align-items: flex-start;
}

.step-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--apple-blue);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 600;
    flex-shrink: 0;
}

.step-content {
    flex: 1;
    padding-top: 4px;
}

.step-content p {
    font-size: 16px;
    color: #1D1D1F;
    line-height: 1.5;
    margin: 0;
}

[data-theme="dark"] .step-content p {
    color: #F5F5F7;
}

.step-content strong {
    color: var(--apple-blue);
    font-weight: 600;
}

.share-icon {
    display: inline-block;
    width: 26px;
    height: 26px;
    margin: 0;
    vertical-align: middle;
    flex-shrink: 0;
    color: var(--apple-blue);
    position: relative;
    top: -2px;
}

.install-note {
    background-color: #F5F5F7;
    border-radius: 12px;
    padding: 16px 20px;
    margin-top: 20px;
}

[data-theme="dark"] .install-note {
    background-color: #2C2C2E;
}

.install-note p {
    font-size: 14px;
    color: #86868B;
    margin: 0;
    line-height: 1.5;
}

[data-theme="dark"] .install-note p {
    color: #98989D;
}

@media (max-width: 480px) {
    .install-modal-content {
        padding: 30px 20px;
    }
    
    .install-modal-icon {
        width: 100px;
        height: 100px;
        margin-bottom: 24px;
    }
    
    .install-modal-title {
        font-size: 28px;
    }
    
    .install-modal-description {
        font-size: 16px;
        margin-bottom: 30px;
    }
    
    .install-step {
        gap: 16px;
        margin-bottom: 20px;
    }
    
    .step-number {
        width: 28px;
        height: 28px;
        font-size: 16px;
    }
    
    .step-content p {
        font-size: 15px;
    }
}

.app-card-large,
.category-card,
.game-card,
.event-card,
.featured-card,
.settings-item {
    transition: background-color 0.3s ease;
}

/* Report Modal */
.report-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    padding-top: calc(20px + env(safe-area-inset-top));
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.report-modal[style*="display: flex"] {
    opacity: 1;
}

.report-modal-content {
    background-color: var(--apple-white);
    color: var(--apple-text);
    border-radius: 20px;
    padding: 30px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.report-modal[style*="display: flex"] .report-modal-content {
    transform: scale(1);
}

[data-theme="dark"] .report-modal-content {
    background-color: var(--apple-gray);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
}

.report-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 32px;
    line-height: 1;
    color: var(--apple-text-light);
    cursor: pointer;
    padding: 5px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease, color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.report-modal-close:hover,
.report-modal-close:active {
    background-color: var(--apple-hover);
    color: var(--apple-text);
}

.report-modal-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--apple-text);
}

.report-form-group {
    margin-bottom: 20px;
}

.report-form-group label {
    display: block;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--apple-text);
}

.report-form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--apple-border);
    border-radius: 10px;
    font-size: 16px;
    font-family: inherit;
    background-color: var(--apple-white);
    color: var(--apple-text);
    resize: vertical;
    min-height: 100px;
    transition: border-color 0.2s ease;
}

.report-form-group textarea:focus {
    outline: none;
    border-color: var(--apple-blue);
}

[data-theme="dark"] .report-form-group textarea {
    background-color: var(--apple-gray);
    border-color: var(--apple-border);
}

.report-form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.report-btn-cancel,
.report-btn-submit {
    flex: 1;
    padding: 14px 24px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s ease, transform 0.1s ease;
    -webkit-tap-highlight-color: transparent;
}

.report-btn-cancel {
    background-color: var(--apple-hover);
    color: var(--apple-text);
}

.report-btn-cancel:hover,
.report-btn-cancel:active {
    opacity: 0.8;
    transform: scale(0.98);
}

.report-btn-submit {
    background-color: var(--apple-blue);
    color: #FFFFFF;
}

.report-btn-submit:hover,
.report-btn-submit:active {
    opacity: 0.9;
    transform: scale(0.98);
}

.report-btn-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* AdSense Ad Styling */
.ad-section {
    margin: 40px 0;
    padding: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Wrapper for AdSense ads - centers the 320x100 banner */
.adsense-wrapper {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 5px;
    background-color: var(--apple-gray);
    border-radius: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 110px; /* 100px ad + 10px padding */
    box-sizing: border-box;
    position: relative;
}

[data-theme="dark"] .adsense-wrapper {
    background-color: var(--apple-dark-gray);
}

/* Center the inline-block ad */
.adsense-wrapper ins.adsbygoogle {
    display: inline-block !important;
    width: 320px !important;
    height: 100px !important;
    margin: 0 auto;
}

/* AdSense responsive adjustments */
.adsense-wrapper iframe {
    border-radius: 12px;
    overflow: hidden;
}

/* Ensure ads don't break layout */
.adsense-wrapper {
    clear: both;
}

/* Ad spacing in content sections */
.content-section + .ad-section {
    margin-top: 0;
    margin-bottom: 40px;
}

/* Ad within apps list */
.ad-in-list {
    width: 100%;
    margin: 20px 0;
    padding: 0;
    clear: both;
}

.ad-in-list .adsense-wrapper {
    margin: 0;
    padding: 5px;
    border-radius: 12px;
}

/* Mobile responsive ads */
@media (max-width: 768px) {
    .adsense-wrapper {
        padding: 5px;
        min-height: 110px;
    }
    
    .adsense-wrapper ins.adsbygoogle {
        width: 320px !important;
        height: 100px !important;
    }
    
    .ad-section {
        margin: 30px 0;
    }
    
    .ad-in-list {
        margin: 16px 0;
    }
    
    .ad-in-list .adsense-wrapper {
        padding: 5px;
        min-height: 110px;
    }
}
