/* Soccer Superstars — JG-084 prototype */

html,
body {
  margin: 0;
  height: 100%;
  background: #1b1f3a;
  overflow: hidden;
}

.ss-root {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: #1b1f3a;
  font-family: "Press Start 2P", ui-monospace, monospace;
  color: #fff;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}

.ss-canvas {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.ss-exit,
.ss-mute {
  position: absolute;
  top: max(8px, env(safe-area-inset-top));
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 3px solid #1b1f3a;
  background: #fff;
  color: #1b1f3a;
  font: 16px/1 "Press Start 2P", monospace;
  text-decoration: none;
  box-shadow: 0 3px 0 #1b1f3a;
  cursor: pointer;
  z-index: 5;
  padding: 0;
}
.ss-exit {
  left: max(8px, env(safe-area-inset-left));
}
.ss-mute {
  left: calc(max(8px, env(safe-area-inset-left)) + 48px);
}
.ss-mute.is-off {
  opacity: 0.5;
  text-decoration: line-through;
}

.ss-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(15, 18, 40, 0.55);
  z-index: 10;
  padding: 16px;
}
.ss-overlay[hidden] {
  display: none;
}

.ss-card {
  width: min(420px, 100%);
  box-sizing: border-box;
  padding: 22px 18px;
  text-align: center;
  background: #2a3170;
  border: 4px solid #fff;
  box-shadow: 0 0 0 4px #1b1f3a, 0 10px 0 4px #1b1f3a;
  animation: ss-pop 0.35s steps(5) both;
}

@keyframes ss-pop {
  from {
    transform: scale(0.6);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.ss-logo {
  margin: 0 0 14px;
  display: grid;
  gap: 8px;
  font-size: clamp(18px, 6vw, 28px);
  line-height: 1.1;
  color: #ffd23f;
  text-shadow: 3px 3px 0 #e23b3b, 6px 6px 0 #1b1f3a;
  font-weight: normal;
}
.ss-logo span:last-child {
  color: #fff;
}

.ss-sub,
.ss-hint,
.ss-label,
.ss-score {
  font-size: 10px;
  line-height: 1.7;
  margin: 8px 0;
}
.ss-hint,
.ss-label {
  color: #b9c3ff;
}
.ss-score {
  font-size: 14px;
}
.ss-score b {
  color: #ffd23f;
  font-weight: normal;
}

.ss-stages {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.ss-stage,
.ss-play {
  font: 10px/1 "Press Start 2P", monospace;
  border: 3px solid #1b1f3a;
  background: #e8ecff;
  color: #1b1f3a;
  padding: 10px 10px;
  box-shadow: 0 4px 0 #1b1f3a;
  cursor: pointer;
}
.ss-stage.is-on {
  background: #ffd23f;
}
.ss-stage:active,
.ss-play:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #1b1f3a;
}

.ss-play {
  font-size: 16px;
  padding: 14px 22px;
  background: #3ddc84;
  margin: 8px 0 4px;
}

.ss-win {
  margin: 0 0 12px;
  font-weight: normal;
  font-size: clamp(20px, 7vw, 30px);
  color: #ffd23f;
  text-shadow: 3px 3px 0 #e23b3b, 6px 6px 0 #1b1f3a;
}

.ss-stars {
  font-size: 34px;
  letter-spacing: 6px;
  color: #ffd23f;
  text-shadow: 3px 3px 0 #1b1f3a;
  min-height: 40px;
}
.ss-stars .off {
  color: #4b538f;
}
.ss-stars span {
  display: inline-block;
  animation: ss-pop 0.3s steps(4) both;
}

.ss-stage {
  display: grid;
  gap: 5px;
  min-width: 52px;
  white-space: nowrap;
  font-size: 14px;
}
.ss-stage small {
  font-size: 7px;
  color: #4b538f;
}
.ss-stage--boss {
  background: #ffb3b3;
}
.ss-stage--boss.is-on {
  background: #ff6f6f;
}

.ss-worldnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
}
.ss-worldnav .ss-label {
  margin: 0;
  color: #ffd23f;
}
.ss-arrow {
  font: 12px/1 "Press Start 2P", monospace;
  border: 3px solid #1b1f3a;
  background: #e8ecff;
  color: #1b1f3a;
  width: 36px;
  height: 32px;
  box-shadow: 0 3px 0 #1b1f3a;
  cursor: pointer;
}
.ss-arrow:disabled {
  opacity: 0.3;
  cursor: default;
}
.ss-stage .ss-st {
  font-size: 10px;
  letter-spacing: 1px;
  color: #c79a00;
  min-height: 9px;
}
.ss-stage .ss-st i {
  font-style: normal;
  color: #b9bfd9;
}
.ss-stage.is-locked {
  background: #4b538f;
  color: #8790c8;
  cursor: not-allowed;
  box-shadow: 0 4px 0 #1b1f3a;
}
.ss-stage.is-locked small {
  color: #8790c8;
}
.ss-link {
  display: block;
  margin: 10px auto 0;
  font: 9px/1 "Press Start 2P", monospace;
  background: none;
  border: 0;
  color: #b9c3ff;
  text-decoration: underline;
  cursor: pointer;
  padding: 6px;
}

/* ---------- coins + buddies (JG-092) ---------- */
.ss-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 6px 0 10px;
}
.ss-wallet,
.ss-earned {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 14px;
  color: #ffd23f;
  margin: 0;
}
.ss-earned {
  display: flex;
  margin: 6px 0;
}
.ss-dim {
  font-size: 9px;
  color: #b9c3ff;
}
.ss-wallet .jg-coin-icon,
.ss-earned .jg-coin-icon {
  width: 22px;
  height: 22px;
}
.ss-buddybtn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: 10px/1 "Press Start 2P", monospace;
  border: 3px solid #1b1f3a;
  background: #ffd23f;
  color: #1b1f3a;
  padding: 6px 10px 6px 6px;
  box-shadow: 0 4px 0 #1b1f3a;
  cursor: pointer;
}
.ss-buddybtn canvas,
.ss-shop canvas {
  image-rendering: pixelated;
  width: 24px;
  height: 24px;
}
.ss-links {
  display: flex;
  justify-content: center;
  gap: 14px;
}
.ss-links .ss-link {
  margin: 10px 0 0;
}
/* Locker: header and DONE always on screen; only the items scroll */
.ss-card--shop {
  width: min(520px, 100%);
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.ss-card--shop > * {
  flex-shrink: 0;
}
.ss-shop {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
  margin: 10px 0 12px;
  padding: 2px 4px 6px;
  flex: 1 1 auto;
  flex-shrink: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y; /* the game root blocks touch scrolling; allow it here */
}
.ss-card--shop [data-ss-shop-close] {
  margin-top: 0;
}
@media (max-height: 600px) {
  .ss-card--shop {
    padding: 12px 12px 14px;
  }
  .ss-card--shop .ss-win {
    font-size: 18px;
    margin-bottom: 6px;
  }
}
.ss-item {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 10px 6px;
  background: #343c86;
  border: 3px solid #1b1f3a;
  box-shadow: 0 4px 0 #1b1f3a;
}
.ss-item.is-picked {
  background: #3ddc84;
}
.ss-item.is-picked .ss-item__kind {
  color: #1b1f3a;
}
.ss-item canvas {
  width: 50px;
  height: 50px;
}
.ss-item__name {
  font-size: 9px;
}
.ss-item__kind {
  font-size: 7px;
  color: #b9c3ff;
}
.ss-item button {
  font: 9px/1 "Press Start 2P", monospace;
  border: 3px solid #1b1f3a;
  background: #e8ecff;
  color: #1b1f3a;
  padding: 7px 8px;
  box-shadow: 0 3px 0 #1b1f3a;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.ss-item button.is-buy {
  background: #ffd23f;
}
.ss-item button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.ss-item button .jg-coin-icon {
  width: 14px;
  height: 14px;
}

/* ---------- Touch / Keyboard mode (JG-086) ---------- */
.ss-modes {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
}
.ss-mode {
  display: grid;
  gap: 4px;
  font: 9px/1 "Press Start 2P", monospace;
  border: 3px solid #1b1f3a;
  background: #4b538f;
  color: #c8cdf0;
  padding: 7px 10px;
  box-shadow: 0 3px 0 #1b1f3a;
  cursor: pointer;
}
.ss-mode small {
  font-size: 6px;
  opacity: 0.8;
}
.ss-mode.is-on {
  background: #7fe0ff;
  color: #1b1f3a;
}

/* ---------- results badges (JG-089) ---------- */
.ss-extra {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0;
  min-height: 0;
}
.ss-badge {
  font-size: 8px;
  padding: 5px 7px;
  background: #3ddc84;
  color: #1b1f3a;
  border: 2px solid #1b1f3a;
  animation: ss-pop 0.35s steps(4) 0.8s both;
}
.ss-badge--streak {
  background: #ff8a1f;
}

/* ---------- locker tabs (JG-092 part 2) ---------- */
.ss-tabs {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin: 4px 0 6px;
  flex-wrap: wrap;
}
.ss-tab {
  font: 9px/1 "Press Start 2P", monospace;
  border: 3px solid #1b1f3a;
  background: #4b538f;
  color: #c8cdf0;
  padding: 8px 9px;
  box-shadow: 0 3px 0 #1b1f3a;
  cursor: pointer;
}
.ss-tab.is-on {
  background: #ffd23f;
  color: #1b1f3a;
}

/* ---------- RAINBOW RUN page on the level map ---------- */
.ss-endless-card {
  display: grid;
  gap: 8px;
  padding: 14px 12px;
  width: 100%;
  box-sizing: border-box;
  border: 3px solid #1b1f3a;
  background: linear-gradient(90deg, #ff4d6d, #ff8a1f, #ffd23f, #3ddc84, #3d7bff, #b388ff);
  color: #1b1f3a;
  font-size: 9px;
  line-height: 1.6;
  text-align: center;
  box-shadow: 0 4px 0 #1b1f3a;
}
.ss-endless-card b {
  font-size: 18px;
  font-weight: normal;
  color: #ffffff;
  text-shadow: 2px 2px 0 #1b1f3a;
}
.ss-endless-card span {
  background: rgba(255, 255, 255, 0.85);
  padding: 4px 6px;
}
.ss-endless-card.is-locked {
  filter: grayscale(0.8);
}
.ss-endless-best {
  font-size: 10px;
}

/* ---------- short screens (phones held sideways): everything must fit or scroll ---------- */
.ss-overlay {
  overflow-y: auto;
  touch-action: pan-y;
  align-items: safe center;
}
@media (max-height: 520px) {
  .ss-overlay {
    padding: 8px;
  }
  .ss-card {
    padding: 12px 14px;
  }
  .ss-logo {
    font-size: 16px;
    margin-bottom: 6px;
    display: flex;
    justify-content: center;
    gap: 10px;
  }
  [data-ss-title] .ss-sub {
    display: none;
  }
  .ss-topbar {
    margin: 2px 0 6px;
  }
  .ss-stages {
    margin-bottom: 8px;
  }
  .ss-play {
    padding: 10px 18px;
    font-size: 13px;
    margin: 4px 0 2px;
  }
  .ss-modes {
    margin-top: 6px;
  }
  .ss-endless-card {
    padding: 8px;
    gap: 5px;
  }
  .ss-endless-card b {
    font-size: 14px;
  }
}

/* "RAINBOW RUN" button after the last world (JG-103) */
.ss-play.is-rainbow {
  background: linear-gradient(90deg, #e23b3b, #ff8a1f, #ffd23f, #3ddc84, #3d7bff, #b388ff);
  color: #ffffff;
  text-shadow: 2px 2px 0 #1b1f3a;
}
