/* General Reset */
html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    width: 100%;
    overflow: hidden;
    background: linear-gradient(330deg, #002E12 0%, #00471D 25%, #006128 50%, #00742E 75%, #007A33 100%);
    font-family: 'Roboto', sans-serif;
    font-weight: 300;
    text-transform: uppercase;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background 0.5s ease-in-out;
}

#app-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    max-height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* WebGL Canvas fills the container */
.webgl {
    width: 100%;
    height: 100%;
    display: block;
    position: absolute;
    top: 0; left: 0;
    z-index: 1;
    background: transparent !important; /* Critical: keep canvas transparent */
    opacity: 0; /* start hidden, fade in when ready */
    transition: opacity 900ms ease-in-out;
}
#app-container.ready .webgl {
    opacity: 1;
}

/* Loader overlay */
#loader-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    /* Solid black background while loading to avoid any visible gradient behind the loader */
    background: rgba(0,0,0,1);
    z-index: 100;
    opacity: 1;
    transition: opacity 600ms ease-in-out;
}

#app-container.ready #loader-overlay {
    opacity: 0;
    pointer-events: none;
}

#loader-img {
    width: 96px;
    height: 96px;
    object-fit: contain;
    border-radius: 12px;
    animation: loaderSpin 1s linear infinite;
}

#loader-text {
    color: #fff;
    font-size: 14px;
    font-weight: 500;
}

@keyframes loaderSpin {
    to { transform: rotate(360deg); }
}

/* Loader Overlay */
/* Note: loader visibility is controlled via the .hidden and .fade-out classes.
   Do not forcibly hide the loader here. */

/* Simple Spinner */
.loader-spinner {
    border: 6px solid #444;
    border-top: 6px solid #fff;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    animation: spin 1s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Control Menu Styling */
#control-menu {
    position: fixed;
    bottom: 28px;
    left: 0;
    width: 100vw;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 18px;
    padding: 10px 0;
    z-index: 10;
    box-sizing: border-box;
    flex-wrap: wrap;
    pointer-events: auto;
}

.button-row {
    display: flex;
    flex-direction: row;
    gap: 12px;
}

.control-button {
    font-family: 'Roboto', sans-serif;
    text-transform: uppercase;
    border: none;
    cursor: pointer;
}

#playReverseBtn,
#playForwardBtn {
    min-width: 96px;
    height: 42px;
    font-size: 1em;
    background: rgba(255, 255, 255, 0.12);
    color: #FFFFFF;
    border: 1.5px solid rgba(255, 255, 255, 0.35);
    border-radius: 21px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 400;
    backdrop-filter: blur(8px);
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

#playReverseBtn:hover,
#playForwardBtn:hover {
    background: rgba(255, 255, 255, 0.22);
    transform: scale(1.05);
}

.color-picker-group {
    display: flex;
    flex-direction: row;
    gap: 16px;
    justify-content: center;
}

.color-box {
    --swatch-color: #ffffff;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: none;
    padding: 0;
    cursor: pointer;
    outline: none;
    transform: translateZ(0);
}

.color-box::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: var(--swatch-gradient, var(--swatch-color));
    background-origin: border-box;
    background-size: 130% 130%;
    background-position: 52% 46%;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.32);
    transition: transform 0.15s ease, box-shadow 0.2s ease;
    backface-visibility: hidden;
    will-change: transform;
}

.color-box::after {
    content: "";
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid transparent;
    transition: border 0.2s ease;
}

.color-box:hover::before,
.color-box:focus-visible::before {
    box-shadow: 0 0 0 2px #ffffff;
    transform: scale(1.06);
}

.color-box:hover::after,
.color-box:focus-visible::after {
    border-color: rgba(255, 255, 255, 0.14);
}

.color-box:active::before {
    transform: scale(0.94);
}

.color-box.active::before {
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9);
}

.color-box.active::after {
    border-color: rgba(255, 255, 255, 0.2);
}

.color-green  { --swatch-color: #1F512A; }
.color-yellow { --swatch-color: #FFCC24; }
.color-red    { --swatch-color: #901D25; }
.color-gray   { --swatch-color: #383838; }

.menu-separator {
    width: 1px;
    height: 48px;
    background: rgba(255, 255, 255, 0.2);
    align-self: stretch;
}

@media (max-width: 600px), (max-height: 600px) {
    #control-menu {
        gap: 10px;
        padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 12px);
    }
    #playReverseBtn,
    #playForwardBtn {
        min-width: 70px;
        height: 34px;
        font-size: 0.85em;
        border-radius: 17px;
    }
    .color-picker-group {
        gap: 10px;
    }
    .menu-separator {
        height: 36px;
    }
    .color-box {
        width: 32px;
        height: 32px;
    }
    .color-box::before {
        background-size: 130% 130%;
        background-position: 52% 46%;
    }
    .color-box::after {
        inset: -3px;
    }
}










