/* ══════════════════════════════════════════════════════════════════════════
   VibesFoot — feuille mobile partagée (téléphone : largeur ≤ 640 px)
   Chargée APRÈS le <style> de chaque page : elle ne fait que surcharger.
   Chaque page se reconnaît par la classe de <html> : p-index, p-reels,
   p-compo, p-classement, p-logos, p-equipes.
   La barre de navigation basse (.vf-mnav) et le bouton flottant (.vf-fab)
   sont injectés par mobile.js — jamais dans un cadre (iframe).
   ══════════════════════════════════════════════════════════════════════════ */
html { -webkit-text-size-adjust: 100%; }
.vf-mnav, .vf-fab { display: none; }

/* Page chargée DANS un cadre (onglets Compo / Classement / Visuels / Reels /
   Configuration de la page Visuels) : son en-tête et sa barre de liens font
   doublon avec ceux de la page mère. mobile.js pose .vf-framed sur <body>. */
.vf-framed > .header, .vf-framed > header, .vf-framed > .nav-tabs { display: none; }
.vf-framed .wrap { padding-top: 6px; }

@media (max-width: 640px) {
  html, body { overflow-x: hidden; }
  body { padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }
  body.embed, body.framed, body.vf-framed { padding-bottom: 0; }
  canvas, img, video, iframe { max-width: 100%; }

  /* ── Barre de navigation basse : 6 onglets, toujours à portée du pouce ── */
  .vf-mnav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 900;
    background: rgba(13,13,20,0.96); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
    border-top: 1px solid #22223a; padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px)); }
  .vf-mnav a { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 5px 2px 4px; border-radius: 10px; color: #7f7f95; text-decoration: none; font-size: 10px;
    font-weight: 700; letter-spacing: .2px; -webkit-tap-highlight-color: transparent; }
  .vf-mnav a .ico { font-size: 20px; line-height: 1; }
  .vf-mnav a .lbl { max-width: 100%; font-size: 9.5px; letter-spacing: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .vf-mnav a.on { color: #00e5ff; background: rgba(0,229,255,0.10); }
  .vf-mnav a:active { background: rgba(255,255,255,0.06); }

  /* ── Bouton flottant Aperçu ⇄ Réglages (Compo, Classement) ── */
  .vf-fab { display: inline-flex; position: fixed; right: 12px; bottom: calc(80px + env(safe-area-inset-bottom, 0px));
    z-index: 890; align-items: center; justify-content: center; width: 46px; height: 46px; padding: 0; border-radius: 50%;
    border: 1px solid rgba(0,229,255,0.45); background: rgba(17,17,24,0.94); color: #00e5ff;
    font-size: 20px; line-height: 1; box-shadow: 0 6px 20px rgba(0,0,0,0.5); cursor: pointer;
    -webkit-tap-highlight-color: transparent; }
  .vf-fab:active { transform: scale(0.96); }

  /* ── Champs : 16 px (sinon iOS zoome au focus) et hauteur tactile ── */
  input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]):not([type=file]),
  select, textarea { font-size: 16px !important; }
  select, input[type=text], input[type=search], input[type=number], input[type=password], input[type=url],
  .field-input { min-height: 42px; height: auto; }
  input[type=checkbox] { width: 18px; height: 18px; flex-shrink: 0; }
  input[type=color] { width: 52px; height: 40px; }

  /* ── Overlays plein écran (Getty, portraits) ── */
  #getty-overlay, #portrait-overlay, #x-overlay { padding: 6px !important; }
  .getty-box { padding: 10px; border-radius: 8px; }
  .getty-box .row { flex-wrap: wrap; }
  .getty-box .row .btn { min-height: 40px; }
  #portrait-q { width: 100% !important; flex: 1 1 100%; order: 3; }
  #portrait-teams { max-height: 96px; }
  #portrait-grid { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  #getty-grid { grid-template-columns: repeat(2, 1fr); }
  #getty-grid .cell { min-height: 90px; }

  /* ════════ VISUELS (index) ════════ */
  .p-index .container { padding: 10px; }
  .p-index .header { margin-bottom: 12px; }
  .p-index .header img { max-width: 118px !important; margin: 12px auto 8px !important; }
  .p-index .vf-nav-row { display: none !important; }
  .p-index #vf-tab-bar { border-radius: 8px; margin-bottom: 10px; }
  .p-index .vf-tab { width: 25%; padding: 12px 2px; font-size: 10px; letter-spacing: .4px; }
  /* Ces onglets intègrent une autre page (iframe) : la barre basse les remplace. */
  .p-index .vf-tab[data-vftab="compo"], .p-index .vf-tab[data-vftab="classement"],
  .p-index .vf-tab[data-vftab="visuels"], .p-index .vf-tab[data-vftab="reels"],
  .p-index .vf-tab[data-vftab="config"] { display: none; }
  /* Les onglets restants se partagent la ligne, quel que soit leur nombre. */
  .p-index .vf-tab { width: auto; flex: 1 1 0; }
  .p-index .grid { gap: 12px; }
  .p-index .panel { padding: 14px 12px; }
  .p-index .section { margin-bottom: 18px; }
  .p-index .section-title { font-size: 12px; }
  .p-index .league-tab { padding: 9px 14px; font-size: 13px; }
  .p-index .match-item { padding: 12px 10px; }
  .p-index button { min-height: 44px; font-size: 14px; }
  .p-index .info, .p-index .error, .p-index .success { font-size: 13px; }
  .p-index .vf-soon { font-size: 13px; }
  .p-index #getty-overlay { padding: 0 !important; }
  .p-index #getty-grid { column-count: 2 !important; }

  /* ════════ REELS (tweet-overlay) ════════ */
  .p-reels .container { padding: 12px; }
  .p-reels .header { margin-bottom: 14px; }
  .p-reels .header h1 { font-size: 22px; }
  .p-reels .header .subtitle { font-size: 12px; }
  .p-reels .nav-tabs { display: none; }
  .p-reels .grid { gap: 14px; }
  .p-reels .panel { padding: 16px 14px; }
  .p-reels .section { margin-bottom: 18px; }
  .p-reels .dropzone { padding: 22px 12px; }
  .p-reels button { min-height: 46px; font-size: 14px; }
  .p-reels .preview-wrap { max-height: 62vh; }

  /* ════════ COMPO ════════ */
  html.p-compo body { font-size: 13px; }
  .p-compo .header { margin: 8px 8px 0; padding: 9px 12px; }
  .p-compo .header-brand { font-size: 14px; }
  .p-compo .header-version { display: none; }
  .p-compo .nav-tabs > a, .p-compo .nav-tabs > .active-tab { display: none; }
  .p-compo .nav-tabs { padding: 6px 8px; }
  .p-compo .view-mode .vm-btn { padding: 11px 8px; font-size: 12px; }
  .p-compo .container { grid-template-columns: minmax(0, 1fr); }
  .p-compo .controls { padding: 0 8px 12px; }
  .p-compo .preview-pane { position: static; min-height: 0; padding: 10px 8px 16px; }
  .p-compo #duo-pane .duo-col { flex: 1 1 100%; }
  .p-compo .duo-col iframe { height: 78vh; }
  .p-compo .card { margin-bottom: 12px; }
  .p-compo .card-header { padding: 10px 12px; }
  .p-compo .card-title { font-size: 12px; }
  .p-compo .field-label { font-size: 11px; }
  .p-compo .type-btn, .p-compo .lg-tab, .p-compo .btn-ghost, .p-compo .btn-icon { min-height: 42px; font-size: 12px; }
  .p-compo .btn-primary, .p-compo .btn-action { min-height: 46px; font-size: 13px; }
  .p-compo .league-item { padding: 11px 10px; font-size: 13px; }
  .p-compo .league-item img { width: 22px; height: 22px; }
  .p-compo .leagues-list { max-height: 260px; }
  .p-compo .fixture-item { min-height: 50px; padding: 9px 8px; }
  .p-compo .fixture-item .fx-tname { font-size: 12px; }
  .p-compo .fixture-item .fx-logo { width: 24px; height: 24px; }
  .p-compo .view-seg { flex: 1 1 calc(50% - 3px); padding: 9px 8px; font-size: 10px; }
  .p-compo .slider-row label { font-size: 11px; }
  .p-compo .status, .p-compo .wording-item, .p-compo #lineup-preview { font-size: 12px; }
  .p-compo .sub-toggle { font-size: 12px; padding: 8px 0; }

  /* ════════ CLASSEMENT ════════ */
  html.p-classement body { font-size: 13px; }
  .p-classement .header { margin: 8px 8px 0; padding: 9px 12px; }
  .p-classement .header-brand { font-size: 14px; }
  .p-classement .header-note { display: none; }
  .p-classement .layout { flex-direction: column; padding: 8px; gap: 8px; }
  .p-classement .panel { width: 100%; }
  .p-classement .stage { width: 100%; }
  .p-classement #boards { gap: 10px; }
  /* Chaque wording passe SOUS le visuel qu'il concerne. */
  .p-classement .board { width: 100%; padding: 8px; flex-direction: column; }
  .p-classement .board-main { width: 100%; flex: none; }
  .p-classement .board-wording { width: 100%; max-height: none; overflow: visible; }
  .p-classement .wi-acts button { min-height: 38px; font-size: 11px; }
  .p-classement .x-box { padding: 10px; border-radius: 10px; }
  .p-classement #x-text { font-size: 16px; }
  .p-classement .card-header { padding: 10px 12px; }
  .p-classement .card-title { font-size: 12px; }
  .p-classement .field-label { font-size: 11px; }
  .p-classement .btn { min-height: 42px; font-size: 12px; }
  .p-classement .btn.primary { min-height: 46px; font-size: 13px; }
  .p-classement .seg button { min-height: 40px; font-size: 11px; }
  .p-classement label.chk { font-size: 13px; min-height: 30px; }
  .p-classement .muted { font-size: 11px; }
  .p-classement #standings-list { max-height: 44vh; }
  .p-classement .st-item { padding: 6px; font-size: 12px; }
  .p-classement .photo-slot { padding: 8px; }
  .p-classement .photo-slot .th { width: 52px; height: 65px; }
  .p-classement .photo-slot .lbl { font-size: 12px; }
  .p-classement .photo-slot button { padding: 8px 9px; font-size: 11px; min-height: 36px; }
  .p-classement .board .acts button { min-height: 38px; font-size: 11px; }
  .p-classement .board .ttl .nb button { width: 30px; height: 30px; font-size: 15px; }
  .p-classement .wording-item { font-size: 12px; padding: 9px 10px; }
  .p-classement #status { font-size: 12px; }

  /* ════════ LOGOS ════════ */
  .p-logos header { padding: 10px 12px; gap: 8px; }
  .p-logos header h1 { font-size: 14px; }
  .p-logos header .muted, .p-logos header nav { display: none; }
  .p-logos main { padding: 10px; gap: 10px; }
  .p-logos .panel { padding: 12px; }
  .p-logos .panel h2 { font-size: 12px; }
  .p-logos button, .p-logos .btn { min-height: 42px; }
  .p-logos #slots .slot button, .p-logos .card-actions button, .p-logos .chip { min-height: 0; }
  .p-logos .result { padding: 10px 8px; }
  .p-logos .result b { font-size: 13px; }
  .p-logos .result img { width: 32px; height: 32px; }
  .p-logos #results { max-height: 46vh; }
  .p-logos #versions { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .p-logos .card-actions { opacity: 1; }
  .p-logos #current span { max-width: 200px; }

  /* ════════ ÉQUIPES & JOUEURS ════════ */
  html.p-equipes body { font-size: 13px; }
  .p-equipes .header { margin: 8px 8px 0; padding: 9px 12px; }
  .p-equipes .header-brand { font-size: 14px; }
  .p-equipes .header > .muted, .p-equipes .nav-tabs { display: none; }
  .p-equipes .wrap { padding: 8px 8px 24px; }
  .p-equipes .seg { gap: 4px; margin: 8px 0 10px; }
  .p-equipes .seg button { min-height: 44px; padding: 8px 4px; font-size: 11px; letter-spacing: .3px; }
  .p-equipes .seg button small { display: none; }
  .p-equipes .card-header { padding: 10px 12px; }
  .p-equipes .card-title { font-size: 12px; }
  .p-equipes .card-body { padding: 10px 8px 12px; }
  .p-equipes .hint { font-size: 11px; }
  .p-equipes .btn { min-height: 42px; font-size: 12px; }
  .p-equipes .chip { padding: 8px 12px; font-size: 12px; }
  .p-equipes .field-label { font-size: 11px; }
  .p-equipes .eq-head { padding: 11px 8px; gap: 6px; }
  .p-equipes .eq-head .id { width: 42px; }
  .p-equipes .eq-head .nm { font-size: 13px; }
  .p-equipes .eq-head .sn { display: none; }
  .p-equipes .eq-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .p-equipes .eq-grid label { font-size: 10px; }
  .p-equipes .eq-grid input { min-height: 40px; font-size: 14px; }
  .p-equipes .eq-bar { flex-wrap: wrap; gap: 8px; }
  .p-equipes .eq-bar .btn { flex: 1 1 auto; }
  .p-equipes .jr-row { flex-wrap: wrap; gap: 6px 8px; padding: 8px; }
  .p-equipes .jr-thumb { width: 46px; height: 46px; }
  .p-equipes .jr-fields { flex: 1 1 200px; }
  .p-equipes .jr-fields input { min-height: 40px; font-size: 14px; }
  .p-equipes .jr-api { display: none; }
  .p-equipes .jr-sec { font-size: 13px; }
  .p-equipes .lgc-row { flex-wrap: wrap; gap: 6px 8px; padding: 8px; }
  .p-equipes .lgc-row .cats { display: none; }
  .p-equipes .lgc-row .nm { flex: 1 1 60%; font-size: 13px; }
  .p-equipes .lgc-row .id { width: auto; }
  .p-equipes .lgc-row button { min-width: 38px; min-height: 38px; font-size: 15px; }
  .p-equipes .pt-grid { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .p-equipes .status { font-size: 12px; }
}

/* Petits téléphones (≤ 380 px) : on serre encore un peu. */
@media (max-width: 380px) {
  .vf-mnav a .lbl { font-size: 9px; }
  .p-index .vf-tab { font-size: 9px; letter-spacing: .2px; }
  #portrait-grid, .p-equipes .pt-grid { grid-template-columns: repeat(2, 1fr); }
}
