/* =========================================================
   MOBILE OVERRIDES – POKÉDEX
   ========================================================= */

@media (max-width: 768px) {

  /* ===============================
     GLOBAL
     =============================== */

  body {
    font-size: 16px;
  }

  #app {
    flex-direction: column;
    overflow-x: hidden;
  }

  /* ===============================
     TOP BAR
     =============================== */

  #top-bar {
    font-size: 0.9rem;
  }

  .topbar-row {
    padding: 8px 10px;
  }

  .topbar-controls {
    display: flex;
    flex-wrap: wrap;              /* ✅ allow wrapping */
    align-items: center;
    gap: 8px 10px;                /* vertical + horizontal spacing */

    width: 100%;
    overflow: visible;            /* ⛔ no horizontal scrolling */
  }

  .topbar-controls .control,
  #reset-section-btn,
  #game-time-btn,
  #language-selector {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  #language-selector {
    max-width: 80px;
  }

  /* ===============================
     SECTION 2 – LIST
     =============================== */

  #section-list {
    padding: 8px;
  }

  .section-header {
    font-size: 0.85rem;
    padding: 6px 10px;
  }

  .section-counter {
    font-size: 0.7rem;
  }

  .pokemon-row {
    font-size: 0.85rem;
    padding: 6px 8px;
  }

  .pokemon-icon {
    width: 28px;
    height: 28px;
  }

  /* ===============================
     SECTION 3 – DETAIL PANEL
     =============================== */

  #detail-panel {
    width: 100%;
    max-width: 100%;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

  .detail-sprite-window {
    width: 160px;
    height: 160px;
  }

  .detail-sprite-window img {
    width: 120px;
    height: 120px;
  }

  /* ===============================
     GAME TIME MODAL
     =============================== */

  #game-time-modal {
    width: 90vw;
    max-width: 360px;
  }

  #game-time-modal label {
    font-size: 0.7rem;
  }

  #game-time-modal button {
    padding: 6px 12px;
  }

  /* ===============================
     MAP MODAL
     =============================== */

  @media (max-width:768px){
     .map-window{
       width: 90vw;
       max-height: 72vh;
       padding: 6px;
     }
  }
   
  .map-backdrop {
     position: fixed;
     inset: 0;
     background: rgba(0,0,0,0.6);
     z-index: 1000;
   }
}

/* =========================================================
   SMALL PHONES (iPhone SE / Mini)
   ========================================================= */

@media (max-width: 768px) and (min-width: 421px) {

  .topbar-title-row {
    font-size: 0.95rem;
  }

  .search-input {
    width: 120px;
    max-width: 120px;
  }

  .section-header {
    font-size: 0.8rem;
  }

  .pokemon-row {
    font-size: 0.8rem;
  }
}

@media (max-width: 768px) {
  #top-bar,
  .topbar-row,
  .topbar-controls {
    overflow: visible !important;
  }
}

/* =========================================================
   GAME SELECTOR – MOBILE DROPDOWN (ANCHOR TO BUTTON)
   ========================================================= */

@media (max-width: 768px) {

  /* Anchor container (same idea as reset-dropdown) */
  #game-selector-btn {
    position: relative;
  }

  .game-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;

    width: 100%;
    max-height: 60vh;
    overflow-y: auto;

    background: linear-gradient(180deg, #c62828, #a81f1f);
    border-radius: 12px;
    padding: 8px;

    z-index: 1000;
  }

  /* Generation headers */
  .game-menu-gen {
    padding: 10px 12px;
    font-weight: 800;
    letter-spacing: 0.06em;
  }

  /* Submenu */
  .game-menu-sub {
    display: none;
    margin-top: 6px;
    background: #111;
    border-radius: 10px;
    overflow: hidden;
  }

  .game-menu-gen.open .game-menu-sub {
    display: block;
  }

  .game-menu-item {
    padding: 10px 12px;
    font-weight: 700;
  }
}


@media (max-width: 768px) {
  .game-submenu {
    position: static;
    margin-top: 6px;
    border-radius: 10px;
    background: #111;
  }

  .game-submenu.open {
    display: block;
  }
}

@media (max-width: 768px) {
  .game-menu {
    width: calc(100vw - 24px);
    max-height: 70vh;
    overflow-y: auto;

    background: linear-gradient(180deg, #c62828, #a81f1f);
    border-radius: 14px;
    padding: 8px;
  }

  .game-menu-sub {
    display: none;
    margin-top: 6px;
  }

  .game-menu-gen.open .game-menu-sub {
    display: block;
  }

  .game-menu-item {
    padding: 10px 12px;
    font-weight: 700;
  }
}
