/* ═══════════════════════════════════════════════════════════════════════════
   RUBIK'S CUBE GAME — stage, HUD, win card, confetti
   Builds on rubiks-cube-logo.css for the cubie / sticker look.
   ═══════════════════════════════════════════════════════════════════════════ */

.cube-game { margin: 0 auto 1.25rem; }

.cube-stage {
  width: 280px;
  height: 280px;
  margin: 0 auto;
  position: relative;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  background:
    radial-gradient(circle at 50% 42%, rgba(59, 130, 246, 0.16), rgba(15, 23, 42, 0) 62%),
    radial-gradient(circle at 50% 50%, rgba(139, 92, 246, 0.08), rgba(15, 23, 42, 0) 70%);
}
.cube-stage::before {
  content: '';
  position: absolute;
  inset: 14px;
  border-radius: 50%;
  border: 1px dashed rgba(148, 163, 184, 0.18);
  pointer-events: none;
}
.cube-stage:active { cursor: grabbing; }

.rubiks-cube-container.rubiks-game {
  perspective: 1100px;
  cursor: pointer;
  transition: filter 0.3s ease, transform 0.3s ease;
}
.rubiks-cube-container.rubiks-game .cubie-face[data-cubie],
.rubiks-cube-container.rubiks-game .cubie-sticker[data-cubie] { cursor: grab; }
.rubiks-cube-container.rubiks-game .cubie-sticker[data-cubie]:hover { filter: brightness(1.18); }
.rubiks-cube-container.rubiks-game .rubiks-pivot { transition: transform 0.12s ease-out; }
.rubiks-cube-container.rubiks-game .cubie-sticker.is-hl {
  filter: brightness(1.35) saturate(1.15);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.85), 0 0 10px rgba(250, 222, 42, 0.7);
}
.cube-btn.is-on { background: rgba(250, 222, 42, 0.2); border-color: rgba(250, 222, 42, 0.6); color: #fde047; }
.rubiks-cube-container.is-scrambling { animation: cubeShake 0.45s ease; }
@keyframes cubeShake {
  0%, 100% { transform: translateX(0) }
  20% { transform: translateX(-6px) rotate(-2deg) }
  40% { transform: translateX(6px) rotate(2deg) }
  60% { transform: translateX(-4px) }
  80% { transform: translateX(4px) }
}
.rubiks-cube-container.is-solved {
  filter: drop-shadow(0 0 26px rgba(250, 222, 42, 0.95));
  animation: cubeWinPulse 0.8s ease-in-out 3;
}
@keyframes cubeWinPulse {
  0%, 100% { transform: scale(1) }
  50% { transform: scale(1.14) }
}

/* HUD */
.cube-hud {
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: stretch;
  flex-wrap: wrap;
  margin-top: 4px;
}
.cube-stat {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 5px 14px;
  min-width: 82px;
  text-align: center;
}
.cube-stat small {
  display: block;
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #64748b;
}
.cube-stat b {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1rem;
  color: #e2e8f0;
  font-weight: 600;
}
.cube-stat.running b { color: #22c55e; }
.cube-actions { display: flex; gap: 8px; justify-content: center; margin-top: 10px; flex-wrap: wrap; }
.cube-btn {
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.35);
  color: #bfdbfe;
  border-radius: 10px;
  padding: 7px 16px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}
.cube-btn:hover { background: rgba(59, 130, 246, 0.28); transform: translateY(-1px); }
.cube-btn:active { transform: translateY(0) scale(0.97); }
.cube-btn:disabled { opacity: 0.45; cursor: default; transform: none; }
.cube-btn.primary {
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  border-color: transparent;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.35);
}
.cube-btn.primary:hover { box-shadow: 0 10px 28px rgba(99, 102, 241, 0.5); }
.cube-status { font-size: 0.74rem; color: #94a3b8; margin-top: 10px; min-height: 1.1em; }
.cube-status.solved { color: #fde047; font-weight: 600; }
.cube-hint { color: #64748b; font-size: 0.66rem; letter-spacing: 0.02em; margin-top: 6px; opacity: 0.8; line-height: 1.5; }
.cube-hint kbd {
  font-family: ui-monospace, Menlo, monospace;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  padding: 0 4px;
  font-size: 0.62rem;
  color: #cbd5e1;
}

/* Win overlay */
.cube-win {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}
.cube-win.show { opacity: 1; pointer-events: auto; }
.cube-win-card {
  background: linear-gradient(160deg, #111827, #0f172a);
  border: 1px solid rgba(250, 222, 42, 0.35);
  border-radius: 22px;
  padding: 2rem 2.5rem;
  text-align: center;
  color: #e2e8f0;
  max-width: 92vw;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 50px rgba(250, 222, 42, 0.18);
  transform: scale(0.75) translateY(20px);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.cube-win.show .cube-win-card { transform: scale(1) translateY(0); }
.cube-win-card .trophy { font-size: 3.2rem; line-height: 1; animation: trophyBounce 1.2s ease-in-out infinite; }
@keyframes trophyBounce {
  0%, 100% { transform: translateY(0) rotate(-6deg) }
  50% { transform: translateY(-8px) rotate(6deg) }
}
.cube-win-card h2 {
  font-size: 1.9rem;
  margin: 0.6rem 0 0.2rem;
  background: linear-gradient(135deg, #fde047, #fb923c, #f472b6);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.5px;
}
.cube-win-card p { color: #94a3b8; margin: 0; font-size: 0.9rem; }
.cube-win-stats { display: flex; gap: 2rem; justify-content: center; margin: 1.2rem 0 1.4rem; }
.cube-win-stats div small { display: block; font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.1em; color: #64748b; }
.cube-win-stats div b {
  display: block;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 1.5rem;
  color: #fff;
}
.cube-win-best { color: #fde047; font-size: 0.8rem; font-weight: 600; margin-bottom: 0.8rem; }
.cube-win-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

.cube-confetti { position: fixed; inset: 0; pointer-events: none; z-index: 60; }

@media (max-width: 480px) {
  .cube-stage { width: 240px; height: 240px; }
  .cube-win-card { padding: 1.5rem 1.2rem; }
}
@media (prefers-reduced-motion: reduce) {
  .rubiks-cube-container.is-solved, .rubiks-cube-container.is-scrambling, .cube-win-card .trophy { animation: none; }
}
