/* ─── Screens ─────────────────────────────────────────────────── */
.zm-screen {
  display: none;
  max-width: 480px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}
.zm-screen.active {
  display: flex;
}

/* Lobby screen plus large pour les deux colonnes */
.zm-screen--wide {
  max-width: 860px;
}

/* ─── Layout lobby deux colonnes ───────────────────────────────── */
.zm-lobby-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  width: 100%;
  align-items: start;
}

.zm-lobby-left {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}
.zm-lobby-right {
  min-width: 0;
}

@media (max-width: 640px) {
  .zm-lobby-layout { grid-template-columns: 1fr; }
}

/* ─── Leaderboard ──────────────────────────────────────────────── */
.zm-leaderboard {
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: 16px;
  padding: 1.1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.zm-lb-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.zm-lb-toggle {
  display: flex;
  gap: 0.3rem;
}

.zm-lb-mode-btn {
  background: none;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 0.25rem 0.6rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.zm-lb-mode-btn:hover { border-color: var(--accent); color: var(--accent); }
.zm-lb-mode-btn.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
}

.zm-lb-title {
  font-size: 0.9rem;
  font-weight: 800;
  margin: 0;
  letter-spacing: -0.01em;
}

.zm-lb-loading,
.zm-lb-empty {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: center;
  margin: 0;
  padding: 1rem 0;
}

.zm-lb-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
}
.zm-lb-row:last-child { border-bottom: none; }

.zm-lb-medal {
  font-size: 1rem;
  width: 1.4rem;
  text-align: center;
  flex-shrink: 0;
}

.zm-lb-rank {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
}

.zm-lb-av {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.zm-lb-av--initial {
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
}

.zm-lb-name {
  flex: 1;
  font-size: 0.82rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.zm-lb-winrate {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--accent);
  flex-shrink: 0;
}

.zm-lb-record {
  font-size: 0.72rem;
  color: var(--text-muted);
  flex-shrink: 0;
  white-space: nowrap;
}

/* ─── Queue dots ───────────────────────────────────────────────── */
.zm-queue-dots {
  display: flex;
  gap: 0.5rem;
}
.zm-queue-dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  animation: zm-dot-bounce 1.2s ease-in-out infinite;
}
.zm-queue-dots span:nth-child(2) { animation-delay: 0.2s; }
.zm-queue-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes zm-dot-bounce {
  0%, 80%, 100% { transform: translateY(0); }
  40%           { transform: translateY(-8px); }
}

/* ─── Lobby ───────────────────────────────────────────────────── */
.zm-title {
  font-size: 2rem;
  font-weight: 900;
  text-align: center;
  margin: 0;
  letter-spacing: -0.02em;
}

.zm-sub {
  color: var(--text-muted);
  text-align: center;
  font-size: 0.95rem;
  margin: 0;
}

.zm-how-to {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 0.75rem 1rem;
  width: 100%;
}

.zm-how-step {
  font-size: 0.79rem;
  color: var(--text-muted);
  line-height: 1.4;
  text-align: center;
}

.zm-how-icon {
  width: 14px;
  height: 14px;
  object-fit: contain;
  vertical-align: middle;
  image-rendering: pixelated;
}

.zm-lobby-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
  width: 100%;
  max-width: 320px;
}

/* ── Find match card button ── */
.zm-btn-find {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 16px;
  padding: 1rem 1.1rem;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 4px 16px color-mix(in srgb, var(--accent) 38%, transparent);
}
.zm-btn-find:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px color-mix(in srgb, var(--accent) 50%, transparent);
}
.zm-btn-find:active { transform: translateY(0); }

.zm-find-icon { font-size: 1.7rem; flex-shrink: 0; line-height: 1; }

.zm-find-text {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 0.1rem;
}
.zm-find-text strong { font-size: 1rem; font-weight: 800; display: block; }
.zm-find-text small  { font-size: 0.78rem; opacity: 0.82; display: block; }

.zm-find-arrow {
  font-size: 1.6rem;
  opacity: 0.75;
  flex-shrink: 0;
  line-height: 1;
}

/* ── Divider ── */
.zm-divider {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  color: var(--text-muted);
  font-size: 0.78rem;
}
.zm-divider::before,
.zm-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Private box ── */
.zm-private-box {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
}

.zm-btn-secondary {
  background: var(--card-bg);
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 0.7rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s;
  white-space: nowrap;
}
.zm-btn-secondary:hover { border-color: var(--accent); }
.zm-btn-full { width: 100%; }

.zm-btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 0.75rem 2rem;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  font-family: inherit;
  transition: opacity 0.15s;
}
.zm-btn-primary:hover { opacity: 0.85; }

.zm-join-row {
  display: flex;
  gap: 0.5rem;
  width: 100%;
  justify-content: center;
}

.zm-code-input {
  flex: 1;
  min-width: 0;
  padding: 0.7rem 0.75rem;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-weight: 700;
  text-align: center;
  font-family: inherit;
  outline: none;
}
.zm-code-input:focus { border-color: var(--accent); }

.zm-error {
  color: #ef4444;
  font-size: 0.85rem;
  text-align: center;
}

/* ─── Waiting ─────────────────────────────────────────────────── */
.zm-room-code-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem 2rem;
  width: 100%;
  max-width: 300px;
}

.zm-room-label {
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin: 0;
}

.zm-room-code {
  font-size: 2.5rem;
  font-weight: 900;
  letter-spacing: 0.25em;
  color: var(--accent);
}

.zm-copy-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  width: 100%;
  justify-content: center;
}

.zm-btn-copy {
  background: none;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 0.5rem 0.6rem;
  font-size: 0.78rem;
  cursor: pointer;
  color: var(--text);
  transition: border-color 0.15s;
  flex: 1 1 auto;
  min-width: 0;
  text-align: center;
}
.zm-btn-copy:hover { border-color: var(--accent); }

.zm-copy-confirm {
  color: #22c55e;
  font-size: 0.85rem;
  margin: 0;
}

.zm-waiting-hint {
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
  margin: 0;
}

/* ─── Players row ─────────────────────────────────────────────── */
.zm-players-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  width: 100%;
}

.zm-player {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  flex: 1;
  padding: 0.6rem;
  border-radius: 12px;
  border: 2px solid transparent;
  transition: border-color 0.2s, background 0.2s;
}

.zm-player--active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.zm-player--me .zm-player-name::after {
  content: ' (toi)';
  font-size: 0.7em;
  color: var(--text-muted);
}

.zm-player-av {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--card-bg);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
  background-size: cover;
  background-position: center;
  overflow: hidden;
}

.zm-player-name {
  font-size: 0.8rem;
  font-weight: 600;
  text-align: center;
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.zm-player-record {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-align: center;
  white-space: nowrap;
}

.zm-vs-badge {
  font-size: 0.85rem;
  font-weight: 900;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* ─── Turn bar ────────────────────────────────────────────────── */
.zm-turn-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
}

.zm-turn-label {
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
  min-width: 140px;
}

.zm-turn--mine   { color: var(--accent); }
.zm-turn--theirs { color: var(--text-muted); }

.zm-timer-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
}

.zm-timer-track {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}

.zm-timer-fill {
  height: 100%;
  background: #22c55e;
  border-radius: 99px;
  transition: width 0.9s linear, background 0.5s;
}

.zm-timer-fill--mid { background: #f59e0b; }
.zm-timer-fill--low { background: #ef4444; }

.zm-timer-num {
  font-size: 0.85rem;
  font-weight: 700;
  min-width: 24px;
  text-align: right;
}

/* ─── Sprite zoomé ───────────────────────────────────────────── */
#zm-sprite {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  opacity: 0;
  -webkit-user-drag: none;
  user-select: none;
  pointer-events: none;
}

#zm-sprite.ready {
  opacity: 1;
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ─── Wrong guesses ───────────────────────────────────────────── */

/* ─── Forfeit button ──────────────────────────────────────────── */
.zm-btn-forfeit {
  background: none;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 0.4rem 1rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s, color 0.15s;
  opacity: 0.6;
}
.zm-btn-forfeit:hover { border-color: #ef4444; color: #ef4444; opacity: 1; }
.zm-btn-forfeit--confirm {
  border-color: #ef4444;
  color: #ef4444;
  opacity: 1;
  animation: zm-forfeit-pulse 0.5s ease;
}
@keyframes zm-forfeit-pulse {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.06); }
  100% { transform: scale(1); }
}

/* ─── Anti-cheat alert ────────────────────────────────────────── */
.zm-cheat-alert {
  background: #fef3c7;
  color: #92400e;
  border: 1.5px solid #fbbf24;
  border-radius: 10px;
  padding: 0.6rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  width: 100%;
}

/* ─── Result ──────────────────────────────────────────────────── */
.zm-result-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  text-align: center;
  padding-top: 2rem;
}

.zm-result-emoji { font-size: 3rem; }

.zm-result-title {
  font-size: 1.6rem;
  font-weight: 900;
}
.zm-win  { color: #22c55e; }
.zm-lose { color: #ef4444; }

.zm-result-sprite {
  width: 120px;
  height: 120px;
  object-fit: contain;
  image-rendering: pixelated;
}

.zm-result-reason {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: -0.25rem 0 0;
}

.zm-result-name {
  font-size: 1.2rem;
  font-weight: 700;
}

/* ─── Game input & autocomplete ───────────────────────────────── */
.zoom-input-wrap {
  position: relative;
  width: 100%;
  max-width: 360px;
}

#zm-input {
  width: 100%;
  padding: 0.85rem 1.1rem;
  border-radius: 14px;
  border: 2px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
}

#zm-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

#zm-input:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

#zm-autocomplete {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  list-style: none;
  margin: 0;
  padding: 0.3rem 0;
  z-index: 100;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  overflow: hidden;
}

#zm-autocomplete li {
  padding: 0.6rem 1rem;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  transition: background 0.1s;
}

#zm-autocomplete li:hover {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
}
