:root {
  --bg: #08141f;
  --bg-2: #102334;
  --panel: rgba(12, 24, 37, 0.76);
  --panel-soft: rgba(255, 255, 255, 0.07);
  --panel-strong: rgba(255, 255, 255, 0.1);
  --text: #f7fbff;
  --muted: #b8cad8;
  --border: rgba(255, 255, 255, 0.14);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
  --red: #e53935;
  --blue: #1e88e5;
  --green: #43a047;
  --yellow: #fbc02d;
  --wild: #1b2028;
  --table-glow: rgba(91, 222, 171, 0.22);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 5%, rgba(229, 57, 53, 0.18), transparent 24%),
    radial-gradient(circle at 90% 10%, rgba(30, 136, 229, 0.18), transparent 22%),
    radial-gradient(circle at 10% 90%, rgba(67, 160, 71, 0.16), transparent 24%),
    linear-gradient(160deg, #08121a, #0e2132 42%, #09161f 100%);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
  border: 0;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.04);
}

input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  outline: none;
}

input:focus {
  border-color: rgba(255, 255, 255, 0.42);
  box-shadow: 0 0 0 3px rgba(30, 136, 229, 0.18);
}

.app {
  width: min(1500px, calc(100% - 18px));
  margin: 0 auto;
  padding: 10px 0 18px;
}

.hidden {
  display: none !important;
}

.panel,
.game {
  border: 1px solid var(--border);
  border-radius: 28px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.home-panel {
  margin-top: 34px;
  padding: 34px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 28px;
}

.brand-icon {
  width: 80px;
  height: 80px;
  border-radius: 24px;
  display: grid;
  place-items: center;
  font-size: 24px;
  font-weight: 900;
  background: conic-gradient(from 45deg, var(--red), var(--yellow), var(--green), var(--blue), var(--red));
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.28);
}

h1,
h2,
p {
  margin-top: 0;
}

.brand h1,
.game-header h1 {
  margin-bottom: 4px;
  font-size: clamp(30px, 4vw, 46px);
  line-height: 1;
  letter-spacing: -1.4px;
}

.brand p,
.game-header p,
.card-box p,
.helper-text,
.history-note {
  color: var(--muted);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  margin-bottom: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #d8e8f3;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.card-box,
.side-card,
.hand-section {
  padding: 16px;
  border-radius: 24px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.08);
}

.card-box h2,
.side-card h2,
.hand-section h2 {
  margin-bottom: 12px;
}

label {
  display: block;
  margin: 14px 0 8px;
  color: var(--muted);
}

.code-input {
  text-transform: uppercase;
  letter-spacing: 4px;
  font-weight: 800;
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.danger-btn,
.uno-btn,
.pass-btn {
  min-height: 46px;
  padding: 12px 18px;
  border-radius: 14px;
  color: var(--text);
  font-weight: 800;
  transition: transform 0.15s ease, filter 0.15s ease, background 0.15s ease;
}

.primary-btn,
.secondary-btn {
  width: 100%;
  margin-top: 20px;
}

.primary-btn {
  background: linear-gradient(135deg, #ff7043, #e53935);
}

.secondary-btn {
  background: linear-gradient(135deg, #1e88e5, #5e35b1);
}

.ghost-btn,
.pass-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border);
}

.danger-btn {
  background: rgba(229, 57, 53, 0.18);
  border: 1px solid rgba(229, 57, 53, 0.45);
  color: #ffcdd2;
}

.uno-btn {
  background: linear-gradient(135deg, #ffe082, #f9a825);
  color: #251902;
  width: 100%;
}

.error-message {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(229, 57, 53, 0.18);
  border: 1px solid rgba(229, 57, 53, 0.35);
}

.game {
  padding: 16px;
}

.game.hand-visible {
  padding-bottom: 250px;
}

.game-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.game-title-block p {
  margin-bottom: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.header-actions .primary-btn,
.header-actions .ghost-btn,
.header-actions .danger-btn {
  width: auto;
  margin-top: 0;
}

.table-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 12px;
  align-items: start;
}

.table-shell {
  padding: 12px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.05), transparent 60%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
}

.turn-banner-wrap {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.turn-banner,
.sub-banner {
  text-align: center;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.turn-banner {
  padding: 12px 14px;
  font-size: clamp(20px, 2.2vw, 28px);
  font-weight: 900;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.04));
}

.sub-banner {
  min-height: 36px;
  padding: 8px 12px;
  color: var(--muted);
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.04);
}

.players-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.player-card {
  min-height: 86px;
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.07);
}

.player-card.active {
  border-color: rgba(251, 192, 45, 0.68);
  box-shadow: 0 0 0 2px rgba(251, 192, 45, 0.2);
}

.player-card.is-me {
  background: rgba(30, 136, 229, 0.12);
}

.player-card.waiting-card {
  grid-template-columns: 1fr;
  min-height: 80px;
  opacity: 0.82;
  border-style: dashed;
}

.player-avatar {
  width: 46px;
  height: 46px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 18px;
  background: linear-gradient(135deg, rgba(255,255,255,0.18), rgba(255,255,255,0.05));
  border: 1px solid rgba(255,255,255,0.12);
}

.player-body {
  min-width: 0;
}

.player-name {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  font-weight: 900;
}

.player-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-seat {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.player-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.12);
}

.badge.uno {
  background: rgba(251, 192, 45, 0.22);
  color: #ffe082;
}

.badge.turn {
  background: rgba(30, 136, 229, 0.2);
  color: #bbdefb;
}

.badge.offline {
  background: rgba(229, 57, 53, 0.22);
  color: #ffcdd2;
}

.table-zone {
  display: grid;
  grid-template-columns: 145px minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
  padding: 12px;
  border-radius: 28px;
  background:
    radial-gradient(circle at center, var(--table-glow), transparent 70%),
    linear-gradient(180deg, #0f513c, #0e4b38 42%, #0a3529 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,0.03);
}

.deck-zone {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 12px;
}

.deck-card,
.playing-card {
  width: 104px;
  height: 152px;
  border-radius: 22px;
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
  box-shadow: 0 16px 35px rgba(0, 0, 0, 0.28);
  border: 7px solid rgba(255, 255, 255, 0.92);
  user-select: none;
}

.deck-card {
  background: repeating-linear-gradient(45deg, #243347, #243347 12px, #32455d 12px, #32455d 24px);
  color: #fff;
}

.deck-card span,
.deck-card strong {
  position: relative;
  z-index: 1;
}

.deck-card strong {
  font-size: 30px;
}

.playing-card {
  color: #fff;
  background: rgba(255, 255, 255, 0.2);
}

.playing-card.red,
.color-choice.red {
  background: var(--red);
}

.playing-card.blue,
.color-choice.blue {
  background: var(--blue);
}

.playing-card.green,
.color-choice.green {
  background: var(--green);
}

.playing-card.yellow,
.color-choice.yellow {
  background: var(--yellow);
  color: #2d2400;
}

.playing-card.wild {
  background: conic-gradient(from 45deg, var(--red), var(--yellow), var(--green), var(--blue), var(--red));
}

.back-card {
  background: rgba(255,255,255,0.12);
}

.playing-card::before {
  content: '';
  position: absolute;
  inset: 14px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  transform: rotate(-22deg);
}

.card-corner,
.card-center {
  position: absolute;
  z-index: 1;
  font-weight: 900;
}

.card-center {
  font-size: 30px;
  text-align: center;
  line-height: 1;
}

.card-corner {
  font-size: 18px;
}

.card-corner-top {
  top: 10px;
  left: 12px;
}

.card-corner-bottom {
  right: 12px;
  bottom: 10px;
  transform: rotate(180deg);
}

.center-desk {
  display: grid;
  gap: 18px;
  align-content: center;
}

.table-badges {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.table-badge {
  min-height: 58px;
  padding: 10px 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: grid;
  gap: 6px;
  align-content: center;
}

.table-badge span {
  font-size: 12px;
  font-weight: 700;
  color: #d4e5da;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.table-badge strong {
  font-size: 16px;
  line-height: 1.2;
}

.center-board {
  min-height: 170px;
  display: grid;
  place-items: center;
}

.discard-stack {
  display: grid;
  justify-items: center;
  gap: 14px;
}

.stack-label {
  display: inline-flex;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255,255,255,0.14);
  color: #d7efe1;
  font-size: 13px;
  font-weight: 800;
}

.side-panel {
  display: grid;
  gap: 12px;
  align-content: start;
}

.vertical-actions {
  display: grid;
  gap: 12px;
}

.action-bar {
  display: flex;
  align-items: center;
  gap: 14px;
}

.helper-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
}

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

.history-head h2 {
  margin-bottom: 0;
}

.history-list {
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
  padding-right: 4px;
}

.history-item,
.history-empty {
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.05);
}

.history-item strong {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
  color: #cfe0eb;
}

.history-item span,
.history-empty {
  color: var(--text);
  line-height: 1.45;
}

.history-empty {
  color: var(--muted);
}

.hand-section {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  width: min(1500px, calc(100% - 18px));
  z-index: 25;
  margin-top: 0;
  padding: 10px 14px 12px;
  border-radius: 22px;
  background: rgba(8, 20, 31, 0.96);
  box-shadow: 0 -18px 55px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(16px);
}

.hand-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.hand-header h2 {
  margin-bottom: 0;
}

.hand {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-wrap: nowrap;
  min-height: 122px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 4px 10px;
  scrollbar-width: thin;
}

.hand .playing-card {
  flex: 0 0 auto;
  width: 78px;
  height: 114px;
  border-width: 5px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.hand .card-center {
  font-size: 22px;
}

.hand .card-corner {
  font-size: 12px;
}

.hand .playing-card.playable:hover:not(:disabled) {
  transform: translateY(-10px) rotate(-1deg);
  box-shadow: 0 22px 45px rgba(0, 0, 0, 0.4);
}

.hand .playing-card.playable {
  box-shadow: 0 0 0 3px rgba(255,255,255,0.15), 0 18px 40px rgba(0, 0, 0, 0.32);
}

.hand .playing-card.not-playable {
  opacity: 0.38;
  filter: grayscale(0.18);
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(10px);
  z-index: 30;
}

.modal-card {
  width: min(460px, 100%);
  padding: 24px;
  border-radius: 24px;
  background: #1b2633;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.color-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin: 20px 0;
}

.color-choice {
  min-height: 84px;
  border-radius: 18px;
  color: #fff;
  font-weight: 900;
  border: 4px solid rgba(255, 255, 255, 0.82);
}

.full-width {
  width: 100%;
}

 .uno-alert {
  position: fixed;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  width: min(440px, calc(100% - 28px));
  pointer-events: none;
  animation: unoAlertIn 0.22s ease-out;
}

.uno-alert.closing {
  animation: unoAlertOut 0.22s ease-in forwards;
}

.uno-alert-card {
  min-height: 0;
  padding: 14px 18px;
  border-radius: 22px;
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: center;
  gap: 12px;
  text-align: left;
  border: 3px solid rgba(255, 255, 255, 0.9);
  color: #221700;
  background: linear-gradient(135deg, rgba(251, 192, 45, 0.98), rgba(255, 152, 0, 0.98));
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(8px);
}

.uno-alert-small {
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.16);
  color: #fff4c2;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.uno-alert-card strong {
  font-size: clamp(30px, 5vw, 48px);
  line-height: 1;
  letter-spacing: -1px;
  text-shadow: 0 3px 0 rgba(255, 255, 255, 0.3);
}

.uno-alert-card p {
  margin: 0;
  font-size: clamp(15px, 2vw, 20px);
  font-weight: 900;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: 360px;
  padding: 14px 16px;
  border-radius: 16px;
  background: #ffffff;
  color: #151822;
  font-weight: 800;
  box-shadow: var(--shadow);
  z-index: 50;
}

@keyframes unoAlertIn {
  from { opacity: 0; transform: translate(-50%, -18px) scale(0.96); }
  to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

@keyframes unoAlertOut {
  from { opacity: 1; transform: translate(-50%, 0) scale(1); }
  to { opacity: 0; transform: translate(-50%, -18px) scale(0.96); }
}

@media (max-width: 1100px) {
  .table-layout {
    grid-template-columns: 1fr;
  }

  .side-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .home-grid,
  .table-zone,
  .table-badges,
  .side-panel {
    grid-template-columns: 1fr;
  }

  .game-header,
  .hand-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-actions {
    justify-content: flex-start;
  }

  .table-zone {
    justify-items: center;
  }

  .center-desk {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .app {
    width: min(100% - 14px, 1400px);
    padding: 8px 0 16px;
  }

  .home-panel,
  .game,
  .table-shell,
  .card-box,
  .side-card,
  .hand-section {
    padding: 18px;
    border-radius: 20px;
  }

  .brand {
    align-items: flex-start;
  }

  .brand-icon {
    width: 62px;
    height: 62px;
    border-radius: 20px;
    font-size: 18px;
  }

  .players-list {
    grid-template-columns: 1fr;
  }

  .deck-card,
  .playing-card {
    width: 118px;
    height: 172px;
  }

  .hand {
    justify-content: center;
  }

  .hand .playing-card {
    width: 92px;
    height: 134px;
  }
}


/* Ergonomie : main toujours visible */
.hand-section {
  position: fixed;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  width: min(1400px, calc(100% - 28px));
  z-index: 25;
}

.hand {
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  justify-content: flex-start;
}

.hand .playing-card {
  flex: 0 0 auto;
}

@media (max-width: 560px) {
  .hand-section {
    width: min(100% - 10px, 1500px);
    bottom: 12px;
    padding: 10px;
  }

  .game {
    padding-bottom: 200px;
  }

  .hand .playing-card {
    width: 74px;
    height: 108px;
  }
}


.win-overlay {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.14), transparent 30%),
    rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(10px);
  animation: winOverlayIn 0.24s ease-out;
}

.win-overlay.closing {
  animation: winOverlayOut 0.24s ease-in forwards;
}

.win-overlay-card {
  width: min(700px, 100%);
  min-height: 340px;
  border-radius: 36px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 18px;
  text-align: center;
  border: 8px solid rgba(255, 255, 255, 0.92);
  color: #102114;
  background: linear-gradient(135deg, #c8f96c, #7ed957);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.55);
  transform: rotate(-1deg);
}

.win-overlay-small {
  padding: 7px 16px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.16);
  color: #f5ffe1;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.win-overlay-card strong {
  font-size: clamp(56px, 10vw, 104px);
  line-height: 0.95;
  letter-spacing: -3px;
  text-shadow: 0 6px 0 rgba(255, 255, 255, 0.32);
}

.win-overlay-card p {
  margin: 0;
  font-size: clamp(22px, 3.5vw, 38px);
  font-weight: 900;
}

@keyframes winOverlayIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes winOverlayOut {
  from { opacity: 1; transform: scale(1); }
  to { opacity: 0; transform: scale(0.96); }
}


.hand-header-main {
  display: grid;
  gap: 4px;
}

.hand-header-main .helper-text {
  display: block;
}

.hand-uno-btn {
  width: auto;
  min-width: 110px;
  align-self: center;
  box-shadow: 0 10px 24px rgba(0,0,0,0.22);
}

@media (max-width: 860px) {
  .hand-header {
    flex-direction: row;
    align-items: center;
  }

  .hand-header-main {
    min-width: 0;
  }

  .hand-uno-btn {
    min-width: 92px;
    padding-inline: 14px;
  }
}

@media (max-width: 560px) {
  .game.hand-visible {
    padding-bottom: 200px;
  }

  .hand-header {
    gap: 8px;
  }

  .hand-header-main .helper-text {
    font-size: 12px;
  }

  .hand-uno-btn {
    min-width: 84px;
  }
}


/* Interface épurée pendant une partie */
.game.game-running .game-title-block {
  display: none;
}

.game.game-running .game-header {
  justify-content: flex-end;
  margin-bottom: 8px;
}

.game.game-running .turn-banner-wrap {
  margin-bottom: 10px;
}


/* Modal confirmation arrêt de partie */
.confirm-card {
  width: min(520px, 100%);
}

.danger-eyebrow {
  background: rgba(229, 57, 53, 0.18);
  border-color: rgba(229, 57, 53, 0.34);
  color: #ffcdd2;
}

.confirm-card h2 {
  margin-bottom: 10px;
}

.confirm-card p {
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: 0;
}

.confirm-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 22px;
}

.confirm-actions .ghost-btn,
.confirm-actions .danger-btn {
  width: 100%;
}

@media (max-width: 560px) {
  .confirm-actions {
    grid-template-columns: 1fr;
  }
}


/* Interface V4 */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,.7), transparent 80%);
}

.game-header {
  padding: 4px 4px 12px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.game-title-block {
  display: flex;
  align-items: center;
  gap: 12px;
}

.game-title-block .eyebrow { margin: 0; }
.game-title-block h1 { display: none; }
.game-title-block p {
  margin: 0;
  padding: 9px 13px;
  border-radius: 12px;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.1);
}

.sound-btn.sound-off { opacity: .72; }

.table-shell {
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 14px 36px rgba(0,0,0,.16);
}

.game.my-turn .turn-banner {
  border-color: rgba(251,192,45,.65);
  background: linear-gradient(135deg, rgba(251,192,45,.22), rgba(255,255,255,.05));
  box-shadow: 0 0 28px rgba(251,192,45,.1);
}

.player-card {
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}
.player-card.active { transform: translateY(-2px); }
.player-avatar { box-shadow: inset 0 1px 0 rgba(255,255,255,.16); }

.table-zone {
  position: relative;
  overflow: hidden;
}
.table-zone::after {
  content: '';
  position: absolute;
  inset: 12px;
  border-radius: 22px;
  border: 1px solid rgba(255,255,255,.07);
  pointer-events: none;
}

.deck-card { transition: transform .18s ease, box-shadow .18s ease; }
.deck-card:hover:not(:disabled) { transform: translateY(-4px) rotate(-1deg); box-shadow: 0 20px 40px rgba(0,0,0,.38); }

.playing-card { isolation: isolate; }
.playing-card::before { box-shadow: inset 0 0 18px rgba(255,255,255,.11); }
.card-center { text-shadow: 0 2px 4px rgba(0,0,0,.28); }

.hand-section {
  border-color: rgba(255,255,255,.18);
  box-shadow: 0 -18px 60px rgba(0,0,0,.48), inset 0 1px 0 rgba(255,255,255,.06);
}
.hand-header-main { gap: 3px; }
.hand-title-row { display: flex; align-items: center; gap: 10px; }
.hand-title-row h2 { margin: 0; }
.hand-count {
  display: inline-flex;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(255,255,255,.1);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.hand::-webkit-scrollbar { height: 8px; }
.hand::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); border-radius: 999px; }
.hand::-webkit-scrollbar-track { background: rgba(255,255,255,.04); border-radius: 999px; }
.hand .playing-card.playable { animation: playablePulse 2.2s ease-in-out infinite; }
.hand .playing-card.playable:hover:not(:disabled) { animation: none; }

.uno-btn:not(:disabled) {
  animation: unoGlow 1.15s ease-in-out infinite alternate;
}

.history-item { animation: historyIn .22s ease-out; }
.toast { border: 1px solid rgba(255,255,255,.75); }

@keyframes playablePulse {
  0%,100% { box-shadow: 0 0 0 2px rgba(255,255,255,.11), 0 16px 34px rgba(0,0,0,.3); }
  50% { box-shadow: 0 0 0 3px rgba(255,255,255,.24), 0 20px 42px rgba(0,0,0,.4); }
}
@keyframes unoGlow {
  from { box-shadow: 0 0 0 rgba(251,192,45,0); }
  to { box-shadow: 0 0 24px rgba(251,192,45,.46); }
}
@keyframes historyIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 760px) {
  .game-title-block { flex-wrap: wrap; }
  .header-actions { width: 100%; }
  .header-actions button { flex: 1 1 auto; }
  .sound-btn { order: 10; }
}


/* Main en éventail : impression de tenir réellement les cartes */
.hand {
  justify-content: center;
  align-items: flex-end;
  overflow-x: auto;
  overflow-y: visible;
  min-height: 150px;
  padding: 24px 42px 8px;
  scroll-padding-inline: 50%;
}

.hand .playing-card {
  margin-left: -24px;
  transform-origin: 50% 115%;
  transform: translateY(var(--fan-rise, 0px)) rotate(var(--fan-rotate, 0deg));
  transition: transform .18s ease, opacity .18s ease, filter .18s ease, box-shadow .18s ease;
}

.hand .playing-card:first-child {
  margin-left: 0;
}

.hand .playing-card.playable:hover:not(:disabled) {
  z-index: 100 !important;
  transform: translateY(-22px) rotate(0deg) scale(1.08);
}

.hand .playing-card:focus-visible {
  z-index: 101 !important;
  transform: translateY(-20px) rotate(0deg) scale(1.06);
  outline: 3px solid rgba(255,255,255,.85);
  outline-offset: 3px;
}

/* L'historique ne clignote plus : seules les nouvelles entrées sont remplacées */
.history-list {
  contain: layout paint;
}

@media (max-width: 760px) {
  .hand {
    justify-content: flex-start;
    padding-inline: 26px;
  }
  .hand .playing-card {
    margin-left: -18px;
  }
}


/* Mode solo */
.solo-card-box {
  position: relative;
  overflow: hidden;
  background: linear-gradient(145deg, rgba(67,160,71,.16), rgba(30,136,229,.1));
  border-color: rgba(126,217,87,.28);
}
.solo-card-box::after {
  content: '🤖';
  position: absolute;
  right: -10px;
  top: -18px;
  font-size: 92px;
  opacity: .08;
  transform: rotate(12deg);
  pointer-events: none;
}
.mode-chip {
  display: inline-flex;
  margin-bottom: 12px;
  padding: 5px 10px;
  border-radius: 999px;
  color: #dfffcf;
  background: rgba(67,160,71,.2);
  border: 1px solid rgba(126,217,87,.28);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .7px;
}
.solo-btn {
  width: 100%;
  min-height: 46px;
  margin-top: 20px;
  padding: 12px 18px;
  border-radius: 14px;
  color: #092013;
  font-weight: 900;
  background: linear-gradient(135deg, #b7f875, #57d98b);
  box-shadow: 0 12px 28px rgba(50,180,110,.2);
  transition: transform .15s ease, filter .15s ease;
}
.badge.bot {
  color: #d5f5ff;
  background: rgba(30,136,229,.2);
}
.bot-avatar {
  font-size: 23px;
  background: linear-gradient(135deg, rgba(30,136,229,.28), rgba(67,160,71,.18));
}
@media (max-width: 1050px) {
  .home-grid { grid-template-columns: 1fr 1fr; }
  .solo-card-box { grid-column: 1 / -1; }
}
@media (max-width: 700px) {
  .home-grid { grid-template-columns: 1fr; }
  .solo-card-box { grid-column: auto; }
}

@media (max-width: 560px) {
  .uno-alert {
    top: 10px;
    width: calc(100% - 16px);
  }

  .uno-alert-card {
    grid-template-columns: auto 1fr;
    padding: 12px 14px;
    gap: 8px 10px;
  }

  .uno-alert-small {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .uno-alert-card p {
    font-size: 14px;
  }
}


/* Ajustements V7 : interface plus compacte et main entièrement visible */
.turn-banner-wrap {
  gap: 0;
  margin-bottom: 10px;
}

.hand-section {
  bottom: 10px;
  padding: 10px 14px 10px;
  overflow: hidden;
}

.hand {
  height: 178px;
  min-height: 178px;
  padding: 42px 52px 16px;
  overflow-x: auto;
  overflow-y: hidden;
  align-items: flex-end;
  overscroll-behavior-x: contain;
}

.hand .playing-card {
  width: 82px;
  height: 120px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.hand .playing-card.playable:active:not(:disabled) {
  z-index: 102 !important;
  transform: translateY(-18px) rotate(0deg) scale(1.04);
}

@media (max-width: 760px) {
  .hand {
    height: 164px;
    min-height: 164px;
    padding: 38px 28px 14px;
  }
}
