* { box-sizing: border-box; margin: 0; padding: 0; user-select: none; -webkit-user-select: none; }
body {
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #080714;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4px;
  color: #fff;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

#game-container {
  position: relative;
  background: #110E26;
  border-radius: 20px;
  padding: clamp(8px, 1.2vw, 14px);
  box-shadow: 0 25px 60px rgba(0,0,0,0.8), 0 0 35px rgba(99, 102, 241, 0.25);
  border: 1.5px solid #6366F1;
  max-width: 1280px;
  width: 100%;
  text-align: center;
}

/* Top Bar HUD */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 4px 8px;
  gap: 8px;
  flex-wrap: wrap;
}

.title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.title {
  font-family: 'Baloo 2', 'Nunito', cursive, sans-serif;
  font-size: clamp(1.1rem, 1.6vw, 1.45rem);
  font-weight: 800;
  color: #FB923C;
  text-shadow: 0 2px 8px rgba(251, 146, 60, 0.4);
  line-height: 1.15;
  text-align: left;
}

.stage-badge {
  background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
  color: #FFF;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 50px;
  border: 1px solid #A78BFA;
  display: inline-block;
}

.hud-stats {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.stat-pill {
  background: rgba(255, 255, 255, 0.08);
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  border-radius: 50px;
  padding: 4px 9px;
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 800;
  font-size: clamp(0.78rem, 1.05vw, 0.9rem);
}

.ammo-pill {
  background: rgba(245, 158, 11, 0.15);
  border-color: #F59E0B;
  color: #FDE68A;
}

.beast-pill {
  background: rgba(239, 68, 68, 0.2);
  border-color: #EF4444;
  color: #FCA5A5;
  cursor: pointer;
  transition: transform 0.15s;
}
.beast-pill:hover {
  transform: scale(1.05);
}

.beast-bar-bg {
  width: 44px;
  height: 8px;
  background: rgba(0,0,0,0.6);
  border-radius: 50px;
  overflow: hidden;
  display: inline-block;
  vertical-align: middle;
  margin-left: 4px;
}

.beast-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #F59E0B, #EF4444);
  transition: width 0.2s ease;
}

.btn-hud-tool {
  background: linear-gradient(135deg, #7C3AED, #4F46E5);
  border: 1.5px solid #A78BFA;
  color: #FFF;
  font-weight: 800;
  font-size: 0.78rem;
  padding: 4px 10px;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: 0 0 10px rgba(124, 58, 237, 0.4);
}
.btn-hud-tool:hover {
  transform: scale(1.05);
  box-shadow: 0 0 15px rgba(124, 58, 237, 0.7);
}
.btn-fs-tool {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.25);
  font-size: 0.95rem;
  padding: 3px 8px;
}

/* Canvas Screen */
.canvas-wrap {
  position: relative;
  width: 100%;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 12px 30px rgba(0,0,0,0.6);
  background: #000;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 960 / 520;
  max-height: 78vh;
  object-fit: contain;
}

/* Modals */
.game-modal {
  position: absolute;
  inset: 0;
  background: rgba(10, 8, 26, 0.94);
  backdrop-filter: blur(12px);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
  animation: fadeIn 0.25s ease;
  overflow-y: auto;
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

.modal-title {
  font-family: 'Baloo 2', 'Nunito', cursive, sans-serif;
  font-size: clamp(1.3rem, 2.2vw, 1.8rem);
  font-weight: 800;
  margin-bottom: 4px;
}

.modal-desc {
  font-size: clamp(0.8rem, 1.1vw, 0.92rem);
  color: #CBD5E1;
  max-width: 580px;
  line-height: 1.4;
  margin-bottom: 12px;
  font-weight: 600;
}

/* Star Bank Badge */
.star-bank-badge {
  background: linear-gradient(90deg, rgba(251, 191, 36, 0.15), rgba(245, 158, 11, 0.25));
  border: 1.5px solid #F59E0B;
  border-radius: 50px;
  padding: 4px 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 800;
  color: #FEF08A;
  margin-bottom: 10px;
}

.btn-sub-action {
  background: #7C3AED;
  border: 1px solid #A78BFA;
  color: #FFF;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 20px;
  cursor: pointer;
}

/* World Selector Tabs */
.world-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 700px;
}

.world-tab-btn {
  background: #1E1B4B;
  border: 1.5px solid #3730A3;
  color: #CBD5E1;
  padding: 5px 12px;
  border-radius: 12px;
  font-weight: 800;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.18s ease;
}
.world-tab-btn:hover {
  background: #312E81;
  border-color: #6366F1;
  color: #FFF;
}
.world-tab-btn.active {
  background: linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%);
  border-color: #A78BFA;
  color: #FFF;
  box-shadow: 0 0 15px rgba(139, 92, 246, 0.5);
}

/* Stage Grid */
.stage-grid-5 {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-bottom: 12px;
  max-width: 600px;
  width: 100%;
}

.stage-card {
  background: #1E1B4B;
  border: 2px solid #3730A3;
  border-radius: 14px;
  padding: 10px 4px;
  cursor: pointer;
  transition: all 0.18s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.stage-card:hover:not(.locked) {
  transform: translateY(-3px);
  border-color: #F59E0B;
  box-shadow: 0 6px 15px rgba(245, 158, 11, 0.3);
}
.stage-card.selected {
  border-color: #10B981;
  background: #064E3B;
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.5);
}
.stage-card.locked {
  opacity: 0.5;
  cursor: not-allowed;
  border-style: dashed;
}
.stage-num {
  font-size: 1rem;
  font-weight: 900;
  color: #FB923C;
}
.stage-boss-icon {
  font-size: 1.4rem;
}
.stage-stars {
  font-size: 0.72rem;
  color: #FBBF24;
}

/* ══════════════════════════════════════════════════════════════
   SKILLS & TALENT UPGRADE SYSTEM STYLES
   ══════════════════════════════════════════════════════════════ */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  max-width: 860px;
  width: 100%;
  max-height: 52vh;
  overflow-y: auto;
  padding: 6px;
}

/* ☁️ Cloud Glassmorphism Column */
.skill-cloud-column {
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  border-radius: 18px;
  padding: 10px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}

.skill-cloud-header {
  font-family: 'Baloo 2', 'Nunito', sans-serif;
  font-size: 0.88rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.5px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  padding-bottom: 5px;
}

.skill-cloud-skills {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.skill-card {
  background: rgba(15, 23, 42, 0.75);
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
  transition: all 0.18s ease;
}
.skill-card:hover {
  border-color: #00F0FF;
  box-shadow: 0 0 14px rgba(0, 240, 255, 0.3);
  transform: translateY(-1px);
}

.skill-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.skill-title {
  font-size: 0.82rem;
  font-weight: 800;
  color: #F8FAFC;
  display: flex;
  align-items: center;
  gap: 5px;
}
.skill-lvl-badge {
  font-size: 0.7rem;
  font-weight: 800;
  color: #38BDF8;
  background: rgba(0, 0, 0, 0.5);
  padding: 1px 6px;
  border-radius: 10px;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.skill-desc {
  font-size: 0.72rem;
  color: #CBD5E1;
  line-height: 1.25;
  font-weight: 600;
}

.skill-bar-wrap {
  display: flex;
  gap: 3px;
  margin: 3px 0;
}
.skill-bar-pip {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}
.skill-bar-pip.active {
  background: linear-gradient(90deg, #F59E0B, #10B981);
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
}

.btn-skill-upgrade {
  background: linear-gradient(135deg, #F59E0B, #D97706);
  border: none;
  color: #050414;
  font-weight: 900;
  font-size: 0.75rem;
  padding: 5px 8px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.15s;
}
.btn-skill-upgrade:hover:not(:disabled) {
  transform: scale(1.03);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}
.btn-skill-upgrade:disabled {
  background: #374151;
  color: #9CA3AF;
  cursor: not-allowed;
}

.btn-play-action {
  background: linear-gradient(135deg, #10B981 0%, #059669 100%);
  border: none;
  color: #FFF;
  font-weight: 900;
  font-size: 0.95rem;
  padding: 9px 22px;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
  transition: all 0.18s ease;
}
.btn-play-action:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.6);
}

/* Mobile Controls */
.mobile-controls {
  display: none;
  justify-content: space-between;
  align-items: center;
  padding: 8px 4px 0;
  gap: 10px;
}
@media (max-width: 850px) {
  .mobile-controls { display: flex; }
  .instructions { display: none; }
}

.ctrl-dpad, .ctrl-actions {
  display: flex;
  gap: 8px;
}

.ctrl-btn {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: rgba(255,255,255,0.12);
  border: 2px solid rgba(255,255,255,0.25);
  color: #FFF;
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
}
.ctrl-btn:active {
  background: rgba(255,255,255,0.3);
  transform: scale(0.92);
}

.ctrl-btn-jump { background: #10B981; border-color: #34D399; }
.ctrl-btn-shoot { background: #F59E0B; border-color: #FBBF24; }
.ctrl-btn-beast { background: #EF4444; border-color: #F87171; }

/* Keyboard Instructions */
.instructions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 6px;
  font-size: 0.74rem;
  color: #94A3B8;
  flex-wrap: wrap;
  font-weight: 700;
}
.key-badge {
  background: rgba(255,255,255,0.15);
  padding: 2px 6px;
  border-radius: 4px;
  color: #F8FAFC;
  font-weight: 800;
}
