/* ========================================================
   ROYA & ARYA: NEON RICOCHET - DESIGN SYSTEM & STYLES
   ======================================================== */

:root {
  /* Colors */
  --bg-deep: #080910;
  --bg-card: rgba(18, 20, 32, 0.85);
  --bg-card-border: rgba(255, 255, 255, 0.12);
  
  /* Spirit Colors */
  --roya-cyan: #00f3ff;
  --roya-glow: rgba(0, 243, 255, 0.5);
  --arya-magenta: #ff007f;
  --arya-glow: rgba(255, 0, 127, 0.5);
  --synergy-purple: #b537f2;
  --synergy-glow: rgba(181, 55, 242, 0.55);
  --prism-gold: #ffb703;
  --prism-glow: rgba(255, 183, 3, 0.5);
  
  /* Neutral & Accents */
  --text-primary: #f0f4fc;
  --text-muted: #8b95ad;
  --text-dim: #545d75;
  --success-green: #06d6a0;
  --danger-red: #ef476f;
  
  /* Typography */
  --font-main: 'Outfit', 'Tajawal', -apple-system, BlinkMacSystemFont, sans-serif;
  
  /* Shadows & Glass */
  --glass-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
  --neon-border: 1px solid rgba(255, 255, 255, 0.15);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --radius-pill: 9999px;
  
  /* Responsive sizes & Apple Safe Area */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --header-height: calc(56px + var(--safe-top));
  --banner-height: calc(48px + var(--safe-bottom));
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background-color: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 15px;
  line-height: 1.4;
  touch-action: none; /* Prevents pull-to-refresh & browser pinch */
}

/* Main Container */
#game-app {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 480px; /* Mobile portrait frame */
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: radial-gradient(circle at 50% 30%, #111425 0%, #07080d 100%);
  overflow: hidden;
  box-shadow: 0 0 60px rgba(0, 243, 255, 0.08);
}

/* ========================================================
   TOP HUD
   ======================================================== */
.hud-layer {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  padding: calc(6px + var(--safe-top)) 14px 6px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 20;
  background: linear-gradient(180deg, rgba(8, 9, 16, 0.92) 0%, rgba(8, 9, 16, 0.6) 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.hud-left {
  display: flex;
  gap: 8px;
  align-items: center;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.icon-btn:active {
  transform: scale(0.92);
  background: rgba(255, 255, 255, 0.15);
}

.hud-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}

.level-indicator .level-title {
  font-size: 0.95rem;
  font-weight: 850;
  letter-spacing: 0.5px;
  background: linear-gradient(90deg, var(--roya-cyan), #ffffff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.score-display {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.score-display .score-value {
  color: var(--prism-gold);
  font-weight: 800;
}

.hud-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.gems-hud-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 183, 3, 0.12);
  border: 1px solid rgba(255, 183, 3, 0.35);
  padding: 5px 11px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(10px);
}

.gems-hud-pill:active {
  transform: scale(0.94);
  background: rgba(255, 183, 3, 0.25);
}

.gem-icon {
  font-size: 0.85rem;
  line-height: 1;
}

.gem-amount {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--prism-gold);
}

.spirits-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  backdrop-filter: blur(10px);
}

.spirit-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  position: relative;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.spirit-dot::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
}

.spirit-roya {
  background: radial-gradient(circle at 35% 35%, #ffffff 0%, var(--roya-cyan) 60%, #0088a8 100%);
  box-shadow: 0 0 10px var(--roya-glow);
}

.spirit-arya {
  background: radial-gradient(circle at 35% 35%, #ffffff 0%, var(--arya-magenta) 60%, #99004d 100%);
  box-shadow: 0 0 10px var(--arya-glow);
}

.spirit-dot.inactive {
  opacity: 0.22;
  box-shadow: none;
  filter: grayscale(1);
  transform: scale(0.85);
}

.shots-count {
  font-weight: 900;
  font-size: 0.95rem;
  color: #fff;
  margin-inline-start: 3px;
  font-family: var(--font-main);
}

/* ========================================================
   CANVAS GAME AREA
   ======================================================== */
#canvas-wrapper {
  position: relative;
  flex: 1;
  width: 100%;
  height: calc(100% - var(--header-height));
  margin-top: var(--header-height);
  overflow: hidden;
  background-color: #060810;
  background-image: 
    linear-gradient(rgba(0, 243, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 243, 255, 0.035) 1px, transparent 1px);
  background-size: 35px 35px;
  background-position: center;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

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

/* Gesture Hint */
.gesture-hint {
  position: absolute;
  bottom: 24%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(14, 16, 26, 0.75);
  border: 1px solid rgba(0, 243, 255, 0.3);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 600;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: opacity 0.4s ease;
}

.hint-hand-pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--roya-cyan);
  animation: pulsePing 1.5s infinite;
}

@keyframes pulsePing {
  0% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(0, 243, 255, 0.7); }
  70% { transform: scale(1.1); box-shadow: 0 0 0 10px rgba(0, 243, 255, 0); }
  100% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(0, 243, 255, 0); }
}

/* Combo Banner */
.combo-banner {
  position: absolute;
  top: 15%;
  left: 50%;
  transform: translateX(-50%) scale(1);
  padding: 6px 18px;
  background: linear-gradient(90deg, var(--arya-magenta), var(--synergy-purple));
  color: #fff;
  font-weight: 900;
  font-size: 1.1rem;
  letter-spacing: 1px;
  border-radius: var(--radius-pill);
  box-shadow: 0 4px 20px var(--arya-glow);
  pointer-events: none;
  animation: popBounce 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popBounce {
  0% { transform: translateX(-50%) scale(0.5); opacity: 0; }
  100% { transform: translateX(-50%) scale(1); opacity: 1; }
}

/* ========================================================
   MODALS & SCREENS
   ======================================================== */
.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(5, 6, 12, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.modal-card {
  position: relative;
  width: 100%;
  max-width: 380px;
  background: var(--bg-card);
  border: var(--neon-border);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  box-shadow: var(--glass-shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  overflow: hidden;
  animation: modalSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlideUp {
  0% { transform: translateY(20px) scale(0.96); opacity: 0; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

/* Title Screen Modern AAA Styling */
.title-card {
  padding: 26px 20px 20px 20px;
  width: 100%;
  max-width: 410px;
  background: linear-gradient(180deg, rgba(16, 20, 36, 0.94) 0%, rgba(9, 11, 20, 0.98) 100%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 28px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.8), 0 0 40px rgba(0, 243, 255, 0.08);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.title-glow-aura {
  position: absolute;
  top: -80px;
  left: 50%;
  transform: translateX(-50%);
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, rgba(0, 243, 255, 0.25) 0%, rgba(255, 0, 127, 0.2) 50%, transparent 70%);
  border-radius: 50%;
  filter: blur(40px);
  pointer-events: none;
}

/* Top Navigation Bar */
.title-top-bar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  position: relative;
  z-index: 10;
}

.btn-top-glass {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-primary);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-top-glass:active {
  transform: scale(0.95);
  background: rgba(255, 255, 255, 0.15);
}

.btn-top-gift {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg, rgba(255, 183, 3, 0.18), rgba(255, 119, 0, 0.18));
  border: 1px solid rgba(255, 183, 3, 0.5);
  color: var(--prism-gold);
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 0 15px rgba(255, 183, 3, 0.2);
  animation: giftGleam 3s ease-in-out infinite;
}

@keyframes giftGleam {
  0%, 100% { box-shadow: 0 0 10px rgba(255, 183, 3, 0.2); transform: translateY(0); }
  50% { box-shadow: 0 0 22px rgba(255, 183, 3, 0.5); transform: translateY(-2px); }
}

.btn-top-gift:active {
  transform: scale(0.95);
}

/* Hero Showcase */
.title-hero-showcase {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  margin-top: 2px;
  margin-bottom: 4px;
}

.hero-spirits-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  margin-bottom: 14px;
  position: relative;
}

.avatar-spirit {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.avatar-roya .spirit-inner-core,
.avatar-arya .spirit-inner-core {
  position: relative;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  animation: floatOrb 3.2s ease-in-out infinite;
}

.avatar-roya .spirit-inner-core {
  background: radial-gradient(circle at 35% 35%, #fff 10%, var(--roya-cyan) 60%, #0077b6 100%);
  box-shadow: 0 0 28px var(--roya-glow), inset 0 0 12px #fff;
}

.avatar-roya .spirit-inner-core::before {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 1.5px solid rgba(0, 243, 255, 0.65);
  transform: rotate(25deg) scaleY(0.48);
  box-shadow: 0 0 8px rgba(0, 243, 255, 0.4);
}

.avatar-roya .spirit-inner-core::after {
  content: '✦';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #fff;
  text-shadow: 0 0 10px var(--roya-cyan);
}

.avatar-arya .spirit-inner-core {
  background: radial-gradient(circle at 35% 35%, #fff 10%, var(--arya-magenta) 60%, #800f2f 100%);
  box-shadow: 0 0 28px var(--arya-glow), inset 0 0 12px #fff;
  animation-delay: 1.6s;
}

.avatar-arya .spirit-inner-core::before {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 0, 127, 0.65);
  transform: rotate(-25deg) scaleY(0.48);
  box-shadow: 0 0 8px rgba(255, 0, 127, 0.4);
}

.avatar-arya .spirit-inner-core::after {
  content: '✺';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #fff;
  text-shadow: 0 0 10px var(--arya-magenta);
}

@keyframes floatOrb {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.spirit-name {
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 2px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.avatar-roya .spirit-name {
  color: var(--roya-cyan);
  text-shadow: 0 0 10px var(--roya-glow);
}

.avatar-arya .spirit-name {
  color: var(--arya-magenta);
  text-shadow: 0 0 10px var(--arya-glow);
}

.hero-synergy-bridge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 48px;
}

.synergy-beam-line {
  width: 48px;
  height: 2px;
  background: linear-gradient(90deg, var(--roya-cyan), var(--synergy-purple), var(--arya-magenta));
  box-shadow: 0 0 8px var(--synergy-purple);
  position: absolute;
}

.synergy-spark-orb {
  font-size: 1.3rem;
  color: var(--prism-gold);
  position: relative;
  z-index: 2;
  animation: pulsePing 2s infinite;
  text-shadow: 0 0 14px var(--prism-gold);
}

.hero-logo-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.game-logo {
  font-size: 2.3rem;
  font-weight: 950;
  letter-spacing: 3px;
  line-height: 1;
  background: linear-gradient(135deg, #ffffff 0%, var(--roya-cyan) 50%, var(--arya-magenta) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 4px 14px rgba(0, 243, 255, 0.35));
  margin: 0;
}

.game-logo .amp {
  font-weight: 600;
  color: var(--prism-gold);
  -webkit-text-fill-color: var(--prism-gold);
}

.logo-sub-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-pill);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.logo-sub-pill .pill-star {
  color: var(--roya-cyan);
  font-size: 0.65rem;
}

/* Mode Tabs */
.mode-tabs {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-pill);
  padding: 4px;
  gap: 4px;
}

.tab-btn {
  padding: 9px 12px;
  border-radius: var(--radius-pill);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-main);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.tab-btn.active {
  background: linear-gradient(135deg, var(--roya-cyan), #0077b6);
  color: #030814;
  font-weight: 900;
  box-shadow: 0 4px 14px rgba(0, 243, 255, 0.35);
}

/* Menu Actions & Master Play Button */
.menu-actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-primary-hero {
  position: relative;
  width: 100%;
  padding: 15px 24px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--roya-cyan) 0%, #0088ff 50%, #b537f2 100%);
  background-size: 200% 200%;
  animation: gradientShift 6s ease infinite, heroPulse 2.8s ease-in-out infinite;
  color: #ffffff;
  font-family: var(--font-main);
  font-size: 1.15rem;
  font-weight: 900;
  letter-spacing: 0.5px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  box-shadow: 0 8px 30px rgba(0, 243, 255, 0.4);
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes heroPulse {
  0%, 100% { box-shadow: 0 6px 24px rgba(0, 243, 255, 0.35); }
  50% { box-shadow: 0 10px 36px rgba(0, 243, 255, 0.6), 0 0 20px rgba(181, 55, 242, 0.3); }
}

.btn-primary-hero:active {
  transform: scale(0.97);
  box-shadow: 0 2px 12px rgba(0, 243, 255, 0.25);
}

.btn-sheen-sweep {
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  transform: skewX(-25deg);
  animation: sheenSweep 4s infinite 1s;
  pointer-events: none;
}

@keyframes sheenSweep {
  0% { left: -100%; }
  30%, 100% { left: 200%; }
}

/* 3-Column Dock Grid */
.main-dock-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.dock-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 6px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  font-family: var(--font-main);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(8px);
}

.dock-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(0, 243, 255, 0.4);
  transform: translateY(-2px);
}

.dock-btn:active {
  transform: scale(0.95);
  background: rgba(255, 255, 255, 0.14);
}

.dock-icon-box {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--roya-cyan);
  transition: all 0.2s ease;
}

.dock-btn:nth-child(2) .dock-icon-box {
  color: var(--arya-magenta);
}

.dock-btn:nth-child(3) .dock-icon-box {
  color: var(--prism-gold);
}

.dock-txt {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.3px;
}

.dock-btn:hover .dock-txt {
  color: var(--text-primary);
}

/* Footer Link */
.title-footer-row {
  width: 100%;
  display: flex;
  justify-content: center;
  margin-top: 2px;
}

.privacy-link {
  font-size: 0.72rem;
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.2s ease;
}

.privacy-link:hover {
  color: var(--text-muted);
}

/* Common Buttons */
.btn-primary {
  width: 100%;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--roya-cyan) 0%, #0099ff 100%);
  color: #030814;
  font-family: var(--font-main);
  font-size: 1.05rem;
  font-weight: 800;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 6px 20px rgba(0, 243, 255, 0.35);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary:active {
  transform: scale(0.97);
  box-shadow: 0 2px 10px rgba(0, 243, 255, 0.2);
}

.btn-secondary {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.07);
  border: var(--neon-border);
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn-secondary:active {
  transform: scale(0.97);
  background: rgba(255, 255, 255, 0.12);
}

.pulse-btn {
  animation: softPulse 2.5s infinite;
}

@keyframes softPulse {
  0%, 100% { box-shadow: 0 4px 18px rgba(0, 243, 255, 0.3); }
  50% { box-shadow: 0 8px 30px rgba(0, 243, 255, 0.6); }
}

/* Victory & Stats */
.star-rating-row {
  display: flex;
  gap: 10px;
  font-size: 2.2rem;
  color: rgba(255, 255, 255, 0.15);
  margin-bottom: 8px;
}

.star-item.star-fill {
  color: var(--prism-gold);
  text-shadow: 0 0 15px var(--prism-glow);
  animation: starPop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

@keyframes starPop {
  0% { transform: scale(0); opacity: 0; }
  80% { transform: scale(1.3); }
  100% { transform: scale(1); opacity: 1; }
}

.modal-title {
  font-size: 1.6rem;
  font-weight: 900;
  margin-bottom: 4px;
}

.victory-title {
  background: linear-gradient(90deg, #fff, var(--roya-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.modal-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.stats-summary-box {
  width: 100%;
  display: flex;
  justify-content: space-around;
  background: rgba(0, 0, 0, 0.35);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 20px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.stat-col {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-num {
  font-size: 1.25rem;
  font-weight: 900;
  color: #fff;
}

.stat-lbl {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.stat-divider {
  width: 1px;
  background: rgba(255, 255, 255, 0.1);
}

.modal-btn-stack {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Game Over Card */
.gameover-title {
  color: var(--danger-red);
}

.rewarded-ad-offer {
  width: 100%;
  background: linear-gradient(135deg, rgba(255, 0, 127, 0.15) 0%, rgba(181, 55, 242, 0.15) 100%);
  border: 1px dashed var(--arya-magenta);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.ad-offer-badge {
  font-size: 0.65rem;
  font-weight: 900;
  color: #fff;
  background: var(--arya-magenta);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}

.ad-offer-desc {
  font-size: 0.8rem;
  color: var(--text-primary);
  line-height: 1.4;
}

.btn-ad-revive {
  margin-top: 4px;
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--arya-magenta), var(--synergy-purple));
  color: #fff;
  font-weight: 800;
  font-size: 0.9rem;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 15px var(--arya-glow);
  transition: transform 0.2s ease;
}

.btn-ad-revive:active {
  transform: scale(0.96);
}

/* Settings Toggle */
.settings-toggle-group {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 22px;
  background: rgba(0, 0, 0, 0.25);
  padding: 14px;
  border-radius: var(--radius-md);
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-primary);
}

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: rgba(255, 255, 255, 0.15);
  transition: .3s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--roya-cyan);
}

input:checked + .slider:before {
  transform: translateX(20px);
}

/* Levels Grid */
.levels-card {
  max-height: 80vh;
}

.modal-header-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.icon-btn-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px 8px;
}

.levels-grid-container {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  overflow-y: auto;
  padding: 8px 4px;
  max-height: 280px;
}

.level-tile {
  aspect-ratio: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--text-primary);
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
}

.level-tile.completed {
  border-color: var(--roya-cyan);
  background: rgba(0, 243, 255, 0.08);
}

.level-tile.current {
  border-color: var(--prism-gold);
  background: rgba(255, 183, 3, 0.15);
  box-shadow: 0 0 12px var(--prism-glow);
}

.level-tile.locked {
  opacity: 0.35;
  cursor: not-allowed;
  filter: grayscale(1);
}

.level-tile-stars {
  font-size: 0.6rem;
  color: var(--prism-gold);
  margin-top: 2px;
}

/* Skins List */
.skins-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 280px;
  overflow-y: auto;
}

.skin-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
}

.skin-item.selected {
  border-color: var(--roya-cyan);
  background: rgba(0, 243, 255, 0.1);
}

.skin-info {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: right;
}

.skin-swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  box-shadow: 0 0 10px currentColor;
}

.skin-label {
  font-weight: 700;
  font-size: 0.9rem;
}

/* Shop Multi-Tab Navigation */
.shop-tabs-nav {
  display: flex;
  gap: 6px;
  width: 100%;
  margin-bottom: 12px;
  background: rgba(0, 0, 0, 0.35);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.shop-tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 8px 4px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.shop-tab-btn.active {
  background: rgba(0, 243, 255, 0.15);
  color: var(--roya-cyan);
  box-shadow: 0 0 10px rgba(0, 243, 255, 0.25);
}

.shop-tab-pane {
  width: 100%;
}

.trail-swatch {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

/* In-Game Quick Booster Action Bar */
.in-game-boosters {
  position: absolute;
  bottom: calc(20px + var(--safe-bottom));
  right: 14px;
  display: flex;
  gap: 8px;
  z-index: 25;
  pointer-events: auto;
}

[dir="rtl"] .in-game-boosters {
  right: auto;
  left: 14px;
}

.booster-btn {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(15, 17, 30, 0.88);
  border: 1.5px solid rgba(0, 243, 255, 0.35);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5), inset 0 0 10px rgba(0, 243, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.booster-btn:active {
  transform: scale(0.9);
}

.booster-btn.active {
  border-color: var(--roya-cyan);
  background: rgba(0, 243, 255, 0.25);
  box-shadow: 0 0 18px var(--roya-cyan);
  animation: boosterPulse 1.2s infinite alternate;
}

.booster-btn.empty {
  border-color: rgba(255, 255, 255, 0.15);
  opacity: 0.75;
}

.boost-icon {
  font-size: 1.2rem;
  pointer-events: none;
}

.boost-count {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--roya-cyan);
  color: #080910;
  font-size: 0.65rem;
  font-weight: 900;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 6px var(--roya-cyan);
}

.booster-btn.empty .boost-count {
  background: #ff007f;
  color: #fff;
  box-shadow: 0 0 6px #ff007f;
}

@keyframes boosterPulse {
  from { box-shadow: 0 0 8px var(--roya-cyan); }
  to { box-shadow: 0 0 22px var(--roya-cyan); }
}

.btn-skin-buy, .btn-skin-ad, .btn-booster-refill {
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}

.btn-skin-buy {
  background: linear-gradient(135deg, #ffb703, #fb8500);
  color: #080910;
  box-shadow: 0 2px 8px rgba(251, 133, 0, 0.35);
}

.btn-skin-buy.locked {
  background: rgba(255, 183, 3, 0.12);
  border: 1px solid rgba(255, 183, 3, 0.45);
  color: #ffb703;
  box-shadow: none;
}

.btn-skin-ad, .btn-booster-refill {
  background: linear-gradient(135deg, rgba(255, 0, 127, 0.25), rgba(0, 243, 255, 0.25));
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

/* Ad Simulation Overlay */
.ad-sim-box {
  background: #0f111e;
  border: 1px solid var(--arya-magenta);
  border-radius: var(--radius-lg);
  padding: 30px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: 320px;
  box-shadow: 0 0 30px var(--arya-glow);
}

.ad-sim-spinner {
  width: 44px;
  height: 44px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--arya-magenta);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.ad-progress-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 6px;
}

.ad-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--arya-magenta);
  transition: width 0.1s linear;
}

/* Bottom Banner & StoreKit VIP */
.banner-layer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--banner-height);
  background: rgba(10, 12, 20, 0.95);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 14px calc(6px + var(--safe-bottom)) 14px;
  z-index: 20;
}

.ad-badge-small {
  font-size: 0.6rem;
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 5px;
  border-radius: 3px;
  color: var(--text-muted);
}

.ad-text-sample {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0 8px;
  flex: 1;
}

.btn-iap-pill {
  background: linear-gradient(90deg, #ffb703, #fb8500);
  border: none;
  border-radius: var(--radius-pill);
  color: #000;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 4px 10px;
  cursor: pointer;
  white-space: nowrap;
}

/* Achievement Unlock Toast Banner */
.achievement-toast {
  position: absolute;
  top: calc(var(--header-height) + 12px);
  left: 50%;
  transform: translateX(-50%) translateY(0);
  background: rgba(18, 20, 36, 0.95);
  border: 1px solid var(--prism-gold);
  border-radius: var(--radius-pill);
  padding: 8px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 8px 24px var(--prism-glow);
  z-index: 150;
  animation: slideDownToast 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes slideDownToast {
  0% { transform: translateX(-50%) translateY(-30px); opacity: 0; }
  100% { transform: translateX(-50%) translateY(0); opacity: 1; }
}

.toast-icon {
  font-size: 1.2rem;
}

.toast-info {
  display: flex;
  flex-direction: column;
  text-align: right;
}

.toast-title {
  font-size: 0.8rem;
  font-weight: 900;
  color: var(--prism-gold);
}

.toast-desc {
  font-size: 0.68rem;
  color: var(--text-muted);
}

/* Mode Switcher Tabs */
.mode-tabs {
  display: flex;
  background: rgba(0, 0, 0, 0.4);
  padding: 4px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 16px;
  width: 100%;
}

.tab-btn {
  flex: 1;
  padding: 8px 12px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-main);
  font-weight: 700;
  font-size: 0.82rem;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.25s ease;
}

.tab-btn.active {
  background: linear-gradient(135deg, var(--roya-cyan), #0099ff);
  color: #030814;
  box-shadow: 0 2px 10px rgba(0, 243, 255, 0.3);
}

/* Achievements Grid */
.achievements-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
  max-height: 280px;
  overflow-y: auto;
  padding: 4px;
}

.achieve-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
}

.achieve-card.unlocked {
  border-color: var(--prism-gold);
  background: rgba(255, 183, 3, 0.08);
}

.achieve-icon {
  font-size: 1.5rem;
  filter: grayscale(1);
  opacity: 0.4;
}

.achieve-card.unlocked .achieve-icon {
  filter: none;
  opacity: 1;
  animation: pulsePing 2s infinite;
}

.achieve-name {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--text-primary);
}

.achieve-detail {
  font-size: 0.65rem;
  color: var(--text-muted);
}

/* Privacy Footer Link */
.privacy-link {
  color: var(--text-muted);
  font-size: 0.75rem;
  text-decoration: underline;
  margin-top: 14px;
  cursor: pointer;
  transition: color 0.2s ease;
}

.privacy-link:hover {
  color: var(--roya-cyan);
}

.text-danger {
  color: var(--danger-red) !important;
}

.text-gold {
  color: var(--prism-gold) !important;
}

.hidden {
  display: none !important;
}

/* =========================================
   GEMS & REWARDED ADS ENHANCEMENTS
   ========================================= */

/* Gems HUD Pill */
.gems-hud-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 183, 3, 0.12);
  border: 1px solid rgba(255, 183, 3, 0.4);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  box-shadow: 0 0 10px rgba(255, 183, 3, 0.2);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.gems-hud-pill:active {
  transform: scale(0.95);
}

.gem-icon {
  font-size: 0.9rem;
  filter: drop-shadow(0 0 4px #ffb703);
}

.gem-amount {
  font-family: var(--font-number);
  font-weight: 800;
  font-size: 0.85rem;
  color: #fff;
  letter-spacing: 0.5px;
}

/* Daily / Ad Reward Card in Title Screen */
.daily-reward-card {
  width: 100%;
  background: linear-gradient(135deg, rgba(255, 183, 3, 0.15), rgba(181, 55, 242, 0.15));
  border: 1px solid rgba(255, 183, 3, 0.4);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 4px 16px rgba(255, 183, 3, 0.15);
  animation: pulseCard 3s infinite alternate;
}

@keyframes pulseCard {
  0% { border-color: rgba(255, 183, 3, 0.3); }
  100% { border-color: rgba(255, 183, 3, 0.8); box-shadow: 0 4px 20px rgba(255, 183, 3, 0.3); }
}

.reward-icon-sparkle {
  font-size: 1.8rem;
  animation: bounceGift 1.8s infinite ease-in-out;
}

@keyframes bounceGift {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px) scale(1.1); }
}

.reward-text-col {
  display: flex;
  flex-direction: column;
  text-align: right;
  flex: 1;
}

.reward-tag {
  font-size: 0.65rem;
  font-weight: 900;
  color: var(--prism-gold);
  text-transform: uppercase;
}

.reward-title {
  font-size: 0.82rem;
  color: #fff;
  line-height: 1.3;
}

.btn-reward-pill {
  background: linear-gradient(135deg, var(--prism-gold), #ff8800);
  border: none;
  border-radius: var(--radius-pill);
  padding: 8px 14px;
  color: #030814;
  font-weight: 900;
  font-size: 0.82rem;
  font-family: var(--font-main);
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(255, 183, 3, 0.4);
  white-space: nowrap;
  transition: transform 0.2s ease;
}

.btn-reward-pill:active {
  transform: scale(0.94);
}

/* Double Reward Button in Victory Modal */
.btn-ad-double {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: linear-gradient(90deg, #ffb703, #fb8500, #b537f2);
  background-size: 200% auto;
  border: none;
  color: #fff;
  font-weight: 900;
  font-size: 0.92rem;
  cursor: pointer;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 4px 18px rgba(255, 183, 3, 0.4);
  transition: all 0.3s ease;
}

.btn-ad-double:hover {
  background-position: right center;
}

.btn-ad-double:active {
  transform: scale(0.97);
}

.ad-pill-tag {
  background: rgba(0, 0, 0, 0.35);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 0.7rem;
  font-weight: 800;
}

/* Achievements Progress Header */
.achieve-summary-box {
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin-bottom: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.achieve-summary-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  margin-bottom: 6px;
}

.achieve-percent-val {
  font-family: var(--font-number);
  font-weight: 900;
  color: var(--prism-gold);
}

.achieve-progress-track {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
}

.achieve-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--roya-cyan), var(--prism-gold));
  transition: width 0.4s ease;
}

/* Individual Achievement Card Upgrades */
.achieve-card {
  position: relative;
  transition: all 0.25s ease;
}

.achieve-card.unlocked {
  background: linear-gradient(135deg, rgba(255, 183, 3, 0.12), rgba(0, 243, 255, 0.08));
  border-color: rgba(255, 183, 3, 0.6);
  box-shadow: 0 4px 14px rgba(255, 183, 3, 0.15);
}

.achieve-reward-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: rgba(255, 183, 3, 0.2);
  color: var(--prism-gold);
  border-radius: var(--radius-pill);
  padding: 1px 7px;
  font-size: 0.65rem;
  font-weight: 800;
  margin-top: 3px;
}

.achieve-card-progress-bar {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  margin-top: 4px;
  overflow: hidden;
}

.achieve-card-progress-fill {
  height: 100%;
  background: var(--roya-cyan);
}

/* Skins Balance Header */
.skins-balance-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.3);
  padding: 8px 12px;
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  font-size: 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.skins-balance-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.skins-gems-badge {
  color: var(--prism-gold);
  font-weight: 800;
  font-size: 0.95rem;
}

.btn-shop-free-gems {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: linear-gradient(135deg, rgba(255, 183, 3, 0.22), rgba(255, 0, 110, 0.28));
  border: 1px solid rgba(255, 183, 3, 0.65);
  border-radius: 999px;
  color: #ffb703;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s;
  box-shadow: 0 0 12px rgba(255, 183, 3, 0.25);
}

.btn-shop-free-gems:active {
  transform: scale(0.95);
}

.btn-shop-free-gems .ad-tag {
  padding: 1px 5px;
  background: #ffb703;
  color: #0b0717;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 900;
  letter-spacing: 0.5px;
  line-height: 1.2;
}

/* Skin Buy / Unlock Buttons */
.btn-skin-buy {
  background: linear-gradient(135deg, #ffb703, #ff8800);
  border: none;
  border-radius: var(--radius-sm);
  color: #030814;
  font-weight: 900;
  font-size: 0.75rem;
  padding: 5px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-skin-ad {
  background: linear-gradient(135deg, var(--arya-magenta), var(--synergy-purple));
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  font-weight: 800;
  font-size: 0.72rem;
  padding: 5px 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 3px;
}

/* Language Toggle Button & World Headers */
.title-top-bar {
  width: 100%;
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
  position: relative;
  z-index: 10;
}

.btn-lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(0, 243, 255, 0.4);
  color: var(--roya-cyan);
  font-size: 0.82rem;
  font-weight: 700;
  font-family: var(--font-main);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 0 10px rgba(0, 243, 255, 0.15);
}

.btn-lang-toggle:hover, .btn-lang-toggle:active {
  background: rgba(0, 243, 255, 0.22);
  border-color: var(--roya-cyan);
  transform: scale(1.04);
}

.world-section-header {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.05);
  border-left: 3px solid var(--roya-cyan);
  border-radius: var(--radius-sm);
  margin-top: 10px;
  margin-bottom: 2px;
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text-primary);
  text-align: start;
}

[dir="rtl"] .world-section-header {
  border-left: none;
  border-right: 3px solid var(--roya-cyan);
}

/* ========================================================
   CINEMATIC INTRO SCENE & WELCOME ANIMATION
   ======================================================== */
.intro-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #080910;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  opacity: 1;
  transition: opacity 0.65s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.intro-overlay.fade-out {
  opacity: 0;
  pointer-events: none;
}

#intro-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.intro-ui-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.intro-logo-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  opacity: 0;
  transform: translateY(18px) scale(0.88);
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
  filter: drop-shadow(0 0 35px rgba(0, 243, 255, 0.35));
}

.intro-logo-box.active {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.intro-emblem-wrap {
  position: relative;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

.intro-pulse-aura {
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(181, 55, 242, 0.4) 0%, rgba(0, 243, 255, 0.15) 50%, transparent 75%);
  animation: introAuraPulse 2s ease-in-out infinite alternate;
}

.intro-duo-halo {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 0 20px rgba(181, 55, 242, 0.5), inset 0 0 15px rgba(0, 243, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 6px;
  background: rgba(14, 16, 28, 0.7);
  backdrop-filter: blur(8px);
}

.intro-orb-dot {
  font-size: 1.2rem;
  line-height: 1;
}

.intro-orb-dot.cyan {
  color: var(--roya-cyan);
  text-shadow: 0 0 12px var(--roya-cyan);
  animation: introDotFloat 1.8s ease-in-out infinite alternate;
}

.intro-orb-dot.magenta {
  color: var(--arya-magenta);
  text-shadow: 0 0 12px var(--arya-magenta);
  animation: introDotFloat 1.8s ease-in-out infinite alternate-reverse;
}

.intro-tether-line {
  flex: 1;
  height: 2px;
  margin: 0 4px;
  background: linear-gradient(90deg, var(--roya-cyan), var(--synergy-purple), var(--arya-magenta));
  box-shadow: 0 0 8px rgba(181, 55, 242, 0.9);
}

.intro-brand-title {
  font-family: 'Outfit', sans-serif;
  font-size: 2.2rem;
  font-weight: 900;
  letter-spacing: 2px;
  background: linear-gradient(135deg, #00f3ff 15%, #ffffff 50%, #ff007f 85%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 25px rgba(0, 243, 255, 0.4);
  margin-bottom: 4px;
}

.intro-brand-sub {
  font-family: 'Outfit', sans-serif;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 5px;
  color: rgba(240, 244, 252, 0.85);
  margin-bottom: 6px;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.intro-brand-ar {
  font-family: 'Tajawal', sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 1px;
}

.btn-skip-intro {
  position: absolute;
  top: calc(var(--safe-top) + 16px);
  left: 18px;
  z-index: 10002;
  pointer-events: auto;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  background: rgba(18, 20, 32, 0.65);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
  transition: all 0.25s ease;
}

[dir="rtl"] .btn-skip-intro {
  left: auto;
  right: 18px;
}

.btn-skip-intro:hover, .btn-skip-intro:active {
  background: rgba(0, 243, 255, 0.2);
  border-color: var(--roya-cyan);
  transform: scale(1.05);
  box-shadow: 0 0 16px rgba(0, 243, 255, 0.35);
}

.btn-skip-intro .skip-arr {
  font-size: 0.75rem;
  opacity: 0.85;
}

@keyframes introAuraPulse {
  0% { transform: scale(0.9); opacity: 0.4; }
  100% { transform: scale(1.15); opacity: 0.85; }
}

@keyframes introDotFloat {
  0% { transform: translateY(-2px); }
  100% { transform: translateY(2px); }
}

/* ========================================================
   COSMIC PLAYER RANK & RESONANCE FEVER JUICE
   ======================================================== */
.player-rank-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(18, 20, 32, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-pill);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.35);
  margin-top: 10px;
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.player-rank-badge:hover, .player-rank-badge:active {
  transform: scale(1.04);
  box-shadow: 0 0 16px rgba(0, 243, 255, 0.3);
}

.player-rank-badge .rank-icon {
  font-size: 1.05rem;
}

.player-rank-badge .rank-title {
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.player-rank-badge .rank-stars {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--prism-gold);
  padding-inline-start: 4px;
  border-inline-start: 1px solid rgba(255, 255, 255, 0.14);
}

/* Resonance Fever Screen Glow */
.resonance-fever-active #canvas-wrapper {
  animation: feverPulse 0.8s ease-in-out infinite alternate;
}

@keyframes feverPulse {
  0% {
    box-shadow: inset 0 0 35px rgba(181, 55, 242, 0.4), 0 0 25px rgba(0, 243, 255, 0.3);
  }
  100% {
    box-shadow: inset 0 0 55px rgba(255, 0, 127, 0.6), 0 0 45px rgba(255, 183, 3, 0.4);
  }
}





/* ========================================================
   CYBER GUARDIAN PORTRAITS (v1.2)
   ======================================================== */
.avatar-roya .spirit-inner-core,
.avatar-arya .spirit-inner-core {
  width: 92px;
  height: 92px;
  background: none;
  box-shadow: none;
}

.avatar-roya .spirit-inner-core::after,
.avatar-arya .spirit-inner-core::after {
  content: none;
}

.avatar-roya .spirit-inner-core::before,
.avatar-arya .spirit-inner-core::before {
  inset: -8px;
  transform: none;
  animation: portraitRingPulse 2.6s ease-in-out infinite;
}

.spirit-portrait {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.avatar-roya .spirit-portrait {
  border: 2px solid var(--roya-cyan);
  box-shadow: 0 0 26px rgba(0, 243, 255, 0.55);
}

.avatar-arya .spirit-portrait {
  border: 2px solid var(--arya-magenta);
  box-shadow: 0 0 26px rgba(255, 0, 127, 0.55);
}

@keyframes portraitRingPulse {
  0%, 100% { opacity: 0.35; transform: scale(0.97); }
  50% { opacity: 0.9; transform: scale(1.04); }
}

.char-duo-row {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-bottom: 8px;
}

.char-mini {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.25);
  animation: floatOrb 3.2s ease-in-out infinite;
}

.char-mini.cyan {
  border-color: var(--roya-cyan);
  box-shadow: 0 0 18px rgba(0, 243, 255, 0.5);
}

.char-mini.magenta {
  border-color: var(--arya-magenta);
  box-shadow: 0 0 18px rgba(255, 0, 127, 0.5);
  animation-delay: 1.6s;
}

/* Defeat state: portraits dimmed so the mood matches the screen */
.char-duo-down .char-mini {
  filter: saturate(0.55) brightness(0.85);
  animation: none;
}

@media (prefers-reduced-motion: reduce) {
  .char-mini,
  .avatar-roya .spirit-inner-core::before,
  .avatar-arya .spirit-inner-core::before {
    animation: none;
  }
}

/* ========================================================
   STAR REQUIREMENT CUSTOM NEON MODAL & REPLAY HIGHLIGHTS
   ======================================================== */
.star-req-card {
  max-width: 380px;
  background: linear-gradient(180deg, rgba(18, 14, 32, 0.96) 0%, rgba(10, 8, 20, 0.98) 100%);
  border: 1px solid rgba(255, 183, 3, 0.35);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 35px rgba(255, 183, 3, 0.15);
  position: relative;
  overflow: hidden;
  padding: 26px 20px 22px;
}

.star-req-icon-wrap {
  position: relative;
  width: 72px;
  height: 72px;
  margin: 0 auto 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.star-req-glow {
  position: absolute;
  inset: -8px;
  background: radial-gradient(circle, rgba(255, 183, 3, 0.35) 0%, rgba(255, 0, 127, 0.2) 60%, transparent 80%);
  border-radius: 50%;
  filter: blur(12px);
  animation: pulseGlow 2.5s infinite ease-in-out;
}

.star-req-icon {
  font-size: 2.4rem;
  position: relative;
  z-index: 2;
  filter: drop-shadow(0 0 10px rgba(255, 183, 3, 0.6));
}

.star-req-subicon {
  position: absolute;
  bottom: 2px;
  right: 2px;
  font-size: 1.3rem;
  z-index: 3;
  animation: starFloat 2s infinite ease-in-out;
  filter: drop-shadow(0 0 8px rgba(255, 183, 3, 0.9));
}

@keyframes starFloat {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-4px) scale(1.15); }
}

.star-req-title {
  color: #ffb703;
  text-shadow: 0 0 18px rgba(255, 183, 3, 0.5);
  font-size: 1.35rem;
  margin-bottom: 6px;
}

.star-req-desc {
  font-size: 0.86rem;
  color: rgba(255, 255, 255, 0.82);
  line-height: 1.45;
  margin-bottom: 14px;
  max-width: 320px;
}

.star-req-stats-box {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 10px 14px;
  margin-bottom: 12px;
}

.star-req-stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.star-req-stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
}

.star-req-stat-val {
  font-size: 1.15rem;
  font-weight: 900;
  color: #00f3ff;
}

.star-req-stat-val.gold {
  color: #ffb703;
  text-shadow: 0 0 10px rgba(255, 183, 3, 0.4);
}

.star-req-stat-divider {
  font-size: 1.4rem;
  color: rgba(255, 255, 255, 0.2);
  font-weight: 300;
}

.star-req-progress-wrap {
  width: 100%;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.star-req-progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 99px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.star-req-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #ffb703 0%, #ff5400 100%);
  border-radius: 99px;
  box-shadow: 0 0 10px rgba(255, 183, 3, 0.6);
  transition: width 0.4s ease;
}

.star-req-progress-text {
  font-size: 0.75rem;
  font-weight: 800;
  color: #ffb703;
  text-align: center;
}

.star-req-tip {
  font-size: 0.76rem;
  color: rgba(255, 255, 255, 0.68);
  background: rgba(255, 183, 3, 0.06);
  border-inline-start: 3px solid #ffb703;
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 16px;
  line-height: 1.4;
  text-align: start;
}

.star-req-btn-primary {
  background: linear-gradient(135deg, #ffb703 0%, #ff8500 100%) !important;
  color: #0b0b12 !important;
  font-weight: 900 !important;
  box-shadow: 0 6px 20px rgba(255, 183, 3, 0.35) !important;
  border: none !important;
}

.star-req-btn-primary:active {
  transform: scale(0.97);
}

/* Level tile pulsing highlight when player needs to replay it for missing stars */
.level-tile.needs-stars-pulse {
  border-color: #ffb703 !important;
  box-shadow: 0 0 14px rgba(255, 183, 3, 0.65) !important;
  animation: needsStarsPulse 1.8s infinite ease-in-out;
  position: relative;
}

@keyframes needsStarsPulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 10px rgba(255, 183, 3, 0.4);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(255, 183, 3, 0.85);
  }
}

.needs-stars-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #ffb703;
  color: #000;
  font-size: 0.58rem;
  font-weight: 900;
  padding: 1px 4px;
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
  z-index: 5;
}

