/* Coin flip page: 3D single coin, multi-coin chips and the session history. */

.coin-stage {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 190px;
}

.coin {
  position: relative;
  width: 150px;
  height: 150px;
  transform-style: preserve-3d;
  transition: transform 0.9s cubic-bezier(0.2, 0.7, 0.3, 1);
}

.coin[data-face="heads"] { transform: rotateY(0deg); }
.coin[data-face="tails"] { transform: rotateY(180deg); }
.coin.no-transition { transition: none; }

/* The keyframes end on a rotation congruent with the settled face, so
   removing .is-flipping after the animation never snaps to the other side. */
.coin.is-flipping[data-face="heads"] { animation: coin-toss-heads 0.9s ease-out; }
.coin.is-flipping[data-face="tails"] { animation: coin-toss-tails 0.9s ease-out; }

@keyframes coin-toss-heads {
  from { transform: rotateY(0deg); }
  to { transform: rotateY(1440deg); }
}

@keyframes coin-toss-tails {
  from { transform: rotateY(0deg); }
  to { transform: rotateY(1620deg); }
}

.coin-face {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 4px solid var(--navy);
  border-radius: 50%;
  font-size: 2.6rem;
  font-weight: 700;
  backface-visibility: hidden;
}

.coin-face--heads { background: #f7c948; color: var(--navy); }
.coin-face--tails { background: var(--navy); color: #f7c948; transform: rotateY(180deg); }

.coin-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.coin-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 2px solid var(--navy);
  border-radius: 50%;
  font-size: 0.95rem;
  font-weight: 700;
}

.coin-chip--heads { background: #f7c948; color: var(--navy); }
.coin-chip--tails { background: var(--navy); color: #f7c948; }

.coin-summary {
  margin: 14px 0 0;
  text-align: center;
  font-weight: 600;
}

.coin-tally {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  margin: 16px 0 0;
  padding: 0;
}

.coin-tally div { margin: 0; }
.coin-tally dt { color: var(--navy-soft); font-size: 0.85rem; }
.coin-tally dd { margin: 2px 0 0; font-size: 1.05rem; font-weight: 700; }

.coin-history {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
}

.coin-history li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}

.coin-history li:last-child { border-bottom: 0; }
.coin-history .coin-chip { width: 26px; height: 26px; font-size: 0.78rem; }

.coin-history-count {
  margin-left: auto;
  color: var(--navy-soft);
  font-size: 0.9rem;
}

@media (max-width: 480px) {
  .coin-stage { min-height: 150px; }
  .coin { width: 124px; height: 124px; }
  .coin-face { font-size: 2.1rem; }
}
