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

:root {
    --tile-gap: 1rem;
    --tile-size: 8rem;
    --primary-color: #ff972f;
    --secondary-color: #ff5917;
    --color-gradient: linear-gradient(var(--primary-color), var(--secondary-color));
    --color-gradient-flip: linear-gradient(var(--secondary-color), var(--primary-color));
    --glow-color: rgba(255, 151, 47, 0.65);

    --fade-in: 0.5s;
    --fade-away: 0.5s;

    --bad: #ff325f;
    --bad-darker: #d7002f;
}

html, body {
    width: 100vw;
    height: 100dvh;
    position: fixed;
    margin: 0;
    box-sizing: border-box;
    touch-action: none;
    overscroll-behavior: none;
}

body {
    overflow-x: hidden;
    overflow-y: auto;
    position: relative;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    animation: come-in var(--fade-in) forwards;
}

.title {
    margin-bottom: 1.5rem;
}

.gradient {
	background: var(--color-gradient);
	background-clip: text;
	color: transparent;
}

.statement {
    color: var(--secondary-color);
}

strong.gradient, strong.statement {
    font-weight: 900;
}

.navbar.regular {
	position: relative;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;

	justify-content: center;
}

#game {
    display: flex;
    flex-direction: column;
    margin-top: 6rem;

    animation: come-in var(--fade-in) backwards;
}

#game.fade {
    animation: go-away var(--fade-away) forwards;
}

.row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--tile-gap);

    height: var(--tile-size);
}

#empty {
    display: flex;
    flex-direction: column;
    margin-bottom: 6rem;
}

@keyframes come-in { from { opacity: 0; } }
@keyframes go-away { to { opacity: 0; } }

.tile {
    height: 100%;
    width: auto;
    aspect-ratio: 1;
    box-sizing: border-box;
    
    background: var(--color-gradient);
    border-radius: 0.75rem;
    box-shadow: 0 0 0.75rem var(--glow-color);

    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;

    font: calc(var(--tile-size) / 2) 'Martian Mono';
    font-weight: 600;
    text-shadow: 0 0.3rem 0.65rem #0000001f;
    touch-action: none;
    user-select: none;
}

.tile::after {
    content: attr(data-number);
    color: white;
}

.tile.empty {
    background: none;
    box-shadow: none;
    border: 0.25rem dashed var(--secondary-color);
    box-shadow: inset 0 0.25rem 1.5rem rgba(255, 151, 47, 0.307);
}

.tile.empty::after {
    color: var(--secondary-color);
    text-shadow: none;
    font-weight: 200;
    opacity: 0.5;
}

@property --pseudo-p {
    syntax: "<color>";
    inherits: false;
    initial-value: black;
}

@property --pseudo-s {
    syntax: "<color>";
    inherits: false;
    initial-value: black;
}

#given > .tile {
    --pseudo-p: var(--primary-color);
    --pseudo-s: var(--secondary-color);

    background: linear-gradient(var(--pseudo-p), var(--pseudo-s));
    position: relative;
    cursor: grab;
    transition:
        opacity 0.25s,
        scale 0.7s var(--spring-easing),
        rotate 50ms,
        box-shadow 0.7s var(--spring-easing);
}

#given .tile.new {
    animation: pulse 0.7s var(--smooth-easing) backwards;
    animation-delay: calc(40ms * sibling-index());
}

@keyframes pulse {
    from {
        translate: 0 -2rem;
        rotate: -8deg;
        opacity: 0;
    }
}

#given > .tile.snapping {
    transition:
        opacity 0.25s,
        scale 0.7s var(--spring-easing),
        rotate 50ms,
        box-shadow 0.7s var(--spring-easing),
        translate 0.35s var(--smooth-easing);
}

#given > .tile.wrong {
    animation: flash-wrong 0.65s;
}

@keyframes flash-wrong {
    50% {
        --pseudo-p: var(--bad);
        --pseudo-s: var(--bad);
    }
}

#game.end .tile {
    cursor: default;
}

#game:not(.end) .tile.active {
    cursor: grabbing;
    scale: 0.9;
    z-index: 4;
    opacity: 0.85;
    box-shadow: 0 0.25rem 1rem #d442078f;
}

.requirements {
    display: flex;
    gap: var(--tile-gap);
    margin: 0.5rem 0;
}

.requirements > p {
    width: var(--tile-size);
    position: relative;

    display: flex;
    text-align: center;
    justify-content: center;
    flex-direction: column;
    color: var(--secondary-color);
    font: 1.25rem 'Martian Mono';
    font-weight: 800;
    border-color: var(--secondary-color);
}

.requirements > p[data-span]::after {
    content: "";
    position: absolute;
    box-sizing: border-box;
    width: 100%;
    height: 1.5rem;
    left: 0;
    border: 0.25rem solid;
}

.requirements > p[data-span].wrong {
    animation: req-flash-wrong 0.65s;
}

@keyframes req-flash-wrong {
    50% {
        color: var(--bad-darker);
        border-color: var(--bad-darker);
    }
}

.requirements:nth-of-type(1) > p {
    padding-bottom: 2rem;
    justify-content: end;
}

.requirements:nth-of-type(3) > p {
    padding-top: 2rem;
    justify-content: start;
}

.requirements:nth-of-type(1) > p::after {
    bottom: 0;
    border-bottom: none;
}

.requirements:nth-of-type(3) > p::after {
    top: 0;
    border-top: none;
}

#tip {
    display: flex;
    justify-content: center;

    margin-top: 2rem;
    font: 1.5rem "Cabinet Grotesk";
    white-space: preserve nowrap;
    align-self: center;
    max-width: var(--tile-size);

    user-select: auto;
}

#tip:not(.new, .proceed) { opacity: 0; }
#tip.new {
    animation: come-in 2s backwards;
    animation-delay: 5s;
}

#tip > strong {
    margin-right: 0.5rem;
    user-select: none;
}

#tip span {
    font-weight: bold;
}

#tip.proceed {
    animation: flash 0.5s;
}

@keyframes flash { from {opacity: 0;} }

#tip.proceed > strong { margin: 0 }
#tip.proceed > span { display: none }

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

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

#stats span {
    font-family: "Martian Mono";
    font-weight: 900;
    user-select: none;
    display: inline-block;
}

@property --combo {
    syntax: "<number>";
    inherits: false;
    initial-value: 1;
}

#stats span.update {
    animation:
        twitch calc(0.75s + (0.05s * min(var(--combo), 6))) var(--spring-easing);
}

@keyframes twitch {
    from {
        rotate: min(5deg + 5deg * var(--combo), 30deg);
    }
}

#mistake-count {
    color: var(--bad); 
}

@property --progress {
    syntax: "<number>";
    inherits: true;
    initial-value: 12;
}

@property --timer-color {
    syntax: "<color>";
    inherits: true;
    initial-value: black;
}

#timer:not(.active) {
    display: none;
}

#timer.danger {
    --timer-color: var(--bad);
}

#timer {
    --timer-color: color-mix(
        in srgb,
        var(--primary-color) calc(1% * var(--progress)),
        var(--secondary-color) calc(100% - 1% * var(--progress)) );

    position: relative;
    background: none;
    display: flex;
    flex-direction: row;
    justify-content: end;
    width: 40rem;
    max-width: stretch;
    border-bottom: 0.2rem solid black;
    border-color: var(--timer-color);

    animation: timer-bounce-in 1.5s var(--bounce-easing), come-in 1.5s;
}

@keyframes timer-bounce-in {
    from {
        translate: 0 -1rem;
    }
}

#timer .progress {
    position: absolute;
    left: 0;
    background-color: var(--timer-color);
    width: calc(1% * var(--progress));
    height: 100%;
    overflow: hidden;
    box-shadow: 0 0.5rem 1rem rgb(from var(--timer-color) r g b / 35% );
}

#timer.tween {
    transition:
        --progress 0.5s var(--smooth-easing),
}

.time-left {
    font: 1.25rem "Martian Mono";
    font-weight: 900;
    margin: 0 0 0.5rem 0;
}

#time-left {
    color: var(--timer-color);
}

#time-mask {
    position: absolute;
    right: calc(-100% * (100/var(--progress) - 1)); /* I'm a genius!!!!! */
    color: white;
    user-select: none;
}

#timer-label {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;

    font: 1.25rem "Cabinet Grotesk";
    font-weight: 800;
    color: var(--timer-color);
}


/* DIALOGS ---------------------------------------------------------------------------------------------------- */





#how-to-play {
    width: min-content;
}

#how-to-play ol, #how-to-play ul {
    margin: 0;
}

#how-to-play .examples {
    display: flex;
    flex-direction: row;
    gap: 4rem;
    margin: 2rem 0;
}

#how-to-play .examples > div {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: fit-content;
    flex: 0 1;
}

#how-to-play .examples .label {
    text-align: center;
    align-self: center;
}

#how-to-play .example {
    display: flex;
    flex-direction: column;
    width: min-content;
    margin-inline: 2rem;
}

#how-to-play .row {
    align-self: start;
    position: relative;
    height: 4rem;
}

#settings .category {
    border: 1.5px solid #dde;
    border-radius: 1rem;

    display: grid;
    align-self: stretch;
}

#settings .setting {
    padding: 1rem 2rem;
}

#settings .setting h2 {
    font-weight: 700;
}

#settings .setting:not(:last-child) {
    border-bottom: 1.5px solid #dde;
}

dialog .requirements {
    gap: 0.5rem;
}

dialog .requirements > p {
    font-size: 1rem;
}

dialog .requirements > p[data-span]::after {
    height: 1.25rem;
    border-width: 0.2rem;
}

dialog .requirements:nth-of-type(1) > p {
    padding-bottom: 1.75rem;
}

dialog .requirements:nth-of-type(3) > p {
    padding-top: 1.75rem;
}

dialog .tile.floating {
    position: absolute;
}

@media (max-width: 768px) {
    :root {
        --tile-gap: 0.5rem;
    }

    html {
        font-size: 14px;
    }
    
    body {
        justify-content: start;
    }

    #game {
        margin: 0 calc(var(--tile-gap) * 4);
        flex: 1 1;
        align-self: stretch;
        justify-content: center;
    }

    .row {
        height: auto;
    }

    .tile {
        flex: 1;
        aspect-ratio: 1;
    }

    .requirements > p {
        font-size: 1rem;
    }

    #tip {
        display: inline-block;
        font-size: 1.25rem;

        max-width: inherit;
        align-self: stretch;
        text-align: center;
        white-space: inherit;
    }

    #tip > strong { margin-right: 0.35rem; }

    #stats {
        margin: 1rem 2rem;
        order: 1;
        align-self: stretch;
        justify-content: space-between;
    }

    #stats h2 {
        font-size: 1.25rem;
        font-weight: 600;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    #stats span {
        font-size: 2rem;
    }

    #timer {
        width: stretch;
        margin: 1rem 2rem;
    }
}

@media (max-width: 32rem) {
    #how-to-play {
        width: 100vw;
        /*max-height: 75dvh;*/
    }
    
    #how-to-play .examples {
        flex-direction: column;
        align-items: center;
        gap: 2rem;
    }
    
    #how-to-play .what {
        display: none;
    }
}