/* Time's Up des petits — feuille de style unique, sans dépendance. */

:root {
  --bg: #1b1033;
  --bg-2: #33205f;
  --ink: #ffffff;
  --ink-soft: #c9bce6;
  --card: #fffdf7;
  --card-ink: #22103f;
  --green: #22c55e;
  --green-dark: #15803d;
  --amber: #f59e0b;
  --amber-dark: #b45309;
  --danger: #ef4444;
  --radius: 1.5rem;
  --gap: clamp(0.6rem, 2vw, 1.2rem);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overscroll-behavior: none;
}

body {
  background: radial-gradient(120% 80% at 50% 0%, var(--bg-2), var(--bg));
  color: var(--ink);
  font-family: "Trebuchet MS", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: clamp(16px, 2.2vh, 22px);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

/* ---------- Écrans ---------- */

.screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--gap);
  padding: calc(var(--gap) + env(safe-area-inset-top)) calc(var(--gap) + env(safe-area-inset-right))
           calc(var(--gap) + env(safe-area-inset-bottom)) calc(var(--gap) + env(safe-area-inset-left));
  text-align: center;
}

.screen--scroll {
  justify-content: flex-start;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

[hidden] { display: none !important; }

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

.logo {
  margin: 0;
  font-size: clamp(2.2rem, 9vh, 4.5rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  text-shadow: 0 0.05em 0.03em rgba(0, 0, 0, 0.45);
}

.logo small {
  display: block;
  font-size: 0.45em;
  color: var(--amber);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tagline {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

/* ---------- Boutons ---------- */

button {
  font: inherit;
  color: inherit;
  border: none;
  background: none;
  cursor: pointer;
}

.big-action {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  min-width: min(88vw, 26rem);
  min-height: clamp(4.5rem, 16vh, 8rem);
  padding: 0 1.2em;
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--green), var(--green-dark));
  box-shadow: 0 0.4rem 0 var(--green-dark), 0 0.9rem 1.5rem rgba(0, 0, 0, 0.35);
  font-size: clamp(1.3rem, 4.5vh, 2.4rem);
  font-weight: 800;
  text-shadow: 0 2px 3px rgba(0, 0, 0, 0.3);
  transition: transform 0.06s ease, box-shadow 0.06s ease;
}

.big-action--small {
  min-height: 3.5rem;
  font-size: 1.2rem;
}

.big-action__icon { font-size: 0.9em; }

.big-action:active {
  transform: translateY(0.35rem);
  box-shadow: 0 0.05rem 0 var(--green-dark), 0 0.3rem 0.8rem rgba(0, 0, 0, 0.35);
}

.ghost {
  padding: 0.7em 1.4em;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  color: var(--ink-soft);
  font-size: 1rem;
}

.ghost:active { background: rgba(255, 255, 255, 0.1); }

/* ---------- Réglages ---------- */

h2 {
  margin: 0.2em 0 0;
  font-size: clamp(1.5rem, 5vh, 2.2rem);
}

.field {
  width: min(100%, 34rem);
  margin: 0;
  padding: 0.9rem 1rem 1.1rem;
  border: none;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.07);
  text-align: left;
}

.field legend {
  padding: 0 0.4em;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.field__hint {
  margin: 0.7em 0 0;
  color: var(--ink-soft);
  font-size: 0.85rem;
}

.field--actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
  background: none;
}

.choices {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 0.5rem;
}

.choices--wrap {
  grid-auto-flow: row;
  grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr));
}

/* Les libellés de catégories sont longs : un cran plus petit pour ne pas déborder. */
.choices--wrap .chip {
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}

.chip {
  min-height: 3.2rem;
  padding: 0.4em 0.3em;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid transparent;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.15;
}

.chip[aria-pressed="true"] {
  background: var(--amber);
  border-color: #fff;
  color: #3b2000;
}

.credits {
  width: min(100%, 34rem);
  color: var(--ink-soft);
  font-size: 0.75rem;
  text-align: left;
  line-height: 1.5;
}

.credits code {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 0.3em;
  padding: 0 0.3em;
}

/* ---------- Annonce de manche / fin de tour ---------- */

.round-count {
  margin: 0;
  color: var(--amber);
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.round-icon {
  font-size: clamp(4rem, 22vh, 10rem);
  line-height: 1;
  filter: drop-shadow(0 0.1em 0.2em rgba(0, 0, 0, 0.4));
}

.round-label {
  margin: 0;
  max-width: 20ch;
  font-size: clamp(1.6rem, 6vh, 3rem);
  line-height: 1.1;
}

.round-hint {
  margin: 0;
  max-width: 26ch;
  color: var(--ink-soft);
  font-size: clamp(1rem, 2.6vh, 1.3rem);
}

/* ---------- Écran de jeu ---------- */

.screen--play {
  /* La grille remplace le centrage flex de .screen : la carte doit occuper
     toute la hauteur disponible entre le chrono et les boutons. */
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-columns: 1fr;
  gap: var(--gap);
  align-items: stretch;
  align-content: stretch;
  justify-items: stretch;
  justify-content: stretch;
}

.hud {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.hud__top {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.hud__top .timer { flex: 1; }

.timer {
  position: relative;
  height: clamp(2.6rem, 7vh, 4rem);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
}

.timer__bar {
  position: absolute;
  inset: 0 auto 0 0;
  width: 100%;
  background: linear-gradient(90deg, #4ade80, #22c55e);
  transition: background-color 0.3s linear;
}

.timer--warn .timer__bar { background: linear-gradient(90deg, #fbbf24, #f59e0b); }
.timer--danger .timer__bar { background: linear-gradient(90deg, #f87171, #ef4444); }

.timer--danger .timer__value { animation: pulse 1s ease-in-out infinite; }

@keyframes pulse {
  50% { transform: scale(1.18); }
}

.timer__round, .timer__value {
  position: relative;
  font-weight: 900;
  font-size: clamp(1.2rem, 3.4vh, 1.9rem);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.45);
}

.dots {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  justify-content: center;
  min-height: 0.7rem;
}

.dot {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
}

.dot--found { background: var(--green); }

.card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 0;
  padding: var(--gap);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--card-ink);
  box-shadow: 0 1rem 2rem rgba(0, 0, 0, 0.35);
}

.card--in { animation: card-in 0.22s ease-out; }

@keyframes card-in {
  from { opacity: 0; transform: scale(0.9) translateY(0.6rem); }
}

.card__visual {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(4rem, 38vh, 20rem);
  line-height: 1;
}

.card__visual img {
  /* On occupe toute la place disponible, comme l'emoji, quelle que soit
     la taille du fichier source. */
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.card__word {
  margin: 0;
  font-size: clamp(1.5rem, 5.5vh, 3rem);
  font-weight: 800;
  text-transform: lowercase;
}

.controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap);
}

.control {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1em;
  min-height: clamp(5rem, 22vh, 11rem);
  border-radius: var(--radius);
  font-size: clamp(1.1rem, 3vh, 1.8rem);
  font-weight: 800;
  transition: transform 0.06s ease, box-shadow 0.06s ease;
}

.control__icon { font-size: 1.9em; line-height: 1; }

.control--pass {
  background: linear-gradient(180deg, var(--amber), var(--amber-dark));
  box-shadow: 0 0.4rem 0 var(--amber-dark), 0 0.8rem 1.4rem rgba(0, 0, 0, 0.3);
}

.control--found {
  background: linear-gradient(180deg, var(--green), var(--green-dark));
  box-shadow: 0 0.4rem 0 var(--green-dark), 0 0.8rem 1.4rem rgba(0, 0, 0, 0.3);
}

.control:active { transform: translateY(0.35rem); box-shadow: none; }

.control:disabled { opacity: 0.4; }

.quit {
  flex: 0 0 auto;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.3);
  color: var(--ink-soft);
  font-size: 1rem;
  opacity: 0.55;
}

.paused {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 5, 25, 0.88);
  font-size: clamp(2rem, 8vh, 4rem);
  font-weight: 800;
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
