:root {
  color-scheme: dark;
  --bg: #070c12;
  --surface: #0b1118;
  --panel: #111b26;
  --panel-alt: #162433;
  --line: #233548;
  --text: #edf4fb;
  --muted: #8ea5bc;
  --cyan: #1aebff;
  --emerald: #19c37d;
  --emerald-dark: #0e7c4e;
  --gold: #f5c451;
  --danger: #ff5d6c;
  --danger-bg: #3b1720;
  --radius: 16px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100dvh;
  overscroll-behavior-y: none;
  background: radial-gradient(circle at 50% 0%, #102030 0%, var(--bg) 62%);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

/* Mobile-first shell, agrandi proprement sur PC de bureau */
.app-shell {
  width: 100%;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  position: relative;
  overscroll-behavior: contain;
}

@media (min-width: 600px) {
  body {
    padding: 22px 16px;
    font-size: 17px;
  }
  .app-shell {
    max-width: 520px;
    min-height: calc(100dvh - 44px);
    border: 1px solid var(--line);
    border-radius: 26px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
    overflow: hidden;
  }
}

/* En-tête */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  background: rgba(11, 17, 24, 0.94);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.brand-btn {
  display: flex;
  align-items: center;
  gap: 11px;
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
  text-align: left;
  cursor: pointer;
  min-height: 44px;
}

.brand-btn img {
  border-radius: 10px;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 3px 10px rgba(0, 0, 0, 0.35));
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text);
}

.brand-sub {
  font-size: 0.76rem;
  color: var(--muted);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.live-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 0 0 rgba(25, 195, 125, 0.7);
  animation: livePulse 2.2s infinite;
  margin-right: 4px;
}

.live-dot.offline {
  background: var(--gold);
  animation: none;
}

@keyframes livePulse {
  0% { box-shadow: 0 0 0 0 rgba(25, 195, 125, 0.65); }
  70% { box-shadow: 0 0 0 8px rgba(25, 195, 125, 0); }
  100% { box-shadow: 0 0 0 0 rgba(25, 195, 125, 0); }
}

.icon-btn {
  display: grid;
  place-items: center;
  min-width: 42px;
  height: 42px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font-size: 1.15rem;
  text-decoration: none;
  cursor: pointer;
}

.desktop-cert { display: none; }
@media (pointer: fine) and (hover: hover) {
  .desktop-cert { display: grid; color: var(--cyan); }
  .desktop-cert:hover { background: var(--panel-alt); }
}

/* Sélecteur de rôle quand le banquier joue aussi */
.role-switcher {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 10px 16px 0;
}

.switch-pill {
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.mini-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
  flex: none;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.45));
}

.switch-pill.active {
  background: rgba(26, 235, 255, 0.14);
  border-color: var(--cyan);
  color: var(--cyan);
}

/* Notifications flottantes temps réel */
.toast-stack {
  position: fixed;
  top: calc(14px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  width: min(calc(100vw - 24px), 488px);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border-radius: 15px;
  background: #102430;
  border: 1px solid var(--cyan);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.6);
  animation: toastIn 0.25s cubic-bezier(0.2, 0.9, 0.3, 1);
  cursor: pointer;
}

.toast.money-in {
  background: #0d2b22;
  border-color: var(--emerald);
}

.toast.money-out {
  background: #231a2a;
  border-color: var(--gold);
}

.toast.danger {
  background: var(--danger-bg);
  border-color: var(--danger);
}

.toast-icon {
  font-size: 1.45rem;
  line-height: 1;
  flex: none;
}

.toast-body {
  flex: 1;
  min-width: 0;
}

.toast-title {
  font-weight: 800;
  font-size: 0.98rem;
  color: #fff;
}

.toast-sub {
  font-size: 0.84rem;
  color: #b7cde0;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-14px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Contenu principal */
.content {
  flex: 1;
  padding: 16px 16px calc(24px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}

.view {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

h1, h2, h3 { margin: 0; letter-spacing: -0.02em; }
h1 { font-size: 1.65rem; }
h2 { font-size: 1.28rem; }
.muted { color: var(--muted); margin: 0; }
.small { font-size: 0.88rem; }
.center-text { text-align: center; }

button, input, select { font: inherit; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

/* Accueil */
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  padding: 18px 8px 6px;
}

.hero-logo {
  border-radius: 22px;
  object-fit: contain;
  filter: drop-shadow(0 12px 26px rgba(0, 0, 0, 0.45));
}

#home-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--line);
  font-size: 0.86rem;
}

.resume-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.resume-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--emerald);
  background: linear-gradient(135deg, rgba(25, 195, 125, 0.2), rgba(17, 27, 38, 0.95));
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
}

.resume-btn span.resume-sub {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: #bcebd7;
}

.mode-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 6px;
}

.mode-card {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 20px 18px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.15s ease;
}

.mode-card:active { transform: scale(0.985); }

.mode-player {
  border-color: rgba(25, 195, 125, 0.55);
  background: linear-gradient(135deg, rgba(25, 195, 125, 0.18), var(--panel) 65%);
}

.mode-bank {
  border-color: rgba(245, 196, 81, 0.5);
  background: linear-gradient(135deg, rgba(245, 196, 81, 0.16), var(--panel) 65%);
}

.mode-icon {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  font-size: 1.75rem;
  background: rgba(255, 255, 255, 0.05);
  padding: 5px;
  flex: none;
}

.mode-art img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.48));
}

.takeover-art {
  object-fit: contain;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.5));
}

/* Sélecteur de pions Monopoly (8 pions dorés) */
.pawn-picker-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pawn-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}

.modal-pawn-grid {
  margin-top: 12px;
}

.pawn-option {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px 6px;
  border-radius: 13px;
  border: 1.5px solid var(--line);
  background: #0b141f;
  color: var(--muted);
  cursor: pointer;
  transition: transform 0.1s ease, border-color 0.15s ease, background 0.15s ease;
}

.pawn-option img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.55));
}

.pawn-option span {
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.pawn-option.selected {
  border-color: var(--gold);
  background: radial-gradient(circle at 50% 35%, rgba(245, 196, 81, 0.24), #0e1925 80%);
  color: var(--gold);
  box-shadow: 0 0 0 2px rgba(245, 196, 81, 0.18);
}

.pawn-option.taken:not(.selected) {
  opacity: 0.58;
}

.pawn-option.taken::after {
  content: 'Pris';
  position: absolute;
  top: 4px;
  right: 4px;
  padding: 1px 4px;
  border-radius: 5px;
  background: rgba(11, 17, 24, 0.88);
  color: var(--muted);
  font-size: 0.6rem;
  font-weight: 800;
}

.pawn-badge {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: radial-gradient(circle at 50% 35%, rgba(245, 196, 81, 0.16), #0a121b 82%);
  border: 1.5px solid var(--pawn-ring, rgba(245, 196, 81, 0.4));
  display: grid;
  place-items: center;
  padding: 4px;
  flex: none;
}

.pawn-badge.clickable {
  cursor: pointer;
}

.pawn-badge img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.5));
}

.pawn-sm {
  width: 26px;
  height: 26px;
  object-fit: contain;
  display: block;
  flex: none;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

.chip-pawn-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  cursor: pointer;
  font-weight: 700;
}

.resume-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.resume-pawn {
  width: 40px;
  height: 40px;
  object-fit: contain;
  flex: none;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5));
}

.mode-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.mode-title {
  font-size: 1.18rem;
  font-weight: 800;
}

.mode-desc {
  font-size: 0.86rem;
  color: var(--muted);
}

.mode-arrow {
  font-size: 1.7rem;
  color: var(--muted);
  line-height: 1;
}

.home-footer {
  margin-top: auto;
  padding-top: 12px;
  display: flex;
  justify-content: center;
}

/* En-tête de vue */
.view-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-back {
  min-height: 40px;
  padding: 6px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--cyan);
  font-weight: 700;
  cursor: pointer;
}

/* Cartes & Boutons */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.center-card {
  align-items: center;
  text-align: center;
  padding: 24px 18px;
}

.big-emoji { font-size: 2.8rem; }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.section-title {
  font-size: 0.96rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.field-hint {
  margin: 0;
  font-size: 0.86rem;
  color: var(--muted);
}

.btn-primary, .btn-emerald, .btn-secondary, .btn-danger, .btn-danger-outline, .btn-danger-ghost, .btn-ghost, .btn-mini, .btn-text {
  min-height: 46px;
  padding: 10px 16px;
  border-radius: 13px;
  border: 1px solid transparent;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.1s ease, opacity 0.15s ease;
}

button:active { transform: scale(0.98); }
button:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary {
  background: var(--cyan);
  color: #031c24;
}

.btn-emerald {
  background: linear-gradient(135deg, #1fd489, #12a868);
  color: #032215;
}

.btn-secondary {
  background: var(--panel-alt);
  border-color: var(--line);
  color: var(--text);
}

.btn-danger {
  background: #c53146;
  color: #fff;
}

.btn-danger-outline {
  background: transparent;
  border-color: rgba(255, 93, 108, 0.5);
  color: #ff9ea7;
}

.btn-danger-ghost {
  background: transparent;
  color: #ff9ea7;
}

.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--muted);
}

.btn-mini {
  min-height: 34px;
  padding: 4px 10px;
  border-radius: 9px;
  background: var(--panel-alt);
  border-color: var(--line);
  color: var(--cyan);
  font-size: 0.82rem;
}

.btn-text {
  min-height: 32px;
  padding: 4px 8px;
  background: transparent;
  color: var(--cyan);
  font-size: 0.84rem;
}

.btn-lg { min-height: 54px; font-size: 1.05rem; }
.btn-block { width: 100%; }

/* Éditions */
.edition-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 0.75fr;
  gap: 8px;
}

.edition-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 13px 8px;
  border-radius: 13px;
  border: 2px solid var(--line);
  background: #0c151f;
  color: var(--text);
  cursor: pointer;
}

.edition-btn.selected {
  border-color: var(--emerald);
  background: rgba(25, 195, 125, 0.16);
}

.ed-name { font-weight: 800; font-size: 0.96rem; }
.ed-amount { font-size: 0.88rem; color: var(--gold); font-weight: 700; }

.custom-amount-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.custom-amount-row input, .field-block input, .field-block select {
  width: 100%;
  min-height: 46px;
  padding: 10px 13px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: #091119;
  color: var(--text);
}

/* Registre joueurs façon SNCF */
.registry-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.registry-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 6px 12px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: #0c151f;
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
  user-select: none;
}

.registry-pill.checked {
  border-color: var(--cyan);
  background: rgba(26, 235, 255, 0.14);
}

.registry-check {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 2px solid var(--muted);
  display: grid;
  place-items: center;
  font-size: 0.82rem;
  font-weight: 900;
}

.registry-pill.checked .registry-check {
  background: var(--cyan);
  border-color: var(--cyan);
  color: #031c24;
}

.registry-del {
  margin-left: 2px;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 0;
  background: rgba(255, 93, 108, 0.25);
  color: #ffb0b8;
  font-weight: 900;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.add-player-form {
  display: flex;
  gap: 8px;
}

.add-player-form input {
  flex: 1;
  min-width: 0;
  min-height: 48px;
  padding: 10px 14px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: #091119;
  color: var(--text);
}

.add-player-form.compact input { min-height: 44px; }

.btn-plus {
  width: 52px;
  min-height: 48px;
  border-radius: 13px;
  border: 0;
  background: var(--emerald);
  color: #032215;
  font-size: 1.6rem;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  flex: none;
}

.selected-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.player-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px 7px 8px;
  border-radius: 999px;
  background: var(--panel-alt);
  border: 1px solid var(--line);
  font-weight: 700;
  font-size: 0.92rem;
}

.chip-remove {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 0.95rem;
}

/* Badges & Avatars */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(245, 196, 81, 0.16);
  border: 1px solid rgba(245, 196, 81, 0.4);
  color: var(--gold);
  font-size: 0.8rem;
  font-weight: 700;
}

.counter-pill {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--panel-alt);
  border: 1px solid var(--line);
  font-weight: 800;
  color: var(--cyan);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  background: rgba(245, 196, 81, 0.14);
  color: var(--gold);
}

.status-badge.connected {
  background: rgba(25, 195, 125, 0.18);
  color: var(--emerald);
}

.avatar-dot {
  width: 40px;
  height: 40px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 1.05rem;
  color: #061018;
  flex: none;
}

.avatar-dot.sm {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  font-size: 0.78rem;
}

/* Salle d'attente & Liste joueurs Banque */
.lobby-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.lobby-banner h2 { margin-top: 6px; }

.player-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.player-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px;
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.player-card-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.player-info {
  flex: 1;
  min-width: 0;
}

.player-name {
  font-weight: 800;
  font-size: 1.06rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
  font-size: 0.8rem;
  color: var(--muted);
}

.player-balance {
  font-size: 1.35rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: #fff;
  white-space: nowrap;
}

.player-balance.low { color: var(--danger); }

.player-actions {
  display: grid;
  grid-template-columns: 1.15fr 1fr 1fr auto;
  gap: 6px;
}

.p-act {
  min-height: 40px;
  padding: 6px 8px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel-alt);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.p-act.go {
  background: rgba(25, 195, 125, 0.16);
  border-color: rgba(25, 195, 125, 0.45);
  color: #6df3b8;
}

.p-act.credit { color: var(--cyan); }
.p-act.debit { color: #ff9ea7; }
.p-act.qr { padding: 6px 12px; color: var(--gold); }

.lobby-row-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-qr-open {
  min-height: 42px;
  padding: 6px 13px;
  border-radius: 11px;
  border: 1px solid rgba(26, 235, 255, 0.5);
  background: rgba(26, 235, 255, 0.14);
  color: var(--cyan);
  font-weight: 800;
  font-size: 0.88rem;
  cursor: pointer;
}

.btn-icon-del {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 1.2rem;
  cursor: pointer;
}

.sticky-cta {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Tableau de bord Banque */
.bank-summary {
  background: linear-gradient(135deg, #132535, #0e1925);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bank-summary-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.last-receipt {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.receipt-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.receipt-text {
  font-weight: 800;
  font-size: 1.02rem;
  color: var(--emerald);
}

.seg-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  border-radius: 14px;
  background: #091018;
  border: 1px solid var(--line);
}

.seg-tab {
  min-height: 42px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.seg-tab.active {
  background: var(--panel-alt);
  color: #fff;
}

.tab-count {
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(26, 235, 255, 0.16);
  color: var(--cyan);
  font-size: 0.78rem;
}

.bank-danger-zone {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

/* Mode Joueur : Carte bancaire & Paiement */
.wallet-card {
  position: relative;
  border-radius: 22px;
  padding: 20px;
  background: linear-gradient(145deg, #132c3d 0%, #0d1b29 60%, #0b241d 100%);
  border: 1px solid rgba(26, 235, 255, 0.3);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.wallet-card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 5px;
  background: var(--player-accent, var(--emerald));
}

.wallet-card.flash-in {
  border-color: var(--emerald);
  box-shadow: 0 0 0 3px rgba(25, 195, 125, 0.35), 0 16px 40px rgba(0, 0, 0, 0.45);
}

.wallet-card.flash-out {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(245, 196, 81, 0.3), 0 16px 40px rgba(0, 0, 0, 0.45);
}

.wallet-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.wallet-identity {
  display: flex;
  align-items: center;
  gap: 13px;
}

.wallet-pawn-wrap {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  padding: 5px;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 35%, rgba(245, 196, 81, 0.25), rgba(8, 16, 24, 0.88) 78%);
  border: 1.5px solid rgba(245, 196, 81, 0.55);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.42);
  flex: none;
}

.wallet-pawn {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.55));
}

.lobby-pawn-hero {
  width: 84px;
  height: 84px;
  object-fit: contain;
  display: block;
  margin-top: 6px;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.55));
}

.pulse-ring img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  display: block;
}

.modal-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.modal-pawn {
  width: 40px;
  height: 40px;
  object-fit: contain;
  flex: none;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.5));
}

.wallet-name {
  font-size: 1.2rem;
  font-weight: 800;
}

.wallet-sub {
  font-size: 0.8rem;
  color: var(--muted);
}

.chip-mark {
  width: 38px;
  height: 28px;
  border-radius: 7px;
  background: linear-gradient(135deg, #f8d777, #c8972c);
  opacity: 0.9;
}

.wallet-balance-wrap {
  margin-top: 24px;
}

.wallet-label {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #9cb4c9;
}

.wallet-balance {
  font-size: clamp(2.4rem, 11vw, 3.2rem);
  font-weight: 900;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  color: #fff;
  margin-top: 4px;
}

.btn-pay-hero {
  width: 100%;
  min-height: 64px;
  margin-top: 4px;
  border-radius: 18px;
  border: 0;
  background: linear-gradient(135deg, #1fd489, #10a567);
  color: #032215;
  font-size: 1.28rem;
  font-weight: 900;
  letter-spacing: 0.01em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  cursor: pointer;
  box-shadow: 0 10px 26px rgba(25, 195, 125, 0.28);
}

.pay-hero-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(3, 34, 21, 0.18);
  display: grid;
  place-items: center;
  font-size: 1.25rem;
}

.pulse-ring {
  width: 78px;
  height: 78px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 2rem;
  background: rgba(26, 235, 255, 0.12);
  border: 2px solid rgba(26, 235, 255, 0.45);
  margin: 10px 0;
  animation: livePulse 2s infinite;
}

.waiting-title {
  font-size: 1.12rem;
  font-weight: 800;
  margin: 0;
}

.lobby-peers {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-top: 6px;
}

.player-footer {
  margin-top: 12px;
}

/* Historique */
.tx-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tx-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 13px;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
}

.tx-item.reverted {
  opacity: 0.52;
  text-decoration: line-through;
}

.tx-icon {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-size: 1.05rem;
  background: var(--panel-alt);
  flex: none;
}

.tx-body {
  flex: 1;
  min-width: 0;
}

.tx-title {
  font-weight: 700;
  font-size: 0.94rem;
}

.tx-meta {
  font-size: 0.78rem;
  color: var(--muted);
}

.tx-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.tx-amount {
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.tx-amount.pos { color: var(--emerald); }
.tx-amount.neg { color: #ff8e99; }
.tx-amount.neutral { color: var(--gold); }

.btn-undo {
  min-height: 28px;
  padding: 2px 9px;
  border-radius: 8px;
  border: 1px solid rgba(255, 93, 108, 0.45);
  background: transparent;
  color: #ffa6af;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}

.empty-state {
  text-align: center;
  padding: 22px 12px;
  color: var(--muted);
  font-size: 0.92rem;
}

/* Scanner caméra */
.scanner-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.camera-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 22px;
  overflow: hidden;
  background: #04080d;
  border: 2px solid var(--line);
}

#scanner-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.scan-frame {
  position: absolute;
  inset: 16%;
  pointer-events: none;
}

.corner {
  position: absolute;
  width: 30px;
  height: 30px;
  border-color: var(--cyan);
  border-style: solid;
  border-width: 0;
}

.corner.tl { top: 0; left: 0; border-top-width: 4px; border-left-width: 4px; border-top-left-radius: 10px; }
.corner.tr { top: 0; right: 0; border-top-width: 4px; border-right-width: 4px; border-top-right-radius: 10px; }
.corner.bl { bottom: 0; left: 0; border-bottom-width: 4px; border-left-width: 4px; border-bottom-left-radius: 10px; }
.corner.br { bottom: 0; right: 0; border-bottom-width: 4px; border-right-width: 4px; border-bottom-right-radius: 10px; }

.scan-beam {
  position: absolute;
  left: 6%;
  right: 6%;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
  box-shadow: 0 0 12px var(--cyan);
  animation: beamMove 2.2s ease-in-out infinite;
}

@keyframes beamMove {
  0%, 100% { top: 8%; }
  50% { top: 88%; }
}

.camera-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  text-align: center;
  background: rgba(7, 12, 18, 0.84);
  color: var(--text);
}

.scanner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.scanner-actions > * { flex: 1; }

.manual-fallback {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
}

.manual-fallback summary {
  cursor: pointer;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.9rem;
}

.inline-form {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.inline-form input {
  flex: 1;
  min-width: 0;
  min-height: 46px;
  padding: 10px 12px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: #091119;
  color: var(--text);
  font-family: monospace;
  font-size: 1.05rem;
  letter-spacing: 0.08em;
}

/* Modals */
.modal {
  width: min(94vw, 480px);
  max-height: 92dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.72);
}

.modal::backdrop {
  background: rgba(3, 8, 14, 0.82);
  backdrop-filter: blur(4px);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.modal-close {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  border: 0;
  background: var(--panel-alt);
  color: var(--text);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}

.qr-status-row {
  display: flex;
  justify-content: center;
  margin-bottom: 10px;
}

.qr-paper {
  background: #fff;
  color: #0b1118;
  border-radius: 16px;
  padding: 16px;
  text-align: center;
  margin-bottom: 12px;
}

.qr-paper img {
  display: block;
  width: min(100%, 290px);
  margin: 0 auto;
  image-rendering: pixelated;
}

.qr-manual-code {
  margin-top: 10px;
  font-size: 0.92rem;
  color: #314357;
}

.qr-manual-code strong {
  font-family: monospace;
  font-size: 1.1rem;
  letter-spacing: 0.08em;
  color: #0b1118;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.modal-actions > * { flex: 1; }

.modal-actions-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

/* Saisie montant + clavier téléphonique */
.amount-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 16px;
  background: #081018;
  border: 2px solid var(--cyan);
}

.amount-input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 2.2rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  text-align: right;
  outline: none;
}

.amount-currency {
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--emerald);
}

.amount-clear {
  width: 44px;
  height: 44px;
  border-radius: 11px;
  border: 0;
  background: var(--panel-alt);
  color: var(--muted);
  font-size: 1.2rem;
  cursor: pointer;
}

.quick-chips {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-top: 10px;
}

.chip-btn {
  min-height: 40px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--panel-alt);
  color: var(--cyan);
  font-weight: 800;
  cursor: pointer;
}

.available-hint {
  margin: 10px 0 0;
  font-size: 0.88rem;
  color: var(--muted);
  text-align: center;
}

.recipients-section {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.recipient-btn {
  width: 100%;
  min-height: 56px;
  padding: 10px 14px;
  border-radius: 15px;
  border: 1.5px solid var(--line);
  background: var(--panel-alt);
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  font-size: 1.02rem;
  cursor: pointer;
  text-align: left;
}

.recipient-bank {
  border-color: rgba(245, 196, 81, 0.65);
  background: linear-gradient(135deg, rgba(245, 196, 81, 0.2), var(--panel-alt));
}

.rec-avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  padding: 4px;
  background: radial-gradient(circle at 50% 35%, rgba(245, 196, 81, 0.16), #0a121b 82%);
  border: 1px solid rgba(245, 196, 81, 0.35);
  flex: none;
}

.rec-avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.48));
}

.rec-avatar.bank-av {
  background: rgba(245, 196, 81, 0.2);
  border-color: rgba(245, 196, 81, 0.55);
}

.rec-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-arrow { color: var(--muted); font-size: 1.2rem; }

.recipient-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.recipient-grid .recipient-btn {
  min-height: 52px;
  padding: 8px 10px;
  font-size: 0.96rem;
}

.field-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
}

.field-block label {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 700;
}

.status-line {
  min-height: 1.2em;
  margin: 0;
  color: var(--cyan);
  font-size: 0.9rem;
  text-align: center;
}

.error-line {
  min-height: 1.2em;
  margin: 4px 0 0;
  color: #ff9ba5;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
}

.podium-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 12px 0;
}

.podium-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  border-radius: 11px;
  background: #0b141e;
  border: 1px solid var(--line);
  font-weight: 700;
}
