/* ============================= */
/*        STAR JUMP GAME         */
/* ============================= */

/* --- Page Layout --- */
.sj-page {
  padding-top: 2rem;
}
.sj-header {
  text-align: center;
  margin-bottom: 1.5rem;
}
.sj-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: #94a3b8;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.8rem;
  transition: color 0.15s;
}
.sj-back-btn:hover {
  color: #38bdf8;
}
.sj-title {
  font-size: 2rem;
  font-weight: 800;
  color: #f9fafb;
  margin: 0 0 0.3rem;
}
.sj-title span {
  background: linear-gradient(120deg, #a78bfa, #38bdf8, #e5e7eb);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.sj-subtitle {
  color: #94a3b8;
  font-size: 0.95rem;
  margin: 0;
}

/* --- HUD --- */
.sj-hud {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.sj-hud-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(15,23,42,0.7);
  border: 1px solid rgba(139,92,246,0.3);
  border-radius: 10px;
  padding: 0.5rem 1.2rem;
  min-width: 80px;
  box-shadow: 0 4px 14px rgba(2, 6, 23, 0.35);
}
.sj-hud-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #94a3b8;
  margin-bottom: 0.2rem;
}
.sj-hud-value {
  font-size: 1.2rem;
  font-weight: 800;
  color: #e2e8f0;
  font-variant-numeric: tabular-nums;
}
.sj-hud-item.sj-hud-seed {
  min-width: 7.5rem;
}
.sj-hud-item.sj-hud-seed .sj-hud-value {
  font-size: 0.8rem;
  font-weight: 700;
  color: #cbd5e1;
  word-break: break-all;
}
.sj-overlay-content .sj-gameover-seed,
.sj-overlay-content .sj-gameover-seed-hint {
  font-size: 0.85rem;
  color: #94a3b8;
  margin: 0.35rem 0 0;
}
.sj-overlay-content .sj-gameover-seed code,
.sj-overlay-content .sj-gameover-seed-hint code {
  font-size: 0.8rem;
  color: #e2e8f0;
  background: rgba(15, 23, 42, 0.8);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

/* --- Canvas Wrapper --- */
.sj-game-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.sj-canvas-wrap {
  position: relative;
  width: 400px;
  max-width: 100%;
  border-radius: 16px;
  overflow: hidden;
  border: 2px solid rgba(139,92,246,0.4);
  box-shadow: 0 0 30px rgba(139,92,246,0.15), inset 0 0 40px rgba(0,0,0,0.3);
}
#sj-canvas {
  display: block;
  width: 100%;
  height: auto;
  background: #0a0a1a;
  touch-action: none;
}

/* --- Overlay (start/game-over) --- */
.sj-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5,5,20,0.85);
  backdrop-filter: blur(6px);
  z-index: 10;
  transition: opacity 0.3s;
}
.sj-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}
.sj-overlay-content {
  text-align: center;
  color: #e2e8f0;
}
.sj-overlay-content h2 {
  font-size: 1.8rem;
  font-weight: 800;
  background: linear-gradient(135deg, #a78bfa, #38bdf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 0 0 0.6rem;
}
.sj-overlay-content p {
  color: #94a3b8;
  font-size: 0.85rem;
  margin: 0 0 1.2rem;
  line-height: 1.5;
}
.sj-overlay-content .sj-gameover-score {
  font-size: 2rem;
  font-weight: 800;
  color: #fbbf24;
  margin: 0.5rem 0;
}
.sj-overlay-content .sj-gameover-stars {
  font-size: 1rem;
  color: #a78bfa;
  margin-bottom: 1rem;
}
.sj-play-btn {
  padding: 0.7rem 2.2rem;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  border: 2px solid #8b5cf6;
  background: rgba(139,92,246,0.2);
  color: #e2e8f0;
  transition: background 0.15s, transform 0.1s;
}
.sj-play-btn:hover {
  background: rgba(139,92,246,0.4);
  transform: scale(1.05);
}
.sj-play-btn:active {
  transform: scale(0.95);
}

.sj-play-btn:focus-visible,
.sj-back-btn:focus-visible,
.sj-ctrl-btn:focus-visible {
  outline: 2px solid #38bdf8;
  outline-offset: 2px;
}

/* --- Mobile Controls --- */
.sj-mobile-controls {
  display: none;
  justify-content: center;
  gap: 2rem;
  margin-top: 1rem;
}
.sj-ctrl-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2px solid rgba(139,92,246,0.5);
  background: rgba(15,23,42,0.8);
  color: #a78bfa;
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.sj-ctrl-btn:active {
  background: rgba(139,92,246,0.3);
}

/* --- Responsive --- */
@media (max-width: 500px) {
  .sj-page { padding: 0.8rem 0.4rem 2rem !important; }
  .sj-header { margin-bottom: 0.8rem; }
  .sj-subtitle { font-size: 0.82rem; }
  .sj-hud {
    gap: 0.45rem;
    margin-bottom: 0.6rem;
  }
  .sj-hud-item {
    padding: 0.3rem 0.5rem;
    min-width: 55px;
    border-radius: 8px;
  }
  .sj-hud-label { font-size: 0.55rem; }
  .sj-hud-value { font-size: 0.9rem; }
  .sj-title { font-size: 1.5rem; }
  .sj-canvas-wrap {
    border-radius: 12px;
    max-height: 65vh;
  }
  .sj-mobile-controls {
    display: flex;
    gap: 1.5rem;
    margin-top: 0.7rem;
  }
  .sj-ctrl-btn {
    width: 56px;
    height: 56px;
    font-size: 1.3rem;
  }
  .sj-overlay-content h2 { font-size: 1.4rem; }
  .sj-overlay-content p { font-size: 0.78rem; }
  .sj-play-btn { font-size: 0.9rem; padding: 0.55rem 1.8rem; }
}

@media (pointer: coarse) {
  .sj-mobile-controls {
    display: flex;
  }
}
