/**
 * Styles par écran — DueFon Flèche
 *
 * §9 du design system (wireframes). Mis à jour par M8 du delta v3
 * (Home en grid 2x2 + Winner avec CTA Atelier).
 */

/* === Home === */

.home {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: var(--s-5);
  padding-top: max(var(--s-5), calc(var(--safe-top) + var(--s-4)));
  padding-bottom: max(var(--s-5), calc(var(--safe-bottom) + var(--s-4)));
}

.home__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 44px;
  margin-bottom: var(--s-6);
}

.home__account {
  position: relative;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  border-radius: var(--r-sm);
  transition: background-color 120ms ease, color 120ms ease;
}

.home__account:active {
  background: var(--bg-surface);
}

.home__account--verified {
  color: var(--accent-red);
}

.home__account-check {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  background: var(--accent-green);
  border: 1.5px solid var(--bg-deep);
  border-radius: 50%;
}

.home__brand {
  text-align: center;
  margin: var(--s-7) 0;
}

.home__mark {
  width: 84px;
  height: 84px;
  margin: 0 auto var(--s-2);
  display: block;
  filter: drop-shadow(0 0 18px rgba(229, 9, 20, 0.45));
}

.home__title {
  font-family: var(--f-horror);
  font-size: clamp(44px, 16vw, 78px);
  letter-spacing: 0.005em;
  color: var(--accent-red);
  text-align: center;
  line-height: 1.05;
  margin: 0;
  /* Sang qui coule + halo cinéma + relief sombre */
  text-shadow:
    0 0 24px rgba(255, 43, 57, 0.7),
    0 0 48px rgba(229, 9, 20, 0.45),
    0 3px 0 var(--accent-red-dark),
    0 7px 18px rgba(0, 0, 0, 0.75);
  animation: horrorFlicker 6s linear infinite;
}

/* Flicker néon d'horreur — discret, désactivé si reduced-motion (cf. base.css) */
@keyframes horrorFlicker {
  0%, 100% { opacity: 1; }
  92% { opacity: 1; }
  93% { opacity: 0.55; }
  94% { opacity: 1; }
  96% { opacity: 0.7; }
  97% { opacity: 1; }
}

.home__tagline {
  font-family: var(--f-title);
  font-weight: 600;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.45em;
  color: var(--text-secondary);
  margin: var(--s-3) 0 0;
  padding-left: 0.45em; /* compense le letter-spacing pour centrer */
}

/* Ligne d'identité fixe (la promesse de marque, sous la tagline FR rotative) */
.home__promise {
  font-family: var(--f-body);
  font-size: 12px;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  text-align: center;
  margin: var(--s-2) 0 0;
}

.home__actions {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  margin-bottom: var(--s-7);
}

.home__games-link {
  font-family: var(--f-title);
  font-weight: 500;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-red);
  padding: var(--s-2);
  text-align: center;
}

.home__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-3);
  margin-top: auto; /* pousse la grille vers le bas */
}

/* === Join === */

.join {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: var(--s-5);
  padding-top: max(var(--s-5), calc(var(--safe-top) + var(--s-4)));
  padding-bottom: max(var(--s-5), calc(var(--safe-bottom) + var(--s-4)));
  gap: var(--s-5);
}

.join__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 44px;
}

.join__title {
  font-family: var(--f-title);
  font-size: 18px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.join__back,
.join__spacer {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: var(--text-secondary);
}

.join__hint {
  font-family: var(--f-body);
  font-size: 14px;
  color: var(--text-secondary);
  text-align: center;
  margin: 0;
}

.join__field {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

.join__field-label {
  font-family: var(--f-body);
  font-size: 13px;
  color: var(--text-secondary);
}

.join__input {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--s-3) var(--s-4);
  color: var(--text-primary);
  font-family: var(--f-display);
  font-size: 28px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  text-align: center;
  outline: none;
  min-height: 56px;
}

.join__input:focus {
  border-color: var(--accent-red);
}

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

.join__scan {
  display: flex;
  align-items: center;
  justify-content: center;
}

.join__or {
  text-align: center;
  font-family: var(--f-title);
  font-size: 13px;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin: 0;
}

/* === Mes parties === */

.games {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: var(--s-5);
  padding-top: max(var(--s-5), calc(var(--safe-top) + var(--s-4)));
  padding-bottom: max(var(--s-5), calc(var(--safe-bottom) + var(--s-4)));
  gap: var(--s-4);
}

.games__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 44px;
}

.games__title {
  font-family: var(--f-title);
  font-size: 18px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.games__back,
.games__spacer {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: var(--text-secondary);
}

.games__empty {
  font-family: var(--f-body);
  font-size: 14px;
  color: var(--text-muted);
  text-align: center;
  margin-top: var(--s-6);
}

.games__list {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

.games__footer {
  margin-top: auto;
}

/* === Historique & Classement (en-têtes communs) === */

.history,
.rankings {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: var(--s-5);
  padding-top: max(var(--s-5), calc(var(--safe-top) + var(--s-4)));
  padding-bottom: max(var(--s-5), calc(var(--safe-bottom) + var(--s-4)));
  gap: var(--s-4);
}

.history__header,
.rankings__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 44px;
}

.history__title,
.rankings__title {
  font-family: var(--f-title);
  font-size: 18px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.history__back,
.history__spacer,
.rankings__back,
.rankings__spacer {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: var(--text-secondary);
}

.history__empty,
.rankings__empty {
  font-family: var(--f-body);
  font-size: 14px;
  color: var(--text-muted);
  text-align: center;
  margin-top: var(--s-6);
}

/* Historique */
.history__list {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

.history-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--s-3) var(--s-4);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

.history-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.history-card__mode {
  font-family: var(--f-title);
  font-weight: 600;
  font-size: 16px;
  color: var(--accent-red);
}

.history-card__date {
  font-family: var(--f-body);
  font-size: 12px;
  color: var(--text-muted);
}

.history-card__players {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3);
}

.history-card__player {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  font-family: var(--f-body);
  font-size: 14px;
  color: var(--text-secondary);
}

.history-card__player--winner {
  color: var(--text-primary);
  font-weight: 600;
}

.history-card__comments-toggle {
  align-self: flex-start;
  font-family: var(--f-body);
  font-size: 13px;
  color: var(--accent-red);
  padding: var(--s-1) 0;
}

/* Classement */
.rankings__sub {
  font-family: var(--f-body);
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
  margin: 0;
}

.rankings__note {
  font-family: var(--f-body);
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  margin: 0;
}

.rankings__tabs {
  display: flex;
  gap: var(--s-2);
  overflow-x: auto;
}

.rankings__tab {
  flex: 1;
  font-family: var(--f-title);
  font-weight: 500;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--bg-raised);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: var(--s-2);
  min-height: 44px;
  cursor: pointer;
}

.rankings__tab--active {
  background: var(--accent-red);
  color: #fff;
  border-color: var(--accent-red);
}

.rankings__list {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

.rank-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--s-3) var(--s-4);
}

.rank-row__pos {
  font-size: 20px;
  width: 28px;
  text-align: center;
  flex-shrink: 0;
}

.rank-row__name {
  flex: 1;
  font-family: var(--f-title);
  font-weight: 500;
  font-size: 16px;
}

.rank-row__metric {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
}

.rank-row__rate {
  font-family: var(--f-display);
  font-size: 24px;
  color: var(--accent-red);
}

.rank-row__unit {
  font-family: var(--f-body);
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.rank-row__count {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  font-family: var(--f-body);
  font-size: 11px;
  color: var(--text-muted);
  min-width: 64px;
  text-align: right;
  white-space: nowrap;
  line-height: 1.2;
}

/* === Mes amis (feed social) === */

.friends {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: var(--s-5);
  padding-top: max(var(--s-5), calc(var(--safe-top) + var(--s-4)));
  padding-bottom: max(var(--s-5), calc(var(--safe-bottom) + var(--s-4)));
  gap: var(--s-4);
}

.friends__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 44px;
}

.friends__title {
  font-family: var(--f-title);
  font-size: 18px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.friends__back,
.friends__spacer {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: var(--text-secondary);
}

.friends__empty {
  font-family: var(--f-body);
  font-size: 14px;
  color: var(--text-muted);
  text-align: center;
  margin-top: var(--s-5);
  line-height: 1.5;
}

/* Identité sociale */
.friends__identity {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  background: var(--bg-surface);
  border: 1px solid var(--accent-red);
  border-radius: var(--r-md);
  padding: var(--s-3) var(--s-4);
}

.friends__identity-label {
  font-family: var(--f-body);
  font-size: 12px;
  color: var(--text-secondary);
}

.friends__identity-row {
  display: flex;
  gap: var(--s-2);
}

.friends__identity-input {
  flex: 1;
  min-width: 0;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: var(--s-2) var(--s-3);
  color: var(--text-primary);
  font-family: var(--f-body);
  font-size: 16px;
  outline: none;
}

.friends__identity-input:focus {
  border-color: var(--accent-red);
}

.friends__identity-save {
  background: var(--accent-red);
  color: #fff;
  border-radius: var(--r-sm);
  padding: 0 var(--s-4);
  min-height: 40px;
  font-family: var(--f-title);
  font-weight: 600;
}

.friends__whoami {
  font-family: var(--f-body);
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
  margin: 0;
}

.friends__edit {
  color: var(--accent-red);
  font-family: var(--f-body);
  font-size: 13px;
  text-decoration: underline;
}

/* Bandeau vérification (non bloquant) */
.friends__verify-banner {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  width: 100%;
  text-align: left;
  background: var(--bg-surface);
  border: 1px solid var(--accent-red);
  border-radius: var(--r-md);
  padding: var(--s-3) var(--s-4);
  box-shadow: var(--glow-red);
}

.friends__verify-badge {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--accent-red);
  color: #fff;
  font-size: 16px;
}

.friends__verify-text {
  flex: 1;
  font-family: var(--f-body);
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.35;
}

.friends__verify-cta {
  flex-shrink: 0;
  font-family: var(--f-title);
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent-red);
}

.friends__section {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}

.friends__section-title {
  font-family: var(--f-title);
  font-weight: 600;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin: var(--s-2) 0 0;
}

.friends__section-empty {
  font-family: var(--f-body);
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
}

/* Cartes de groupe (Mes groupes) */
.group-list {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

.group-card {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--s-4);
}

.group-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
}

.group-card__name {
  font-family: var(--f-title);
  font-weight: 600;
  font-size: 17px;
  color: var(--text-primary);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-card__tools {
  display: flex;
  gap: var(--s-1);
  flex-shrink: 0;
}

.group-card__tool {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-sm);
  color: var(--text-muted);
  font-size: 15px;
}

.group-card__tool:active {
  background: var(--bg-raised);
}

.group-card__actions {
  display: flex;
  gap: var(--s-2);
  flex-wrap: wrap;
}

.group-card__btn {
  flex: 1;
  min-width: 92px;
  font-family: var(--f-title);
  font-weight: 500;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--bg-raised);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: var(--s-2);
  min-height: 40px;
}

.group-card__btn--primary {
  background: var(--accent-red);
  border-color: var(--accent-red);
  color: #fff;
}

.group-card__games {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  padding-top: var(--s-2);
  border-top: 1px solid var(--border);
}

/* Membres du groupe (afficher / retirer) */
.group-card__members {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  padding-top: var(--s-2);
  border-top: 1px solid var(--border);
}
.member-row {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  min-height: 40px;
}
.member-row__name {
  font-family: var(--f-title);
  font-weight: 500;
  font-size: 15px;
  margin-right: auto;
}
.member-row__del {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
}
.member-row__del:active { color: var(--accent-red); }
.group-card__members-note {
  font-family: var(--f-body);
  font-size: 11px;
  color: var(--text-muted);
  margin: var(--s-1) 0 0;
}

.group-game-wrap {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

.group-game {
  display: flex;
  align-items: baseline;
  gap: var(--s-2);
  width: 100%;
  text-align: left;
  font-family: var(--f-body);
  font-size: 13px;
  color: var(--text-secondary);
  padding: var(--s-1) 0;
}

.group-game__mode {
  font-family: var(--f-title);
  font-weight: 600;
  font-size: 13px;
  color: var(--accent-red);
  flex-shrink: 0;
}

.group-game__line {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-game__chat {
  flex-shrink: 0;
  font-size: 12px;
  color: var(--text-muted);
}

.friends__tabs {
  display: flex;
  gap: var(--s-2);
}

.friends__tab {
  flex: 1;
  font-family: var(--f-title);
  font-weight: 500;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--bg-raised);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: var(--s-2);
  min-height: 44px;
}

.friends__tab--active {
  background: var(--accent-red);
  color: #fff;
  border-color: var(--accent-red);
}

/* Feed */
.feed {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}

.feed-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--s-4);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

.feed-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.feed-card__mode {
  font-family: var(--f-title);
  font-weight: 600;
  font-size: 15px;
  color: var(--accent-red);
}

.feed-card__date {
  font-family: var(--f-body);
  font-size: 12px;
  color: var(--text-muted);
}

.feed-card__line {
  font-family: var(--f-body);
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.4;
}

.feed-card__line strong {
  color: var(--text-primary);
}

.feed-card__actions {
  display: flex;
  gap: var(--s-3);
  margin-top: var(--s-1);
}

.feed-action {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-2) var(--s-3);
  min-height: 40px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--f-title);
  font-weight: 500;
  font-size: 14px;
  transition: color 120ms ease, border-color 120ms ease, background 120ms ease, transform 80ms ease;
}

.feed-action:active {
  transform: scale(0.94);
}

.feed-action--on {
  color: #fff;
  background: var(--accent-red);
  border-color: var(--accent-red);
  box-shadow: var(--glow-red);
}

/* Commentaires */
.feed-card__comments {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  margin-top: var(--s-2);
  padding-top: var(--s-3);
  border-top: 1px solid var(--border);
}

/* Fil de commentaires réutilisable (GameComments) */
.game-comments {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  width: 100%;
  text-align: left;
}

.comment {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  font-family: var(--f-body);
  font-size: 14px;
  line-height: 1.4;
}

.comment__author {
  font-weight: 600;
  color: var(--accent-red);
}

.comment__text {
  color: var(--text-primary);
}

.comment__empty {
  font-family: var(--f-body);
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
}

.comment__form {
  display: flex;
  gap: var(--s-2);
  margin-top: var(--s-1);
}

.comment__input {
  flex: 1;
  min-width: 0;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: var(--s-2) var(--s-3);
  color: var(--text-primary);
  font-family: var(--f-body);
  font-size: 15px;
  outline: none;
}

.comment__input:focus {
  border-color: var(--accent-red);
}

.comment__send {
  background: var(--accent-red);
  color: #fff;
  border-radius: var(--r-sm);
  padding: 0 var(--s-3);
  min-height: 40px;
  font-family: var(--f-title);
  font-weight: 500;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* === Stats (mini tableau de bord) === */

.stats {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: var(--s-5);
  padding-top: max(var(--s-5), calc(var(--safe-top) + var(--s-4)));
  padding-bottom: max(var(--s-5), calc(var(--safe-bottom) + var(--s-4)));
  gap: var(--s-4);
}

.stats__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 44px;
}

.stats__title {
  font-family: var(--f-title);
  font-size: 18px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stats__back,
.stats__spacer {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: var(--text-secondary);
}

.stats__msg {
  font-family: var(--f-body);
  font-size: 14px;
  color: var(--text-muted);
  text-align: center;
  margin-top: var(--s-6);
}

.stats__top {
  display: flex;
  gap: var(--s-3);
}

.stat-tile {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-1);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s-4);
}

.stat-tile__num {
  font-family: var(--f-display);
  font-size: 40px;
  color: var(--accent-red);
  line-height: 1;
}

.stat-tile__lbl {
  font-family: var(--f-body);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.stats__list {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

.stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--s-3) var(--s-4);
}

.stat-row__name {
  font-family: var(--f-body);
  font-size: 15px;
  color: var(--text-primary);
}

.stat-row__count {
  font-family: var(--f-display);
  font-size: 22px;
  color: var(--accent-red);
}

.stats__section-title {
  font-family: var(--f-title);
  font-weight: 600;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin: var(--s-3) 0 0;
}

.mode-stat {
  font-family: var(--f-body);
  font-size: 14px;
  color: var(--text-secondary);
}

.settings__stats-link {
  font-family: var(--f-body);
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
  padding: var(--s-2);
  margin-top: var(--s-2);
}

/* === Admin (/daremin) === */

.admin {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: var(--s-5);
  padding-top: max(var(--s-5), calc(var(--safe-top) + var(--s-4)));
  padding-bottom: max(var(--s-5), calc(var(--safe-bottom) + var(--s-4)));
  gap: var(--s-4);
}

.admin__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 44px;
}

.admin__title {
  font-family: var(--f-display);
  font-size: 22px;
  letter-spacing: 0.1em;
  color: var(--accent-red);
}

.admin__version {
  min-width: 44px;
  text-align: right;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.admin__back,
.admin__spacer {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: var(--text-secondary);
}

.admin__msg {
  font-family: var(--f-body);
  font-size: 14px;
  color: var(--text-muted);
  text-align: center;
  margin: var(--s-3) 0;
}

.admin__gate {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-3);
  background: var(--bg-surface);
  border: 1px solid var(--accent-red);
  border-radius: var(--r-lg);
  padding: var(--s-6);
  text-align: center;
  margin-top: var(--s-5);
}

.admin__gate-title {
  font-family: var(--f-title);
  font-weight: 600;
  font-size: 20px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.admin__gate-text {
  font-family: var(--f-body);
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}

.admin__gate-text code {
  font-family: var(--f-display);
  color: var(--accent-red);
}

.admin__uid {
  font-family: ui-monospace, monospace;
  font-size: 13px;
  color: var(--text-primary);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: var(--s-3);
  width: 100%;
  word-break: break-all;
  cursor: pointer;
}

.admin__section {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

.admin__section-title {
  font-family: var(--f-title);
  font-weight: 600;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin: var(--s-3) 0 0;
}

.admin__hint {
  font-family: var(--f-body);
  font-size: 11px;
  color: var(--text-muted);
  margin: var(--s-1) 0 var(--s-2);
}

/* Journal des events (audit) */
.event-log { display: flex; flex-direction: column; }
.event-log__row {
  display: flex;
  align-items: baseline;
  gap: var(--s-2);
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-family: var(--f-body);
  font-size: 12px;
}
.event-log__time { color: var(--text-muted); font-variant-numeric: tabular-nums; flex: none; width: 96px; }
.event-log__name { color: var(--text-primary); font-weight: 600; flex: 1; }
.event-log__params { color: var(--text-secondary); font-weight: 400; }
.event-log__meta { color: var(--text-muted); flex: none; text-align: right; }

.admin__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-2);
}

.admin-item {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--s-3) var(--s-4);
}

.admin-item__info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.admin-item__name {
  font-family: var(--f-title);
  font-weight: 500;
  font-size: 15px;
  color: var(--text-primary);
}

.admin-item__sub {
  font-family: var(--f-body);
  font-size: 13px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-item__del {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
}

.admin-item__del:active {
  background: var(--accent-red);
  color: #fff;
}

/* Tendances (graphes admin) */
.trend-chips {
  display: flex;
  gap: var(--s-2);
  flex-wrap: wrap;
}

.trend-chip {
  font-family: var(--f-title);
  font-weight: 500;
  font-size: 13px;
  background: var(--bg-raised);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: var(--s-2) var(--s-3);
  min-height: 36px;
}

.trend-chip--on {
  background: var(--accent-red);
  color: #fff;
  border-color: var(--accent-red);
}

.trend-head {
  display: flex;
  align-items: baseline;
  gap: var(--s-3);
  margin-top: var(--s-2);
}

.trend-total {
  font-family: var(--f-display);
  font-size: 36px;
  color: var(--text-primary);
  line-height: 1;
}

.trend-delta {
  font-family: var(--f-title);
  font-weight: 600;
  font-size: 15px;
}

.trend-delta--up { color: var(--accent-green); }
.trend-delta--down { color: var(--accent-red-bright); }
.trend-delta--flat { color: var(--text-muted); }

.trend-prev {
  font-family: var(--f-body);
  font-size: 12px;
  color: var(--text-muted);
  margin-left: auto;
}

.trend-chart {
  width: 100%;
  height: 130px;
  display: block;
  margin-top: var(--s-2);
}

.trend-legend {
  font-family: var(--f-body);
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  margin: var(--s-1) 0 0;
}

.trend-legend__cur { color: var(--accent-red); }
.trend-legend__prev { color: var(--text-muted); }

/* === Cricket === */

.cricket {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
}

.cricket__board {
  padding: var(--s-3) var(--s-4);
}

.cricket__row {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border);
}

.cricket__row--head {
  border-bottom: 1px solid var(--accent-red);
}

.cricket__row--scores {
  border-bottom: none;
  border-top: 1px solid var(--accent-red);
  margin-top: var(--s-1);
}

.cricket__target {
  width: 56px;
  flex-shrink: 0;
  font-family: var(--f-display);
  font-size: 22px;
  color: var(--accent-red);
  padding: var(--s-2) 0;
}

.cricket__phead {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-family: var(--f-title);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  padding: var(--s-2) 0;
}

.cricket__cell {
  flex: 1;
  text-align: center;
  font-size: 24px;
  line-height: 1;
  color: var(--text-primary);
  padding: var(--s-2) 0;
  min-height: 40px;
}

.cricket__cell--closed {
  color: var(--accent-red);
  text-shadow: var(--glow-red);
}

.cricket__score {
  flex: 1;
  text-align: center;
  font-family: var(--f-display);
  font-size: 26px;
  color: var(--text-primary);
  padding: var(--s-2) 0;
}

.cricket__col--current {
  background: rgba(229, 9, 20, 0.1);
}

.cricket__turn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  padding: var(--s-2) var(--s-4);
  font-family: var(--f-body);
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: auto;
}

.cricket__turn strong {
  color: var(--text-primary);
  font-family: var(--f-title);
  font-weight: 600;
}

/* === GameSetup === */

.setup {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: var(--s-5);
  padding-top: max(var(--s-5), calc(var(--safe-top) + var(--s-4)));
  padding-bottom: max(var(--s-5), calc(var(--safe-bottom) + var(--s-4)));
  gap: var(--s-5);
}

.setup__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 44px;
}

.setup__title {
  font-family: var(--f-title);
  font-size: 18px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.setup__back,
.setup__spacer {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: var(--text-secondary);
}

.setup__section {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}

.setup__label {
  font-family: var(--f-body);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.setup__modes {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s-2);
}

.setup__mode {
  font-family: var(--f-title);
  font-weight: 500;
  font-size: 16px;
  background: var(--bg-raised);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  min-height: 56px;
  cursor: pointer;
  transition: background 80ms ease, color 80ms ease;
}

.setup__mode--active {
  background: var(--accent-red);
  color: var(--text-primary);
  border-color: var(--accent-red);
  box-shadow: 0 2px 8px rgba(230, 57, 70, 0.4);
}

.setup__mode--disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.setup__empty {
  font-family: var(--f-body);
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
}

.setup__venue-name { margin-top: var(--s-3); width: 100%; }
.setup__venue-hint {
  font-family: var(--f-body);
  font-size: 12px;
  color: var(--text-muted);
  margin: var(--s-2) 0 0;
}

/* Bouton « M'ajouter » mis en avant (#5) */
.setup__me {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  width: 100%;
  min-height: 48px;
  margin-bottom: var(--s-3);
  padding: var(--s-2) var(--s-3);
  background: var(--bg-surface);
  border: 1.5px dashed var(--accent-red);
  border-radius: var(--r-md);
  color: var(--accent-red);
  font-family: var(--f-title);
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: background 80ms ease, border-color 80ms ease;
}

.setup__me--on {
  border-style: solid;
  background: var(--accent-red);
  color: var(--text-primary);
}

.setup__me-ic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: currentColor;
  color: var(--bg-deep);
  font-weight: 700;
  flex: none;
}

/* Chips d'amis sélectionnables */
.setup__friends {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}

.friend-chip--me {
  border-color: var(--accent-red);
}

/* === Bandeau ordre de tour en partie (#6) === */
.turn-order {
  margin: var(--s-2) 0;
  padding: var(--s-2) var(--s-3);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.turn-order__now {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: var(--s-2);
}
.turn-order__badge {
  font-family: var(--f-body);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent-red);
}
.turn-order__name {
  font-family: var(--f-title);
  font-weight: 700;
  font-size: 16px;
  color: var(--text-primary);
}
.turn-order__sep { color: var(--text-muted); }
.turn-order__team {
  font-family: var(--f-body);
  font-size: 13px;
  color: var(--text-secondary);
}
.turn-order__strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.turn-order__chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  background: var(--bg-raised);
  border: 1px solid transparent;
  border-radius: 999px;
  white-space: nowrap;
  flex: none;
}
.turn-order__chip--on {
  border-color: var(--accent-red);
  background: rgba(229, 9, 20, 0.12);
}
.turn-order__dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: none;
}
.turn-order__chip-name {
  font-family: var(--f-title);
  font-weight: 600;
  font-size: 13px;
}
.turn-order__chip-team {
  font-family: var(--f-body);
  font-size: 11px;
  color: var(--text-muted);
}
.cricket__turn-team {
  color: var(--text-secondary);
  font-weight: 400;
}

/* === Format équipes (#4) === */
.setup__teamcount {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin-top: var(--s-3);
}
.setup__teamcount-lbl {
  font-family: var(--f-body);
  font-size: 13px;
  color: var(--text-secondary);
  margin-right: auto;
}
.setup__step {
  width: 40px;
  height: 40px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-family: var(--f-title);
  font-weight: 600;
  cursor: pointer;
}
.setup__step--active {
  background: var(--accent-red);
  border-color: var(--accent-red);
}

.setup__assign {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  margin-top: var(--s-3);
}
.assign-row {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-2) var(--s-3);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.assign-row__name {
  font-family: var(--f-title);
  font-weight: 500;
  font-size: 15px;
  margin-right: auto;
}
.assign-row__teams {
  display: flex;
  gap: 6px;
}
.assign-chip {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-raised);
  color: var(--text-secondary);
  font-family: var(--f-title);
  font-weight: 700;
  cursor: pointer;
  transition: background 80ms ease, color 80ms ease, border-color 80ms ease;
}
.assign-chip--on { color: #fff; border-color: transparent; }
.assign-chip--c1 { background: var(--p1); }
.assign-chip--c2 { background: var(--p2); }
.assign-chip--c3 { background: var(--p3); }

.setup__order {
  margin-top: var(--s-3);
  padding: var(--s-3);
  background: var(--bg-surface);
  border: 1px dashed var(--border);
  border-radius: var(--r-md);
}
.setup__order-lbl {
  display: block;
  font-family: var(--f-body);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: var(--s-2);
}
.setup__order-teams {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.order-team {
  display: flex;
  align-items: center;
  gap: var(--s-2);
}
.order-team__dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex: none;
}
.order-team__name {
  font-family: var(--f-title);
  font-weight: 600;
  font-size: 14px;
}
.order-team__members {
  font-family: var(--f-body);
  font-size: 12px;
  color: var(--text-secondary);
  margin-left: auto;
}

/* === Salle d'attente / invitation (#join) === */
.setup__invite {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-red);
  background: none;
  border: none;
  cursor: pointer;
}
.setup__invite-hint {
  font-family: var(--f-body);
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg-surface);
  border: 1px dashed var(--border);
  border-radius: var(--r-md);
  padding: var(--s-2) var(--s-3);
  margin: 0 0 var(--s-3);
}
.setup__invite-hint strong { color: var(--accent-red); font-family: var(--f-title); letter-spacing: 0.08em; }

.lobby { padding: 0 var(--s-4) var(--s-6); }
.lobby__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 44px;
  margin-bottom: var(--s-4);
}
.lobby__back {
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; color: var(--text-primary);
  background: none; border: none; cursor: pointer;
}
.lobby__title { font-family: var(--f-display); font-size: 22px; letter-spacing: 0.04em; }
.lobby__spacer { width: 44px; }
.lobby__msg { font-family: var(--f-body); color: var(--text-muted); text-align: center; margin-top: var(--s-6); }
.lobby__code { font-family: var(--f-body); color: var(--text-secondary); text-align: center; margin: 0 0 var(--s-4); }
.lobby__code strong { color: var(--accent-red); font-family: var(--f-title); letter-spacing: 0.12em; font-size: 18px; }
.lobby__section { margin-bottom: var(--s-5); }
.lobby__label {
  font-family: var(--f-title); font-weight: 600; font-size: 14px;
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-secondary);
  margin: 0 0 var(--s-2);
}
.lobby__hint { font-family: var(--f-body); font-size: 13px; color: var(--text-muted); margin: 0 0 var(--s-3); }
.lobby__roster { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-bottom: var(--s-3); }
.lobby__full {
  font-family: var(--f-body); font-size: 13px; color: var(--text-secondary);
  background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--r-md);
  padding: var(--s-2) var(--s-3); margin: var(--s-2) 0 0;
}
.lobby__full strong { color: var(--accent-red); }
.lobby__waiting {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--f-title); font-size: 15px; color: var(--text-secondary);
  margin-top: var(--s-5); padding: var(--s-3);
  background: var(--bg-surface); border-radius: var(--r-md);
}

.friend-chip__me-tag {
  margin-left: 6px;
  padding: 1px 6px;
  font-family: var(--f-body);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent-red);
  background: rgba(229, 9, 20, 0.14);
  border-radius: 999px;
  vertical-align: middle;
}

.friend-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-2) var(--s-3);
  min-height: 44px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-primary);
  cursor: pointer;
  transition: background 80ms ease, border-color 80ms ease;
}

.friend-chip--selected {
  background: var(--bg-raised);
  border-color: var(--accent-red);
}

.friend-chip__name {
  font-family: var(--f-title);
  font-weight: 500;
  font-size: 15px;
}

.friend-chip__order {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-red);
  color: var(--text-primary);
  font-family: var(--f-body);
  font-size: 12px;
}

.setup__add-row {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin-top: var(--s-3);
  padding: var(--s-2) var(--s-3);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}

.setup__add-btn {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  background: var(--accent-red);
  color: var(--text-primary);
  border-radius: var(--r-sm);
}

.setup__add-btn:disabled {
  opacity: 0.4;
}

.setup__input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--f-body);
  font-size: 16px;
  min-width: 0;
}

/* Liste d'amis dans Réglages */
.settings__friends-list {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

.settings__friend {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}

.settings__friend-name {
  flex: 1;
  font-family: var(--f-body);
  font-size: 16px;
}

.setup__input::placeholder {
  color: var(--text-muted);
}

.setup__remove {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--text-muted);
  border-radius: 50%;
}

.setup__remove:active {
  background: var(--bg-raised);
}

.setup__add {
  font-family: var(--f-title);
  font-weight: 500;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: transparent;
  color: var(--accent-red);
  border: 1px dashed var(--border);
  border-radius: var(--r-md);
  padding: var(--s-3);
  min-height: 44px;
  cursor: pointer;
}

.setup__toggle {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  cursor: pointer;
}

.setup__toggle-input {
  width: 20px;
  height: 20px;
  accent-color: var(--accent-red);
}

.setup__toggle-label {
  font-family: var(--f-title);
  font-weight: 500;
  font-size: 16px;
}

.setup__toggle-hint {
  margin-left: auto;
  font-family: var(--f-body);
  font-size: 12px;
  color: var(--text-muted);
}

.setup__cta {
  margin-top: auto;
}

/* === Ambiance === */

.ambiance {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: var(--s-5);
  padding-top: max(var(--s-5), calc(var(--safe-top) + var(--s-4)));
  padding-bottom: max(var(--s-5), calc(var(--safe-bottom) + var(--s-4)));
  gap: var(--s-4);
}

.ambiance__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 44px;
}

.ambiance__title {
  font-family: var(--f-title);
  font-size: 18px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ambiance__back,
.ambiance__spacer {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: var(--text-secondary);
}

.ambiance__intro {
  font-family: var(--f-body);
  font-size: 14px;
  color: var(--text-secondary);
  text-align: center;
  margin: 0 0 var(--s-3);
}

.ambiance__list {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}

.ambiance__preset {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--s-1);
  padding: var(--s-4) var(--s-5);
  min-height: 88px;
  background: var(--bg-raised);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  cursor: pointer;
  text-align: left;
  transition: transform 80ms ease, background 80ms ease;
}

.ambiance__preset:active {
  transform: scale(0.98);
}

.ambiance__preset--active {
  background: var(--accent-red);
  border-color: var(--accent-red);
  box-shadow: var(--sh-btn);
}

.ambiance__preset-emoji {
  font-size: 28px;
  line-height: 1;
}

.ambiance__preset-label {
  font-family: var(--f-title);
  font-weight: 600;
  font-size: 20px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ambiance__preset-desc {
  font-family: var(--f-body);
  font-size: 13px;
  color: var(--text-secondary);
}

.ambiance__preset--active .ambiance__preset-desc {
  color: rgba(255, 255, 255, 0.85);
}

.ambiance__last {
  margin-top: auto;
  text-align: center;
  font-family: var(--f-body);
  font-size: 12px;
  color: var(--text-muted);
}

/* === Settings === */

.settings {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: var(--s-5);
  padding-top: max(var(--s-5), calc(var(--safe-top) + var(--s-4)));
  padding-bottom: max(var(--s-5), calc(var(--safe-bottom) + var(--s-4)));
  gap: var(--s-5);
}

.settings__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 44px;
}

.settings__title {
  font-family: var(--f-title);
  font-size: 18px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.settings__back,
.settings__spacer {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: var(--text-secondary);
}

.settings__section {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}

.settings__label {
  font-family: var(--f-body);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.settings__offline {
  font-family: var(--f-body);
  font-size: 13px;
  color: var(--accent-gold);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--s-3);
}

/* Carte compte (vérification) */
.account-card {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--s-4);
}

.account-card--ok {
  border-color: var(--accent-green);
}

.account-card__row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
}

.account-card__badge {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 20px;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.account-card--ok .account-card__badge {
  color: #fff;
  background: var(--accent-green);
  border-color: var(--accent-green);
}

.account-card__info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.account-card__status {
  font-family: var(--f-title);
  font-weight: 600;
  font-size: 16px;
}

.account-card__email {
  font-family: var(--f-body);
  font-size: 12px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-card__hint {
  font-family: var(--f-body);
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

.account-name-row {
  display: flex;
  gap: var(--s-2);
}

.account-name-save {
  flex-shrink: 0;
  background: var(--accent-red);
  color: #fff;
  border-radius: var(--r-sm);
  padding: 0 var(--s-4);
  min-height: 48px;
  font-family: var(--f-title);
  font-weight: 600;
}

.settings__admin-note {
  font-family: var(--f-body);
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  margin: var(--s-2) 0 0;
}

.settings__version {
  font-family: var(--f-body);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  opacity: 0.6;
  text-align: center;
  margin: var(--s-4) 0 var(--s-2);
  font-variant-numeric: tabular-nums;
}

/* Navigation par sections (hub Compte) */
.account-nav {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

.account-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  width: 100%;
  text-align: left;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--s-4);
  min-height: 56px;
  transition: border-color 120ms ease, background 120ms ease;
}

.account-row:active {
  border-color: var(--accent-red);
  background: var(--bg-raised);
}

.account-row__ic {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  stroke: var(--accent-red);
  fill: none;
}

.account-row__lbl {
  flex: 1;
  font-family: var(--f-title);
  font-weight: 500;
  font-size: 16px;
  color: var(--text-primary);
}

.account-row__chev {
  flex-shrink: 0;
  font-size: 22px;
  color: var(--text-muted);
}

.account-row--minor {
  margin-top: var(--s-2);
  background: transparent;
}

.account-row--minor .account-row__ic { stroke: var(--text-muted); }
.account-row--minor .account-row__lbl { font-size: 14px; color: var(--text-secondary); }

.settings__group-card {
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s-5);
}

.settings__group-label {
  font-family: var(--f-body);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.settings__group-code {
  font-family: var(--f-display);
  font-size: 48px;
  letter-spacing: 0.1em;
  color: var(--accent-gold);
}

.settings__group-hint {
  font-family: var(--f-body);
  font-size: 12px;
  color: var(--text-secondary);
  text-align: center;
}

.qr-share {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-2);
  margin-top: var(--s-4);
}

.qr-share__img {
  width: 200px;
  height: 200px;
  border-radius: var(--r-md);
  background: var(--text-primary);
}

.qr-share__hint,
.qr-share__loading,
.qr-share__error {
  font-family: var(--f-body);
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
}

.settings__field {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

.settings__field-label {
  font-family: var(--f-body);
  font-size: 13px;
  color: var(--text-secondary);
}

.settings__input {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--s-3) var(--s-4);
  color: var(--text-primary);
  font-family: var(--f-body);
  font-size: 16px;
  outline: none;
  min-height: 48px;
}

.settings__input:focus {
  border-color: var(--accent-red);
}

.settings__input--code {
  font-family: var(--f-display);
  font-size: 24px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  text-align: center;
}

/* === GameX01 === */

.gameX01 {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
  position: relative;
}

.gameX01__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--border);
}

.gameX01__btn-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--text-secondary);
  border-radius: var(--r-sm);
  cursor: pointer;
}

.gameX01__btn-icon:active:not(:disabled) {
  background: var(--bg-surface);
}

.gameX01__btn-icon:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.gameX01__center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.gameX01__mode {
  font-family: var(--f-title);
  font-weight: 500;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.gameX01__ambiance {
  font-family: var(--f-body);
  font-size: 11px;
  color: var(--text-secondary);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px var(--s-2);
  cursor: pointer;
  line-height: 1.2;
}

.gameX01__ambiance:active {
  background: var(--bg-raised);
}

.gameX01__sync-dot {
  width: 6px;
  height: 6px;
  margin-left: 4px;
  vertical-align: middle;
}

.gameX01__eye {
  font-size: 18px;
  opacity: 0.7;
}

.gameX01__viewer-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--s-3);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--accent-blue);
  color: var(--text-secondary);
  font-family: var(--f-body);
  font-size: 13px;
  padding: var(--s-3) var(--s-4);
  text-align: center;
}

.gameX01__take-scoring {
  font-family: var(--f-title);
  font-weight: 500;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--accent-blue);
  color: var(--text-primary);
  border-radius: var(--r-sm);
  padding: var(--s-2) var(--s-3);
  min-height: 36px;
  cursor: pointer;
}

.gameX01__current {
  padding: var(--s-4);
  flex-shrink: 0;
}

.gameX01__turn-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin-top: var(--s-3);
  flex-wrap: wrap;
}

.gameX01__turn-score {
  font-family: var(--f-title);
  font-weight: 500;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-red);
}

.gameX01__throw-slots {
  display: flex;
  gap: var(--s-2);
}

.gameX01__throw-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 28px;
  padding: 0 var(--s-2);
  border-radius: var(--r-sm);
  font-family: var(--f-title);
  font-size: 13px;
  background: var(--bg-raised);
  color: var(--text-muted);
}

.gameX01__throw-slot--filled {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--accent-red);
}

.gameX01__end-turn {
  margin-left: auto;
  font-family: var(--f-title);
  font-weight: 500;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--bg-raised);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: var(--s-2) var(--s-3);
  min-height: 36px;
  cursor: pointer;
}

.gameX01__end-turn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.gameX01__others {
  display: flex;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  flex-shrink: 0;
}

.gameX01__others .player-card {
  flex: 1;
  min-width: 120px;
  padding: var(--s-2);
}

/* Bust flash */
.bust-flash {
  position: fixed;
  inset: 0;
  background: var(--accent-red);
  z-index: 999;
  animation: bustFlash 600ms ease-out;
  pointer-events: none;
}

@keyframes bustFlash {
  0% { opacity: 0; }
  20% { opacity: 0.85; }
  100% { opacity: 0; }
}

/* === Winner === */

.winner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: var(--s-5);
  padding-top: max(var(--s-6), var(--safe-top));
  padding-bottom: max(var(--s-5), var(--safe-bottom));
  gap: var(--s-4);
  text-align: center;
  overflow-y: auto;
}

/* Quand le fil de commentaires est présent, on aère depuis le haut. */
.winner:has(.winner__comments) {
  justify-content: flex-start;
}

.winner__trophy {
  font-size: 96px;
  line-height: 1;
}

.winner__name {
  font-family: var(--f-display);
  font-size: 56px;
  color: var(--text-primary);
  margin: 0;
  letter-spacing: 0.02em;
}

.winner__members {
  font-family: var(--f-title);
  font-weight: 600;
  font-size: 18px;
  color: var(--text-secondary);
  margin: var(--s-1) 0 0;
}

.winner__label {
  font-family: var(--f-title);
  font-size: 24px;
  color: var(--accent-gold);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin: 0;
}

.winner__stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-4);
  margin: var(--s-5) 0;
  width: 100%;
}

.winner__stat {
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
}

.winner__stat dt {
  font-family: var(--f-body);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.winner__stat dd {
  font-family: var(--f-display);
  font-size: 32px;
  color: var(--text-primary);
  margin: 0;
}

.winner__comments {
  width: 100%;
  margin-top: var(--s-5);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}

.winner__comments-title {
  font-family: var(--f-title);
  font-weight: 600;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  text-align: left;
}

.winner__cta {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  margin-top: var(--s-5);
}
