/* Wemovexa — Playgate v2. Même identité que la v1 (fond nuit, accent bleu,
   dégradé violet → cyan du logo). Écrit pour de vieilles WebView de box :
   pas de `inset`, pas de `aspect-ratio`, pas de `gap` sur flexbox. */
:root {
  color-scheme: dark;
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1d212a;
  --border: #2a2f3a;
  --text: #e8eaf0;
  --muted: #9aa1ae;
  --accent: #4f8cff;
  --violet: #8b6cff;
  --cyan: #22d3ee;
  --danger: #ff6b6b;
  --ok: #4fd18b;
  --warn: #ffb547;
  --focus-ring: #ffffff;
  --hit: 44px;
  --ligne: 56px;
  --marge: 16px;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.35;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Anneau de focus : posé sur :focus (et pas seulement :focus-visible,
   inconnu des WebView < Chrome 86) — indispensable à la télécommande. */
:focus { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
.ligne:focus { outline: 3px solid var(--accent); outline-offset: -3px; background: #23304a; }
.cadre:focus { outline: 3px solid var(--accent); outline-offset: -3px; }
input:focus { outline: 3px solid var(--accent); outline-offset: 0; }

.marque {
  font-weight: 700;
  letter-spacing: .01em;
  background: linear-gradient(90deg, var(--violet), var(--cyan));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.btn {
  font: inherit;
  color: var(--text);
  background: linear-gradient(180deg, #1c1f27, #14161c);
  border: 1px solid var(--border);
  border-radius: 999px;
  min-height: var(--hit);
  padding: 8px 18px;
  cursor: pointer;
}
.btn:hover { border-color: var(--accent); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primaire {
  background: linear-gradient(180deg, #6aa0ff, var(--accent));
  border-color: transparent;
  color: #fff;
  font-weight: 600;
}
.btn-icone {
  width: var(--hit);
  padding: 0;
  font-size: 1.15rem;
  line-height: 1;
  flex: 0 0 auto;
}
.btn-icone.actif { color: #ffd34d; border-color: #6b5a1f; }

/* ============================================================ porte */
.porte {
  height: 100%;
  overflow-y: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--marge);
  background:
    radial-gradient(1200px 600px at 20% -10%, rgba(139,108,255,.18), transparent 60%),
    radial-gradient(900px 500px at 110% 110%, rgba(34,211,238,.12), transparent 60%),
    var(--bg);
}
.porte-carte {
  width: 100%;
  max-width: 420px;
  background: rgba(23,26,33,.92);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px 24px;
  text-align: center;
}
.porte-logo { display: block; margin: 0 auto 12px; border-radius: 16px; }
.porte h1 { margin: 0 0 8px; font-size: 1.9rem; }
.porte-texte { color: var(--muted); margin: 0 0 20px; }
.porte-carte.suspendu .marque { background: none; color: var(--danger); }
.porte-form { text-align: left; }
.porte-form > * { margin-bottom: 14px; }
.porte-form .btn { width: 100%; }
.turnstile-box { display: flex; justify-content: center; min-height: 65px; }
.champ { display: block; }
.champ span { display: block; color: var(--muted); font-size: .9rem; margin-bottom: 6px; }
.champ input, .recherche input {
  font: inherit;
  width: 100%;
  min-height: var(--hit);
  padding: 8px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #0b0d11;
  color: var(--text);
}
.porte-erreur {
  margin: 4px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255,107,107,.12);
  border: 1px solid rgba(255,107,107,.35);
  color: #ffc9c9;
  text-align: left;
}

/* ============================================================ lecteur */
/* Téléphone (portrait) par défaut : en-tête, vidéo, catégories en ruban,
   liste qui défile. Le document ne défile jamais, seule la liste. */
.lecteur {
  height: 100%;
  display: -ms-grid;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto auto minmax(0, 1fr);
  grid-template-areas: "entete" "video" "cats" "liste";
}
.entete {
  grid-area: entete;
  display: flex;
  align-items: center;
  padding: 8px var(--marge);
  border-bottom: 1px solid var(--border);
  min-width: 0;
}
.entete-marque { display: flex; align-items: center; flex: 0 0 auto; margin-right: 12px; font-size: 1.15rem; }
.entete-marque img { margin-right: 8px; border-radius: 8px; }
.recherche { flex: 1 1 auto; min-width: 0; max-width: 520px; margin-left: auto; }
.recherche input { border-radius: 999px; padding-left: 16px; }

.zone-video { grid-area: video; min-width: 0; background: #000; }
.cadre {
  position: relative;
  width: 100%;
  height: 0;
  padding-top: 56.25%;
  background: #000;
  overflow: hidden;
}
.cadre video, .ecran, .bandeau-zone {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
}
.cadre video { background: #000; object-fit: contain; }
.ecran {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 16px;
  background:
    radial-gradient(600px 300px at 30% 0%, rgba(139,108,255,.22), transparent 70%),
    linear-gradient(180deg, #11131a, #07080b);
}
.ecran-contenu { max-width: 34em; }
.ecran-titre { font-size: 1.2rem; font-weight: 700; margin-bottom: 6px; }
.ecran-texte { color: var(--muted); margin-bottom: 12px; }
.ecran-chargement { background: rgba(0,0,0,.55); }
.ecran-chargement .ecran-texte:before {
  content: "";
  display: inline-block;
  width: 14px; height: 14px;
  margin-right: 8px;
  vertical-align: -2px;
  border-radius: 50%;
  border: 2px solid var(--muted);
  border-top-color: var(--cyan);
  animation: tourne .8s linear infinite;
}
@keyframes tourne { to { transform: rotate(360deg); } }
.ecran-attente .ecran-titre { color: var(--warn); }
.bandeau {
  position: absolute;
  left: 16px; top: 16px;
  max-width: calc(100% - 32px);
  padding: 8px 14px;
  border-radius: 10px;
  background: rgba(10,12,16,.82);
  border: 1px solid var(--border);
  font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.commandes {
  display: flex;
  align-items: center;
  padding: 8px var(--marge);
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  min-width: 0;
}
.commandes > * + * { margin-left: 8px; }
.en-cours {
  flex: 1 1 auto;
  min-width: 0;
  font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Catégories : ruban horizontal (défilement interne) sur téléphone. */
.categories {
  grid-area: cats;
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 10px var(--marge);
  border-bottom: 1px solid var(--border);
  scrollbar-width: none;
  min-width: 0;
}
.categories::-webkit-scrollbar { display: none; }
.cat {
  font: inherit;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 6px 14px;
  margin-right: 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  text-align: left;
}
.cat:hover { color: var(--text); }
.cat.actif { color: #fff; background: linear-gradient(180deg, #6aa0ff, var(--accent)); border-color: transparent; }
.cat-nb { margin-left: 8px; font-size: .8em; opacity: .7; }
.cat-nom { overflow: hidden; text-overflow: ellipsis; }

.zone-liste { grid-area: liste; display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.liste-titre { flex: 0 0 auto; padding: 8px var(--marge) 4px; color: var(--muted); font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.liste {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.liste-espace { position: relative; width: 100%; }
.liste-vide { flex: 0 0 auto; padding: 16px var(--marge); color: var(--muted); margin: 0; }
.ligne {
  position: absolute;
  left: 0; right: 0;
  height: var(--ligne);
  display: flex;
  align-items: center;
  padding: 0 var(--marge);
  cursor: pointer;
  border-bottom: 1px solid rgba(42,47,58,.55);
  user-select: none;
  -webkit-user-select: none;
}
.ligne:hover { background: var(--panel-2); }
.logo {
  flex: 0 0 auto;
  width: 40px; height: 40px;
  margin-right: 12px;
  border-radius: 8px;
  object-fit: contain;
  background: rgba(255,255,255,.06);
}
.initiale {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
}
.nom { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.etoile { display: none; color: #ffd34d; margin-left: 8px; }
.ligne.favori .etoile { display: inline; }
.ligne.joue { color: #9ec0ff; background: rgba(79,140,255,.10); box-shadow: inset 4px 0 0 var(--accent); }
.ligne.joue .nom:before { content: "\25B6\00a0"; font-size: .8em; }

/* ============================================================ ordinateur / TV */
@media (min-width: 900px) {
  :root { --marge: 18px; --ligne: 58px; }
  .lecteur {
    grid-template-columns: 220px minmax(300px, 28vw) minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas: "entete entete entete" "cats liste video";
  }
  .categories {
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 12px 10px;
    border-bottom: 0;
    border-right: 1px solid var(--border);
    scrollbar-width: thin;
  }
  .cat {
    display: flex;
    width: 100%;
    margin: 0 0 6px;
    border-radius: 12px;
    justify-content: space-between;
    flex: 0 0 auto;
  }
  .cat-nom { flex: 1 1 auto; min-width: 0; }
  .zone-liste { border-right: 1px solid var(--border); }
  .zone-video { background: var(--bg); padding: 18px; overflow: hidden; display: flex; flex-direction: column; }
  .zone-video .cadre, .zone-video .commandes {
    /* Garde la vidéo entière dans la hauteur disponible. */
    max-width: calc((100vh - 190px) * 16 / 9);
  }
  .cadre { border-radius: 14px; }
  .commandes { background: transparent; border: 0; padding: 12px 0 0; }
  .en-cours { font-size: 1.2rem; }
}
@media (min-width: 1600px) {
  :root { --ligne: 68px; --hit: 52px; --marge: 22px; }
  body { font-size: 20px; }
  .lecteur { grid-template-columns: 290px minmax(380px, 27vw) minmax(0, 1fr); }
  .logo { width: 48px; height: 48px; }
  .ecran-titre { font-size: 1.5rem; }
}
@media (max-width: 380px) {
  .entete-marque .marque { display: none; }
}

/* ============================================================ plein écran */
body.plein .zone-video, .zone-video:fullscreen, .zone-video:-webkit-full-screen {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  width: 100%; height: 100%;
  max-width: none;
  padding: 0;
  z-index: 50;
  background: #000;
}
body.plein .zone-video .cadre {
  max-width: none;
  height: 100%;
  padding-top: 0;
  border-radius: 0;
}
body.plein .zone-video .commandes { display: none; }
body.plein .bandeau { font-size: 1.4rem; top: 32px; left: 32px; }
