/* Keyboard Jump — full stage to footer, no chrome buttons */

.kj-sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

html.site-typing-app-html:has(body.kj-page) {
    height: auto;
    overflow: auto;
}

body.kj-page.site-typing-app {
    min-height: 100vh;
    height: auto;
    overflow: auto;
    display: flex;
    flex-direction: column;
    background: var(--chrome-bg, #323437);
}

body.kj-page .main-content {
    flex: 1 1 auto;
    max-width: none;
    padding: 0;
    min-height: auto;
    height: auto;
    overflow: visible;
    display: flex;
    flex-direction: column;
}

body.kj-page.site-typing-app .footer.footer-mt-minimal {
    position: relative;
    bottom: auto;
    margin-top: auto;
    flex: 0 0 auto;
    height: auto;
    min-height: var(--chrome-footer-min-h, 36px);
    max-height: none;
}

.kj-app {
    --kj-w: 980px;
    --kj-accent: var(--chrome-accent, #e2b714);
    --kj-bg: var(--chrome-bg, #323437);
    --kj-surface: var(--chrome-surface, #2c2e31);
    --kj-text: var(--chrome-text, #d1d0c5);
    --kj-muted: var(--chrome-sub, #646669);
    --kj-border: var(--chrome-border, #4a4d52);
    flex: 1 1 auto;
    min-height: 0;
    width: min(var(--kj-w), 100%);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    color: var(--kj-text);
}

.kj-chrome {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.45rem 0.85rem;
}

.kj-back {
    color: var(--kj-muted);
    text-decoration: none;
    font-size: 0.85rem;
    white-space: nowrap;
}

.kj-back:hover { color: var(--kj-accent); }

.kj-hud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem 1rem;
    justify-content: center;
    font-family: 'Roboto Mono', ui-monospace, monospace;
    font-size: 0.82rem;
}

.kj-hud em {
    font-style: normal;
    color: var(--kj-muted);
    margin-right: 0.25rem;
    font-size: 0.68rem;
    letter-spacing: 0.04em;
}

.kj-hud strong {
    font-weight: 600;
    color: var(--kj-text);
}

.kj-lang {
    background: var(--kj-surface);
    color: var(--kj-text);
    border: 1px solid var(--kj-border);
    border-radius: 8px;
    padding: 0.28rem 0.45rem;
    font: inherit;
    font-size: 0.8rem;
}

.kj-stage {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
    border-top: 1px solid color-mix(in srgb, var(--kj-border) 70%, transparent);
    background:
        radial-gradient(ellipse 70% 40% at 50% 0%, color-mix(in srgb, var(--kj-accent) 10%, transparent), transparent 55%),
        var(--kj-bg);
}

/* Big target word — always visible */
.kj-word-panel {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 1rem 1rem 0.55rem;
    z-index: 4;
    position: relative;
    cursor: text;
}

.kj-target-word {
    min-height: 2.4rem;
    max-width: min(920px, 94%);
    font-family: 'Roboto Mono', 'Noto Sans Tamil', ui-monospace, monospace;
    font-size: clamp(1.85rem, 4.2vw, 2.75rem);
    font-weight: 700;
    letter-spacing: 0.03em;
    line-height: 1.2;
    text-align: center;
    color: var(--kj-text);
    word-break: break-word;
    pointer-events: none;
}

.kj-target-word .kj-ch.is-wait {
    color: var(--kj-muted);
}

.kj-target-word .kj-ch.is-next {
    color: var(--kj-accent);
    background: color-mix(in srgb, var(--kj-accent) 18%, transparent);
    border-radius: 4px;
    text-decoration: none;
    box-shadow: none;
}

.kj-caret {
    display: inline-block;
    width: 0.12em;
    margin-right: 0.06em;
    color: var(--kj-accent);
    font-weight: 400;
    animation: kj-caret-blink 1s steps(1) infinite;
}

@keyframes kj-caret-blink {
    0%, 45% { opacity: 1; }
    46%, 100% { opacity: 0; }
}

.kj-target-word .kj-ch.is-ok {
    color: var(--kj-text);
}

.kj-target-word .kj-ch.is-bad {
    color: #ca4754;
}

.kj-target-fuse {
    width: min(280px, 50%);
    height: 5px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--kj-border) 70%, transparent);
    overflow: hidden;
}

.kj-target-fuse > i {
    display: block;
    width: 100%;
    height: 100%;
    transform-origin: left center;
    transform: scaleX(1);
    background: var(--kj-accent);
}

.kj-target-fuse.is-critical > i {
    background: #ca4754;
}

.kj-arena.game-arena {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    margin: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    overflow: hidden;
}

.kj-app .game-mode-keyboard-jump {
    background: transparent !important;
    border: none !important;
}

/* Capture field sits on the word so the first key always lands here */
.kj-input.game-input {
    position: absolute;
    left: 50%;
    top: 0.85rem;
    transform: translateX(-50%);
    width: min(640px, 92%);
    height: 3.2rem;
    opacity: 0;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    resize: none;
    z-index: 8;
    caret-color: transparent;
    background: transparent !important;
    color: transparent !important;
    box-shadow: none !important;
    outline: none !important;
    cursor: text;
}

.kj-scene {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.kj-skyline {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(color-mix(in srgb, var(--kj-border) 18%, transparent) 1px, transparent 1px),
        linear-gradient(90deg, color-mix(in srgb, var(--kj-border) 18%, transparent) 1px, transparent 1px);
    background-size: 36px 36px;
    opacity: 0.28;
    mask-image: linear-gradient(180deg, #000 0%, #000 55%, transparent 100%);
    pointer-events: none;
}

/* World stands on the arena floor (just above site footer) */
.kj-world {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 8px;
    height: 2400px;
    transform: translateY(0);
    will-change: transform;
}

.kj-world.is-scrolling {
    transition: transform 0.72s cubic-bezier(0.18, 0.9, 0.22, 1);
}

.kj-ground-pad {
    position: absolute;
    left: 50%;
    bottom: 0;
    width: min(240px, 42%);
    height: 10px;
    transform: translateX(-50%);
    border-radius: 999px;
    background: color-mix(in srgb, var(--kj-accent) 30%, var(--kj-surface));
    border: 1px solid color-mix(in srgb, var(--kj-accent) 45%, var(--kj-border));
}

.kj-tiles {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.kj-tile {
    position: absolute;
    left: 50%;
    bottom: 0;
    width: 124px;
    height: 16px;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.kj-tile-plank {
    width: 100%;
    height: 14px;
    border-radius: 8px;
    background: color-mix(in srgb, var(--kj-surface) 78%, #000 22%);
    border: 1px solid var(--kj-border);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.28);
}

.kj-tile-glow {
    position: absolute;
    inset: -6px -10px;
    border-radius: 12px;
    opacity: 0;
    background: color-mix(in srgb, var(--kj-accent) 22%, transparent);
}

.kj-tile.is-active { z-index: 3; }

.kj-tile.is-active .kj-tile-plank {
    background: color-mix(in srgb, var(--kj-accent) 48%, var(--kj-surface));
    border-color: color-mix(in srgb, var(--kj-accent) 60%, var(--kj-border));
    box-shadow:
        0 0 0 1px color-mix(in srgb, var(--kj-accent) 45%, transparent),
        0 8px 20px color-mix(in srgb, var(--kj-accent) 25%, transparent);
}

.kj-tile.is-active .kj-tile-glow { opacity: 1; }
.kj-tile.is-upcoming .kj-tile-plank { opacity: 0.85; }
.kj-tile.is-passed { opacity: 0.4; }
.kj-tile.is-broken { opacity: 0.22; filter: grayscale(0.5); }
.kj-tile.is-breaking { animation: kj-tile-crack 0.42s ease forwards; }
.kj-tile.is-critical .kj-tile-plank {
    border-color: #ca4754;
    box-shadow: 0 0 0 1px color-mix(in srgb, #ca4754 50%, transparent);
}

.kj-human {
    position: absolute;
    left: 50%;
    bottom: 0;
    z-index: 5;
    width: 42px;
    height: 70px;
    transform: translateX(-50%);
    transition: left 0.72s cubic-bezier(0.18, 0.9, 0.22, 1), bottom 0.72s cubic-bezier(0.18, 0.9, 0.22, 1);
    will-change: left, bottom;
}

.kj-human-figure {
    position: relative;
    width: 100%;
    height: 100%;
    transform-origin: center bottom;
}

.kj-human.is-jumping .kj-human-figure {
    animation: kj-human-leap 0.72s cubic-bezier(0.18, 0.9, 0.22, 1);
}

.kj-human.is-landing .kj-human-figure {
    animation: kj-human-land 0.22s ease-out;
}

.kj-human.is-shake .kj-human-figure {
    animation: kj-human-shake 0.3s ease;
}

.kj-human:not(.is-jumping):not(.is-landing):not(.is-falling):not(.is-shake) .kj-human-figure {
    animation: kj-human-idle 2.4s ease-in-out infinite;
}

.kj-head {
    position: absolute;
    left: 50%;
    top: 2px;
    width: 16px;
    height: 16px;
    margin-left: -8px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--kj-text) 88%, var(--kj-accent));
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--kj-accent) 25%, transparent);
}

.kj-eye {
    position: absolute;
    top: 6px;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--kj-bg) 70%, #111);
}

.kj-eye-l { left: 3px; }
.kj-eye-r { right: 3px; }

.kj-torso {
    position: absolute;
    left: 50%;
    top: 20px;
    width: 18px;
    height: 24px;
    margin-left: -9px;
    border-radius: 6px;
    background: var(--kj-accent);
}

.kj-arm {
    position: absolute;
    top: 22px;
    width: 5px;
    height: 18px;
    border-radius: 4px;
    background: color-mix(in srgb, var(--kj-accent) 70%, #000 30%);
    transform-origin: top center;
}

.kj-arm-l { left: 6px; transform: rotate(8deg); }
.kj-arm-r { right: 6px; transform: rotate(-8deg); }

.kj-leg {
    position: absolute;
    bottom: 2px;
    width: 6px;
    height: 22px;
    border-radius: 4px;
    background: color-mix(in srgb, var(--kj-text) 55%, var(--kj-surface));
    transform-origin: top center;
}

.kj-leg-l { left: 11px; }
.kj-leg-r { right: 11px; }

.kj-dust {
    position: absolute;
    left: 50%;
    bottom: -2px;
    width: 28px;
    height: 8px;
    margin-left: -14px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--kj-accent) 35%, transparent);
    opacity: 0;
    pointer-events: none;
    transform: scaleX(0.4);
}

.kj-dust.is-puff {
    animation: kj-dust-puff 0.38s ease-out;
}

.kj-human.is-jumping .kj-arm-l { transform: rotate(-48deg); }
.kj-human.is-jumping .kj-arm-r { transform: rotate(48deg); }
.kj-human.is-jumping .kj-leg-l { transform: rotate(18deg); }
.kj-human.is-jumping .kj-leg-r { transform: rotate(-18deg); }

.kj-human.is-landing .kj-arm-l { transform: rotate(18deg); }
.kj-human.is-landing .kj-arm-r { transform: rotate(-18deg); }
.kj-human.is-landing .kj-leg-l,
.kj-human.is-landing .kj-leg-r { transform: none; }

.kj-human:not(.is-jumping):not(.is-landing):not(.is-falling):not(.is-shake) .kj-arm-l {
    animation: kj-arm-idle-l 2.4s ease-in-out infinite;
}
.kj-human:not(.is-jumping):not(.is-landing):not(.is-falling):not(.is-shake) .kj-arm-r {
    animation: kj-arm-idle-r 2.4s ease-in-out infinite;
}

.kj-human.is-falling .kj-human-figure {
    animation: kj-human-fall 0.55s cubic-bezier(0.4, 0.05, 0.7, 0.2) forwards;
}
.kj-human.is-falling .kj-arm-l { transform: rotate(-70deg); }
.kj-human.is-falling .kj-arm-r { transform: rotate(70deg); }
.kj-human.is-falling .kj-leg-l { transform: rotate(25deg); }
.kj-human.is-falling .kj-leg-r { transform: rotate(-12deg); }
.kj-human.is-falling .kj-eye {
    height: 1px;
    top: 7px;
    border-radius: 1px;
}

@keyframes kj-human-idle {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

@keyframes kj-arm-idle-l {
    0%, 100% { transform: rotate(8deg); }
    50% { transform: rotate(16deg); }
}

@keyframes kj-arm-idle-r {
    0%, 100% { transform: rotate(-8deg); }
    50% { transform: rotate(-16deg); }
}

@keyframes kj-human-leap {
    0% { transform: translateY(0) scale(1, 1) rotate(0deg); }
    22% { transform: translateY(-18px) scale(1.02, 0.96) rotate(-4deg); }
    48% { transform: translateY(-68px) scale(0.96, 1.06) rotate(3deg); }
    78% { transform: translateY(-16px) scale(1.03, 0.97) rotate(-1deg); }
    100% { transform: translateY(0) scale(1, 1) rotate(0deg); }
}

@keyframes kj-human-land {
    0% { transform: translateY(-6px) scale(1.05, 0.92); }
    100% { transform: translateY(0) scale(1, 1); }
}

@keyframes kj-human-fall {
    0% { transform: translateY(0) rotate(0deg); opacity: 1; }
    55% { transform: translateY(18px) rotate(-12deg); opacity: 0.85; }
    100% { transform: translateY(52px) rotate(18deg); opacity: 0.35; }
}

@keyframes kj-dust-puff {
    0% { opacity: 0.7; transform: scaleX(0.35) scaleY(0.6); }
    100% { opacity: 0; transform: scaleX(1.5) scaleY(1); }
}

.kj-overlay-card {
    text-align: center;
    cursor: default;
    max-width: 400px;
    padding: 1.75rem 1.6rem 1.45rem;
}

.kj-overlay-kicker {
    margin: 0 0 0.35rem;
    font-size: 0.72rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: color-mix(in srgb, #ca4754 75%, var(--kj-muted));
}

.kj-overlay-card h2 {
    margin: 0 0 0.55rem;
    font-size: 1.55rem;
    letter-spacing: -0.02em;
}

.kj-overlay-card .game-overlay-score {
    margin: 0 0 0.35rem;
    font-size: 1.05rem;
}

.kj-overlay-card .game-overlay-score strong {
    color: var(--kj-accent);
}

.kj-overlay-card .game-overlay-detail {
    margin: 0 0 1.15rem;
    color: var(--kj-muted);
    font-size: 0.92rem;
    line-height: 1.4;
}

.kj-overlay-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    justify-content: center;
}

.kj-overlay-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 7.5rem;
    padding: 0.62rem 1.05rem;
    border-radius: 10px;
    font: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.kj-overlay-btn-primary {
    background: var(--kj-accent);
    color: #111;
    border-color: color-mix(in srgb, var(--kj-accent) 70%, #000);
}

.kj-overlay-btn-primary:hover {
    filter: brightness(1.06);
}

.kj-overlay-btn-ghost {
    background: transparent;
    color: var(--kj-text);
    border-color: var(--kj-border);
}

.kj-overlay-btn-ghost:hover {
    border-color: var(--kj-accent);
    color: var(--kj-accent);
}

.kj-overlay-hint {
    margin: 0.9rem 0 0;
    color: var(--kj-muted);
    font-size: 0.8rem;
}

@keyframes kj-human-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

@keyframes kj-tile-crack {
    0% { transform: translateX(-50%) rotate(0deg); opacity: 1; }
    45% { transform: translateX(-50%) rotate(-4deg) translateY(6px); }
    100% { transform: translateX(-50%) rotate(8deg) translateY(26px); opacity: 0.15; }
}

.kj-arena.is-hit-flash,
.gs-stage .kj-arena.is-hit-flash,
.game-arena.kj-arena.is-hit-flash {
    box-shadow: none;
}

.kj-arena.is-miss-flash {
    box-shadow: inset 0 0 0 2px color-mix(in srgb, #ca4754 60%, transparent);
}

@media (max-width: 900px) {
    .kj-app { width: 100%; }
    .kj-chrome { flex-wrap: wrap; }
    .kj-hud { order: 3; flex: 1 0 100%; }
    .kj-target-word { font-size: clamp(1.45rem, 7vw, 2.1rem); }
}
