/* Video Interface Styles - Light Theme */

/* Backdrop container - full screen behind all content */
.backdrop-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  z-index: -1; /* Behind all content */
  pointer-events: none;
  background: transparent; /* Transparent - let backdrops handle visuals */
}

/* Subtle frosted glass overlay on top of backdrops */
.backdrop-container::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 1;
  pointer-events: none;
}

.backdrop-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transition: opacity 1000ms ease-in-out;
  will-change: opacity;
  transform: translateZ(0);
  backface-visibility: hidden;
}

/* Scoped CSS reset for video interface only */
.video-container * {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

/* Preserve character sheet styling */
.character-container * {
  box-sizing: border-box; /* Keep this for proper sizing */
}

/* Override body centering for video interface */
body.video-mode {
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  padding: 0;
  margin: 0;
  height: 100vh;
  overflow: hidden;
  background: #f8f9fa;
}

body.video-mode .app {
  max-width: none;
  width: 100%;
  height: 100vh;
  margin: 0;
  padding: 0;
}

/* Main split-screen container */
.main-container {
  display: flex;
  width: 100%;
  height: 100vh;
  margin: 0;
  padding: 0;
  gap: 0; /* Remove gap between sheet and video */
}

/* Character sheet container - fixed left side */
.character-container {
  flex: 0 0 400px;
  height: 100vh;
  overflow-y: auto;
  background: rgba(41, 145, 222, 0.65);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-sizing: border-box;
  margin: 0;
  padding: 20px;
  padding-bottom: 90px; /* Space for fixed video controls at bottom */
  position: relative;
  z-index: auto; /* Don't create stacking context */
  border-right: 1px solid rgba(255, 255, 255, 0.8); /* White border on right */
}

/* Ensure character container maintains scrolling during screen sharing */
.video-container.screen-sharing-mode ~ .character-container,
.main-container .character-container {
  overflow-y: auto !important;
  height: 100vh !important;
  position: relative !important;
  z-index: 10 !important; /* Higher than screen sharing overlays */
  pointer-events: auto !important;
}

/* Ensure character sheet content remains interactive */
.character-container * {
  pointer-events: auto;
}

/* Make sure screen sharing overlays don't block character container interactions */
.screen-sharing-main,
.screen-sharing-participants {
  pointer-events: auto;
}

/* Prevent screen sharing backgrounds from interfering with character container */
.video-container.screen-sharing-mode .character-container {
  isolation: isolate;
}

/* Video container - takes remaining space */
.video-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: transparent; /* Remove default background so generated backdrop shows */
  position: relative;
  margin: 0;
  padding: 0;
  border: none;
  border-left: none;
}

/* Remove the blurred backdrop pseudo-elements - BackdropManager handles this */
/* These are commented out so generated backdrops from QuestAI can show through
.video-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0 !important;
  right: 0;
  bottom: 0;
  background: url('../assets/smallername.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  filter: blur(100px);
  z-index: -1;
}

.video-container::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0 !important;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(50px);
  z-index: 0;
}
*/

/* Facilitator full-screen mode */
.video-container.facilitator-mode {
  width: 100%;
  height: 100vh;
  isolation: isolate; /* contain blending/compositing to the facilitator container */
}

/* Force permanent layer promotion for facilitator tiles/grid */
.video-container.facilitator-mode,
.video-container.facilitator-mode .participants-grid,
.video-container.facilitator-mode .participant,
.video-container.facilitator-mode .participant video {
  will-change: transform, opacity;
  transform: translateZ(0);
  backface-visibility: hidden;
  contain: paint;
}

/* Reduce paint-heavy effects that destabilize layers in facilitator mode */
.video-container.facilitator-mode .participant {
  box-shadow: none;
}
.video-container.facilitator-mode .participant:hover {
  transform: none;       /* no hover-scale: prevents re-rasterization */
  box-shadow: none;      /* keep hover cheap */
  border-color: #4a9eff; /* still provide a hover affordance */
}

/* Disable heavy blur layers for facilitator or when explicitly requested */
.video-container.no-blur {
  background: transparent;
}
.video-container.no-blur::before,
.video-container.no-blur::after {
  display: none !important;
}

/* Screen sharing mode styles */
.video-container.screen-sharing-mode {
  position: relative;
}

.screen-sharing-main {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: url('../assets/smallername.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  position: relative;
  z-index: 5; /* Lower than character container */
  pointer-events: auto;
}

.screen-sharing-main::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('../assets/smallername.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  filter: blur(100px);
  z-index: -1;
}

/* Overlay participants on screen share */
.screen-sharing-participants {
  position: absolute;
  top: 20px;
  bottom: 100px;
  right: 20px;
  width: 280px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 6; /* Lower than character container */
  pointer-events: auto;
}

.screen-sharing-participants::-webkit-scrollbar {
  width: 6px;
}

.screen-sharing-participants::-webkit-scrollbar-track {
  background: transparent;
}

.screen-sharing-participants::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.3);
  border-radius: 3px;
}

.screen-sharing-participants::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.5);
}

.screen-sharing-participant {
  aspect-ratio: 16/9;
  background: #111;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid rgba(255,255,255,0.3);
  transition: all 0.3s ease;
  position: relative;
  min-height: 100px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  flex-shrink: 0;
}

.screen-sharing-participant:hover {
  border-color: #4a9eff;
  transform: scale(1.02);
}

.screen-sharing-participant.local {
  border-color: #28a745;
}

.screen-sharing-participant video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.screen-sharing-participant.local video {
  transform: scaleX(-1);
}

.screen-sharing-participant .participant-name {
  position: absolute;
  bottom: 4px;
  left: 4px;
  right: 4px;
  background: rgba(0, 0, 0, 0.85);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Portrait overlay for screen sharing participants */
.screen-sharing-participant .participant-portrait {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 40px;
  height: 40px;
  z-index: 5;
  pointer-events: none;
}

.screen-sharing-participant .participant-portrait-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px solid #2991de;
  object-fit: cover;
  background: #6cace4;
}

.screen-share-video {
  flex: 1;
  display: flex;
  align-items: center;
  flex-direction: column; /* vertical stack so justify-content controls bottom alignment */
  justify-content: center;
  position: relative;
  z-index: 5;
  background: transparent;
}

.screen-share-video video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  z-index: 6;
}

/* Improve GPU stability to mitigate artifacts */
.participant video,
.screen-share-video video {
  will-change: transform;
  transform: translateZ(0);
  backface-visibility: hidden;
}

/* Ensure proper z-index layering for screen sharing */
.screen-sharing-mode .screen-share-video {
  z-index: 5;
}

.screen-sharing-mode .screen-sharing-participants {
  z-index: 6;
}

/* Character container should always be on top for interactions */
.main-container .character-container {
  z-index: 10 !important;
  isolation: isolate;
}

/* Video header - Hidden to remove gray bar */
.video-header {
  display: none;
}

.room-info {
  display: flex;
  align-items: center;
  gap: 20px;
}

.room-code {
  font-size: 14px;
  font-weight: 600;
  color: #495057;
  background: #e9ecef;
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid #ced4da;
}

/* Hide connection status bar and video-specific gray elements only */
.video-container .connection-status,
.video-container .room-header,
.video-container .header-bar,
.video-container .status-bar,
.video-container .video-status,
.video-container .room-status,
.video-container .livekit-header,
.video-container .top-bar,
.video-container .navigation-bar,
.video-container .toolbar,
.video-container .menu-bar,
.video-container .title-bar,
.video-container .nav-bar,
.video-container .breadcrumb {
  display: none !important;
}

/* CRITICAL: Hide old dice-controls-container (bottom-right UI from non-video mode) */
body.video-mode #dice-controls-container {
  display: none !important;
  position: static !important;
  pointer-events: none !important;
}

/* Hide old timer display SVG circles in character sheet during video mode */
body.video-mode #timer-display {
  display: none !important;
}

/* Remove all gray backgrounds and elements */
/* Make body transparent so BackdropManager's backdrop shows through */
body.video-mode {
  background: transparent !important;
}

/* Force hide any remaining gray bars - but not in character sheet */
.video-container div[style*="background: #"], 
.video-container div[style*="background-color: #"],
.video-container .bg-gray,
.video-container .gray-bar,
.video-container .gray-header,
.video-container .gray-menu,
.bg-gray:not(.character-container *),
.gray-bar:not(.character-container *),
.gray-header:not(.character-container *),
.gray-menu:not(.character-container *) {
  display: none !important;
}

/* Dice and timer backdrop at top */
.dice-and-timer-container {
  position: fixed;
  top: 0;
  left: 400px; /* Start after character container */
  right: 0;
  height: 10vh; /* 10% of viewport height */
  min-height: 60px; /* Minimum for usability */
  max-height: 100px; /* Maximum to prevent oversizing */
  background: rgba(41, 145, 222, 0.65); /* Blue with transparency */
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.8); /* White border on bottom */
  z-index: 50; /* Same level as bottom backdrop */
  pointer-events: auto; /* Allow interaction with dice */
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 15px;
}

/* For facilitators, dice bar spans full width from left edge */
.video-container.facilitator-mode .dice-and-timer-container {
  left: 0 !important;
}

/* Dice area - flexes to fill available space on left */
.dice-area {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-start;
  height: 100%;
  padding: 5px 0;
  min-width: 0; /* Allow flexbox to shrink below content size */
}

/* Timer area - fixed width, stays on right */
.timer-area {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-end;
  justify-content: center;
  height: 100%;
  padding-right: 10px;
  position: relative; /* For absolute positioning of button */
}

/* Individual dice slot - transparent with white outline */
/* AI-managed: no click interactions */
.dice-slot {
  position: relative;
  background: transparent;
  border: 2px solid rgba(255, 255, 255, 0.8);
  border-radius: 6px;
  cursor: default !important; /* Changed from pointer - AI controls dice */
  pointer-events: none; /* Disable all interactions */
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-sizing: border-box;
}

/* Responsive dice sizing based on difficulty */
.dice-area[data-difficulty="1"] .dice-slot,
.dice-area[data-difficulty="2"] .dice-slot {
  width: 45px;
  height: 45px;
}

.dice-area[data-difficulty="3"] .dice-slot,
.dice-area[data-difficulty="4"] .dice-slot,
.dice-area[data-difficulty="5"] .dice-slot {
  width: 40px;
  height: 40px;
}

.dice-area[data-difficulty="6"] .dice-slot,
.dice-area[data-difficulty="7"] .dice-slot,
.dice-area[data-difficulty="8"] .dice-slot {
  width: 35px;
  height: 35px;
}

.dice-area[data-difficulty="9"] .dice-slot,
.dice-area[data-difficulty="10"] .dice-slot,
.dice-area[data-difficulty="11"] .dice-slot,
.dice-area[data-difficulty="12"] .dice-slot {
  width: 32px;
  height: 32px;
}

.dice-area[data-difficulty="13"] .dice-slot,
.dice-area[data-difficulty="14"] .dice-slot,
.dice-area[data-difficulty="15"] .dice-slot {
  width: 28px;
  height: 28px;
}

.dice-area[data-difficulty="16"] .dice-slot,
.dice-area[data-difficulty="17"] .dice-slot,
.dice-area[data-difficulty="18"] .dice-slot,
.dice-area[data-difficulty="19"] .dice-slot,
.dice-area[data-difficulty="20"] .dice-slot {
  width: 25px;
  height: 25px;
}

/* Dice slot hover effect */
/* REMOVED: Hover state - dice slots are now AI-managed and non-interactive */
.dice-slot:hover {
  /* No hover effects - AI controls dice commitment */
}

/* Claimed dice slot */
.dice-slot.claimed {
  border-color: #28a745;
  background: rgba(40, 167, 69, 0.2);
  cursor: default;
}

/* Player portrait image in dice */
.dice-player-portrait {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 4px;
  user-select: none;
  pointer-events: none;
}

/* Player avatar/initial in dice (fallback when no portrait) */
.dice-player-indicator {
  font-size: 12px;
  font-weight: 700;
  color: white;
  text-align: center;
  user-select: none;
  pointer-events: none;
}

/* Dice value display (after roll) */
.dice-value {
  font-size: 18px;
  font-weight: 800;
  color: white;
  text-align: center;
  user-select: none;
  pointer-events: none;
}

/* Dice rolling animation */
.dice-slot.rolling {
  animation: diceRoll 0.5s ease-in-out infinite;
  background: rgba(255, 255, 255, 0.3);
}

@keyframes diceRoll {
  0%, 100% { transform: rotate(0deg) scale(1); }
  25% { transform: rotate(90deg) scale(1.1); }
  50% { transform: rotate(180deg) scale(1); }
  75% { transform: rotate(270deg) scale(1.1); }
}

@keyframes dicePop {
  0% { transform: scale(1); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

/* Dice result states */
.dice-slot.result-6 {
  background: rgba(40, 167, 69, 0.4);
  border-color: #28a745;
  box-shadow: 0 0 10px rgba(40, 167, 69, 0.6);
}

.dice-slot.result-1 {
  background: rgba(220, 53, 69, 0.4);
  border-color: #dc3545;
  box-shadow: 0 0 10px rgba(220, 53, 69, 0.6);
}

.dice-slot.result-4,
.dice-slot.result-5 {
  background: rgba(255, 193, 7, 0.3);
  border-color: #ffc107;
}

.dice-slot.result-2,
.dice-slot.result-3 {
  background: rgba(255, 152, 0, 0.3);
  border-color: #ff9800;
}

/* Timer with SVG Progress Ring */
.timer-with-ring {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
}

.timer-ring {
  position: absolute;
  top: 0;
  left: 0;
  width: 80px;
  height: 80px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.timer-content {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  z-index: 1;
}

.timer-label {
  font-size: 10px;
  font-weight: 600;
  color: white;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.9;
  margin-bottom: 2px;
}

.timer-value {
  font-size: 18px;
  font-weight: 800;
  color: white;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  line-height: 1;
}

/* Timer warning and danger state animations - Applied to container AND SVG ring */
.timer-with-ring.timer-warning {
  animation: timer-scale-warning 2s ease-in-out infinite;
}

.timer-with-ring.timer-danger {
  animation: timer-scale-danger 0.8s ease-in-out infinite;
}

.timer-with-ring.timer-critical {
  animation: timer-scale-critical 0.4s ease-in-out infinite;
}

.timer-with-ring.timer-warning .timer-ring {
  animation: timer-glow-warning 2s ease-in-out infinite;
}

.timer-with-ring.timer-danger .timer-ring {
  animation: timer-glow-danger 0.8s ease-in-out infinite;
}

.timer-with-ring.timer-critical .timer-ring {
  animation: timer-glow-critical 0.4s ease-in-out infinite;
}

/* Scale animations for container */
@keyframes timer-scale-warning {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes timer-scale-danger {
  0%, 100% {
    transform: scale(1) translateX(0);
  }
  25% {
    transform: scale(1.1) translateX(-3px);
  }
  50% {
    transform: scale(1.1) translateX(3px);
  }
  75% {
    transform: scale(1.1) translateX(-3px);
  }
}

@keyframes timer-scale-critical {
  0%, 100% {
    transform: scale(1) translateX(0);
  }
  20% {
    transform: scale(1.15) translateX(-4px);
  }
  40% {
    transform: scale(1.15) translateX(4px);
  }
  60% {
    transform: scale(1.15) translateX(-4px);
  }
  80% {
    transform: scale(1.15) translateX(4px);
  }
}

/* Glow animations for SVG ring */
@keyframes timer-glow-warning {
  0% {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3)) drop-shadow(0 0 0 rgba(255, 193, 7, 0));
  }
  50% {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3)) drop-shadow(0 0 20px rgba(255, 193, 7, 1));
  }
  100% {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3)) drop-shadow(0 0 0 rgba(255, 193, 7, 0));
  }
}

@keyframes timer-glow-danger {
  0% {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3)) drop-shadow(0 0 0 rgba(244, 67, 54, 0));
  }
  50% {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3)) drop-shadow(0 0 24px rgba(244, 67, 54, 1));
  }
  100% {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3)) drop-shadow(0 0 0 rgba(244, 67, 54, 0));
  }
}

@keyframes timer-glow-critical {
  0% {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3)) drop-shadow(0 0 10px rgba(244, 67, 54, 0.8));
  }
  50% {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3)) drop-shadow(0 0 35px rgba(244, 67, 54, 1));
  }
  100% {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3)) drop-shadow(0 0 10px rgba(244, 67, 54, 0.8));
  }
}

/* Legacy compact timer styles (kept for backwards compatibility) */
.timer-compact {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 600;
  color: white;
  white-space: nowrap;
}

.timer-compact-label {
  opacity: 0.9;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.timer-compact-value {
  font-size: 20px;
  font-weight: 700;
  padding: 4px 12px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  transition: all 0.3s ease;
}

/* Compact timer critical state (1-10 seconds) - pulsing */
.timer-compact.timer-critical .timer-compact-value {
  color: #ff3333;
  background: rgba(244, 67, 54, 0.3);
  border: 2px solid #ff3333;
  animation: compact-timer-pulse 0.4s ease-in-out infinite;
  box-shadow: 0 0 20px rgba(244, 67, 54, 0.8);
}

/* Compact timer at 0 - red but static (no pulse) */
.timer-compact.timer-zero .timer-compact-value {
  color: #ff3333;
  background: rgba(244, 67, 54, 0.3);
  border: 2px solid #ff3333;
  box-shadow: 0 0 15px rgba(244, 67, 54, 0.6);
}

@keyframes compact-timer-pulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 20px rgba(244, 67, 54, 0.8);
  }
  50% {
    transform: scale(1.1);
    box-shadow: 0 0 30px rgba(244, 67, 54, 1);
  }
}

/* Participants grid - Container for positioned tiles */
.participants-grid {
  position: fixed;
  top: 10vh; /* Start after dice panel */
  left: 400px; /* After character sheet */
  right: 0;
  bottom: 15vh; /* Above QuestAI panel */
  pointer-events: none; /* Allow clicks through to background */
  z-index: 1;
}

/* For facilitators, grid spans full width */
.video-container.facilitator-mode .participants-grid {
  left: 0 !important;
}

/* Blue frosted glass bar at bottom of video grid for QuestAI panel - REMOVED */
/*
.participants-grid::after {
  content: '';
  position: fixed;
  bottom: 0;
  left: 400px;
  right: 0;
  height: 90px;
  background: rgba(41, 145, 222, 0.55);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(255, 255, 255, 0.8);
  z-index: 50;
  pointer-events: none;
}
*/

/* Participant video tiles - Compact and positioned */
.participant {
  position: absolute;
  width: 240px;
  height: 135px; /* 16:9 aspect ratio (240 / 16 * 9) */
  background: #111;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.3);
  transition: all 0.3s ease;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  pointer-events: auto; /* Re-enable clicks on tiles */
}

/* 1 Player: Upper right */
.participants-grid:has(.participant:nth-child(1):last-child) .participant:nth-child(1) {
  top: 20px;
  right: 20px;
}

/* 2 Players: Upper right, upper left */
.participants-grid:has(.participant:nth-child(2):last-child) .participant:nth-child(1) {
  top: 20px;
  right: 20px;
}

.participants-grid:has(.participant:nth-child(2):last-child) .participant:nth-child(2) {
  top: 20px;
  left: 20px;
}

/* 3 Players: Upper right, upper middle, upper left */
.participants-grid:has(.participant:nth-child(3):last-child) .participant:nth-child(1) {
  top: 20px;
  right: 20px;
}

.participants-grid:has(.participant:nth-child(3):last-child) .participant:nth-child(2) {
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
}

.participants-grid:has(.participant:nth-child(3):last-child) .participant:nth-child(3) {
  top: 20px;
  left: 20px;
}

/* 4 Players: Upper right, upper left, bottom right, bottom left */
.participants-grid:has(.participant:nth-child(4):last-child) .participant:nth-child(1) {
  top: 20px;
  right: 20px;
}

.participants-grid:has(.participant:nth-child(4):last-child) .participant:nth-child(2) {
  top: 20px;
  left: 20px;
}

.participants-grid:has(.participant:nth-child(4):last-child) .participant:nth-child(3) {
  bottom: 40px;
  right: 20px;
}

.participants-grid:has(.participant:nth-child(4):last-child) .participant:nth-child(4) {
  bottom: 40px;
  left: 20px;
}

/* 5 Players: Upper right, upper middle, upper left, bottom right, bottom left */
.participants-grid:has(.participant:nth-child(5):last-child) .participant:nth-child(1) {
  top: 20px;
  right: 20px;
}

.participants-grid:has(.participant:nth-child(5):last-child) .participant:nth-child(2) {
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
}

.participants-grid:has(.participant:nth-child(5):last-child) .participant:nth-child(3) {
  top: 20px;
  left: 20px;
}

.participants-grid:has(.participant:nth-child(5):last-child) .participant:nth-child(4) {
  bottom: 40px;
  right: 20px;
}

.participants-grid:has(.participant:nth-child(5):last-child) .participant:nth-child(5) {
  bottom: 40px;
  left: 20px;
}

/* 6+ Players: Add bottom middle and continue pattern */
.participants-grid:has(.participant:nth-child(n+6)) .participant:nth-child(1) {
  top: 20px;
  right: 20px;
}

.participants-grid:has(.participant:nth-child(n+6)) .participant:nth-child(2) {
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
}

.participants-grid:has(.participant:nth-child(n+6)) .participant:nth-child(3) {
  top: 20px;
  left: 20px;
}

.participants-grid:has(.participant:nth-child(n+6)) .participant:nth-child(4) {
  bottom: 40px;
  right: 20px;
}

.participants-grid:has(.participant:nth-child(n+6)) .participant:nth-child(5) {
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
}

.participants-grid:has(.participant:nth-child(n+6)) .participant:nth-child(6) {
  bottom: 40px;
  left: 20px;
}

/* 7+ Players: Stack vertically on right side for overflow */
.participants-grid:has(.participant:nth-child(n+7)) .participant:nth-child(n+7) {
  top: 20px;
  right: 280px; /* Stack to left of first column */
  /* Calculate vertical offset based on index */
}

.participants-grid:has(.participant:nth-child(n+7)) .participant:nth-child(7) {
  top: 20px;
}

.participants-grid:has(.participant:nth-child(n+7)) .participant:nth-child(8) {
  top: 175px; /* 135px height + 40px gap */
}

.participants-grid:has(.participant:nth-child(n+7)) .participant:nth-child(9) {
  top: 330px;
}

.participants-grid:has(.participant:nth-child(n+7)) .participant:nth-child(10) {
  top: 485px;
}

.participant:hover {
  border-color: #4a9eff;
  box-shadow: 0 8px 20px rgba(74, 158, 255, 0.4);
  transform: scale(1.02);
}

.participant.local {
  border-color: #28a745;
  border-width: 3px;
  box-shadow: 0 6px 16px rgba(40, 167, 69, 0.4);
}

.participant video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}

.participant.local video {
  transform: scaleX(-1);
}

.participant-name {
  position: absolute;
  bottom: 8px;
  left: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.85);
  color: white;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  backdrop-filter: blur(10px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-radius: 6px;
  z-index: 10;
}

.participant.local .participant-name {
  background: rgba(40, 167, 69, 0.9);
  color: white;
}

.participant.local .participant-name::after {
  content: " (You)";
  opacity: 0.9;
  font-size: 11px;
}

/* Player portrait overlay */
.participant-portrait {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 60px;
  height: 60px;
  z-index: 5;
  pointer-events: none;
}

.participant-portrait-img {
  width: 100%;
  height: 100%;
  border-radius: 50%; 
  border: 2px solid #2991de;
  object-fit: cover;
  background: #6cace4;
}

/* Video controls - Fixed at bottom of character sheet container */
.video-controls {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 400px;  /* Match character container width */
  display: none;  /* Hidden by default, shown when character sheet appears */
  justify-content: center;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(10px);
  border-top: 2px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
  z-index: 100;  /* Below modals (1000) but above normal content */
}

/* Show controls when character sheet is visible */
.video-controls.show {
  display: flex !important;
}

/* Facilitator controls - centered at bottom, above QuestAI panel */
.video-container.facilitator-mode .video-controls {
  left: 50%;
  transform: translateX(-50%);
  width: auto;
  display: flex !important;  /* Always visible for facilitator */
  border-radius: 25px 25px 0 0;
  bottom: calc(5vh + 100px);  /* Position above QuestAI panel (5vh bottom + 84px height + margin) */
}

.control-btn {
  width: 48px;              /* slightly smaller */
  height: 48px;
  border-radius: 50%;
  border: 3px solid #ced4da;
  background: #ffffff;
  color: #495057;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  transition: all 0.3s ease;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.control-btn .control-icon {
  width: 24px;
  height: 24px;
  filter: brightness(0) saturate(100%) invert(27%) sepia(12%) saturate(1019%) hue-rotate(177deg) brightness(95%) contrast(91%);
  transition: filter 0.3s ease;
}

.control-btn:hover .control-icon {
  filter: brightness(0) saturate(100%) invert(41%) sepia(85%) saturate(1352%) hue-rotate(204deg) brightness(103%) contrast(101%);
}

.control-btn.active .control-icon,
.control-btn.disabled .control-icon {
  filter: brightness(0) invert(1);
}

.control-btn.leave-btn .control-icon,
.control-btn.settings-btn .control-icon {
  filter: brightness(0) invert(1);
}

.control-btn:hover {
  background: #f8f9fa;
  border-color: #007bff;
  color: #007bff;
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0,123,255,0.2);
}

.control-btn.disabled {
  background: #f8d7da;
  border-color: #f5c6cb;
  color: #721c24;
}

.control-btn.disabled:hover {
  background: #f5c6cb;
  border-color: #f1aeb5;
  transform: scale(1.02);
}

.control-btn.active {
  background: #007bff;
  border-color: #0056b3;
  color: white;
}

.control-btn.active:hover {
  background: #0056b3;
  border-color: #004085;
}

.control-btn.leave-btn {
  background: #dc3545;
  border-color: #c82333;
  color: white;
}

.control-btn.leave-btn:hover {
  background: #c82333;
  border-color: #bd2130;
  transform: scale(1.05);
}

.control-btn.settings-btn {
  background: #6c757d;
  border-color: #5a6268;
  color: white;
}

.control-btn.settings-btn:hover {
  background: #5a6268;
  border-color: #545b62;
}

/* Device settings panel */
.device-settings {
  position: absolute;
  bottom: 90px;
  right: 20px;
  background: linear-gradient(180deg, #5BA3E5 0%, #4A8BC2 100%);
  border: 2px solid rgba(255,255,255,0.9);
  border-radius: 12px;
  padding: 20px;
  min-width: 280px;
  backdrop-filter: blur(10px);
  z-index: 1000;
  box-shadow: 0 8px 25px rgba(0,0,0,0.25);
}

.device-group {
  margin-bottom: 15px;
}

.device-group:last-child {
  margin-bottom: 0;
}

.device-group label {
  display: block;
  color: #ffffff;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.device-group select {
  width: 100%;
  padding: 8px 12px;
  background: rgba(255,255,255,0.9);
  border: 2px solid rgba(255,255,255,0.5);
  border-radius: 6px;
  color: #2b7ac6;
  font-size: 14px;
  outline: none;
  transition: border-color 0.3s ease;
}

.device-group select:focus {
  border-color: rgba(255,255,255,1);
  background: #ffffff;
}

.device-group select option {
  background: #ffffff;
  color: #2b7ac6;
}

/* Screen sharing controls overlay */
.screen-sharing-controls {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.95);
  border: 2px solid #e9ecef;
  border-radius: 25px;
  padding: 10px 20px;
  display: flex;
  gap: 10px;
  align-items: center;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 1001;
}

.screen-sharing-indicator {
  color: #dc3545;
  font-weight: 600;
  font-size: 14px;
}

.stop-sharing-btn {
  background: #dc3545;
  color: white;
  border: none;
  border-radius: 15px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.stop-sharing-btn:hover {
  background: #c82333;
}

/* Responsive adjustments */
@media (max-width: 1200px) {
  .character-container {
    flex: 0 0 400px; /* stays fixed */
  }

  .screen-sharing-sidebar {
    flex: 0 0 200px;
  }
}

/* Hide video/audio controls on non-desktop devices */
@media (max-width: 1024px) {
  .video-controls {
    display: none !important;
  }

  .device-settings {
    display: none !important;
  }

  .screen-sharing-controls {
    display: none !important;
  }
}

@media (max-width: 768px) {
  .main-container {
    flex-direction: column;
  }

  .character-container {
    flex: 0 0 400px; /* stays fixed */
    padding: 0;
  }

  .participants-grid {
    padding: 15px;
    gap: 10px;
    margin-bottom: 70px;
  }

  .video-controls {
    display: none !important;
  }

  .control-btn {
    width: 44px;
    height: 44px;
    font-size: 18px;
  }

  .device-settings {
    display: none !important;
  }

  .screen-sharing-sidebar {
    flex: 0 0 150px;
  }

  .screen-sharing-participants {
    padding: 10px;
    gap: 8px;
  }

  .screen-sharing-participant {
    min-height: 80px;
  }

  /* Dice system responsive */
  #dice-and-timer-container {
    flex-direction: column;
    height: auto;
    min-height: 250px;
  }

  #dice-area {
    width: 100% !important;
    padding: 10px;
    min-height: 200px;
  }

  .dice-slot {
    width: 38px !important;
    height: 38px !important;
    font-size: 18px !important;
    border-width: 2px !important;
  }

  .risk-level-display {
    font-size: 14px !important;
    padding: 8px 12px !important;
  }

  .risk-level-value {
    font-size: 28px !important;
  }

  #dice-controls-container {
    position: static;
    width: 100%;
    margin-top: 10px;
    padding: 10px;
  }

  .roll-dice-btn {
    width: 100%;
    min-width: auto;
    font-size: 16px;
    padding: 14px 24px;
  }

  .special-actions-group {
    flex-direction: column;
    gap: 8px;
  }

  .push-luck-btn, .pay-price-btn {
    width: 100%;
    min-width: auto;
    font-size: 14px;
    padding: 10px 16px;
  }

  /* Timer adjustments */
  #tension-timer-display, #portal-timer-display {
    width: 70px !important;
    height: 70px !important;
  }

  .timer-value {
    font-size: 18px !important;
  }

  .timer-label {
    font-size: 9px !important;
  }
}

/* Mobile portrait (< 576px) */
@media (max-width: 575px) {
  #dice-area {
    padding: 8px;
    gap: 6px;
  }

  .dice-slot {
    width: 32px !important;
    height: 32px !important;
    font-size: 16px !important;
    border-width: 1.5px !important;
    border-radius: 6px !important;
  }

  .roll-dice-btn {
    font-size: 15px;
    padding: 12px 20px;
  }

  .risk-level-display {
    font-size: 12px !important;
  }

  .risk-level-value {
    font-size: 24px !important;
  }

  #tension-timer-display, #portal-timer-display {
    width: 60px !important;
    height: 60px !important;
  }

  .timer-value {
    font-size: 16px !important;
  }

  .dice-status-message {
    font-size: 12px;
    padding: 8px 12px;
  }

  .soft-reset-btn {
    font-size: 16px;
    padding: 6px 10px;
  }
}

/* Landscape orientation on mobile */
@media (orientation: landscape) and (max-height: 600px) {
  #dice-and-timer-container {
    height: 180px;
    min-height: 180px;
  }

  #dice-area {
    min-height: auto;
  }

  .dice-slot {
    width: 30px !important;
    height: 30px !important;
    font-size: 14px !important;
  }

  #dice-controls-container {
    padding: 5px;
  }

  .roll-dice-btn {
    padding: 10px 18px;
    font-size: 14px;
  }
}

/* Tablet (576px - 991px) */
@media (min-width: 576px) and (max-width: 991px) {
  #dice-area {
    width: 70% !important;
    padding: 12px;
  }

  .dice-slot {
    width: 40px !important;
    height: 40px !important;
    font-size: 20px !important;
  }

  #dice-controls-container {
    right: 8px;
    bottom: 8px;
  }

  .roll-dice-btn {
    min-width: 180px;
  }

  #tension-timer-display, #portal-timer-display {
    width: 75px !important;
    height: 75px !important;
  }
}

/* Loading state */
.participant.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6c757d;
  font-size: 14px;
  background: #f8f9fa;
}

.participant.loading::before {
  content: "";
  width: 30px;
  height: 30px;
  border: 3px solid #e9ecef;
  border-top: 3px solid #007bff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-right: 10px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Error states */
.participant.error {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #721c24;
  font-size: 12px;
  text-align: center;
  padding: 10px;
  background: #f8d7da;
}

/* Accessibility improvements */
.control-btn:focus {
  outline: 3px solid rgba(0, 123, 255, 0.4);
  outline-offset: 2px;
}

/* Animation for layout changes */
.participants-grid,
.participant {
  transition: all 0.3s ease;
}

/* When screen sharing is active, hide main participants grid */
.video-container.screen-sharing-mode:not(.facilitator-screen-sharing) .participants-grid {
  display: none;
}

/* When facilitator is screen sharing, overlay the participants grid */
.video-container.facilitator-screen-sharing .participants-grid {
  position: absolute;
  top: 20px;
  bottom: 100px;
  right: 20px;
  width: 280px;
  height: auto;
  padding: 0;
  margin-bottom: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 10px;
  align-content: flex-start;
  justify-content: flex-start;
  z-index: 100;
}

.video-container.facilitator-screen-sharing .participant {
  flex: 0 0 auto;
  width: 100%;
  max-width: 100%;
  aspect-ratio: 16/9;
  background: #111;
  border: 2px solid rgba(255,255,255,0.3);
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

/* Screen share label overlay */
.screen-sharer-label {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.2);
}

/* Centered portrait fallback (shown when participant camera is off) */
.participant-centered-portrait {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end; /* Bottom-align the large portrait so it sprouts from the name label */
  z-index: 6;
  pointer-events: none;
  background: #6cace4 !important; /* Solid blue, fills the entire tile */
  margin: 0 !important;
  /* Reserve space at top and bottom (for rounded corners/name bar) + small side padding */
  padding: 32px 4% 64px; /* allow JS to override padding dynamically for exact label height */
  border: none !important;
  box-shadow: none !important;
  overflow: hidden;
  box-sizing: border-box;
}

.participant-centered-inner {
  width: 100%;
  height: 100%;
  max-width: 900px;
  max-height: 100%;
  display: flex;
  align-items: flex-end; /* bottom-align image within overlay */
  justify-content: center;
  border-radius: 12px;
  background: transparent;
  box-shadow: none;
  overflow: hidden;
  border: none;
  margin: 0;
}

.participant-centered-img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain; /* Show full portrait without cropping */
  border-radius: 8px;
  display: block;
}

.participant-centered-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 48px;
  font-weight: 800;
  letter-spacing: 2px;
  user-select: none;
}

/* Slightly dim underlying video while portrait fallback is visible */
.participant .participant-centered-portrait ~ video {
  filter: brightness(0.35) saturate(0.9);
}

/* Ensure portrait border for the small corner avatar uses the requested color (already present, kept for clarity) */
.participant-portrait-img {
  background: #6cace4;
}

/* ========================================================================
   DICE CONTROL BUTTONS (Bottom-Right Fixed Position)
   ======================================================================== */

.dice-controls-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  z-index: 100;
  pointer-events: auto;
}

/* Risk Level Display */
.risk-level-display {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(41, 145, 222, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 8px 16px;
  border-radius: 8px;
  border: 2px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.risk-label {
  color: white;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.risk-value {
  color: white;
  font-size: 20px;
  font-weight: 800;
  min-width: 30px;
  text-align: center;
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

/* Roll Dice Button */
.roll-dice-btn {
  background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
  color: white;
  border: 3px solid rgba(255, 255, 255, 0.9);
  border-radius: 12px;
  padding: 16px 32px;
  font-size: 18px;
  font-weight: 700;
  font-family: 'League Spartan', sans-serif;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  text-transform: uppercase;
  letter-spacing: 1px;
  min-width: 200px;
  text-align: center;
}

.roll-dice-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
  background: linear-gradient(135deg, #20c997 0%, #28a745 100%);
}

.roll-dice-btn:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.roll-dice-btn:disabled {
  background: rgba(150, 150, 150, 0.5);
  cursor: default !important; /* AI controls rolling now */
  opacity: 0.7;
  border-color: rgba(255, 255, 255, 0.4);
  pointer-events: none; /* Disable all interactions */
}

.roll-dice-btn.rolling {
  background: linear-gradient(135deg, #ffc107 0%, #ff9800 100%);
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* AI Suggested Roll Animation */
.roll-dice-btn.ai-suggested {
  animation: aiSuggestPulse 1.5s ease-in-out 2;
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.8), 0 8px 25px rgba(0, 0, 0, 0.5);
}

@keyframes aiSuggestPulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  }
  50% {
    transform: scale(1.08);
    box-shadow: 0 0 25px rgba(255, 215, 0, 0.9), 0 10px 30px rgba(0, 0, 0, 0.6);
  }
}

/* Screen reader only (accessible but invisible) */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Status Message */
.dice-status-message {
  background: rgba(41, 145, 222, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: white;
  padding: 10px 16px;
  border-radius: 8px;
  border: 2px solid rgba(255, 255, 255, 0.6);
  font-size: 13px;
  font-weight: 600;
  max-width: 280px;
  text-align: center;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
  line-height: 1.3;
}

/* Special Actions Container */
.special-actions-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-end;
}

.special-action-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Special Action Buttons */
.special-action-btn {
  background: linear-gradient(135deg, #6f42c1 0%, #9c36b5 100%);
  color: white;
  border: 3px solid rgba(255, 255, 255, 0.9);
  border-radius: 10px;
  padding: 12px 24px;
  font-size: 16px;
  font-weight: 700;
  font-family: 'League Spartan', sans-serif;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.special-action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}

.special-action-btn:active {
  transform: none;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

.special-action-btn.push-luck {
  background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
}

.special-action-btn.pay-price {
  background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
}

/* Special Action Timer */
.special-action-timer {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to right, rgba(0, 0, 0, 0.7) 0%, transparent 100%);
  border-radius: 10px;
  pointer-events: none;
  transition: width 0.1s linear;
  z-index: 1;
}

/* Soft Reset Button */
.soft-reset-btn {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.6);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  font-size: 24px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.soft-reset-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg) scale(1.1);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

.soft-reset-btn:active {
  transform: rotate(90deg) scale(1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Game Notifications */
.game-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  min-width: 300px;
  max-width: 400px;
  padding: 16px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  color: white;
  font-family: 'League Spartan', sans-serif;
  font-size: 14px;
  z-index: 10000;
  animation: slideInRight 0.3s ease-out, fadeOut 0.5s ease-in 4.5s;
  pointer-events: none;
}

@keyframes slideInRight {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

/* XP Award Notification (Blue) */
.game-notification.xp-award {
  background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
  border-left: 4px solid #64B5F6;
}

/* Risk Set Notification (Purple) */
.game-notification.risk-set {
  background: linear-gradient(135deg, #9C27B0 0%, #7B1FA2 100%);
  border-left: 4px solid #BA68C8;
}

/* Success Notification (Green) */
.game-notification.success {
  background: linear-gradient(135deg, #4CAF50 0%, #388E3C 100%);
  border-left: 4px solid #81C784;
}

/* Warning Notification (Orange) */
.game-notification.warning {
  background: linear-gradient(135deg, #FF9800 0%, #F57C00 100%);
  border-left: 4px solid #FFB74D;
}

/* Notification Header */
.notification-header {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.notification-icon {
  font-size: 20px;
}

/* Notification Body */
.notification-body {
  font-size: 13px;
  line-height: 1.4;
  opacity: 0.95;
}

/* XP Breakdown */
.xp-breakdown {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.3);
}

.xp-player-line {
  display: flex;
  justify-content: space-between;
  margin: 4px 0;
  font-size: 12px;
}

.xp-player-name {
  font-weight: 600;
}

.xp-player-amount {
  font-weight: 700;
  color: #FFD700;
}

.xp-total {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.4);
  font-weight: 700;
  text-align: right;
  font-size: 14px;
}

/* Multiple notifications stack */
.game-notification:nth-child(2) {
  top: 110px;
}

.game-notification:nth-child(3) {
  top: 200px;
}

/* Mobile responsive notifications */
@media (max-width: 575px) {
  .game-notification {
    top: 10px;
    right: 10px;
    left: 10px;
    min-width: auto;
    max-width: none;
    font-size: 13px;
  }

  .notification-header {
    font-size: 15px;
  }
}
