/* ==========================================
   MONKEY JUMP GAME & SELECTION SCREEN STYLES
   Tyspingo Typing Master Pro — Standalone Upgrade
   ========================================== */

/* Game Mode Selection Screen */
.game-selection-screen {
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  padding: 2.5rem 1rem 3.5rem;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2.5rem;
  animation: game-fade-in 0.4s ease-out;
}

@keyframes game-fade-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.game-selection-header {
  text-align: center;
}

.game-selection-header h1 {
  font-size: 2.8rem;
  font-weight: 900;
  margin: 0 0 0.5rem 0;
  background: linear-gradient(135deg, #38bdf8 0%, #a855f7 50%, #f43f5e 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: 1px;
}

.game-selection-header p {
  color: #94a3b8;
  font-size: 1.2rem;
  margin: 0;
}

.game-selection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 2rem;
  width: 100%;
}

.game-select-card {
  background: linear-gradient(145deg, rgba(30, 41, 59, 0.85) 0%, rgba(15, 23, 42, 0.98) 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  padding: 2.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.game-select-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 4px;
  background: linear-gradient(90deg, #38bdf8, #818cf8);
  opacity: 0.8;
  transition: opacity 0.25s;
}

.game-select-card.monkey-card::before {
  background: linear-gradient(90deg, #22c55e, #eab308);
}

.game-select-card:hover {
  transform: translateY(-6px);
  border-color: rgba(56, 189, 248, 0.4);
  box-shadow: 0 22px 45px rgba(0, 0, 0, 0.6), 0 0 30px rgba(56, 189, 248, 0.15);
}

.game-select-card.monkey-card:hover {
  border-color: rgba(34, 197, 94, 0.4);
  box-shadow: 0 22px 45px rgba(0, 0, 0, 0.6), 0 0 30px rgba(34, 197, 94, 0.15);
}

.game-card-badge {
  position: absolute;
  top: 1rem; right: 1rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.monkey-card .game-card-badge {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  border-color: rgba(34, 197, 94, 0.3);
}

.game-card-icon-wrap {
  width: 96px;
  height: 96px;
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 3.2rem;
  box-shadow: inset 0 2px 10px rgba(255, 255, 255, 0.05);
  transition: transform 0.25s ease;
}

.game-select-card:hover .game-card-icon-wrap {
  transform: scale(1.08) rotate(-3deg);
}

.game-select-card h2 {
  font-size: 1.7rem;
  font-weight: 800;
  color: #f8fafc;
  margin: 0 0 0.6rem 0;
}

.game-select-card p {
  color: #94a3b8;
  font-size: 0.95rem;
  line-height: 1.5;
  margin: 0 0 1.75rem 0;
  flex-grow: 1;
}

/* Outer Frame for Monkey Jump */
.monkey-game-frame {
  position: relative;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 50% 20%, #14532d 0%, #064e3b 45%, #022c22 80%, #051a14 100%);
  overflow: hidden;
  user-select: none;
  font-family: inherit;
}

/* Background Jungle Atmosphere */
.mj-bg-jungle {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  overflow: hidden;
}

.mj-bg-vine {
  position: absolute;
  width: 140px;
  height: 100%;
  top: 0;
  opacity: 0.22;
  background-image: radial-gradient(circle, #22c55e 2px, transparent 2px);
  background-size: 28px 34px;
}
.mj-bg-vine-left { left: 0; }
.mj-bg-vine-right { right: 0; transform: scaleX(-1); }

.mj-bg-leaf {
  position: absolute;
  width: 6px;
  height: 6px;
  background: rgba(74, 222, 128, 0.3);
  border-radius: 50%;
  pointer-events: none;
  animation: mj-leaf-fall 6s linear infinite;
}

@keyframes mj-leaf-fall {
  0% { transform: translateY(-20px) translateX(0) rotate(0deg); opacity: 0; }
  20% { opacity: 0.6; }
  100% { transform: translateY(800px) translateX(80px) rotate(360deg); opacity: 0; }
}

/* Arcade Pre-Start Attract Screen */
.mj-attract-screen {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(circle at 50% 40%, rgba(6, 78, 59, 0.98) 0%, rgba(2, 44, 34, 0.99) 70%, #051a14 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2.5rem;
  z-index: 40;
  text-align: center;
}

.mj-attract-screen[hidden] {
  display: none !important;
}

.mj-attract-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 2.5rem;
}

.mj-attract-icon {
  font-size: 4.5rem;
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.5));
  animation: mj-attract-float 3s ease-in-out infinite alternate;
}

@keyframes mj-attract-float {
  0% { transform: translateY(0) rotate(-4deg); }
  100% { transform: translateY(-14px) rotate(4deg); }
}

.mj-attract-title {
  font-size: 3.4rem;
  font-weight: 900;
  margin: 0;
  letter-spacing: 2px;
  background: linear-gradient(135deg, #4ade80 0%, #facc15 50%, #f97316 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 10px 30px rgba(34, 197, 94, 0.3);
}

.mj-attract-sub {
  color: #a7f3d0;
  font-size: 1.15rem;
  margin: 0;
  max-width: 460px;
  line-height: 1.5;
  font-weight: 500;
}

/* Pulsing Enter Start Button Banner */
.mj-enter-prompt-box {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.25) 0%, rgba(234, 179, 8, 0.25) 100%);
  border: 2px solid #4ade80;
  border-radius: 16px;
  padding: 1.1rem 2.8rem;
  box-shadow: 0 0 35px rgba(74, 222, 128, 0.4), inset 0 0 15px rgba(255, 255, 255, 0.2);
  margin-bottom: 2rem;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.mj-enter-prompt-box:hover {
  transform: scale(1.04);
}

.mj-enter-prompt-text {
  font-size: 1.35rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: 2px;
  margin: 0;
  animation: mj-pulse-enter 1.2s ease-in-out infinite alternate;
}

@keyframes mj-pulse-enter {
  0% { opacity: 0.65; transform: scale(0.98); }
  100% { opacity: 1; transform: scale(1.03); filter: drop-shadow(0 0 12px #4ade80); }
}

.mj-attract-hint {
  font-size: 0.85rem;
  color: #6ee7b7;
  letter-spacing: 1px;
  opacity: 0.85;
}

/* GET READY Overlay */
.mj-get-ready-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(2, 44, 34, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 35;
}

.mj-get-ready-overlay[hidden] {
  display: none !important;
}

.mj-get-ready-text {
  font-size: 3.5rem;
  font-weight: 900;
  color: #facc15;
  letter-spacing: 4px;
  animation: mj-pop-in 0.3s ease-out;
}

@keyframes mj-pop-in {
  from { transform: scale(0.5); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* Level Up Notification Banner */
.mj-level-up-banner {
  position: absolute;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #eab308 0%, #f97316 100%);
  color: #0f172a;
  padding: 0.6rem 1.8rem;
  border-radius: 30px;
  font-weight: 900;
  font-size: 1.1rem;
  letter-spacing: 2px;
  box-shadow: 0 10px 30px rgba(234, 179, 8, 0.6);
  z-index: 25;
  pointer-events: none;
  animation: mj-banner-bounce 1.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes mj-banner-bounce {
  0% { transform: translate(-50%, -40px) scale(0.6); opacity: 0; }
  20% { transform: translate(-50%, 0) scale(1.1); opacity: 1; }
  80% { transform: translate(-50%, 0) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -20px) scale(0.8); opacity: 0; }
}

/* HUD Top Bar */
.mj-hud {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 64px;
  background: rgba(5, 26, 20, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(74, 222, 128, 0.18);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  z-index: 20;
}

.mj-hud-left {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.mj-back-btn {
  background: rgba(30, 41, 59, 0.85);
  color: #cbd5e1;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 0.4rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  transition: all 0.15s ease;
}

.mj-back-btn:hover {
  background: rgba(51, 65, 85, 1);
  color: #ffffff;
  transform: translateX(-2px);
}

.mj-hud-stats {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.mj-hud-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  font-size: 0.7rem;
  color: #86efac;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.mj-hud-value {
  color: #ffffff;
  font-weight: 800;
  font-size: 1rem;
}

.mj-level-badge {
  color: #facc15;
  font-weight: 800;
}

/* Arena Viewport */
.mj-arena {
  position: absolute;
  top: 64px; left: 0; right: 0; bottom: 0;
  overflow: hidden;
}

/* Parallax World Layer */
.mj-world {
  position: absolute;
  left: 0; top: 0; width: 100%; height: 100%;
  transition: transform 0.45s cubic-bezier(0.25, 1, 0.5, 1);
  will-change: transform;
}

/* Wooden Platform Component - Stylized 3D Timber Plank */
.mj-platform {
  position: absolute;
  width: 240px;
  height: 42px;
  background: 
    linear-gradient(180deg, rgba(254, 240, 138, 0.16) 0%, transparent 25%),
    repeating-linear-gradient(90deg, transparent 0, transparent 40px, rgba(0, 0, 0, 0.08) 40px, rgba(0, 0, 0, 0.08) 42px),
    linear-gradient(180deg, #92400e 0%, #78350f 45%, #451a03 90%, #290f02 100%);
  border-radius: 12px;
  border: 2px solid #b45309;
  border-bottom: 3.5px solid #290f02;
  box-shadow: 
    0 14px 28px rgba(0, 0, 0, 0.75), 
    0 4px 10px rgba(0, 0, 0, 0.5), 
    inset 0 2px 3px rgba(254, 240, 138, 0.4), 
    inset 0 -3px 6px rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, opacity 0.3s ease;
  z-index: 5;
}

/* Wood Grain Detail Overlay */
.mj-platform::before {
  content: '';
  position: absolute;
  top: 3px; left: 10px; right: 10px;
  height: 3px;
  background: linear-gradient(90deg, transparent 0%, rgba(254, 240, 138, 0.3) 30%, rgba(254, 240, 138, 0.35) 70%, transparent 100%);
  border-radius: 3px;
  pointer-events: none;
}

/* End Pegs / Iron Nails on Plank Ends */
.mj-platform-peg {
  position: absolute;
  width: 9px;
  height: 9px;
  background: radial-gradient(circle at 35% 35%, #d97706 0%, #78350f 70%, #451a03 100%);
  border-radius: 50%;
  border: 1px solid #451a03;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.8), inset 0 1px 1px rgba(254, 240, 138, 0.5);
  top: 16px;
  z-index: 6;
}

.mj-platform-peg-left { left: 12px; }
.mj-platform-peg-right { right: 12px; }

/* Variations in Timber Tone */
.mj-platform.mj-wood-oak {
  background: 
    linear-gradient(180deg, rgba(254, 240, 138, 0.18) 0%, transparent 25%),
    repeating-linear-gradient(90deg, transparent 0, transparent 35px, rgba(0, 0, 0, 0.08) 35px, rgba(0, 0, 0, 0.08) 37px),
    linear-gradient(180deg, #a16207 0%, #854d0e 45%, #542d06 90%, #311802 100%);
  border-color: #d97706;
}

.mj-platform.mj-wood-mahogany {
  background: 
    linear-gradient(180deg, rgba(254, 240, 138, 0.15) 0%, transparent 25%),
    repeating-linear-gradient(90deg, transparent 0, transparent 45px, rgba(0, 0, 0, 0.09) 45px, rgba(0, 0, 0, 0.09) 47px),
    linear-gradient(180deg, #991b1b 0%, #7f1d1d 45%, #450a0a 90%, #240505 100%);
  border-color: #b91c1c;
}

.mj-platform.mj-wood-teak {
  background: 
    linear-gradient(180deg, rgba(254, 240, 138, 0.16) 0%, transparent 25%),
    repeating-linear-gradient(90deg, transparent 0, transparent 50px, rgba(0, 0, 0, 0.08) 50px, rgba(0, 0, 0, 0.08) 52px),
    linear-gradient(180deg, #854d0e 0%, #713f12 45%, #3f1d0b 90%, #200d04 100%);
  border-color: #a16207;
}

/* TARGET WORD WRAPPER ATTACHED DIRECTLY ABOVE NEXT PLATFORM */
.mj-platform-target-wrap {
  position: absolute;
  bottom: 50px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  z-index: 15;
  pointer-events: none;
  white-space: nowrap;
}

.mj-platform-target-box {
  background: rgba(15, 23, 42, 0.96);
  border: 2px solid #4ade80;
  border-radius: 14px;
  padding: 0.5rem 1.3rem;
  font-family: 'Fira Code', 'Courier New', monospace;
  font-size: 1.45rem;
  font-weight: 800;
  color: #f8fafc;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.75), 0 0 25px rgba(74, 222, 128, 0.4);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.mj-platform-target-box.is-error {
  border-color: #ef4444 !important;
  box-shadow: 0 0 30px rgba(239, 68, 68, 0.9) !important;
  animation: mj-shake-target 0.25s ease-in-out;
}

@keyframes mj-shake-target {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

.mj-typed-text {
  color: #4ade80;
  text-shadow: 0 0 12px rgba(74, 222, 128, 0.9);
}

.mj-cursor {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  background: #38bdf8;
  vertical-align: middle;
  margin: 0 1px;
  animation: mj-blink-cursor 0.7s infinite;
}

@keyframes mj-blink-cursor {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.mj-remaining-text {
  color: #e2e8f0;
}

/* Platform Health Bar attached below target word on platform */
.mj-platform-health-track {
  width: 120px;
  height: 8px;
  background: rgba(15, 23, 42, 0.85);
  border-radius: 4px;
  border: 1px solid rgba(74, 222, 128, 0.35);
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.6);
}

.mj-platform-health-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #22c55e 0%, #4ade80 100%);
  border-radius: 3px;
  transition: width 0.1s linear, background 0.3s ease;
}

.mj-platform-health-fill.warning {
  background: linear-gradient(90deg, #eab308 0%, #facc15 100%);
}

.mj-platform-health-fill.danger {
  background: linear-gradient(90deg, #ef4444 0%, #f87171 100%);
  animation: mj-pulse-danger 0.3s infinite alternate;
}

/* Platform Warning Badge (Unstable / Breaking) */
.mj-platform-warning-badge {
  position: absolute;
  top: -24px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 1px;
  padding: 0.15rem 0.5rem;
  border-radius: 8px;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
  white-space: nowrap;
}

.mj-platform.stage-cracking .mj-platform-warning-badge {
  opacity: 1;
  background: rgba(234, 179, 8, 0.9);
  color: #0f172a;
  box-shadow: 0 0 10px rgba(234, 179, 8, 0.6);
}

.mj-platform.stage-severe .mj-platform-warning-badge {
  opacity: 1;
  background: rgba(239, 68, 68, 0.95);
  color: #ffffff;
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.8);
  animation: mj-badge-pulse 0.3s infinite alternate;
}

@keyframes mj-badge-pulse {
  from { transform: scale(0.95); }
  to { transform: scale(1.05); }
}

/* Wood Grain Detail Lines */
.mj-platform::before {
  content: '';
  position: absolute;
  top: 4px; left: 12px; right: 12px;
  height: 2px;
  background: rgba(254, 240, 138, 0.25);
  border-radius: 2px;
}

/* Wooden End Pegs */
.mj-platform-peg {
  position: absolute;
  width: 12px; height: 12px;
  background: #451a03;
  border: 2px solid #ca8a04;
  border-radius: 50%;
  top: 11px;
}
.mj-platform-peg-left { left: 8px; }
.mj-platform-peg-right { right: 8px; }

/* Crack Overlays */
.mj-crack-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  border-radius: 8px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

/* Stage 2 Cracks */
.mj-platform.stage-cracking .mj-crack-overlay {
  opacity: 0.85;
  background-image: 
    linear-gradient(45deg, transparent 45%, #fef08a 48%, #fef08a 52%, transparent 55%),
    linear-gradient(-35deg, transparent 40%, #ca8a04 45%, #ca8a04 50%, transparent 55%);
  animation: mj-wobble-light 0.4s infinite alternate;
}

.mj-platform.stage-cracking {
  border-color: #eab308;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6), 0 0 15px rgba(234, 179, 8, 0.4);
}

@keyframes mj-wobble-light {
  0% { transform: rotate(0deg); }
  50% { transform: rotate(1.2deg); }
  100% { transform: rotate(-1.2deg); }
}

/* Stage 3 Severe Damage Cracks */
.mj-platform.stage-severe .mj-crack-overlay {
  opacity: 1;
  background-image: 
    linear-gradient(45deg, transparent 35%, #ef4444 45%, #fef08a 50%, #ef4444 55%, transparent 65%),
    linear-gradient(-45deg, transparent 30%, #ef4444 42%, #ef4444 48%, transparent 60%),
    linear-gradient(90deg, transparent 45%, #7f1d1d 50%, transparent 55%);
  animation: mj-wobble-severe 0.15s infinite alternate;
}

.mj-platform.stage-severe {
  border-color: #ef4444;
  box-shadow: 0 8px 25px rgba(239, 68, 68, 0.6), 0 0 25px rgba(239, 68, 68, 0.5);
}

@keyframes mj-wobble-severe {
  0% { transform: translateY(-1px) rotate(-2.5deg); }
  100% { transform: translateY(1px) rotate(2.5deg); }
}

/* Stage 4 Physical Plank Splitting Animation */
.mj-platform-split-left {
  position: absolute;
  left: 0; top: 0; width: 50%; height: 100%;
  background: linear-gradient(180deg, #854d0e 0%, #451a03 100%);
  border-radius: 8px 0 0 8px;
  animation: mj-split-left-fall 0.6s ease-in forwards;
}

.mj-platform-split-right {
  position: absolute;
  right: 0; top: 0; width: 50%; height: 100%;
  background: linear-gradient(180deg, #854d0e 0%, #451a03 100%);
  border-radius: 0 8px 8px 0;
  animation: mj-split-right-fall 0.6s ease-in forwards;
}

@keyframes mj-split-left-fall {
  0% { transform: rotate(0deg); opacity: 1; }
  100% { transform: translateX(-40px) translateY(200px) rotate(-45deg); opacity: 0; }
}

@keyframes mj-split-right-fall {
  0% { transform: rotate(0deg); opacity: 1; }
  100% { transform: translateX(40px) translateY(200px) rotate(45deg); opacity: 0; }
}

/* Wood Chip Particles */
.mj-wood-chip {
  position: absolute;
  width: 6px; height: 6px;
  background: #a16207;
  border-radius: 2px;
  pointer-events: none;
  z-index: 15;
  animation: mj-chip-fall 0.5s ease-out forwards;
}

@keyframes mj-chip-fall {
  0% { opacity: 1; transform: translate(0, 0) scale(1); }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) rotate(180deg) scale(0.3); }
}

/* Floating Speed Rating Popups */
.mj-rating-popup {
  position: absolute;
  top: -30px;
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: 1px;
  padding: 0.2rem 0.75rem;
  border-radius: 12px;
  pointer-events: none;
  animation: mj-rating-float 0.8s ease-out forwards;
}

.mj-rating-popup.perfect { background: #facc15; color: #0f172a; box-shadow: 0 0 15px #facc15; }
.mj-rating-popup.great { background: #38bdf8; color: #0f172a; box-shadow: 0 0 15px #38bdf8; }
.mj-rating-popup.good { background: #4ade80; color: #0f172a; box-shadow: 0 0 15px #4ade80; }

@keyframes mj-rating-float {
  0% { opacity: 1; transform: translateY(0) scale(0.8); }
  50% { opacity: 1; transform: translateY(-22px) scale(1.1); }
  100% { opacity: 0; transform: translateY(-38px) scale(0.9); }
}

/* Monkey Character Container */
.mj-monkey-character {
  position: absolute;
  width: 84px; height: 84px;
  z-index: 10;
  pointer-events: none;
  transition: transform 0.15s ease;
  will-change: left, bottom, transform;
}

.mj-monkey-svg {
  width: 100%; height: 100%;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.5));
}

.mj-monkey-character.is-falling {
  animation: mj-monkey-fall-spin 0.9s ease-in forwards;
}

@keyframes mj-monkey-fall-spin {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  25% { transform: translateY(-20px) rotate(20deg); }
  100% { transform: translateY(600px) rotate(480deg); opacity: 0; }
}

/* Landing Sparks */
.mj-landing-spark {
  position: absolute;
  width: 10px; height: 10px;
  background: #4ade80;
  border-radius: 50%;
  pointer-events: none;
  z-index: 15;
  animation: mj-spark-burst 0.35s ease-out forwards;
}

@keyframes mj-spark-burst {
  0% { opacity: 1; transform: translate(0, 0) scale(1); }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(0.2); }
}

/* ==========================================
   CINEMATIC FALL & ROAST OVERLAY STYLES
   ========================================== */
.mj-cinematic-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(circle at center, rgba(15, 15, 26, 0.96) 0%, rgba(5, 5, 10, 0.99) 100%);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  z-index: 50;
  text-align: center;
  box-sizing: border-box;
  overflow-y: auto;
}

.mj-cinematic-overlay[hidden] {
  display: none !important;
}

.mj-cinematic-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-width: 800px;
  width: 100%;
  gap: 1.25rem;
  animation: mj-cinematic-appear 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes mj-cinematic-appear {
  0% { opacity: 0; transform: scale(0.92); }
  100% { opacity: 1; transform: scale(1); }
}

/* Large Hero Monkey Avatar */
.mj-cinematic-monkey {
  font-size: clamp(4.5rem, 10vw, 6.8rem);
  line-height: 1;
  filter: drop-shadow(0 15px 35px rgba(0, 0, 0, 0.9));
  animation: mj-monkey-float 2.5s ease-in-out infinite alternate;
  user-select: none;
}

@keyframes mj-monkey-float {
  0% { transform: translateY(0) rotate(-3deg); }
  100% { transform: translateY(-12px) rotate(3deg); }
}

/* Large Roast Box & Typography */
.mj-cinematic-roast-box {
  width: 100%;
  max-width: 760px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 0 0.5rem;
}

.mj-cinematic-roast-badge {
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: #facc15;
  background: rgba(250, 204, 21, 0.12);
  border: 1px solid rgba(250, 204, 21, 0.3);
  padding: 0.25rem 0.85rem;
  border-radius: 20px;
  box-shadow: 0 0 15px rgba(250, 204, 21, 0.2);
}

.mj-cinematic-roast-text {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: clamp(1.4rem, 3.8vw, 2.3rem);
  font-weight: 800;
  color: #ffffff;
  margin: 0;
  line-height: 1.4;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.9), 0 0 40px rgba(250, 204, 21, 0.15);
  font-style: normal;
  letter-spacing: -0.02em;
  word-wrap: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
}

/* Remaining Hearts Indicator (Life Lost Screen) */
.mj-cinematic-lives {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 25px;
  padding: 0.4rem 1.1rem;
  color: #f87171;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 1px;
  margin-top: 0.25rem;
}

.mj-cinematic-lives-val {
  font-size: 1.3rem;
  letter-spacing: 2px;
}

/* Continue / Play Again Pulsing Prompt */
.mj-cinematic-prompt {
  background: rgba(255, 255, 255, 0.05);
  border: 1.5px solid rgba(250, 204, 21, 0.5);
  border-radius: 50px;
  padding: 0.85rem 2.25rem;
  margin-top: 0.5rem;
  box-shadow: 0 0 25px rgba(250, 204, 21, 0.25);
  animation: mj-prompt-pulse 1.8s ease-in-out infinite alternate;
  cursor: pointer;
  transition: transform 0.2s, background 0.2s;
}

.mj-cinematic-prompt:hover {
  background: rgba(250, 204, 21, 0.15);
  transform: scale(1.03);
}

.mj-cinematic-prompt-text {
  font-size: clamp(0.9rem, 2vw, 1.15rem);
  font-weight: 900;
  letter-spacing: 2px;
  color: #facc15;
  margin: 0;
  text-transform: uppercase;
}

@keyframes mj-prompt-pulse {
  0% { transform: scale(1); box-shadow: 0 0 15px rgba(250, 204, 21, 0.2); }
  100% { transform: scale(1.04); box-shadow: 0 0 35px rgba(250, 204, 21, 0.5); }
}

/* Final Results Grid in Cinematic Game Over Overlay */
.mj-cinematic-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  width: 100%;
  max-width: 540px;
  margin-top: 0.25rem;
}

.mj-cinematic-stat-box {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 0.6rem 0.8rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.mj-cinematic-stat-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #94a3b8;
}

.mj-cinematic-stat-val {
  font-size: 1.35rem;
  font-weight: 900;
  color: #38bdf8;
}

/* Modals */
.mj-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(2, 44, 34, 0.92);
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  z-index: 30;
  text-align: center;
}

.mj-overlay[hidden] {
  display: none !important;
}

.mj-modal-card {
  background: rgba(6, 78, 59, 0.95);
  border: 1px solid rgba(74, 222, 128, 0.25);
  border-radius: 20px;
  padding: 2.25rem 2.5rem;
  max-width: 480px;
  width: 90%;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.8), 0 0 35px rgba(34, 197, 94, 0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

.mj-modal-title {
  font-size: 2.2rem;
  font-weight: 800;
  margin: 0;
  background: linear-gradient(135deg, #4ade80 0%, #facc15 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.mj-modal-title.game-over-title {
  background: linear-gradient(135deg, #f87171 0%, #fb923c 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.mj-modal-sub {
  color: #a7f3d0;
  font-size: 0.95rem;
  margin: 0;
  line-height: 1.4;
}

/* Funny Monkey Roast Bubble in Game Over Modal */
.mj-roast-bubble {
  width: 100%;
  box-sizing: border-box;
  background: linear-gradient(135deg, rgba(234, 179, 8, 0.15) 0%, rgba(249, 115, 22, 0.2) 100%);
  border: 1.5px solid rgba(250, 204, 21, 0.4);
  border-radius: 16px;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3), inset 0 1px 2px rgba(254, 240, 138, 0.2);
  animation: mj-roast-pop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes mj-roast-pop {
  0% { transform: scale(0.88); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.mj-roast-avatar {
  font-size: 2.2rem;
  width: 48px;
  height: 48px;
  min-width: 48px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(250, 204, 21, 0.5);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  animation: mj-avatar-shake 2s ease-in-out infinite alternate;
}

@keyframes mj-avatar-shake {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-8deg); }
  75% { transform: rotate(8deg); }
}

.mj-roast-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  text-align: left;
  flex-grow: 1;
}

.mj-roast-badge {
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #facc15;
  background: rgba(250, 204, 21, 0.15);
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  border: 1px solid rgba(250, 204, 21, 0.3);
}

.mj-roast-text {
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0;
  line-height: 1.4;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  font-style: italic;
}

/* Floating Fall Speech Bubble in Arena */
.mj-fall-roast-bubble {
  position: absolute;
  z-index: 25;
  background: rgba(15, 23, 42, 0.95);
  border: 2px solid #facc15;
  border-radius: 14px;
  padding: 0.5rem 0.9rem;
  max-width: 260px;
  color: #fef08a;
  font-size: 0.88rem;
  font-weight: 700;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.8), 0 0 20px rgba(250, 204, 21, 0.3);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  pointer-events: none;
  animation: mj-fall-bubble-float 1.8s cubic-bezier(0.25, 1, 0.5, 1) forwards;
  white-space: normal;
  word-wrap: break-word;
}

.mj-fall-roast-bubble::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 20px;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 8px solid #facc15;
}

.mj-fall-roast-bubble .mj-roast-icon {
  font-size: 1.3rem;
}

@keyframes mj-fall-bubble-float {
  0% { opacity: 0; transform: translateY(10px) scale(0.85); }
  15% { opacity: 1; transform: translateY(0) scale(1); }
  80% { opacity: 1; transform: translateY(-15px) scale(1); }
  100% { opacity: 0; transform: translateY(-30px) scale(0.9); }
}

/* Responsive adjustments */
@media (max-width: 640px) {
  .game-selection-header h1 { font-size: 2rem; }
  .game-selection-grid { grid-template-columns: 1fr; }
  .mj-hud { padding: 0 0.5rem; height: 56px; }
  .mj-platform-target-box { font-size: 1.2rem; padding: 0.4rem 1rem; }
  .mj-attract-title { font-size: 2.4rem; }
  .mj-enter-prompt-box { padding: 0.9rem 1.5rem; }
  .mj-enter-prompt-text { font-size: 1.05rem; }
  .mj-roast-bubble { padding: 0.75rem 1rem; gap: 0.75rem; }
  .mj-roast-avatar { font-size: 1.8rem; width: 40px; height: 40px; min-width: 40px; }
  .mj-roast-text { font-size: 0.95rem; }
}
