/* Fil de discussion façon iMessage (partagé joueur + admin). */
:root {
  --c-bg: #ffffff;
  --c-text: #000000;
  --c-recv: #e9e9eb;
  --c-recv-text: #000000;
  --c-sent: #0a7cff;
  --c-sent-text: #ffffff;
  --c-muted: #8e8e93;
  --c-danger: #ff3b30;
  --c-card: #ffffff;
  --c-card-ink: #1c1c1e;
  --c-card-red: #d91a2a;
}
@media (prefers-color-scheme: dark) {
  :root {
    --c-bg: #000000;
    --c-text: #ffffff;
    --c-recv: #262629;
    --c-recv-text: #ffffff;
    --c-muted: #8d8d93;
    --c-danger: #ff453a;
  }
}

.thread {
  background: var(--c-bg);
  color: var(--c-text);
  padding: 4px 16px 10px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

.stamp {
  text-align: center;
  color: var(--c-muted);
  font-size: 11px;
  line-height: 13px;
  margin: 16px 0 8px;
}
.stamp b { font-weight: 600; }

.msg { display: flex; flex-direction: column; margin-top: 2px; }
.msg.first { margin-top: 9px; }
.stamp + .msg.first { margin-top: 0; }
.msg.me { align-items: flex-end; }
.msg.them { align-items: flex-start; }

.bubble {
  position: relative;
  max-width: min(76%, 520px);
  padding: 7px 12px 8px;
  border-radius: 18px;
  font-size: 17px;
  line-height: 22px;
  letter-spacing: -0.2px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.me .bubble { background: var(--c-sent); color: var(--c-sent-text); }
.them .bubble { background: var(--c-recv); color: var(--c-recv-text); }

/* Queue de bulle : un coin arrondi + une découpe de la couleur du fond. */
.bubble.tail::before,
.bubble.tail::after { content: ""; position: absolute; bottom: 0; height: 20px; }
.me .bubble.tail::before { right: -7px; width: 20px; background: var(--c-sent); border-bottom-left-radius: 16px 14px; }
.me .bubble.tail::after { right: -26px; width: 26px; background: var(--c-bg); border-bottom-left-radius: 10px; }
.them .bubble.tail::before { left: -7px; width: 20px; background: var(--c-recv); border-bottom-right-radius: 16px 14px; }
.them .bubble.tail::after { left: -26px; width: 26px; background: var(--c-bg); border-bottom-right-radius: 10px; }

.bubble.emoji { background: none !important; font-size: 46px; line-height: 54px; padding: 0 2px; letter-spacing: 2px; }

.msg.pop .bubble { animation: bubble-pop 0.24s cubic-bezier(0.2, 0.9, 0.3, 1.2); }
.msg.me.pop .bubble { transform-origin: 100% 100%; }
.msg.them.pop .bubble { transform-origin: 0 100%; }
@keyframes bubble-pop {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.typing .bubble { display: inline-flex; gap: 4px; padding: 12px 14px; }
.typing .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c-muted); animation: typing-dot 1.2s infinite ease-in-out; }
.typing .dot:nth-child(2) { animation-delay: 0.18s; }
.typing .dot:nth-child(3) { animation-delay: 0.36s; }
@keyframes typing-dot {
  0%, 70%, 100% { opacity: 0.35; transform: translateY(0); }
  35% { opacity: 1; transform: translateY(-2px); }
}

.receipt { text-align: right; color: var(--c-muted); font-size: 11px; font-weight: 500; margin: 3px 4px 0 0; }

.msg.failed .bubble { opacity: 0.75; }
.undelivered {
  align-self: flex-end;
  margin: 3px 2px 0 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--c-danger);
  font: 500 11px/1.3 inherit;
  font-family: inherit;
  cursor: pointer;
}

.note { font-size: 11px; color: var(--c-muted); margin: 2px 8px 0; }
.note.ok { color: #1f9d55; }
.note.ko { color: var(--c-danger); }

/* Cartes à jouer */
.cards { position: relative; z-index: 1; display: inline-flex; flex-wrap: wrap; gap: 5px; vertical-align: middle; margin: 4px 0; }
.card {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 34px;
  height: 46px;
  border-radius: 6px;
  background: var(--c-card);
  color: var(--c-card-ink);
  box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.25), 0 1px 2px rgba(0, 0, 0, 0.25);
  font: 700 15px/1 -apple-system, BlinkMacSystemFont, "SF Pro Rounded", system-ui, sans-serif;
  letter-spacing: -0.5px;
  white-space: nowrap;
}
.card svg { width: 16px; height: 16px; fill: currentColor; }
.card.red { color: var(--c-card-red); }
.card i { font-style: normal; font-size: 14px; opacity: 0.4; }
