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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
    width: 100%;
}

/* Animated gradient background */
.gradient-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
}

.gradient-1, .gradient-2, .gradient-3 {
    position: absolute;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.gradient-1 {
    opacity: 0.8;
    animation: gradientMove 15s ease infinite;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #ff6b6b 100%);
}

.gradient-2 {
    opacity: 0.6;
    animation: gradientMove 20s ease infinite reverse;
    background: linear-gradient(135deg, #4ecdc4 0%, #556270 50%, #ff6b6b 100%);
}

.gradient-3 {
    opacity: 0.4;
    animation: gradientMove 25s ease infinite;
    background: linear-gradient(135deg, #ff6b6b 0%, #4ecdc4 50%, #667eea 100%);
}

@keyframes gradientMove {
    0% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(-5%, 5%) scale(1.05); }
    50% { transform: translate(5%, -5%) scale(1.1); }
    75% { transform: translate(-5%, -5%) scale(1.05); }
    100% { transform: translate(0, 0) scale(1); }
}

.container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 20px;
    position: relative;
    z-index: 1;
    overflow-x: hidden;
}

/* Header styles */
.header {
    text-align: center;
    margin-bottom: 50px;
    color: white;
    animation: fadeInDown 1s ease;
    width: 100%;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.logo {
    font-size: 4rem;
    margin-bottom: 20px;
    animation: bounce 2s ease infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.header h1 {
    font-size: clamp(2rem, 8vw, 3.5rem);
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    word-wrap: break-word;
}

.highlight {
    background: linear-gradient(135deg, #fff 0%, #f0f0f0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: clamp(1rem, 4vw, 1.2rem);
    opacity: 0.9;
    margin-bottom: 20px;
    padding: 0 10px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    padding: 10px 25px;
    border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    font-size: 0.95rem;
    max-width: 90%;
    margin: 0 auto;
}

.dot {
    width: 10px;
    height: 10px;
    background: #4ade80;
    border-radius: 50%;
    display: inline-block;
    animation: pulse 2s ease infinite;
    flex-shrink: 0;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2); }
}

/* Apps grid */
.apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    padding: 20px;
    animation: fadeInUp 1s ease 0.3s both;
    width: 100%;
}

/* iPhone Portrait (vertical) - Show only 1 app */
@media (max-width: 480px) and (orientation: portrait) {
    .apps-grid {
        grid-template-columns: 1fr; /* Single column */
        gap: 20px;
        padding: 10px;
    }
    
    .app-card {
        width: 100%;
        max-width: 100%;
        margin: 0 auto;
    }
    
    /* Hide all apps beyond the first one */
    .app-card:nth-child(n+2) {
        display: none;
    }
    
    /* Add a "More Apps" indicator */
    .apps-grid::after {
        content: "↓ Swipe for more apps ↓";
        display: block;
        text-align: center;
        color: rgba(255, 255, 255, 0.9);
        font-size: 1rem;
        font-weight: 500;
        padding: 15px;
        background: rgba(255, 255, 255, 0.15);
        backdrop-filter: blur(10px);
        border-radius: 30px;
        margin-top: 20px;
        animation: pulse 2s ease infinite;
        border: 1px solid rgba(255, 255, 255, 0.2);
        letter-spacing: 0.5px;
    }
}

/* iPhone Pro Max specific portrait - Show only 1 app */
@media (max-width: 428px) and (orientation: portrait) {
    .container {
        padding: 20px 10px;
    }

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

    .status-badge {
        padding: 8px 15px;
        font-size: 0.85rem;
    }

    .quick-stats {
        flex-direction: column;
        align-items: center;
        gap: 15px;
        border-radius: 30px;
        padding: 15px;
    }

    .app-card {
        aspect-ratio: auto;
        min-height: 280px;
        max-width: 100%;
    }

    .card-content {
        padding: 20px 15px;
    }

    .app-icon {
        font-size: 3rem;
        margin-bottom: 15px;
    }

    .app-title {
        font-size: 1.5rem;
    }

    .app-description {
        font-size: 0.9rem;
        margin-bottom: 15px;
    }

    .app-status {
        padding: 6px 12px;
        font-size: 0.85rem;
    }
    
    .app-status span:last-child {
        max-width: 120px;
    }
    
    /* Ensure only 1 app shows */
    .app-card:nth-child(n+2) {
        display: none;
    }
}

/* Small phones portrait - Show only 1 app */
@media (max-width: 375px) and (orientation: portrait) {
    .header h1 {
        font-size: 1.8rem;
    }

    .app-title {
        font-size: 1.3rem;
    }

    .app-icon {
        font-size: 2.5rem;
    }

    .quick-stats {
        gap: 10px;
    }

    .stat-item {
        font-size: 0.85rem;
    }

    .refresh-btn {
        padding: 12px 25px;
        font-size: 0.95rem;
    }
    
    /* Show only 1 app */
    .app-card:nth-child(n+2) {
        display: none;
    }
}

/* iPhone Landscape (horizontal) - Show all apps in 2 columns */
@media (max-width: 926px) and (orientation: landscape) {
    .container {
        padding: 20px 15px;
        max-width: 100%;
    }
    
    .apps-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
        padding: 10px;
    }
    
    .app-card {
        max-width: 100%;
        aspect-ratio: auto;
        min-height: 200px;
    }
    
    /* Show all apps in landscape */
    .app-card:nth-child(n) {
        display: flex;
    }
    
    /* Remove the "More Apps" indicator in landscape */
    .apps-grid::after {
        display: none;
    }
    
    .card-content {
        padding: 15px 10px;
    }
    
    .app-icon {
        font-size: 2.5rem;
        margin-bottom: 10px;
    }
    
    .app-title {
        font-size: 1.3rem;
        margin-bottom: 5px;
    }
    
    .app-description {
        font-size: 0.8rem;
        margin-bottom: 10px;
        line-height: 1.3;
    }
    
    .app-status {
        padding: 4px 10px;
        font-size: 0.75rem;
    }
    
    .quick-stats {
        margin: 20px 0;
        padding: 12px;
        gap: 15px;
    }
    
    .header {
        margin-bottom: 20px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .logo {
        font-size: 2.5rem;
        margin-bottom: 10px;
    }
}

/* iPad and larger tablets */
@media (min-width: 481px) and (max-width: 820px) {
    .apps-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    /* Show all apps on tablets */
    .app-card:nth-child(n) {
        display: flex;
    }
    
    .apps-grid::after {
        display: none;
    }
}

/* Desktop and larger screens */
@media (min-width: 821px) {
    .apps-grid {
        grid-template-columns: repeat(4, 1fr); /* Show all 4 apps on desktop */
    }
    
    .app-card:nth-child(n) {
        display: flex;
    }
    
    .apps-grid::after {
        display: none;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.app-card {
    text-decoration: none;
    color: inherit;
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    transition: transform 0.3s ease;
    aspect-ratio: 1 / 1.1;
    width: 100%;
    max-width: 350px;
    margin: 0 auto;
}

.app-card:hover {
    transform: translateY(-10px);
}

.card-glow {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #667eea, #764ba2, #ff6b6b);
    opacity: 0.7;
    filter: blur(20px);
    transition: opacity 0.3s ease;
}

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

.card-content {
    position: absolute;
    top: 2px;
    left: 2px;
    right: 2px;
    bottom: 2px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 18px;
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: background 0.3s ease;
}

.app-card:hover .card-content {
    background: rgba(255, 255, 255, 0.98);
}

.app-icon {
    font-size: clamp(2.5rem, 8vw, 4rem);
    margin-bottom: 20px;
    animation: float 3s ease infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.app-title {
    font-size: clamp(1.2rem, 4vw, 1.8rem);
    font-weight: bold;
    color: #333;
    margin-bottom: 10px;
    word-wrap: break-word;
    width: 100%;
}

.app-description {
    color: #666;
    font-size: clamp(0.8rem, 2.5vw, 0.95rem);
    line-height: 1.5;
    margin-bottom: 20px;
    flex-grow: 1;
    padding: 0 5px;
    width: 100%;
    word-wrap: break-word;
}

.app-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 30px;
    font-size: clamp(0.75rem, 2.5vw, 0.9rem);
    font-weight: 600;
    letter-spacing: 0.3px;
    transition: all 0.3s ease;
    max-width: 100%;
    white-space: nowrap;
}

.app-status span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.status-ready {
    background: #e8f5e9;
    color: #2e7d32;
}
.status-ready .status-dot {
    background: #2e7d32;
    animation: pulse 2s ease infinite;
}

.status-coming {
    background: #fff3e0;
    color: #ef6c00;
}
.status-coming .status-dot {
    background: #ef6c00;
}

.status-offline {
    background: #ffebee;
    color: #c62828;
}
.status-offline .status-dot {
    background: #c62828;
}

/* Quick stats */
.quick-stats {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 20px 40px;
    margin: 40px 0;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 60px;
    color: white;
    animation: fadeInUp 1s ease 0.6s both;
    width: 100%;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: clamp(0.85rem, 2.5vw, 1rem);
    flex-wrap: wrap;
    justify-content: center;
}

.stat-item i {
    font-size: 1.2rem;
    opacity: 0.9;
    flex-shrink: 0;
}

.stat-item span:last-child {
    opacity: 0.8;
}

#onlineCount, #lastCheck {
    font-weight: bold;
    font-size: clamp(1rem, 3.5vw, 1.2rem);
    margin-left: 5px;
}

/* Footer */
.footer {
    text-align: center;
    margin-top: 40px;
    animation: fadeInUp 1s ease 0.9s both;
    width: 100%;
}

.refresh-btn {
    background: white;
    color: #667eea;
    border: none;
    padding: 15px 40px;
    border-radius: 50px;
    font-size: clamp(1rem, 4vw, 1.1rem);
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 20px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    max-width: 90%;
}

.refresh-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 15px 30px rgba(0,0,0,0.3);
}

.refresh-btn i {
    transition: transform 0.5s ease;
    flex-shrink: 0;
}

.refresh-btn:hover i {
    transform: rotate(180deg);
}

.footer-text {
    color: rgba(255,255,255,0.8);
    font-size: clamp(0.8rem, 3vw, 0.9rem);
    padding: 0 10px;
}

/* Landscape mode on small phones */
@media (max-height: 500px) and (orientation: landscape) {
    .apps-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .app-card {
        aspect-ratio: auto;
        min-height: 150px;
    }
    
    /* Show all apps in landscape */
    .app-card:nth-child(n) {
        display: flex;
    }
    
    .apps-grid::after {
        display: none;
    }
    
    .card-content {
        padding: 10px;
    }
    
    .app-icon {
        font-size: 2rem;
        margin-bottom: 5px;
    }
    
    .app-title {
        font-size: 1.1rem;
    }
    
    .app-description {
        display: none;
    }
    
    .app-status {
        margin-top: 5px;
    }
    
    .quick-stats {
        flex-direction: row;
        flex-wrap: wrap;
        margin: 15px 0;
    }
}

/* Ensure no horizontal scroll on any device */
html, body {
    max-width: 100%;
    overflow-x: hidden;
    position: relative;
}

/* Add smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Better touch targets for mobile */
@media (max-width: 768px) {
    .refresh-btn,
    .app-card,
    .status-badge {
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }

    .refresh-btn:active {
        transform: scale(0.95);
    }

    .app-card:active {
        transform: scale(0.98);
    }
}
