html {
    height: 100%;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-image: url('./Images/comic.jpg');
    background-size: contain;
    background-position: center;
    background-repeat: repeat;
    position: relative;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgb(115, 115, 58);
    opacity: 0.3;
    z-index: -2;
    pointer-events: none;
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    background: url('./Images/dots.jpg');
    background-size: cover;
    opacity: 0.2;
    mix-blend-mode: multiply;
    z-index: -1;
    pointer-events: none;
    animation: driftDots 20s linear infinite;
}

@keyframes driftDots {
    from {
        background-position: 0 0;
    }

    to {
        background-position: 100% 100%;
    }
}

h1 {
    font-family: "Bangers", cursive;
    font-size: 5rem;
    text-align: center;
    margin: 0.5rem 0;
    letter-spacing: 0.3rem;
    text-transform: uppercase;
    text-shadow:
        2px 2px 0 #000,
        4px 4px 0 #cc9900;
    animation:
        wobbleTitle 3s infinite ease-in-out,
        titleGlow 2s infinite ease-in-out;
}

@keyframes titleGlow {

    0%,
    100% {
        color: #fff200;
    }

    50% {
        color: #ffc510;
    }
}

@keyframes wobbleTitle {
    0% {
        transform: rotate(0deg) translateY(0);
    }

    20% {
        transform: rotate(2deg) translateY(-2px);
    }

    40% {
        transform: rotate(-2deg) translateY(1px);
    }

    60% {
        transform: rotate(2deg) translateY(-1px);
    }

    80% {
        transform: rotate(-2deg) translateY(1px);
    }

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

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

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

.pop {
    animation-name: popOut;
    animation-duration: 0.1s;
}

@keyframes flipOut {
    0% {
        transform: scaleY(1);
    }

    25% {
        transform: scaleY(0.5);
    }

    50% {
        transform: scaleY(0.05);
    }

    75% {
        transform: scaleY(0.5);
    }

    100% {
        transform: scaleY(1);
    }
}

@keyframes liftUp {
    0% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(-1.5rem);
    }

    50% {
        transform: translateY(0);
    }

    70% {
        transform: translateY(-0.5rem);
    }

    100% {
        transform: translateY(0);
    }
}

.dance {
    animation-name: liftUp;
    animation-duration: 0.6s;
    animation-timing-function: cubic-bezier(0.34, 1.56, 0.64, 1);
    animation-fill-mode: both;
}

#answer-message {
    position: fixed;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    background-color: #D2691E;
    color: white;
    font-family: "Bangers", cursive;
    padding: 1rem 2rem;
    font-size: 2rem;
    border-radius: 10px;
    box-shadow: 0 0 10px gray;
    z-index: 999;
    transition: opacity 0.3s;
    letter-spacing: 0.1rem;
}

#msg-img {
    height: 30rem;
    width: auto;
    position: fixed;
    top: 5rem;
    left: 50%;
    transform: translateX(-50%) scale(1);
    z-index: 999;
    animation: popBounce 0.9s ease-in-out;
    pointer-events: none;
    transition: transform 0.2s ease;
    filter: drop-shadow(0 0 0.5rem yellow) drop-shadow(0 0 1rem red);
}

@keyframes popBounce {
    0% {
        transform: translateX(-50%) scale(0.8);
        opacity: 0;
    }

    50% {
        transform: translateX(-50%) scale(1.2);
        opacity: 1;
    }

    80% {
        transform: translateX(-50%) scale(1);
        opacity: 1;
    }

    100% {
        transform: translateX(-50%) scale(0.8);
        opacity: 0;
    }
}

.tile {
    background-image: url("./Images/monroe.jpg");
    background-position: center;
    background-size: contain;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.frame {
    filter: none !important;
    box-shadow: inset 0 0 0 3px #fb1d36;
}

.flipped {
    animation-name: flipOut;
    animation-duration: 0.4s;
}

.hidden {
    display: none !important;
}

.comic-gray {
    background-color: #908f8f;
    background-image: none;
    border: 0.2rem solid #7e7e7e;
}

.comic-yellow {
    background-color: #FED715;
    background-image: none;
    border: 0.2rem solid #cfb013;
}

.comic-green {
    background-color: #39FF14;
    background-image: none;
    border: 0.2rem solid #2ed211;
}

.tile.gray {
    background-color: #808080;
    color: white;
    filter: grayscale()
}

.tile.yellow {
    background-color: #FED715;
    background-image: none;
    color: white;
    filter: none;
    border: 3px solid white;
    box-shadow: inset 0 0 0.5rem white, 0 0 1rem #FED715;
}

.tile.green {
    background-color: #39FF14;
    background-image: none;
    color: white;
    filter: none;
    border: 3px solid white;
    box-shadow: inset 0 0 0.5rem white, 0 0 1rem #39FF14;
}

p {
    color: white;
    font-size: 3rem;
    font-family: "Bangers", cursive;
    text-align: center;
    margin: 0;
    padding: 0;
    text-shadow: 0 0 5px black, 0 0 2px black;
    position: relative;
    z-index: 2;
}

#game-board,
#keyboard {
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: auto;
    width: fit-content;
    margin: auto;
    backface-visibility: hidden;
}

#game-board .container {
    display: grid;
    grid-template-rows: repeat(6, 1fr);
    gap: 0.3rem;
    margin: 0 1rem;
    width: 20rem;
    aspect-ratio: 5 / 6;
    background-color: #000;
}

.row {
    display: grid;
    height: 100%;
    width: 100%;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.3rem;
}

#keyboard .container {
    display: grid;
    grid-template-rows: repeat(3, 1fr);
    width: auto;
    height: auto;
    gap: 0.45rem;
    margin: 0.85rem;
}

.keyboardRow {
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.45rem;
}

.key {
    height: 3rem;
    aspect-ratio: 3 / 4;
    border-radius: 13%;
    position: relative;
    transition: all 0.1s ease;

    box-shadow:
        0.4rem 0.4rem 0 rgba(0, 0, 0, 0.788);
    border: 0.2rem solid white;
    background-color: white;

    box-shadow:
        0.1rem 0.1rem 0 #55390b,
        0.25rem 0.25rem 0 #5c3d0c,
        inset 0 0 5px rgba(0, 0, 0, 0.08);
    border: 0.2rem solid #b0975b;
    background-color: #b0975b;
    ;
}

.key.pressed {
    transform: translate(0.15rem, 0.15rem);
    box-shadow: 0.2rem 0.2rem 0 rgb(34, 34, 34);
    border: 4px solid lightgray;

    border: 4px solid #8f7a49;
    box-shadow:
        1px 1px 0 #3a250a,
        inset 0 0 6px rgba(0, 0, 0, 0.2);
}

.key-l {
    aspect-ratio: 4.65 / 4;
}

.tile {
    position: relative;
    overflow: hidden;
}

.tile::after {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(120deg,
            rgba(255, 255, 255, 0) 0%,
            rgba(255, 255, 255, 0.4) 50%,
            rgba(255, 255, 255, 0) 100%);
    transform: rotate(25deg);
    animation: glossSwipe 2.5s ease-in-out infinite;
    opacity: 0;
    pointer-events: none;
    z-index: 2;
    transition: opacity 0.3s ease-in-out;
}

.tile.glossy::after {
    opacity: 1;
}


@keyframes glossSwipe {
    0% {
        transform: translateX(-100%) rotate(25deg);
    }

    50% {
        transform: translateX(100%) rotate(25deg);
    }

    100% {
        transform: translateX(100%) rotate(25deg);
    }
}

.tile:nth-child(1).glossy::after {
    animation-delay: 0s;
}

.tile:nth-child(2).glossy::after {
    animation-delay: 0.3s;
}

.tile:nth-child(3).glossy::after {
    animation-delay: 0.6s;
}

.tile:nth-child(4).glossy::after {
    animation-delay: 0.9s;
}

.tile:nth-child(5).glossy::after {
    animation-delay: 1.2s;
}

button {
    width: 100%;
    height: 100%;
    font-size: 1.8rem;
    font-family: "Bangers", cursive;
    border-radius: 12%;
    background-color: #d3d6da;
    border: none;
    cursor: pointer;
    position: relative;
    z-index: 2;

    background-color: #f4e2b6;
    background-image:
        repeating-linear-gradient(135deg, rgba(0, 0, 0, 0.02) 0px, rgba(0, 0, 0, 0.02) 1px, transparent 1px, transparent 4px),
        linear-gradient(to bottom right, #f7e6c3, #e9d4a6);
    color: #3a2e0d;
    text-shadow: 1px 1px 0 #fff7d0;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

@keyframes explodeOut {
    0% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
        filter: brightness(1.5);
    }

    50% {
        transform: scale(1.25) rotate(12deg);
        opacity: 0.7;
        filter: brightness(3);
    }

    100% {
        transform: scale(1) rotate(-6deg);
        opacity: 1;
        filter: brightness(1);
    }
}

.explode {
    animation: explodeOut 0.4s ease;
    z-index: 10;
}

.shake {
    animation-name: shakeX;
    animation-duration: 0.4s;
    animation-timing-function: cubic-bezier(0.34, 1.56, 0.64, 1);
    animation-fill-mode: both;
}

#reveal-button {
    width: 129.25px;
    height: 34.4px;
    position: fixed;
    top: 1rem;
    left: 1rem;
    padding: 0.4rem 0.5rem 0.5rem 0.5rem;
    font-family: "Bangers", cursive;
    font-size: 1rem;
    text-align: center;
    letter-spacing: 0.1rem;
    text-shadow: 0.5px 0.5px 0 #fff7d0;
    background: rgb(255, 191, 0);
    border: 3px solid rgba(92, 55, 0, 0.753);
    color: rgba(90, 36, 25, 0.905);
    border-radius: 0.5rem;
    cursor: pointer;
    z-index: 999;
    box-shadow:
        0.1rem 0.1rem #cc9900,
        0.2rem 0.2rem 0 #00000079;
    transition: transform 0.1s ease;
}

#reveal-button:active {
    transform: translate(0.15rem, 0.15rem);
    box-shadow: 0.2rem 0.2rem 0 rgb(0, 0, 0);
}

.switch {
    position: fixed;
    top: 1rem;
    right: 1rem;
    display: inline-block;
    width: 60px;
    height: 34px;
    z-index: 999;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: background 0.6s ease, box-shadow 0.4s;
    border-radius: 34px;
    overflow: hidden;
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.3);
}

input:checked+.slider {
    background: linear-gradient(135deg,
            #70410c 0%,
            #e79039 50%,
            #ff8d60 100%);
    box-shadow: 0 0 12px #413e0b,
        0 0 18px #d88424,
        inset 0 0 5px #1e1c00;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    border-radius: 50%;
    transition: 0.4s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input:checked+.slider:before {
    transform: translateX(26px);
    background: radial-gradient(circle at 30% 30%,
            #fff3b9 20%,
            #ffbf00 40%,
            rgba(90, 55, 23, 0.741) 100%);
    box-shadow: 0 0 8px #4b2602,
        inset 0 0 4px #fff5ea;
}

.glitch-overlay::before {
    content: "";
    position: fixed;
    inset: 0;
    background: repeating-linear-gradient(0deg,
            rgba(255, 0, 0, 0.2) 0px,
            rgba(0, 255, 0, 0.2) 1px,
            rgba(0, 0, 255, 0.2) 2px);
    animation: scanlines 0.2s infinite;
    z-index: 9999;
    pointer-events: none;
}

@keyframes scanlines {
    0% {
        transform: translateY(0);
    }

    100% {
        transform: translateY(1px);
    }
}

body.glitchy {
    filter: contrast(2) saturate(3) hue-rotate(120deg);
}

@keyframes shakeX {
    0% {
        transform: translateX(0);
    }

    10% {
        transform: translateX(0.25rem);
    }

    20% {
        transform: translateX(0rem);
    }

    30% {
        transform: translateX(-0.25rem);
    }

    40% {
        transform: translateX(0);
    }

    50% {
        transform: translateX(0.25rem);
    }

    60% {
        transform: translateX(0);
    }

    70% {
        transform: translateX(-0.25rem);
    }

    80% {
        transform: translateX(0);
    }

    90% {
        transform: translateX(0.25rem);
    }

    100% {
        transform: translateX(0);
    }
}


@media (max-width: 600px) {

    html {
        font-size: 10px;
    }

    body {
        margin: 0;
    }

    h1 {
        margin-top: 5.5rem;
        margin-bottom: 1.8rem;
        font-size: 6rem;
    }

    #game-board .container {
        width: 80vw;
    }

    .row,
    .keyboardRow,
    #keyboard .container,
    #game-board .container {
        gap: 0.6rem;
    }


    .key {
    height: 5.9rem;
    width: 2.85rem;
    }

    .key-l {
        width: 4.7rem;
    }

    #keyboard button {
        font-size: 2.3rem;
    }

    .enter button {
        font-size: 1.8rem !important;
    }

    #reveal-button {
        width:116.18px;
        height: 27.6px;
        font-size: 1.5rem;
    }
}