/*
 * Partie en direct au telephone (`/jeu`, refonte v2, phase 9, maquettes
 * `partie/CodeMobile`, `PseudoMobile`, `AttenteMobile`, `QuestionMobile`,
 * `JusteMobile`, `FinMobile`). Ecran de jeu : ni menu ni barre du bas, une
 * colonne de 390 px au plus, centree sur un ecran plus large.
 */

.jeu {
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
  box-sizing: border-box;
  width: 100%;
  max-width: 430px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: var(--sp-5) 18px var(--sp-6);
  line-height: normal;
}

.jeu__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.jeu__brand {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  color: var(--text);
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
}

.jeu-count {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  margin: 0;
  padding: 0 11px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  font-weight: 900;
  font-size: 15px;
  white-space: nowrap;
}

.jeu-count[hidden] { display: none; }

.jeu__main {
  display: flex;
  flex: 1;
  flex-direction: column;
}

.jeu-screen {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: var(--sp-5);
}

.jeu-screen[hidden] { display: none; }

/* La question et le resultat n'ont pas d'en-tete du site. */
.jeu[data-screen="question"] .jeu__top,
.jeu[data-screen="result"] .jeu__top { display: none; }

.jeu-foot {
  margin: auto 0 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  text-align: center;
}

.jeu-foot:empty { visibility: hidden; }

/* Bouton or des ecrans : 64 px, rayon 22, texte 22 */
.jeu-cta {
  min-height: 64px;
  font-size: 22px;
  text-decoration: none;
}

.jeu-link {
  font-size: 15px;
  font-weight: 800;
  text-align: center;
}

.jeu-link[hidden] { display: none; }

/* --- 1. Le code ------------------------------------------------------------ */
.jeu-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  margin-top: 30px;
  text-align: center;
}

.jeu-hero__tile {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 76px;
  height: 76px;
  border-radius: 24px;
  background: var(--cyan);
  box-shadow: 0 4px 0 var(--cyan-edge);
}

.jeu-hero__title {
  margin: 10px 0 0;
  font-size: 34px;
  line-height: 1;
}

.jeu-hero__lead {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  font-weight: 700;
}

.jeu-code {
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
  margin-top: 14px;
}

.jeu-code__error { margin: -8px 0 0; text-align: center; }

/* Le champ de code commun, en grandes cases blanches */
.code-entry--partie .code-entry__boxes {
  justify-content: center;
  gap: 6px;
}

.code-entry--partie .code-entry__boxes > span {
  width: 48px;
  height: 60px;
  border: 0;
  border-radius: 16px;
  background: var(--panel-card);
  box-shadow: 0 5px 0 var(--code-box-edge);
  color: var(--on-flame);
  font-size: 28px;
}

.code-entry--partie .code-entry__boxes > :nth-child(4) { margin-left: var(--sp-4); }

.code-entry--partie:focus-within .code-entry__boxes > [data-state="current"] {
  outline: 3px solid var(--flame);
  outline-offset: 2px;
}

.jeu-tips {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: var(--sp-2) 0 0;
  padding: 0;
  list-style: none;
}

.jeu-tip {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) 14px;
  border-radius: 20px;
  background: var(--surface);
}

.jeu-tip > span {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
}

.jeu-tip__title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 800;
  line-height: 1.15;
}

.jeu-tip__text {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

/* --- Carte de la partie (pseudo, attente) --------------------------------- */
.jeu-card {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) 14px;
  border: 2px solid var(--sel-border);
  border-radius: 20px;
  background: var(--sel-bg);
  color: var(--sel-text);
}

.jeu-card--bottom { margin-top: auto; }

.jeu-card__tile {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--r-sm);
  background: var(--violet);
  box-shadow: 0 4px 0 var(--violet-edge);
}

.jeu-card__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.jeu-card__title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 800;
  line-height: 1.1;
}

.jeu-card__line {
  font-size: 13px;
  font-weight: 800;
  opacity: 0.85;
}

/* --- 2. Pseudo et couleur ---------------------------------------------------- */
.jeu-pseudo {
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
}

.jeu-pseudo__preview {
  align-self: center;
  width: 96px;
  height: 96px;
  margin-top: var(--sp-2);
  font-size: 43px;
}

.jeu-field { display: flex; flex-direction: column; gap: var(--sp-2); margin: 0; }

.jeu-label {
  padding: 0;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
}

.jeu-input {
  height: 60px;
  border: 3px solid var(--sel-border);
  border-radius: var(--r-md);
  background: var(--surface);
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 800;
}

.jeu-hint { margin: 0; color: var(--muted); font-size: 13px; font-weight: 700; }

.jeu-colors {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  margin: 0;
  padding: 0;
  border: 0;
}

.jeu-colors__list {
  display: flex;
  justify-content: space-between;
}

.jeu-color { position: relative; display: inline-flex; cursor: pointer; }

.jeu-color .avatar { box-sizing: border-box; width: 44px; height: 44px; }

.jeu-color .choice__input:checked + .avatar {
  border: 4px solid var(--panel-card);
  box-shadow: 0 0 0 3px var(--sel-border);
}

.jeu-color .choice__input:focus-visible + .avatar { outline: 3px solid var(--focus); outline-offset: 4px; }

/* --- 3. Attente ------------------------------------------------------------ */
.jeu-wait {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-top: 50px;
  text-align: center;
}

.jeu-wait__ring {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 180px;
  height: 180px;
  border: 3px dashed var(--sel-border);
  border-radius: 50%;
  box-sizing: border-box;
}

.jeu-wait__avatar { width: 120px; height: 120px; font-size: 54px; }

.jeu-wait__name { margin: 0; font-size: 30px; line-height: 1; }

.jeu-wait__in {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  height: 40px;
  margin: 0;
  padding: 0 var(--sp-4);
  border-radius: var(--radius-pill);
  background: var(--green-bg);
  color: var(--green-strong);
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 800;
}

.jeu-wait__lead {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 17px;
  font-weight: 800;
  line-height: 1.35;
}

.jeu-stack {
  display: flex;
  justify-content: center;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.jeu-stack__avatar { width: 40px; height: 40px; font-size: 18px; }

.jeu-stack__more {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--soft);
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 800;
}

/* --- 4. Question -------------------------------------------------------------- */
.jeu-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.jeu-bar > p { margin: 0; }

.jeu-bar__progress { font-family: var(--font-display); font-size: 18px; font-weight: 800; }

.jeu-bar__total { color: var(--muted); }

.jeu-bar__streak {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--flame-text);
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
}

.jeu-timer {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 54px;
}

.jeu-timer__ring {
  position: absolute;
  inset: 0;
  transform: rotate(-90deg);
}

.jeu-timer__track,
.jeu-timer__left {
  fill: none;
  stroke-width: 6;
}

.jeu-timer__track { stroke: var(--soft); }

.jeu-timer__left { stroke: var(--flame); transition: stroke-dashoffset 1s linear; }

.jeu-timer__value { font-family: var(--font-display); font-size: 19px; font-weight: 800; }

.jeu-prompt {
  margin: 0;
  padding: 18px;
  border-radius: 24px;
  background: var(--surface);
  font-size: 22px;
  line-height: 1.2;
}

.jeu-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3);
  margin: 0;
  padding: 0;
  list-style: none;
}

.jeu-choice {
  --tile: var(--game-answer-a);
  --tile-edge: var(--game-answer-a-edge);
  --tile-ink: var(--game-answer-a-ink);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  box-sizing: border-box;
  width: 100%;
  min-height: 182px;
  padding: 14px var(--sp-4);
  border: 0;
  border-radius: 24px;
  background: var(--tile);
  box-shadow: var(--game-tile-hi), 0 7px 0 var(--tile-edge);
  color: var(--tile-ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

/* Memes couleurs par lettre qu'au tableau (profs.css, `.live-choices--board`). */
.jeu-choice[data-index="1"] { --tile: var(--game-answer-b); --tile-edge: var(--game-answer-b-edge); --tile-ink: var(--game-answer-b-ink); }
.jeu-choice[data-index="2"] { --tile: var(--game-answer-c); --tile-edge: var(--game-answer-c-edge); --tile-ink: var(--game-answer-c-ink); }
.jeu-choice[data-index="3"] { --tile: var(--game-answer-d); --tile-edge: var(--game-answer-d-edge); --tile-ink: var(--game-answer-d-ink); }

.jeu-choice:active:not(:disabled) { transform: translateY(4px); box-shadow: var(--game-tile-hi), 0 3px 0 var(--tile-edge); }

.jeu-choice[data-state="idle"] { opacity: 0.35; }
.jeu-choice[data-state="chosen"] { outline: 4px solid var(--text); outline-offset: 3px; }
.jeu-choice:disabled { cursor: default; }

.jeu-choice__letter {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--game-key-light);
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
}

.jeu-choice__label {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 800;
  line-height: 1.05;
}

/* --- 5. Juste, rate, sans reponse --------------------------------------------- */
.jeu[data-screen="result"] { background: var(--success); color: var(--panel-card); }
.jeu[data-screen="result"]:has([data-tone="bad"]),
.jeu[data-screen="result"]:has([data-tone="miss"]) { background: var(--game-bad-bg); }

body:has(.jeu[data-screen="result"]) { background: var(--success); }
body:has([data-tone="bad"]:not([hidden])),
body:has([data-tone="miss"]:not([hidden])) { background: var(--game-bad-bg); }

.jeu-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-3);
  margin-top: 90px;
  text-align: center;
}

.jeu-result__mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: var(--panel-card);
  box-shadow: 0 8px 0 var(--success-dark);
}

[data-tone="bad"] .jeu-result__mark,
[data-tone="miss"] .jeu-result__mark { box-shadow: 0 8px 0 var(--game-bad-edge); }

.jeu-result__title { margin: 0; color: inherit; font-size: 54px; line-height: 1; }

[data-tone="bad"] .jeu-result__title,
[data-tone="miss"] .jeu-result__title { color: var(--game-bad-title); }

.jeu-result__points {
  margin: 0;
  color: var(--game-points);
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 800;
}

[data-tone="bad"] .jeu-result__points,
[data-tone="miss"] .jeu-result__points { display: none; }

.jeu-result__answer { margin: 0; color: var(--game-bad-hint-text); font-size: 18px; font-weight: 800; }

.jeu-result__streak {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  height: 42px;
  margin: 0;
  padding: 0 18px;
  border-radius: var(--radius-pill);
  background: var(--game-key-bg);
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
}

.jeu-result__answer[hidden],
.jeu-result__streak[hidden] { display: none; }

.jeu-result__foot {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: auto;
}

.jeu-rank {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0;
  padding: var(--sp-4);
  border-radius: var(--r-lg);
  background: var(--game-key-bg);
}

.jeu-rank__me { font-family: var(--font-display); font-size: 20px; font-weight: 800; }

.jeu-rank__of { font-size: 15px; font-weight: 800; opacity: 0.85; }

.jeu-result__next {
  margin: 0;
  color: var(--game-on-success-soft);
  font-size: 14px;
  font-weight: 800;
  text-align: center;
}

[data-tone="bad"] .jeu-result__next,
[data-tone="miss"] .jeu-result__next { color: var(--game-bad-hint-text); }

[data-tone="bad"] .jeu-rank,
[data-tone="miss"] .jeu-rank { color: var(--game-bad-hint-text); }

/* --- 6. Fin -------------------------------------------------------------------- */
.jeu-end__head {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  text-align: center;
}

.jeu-end__title { margin: 0; font-size: 32px; line-height: 1; }

.jeu-end__line { margin: 0; color: var(--muted); font-size: 16px; font-weight: 800; }

.jeu-podium {
  display: flex;
  align-items: flex-end;
  gap: var(--sp-2);
  margin: 0;
  padding: 0 6px;
  list-style: none;
}

.jeu-podium__step {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.jeu-podium__avatar { width: 50px; height: 50px; font-size: 22px; }

.jeu-podium__step[data-mine="true"] .jeu-podium__avatar { width: 58px; height: 58px; font-size: 26px; }

.jeu-podium__name { font-family: var(--font-display); font-size: 15px; font-weight: 800; }

.jeu-podium__step[data-mine="true"] .jeu-podium__name { color: var(--flame-text); }

.jeu-podium__block {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  box-sizing: border-box;
  width: 100%;
  height: 96px;
  padding-top: 10px;
  border-radius: 16px 16px 0 0;
  background: var(--soft);
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 800;
}

.jeu-podium__step[data-rank="1"] .jeu-podium__block { height: 160px; }
.jeu-podium__step[data-rank="2"] .jeu-podium__block { height: 120px; }

.jeu-podium__step[data-mine="true"] .jeu-podium__block {
  background: linear-gradient(180deg, var(--flame), var(--flame-edge));
  color: var(--on-flame);
}

.jeu-xp {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 14px;
  border: 2px solid var(--warm-border);
  border-radius: var(--r-lg);
  background: var(--warm-bg);
}

.jeu-xp[hidden] { display: none; }

.jeu-xp__text { display: flex; flex: 1; flex-direction: column; }

.jeu-xp__value { font-family: var(--font-display); font-size: 20px; font-weight: 800; line-height: 1.05; }

.jeu-xp__line { color: var(--warm-text); font-size: 13px; font-weight: 800; }

/* Tailles des icones (`.site-icon` vaut 24 px par defaut) */
.jeu__brand .site-icon { width: 30px; height: 30px; }
.jeu-count .site-icon { width: 18px; height: 18px; }
.jeu-hero__tile .site-icon { width: 40px; height: 40px; }
.jeu-card__tile .site-icon { width: 24px; height: 24px; }
.jeu-wait__in .site-icon { width: 20px; height: 20px; }
.jeu-bar__streak .site-icon,
.jeu-result__streak .site-icon { width: 22px; height: 22px; }
.jeu-result__mark .site-icon { width: 86px; height: 86px; }
.jeu-xp .site-icon { width: 34px; height: 34px; }
.jeu-cta .site-icon { filter: none; width: 22px; height: 22px; }
