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

body {
    font-family: 'Open Sans', sans-serif;
    background: linear-gradient(135deg, #9CAF56, #B8C768);
    min-height: 100vh;
    color: #3C2415;
    line-height: 1.6;
}

/* Header Styles */
.header {
    text-align: center;
    padding: 30px 20px;
    background: rgba(156, 175, 86, 0.95);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    position: relative;
}

.title {
    font-family: 'Fredoka One', cursive;
    font-size: 3.5em;
    color: #F5F5DC;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.4);
    margin-bottom: 10px;
    letter-spacing: 2px;
}

.subtitle {
    font-size: 1.3em;
    color: #F5F5DC;
    font-weight: 300;
    margin-bottom: 25px;
}

/* Navigation Tabs */
.navigation-tabs {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.tab-btn {
    padding: 10px 20px;
    background: rgba(245, 245, 220, 0.9);
    border: 2px solid transparent;
    border-radius: 25px;
    color: #3C2415;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9em;
}

.tab-btn:hover {
    background: #FFB347;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 179, 71, 0.3);
}

.tab-btn.active {
    background: #FFB347;
    border-color: #F5F5DC;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 179, 71, 0.4);
}

/* Main Guide Container */
.guide-container {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
}

/* Pattern Sections */
.pattern-section {
    background: rgba(245, 245, 220, 0.95);
    border-radius: 15px;
    margin-bottom: 30px;
    padding: 30px;
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.section-title {
    font-family: 'Fredoka One', cursive;
    font-size: 2em;
    color: #9CAF56;
    text-align: center;
    margin-bottom: 25px;
    letter-spacing: 1px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

/* Cat Grids */
.cat-grid {
    display: grid;
    gap: 20px;
    justify-items: center;
}

.solid-grid, .tabby-grid {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    max-width: 900px;
    margin: 0 auto;
}

.tipped-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    max-width: 600px;
    margin: 0 auto;
}

.tortie-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    max-width: 900px;
    margin: 0 auto;
}

.points-grid {
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    max-width: 1000px;
    margin: 0 auto;
}

.spotting-grid {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    max-width: 1000px;
    margin: 0 auto;
}

/* Cat Items */
.cat-item {
    background: white;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    min-height: 180px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
}

.cat-item:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 10px 30px rgba(156, 175, 86, 0.3);
    background: rgba(255, 255, 255, 0.95);
}

.cat-image {
    width: 100px;
    height: 100px;
    object-fit: contain;
    margin: 0 auto 10px;
    border-radius: 8px;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    transition: all 0.3s ease;
    display: block;
    background-color: #f8f8f8;
}

.cat-image.loading {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    opacity: 0.7;
}

.cat-image[src=""], .cat-image:not([src]) {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    opacity: 0.7;
}

.cat-label {
    font-weight: 600;
    color: #3C2415;
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: auto;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(5px);
}

.modal.show {
    opacity: 1;
}

.modal-content {
    background: rgba(245, 245, 220, 0.98);
    margin: 2% auto;
    padding: 0;
    border-radius: 15px;
    width: 90%;
    max-width: 800px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    transform: translateY(-50px);
    transition: transform 0.3s ease;
    position: relative;
}

.modal.show .modal-content {
    transform: translateY(0);
}

.close {
    position: absolute;
    right: 15px;
    top: 10px;
    color: #3C2415;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1001;
    background: rgba(255, 255, 255, 0.8);
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.close:hover {
    background: #FFB347;
    transform: scale(1.1);
}

.modal-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    padding: 30px;
}

.modal-image {
    text-align: center;
}

.large-cat-image {
    width: 100%;
    max-width: 256px;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
    image-rendering: pixelated;
}

.modal-info h3 {
    font-family: 'Fredoka One', cursive;
    font-size: 2em;
    color: #9CAF56;
    margin-bottom: 20px;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.1);
}

.modal-info h4 {
    font-weight: 600;
    color: #3C2415;
    margin: 20px 0 10px 0;
    font-size: 1.1em;
    border-bottom: 2px solid #9CAF56;
    padding-bottom: 5px;
}

.modal-info p {
    color: #3C2415;
    line-height: 1.6;
    margin-bottom: 15px;
}

.genetics-info {
    background: rgba(156, 175, 86, 0.1);
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    border-left: 4px solid #9CAF56;
}

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

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

@keyframes bounceIn {
    0% { 
        opacity: 0;
        transform: scale(0.3);
    }
    50% { 
        opacity: 1;
        transform: scale(1.05);
    }
    70% { 
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Enhanced hover effects */
.cat-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent, rgba(255, 179, 71, 0.1), transparent);
    border-radius: 12px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.cat-item:hover::before {
    opacity: 1;
}

/* Improved accessibility */
.cat-item:focus {
    outline: 3px solid #FFB347;
    outline-offset: 2px;
}

.tab-btn:focus {
    outline: 2px solid #F5F5DC;
    outline-offset: 2px;
}

/* Error and loading states */
.cat-image.error {
    background: #f5f5f5;
    border: 2px dashed #ddd;
    color: #666;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.cat-image.error:before {
    content: "Loading...";
}

/* Responsive Design */
@media (max-width: 768px) {
    .title {
        font-size: 2.5em;
    }
    
    .subtitle {
        font-size: 1.1em;
    }

    .navigation-tabs {
        gap: 8px;
    }

    .tab-btn {
        padding: 8px 15px;
        font-size: 0.8em;
    }

    .cat-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 15px;
    }

    .cat-item {
        padding: 12px;
        min-height: 150px;
    }

    .cat-image {
        width: 80px;
        height: 80px;
    }

    .cat-label {
        font-size: 0.75em;
    }

    .modal-content {
        width: 95%;
        margin: 5% auto;
    }

    .modal-body {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 20px;
    }

    .modal-info h3 {
        font-size: 1.5em;
    }

    .section-title {
        font-size: 1.5em;
    }

    .pattern-section {
        padding: 20px;
        margin-bottom: 20px;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 20px 15px;
    }

    .navigation-tabs {
        justify-content: center;
    }

    .tab-btn {
        padding: 6px 12px;
        font-size: 0.75em;
    }

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

    .cat-image {
        width: 70px;
        height: 70px;
    }

    .guide-container {
        padding: 0 15px;
    }
}

/* Print styles */
@media print {
    .header, .navigation-tabs, .modal {
        display: none !important;
    }
    
    .guide-container {
        max-width: none;
        margin: 0;
        padding: 0;
    }
    
    .pattern-section {
        break-inside: avoid;
        margin-bottom: 20px;
        box-shadow: none;
    }
}