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

html {
    /* Prevent zoom on double tap for iOS */
    touch-action: manipulation;
    /* Smooth scrolling */
    scroll-behavior: smooth;
    /* Improve text rendering */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    /* Safe area support for notched devices */
    padding: max(env(safe-area-inset-top), 15px) max(env(safe-area-inset-right), 15px) max(env(safe-area-inset-bottom), 15px) max(env(safe-area-inset-left), 15px);
    display: flex;
    justify-content: center;
    align-items: center;
    /* Prevent text size adjustment on orientation change */
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

.container {
    max-width: 800px;
    width: 100%;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: clamp(20px, 5vw, 50px) clamp(16px, 4vw, 40px);
    animation: fadeIn 0.6s ease-in;
}

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

h1 {
    text-align: center;
    color: #2d3748;
    font-size: clamp(1.5rem, 5vw, 2.5rem);
    margin-bottom: 10px;
    line-height: 1.2;
    word-wrap: break-word;
}

.subtitle {
    text-align: center;
    color: #718096;
    font-size: clamp(0.95rem, 3vw, 1.1rem);
    margin-bottom: clamp(25px, 5vw, 40px);
    line-height: 1.5;
}

.decorative-line {
    width: clamp(60px, 15vw, 100px);
    height: 3px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    margin: 15px auto;
    border-radius: 2px;
}

.lists-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr));
    gap: clamp(15px, 3vw, 20px);
    margin-top: clamp(25px, 5vw, 40px);
}

.list-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    /* Ensure minimum touch target size of 48x48px */
    min-height: 140px;
    padding: clamp(20px, 4vw, 30px);
    border-radius: 12px;
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
    text-decoration: none;
    color: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    /* Better tap highlight */
    -webkit-tap-highlight-color: rgba(255, 255, 255, 0.3);
    /* Prevent text selection on tap */
    -webkit-user-select: none;
    user-select: none;
    /* Improve touch responsiveness */
    touch-action: manipulation;
}

.list-card:active {
    transform: scale(0.98);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Desktop hover effects */
@media (hover: hover) and (pointer: fine) {
    .list-card:hover {
        transform: translateY(-5px);
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    }
}

.list-card h2 {
    font-size: clamp(1.1rem, 3.5vw, 1.5rem);
    margin-bottom: 8px;
    font-weight: 600;
    line-height: 1.3;
}

.list-card p {
    font-size: clamp(0.85rem, 2.5vw, 0.95rem);
    opacity: 0.95;
    line-height: 1.4;
}

.icon {
    font-size: clamp(2rem, 6vw, 2.5rem);
    margin-bottom: 12px;
    /* Prevent emoji from being selected */
    user-select: none;
}

footer {
    text-align: center;
    margin-top: clamp(30px, 6vw, 50px);
    color: #a0aec0;
    font-size: clamp(0.85rem, 2.5vw, 0.95rem);
    line-height: 1.6;
    padding-bottom: env(safe-area-inset-bottom);
}

/* Mobile-specific optimizations */
@media (max-width: 640px) {
    body {
        padding: 10px;
        /* Align to top on mobile for better content visibility */
        align-items: flex-start;
        padding-top: max(env(safe-area-inset-top), 20px);
    }

    .container {
        border-radius: 12px;
        /* Adjust vertical margin */
        margin: 10px 0;
    }

    .lists-grid {
        /* Single column on mobile for easier tapping */
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .list-card {
        /* Slightly larger touch targets on mobile */
        min-height: 120px;
        padding: 25px 20px;
    }

    footer {
        margin-top: 30px;
        padding-bottom: max(env(safe-area-inset-bottom), 15px);
    }
}

/* Tablet breakpoint */
@media (min-width: 641px) and (max-width: 1024px) {
    .lists-grid {
        grid-template-columns: repeat(auto-fill, minmax(min(45%, 280px), 1fr));
    }
}

/* Large screens */
@media (min-width: 1025px) {
    .container {
        margin: 40px auto;
    }
}

/* Landscape mobile optimization */
@media (max-width: 900px) and (orientation: landscape) {
    body {
        align-items: flex-start;
        padding: 15px;
    }

    .container {
        margin: 15px 0;
    }

    h1 {
        font-size: clamp(1.3rem, 4vw, 2rem);
        margin-bottom: 8px;
    }

    .subtitle {
        margin-bottom: 20px;
    }

    .lists-grid {
        margin-top: 20px;
        grid-template-columns: repeat(auto-fill, minmax(min(45%, 200px), 1fr));
        gap: 12px;
    }

    .list-card {
        min-height: 100px;
        padding: 15px;
    }

    .icon {
        font-size: 1.8rem;
        margin-bottom: 8px;
    }

    footer {
        margin-top: 20px;
    }
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
    transition: opacity 0.3s ease;
}

.modal-container {
    animation: modalSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalSlideIn {
    from {
        transform: scale(0.8) translateY(-50px);
        opacity: 0;
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.modal-content {
    background: white;
    border-radius: 20px;
    padding: 40px 30px;
    max-width: 400px;
    width: 100%;
    text-align: center;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
    position: relative;
}

.modal-icon {
    font-size: 3rem;
    margin-bottom: 20px;
    animation: bounce 0.6s ease 0.2s both;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

.modal-message {
    font-size: 1.2rem;
    color: #2d3748;
    margin-bottom: 30px;
    line-height: 1.5;
    font-weight: 500;
}

.modal-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 15px 30px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.modal-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.modal-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.4);
}

/* Mobile responsiveness for modal */
@media (max-width: 480px) {
    .modal-content {
        padding: 30px 25px;
        margin: 0 15px;
    }

    .modal-icon {
        font-size: 2.5rem;
        margin-bottom: 15px;
    }

    .modal-message {
        font-size: 1.1rem;
        margin-bottom: 25px;
    }

    .modal-button {
        padding: 12px 25px;
        font-size: 0.95rem;
    }
}