@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;600;700&family=Nunito:wght@400;600;800&display=swap');

body {
    font-family: 'Nunito', sans-serif;
    margin: 0;
    overflow: hidden;
    touch-action: manipulation;
}


.title-text {
    font-family: 'Fredoka', sans-serif;
    font-weight: 700;
    color: #334155;
    transition: opacity 0.5s ease, transform 0.5s ease;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

.scene-container {
    width: 320px;
    height: 400px;
    position: relative;
}

/* Box styles */
.box-wrapper {
    position: absolute;
    left: 50%;
    bottom: 40px;
    margin-left: -55px;
    width: 110px;
    height: 200px;
    transition: transform 0.7s cubic-bezier(0.34, 1.56, 0.64, 1), left 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 5;
    perspective: 1000px;
}

.box-wrapper.fallen {
    transform: translateX(180px);
    left: 55%;
}

.crayola-box {
    width: 100%;
    height: 100%;
    position: relative;
    transform-origin: bottom left;
    transition: transform 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
    cursor: pointer;
    transform-style: preserve-3d;
}

.crayola-box.fallen {
    transform: rotateZ(-90deg);
    cursor: default;
}

/* 3D Box Construction */
.box-3d {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transform: rotateX(-10deg) rotateY(-25deg);
    transition: transform 0.7s ease;
}

.face {
    position: absolute;
    backface-visibility: hidden;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.front {
    width: 110px;
    height: 200px;
    background-color: #facc15;
    transform: rotateY(0deg) translateZ(25px);
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: hidden;
}

.back {
    width: 110px;
    height: 200px;
    background-color: #eab308;
    transform: rotateY(180deg) translateZ(25px);
}

.right {
    width: 50px;
    height: 200px;
    left: 30px;
    background-color: #047857;
    transform: rotateY(90deg) translateZ(55px);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
}

.left {
    width: 50px;
    height: 200px;
    left: 30px;
    background-color: #16a34a;
    transform: rotateY(-90deg) translateZ(55px);
}

.top {
    width: 110px;
    height: 50px;
    top: 75px;
    background-color: #16a34a;
    transform: rotateX(90deg) translateZ(100px);
}

.bottom {
    width: 110px;
    height: 50px;
    top: 75px;
    background-color: #15803d;
    transform: rotateX(-90deg) translateZ(100px);
}

/* 3D Box Details */
.green-arch {
    width: 100%;
    height: 60px;
    background-color: #16a34a;
    border-bottom-left-radius: 50% 20px;
    border-bottom-right-radius: 50% 20px;
    box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.2);
}

.crayola-logo {
    font-family: 'Fredoka', sans-serif;
    font-size: 26px;
    font-weight: 800;
    color: #16a34a;
    text-shadow: 2px 2px 0 #fff, -2px -2px 0 #fff, 2px -2px 0 #fff, -2px 2px 0 #fff;
    margin-top: -30px;
    z-index: 2;
    transform: rotate(-8deg);
}

.red-blob {
    background-color: #ef4444;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    margin-top: 25px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    font-family: 'Fredoka', sans-serif;
    box-shadow: 3px 3px 6px rgba(0, 0, 0, 0.2);
}

.blob-num {
    font-size: 66px;
    font-weight: 800;
    line-height: 0.8;
    margin-top: 8px;
}

.blob-text {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
}

.chevron {
    width: 0;
    height: 0;
    border-left: 20px solid transparent;
    border-right: 20px solid transparent;
    border-bottom: 30px solid #16a34a;
    margin-bottom: -5px;
}

.chevron:last-child {
    margin-bottom: 20px;
}

/* Vibrating animation */
@keyframes vibrate {
    0% {
        transform: rotate(0deg) translate(0, 0);
    }

    20% {
        transform: rotate(3deg) translate(1px, -1px);
    }

    40% {
        transform: rotate(-3deg) translate(-1px, 1px);
    }

    60% {
        transform: rotate(2deg) translate(2px, 0);
    }

    80% {
        transform: rotate(-2deg) translate(-2px, 0);
    }

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

.vibrate {
    animation: vibrate 0.8s infinite;
}

/* Crayons */
.crayon {
    position: absolute;
    bottom: 40px;
    /* same bottom as box */
    left: 50%;
    margin-left: -12px;
    width: 24px;
    height: 130px;
    z-index: 1;
    opacity: 0;
    transform: translate(0, 0) rotate(0deg);
    cursor: pointer;
    transition: transform 0.6s cubic-bezier(0.25, 0.8, 0.25, 1), opacity 0.4s ease;
    filter: drop-shadow(2px 4px 6px rgba(0, 0, 0, 0.3));
}

.crayon-tip {
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-bottom: 25px solid;
    margin: 0 auto;
    position: relative;
}

.crayon-body {
    width: 24px;
    height: 105px;
    background-color: currentColor;
    border-radius: 0 0 3px 3px;
    position: relative;
    background-image: linear-gradient(90deg, rgba(255, 255, 255, 0.3) 0%, rgba(255, 255, 255, 0) 20%, rgba(0, 0, 0, 0) 80%, rgba(0, 0, 0, 0.2) 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
}

.c-stripe {
    width: 100%;
    height: 12px;
    background-color: #222;
    opacity: 0.8;
}

.c-label {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    color: #222;
    font-size: 10px;
    font-weight: 800;
    font-family: 'Fredoka', sans-serif;
    letter-spacing: 1px;
    opacity: 0.8;
    transform: rotate(180deg);
}

/* Colors */
.crayon-blue {
    color: #3b82f6;
}

.crayon-blue .crayon-tip {
    border-bottom-color: #2563eb;
}

.crayon-green {
    color: #22c55e;
}

.crayon-green .crayon-tip {
    border-bottom-color: #16a34a;
}

.crayon-red {
    color: #ef4444;
}

.crayon-red .crayon-tip {
    border-bottom-color: #dc2626;
}

.crayon-yellow {
    color: #eab308;
}

.crayon-yellow .crayon-tip {
    border-bottom-color: #ca8a04;
}

/* Spilled State Transforms */
.scene-container.spilled .crayon {
    opacity: 1;
}

.scene-container.spilled .crayon-blue {
    transform: translate(-100px, -110px) rotate(-85deg);
    z-index: 4;
}

.scene-container.spilled .crayon-green {
    transform: translate(-50px, -65px) rotate(-70deg);
    z-index: 3;
}

.scene-container.spilled .crayon-red {
    transform: translate(-130px, -30px) rotate(-100deg);
    z-index: 2;
}

.scene-container.spilled .crayon-yellow {
    transform: translate(-60px, 10px) rotate(-55deg);
    z-index: 1;
}

/* Hover/Active effects */
@media (hover: hover) {
    .scene-container.spilled .crayon:hover {
        filter: drop-shadow(4px 8px 8px rgba(0, 0, 0, 0.4));
        z-index: 10;
    }

    .scene-container.spilled .crayon-blue:hover {
        transform: translate(-110px, -120px) rotate(-85deg) scale(1.1);
    }

    .scene-container.spilled .crayon-green:hover {
        transform: translate(-60px, -75px) rotate(-70deg) scale(1.1);
    }

    .scene-container.spilled .crayon-red:hover {
        transform: translate(-140px, -40px) rotate(-100deg) scale(1.1);
    }

    .scene-container.spilled .crayon-yellow:hover {
        transform: translate(-70px, 0px) rotate(-55deg) scale(1.1);
    }
}

.crayon:active {
    filter: drop-shadow(1px 2px 3px rgba(0, 0, 0, 0.5)) !important;
    transform: scale(0.95) !important;
}

/* Modal Styling */
.custom-modal {
    border-radius: 20px;
    border: none;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    transition: background-color 0.4s ease;
    color: white;
}

.custom-modal .btn-close {
    opacity: 0.8;
}

.custom-modal .btn-close:hover {
    opacity: 1;
}

.modal-icon svg {
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.2));
}

#modalMessage {
    font-family: 'Nunito', sans-serif;
    line-height: 1.5;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}