@font-face {
    font-family: 'Atkinson Hyperlegible';
    src: url('fonts/hinted-AtkinsonHyperlegible-Bold.eot');
    src: url('fonts/hinted-AtkinsonHyperlegible-Bold.eot?#iefix') format('embedded-opentype'),
        url('fonts/hinted-AtkinsonHyperlegible-Bold.woff2') format('woff2'),
        url('fonts/hinted-AtkinsonHyperlegible-Bold.woff') format('woff'),
        url('fonts/hinted-AtkinsonHyperlegible-Bold.ttf') format('truetype'),
        url('fonts/hinted-AtkinsonHyperlegible-Bold.svg#AtkinsonHyperlegible-Bold') format('svg');
    font-weight: bold;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Atkinson Hyperlegible';
    src: url('fonts/hinted-AtkinsonHyperlegible-BoldItalic.eot');
    src: url('fonts/hinted-AtkinsonHyperlegible-BoldItalic.eot?#iefix') format('embedded-opentype'),
        url('fonts/hinted-AtkinsonHyperlegible-BoldItalic.woff2') format('woff2'),
        url('fonts/hinted-AtkinsonHyperlegible-BoldItalic.woff') format('woff'),
        url('fonts/hinted-AtkinsonHyperlegible-BoldItalic.ttf') format('truetype'),
        url('fonts/hinted-AtkinsonHyperlegible-BoldItalic.svg#AtkinsonHyperlegible-BoldItalic') format('svg');
    font-weight: bold;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: 'Atkinson Hyperlegible';
    src: url('fonts/hinted-AtkinsonHyperlegible-Italic.eot');
    src: url('fonts/hinted-AtkinsonHyperlegible-Italic.eot?#iefix') format('embedded-opentype'),
        url('fonts/hinted-AtkinsonHyperlegible-Italic.woff2') format('woff2'),
        url('fonts/hinted-AtkinsonHyperlegible-Italic.woff') format('woff'),
        url('fonts/hinted-AtkinsonHyperlegible-Italic.ttf') format('truetype'),
        url('fonts/hinted-AtkinsonHyperlegible-Italic.svg#AtkinsonHyperlegible-Italic') format('svg');
    font-weight: normal;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: 'Atkinson Hyperlegible';
    src: url('fonts/hinted-AtkinsonHyperlegible-Regular.eot');
    src: url('fonts/hinted-AtkinsonHyperlegible-Regular.eot?#iefix') format('embedded-opentype'),
        url('fonts/hinted-AtkinsonHyperlegible-Regular.woff2') format('woff2'),
        url('fonts/hinted-AtkinsonHyperlegible-Regular.woff') format('woff'),
        url('fonts/hinted-AtkinsonHyperlegible-Regular.ttf') format('truetype'),
        url('fonts/hinted-AtkinsonHyperlegible-Regular.svg#AtkinsonHyperlegible-Regular') format('svg');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}



html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;


    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    touch-action: none;
    outline: none;
    display: block;
}

#gameCanvas {
    width: 100%;
    height: 100%;
    display: block;
    touch-action: none;


    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    touch-action: none;
    outline: none;
    display: block;

}

#overlay {
    position: absolute;
    top: 0;
    left: 0;

    width: 100vw;
    height: 100vh;

    background: #05042d;
    /* visible color */
    opacity: 0;
    /* start hidden */

    pointer-events: none;

    z-index: 99999;
}

.rotate-device-img {
    width: 200px;
}

.rotate-device-text {
    font-size: 25px;
    text-align: center;
    width: 10ch;
}

@keyframes nudge-rotate {

    0%,
    100% {
        transform: rotate(0deg);
    }

    15% {
        transform: rotate(-12deg);
        /* Quick tilt left */
    }

    30% {
        transform: rotate(10deg);
        /* Bounce right */
    }

    45% {
        transform: rotate(-5deg);
        /* Settle left */
    }

    60% {
        transform: rotate(2deg);
        /* Settle right */
    }
}

.rotate-device-img {
    width: 200px;
    animation: nudge-rotate 2s infinite ease-in-out;
    transform-origin: center center;
    display: block;
}

.loader-container {
    position: fixed;
    bottom: 20px;
    right: 40px;
    pointer-events: none;
}

.loader-bounce {
    width: 150px;
    animation: elastic 1.5s infinite cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

@keyframes elastic {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.4) rotate(90deg);
    }

    100% {
        transform: scale(1) rotate(180deg);
    }
}

body {

    background-image: url("./textures/skybox.png");
    background-repeat: no-repeat;
    background-position: center;
    background-size: cover;
    background-color: #1a004c;
    justify-content: center;
    align-items: center;
    display: flex;
}


.customization-anchor {
    position: fixed;
    top: -3vh;    
    left: 65vw;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column; 
    align-items: center;
    gap: 0vh;
    z-index:100; 
    visibility: visible !important;
       pointer-events: none;
}

.customization-panel {
    position: relative;

    width: min(90vh, 65vw);
    z-index: 100;
    visibility: hidden;

}

.panel-content-wrapper {
    position: absolute; /* This is the key change */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    
    display: flex;
    padding: 6vh; /* Adjust this to move the grid away from the image edges */
    gap: 4vh;
    box-sizing: border-box;
    z-index: 2; /* Sits above #panel-ui */
}

#panel-ui {
    display: block !important;
    width: 100%;
    height: auto;
    opacity: 1 !important;
    z-index: 1; /* Sits below the content */
}

.options-grid {
    flex: 2; 
    display: grid;
    grid-template-columns: repeat(3, 1fr); 
   
    gap: 2%;
    overflow-y: auto; 
    padding-right: 1vh;
    align-content: start; 
}



.options-grid::-webkit-scrollbar {
    width: 8px;
}
.options-grid::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3); 
    border-radius: 10px;
}

.grid-item {
    background: #99b4ff61;
    border-radius: 2vh;
    cursor: pointer;
    transition: background 0.2s;
    
 
    width: 100%;
    aspect-ratio: 1 / 1; 
}
.grid-item:hover {
    background: rgba(203, 240, 255, 0.578);
}


.panel-sidebar {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2vh;

    container-type: inline-size;
    width: 100%; 
}
.color-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.8vh;
}
.color-swatch {
    width: 40cqw; 
    max-width: 7.5vh; 
    
    aspect-ratio: 1 / 1;
    height: auto;   
    
    border-radius: 30%; 
    cursor: pointer;
    border: 2px solid transparent;
    box-sizing: border-box;
}
.name-input-anchor {
    position: fixed;
    top: 30vh;
    left: 50%;
    transform: translateX(-50%) scale(0);
    width: 63vh;
    max-width: 95%;
    z-index: 100;
    pointer-events: none;
    visibility: hidden;
    transform-origin: center center;
    will-change: transform contents;
}

.name-input-container {
    position: relative;
    width: 100%;
}

#name-input-ui {
    width: 100%;
    display: block;
    pointer-events: none;
}

.name-text-field {


    position: absolute;
    pointer-events: auto;

    top: 62%;
    left: 55%;
    transform: translate(-50%, -50%);
    width: 55%;
    height: 20%;

    background: transparent;
    border: none;
    outline: none;
    color: #68b6dd;
    font-size: 5vh;
    text-align: left;
    font-family: Atkinson Hyperlegible;
    font-weight: bold;
    overflow: visible;

}


.name-text-field::placeholder {
    font-size: 3.8vh;
    font-weight: 520;
    color: rgba(212, 233, 254, 0.6);
    letter-spacing: 0.05vh;
    opacity: 1;
}

.blockly-prompt-anchor {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100000;
    pointer-events: none;
    visibility: hidden;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 5vh;
}

.blockly-prompt-container {
    position: relative;
    width: 63vh;
    max-width: 95%;
    transform: scale(0);
    transform-origin: center center;
    will-change: transform, contents;
}

.blockly-prompt-bg {
    width: 100%;
    display: block;
    pointer-events: none;
}

.blockly-prompt-field {
    position: absolute;
    pointer-events: auto;
    top: 62%;
    left: 55%;
    transform: translate(-50%, -50%);
    width: 55%;
    height: 20%;
    background: transparent;
    border: none;
    outline: none;
    color: #68b6dd;
    font-size: 5vh;
    text-align: left;
    font-family: Atkinson Hyperlegible;
    font-weight: bold;
    overflow: visible;
}

.blockly-prompt-field::placeholder {
    font-size: 3.8vh;
    font-weight: 520;
    color: rgba(212, 233, 254, 0.6);
    letter-spacing: 0.05vh;
    opacity: 1;
}

.dialogue-anchor {
    position: fixed;
    bottom: 2vh;
    left: 50%;
    transform: translateX(-50%);
    width: 63vh;
    max-width: 95%;
    z-index: 100;
    pointer-events: none;
}

.dialogue-container {
    opacity: 0;
    /* hide the dialogue by default*/
}

.dialogue-name {
    position: absolute;
    top: -5%;
    left: 12%;
    margin: 0;
    font-size: 5vh;
    font-weight: bold;
    z-index: 102;
    white-space: nowrap;
    color: #ffffff;
    --thickness: 0.7vh;
    --color: #1D4B96;
    text-shadow:
        calc(var(--thickness) * 0.00) calc(var(--thickness) * 1.00) 0.5px var(--color),
        calc(var(--thickness) * 0.98) calc(var(--thickness) * 0.21) 0.5px var(--color),
        calc(var(--thickness) * 0.42) calc(var(--thickness) * -0.91) 0.5px var(--color),
        calc(var(--thickness) * -0.80) calc(var(--thickness) * -0.60) 0.5px var(--color),
        calc(var(--thickness) * -0.76) calc(var(--thickness) * 0.65) 0.5px var(--color),
        calc(var(--thickness) * 0.48) calc(var(--thickness) * 0.88) 0.5px var(--color),
        calc(var(--thickness) * 0.96) calc(var(--thickness) * -0.28) 0.5px var(--color),
        calc(var(--thickness) * -0.07) calc(var(--thickness) * -1.00) 0.5px var(--color),
        calc(var(--thickness) * -0.99) calc(var(--thickness) * -0.15) 0.5px var(--color),
        calc(var(--thickness) * -0.35) calc(var(--thickness) * 0.94) 0.5px var(--color),
        calc(var(--thickness) * 0.84) calc(var(--thickness) * 0.54) 0.5px var(--color),
        calc(var(--thickness) * 0.71) calc(var(--thickness) * -0.70) 0.5px var(--color),
        calc(var(--thickness) * -0.54) calc(var(--thickness) * -0.84) 0.5px var(--color),
        calc(var(--thickness) * -0.94) calc(var(--thickness) * 0.35) 0.5px var(--color),
        calc(var(--thickness) * 0.14) calc(var(--thickness) * 0.99) 0.5px var(--color),
        calc(var(--thickness) * 1.00) calc(var(--thickness) * 0.08) 0.5px var(--color);
}

.dialogue-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);

    width: 80%;
    margin: 0;
    text-align: center;
    z-index: 101;
    width: 28ch;
    font-weight: bold;
    font-size: 2.95vh;
    color: #1B508E;
    white-space: pre-wrap;
    opacity: 1;
    line-height: 3.5vh;
}

.dialogue-option {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);

    width: 80%;
    margin: 0;
    text-align: left;
    z-index: 105;
    width: 28ch;
    font-weight: bold;
    font-size: 2.8vh;
    color: #1B508E;
    white-space: pre-wrap;
    cursor: pointer;
    pointer-events: auto;
    opacity: 0;
    transition: color 0.2s ease, transform 0.2s ease;
    line-height: 3.3vh;
}


.dialogue-option:hover {
    color: #3679A3;
    /* text-shadow: 0px 0px 8px #a5ddfe;*/
}

#dialogue-options-arrow {
    animation: arrow-nudge 0.8s infinite alternate ease-in-out;
    pointer-events: none;
}

@keyframes arrow-nudge {
    from {
        transform: translateX(0);
    }

    to {
        transform: translateX(-0.8vh);
    }
}


#dialogue-option-1 {
    transform: translate(-40%, -150%);
}

#dialogue-option-2 {
    transform: translate(-40%, -20%);
}

#dialogue-option-3 {
    transform: translate(-40%, 110%);
}

/*
option 1 pos 34% 
option 2 pos 48% 
option 3 pos 63% 
*/

#dialogue-options-arrow {
    position: absolute;
    top: 34%;
    left: 10%;
    z-index: 110;
    width: 2.8vh;
    height: auto;
    opacity: 0;
}

#dialogue-options-arrow {
    animation: arrow-bounce 0.8s infinite alternate ease-in-out;
}

@keyframes arrow-bounce {
    from {
        transform: translateX(0);
    }

    to {
        transform: translateX(-0.6vh);
    }
}

#speechbubble-left {
    width: 100%;
    height: auto;
    display: block;
    position: relative;
    z-index: 1;
    left: -1.9vh;
    top: 0.5vh;
    opacity: 1;
}

#speechbubble-right {
    width: 100%;
    height: auto;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
    left: 1.9vh;
    top: 0.5vh;
    opacity: 1;
}

@keyframes shake-anim {
    0% {
        transform: translate(0vh, 0vh);
    }

    20% {
        transform: translate(-0.05vh, 0.05vh);
    }

    40% {
        transform: translate(-0.05vh, -0.05vh);
    }

    60% {
        transform: translate(0.05vh, 0.05vh);
    }

    80% {
        transform: translate(0.05vh, -0.05vh);
    }

    100% {
        transform: translate(0vh, 0vh);
    }
}


.char-shake-alt {
    animation: shake-anim-2 0.12s linear infinite;
}

@keyframes shake-anim-2 {
    0% {
        transform: translate(0vh, 0vh);
    }

    50% {
        transform: translate(0.065vh, -0.06vh);
    }

    100% {
        transform: translate(-0.065vh, 0.06vh);
    }
}

.char-span {
    display: inline-block;
    vertical-align: bottom;
}

.char-shake {
    animation: shake-anim 0.15s linear infinite;
}

.char-wobble {
    animation: wobble-anim 0.5s ease-in-out infinite alternate;
}

@keyframes wobble-anim {
    from {
        transform: translateY(0vh);
    }

    to {
        transform: translateY(-0.5vh);
    }
}



.charecter-dialogue-anchor {
    position: fixed;
    top: 5vh; 
    left: 50%;
    transform: translateX(-50%);
    width: 63vh;
    max-width: 95%;
    z-index: 100;
    pointer-events: none;


}

.charecter-dialogue-container {
    position: relative;
    opacity: 0;

    display: inline-block; 
    max-width: 85%; 
    min-width: 20%; 
}

#charecter-dialogue {
    width: 100%; 
    height: auto;
    display: block;
    position: relative;
    z-index: 1;
}

#charecter-dialogue-text {
    position: absolute;
    top: 50%; 
    left: 62%; 
    transform: translate(-50%, -50%);


    width: 64%; 
    max-width: 18ch; 
    
    margin: 0;
    text-align: left;
    z-index: 101;
    font-weight: bold;
    font-size: 2.2vh; 
    color: #ffffff; 
    text-shadow: 0px 2px 4px rgba(49, 0, 52, 0.4); 
    
    white-space: pre-wrap; 
    line-height: 1.1;

    word-break: keep-all; 
    overflow-wrap: normal;
}

#blob, #bunny-yay, #level-complete, #print-button, #restart-button {
    opacity: 0;
}



.win-screen-anchor {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 101;
    pointer-events: none;
    background-color: #05042d00;
}


.win-screen-container {
    position: relative;
    width: 100vmin;
    height: 100vmin;
    display: flex;
    justify-content: center;
    align-items: center;
}

#blob {
    position: absolute;
    width: 95vmin; 
    max-width: 800px; 
    height: auto;
    z-index: 1;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

#bunny-yay {
    position: absolute;

    height: 50vmin; 
    

    left: 50%;
    transform: translateX(-50%);
    

    bottom: -10%; 

    z-index: 2; 
}
#level-complete {
    position: absolute;
    top: 22%; 
    width: 65vmin; 
    max-width: 550px;
    z-index: 10;
    left: 50%;
    transform: translateX(-50%);
}

#print-button, #restart-button {
    position: absolute;
    width: 15vmin; 
    max-width: 120px;
    cursor: pointer;
    z-index: 15;
    

    top: 48%; 
    
    transition: transform 0.2s ease;
}

#print-button {

    left: calc(50% - 12vmin); 
    transform: translate(-50%, -50%);
}

#restart-button {
    left: calc(50% + 12vmin);
    transform: translate(-50%, -50%);
}


#print-button:hover, #restart-button:hover {
    transform: translate(-50%, -60%) scale(1.1);
}

.centered img {
    width: 50px;
    max-width: 20vw;
    height: auto;
    display: block;
}

#playButton {
    user-select: none;
    -webkit-user-drag: none;
    -moz-user-select: none;
    -ms-user-select: none;
    pointer-events: auto;
}

/* Show a warning only when in portrait */
#portrait-warning {
    display: none;
}

@media screen and (orientation: portrait) {
    #portrait-warning {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgb(5, 4, 45);
        color: white;
        pointer-events: block;
        z-index: 9999999;
    }
}

* {
    font-family: 'Atkinson Hyperlegible', sans-serif;
    -webkit-user-drag: none;
    -user-drag: none;
    -moz-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}