/* NCA Evolution - Responsive Styles */

/* Hide grid controls on smaller screens */
@media (max-width: 767px) {
    .grid-control-btn {
        display: none;
    }
}

/* Mobile Portrait */
@media (max-width: 480px) {
    .app-container {
        padding: 0.75rem;
        gap: 0.6rem;
    }

    .nav-links {
        display: none;
    }

    .app-title {
        font-size: 1rem;
        letter-spacing: 0.12em;
    }

    .stat-item {
        padding: 0.35rem 0.6rem;
        font-size: 0.7rem;
    }

    .stat-label {
        font-size: 0.55rem;
    }

    .profile-bar {
        padding: 0.6rem 0.8rem;
    }

    .profile-name {
        font-size: 0.75rem;
    }

    .profile-btn {
        font-size: 0.65rem;
        padding: 0.25rem 0.5rem;
    }

    .profile-score .score-value {
        font-size: 1.2rem;
    }

    /* Leaderboard panel mobile */
    .leaderboard-panel {
        padding: 0.55rem 0.7rem;
    }

    .panel-tab {
        font-size: 0.6rem;
        padding: 0.2rem 0.4rem;
    }

    .curator-item {
        padding: 0.35rem 0.5rem;
        font-size: 0.7rem;
    }

    .instruction {
        font-size: 0.75rem;
    }

    /* Grid - single row of 3 on mobile */
    #nca-grid {
        grid-template-columns: repeat(3, 1fr);
        grid-template-rows: 1fr;
        gap: 0.5rem;
        margin-top: 50px;
    }

    .nca-cell {
        border-radius: 10px;
    }

    .nca-cell::before,
    .nca-cell::after {
        width: 8px;
        height: 8px;
    }

    .nca-cell::before {
        top: 4px;
        left: 4px;
    }

    .nca-cell::after {
        bottom: 4px;
        right: 4px;
    }

    .nca-overlay {
        padding: 0.35rem 0.5rem;
    }

    .nca-id {
        font-size: 0.55rem;
    }

    .nca-votes {
        font-size: 0.65rem;
    }

    .evolution-section {
        padding: 0.5rem 0.75rem;
    }

    .evolution-title {
        font-size: 2rem;
        letter-spacing: 0.2em;
    }

    .evolution-subtitle {
        font-size: 0.95rem;
    }

    /* Background blobs - smaller on mobile */
    .bg-blob-1 { width: 350px; height: 350px; }
    .bg-blob-2 { width: 300px; height: 300px; }
    .bg-blob-3 { width: 250px; height: 250px; }
    .bg-blob-4 { width: 180px; height: 180px; }
}

/* Very narrow screens - keep single row but smaller gaps */
@media (max-width: 320px) {
    #nca-grid {
        gap: 0.35rem;
    }
}

/* Very small screens */
@media (max-width: 360px) {
    .app-container {
        padding: 0.5rem;
    }

    .nav-back,
    .nav-forward {
        font-size: 0.65rem;
        padding: 0.3rem 0.45rem;
    }

    .nav-back-text,
    .nav-forward-text {
        display: none;
    }

    .nav-back svg,
    .nav-forward svg {
        width: 18px;
        height: 18px;
    }

    .header-stats {
        gap: 0.4rem;
    }

    .stat-item {
        padding: 0.3rem 0.5rem;
    }

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

    .profile-name {
        font-size: 0.7rem;
    }

    .evolution-title {
        font-size: 1.6rem;
    }
}

/* Landscape / Short screens */
@media (max-height: 600px) {
    .app-container {
        padding: 0.5rem;
        gap: 0.4rem;
    }

    .profile-bar {
        padding: 0.5rem 0.75rem;
    }

    .leaderboard-panel {
        padding: 0.4rem 0.6rem;
    }

    .instruction {
        display: none;
    }

    .app-footer {
        padding-top: 0.25rem;
    }

    .evolution-section {
        padding: 0.4rem 0.6rem;
    }
}

/* Very short screens (extreme landscape) */
@media (max-height: 480px) {
    .nav-back,
    .nav-forward {
        font-size: 0.65rem;
        padding: 0.25rem 0.4rem;
    }

    .nav-back-text,
    .nav-forward-text {
        display: none;
    }

    .app-header {
        display: none;
    }

    .leaderboard-panel {
        display: none;
    }

    /* In landscape, 3x2 works well - just constrain height */
    #nca-grid {
        max-height: calc(100vh - 100px);
        width: auto;
        aspect-ratio: 3 / 2;
    }

    .evolution-title {
        font-size: 1.8rem;
    }

    .evolution-dna {
        margin-bottom: 1.5rem;
        height: 60px;
    }

    .dna-strand {
        height: 50px;
    }
}

/* Tablet and up - can show more */
@media (min-width: 600px) {
    .app-container {
        padding: 1.25rem;
        gap: 0.85rem;
    }

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

    #nca-grid {
        gap: 0.8rem;
    }

    .nca-cell {
        border-radius: 16px;
    }

    .nca-cell::before,
    .nca-cell::after {
        width: 14px;
        height: 14px;
    }

    .profile-bar {
        padding: 0.85rem 1.2rem;
    }

    .profile-name {
        font-size: 1rem;
    }

    .footer-links-bottom {
        margin-top: calc(0.25rem + 16px);
    }
}

/* Large screens */
@media (min-width: 768px) and (min-height: 700px) {
    .app-container {
        max-width: 600px;
        padding: 1.5rem;
    }

    #nca-grid {
        gap: 1rem;
    }
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    .bg-blob,
    .bg-animation::before,
    .bg-animation::after,
    .app-title,
    .evolution-bar-inner,
    .evolution-title,
    .dna-strand,
    .evolution-dots span {
        animation: none !important;
    }

    .nca-cell {
        transition-duration: 0.1s;
    }
}
