:root {
    --bg: #edf5ff;
    --bg-strong: #d7e8ff;
    --surface: rgba(255, 255, 255, 0.92);
    --surface-solid: #ffffff;
    --surface-soft: rgba(218, 234, 255, 0.72);
    --text: #1f2942;
    --muted: #7f8ba8;
    --accent: #2f80ff;
    --accent-strong: #1e66e6;
    --shadow: 0 18px 44px rgba(57, 106, 188, 0.14);
    --shadow-soft: 0 10px 28px rgba(95, 136, 206, 0.12);
    --radius-xl: 32px;
    --radius-lg: 22px;
    --radius-md: 18px;
    --radius-sm: 16px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    height: 100%;
    background:
        radial-gradient(circle at top, rgba(255, 255, 255, 0.98), transparent 38%),
        linear-gradient(180deg, #f7fbff 0%, #e6f1ff 100%);
    color: var(--text);
    font-family: Inter, Arial, Helvetica, sans-serif;
    overflow: hidden;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

body {
    min-height: 100dvh;
    width: 100%;
}

button {
    font: inherit;
}

.app-shell {
    min-height: 100dvh;
    height: 100dvh;
    width: 100%;
    padding: 0;
}

.game-screen {
    place-items: center;
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-rows: minmax(0, 1fr);
    overflow: hidden;
    padding:
        max(8px, env(safe-area-inset-top))
        max(10px, env(safe-area-inset-right))
        max(10px, env(safe-area-inset-bottom))
        max(10px, env(safe-area-inset-left));
}

.top-stats {
    position: absolute;
    top: 12px;
    left: 12px;
    right: 12px;
    z-index: 3;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: stretch;
    gap: 6px;
    pointer-events: none;
}

.stat-card,
.score-card,
.mission-card,
.circle-button,
.overlay-content {
    border-radius: var(--radius-lg);
    border: 1px solid rgba(152, 184, 234, 0.2);
    background: rgba(255, 255, 255, 0.6);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(14px);
}

.stat-card,
.score-card {
    min-height: 52px;
    background: rgba(255, 255, 255, 0.52);
}

.stat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    text-align: center;
    padding: 7px 7px 6px;
}

.stat-card p,
.score-card p,
.mission-copy p {
    margin: 0;
}

.stat-pill {
    min-width: 0;
    width: 100%;
    min-height: 0;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.stat-pill strong,
.score-card strong {
    font-size: 17px;
    line-height: 1;
    font-weight: 700;
    color: var(--text);
}

.stat-icon {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
}

.stat-icon img,
.mission-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.stat-card p,
.score-card p {
    color: var(--muted);
    font-size: 10px;
    line-height: 1.15;
}

.score-card {
    min-width: 76px;
    padding: 8px 11px 7px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    background: rgba(255, 255, 255, 0.52);
}

.board-stage {
    display: grid;
    place-items: center;
    min-height: 0;
    height: 100%;
    width: 100%;
    padding: 0;
}

.board-frame {
    position: relative;
    width: min(100%, 390px);
    height: min(100%, 690px);
    margin: 0 auto;
    border-radius: 30px;
    overflow: hidden;
    background: transparent;
    box-shadow: none;
}

#board {
    display: block;
    width: 100%;
    height: 100%;
    background-image: url("./jumper-bg.webp");
    background-size: cover;
    background-position: center;
}

.board-decor {
    position: absolute;
    inset: auto auto 0 0;
    pointer-events: none;
    opacity: 0.58;
    filter: blur(1px);
}

.board-decor--left {
    left: -6%;
    bottom: 18%;
    width: 44%;
    height: 32%;
    background: radial-gradient(circle, rgba(191, 224, 255, 0.6), rgba(191, 224, 255, 0));
}

.board-decor--right {
    right: -4%;
    top: 20%;
    width: 34%;
    height: 24%;
    background: radial-gradient(circle, rgba(214, 232, 255, 0.66), rgba(214, 232, 255, 0));
}

.board-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(228, 239, 255, 0.52);
    z-index: 5;
}

.board-overlay.is-hidden {
    display: none;
}

.overlay-content {
    max-width: 238px;
    padding: 18px 16px;
    text-align: center;
    justify-items: center;
}

.overlay-title {
    margin: 4px 0 10px;
    font-size: 28px;
    font-weight: 700;
}

.overlay-kicker {
    margin: 0;
    color: var(--accent);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.overlay-kicker.is-hidden {
    display: none;
}

.overlay-copy {
    margin: 0 0 18px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.4;
}

.primary-button {
    border-radius: 999px;
    border: 0;
    background: linear-gradient(180deg, #3d93ff 0%, #1e66e6 100%);
    color: #ffffff;
    min-height: 46px;
    padding: 0 20px;
    box-shadow: 0 14px 24px rgba(47, 128, 255, 0.24);
}

.primary-button.is-hidden {
    display: none;
}

.bottom-bar {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 12px;
    z-index: 3;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 7px;
}

.circle-button {
    width: 52px;
    height: 52px;
    border: 0;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.62);
}

.circle-button__icon {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
}

.circle-button__icon svg {
    width: 24px;
    height: 24px;
    display: block;
    fill: var(--accent);
}

.mission-card {
    min-height: 52px;
    padding: 8px 11px 9px;
}

.mission-copy {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}

.mission-copy p {
    font-size: 11px;
    line-height: 1.2;
    font-weight: 600;
}

.mission-icon {
    width: 14px;
    height: 14px;
    flex: 0 0 auto;
    color: var(--accent);
}

.progress-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px;
    align-items: center;
}

.progress-track {
    height: 10px;
    border-radius: 999px;
    background: rgba(47, 128, 255, 0.12);
    overflow: hidden;
}

.progress-fill {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #2f80ff 0%, #1e66e6 100%);
}

.progress-value {
    color: var(--accent);
    font-size: 10px;
}

#restartButton {
    display: none;
}

@media (max-width: 480px), (max-height: 780px) {
    .app-shell {
        padding: 0;
    }

    .game-screen {
        padding:
            max(6px, env(safe-area-inset-top))
            max(8px, env(safe-area-inset-right))
            max(8px, env(safe-area-inset-bottom))
            max(8px, env(safe-area-inset-left));
    }

    .overlay-content {
        max-width: 228px;
        padding: 18px 16px;
    }

    .overlay-title {
        font-size: 24px;
    }

    .board-frame {
        border-radius: 28px;
    }

    .top-stats {
        top: 8px;
        left: 8px;
        right: 8px;
        gap: 5px;
    }

    .stat-card,
    .score-card {
        min-height: 48px;
    }

    .stat-pill {
        min-height: 0;
        padding: 0;
    }

    .stat-pill strong,
    .score-card strong {
        font-size: 16px;
    }

    .stat-card p,
    .score-card p {
        font-size: 9px;
    }

    .bottom-bar {
        left: 8px;
        right: 8px;
        bottom: 8px;
        gap: 6px;
    }

    .mission-card {
        min-height: 48px;
        padding: 8px 10px 9px;
    }

    .mission-copy p,
    .progress-value {
        font-size: 10px;
    }

    .circle-button {
        width: 48px;
        height: 48px;
    }

    .circle-button__icon {
        width: 24px;
        height: 24px;
    }

    .circle-button__icon svg {
        width: 22px;
        height: 22px;
    }
}
