* {
margin: 0;
padding: 0;
box-sizing: border-box;
}

:root {
    --w: 320px;
    --bg: #060606;
    --fg: #f4f4f4;
}

html {
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
}

body {
    background: var(--bg);
    color: var(--fg);
    font-family: "Unbounded", sans-serif;
    -webkit-font-smoothing: antialiased;
}

::selection {
    background: var(--fg);
    color: var(--bg);
}

.hero,
.step,
.cta {
    min-height: 100vh;
    min-height: 100svh;
    display: grid;
    place-items: center;
    scroll-snap-align: start;
    padding: 48px 24px;
}

.hero h1 {
    font-weight: 800;
    font-size: clamp(34px, 6.5vw, 78px);
    line-height: 1.1;
    letter-spacing: -0.01em;
    text-align: center;
    max-width: 920px;
}

.num {
    display: block;
    color: #4d4d4d;
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 0.4em;
    margin-bottom: 22px;
}

.game-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
}

.game-inner h2 {
    font-size: 24px;
    font-weight: 700;
    line-height: 1.42;
    overflow-wrap: break-word;
    margin-bottom: 28px;
}

.board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    width: min(760px, 92vw, 74vh);
    width: min(760px, 92vw, 74svh);
    aspect-ratio: 1 / 1;
    background: #0d0d0d;
    border: 1px solid #1d1d1d;
    border-radius: 22px;
    padding: 6px;
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.6);
    user-select: none;
    touch-action: manipulation;
}

.tile {
    border-radius: 0;
    border: 1px solid #1d1d1d;
    background-size: cover;
    background-position: center;
    cursor: pointer;
    transition: transform 0.16s ease, opacity 0.16s ease;
}

.tile:hover {
    transform: scale(0.96);
    opacity: 0.9;
}

.tile.empty {
    border-radius: 0;
    background: transparent;
    border: 1px dashed #1d1d1d;
    cursor: default;
}

.tile.empty:hover {
    transform: none;
    opacity: 1;
}

.controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 18px;
    margin-top: 26px;
}

.stats {
    color: #4d4d4d;
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.2em;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--fg);
    color: var(--bg);
    font-family: inherit;
    font-weight: 700;
    font-size: 14px;
    padding: 14px 30px;
    border: none;
    border-radius: 16px;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.15s ease, opacity 0.15s ease;
}

.btn:hover:not(:disabled) {
    transform: translateY(-3px);
}

.btn:disabled {
    opacity: 0.45;
    cursor: default;
}

.board-error {
    grid-column: 1 / -1;
    display: grid;
    place-items: center;
    color: #4d4d4d;
    font-size: 13px;
    line-height: 1.6;
    text-align: center;
    padding: 20px;
}

@media (max-height: 840px) {
    .game-inner h2 {
        font-size: 19px;
    }

    .board {
        width: min(640px, 88vw, 66vh);
        width: min(640px, 88vw, 66svh);
    }
}

@media (max-width: 780px) {
    html {
        scroll-snap-type: y proximity;
    }

    .game-inner h2 {
        font-size: 20px;
    }

    .board {
        width: min(560px, 92vw, 72vh);
        width: min(560px, 92vw, 72svh);
    }

    .btn {
        font-size: 13px;
        padding: 12px 22px;
    }
}
