/* Refaire le monde (template/espace/refaire-le-monde.php, 2026-10-17): the night sky above the curve of the world, and
   the scale of the debate. « Qui joue ? » first (two to six players, the themes and the moves aside); then each
   player puts their token in a plate; the beam leans with them (--rm-tilt, written by the script: up to 18deg, toward
   « Pour » on the right) and the plates stay level. The views of the game (an affirmation, the wall of the Pass, the
   end) share one place in a stage of fixed size, so nothing around them moves.
   Only transforms and opacity move; still for those who ask for less motion. */
.esp-page.rm {
  --rm-tilt: 0deg;
  background: linear-gradient(180deg, #2c1f63 0%, #22184f 34%, #1a1240 64%, #120c2c 100%);
}

/* ---------- The sky and the world ---------- */
.rm-sky {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.rm-sky span,
.rm-sky i {
  position: absolute;
  display: block;
}

.rm-sky__stars {
  inset: 0 0 30%;
}

.rm-sky__stars i {
  top: var(--y);
  left: var(--x);
  width: var(--s);
  height: var(--s);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 6px rgba(255, 255, 255, .8);
  opacity: .7;
}

/* The curve of the world at the bottom of the screen, its edge lit by the night. */
.rm-sky__world {
  left: 50%;
  bottom: -780px;
  width: 940px;
  height: 940px;
  translate: -50% 0;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 12%, #34287a, #191138 46%, #0f0a26 70%);
  box-shadow: 0 -2px 0 rgba(255, 217, 138, .5), 0 -16px 50px rgba(150, 110, 255, .32), 0 -60px 120px rgba(150, 110, 255, .14);
}

.rm-sky__world i {
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 4%, rgba(255, 217, 138, .22), transparent 22%);
}

/* ---------- The stage ---------- */
.rm .esp-game__shell {
  gap: 10px;
}

.rm-stage {
  position: relative;
  display: grid;
  flex: 1 1 auto;
  min-height: 0;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}

.rm-slide {
  display: grid;
  align-items: center;
  transition: transform .34s cubic-bezier(.2, .8, .2, 1), opacity .34s ease;
}

.rm-slide.is-leaving-left { transform: translateX(-56px); opacity: 0; }
.rm-slide.is-leaving-right { transform: translateX(56px); opacity: 0; }
.rm-slide.is-coming-left { transform: translateX(-56px); opacity: 0; transition: none; }
.rm-slide.is-coming-right { transform: translateX(56px); opacity: 0; transition: none; }

.rm-view {
  grid-area: 1 / 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  visibility: hidden;
  opacity: 0;
}

.rm[data-rm-view="players"] .rm-view--players,
.rm[data-rm-view="debate"] .rm-view--debate,
.rm[data-rm-view="wall"] .rm-view--wall,
.rm[data-rm-view="end"] .rm-view--end {
  visibility: visible;
  opacity: 1;
}

/* ---------- Who plays (template/espace/partials/players.php, static/css/espace.css) ---------- */
.rm-view--players {
  align-items: stretch;
}

/* The themes and the moves step aside while « Qui joue ? » is open: up to six lines fit; they come back softly.
   Closed, it takes no room: the stage keeps the size of the game. */
.rm[data-rm-view="players"] .rm-themes,
.rm[data-rm-view="players"] .rm-moves,
.rm:not([data-rm-view="players"]) .rm-view--players {
  display: none;
}

.rm-themes,
.rm-moves {
  animation: rm-appear .34s ease both;
}

@keyframes rm-appear {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ---------- An affirmation ---------- */
.rm-kicker {
  margin: 0;
  color: #ffd98a;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.rm-statement {
  margin: 0;
  color: #fff;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(22px, 6.3vw, 28px);
  line-height: 1.32;
  text-wrap: balance;
}

.rm-word {
  white-space: nowrap;
}

/* Whose turn it is, then what a token can still do: one line, its place kept. */
.rm-turn {
  min-height: 20px;
  margin: 0;
  color: rgba(255, 255, 255, .74);
  font-size: 14.5px;
  font-weight: 800;
}

/* ---------- The scale ---------- */
.rm-scale {
  position: relative;
  height: 172px;
  margin-top: 6px;
}

/* The post, from the pivot of the beam down to its foot. */
.rm-scale__post {
  position: absolute;
  top: 44px;
  bottom: 0;
  left: 50%;
  width: 6px;
  margin-left: -3px;
  border-radius: 3px;
  background: linear-gradient(180deg, #ffe2a0, #c99a3e);
}

.rm-scale__post::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 84px;
  height: 9px;
  translate: -50% 0;
  border-radius: 6px;
  background: linear-gradient(180deg, #e0b863, #a87c2c);
}

.rm-scale__beam {
  position: absolute;
  top: 40px;
  left: 15%;
  right: 15%;
  height: 8px;
  transform: rotate(var(--rm-tilt));
  transition: transform .9s cubic-bezier(.34, 1.45, .5, 1);
}

.rm-scale__bar {
  position: absolute;
  inset: 0;
  border-radius: 4px;
  background: linear-gradient(90deg, #ffe7ad, #ffd98a 50%, #ffe7ad);
  box-shadow: 0 4px 14px rgba(255, 217, 138, .3);
}

/* The pivot, on top of the post. */
.rm-scale__beam::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  translate: -50% -50%;
  border: 3px solid #ffd98a;
  border-radius: 50%;
  background: #22184f;
}

/* A plate hangs from each end of the beam, and stays level as it leans. */
.rm-pan {
  position: absolute;
  top: 4px;
  width: 116px;
  margin-left: -58px;
  transform: rotate(calc(var(--rm-tilt) * -1));
  transform-origin: 50% 0;
  transition: transform .9s cubic-bezier(.34, 1.45, .5, 1);
}

.rm-pan--contre { left: 0; }
.rm-pan--pour { left: 100%; }

.rm-pan__strings {
  position: absolute;
  top: 0;
  left: 50%;
  width: 0;
  height: 0;
}

.rm-pan__strings::before,
.rm-pan__strings::after {
  content: "";
  position: absolute;
  top: 0;
  left: -1px;
  width: 1.5px;
  height: 64px;
  background: rgba(255, 217, 138, .6);
  transform-origin: 50% 0;
}

.rm-pan__strings::before { rotate: 47deg; }
.rm-pan__strings::after { rotate: -47deg; }

.rm-pan__plate {
  position: relative;
  height: 50px;
  margin-top: 42px;
}

.rm-pan__drop {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: 100%;
  padding: 0 0 7px;
  border: 2px solid rgba(255, 217, 138, .75);
  border-top-width: 3px;
  border-radius: 4px 4px 58px 58px;
  background: rgba(255, 217, 138, .08);
  color: #ffd98a;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background .2s ease, transform .15s ease;
}

.rm-pan__drop:not(:disabled):hover {
  background: rgba(255, 217, 138, .16);
}

.rm-pan__drop:not(:disabled):active {
  transform: scale(.97);
}

.rm-pan__drop:disabled {
  cursor: default;
}

/* The tokens in a plate: in its bowl, above its word, overlapping a little when there are several. */
.rm-pan__tokens {
  position: absolute;
  right: 0;
  bottom: 25px;
  left: 0;
  display: flex;
  justify-content: center;
  pointer-events: none;
}

.rm-pan__tokens .rm-token + .rm-token {
  margin-left: -10px;
}

/* Five tokens or more in a plate: a little pile, on two rows. */
.rm-pan__tokens.is-crowded {
  left: 50%;
  right: auto;
  width: 104px;
  box-sizing: border-box;
  padding: 0 6px;
  flex-wrap: wrap-reverse;
  translate: -50% 0;
}

.rm-pan__tokens.is-crowded .rm-token,
.rm-pan__tokens.is-crowded .rm-token + .rm-token {
  margin: -7px -6px 0;
}

.rm-pan__tokens .rm-token {
  pointer-events: auto;
}

/* The tokens not put yet wait on top of the post. */
.rm-scale__waiting {
  position: absolute;
  top: -2px;
  left: 50%;
  display: flex;
  gap: 8px;
  translate: -50% 0;
}

.rm-token {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, .92);
  border-radius: 50%;
  background: var(--esp-token-bg);
  color: var(--esp-token-ink, #fff);
  font: inherit;
  font-size: 15px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(10, 4, 30, .45);
  -webkit-tap-highlight-color: transparent;
}

.rm-token.is-active {
  box-shadow: 0 0 0 4px rgba(255, 217, 138, .5), 0 6px 14px rgba(10, 4, 30, .45);
}

.rm-scale__waiting .rm-token:not(.is-active) {
  opacity: .55;
}

/* ---------- What the couple and the others think ---------- */
.rm-result {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 82px;
}

.rm-verdict {
  min-height: 22px;
  margin: 0;
  color: #fff;
  font-size: 16px;
  font-weight: 900;
  line-height: 1.35;
  opacity: 0;
  transition: opacity .3s ease;
}

.rm.is-voted .rm-verdict {
  opacity: 1;
}

/* The share of the opinions: « Pour » fills from the right, as its plate. */
.rm-bar {
  position: relative;
  display: block;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(206, 190, 255, .26);
}

.rm-bar span {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #ff7ab8, #ffd98a);
  transition: width .8s cubic-bezier(.2, .8, .2, 1);
}

.rm-bar[hidden] {
  display: none;
}

.rm-share {
  margin: 0;
  color: rgba(255, 255, 255, .86);
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1.4;
}

/* ---------- The wall of the Pass, and the end ---------- */
.rm-view--wall,
.rm-view--end {
  align-items: flex-start;
}

.rm-view__icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: rgba(255, 217, 138, .12);
  box-shadow: 0 0 0 1px rgba(255, 217, 138, .35);
  color: #ffd98a;
}

.rm-view__title {
  margin: 0;
  color: #fff;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 26px;
  font-weight: 700;
  line-height: 1.25;
}

.rm-view__text {
  margin: 0;
  color: rgba(255, 255, 255, .8);
  font-size: 16px;
  line-height: 1.5;
}

/* ---------- Before, next ---------- */
.rm-moves {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
  padding-bottom: 6px;
}

.rm-up {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 10px 0 4px;
  border: 0;
  background: none;
  color: rgba(255, 255, 255, .78);
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.rm-up:disabled {
  visibility: hidden;
}

.rm-next {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 22px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #8b63ff, #e0156f);
  box-shadow: 0 14px 30px rgba(139, 99, 255, .35);
  color: #fff;
  font: inherit;
  font-size: 16px;
  font-weight: 900;
  cursor: pointer;
  transition: transform .15s ease, opacity .2s ease;
}

.rm-next:active {
  transform: scale(.98);
}

.rm-next:disabled {
  opacity: .45;
  cursor: default;
}

/* The smallest phones: the plates come closer, « Précédent » keeps its arrow and says its name to screen readers. */
@media (max-width: 359px) {
  .rm-scale__beam {
    left: 17%;
    right: 17%;
  }

  .rm-pan {
    width: 100px;
    margin-left: -50px;
  }

  .rm-token {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }

  .rm-pan__tokens.is-crowded {
    width: 96px;
  }

  .rm-next {
    padding: 0 16px;
    font-size: 15px;
    white-space: nowrap;
  }

  .rm-up {
    padding: 0 12px;
  }

  .rm-up__label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
}

/* Short screens: the scale comes lower and closer, so that an affirmation of three lines still fits without moving
   the page. */
@media (max-height: 700px) {
  .rm-view {
    gap: 10px;
  }

  .rm-scale {
    height: 146px;
    margin-top: 0;
  }

  .rm-scale__post {
    top: 38px;
  }

  .rm-scale__beam {
    top: 34px;
  }

  .rm-pan__plate {
    height: 44px;
    margin-top: 34px;
  }

  .rm-pan__strings::before,
  .rm-pan__strings::after {
    height: 50px;
  }

  .rm-result {
    min-height: 76px;
  }

  .rm-statement {
    font-size: clamp(19px, 5.8vw, 24px);
  }

  .rm-turn,
  .rm-share {
    font-size: 13.5px;
  }

  .rm-verdict {
    font-size: 15px;
  }
}

/* ---------- The movements, for those who want them ---------- */
@media (prefers-reduced-motion: no-preference) {
  .rm-sky__stars i {
    animation: rm-twinkle 4.5s ease-in-out var(--delay) infinite;
  }

  .rm-scale__waiting .rm-token.is-active {
    animation: rm-pulse 1.8s ease-in-out infinite;
  }

  .rm-token.is-dropping {
    animation: rm-drop .55s cubic-bezier(.3, 1.4, .5, 1);
  }

  .rm-next__arrow {
    animation: rm-nudge 2.6s ease-in-out infinite;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rm-themes,
  .rm-moves {
    animation: none;
  }

  .rm-slide,
  .rm-scale__beam,
  .rm-pan,
  .rm-bar span {
    transition: none;
  }
}

@keyframes rm-twinkle {
  0%, 100% { opacity: .25; }
  50% { opacity: .9; }
}

@keyframes rm-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

@keyframes rm-drop {
  0% { opacity: 0; transform: translateY(-44px) scale(.9); }
  55% { opacity: 1; }
  100% { transform: none; }
}

@keyframes rm-nudge {
  0%, 70%, 100% { transform: none; }
  80% { transform: translateX(3px); }
}
