/* ═══════════════════════════════════════════════════════════
   tienlen.css — Tien Len Mien Nam card game styles
   ═══════════════════════════════════════════════════════════ */

/* ── Page layout: game table (left) + sidebar (right) ──── */
.bc-table-layout {
  display: flex;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* <=900px: sidebar becomes collapsed top bar, table fills rest */
@media (max-width: 900px) {
  .bc-table-layout {
    flex-direction: column;
  }
}

/* Phone landscape: keep row, slim sidebar */
@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 ─────────────────────────────────────────────── */
.tl-seat {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  z-index: 10;
  transition: box-shadow 0.3s, opacity 0.3s;
}
.tl-seat-bottom { left: 50%; bottom: 24%; transform: translateX(-50%); z-index: 25; }
.tl-seat-top    { left: 50%; top: 5%;    transform: translateX(-50%); }
.tl-seat-left   { left: 5%;  top: 40%;   transform: translateY(-50%); align-items: flex-start; }
.tl-seat-right  { right: 5%; top: 40%;   transform: translateY(-50%); align-items: flex-end; }
.tl-seat-left .tl-mini-cards,
.tl-seat-right .tl-mini-cards {
  flex-direction: column;
  align-items: center;
}
.tl-seat-left .tl-mini-card:not(:first-child),
.tl-seat-right .tl-mini-card:not(:first-child) { margin-left: 0; margin-top: -40px; }

.tl-seat.tl-active-turn {
  border-radius: 12px;
}

.tl-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;
}
.tl-seat-avatar img {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

/* Timer ring on avatar */
.tl-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;
}
.tl-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;
}
.tl-timer-ring.tl-timer-active { display: block; }
.tl-timer-ring.tl-timer-warn circle { stroke: var(--gc-gold, #f39c12); }
.tl-timer-ring.tl-timer-urgent circle { stroke: var(--gc-red, #ef4444); }
.tl-timer-ring.tl-timer-urgent { animation: pulse 0.5s infinite; }

.tl-card-count {
  font-size: 11px;
  font-family: 'IBM Plex Mono', monospace;
  color: var(--gc-cyan, #22d3ee);
  font-weight: 600;
}

.tl-seat-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}
.tl-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;
}
.tl-seat-points {
  font-size: 10px;
  font-family: 'IBM Plex Mono', monospace;
  color: var(--gc-gold, #FFD700);
  font-weight: 500;
}

.tl-seat-badge {
  font-size: 10px;
  color: var(--gc-muted, #6b8fb5);
  min-height: 14px;
}

/* Opponent card fan */
.tl-seat-cards {
  display: flex;
  justify-content: center;
}
.tl-mini-cards {
  display: flex;
  justify-content: center;
}
.tl-mini-card {
  width: 44px;
  aspect-ratio: 242/340;
  border-radius: 2px;
  flex-shrink: 0;
}
/* Fan direction per seat — cards curve away from table center */
.tl-seat-bottom .tl-mini-card { transform-origin: bottom center; }
.tl-seat-top .tl-mini-card    { transform-origin: top center; }
.tl-seat-left .tl-mini-card   { transform-origin: center right; }
.tl-seat-right .tl-mini-card  { transform-origin: center left; }
.tl-mini-card:not(:first-child) { margin-left: -16px; }

/* Seat states */
.tl-seat.tl-passed .tl-seat-avatar { opacity: 0.4; }
.tl-seat.tl-forfeited { opacity: 0.3; pointer-events: none; }
.tl-seat.tl-forfeited::after {
  content: 'X';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 28px;
  font-weight: 900;
  color: var(--gc-red, #ef4444);
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

/* Pass indicator */
.tl-pass-indicator {
  position: absolute;
  top: -6px; right: -6px;
  font-size: 10px;
  font-weight: 700;
  color: var(--gc-red, #ef4444);
  background: rgba(0,0,0,0.6);
  padding: 2px 6px;
  border-radius: 8px;
  animation: fadeInUp 0.3s ease;
}

/* ── Table Center ──────────────────────────────────────── */
.tl-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: 6px;
}
.tl-played-cards {
  display: flex;
  gap: 4px;
  justify-content: center;
  min-height: 70px;
  align-items: center;
}
.tl-table-card {
  width: 48px;
  aspect-ratio: 242/340;
  border-radius: 3px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
.tl-card-fly {
  animation: cardFly 0.35s cubic-bezier(0.2, 0.8, 0.3, 1) backwards;
}
@keyframes cardFly {
  from {
    opacity: 0;
    transform: translate(var(--fly-from-x, 0), var(--fly-from-y, 0)) scale(0.4);
  }
  60% {
    opacity: 1;
  }
  to {
    opacity: 1;
    transform: translate(0, 0) scale(1);
  }
}

.tl-status {
  font-size: 13px;
  color: var(--gc-muted, #6b8fb5);
  font-weight: 500;
}

/* ── Start Button (table center) ──────────────────────── */
.tl-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, #f59e0b, #d97706);
  color: #0a1e3a;
  box-shadow: 0 4px 16px rgba(245,158,11,0.3);
  transition: transform 0.15s, box-shadow 0.15s;
  animation: fadeInUp 0.3s ease;
}
.tl-start-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(245,158,11,0.4);
}
.tl-start-btn:disabled {
  opacity: 0.4;
  cursor: default;
  transform: none;
}

.tl-combo-label {
  font-family: 'Bungee', cursive;
  font-size: 14px;
  color: var(--gc-gold, #FFD700);
  animation: fadeInUp 0.3s ease;
}
.tl-combo-label.chop {
  color: var(--gc-red, #ef4444);
  font-size: 16px;
  text-shadow: 0 0 8px rgba(239,68,68,0.5);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── My Hand ───────────────────────────────────────────── */
.tl-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;
}
.tl-hand-area > * {
  pointer-events: auto;
}
.tl-hand {
  display: flex;
  justify-content: center;
  padding: 24px 0 4px;
  max-width: 100%;
  overflow: visible;
  -webkit-overflow-scrolling: touch;
}
.tl-card {
  width: 56px;
  aspect-ratio: 242/340;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  flex-shrink: 0;
  border-radius: 4px;
  position: relative;
  user-select: none;
  -webkit-user-select: none;
  transform-origin: bottom center;
}
.tl-card img {
  width: 100%; height: 100%;
  border-radius: 4px;
  pointer-events: none;
}
.tl-card:not(:first-child) { margin-left: -24px; }
/* hover/selected transforms handled via JS to preserve rotation */
/* playable hint removed — no blue border */
.tl-card.dimmed {
  opacity: 0.5;
  pointer-events: none;
}

.tl-selection-hint {
  font-size: 11px;
  color: var(--gc-red, #ef4444);
  min-height: 16px;
  margin-top: 2px;
}

/* ── Action Bar ────────────────────────────────────────── */
.tl-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 6px;
}
.tl-actions .bc-btn {
  font-size: 13px;
  padding: 8px 18px;
  border-radius: 8px;
  font-weight: 600;
  font-family: 'Be Vietnam Pro', sans-serif;
  cursor: pointer;
  border: none;
  transition: background 0.15s, transform 0.1s, opacity 0.15s;
}
.tl-actions .bc-btn:disabled {
  opacity: 0.4;
  cursor: default;
  transform: none;
}
.tl-actions .bc-btn-primary {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #0a1e3a;
}
.tl-actions .bc-btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(245,158,11,0.3);
}
.tl-actions .bc-btn-secondary {
  background: rgba(200,221,240,0.08);
  border: 1px solid rgba(200,221,240,0.15);
  color: var(--gc-text, #c8ddf0);
}
.tl-actions .bc-btn-secondary:hover:not(:disabled) {
  background: rgba(200,221,240,0.14);
}
.tl-sort-btn.active {
  background: rgba(34,211,238,0.15);
  border-color: rgba(34,211,238,0.3);
  color: var(--gc-cyan, #22d3ee);
}

/* ── Inline Result ─────────────────────────────────────── */
.tl-inline-result {
  text-align: center;
  animation: fadeInUp 0.3s ease;
}
.tl-inline-winner {
  font-size: 18px;
  font-weight: 700;
  color: var(--gc-gold, #FFD700);
  text-shadow: 0 0 12px rgba(255,215,0,0.4);
}
.tl-inline-reason {
  font-size: 12px;
  color: var(--gc-muted, #8899aa);
  margin-top: 2px;
}
.tl-inline-rake {
  font-size: 11px;
  color: var(--gc-muted, #6b8fb5);
  margin-top: 4px;
}

/* Seat delta float */
.tl-seat-delta .tl-delta-amount {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 14px;
  font-weight: 700;
}
.tl-seat-delta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-align: center;
  animation: floatUp 0.5s ease;
  white-space: nowrap;
}
.tl-seat-delta.positive { color: var(--gc-green, #4ade80); }
.tl-seat-delta.negative { color: var(--gc-red, #ef4444); }

@keyframes floatUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Deal Card Animation ──────────────────────────────── */
.tl-deal-card {
  position: fixed;
  width: 48px;
  aspect-ratio: 242 / 340;
  z-index: 50;
  pointer-events: none;
  transition: transform 320ms cubic-bezier(0.2, 0.8, 0.2, 1), opacity 320ms ease;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
  border-radius: 4px;
}
.tl-deal-card img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 4px;
}

/* ── Special Play Effects ──────────────────────────────── */
.tl-special-effect {
  position: absolute;
  top: 40%; left: 50%;
  transform: translate(-50%, -50%);
  font-family: 'Bungee', 'Be Vietnam Pro', cursive;
  font-size: 36px;
  font-weight: 800;
  z-index: 100;
  pointer-events: none;
  white-space: nowrap;
  animation: specialBoom 1.2s ease forwards;
}
.tl-effect-heo {
  color: var(--gc-gold, #FFD700);
  text-shadow: 0 0 20px rgba(255,215,0,0.6), 0 4px 12px rgba(0,0,0,0.5);
}
.tl-effect-chop {
  color: var(--gc-red, #ef4444);
  font-size: 42px;
  text-shadow: 0 0 24px rgba(239,68,68,0.7), 0 4px 12px rgba(0,0,0,0.5);
}
@keyframes specialBoom {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.3); }
  20%  { opacity: 1; transform: translate(-50%, -50%) scale(1.2); }
  40%  { transform: translate(-50%, -50%) scale(1.0); }
  80%  { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.1) translateY(-15px); }
}

/* ── Seat Delta Penalty Labels ────────────────────────── */
.tl-delta-penalty {
  font-size: 11px;
  font-weight: 700;
  color: var(--gc-red, #ef4444);
  text-shadow: 0 0 6px rgba(239,68,68,0.4);
  animation: floatUp 0.5s ease;
}

/* ── Tablet (iPad) ─────────────────────────────────────── */
@media (max-width: 1024px) {
  .tl-mini-card { width: 28px; }
  .tl-mini-card:not(:first-child) { margin-left: -12px; }
  .tl-seat-left .tl-mini-card:not(:first-child),
  .tl-seat-right .tl-mini-card:not(:first-child) { margin-left: 0; margin-top: -28px; }
}

/* ── Mobile Responsive ─────────────────────────────────── */
@media (max-width: 900px) {
  .tl-seat-top    { transform: scale(0.75) translateX(-50%); }
  .tl-seat-left   { transform: scale(0.75) translateY(-50%); }
  .tl-seat-right  { transform: scale(0.75) translateY(-50%); }
  .tl-card { width: 46px; }
  .tl-card:not(:first-child) { margin-left: -20px; }
  .tl-table-card { width: 38px; }
  .tl-seat-avatar { width: 40px; height: 40px; }
  .tl-actions .bc-btn { font-size: 12px; padding: 7px 14px; }
}

@media (max-width: 600px) {
  .tl-card { width: 40px; }
  .tl-card:not(:first-child) { margin-left: -16px; }
  .tl-table-card { width: 32px; }
  .tl-seat-avatar { width: 34px; height: 34px; }
  .tl-seat-name { font-size: 10px; max-width: 60px; }
  .tl-actions { gap: 6px; }
  .tl-actions .bc-btn { font-size: 11px; padding: 6px 12px; }
  .tl-combo-label { font-size: 12px; }
  .tl-mini-card { width: 18px; }
  .tl-mini-card:not(:first-child) { margin-left: -10px; }
  .tl-seat-left .tl-mini-card:not(:first-child),
  .tl-seat-right .tl-mini-card:not(:first-child) { margin-left: 0; margin-top: -14px; }
}

