/* ============================================
   PUZZLE GAME - SPECIFIC STYLES
   Common styles are in ../css/common.css
   ============================================ */

/* Puzzle-specific CSS Variables */
:root {
  --puzzle-bg: #2a2a3e;
  --puzzle-border: #4a4a5e;
  --piece-shadow: rgba(0, 0, 0, 0.3);
}

body.theme-light {
  --puzzle-bg: #e8e8f0;
  --puzzle-border: #c0c0d0;
  --piece-shadow: rgba(0, 0, 0, 0.15);
}

/* ============================================
   PLAYER CARDS CONTAINER (Dynamic 2-6 players)
   ============================================ */
.puzzle-game-header {
  max-width: 100% !important;
  justify-content: center !important;
}

.player-cards-container {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: nowrap;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  padding: 4px;
}

/* Hide scrollbar but allow scrolling */
.player-cards-container::-webkit-scrollbar {
  display: none;
}
.player-cards-container {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Player card in puzzle - flexible sizing for 2-6 players */
.player-cards-container .player-card {
  flex: 0 1 auto;
  min-width: 100px;
  max-width: 160px;
  padding: 6px 10px;
}

/* 2 players: wider cards */
.player-cards-container.players-2 .player-card {
  min-width: 140px;
  max-width: 180px;
}

/* 3 players */
.player-cards-container.players-3 .player-card {
  min-width: 120px;
  max-width: 160px;
}

/* 4 players */
.player-cards-container.players-4 .player-card {
  min-width: 100px;
  max-width: 140px;
}

/* 5-6 players: compact cards */
.player-cards-container.players-5 .player-card,
.player-cards-container.players-6 .player-card {
  min-width: 80px;
  max-width: 120px;
  padding: 4px 8px;
}

.player-cards-container.players-5 .player-card .name,
.player-cards-container.players-6 .player-card .name {
  font-size: 12px;
  max-width: 70px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-cards-container.players-5 .player-card .rating,
.player-cards-container.players-6 .player-card .rating {
  font-size: 11px;
}

.player-cards-container.players-5 .player-card .player-indicator,
.player-cards-container.players-6 .player-card .player-indicator {
  font-size: 14px;
}

/* Empty slot styling */
.player-cards-container .player-card.empty-slot {
  opacity: 0.5;
  border: 1px dashed var(--border);
}

.player-cards-container .player-card.empty-slot .name {
  color: var(--text-secondary);
  font-style: italic;
}

/* ============================================
   PLAYER CARD (Puzzle-specific: puzzle indicator)
   ============================================ */
.player-card .player-indicator {
  font-size: 18px;
  flex-shrink: 0;
}

/* ============================================
   GAME BOARD - Puzzle Container
   ============================================ */
.game-board {
  width: 100%;
  /* Use clamp for responsive height: min 300px, prefer viewport-based, max 800px */
  height: clamp(300px, calc(100vh - 200px), 800px);
  background: var(--puzzle-bg);
  border: 2px solid var(--puzzle-border);
  border-radius: 12px;
  padding: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  flex: 1 1 auto;  /* Allow grow and shrink */
}

/* Override game-area to stretch children to full width */
.game-room .game-area {
  align-items: stretch;
  width: 100%;
}

/* Board container - must have explicit width to expand properly */
.board-container {
  width: 100%;
  max-width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Canvas fills the game board - JS controls the actual size */
#puzzle-canvas {
  display: block;
  /* Don't set width/height in CSS - let JS handle it via canvas.width/height */
  /* The canvas will fill its container based on JS-set dimensions */
}

/* Timer overlay on game board */
.game-board .timer-display {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 10;
}

/* Puzzle placeholder */
.puzzle-placeholder {
  font-size: 120px;
  opacity: 0.3;
  user-select: none;
}

/* Puzzle container during game */
.puzzle-container {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

/* ============================================
   PUZZLE PIECES (For future implementation)
   ============================================ */
.puzzle-piece {
  position: absolute;
  cursor: grab;
  transition: transform 0.1s ease;
  box-shadow: 0 2px 8px var(--piece-shadow);
}

.puzzle-piece:active {
  cursor: grabbing;
  transform: scale(1.05);
  z-index: 100;
}

.puzzle-piece.placed {
  cursor: default;
  box-shadow: none;
}

.puzzle-piece.correct {
  animation: pieceCorrect 0.3s ease;
}

@keyframes pieceCorrect {
  0% { transform: scale(1.1); }
  50% { transform: scale(0.95); }
  100% { transform: scale(1); }
}

/* ============================================
   PUZZLE GRID (For future implementation)
   ============================================ */
.puzzle-grid {
  display: grid;
  gap: 1px;
  background: var(--puzzle-border);
  border-radius: 8px;
  overflow: hidden;
}

.puzzle-slot {
  background: var(--puzzle-bg);
  display: flex;
  justify-content: center;
  align-items: center;
}

.puzzle-slot.highlight {
  background: rgba(108, 92, 231, 0.2);
}

/* ============================================
   PROGRESS BAR
   ============================================ */
.progress-bar-container {
  width: 100%;
  max-width: 600px;
  margin-bottom: 10px;
}

.progress-bar {
  height: 20px;
  background: var(--bg-tertiary);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 0.3s ease;
  border-radius: 10px;
}

.progress-text {
  text-align: center;
  font-size: 12px;
  margin-top: 5px;
  color: var(--text-secondary);
}

/* ============================================
   IMAGE PREVIEW
   ============================================ */
.image-preview {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 80px;
  height: 80px;
  border: 2px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  opacity: 0.7;
  transition: all 0.3s ease;
  cursor: pointer;
}

.image-preview:hover {
  opacity: 1;
  transform: scale(1.1);
  z-index: 10;
}

.image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ============================================
   TIMER DISPLAY
   ============================================ */
.timer-display {
  font-family: 'Courier New', monospace;
  font-size: 24px;
  font-weight: bold;
  color: var(--text-primary);
  padding: 8px 16px;
  background: var(--bg-secondary);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.timer-display.warning {
  color: var(--warning);
}

.timer-display.danger {
  color: var(--error);
  animation: timerPulse 1s infinite;
}

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

/* ============================================
   PIECE TRAY (For future implementation)
   ============================================ */
.piece-tray {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px;
  background: var(--bg-secondary);
  border-radius: 8px;
  border: 1px solid var(--border);
  max-height: 200px;
  overflow-y: auto;
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */
@media (max-width: 820px) {
  .game-board {
    height: clamp(280px, calc(100vh - 180px), 600px);
    border-radius: 8px;
  }

  .puzzle-placeholder {
    font-size: 80px;
  }

  .image-preview {
    width: 60px;
    height: 60px;
  }

  /* Player cards on tablet */
  .player-cards-container {
    gap: 6px;
  }

  .player-cards-container .player-card {
    min-width: 80px;
    max-width: 130px;
    padding: 5px 8px;
  }

  .player-cards-container .player-card .name {
    font-size: 12px;
    max-width: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .player-cards-container .player-card .rating {
    font-size: 11px;
  }

  .player-cards-container .player-card .player-indicator {
    font-size: 14px;
  }
}

@media (max-width: 480px) {
  .game-board {
    height: clamp(220px, calc(100vh - 160px), 500px);
    border-radius: 6px;
  }

  .puzzle-placeholder {
    font-size: 60px;
  }

  .timer-display {
    font-size: 18px;
    padding: 6px 12px;
  }

  /* Player cards on mobile - ultra compact */
  .player-cards-container {
    gap: 4px;
    padding: 2px;
  }

  .player-cards-container .player-card {
    min-width: 55px;
    max-width: 80px;
    padding: 3px 5px;
  }

  .player-cards-container .player-card .player-row-1 {
    gap: 3px;
  }

  .player-cards-container .player-card .name {
    font-size: 10px;
    max-width: 45px;
  }

  .player-cards-container .player-card .rating {
    font-size: 9px;
  }

  .player-cards-container .player-card .player-indicator {
    font-size: 12px;
  }

  /* Hide timer on very small screens for more space */
  .player-cards-container.players-5 .player-card .player-row-2,
  .player-cards-container.players-6 .player-card .player-row-2 {
    display: none;
  }
}

/* ============================================
   BOARD STYLES (for variety)
   ============================================ */
.game-board.style-wooden {
  background: linear-gradient(135deg, #8b6914 0%, #a67c00 50%, #8b6914 100%);
  border-color: #5a4510;
}

.game-board.style-modern {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #1a1a2e 100%);
  border-color: #0f3460;
}

/* ============================================
   WINNING ANIMATION
   ============================================ */
.puzzle-complete {
  animation: puzzleWin 1s ease-out;
}

@keyframes puzzleWin {
  0% { transform: scale(1); }
  25% { transform: scale(1.02); }
  50% { transform: scale(1); }
  75% { transform: scale(1.01); }
  100% { transform: scale(1); }
}

/* ============================================
   HOW TO PLAY SECTION
   ============================================ */
.how-to-play-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0;
}

/* ============================================
   RESPONSIVE ADS
   ============================================ */
@media (max-width: 768px) {
  .ad-pc-only { display: none !important; }
}
@media (min-width: 769px) {
  .ad-mobile-only { display: none !important; }
}

/* Ad Lobby Center */
.ad-lobby {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
}

/* 게임방 모바일 하단 광고 320x50 */
.ad-mobile-fixed {
  display: none;  /* Hidden by default, shown on mobile only */
  width: 320px;
  height: 50px;
  margin: 8px auto;
}

.ad-mobile-fixed.hidden {
  display: none !important;
}

@media (max-width: 820px) {
  .ad-mobile-fixed:not(.hidden) {
    display: block;
  }
}

/* ============================================
   SIDEBAR TAB (탭 기반 통합 사이드바)
   ============================================ */
.sidebar {
  padding: 1px;
  gap: 1px;
}

.sidebar-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1px;
  flex-shrink: 0;
}

.sidebar-tab {
  flex: 1;
  padding: 10px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.sidebar-tab:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.sidebar-tab.active {
  color: var(--accent);
  border-bottom: 2px solid var(--accent);
  margin-bottom: -1px;
}

.sidebar-tab-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow-y: auto;
  min-height: 0;
}

#sidebar-chat-content .chat-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  background: var(--bg-card);
  border-radius: 1px;
  overflow: hidden;
  min-height: 0;
}

#sidebar-chat-content .chat-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

#sidebar-chat-content .chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1px;
  min-height: 150px;
}

#sidebar-chat-content .game-controls {
  padding: 10px;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex-shrink: 0;
}

#sidebar-chat-content .game-controls .btn {
  flex: 1;
  min-width: 80px;
}

.sidebar .ad-sidebar {
  flex-shrink: 0;
  margin-top: auto;
  display: flex;
  justify-content: center;
}

@media (max-width: 820px) {
  .sidebar-tabs {
    display: none;
  }
}

/* ============================================
   CHAT TABS & PARTICIPANT LIST
   ============================================ */
.chat-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 0;
}
.chat-tab {
  flex: 1;
  padding: 10px 15px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.chat-tab:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.chat-tab.active {
  color: var(--accent);
  border-bottom: 2px solid var(--accent);
  font-weight: 500;
}
.participant-count {
  background: var(--accent);
  color: white;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}
.tab-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#chat-content {
  display: flex;
  flex-direction: column;
  height: 100%;
}
#chat-content .chat-messages {
  flex: 1;
}

/* Participants List */
.participants-list {
  padding: 10px;
  overflow-y: auto;
  height: 100%;
}
.participant-section {
  margin-bottom: 15px;
}
.participant-section-header {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
  margin-bottom: 8px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--border-color);
}
.participant-items {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.participant-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--bg-secondary);
  border-radius: 8px;
  font-size: 13px;
}
.participant-item.player {
  border-left: 3px solid var(--accent);
}
.participant-item.host {
  border-left: 3px solid #f1c40f;
}
.participant-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}
.participant-info {
  flex: 1;
}
.participant-name {
  font-weight: 500;
  color: var(--text-primary);
}
.participant-role {
  font-size: 11px;
  color: var(--text-secondary);
}
.empty-participants {
  text-align: center;
  color: var(--text-secondary);
  padding: 20px;
  font-size: 13px;
}

/* ============================================
   APPRECIATION MODE OVERLAY
   ============================================ */
.appreciation-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  z-index: 9999;
  display: none;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  animation: fadeIn 0.3s ease;
}
.appreciation-overlay.active {
  display: flex;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.appreciation-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-width: 95vw;
  max-height: 95vh;
  gap: 20px;
}
.appreciation-content img {
  max-width: 90vw;
  max-height: 75vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  animation: scaleIn 0.5s ease;
}
@keyframes scaleIn {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.appreciation-info {
  text-align: center;
  color: #fff;
  animation: slideUp 0.5s ease 0.2s both;
}
@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.appreciation-info .appreciation-title {
  font-size: 24px;
  font-weight: bold;
  color: #ffd700;
  display: block;
  margin-bottom: 8px;
}
.appreciation-info .appreciation-artist {
  font-size: 18px;
  color: #ccc;
  font-style: italic;
}
.appreciation-close-btn {
  padding: 15px 40px;
  font-size: 16px;
  background: linear-gradient(135deg, var(--accent-color), var(--accent-hover));
  color: #fff;
  border: none;
  border-radius: 30px;
  cursor: pointer;
  transition: all 0.3s ease;
  animation: slideUp 0.5s ease 0.4s both;
  box-shadow: 0 4px 15px rgba(106, 90, 205, 0.4);
}
.appreciation-close-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(106, 90, 205, 0.6);
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .appreciation-content img {
    max-width: 95vw;
    max-height: 65vh;
  }
  .appreciation-info .appreciation-title {
    font-size: 18px;
  }
  .appreciation-info .appreciation-artist {
    font-size: 14px;
  }
  .appreciation-close-btn {
    padding: 12px 30px;
    font-size: 14px;
  }
}

/* ============================================
   ARTWORK INFO PANEL (Appreciation Mode)
   ============================================ */
.artwork-info-panel {
  position: absolute;
  /* Position at the center of the right half of the canvas */
  right: 25%;
  top: 50%;
  transform: translate(50%, -50%);
  background: rgba(0, 0, 0, 0.85);
  border-radius: 12px;
  padding: 20px;
  min-width: 180px;
  max-width: 250px;
  text-align: center;
  display: none;
  flex-direction: column;
  gap: 10px;
  z-index: 100;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.artwork-info-panel.active {
  display: flex;
}
.artwork-info-panel .artwork-title {
  font-size: 18px;
  font-weight: 600;
  color: #fff;
  line-height: 1.3;
}
.artwork-info-panel .artwork-artist {
  font-size: 14px;
  color: #aaa;
}
.artwork-info-panel .artwork-hint {
  font-size: 12px;
  color: #888;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

@media (max-width: 768px) {
  .artwork-info-panel {
    right: auto;
    left: 50%;
    top: 15px;
    transform: translateX(-50%);
    padding: 15px;
    min-width: 150px;
    max-width: 200px;
  }
  .artwork-info-panel .artwork-title {
    font-size: 16px;
  }
  .artwork-info-panel .artwork-artist {
    font-size: 12px;
  }
}

/* ============================================
   FULLSCREEN MODE
   ============================================ */

/* Fullscreen Button */
.fullscreen-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 50;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fullscreen-btn:hover {
  background: rgba(0, 0, 0, 0.8);
  border-color: rgba(255, 255, 255, 0.4);
  transform: scale(1.05);
}

.fullscreen-btn .fullscreen-icon {
  font-size: 20px;
  color: #fff;
}

/* Fullscreen Mode Styles */
.board-container.fullscreen {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 9999 !important;
  background: var(--bg-primary, #1a1a2e) !important;
  margin: 0 !important;
  padding: 0 !important;
  border-radius: 0 !important;
}

.board-container.fullscreen .game-board {
  width: 100% !important;
  height: 100% !important;
  min-width: unset !important;
  min-height: unset !important;
  max-height: unset !important;
  border-radius: 0 !important;
}

.board-container.fullscreen .fullscreen-btn {
  top: 20px;
  right: 20px;
  background: rgba(0, 0, 0, 0.7);
  padding: 12px 16px;
}

.board-container.fullscreen .fullscreen-btn .fullscreen-icon::after {
  content: '✕';
}

.board-container.fullscreen .fullscreen-btn .fullscreen-icon {
  font-size: 0;
}

.board-container.fullscreen .fullscreen-btn .fullscreen-icon::after {
  font-size: 20px;
}

/* Hide other elements in fullscreen */
.board-container.fullscreen .waiting-overlay,
.board-container.fullscreen .artwork-info-panel {
  /* These can still show if needed */
}

/* ESC key hint */
.fullscreen-hint {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 12px;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.board-container.fullscreen .fullscreen-hint {
  opacity: 1;
  animation: fadeOut 3s ease forwards;
  animation-delay: 2s;
}

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

/* ============================================
   MULTI-PLAYER MODE STYLES
   ============================================ */

/* Room mode info in participants list */
.room-mode-info {
  padding: 8px 12px;
  background: var(--primary-color, #4a90d9);
  color: white;
  border-radius: 6px;
  margin-bottom: 8px;
  text-align: center;
  font-size: 12px;
  font-weight: 500;
}

/* Mode badge in room list */
.mode-badge {
  font-size: 14px;
  margin-right: 6px;
}

.room-title-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.room-title-row h3 {
  margin: 0;
}

/* Full room indicator */
.room-item.room-full {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Empty slot indicator */
.participant-item.empty-slot {
  opacity: 0.5;
  border-style: dashed;
}

.participant-item.empty-slot .participant-avatar {
  animation: pulse 2s infinite;
}

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

/* Live rankings during competitive mode */
.live-rankings {
  position: fixed;
  top: 100px;
  right: 20px;
  background: var(--card-bg, #2a2a3a);
  border-radius: 12px;
  padding: 16px;
  min-width: 200px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  z-index: 100;
}

.rankings-title {
  font-weight: bold;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color, #3a3a4a);
}

.ranking-item {
  padding: 6px 0;
  font-size: 14px;
}

.ranking-item:first-of-type {
  color: gold;
}

/* Shared progress for cooperative mode */
.shared-progress-bar {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--card-bg, #2a2a3a);
  border-radius: 20px;
  padding: 8px 20px;
  min-width: 200px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  z-index: 100;
}

.shared-progress-bar .progress-fill {
  height: 6px;
  background: var(--primary-color, #4a90d9);
  border-radius: 3px;
  margin-top: 8px;
  transition: width 0.3s ease;
}

/* Mobile adjustments for multi-player UI */
@media (max-width: 768px) {
  .live-rankings {
    top: auto;
    bottom: 80px;
    right: 10px;
    left: 10px;
    min-width: auto;
  }

  .shared-progress-bar {
    top: auto;
    bottom: 130px;
    width: calc(100% - 40px);
    min-width: auto;
  }
}

/* ============================================
   TUTORIAL MODAL
   ============================================ */
.modal-tutorial {
  max-width: 520px;
  width: 95%;
  background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
  border: 2px solid #3a3a5c;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.modal-tutorial h2 {
  text-align: center;
  margin-bottom: 20px;
  font-size: 1.5rem;
  color: #ffd700;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}
.tutorial-wrapper {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.tutorial-visual {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
#tutorial-canvas {
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  max-width: 100%;
}
.tutorial-caption {
  font-size: 0.85rem;
  color: #a0a0c0;
  text-align: center;
  font-style: italic;
}
.tutorial-text {
  padding: 0 10px;
  text-align: center;
}
.tutorial-text h3 {
  font-size: 1.2rem;
  color: #fff;
  margin-bottom: 10px;
}
.tutorial-text p {
  font-size: 0.95rem;
  color: #c0c0d0;
  line-height: 1.6;
  white-space: pre-line;
}
.tutorial-navigation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.tutorial-dots {
  display: flex;
  gap: 6px;
}
.progress-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3a3a5c;
  transition: all 0.3s ease;
}
.progress-dot.active {
  background: #ffd700;
  box-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
}
.progress-dot.completed {
  background: #4ade80;
}
.tutorial-navigation .btn {
  min-width: 90px;
}
.tutorial-navigation .btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Light theme tutorial */
body.theme-light .modal-tutorial {
  background: linear-gradient(180deg, #f5f5f5 0%, #e8e8e8 100%);
  border-color: #ccc;
}
body.theme-light .modal-tutorial h2 {
  color: #b8860b;
  text-shadow: none;
}
body.theme-light .tutorial-caption {
  color: #666;
}
body.theme-light .tutorial-text h3 {
  color: #333;
}
body.theme-light .tutorial-text p {
  color: #555;
}
body.theme-light #tutorial-canvas {
  background: linear-gradient(135deg, #f0f0f0 0%, #e0e0e0 100%);
}
body.theme-light .progress-dot {
  background: #ccc;
}
body.theme-light .progress-dot.active {
  background: #b8860b;
  box-shadow: 0 0 8px rgba(184, 134, 11, 0.5);
}

/* Mobile responsive for tutorial */
@media (max-width: 520px) {
  .modal-tutorial {
    max-width: 100%;
    margin: 10px;
  }
  #tutorial-canvas {
    width: 100%;
    height: auto;
    max-height: 220px;
  }
  .tutorial-text h3 {
    font-size: 1rem;
  }
  .tutorial-text p {
    font-size: 0.85rem;
  }
  .tutorial-navigation .btn {
    min-width: 70px;
    font-size: 0.85rem;
    padding: 8px 12px;
  }
}
