/* ============================================================
   UNO CARDS — CSS 3D, animations, all card types
   ============================================================ */

/* ---- Base card ---- */
.card {
  width: 64px; height: 96px;
  border-radius: 10px;
  position: relative;
  cursor: pointer;
  perspective: 600px;
  flex-shrink: 0;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.card-face {
  width: 100%; height: 100%;
  border-radius: 10px;
  position: relative;
  display: flex; align-items: center; justify-content: center;
  border: 3px solid rgba(255,255,255,0.85);
  box-shadow: 0 4px 14px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.2);
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  backface-visibility: hidden;
}

/* Inner oval decoration */
.card-face::before {
  content: '';
  position: absolute;
  width: 82%; height: 70%;
  border: 2px solid rgba(255,255,255,0.35);
  border-radius: 50%;
  transform: rotate(-25deg);
  pointer-events: none;
}

/* Corner labels */
.card-corner {
  position: absolute;
  font-family: var(--font-display);
  font-size: 13px; font-weight: 800;
  line-height: 1; color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.6);
  z-index: 2;
}
.card-corner.tl { top: 5px; left: 6px; }
.card-corner.br { bottom: 5px; right: 6px; transform: rotate(180deg); }

/* Center value */
.card-center {
  font-family: var(--font-display);
  font-size: 30px; font-weight: 800;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,0.4);
  z-index: 2;
  line-height: 1;
}
.card-center.special { font-size: 20px; }
.card-center.wild-symbol { font-size: 22px; }

/* ---- Color variants ---- */
.card-red    .card-face { background: linear-gradient(150deg, #ef4444 0%, #b91c1c 100%); }
.card-green  .card-face { background: linear-gradient(150deg, #22c55e 0%, #15803d 100%); }
.card-blue   .card-face { background: linear-gradient(150deg, #3b82f6 0%, #1d4ed8 100%); }
.card-yellow .card-face { background: linear-gradient(150deg, #eab308 0%, #a16207 100%); }
.card-wild   .card-face {
  background: linear-gradient(150deg, #1e1e2e 0%, #0d0d1a 100%);
  border-color: rgba(255,255,255,0.5);
}

/* Wild color wheel decoration */
.wild-quarters {
  position: absolute;
  width: 38px; height: 38px;
  border-radius: 50%; overflow: hidden;
  z-index: 1;
}
.wild-q { position: absolute; width: 50%; height: 50%; }
.wild-q.q1 { top: 0;   left: 0;  background: #ef4444; }
.wild-q.q2 { top: 0;   right: 0; background: #3b82f6; }
.wild-q.q3 { bottom:0; left: 0;  background: #eab308; }
.wild-q.q4 { bottom:0; right: 0; background: #22c55e; }

/* ---- Back face ---- */
.card-back .card-face {
  background:
    repeating-linear-gradient(45deg, #cc0000, #cc0000 5px, #aa0000 5px, #aa0000 10px);
  border-color: rgba(255,255,255,0.7);
}
.back-face .back-label {
  font-family: var(--font-display);
  font-size: 15px; font-weight: 800;
  color: rgba(255,255,255,0.9);
  text-shadow: 0 1px 4px rgba(0,0,0,0.6);
  z-index: 2;
  background: rgba(0,0,0,0.25);
  padding: 3px 8px; border-radius: 4px;
}

/* ---- Hover (player hand) ---- */
.card.in-hand:hover .card-face {
  transform: translateY(-16px) scale(1.06);
  box-shadow: 0 12px 28px rgba(0,0,0,0.6);
}

/* ---- Playable glow ---- */
.card.playable .card-face {
  box-shadow: 0 0 0 2px var(--yellow), 0 0 18px rgba(232,245,66,0.5), 0 4px 14px rgba(0,0,0,0.5);
  animation: cardPulse 1.4s ease-in-out infinite;
}
@keyframes cardPulse {
  0%,100% { box-shadow: 0 0 0 2px var(--yellow), 0 0 10px rgba(232,245,66,0.4), 0 4px 14px rgba(0,0,0,0.5); }
  50%      { box-shadow: 0 0 0 3px var(--yellow), 0 0 24px rgba(232,245,66,0.7), 0 4px 20px rgba(0,0,0,0.5); }
}

/* ---- Selected ---- */
.card.selected .card-face {
  transform: translateY(-20px) scale(1.08);
  box-shadow: 0 0 0 3px #fff, 0 16px 32px rgba(0,0,0,0.7);
}

/* ---- Not playable (dim) ---- */
.card.not-playable { opacity: 0.45; cursor: not-allowed; }
.card.not-playable:hover .card-face { transform: none; }

/* ---- Discard top card ---- */
.card.discard-top { cursor: default; }
.card.discard-top .card-face { transform: none !important; }

/* ---- Deck stack visual ---- */
.deck-pile { position: relative; width: 64px; height: 96px; }
.card-stack {
  position: absolute; width: 64px; height: 96px;
  border-radius: 10px; border: 3px solid rgba(255,255,255,0.6);
  background: repeating-linear-gradient(45deg,#990000,#990000 5px,#770000 5px,#770000 10px);
}
.card-stack.s1 { top: -4px; left: 4px; }
.card-stack.s2 { top: -2px; left: 2px; }
.card-stack.s3 { top: 0; left: 0; cursor: pointer; }

/* ---- Opponent mini cards ---- */
.card.mini {
  width: 40px; height: 58px;
  cursor: default; pointer-events: none;
}
.card.mini .card-face { border-width: 2px; }
.card.mini .card-corner { font-size: 9px; }
.card.mini .card-center { font-size: 18px; }
.card.mini .card-center.special { font-size: 12px; }

/* ---- Fly animation (card moves from hand to discard) ---- */
.card.flying {
  position: fixed; z-index: 500;
  pointer-events: none;
  transition: all 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- Draw animation ---- */
@keyframes drawFromDeck {
  from { opacity: 0; transform: translateX(-20px) scale(0.9); }
  to   { opacity: 1; transform: none; }
}
.card.just-drawn { animation: drawFromDeck 0.35s ease; }

/* ---- Flip animation ---- */
@keyframes flipIn {
  from { transform: rotateY(-90deg) scale(0.9); opacity: 0; }
  to   { transform: rotateY(0) scale(1); opacity: 1; }
}
.card.flip-in .card-face { animation: flipIn 0.4s ease; }

/* ---- Color picker buttons ---- */
.color-choices {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.color-choice {
  padding: 14px 10px; border: none; border-radius: 8px;
  font-family: var(--font-display); font-size: 13px; font-weight: 700;
  cursor: pointer; color: #fff; letter-spacing: 1px;
  transition: transform 0.15s, box-shadow 0.15s;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}
.color-choice:hover  { transform: scale(1.06); box-shadow: 0 6px 20px rgba(0,0,0,0.4); }
.color-choice:active { transform: scale(0.98); }
.color-choice.red    { background: linear-gradient(135deg, #ef4444, #b91c1c); }
.color-choice.green  { background: linear-gradient(135deg, #22c55e, #15803d); }
.color-choice.blue   { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.color-choice.yellow { background: linear-gradient(135deg, #eab308, #a16207); }

/* ---- Current color dot ---- */
.current-color-dot {
  width: 14px; height: 14px; border-radius: 50%;
  margin: 6px auto 0; border: 2px solid rgba(255,255,255,0.3);
  transition: background 0.3s;
}
.current-color-dot.red    { background: #ef4444; }
.current-color-dot.green  { background: #22c55e; }
.current-color-dot.blue   { background: #3b82f6; }
.current-color-dot.yellow { background: #eab308; }

/* ---- Deal pop-in animation ---- */
@keyframes dealPop {
  0%   { transform: scale(0.5) translateY(10px); opacity: 0; }
  70%  { transform: scale(1.08) translateY(-3px); opacity: 1; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}
.card.deal-pop {
  animation: dealPop 0.22s ease-out forwards;
}
