/* ==========================================================================
   Écrans spécifiques
   ========================================================================== */

/* --- Accueil ------------------------------------------------------------- */

.home-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(var(--s-2) + var(--safe-top)) calc(var(--gutter) - 12px) 0 var(--gutter);
  min-height: 56px;
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--fs-base);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.wordmark__mark {
  width: 18px;
  height: 18px;
}

.home-intro {
  padding: var(--s-6) 0 0;
}

.home-intro__title {
  max-width: 14em;
  font-size: var(--fs-2xl);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.home-intro__text {
  margin-top: var(--s-2);
  color: var(--text-2);
}

.home-resume {
  margin-top: var(--s-6);
}

/* Ligne de jeu : illustration, texte, bouton Jouer */
.game-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  border-bottom: 1px solid var(--line);
}

.game-row:last-child {
  border-bottom: 0;
}

.game-row__link {
  display: flex;
  flex: 1;
  align-items: center;
  gap: var(--s-4);
  min-width: 0;
  padding: var(--s-4) 0;
  text-decoration: none;
}

.game-row__link:active .game-tile {
  background: color-mix(in srgb, var(--accent) 22%, var(--surface-1));
}

.game-row__name,
.game-row__desc {
  display: block;
}

.game-row__name {
  font-size: 17px;
  font-weight: 500;
  line-height: 1.3;
}

.game-row__desc {
  margin-top: 2px;
  color: var(--text-2);
  font-size: var(--fs-base);
  line-height: 1.4;
}

.game-row__meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: var(--s-2);
  color: var(--text-3);
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
}

.game-tile {
  display: grid;
  flex: none;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: var(--r-card);
  background: color-mix(in srgb, var(--accent) 13%, var(--surface-1));
  color: var(--accent);
  transition: background-color var(--t-fast) var(--ease);
}

.game-tile svg {
  width: 34px;
  height: 34px;
}

.game-tile--lg {
  width: 80px;
  height: 80px;
}

.game-tile--lg svg {
  width: 50px;
  height: 50px;
}

/* Illustrations : la teinte du jeu + un trait secondaire neutre */
.illustration {
  --ill-line: var(--text-2);
}

.home-footer {
  padding: var(--s-8) 0 calc(var(--s-6) + var(--safe-bottom));
  color: var(--text-3);
  font-size: var(--fs-sm);
}

/* --- Page de présentation de l'application ------------------------------- */

.welcome-hero {
  padding: calc(var(--s-10) + var(--safe-top)) 0 var(--s-2);
}

.welcome-hero__mark {
  width: 44px;
  height: 44px;
  margin-bottom: var(--s-5);
}

.welcome-hero__title {
  margin-top: var(--s-2);
  font-size: var(--fs-3xl);
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: -0.02em;
}

.welcome-hero__text {
  margin-top: var(--s-4);
  color: var(--text-2);
  font-size: var(--fs-lg);
  line-height: 1.45;
}

/* Bande des illustrations des jeux */
.welcome-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
  gap: var(--s-2);
  margin-top: var(--s-6);
}

.welcome-strip .game-tile {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
}

.welcome-strip .game-tile svg {
  width: 62%;
  height: 62%;
}

.welcome-hero__actions {
  display: grid;
  gap: var(--s-2);
  margin-top: var(--s-6);
}

.welcome-feature {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: var(--s-3);
  padding: var(--s-4) 0;
  border-bottom: 1px solid var(--line);
}

.welcome-feature:last-child {
  border-bottom: 0;
}

.welcome-feature__icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-btn);
  color: var(--accent);
}

.welcome-feature__title {
  display: block;
  font-weight: 500;
}

.welcome-feature__text {
  display: block;
  margin-top: 2px;
  color: var(--text-2);
  font-size: var(--fs-base);
}

.welcome-game {
  border-bottom: 1px solid var(--line);
}

.welcome-game:last-child {
  border-bottom: 0;
}

.welcome-steps {
  margin-top: var(--s-3);
}

.welcome-steps .icon {
  vertical-align: -3px;
  color: var(--accent);
}

/* --- Présentation d'un jeu ----------------------------------------------- */

.intro-hero {
  padding: var(--s-4) 0 var(--s-6);
  border-bottom: 1px solid var(--line);
}

.intro-hero__category {
  margin-top: var(--s-5);
  color: var(--accent);
  font-size: var(--fs-sm);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.intro-hero__name {
  margin-top: var(--s-1);
  font-size: var(--fs-3xl);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.015em;
}

.intro-hero__tagline {
  margin-top: var(--s-3);
  color: var(--text-2);
  font-size: var(--fs-lg);
  line-height: 1.4;
}

.intro-facts {
  display: flex;
  gap: var(--s-6);
  margin-top: var(--s-5);
}

.intro-fact__label {
  color: var(--text-3);
  font-size: var(--fs-sm);
}

.intro-fact__value {
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.prose {
  color: var(--text-2);
  line-height: 1.55;
}

.steps {
  counter-reset: step;
}

.steps li {
  display: grid;
  grid-template-columns: 32px 1fr;
  padding: var(--s-3) 0;
  border-bottom: 1px solid var(--line);
  counter-increment: step;
}

.steps li:last-child {
  border-bottom: 0;
}

.steps li::before {
  content: counter(step, decimal-leading-zero);
  color: var(--accent);
  font-size: var(--fs-sm);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  line-height: 1.75;
}

/* --- Table Display ------------------------------------------------------- */
/*
   Le téléphone est posé à plat au centre de la table. Le même texte est
   affiché quatre fois, chaque copie orientée vers un côté :
   - bas  : lecture normale         - haut   : retourné (180°)
   - gauche : tourné de 90°         - droite : tourné de -90°
   Les zones latérales utilisent les unités de conteneur (cqw / cqh) pour
   échanger largeur et hauteur avant la rotation.
*/

.table-display {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  grid-template-areas:
    "top top top"
    "left center right"
    "bottom bottom bottom";
  grid-template-columns: 1fr 1.3fr 1fr;
  grid-template-rows: 1fr 1.3fr 1fr;
  max-width: var(--app-width);
  margin: 0 auto;
  background: var(--bg);
  padding: var(--safe-top) 0 var(--safe-bottom);
  user-select: none;
  -webkit-user-select: none;
}

/* Téléphone posé à plat qui bascule en paysage : on fait pivoter tout l'affichage
   de 90°. La disposition reste physiquement identique à celle du portrait ; le texte
   étant affiché dans les quatre orientations, chacun le lit toujours de sa place.
   (Limité aux écrans peu hauts pour ne pas pivoter sur un ordinateur.) */
@media (orientation: landscape) and (max-height: 600px) {
  .table-display {
    inset: auto;
    top: 50%;
    left: 50%;
    width: 100dvh;
    height: 100dvw;
    max-width: none;
    margin: 0;
    padding: var(--safe-top) var(--safe-bottom);
    transform: translate(-50%, -50%) rotate(-90deg);
  }
}

.td-zone {
  position: relative;
  overflow: hidden;
  container-type: size;
}

.td-zone--top { grid-area: top; border-bottom: 1px solid var(--line); }
.td-zone--bottom { grid-area: bottom; border-top: 1px solid var(--line); }
.td-zone--left { grid-area: left; border-right: 1px solid var(--line); }
.td-zone--right { grid-area: right; border-left: 1px solid var(--line); }

.td-zone__inner {
  position: absolute;
  top: 50%;
  left: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  width: 100cqw;
  height: 100cqh;
  padding: var(--s-3) var(--s-4);
  overflow: hidden;
  text-align: center;
  transform: translate(-50%, -50%);
}

.td-zone--top .td-zone__inner {
  transform: translate(-50%, -50%) rotate(180deg);
}

.td-zone--left .td-zone__inner,
.td-zone--right .td-zone__inner {
  width: 100cqh;
  height: 100cqw;
}

.td-zone--left .td-zone__inner {
  transform: translate(-50%, -50%) rotate(90deg);
}

.td-zone--right .td-zone__inner {
  transform: translate(-50%, -50%) rotate(-90deg);
}

.td-label {
  flex: none;
  color: var(--accent);
  font-size: var(--fs-sm);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.td-text {
  max-width: 100%;
  transition: none; /* la taille est mesurée immédiatement après chaque changement */
  font-weight: 500;
  line-height: 1.18;
  letter-spacing: -0.005em;
  overflow-wrap: normal;
  text-wrap: balance;
}

.td-center {
  grid-area: center;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: var(--s-3);
  min-width: 0;
  padding: var(--s-3);
}

/* Commandes au centre de la table (lues par l'organisateur) */
.td-counter {
  color: var(--text-3);
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.td-status {
  display: grid;
  place-items: center;
  align-content: center;
  gap: var(--s-2);
  min-height: 96px;
  text-align: center;
}

.td-status__label {
  color: var(--text-2);
  font-size: var(--fs-sm);
}

.td-progress {
  width: 100%;
  height: 3px;
  overflow: hidden;
  background: var(--line-strong);
}

.td-progress__bar {
  height: 100%;
  background: var(--accent);
  transform-origin: left;
  transition: transform 100ms linear;
}

.td-digit {
  color: var(--accent);
  font-size: 56px;
  font-weight: 500;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.td-done {
  color: var(--accent);
  font-size: var(--fs-lg);
  font-weight: 500;
  line-height: 1.2;
}

.td-done--danger {
  color: var(--danger);
}

.td-controls {
  display: flex;
  justify-content: center;
  gap: var(--s-2);
}

.td-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-btn);
  background: transparent;
  color: var(--text);
}

.td-icon-btn:active {
  background: var(--surface-2);
}

.td-icon-btn:disabled {
  opacity: 0.3;
}

.td-next {
  min-height: 64px;
}

.td-quit {
  align-self: center;
  min-height: 40px;
  padding: 0 var(--s-3);
  border: 0;
  background: none;
  color: var(--text-3);
  font-size: var(--fs-sm);
}

.table-display.is-changing .td-text {
  animation: td-text-in 260ms var(--ease);
}

@keyframes td-text-in {
  from {
    opacity: 0;
  }
}
