/* ==========================================================================
   Écrans de partie : configuration, distribution secrète, manches, résultats
   ========================================================================== */

/* --- Textes courants ----------------------------------------------------- */

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

.lead--top {
  margin-top: var(--s-4);
}

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

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

.screen-title {
  margin-top: var(--s-6);
  font-size: var(--fs-xl);
  font-weight: 500;
  line-height: 1.25;
}

.result-title {
  margin-top: var(--s-2);
  font-size: var(--fs-2xl);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.center-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-bottom: var(--s-10);
}

.subsection-title {
  margin-top: var(--s-5);
  padding-bottom: var(--s-1);
  color: var(--text-3);
  font-size: var(--fs-sm);
  font-weight: 500;
}

.field-hint {
  margin-top: var(--s-3);
  color: var(--text-2);
  font-size: var(--fs-sm);
}

.input--large {
  min-height: 56px;
  font-size: var(--fs-lg);
}

/* --- Étiquettes ---------------------------------------------------------- */

.tag {
  display: inline-flex;
  align-items: center;
  flex: none;
  min-height: 24px;
  padding: 0 var(--s-2);
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: 500;
  white-space: nowrap;
}

.tag--accent {
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  color: var(--accent);
}

.tag--success {
  border-color: color-mix(in srgb, var(--success) 55%, transparent);
  color: var(--success);
}

.tag--danger {
  border-color: color-mix(in srgb, var(--danger) 55%, transparent);
  color: var(--danger);
}

/* --- Pied de page empilé (message + bouton) ------------------------------ */

.screen__footer--stack {
  flex-direction: column;
  gap: var(--s-2);
}

.footer-hint {
  color: var(--text-2);
  font-size: var(--fs-sm);
  text-align: center;
}

.footer-hint.is-error {
  color: var(--danger);
}

/* --- Saisie des joueurs -------------------------------------------------- */

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

.player-add .input {
  flex: 1;
}

.player-add__btn {
  width: 48px;
  padding: 0;
}

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

.player-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-height: 52px;
  border-bottom: 1px solid var(--line);
}

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

.player-row__index {
  width: 20px;
  color: var(--text-3);
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
}

.player-row__name {
  flex: 1;
  min-height: 48px;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-row.is-editing {
  padding: var(--s-1) 0;
}

.player-row__input {
  flex: 1;
}

/* --- Bibliothèques ------------------------------------------------------- */

.library-toolbar {
  display: grid;
  justify-items: start;
  gap: var(--s-2);
  margin-top: var(--s-5);
}

.library-toolbar .input {
  justify-self: stretch;
}

.panel-actions--start {
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: var(--s-2);
}

/* --- Choix des mots ------------------------------------------------------ */

.word-panel {
  margin-top: var(--s-4);
}

.panel-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: var(--s-3);
}

.word-panel--fields {
  display: grid;
  gap: var(--s-4);
}

/* --- Distribution secrète ------------------------------------------------ */

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

.reveal__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: center;
  padding: var(--s-6) var(--gutter) var(--s-10);
  animation: screen-in var(--t-med) var(--ease);
}

.reveal__footer {
  padding: var(--s-3) var(--gutter) calc(var(--s-5) + var(--safe-bottom));
}

.handoff__step {
  color: var(--text-3);
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
}

.handoff__lead {
  margin-top: var(--s-6);
  color: var(--text-2);
  font-size: var(--fs-lg);
}

.handoff__name {
  margin-top: var(--s-1);
  font-size: 44px;
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.015em;
  overflow-wrap: anywhere;
}

.handoff__hint {
  margin-top: var(--s-6);
  padding-top: var(--s-4);
  border-top: 1px solid var(--line);
  color: var(--text-2);
  font-size: var(--fs-base);
}

.secret__name {
  color: var(--text-2);
  font-size: var(--fs-lg);
}

.secret__content {
  margin-top: var(--s-6);
  padding: var(--s-6) 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.secret__role {
  display: inline-block;
  margin-bottom: var(--s-4);
  padding: var(--s-1) var(--s-2);
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.secret__role.is-special {
  border-color: var(--accent);
  color: var(--accent);
}

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

.secret__word {
  margin-top: var(--s-1);
  font-size: clamp(36px, 12vw, 56px);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
  animation: secret-in 280ms var(--ease);
}

.secret__word--none {
  color: var(--accent);
  font-size: clamp(28px, 9vw, 40px);
}

@keyframes secret-in {
  from {
    opacity: 0;
    transform: translateY(8px);
    filter: blur(6px);
  }
}

.secret__hint {
  margin-top: var(--s-4);
  color: var(--text-2);
  font-size: var(--fs-base);
}

/* Bouton à maintenir : une barre se remplit de gauche à droite */
.hold-btn {
  position: relative;
  overflow: hidden;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
}

.hold-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgb(0 0 0 / 0.22);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 150ms var(--ease);
}

.hold-btn.is-holding::before {
  transform: scaleX(1);
  transition: transform var(--hold-duration, 600ms) linear;
}

.hold-btn.is-holding {
  transform: none;
}

.hold-btn__label {
  position: relative;
}

/* --- Ordre de passage ---------------------------------------------------- */

.order-row {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  min-height: 56px;
  border-bottom: 1px solid var(--line);
}

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

.order-row__index {
  width: 24px;
  color: var(--text-3);
  font-size: var(--fs-sm);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.order-row__name {
  flex: 1;
  min-width: 0;
  font-size: var(--fs-lg);
  overflow-wrap: anywhere;
}

.order-row.is-first .order-row__index {
  color: var(--accent);
}

.row--muted .row__title {
  color: var(--text-2);
}

/* --- Questions (L'Espion) ------------------------------------------------ */

.question-card {
  margin-top: var(--s-6);
  padding-bottom: var(--s-6);
  border-bottom: 1px solid var(--line);
}

.question-card__progress {
  color: var(--text-3);
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
}

.question-card__asker,
.question-card__target {
  font-size: var(--fs-3xl);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.015em;
  overflow-wrap: anywhere;
  animation: screen-in var(--t-med) var(--ease);
}

.question-card__asker {
  margin-top: var(--s-4);
}

.question-card__verb {
  margin: var(--s-1) 0;
  color: var(--text-2);
  font-size: var(--fs-lg);
}

.question-card__target {
  color: var(--accent);
}

/* --- Vote ---------------------------------------------------------------- */

.choice-list {
  margin-top: var(--s-6);
  border-top: 1px solid var(--line);
}

.choice-row {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  width: 100%;
  min-height: 56px;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: none;
  font-size: var(--fs-lg);
  text-align: left;
}

.choice-row__mark {
  position: relative;
  flex: none;
  width: 20px;
  height: 20px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  transition: border-color var(--t-fast) var(--ease);
}

.choice-row[aria-checked="true"] .choice-row__mark {
  border-color: var(--accent);
}

.choice-row[aria-checked="true"] .choice-row__mark::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 1px;
  background: var(--accent);
}

.choice-row__name {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

/* --- Devine qui je suis -------------------------------------------------- */

.team-fields {
  display: grid;
  gap: var(--s-2);
  margin-top: var(--s-3);
}

.field__label--spaced {
  margin-top: var(--s-5);
}

.how-to {
  margin-top: var(--s-6);
  border-top: 1px solid var(--line);
  counter-reset: step;
}

.how-to li {
  display: grid;
  grid-template-columns: 28px 1fr;
  padding: var(--s-3) 0;
  border-bottom: 1px solid var(--line);
  color: var(--text-2);
  counter-increment: step;
}

.how-to li::before {
  content: counter(step);
  color: var(--accent);
  font-weight: 500;
}

/* Écran de jeu plein écran : deux zones tactiles à l'aveugle (haut = Passer, bas = Trouvé) */
.guess-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  grid-template-rows: 1fr 1fr;
  background: var(--bg);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.guess-zone {
  display: flex;
  justify-content: center;
  width: 100%;
  padding: calc(var(--s-4) + var(--safe-top)) var(--s-4) calc(var(--s-4) + var(--safe-bottom));
  border: 0;
  background: transparent;
  color: var(--text-3);
  touch-action: manipulation;
}

.guess-zone--pass {
  align-items: flex-start;
}

.guess-zone--found {
  align-items: flex-end;
  background: color-mix(in srgb, var(--accent) 7%, transparent);
}

.guess-zone__label {
  font-size: var(--fs-sm);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.guess-zone--found .guess-zone__label {
  color: var(--accent);
}

.guess-zone:active {
  background: var(--surface-1);
}

.guess-screen.is-getting-ready .guess-zone {
  pointer-events: none;
}

.guess-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  padding: 56px var(--gutter);
  text-align: center;
  pointer-events: none;
}

.guess-timer {
  color: var(--text-2);
  font-size: var(--fs-2xl);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.guess-timer.is-urgent {
  color: var(--danger);
}

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

.guess-word-box {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 45%;
  overflow: hidden;
}

.guess-word {
  max-width: 100%;
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.02em;
  text-wrap: balance;
  transition: none;
}

.guess-word.is-new {
  animation: secret-in 220ms var(--ease);
}

.guess-score {
  color: var(--text-3);
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
}

.guess-mode {
  color: var(--text-3);
  font-size: 12px;
}

.guess-quit {
  position: absolute;
  top: calc(var(--s-2) + var(--safe-top));
  right: var(--s-2);
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 0;
  background: none;
  color: var(--text-3);
}

/* Retour visuel, visible par les autres joueurs */
.guess-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

.guess-screen.flash-found::after {
  background: var(--success);
  animation: guess-flash 380ms var(--ease);
}

.guess-screen.flash-pass::after {
  background: var(--text-3);
  animation: guess-flash 380ms var(--ease);
}

@keyframes guess-flash {
  from {
    opacity: 0.35;
  }
  to {
    opacity: 0;
  }
}

.turn-stats {
  display: flex;
  gap: var(--s-8);
  margin-top: var(--s-5);
}

.turn-stat {
  display: flex;
  flex-direction: column;
}

.turn-stat__value {
  font-size: var(--fs-3xl);
  font-weight: 500;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.turn-stat.is-highlight .turn-stat__value {
  color: var(--accent);
}

.turn-stat__label {
  margin-top: var(--s-1);
  color: var(--text-2);
  font-size: var(--fs-sm);
}

.word-list__item {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-height: 44px;
  border-bottom: 1px solid var(--line);
  color: var(--text-2);
}

.word-list__item:last-child {
  border-bottom: 0;
}

.word-list__item.is-found {
  color: var(--text);
}

.word-list__item.is-found .icon {
  color: var(--success);
}

.ranking__row {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  min-height: 64px;
  border-bottom: 1px solid var(--line);
}

.ranking__row:last-child {
  border-bottom: 0;
}

.ranking__rank {
  width: 24px;
  color: var(--text-3);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.ranking__main {
  flex: 1;
  min-width: 0;
}

.ranking__name {
  display: block;
  font-size: var(--fs-lg);
  overflow-wrap: anywhere;
}

.ranking__detail {
  display: block;
  color: var(--text-2);
  font-size: var(--fs-sm);
}

.ranking__score {
  font-size: var(--fs-2xl);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.ranking__row.is-first .ranking__rank,
.ranking__row.is-first .ranking__score {
  color: var(--accent);
}

/* --- La règle secrète ---------------------------------------------------- */

.rule-card {
  padding: var(--s-5) 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  animation: secret-in 280ms var(--ease);
}

.rule-card__text {
  margin-top: var(--s-2);
  font-size: var(--fs-2xl);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.rule-card__hint {
  margin-top: var(--s-3);
  color: var(--text-2);
}

.investigation {
  display: flex;
  align-items: baseline;
  gap: var(--s-5);
  margin-top: var(--s-4);
}

.investigation__timer {
  color: var(--accent);
  font-size: var(--fs-3xl);
  font-weight: 500;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.investigation__timer.is-urgent {
  color: var(--danger);
}

.investigation__attempts {
  color: var(--text-2);
  font-size: var(--fs-base);
}

.investigation__attempts--spaced {
  margin-top: var(--s-4);
}

/* --- Résultats ----------------------------------------------------------- */

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

.reveal-line__word {
  color: var(--text-2);
}

.guess-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-3);
  margin-top: var(--s-4);
  color: var(--text-2);
}

.end-hero {
  padding: var(--s-6) 0 var(--s-2);
}

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

.row__value--strong {
  color: var(--text);
  font-weight: 500;
}

.row.is-winner .row__title {
  color: var(--accent);
}

.history-row {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: var(--s-3);
  padding: var(--s-3) 0;
  border-bottom: 1px solid var(--line);
}

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

.history-row__round {
  color: var(--text-3);
  font-size: var(--fs-sm);
  line-height: 1.7;
}

.history-row__guess {
  display: block;
  color: var(--text-2);
  font-size: var(--fs-base);
}
