/* Ranked, recherche d'une partie, recompenses de fin de match. Meme
   fenetre que le format et l'entrainement : posee sur les modes, floutes
   derriere. Ordinateur et telephone (paysage) partagent tout ; seules les
   tailles se resserrent sur un ecran bas. */

:is(#screen-ranked, #screen-recherche).screen.sheet {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: clamp(8px, 2vh, 20px);
  padding: max(3%, env(safe-area-inset-top)) max(3%, env(safe-area-inset-right)) 3% max(3%, env(safe-area-inset-left));
  background: #04060a99;
  -webkit-backdrop-filter: blur(9px) grayscale(.7);
  backdrop-filter: blur(9px) grayscale(.7);
  overflow-y: auto;
}
:is(#screen-ranked, #screen-recherche).screen.sheet::before,
:is(#screen-ranked, #screen-recherche).screen.sheet::after { display: none; }
:is(#screen-ranked, #screen-recherche).screen.sheet[hidden] { display: none; }
#screen-ranked .sheet-head { width: auto; text-align: center; }
#screen-ranked .sheet-head .eyebrow,
#recherche-mode { margin: 0; color: var(--orange); letter-spacing: .24em; font: 700 clamp(10px, .9vw, 14px)/1 var(--mono); }
#screen-ranked .sheet-body { width: auto; overflow: visible; padding: 0; }

/* ------------------------------------------------------------ rang --- */

.rk-corps {
  display: grid;
  grid-template-columns: auto minmax(220px, 320px);
  gap: clamp(14px, 2.4vw, 36px);
  align-items: stretch;
}
.rk-carte,
.rk-classement {
  background: #0b1018e6;
  border: 1px solid #ffffff1f;
  border-radius: 16px;
  box-shadow: 0 22px 60px #000c;
}
.rk-carte {
  display: grid;
  grid-template-columns: auto minmax(220px, 340px);
  align-items: center;
  gap: clamp(12px, 2vw, 30px);
  padding: clamp(14px, 2.4vw, 32px);
}
.rk-insigne {
  width: clamp(120px, 17vw, 260px);
  height: auto;
  aspect-ratio: 1;
  filter: drop-shadow(0 12px 30px #000a);
}
/* Pas encore classe : l'insigne Gold, voile, dit ou vise le placement. */
.rk-insigne.non-classe { filter: grayscale(1) brightness(.55) drop-shadow(0 12px 30px #000a); }
.rk-infos { display: grid; gap: clamp(4px, .8vh, 8px); min-width: 0; }
.rk-infos p { margin: 0; }
.rk-etiquette { color: var(--dim); font: 700 clamp(10px, .85vw, 13px)/1.2 var(--mono); letter-spacing: .18em; text-transform: uppercase; }
#rk-rang { margin: 0; font: italic 800 clamp(30px, 4vw, 64px)/1 'Exo 2', var(--display); text-transform: uppercase; }
.rk-pr { font: 700 clamp(15px, 1.5vw, 24px)/1.3 var(--mono); color: var(--orange); }
/* Avant le placement : une explication, pas un chiffre. */
.rk-pr.explication { max-width: 34ch; font: 400 clamp(11px, 1vw, 14px)/1.45 var(--mono); color: var(--dim); }
.rk-barre { height: 10px; border-radius: 5px; background: #ffffff14; overflow: hidden; }
.rk-barre[hidden] { display: none; }
.rk-barre span { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--violet), var(--orange)); transition: width .6s ease; }
.rk-suite, .rk-bilan { color: var(--dim); font: 400 clamp(11px, .95vw, 14px)/1.3 var(--mono); }
.rk-protections { font: 700 clamp(11px, .95vw, 14px)/1.3 var(--mono); color: #cdb8ff; }
.rk-protections:empty, .rk-bilan:empty, .rk-suite:empty { display: none; }
.rk-niveau { display: grid; gap: 5px; margin-top: 4px; font: 400 clamp(11px, .9vw, 13px)/1 var(--mono); color: var(--ink); }
.rk-xp { height: 5px; border-radius: 3px; background: #ffffff14; overflow: hidden; }
.rk-xp span { display: block; height: 100%; width: 0; background: var(--violet); }

.rk-classement { display: grid; grid-template-rows: auto 1fr; padding: clamp(12px, 1.6vw, 22px); min-height: 0; }
.rk-classement h3 { margin: 0 0 10px; font: 700 clamp(11px, .9vw, 13px)/1 var(--mono); letter-spacing: .2em; text-transform: uppercase; color: var(--dim); }
#rk-classement { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; align-content: start; overflow-y: auto; max-height: min(52vh, 420px); }
#rk-classement li { display: grid; grid-template-columns: 2ch 26px 1fr auto; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 8px; font: 400 clamp(11px, .9vw, 14px)/1.2 var(--mono); }
#rk-classement li:nth-child(odd) { background: #ffffff08; }
#rk-classement li.vide { display: block; color: var(--dim); background: none; }
#rk-classement .pos { color: var(--dim); text-align: right; }
#rk-classement img { width: 26px; height: 26px; }
#rk-classement .nom { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#rk-classement .pr { color: var(--orange); font-weight: 700; }

#rk-statut { min-height: 1.3em; margin: 0; text-align: center; text-shadow: 0 2px 10px #000; }
#rk-statut:empty { min-height: 0; }
/* Memes boutons que l'ecran de fin : lisibles, le principal en orange. */
.rk-menu { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
:is(.rk-menu, .recherche-carte .sheet-menu) button {
  min-width: 170px;
  padding: 12px 24px;
  border: 1px solid #ffffff26;
  border-radius: 12px;
  background: #0b0f18;
  color: #fff;
  font: italic 800 clamp(14px, 1.2vw, 18px)/1 'Exo 2', var(--display);
  letter-spacing: .06em;
  text-transform: uppercase;
  clip-path: none;
  opacity: 1;
}
:is(.rk-menu, .recherche-carte .sheet-menu) button::after { display: none; }
.rk-menu button.rk-chercher {
  border: 0;
  background: linear-gradient(#ff8f3f, var(--orange) 55%, #d85d0e);
  box-shadow: 0 10px 30px #f07a2544;
}
:is(.rk-menu, .recherche-carte .sheet-menu) button:hover,
:is(.rk-menu, .recherche-carte .sheet-menu) button.pad-focus { outline: none; border-color: #fff9; filter: brightness(1.12); box-shadow: 0 0 0 2px #fff6; }

/* -------------------------------------------------------- recherche --- */

.recherche-carte {
  display: grid;
  justify-items: center;
  gap: clamp(6px, 1.4vh, 14px);
  width: min(460px, 92vw);
  padding: clamp(18px, 3vw, 36px);
  text-align: center;
  background: #0b1018e6;
  border: 1px solid #ffffff1f;
  border-radius: 16px;
  box-shadow: 0 22px 60px #000c;
}
.recherche-carte h2 { margin: 0; font-size: clamp(18px, 2vw, 30px); }
.recherche-temps { margin: 0; font: 700 clamp(28px, 3.4vw, 52px)/1 var(--mono); color: var(--orange); font-variant-numeric: tabular-nums; }
.recherche-detail { margin: 0; min-height: 2.6em; color: var(--dim); font: 400 clamp(11px, 1vw, 14px)/1.3 var(--mono); }
/* Des ondes qui partent du centre : la recherche tourne. */
.recherche-radar { position: relative; width: clamp(56px, 7vw, 96px); aspect-ratio: 1; }
.recherche-radar::after { content: ''; position: absolute; inset: 38%; border-radius: 50%; background: var(--orange); box-shadow: 0 0 18px var(--orange); }
.recherche-radar span { position: absolute; inset: 0; border: 2px solid var(--violet); border-radius: 50%; opacity: 0; animation: radar 2.4s ease-out infinite; }
.recherche-radar span:nth-child(2) { animation-delay: .8s; }
.recherche-radar span:nth-child(3) { animation-delay: 1.6s; }
@keyframes radar {
  from { transform: scale(.3); opacity: .9; }
  to { transform: scale(1); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .recherche-radar span { animation: none; opacity: .4; }
}

/* ---------------------------------------------- recompenses de fin --- */

#result-recompense {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 4px 14px;
  margin: 4px 0 2px;
  padding: 10px 14px;
  border-radius: 12px;
  background: #ffffff0a;
  text-align: left;
}
#result-recompense[hidden] { display: none; }
#result-recompense img { grid-row: span 4; width: clamp(56px, 7vw, 96px); height: auto; }
#result-recompense p { margin: 0; font: 400 clamp(11px, 1vw, 14px)/1.35 var(--mono); color: var(--dim); }
#result-recompense .rc-rang { font: italic 800 clamp(16px, 1.7vw, 26px)/1.1 'Exo 2', var(--display); color: var(--ink); text-transform: uppercase; }
#result-recompense .rc-pr { font-weight: 700; color: var(--ink); }
#result-recompense .rc-pr .plus { color: #7ee2a8; }
#result-recompense .rc-pr .moins { color: #ff8a7a; }
#result-recompense .rc-protection { color: #cdb8ff; }
#result-recompense.sans-rang { grid-template-columns: 1fr; text-align: center; }

/* --------------------------------------- salon d'attente du match --- */

/* Match du matchmaking : ni camp ni stade a choisir, seulement l'attente. */
#lobby.mm #teams,
#lobby.mm #btn-stadium-pick { display: none; }

/* Pause d'un match Ranked : l'abandon demande une confirmation. */
.pause-alerte { margin: 6px 0 0; max-width: 32ch; color: #ffb38a; font: 400 clamp(11px, 1vw, 14px)/1.35 var(--mono); }
.pause-alerte[hidden] { display: none; }

/* ------------------------------------------------ telephone, paysage --- */

@media (max-width: 900px) {
  .rk-corps { grid-template-columns: 1fr; }
  .rk-classement { display: none; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .rk-corps { grid-template-columns: auto minmax(180px, 240px); gap: 12px; }
  .rk-classement { display: grid; }
  .rk-carte { grid-template-columns: auto minmax(180px, 260px); padding: 12px; gap: 12px; }
  .rk-insigne { width: 96px; }
  #rk-rang { font-size: 26px; }
  #rk-classement { max-height: 44vh; }
  #rk-classement li { padding: 3px 4px; }
  #rk-classement img { width: 20px; height: 20px; }
  :is(#screen-ranked, #screen-recherche).screen.sheet { gap: 8px; padding-block: 8px; }
  #result-recompense img { width: 48px; }
  :is(.rk-menu, .recherche-carte .sheet-menu) button { min-width: 130px; padding: 9px 16px; }
}

/* La feuille generique pose ses lignes (tete, corps, pied) : la recherche,
   elle, n'est qu'une carte, au centre, son bouton au milieu. */
#screen-recherche.screen.sheet { grid-template-rows: none; align-content: center; }
.recherche-carte .sheet-menu { display: flex; justify-content: center; width: 100%; margin: 4px 0 0; padding: 0; }
