/* ============================================
   Mini Game Bay - Responsive Styles
   ============================================ */

@media (max-width: 768px) {
  .main-content { padding: 0.75rem; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .games-grid { grid-template-columns: 1fr; }

  /* Mobile Navbar Layout */
  .navbar {
    flex-direction: row;
    flex-wrap: wrap;
    padding: 0.4rem 0.5rem;
    padding-top: max(0.4rem, env(safe-area-inset-top));
    justify-content: space-between;
    align-items: center;
    gap: 0.35rem;
  }

  /* Hide Site Title on Mobile */
  .nav-brand-title {
    display: none !important;
  }

  /* Make Back Button compact & prominent */
  .nav-brand {
    font-size: 1.25rem;
    padding: 0.4rem 0.6rem;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin: 0;
  }
  .nav-brand i {
    font-size: 1.3rem;
  }

  /* Back Button + Site Nav bar on ONE single line stretching width of browser */
  .nav-links {
    display: flex;
    flex: 1;
    justify-content: space-between;
    align-items: center;
    gap: 0.25rem;
    width: auto;
    flex-wrap: nowrap;
  }

  /* Nav Items text and icons slightly bigger, filling screen width on 1 line */
  .nav-links .nav-item {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.45rem 0.3rem;
    font-size: 0.88rem;
    font-weight: 500;
    white-space: nowrap;
    text-align: center;
  }

  .nav-links .nav-item i,
  .nav-links .nav-item .gicon {
    font-size: 1.15rem;
    margin-right: 0.2rem;
  }

  .nav-links .nav-fullscreen {
    flex: 0 0 auto;
    padding: 0.45rem 0.55rem;
  }

  /* Game Bar containing Power Ups & Timer on mobile */
  .nav-game-bar {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    margin-top: 0.1rem;
  }

  /* Timer to the right of Power Ups bar */
  .nav-powerups {
    display: flex;
    gap: 0.25rem;
    align-items: center;
  }

  .nav-timer {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
  }

  .levels-grid { grid-template-columns: repeat(3, 1fr); gap: 0.6rem; }
  .level-card { padding: 0.5rem; }
  .level-active-badge { top: 4px; right: 4px; font-size: 0.55rem; padding: 1px 4px; gap: 2px; }
  .level-number { font-size: 1.35rem; }
  .level-name { font-size: 0.75rem; margin: 0.15rem 0 0; }
  .best-record { font-size: 0.65rem; }
  .stars { font-size: 0.85rem; margin-top: 0.1rem; }
  h2 { font-size: 1.25rem; }
  .game-header-buttons { gap: 0.25rem; }
  .game-header-buttons .btn { padding: 6px 10px; font-size: 0.75rem; }

  .notification {
    top: auto; bottom: 20px; right: 10px; left: 10px;
    text-align: center; font-size: 0.85rem; padding: 0.6rem 1rem;
    animation-name: slideInUp;
  }

  /* Game Mobile Experience */
  .hide-on-mobile { display: none !important; }
  body.in-game .main-content { padding: 0; min-height: calc(100vh - 60px); height: calc(100vh - 60px); }
  body.in-game #page-game { height: calc(100vh - 60px); padding: 0.5rem; }
}

@media (max-width: 480px) {
  .main-content { padding: 0.5rem; }
  .stats-grid { grid-template-columns: 1fr; }
  .btn { padding: 8px 12px; font-size: 0.8rem; }
  .card { padding: 12px; }
  .nav-links .nav-item {
    font-size: 0.82rem;
    padding: 0.4rem 0.2rem;
  }
  .nav-links .nav-item i,
  .nav-links .nav-item .gicon {
    font-size: 1.1rem;
    margin-right: 0.15rem;
  }
}

@media (max-width: 360px) {
  .levels-grid { grid-template-columns: repeat(2, 1fr); gap: 0.5rem; }
  .level-card { padding: 0.5rem; }
  .level-number { font-size: 1.4rem; }
  .level-name { font-size: 0.78rem; }
  .best-record { font-size: 0.68rem; }
  .stars { font-size: 0.9rem; }
}

/* ============ PORTRAIT ORIENTATION ENFORCEMENT ============ */
.rotate-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: var(--bg-primary, #0f0f17);
  color: var(--text-primary, #ffffff);
  z-index: 999999;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1.5rem;
  box-sizing: border-box;
}

.rotate-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  max-width: 320px;
}

.rotate-icon {
  font-size: 3.5rem;
  color: var(--accent-primary, #6c63ff);
  animation: rotateHint 2.4s infinite ease-in-out;
}

.rotate-content h2 {
  font-size: 1.35rem;
  margin: 0;
  color: var(--text-primary, #ffffff);
}

.rotate-content p {
  font-size: 0.9rem;
  color: var(--text-secondary, #a0a0b0);
  margin: 0;
}

@keyframes rotateHint {
  0%, 100% { transform: rotate(90deg); }
  50% { transform: rotate(0deg); }
}

/* Show rotate overlay when device is in landscape mode on mobile/handheld screens */
@media screen and (max-width: 950px) and (max-height: 550px) and (orientation: landscape),
       screen and (max-width: 950px) and (orientation: landscape) {
  .rotate-overlay {
    display: flex !important;
  }
  body {
    overflow: hidden !important;
  }
}