/* ─── Reset & base ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: 'Segoe UI', system-ui, sans-serif; }

/* ─── Cards ──────────────────────────────────────────────────────────────── */
.card {
  width: 60px; height: 84px;
  border-radius: 8px;
  border: 2px solid #ccc;
  background: #fff;
  display: inline-flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 4px 5px;
  font-weight: 700;
  font-size: 14px;
  cursor: default;
  user-select: none;
  position: relative;
  box-shadow: 1px 2px 6px rgba(0,0,0,0.3);
  transition: transform 0.15s, box-shadow 0.15s;
  flex-shrink: 0;
}
.card.sm { width: 48px; height: 68px; font-size: 11px; padding: 3px 4px; border-radius: 6px; }
.card.md { width: 66px; height: 92px; font-size: 15px; padding: 4px 5px; border-radius: 7px; }
.card.lg { width: 80px; height: 112px; font-size: 18px; padding: 5px 7px; border-radius: 9px; }
.card.xl { width: 96px; height: 134px; font-size: 22px; padding: 6px 8px; border-radius: 10px; }

.card .top { display: flex; flex-direction: column; align-items: flex-start; line-height: 1; }
.card .bot { display: flex; flex-direction: column; align-items: flex-end; line-height: 1; transform: rotate(180deg); }
.card .mid { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); font-size: 20px; }
.card.sm .mid { font-size: 14px; }
.card.md .mid { font-size: 18px; }
.card.lg .mid { font-size: 24px; }
.card.xl .mid { font-size: 30px; }

.card.red { color: #d32f2f; border-color: #ef9a9a; }
.card.black { color: #212121; border-color: #bdbdbd; }

/* special card glow */
.card.special-2 { border-color: #7b1fa2; box-shadow: 0 0 8px 2px rgba(123,31,162,0.4); }
.card.special-7 { border-color: #1565c0; box-shadow: 0 0 8px 2px rgba(21,101,192,0.4); }
.card.special-9 { border-color: #e65100; box-shadow: 0 0 8px 2px rgba(230,81,0,0.4); }
.card.special-10 { border-color: #b71c1c; box-shadow: 0 0 8px 2px rgba(183,28,28,0.5); }

.card.selectable { cursor: pointer; }
.card.selectable:hover { transform: translateY(-6px); box-shadow: 2px 6px 14px rgba(0,0,0,0.4); }
.card.selected { transform: translateY(-14px); box-shadow: 0 0 0 3px #ffd600, 2px 8px 16px rgba(0,0,0,0.4); }

/* card back */
.card.back {
  background: repeating-linear-gradient(
    45deg,
    #1a237e,
    #1a237e 5px,
    #283593 5px,
    #283593 10px
  );
  border-color: #1a237e;
  color: transparent;
}
.card.back::after {
  content: '';
  position: absolute;
  inset: 5px;
  border: 2px solid rgba(255,255,255,0.2);
  border-radius: 4px;
}

/* face-down card (can be tapped to play) */
.card.back.selectable { cursor: pointer; }
.card.back.selectable:hover { transform: translateY(-6px); }

/* pile offset: show card underneath (used for 7s) */
.pile-stack { position: relative; display: inline-block; }
.pile-stack .card { position: absolute; top: 0; left: 0; }
.pile-stack .card:last-child { position: relative; }
.pile-stack .card.peek { top: 12px; left: 4px; z-index: 0; }
.pile-stack .card.top-card { z-index: 1; top: 0; left: 0; }

/* ─── Animations ─────────────────────────────────────────────────────────── */
@keyframes dealIn {
  from { opacity: 0; transform: translate(-50vw, -50vh) rotate(-20deg) scale(0.3); }
  to   { opacity: 1; transform: translate(0,0) rotate(0) scale(1); }
}
@keyframes burnOut {
  from { opacity: 1; transform: scale(1); }
  to   { opacity: 0; transform: scale(1.5) rotate(10deg); }
}
@keyframes slideIn {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(255,214,0,0.7); }
  50% { box-shadow: 0 0 0 12px rgba(255,214,0,0); }
}

.deal-anim { animation: dealIn 0.4s ease-out both; }
.burn-anim { animation: burnOut 0.5s ease-in both; }
.slide-anim { animation: slideIn 0.3s ease-out both; }
.pulse-anim { animation: pulse 1.2s infinite; }

/* deal stagger */
.deal-anim:nth-child(1) { animation-delay: 0.05s; }
.deal-anim:nth-child(2) { animation-delay: 0.10s; }
.deal-anim:nth-child(3) { animation-delay: 0.15s; }
.deal-anim:nth-child(4) { animation-delay: 0.20s; }
.deal-anim:nth-child(5) { animation-delay: 0.25s; }
.deal-anim:nth-child(6) { animation-delay: 0.30s; }

/* ─── Toast notifications ─────────────────────────────────────────────────── */
#toast-container {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
  z-index: 9999; display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  background: rgba(0,0,0,0.85);
  color: #fff; padding: 10px 20px; border-radius: 24px;
  font-size: 14px; font-weight: 600; white-space: nowrap;
  animation: slideIn 0.3s ease-out, fadeOut 0.4s ease-in 2.6s forwards;
  pointer-events: none;
}
.toast.error { background: rgba(183,28,28,0.9); }
.toast.success { background: rgba(27,94,32,0.9); }
@keyframes fadeOut { to { opacity: 0; transform: translateY(-10px); } }

/* ─── Util ───────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }
button {
  cursor: pointer; border: none; border-radius: 8px;
  font-family: inherit; font-weight: 600;
  padding: 10px 20px; font-size: 14px;
  transition: opacity 0.15s, transform 0.1s;
}
button:disabled { opacity: 0.4; cursor: not-allowed; transform: none !important; }
button:active:not(:disabled) { transform: scale(0.96); }

.btn-primary   { background: #ffd600; color: #212121; }
.btn-success   { background: #2e7d32; color: #fff; }
.btn-danger    { background: #c62828; color: #fff; }
.btn-ghost     { background: rgba(255,255,255,0.15); color: #fff; border: 1px solid rgba(255,255,255,0.3); }
.btn-sm        { padding: 6px 14px; font-size: 12px; border-radius: 6px; }
