@import url("../games.css?v=2026.02.25");

:root {
    --text-shadow: 0 0.5rem 1rem #0000001f;
    --text-glow: 0 0 20px #ffffff66;

    --tile-height: 8rem;
    --tile-width: 5.5rem;
    --tile-gap: 0.5rem;

    --primary-color: #ca76ff;
    --secondary-color: #56a8ff;
    --color-gradient: linear-gradient(in oklch, var(--secondary-color), var(--primary-color));
}

html, body {
    height: 100dvh;
    margin: 0;
}

body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden;

    background: var(--color-gradient);
    /* background: linear-gradient(in oklch, #ffa02b, #ff7bcc); */
}



.title {
    color: white;
    text-shadow: var(--text-shadow);

    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin: 0;
}

h1, p, .title h1, .title p {
    color: inherit;
    text-shadow: inherit;
}

.title h1 {
    font-weight: 800;
}

.title p {
    font: 3rem "Clash Display";
    font-weight: 500;
}

p {
    color: white;
    font: 1.5rem "Cabinet Grotesk";
}



.navbar.regular {
	position: relative;
    margin-top: 1rem;
	inset: 0;

	justify-content: center;
}

.navbar > button {
    border-color: #ffffffba;
    color: #ffffffba;
}

.navbar > button:hover {
    border-color: white;
    color: white;
    background-color: #ffffff1f;
    box-shadow: 0 0 0.7rem #ffffff4f;
}

.menu .options {
    grid-column: span 2;
    margin-top: 4rem;
    display: flex;
    flex-direction: row;
    justify-content: center;
    gap: 1rem;
}


.menu .options button {
    background: none;
    appearance: none;
    outline: none;
    border: 0.2rem solid #ffffffc1;
    border-radius: 1rem;

    font: 1.5rem "Cabinet Grotesk";
    font-weight: 800;
    color: white;
    padding: 0.8rem 2rem;

    box-shadow:
        0 0.5rem 1rem #ffffff2f,
        inset 0 -0.5rem 1rem #ffffff2f;

    cursor: pointer;
    transition:
        background-color 0.25s,
        padding 0.5s var(--smooth-easing);
}

.menu .options button:hover {
    background-color: #ffffff1f;
    padding-inline: 2.5rem;
}

.menu .options button.primary {
    border-color: #ffffff8b;
    backdrop-filter: blur(.2rem);
    background: linear-gradient(0deg, #ffffff62, #ffffff36);

    text-shadow: var(--text-shadow);
    box-shadow: 0rem 0.5rem 0.5rem #ffffff2f;
}

#main-menu {
    display: grid;
    grid-template-rows: repeat(2, auto);
    grid-template-columns: repeat(2, auto);

    margin-top: 2rem;
    column-gap: 1rem;
}

#main-menu .card {
    position: relative;
    width: 36rem;
    height: 24rem;

    display: flex;
    flex-direction: column;
    justify-content: end;
    gap: 0.75rem;

    background: linear-gradient(transparent, #ffffff17);
    box-sizing: border-box;
    box-shadow:
        0 1rem 1rem #ffffff13,
        inset 0 -1rem 1rem #ffffff13;

    border: 0.2rem solid #ffffffaa;
    border-radius: 2rem;
    padding: 2rem;

    user-select: none;
    cursor: pointer;
    overflow: hidden;

    transition: border 0.5s var(--smooth-easing), box-shadow 0.5s, width 0.5s var(--smooth-easing);
}

#main-menu .card.selected {
    width: 38rem;

    border-color: white;
    border-width: 0.25rem;
    box-shadow:
        0 0 2rem #ffffff66,
        inset 0 0 2rem #ffffff66;
}

#main-menu .card.wip {
    background: none;
    box-shadow: none;
    border-style: dashed;
    cursor: default;

    align-items: center;
    justify-content: center;
    padding-inline: 8rem;
}

#main-menu .card h1 {
    font: 5rem "Cabinet Grotesk";
    font-weight: 900;
    color: white;
    text-box: trim-both cap alphabetic;
    text-shadow: var(--text-shadow);
}

#main-menu .card.wip h1 {
    text-align: center;
    text-shadow: none;
    opacity: 0.4;
    line-height: 5rem;
}

#main-menu .options {
    grid-column: span 2;
    margin-top: 2rem;
}

#classic .pseudo-worm {
    position: absolute;
    right: 5rem;
    top: 3rem;

    display: flex;
    gap: 0.25rem;
    scale: 1.05;
    /* opacity: 0.7; */

    mask-image: linear-gradient(to right, transparent, white 50%, white);
}

#classic .pseudo-worm .tile {
    animation: none;
}

#game {
    display: flex;
    flex-direction: column;
    align-items: center;

    transition-behavior: allow-discrete;

    /* animation: game-away 1s 2s forwards; */
}

@keyframes game-away {
    to {
        opacity: 0;
    }
}


#stats {
    display: flex;
    flex-direction: row;
    margin-top: 2rem;
    gap: 2rem;
    color: white;
}

#stats h2 {
    font-size: 2rem;
    font-family: "Cabinet Grotesk";
}

#stats span {
    font-family: "Martian Mono";
    font-weight: 900;
    user-select: none;
    text-shadow: var(--text-glow);
    display: inline-block;
}

#stats span > span {
    display: inline-block;
    animation: stats-roll 1s var(--smooth-easing) backwards;
    animation-delay: calc(70ms * (sibling-count() - sibling-index()));
}

@keyframes stats-roll {
    from {
        transform: translateY(-1rem);
        opacity: 0;
    }
}

.worm {
    position: relative;
    display: flex;
    width: 100vw;
    right: calc(50% - var(--tile-width)/2);
    box-sizing: border-box;
    
    justify-content: right;
    align-items: center;
    gap: var(--tile-gap);

    margin-top: 4rem;
    margin-bottom: 1rem;
}

@keyframes worm-right { from { translate: calc((var(--tile-width) + var(--tile-gap)) * -1) 0; } }
@keyframes worm-left { from { translate: calc(var(--tile-width) + var(--tile-gap)) 0; } }

.worm.right { animation: worm-right 0.5s var(--smooth-easing) forwards; }
.worm.left { animation: worm-left 0.5s var(--smooth-easing) forwards; }

.tile {
    place-content: center;
    text-align: center;
    height: var(--tile-height);
    width: var(--tile-width);
    flex-shrink: 0;

    font: 2.5rem "Martian Mono";
    font-weight: bold;
    color: white;
    text-shadow: var(--text-glow);

    background: #ffffff00;
    box-sizing: border-box;
    box-shadow:
        0 0 0.75rem #00000022,
        inset 0 -0.5rem 1.5rem #ffffff55;
    border: 0.2rem solid #ffffffdd;
    border-radius: 1.5rem;
    user-select: none;
}

.tile:not(.empty) {
    animation: tile-enter 0.75s var(--smooth-easing);
}

.tile.first {
    animation:
        tile-wiggle 1s var(--spring-easing),
        tile-enter 0.75s var(--smooth-easing);
}

@keyframes tile-enter {
    from {
        background: #ffffff79;
        scale: 1 0.7;
        width: 6rem;
    }
}

@keyframes tile-wiggle {
    from {
        rotate: 20deg;
    }
}

.empty.tile {
    text-shadow: none;
    box-shadow: none;
    border-color: #ffffff90;
    color: #ffffff90;
    background: none;
    border-style: dashed;
}

.valid.tile {
    animation: 
        tile-pulse 1.25s cubic-bezier(0.075, 0.82, 0.165, 1) forwards,
        valid-shine 1.75s ease-out;
}

.wrong.tile {
    animation:
        tile-pulse 1.25s cubic-bezier(0.075, 0.82, 0.165, 1) forwards,
        reject-shine 1.75s ease-out;
}

@keyframes tile-pulse {
    from {
        border-width: 0.5rem;
        scale: 1 1.8;
    }
}

@keyframes valid-shine {
    from {
        border-color: white;
        background: #ffffffaa;
        box-shadow: 0 0 4rem rgba(255, 255, 255, 0.5);
    }
}

@keyframes reject-shine {
    from {
        background: #ff3300aa;
        border-color: rgb(255, 51, 0);
        box-shadow: 0 0 4rem rgba(255, 51, 0, 0.5);
    }
}

#type-a-word { font-weight: 500; }
#type-a-word b {
    font-weight: 800;
    text-shadow: var(--text-glow);
}

.game-info{
    margin-top: 4rem;
}

#timer {
    margin-bottom: 0.5rem;

    font: 4rem "Martian Mono";
    font-weight: bold;
    letter-spacing: -0.15rem;
    text-align: center;
    text-shadow: var(--text-shadow);
    user-select: none;
}

#timer span {
    display: inline-block;
    animation: timer-roll 0.75s var(--smooth-easing) backwards;
    animation-delay: calc(
        (sibling-count() - sibling-index()) * 50ms
    );
}

@keyframes timer-roll {
    from {
        transform: translateY(-1rem);
        opacity: 0;
    }
}

#tip strong {
    font-weight: 900;
    font-kerning: auto;
    margin-right: 0.5rem;
    user-select: none;
    text-shadow: var(--text-glow);
}

#tip {
    font-weight: bold;
}

#tip {
    text-align: center;
}

.flash {
    position: fixed;
    width: 100vw;
    display: flex;
    justify-content: space-evenly;
    align-items: center;
    user-select: none;

    z-index: 999;
}

.flash span {
    flex-grow: 1;
    height: 66.6vh;
    place-content: center;
    text-align: center;

    font: min(calc(150vw / sibling-count()), 40vh) "Cabinet Grotesk";
    font-weight: 900;
    color: white;
    text-shadow: 0 0 4rem rgb(255, 255, 255);
    text-box: trim-both cap alphabetic;
    
    opacity: 0;
    transform: scaleY(1.5);
    animation:
        bounce-character 1.25s var(--spring-easing) backwards,
        flash-bg 1.5s,
        flash-away 1.5s;
    animation-delay: calc((120ms / sibling-count()) * sibling-index());
}

@keyframes bounce-character { from { transform: scaleY(2.5); } }
@keyframes flash-bg { from { background-color: #ffec8eac; } }
@keyframes flash-away { from { opacity: 1; } 50% { opacity: 1; } }


#game-over {
    display: grid;
    grid-template-rows: repeat(3, auto);
    grid-template-columns: auto auto;
    /* gap: 4rem; */

    margin-top: 2rem;
    transition-behavior: allow-discrete;
}

#game-over > h1 {
    grid-row: 1;
    grid-column: span 2;

    font: 6rem "Clash Display";
    font-weight: 600;
    color: white;
    text-align: center;
    text-shadow: var(--text-shadow);

    text-box: trim-both cap alphabetic;
    border-bottom: 2px solid rgba(255, 255, 255, 0.276);
    padding-bottom: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 2rem 2rem -2rem rgba(255, 255, 255, 0.17);
}

#game-over .word-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;

    max-height: 26rem;
    max-width: 40rem;
    align-self: center;
    padding: 0 5rem;
    overflow-y: auto;
    scrollbar-width: none;
}

@container (width > 20rem) {
    #game-over .word-list {
        background-color: black;
    }
}

@property --row-delay {
    syntax: "<time>";
    inherits: true;
    initial-value: 0ms;
}

#game-over .row {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.25rem;
    --row-delay: calc(200ms * (sibling-index() - 1));

    /* animation: row-enter 1s var(--smooth-easing) var(--row-delay) backwards; */
}

#game-over .row * {
    animation: row-enter 1s var(--smooth-easing) backwards;
    animation-delay: calc(var(--row-delay) + 50ms * sibling-index());
}

@keyframes row-enter {
    from {
        opacity: 0;
        translate: 2rem 0;
    }
}

#game-over .tile {
    height: calc(var(--tile-height) * 0.8);
    width: calc(var(--tile-width) * 0.8);
    font-size: 2.25rem;

    animation: 
        row-enter 1s var(--smooth-easing) backwards,
        valid-shine 1s backwards;
    animation-delay: calc(var(--row-delay) + 50ms * sibling-index());
}

#game-over .row span {
    margin-left: 1rem;

    font: 3rem "Martian Mono";
    font-weight: 900;
    color: white;
    text-shadow: var(--text-glow);
}

#game-over .scores {
    display: grid;
    grid-template-rows: auto auto;
    grid-template-columns: auto auto;
    row-gap: 4rem;
    column-gap: 4rem;
    padding-right: 5rem;
    align-self: center;

    color: white;
}

#game-over .scores > div {
    margin: auto;
}

#game-over .scores h2 {
    font: 2.5rem "Clash Display";
    font-weight: 500;
    text-shadow: var(--text-shadow);
    text-box: trim-both cap alphabetic;
    margin-bottom: 1rem;
}

#game-over .scores h1 {
    font: 6rem "Martian Mono";
    font-weight: 900;
    text-shadow: var(--text-glow);
    text-box: trim-both cap alphabetic
}

#game-over .final-score {
    grid-row: 1;
    grid-column: span 2;
}

#game-over .final-score h2 {
    font-size: 3rem;
}

#game-over .final-score h1 {
    font-size: 12rem;
}


.background {
    position: fixed;
    display: flex;
    flex-direction: column;
    width: 100vw;
    gap: 2rem;

    opacity: 0.07;
    z-index: -999;
    user-select: none;
}

.background .row {
    display: flex;
    /* overflow: hidden; */
}

.background span {
    color: black;
    font: 24vw "Cabinet Grotesk";
    font-weight: 900;

    display: inline-block;
    width: max-content;
    text-box: trim-both cap alphabetic;
    animation: marquee 14s linear infinite;
}

.background .row:nth-child(2n) span {
    animation-direction: reverse;
    animation-duration: 20s;
    opacity: 0.8;
}

@keyframes marquee {
    from { transform: translateX(0); }
    to   { transform: translateX(-100%); }
}



dialog {
    border-color: #ffffff44;
    border-width: 0.2rem;
    background: #ffffffaa;
    backdrop-filter:
        blur(1rem)
        brightness(1.25);
}

dialog[open]::backdrop {
    background: #00000000;
    /* backdrop-filter: none; */
}

dialog p {
    color: var(--text-color);
}

#how-to-play {
    width: 38rem;
}

#how-to-play .pseudo-worm {
    display: flex;
    gap: var(--tile-gap);
    justify-content: end;
    margin-bottom: 2rem;

    width: stretch;
    justify-content: flex-end;
    mask-image: linear-gradient(to right, transparent, white 35%, white);
}

#how-to-play .pseudo-worm .tile {
    border-color: var(--text-color);
    color: var(--text-color);
    box-shadow:
        0 0 0.75rem #00000022,
        inset 0 -0.5rem 1.5rem #0000001b;

    animation: none;
}


/* dialog h1, dialog h2 {
    color: white;
    text-shadow: var(--text-shadow);
} */