/* Gradation — gobelets, cubes, rangement, barre de joueurs, zone d'action. */

/* ================= gobelets ================= */
.gr-cup { display: block; width: 100%; height: auto; overflow: visible; transition: transform 0.35s var(--spring), opacity 0.35s var(--ease), filter 0.3s; }
.gr-cup .cup-body { stroke-width: 1.5; }
.gr-cup .cup-shine { opacity: 0.5; }
.gr-cup.s0 .cup-body { fill: #0a0f16; stroke: rgba(224, 239, 255, 0.6); }
.gr-cup.s0 .cup-shine { fill: #fff; opacity: 0.16; }
.gr-cup.s1 .cup-body { fill: #c1cbd8; stroke: rgba(255, 255, 255, 0.85); }
.gr-cup.s1 .cup-shine { fill: #fff; opacity: 0.6; }
.gr-cup.s2 .cup-body { fill: #6b7b92; stroke: rgba(255, 255, 255, 0.5); }
.gr-cup.s2 .cup-shine { fill: #fff; opacity: 0.28; }
.gr-cup.s3 .cup-body { fill: #f4f9ff; stroke: #fff; }
.gr-cup.s3 .cup-shine { fill: #0d335d; opacity: 0.1; }

/* ================= une colonne : gobelet + cube ================= */
.gr-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; width: 100%; max-width: 416px; margin: 0 auto; }
.gr-col {
  appearance: none; border: 0; background: none; padding: 4px 0 0; margin: 0; color: inherit; font: inherit;
  display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; touch-action: manipulation;
  -webkit-user-select: none; user-select: none;
}
button.gr-col { cursor: pointer; }
button.gr-col:active .gr-cup { transform: translateY(-4px); }
.gr-tile {
  width: 76%; height: 26px; border-radius: 9px; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px; line-height: 1; font-variant-numeric: tabular-nums;
}
.gr-mine .gr-tile { background: var(--sky); color: var(--navy); }
.gr-theirs .gr-tile { background: rgba(224, 239, 255, 0.12); color: var(--text); }
.gr-tile.blank { color: rgba(169, 196, 228, 0.6); }
.gr-col.empty .gr-cup { opacity: 0.4; }
.gr-col.empty .gr-tile { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line); }

/* gobelet déjà joué : il s'efface, le cube reste visible ; le cube gagnant prend la couleur du joueur */
.gr-col.played .gr-cup { opacity: 0.25; transform: translateY(-3px); }
.gr-theirs .gr-col.played .gr-tile { background: rgba(224, 239, 255, 0.22); }
.gr-row.p0 .gr-col.won .gr-tile { background: var(--p0); color: var(--navy); box-shadow: 0 6px 16px -6px var(--p0); }
.gr-row.p1 .gr-col.won .gr-tile { background: var(--p1); color: var(--navy); box-shadow: 0 6px 16px -6px var(--p1); }
.gr-col.fresh .gr-tile { animation: gr-flip 0.55s var(--spring) both; }
@keyframes gr-flip { from { transform: scale(0.4) rotateX(80deg); opacity: 0; } to { transform: none; opacity: 1; } }

/* gobelet choisi (ou déjà joué par moi, en attente) : il se lève */
.gr-col.chosen .gr-cup { transform: translateY(-9px); filter: drop-shadow(0 0 9px rgba(224, 239, 255, 0.8)); }
.gr-col.chosen .gr-tile { box-shadow: 0 0 0 2.5px var(--sky); }
/* gobelets de l'adversaire qui pourraient être celui qu'il vient de jouer (même couleur) */
.gr-col.maybe .gr-cup { animation: gr-maybe 1.3s ease-in-out infinite; }
@keyframes gr-maybe { 0%, 100% { transform: translateY(0); filter: none; } 50% { transform: translateY(-6px); filter: drop-shadow(0 0 8px rgba(224, 239, 255, 0.85)); } }

/* ================= rangement ================= */
.gr-tray { width: 100%; display: flex; flex-direction: column; gap: 12px; }
.gr-total { display: flex; align-items: center; gap: 12px; min-height: 36px; color: var(--muted); font-size: 15px; }
.gr-sum b { color: var(--text); font-size: 18px; font-variant-numeric: tabular-nums; }
.gr-bar { flex: 1 1 auto; height: 8px; border-radius: 6px; background: var(--line); overflow: hidden; }
.gr-bar i { display: block; height: 100%; border-radius: 6px; background: var(--sky); transition: width 0.3s var(--ease), background 0.3s; }
.gr-total .btn-link { min-height: 36px; padding: 0 4px; font-size: 15px; }
.gr-digits { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.gr-digit {
  appearance: none; border: 0; cursor: pointer; min-height: 54px; border-radius: 16px; padding: 6px 0 7px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  background: var(--tile); color: var(--text); box-shadow: inset 0 0 0 1.5px var(--line);
  transition: transform 0.16s var(--spring), opacity 0.2s; touch-action: manipulation; -webkit-user-select: none; user-select: none;
}
.gr-digit b { font-size: 22px; line-height: 1; font-variant-numeric: tabular-nums; }
.gr-digit:active { transform: scale(0.94); }
.gr-digit.off { opacity: 0.3; }
.gr-copies { display: flex; gap: 4px; }
.gr-copies i { width: 7px; height: 7px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--muted); }
.gr-copies i.on { background: var(--sky); box-shadow: none; }

/* ================= table de jeu ================= */
.gr-table { width: 100%; display: flex; flex-direction: column; gap: 8px; }
.gr-mid { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 2px 0; text-align: center; }
.gr-mid .gr-pips { display: flex; gap: 8px; }
.gr-mid .gr-pips i { width: 11px; height: 11px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--line); background: none; }
.gr-mid .gr-pips i.w0 { background: var(--p0); box-shadow: none; }
.gr-mid .gr-pips i.w1 { background: var(--p1); box-shadow: none; }
.gr-mid .gr-pips i.tie { background: var(--muted); box-shadow: none; opacity: 0.6; }
.gr-mid .gr-pips i.next { box-shadow: inset 0 0 0 2px var(--sky); animation: gr-pulse 1.2s ease-in-out infinite; }
@keyframes gr-pulse { 50% { transform: scale(1.35); } }
.gr-last { min-height: 2.7em; display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 14px; line-height: 1.35; color: var(--muted); }
.gr-last strong { color: var(--text); }
.gr-played { width: 22px; flex: none; }

/* ================= écran de partie ================= */
.gr-screen { height: 100vh; height: 100dvh; min-height: 0; gap: 10px; padding-top: max(8px, env(safe-area-inset-top)); overflow: hidden; }
.gr-top { display: flex; align-items: center; justify-content: space-between; min-height: 44px; }
.gr-round { color: var(--muted); font-weight: 700; font-size: 15px; }
.gr-rules {
  appearance: none; border: 0; cursor: pointer; min-height: 44px; padding: 0 16px 0 8px; border-radius: 999px;
  display: inline-flex; align-items: center; gap: 8px; background: transparent; color: var(--text);
  box-shadow: inset 0 0 0 1.5px var(--line); font: inherit; font-weight: 500; font-size: 15px; touch-action: manipulation;
}
.gr-rules span {
  width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--sky); color: var(--navy); font-weight: 700; font-size: 16px; line-height: 1;
}
.gr-rules:active { opacity: 0.75; }
.gr-players { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.gr-player {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0;
  padding: 9px 14px; border-radius: 20px; background: var(--night); opacity: 0.62;
  box-shadow: inset 0 0 0 1.5px var(--line); transition: opacity 0.4s var(--ease), box-shadow 0.4s var(--ease), transform 0.4s var(--spring);
}
.gr-player.active { opacity: 1; transform: translateY(-2px); }
.gr-player.p0.active { box-shadow: inset 0 0 0 2px var(--p0), 0 10px 26px -12px var(--p0); }
.gr-player.p1.active { box-shadow: inset 0 0 0 2px var(--p1), 0 10px 26px -12px var(--p1); }
.gr-who { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.gr-pname { font-weight: 700; font-size: 16px; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gr-pname small { font-size: 12px; font-weight: 700; color: var(--ink); background: var(--text); border-radius: 6px; padding: 1px 6px; margin-left: 6px; vertical-align: 2px; }
.gr-pmeta { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.gr-presence { width: 8px; height: 8px; border-radius: 50%; background: #7f9cc0; flex: none; }
.gr-presence.on { background: #4be3a3; box-shadow: 0 0 8px #4be3a3; }
.gr-pscore { font-size: 30px; font-weight: 700; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.p0 .gr-pscore { color: var(--p0); }
.p1 .gr-pscore { color: var(--p1); }
.gr-pscore.bump { animation: gr-bump 0.4s var(--spring); }
@keyframes gr-bump { 40% { transform: scale(1.35); } }

.gr-stage { flex: 1 1 auto; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.gr-dock { display: flex; flex-direction: column; gap: 10px; padding-bottom: 2px; }
.gr-title { font-size: 23px; font-weight: 700; letter-spacing: -0.025em; line-height: 1.1; }
.gr-sub { color: var(--muted); font-size: 15px; line-height: 1.4; min-height: 2.8em; }
.gr-sub .c0 { color: var(--p0); font-weight: 700; }
.gr-sub .c1 { color: var(--p1); font-weight: 700; }
.gr-actions { display: grid; grid-template-columns: 1fr 1.7fr; gap: 10px; }
.gr-actions .btn { padding: 0 14px; }

.gr-confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 30; }
.nudge { animation: gr-nudge 0.32s ease; }
@keyframes gr-nudge { 20% { transform: translateX(-7px); } 45% { transform: translateX(7px); } 70% { transform: translateX(-4px); } }

/* ================= illustrations des règles ================= */
.gr-art { max-width: 300px; }
.gr-art-tile { fill: rgba(224, 239, 255, 0.92); }
.gr-art-tile.hidden { fill: rgba(224, 239, 255, 0.14); }
.gr-art-tile.won.p0 { fill: var(--p0); }
.gr-art-tile.won.p1 { fill: var(--p1); }
.gr-art-num { fill: var(--navy); font: 700 14px var(--font); }
.gr-art-tile.hidden + .gr-art-num { fill: var(--muted); }
.gr-art-label { fill: var(--muted); font: 500 9px var(--font); }
.gr-art-col.open { opacity: 0.28; }
.gr-art-col.lifted { filter: drop-shadow(0 0 6px rgba(224, 239, 255, 0.8)); }
.gr-art .gr-cup { width: 40px; height: 46px; }
