:root {
  --accent: #f0b90b;
  --accent2: #f8d33a;
  --red: #ff4444;
  --green: #00c851;
  --gray: #8a939f;
  --text: #eaecef;
  --bg-dark: #1e2026;
}

/* ========== تخطيط لوحة اللعبة الجديد ========== */
#panel-game {
  position: relative;
  overflow: hidden;
  width: 100%;
  height: 100%;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #000011 0%, #001122 100%);
}

.game-main-section {
  height: 80%;
  min-height: 400px;
  position: relative;
  overflow: hidden;
}

.game-cards-section {
  height: 20%;
  min-height: 120px;
  max-height: 40%;
  background: var(--bg-dark);
  border-top: 2px solid var(--accent);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.3);
  position: relative;
  z-index: 100;
  transition: transform 0.3s ease;
  touch-action: pan-y;
}

.game-cards-section.collapsed {
  transform: translateY(calc(100% - 60px));
}

.game-cards-section.expanded {
  transform: translateY(0);
}

/* المؤشر للسحب لأعلى */
.swipe-up-indicator {
  position: absolute;
  bottom: 10px;
  left: 0;
  width: 100%;
  text-align: center;
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  z-index: 100;
  animation: bounce 2s infinite;
  pointer-events: none;
}

.swipe-up-indicator i {
  font-size: 24px;
  display: block;
  margin-bottom: 5px;
}

.swipe-up-indicator span {
  display: block;
  background: rgba(0, 0, 0, 0.5);
  padding: 4px 10px;
  border-radius: 15px;
  margin: 0 auto;
  width: fit-content;
  backdrop-filter: blur(5px);
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-10px);
  }
  60% {
    transform: translateY(-5px);
  }
}

/* تحسينات للعبة داخل القسم الرئيسي */
#gameContainer {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}

#gameCanvas {
  width: 100%;
  height: 100%;
  display: block;
  background: linear-gradient(180deg, #000011 0%, #001122 50%, #000033 100%);
}

#gameUI {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: white;
  font-weight: bold;
  gap: 10px;
}

#gameStats {
  display: flex;
  gap: 8px;
  font-size: 14px;
  flex-wrap: wrap;
  background: rgba(0, 0, 0, 0.5);
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--accent);
  backdrop-filter: blur(5px);
}

.stat-item {
  display: none;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.08);
  padding: 4px 8px;
  border-radius: 15px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  min-width: 60px;
  justify-content: center;
  transition: all 0.2s ease;
}

.stat-item:first-child {
  background: rgba(255, 0, 0, 0.2);
  border: 1px solid #ff4444;
}

.stat-item.coin-stat {
  background: rgba(255, 215, 0, 0.2);
  border: 1px solid #FFD700;
}

#pauseBtn {
  background: rgba(240, 185, 11, 0.8);
  color: var(--bg-dark);
  border: none;
  padding: 4px 10px;
  border-radius: 15px;
  font-weight: 600;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s ease;
  min-width: 50px;
  display: none;
}

#pauseBtn:hover {
  background: var(--accent2);
  transform: translateY(-1px);
}

#startGameBtn:not([style*="display: none"]) ~ #gameUI #gameStats .stat-item.coin-stat {
  display: flex !important;
}

#startGameBtn[style*="display: none"] ~ #gameUI #gameStats .stat-item:first-child,
#startGameBtn[style*="display: none"] ~ #gameUI #gameStats .stat-item.coin-stat,
#startGameBtn[style*="display: none"] ~ #gameUI #pauseBtn {
  display: flex !important;
}

#startGameBtn {
  position: absolute;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: var(--bg-dark);
  border: none;
  padding: 18px 35px;
  border-radius: 12px;
  font-weight: bold;
  cursor: pointer;
  font-size: 20px;
  z-index: 300;
  transition: all 0.3s ease;
  box-shadow: 0 4px 20px rgba(240, 185, 11, 0.4);
}

#startGameBtn:hover {
  transform: translateX(-50%) translateY(-3px);
  box-shadow: 0 6px 25px rgba(240, 185, 11, 0.6);
}

#gameOverScreen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 200;
  color: white;
  text-align: center;
  padding: 30px;
  box-sizing: border-box;
  backdrop-filter: blur(5px);
}

#gameOverTitle {
  font-size: 42px;
  color: var(--red);
  margin-bottom: 25px;
  font-weight: bold;
  text-shadow: 0 0 15px rgba(255, 0, 0, 0.7);
  animation: pulse 2s infinite;
}

#finalScore {
  font-size: 32px;
  color: var(--accent);
  margin-bottom: 20px;
  text-shadow: 0 0 10px rgba(240, 185, 11, 0.7);
}

#finalCoins {
  font-size: 28px;
  color: #FFD700;
  margin-bottom: 35px;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.7);
}

#restartBtn {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: var(--bg-dark);
  border: none;
  padding: 18px 35px;
  border-radius: 12px;
  font-weight: bold;
  cursor: pointer;
  font-size: 20px;
  transition: all 0.3s ease;
  box-shadow: 0 6px 20px rgba(240, 185, 11, 0.4);
  margin-top: 20px;
}

#restartBtn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(240, 185, 11, 0.6);
}

/* تحسين الكروت في القسم السفلي */
.cards-container {
  padding: 16px;
  max-height: 100%;
  overflow-y: auto;
}

.promo-code-section, .conversion-section {
  margin-bottom: 15px;
  background: #2b3139;
  border-radius: 10px;
  padding: 16px;
  border: 1px solid #3a4554;
}

.conversion-section {
  background: rgba(43, 49, 57, 0.7);
  backdrop-filter: blur(10px);
}

.conversion-title {
  font-weight: 600;
  font-size: 16px;
  margin-bottom: 10px;
  color: var(--accent);
  text-align: center;
}

.conversion-rate {
  font-size: 12px;
  color: var(--gray);
  margin-bottom: 12px;
  text-align: center;
}

.conversion-inputs {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.conversion-input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid #3a4554;
  border-radius: 8px;
  background: #1e2026;
  color: var(--text);
  font-size: 14px;
  min-width: 120px;
}

.conversion-input:focus {
  outline: none;
  border-color: var(--accent);
}

.conversion-btn {
  background: var(--accent);
  color: #1e2026;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 100px;
}

.conversion-btn:hover {
  background: var(--accent2);
  transform: translateY(-2px);
}

.conversion-result {
  font-size: 13px;
  color: var(--green);
  margin-top: 8px;
  text-align: center;
  font-weight: 600;
}

/* إزالة الأنماط القديمة */
#panel-game .conversion-section {
  margin-top: 15px;
  padding: 15px;
  background: rgba(43, 49, 57, 0.7);
  border-radius: 10px;
  border: 1px solid #3a4554;
  backdrop-filter: blur(10px);
}

/* تحسين التمرير في الكروت */
.cards-container::-webkit-scrollbar {
  width: 4px;
}

.cards-container::-webkit-scrollbar-track {
  background: transparent;
}

.cards-container::-webkit-scrollbar-thumb {
  background: #3a4554;
  border-radius: 4px;
}

/* مؤشر السحب */
.cards-drag-indicator {
  width: 40px;
  height: 4px;
  background: var(--accent);
  border-radius: 2px;
  margin: 8px auto;
  cursor: grab;
}

.cards-drag-indicator:active {
  cursor: grabbing;
}

/* إخفاء زر الاستمرار بالإعلان مؤقتاً */
#continueWithAdBtn {
  margin: 10px 0;
}

/* ========== Game Paused Overlay ========== */
.game-paused-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  color: white;
  text-align: center;
  padding: 30px;
  backdrop-filter: blur(5px);
}

.game-paused-overlay h2 {
  color: var(--accent);
  font-size: 24px;
  margin-bottom: 15px;
  text-shadow: 0 0 10px rgba(240, 185, 11, 0.5);
}

.game-paused-overlay p {
  color: var(--text);
  font-size: 16px;
  margin-bottom: 25px;
  max-width: 300px;
  line-height: 1.5;
}

.resume-game-btn {
  background: var(--accent);
  color: #1e2026;
  border: none;
  padding: 12px 30px;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
  font-size: 16px;
  margin: 10px 0;
  transition: all 0.3s;
  min-width: 150px;
}

.resume-game-btn:hover {
  background: var(--accent2);
  transform: scale(1.05);
  box-shadow: 0 4px 15px rgba(240, 185, 11, 0.4);
}

.cancel-game-btn {
  background: transparent;
  color: var(--gray);
  border: 1px solid var(--gray);
  padding: 10px 25px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  font-size: 14px;
  margin-top: 10px;
  transition: all 0.3s;
}

.cancel-game-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

/* ========== تأثيرات اللعبة ========== */
.star {
  position: absolute;
  background: white;
  border-radius: 50%;
}

.explosion {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, #ff4444 0%, transparent 70%);
  animation: explode 0.5s forwards;
}

.particle {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.health-bar {
  position: absolute;
  height: 4px;
  background: linear-gradient(90deg, #ff0000, #ffff00, #00ff00);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.progress-bar {
  width: 100%;
  height: 6px;
  background: #333;
  border-radius: 3px;
  overflow: hidden;
  margin-top: 5px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent2), var(--accent));
  border-radius: 3px;
  transition: width 0.3s ease;
}

.text-glow {
  text-shadow: 0 0 10px currentColor;
}

.flash-effect {
  animation: flash 0.3s;
}

.pulse {
  animation: pulse 2s infinite;
}

.spaceship-svg {
  filter: drop-shadow(0 0 10px var(--accent));
}

.enemy-svg {
  filter: drop-shadow(0 0 8px var(--red));
}

.powerup-shield {
  animation: shieldPulse 2s infinite;
}

.powerup-weapon {
  animation: weaponGlow 1.5s infinite alternate;
}

.powerup-health {
  animation: healthPulse 1.5s infinite;
}

.coin-image {
  animation: coinSpin 3s infinite linear;
}

.bullet-super {
  background: linear-gradient(180deg, #00ff00, #ffff00) !important;
  box-shadow: 0 0 10px #ffff00 !important;
}

.bullet-ultra {
  background: linear-gradient(180deg, #ffff00, #ff9900) !important;
  box-shadow: 0 0 15px #ff9900 !important;
}

.bullet-mega {
  background: linear-gradient(180deg, #ff9900, #ff0000) !important;
  box-shadow: 0 0 20px #ff0000 !important;
  animation: bulletPulse 0.3s infinite alternate;
}

.tooltip {
  position: absolute;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  pointer-events: none;
  z-index: 1000;
  border: 1px solid var(--accent);
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.9;
  }
}

@keyframes explode {
  0% {
    transform: scale(0);
    opacity: 1;
  }
  100% {
    transform: scale(3);
    opacity: 0;
  }
}

@keyframes floatUp {
  0% {
    transform: translateY(0);
    opacity: 1;
  }
  100% {
    transform: translateY(-50px);
    opacity: 0;
  }
}

@keyframes flash {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

@keyframes bulletPulse {
  0% {
    transform: scale(1);
  }
  100% {
    transform: scale(1.2);
  }
}

@keyframes shieldPulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.1);
    opacity: 0.8;
  }
}

@keyframes weaponGlow {
  0% {
    filter: drop-shadow(0 0 5px #ffd700);
  }
  100% {
    filter: drop-shadow(0 0 10px #ffaa00);
  }
}

@keyframes healthPulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

@keyframes coinSpin {
  0% {
    transform: rotateY(0deg);
  }
  100% {
    transform: rotateY(360deg);
  }
}

/* ========== تجاوب للشاشات المختلفة ========== */
@media (max-width: 768px) {
  .game-main-section {
    min-height: 350px;
  }
  
  .game-cards-section {
    min-height: 100px;
  }
  
  #gameStats {
    font-size: 12px;
    padding: 4px 8px;
    gap: 6px;
  }
  
  .stat-item {
    padding: 3px 6px;
    min-width: 50px;
    font-size: 11px;
  }
  
  #startGameBtn {
    padding: 14px 28px;
    font-size: 18px;
    bottom: 40px;
  }
  
  .cards-container {
    padding: 12px;
  }
  
  .promo-code-section, .conversion-section {
    padding: 12px;
  }
}

@media (max-width: 480px) {
  .game-main-section {
    min-height: 300px;
  }
  
  .game-cards-section {
    min-height: 90px;
  }
  
  #gameStats {
    font-size: 11px;
  }
  
  .stat-item {
    min-width: 45px;
    padding: 2px 5px;
    font-size: 10px;
  }
  
  #startGameBtn {
    padding: 12px 24px;
    font-size: 16px;
    bottom: 30px;
  }
  
  .conversion-inputs {
    flex-direction: column;
  }
  
  .conversion-input, .conversion-btn {
    width: 100%;
  }
}

@media (max-height: 600px) {
  .game-main-section {
    height: 75%;
  }
  
  .game-cards-section {
    height: 25%;
    min-height: 100px;
  }
  
  .swipe-up-indicator {
    bottom: 5px;
    font-size: 10px;
  }
  
  .swipe-up-indicator i {
    font-size: 18px;
  }
}

/* تحسينات للأجهزة اللوحية */
@media (min-width: 768px) and (max-width: 1024px) {
  .game-main-section {
    min-height: 450px;
  }
  
  .game-cards-section {
    min-height: 140px;
  }
  
  .cards-container {
    display: flex;
    gap: 16px;
  }
  
  .promo-code-section, .conversion-section {
    flex: 1;
    margin-bottom: 0;
  }
}

/* تحسينات التمرير السلس */
.game-cards-section,
.cards-container {
  -webkit-overflow-scrolling: touch;
}

/* تحسين التركيز على العناصر */
#promoCode:focus,
#convertAmount:focus {
  box-shadow: 0 0 0 2px rgba(240, 185, 11, 0.3);
  outline: none;
}

/* إضافة تأثير hover للأزرار في الكروت */
.conversion-btn:hover,
#submitPromoCode:hover {
  box-shadow: 0 4px 12px rgba(240, 185, 11, 0.3);
}

/* ========== تحسينات العرض المنوي ========== */
#continueAdStatus {
  font-size: 12px;
  color: var(--gray);
  margin: 8px 0;
  text-align: center;
}

.continue-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  margin: 10px 0;
  width: 100%;
  max-width: 200px;
}

.continue-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.continue-btn:active:not(:disabled) {
  transform: translateY(0);
}

.continue-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  background: #667eea;
}

/* تحسينات لعناصر التحكم في اللعبة */
#gameControls {
  display: flex;
  gap: 8px;
}

.control-btn {
  background: rgba(240, 185, 11, 0.8);
  color: var(--bg-dark);
  border: none;
  padding: 6px 12px;
  border-radius: 15px;
  font-weight: 600;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s ease;
  min-width: 60px;
}

.control-btn:hover {
  background: var(--accent2);
  transform: translateY(-1px);
}

/* تحسينات للشاشات الصغيرة جداً */
@media (max-height: 500px) {
  .game-main-section {
    height: 70%;
  }
  
  .game-cards-section {
    height: 30%;
  }
  
  #startGameBtn {
    bottom: 20px;
    padding: 10px 20px;
    font-size: 14px;
  }
}