/* ============================================================================
   Royal Ludo Arena v2.0.0 — 3D Studio Board, Glossy 3D Pawns, 2v2 Team HUD,
   Live Server Status & Luxury Royal Modals CSS
   ============================================================================ */

:root {
  --rla-bg: #2b1206;
  --rla-wood: #3d1c0b;
  --rla-wood-dark: #240e04;
  --rla-wine: #73111c;
  --rla-wine-bright: #9d1a28;
  --rla-gold: #f4bd41;
  --rla-gold-deep: #b87a14;
  --rla-cream: #fff4d6;
  --rla-cream-soft: #f5dfb0;
  --rla-blue: #1e78ff;
  --rla-red: #e52d2d;
  --rla-green: #1ea849;
  --rla-yellow: #f4b71a;
}

/* ---------- Live HUD Overlay on Home & Profile ---------- */
.rla-live-hud {
  position: absolute;
  top: 0.9%;
  left: 33%;
  width: 55%;
  height: 5.2%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  pointer-events: none;
  z-index: 6;
}
.rla-hud-pill {
  background: #3c190a;
  border: 2px solid var(--rla-gold);
  border-radius: 999px;
  padding: 2px 10px 2px 7px;
  color: #fff6dc;
  font-weight: 900;
  font-size: clamp(10px, 2.7vw, 15px);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.55);
  white-space: nowrap;
}
.rla-hud-level {
  position: absolute;
  left: 2.2%;
  top: 8.3%;
  background: #4b200d;
  border: 1.5px solid var(--rla-gold);
  border-radius: 999px;
  padding: 2px 9px;
  color: var(--rla-cream);
  font-size: clamp(9px, 2.3vw, 12px);
  font-weight: 800;
  z-index: 6;
  pointer-events: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
}
.rla-server-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 4px;
  background: #f59e0b;
}
.rla-server-dot.live {
  background: #22c55e;
  box-shadow: none;
}
.rla-resume-banner {
  position: absolute;
  left: 50%;
  bottom: 10%;
  transform: translateX(-50%);
  z-index: 12;
  background: #9d1a28;
  border: 2.5px solid var(--rla-gold);
  color: #fff5d6;
  font-weight: 900;
  font-size: clamp(11px, 3vw, 14px);
  padding: 8px 16px;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.65);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* ---------- Full Game Arena Shell ---------- */
.rla-arena-shell {
  min-height: 100dvh;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: max(6px, env(safe-area-inset-top)) 8px max(8px, env(safe-area-inset-bottom));
  background: #5c2a12;
  color: var(--rla-cream);
  user-select: none;
  overflow: hidden;
  position: relative;
}
.rla-arena-shell.theme-emerald-palace {
  background: #145c3d;
}
.rla-arena-shell.theme-midnight-gold {
  background: #232844;
}
.rla-arena-inner {
  width: min(100%, 540px);
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  justify-content: space-between;
}

/* ---------- Top Bar & 2v2 Team Score Bar ---------- */
.rla-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  background: rgba(64, 28, 12, 0.94);
  border: 2px solid var(--rla-gold);
  border-radius: 14px;
  padding: 5px 9px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
}
.rla-top-left, .rla-top-right { display: flex; align-items: center; gap: 5px; }
.rla-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  border: 2px solid var(--rla-gold);
  background: #8a1824;
  color: var(--rla-cream);
  font-size: 15px;
  font-weight: 800;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.rla-icon-btn.active { background: #f6c445; color: #361704; }
.rla-mode-pill {
  background: #911a26;
  border: 1.5px solid var(--rla-gold);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  color: var(--rla-cream);
}
.rla-timer-pill {
  background: #230d04;
  border: 1.5px solid #f4bd41;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 900;
  color: #ffd86b;
  font-variant-numeric: tabular-nums;
}

.rla-team-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  background: rgba(50, 20, 8, 0.92);
  border: 1.5px solid rgba(244, 189, 65, 0.65);
  border-radius: 11px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 900;
}
.rla-team-side { display: flex; flex-direction: column; gap: 3px; }
.rla-team-side.right { text-align: right; }
.rla-team-track { height: 6px; border-radius: 999px; background: rgba(0, 0, 0, 0.5); overflow: hidden; }
.rla-team-fill-t1 { height: 100%; background: #1e78ff; }
.rla-team-fill-t2 { height: 100%; background: #e52d2d; margin-left: auto; }

/* ---------- Player Seat Rows ---------- */
.rla-seat-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rla-seat-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 8px;
  border-radius: 13px;
  background: rgba(61, 28, 11, 0.92);
  border: 2px solid rgba(244, 189, 65, 0.42);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  min-height: 56px;
}
.rla-seat-card.empty { opacity: 0.28; justify-content: center; font-size: 11px; color: #cbb089; }
.rla-seat-card.active {
  border-color: #ffe07a;
  box-shadow: 0 0 0 2px rgba(255, 215, 92, 0.45);
}
.rla-seat-card.seat-right { flex-direction: row-reverse; text-align: right; }
.rla-seat-card.color-red { border-left: 5px solid var(--rla-red); }
.rla-seat-card.color-green { border-right: 5px solid var(--rla-green); }
.rla-seat-card.color-blue { border-left: 5px solid var(--rla-blue); }
.rla-seat-card.color-yellow { border-right: 5px solid var(--rla-yellow); }

.rla-avatar-wrap { position: relative; width: 42px; height: 42px; flex: none; display: grid; place-items: center; }
.rla-timer-ring { position: absolute; inset: -3px; width: 48px; height: 48px; transform: rotate(-90deg); }
.rla-timer-ring circle { fill: none; stroke-width: 3.5; }
.rla-timer-ring .bg { stroke: rgba(255, 255, 255, 0.14); }
.rla-timer-ring .fg { stroke: #ffd55a; stroke-linecap: round; transition: stroke-dashoffset 0.25s linear; }
.rla-avatar-circle {
  width: 36px; height: 36px; border-radius: 50%;
  background: #7d3616;
  border: 2px solid var(--rla-gold);
  display: grid; place-items: center; font-size: 18px; z-index: 1;
}
.rla-seat-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.rla-seat-name { font-size: 12.5px; font-weight: 800; color: #fff6dc; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rla-seat-sub { font-size: 10.5px; color: #e3c38d; font-weight: 700; display: flex; align-items: center; gap: 4px; }
.rla-seat-card.seat-right .rla-seat-sub { justify-content: flex-end; }
.rla-home-pips { display: inline-flex; gap: 3px; }
.rla-home-pip { width: 7.5px; height: 7.5px; border-radius: 50%; border: 1px solid rgba(255,255,255,0.45); background: rgba(0,0,0,0.35); }
.rla-home-pip.done { background: #ffd34d; border-color: #fff; box-shadow: none; }

.rla-emote-bubble {
  position: absolute; top: -26px; left: 50%; transform: translateX(-50%);
  background: #fff7e0; color: #351606; border: 2px solid var(--rla-gold);
  border-radius: 14px; padding: 3px 10px; font-size: 12.5px; font-weight: 800;
  white-space: nowrap; z-index: 30; box-shadow: 0 4px 12px rgba(0,0,0,0.45);
  animation: rlaEmotePop 2.2s ease forwards; pointer-events: none;
}
@keyframes rlaEmotePop {
  0% { opacity: 0; transform: translate(-50%, 8px) scale(0.7); }
  14% { opacity: 1; transform: translate(-50%, 0) scale(1.06); }
  82% { opacity: 1; transform: translate(-50%, -2px); }
  100% { opacity: 0; transform: translate(-50%, -14px); }
}

/* ---------- 3D Interactive Dice ---------- */
.rla-dice-dock { width: 42px; height: 42px; flex: none; display: grid; place-items: center; perspective: 220px; }
.rla-dice-btn { width: 40px; height: 40px; border: 0; padding: 0; background: transparent; cursor: pointer; display: grid; place-items: center; border-radius: 10px; }
.rla-dice-btn:disabled { cursor: default; opacity: 0.72; }
.rla-dice-btn.ready { animation: rlaDiceInvite 1.1s ease-in-out infinite; }
@keyframes rlaDiceInvite {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 4px rgba(255, 215, 80, 0.5)); }
  50% { transform: scale(1.1); filter: drop-shadow(0 0 12px rgba(255, 215, 80, 0.95)); }
}
.rla-dice-face {
  width: 36px; height: 36px; border-radius: 9px;
  background: #ffffff;
  border: 2px solid #c5a468;
  box-shadow: inset 0 2px 3px rgba(255,255,255,0.9), 0 4px 8px rgba(0,0,0,0.55);
  display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr);
  padding: 5px; gap: 2px;
}
.dice-royal-gold .rla-dice-face { background: #ffe788; border-color: #fff0ad; }
.dice-ruby-crimson .rla-dice-face { background: #d92638; border-color: #f6c44e; }
.rla-dice-face.rolling { animation: rlaDiceTumble 0.42s linear infinite; }
@keyframes rlaDiceTumble {
  0% { transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg) scale(1.06); }
  50% { transform: rotateX(180deg) rotateY(180deg) rotateZ(90deg) scale(1.14); }
  100% { transform: rotateX(360deg) rotateY(360deg) rotateZ(180deg) scale(1.06); }
}
.rla-pip { width: 6px; height: 6px; border-radius: 50%; background: #444; margin: auto; opacity: 0; }
.rla-pip.on { opacity: 1; }
.dice-royal-gold .rla-pip.on { background: #c9182b; }
.dice-ruby-crimson .rla-pip.on { background: #fff4b8; }

/* ---------- Pixel-Exact 3D Studio Board (1200x1200, 105px frame = 8.75%) ---------- */
.rla-board-frame {
  position: relative;
  width: min(100%, 510px, 55dvh);
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.78);
  border: 2px solid rgba(244, 189, 65, 0.7);
}
.rla-board-frame.shake { animation: rlaBoardShake 0.38s ease; }
@keyframes rlaBoardShake {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(-5px, 3px); }
  50% { transform: translate(5px, -3px); }
  75% { transform: translate(-3px, -2px); }
}
.rla-board-art-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: fill;
  pointer-events: none;
}
/* Exact mathematical alignment: 105 / 1200 = 8.75% on every side -> inner 15x15 grid is 82.5% x 82.5% */
.rla-board-surface {
  position: absolute;
  inset: 8.75%;
}
.theme-emerald-palace .rla-board-art-img { filter: hue-rotate(85deg) saturate(1.05); }
.theme-midnight-gold .rla-board-art-img { filter: contrast(1.08) brightness(0.92); }

.rla-tokens-layer { position: absolute; inset: 0; pointer-events: none; }

/* 3D Glossy Pawn Sprite Buttons */
.rla-pawn-btn {
  position: absolute;
  width: 7.4%;
  height: 7.4%;
  transform: translate(-50%, -66%);
  border: 0;
  padding: 0;
  background: transparent;
  pointer-events: auto;
  cursor: default;
  z-index: 5;
  transition: left 0.14s cubic-bezier(0.22, 0.8, 0.36, 1), top 0.14s cubic-bezier(0.22, 0.8, 0.36, 1), transform 0.14s ease;
  -webkit-tap-highlight-color: transparent;
}
.rla-pawn-btn.hopping { transform: translate(-50%, -98%) scale(1.22); z-index: 25; }
.rla-pawn-btn.movable { cursor: pointer; z-index: 18; animation: rlaPawnBounce 0.72s ease-in-out infinite; }
@keyframes rlaPawnBounce {
  0%, 100% { transform: translate(-50%, -66%) scale(1.08); }
  50% { transform: translate(-50%, -88%) scale(1.2); }
}
.rla-pawn-img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.52));
}
.rla-pawn-ring {
  position: absolute; left: 50%; top: 72%; width: 122%; height: 122%;
  transform: translate(-50%, -50%); border-radius: 50%;
  border: 2.5px solid #ffdf5e;
  box-shadow: 0 2px 3px rgba(0,0,0,0.35);
  animation: rlaRingPulse 1s ease-out infinite; pointer-events: none;
}
@keyframes rlaRingPulse {
  0% { transform: translate(-50%, -50%) scale(0.85); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1.32); opacity: 0.15; }
}
.rla-stack-badge {
  position: absolute; right: -3px; top: -3px; min-width: 15px; height: 15px;
  border-radius: 999px; background: #2b1206; border: 1.5px solid var(--rla-gold);
  color: #fff5d4; font-size: 9px; font-weight: 900; display: grid; place-items: center;
  padding: 0 3px; z-index: 20; pointer-events: none;
}

/* ---------- Banners, Burst FX & Bottom Bar ---------- */
.rla-board-banner {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  background: #9a1826;
  border: 2.5px solid var(--rla-gold); color: #fff6dc;
  font-weight: 900; font-size: clamp(13px, 3.8vw, 18px);
  padding: 8px 16px; border-radius: 999px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.72);
  pointer-events: none; z-index: 40; white-space: nowrap;
  animation: rlaBannerPop 1.45s ease forwards;
}
@keyframes rlaBannerPop {
  0% { opacity: 0; transform: translate(-50%, -30%) scale(0.65); }
  16% { opacity: 1; transform: translate(-50%, -50%) scale(1.06); }
  80% { opacity: 1; transform: translate(-50%, -54%); }
  100% { opacity: 0; transform: translate(-50%, -72%) scale(0.95); }
}
.rla-fx-burst {
  position: absolute; width: 60px; height: 60px; transform: translate(-50%, -50%);
  border-radius: 50%; border: 4px solid #ffd54d; box-shadow: 0 3px 8px rgba(0,0,0,0.45);
  pointer-events: none; z-index: 35; animation: rlaBurst 0.55s ease-out forwards;
}
@keyframes rlaBurst {
  0% { transform: translate(-50%, -50%) scale(0.2); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1.9); opacity: 0; }
}

.rla-bottom-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  background: rgba(64, 28, 12, 0.94);
  border: 2px solid var(--rla-gold); border-radius: 13px; padding: 5px 9px;
}
.rla-turn-prompt { font-size: 12.5px; font-weight: 800; color: var(--rla-cream); flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rla-emote-strip { display: flex; align-items: center; gap: 4px; }
.rla-emote-btn {
  min-width: 30px; height: 30px; padding: 0 5px; border-radius: 8px;
  border: 1.5px solid rgba(244, 189, 65, 0.55); background: rgba(255, 240, 200, 0.1);
  color: var(--rla-cream); font-size: 14px; font-weight: 800; cursor: pointer; display: grid; place-items: center;
}
.rla-reroll-btn {
  padding: 5px 9px; border-radius: 9px; border: 2px solid var(--rla-gold);
  background: #f8cc54; color: #361704;
  font-size: 11px; font-weight: 900; cursor: pointer; white-space: nowrap;
}

/* ---------- Royal Feature Modals ---------- */
.rla-royal-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.rla-royal-card {
  background: #522410;
  border: 2px solid rgba(244, 189, 65, 0.6); border-radius: 12px; padding: 10px 8px;
  text-align: center; display: flex; flex-direction: column; align-items: center; gap: 5px;
}
.rla-royal-card.active, .rla-royal-card.claimed { border-color: #7ee081; background: #275734; }
.rla-royal-card.highlight { border-color: #ffe070; box-shadow: 0 3px 8px rgba(0,0,0,0.35); }
.rla-royal-btn {
  padding: 8px 14px; border: 2px solid #f7ca57;
  background: #fbd261; color: #3a1905;
  border-radius: 10px; font-weight: 900; font-size: 13px; cursor: pointer; box-shadow: 0 3px 0 #7b470c;
}
.rla-royal-btn:disabled { opacity: 0.5; cursor: default; }
.rla-royal-btn.secondary { background: #8b1c28; color: #fff4d6; box-shadow: 0 3px 0 #33060a; }

.rla-wheel-wrap { position: relative; width: 240px; height: 240px; margin: 4px auto; }
.rla-wheel-pointer {
  position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
  width: 0; height: 0; border-left: 12px solid transparent; border-right: 12px solid transparent;
  border-top: 22px solid #ffd54d; z-index: 5;
}
.rla-wheel-svg { width: 100%; height: 100%; transition: transform 3.8s cubic-bezier(0.16, 0.9, 0.24, 1); }

.rla-list { display: flex; flex-direction: column; gap: 7px; }
.rla-list-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: rgba(255, 236, 194, 0.08); border: 1.5px solid rgba(244, 189, 65, 0.45);
  border-radius: 11px; padding: 8px 10px;
}
.rla-list-row.self { border-color: #ffd859; background: rgba(244, 189, 65, 0.18); }
.rla-progress-bar { width: 100%; height: 7px; border-radius: 999px; background: rgba(0,0,0,0.45); overflow: hidden; margin-top: 4px; }
.rla-progress-fill { height: 100%; background: #f6c23e; border-radius: 999px; }
.rla-switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.rla-switch input { width: 20px; height: 20px; accent-color: #f4bd41; }

.rla-confetti { position: fixed; width: 9px; height: 14px; top: -16px; z-index: 300; pointer-events: none; border-radius: 2px; animation: rlaConfettiFall 2.4s linear forwards; }
@keyframes rlaConfettiFall { 0% { transform: translateY(0) rotate(0deg); opacity: 1; } 100% { transform: translateY(105dvh) rotate(680deg); opacity: 0.2; } }
.rla-toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  background: #7c1420; border: 2px solid var(--rla-gold);
  color: #fff6dc; font-weight: 800; font-size: 13px; padding: 9px 16px; border-radius: 999px;
  z-index: 350; box-shadow: 0 8px 24px rgba(0,0,0,0.65); pointer-events: none;
}
