/* =====================================================================
   Curling — styles propres au jeu (préfixe cu-)
   La barre, le plein écran et les infobulles sont dans css/games.css.
   ===================================================================== */

/* Barre commune aux couleurs du jeu : nuit d'hiver et glace */
.cu-jeu {
  --mg-jeu-largeur: 1204px; /* barre de 1180 px + marges de 12 px : ne pas changer */
  --mgb-fond:
    radial-gradient(
      120% 180% at 0% 0%,
      rgba(127, 220, 255, 0.22),
      transparent 55%
    ),
    linear-gradient(120deg, #0a2140, #154a7a);
  --mgb-accent: #7fdcff;
  --mgb-titre: linear-gradient(100deg, #ffffff, #bdefff 55%, #7fdcff);
  --mgb-doux: #9ec3e0;
  --mg-fs-fond: #06162b;
  --mg-bulle-fond: #0a2140;
  --cu-rouge: #e0303f;
  --cu-jaune: #f4c21b;
  --cu-arene: #0a1c33;
  --cu-glace: #7fdcff;
}

.cu-jeu [hidden] {
  display: none !important;
}

.cu-pastille {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 5px;
  border-radius: 50%;
  vertical-align: 0;
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.55);
}

.cu-pastille.cu-e0 {
  background: var(--cu-rouge);
}

.cu-pastille.cu-e1 {
  background: var(--cu-jaune);
}

.cu-puce {
  align-self: center;
}

.cu-puce b {
  color: var(--mgb-accent);
}

/* Zone de jeu : même largeur que la barre (css/games.css), hauteur posée par game.js (ajuster) */
.cu-zone {
  position: relative;
  box-sizing: border-box;
  align-self: center;
  display: flex;
  flex-direction: column;
  width: min(var(--mg-barre-largeur, 1180px), calc(100vw - 24px));
  border-radius: 16px;
  overflow: hidden;
  background: var(--cu-arene);
  box-shadow: 0 18px 40px -18px rgba(6, 22, 43, 0.7);
  user-select: none;
  -webkit-user-select: none;
}

/* Plein écran : la zone prend toute la place sous la barre */
.cu-jeu.mg-fs .cu-zone {
  align-self: stretch;
  width: auto;
  flex: 1;
  min-height: 0;
}

.cu-canvas {
  display: block;
  flex: 1;
  min-height: 0;
  width: 100%;
  touch-action: none;
  cursor: crosshair;
}

.cu-canvas.balai {
  cursor: grab;
}

.cu-canvas.attente {
  cursor: default;
}

/* ---------- Bande du bas : effet, énergie des balayeurs, conseil ---------- */
.cu-pied {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-shrink: 0;
  min-height: 50px;
  padding: 6px 16px;
  box-sizing: border-box;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.03),
    rgba(255, 255, 255, 0.07)
  );
  border-top: 1px solid rgba(127, 220, 255, 0.14);
  color: #d8ecfb;
  font-family: "Outfit", system-ui, sans-serif;
}

.cu-lib {
  font-family: "Russo One", "Outfit", sans-serif;
  font-size: 0.72em;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #8fb6d6;
}

.cu-effet {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cu-effet .cu-lib {
  margin-right: 4px;
}

.cu-eff {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  margin: 0;
  padding: 0 14px 0 10px;
  border: 1px solid rgba(127, 220, 255, 0.25);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: #cfe6f7;
  font: inherit;
  font-weight: 600;
  font-size: 0.9em;
  cursor: pointer;
  transition:
    background 0.15s,
    color 0.15s,
    border-color 0.15s,
    transform 0.1s;
}

.cu-eff svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cu-eff:hover:not(:disabled) {
  border-color: var(--cu-glace);
  color: #fff;
}

.cu-eff:active:not(:disabled) {
  transform: scale(0.96);
}

.cu-eff[aria-pressed="true"] {
  background: var(--cu-glace);
  border-color: var(--cu-glace);
  color: #06233f;
}

.cu-eff:disabled {
  opacity: 0.4;
  cursor: default;
}

.cu-eff:focus-visible {
  outline: 2px solid var(--cu-glace);
  outline-offset: 2px;
}

.cu-balai {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cu-jauge {
  position: relative;
  width: 150px;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.cu-jauge i {
  position: absolute;
  inset: 0 auto 0 0;
  width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #4fb8ff, #bff0ff);
  box-shadow: 0 0 10px rgba(127, 220, 255, 0.6);
  transition: width 0.08s linear;
}

.cu-jauge.vide i {
  background: #5d7590;
  box-shadow: none;
}

.cu-conseil {
  flex: 1;
  min-width: 0;
  text-align: right;
  font-size: 0.9em;
  color: #a9c8e2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- Bilan d'une manche (carte posée sur la glace) ---------- */
.cu-bilan {
  position: absolute;
  top: 50%;
  left: var(--cu-bilan-x, 50%);
  z-index: 5;
  box-sizing: border-box;
  width: min(340px, calc(100% - 24px));
  padding: 16px 18px 12px 18px;
  border-radius: 18px;
  background: rgba(8, 26, 48, 0.9);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(127, 220, 255, 0.25);
  box-shadow: 0 20px 40px -14px rgba(0, 0, 0, 0.6);
  color: #e6f4ff;
  font-family: "Outfit", system-ui, sans-serif;
  text-align: center;
  transform: translateY(-50%);
  animation: cu-entree 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.cu-bilan.centre {
  left: 50%;
  transform: translate(-50%, -50%);
  animation: none;
}

@keyframes cu-entree {
  from {
    opacity: 0;
    transform: translateY(-50%) scale(0.9);
  }
}

.cu-bilan-titre {
  font-family: "Russo One", sans-serif;
  font-size: 0.8em;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #8fb6d6;
}

.cu-bilan-texte {
  margin: 4px 0 10px 0;
  font-family: "Russo One", sans-serif;
  font-size: 1.35em;
  line-height: 1.2;
}

.cu-bilan .btn-vert {
  margin-top: 10px;
  background: var(--cu-glace);
  color: #06233f;
}

/* Tableau des scores, façon tableau d'affichage */
.cu-tableau {
  overflow-x: auto;
}

.cu-tableau table {
  margin: 0 auto;
  border-collapse: separate;
  border-spacing: 3px;
  font-family: "Russo One", sans-serif;
  font-size: 0.92em;
}

.cu-tableau th,
.cu-tableau td {
  min-width: 24px;
  padding: 4px 5px;
  border-radius: 6px;
  text-align: center;
  font-weight: 400;
}

.cu-tableau thead th {
  color: #7f9fbd;
  font-size: 0.78em;
}

.cu-tableau tbody td {
  background: rgba(255, 255, 255, 0.06);
  color: #5f7d99;
}

.cu-tableau tbody td.pts {
  color: #fff;
}

.cu-tableau tbody .e0 td.pts {
  background: var(--cu-rouge);
}

.cu-tableau tbody .e1 td.pts {
  background: var(--cu-jaune);
  color: #3a2a00;
}

.cu-tableau tbody td.total {
  background: rgba(127, 220, 255, 0.16);
  color: #fff;
}

.cu-tableau tbody th {
  text-align: left;
  color: #dcecf8;
  white-space: nowrap;
}

/* ---------- Fenêtres (réglages, fin de partie) : dans la zone, la barre reste visible ---------- */
.cu-voile {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background: rgba(4, 14, 28, 0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.cu-fen {
  box-sizing: border-box;
  width: min(470px, 100%);
  max-height: 100%;
  overflow-y: auto;
  margin: 0;
  padding: 22px 26px 18px 26px;
  border-radius: 22px;
  background:
    radial-gradient(
      130% 90% at 50% 0%,
      rgba(127, 220, 255, 0.16),
      transparent 60%
    ),
    linear-gradient(180deg, #0f2d52, #0a1f3a);
  border: 1px solid rgba(127, 220, 255, 0.25);
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.7);
  color: #e6f4ff;
  font-family: "Outfit", system-ui, sans-serif;
  text-align: center;
  animation: cu-fen 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes cu-fen {
  from {
    opacity: 0;
    transform: scale(0.94);
  }
}

.cu-fen-titre {
  font-family: "Russo One", sans-serif;
  font-size: 2em;
  line-height: 1.1;
  background: linear-gradient(100deg, #ffffff, #7fdcff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.cu-fen-sous {
  margin: 6px 0 14px 0;
  color: #a9c8e2;
  font-size: 0.95em;
}

.cu-ligne {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-top: 1px solid rgba(127, 220, 255, 0.1);
}

.cu-ligne-lib {
  font-weight: 600;
  color: #cfe3f3;
  text-align: left;
}

.cu-choix {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
  padding: 3px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.25);
}

.cu-choix button {
  margin: 0;
  min-width: 40px;
  height: 32px;
  padding: 0 13px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: #a9c8e2;
  font: inherit;
  font-weight: 600;
  font-size: 0.9em;
  cursor: pointer;
  transition:
    background 0.15s,
    color 0.15s;
}

.cu-choix button:hover {
  color: #fff;
}

.cu-choix button[aria-pressed="true"] {
  background: var(--cu-glace);
  color: #06233f;
}

.cu-choix button:focus-visible {
  outline: 2px solid var(--cu-glace);
  outline-offset: 1px;
}

.cu-fen-boutons {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
}

.cu-fen .btn-vert {
  background: var(--cu-glace);
  color: #06233f;
  min-width: 130px;
}

.cu-fen .btn-vert:hover {
  background: #a9e8ff;
}

.cu-fin-score {
  margin: 8px 0 12px 0;
  font-family: "Russo One", sans-serif;
  font-size: 2.6em;
  line-height: 1;
}

.cu-fin-score .e0 {
  color: var(--cu-rouge);
}

.cu-fin-score .e1 {
  color: var(--cu-jaune);
}

.cu-fin-score .tiret {
  margin: 0 12px;
  color: #5f7d99;
}

/* ---------- Écran étroit ---------- */
@media (max-width: 760px) {
  .cu-pied {
    flex-wrap: wrap;
    gap: 8px 16px;
  }

  .cu-conseil {
    flex-basis: 100%;
    text-align: left;
    white-space: normal;
  }

  .cu-jauge {
    width: 90px;
  }
}

@media (max-width: 600px) {
  .cu-puce {
    display: none;
  }

  .cu-ligne {
    flex-direction: column;
    align-items: flex-start;
  }

  .cu-choix {
    justify-content: flex-start;
  }
}
