/**
 * Hub accueil mobile — CSS plat (pas de nesting : WebView Android ancien).
 * Déclenché par : tactile, viewport court, ou .menu-hub--compact (JS).
 */

/* —— Toujours sur téléphone / tablette tactile —— */
html.ys-touch-play #mainMenu.menu-hub {
  gap: 4px;
  padding: max(4px, env(safe-area-inset-top, 0px)) 6px
    max(4px, env(safe-area-inset-bottom, 0px));
  /* 5 rows : top, auth, body (1fr), cta, dock — pas de ligne fantôme */
  grid-template-rows: auto auto minmax(0, 1fr) auto auto;
}

html.ys-touch-play #mainMenu.menu-hub .menu-hub-top {
  padding: 3px 5px;
}

html.ys-touch-play #mainMenu.menu-hub .menu-hub-update-btn {
  width: 28px;
  height: 28px;
  font-size: 0.9rem;
}

html.ys-touch-play #mainMenu.menu-hub .menu-hub-logo {
  font-size: 0.92rem;
}

html.ys-touch-play #mainMenu.menu-hub .menu-hub-auth .menu-auth-bar {
  padding: 5px 8px;
}

html.ys-touch-play #mainMenu.menu-hub .menu-hub-body {
  position: relative;
}

/* Bouton +/✕ tactile — toujours visible, au-dessus du contenu scroll */
html.ys-touch-play #mainMenu.menu-hub .hub-event-toggle,
#mainMenu.menu-hub.menu-hub--compact .hub-event-toggle {
  position: absolute;
  top: 50%;
  right: 2px;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  line-height: 1;
  z-index: 25;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  border-radius: 10px;
  border: 2px solid rgba(255, 216, 116, 0.65);
  background: rgba(8, 14, 24, 0.95);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
  cursor: pointer;
}

/* EVENT réduit : bandeau horizontal (ne mange pas la hauteur du hub) */
html.ys-touch-play #mainMenu.menu-hub .hub-event-card--collapsed,
#mainMenu.menu-hub.menu-hub--compact .hub-event-card--collapsed {
  width: calc(100% - 4px);
  height: auto;
  min-height: 0;
  max-height: 42px;
  margin: 0 auto 3px;
  padding: 4px 44px 4px 8px;
  align-self: stretch;
  flex-shrink: 0;
  box-sizing: border-box;
}

html.ys-touch-play #mainMenu.menu-hub .hub-event-card--collapsed .hub-event-head,
#mainMenu.menu-hub.menu-hub--compact .hub-event-card--collapsed .hub-event-head {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  height: auto;
  width: 100%;
  text-align: left;
}

html.ys-touch-play #mainMenu.menu-hub .hub-event-card--collapsed .hub-event-title-wrap,
#mainMenu.menu-hub.menu-hub--compact .hub-event-card--collapsed .hub-event-title-wrap {
  flex-direction: row;
  align-items: center;
  gap: 5px;
  flex: 1 1 auto;
  min-width: 0;
}

html.ys-touch-play #mainMenu.menu-hub .hub-event-card--collapsed .hub-event-countdown,
#mainMenu.menu-hub.menu-hub--compact .hub-event-card--collapsed .hub-event-countdown {
  flex-direction: row;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}

/* EVENT ouvert : overlay modal mobile — header sticky + contenu scroll */
html.ys-touch-play #mainMenu.menu-hub .hub-event-card--expanded,
#mainMenu.menu-hub.menu-hub--compact .hub-event-card--expanded {
  position: absolute;
  top: 0;
  left: 4px;
  right: 4px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  width: auto;
  max-width: none;
  max-height: min(48vh, 280px);
  margin: 0;
  padding: 0;
  gap: 0;
  overflow: hidden;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.62);
}

html.ys-touch-play #mainMenu.menu-hub .hub-event-card--expanded .hub-event-toggle,
#mainMenu.menu-hub.menu-hub--compact .hub-event-card--expanded .hub-event-toggle {
  display: none;
}

html.ys-touch-play #mainMenu.menu-hub .hub-event-card--expanded .hub-event-head,
#mainMenu.menu-hub.menu-hub--compact .hub-event-card--expanded .hub-event-head {
  display: none;
}

html.ys-touch-play #mainMenu.menu-hub .hub-event-mobile-bar,
#mainMenu.menu-hub.menu-hub--compact .hub-event-mobile-bar {
  display: none;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 44px;
  padding: 6px 8px;
  margin: 0;
  position: sticky;
  top: 0;
  z-index: 35;
  background: linear-gradient(
    180deg,
    rgba(28, 20, 8, 0.98),
    rgba(14, 18, 28, 0.98)
  );
  border-bottom: 1px solid rgba(255, 216, 116, 0.45);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

html.ys-touch-play #mainMenu.menu-hub .hub-event-card--expanded .hub-event-mobile-bar,
#mainMenu.menu-hub.menu-hub--compact .hub-event-card--expanded .hub-event-mobile-bar {
  display: flex;
}

html.ys-touch-play #mainMenu.menu-hub .hub-event-mobile-bar-title,
#mainMenu.menu-hub.menu-hub--compact .hub-event-mobile-bar-title {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #ffd874;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html.ys-touch-play #mainMenu.menu-hub .hub-event-mobile-close,
#mainMenu.menu-hub.menu-hub--compact .hub-event-mobile-close {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 8px 12px;
  margin: 0;
  border: 2px solid rgba(255, 216, 116, 0.7);
  border-radius: 10px;
  background: rgba(8, 14, 24, 0.96);
  color: #ffe8a8;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.1;
  white-space: nowrap;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  z-index: 36;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
}

html.ys-touch-play #mainMenu.menu-hub .hub-event-card--expanded .hub-event-panel,
#mainMenu.menu-hub.menu-hub--compact .hub-event-card--expanded .hub-event-panel {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  max-height: none;
  margin: 0;
  padding: 6px 8px 8px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

html.ys-touch-play #mainMenu.menu-hub.hub-event-overlay-open .menu-hub-playfield,
#mainMenu.menu-hub.menu-hub--compact.hub-event-overlay-open .menu-hub-playfield {
  position: relative;
}

html.ys-touch-play #mainMenu.menu-hub.hub-event-overlay-open .menu-hub-playfield::before,
#mainMenu.menu-hub.menu-hub--compact.hub-event-overlay-open .menu-hub-playfield::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 8;
  background: rgba(4, 8, 16, 0.38);
  pointer-events: none;
}

html.ys-touch-play #mainMenu.menu-hub .hub-event-badge {
  font-size: 0.62rem;
}

html.ys-touch-play #mainMenu.menu-hub .hub-event-sub {
  font-size: 0.56rem;
}

html.ys-touch-play #mainMenu.menu-hub .hub-event-countdown-val {
  font-size: 0.78rem;
}

html.ys-touch-play #mainMenu.menu-hub .hub-event-prize {
  font-size: 0.58rem;
  padding: 3px 6px;
  line-height: 1.25;
}

html.ys-touch-play #mainMenu.menu-hub .hub-event-top-title {
  margin: 0;
  font-size: 0.54rem;
}

html.ys-touch-play #mainMenu.menu-hub .hub-event-panel {
  min-height: 0;
}

html.ys-touch-play #mainMenu.menu-hub .hub-event-top-list {
  max-height: 72px;
  margin-top: 2px;
  gap: 1px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

html.ys-touch-play #mainMenu.menu-hub .hub-event-top-row {
  padding: 1px 4px;
  font-size: 0.66rem;
  gap: 4px;
}

html.ys-touch-play #mainMenu.menu-hub .hub-event-top-rank {
  width: 16px;
  font-size: 0.74rem;
}

html.ys-touch-play #mainMenu.menu-hub .hub-event-top-av {
  width: 16px;
  height: 16px;
}

html.ys-touch-play #mainMenu.menu-hub .hub-event-top-ys {
  font-size: 0.62rem;
}

html.ys-touch-play #mainMenu.menu-hub .hub-event-top-prize {
  min-width: 26px;
  font-size: 0.55rem;
  padding: 0 4px;
}

html.ys-touch-play #mainMenu.menu-hub .menu-hub-body {
  min-height: 0;
  overflow: hidden;
  flex: 1 1 auto;
}

html.ys-touch-play #mainMenu.menu-hub .menu-hub-playfield {
  grid-template-columns: 46px minmax(0, 1fr) 46px;
  gap: 4px;
  min-height: 0;
  flex: 1 1 auto;
}

html.ys-touch-play #mainMenu.menu-hub .menu-hub-center {
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
  justify-content: flex-start;
  padding-top: 2px;
}

html.ys-touch-play #mainMenu.menu-hub .menu-hero-pick {
  max-height: 100%;
  overflow: hidden;
  flex: 0 1 auto;
  min-height: 0;
}

html.ys-touch-play #mainMenu.menu-hub .menu-hub-rail {
  gap: 6px;
  padding-top: 2px;
}

html.ys-touch-play #mainMenu.menu-hub .menu-hub-rail-btn {
  min-height: 46px;
  padding: 4px 2px;
  font-size: 0.52rem;
}

html.ys-touch-play #mainMenu.menu-hub .menu-hero-card {
  padding: 6px 8px 4px;
}

html.ys-touch-play #mainMenu.menu-hub .menu-hero-frame {
  width: min(100px, 30vw);
  max-height: min(92px, 14vh);
  min-height: 64px;
  padding: 4px;
  margin-bottom: 2px;
}

html.ys-touch-play #mainMenu.menu-hub #menuHeroPortrait.menu-hero-portrait {
  min-height: 60px;
  max-height: min(88px, 13vh);
}

html.ys-touch-play #mainMenu.menu-hub .menu-hub--soul .menu-hero-frame {
  max-height: min(92px, 14vh);
}

html.ys-touch-play #mainMenu.menu-hub .menu-hub--soul #menuHeroPortrait.menu-hero-portrait {
  max-height: min(88px, 13vh);
}

html.ys-touch-play #mainMenu.menu-hub .menu-hub-cta {
  flex-shrink: 0;
  gap: 6px;
  padding: 6px 6px 8px;
  margin-top: 0;
  position: relative;
  z-index: 2;
  min-height: max-content;
}

html.ys-touch-play #mainMenu.menu-hub #playBtn.menu-hub-play,
html.ys-touch-play #mainMenu.menu-hub .menu-hub-play {
  padding: 10px 14px 8px;
  max-width: min(280px, 100%);
}

html.ys-touch-play #mainMenu.menu-hub .menu-hub-play-label {
  font-size: 1.18rem;
  line-height: 1.1;
}

html.ys-touch-play #mainMenu.menu-hub .menu-hub-play-sub {
  font-size: 0.58rem;
}

html.ys-touch-play #mainMenu.menu-hub .menu-hub-dock {
  flex-shrink: 0;
  padding: 6px 4px max(4px, env(safe-area-inset-bottom, 0px));
  row-gap: 6px;
  position: relative;
  z-index: 1;
}

html.ys-touch-play #mainMenu.menu-hub .menu-hub-dock-btn {
  min-height: 46px;
  padding: 4px 2px 3px;
}

html.ys-touch-play #mainMenu.menu-hub .menu-hub-dock-btn.menu-hub--soon {
  min-height: 50px;
  padding-bottom: 11px;
}

html.ys-touch-play #mainMenu.menu-hub .menu-hub-rail-btn.menu-hub--soon {
  min-height: 48px;
  padding-bottom: 10px;
}

/* Viewport navigateur court (barre d’adresse) */
@media (max-height: 820px) {
  #mainMenu.menu-hub {
    gap: 4px;
    padding-top: max(4px, env(safe-area-inset-top, 0px));
    padding-bottom: max(4px, env(safe-area-inset-bottom, 0px));
  }

  #mainMenu.menu-hub .hub-event-card {
    padding: 5px 8px;
    gap: 3px;
  }

  #mainMenu.menu-hub .menu-hero-frame {
    max-height: min(96px, 15vh);
    min-height: 64px;
  }

  #mainMenu.menu-hub #menuHeroPortrait.menu-hero-portrait {
    max-height: min(90px, 14vh);
  }

  #mainMenu.menu-hub .menu-hub-cta {
    padding-top: 6px;
  }
}

/* JS : .menu-hub--compact / --compact-tight (même règles clés, flat) */
#mainMenu.menu-hub.menu-hub--compact {
  gap: 4px;
}

#mainMenu.menu-hub.menu-hub--compact .hub-event-card {
  padding: 5px 8px;
}

#mainMenu.menu-hub.menu-hub--compact .menu-hero-frame {
  max-height: min(100px, 16vh);
}

#mainMenu.menu-hub.menu-hub--compact-tight .hub-event-card--collapsed {
  max-height: 40px;
  padding: 3px 42px 3px 6px;
}

#mainMenu.menu-hub.menu-hub--compact-tight .menu-hero-frame {
  max-height: min(80px, 12vh);
  min-height: 56px;
}

#mainMenu.menu-hub.menu-hub--compact-tight #menuHeroPortrait.menu-hero-portrait {
  max-height: min(76px, 11vh);
  min-height: 52px;
}

#mainMenu.menu-hub.menu-hub--compact-tight #playBtn.menu-hub-play {
  padding: 8px 12px 7px;
}

#mainMenu.menu-hub.menu-hub--compact-tight .menu-hub-play-label {
  font-size: 1.08rem;
}

#mainMenu.menu-hub.menu-hub--compact-tight .menu-hub-dock-btn {
  min-height: 42px;
}

html.ys-touch-play #mainMenu.menu-hub.menu-hub--compact-tight .hub-event-card--expanded,
#mainMenu.menu-hub.menu-hub--compact-tight .hub-event-card--expanded {
  max-height: min(44vh, 250px);
}

@container stage (max-height: 820px) {
  #mainMenu.menu-hub {
    gap: 4px;
    grid-template-rows: auto auto minmax(0, 1fr) auto auto;
  }

  #mainMenu.menu-hub .hub-event-card {
    padding: 5px 8px;
  }

  #mainMenu.menu-hub .menu-hero-frame {
    max-height: min(96px, 15vh);
  }

  #mainMenu.menu-hub .menu-hub-cta {
    padding-top: 6px;
  }
}
