/* Override the controls-select width cap so coin names fit. */
.controls label select#coinSelect { width: auto; min-width: 220px; }

.coin-stage {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 32px;
  align-items: center;
}
@media (max-width: 640px) {
  .coin-stage { grid-template-columns: 1fr; justify-items: center; }
}

.coin-scene {
  perspective: 1200px;
  width: 220px;
  height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.coin {
  width: 200px;
  height: 200px;
  position: relative;
  transform-style: preserve-3d;
  transform: rotateX(0deg);
  transition: none;
}
.coin.flipping { animation: coinFlip var(--flip-dur, 1.6s) cubic-bezier(0.1, 0.9, 0.2, 1) forwards; }
@keyframes coinFlip {
  0%   { transform: translateY(0) rotateX(0deg); }
  25%  { transform: translateY(-80px) rotateX(540deg); }
  50%  { transform: translateY(-120px) rotateX(1080deg); }
  75%  { transform: translateY(-60px) rotateX(1620deg); }
  100% { transform: translateY(0) rotateX(var(--final-rot, 1800deg)); }
}

.coin .face {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  font-weight: 800;
  color: #211a04;
  background: radial-gradient(circle at 30% 30%, #fff6c9 0%, #f0b429 55%, #b8832d 100%);
  box-shadow: inset 0 0 0 6px rgba(0, 0, 0, 0.12), inset 0 -8px 20px rgba(0, 0, 0, 0.25), 0 10px 30px rgba(0, 0, 0, 0.45);
  backface-visibility: hidden;
  text-align: center;
  padding: 0 14px;
  overflow: hidden;
  word-break: break-word;
  line-height: 1.1;
}
.coin .face.front { transform: translateZ(8px); }
.coin .face.back  { transform: rotateX(180deg) translateZ(8px); }
/* World-coin mode: images/SVGs paint their own metal, so clear the gold fill
   and the inset wash and let the art fill the whole circle. */
.coin.world .face {
  background: none;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  padding: 0;
  overflow: hidden;
}
.coin.world .face svg,
.coin.world .face img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

/* Thin cylinder side so edge-on views don't look paper-thin. */
.coin .edge {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: linear-gradient(180deg, #d99b1a, #a8791d);
  transform: translateZ(0);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.3);
}

.coin-controls { display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }
.result {
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  font-weight: 800;
  color: var(--accent);
  min-height: 1.4em;
  word-break: break-word;
}
.score { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 4px; }
.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 90px;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.stat .label { color: var(--dim); font-size: 0.8rem; letter-spacing: 0.05em; max-width: 100px; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat .value { font-size: 1.4rem; font-weight: 700; color: var(--accent); }

kbd {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.85em;
}
