/* Avatar card styles - non-critical CSS moved here */
.avatar-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    aspect-ratio: 1/1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    width: 100%; /* Full width */
    max-width: 500px; /* Limit max width on larger screens */
    margin: 0 auto; /* Center the cards */
}

.avatar-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.15);
}

.avatar-card:active {
    transform: scale(0.95);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.avatar-card.rotate-animation {
    animation: rotate360 2s ease-in-out;
    transform-origin: center;
}

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

.avatar-card img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.graffiti-overlay, .celebration-overlay {
    position: absolute !important;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 10;
    overflow: visible;
}

/* Menu Grid Styles */
main.menu-grid {
    padding: 1rem;
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    padding-top: 2rem;
}

.menu-item {
    display: block;
    text-decoration: none;
    color: inherit;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    text-align: center;
    padding: 1.5rem;
}

.menu-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.15);
}

.menu-icon {
    width: 100px;
    height: 100px;
    margin: 0 auto 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.menu-icon img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.menu-item h2 {
    color: #6a11cb;
    margin: 0.5rem 0;
}

.menu-item p {
    color: #666;
    margin: 0.5rem 0;
}

.feature-placeholder {
    text-align: center;
    padding: 2rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    max-width: 600px;
    margin: 2rem auto;
}

.feature-placeholder h2 {
    color: #6a11cb;
    margin-bottom: 1rem;
}

.feature-placeholder p {
    margin-bottom: 1.5rem;
    color: #666;
}

.feature-placeholder a {
    display: inline-block;
    padding: 0.8rem 1.5rem;
    background: #6a11cb;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    transition: background 0.3s;
}

.feature-placeholder a:hover {
    background: #2575fc;
}

/* Footer styles */
footer {
    background: #333;
    color: white;
    text-align: center;
    padding: 1.5rem;
    margin-top: 2rem;
}

.footer-nav {
    margin-top: 0.5rem;
}

.footer-nav a {
    color: #ddd;
    text-decoration: none;
    margin: 0 1rem;
    font-size: 0.9rem;
}

.footer-nav a:hover {
    text-decoration: underline;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

/* Header styles */
header {
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    color: white;
    padding: 1rem;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

header h1 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

/* Common main layout */
main {
    padding: 1rem;
    max-width: 1200px;
    margin: 0 auto;
    padding-top: 2rem;
}

/* Loading indicator */
.loading {
    text-align: center;
    padding: 20px;
    font-size: 1.2rem;
    color: #666;
}

.hidden {
    display: none;
}

/* Common responsive adjustments */
@media (max-width: 768px) {
    header {
        padding: 0.8rem;
    }

    header h1 {
        font-size: 1.3rem;
    }

    main {
        padding: 0.8rem;
    }
}

/* Specific styles for Canvas page */
main.canvas-main {
    padding: 0;
    margin: 0;
    height: calc(100vh - 140px); /* Full height minus header and footer */
    display: flex;
    flex-direction: column;
}

.canvas-container {
    flex: 1;
    position: relative;
    background-color: white;
    margin: 1rem;
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    overflow: hidden;
}

#drawingCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: crosshair;
    background-color: white;
}

.download-btn {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    z-index: 10;
    padding: 0.8rem;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    transition: background 0.3s, transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.download-btn:hover {
    background: #45a049;
    transform: scale(1.05);
}

.download-btn:active {
    transform: scale(0.98);
}

/* Specific styles for Rocket page */
.rocket-body {
    overflow: hidden; /* Prevent scrolling */
    height: 100vh;
    position: relative;
}

#gameContainer {
    position: relative;
    width: 100%;
    height: calc(100vh - 140px); /* Full height minus header and footer */
    background: linear-gradient(to bottom, #87CEEB, #E0F7FA);
    overflow: hidden;
}

.rocket {
    position: absolute;
    width: 40px;
    height: 60px;
    background: #FF5722;
    border-radius: 50% 50% 0 0;
    cursor: pointer;
    z-index: 10;
    transition: transform 0.1s;
    /* Create a larger touch area */
    margin: -30px;
    padding: 30px;
}

.rocket::before {
    content: '';
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-bottom: 15px solid #E91E63;
}

.rocket::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 10px solid #FF9800;
}

.rocket:hover {
    transform: scale(1.1);
}

/* Specific styles for Color page */
.mixing-area {
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin: 2rem 0;
    flex-wrap: nowrap;
    gap: 1rem;
}

.color-placeholder {
    width: 140px;
    height: 140px;
    border: 3px dashed #ccc;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #666;
    background-color: rgba(255, 255, 255, 0.5);
    transition: all 0.3s ease;
}

.color-placeholder.filled {
    border: 3px solid #333;
    background-color: transparent;
}

.color-placeholder.drag-over {
    border: 3px solid #6a11cb;
    background-color: rgba(106, 17, 203, 0.1);
}

.mixed-color {
    width: 140px;
    height: 140px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: white;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.7);
    transition: all 0.3s ease;
}

.arrow {
    font-size: 2rem;
    color: #6a11cb;
}

/* Color grid */
.color-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-top: 2rem;
}

.color-tile {
    aspect-ratio: 1/1;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.7);
    cursor: grab;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    user-select: none;
}

.color-tile:active {
    cursor: grabbing;
}

.color-tile:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.color-name {
    background-color: rgba(0, 0, 0, 0.5);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    margin-top: 0.5rem;
}

/* Instructions */
.instructions {
    text-align: center;
    margin: 1.5rem 0;
    padding: 1rem;
    background-color: #e3f2fd;
    border-radius: 8px;
    color: #1565c0;
}

/* Clear button */
.clear-btn {
    display: block;
    margin: 1.5rem auto;
    padding: 0.8rem 1.5rem;
    background: #6a11cb;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.3s;
}

.clear-btn:hover {
    background: #5a0db9;
}

/* Responsive adjustments for Color page */
@media (max-width: 768px) {
    .mixing-area {
        flex-direction: row;
        flex-wrap: nowrap;
        justify-content: center;
        align-items: center;
        gap: 0.5rem;
    }

    .arrow {
        transform: rotate(0deg);
        font-size: 1.5rem;
    }

    .color-placeholder, .mixed-color {
        width: 100px;
        height: 100px;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .mixing-area {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 10px;
        justify-content: flex-start;
    }

    .color-placeholder, .mixed-color {
        width: 90px;
        height: 90px;
        min-width: 90px;
        font-size: 0.8rem;
    }

    .arrow {
        min-width: 30px;
        text-align: center;
    }

    .color-grid {
        gap: 0.5rem;
    }

    .color-tile {
        font-size: 0.7rem;
    }
}

/* Responsive adjustments for desktop and small mobile */
@media (min-width: 769px) {
    main {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 0.8rem;
        padding: 0.8rem;
    }

    .avatar-card {
        max-width: 120px; /* Set max width for desktop view */
    }

    main.menu-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); /* Adjust for menu items */
    }
}

@media (max-width: 480px) {
    .avatar-card {
        max-width: none; /* Remove max width constraint on mobile */
    }

    main.menu-grid {
        grid-template-columns: 1fr; /* Single column on mobile */
    }
}