/* IIPE JUMP - IIPE 2027 */

:root {
  --jump-nav-h: 64px;                 /* tinggi navbar (sticky), dipakai buat hitung tinggi stage */
  --jump-font: 'Jersey 10', monospace;
  --jump-purple: #5B3CC4;
  --jump-purple-dk: #3B2290;
  --jump-green: #C2F08A;
  --jump-cream: #FFFFDA;
  --jump-checker: #FFF1A0;
  --jump-pad-h: 112px;                /* tinggi footer tombol (di luar area main; batas bawah layar game) */
}

@media (min-width: 769px) { :root { --jump-nav-h: 76px; } }   /* navbar desktop sedikit lebih tinggi */

.jump-body { margin: 0; background: var(--jump-cream); }

.jump-page {
  display: flex; justify-content: center; align-items: center;
  min-height: calc(100vh - var(--jump-nav-h));
  min-height: calc(100dvh - var(--jump-nav-h));
  padding: 20px;
  box-sizing: border-box;
  background: repeating-conic-gradient(var(--jump-checker) 0% 25%, var(--jump-cream) 0% 50%) 0 0 / 56px 56px;
}

/* ---------- stage ---------- */
.jump-stage {
  position: relative;
  aspect-ratio: 9 / 18.5;             /* area main ~9:16 + footer tombol di bawahnya */
  height: min(calc(100dvh - var(--jump-nav-h) - 40px), 780px);
  max-width: 100%;
  border: 3px solid #000;
  box-shadow: 8px 8px 0 #000;
  background: var(--jump-cream);
  overflow: hidden;
  touch-action: none;                 /* geser jari = kontrol game, bukan scroll halaman */
  user-select: none; -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  font-family: var(--jump-font);
}
#jumpCanvas { position: absolute; left: 0; top: 0; width: 100%; height: calc(100% - var(--jump-pad-h)); display: block; }   /* area main berhenti di atas footer */

/* HP: stage full layar (di bawah navbar), tanpa bingkai */
@media (max-width: 600px) {
  .jump-page { padding: 0; min-height: 0; display: block; }
  .jump-stage {
    aspect-ratio: auto;
    width: 100%;
    height: calc(100dvh - var(--jump-nav-h));
    border: 0; box-shadow: none;
  }
}

/* ---------- HUD ---------- */
.jump-hud {
  position: absolute; top: 10px; left: 10px; right: 10px;
  display: flex; justify-content: space-between; align-items: flex-start;
  pointer-events: none; z-index: 2;
}
.hud-col { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.hud-right { align-items: flex-end; }
.hud-box {
  padding: .25em .7em .3em;
  background: var(--jump-purple); color: var(--jump-cream);
  border: 3px solid var(--jump-green);
  box-shadow: 0 4px 0 var(--jump-purple-dk);
  font-size: 26px; line-height: 1.1; white-space: nowrap;
}
.hud-box b { font-weight: 400; font-size: 1.15em; }
.hud-box small { font-size: .7em; margin-left: 1px; }
.hud-label { font-size: .6em; color: var(--jump-green); letter-spacing: .06em; margin-right: .3em; }
.hud-best { font-size: 20px; }
.hud-box.bump { animation: hudBump .15s steps(2); }
@keyframes hudBump { 50% { transform: translateY(-3px); } }

/* progres coin: 10 kotak */
.hud-coins {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 10px 4px 6px;
  background: var(--jump-purple);
  border: 3px solid var(--jump-green);
  box-shadow: 0 4px 0 var(--jump-purple-dk);
}
.hud-coins img { width: 24px; height: 24px; image-rendering: pixelated; }
.pips { display: grid; grid-template-columns: repeat(10, 8px); gap: 3px; }
.pips i { height: 14px; background: var(--jump-purple-dk); }
.pips i.on { background: var(--jump-green); }

/* nyawa (hati) */
.hud-hearts {
  display: flex; align-items: center; gap: 4px; min-height: 26px;
  padding: 5px 8px;
  background: var(--jump-purple);
  border: 3px solid var(--jump-green);
  box-shadow: 0 4px 0 var(--jump-purple-dk);
}
.hud-hearts img { width: 26px; height: 23px; image-rendering: pixelated; display: block; transition: opacity .15s; }
.hud-hearts img.off { opacity: .25; filter: grayscale(1); }
.hud-hearts.bump { animation: hudBump .25s steps(3); }

/* kekuatan aktif */
.chips { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.chip {
  position: relative; min-width: 120px; padding: 3px 10px 9px;
  background: var(--jump-purple); color: var(--jump-cream);
  border: 3px solid var(--jump-green);
  font-size: 18px; line-height: 1.1; text-align: right; letter-spacing: .04em;
}
.chip i { position: absolute; left: 0; bottom: 0; height: 5px; background: var(--jump-green); }
.chip.low { animation: hudBump .3s steps(2) infinite; }
.chip.low i { background: #FF7A7A; }

/* ---------- tombol kiri / kanan (gaya sama dengan panah di section What to expect) ---------- */
/* footer: bukan area main. Tinggi = --jump-pad-h, di bawah kanvas */
.jump-pad {
  position: absolute; z-index: 2;
  left: 0; right: 0; bottom: 0; height: var(--jump-pad-h);
  box-sizing: border-box;
  display: flex; justify-content: space-between; align-items: center;
  padding: 0 16px env(safe-area-inset-bottom, 0px);
  background: var(--jump-purple-dk);
  border-top: 3px solid var(--jump-green);
}
.g-btn {
  display: grid; place-items: center;
  width: clamp(72px, 9vh, 96px); aspect-ratio: 1.15;
  padding: 0; cursor: pointer;
  border: 3px solid var(--jump-green); background: var(--jump-purple);
  box-shadow: 0 5px 0 var(--jump-purple-dk);
  touch-action: none; -webkit-tap-highlight-color: transparent;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.g-btn::before {                       /* segitiga pixel (kanan), 4x7 kotak */
  content: ""; width: 34%; aspect-ratio: 4 / 7; background: var(--jump-cream);
  clip-path: polygon(0 0, 25% 0, 25% 14.29%, 50% 14.29%, 50% 28.57%, 75% 28.57%, 75% 42.86%,
                     100% 42.86%, 100% 57.14%, 75% 57.14%, 75% 71.43%, 50% 71.43%, 50% 85.71%,
                     25% 85.71%, 25% 100%, 0 100%);
}
.g-prev::before { transform: scaleX(-1); }
.g-btn:hover { background: #6a4ad6; }
.g-btn:active, .g-btn.is-down { transform: translateY(4px); box-shadow: 0 1px 0 var(--jump-purple-dk); background: #6a4ad6; }
.g-btn:focus-visible { outline: 3px solid #000; outline-offset: 3px; }

/* ---------- overlay ---------- */
.jump-overlay {
  position: absolute; inset: 0; z-index: 3;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 24px; text-align: center;
  background: rgba(255, 255, 218, .86);
  color: #000;
}
.jump-overlay[hidden] { display: none; }

.jump-title {
  margin: 0; font-weight: 400;
  font-size: min(clamp(44px, 9vh, 84px), 15vw); line-height: .95;
  color: var(--jump-purple);
  text-shadow: 4px 4px 0 var(--jump-green);
}
.jump-title.small { font-size: clamp(40px, 7vh, 64px); }
.jump-hero { width: 110px; height: auto; image-rendering: auto; animation: heroHop 1s steps(6) infinite; }
@keyframes heroHop { 50% { transform: translateY(-16px); } }

.jump-btn {
  appearance: none; cursor: pointer;
  padding: .3em 1.2em .35em;
  font: 400 34px/1 var(--jump-font);
  color: var(--jump-cream); background: var(--jump-purple);
  border: 3px solid var(--jump-green);
  box-shadow: 0 6px 0 var(--jump-purple-dk);
  transition: transform .06s;
}
.jump-btn:hover { background: #6a4ad6; }
.jump-btn:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--jump-purple-dk); }
.jump-btn:focus-visible, .jump-link:focus-visible { outline: 3px solid #000; outline-offset: 3px; }

.jump-hero { max-height: 96px; width: auto; }

/* pilih karakter */
.char-row { display: flex; gap: 10px; justify-content: center; }
.char-btn {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  width: 84px; padding: 6px 4px 6px; cursor: pointer;
  background: var(--jump-purple-dk); color: var(--jump-cream);
  border: 3px solid transparent; box-shadow: 0 4px 0 #1f1260;
  font: 400 16px/1 var(--jump-font); letter-spacing: .04em;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent; opacity: .75;
}
.char-btn img { width: 100%; height: 52px; object-fit: contain; image-rendering: auto; pointer-events: none; }
.char-btn:hover { opacity: 1; }
.char-btn.on { background: var(--jump-purple); border-color: var(--jump-green); opacity: 1; }
.char-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #1f1260; }
.char-btn:focus-visible { outline: 3px solid #000; outline-offset: 3px; }
.jump-linkbtn { appearance: none; background: none; border: 0; padding: 0; cursor: pointer; font-family: var(--jump-font); }

.jump-help { margin: 0; font-size: 22px; color: #333; }
@media (hover: none) and (pointer: coarse) {
  .only-keys { display: none; }   /* HP: petunjuk keyboard disembunyikan */
}

.jump-result { margin: 0; font-size: 72px; line-height: 1; color: var(--jump-purple); }
.jump-result small { font-size: .45em; margin-left: 2px; }
.jump-newbest { margin: 0; font-size: 28px; color: #000; background: var(--jump-green); padding: .1em .6em; border: 3px solid #000; animation: hudBump .4s steps(2) infinite; }
.jump-link { font-size: 22px; color: #000; text-decoration: underline; text-underline-offset: 3px; }

.jump-coinsum { margin: 0; font-size: 34px; display: flex; align-items: center; gap: 8px; color: var(--jump-purple); }
.jump-coinsum img { width: 30px; height: 30px; }
.jump-coinsum b { font-weight: 400; }

/* ---------- pilih kekuatan ---------- */
.jump-pick { background: rgba(255, 255, 218, .93); gap: 10px; }
.pick-cards { display: flex; flex-direction: column; gap: 14px; width: min(100%, 340px); margin-top: 6px; }
.pick-card {
  position: relative; display: grid; grid-template-columns: 64px 1fr; grid-template-rows: auto auto;
  column-gap: 14px; align-items: center; text-align: left;
  padding: 12px 40px 14px 12px; cursor: pointer;
  background: var(--jump-purple); color: var(--jump-cream);
  border: 3px solid var(--jump-green); box-shadow: 0 5px 0 var(--jump-purple-dk);
  font-family: var(--jump-font);
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.pick-card:hover:not(:disabled) { background: #6a4ad6; }
.pick-card:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 var(--jump-purple-dk); }
.pick-card:disabled { opacity: .55; cursor: default; }
.pick-card:focus-visible { outline: 3px solid #000; outline-offset: 3px; }
.pick-icon { grid-row: 1 / 3; display: grid; place-items: center; width: 64px; height: 56px; }
.pick-icon canvas { max-width: 100%; max-height: 100%; image-rendering: pixelated; }
.pick-card b { font-weight: 400; font-size: 26px; line-height: 1; align-self: end; }
.pick-card small { font-size: 18px; line-height: 1.1; color: var(--jump-green); align-self: start; margin-top: 4px; }
.pick-card em { position: absolute; top: 6px; right: 10px; font-style: normal; font-size: 18px; color: var(--jump-green); opacity: .8; }
@media (hover: none) and (pointer: coarse) { .pick-card em { display: none; } }

@media (prefers-reduced-motion: reduce) {
  .jump-hero, .jump-newbest, .chip.low { animation: none; }
}

/* HP: tombol kiri/kanan dirapatkan ke tengah supaya enak dipakai dengan satu tangan (harus di bawah aturan dasar .jump-pad) */
@media (max-width: 600px) {
  :root { --jump-pad-h: calc(124px + env(safe-area-inset-bottom, 0px)); }
  .jump-pad { justify-content: center; gap: clamp(18px, 6vw, 30px); }
  .jump-pad .g-btn { width: clamp(84px, 24vw, 104px); }
}

/* ---------- tombol mute ---------- */
.mute-btn {
  position: absolute; z-index: 4; top: 158px; left: 10px;
  display: grid; place-items: center; width: 44px; height: 44px; padding: 0; cursor: pointer;
  background: var(--jump-purple); color: var(--jump-cream);
  border: 3px solid var(--jump-green); box-shadow: 0 4px 0 var(--jump-purple-dk);
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
/* mute ada di kolom kanan HUD, tepat di bawah BEST */
.hud-right .mute-btn { position: static; pointer-events: auto; }
.mute-btn svg { width: 22px; height: 22px; fill: currentColor; shape-rendering: crispEdges; }
.mute-btn .x { display: none; }
.mute-btn.off .waves { display: none; }
.mute-btn.off .x { display: block; }
.mute-btn:hover { background: #6a4ad6; }
.mute-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--jump-purple-dk); }
.mute-btn:focus-visible { outline: 3px solid #000; outline-offset: 3px; }

/* kartu kekuatan yang sedang dipilih dengan keyboard (laptop) */
@media (hover: hover) {
  .pick-card.sel:not(:disabled) { background: #6a4ad6; outline: 3px solid #000; outline-offset: 3px; }
}

/* ---------- karakter secret & kolom kode ---------- */
.char-row { flex-wrap: wrap; }
.char-btn[hidden] { display: none; }
@media (max-width: 420px) { .char-btn { width: 74px; } }

.code-box { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; }
.code-box[hidden] { display: none; }
.code-box input {
  width: 170px; padding: .2em .5em; font: 400 24px/1.1 var(--jump-font); text-transform: uppercase; letter-spacing: .06em;
  color: #000; background: var(--jump-cream); border: 3px solid var(--jump-purple); border-radius: 0; text-align: center;
}
.code-box input:focus-visible { outline: 3px solid #000; outline-offset: 2px; }
.code-go {
  padding: .2em .8em; cursor: pointer; font: 400 24px/1.1 var(--jump-font);
  color: var(--jump-cream); background: var(--jump-purple); border: 3px solid var(--jump-green); box-shadow: 0 4px 0 var(--jump-purple-dk);
}
.code-go:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--jump-purple-dk); }
.code-msg { flex-basis: 100%; margin: 0; min-height: 1.1em; font-size: 20px; color: var(--jump-purple); }


/* ---------- mobile: navbar disembunyikan ---------- */
.jump-navwrap { display: contents; }   /* tidak mengubah layout/sticky navbar di desktop */
@media (max-width: 600px) {
  :root { --jump-nav-h: 0px; }
  .jump-navwrap { display: none; }
}

/* ---------- HUD lebih ringkas supaya tidak melebihi lebar stage ---------- */
.hud-col { min-width: 0; }
.hud-box { font-size: 22px; }
.hud-best { font-size: 17px; }
.pips { grid-template-columns: repeat(10, 6px); gap: 2px; }
.pips i { height: 12px; }
.hud-coins img { width: 22px; height: 22px; }
.hud-hearts img { width: 22px; height: 20px; }
.hud-coins, .hud-hearts { padding-top: 4px; padding-bottom: 4px; }

/* ---------- desktop (mouse): footer pendek, tanpa tombol ---------- */
.pad-hint { display: none; }
@media (hover: hover) and (pointer: fine) {
  :root { --jump-pad-h: 44px; }
  .jump-stage { aspect-ratio: 9 / 17; }        /* area main tetap ~9:16 */
  .jump-pad { justify-content: center; padding: 0 12px; }
  .jump-pad .g-btn { display: none; }
  .pad-hint {
    display: block; margin: 0;
    font: 400 20px/1 var(--jump-font);
    color: var(--jump-cream); letter-spacing: .06em;
  }
}


/* ---------- overlay: isi tidak boleh terpotong ---------- */
.jump-overlay { overflow-y: auto; justify-content: flex-start; touch-action: pan-y; }
.jump-overlay > :first-child { margin-top: auto; }     /* tengah kalau muat, scroll kalau tidak */
.jump-overlay > :last-child  { margin-bottom: auto; }

/* ---------- laptop/desktop: layar menu dipadatkan ---------- */
@media (hover: hover) and (pointer: fine) {
  .jump-overlay { bottom: var(--jump-pad-h); gap: 8px; padding: 14px 16px; }   /* berhenti di atas footer */
  .jump-title { font-size: min(clamp(36px, 7vh, 60px), 13vw); text-shadow: 3px 3px 0 var(--jump-green); }
  .jump-title.small { font-size: clamp(34px, 6vh, 52px); }
  .jump-hero { max-height: 72px; }
  .char-row { gap: 6px; }
  .char-btn { width: 72px; padding: 4px 2px; font-size: 14px; }
  .char-btn img { height: 40px; }
  .jump-btn { font-size: 28px; }
  .jump-help { font-size: 18px; line-height: 1.15; }
  .jump-link { font-size: 18px; }
  .jump-result { font-size: 56px; }
  .pick-cards { gap: 10px; }
  .pick-card { padding: 8px 36px 10px 10px; }
}
@media (hover: hover) and (pointer: fine) and (max-height: 720px) {
  .jump-hero { max-height: 52px; }
  .jump-title { font-size: min(clamp(30px, 6vh, 44px), 12vw); }
  .jump-help { font-size: 16px; }
  .char-btn img { height: 32px; }
  .char-btn { width: 66px; }
}