* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Segoe UI', Tahoma, sans-serif;
  background: linear-gradient(135deg, #1e1e2f, #2a2a4a);
  color: #fff;
  min-height: 100vh;
}

/* ===== الصفحة الرئيسية ===== */
.hub-body {
  padding: 40px 20px;
}
.hero {
  text-align: center;
  margin-bottom: 40px;
}
.hero h1 {
  font-size: 42px;
  margin-bottom: 10px;
  background: linear-gradient(90deg, #ffd93d, #ff6b6b);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero p {
  font-size: 18px;
  opacity: 0.8;
}
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
  max-width: 1200px;
  margin: 0 auto;
}
.game-card {
  background: linear-gradient(135deg, var(--c1), var(--c2));
  padding: 25px;
  border-radius: 16px;
  text-decoration: none;
  color: #fff;
  position: relative;
  overflow: hidden;
  transition: transform 0.25s, box-shadow 0.25s;
  cursor: pointer;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
.game-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
}
.game-icon {
  font-size: 50px;
  margin-bottom: 12px;
}
.game-card h2 {
  font-size: 24px;
  margin-bottom: 8px;
}
.game-card p {
  opacity: 0.9;
  font-size: 15px;
  line-height: 1.5;
}
.badge {
  position: absolute;
  top: 15px;
  left: 15px;
  background: rgba(0,0,0,0.3);
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
}
.coming-soon {
  opacity: 0.6;
  pointer-events: none;
}
footer {
  text-align: center;
  margin-top: 50px;
  opacity: 0.6;
}

/* ===== صفحات الألعاب ===== */
.game-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
}
.back-btn {
  position: fixed;
  top: 20px;
  right: 20px;
  background: rgba(255,255,255,0.1);
  color: #fff;
  text-decoration: none;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  transition: background 0.2s;
  z-index: 100;
}
.back-btn:hover {
  background: rgba(255,255,255,0.2);
}
.game-title {
  font-size: 30px;
  margin-bottom: 8px;
  text-align: center;
}
.game-subtitle {
  opacity: 0.8;
  margin-bottom: 20px;
  text-align: center;
}
.stats {
  display: flex;
  gap: 15px;
  margin: 15px 0;
  flex-wrap: wrap;
  justify-content: center;
}
.stat {
  background: rgba(255,255,255,0.1);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 16px;
}
.stat span {
  font-weight: bold;
  color: #ffd93d;
  margin-right: 4px;
}
.btn {
  background: #ffd93d;
  color: #1e1e2f;
  border: none;
  padding: 10px 24px;
  font-size: 16px;
  font-weight: bold;
  border-radius: 8px;
  cursor: pointer;
  margin-top: 15px;
  transition: background 0.2s, transform 0.1s;
}
.btn:hover { background: #ffe770; }
.btn:active { transform: scale(0.97); }
.btn.secondary {
  background: rgba(255,255,255,0.15);
  color: #fff;
}
.btn.secondary:hover { background: rgba(255,255,255,0.25); }
.message {
  font-size: 20px;
  min-height: 30px;
  margin-top: 15px;
  text-align: center;
}
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
}
.overlay.active { display: flex; }
.overlay-box {
  background: #2a2a4a;
  padding: 30px 40px;
  border-radius: 16px;
  text-align: center;
  max-width: 90%;
}
.overlay-box h2 { margin-bottom: 10px; font-size: 28px; }
.overlay-box p { margin: 8px 0; opacity: 0.9; }

/* ===== Difficulty Bar (shared) ===== */
.diff-bar { display: flex; gap: 8px; justify-content: center; margin: 15px 0 5px; }
.diff-btn { padding: 6px 18px; border: 1px solid rgba(255,255,255,0.2); border-radius: 20px;
  background: transparent; color: #fff; cursor: pointer; font-size: 14px; font-family: inherit;
  transition: 0.2s; }
.diff-btn:hover { background: rgba(255,255,255,0.1); }
.diff-btn.active { background: #00adb5; border-color: #00adb5; font-weight: bold; }

/* ===== Music Player (shared with main site) ===== */
.music-player {
  position: fixed;
  bottom: 80px; right: 20px;
  z-index: 999;
  background: #2a2a4a;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.4);
  backdrop-filter: blur(8px);
  transition: transform 0.3s ease, opacity 0.3s ease;
  max-width: 320px;
}
.music-player.hidden { transform: translateY(20px); opacity: 0; pointer-events: none; }
.music-player .mp-btn {
  background: none;
  border: none;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  flex-shrink: 0;
}
.music-player .mp-btn:hover { background: rgba(255,255,255,0.1); }
.music-player .mp-name {
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1;
}
.music-player .mp-volume { width: 60px; accent-color: #00adb5; flex-shrink: 0; }
.music-player .mp-close { font-size: 14px; opacity: 0.5; width: 28px; height: 28px; }
.music-player .mp-close:hover { opacity: 1; }
[dir="rtl"] .music-player { right: auto; left: 20px; }
@keyframes mp-pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(255,215,0,0.5); } 50% { box-shadow: 0 0 0 8px rgba(255,215,0,0); } }

/* ===== Mute Button ===== */
.mute-btn {
  position: fixed;
  top: 20px; left: 20px;
  background: rgba(255,255,255,0.1);
  border: none;
  color: #fff;
  width: 40px; height: 40px;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  z-index: 100;
  transition: background 0.2s;
}
.mute-btn:hover { background: rgba(255,255,255,0.2); }

/* ===== Loading Screen ===== */
.game-loading {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: linear-gradient(135deg, #1e1e2f, #2a2a4a);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s ease;
}
.game-loading.hide { opacity: 0; pointer-events: none; }
.game-loading .lds-ring {
  display: inline-block;
  width: 64px; height: 64px;
}
.game-loading .lds-ring div {
  box-sizing: border-box;
  display: block;
  position: absolute;
  width: 48px; height: 48px;
  margin: 6px;
  border: 4px solid #fff;
  border-radius: 50%;
  animation: lds-ring 1.2s cubic-bezier(0.5,0,0.5,1) infinite;
  border-color: #ffd93d transparent transparent transparent;
}
.game-loading .lds-ring div:nth-child(1) { animation-delay: -0.45s; }
.game-loading .lds-ring div:nth-child(2) { animation-delay: -0.3s; }
.game-loading .lds-ring div:nth-child(3) { animation-delay: -0.15s; }
@keyframes lds-ring { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.game-loading p { margin-top: 20px; font-size: 16px; opacity: 0.8; animation: load-pulse 1.5s ease infinite; }
@keyframes load-pulse { 0%,100% { opacity: 0.5; } 50% { opacity: 1; } }

/* ===== Fullscreen Button ===== */
.fs-btn {
  position: fixed;
  top: 20px; left: 120px;
  background: rgba(255,255,255,0.1);
  border: none;
  color: #fff;
  width: 40px; height: 40px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  z-index: 100;
  transition: background 0.2s;
}
.fs-btn:hover { background: rgba(255,255,255,0.2); }
[dir="rtl"] .fs-btn { left: auto; right: 120px; }
[dir="rtl"] .back-btn { right: auto; left: 20px; }
[dir="rtl"] .mute-btn { left: auto; right: 20px; }

/* ===== Share Button ===== */
.share-btn {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border: none;
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  margin: 6px 4px;
  transition: background 0.2s;
  font-family: inherit;
}
.share-btn:hover { background: rgba(255,255,255,0.25); }