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

html {
    width: 100%;
    height: 100%;
    height: -webkit-fill-available;
}

body {
    width: 100%;
    height: 100%;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background-color: #f5f5f7;
    overflow-y: auto;
    position: relative;
}

#colorDisplay {
    width: 100vw;
    height: 100vh; 
    height: 100dvh; /* Dynamic viewport height */
    height: -webkit-fill-available;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 10vw;
    font-weight: bold;
    color: white;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    display: none; /* Hidden initially */
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    overflow: hidden;
    transform: translateZ(0); /* Hardware acceleration */
    z-index: 9999;
}

/* Config Panel */
#configPanel {
    max-width: 600px;
    margin: 10px auto;
    padding: 15px;
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    box-sizing: border-box;
    height: auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.app-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
    text-align: center;
}

.app-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    margin-bottom: 5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

h1 {
    text-align: center;
    margin-bottom: 5px;
    color: #1d1d1f;
}

h2 {
    font-size: 1.2rem;
    color: #1d1d1f;
    margin-bottom: 10px;
}

.config-section {
    margin-bottom: 20px;
}

/* Color Options */
.color-options {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
}

.color-options label {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 6px;
    background-color: #f5f5f7;
    cursor: pointer;
    transition: background-color 0.2s;
}

.color-options label:hover {
    background-color: #e5e5ea;
}

/* Slider */
.slider-container {
    padding: 10px 0;
}

.slider {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: #e5e5ea;
    outline: none;
    -webkit-appearance: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #0071e3;
    cursor: pointer;
}

.slider-value {
    margin-top: 10px;
    text-align: center;
    font-size: 1rem;
    color: #1d1d1f;
}

/* Button */
#startButton {
    display: block;
    width: 100%;
    padding: 15px;
    background-color: #0071e3;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

#startButton:hover {
    background-color: #0077ED;
}

@media (max-width: 600px) {
    body {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        overflow: hidden;
        padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
        background-color: #000000;
    }
    
    #configPanel {
        margin: 0;
        padding: 10px;
        padding-top: max(10px, env(safe-area-inset-top));
        padding-bottom: max(20px, env(safe-area-inset-bottom));
        padding-left: max(10px, env(safe-area-inset-left));
        padding-right: max(10px, env(safe-area-inset-right));
        max-height: 100vh;
        overflow-y: scroll;
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        border-radius: 0;
    }
    
    .color-options {
        grid-template-columns: repeat(2, 1fr);
        gap: 5px;
    }

    .color-options label {
        padding: 6px 8px;
    }

    h1 {
        font-size: 1.4rem;
        margin-bottom: 0;
    }

    h2 {
        font-size: 1rem;
        margin-bottom: 5px;
    }

    .app-header {
        margin-bottom: 10px;
    }

    #startButton {
        padding: 12px;
        margin-bottom: 20px;
    }
}