* {
  box-sizing: border-box;
}

@font-face {
  font-family: 'Press Start 2P';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(./fonts/8Lg6LX8-ntOHUQnvQ0E7o6SkDmgNrBPNFeI4cxdj3Ko.woff2) format('woff2');
  unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113,
    U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Press Start 2P';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(./fonts/8Lg6LX8-ntOHUQnvQ0E7o69WAFmVxfVhVkWhl-QDeAk.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F,
    U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #6ec6ff;
  font-family: 'Press Start 2P', Helvetica, Arial, sans-serif;
  color: #fff;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  touch-action: none;
}

#app {
  position: relative;
  width: 100%;
  height: 100%;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}

/* Frosted sheet over the sharp game — blurs what's behind, no soft canvas edges */
#end-frost {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  opacity: 0;
  background: rgba(110, 198, 255, 0.12);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  transition: opacity 0.45s ease; /* keep in sync with END_SETTLE_MS */
}

#app.game-ended #end-frost {
  opacity: 1;
}

/* Shared snackbar chrome — same as Pongis V2 / Golf V2 */
.snackbar {
  position: absolute;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom, 0px));
  z-index: 20;
  box-sizing: border-box;
  width: max-content;
  max-width: 80%;
  margin: 0;
  padding: 12px 18px;
  border: none;
  border-radius: 12px;
  outline: none;
  box-shadow: none;
  background: rgba(255, 255, 255, 0.6);
  color: rgba(0, 0, 0, 0.8);
  font-family: 'Roboto', Helvetica, Arial, sans-serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.35;
  text-align: center;
  pointer-events: none;
  transform: translateX(-50%);
  opacity: 0;
  transition: opacity 300ms ease;
}

.snackbar.is-visible {
  opacity: 1;
}

/* ── Score (same placement / type as original Jump) ── */

#SCORE,
#HIGHSCORE {
  position: absolute;
  left: 0;
  width: 100%;
  top: calc(10% - 30px);
  height: auto;
  font-family: 'Press Start 2P', Helvetica, Arial, sans-serif;
  font-size: 32px;
  line-height: 100%;
  color: white;
  text-align: center;
  z-index: 5;
  pointer-events: none;
}

#SCORE {
  top: calc(10% - 35px);
  transform-origin: center top;
}

#SCORE.absorb {
  animation: score_absorb 0.2s ease-out;
}

#HIGHSCORE {
  margin-top: -30px;
  font-size: 16px;
  opacity: 0.6;
}

/* Only the HI / ALL-TIME HI label is tappable — outer box keeps original placement */
#HIGHSCORE_HIT {
  display: inline-block;
  margin: 0;
  padding: 0;
  border: none;
  outline: none;
  background: transparent;
  color: inherit;
  font: inherit;
  line-height: inherit;
  cursor: pointer;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
  -webkit-appearance: none;
  appearance: none;
}

#HIGHSCORE_HIT:focus,
#HIGHSCORE_HIT:focus-visible {
  outline: none;
  box-shadow: none;
}

#HIGHSCORE.flash {
  animation: highscore_flash 2s 0s linear;
}

/* Short landscape (phones): keep HI + score on-screen, clear the center */
@media (orientation: landscape) and (max-height: 500px) {
  #SCORE,
  #HIGHSCORE {
    left: max(12px, env(safe-area-inset-left, 0px));
    width: auto;
    max-width: 45%;
    text-align: left;
  }

  #HIGHSCORE {
    top: max(8px, env(safe-area-inset-top, 0px));
    margin-top: 0;
  }

  #SCORE {
    top: max(28px, calc(env(safe-area-inset-top, 0px) + 20px));
    transform-origin: left top;
  }
}

@keyframes highscore_flash {
  0% {
    opacity: 1;
  }
  9% {
    opacity: 1;
  }
  10% {
    opacity: 0;
  }
  19% {
    opacity: 0;
  }
  20% {
    opacity: 1;
  }
  29% {
    opacity: 1;
  }
  30% {
    opacity: 0;
  }
  39% {
    opacity: 0;
  }
  40% {
    opacity: 1;
  }
  49% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
  59% {
    opacity: 0;
  }
  60% {
    opacity: 1;
  }
  69% {
    opacity: 1;
  }
  100% {
    opacity: 0.6;
  }
}

/* Tiny pop when a clear bonus lands in the main score */
@keyframes score_absorb {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

/* Floating clear bonus — same type as #SCORE; drifts up then fades */
#EXTRASCORE {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 6;
  margin: 0;
  padding: 0;
  width: auto;
  font-family: 'Press Start 2P', Helvetica, Arial, sans-serif;
  font-size: 32px;
  line-height: 100%;
  color: white;
  text-align: center;
  pointer-events: none;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.15);
  will-change: transform, opacity;
  transform: translate(-50%, -100%);
  white-space: nowrap;
}

#EXTRASCORE.hidden {
  display: none !important;
}

#power-wrap {
  display: none !important;
}

#power-wrap.active {
  display: none !important;
}

#power-fill {
  display: none !important;
}

/* ── Game-over buttons (original Jump positions) ── */

#RESTART_BUTTON,
#HIGHSCORES_BUTTON,
#SETTINGS_BUTTON {
  position: absolute;
  height: 15vh;
  width: 30vw;
  top: 40vh;
  left: 35vw;
  padding: 0;
  border: none;
  background-color: transparent;
  background-image: url(../images/replay.png);
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center center;
  z-index: 7;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

#RESTART_BUTTON.hidden,
#HIGHSCORES_BUTTON.hidden,
#SETTINGS_BUTTON.hidden,
.hidden {
  display: none !important;
}

#HIGHSCORES_BUTTON {
  top: auto;
  bottom: calc(10vh - 40px);
  left: 50%;
  height: 80px;
  width: 80px;
  margin-left: -40px;
  background-image: url(../images/ranking.png);
  /* Same visual scale as settings: height = 60% of button (file is wider than square). */
  background-size: auto 60%;
}

#SETTINGS_BUTTON {
  top: auto;
  bottom: calc(10vh + 40px);
  left: 50%;
  margin-left: -40px;
  height: 80px;
  width: 80px;
  background-image: url(../images/settings.png);
  background-size: auto 60%;
}

/* ── Best scores list (inside V2 stadium-picker modal) ── */

#jump-best-picker .stadium-picker-panel {
  display: flex;
  flex-direction: column;
}

.jump-best-list {
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: none;
  margin: 8px 0 0;
  padding: 8px clamp(18px, 5vw, 40px) 36px;
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  box-sizing: border-box;
}

.jump-best-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: center;
  column-gap: clamp(12px, 3vw, 28px);
  flex: 1 1 0;
  min-height: 2.4em;
  margin: 0;
  font-family: 'Press Start 2P', Helvetica, Arial, sans-serif;
  font-size: clamp(11px, 2.8vw, 15px);
  line-height: 140%;
  color: slategray;
  text-transform: uppercase;
}

.jump-best-row span:nth-of-type(1) {
  text-align: left;
}

.jump-best-row span:nth-of-type(2) {
  text-align: center;
}

.jump-best-row span:nth-of-type(3) {
  text-align: right;
  white-space: nowrap;
}

.jump-best-row.is-own {
  animation: own_score_flash 1s 0s infinite;
}

@keyframes own_score_flash {
  0% {
    opacity: 1;
  }
  49% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
  100% {
    opacity: 0.35;
  }
}

.jump-best-empty {
  margin: 28px 12px;
  font-family: var(--modal-body-font);
  font-size: var(--modal-body-size);
  line-height: var(--modal-body-line-height);
  color: slategray;
  text-align: center;
  opacity: 0.75;
}

#SETTINGS_BUTTON.settings-pulse {
  animation: settings_processing 1s linear;
}

@keyframes settings_processing {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* ── Settings / ranking modal (same shell as Pongis V2 stadium picker) ── */

:root {
  --display-font: 'Press Start 2P', Helvetica, Arial, sans-serif;
  --display-font-weight: 400;
  --modal-title-font: var(--display-font);
  --modal-title-size: 36px;
  --modal-title-weight: var(--display-font-weight);
  --modal-title-line-height: 1.2;
  --modal-title-transform: uppercase;
  --modal-body-font: 'Roboto', Helvetica, Arial, sans-serif;
  --modal-body-size: 16px;
  --modal-body-weight: 400;
  --modal-body-line-height: 1.45;
}

@media (max-width: 519px) {
  :root {
    --modal-title-size: clamp(14px, 4.6vw, 26px);
  }
}

.stadium-picker-title {
  font-family: var(--modal-title-font);
  font-size: var(--modal-title-size);
  font-weight: var(--modal-title-weight);
  line-height: var(--modal-title-line-height);
  text-transform: var(--modal-title-transform);
}

.stadium-picker {
  position: absolute;
  inset: 0;
  z-index: 32;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 0;
  pointer-events: none;
  visibility: hidden;
  transition: visibility 0s linear 95ms;
}

.stadium-picker.is-open {
  pointer-events: auto;
  visibility: visible;
  transition: visibility 0s;
}

.stadium-picker-backdrop {
  position: absolute;
  inset: 0;
  background: transparent;
}

.stadium-picker-sheet {
  position: relative;
  z-index: 1;
  width: 650px;
  max-width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #fff;
  color: slategray;
  font-family: 'Roboto', Helvetica, Arial, sans-serif;
  overflow: hidden;
  transform: scale(0.9);
  opacity: 0;
  transform-origin: center center;
  transition:
    transform 90ms ease-in,
    opacity 75ms ease-in;
}

.stadium-picker.is-open .stadium-picker-sheet {
  transform: scale(1);
  opacity: 1;
  transition:
    transform 150ms cubic-bezier(0.32, 1.12, 0.54, 1),
    opacity 130ms ease-out;
}

@media (min-width: 680px) and (min-height: 700px) {
  .stadium-picker {
    padding: 16px;
    align-items: center;
  }

  .stadium-picker-sheet {
    width: 650px;
    max-width: 650px;
    height: calc(100% - 32px);
    max-height: 800px;
    border-radius: 0;
  }
}

@media (max-width: 519px) {
  .stadium-picker-sheet {
    width: 100%;
    max-width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .stadium-picker {
    transition: none;
  }

  .stadium-picker-sheet {
    transform: none;
    opacity: 1;
    transition: none;
  }
}

.stadium-picker-chrome {
  position: relative;
  flex-shrink: 0;
  min-height: 0;
  background: #fff;
}

.stadium-picker-close {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 3;
  width: 60px;
  height: 60px;
  border: none;
  background-color: transparent;
  background-image: url('../images/ui/feedback_x.png');
  background-repeat: no-repeat;
  background-position: center center;
  background-size: 20px auto;
  cursor: pointer;
}

.stadium-picker-panel {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0 14px 32px;
}

.stadium-picker-title {
  margin: 0;
  padding: 28px 60px 0;
  text-align: center;
  color: slategray;
}

.jump-settings-heading {
  margin: 28px auto 12px;
  max-width: 420px;
  padding: 0 12px;
  font-family: var(--modal-body-font);
  font-size: 18px;
  font-weight: 600;
  line-height: var(--modal-body-line-height);
  color: slategray;
  text-align: center;
}

.jump-settings-colors {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  max-width: 360px;
  margin: 0 auto 8px;
  padding: 4px 8px 12px;
}

.jump-settings-swatch {
  box-sizing: border-box;
  width: 64px;
  height: 64px;
  padding: 0;
  border: 4px solid #e4e8ec;
  border-radius: 50%;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.jump-settings-swatch.is-selected {
  border-color: slategray;
}

.jump-settings-ratio {
  max-width: 360px;
  margin: 0 auto 24px;
  padding: 0 8px;
}

.bot-speed-picker-slider,
.jump-settings-slider {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: min(320px, calc(100% - 28px));
  height: 14px;
  margin: 0 auto;
  border-radius: 999px;
  background: #d8d8d8;
  outline: none;
}

.bot-speed-picker-slider::-webkit-slider-thumb,
.jump-settings-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: slategray;
  cursor: pointer;
}

.bot-speed-picker-slider::-moz-range-thumb,
.jump-settings-slider::-moz-range-thumb {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: slategray;
  cursor: pointer;
}

.jump-settings-ratio-labels {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding: 0 6px;
  font-family: var(--modal-body-font);
  font-size: var(--modal-body-size);
  color: slategray;
}

.jump-settings-views {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  max-width: 360px;
  margin: 0 auto 28px;
  padding: 4px 8px 12px;
}

.jump-settings-view-btn {
  box-sizing: border-box;
  width: 64px;
  height: 64px;
  padding: 0;
  border: 4px solid #e4e8ec;
  border-radius: 50%;
  background: #f4f6f8;
  color: slategray;
  font-family: var(--modal-body-font);
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.jump-settings-view-btn.is-selected {
  border-color: slategray;
  background: #e8ecef;
}
