/* ============================================================
   MAIN STYLESHEET - Home Page (Consolidated & Optimized)
   Mobile first, with tablet & desktop breakpoints
   ============================================================ */

/* ============================================================
   RESET & FOUNDATIONS
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  height: 100%;
  scrollbar-width: none;
}

html::-webkit-scrollbar {
  display: none;
}

body {
  height: 100%;
  font-family: 'Arial Rounded MT Bold', Arial, sans-serif;
  overflow: hidden;
}

/* ============================================================
   BACKGROUND — iOS-SAFE FIXED TECHNIQUE
   body::before with position:fixed renders correctly on iOS Safari.
   background-attachment:fixed on body is broken on iOS.
   ============================================================ */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: url('../assets/background/background-desktop.png');
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
}

/* ============================================================
   LAUNCHER WRAPPER — Main Container
   ============================================================ */
.launcher {
  position: relative;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
}

.launcher__title {
  font-size: 2rem;
  font-weight: 700;
  color: #2c3e50;
  margin-bottom: 20px;
  text-align: center;
  direction: rtl;
}

/* ============================================================
   GAME GRID — Card Layout
   ============================================================ */
.game-grid {
  list-style: none;
  position: absolute;
  inset: 0;
}

.game-card {
  position: absolute;
  transform: translate(-50%, -50%);
}

.game-card__link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.2s ease;
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
}

.game-card__link[data-locked] {
  cursor: not-allowed;
}

.game-card__img-wrap {
  position: relative;
  width: 140px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.game-card__img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: none;
  -webkit-user-drag: none;
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.game-card__lock-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(0, 0, 0, 0.6);
  border-radius: 16px;
  font-size: 3rem;
  backdrop-filter: blur(4px);
}

.game-card__title {
  display: none;
}

.game-card__stars { font-size: 0.65rem; text-align: center; min-height: 1em; line-height: 1; margin-top: 4px; }

.badge {
  position: absolute;
  top: -8px;
  right: -8px;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.badge--new {
  background-color: #2ed573;
  color: white;
}

.badge--premium {
  background-color: #ffc107;
  color: #2c3e50;
}

/* ============================================================
   INTERACTION STATES
   ============================================================ */
@media (hover: hover) {
  .game-card__link:hover {
    transform: scale(1.06);
  }
}

.game-card__link:active {
  transform: scale(0.93);
  transition-duration: 0.07s;
}

.game-card__link:focus-visible {
  outline: 3px solid #ffe066;
  outline-offset: 4px;
}

/* ⚠️ DO NOT MODIFY THESE POSITIONS — MANUAL LAYOUT CONTROL
   These positions are intentionally fixed for visual design.
   Any automated refactor or layout change must NOT alter them.
*/
.game-puzzle      { top: 22%; left: 25%; }
.game-differences { top: 22%; left: 75%; }
.game-shadow      { top: 42%; left: 25%; }
.game-shapes      { top: 42%; left: 75%; }
.game-counting    { top: 74%; left: 25%; }

/* ============================================================
   MOBILE — ≤600px
   ============================================================ */
@media (max-width: 600px) {
  body::before {
    background-image: url("../assets/background/background-mobile.png");
    background-size: cover;
    background-position: center top;
  }

  /* ⚠️ DO NOT MODIFY THESE POSITIONS — MANUAL LAYOUT CONTROL
     These positions are intentionally fixed for visual design.
     Any automated refactor or layout change must NOT alter them.
  */
  .game-puzzle      { top: 20%; left: 35%; }
  .game-differences { top: 20%; left: 75%; }
  .game-shadow      { top: 40%; left: 35%; }
  .game-shapes      { top: 40%; left: 75%; }
  .game-counting    { top: 75%; left: 35%; }
}
/* ============================================================
   TABLET — 640px to 1023px
   ============================================================ */
@media (min-width: 640px) and (max-width: 1023px) {
  .game-card__img-wrap {
    width: 180px;
    height: 180px;
  }
}

/* ============================================================
   DESKTOP — 1024px and up
   ============================================================ */
@media (min-width: 1024px) {
  .game-card__img-wrap {
    width: 170px;
    height: 170px;
  }

  .launcher__title {
    font-size: 2.5rem;
    margin-bottom: 40px;
  }

  .game-puzzle      { top: 32%; left: 38%; }
  .game-differences { top: 32%; left: 50%; }
  .game-shadow      { top: 32%; left: 62%; }
  .game-shapes      { top: 52%; left: 38%; }
  .game-counting    { top: 52%; left: 62%; }
}
/* ============================================================
   LARGE DESKTOP — 1440px and up
   ============================================================ */
@media (min-width: 1440px) {
  .game-card__img-wrap {
    width: 240px;
    height: 240px;
  }

  .launcher__title {
    font-size: 3rem;
  }
}

/* ============================================================
   ACCESSIBILITY — Reduced Motion
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .game-card__link,
  .game-card__img {
    transition: none;
  }
}

/* ============================================================
   LOCK MODAL
   ============================================================ */
.modal[hidden] { display: none; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
}

.modal-box {
  position: relative;
  background: #fff;
  border-radius: 24px;
  padding: 2rem 2.5rem;
  text-align: center;
  max-width: 320px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.modal-icon {
  font-size: 3.5rem;
  margin-bottom: 0.5rem;
}

.modal-message {
  font-size: 1.2rem;
  font-weight: 700;
  color: #333;
  margin-bottom: 1.5rem;
  direction: rtl;
}

.modal-close-btn {
  background: #FF6B6B;
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 0.65rem 2rem;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease;
  font-family: inherit;
}

.modal-close-btn:active {
  transform: scale(0.95);
}
