/* UNO — shared styling. All classes scoped `.uno-*`.
 * Matches the hub's neon-indigo vibe with UNO's bright card colours.
 * Consumed by player.html / tv.html / lobby.html via player.js + tv.js.
 */

.uno-root,
.uno-scope {
  /* brand card colours */
  --uno-red:    #e23a3a;
  --uno-yellow: #f5b914;
  --uno-green:  #2eb344;
  --uno-blue:   #2a7ade;
  --uno-wild:   #1a1a22;

  /* hub neon-indigo surface */
  --uno-bg:        #0a0a0f;
  --uno-bg-2:      #0f0f1a;
  --uno-card-bg:   #16162a;
  --uno-accent:    #7c3aed;
  --uno-accent2:   #ec4899;
  --uno-text:      #e2e8f0;
  --uno-text-2:    #94a3b8;
  --uno-border:    rgba(124, 58, 237, 0.18);
  --uno-border-br: rgba(124, 58, 237, 0.5);
  --uno-glow:      0 0 24px rgba(124, 58, 237, .35);
  --uno-r:         14px;
  --uno-rl:        22px;
  --uno-shadow:    0 10px 34px rgba(0, 0, 0, .55);
  --uno-tr:        .18s ease;

  color: var(--uno-text);
  font-family: "Trebuchet MS", "Segoe UI", system-ui, Arial, sans-serif;
}

/* ============================ TABLE / SURFACE ============================ */
.uno-table {
  position: relative;
  min-height: 100vh;
  background:
    radial-gradient(120% 90% at 50% -10%, rgba(124, 58, 237, .22), transparent 60%),
    radial-gradient(100% 80% at 50% 120%, rgba(236, 72, 153, .14), transparent 60%),
    var(--uno-bg);
  overflow: hidden;
}
.uno-felt {
  position: absolute;
  inset: 6% 4%;
  border-radius: 48% / 40%;
  background:
    radial-gradient(closest-side, rgba(46, 179, 68, .12), rgba(20, 30, 22, .05)),
    radial-gradient(closest-side, rgba(124, 58, 237, .1), transparent);
  border: 2px solid var(--uno-border);
  box-shadow: inset 0 0 80px rgba(0, 0, 0, .6), var(--uno-glow);
}

/* ============================ CARD ============================ */
.uno-card {
  position: relative;
  display: inline-block;
  border-radius: var(--uno-r);
  box-shadow: 0 6px 16px rgba(0, 0, 0, .5), 0 1px 0 rgba(255, 255, 255, .25) inset;
  transition: transform var(--uno-tr), box-shadow var(--uno-tr), filter var(--uno-tr);
  user-select: none;
  -webkit-user-select: none;
  line-height: 0;
  flex: 0 0 auto;
}
.uno-card .uno-card-svg {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: var(--uno-r);
}
/* sizes (width drives; height = 1.5×) */
.uno-size-xs { width: 38px;  height: 57px;  --uno-r: 6px; }
.uno-size-sm { width: 56px;  height: 84px;  --uno-r: 8px; }
.uno-size-md { width: 84px;  height: 126px; --uno-r: 12px; }
.uno-size-lg { width: 120px; height: 180px; --uno-r: 16px; }
.uno-size-xl { width: 160px; height: 240px; --uno-r: 20px; }

.uno-card.is-selectable { cursor: pointer; }
.uno-card.is-selectable:hover {
  transform: translateY(-14px) scale(1.04);
  box-shadow: 0 16px 34px rgba(0, 0, 0, .6), var(--uno-glow);
  z-index: 5;
}
.uno-card.is-disabled,
.uno-card[data-legal="0"] { filter: grayscale(.55) brightness(.62); cursor: not-allowed; }
.uno-card.is-lifted { transform: translateY(-30px) scale(1.08); z-index: 8; }
.uno-card.is-back { box-shadow: 0 6px 16px rgba(0, 0, 0, .55); }

/* ============================ HAND FAN / ARC ============================ */
.uno-hand {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  padding: 28px 16px 14px;
  min-height: 150px;
  perspective: 1100px;
}
.uno-hand .uno-card {
  margin: 0 -22px;            /* overlap → fanned look */
  transform-origin: bottom center;
  transition: transform .2s ease, margin .2s ease;
}
.uno-hand .uno-card:hover { margin: 0 4px; }   /* spread on hover */
/* arc curvature is applied inline by player.js (per-card rotate/translateY),
   these are sane fallbacks if JS doesn't set them */
.uno-hand.is-fanned .uno-card { will-change: transform; }

/* ============================ SEATS (TV) ============================ */
.uno-seat {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: var(--uno-rl);
  background: rgba(22, 22, 42, .6);
  border: 1px solid var(--uno-border);
  backdrop-filter: blur(6px);
  transition: box-shadow var(--uno-tr), border-color var(--uno-tr);
}
.uno-seat.is-current {
  border-color: var(--uno-border-br);
  box-shadow: var(--uno-glow);
  animation: uno-pulse 1.4s ease-in-out infinite;
}
.uno-seat .uno-seat-name { font-weight: 800; font-size: 15px; }
.uno-seat .uno-seat-count { font-size: 13px; color: var(--uno-text-2); }
.uno-seat .uno-seat-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--uno-grad, linear-gradient(135deg, #7c3aed, #ec4899));
  display: grid; place-items: center; font-size: 22px;
}
.uno-seat.is-uno .uno-seat-count { color: var(--uno-yellow); font-weight: 900; }
@keyframes uno-pulse {
  0%, 100% { box-shadow: 0 0 18px rgba(124, 58, 237, .35); }
  50%      { box-shadow: 0 0 38px rgba(124, 58, 237, .7); }
}

/* discard pile + draw pile + direction + active color */
.uno-pile { display: flex; align-items: center; gap: 20px; }
.uno-discard, .uno-draw { position: relative; }
.uno-draw { cursor: pointer; }
.uno-active-color {
  width: 30px; height: 30px; border-radius: 50%;
  box-shadow: 0 0 16px currentColor; border: 2px solid #fff;
}
.uno-active-color.is-red    { background: var(--uno-red); color: var(--uno-red); }
.uno-active-color.is-yellow { background: var(--uno-yellow); color: var(--uno-yellow); }
.uno-active-color.is-green  { background: var(--uno-green); color: var(--uno-green); }
.uno-active-color.is-blue   { background: var(--uno-blue); color: var(--uno-blue); }

.uno-direction {
  font-size: 26px; color: var(--uno-accent);
  filter: drop-shadow(0 0 8px var(--uno-accent));
}
.uno-direction.is-ccw { transform: scaleX(-1); }

/* ============================ BUTTONS ============================ */
.uno-btn {
  appearance: none; border: none; cursor: pointer;
  font-family: inherit; font-weight: 800; font-size: 15px;
  color: #fff; padding: 12px 22px; border-radius: 999px;
  background: linear-gradient(135deg, var(--uno-accent), var(--uno-accent2));
  box-shadow: var(--uno-glow);
  transition: transform var(--uno-tr), box-shadow var(--uno-tr), filter var(--uno-tr);
}
.uno-btn:hover { transform: translateY(-2px); filter: brightness(1.08); }
.uno-btn:active { transform: translateY(0); }
.uno-btn:disabled { opacity: .45; cursor: not-allowed; transform: none; filter: grayscale(.4); }
.uno-btn.is-ghost { background: rgba(255, 255, 255, .06); box-shadow: none; border: 1px solid var(--uno-border-br); }
.uno-btn.is-danger { background: linear-gradient(135deg, #f87171, #e23a3a); }
.uno-btn.is-uno {
  background: linear-gradient(135deg, var(--uno-yellow), var(--uno-red));
  font-size: 20px; padding: 16px 40px; letter-spacing: 2px;
  animation: uno-pulse 1s ease-in-out infinite;
}
.uno-btn.is-catch { background: linear-gradient(135deg, var(--uno-green), #15803d); }

/* ============================ COLOR PICKER ============================ */
.uno-colorpick {
  position: fixed; inset: 0; z-index: 9000;
  display: grid; place-items: center;
  background: rgba(0, 0, 0, .6); backdrop-filter: blur(4px);
}
.uno-colorpick-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
  padding: 24px; border-radius: var(--uno-rl);
  background: var(--uno-card-bg); box-shadow: var(--uno-shadow);
  border: 1px solid var(--uno-border-br);
}
.uno-colorpick-grid > .uno-colorswatch {
  width: 110px; height: 110px; border-radius: var(--uno-r);
  cursor: pointer; border: 3px solid rgba(255, 255, 255, .25);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .5);
  transition: transform var(--uno-tr), box-shadow var(--uno-tr);
}
.uno-colorswatch:hover { transform: scale(1.07); box-shadow: 0 0 26px currentColor; }
.uno-colorswatch.is-red    { background: var(--uno-red); color: var(--uno-red); }
.uno-colorswatch.is-yellow { background: var(--uno-yellow); color: var(--uno-yellow); }
.uno-colorswatch.is-green  { background: var(--uno-green); color: var(--uno-green); }
.uno-colorswatch.is-blue   { background: var(--uno-blue); color: var(--uno-blue); }

/* ============================ TOASTS ============================ */
.uno-toasts {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  z-index: 9500; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
}
.uno-toast {
  padding: 10px 20px; border-radius: 999px; font-weight: 700; font-size: 14px;
  background: rgba(22, 22, 42, .92); color: var(--uno-text);
  border: 1px solid var(--uno-border-br); box-shadow: var(--uno-shadow);
  opacity: 0; transform: translateY(14px); transition: opacity .25s ease, transform .25s ease;
}
.uno-toast.show { opacity: 1; transform: translateY(0); }
.uno-toast.is-invalid { border-color: #f87171; color: #fecaca; }
.uno-toast.is-success { border-color: var(--uno-green); }
.uno-toast.is-warn    { border-color: var(--uno-yellow); }

/* ============================ OVERLAYS ============================ */
.uno-overlay {
  position: fixed; inset: 0; z-index: 8500;
  display: grid; place-items: center;
  background: rgba(5, 5, 12, .82); backdrop-filter: blur(6px);
  padding: 24px;
}
.uno-panel {
  background: var(--uno-card-bg); border: 1px solid var(--uno-border-br);
  border-radius: var(--uno-rl); box-shadow: var(--uno-shadow);
  padding: 28px; max-width: 560px; width: 100%; text-align: center;
}
.uno-panel h2 { margin: 0 0 12px; font-size: 26px; }

/* ============================ FX LAYER ============================ */
.uno-fx-layer {
  position: fixed; inset: 0; z-index: 9800; pointer-events: none; overflow: hidden;
}
.uno-fx-flying { border-radius: var(--uno-r); box-shadow: 0 18px 40px rgba(0, 0, 0, .6); }

.uno-fx-banner {
  position: fixed; top: 38%; left: 50%;
  transform: translate(-50%, -50%) scale(.4); opacity: 0;
  font-weight: 900; font-size: clamp(48px, 12vw, 140px); letter-spacing: 4px;
  color: #fff; text-shadow: 0 0 30px rgba(124, 58, 237, .9), 0 8px 24px rgba(0, 0, 0, .7);
  transition: transform .35s cubic-bezier(.3, 1.5, .5, 1), opacity .3s ease;
  pointer-events: none; white-space: nowrap;
}
.uno-fx-banner.show { transform: translate(-50%, -50%) scale(1); opacity: 1; }
.uno-fx-banner.out { transform: translate(-50%, -50%) scale(1.3); opacity: 0; }
.uno-fx-banner.is-uno { color: var(--uno-yellow); text-shadow: 0 0 40px var(--uno-red), 0 0 80px var(--uno-yellow); }
.uno-fx-banner.is-skip { color: var(--uno-red); }
.uno-fx-banner.is-reverse { color: var(--uno-green); }
.uno-fx-banner.is-draw2, .uno-fx-banner.is-wild4 { color: var(--uno-yellow); }
.uno-fx-banner.is-win { color: var(--uno-yellow); }
.uno-fx-banner .uno-rev { display: inline-block; animation: uno-spin .8s ease; }
@keyframes uno-spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }

.uno-spark {
  position: absolute; width: 16px; height: 16px; border-radius: 50%;
  box-shadow: 0 0 14px currentColor;
}
.uno-confetti {
  position: absolute; top: -10vh; width: 10px; height: 16px; border-radius: 2px;
}

/* ============================ RESPONSIVE ============================ */
/* mobile */
@media (max-width: 640px) {
  .uno-hand .uno-card { margin: 0 -28px; }
  .uno-size-lg { width: 92px; height: 138px; }
  .uno-btn { padding: 10px 16px; font-size: 14px; }
  .uno-colorpick-grid > .uno-colorswatch { width: 80px; height: 80px; }
  .uno-felt { inset: 3% 2%; }
}
/* big-screen TV */
@media (min-width: 1600px) {
  .uno-seat .uno-seat-name { font-size: 20px; }
  .uno-seat .uno-seat-avatar { width: 60px; height: 60px; font-size: 30px; }
  .uno-fx-banner { font-size: clamp(80px, 10vw, 200px); }
}

/* reduced motion */
@media (prefers-reduced-motion: reduce) {
  .uno-card, .uno-btn, .uno-seat, .uno-toast, .uno-fx-banner { transition: none !important; animation: none !important; }
}
