/*
 * Accueil de l'eleve connecte (/reviser, refonte v2, phase 5, maquettes
 * eleve/Tableau* et defidujour/PisteA). Mobile : une colonne dans l'ordre de
 * la maquette ; ordinateur (a partir de 960 px) : trois colonnes de 360, 456
 * et 320 px (1180 px de contenu).
 */

/* Le pied de page suit le contenu, comme dans la maquette (pas une page
   entiere de hauteur sous l'en-tete). */
[data-page="reviser"] .app {
  min-height: 0;
}

/* 20 px sous l'en-tete, comme la maquette mobile. */
[data-page="reviser"] .app-content {
  padding-top: var(--sp-2);
}

.student-home {
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
}

.student-home__col {
  display: contents;
}

/* Ordre du mobile : bonjour, objectif, defi, code, a toi de jouer, verrou,
   devoir, bac, matieres, semaine, badges */
.student-hello { order: 1; }
.student-goal { order: 2; }
.student-daily { order: 3; }
.student-code { order: 4; }
.student-play,
.student-locked { order: 5; }
.student-class { order: 6; }
.student-bac { order: 7; }
.student-subjects { order: 8; }
.student-week,
.student-later { order: 9; }
.student-badges { order: 10; }

.student-card {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding: var(--sp-4);
  border-radius: 24px;
  background: var(--surface);
}

.student-card[hidden],
.student-home [hidden] {
  display: none;
}

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

.student-card__title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.25rem;
  line-height: 1.05;
}

.student-play .student-card__title,
.student-subjects .student-card__title {
  font-size: 1.375rem;
}

.student-card__link {
  color: var(--accent-text);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--fs-small);
  text-decoration: none;
  white-space: nowrap;
}

.student-kicker {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: var(--muted);
  font-family: var(--font-body);
  font-weight: 900;
  font-size: var(--fs-tiny);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.student-kicker .site-icon {
  width: 16px;
  height: 16px;
}

/* Bandeau d'attente de l'accord parental (maquette eleve/TableauParent*) */
.student-pending {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) 14px;
  border: 2px solid var(--warm-border);
  border-radius: var(--r-md);
  background: var(--warm-bg);
  color: var(--warm-text);
  font-weight: 800;
  font-size: var(--fs-small);
  line-height: 1.35;
}

.student-pending p {
  flex: 1;
  margin: 0;
}

.student-pending__link {
  color: var(--flame-text);
  font-family: var(--font-display);
  font-weight: 800;
  white-space: nowrap;
}

/* --- Bonjour --------------------------------------------------------------- */
.student-hello {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.student-hello .avatar {
  width: 56px;
  height: 56px;
  border: 3px solid var(--flame);
  font-family: var(--font-display);
  font-size: 1.4375rem;
}

.student-hello__text {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--sp-1);
  min-width: 0;
}

.student-hello__title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.5rem;
  line-height: 1;
}

/* Classe sans crayon : le changement de classe n'est pas ouvert (decision 15). */
.student-hello__class {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  height: 32px;
  padding: 0 10px;
  border-radius: var(--r-xs);
  background: var(--soft);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--fs-small);
}

.student-hello__level {
  color: var(--flame-text);
}

.student-hello__league {
  flex-shrink: 0;
}

/* Sur mobile, la ligue quitte l'en-tete (components.css) et vient ici. */
.student-hello .student-hello__league:not([hidden]) {
  display: flex;
}

/* --- Objectif du jour et reprise --------------------------------------------- */
.student-goal__top {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
}

.student-ring {
  position: relative;
  flex: 0 0 92px;
  width: 92px;
  height: 92px;
}

.student-ring svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: none;
  stroke-width: 12;
}

.student-ring__track { stroke: var(--ring-track); }

.student-ring__arc {
  stroke: var(--success);
  stroke-linecap: round;
}

.student-ring__arc[stroke-dasharray="0 100"] { stroke: none; }

.student-ring__value {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-weight: 800;
  font-size: 0.6875rem;
  line-height: 1.1;
}

.student-ring__value strong {
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1.4375rem;
  line-height: 1;
}

.student-goal__text {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.student-goal__title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.25rem;
  line-height: 1.1;
}

.student-goal__sub {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
  font-size: 0.8125rem;
}

.student-resume {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3);
  border-radius: var(--r-md);
  background: var(--soft);
}

.student-resume__chapter {
  display: flex;
  flex: 1;
  align-items: center;
  gap: var(--sp-3);
  min-width: 0;
}

.student-resume__tile {
  width: 46px;
  height: 46px;
  border-radius: var(--r-sm);
  box-shadow: 0 var(--edge-sm) 0 var(--subject-edge, var(--violet-edge));
}

.student-resume__text {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  margin: 0;
}

.student-resume__subject {
  color: var(--muted);
  font-weight: 800;
  font-size: var(--fs-tiny);
  text-transform: uppercase;
}

.student-resume__text strong {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.0625rem;
  line-height: 1.15;
}

.student-resume__go {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  height: 44px;
  padding: 0 var(--sp-4);
  border-radius: var(--r-sm);
  background: var(--flame);
  box-shadow: 0 var(--edge-sm) 0 var(--flame-edge);
  color: var(--on-flame);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--fs-body);
  text-decoration: none;
  text-transform: uppercase;
}

/* --- Defi du jour (carte .defi-card du kit) --------------------------------- */
.student-daily[data-state="play"] .student-daily__done-only,
.student-daily[data-state="done"] .student-daily__play-only {
  display: none;
}

[data-page="reviser"] .defi-card__play .site-icon {
  width: 22px;
  height: 22px;
}

/* --- Code de jeu ------------------------------------------------------------- */
.student-code {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  margin: 0;
  padding: var(--sp-3) 14px;
  border: 2px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
}

.student-code__head {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.student-code__icon {
  --tile-icon-bg: var(--cyan);
  --tile-icon-edge: var(--cyan-edge);
}

.student-code__copy {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  margin: 0;
}

.student-code__label {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.0625rem;
  line-height: 1.1;
}

.student-code__hint {
  color: var(--muted);
  font-weight: 800;
  font-size: 0.8125rem;
}

.student-code__open,
.student-code__submit {
  --button-edge-size: var(--edge-sm);
  --button-hi: var(--relief-none);
  flex-shrink: 0;
  min-height: 42px;
  padding: 0 14px;
  border-radius: var(--r-sm);
  font-family: var(--font-display);
  font-size: 0.9375rem;
}

.student-code__entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
}

.student-code__error {
  margin: 0;
}

.student-code__error:empty {
  display: none;
}

/* --- A toi de jouer ------------------------------------------------------------ */
.student-play {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.student-play__list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.student-challenge {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) 14px;
  border-radius: var(--r-lg);
  background: var(--sel-bg);
  box-shadow: 0 5px 0 var(--violet-edge);
}

.student-challenge .avatar {
  width: 46px;
  height: 46px;
  font-family: var(--font-display);
  font-size: 1.25rem;
}

.student-challenge__text {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.student-challenge__text strong {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.0625rem;
  line-height: 1.1;
}

.student-challenge__text span {
  color: var(--sel-text);
  font-weight: 800;
  font-size: 0.8125rem;
}

.student-challenge .button {
  --button-edge-size: var(--edge-sm);
  --button-hi: var(--relief-none);
  min-height: 42px;
  padding: 0 14px;
  border-radius: var(--r-sm);
  font-family: var(--font-display);
  font-size: 0.9375rem;
  text-transform: uppercase;
}

.student-play__empty {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

/* Series a deux, dans « A toi de jouer » : carte chaude de la maquette */
.student-home .duo-home {
  gap: 10px;
}

.student-home .duo-card {
  padding: var(--sp-3) 14px;
  border: 2px solid var(--warm-border);
  border-radius: var(--r-lg);
  background: var(--warm-bg);
}

.student-home .duo-card__icon {
  width: 32px;
  height: 32px;
}

.student-home .duo-card__flame {
  width: 28px;
  height: 28px;
}

.student-home .duo-card__title {
  color: var(--flame-text);
  font-family: var(--font-display);
  font-size: 1.0625rem;
  line-height: 1.1;
}

.student-home .duo-card__status {
  color: var(--warm-text);
  font-weight: 800;
  font-size: 0.8125rem;
  line-height: 1.35;
}

.student-home .duo-home__all {
  display: none;
}

/* --- Verrou de l'accord parental ------------------------------------------------ */
.student-locked {
  border: 2px solid var(--border);
}

.student-locked__head {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.student-locked__icon {
  display: grid;
  flex-shrink: 0;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: var(--soft);
}

.student-locked__head .student-card__title {
  font-size: 1.125rem;
  line-height: 1.1;
}

.student-locked__text {
  margin: 2px 0 0;
  color: var(--muted);
  font-weight: 800;
  font-size: 0.8125rem;
}

.student-locked__tiles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--sp-2);
  margin: 0;
  padding: 0;
  list-style: none;
  opacity: 0.55;
}

.student-locked__tiles li {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: 64px;
  border: 2px dashed var(--border);
  border-radius: 16px;
  background: var(--soft);
  color: var(--muted);
  font-weight: 800;
  font-size: 0.6875rem;
}

.student-locked .button {
  --button-edge-size: 0px;
  min-height: 50px;
  border: 2px solid var(--border);
  border-radius: var(--r-md);
  background: transparent;
  color: var(--text);
  font-family: var(--font-display);
  font-size: var(--fs-body);
}

/* --- Devoir de la classe ---------------------------------------------------------- */
.student-class {
  flex-direction: row;
  align-items: center;
  padding: var(--sp-3) 14px;
  border-radius: var(--r-lg);
  color: var(--text);
  text-decoration: none;
}

.student-class__tile,
.student-bac__tile {
  width: 46px;
  height: 46px;
  border-radius: var(--r-sm);
  box-shadow: 0 var(--edge-sm) 0 var(--subject-edge, var(--violet-edge));
}

.student-class__text {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.student-class__name {
  color: var(--muted);
  font-weight: 800;
  font-size: var(--fs-tiny);
  text-transform: uppercase;
}

.student-class__text strong {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.0625rem;
  line-height: 1.15;
}

.student-class__xp {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 11px;
  border-radius: var(--r-pill);
  background: var(--sel-bg);
  color: var(--sel-text);
  font-weight: 900;
  font-size: 0.8125rem;
  white-space: nowrap;
}

.student-class__xp[hidden] { display: none; }

/* --- Bac de francais ------------------------------------------------------------------ */
.student-bac__head {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.student-bac__head .student-card__title {
  flex: 1;
  font-size: 1.3125rem;
}

.student-bac__countdown {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0;
  padding: 5px 10px;
  border-radius: 12px;
  background: var(--soft);
  color: var(--muted);
  font-weight: 800;
  font-size: 0.6875rem;
}

.student-bac__countdown strong {
  color: var(--flame-text);
  font-family: var(--font-display);
  font-size: 1.25rem;
  line-height: 1;
}

.student-bac__steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.student-bac__steps li {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-weight: 800;
  font-size: var(--fs-tiny);
  text-align: center;
}

.student-bac__mark {
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 44px;
  height: 44px;
  border: 2px solid var(--border);
  border-radius: 50%;
  background: var(--soft);
  color: var(--muted);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.125rem;
}

[data-state="doing"] > .student-bac__mark {
  border: 0;
  background: var(--flame);
  box-shadow: 0 var(--edge-sm) 0 var(--flame-edge);
  color: var(--on-flame);
  font-size: 0.9375rem;
}

[data-state="done"] > .student-bac__mark {
  border: 0;
  background: var(--success);
  box-shadow: 0 var(--edge-sm) 0 var(--success-dark);
  color: var(--on-accent);
}

.student-bac__works {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--sp-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.student-bac__cover > * {
  display: flex;
  align-items: flex-end;
  box-sizing: border-box;
  height: 70px;
  padding: 7px;
  border-radius: 12px;
  background: var(--objet-color);
  box-shadow: 0 var(--edge-sm) 0 var(--objet-edge);
  color: var(--objet-ink);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.6875rem;
  line-height: 1.05;
  text-decoration: none;
}

.student-bac__cover[data-empty] > * {
  border: 2px dashed var(--border);
  background: var(--soft);
  box-shadow: none;
  color: var(--muted);
}

.student-bac__next {
  font-family: var(--font-display);
  letter-spacing: 0.03em;
}

/* --- Mes matieres ----------------------------------------------------------------------- */
.student-subjects {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.student-subjects__list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.student-subject {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  padding: 10px var(--sp-3);
  border: 0;
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.student-subject .subject-tile {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  box-shadow: 0 var(--edge-sm) 0 var(--subject-edge, var(--violet-edge));
}

.student-subject__main {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.student-subject__name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--fs-body);
  line-height: 1;
}

.student-subject__bar {
  height: 8px;
  background: var(--soft);
}

.student-subject__count {
  flex-shrink: 0;
  min-width: 44px;
  color: var(--muted);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--fs-small);
  text-align: right;
}

/* Compte en attente d'accord : semaine et badges viendront avec l'accord */
.student-later {
  flex-direction: row;
  align-items: center;
  margin: 0;
  border: 2px solid var(--cyan);
  background: var(--cyan-bg);
  color: var(--cyan-text);
  font-weight: 700;
}

/* --- Cette semaine --------------------------------------------------------------------- */
.student-week__total {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--sp-2);
  margin: 0;
  color: var(--muted);
  font-weight: 800;
  font-size: 0.8125rem;
}

.student-week__total strong {
  white-space: nowrap;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1.625rem;
}

.student-week__bars {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  align-items: end;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.student-week__day {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: stretch;
  gap: var(--sp-1);
  height: 87px;
}

.student-week__bar {
  min-height: 4px;
  max-height: 70px;
  border-radius: 6px;
  background: var(--track-edge);
}

.student-week__day[data-state="met"] .student-week__bar { background: var(--success); }
.student-week__day[data-state="some"] .student-week__bar { background: var(--violet); }
.student-week__bar[data-value="10"] { height: 7px; }
.student-week__bar[data-value="20"] { height: 14px; }
.student-week__bar[data-value="30"] { height: 21px; }
.student-week__bar[data-value="40"] { height: 28px; }
.student-week__bar[data-value="50"] { height: 35px; }
.student-week__bar[data-value="60"] { height: 42px; }
.student-week__bar[data-value="70"] { height: 49px; }
.student-week__bar[data-value="80"] { height: 56px; }
.student-week__bar[data-value="90"] { height: 63px; }
.student-week__bar[data-value="100"] { height: 70px; }

.student-week__letter {
  color: var(--muted);
  font-weight: 800;
  font-size: 0.6875rem;
  text-align: center;
}

/* --- Niveau et badges ------------------------------------------------------------------- */
.student-badges__list {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: var(--sp-1);
  margin: 0;
  padding: 0;
  list-style: none;
}

.student-badge {
  display: flex;
  justify-content: center;
}

.student-badge img {
  display: block;
  width: 48px;
  height: 54px;
}

.student-badge[data-earned="false"] img {
  opacity: 0.55;
}

.student-badges__next {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px var(--sp-3);
  border-radius: 16px;
  background: var(--soft);
}

.student-badges__next p {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-2);
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--fs-small);
}

.student-badges__next strong {
  color: var(--flame-text);
}

.student-badges__next .progress {
  height: 8px;
}

.student-badges__next .progress__bar {
  background: var(--error);
}

/* --- Ordinateur : trois colonnes ------------------------------------------------------------ */
@media (min-width: 960px) {
  [data-page="reviser"] .app-content {
    padding-top: var(--sp-4);
  }

  .student-home {
    display: grid;
    grid-template-columns: minmax(0, 360fr) minmax(0, 456fr) minmax(0, 320fr);
    align-items: start;
    gap: 22px;
  }

  .student-home__col {
    display: flex;
    flex-direction: column;
    gap: 18px;
  }

  .student-home__col > * {
    order: 0;
  }

  .student-hello {
    padding: var(--sp-5);
    border-radius: 24px;
    background: var(--surface);
  }

  .student-hello .avatar {
    width: 64px;
    height: 64px;
    font-size: 1.625rem;
  }

  .student-hello__title {
    font-size: 1.75rem;
  }

  /* La ligue est dans l'en-tete sur ordinateur. */
  .student-hello .student-hello__league:not([hidden]) {
    display: none;
  }

  .student-ring {
    flex-basis: 104px;
    width: 104px;
    height: 104px;
  }

  .student-ring__value {
    font-size: var(--fs-tiny);
  }

  .student-ring__value strong {
    font-size: 1.6875rem;
  }
}

/* --- Nouveau badge (refonte 2026, phase 10, maquette compte/NouveauBadgeMobile ;
   refonte v2, phase 6 : ecusson de 150 px dans le halo de sa couleur) --- */
.badge-new { position: fixed; inset: 0; z-index: 70; display: flex; flex-direction: column; align-items: center; padding: var(--space-8) var(--content-gutter) calc(var(--space-6) + env(safe-area-inset-bottom)); overflow-y: auto; background: var(--bg); text-align: center; padding-top: 84px; gap: var(--sp-4); }
.badge-new[hidden] { display: none; }
.badge-new > * { width: 100%; max-width: 420px; }
.badge-new__close { position: absolute; top: var(--sp-4); right: var(--content-gutter); width: var(--touch-min); height: var(--touch-min); max-width: none; }
.badge-new__kicker { margin: 0; color: var(--flame-text); font-size: 0.875rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.badge-new__blason { height: auto; box-sizing: content-box; width: 150px; padding: 30px 40px; background: radial-gradient(circle, color-mix(in srgb, var(--badge-glow, var(--flame)) 33%, transparent) 0%, transparent 65%); }
.badge-new__title { margin: 0; font-family: var(--font-display); line-height: 1.1; font-size: 2.25rem; }
.badge-new__text { margin: 0; color: var(--muted); }
.badge-new__level { width: auto; margin: var(--sp-2) 0; background: var(--sel-bg); font-weight: 800; display: inline-flex; align-items: center; gap: 10px; padding: 10px 18px; border-radius: var(--r-md); }
.badge-new__level s { color: var(--muted); }
.badge-new__level strong { color: var(--flame-text); font-family: var(--font-display); font-size: 1.75rem; }
.badge-new .button { gap: var(--sp-2); }

/* Petits textes des cartes : l'interligne des maquettes (Nunito, `normal`). */
.student-code__hint,
.student-class__name,
.student-resume__subject,
.student-challenge__text span,
.student-goal__sub,
.student-locked__text {
  line-height: 1.35;
}

/* Refonte v2, phase 6 (maquette compte/NouveauBadgeMobile) : bouton secondaire sans relief */
.badge-new .button--secondary { --button-edge-size: 0px; border: 2px solid var(--border); background: transparent; box-shadow: none; }
