/* begin license *
 *
 * Small browser games on swl and swindl
 *
 * All rights reserved.
 *
 * Copyright (C) 2026 moatley moatley@lost-monkeys.net
 *
 * This file is part of "Games"
 *
 * end license */

/* Jump: the header on top, the jungle (a canvas) fills the rest of the screen. */
:root {
    --jump-bg: #e4f2dc;
    --jump-panel: #ffffff;
    --jump-text: #22302a;
    --jump-muted: #6c7a72;
    --jump-pad: rgba(255, 255, 255, .55);
    --jump-pad-on: rgba(255, 255, 255, .9);
}
:root[data-theme="dark"] {
    --jump-bg: #0f1a24;
    --jump-panel: #1f2a36;
    --jump-text: #eceef4;
    --jump-muted: #8d99a5;
    --jump-pad: rgba(255, 255, 255, .12);
    --jump-pad-on: rgba(255, 255, 255, .3);
}

body.jump-page {
    margin: 0;
    background: var(--jump-bg);
    color: var(--jump-text);
    overflow: hidden;
    overscroll-behavior: none;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

.jump {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    max-width: 34rem;
    margin: 0 auto;
    padding: env(safe-area-inset-top) 0 0;
    box-sizing: border-box;
}

.jump-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .75rem .75rem .5rem;
    flex: 0 0 auto;
}
.jump-back, .jump-new {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border: 0;
    border-radius: 50%;
    background: var(--jump-panel);
    color: var(--jump-text);
    font-size: 1.2rem;
    text-decoration: none;
    cursor: pointer;
}
.jump-scores { display: flex; gap: 2rem; }
.jump-score { display: flex; flex-direction: column; align-items: center; min-width: 4rem; }
.jump-score > span:last-child { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.jump-label { font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: var(--jump-muted); }
.jump-portrait {
    width: 3.4rem;
    height: 3.4rem;
    border-radius: 50%;
    overflow: hidden;
    background: var(--jump-panel);
    flex: 0 0 auto;
}

.jump-stage {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    touch-action: none;
    cursor: pointer;
}
@media (min-width: 34rem) {
    .jump-stage { border-radius: 1rem 1rem 0 0; }
}
.jump-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* the monkey: placed by jump.js with a transform; his feet at the bottom middle */
.jump-monkey {
    position: absolute;
    left: 0;
    top: 0;
    pointer-events: none;
    will-change: transform;
}
.jump-monkey[hidden] { display: none; }
.jump-mascot { display: block; width: 100%; height: 100%; overflow: visible; }

/* where to hold: the two halves of the screen */
.jump-pad {
    position: absolute;
    bottom: calc(1rem + env(safe-area-inset-bottom));
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    background: var(--jump-pad);
    color: var(--jump-text);
    font-size: 1.5rem;
    pointer-events: none;
    transition: background .1s, transform .1s;
}
.jump-pad[hidden] { display: none; }
.jump-pad-left { left: 1rem; }
.jump-pad-right { right: 1rem; }
.jump-pad.jump-on { background: var(--jump-pad-on); transform: scale(1.1); }
@media (hover: hover) and (pointer: fine) {
    /* a keyboard is likely: no need for the buttons */
    .jump-pad { opacity: .6; }
}

.jump-hint {
    position: absolute;
    left: 50%;
    bottom: calc(5.5rem + env(safe-area-inset-bottom));
    transform: translateX(-50%);
    margin: 0;
    padding: .4rem .9rem;
    border-radius: 1rem;
    background: var(--jump-panel);
    color: var(--jump-text);
    font-size: .9rem;
    white-space: nowrap;
    pointer-events: none;
    transition: opacity .6s;
}
.jump-hint.jump-gone { opacity: 0; }

.jump-pop {
    position: absolute;
    left: 0;
    top: 0;
    font-weight: 800;
    font-size: 1.1rem;
    color: #e0a100;
    text-shadow: 0 1px 3px rgba(0, 0, 0, .35);
    pointer-events: none;
    animation: jump-pop .9s ease-out forwards;
}
@keyframes jump-pop {
    from { opacity: 1; translate: 0 0; }
    to { opacity: 0; translate: 0 -2.5rem; }
}
@media (prefers-reduced-motion: reduce) {
    .jump-pop { animation: jump-fade .9s forwards; }
    @keyframes jump-fade { to { opacity: 0; } }
    .jump-pad { transition: none; }
}

.jump-over {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, .45);
}
.jump-over[hidden] { display: none; }
.jump-over-box {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: .5rem 1rem;
    margin: 0 1rem;
    padding: 1.5rem 2rem;
    border-radius: 1rem;
    background: var(--jump-panel);
    color: var(--jump-text);
}
.jump-over-box h2 { margin-top: 0; }
.jump-over-best { color: #e0a100; font-weight: 700; }
.jump-over-mascot { width: 7.5rem; height: auto; }
.jump-over-buttons { grid-column: 1 / -1; display: flex; justify-content: center; gap: .75rem; }
