body {
    margin: 0;
    padding: 1rem;
    background: #1a1a1a;
    font-family: Calibri, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    box-sizing: border-box;
}

/* Header */
header {
    padding: 1rem 0;
    text-align: center;
    position: relative;
    width: 100%;
    max-width: 800px;
}

h1 {
    color: #f71a6a;
    margin-bottom: 1rem;
    font-size: 2.5rem;
}

.logo {
    width: 90px;
    height: 90px;
    margin: 0 auto 1rem;
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    border-radius: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse 3s ease-in-out infinite;
}

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

.subtitle {
    font-size: 1.2rem;
    color: #ecf0f1;
    margin-bottom: 0.5rem;
    animation: slideInUp 1s ease-out 0.3s both;
}

/* Canvas Container */
#canvas-container {
    background: #ecf0f1;
    border-radius: 1%;
    overflow: hidden;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    aspect-ratio: 1 / 1;
}

/* Ensure p5.js canvas maintains aspect ratio */
#canvas-container canvas {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain;
    display: block;
}

/* Buttons & Controls */
.controls {
    margin-top: 1rem;
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    width: 100%;
    max-width: 700px;
}

button {
    padding: 0.75rem 1.5rem;
    color: #ecf0f1;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    min-width: 120px;
    transition: all 0.3s ease;
    touch-action: manipulation; /* Improves touch responsiveness */
}

#back-btn {
    color: #ecf0f1;
    background-color: transparent;
    text-decoration: none;
    margin: auto;
    position: absolute;
    font-size: 3rem;
    top: 2rem;
    left: 2rem;
    visibility: hidden;
    max-width: 2rem;
}

.regenerate-btn {
    background: #f71a6a;
}

.regenerate-btn:hover {
    background: #d1155a;
}

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

.reset-btn {
    background: #37a66c;
}

.reset-btn:hover {
    background: #2d8756;
}

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

#playBtn {
    background: #f71a6a;
}

#playBtn:hover {
    background: #d1155a;
}

#playBtn.active {
    background: #37a66c;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: white;
}

.select-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: white;
}

select {
    font-size: 1rem;
    border: none;
    border-radius: 5px;
}


/* Mobile Responsive Styles */
@media screen and (max-width: 768px) {
    body {
        padding: 15px;
    }

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

    .logo {
        width: 70px;
        height: 70px;
        margin-bottom: 0.5rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    header {
        padding: 0.5rem 0;
    }

    .controls {
        gap: 0.75rem;
        margin-top: 0.75rem;
    }

    button {
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
        min-width: 100px;
    }

    #back-btn {
        visibility: visible;
    }
}

@media screen and (max-width: 480px) {
    body {
        padding: 10px;
    }

    h1 {
        font-size: 1.5rem;
    }

    .logo {
        width: 60px;
        height: 60px;
    }

    .subtitle {
        font-size: 0.9rem;
    }

    .controls {
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
        width: 100%;
    }

    button {
        width: 100%;
        max-width: 200px;
        font-size: larger;
        padding: 1.2rem;
    }

    .slider-container {
        font-size: larger;
        padding: 1.2rem;
    }

    .select-container {
        font-size: larger;
        padding: 1.2rem;
    }

    #back-btn {
        font-size: 2rem;
        visibility: visible;
    }
}

/* Landscape orientation on mobile */
@media screen and (max-height: 500px) and (orientation: landscape) {
    body {
        padding: 10px;
    }

    header {
        padding: 0.25rem 0;
    }

    h1 {
        font-size: 1.5rem;
        margin-bottom: 0.25rem;
    }

    .logo {
        width: 50px;
        height: 50px;
        margin-bottom: 0.25rem;
    }

    .subtitle {
        font-size: 0.8rem;
        margin-bottom: 0.25rem;
    }

    .controls {
        margin-top: 0.5rem;
        flex-direction: row;
        gap: 0.5rem;
    }

    button {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
        min-width: 80px;
    }
}

/* High DPI displays */
/*@media screen and (-webkit-min-device-pixel-ratio: 2),*/
/*screen and (min-resolution: 192dpi) {*/
/*    .logo img {*/
/*        image-rendering: -webkit-optimize-contrast;*/
/*        image-rendering: crisp-edges;*/
/*    }*/
/*}*/