* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: #f3f3f1;
  font-family: ui-monospace, "Cascadia Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

.stage {
  height: 100svh;
  display: grid;
  place-items: center;
  position: relative;
}

.game-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Chronomètre de manche, au-dessus du rectangle noir */
.timer {
  min-height: 28px;
  padding-bottom: 4px;
  color: #111111;
  font-size: 1.05rem;
  font-weight: 700;
  text-align: center;
}

#arena {
  background: #ffffff;
  display: block;
}

/* Écran pseudo : même sobriété, même place que la pastille de lien */
.gate {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  border: 3px solid #111111;
  background: #ffffff;
}

.gate-input {
  display: block;
  width: 280px;
  border: 0;
  outline: none;
  background: #ffffff;
  color: #111111;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  text-align: center;
  padding: 14px 20px;
}

.gate-input::placeholder {
  color: #8a8a86;
}

.verdict {
  cursor: default;
}

/* Pastille d'invitation : un clic copie le lien. Disparaît dès que
   l'adversaire arrive. */
.invite {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  padding: 14px 20px;
  border: 3px solid #111111;
  background: #ffffff;
  color: #111111;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 120ms ease;
}

.invite:active {
  transform: translate(-50%, -50%) scale(0.96);
}

.invite.copied {
  background: #111111;
  color: #ffffff;
}

/* Chat furtif : petit panneau sobre en bas à gauche, ouvert avec Entrée */
.chat {
  position: absolute;
  left: 18px;
  bottom: 18px;
  width: min(320px, calc(100vw - 36px));
  border: 3px solid #111111;
  background: #ffffff;
  padding: 10px;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 8px;
  max-height: 40svh;
}

.chat-close {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 30px;
  height: 30px;
  border: 3px solid #111111;
  background: #ffffff;
  color: #111111;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
}

.chat-close:hover {
  background: #111111;
  color: #ffffff;
}

.chat-messages {
  overflow-y: auto;
  min-height: 60px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
  padding-right: 26px;
}

.chat-msg {
  word-break: break-word;
  line-height: 1.35;
  color: #111111;
}

.chat-msg .who {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 6px;
}

.chat-input {
  width: 100%;
  border: 2px solid #111111;
  background: #ffffff;
  color: #111111;
  font: inherit;
  font-size: 0.9rem;
  padding: 7px 9px;
  outline: none;
}

[hidden] {
  display: none !important;
}
