/* =============================================================
   MOTAMORPHOSE — écrans spécifiques
   ============================================================= */

/* -------------------------------- Accueil --------------------------- */
.screen--home {
  justify-content: center;
  gap: 18px;
  padding-top: calc(var(--safe-top) + 26px);
  padding-bottom: calc(var(--safe-bottom) + 18px);
}

.home__head {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: clamp(1.5rem, 8.4vw, 2.35rem);
  font-weight: 900;
  letter-spacing: 0.02em;
  line-height: 1;
}

.logo__row {
  display: flex;
  gap: clamp(2px, 0.9vw, 5px);
}

.logo__letter {
  display: inline-grid;
  place-items: center;
  width: clamp(26px, 7.6vw, 38px);
  height: clamp(32px, 9.2vw, 46px);
  border-radius: 10px;
  background: var(--grad-tile);
  border: 1px solid var(--border-strong);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 8px 20px rgba(4, 2, 16, 0.35);
  color: var(--text);
  animation: letter-float 3.6s var(--ease-out) infinite;
  animation-delay: calc(var(--i) * 110ms);
}

.logo__row:last-child .logo__letter {
  background: var(--grad-primary);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 10px 26px rgba(64, 40, 220, 0.45);
}

.home__tagline {
  font-size: 0.86rem;
  color: var(--text-dim);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.home__stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.stat-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 10px 8px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  backdrop-filter: blur(12px);
}

.stat-chip__icon {
  font-size: 0.9rem;
  color: var(--yellow);
  line-height: 1;
}

.stat-chip__value {
  font-size: 1.12rem;
  font-weight: 900;
  font-family: var(--font-mono);
  line-height: 1.15;
}

.stat-chip__label {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
}

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

.home__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.home__grid .btn {
  min-height: 68px;
  border-radius: var(--radius-lg);
}

.home__row {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.home__foot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  margin-top: 2px;
}

.link-install {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--turquoise);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ------------------------------- Résultat --------------------------- */
.screen--result {
  position: relative;
  justify-content: center;
  overflow: hidden;
}

.confetti {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

.result__card {
  position: relative;
  z-index: 3;
  background: linear-gradient(180deg, rgba(40, 20, 80, 0.92), rgba(21, 10, 46, 0.96));
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  animation: modal-in 420ms var(--ease-spring) both;
}

[data-theme="light"] .result__card {
  background: linear-gradient(180deg, #ffffff, #f2edff);
}

.result__eyebrow {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--turquoise);
}

.result__title {
  font-size: 1.6rem;
  font-weight: 900;
  text-align: center;
  background: var(--grad-brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  line-height: 1.15;
}

.result__score {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.result__score-value {
  font-size: 2.6rem;
  font-weight: 900;
  font-family: var(--font-mono);
  letter-spacing: -0.02em;
  color: var(--yellow);
  text-shadow: 0 0 30px rgba(255, 217, 61, 0.4);
}

.result__score-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.result__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
}

.result__grid div {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.result__grid dt {
  font-size: 0.64rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
}

.result__grid dd {
  font-size: 1rem;
  font-weight: 800;
  font-family: var(--font-mono);
}

.result__path {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  width: 100%;
}

.result__path .word {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--text-dim);
}

.result__path .word--optimal {
  color: var(--turquoise);
  border: 1px solid rgba(20, 224, 200, 0.4);
}

.result__buttons {
  display: flex;
  gap: 8px;
  width: 100%;
  flex-wrap: wrap;
}

.result__buttons .btn {
  flex: 1 1 auto;
}

/* --------------------------- Multijoueur --------------------------- */
.mode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.mode-card {
  padding: 12px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--border);
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: transform 160ms var(--ease-spring), border-color 160ms, background 160ms;
}

.mode-card strong {
  font-size: 0.86rem;
  font-weight: 800;
}

.mode-card small {
  font-size: 0.68rem;
  color: var(--text-faint);
  line-height: 1.35;
}

.mode-card--active {
  border-color: rgba(20, 224, 200, 0.65);
  background: rgba(20, 224, 200, 0.1);
  box-shadow: 0 0 0 1px rgba(20, 224, 200, 0.3);
}

/* -------------------------------- Salon ---------------------------- */
.screen--room {
  gap: 12px;
}

.room__code {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(43, 108, 255, 0.18), rgba(138, 83, 255, 0.18));
  border: 1px solid rgba(110, 161, 255, 0.35);
}

.room__code-label {
  font-size: 0.66rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-faint);
}

.room__code-value {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: 0.28em;
  text-indent: 0.28em;
  color: #fff;
  text-shadow: 0 0 26px rgba(110, 161, 255, 0.6);
}

.room__code-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.room__meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}

.room__actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
}

.room__hint {
  text-align: center;
}

.room__countdown {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(8, 3, 22, 0.82);
  backdrop-filter: blur(8px);
  z-index: 15;
}

.room__countdown[hidden] {
  display: none;
}

.room__countdown-value {
  font-size: 6rem;
  font-weight: 900;
  font-family: var(--font-mono);
  color: var(--turquoise);
  text-shadow: 0 0 60px rgba(20, 224, 200, 0.7);
  animation: countdown-pop 1s var(--ease-spring) infinite;
}

/* ------------------------------ Aventure --------------------------- */
.levels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
  gap: 10px;
}

.level-card {
  aspect-ratio: 1;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-weight: 800;
  transition: transform 160ms var(--ease-spring), border-color 180ms, background 180ms;
}

.level-card strong {
  font-size: 1.1rem;
  font-family: var(--font-mono);
}

.level-card small {
  font-size: 0.58rem;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.level-card--done {
  border-color: rgba(53, 208, 127, 0.5);
  background: rgba(53, 208, 127, 0.1);
}

.level-card--done .level-card__stars {
  color: var(--yellow);
  font-size: 0.62rem;
  letter-spacing: 1px;
}

.level-card--locked {
  opacity: 0.4;
  pointer-events: none;
}

.level-card--next {
  border-color: var(--turquoise);
  box-shadow: 0 0 0 1px rgba(20, 224, 200, 0.35), 0 12px 30px rgba(20, 224, 200, 0.2);
  animation: pulse-soft 2.4s ease-in-out infinite;
}

/* ---------------------------- Statistiques ------------------------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.stat-card {
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-card__value {
  font-size: 1.3rem;
  font-weight: 900;
  font-family: var(--font-mono);
}

.stat-card__label {
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
}

/* ------------------------------ Comment jouer --------------------- */
.howto {
  gap: 10px;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--text-dim);
}

.howto strong {
  color: var(--text);
}

.howto em {
  color: var(--turquoise);
  font-style: normal;
  font-weight: 700;
}

.howto__example {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  justify-content: center;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--surface-2);
}

.howto__example .word {
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 0.82rem;
  padding: 6px 9px;
  border-radius: 8px;
  background: rgba(20, 224, 200, 0.14);
  color: #c8fff8;
  border: 1px solid rgba(20, 224, 200, 0.3);
}

.howto__list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-left: 4px;
}

.howto__list li {
  position: relative;
  padding-left: 16px;
}

.howto__list li::before {
  content: "✦";
  position: absolute;
  left: 0;
  color: var(--yellow);
  font-size: 0.7rem;
}

/* ------------------------------- Modale --------------------------- */
.modal__body .word-preview {
  display: flex;
  gap: 5px;
  justify-content: center;
  margin: 10px 0;
}

@media (max-width: 360px) {
  .home__grid {
    grid-template-columns: 1fr;
  }
  .mode-grid {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 720px) {
  .screen--home {
    gap: 22px;
  }
  .home__grid {
    grid-template-columns: repeat(4, 1fr);
  }
  .home__grid .btn {
    flex-direction: column;
    min-height: 92px;
    gap: 6px;
  }
  .home__grid .btn__label {
    align-items: center;
    text-align: center;
  }
}
