/* ============ COINCHE — styles (préfixe coinche-) ============ */

.coinche-root {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-family: inherit;
  color: var(--text, #222);
  max-width: 1140px;
  margin: 0 auto;
}

/* ---- disposition : scores gauche · tapis · enchères droite ---- */
.coinche-layout {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  justify-content: center;
  flex-wrap: nowrap;
}
.coinche-side {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 0 0 auto;
}
.coinche-side-left { width: 150px; }
.coinche-side-right { width: 210px; }
/* repli seulement sur très petit écran : colonnes empilées */
@media (max-width: 640px) {
  .coinche-layout { flex-wrap: wrap; }
  .coinche-side-left,
  .coinche-side-right { width: 100%; }
}

/* ---- scores (colonne gauche) ---- */
.coinche-scores {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.coinche-team {
  border: 1px solid var(--line, #ddd);
  border-radius: 10px;
  padding: 8px 12px;
  background: var(--bg-soft, #f6f6f6);
  text-align: center;
}
.coinche-team-mine {
  border-color: var(--accent, #4a7dff);
}
.coinche-team-label {
  font-size: 13px;
  font-weight: 700;
}
.coinche-team-names {
  font-size: 11px;
  opacity: 0.7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.coinche-team-score {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.1;
}
.coinche-target {
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 6px;
  border-radius: 8px;
  background: var(--bg-soft, #f6f6f6);
  border: 1px dashed var(--line, #ddd);
  opacity: 0.9;
}

/* ---- décompte des points de la donne en cours ---- */
.coinche-live {
  border: 1px solid var(--line, #ddd);
  border-radius: 10px;
  padding: 8px 10px;
  background: var(--bg-soft, #f6f6f6);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.coinche-live-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.7;
}
.coinche-live-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 13px;
}
.coinche-live-mine {
  font-weight: 800;
  color: var(--accent, #4a7dff);
}
.coinche-live-team { flex: 0 0 auto; }
.coinche-live-val { margin-left: auto; font-weight: 700; }
.coinche-live-tricks {
  font-size: 11px;
  opacity: 0.65;
  min-width: 42px;
  text-align: right;
}
.coinche-live-goal {
  font-size: 11px;
  opacity: 0.75;
  padding-top: 4px;
  margin-top: 2px;
  border-top: 1px dashed var(--line, #ddd);
}

/* ---- dernier pli (colonne gauche, toujours visible) ---- */
.coinche-lasttrick {
  border: 1px solid var(--line, #ddd);
  border-radius: 10px;
  padding: 8px;
  background: var(--bg-soft, #f6f6f6);
  text-align: center;
}
.coinche-lasttrick-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.7;
  margin-bottom: 5px;
}
.coinche-lasttrick-cards {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
}
.coinche-lasttrick-who {
  font-size: 11px;
  opacity: 0.75;
  margin-top: 5px;
}
.coinche-card-xs {
  width: 34px;
  height: 48px;
  border-radius: 4px;
}
.coinche-card-xs .coinche-card-rank { font-size: 11px; }
.coinche-card-xs .coinche-card-suit { font-size: 12px; }
.coinche-card-won { outline: 2px solid #ffd166; }

/* ---- contrat (colonne gauche) ---- */
.coinche-contract {
  text-align: center;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--bg-soft, #f6f6f6);
  border: 1px solid var(--line, #ddd);
}
.coinche-contract-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.7;
}
.coinche-contract-val {
  font-size: 17px;
  font-weight: 800;
  margin-top: 1px;
}
.coinche-contract-suit { font-weight: 800; }
.coinche-contract-co {
  font-size: 11px;
  font-weight: 700;
  color: #c0392b;
}
.coinche-contract-who {
  font-size: 11px;
  opacity: 0.75;
  margin-top: 2px;
}
.coinche-message {
  text-align: center;
  font-weight: 700;
  color: var(--accent, #4a7dff);
}
.coinche-recap {
  text-align: center;
  font-size: 12px;
  opacity: 0.75;
}

/* ---- écran de fin de donne ---- */
.coinche-recap-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 2px solid var(--accent, #4a7dff);
  background: var(--bg-soft, #f6f6f6);
  text-align: center;
  max-width: 560px;
  width: 100%;
  margin: 0 auto;
  align-self: center;
}
.coinche-recap-btn {
  margin-top: 6px;
  padding: 10px 24px;
  font-size: 15px;
}
.coinche-recap-title {
  font-size: 16px;
  font-weight: 800;
}
.coinche-recap-line { font-size: 13px; }
.coinche-recap-ok  { font-size: 16px; font-weight: 800; color: #2e9e5b; }
.coinche-recap-bad { font-size: 16px; font-weight: 800; color: #d64545; }
.coinche-recap-total {
  font-size: 16px;
  font-weight: 700;
  padding-top: 2px;
}
.coinche-recap-hint {
  font-size: 12px;
  opacity: 0.65;
}

/* ---- table : tapis vert ---- */
.coinche-table {
  position: relative;
  flex: 1 1 auto;
  min-width: 260px;
  min-height: 440px;
  border: 3px solid #1d4230;
  border-radius: 14px;
  background: radial-gradient(ellipse at center, #43966a 0%, #2f7a52 55%, #22603e 100%);
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.25);
}
.coinche-seat {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  max-width: 30%;
}
.coinche-seat-top    { top: 8px;  left: 50%; transform: translateX(-50%); }
.coinche-seat-bottom { bottom: 8px; left: 50%; transform: translateX(-50%); }
.coinche-seat-left   { left: 8px; top: 50%; transform: translateY(-50%); }
.coinche-seat-right  { right: 8px; top: 50%; transform: translateY(-50%); }

/* sur le tapis : couleurs fixes, lisibles quel que soit le thème */
.coinche-seat-name {
  font-size: 13px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
  color: #fff;
  background: rgba(0, 0, 0, 0.3);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}
.coinche-active {
  border-color: #ffd166;
  color: #ffd166;
  animation: coinche-pulse 1.2s ease-in-out infinite;
}
@keyframes coinche-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.coinche-backs {
  display: flex;
}
.coinche-back {
  width: 14px;
  height: 22px;
  border-radius: 3px;
  background: #35547e;
  opacity: 0.9;
  border: 1px solid rgba(255, 255, 255, 0.75);
  margin-left: -7px;
}
.coinche-back:first-child { margin-left: 0; }

/* bulles d'annonces : toujours du texte sombre sur fond clair */
.coinche-bubble {
  font-size: 13px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  color: #111;
  border: 1px solid rgba(0, 0, 0, 0.25);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}
.coinche-bubble-suit { font-weight: 800; }
.coinche-bubble .coinche-red { color: #c0392b; }

/* ---- pli central ---- */
.coinche-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  gap: 4px;
}
.coinche-center-label {
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}
.coinche-trick {
  position: relative;
  width: 220px;
  height: 210px;
}
.coinche-ghost { opacity: 0.75; }
.coinche-trick-slot { position: absolute; }
.coinche-trick-top    { top: 0; left: 50%; transform: translateX(-50%); }
.coinche-trick-bottom { bottom: 0; left: 50%; transform: translateX(-50%); }
.coinche-trick-left   { left: 0; top: 50%; transform: translateY(-50%); }
.coinche-trick-right  { right: 0; top: 50%; transform: translateY(-50%); }
.coinche-trick-winner .coinche-card {
  outline: 3px solid #ffd166;
}

/* ---- animation « jeté de carte » : la carte arrive du siège du joueur ---- */
.coinche-throw { will-change: transform, opacity; }
.coinche-throw-bottom { animation: coinche-throw-bottom 0.9s cubic-bezier(0.18, 0.9, 0.25, 1); }
.coinche-throw-top    { animation: coinche-throw-top 0.9s cubic-bezier(0.18, 0.9, 0.25, 1); }
.coinche-throw-left   { animation: coinche-throw-left 0.9s cubic-bezier(0.18, 0.9, 0.25, 1); }
.coinche-throw-right  { animation: coinche-throw-right 0.9s cubic-bezier(0.18, 0.9, 0.25, 1); }
@keyframes coinche-throw-bottom {
  0%   { transform: translateY(230px) rotate(16deg) scale(0.78); opacity: 0; }
  55%  { opacity: 1; }
  100% { transform: translateY(0) rotate(0) scale(1); opacity: 1; }
}
@keyframes coinche-throw-top {
  0%   { transform: translateY(-230px) rotate(-16deg) scale(0.78); opacity: 0; }
  55%  { opacity: 1; }
  100% { transform: translateY(0) rotate(0) scale(1); opacity: 1; }
}
@keyframes coinche-throw-left {
  0%   { transform: translateX(-280px) rotate(-16deg) scale(0.78); opacity: 0; }
  55%  { opacity: 1; }
  100% { transform: translateX(0) rotate(0) scale(1); opacity: 1; }
}
@keyframes coinche-throw-right {
  0%   { transform: translateX(280px) rotate(16deg) scale(0.78); opacity: 0; }
  55%  { opacity: 1; }
  100% { transform: translateX(0) rotate(0) scale(1); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .coinche-throw-bottom, .coinche-throw-top, .coinche-throw-left, .coinche-throw-right { animation: none; }
}

/* ---- cartes : texte de secours toujours sombre sur carte blanche ---- */
.coinche-card {
  position: relative;
  overflow: hidden;
  width: 90px;
  height: 126px;
  border-radius: 8px;
  background: #fdfbf5;
  border: 1px solid #b9b2a4;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  color: #1a1a1a;
  font-weight: 700;
  padding: 0;
  cursor: default;
}
.coinche-card-sm {
  width: 62px;
  height: 88px;
  border-radius: 6px;
}
/* image du jeu illustré, par-dessus le rendu texte de secours */
.coinche-card-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  pointer-events: none;
}
.coinche-card .coinche-card-rank { font-size: 26px; line-height: 1; color: inherit; }
.coinche-card-sm .coinche-card-rank { font-size: 18px; }
.coinche-card .coinche-card-suit { font-size: 30px; line-height: 1.1; color: inherit; }
.coinche-card-sm .coinche-card-suit { font-size: 20px; }
.coinche-card.coinche-red { color: #c0392b; }
.coinche-card.coinche-trump {
  border-color: #ffd166;
  border-width: 2px;
}

/* ---- ma main ---- */
.coinche-hand {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  padding: 4px 0;
}
button.coinche-card.coinche-playable {
  cursor: pointer;
  transition: transform 0.12s ease;
}
button.coinche-card.coinche-playable:hover {
  transform: translateY(-8px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
}
button.coinche-card:disabled {
  opacity: 0.45;
}
button.coinche-card.coinche-idle:disabled {
  opacity: 1;
}

/* ---- panneau d'actions ---- */
.coinche-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-height: 40px;
}
.coinche-panel-title {
  font-size: 14px;
  font-weight: 600;
  text-align: center;
}
.coinche-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  align-items: center;
}
.coinche-btn {
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--line, #ccc);
  background: var(--bg-soft, #f6f6f6);
  color: var(--text, #222);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}
.coinche-btn:hover:not(:disabled) {
  border-color: var(--accent, #4a7dff);
}
.coinche-btn:disabled {
  opacity: 0.45;
  cursor: default;
}
.coinche-primary {
  background: var(--accent, #4a7dff);
  color: #fff;
  border-color: var(--accent, #4a7dff);
}
.coinche-danger {
  background: #c0392b;
  color: #fff;
  border-color: #c0392b;
}
/* boutons de couleur : symboles TOUJOURS sombres sur fond blanc */
.coinche-suit-btn {
  font-size: 20px;
  width: 46px;
  padding: 6px 0;
  background: #fff;
  color: #1a1a1a;
}
.coinche-suit-btn.coinche-red { color: #c0392b; }
.coinche-suit-btn.coinche-sel {
  outline: 2px solid var(--accent, #4a7dff);
}
/* liste des valeurs d'enchère : chiffres sombres sur fond blanc */
.coinche-select {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #999;
  background: #fff;
  color: #1a1a1a;
  font-size: 14px;
  font-weight: 600;
}
.coinche-select option {
  background: #fff;
  color: #1a1a1a;
}

/* ---- fin de partie ---- */
.coinche-final {
  font-size: 22px;
  font-weight: 800;
}
.coinche-final-win { color: var(--accent, #4a7dff); }
.coinche-final-lose { opacity: 0.7; }
