

:root {
  --ludo-bg: #0b0e17;
  --ludo-surface: #121826;
  --ludo-panel: rgba(22, 29, 46, 0.75);
  --ludo-border: rgba(255, 255, 255, 0.09);
  
  --red-main: #ff334b;
  --red-grad: linear-gradient(135deg, #ff416c, #ff4b2b);
  --red-glow: rgba(255, 65, 108, 0.45);
  
  --green-main: #10b981;
  --green-grad: linear-gradient(135deg, #10b981, #059669);
  --green-glow: rgba(16, 185, 129, 0.45);
  
  --yellow-main: #f59e0b;
  --yellow-grad: linear-gradient(135deg, #f59e0b, #d97706);
  --yellow-glow: rgba(245, 158, 11, 0.45);
  
  --blue-main: #3b82f6;
  --blue-grad: linear-gradient(135deg, #3b82f6, #1d4ed8);
  --blue-glow: rgba(59, 130, 246, 0.45);
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body.ludo-body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
  background-color: var(--ludo-bg);
  font-family: var(--font-sans);
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.hidden {
  display: none !important;
}



.game-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.game-brand-title {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: var(--primary-accent);
}

.mp-live-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1px;
  padding: 2px 8px;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #34d399;
  border-radius: 20px;
}

.mp-dot {
  width: 6px;
  height: 6px;
  background: #10b981;
  border-radius: 50%;
  animation: pulse-dot 1.5s infinite;
}

@keyframes pulse-dot {
  0% { transform: scale(0.9); opacity: 0.6; box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1.1); opacity: 1; box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.9); opacity: 0.6; box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}


.header-center {
  display: flex;
  align-items: center;
}

.match-pill-content {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--ludo-border);
  border-radius: 20px;
  padding: 4px 12px;
}

.match-pill-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red-main);
  box-shadow: 0 0 8px currentColor;
  transition: background 0.3s ease;
}

.match-pill-text {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.match-pill-timer {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 800;
  color: var(--primary-accent);
}

.match-pill-timer.warning {
  color: #ff3b30 !important;
  animation: pulse-dot 0.8s infinite;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hud-pill-btn {
  background: rgba(242, 156, 17, 0.12);
  border: 1px solid rgba(242, 156, 17, 0.35);
  color: var(--primary-accent);
  border-radius: 14px;
  padding: 4px 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.hud-pill-btn:hover {
  background: var(--primary-accent);
  color: #121824;
}

.hud-icon-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--ludo-border);
  border-radius: 50%;
  color: var(--text-primary);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: var(--transition-smooth);
}

.hud-icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--primary-accent);
  color: var(--primary-accent);
}

.chat-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: #ff3b30;
  color: #ffffff;
  font-size: 9px;
  font-weight: 800;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--ludo-bg);
}


.ludo-stage {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 12px 10px 12px;
  position: relative;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
  overflow: visible;
}

.ludo-shell {
  position: relative !important;
  min-height: 600px;
  background: #070b17;
  display: flex;
  flex-direction: column;
}

.ludo-shell .game-header {
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.ludo-shell .game-intro-overlay {
  top: 54px;
  bottom: 0;
  left: 0;
  right: 0;
  border-radius: 0 0 22px 22px;
}

.ludo-shell.is-fullscreen .game-intro-overlay,
.ludo-shell:fullscreen .game-intro-overlay,
.ludo-shell.pseudo-fullscreen .game-intro-overlay {
  top: 54px !important;
  border-radius: 0 !important;
}

.ludo-shell .ludo-stage {
  flex: 1 0 auto;
}

.ludo-shell .game-instructions-bar {
  flex-shrink: 0;
  margin-top: auto;
}


.players-hud-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(94vw, calc(100dvh - 210px), 530px);
  gap: 8px;
  z-index: 10;
}

.players-hud-row.top-row {
  margin-bottom: 4px;
}

.players-hud-row.bottom-row {
  margin-top: 4px;
}


.player-station {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  max-width: 215px;
}

.player-station.station-red {
  justify-content: flex-start;
}

.player-station.station-green {
  justify-content: flex-end;
}

.player-station.station-blue {
  justify-content: flex-start;
}

.player-station.station-yellow {
  justify-content: flex-end;
}


.dice-box {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  background: rgba(18, 24, 38, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1.5px solid var(--ludo-border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.dice-box:hover {
  transform: scale(1.08);
  border-color: rgba(255, 255, 255, 0.3);
}

.dice-box.active-roll {
  animation: dice-turn-pulse 1.1s infinite alternate;
}

@keyframes dice-turn-pulse {
  0% {
    transform: scale(1);
    filter: drop-shadow(0 0 6px currentColor);
  }
  100% {
    transform: scale(1.14);
    filter: drop-shadow(0 0 16px currentColor);
  }
}

.dice-box.hud-red.active-roll {
  border-color: var(--red-main);
  box-shadow: 0 0 16px var(--red-glow);
  color: var(--red-main);
}

.dice-box.hud-green.active-roll {
  border-color: var(--green-main);
  box-shadow: 0 0 16px var(--green-glow);
  color: var(--green-main);
}

.dice-box.hud-yellow.active-roll {
  border-color: var(--yellow-main);
  box-shadow: 0 0 16px var(--yellow-glow);
  color: var(--yellow-main);
}

.dice-box.hud-blue.active-roll {
  border-color: var(--blue-main);
  box-shadow: 0 0 16px var(--blue-glow);
  color: var(--blue-main);
}

.dice-tap-hint {
  font-size: 7.5px;
  font-family: var(--font-mono);
  font-weight: 800;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  position: absolute;
  bottom: 1px;
}

.dice-box.active-roll .dice-tap-hint {
  color: var(--primary-accent);
  font-weight: 800;
}

.dice-box.inactive-player {
  opacity: 0.25;
  filter: grayscale(0.85);
  pointer-events: none;
}


.player-card {
  background: rgba(20, 26, 42, 0.7);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1.5px solid var(--ludo-border);
  border-radius: 12px;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.player-card.active-turn {
  transform: translateY(-1px);
  background: rgba(24, 32, 54, 0.9);
}

.player-card.hud-red.active-turn {
  border-color: var(--red-main);
  box-shadow: 0 0 14px var(--red-glow);
}

.player-card.hud-green.active-turn {
  border-color: var(--green-main);
  box-shadow: 0 0 14px var(--green-glow);
}

.player-card.hud-yellow.active-turn {
  border-color: var(--yellow-main);
  box-shadow: 0 0 14px var(--yellow-glow);
}

.player-card.hud-blue.active-turn {
  border-color: var(--blue-main);
  box-shadow: 0 0 14px var(--blue-glow);
}

.player-card.inactive-player {
  opacity: 0.25;
  filter: grayscale(0.85);
  pointer-events: none;
}

.player-avatar-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.player-avatar {
  font-size: 18px;
  line-height: 1;
}

.player-meta {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.player-name {
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-primary);
}

.player-progress {
  font-size: 9px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.player-status-tag {
  font-size: 8px;
  font-family: var(--font-mono);
  font-weight: 800;
  padding: 2px 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  text-transform: uppercase;
}

.player-card.active-turn .player-status-tag {
  background: var(--primary-accent);
  color: #121824;
}


.turn-countdown-widget {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: 80px;
}

.countdown-bar-track {
  width: 100%;
  height: 5px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
}

.countdown-bar-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #10b981, #f59e0b, #ef4444);
  border-radius: 3px;
  transition: width 1s linear;
}

.countdown-timer-text {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  color: var(--primary-accent);
}

.countdown-timer-text.warning {
  color: #ef4444 !important;
  animation: pulse-dot 0.8s infinite;
}


.reaction-center-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30;
}

.reaction-trigger-btn {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 50%;
  background: rgba(20, 26, 42, 0.85);
  border: 1px solid var(--ludo-border);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
  color: #ffffff;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.reaction-trigger-btn:hover, .reaction-trigger-btn:active {
  transform: scale(1.15);
  border-color: var(--primary-accent);
  background: rgba(242, 156, 17, 0.2);
}

.reaction-popover {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(14, 19, 32, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 24px;
  padding: 5px 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7), 0 0 14px rgba(242, 156, 17, 0.25);
  white-space: nowrap;
  animation: popover-slide-up 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 50;
}

.reaction-popover.hidden {
  display: none;
}

@keyframes popover-slide-up {
  from {
    opacity: 0;
    transform: translate(-50%, 8px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
}

.reaction-pill-btn {
  background: transparent;
  border: none;
  font-size: 18px;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.reaction-pill-btn:hover, .reaction-pill-btn:active {
  transform: scale(1.3) translateY(-2px);
  background: rgba(255, 255, 255, 0.12);
}


.board-arena {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin: 4px 0;
}

.board-container {
  width: min(94vw, calc(100dvh - 210px), 530px);
  height: min(94vw, calc(100dvh - 210px), 530px);
  aspect-ratio: 1 / 1;
  background: #0d111d;
  border-radius: 16px;
  border: 5px solid #1a2238;
  box-shadow: 
    0 16px 48px rgba(0, 0, 0, 0.75),
    inset 0 0 25px rgba(0, 0, 0, 0.9),
    0 0 0 1px rgba(255, 255, 255, 0.08);
  display: grid;
  grid-template-columns: repeat(15, 1fr);
  grid-template-rows: repeat(15, 1fr);
  position: relative;
  overflow: hidden;
}


.yard {
  grid-row: span 6;
  grid-column: span 6;
  padding: 6%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.yard.red {
  background: var(--red-grad);
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.4);
}

.yard.green {
  background: var(--green-grad);
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.4);
}

.yard.yellow {
  background: var(--yellow-grad);
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.4);
}

.yard.blue {
  background: var(--blue-grad);
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.4);
}


.yard-inner {
  width: 78%;
  height: 78%;
  background: rgba(13, 17, 29, 0.88);
  backdrop-filter: blur(8px);
  border-radius: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 14%;
  padding: 14%;
  box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.token-nest {
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.6);
  border: 1.5px dashed rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}


.scene-mini {
  width: 32px;
  height: 32px;
  perspective: 200px;
}

.cube-mini {
  width: 32px;
  height: 32px;
  position: relative;
  transform-style: preserve-3d;
  transform: rotateX(-22deg) rotateY(-45deg);
  transition: transform 1.2s cubic-bezier(0.2, 0.8, 0.3, 1);
}

.cube-mini-face {
  position: absolute;
  width: 32px;
  height: 32px;
  background: radial-gradient(circle, #ffffff 0%, #ebebeb 85%, #d4d4d4 100%);
  border: 1px solid #b5b5b5;
  border-radius: 6px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  padding: 3px;
  box-shadow: inset 0 0 3px rgba(0, 0, 0, 0.15);
}

.dot-mini {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #181818;
  align-self: center;
  justify-self: center;
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.7);
}

.face-1-m { transform: rotateY(0deg) translateZ(16px); }
.face-6-m { transform: rotateX(180deg) translateZ(16px); }
.face-2-m { transform: rotateY(90deg) translateZ(16px); }
.face-5-m { transform: rotateY(-90deg) translateZ(16px); }
.face-3-m { transform: rotateX(90deg) translateZ(16px); }
.face-4-m { transform: rotateX(-90deg) translateZ(16px); }

.face-1-m .dot-mini { grid-area: 2 / 2; }
.face-2-m .dot-mini:nth-child(1) { grid-area: 1 / 1; }
.face-2-m .dot-mini:nth-child(2) { grid-area: 3 / 3; }
.face-3-m .dot-mini:nth-child(1) { grid-area: 1 / 1; }
.face-3-m .dot-mini:nth-child(2) { grid-area: 2 / 2; }
.face-3-m .dot-mini:nth-child(3) { grid-area: 3 / 3; }
.face-4-m .dot-mini:nth-child(1) { grid-area: 1 / 1; }
.face-4-m .dot-mini:nth-child(2) { grid-area: 1 / 3; }
.face-4-m .dot-mini:nth-child(3) { grid-area: 3 / 1; }
.face-4-m .dot-mini:nth-child(4) { grid-area: 3 / 3; }
.face-5-m .dot-mini:nth-child(1) { grid-area: 1 / 1; }
.face-5-m .dot-mini:nth-child(2) { grid-area: 1 / 3; }
.face-5-m .dot-mini:nth-child(3) { grid-area: 2 / 2; }
.face-5-m .dot-mini:nth-child(4) { grid-area: 3 / 1; }
.face-5-m .dot-mini:nth-child(5) { grid-area: 3 / 3; }
.face-6-m .dot-mini:nth-child(1) { grid-area: 1 / 1; }
.face-6-m .dot-mini:nth-child(2) { grid-area: 1 / 3; }
.face-6-m .dot-mini:nth-child(3) { grid-area: 2 / 1; }
.face-6-m .dot-mini:nth-child(4) { grid-area: 2 / 3; }
.face-6-m .dot-mini:nth-child(5) { grid-area: 3 / 1; }
.face-6-m .dot-mini:nth-child(6) { grid-area: 3 / 3; }

.cube-mini.rolling {
  animation: spin-tumble-dice 0.9s cubic-bezier(0.2, 0.8, 0.3, 1.1);
}

@keyframes spin-tumble-dice {
  0% { transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg); }
  35% { transform: rotateX(360deg) rotateY(180deg) rotateZ(90deg); }
  70% { transform: rotateX(720deg) rotateY(540deg) rotateZ(270deg); }
  100% { transform: rotateX(1080deg) rotateY(1080deg) rotateZ(540deg); }
}


.cell {
  border: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: rgba(18, 24, 38, 0.35);
  border-radius: 2px;
}

.cell.red-start {
  background: var(--red-grad) !important;
  color: #fff;
}
.cell.red-start::after {
  content: '▼';
  font-size: 10px;
  opacity: 0.85;
  color: #fff;
}

.cell.green-start {
  background: var(--green-grad) !important;
  color: #fff;
}
.cell.green-start::after {
  content: '◄';
  font-size: 10px;
  opacity: 0.85;
  color: #fff;
}

.cell.yellow-start {
  background: var(--yellow-grad) !important;
  color: #fff;
}
.cell.yellow-start::after {
  content: '▲';
  font-size: 10px;
  opacity: 0.85;
  color: #fff;
}

.cell.blue-start {
  background: var(--blue-grad) !important;
  color: #fff;
}
.cell.blue-start::after {
  content: '►';
  font-size: 10px;
  opacity: 0.85;
  color: #fff;
}

.cell.red-home {
  background: rgba(255, 65, 108, 0.35) !important;
  border-color: rgba(255, 65, 108, 0.5);
}

.cell.green-home {
  background: rgba(16, 185, 129, 0.35) !important;
  border-color: rgba(16, 185, 129, 0.5);
}

.cell.yellow-home {
  background: rgba(245, 158, 11, 0.35) !important;
  border-color: rgba(245, 158, 11, 0.5);
}

.cell.blue-home {
  background: rgba(59, 130, 246, 0.35) !important;
  border-color: rgba(59, 130, 246, 0.5);
}

.cell.safe-zone::before {
  content: '★';
  font-size: 14px;
  color: #fbbf24;
  text-shadow: 0 0 6px rgba(251, 191, 36, 0.8);
  position: absolute;
  pointer-events: none;
  z-index: 1;
}

.center-home {
  grid-row: 7 / 10;
  grid-column: 7 / 10;
  position: relative;
  background: radial-gradient(circle, #1a2236 0%, #0d111d 90%);
  border: 1.5px solid var(--ludo-border);
  box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.center-home::before {
  content: '🏆';
  font-size: 22px;
  position: absolute;
  z-index: 2;
  filter: drop-shadow(0 2px 6px rgba(245, 158, 11, 0.6));
}


.stack-container {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.token {
  width: 82%;
  height: 82%;
  border-radius: 50%;
  position: relative;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  border: 2px solid rgba(255, 255, 255, 0.85);
  box-shadow: 
    0 3px 6px rgba(0, 0, 0, 0.6),
    inset 0 -3px 4px rgba(0, 0, 0, 0.4),
    inset 0 3px 4px rgba(255, 255, 255, 0.6);
  z-index: 5;
}

.token.red {
  background: radial-gradient(circle at 35% 35%, #ff6b8b 0%, #ff334b 60%, #990f23 100%);
  color: #ff334b;
}

.token.green {
  background: radial-gradient(circle at 35% 35%, #34d399 0%, #10b981 60%, #064e3b 100%);
  color: #10b981;
}

.token.yellow {
  background: radial-gradient(circle at 35% 35%, #fde047 0%, #f59e0b 60%, #78350f 100%);
  color: #f59e0b;
}

.token.blue {
  background: radial-gradient(circle at 35% 35%, #60a5fa 0%, #3b82f6 60%, #1e3a8a 100%);
  color: #3b82f6;
}

.token.movable {
  cursor: pointer;
  z-index: 25;
  animation: token-hop 0.65s ease-in-out infinite alternate;
}

@keyframes token-hop {
  0% {
    transform: translateY(0) scale(1);
    box-shadow: 
      0 3px 6px rgba(0, 0, 0, 0.6),
      0 0 0 0 currentColor;
  }
  100% {
    transform: translateY(-8px) scale(1.18);
    box-shadow: 
      0 10px 18px rgba(0, 0, 0, 0.5),
      0 0 14px currentColor;
  }
}

.stack-container.size-2 .token { width: 68%; height: 68%; }
.stack-container.size-2 .token:nth-child(1) { transform: translate(-20%, -20%); }
.stack-container.size-2 .token:nth-child(2) { transform: translate(20%, 20%); }

.stack-container.size-3 .token, .stack-container.size-4 .token { width: 56%; height: 56%; }
.stack-container.size-4 .token:nth-child(1) { transform: translate(-25%, -25%); }
.stack-container.size-4 .token:nth-child(2) { transform: translate(25%, -25%); }
.stack-container.size-4 .token:nth-child(3) { transform: translate(-25%, 25%); }
.stack-container.size-4 .token:nth-child(4) { transform: translate(25%, 25%); }


.mobile-action-dock {
  display: flex;
  align-items: center;
  justify-content: space-around;
  width: min(94vw, calc(100dvh - 210px), 530px);
  background: rgba(18, 24, 38, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--ludo-border);
  border-radius: 14px;
  padding: 6px 12px;
  margin-top: 4px;
}

.dock-btn {
  background: transparent;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--text-muted);
  cursor: pointer;
  position: relative;
  padding: 4px 10px;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.dock-btn:hover, .dock-btn:active {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.dock-icon { font-size: 16px; line-height: 1; }
.dock-label { font-size: 10px; font-family: var(--font-mono); font-weight: 700; letter-spacing: 0.5px; }

.dock-badge {
  position: absolute;
  top: 0;
  right: 6px;
  background: #ff3b30;
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dock-btn-quit { color: #ff4b4b !important; }


.sheet-drawer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1000;
  pointer-events: none;
  visibility: hidden;
  transition: visibility 0.3s ease;
}

.sheet-drawer.open {
  pointer-events: auto;
  visibility: visible;
}

.sheet-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sheet-drawer.open .sheet-backdrop { opacity: 1; }

.sheet-panel {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translate(-50%, 100%);
  width: 100%;
  max-width: 480px;
  background: rgba(18, 24, 38, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--ludo-border);
  border-bottom: none;
  border-radius: 20px 20px 0 0;
  padding: 12px 16px 24px 16px;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  max-height: 75vh;
}

.sheet-drawer.open .sheet-panel { transform: translate(-50%, 0); }

.sheet-handle {
  width: 36px;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
  align-self: center;
  margin-bottom: 10px;
}

.sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--ludo-border);
}

.sheet-title-row { display: flex; align-items: center; gap: 8px; }
.sheet-icon { font-size: 16px; }
.sheet-title { font-family: var(--font-mono); font-size: 13px; font-weight: 800; letter-spacing: 1px; color: var(--primary-accent); }
.sheet-close-btn { background: transparent; border: none; color: var(--text-muted); cursor: pointer; font-size: 16px; padding: 4px; }
.sheet-action-link { background: transparent; border: none; color: var(--text-muted); font-size: 11px; font-family: var(--font-mono); cursor: pointer; }
.sheet-action-link:hover { color: var(--primary-accent); }

.chat-preset-chips { display: flex; gap: 6px; padding: 8px 0; overflow-x: auto; scrollbar-width: none; }
.chat-preset-chips::-webkit-scrollbar { display: none; }

.chip-pill {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--ludo-border);
  border-radius: 14px;
  padding: 4px 10px;
  font-size: 11px;
  color: var(--text-primary);
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chip-pill:hover { background: rgba(255, 255, 255, 0.12); border-color: var(--primary-accent); }

.chat-stream, .log-stream {
  height: 240px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 0;
  font-size: 12px;
}

.chat-msg {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.chat-msg.system {
  background: rgba(242, 156, 17, 0.08);
  border-color: rgba(242, 156, 17, 0.2);
  color: var(--primary-accent);
  font-size: 11px;
}

.chat-msg-header { display: flex; justify-content: space-between; align-items: center; }
.chat-sender { font-weight: 700; font-size: 11px; }
.chat-time { font-size: 9px; color: var(--text-muted); font-family: var(--font-mono); }
.chat-msg-body { color: var(--text-primary); word-break: break-word; }

.chat-input-bar {
  display: flex;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--ludo-border);
}

.chat-input-bar input {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--ludo-border);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13px;
}

.chat-input-bar input:focus { outline: none; border-color: var(--primary-accent); }
.chat-input-bar button {
  background: var(--primary-accent);
  border: none;
  border-radius: 8px;
  color: #121824;
  padding: 0 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.log-entry {
  padding-bottom: 4px;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.05);
  font-family: var(--font-mono);
  font-size: 11px;
}
.log-entry.system { color: var(--primary-accent); }
.log-entry.red { color: #ff3b30; }
.log-entry.green { color: #10b981; }
.log-entry.yellow { color: #f59e0b; }
.log-entry.blue { color: #3b82f6; }


.reaction-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 1000;
  overflow: hidden;
}

.reaction-bubble {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(18, 24, 38, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--ludo-border);
  padding: 6px 14px;
  border-radius: 20px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  font-family: var(--font-sans);
  pointer-events: none;
  animation: float-up-burst 2.6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.reaction-bubble .sender { font-size: 11px; font-weight: 700; }
.reaction-bubble .emoji { font-size: 24px; line-height: 1; }

@keyframes float-up-burst {
  0% { opacity: 0; transform: translateY(20px) scale(0.6) rotate(-5deg); }
  15% { opacity: 1; transform: translateY(0px) scale(1.15) rotate(3deg); }
  30% { transform: translateY(-15px) scale(1) rotate(-2deg); }
  80% { opacity: 0.95; transform: translateY(-100px) scale(1) rotate(0deg); }
  100% { opacity: 0; transform: translateY(-160px) scale(0.8); }
}

.toast-container {
  position: fixed;
  top: 60px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1100;
  pointer-events: none;
}

.toast-msg {
  background: rgba(18, 24, 38, 0.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--primary-accent);
  color: var(--text-primary);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toast-in 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes toast-in {
  from { transform: translateX(40px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}


.ludo-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(8, 11, 19, 0.85);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 16px;
}

.overlay-panel {
  background: rgba(18, 24, 38, 0.94);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--ludo-border);
  border-radius: 20px;
  padding: 24px;
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-header { text-align: center; }

.modal-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: var(--primary-accent);
  background: rgba(242, 156, 17, 0.12);
  border: 1px solid rgba(242, 156, 17, 0.3);
  padding: 2px 10px;
  border-radius: 12px;
  margin-bottom: 6px;
}

.overlay-title {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 2px;
  margin: 0 0 6px 0;
  color: #fff;
}

.overlay-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
}

.setup-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.setup-label {
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.mode-tabs-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.mode-tab-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--ludo-border);
  border-radius: 10px;
  padding: 10px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-muted);
}

.mode-tab-btn .tab-icon { font-size: 20px; }
.mode-tab-btn .tab-name { font-size: 11px; font-weight: 700; font-family: var(--font-sans); }

.mode-tab-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.mode-tab-btn.active {
  background: rgba(242, 156, 17, 0.15);
  border-color: var(--primary-accent);
  color: var(--primary-accent);
  box-shadow: 0 0 12px rgba(242, 156, 17, 0.25);
}

.players-count-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.count-pill-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--ludo-border);
  border-radius: 10px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.count-num { font-size: 16px; font-weight: 800; font-family: var(--font-mono); color: var(--text-primary); }
.count-desc { font-size: 9px; color: var(--text-muted); text-align: center; }

.count-pill-btn.active {
  background: var(--primary-accent);
  border-color: var(--primary-accent);
}
.count-pill-btn.active .count-num,
.count-pill-btn.active .count-desc {
  color: #121824;
  font-weight: 800;
}

.online-lobby-box {
  border-top: 1px solid var(--ludo-border);
  padding-top: 14px;
}

.lobby-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--ludo-border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13px;
}
.lobby-input:focus { outline: none; border-color: var(--primary-accent); }

.code-input {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 16px;
  letter-spacing: 2px;
}

.lobby-subtabs {
  display: flex;
  gap: 8px;
  margin: 10px 0;
}

.subtab-btn {
  flex: 1;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--ludo-border);
  border-radius: 6px;
  padding: 6px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.subtab-btn.active {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  border-color: var(--primary-accent);
}

.private-actions-row {
  display: flex;
  gap: 8px;
}

.join-input-wrap {
  display: flex;
  gap: 6px;
  flex: 1.3;
}

.setup-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--ludo-border);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text-primary);
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 13px;
}
.setup-btn:hover { background: rgba(255, 255, 255, 0.1); border-color: var(--primary-accent); }

.btn-highlight {
  background: rgba(242, 156, 17, 0.15) !important;
  border-color: var(--primary-accent) !important;
  color: var(--primary-accent) !important;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.waiting-room-card {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--ludo-border);
  border-radius: 12px;
  padding: 14px;
  margin-top: 10px;
}

.room-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.code-and-copy {
  display: flex;
  align-items: center;
  gap: 8px;
}

.room-code-display {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--primary-accent);
}

.copy-btn {
  background: rgba(242, 156, 17, 0.12);
  border: 1px solid rgba(242, 156, 17, 0.35);
  border-radius: 6px;
  padding: 4px 10px;
  color: var(--primary-accent);
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.copy-btn:hover { background: var(--primary-accent); color: #121824; }

.status-badge {
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 4px;
}
.status-badge.connected {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.color-slots-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.color-slot-btn {
  border-radius: 8px;
  padding: 8px 10px;
  text-align: left;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: all 0.2s ease;
}

.slot-color-tag { font-size: 10px; font-weight: 800; font-family: var(--font-mono); }
.slot-occupant { font-size: 11px; color: var(--text-primary); margin-top: 3px; }

.red-slot { background: rgba(255, 65, 108, 0.1); border: 1px solid rgba(255, 65, 108, 0.3); color: #ff416c; }
.green-slot { background: rgba(16, 185, 129, 0.1); border: 1px solid rgba(16, 185, 129, 0.3); color: #10b981; }
.yellow-slot { background: rgba(245, 158, 11, 0.1); border: 1px solid rgba(245, 158, 11, 0.3); color: #f59e0b; }
.blue-slot { background: rgba(59, 130, 246, 0.1); border: 1px solid rgba(59, 130, 246, 0.3); color: #3b82f6; }

.color-slot-btn.selected { border-width: 2px !important; box-shadow: 0 0 12px currentColor; }
.color-slot-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.lobby-waiting-msg { font-size: 11px; color: var(--text-muted); text-align: center; font-style: italic; margin-top: 6px; }

.action-btn.overlay-btn {
  background: linear-gradient(135deg, var(--primary-accent), #d97706);
  color: #121824;
  border: none;
  border-radius: 10px;
  padding: 13px;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  width: 100%;
  box-shadow: 0 4px 15px rgba(242, 156, 17, 0.25);
  transition: all 0.2s ease;
}

.action-btn.overlay-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(242, 156, 17, 0.35);
}

.public-rooms-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.refresh-rooms-btn {
  background: transparent;
  border: none;
  color: var(--primary-accent);
  font-size: 11px;
  font-family: var(--font-mono);
  cursor: pointer;
}

.public-rooms-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 140px;
  overflow-y: auto;
}

.room-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--ludo-border);
  border-radius: 8px;
  padding: 8px 12px;
}

.room-item-host { font-size: 12px; font-weight: 700; }
.room-item-meta { font-size: 10px; color: var(--text-muted); font-family: var(--font-mono); }
.empty-rooms-msg { font-size: 11px; color: var(--text-muted); text-align: center; padding: 14px; }


.victory-panel { text-align: center; max-width: 420px; }
.victory-trophy { font-size: 52px; margin-bottom: 4px; animation: bounce 1s infinite alternate cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.victory-buttons-row { display: flex; gap: 10px; margin-top: 14px; }




@media (max-width: 480px) {
  .game-brand-title { font-size: 14px; }
  
  .players-hud-row {
    gap: 4px;
    width: min(96vw, calc(100dvh - 190px), 440px);
  }

  .player-station {
    gap: 5px;
    max-width: 165px;
  }

  .dice-box {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    border-radius: 10px;
  }
  .scene-mini, .cube-mini, .cube-mini-face {
    width: 28px;
    height: 28px;
  }
  .dot-mini {
    width: 4px;
    height: 4px;
  }
  .face-1-m { transform: rotateY(0deg) translateZ(14px); }
  .face-6-m { transform: rotateX(180deg) translateZ(14px); }
  .face-2-m { transform: rotateY(90deg) translateZ(14px); }
  .face-5-m { transform: rotateY(-90deg) translateZ(14px); }
  .face-3-m { transform: rotateX(90deg) translateZ(14px); }
  .face-4-m { transform: rotateX(-90deg) translateZ(14px); }

  .player-card {
    padding: 3px 6px;
    gap: 5px;
    border-radius: 10px;
  }
  .player-avatar { font-size: 15px; }
  .player-name {
    font-size: 11px;
    font-weight: 700;
    max-width: 90px;
  }
  .player-progress { font-size: 8px; }
  .player-status-tag { display: none !important; }
  .reaction-trigger-btn {
    width: 32px;
    height: 32px;
    min-width: 32px;
    font-size: 15px;
  }
  .match-pill-text { display: none; }
}


@media (min-height: 700px) and (min-width: 768px) {
  .ludo-stage { padding: 12px 20px; }
  .players-hud-row { width: min(90vw, calc(100dvh - 210px), 560px); }
  .board-container {
    width: min(90vw, calc(100dvh - 210px), 560px);
    height: min(90vw, calc(100dvh - 210px), 560px);
  }
  .player-station { max-width: 240px; }
  .player-card { padding: 8px 12px; }
  .player-name { font-size: 12px; }
  .player-progress { font-size: 10px; }
}


@media (min-width: 1024px) {
  .sheet-panel {
    border-radius: 20px;
    margin-bottom: 24px;
  }
}


.dice-box,
.player-card,
.token,
.cell {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

body.ludo-body.game-scroll-locked {
  overscroll-behavior: contain !important;
}

.ludo-roll-queue{position:absolute;z-index:30;display:flex;align-items:center;justify-content:center;gap:5px;max-width:35%;padding:5px 8px;border:1px solid #fff6;border-radius:12px;background:#11182bdb;box-shadow:0 3px 16px #0009;pointer-events:none;top:2%;left:10%;transform:translateX(-50%)}
.ludo-roll-queue[hidden]{display:none!important}
.ludo-roll-queue[data-color=red]{left:20%;top:2%}.ludo-roll-queue[data-color=green]{left:80%;top:2%}.ludo-roll-queue[data-color=yellow]{left:80%;top:90%}.ludo-roll-queue[data-color=blue]{left:20%;top:90%}
.ludo-queued-die{display:grid;place-items:center;min-width:27px;height:27px;border-radius:7px;background:#f5f5ef;color:#192033;font-size:17px;font-weight:900;box-shadow:inset 0 -3px 0 #b5b5b5}
.ludo-queued-die.current{outline:2px solid #ffbd42;box-shadow:0 0 13px #ffbd4299}
@media(max-width:520px){.ludo-roll-queue{gap:3px;padding:3px 5px}.ludo-queued-die{min-width:20px;height:20px;font-size:12px}}
