/*
 * BriqueBall · les pages d'entrée, connexion et création de compte (vue entree.php ; entree.js). Préfixe en-.
 * Un soir de match à l'Arène : la salle du direct (direct.css, classes dx-) filme un petit match en perspective sur un
 * parquet en érable ; devant, le guichet d'entrée. Ordinateur et téléphone tourné : le guichet à droite, le match à
 * gauche. Téléphone tenu droit et tablette en hauteur : le match en haut, le guichet en bas (la page défile s'il le faut,
 * la salle reste derrière).
 * Les lumières ne s'allument qu'à la première visite de la session ; le guichet est là dès la première image. Ce qui
 * bouge ne bouge que par transformations et opacités ; rien de flou par-dessus le match.
 */

.en-body {
  --en-pw: min(420px, 44vw);                /* le guichet sur le côté */
  --en-gap: clamp(14px, 2.6vw, 44px);
  --en-aside: calc(var(--en-pw) + 2 * var(--en-gap));
  display: block; min-height: 100vh; min-height: 100dvh; background: #02040A;
}

/* ---------- La salle ---------- */

.en {
  --en-gold: #FFC52E; --en-gold-2: #F5A00C; --en-led: #FFE7A0; --en-line: rgba(255, 255, 255, .1); --en-text-2: #9AA6C4;
  --home-hi: #4C8DFF; --away-hi: #FF4D63;
  z-index: 0;
}
/* tant que la caméra n'a pas cadré (avant entree.js), rien de ce qu'elle filme n'est posé : la salle seule */
.en:not(.is-ready) .dx-cam > :not([data-back]) { visibility: hidden; }
.en .dx-scene {
  background:
    radial-gradient(90% 55% at 50% 0%, rgba(90, 130, 240, .26), transparent 70%),
    radial-gradient(130% 80% at 50% 8%, #121F4A 0%, #08102A 40%, #03060F 72%, #010205 100%);
}
.en .tele .en-pass { stroke-dasharray: 1.4 5.5; stroke-width: 2px; stroke-opacity: .75; }
.en-crest { background-image: url("../img/favicon.svg"); }
.en .dx-bug .en-crest { width: 30px; height: 30px; }
/* le message du ruban qui ne clignote pas (le pseudo tapé, l'envoi) */
.en .dx-ribbon.is-calm .dx-ribbon__say { animation: none; }

/* Les lumières s'allument : la salle dans le noir, puis les projecteurs, rampe après rampe */
.en-dark { position: absolute; inset: 0; z-index: 3; background: #000; opacity: 0; pointer-events: none; }
.en-intro .en-dark { animation: en-lights 1.6s linear both; }
.en-intro .dx-beam { animation: en-beams 1.6s linear both; }
@keyframes en-lights {
  0%, 30% { opacity: 1; }
  31%, 52% { opacity: .66; }
  53%, 72% { opacity: .34; }
  73% { opacity: 0; }
  100% { opacity: 0; }
}
@keyframes en-beams { 0%, 72% { opacity: 0; } 73% { opacity: .55; } 100% { opacity: .3; } }

/* Aux lumières, la caméra recule sur la salle ; à l'envoi, elle pousse vers le terrain */
.en .dx-shake { transition: transform 1.8s cubic-bezier(.2, .7, .2, 1); }
.en-intro .en .dx-shake { transform: scale(1.18); }
.en.is-entering .dx-shake { transform: scale(1.07); }

/* ---------- L'habillage : bandeau de score, nom de l'action, paniers, grandes actions ---------- */

.en .dx-bug { top: var(--dx-top); }
.en .dx-play, .en .dx-pop { top: calc(var(--dx-top) + 66px); }
.en .dx-slam { bottom: var(--en-ph, 0px); right: var(--en-pr, 0px); }

/* ---------- Le guichet ---------- */

.en-main {
  --gold: #FFC52E; --gold-2: #F5A00C; --line: rgba(255, 255, 255, .1); --text-2b: #9AA6C4;
  display: grid; min-height: 100vh; min-height: 100dvh;
}
/* le guichet passe devant la salle, pas toute la page : un calque plein écran par-dessus le match coûtait 6 images par seconde */
.en-panel {
  position: relative; z-index: 1; isolation: isolate; display: grid; gap: 16px; align-content: start; width: 100%; padding: 24px 24px 16px; border-radius: 28px;
  background: linear-gradient(180deg, rgba(15, 24, 50, .95), rgba(6, 10, 24, .97) 60%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .1), inset 0 1px 0 rgba(255, 255, 255, .14), 0 44px 90px -30px rgba(0, 0, 0, .95), 0 0 0 6px rgba(255, 197, 46, .045);
}
.en-panel::before { /* le liseré d'or */
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; padding: 1px; pointer-events: none;
  background: linear-gradient(160deg, rgba(255, 220, 120, .7), transparent 34%, transparent 66%, rgba(255, 220, 120, .3));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude;
}
.en-panel::after { /* la lumière de la salle sur le haut du guichet */
  content: ""; position: absolute; left: 12%; right: 12%; top: 0; z-index: -1; height: 120px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(closest-side, rgba(255, 210, 120, .12), transparent); transform: translateY(-50%);
}

.en-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.en-logo { margin: 0; font: 800 44px/.9 var(--cond); letter-spacing: .01em; text-transform: uppercase; }
.en-logo b { color: var(--red-hi); }
.en-clock { display: flex; align-items: center; gap: 0; margin: 0; border-radius: 999px; background: rgba(4, 8, 20, .7); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.en-clock span { padding: 0 10px 0 13px; color: var(--text-2b); font: 700 12px/1 var(--cond); letter-spacing: .14em; text-transform: uppercase; white-space: nowrap; }
.en-clock b {
  display: flex; align-items: center; height: 30px; padding: 0 12px; background: rgba(255, 197, 46, .1); color: #FFE7A0;
  font: 700 16px/1 var(--mono); font-variant-numeric: tabular-nums; text-shadow: 0 0 6px rgba(255, 197, 46, .8);
}

/* Les onglets : une pastille claire glisse sous celui qui est ouvert */
.en-tabs { position: relative; isolation: isolate; display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 15px; background: rgba(255, 255, 255, .05); box-shadow: inset 0 0 0 1px var(--line); }
.en-tab {
  display: grid; place-items: center; height: 42px; border-radius: 11px; color: var(--text-2b); text-decoration: none; -webkit-tap-highlight-color: transparent;
  font: 800 15px/1 var(--cond); letter-spacing: .1em; text-transform: uppercase; transition: color .25s;
}
.en-tab:hover { color: var(--white); }
.en-tab[aria-current] { color: #0A1324; }
.en-tab:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.en-tabs__pill {
  position: absolute; z-index: -1; left: 4px; top: 4px; bottom: 4px; width: calc(50% - 4px); border-radius: 11px;
  background: linear-gradient(180deg, #FFFFFF, #DCE4F2); box-shadow: 0 6px 18px rgba(0, 0, 0, .35); transition: transform .35s var(--ease);
}
[data-mode="signup"] .en-tabs__pill { transform: translateX(100%); }

/* Les formulaires */
.en-form { display: grid; gap: 13px; min-width: 0; margin: 0; }
.en-lead h2 { margin: 2px 0 4px; font: 800 30px/1 var(--cond); letter-spacing: .01em; text-transform: uppercase; }
.en-lead p { margin: 0; color: var(--text-2b); font-size: 14.5px; line-height: 1.45; }
.en-alert { margin: 0; padding: 10px 14px; border-radius: 12px; background: rgba(200, 16, 46, .18); color: #FFB3BE; font-size: 14.5px; line-height: 1.4; box-shadow: inset 0 0 0 1px rgba(255, 77, 99, .42); }

.en-field { position: relative; display: grid; gap: 7px; }
.en-field > span { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; color: var(--text-2b); font: 700 12.5px/1 var(--cond); letter-spacing: .14em; text-transform: uppercase; }
.en-field input, .en-ticket input { width: 100%; min-width: 0; border: 0; color: var(--white); -webkit-appearance: none; appearance: none; }
.en-field input {
  height: 50px; padding: 0 16px; border-radius: 14px; background: #0E1830;
  font: 500 17px/1 var(--font); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .13); transition: box-shadow .15s, background-color .15s;
}
.en-field input:hover { background: #111D3A; }
.en-field input:focus { outline: none; background: #111D3A; box-shadow: inset 0 0 0 2px var(--gold), 0 0 0 4px rgba(255, 197, 46, .12); }
.en-field input:-webkit-autofill { -webkit-text-fill-color: var(--white); -webkit-box-shadow: 0 0 0 100px #111D3A inset, inset 0 0 0 1px rgba(255, 255, 255, .13); caret-color: var(--white); }
.en-field--pass input { padding-right: 54px; }
.en-eye {
  position: absolute; right: 3px; bottom: 3px; display: grid; place-items: center; width: 46px; height: 44px; border: 0; border-radius: 11px;
  background: none; color: var(--text-2b); cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.en-eye:hover, .en-eye[aria-pressed="true"] { color: var(--white); }
.en-eye:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }
.en-eye svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.en-eye .en-eye__shut, .en-eye[aria-pressed="true"] .en-eye__open { display: none; }
.en-eye[aria-pressed="true"] .en-eye__shut { display: inline; }
.en-rule { color: var(--text-2b); font: 700 11.5px/1 var(--cond); font-style: normal; letter-spacing: .08em; opacity: .8; transition: color .2s; }
.en-rule.is-ok { color: #3BE38F; opacity: 1; }
.en-rule.is-ok::before { content: "✓ "; }
.is-bad { animation: en-bad .4s cubic-bezier(.36, .07, .19, .97); }
.is-bad input { box-shadow: inset 0 0 0 2px #FF4D63; }
@keyframes en-bad { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }

/* Le code d'invitation : un billet d'entrée, ses deux encoches, son talon en pointillés */
.en-ticket {
  position: relative; display: grid; gap: 4px; padding: 12px 18px 11px; border-radius: 16px; cursor: text;
  background: linear-gradient(120deg, rgba(255, 197, 46, .17), rgba(255, 197, 46, .05) 60%, rgba(255, 197, 46, .1));
  box-shadow: inset 0 0 0 1.5px rgba(255, 197, 46, .42);
}
.en-ticket::before, .en-ticket::after { content: ""; position: absolute; top: 50%; width: 18px; height: 18px; margin-top: -9px; border-radius: 50%; background: #0A1022; box-shadow: inset 0 0 0 1.5px rgba(255, 197, 46, .42); }
.en-ticket::before { left: -9px; clip-path: inset(0 0 0 50%); }
.en-ticket::after { right: -9px; clip-path: inset(0 50% 0 0); }
.en-ticket__k { color: var(--gold); font: 800 12.5px/1 var(--cond); letter-spacing: .16em; text-transform: uppercase; }
.en-ticket input {
  height: 40px; padding: 0; background: none; color: #FFE7A0; caret-color: var(--gold);
  font: 800 30px/1 var(--cond); letter-spacing: .32em; text-transform: uppercase; text-shadow: 0 0 12px rgba(255, 197, 46, .45);
}
.en-ticket input::placeholder { color: rgba(255, 231, 160, .25); text-shadow: none; }
.en-ticket input:focus { outline: none; }
.en-ticket:focus-within { box-shadow: inset 0 0 0 2px var(--gold), 0 0 0 4px rgba(255, 197, 46, .12); }
.en-ticket small { padding-top: 7px; border-top: 1.5px dashed rgba(255, 197, 46, .3); color: var(--text-2b); font-size: 12.5px; line-height: 1.35; }

/* Le bouton d'entrée */
.en-go {
  position: relative; display: flex; align-items: center; justify-content: center; gap: 10px; height: 56px; margin-top: 2px; padding: 0 20px; overflow: hidden;
  border: 0; border-radius: 16px; cursor: pointer; color: #1A1204; -webkit-tap-highlight-color: transparent;
  background: linear-gradient(180deg, #FFDA6B, var(--gold-2));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .65), inset 0 -2px 0 rgba(150, 80, 0, .35), 0 16px 34px -14px rgba(255, 170, 30, .95);
  font: 800 19px/1 var(--cond); letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; transition: transform .15s, filter .15s;
}
.en-go::after { /* le reflet qui passe au survol */
  content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 40%; pointer-events: none;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .55), transparent); transform: translateX(-120%) skewX(-18deg);
}
.en-go:hover { filter: brightness(1.06); }
.en-go:hover::after { transform: translateX(300%) skewX(-18deg); transition: transform .7s cubic-bezier(.3, .6, .3, 1); }
.en-go:active { transform: translateY(1px) scale(.985); }
.en-go:focus-visible { outline: 2px solid var(--white); outline-offset: 3px; }
.en-go.is-busy { cursor: progress; }
.en-go.is-busy::before { content: ""; width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid rgba(26, 18, 4, .3); border-top-color: #1A1204; animation: en-spin .7s linear infinite; }
@keyframes en-spin { to { transform: rotate(1turn); } }

.en-note { margin: 0; color: var(--text-2b); font-size: 13px; text-align: center; }

/* Le mode visiteur : tout voir sans compte (visite.php) */
.en-visit {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 16px; color: var(--white); text-decoration: none; -webkit-tap-highlight-color: transparent;
  background: rgba(255, 255, 255, .04); box-shadow: inset 0 0 0 1px var(--line); transition: background .2s, box-shadow .2s;
}
.en-visit:hover { background: rgba(255, 197, 46, .07); box-shadow: inset 0 0 0 1px rgba(255, 197, 46, .45); }
.en-visit:active { transform: scale(.99); }
.en-visit:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.en-visit__ico { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: rgba(255, 197, 46, .12); color: var(--gold); }
.en-visit__ico svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.en-visit__t { display: grid; flex: 1; gap: 4px; min-width: 0; }
.en-visit__t b { font: 800 16px/1 var(--cond); letter-spacing: .1em; text-transform: uppercase; }
.en-visit__t small { color: var(--text-2b); font-size: 12.5px; line-height: 1.35; }
.en-visit__go { flex: none; width: 18px; height: 18px; fill: none; stroke: var(--text-2b); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s, stroke .2s; }
.en-visit:hover .en-visit__go { transform: translateX(3px); stroke: var(--gold); }
@media (prefers-reduced-motion: reduce) { .en-visit, .en-visit__go { transition: none; } .en-visit:hover .en-visit__go { transform: none; } }
.en-legal { margin: 0; padding-top: 12px; border-top: 1px solid var(--line); color: #66728F; font-size: 12px; text-align: center; }

/* ---------- Ordinateur, tablette et téléphone tournés : le guichet à droite ---------- */

@media (min-width: 640px) and (min-aspect-ratio: 5/4) {
  .en-main { justify-content: end; align-content: center; padding: var(--en-gap); }
  .en-panel { width: var(--en-pw); }
  .en .dx-bug, .en .dx-play, .en .dx-pop { left: calc((100% - var(--en-aside)) / 2 + var(--en-gap) / 2); right: auto; transform: translateX(-50%); }
  .en .dx-play.is-on { transform: translate(-50%, 0); }
  .en .dx-bug { max-width: calc(100% - var(--en-aside) - var(--en-gap)); }
}
/* la place du match est étroite : le bandeau de score se resserre */
@media (min-width: 640px) and (min-aspect-ratio: 5/4) and (max-width: 1180px) {
  .en .dx-bug__name { font-size: 16px; }
  .en .dx-bug__score { min-width: 48px; font-size: 28px; }
  .en .dx-bug__period { display: none; }
}
@media (orientation: landscape) and (max-height: 560px) {
  .en .dx-bug__period, .en .dx-bug__shot { display: none; }
}
/* l'écran est bas (téléphone tourné, petit portable) : le guichet se resserre */
@media (min-width: 640px) and (min-aspect-ratio: 5/4) and (max-height: 760px) {
  .en-panel { gap: 11px; padding: 18px 20px 12px; }
  .en-logo { font-size: 36px; }
  .en-lead p { display: none; }
  .en-lead h2 { font-size: 25px; }
  .en-form { gap: 10px; }
  .en-field input { height: 46px; }
  .en-eye { height: 40px; }
  .en-go { height: 50px; font-size: 17px; }
  .en-ticket { padding: 9px 16px 8px; }
  .en-ticket input { height: 34px; font-size: 26px; }
  .en-visit { padding: 8px 12px; }
  .en-visit__ico { width: 32px; height: 32px; }
  .en-visit__t small { display: none; }
}
@media (orientation: landscape) and (max-height: 560px) {
  .en .dx-play, .en .dx-pop { top: calc(var(--dx-top) + 42px); }
}
@media (min-width: 640px) and (min-aspect-ratio: 5/4) and (max-height: 480px) {
  .en-main { align-content: start; }
  .en-clock, .en-lead { display: none; }
  .en-logo { font-size: 28px; }
  .en-tab { height: 36px; }
  .en-ticket small { display: none; }
}

/* ---------- Téléphone tenu droit, tablette en hauteur : le match en haut, le guichet en bas ---------- */

@media (max-width: 639px), (max-aspect-ratio: 5/4) {
  .en { --dx-top: calc(env(safe-area-inset-top) + 8px); }
  .en .dx-bug { top: var(--dx-top); left: 50%; right: auto; width: min(560px, calc(100% - 20px)); transform: translateX(-50%); }
  .en .dx-play, .en .dx-pop { top: calc(var(--dx-top) + 60px); }
  /* la salle garde au moins le haut de l'écran ; le guichet en dessous, la page défile s'il le faut */
  .en-main { align-content: end; justify-items: center; padding: max(36vh, calc(env(safe-area-inset-top) + 230px)) 10px calc(10px + env(safe-area-inset-bottom)); }
  .en-panel { max-width: 520px; gap: 13px; padding: 18px 18px 12px; border-radius: 24px; }
  .en-logo { font-size: 32px; }
  .en-lead h2 { font-size: 25px; }
  .en-lead p { display: none; } /* la place va au match */
  .en-form { gap: 11px; }
  .en-field input { height: 48px; font-size: 16px; } /* 16 px : iOS ne zoome pas sur le champ */
  .en-eye { height: 42px; }
  .en-go { height: 54px; font-size: 18px; }
}
@media (max-width: 400px) {
  .en-clock span { display: none; }
  .en-logo { font-size: 29px; }
}

@media (prefers-reduced-motion: reduce) {
  .en-tabs__pill, .en-tab, .en-go, .en-field input, .en-rule, .en .dx-shake { transition: none; }
  .is-bad, .en-intro .en-dark, .en-intro .dx-beam { animation: none; }
}
