/* ═══════════════════════════════════════════════════════════
   uno.css — UNO card game styles (HTML rendering, no Phaser)
   ═══════════════════════════════════════════════════════════ */

/* ── Page layout ──────────────────────────────────────────── */
.bc-table-layout {
  display: flex;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}
@media (max-width: 900px) {
  .bc-table-layout { flex-direction: column; }
}
@media (orientation: landscape) and (max-width: 932px) and (pointer: coarse) {
  .bc-table-layout { flex-direction: row; }
  .bc-table-layout .bc-sidebar {
    width: 200px !important;
    height: 100dvh !important;
    border-left: 1px solid var(--gc-border, rgba(255,255,255,0.12));
    border-bottom: none;
  }
}

/* ── Table ─────────────────────────────────────────────────── */
.bc-table {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 50%, #1e5a8a 0%, #0a1e3a 100%);
}
.bc-table::before {
  content: '';
  position: absolute; inset: 0;
  background: repeating-conic-gradient(rgba(255,255,255,0.03) 0% 25%, transparent 0% 50%) 0 0 / 40px 40px;
  transform: rotate(45deg) scale(1.5);
  pointer-events: none;
}

/* ── Seats ─────────────────────────────────────────────────── */
.uno-seat {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  z-index: 10;
  transition: box-shadow 0.3s, opacity 0.3s;
}
.uno-seat-bottom { left: 50%; bottom: 24%; transform: translateX(-50%); z-index: 25; }
.uno-seat-top    { left: 50%; top: 5%;    transform: translateX(-50%); }
.uno-seat-left   { left: 5%;  top: 40%;   transform: translateY(-50%); }
.uno-seat-right  { right: 5%; top: 40%;   transform: translateY(-50%); }

/* ── Avatar ───────────────────────────────────────────────── */
.uno-seat-avatar {
  width: 52px; height: 52px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.15);
  background: rgba(0,0,0,0.3);
  flex-shrink: 0;
  position: relative;
  overflow: visible;
}
.uno-seat-avatar img {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.uno-active-turn .uno-seat-avatar {
}
.uno-crown {
  font-size: 14px;
  line-height: 1;
  pointer-events: none;
}

/* ── Timer Ring ───────────────────────────────────────────── */
.uno-timer-ring {
  position: absolute;
  inset: -5px;
  width: calc(100% + 10px);
  height: calc(100% + 10px);
  z-index: 2;
  pointer-events: none;
  transform: rotate(-90deg);
  display: none;
}
.uno-timer-ring circle {
  fill: none;
  stroke: var(--gc-green, #2ecc71);
  stroke-width: 3.5;
  stroke-dasharray: 163.36;
  stroke-dashoffset: 0;
  stroke-linecap: round;
  transition: stroke 0.3s;
}
.uno-timer-ring.uno-timer-active { display: block; }
.uno-timer-ring.uno-timer-warn circle { stroke: var(--gc-gold, #f39c12); }
.uno-timer-ring.uno-timer-urgent circle { stroke: var(--gc-red, #ef4444); }
.uno-timer-ring.uno-timer-urgent { animation: pulse 0.5s infinite; }

/* ── Seat Info ────────────────────────────────────────────── */
.uno-card-count {
  font-size: 11px;
  font-family: 'IBM Plex Mono', monospace;
  color: var(--gc-cyan, #22d3ee);
  font-weight: 600;
}
.uno-seat-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}
.uno-seat-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--gc-text-bright, #e8f0fa);
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.uno-seat-name.turn { color: #FFD700; }
.uno-seat-points {
  font-size: 10px;
  font-family: 'IBM Plex Mono', monospace;
  color: var(--gc-gold, #FFD700);
  font-weight: 500;
}

/* ── Mini Cards (opponent card backs) ─────────────────────── */
.uno-mini-cards {
  display: flex;
  justify-content: center;
}
.uno-mini-card {
  width: 28px;
  aspect-ratio: 2/3;
  border-radius: 2px;
  flex-shrink: 0;
  transform-origin: bottom center;
}
.uno-mini-card:not(:first-child) { margin-left: -16px; }

/* ── Seat States ──────────────────────────────────────────── */
.uno-seat.uno-active-turn { border-radius: 12px; }

/* ── Seat Delta (round result float) ──────────────────────── */
.uno-seat-delta {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  animation: floatUp 0.5s ease;
  white-space: nowrap;
}
.uno-seat-delta.positive { color: var(--gc-green, #4ade80); }
.uno-seat-delta.negative { color: var(--gc-red, #ef4444); }

/* ── Table Center ─────────────────────────────────────────── */
.uno-table-center {
  position: absolute;
  left: 50%; top: 38%;
  transform: translate(-50%, -50%);
  text-align: center;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.uno-piles {
  display: flex;
  align-items: center;
  gap: 20px;
}

.uno-discard-stack {
  position: relative;
  width: 64px;
  aspect-ratio: 2/3;
}
.uno-discard-prev {
  position: absolute;
  inset: 0;
  transform: translate(-6px, 3px) rotate(-8deg);
  opacity: 0.5;
  z-index: 0;
  border-radius: 6px;
}
.uno-discard-top {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

/* ── Draw Pile ────────────────────────────────────────────── */
.uno-draw-pile {
  width: 64px;
  aspect-ratio: 2/3;
  cursor: pointer;
  transition: transform 0.15s, filter 0.15s;
  border-radius: 6px;
  overflow: hidden;
}
.uno-draw-pile img {
  width: 100%; height: 100%;
  border-radius: 6px;
  pointer-events: none;
}
.uno-draw-pile:hover {
  transform: scale(1.08);
}
.uno-draw-pile.must-draw {
  filter: brightness(1.3) saturate(1.2);
  animation: drawPulse 1s infinite;
}
@keyframes drawPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

/* ── Discard Glow ─────────────────────────────────────────── */
.uno-discard-stack.has-glow .uno-discard-top {
  box-shadow: 0 0 16px var(--uno-glow-color, rgba(255,255,255,0.3)), 0 4px 16px rgba(0,0,0,0.4);
}

/* ── Color Indicator ──────────────────────────────────────── */
.uno-color-ind {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  transform: rotate(45deg);
  border: 2px solid rgba(255,255,255,0.8);
  margin-top: 4px;
  transition: background 0.3s;
}

/* ── Card Sprite (from deck.svg spritesheet) ──────────────── */
.uno-card-sprite {
  background-image: url(/assets/cards/deck.svg);
  background-size: 1400% 800%;
  background-repeat: no-repeat;
}

/* ── Status Text ──────────────────────────────────────────── */
.uno-status {
  font-size: 13px;
  color: var(--gc-muted, #6b8fb5);
  font-weight: 500;
  margin-top: 4px;
}

/* ── Start Button (table center) ──────────────────────────── */
.uno-start-btn {
  margin-top: 10px;
  font-size: 15px;
  padding: 10px 28px;
  border-radius: 10px;
  font-weight: 700;
  font-family: 'Be Vietnam Pro', sans-serif;
  cursor: pointer;
  border: none;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff;
  box-shadow: 0 4px 16px rgba(59,130,246,0.3);
  transition: transform 0.15s, box-shadow 0.15s;
  animation: fadeInUp 0.3s ease;
}
.uno-start-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(59,130,246,0.4);
}

/* ── My Hand ──────────────────────────────────────────────── */
.uno-hand-area {
  position: absolute;
  bottom: 2%; left: 0; right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 10px 10px;
  z-index: 20;
  pointer-events: none;
}
.uno-hand-area > * { pointer-events: auto; }
.uno-hand {
  display: flex;
  justify-content: center;
  padding: 24px 0 4px;
  max-width: 100%;
  overflow: visible;
}
.uno-card {
  width: 62px;
  aspect-ratio: 2/3;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
  flex-shrink: 0;
  border-radius: 6px;
  position: relative;
  user-select: none;
  -webkit-user-select: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  transform-origin: bottom center;
}
.uno-card:not(:first-child) { margin-left: -22px; }
.uno-card:hover:not(.dimmed) {
  transform: rotate(0deg) translateY(-30px) scale(1.1) !important;
  box-shadow: 0 8px 20px rgba(0,0,0,0.5);
  z-index: 100;
}
.uno-card.dimmed {
  cursor: default;
}

/* ── UNO Button ───────────────────────────────────────────── */
.uno-btn {
  position: absolute;
  right: 8%; bottom: 30%;
  z-index: 50;
  width: 76px; height: 76px;
  border-radius: 50%;
  background: #E74C3C;
  border: 3px solid #fff;
  color: #fff;
  font-family: 'Bungee', cursive;
  font-size: 18px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(231,76,60,0.5);
  animation: unoPulse 0.5s ease infinite alternate;
  transition: opacity 0.2s;
}
.uno-btn:hover {
  box-shadow: 0 6px 24px rgba(231,76,60,0.7);
}
@keyframes unoPulse {
  from { transform: scale(1); }
  to   { transform: scale(1.12); }
}

/* ── Color Chooser Overlay ────────────────────────────────── */
.uno-color-chooser {
  position: absolute;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}
.uno-cc-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.65);
}
.uno-cc-content {
  position: relative;
  z-index: 1;
  text-align: center;
}
.uno-cc-title {
  font-family: 'Bungee', cursive;
  font-size: 26px;
  color: #fff;
  margin-bottom: 24px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}
.uno-cc-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.uno-cc-btn {
  width: 76px; height: 76px;
  border-radius: 50%;
  border: 3px solid #fff;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.uno-cc-btn:hover {
  transform: scale(1.15);
  box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}
.uno-cc-btn[data-color="red"]    { background: #E74C3C; }
.uno-cc-btn[data-color="yellow"] { background: #F1C40F; }
.uno-cc-btn[data-color="green"]  { background: #2ECC71; }
.uno-cc-btn[data-color="blue"]   { background: #3498DB; }

/* ── Effects (floating text) ──────────────────────────────── */
.uno-effect {
  position: absolute;
  left: 50%; top: 40%;
  transform: translate(-50%, -50%);
  font-family: 'Bungee', cursive;
  font-size: 42px;
  pointer-events: none;
  z-index: 100;
  text-shadow: 0 0 12px currentColor, 0 4px 12px rgba(0,0,0,0.5);
  animation: unoEffect 1.2s ease forwards;
}
@keyframes unoEffect {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
  20%  { opacity: 1; transform: translate(-50%, -50%) scale(1.2); }
  60%  { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.3) translateY(-20px); }
}

/* ── Deal Card Animation ──────────────────────────────────── */
.uno-deal-card {
  position: absolute;
  width: 48px;
  aspect-ratio: 2/3;
  z-index: 150;
  pointer-events: none;
  transition: left 100ms cubic-bezier(0.2, 0.8, 0.2, 1),
              top 100ms cubic-bezier(0.2, 0.8, 0.2, 1);
  box-shadow: 0 8px 20px rgba(0,0,0,0.45);
  border-radius: 4px;
}
.uno-deal-card img {
  display: block;
  width: 100%; height: 100%;
  border-radius: 4px;
}

/* ── Card Flash (draw rejected hint) ──────────────────────── */
.uno-card-flash {
  animation: cardFlash 0.3s ease 2;
}
@keyframes cardFlash {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-18px); }
}

/* ── Shared Animations ────────────────────────────────────── */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.5; }
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes floatUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Hidden utility ───────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Mobile ───────────────────────────────────────────────── */
@media (max-width: 900px) {
  .uno-seat-top    { transform: scale(0.75) translateX(-50%); }
  .uno-seat-left   { transform: scale(0.75) translateY(-50%); }
  .uno-seat-right  { transform: scale(0.75) translateY(-50%); }
  .uno-card { width: 50px; }
  .uno-card:not(:first-child) { margin-left: -18px; }
  .uno-discard-stack { width: 52px; }
  .uno-draw-pile { width: 52px; }
  .uno-seat-avatar { width: 40px; height: 40px; }
  .uno-btn { width: 64px; height: 64px; font-size: 15px; }
  .bc-profile-chip { min-height: 32px; padding: 4px 8px; gap: 4px; }
  .bc-profile-chip strong { font-size: 11px; max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .bc-profile-chip span { font-size: 10px; white-space: nowrap; }
  .bc-btn-icon { width: 32px; height: 32px; font-size: 14px; }
  .bc-table { padding-bottom: env(safe-area-inset-bottom, 0px); }
  .orientation-lock { display: none !important; }
}

@media (max-width: 600px) {
  .uno-card { width: 42px; }
  .uno-card:not(:first-child) { margin-left: -14px; }
  .uno-card:hover:not(.dimmed) { transform: translateY(-14px) scale(1.06); }
  .uno-discard-stack { width: 44px; }
  .uno-draw-pile { width: 44px; }
  .uno-seat-avatar { width: 34px; height: 34px; }
  .uno-seat-name { font-size: 10px; max-width: 60px; }
  .uno-mini-card { width: 18px; }
  .uno-mini-card:not(:first-child) { margin-left: -10px; }
  .uno-btn { width: 56px; height: 56px; font-size: 13px; right: 4%; bottom: 25%; }
  .uno-cc-btn { width: 60px; height: 60px; }
  .uno-cc-title { font-size: 20px; }
}

/* ── Phone landscape: slim sidebar ────────────────────────── */
@media (orientation: landscape) and (max-width: 932px) and (pointer: coarse) {
  .bc-sidebar-header { padding: 6px 8px; }
  .bc-sidebar-room { padding: 8px; }
  .bc-sidebar-room, .bc-sidebar-chat { display: flex !important; }
  .bc-sidebar-chat { padding: 6px 8px; }
  .bc-sidebar-toggle { display: none !important; }
  .bc-room-stats { font-size: 11px; }
}

