/* ==========================================================================
   🎮 2D FLASH STYLE BIRTHDAY KICK GAME - MODERN CSS STYLESHEET
   ========================================================================== */

:root {
  --primary-color: #ff0055;
  --secondary-color: #ffcc00;
  --accent-cyan: #00f0ff;
  --dark-bg: #030408;
  --card-bg: rgba(18, 18, 32, 0.95);
  --glass-border: rgba(255, 255, 255, 0.12);
  --font-main: 'Vazirmatn', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-arcade: 'Press Start 2P', cursive, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}

/* 🚫 جلوگیری از درگ اند دراپ عکس‌ها روی ویندوز/دسکتاپ (No Drag & Drop on Images) */
img {
  -webkit-user-drag: none;
  -khtml-user-drag: none;
  -moz-user-drag: none;
  -o-user-drag: none;
  user-drag: none;
  pointer-events: none;
}

button, input, a {
  pointer-events: auto;
}

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-main);
  background: radial-gradient(circle at 50% 40%, #090c17 0%, #030408 65%, #000000 100%);
  color: #ffffff;
}

/* ==========================================================================
   🔒 1. AUTH GATE / LOGIN SCREEN
   ========================================================================== */

.auth-container {
  width: 100vw;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 999;
  backdrop-filter: blur(12px);
  background: rgba(3, 4, 8, 0.95);
}

.auth-card {
  width: 100%;
  max-width: 360px;
  padding: 30px 24px;
  background: var(--card-bg);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  text-align: center;
  animation: fadeInDown 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.input-group {
  position: relative;
  margin-bottom: 20px;
}

.input-group input {
  width: 100%;
  padding: 18px 20px;
  border-radius: 16px;
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  font-family: var(--font-main);
  outline: none;
  transition: all 0.3s ease;
  text-align: center;
  letter-spacing: 3px;
}

.input-group input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.4);
  background: rgba(0, 0, 0, 0.9);
}

.input-group input::-webkit-outer-spin-button,
.input-group input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.input-group input[type=number] {
  -moz-appearance: textfield;
}

.error-msg {
  background: rgba(255, 0, 85, 0.15);
  border: 1px solid rgba(255, 0, 85, 0.4);
  color: #ff4d7d;
  padding: 12px;
  border-radius: 12px;
  font-size: 14px;
  margin-bottom: 20px;
  animation: shake 0.4s ease;
}

.btn-primary {
  width: 100%;
  padding: 16px;
  border-radius: 14px;
  border: none;
  background: linear-gradient(135deg, var(--primary-color), #d00040);
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  font-family: var(--font-main);
  cursor: pointer;
  box-shadow: 0 8px 25px rgba(255, 0, 85, 0.4);
  transition: all 0.2s ease;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(255, 0, 85, 0.6);
}

.btn-primary:active {
  transform: translateY(1px);
}

/* ==========================================================================
   ⏳ 2. PRELOADER & SOUND RECOMMENDATION SCREEN
   ========================================================================== */

.preloader-container {
  width: 100vw;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 990;
  backdrop-filter: blur(16px);
  background: rgba(3, 4, 8, 0.96);
  opacity: 1;
  transition: opacity 0.8s ease-in-out;
}

.preloader-container.fade-out {
  opacity: 0;
  pointer-events: none;
}

.preloader-card {
  width: 100%;
  max-width: 440px;
  padding: 40px 30px;
  background: var(--card-bg);
  border: 1px solid var(--glass-border);
  border-radius: 28px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  text-align: center;
  animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.sound-notice-icon {
  font-size: 64px;
  margin-bottom: 20px;
  animation: soundPulse 1.2s infinite ease-in-out;
  filter: drop-shadow(0 0 20px rgba(0, 240, 255, 0.6));
}

@keyframes soundPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

.sound-notice-title {
  font-size: 18px;
  font-weight: 900;
  line-height: 1.6;
  margin-bottom: 30px;
  background: linear-gradient(135deg, #ffffff 40%, var(--secondary-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 15px rgba(255, 204, 0, 0.3);
}

.preloader-progress-bar {
  width: 100%;
  height: 14px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
  margin-bottom: 12px;
}

.preloader-fill {
  height: 100%;
  background: linear-gradient(90deg, #ff0055, #00f0ff, #ffcc00);
  border-radius: 8px;
  transition: width 0.2s ease-out;
}

.preloader-status-text {
  font-size: 14px;
  font-weight: 700;
  color: #a0a0c0;
}

/* ==========================================================================
   🎮 3. MAIN 2D GAME ARENA
   ========================================================================== */

.game-container {
  width: 100vw;
  height: 100vh;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  background: radial-gradient(circle at 50% 40%, #090c17 0%, #030408 65%, #000000 100%);
}

#confetti-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 100;
}

.shake-wrapper {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
  will-change: transform;
  transform: translateZ(0);
  transition: transform 0.05s ease-out;
}

/* ⚡ Mortal Kombat Style Combo Counter */
.combo-container {
  position: absolute;
  top: 40px;
  right: 25px;
  z-index: 20;
  text-align: right;
  pointer-events: none;
  opacity: 0;
  transform: scale(0.5) rotate(-5deg);
  transition: all 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.combo-container.active {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

.combo-count {
  font-family: var(--font-arcade);
  font-size: 48px;
  font-weight: 900;
  color: var(--secondary-color);
  text-shadow: 
    3px 3px 0 #000, 
    -2px -2px 0 #000, 
    0 0 20px rgba(255, 204, 0, 0.9);
  line-height: 1;
}

.combo-label {
  font-family: var(--font-arcade);
  font-size: 16px;
  color: var(--primary-color);
  text-shadow: 2px 2px 0 #000, 0 0 10px var(--primary-color);
}

.combo-title {
  font-family: var(--font-arcade);
  font-size: 14px;
  color: var(--accent-cyan);
  margin-top: 4px;
  text-shadow: 2px 2px 0 #000;
  animation: pulseGlow 0.4s infinite alternate;
}

/* 🥊 Arena Stage */
.stage-arena {
  width: 100%;
  height: 100vh;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
}

/* 👆 انگشت راهنما */
.tap-hint-finger {
  position: absolute;
  top: calc(50% + 110px);
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 35;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.8s ease-in-out;
}

.tap-hint-finger.visible {
  opacity: 1;
  animation: fingerPulse 1.2s infinite ease-in-out;
}

.finger-icon {
  font-size: 64px;
  filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.9)) drop-shadow(0 0 25px var(--secondary-color));
}

@keyframes fingerPulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1) translateY(0px); }
  50% { transform: translate(-50%, -50%) scale(1.2) translateY(-14px); }
}

/* Character & Sprites */
.character-wrapper {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 360px;
  max-width: 88vw;
  height: 480px;
  max-height: 75vh;
  z-index: 5;
  will-change: transform;
  transform-style: preserve-3d;
  transition: transform 0.1s ease-out;
}

.character-sprite {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

.placeholder-svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 10px 25px rgba(0, 0, 0, 0.9));
}

.real-asset-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 10px 25px rgba(0,0,0,0.9));
  transform: translateZ(0);
}

/* 🦵 Kick Leg Animation Layer */
.kick-leg-wrapper {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 200px;
  height: 310px;
  z-index: 8;
  pointer-events: none;
  opacity: 0;
  transform-origin: bottom left;
  transform: translate(-230px, 140px) rotate(15deg);
  will-change: transform, opacity;
}

.kick-leg {
  width: 100%;
  height: 100%;
  position: relative;
}

.kick-leg-wrapper.striking {
  animation: legKickSwingLeft 0.16s cubic-bezier(0.1, 0.9, 0.2, 1) forwards;
}

@keyframes legKickSwingLeft {
  0% {
    opacity: 0;
    transform: translate(-230px, 140px) rotate(15deg) scale(0.9);
  }
  45% {
    opacity: 1;
    transform: translate(-18px, -18px) rotate(-48deg) scale(1.3);
  }
  75% {
    opacity: 1;
    transform: translate(-10px, -25px) rotate(-56deg) scale(1.32);
  }
  100% {
    opacity: 0;
    transform: translate(-230px, 140px) rotate(15deg) scale(0.9);
  }
}

.impact-fx {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, 40px) scale(0);
  font-size: 85px;
  z-index: 12;
  pointer-events: none;
  opacity: 0;
  transition: transform 0.1s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.1s ease;
}

.impact-fx.active {
  opacity: 1;
  transform: translate(-50%, 40px) scale(1.4);
}

/* ⚡ زیگ زاگی دو نصف شدن طبیعی فیزیکی */

.split-half {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  clip-path: none;
  will-change: transform, clip-path;
  backface-visibility: hidden;
  transform: translateZ(0);
  transition: transform 1.2s cubic-bezier(0.55, 0.055, 0.675, 0.19);
}

.is-split-active .split-left {
  clip-path: polygon(0 0, 50% 0, 44% 16%, 56% 34%, 42% 53%, 58% 72%, 47% 100%, 0 100%);
  animation: splitFlashLeft 0.3s ease-out;
}

.is-split-active .split-right {
  clip-path: polygon(50% 0, 100% 0, 100% 100%, 47% 100%, 58% 72%, 42% 53%, 56% 34%, 44% 16%, 50% 0);
  animation: splitFlashRight 0.3s ease-out;
}

.split-left.splitting {
  transform: translate3d(-260px, 920px, 0) rotate(-65deg);
}

.split-right.splitting {
  transform: translate3d(260px, 920px, 0) rotate(65deg);
}

@keyframes splitFlashLeft {
  0% { filter: brightness(2.5) drop-shadow(-5px 0 15px #ff0055); }
  100% { filter: brightness(1) drop-shadow(0 10px 25px rgba(0,0,0,0.9)); }
}

@keyframes splitFlashRight {
  0% { filter: brightness(2.5) drop-shadow(5px 0 15px #ff0055); }
  100% { filter: brightness(1) drop-shadow(0 10px 25px rgba(0,0,0,0.9)); }
}

/* 💀 Mortal Kombat Fatality Banner */
.fatality-banner {
  position: absolute;
  top: 30%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  font-family: var(--font-arcade);
  font-size: clamp(28px, 7.5vw, 48px);
  max-width: 90vw;
  white-space: nowrap;
  text-align: center;
  color: #ff0000;
  text-shadow: 
    3px 3px 0 #000, 
    -2px -2px 0 #000,
    0 0 25px rgba(255, 0, 0, 0.9);
  z-index: 50;
  pointer-events: none;
  opacity: 0;
  letter-spacing: 2px;
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
}

.fatality-banner.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  animation: fatalityGlow 0.5s infinite alternate;
}

/* ⭐ 3. عکس دوست متولد (فوق‌العاده بزرگ و کامل) + پیام و دکمه بازی مجدد */

.birthday-friend-wrapper {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.3);
  width: 90vw;
  max-width: 580px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 2;
  opacity: 0;
  pointer-events: none;
  will-change: transform, opacity;
  transition: all 1.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.birthday-friend-wrapper.revealed {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.birthday-friend-sprite {
  width: 100%;
  max-width: 480px;
  height: 480px;
  max-height: 52vh;
  display: flex;
  justify-content: center;
  align-items: center;
  filter: drop-shadow(0 0 45px rgba(255, 204, 0, 0.95)) drop-shadow(0 0 80px rgba(255, 0, 85, 0.7));
}

.birthday-friend-sprite img,
.birthday-friend-sprite svg {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.birthday-text-container {
  width: 100%;
  max-width: 460px;
  margin-top: 10px;
  text-align: center;
  background: rgba(18, 18, 32, 0.95);
  border: 2px solid var(--secondary-color);
  padding: 18px 20px;
  border-radius: 24px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.9), 0 0 25px rgba(255, 204, 0, 0.35);
  animation: fadeIn 0.8s ease 0.5s both;
}

.birthday-heading {
  font-size: 22px;
  font-weight: 900;
  color: var(--secondary-color);
  text-shadow: 0 0 14px rgba(255, 204, 0, 0.7);
  margin-bottom: 6px;
}

/* 📄 پشتیبانی کامل از \n و شکستن سطر در متن تبریک (Line Breaks Support) */
.birthday-subtext {
  font-size: 14px;
  color: #e0e0ff;
  line-height: 1.6;
  margin-bottom: 14px;
  white-space: pre-line;
}

.btn-restart {
  background: linear-gradient(135deg, #00c853, #00897b);
  box-shadow: 0 6px 20px rgba(0, 200, 83, 0.4);
  font-size: 16px;
  padding: 12px 24px;
}

.btn-restart:hover {
  box-shadow: 0 10px 25px rgba(0, 200, 83, 0.6);
}

/* Keyframe Animations */
@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-30px); }
  to { opacity: 1; transform: translateY(0); }
}

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

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fatalityGlow {
  from { text-shadow: 0 0 20px #ff0000; }
  to { text-shadow: 0 0 50px #ff0000, 0 0 10px #fff; }
}

@keyframes pulseGlow {
  from { opacity: 0.8; }
  to { opacity: 1; transform: scale(1.08); }
}
