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

/* Chess-specific CSS Variables */
:root {
  --board-light: #f0d9b5;
  --board-dark: #b58863;
  --board-highlight: rgba(255, 255, 0, 0.4);
  --board-valid-move: rgba(0, 128, 0, 0.5);
}

body.theme-light {
  --board-light: #f0d9b5;
  --board-dark: #b58863;
}

/* ============================================
   GAME HEADER (Chess-specific max-width)
   ============================================ */

.game-header {
  max-width: 520px;
}

/* ============================================
   PLAYER CARD (Chess-specific with piece indicator)
   ============================================ */

.player-card {
  background: var(--bg-card);
  padding: 8px 12px;
  border-radius: 8px;
  min-width: 160px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.player-card.active {
  border: 2px solid var(--accent);
}

.player-card .player-row-1 {
  display: flex;
  align-items: center;
  gap: 8px;
}

.player-card .player-row-2 {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Chess piece indicator (king symbol) */
.piece-indicator {
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
}

.piece-indicator.white {
  color: #fff;
  text-shadow: 0 0 3px #000;
}

.piece-indicator.black {
  color: #333;
  text-shadow: 0 0 2px #fff;
}

.player-card .name {
  font-weight: bold;
  font-size: 14px;
}

.player-card .rating {
  font-size: 13px;
  color: var(--warning);
  font-weight: bold;
}

.player-card .timer {
  font-family: monospace;
  font-size: 14px;
  font-weight: bold;
}

.vs-text {
  font-size: 18px;
  font-weight: bold;
  color: var(--text-secondary);
}

/* ============================================
   BOARD WRAPPER & CAPTURED PIECES
   ============================================ */

.board-wrapper {
  position: relative;
  display: inline-block;
}

/* Captured by black (top-right) */
.captured-pieces.captured-top-right {
  position: absolute;
  top: -30px;
  right: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  font-size: 20px;
  max-width: 200px;
  justify-content: flex-end;
}

/* Captured by white (bottom-left) */
.captured-pieces.captured-bottom-left {
  position: absolute;
  bottom: -30px;
  left: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  font-size: 20px;
  max-width: 200px;
}

.captured-pieces .captured-piece {
  filter: drop-shadow(1px 1px 1px rgba(0,0,0,0.3));
}

.captured-pieces {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  min-height: 30px;
  padding: 5px;
  font-size: 20px;
  max-width: 480px;
}

.captured-piece {
  transition: transform 0.2s;
}

.captured-piece:hover {
  transform: scale(1.2);
}

/* ============================================
   CHESS BOARD
   ============================================ */

.board-container {
  position: relative;
  padding: 15px;
  background: #5d4e37;
  border-radius: 8px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.5);
  margin: auto 0;
}

.chess-board {
  display: grid;
  grid-template-columns: repeat(8, 80px);
  grid-template-rows: repeat(8, 80px);
  border: 8px solid #5d4524;
  border-radius: 4px;
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.5),
    inset 0 0 0 2px #8b6914,
    0 0 0 4px #3d2e17;
  background: linear-gradient(135deg, #8b6914 0%, #5d4524 100%);
  padding: 2px;
}

.cell {
  width: 80px;
  height: 80px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  position: relative;
  user-select: none;
  transition: all 0.15s ease;
}

.cell.light {
  background: linear-gradient(135deg, #f5e6c8 0%, #edd9b3 50%, #e8d1a5 100%);
  box-shadow: inset 1px 1px 3px rgba(255, 255, 255, 0.5);
}

.cell.dark {
  background: linear-gradient(135deg, #b88b4a 0%, #a67c41 50%, #8f6a38 100%);
  box-shadow: inset -1px -1px 3px rgba(0, 0, 0, 0.2);
}

.cell.selected {
  background: linear-gradient(135deg, #f7ec5e 0%, #f0d800 50%, #d4bc00 100%) !important;
  box-shadow: inset 0 0 15px rgba(255, 215, 0, 0.8) !important;
}

.cell.last-move {
  background: linear-gradient(135deg, #c8e896 0%, #a9d46a 50%, #8bc34a 100%) !important;
  box-shadow: inset 0 0 10px rgba(139, 195, 74, 0.5) !important;
}

.cell.valid-move::after {
  content: '';
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 150, 0, 0.8) 0%, rgba(0, 100, 0, 0.4) 100%);
  position: absolute;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.cell.capture::after {
  content: '';
  width: 100%;
  height: 100%;
  border: 5px solid transparent;
  border-radius: 50%;
  position: absolute;
  box-sizing: border-box;
  background: radial-gradient(circle, transparent 55%, rgba(255, 50, 50, 0.6) 55%, rgba(255, 50, 50, 0.6) 70%, transparent 70%);
}

.cell.check {
  animation: checkPulse 1s ease-in-out infinite;
  background: radial-gradient(circle, rgba(255, 0, 0, 0.8) 0%, rgba(255, 100, 100, 0.4) 50%, transparent 70%) !important;
}

@keyframes checkPulse {
  0%, 100% { box-shadow: inset 0 0 20px rgba(255, 0, 0, 0.8); }
  50% { box-shadow: inset 0 0 30px rgba(255, 0, 0, 1); }
}

.cell:hover {
  filter: brightness(1.08);
}

/* ============================================
   CHESS PIECES
   ============================================ */

.piece {
  width: 62px;
  height: 62px;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), filter 0.15s;
  z-index: 10;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(2px 3px 3px rgba(0, 0, 0, 0.4));
}

.piece svg {
  width: 100%;
  height: 100%;
}

.piece:hover {
  transform: scale(1.15) translateY(-3px);
  z-index: 100;
  filter: drop-shadow(2px 4px 5px rgba(0, 0, 0, 0.5)) brightness(1.05);
}

.piece.dragging {
  opacity: 0.7;
  transform: scale(1.2);
}

/* ============================================
   PROMOTION MODAL
   ============================================ */

.promotion-options {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin: 20px 0;
}

.promotion-btn {
  width: 80px;
  height: 80px;
  padding: 10px;
  background: var(--bg-card);
  border: 2px solid var(--bg-primary);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.promotion-btn svg {
  width: 60px;
  height: 60px;
}

.promotion-btn:hover {
  background: var(--accent);
  transform: scale(1.1);
}

/* ============================================
   COLOR SELECTION (AI game)
   ============================================ */

.color-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.color-btn {
  padding: 10px 20px;
  border: 2px solid var(--bg-card);
  border-radius: 8px;
  background: var(--bg-primary);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s;
}

.color-btn.selected {
  border-color: var(--accent);
  background: rgba(233, 69, 96, 0.2);
}

.color-btn.white-btn { background: #f0d9b5; color: #333; }
.color-btn.black-btn { background: #333; color: #fff; }
.color-btn.random-btn { background: linear-gradient(135deg, #f0d9b5 50%, #333 50%); }

/* ============================================
   AI LEVEL SLIDER
   ============================================ */

.ai-level-slider {
  padding: 20px;
  text-align: center;
}

.ai-level-slider input[type="range"] {
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(to right, #4ade80, #fbbf24, #ef4444);
  -webkit-appearance: none;
}

.ai-level-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: white;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.ai-level-display {
  margin-top: 15px;
}

.ai-level-number {
  display: block;
  font-size: 48px;
  font-weight: bold;
  color: var(--accent);
}

.ai-level-name {
  display: block;
  font-size: 18px;
  margin-bottom: 5px;
}

.ai-level-rating {
  font-size: 14px;
  color: var(--text-secondary);
}

.ai-level-presets {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 15px;
  flex-wrap: wrap;
}

/* ============================================
   MOVE LIST (Chess notation)
   ============================================ */

.move-list-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 10px;
  min-height: 0;
  background: transparent;
  border-radius: 0;
}

.move-list-header {
  font-size: 14px;
  font-weight: bold;
  margin-bottom: 10px;
  color: var(--text-secondary);
}

.move-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  flex: 1;
  overflow-y: auto;
  align-content: flex-start;
}

.move-item {
  padding: 4px 8px;
  background: var(--bg-card);
  border-radius: 4px;
  font-size: 12px;
  font-family: monospace;
}

.move-item.white {
  border-left: 3px solid #fff;
}

.move-item.black {
  border-left: 3px solid #333;
}

.move-row {
  display: flex;
  gap: 8px;
  padding: 4px 8px;
  background: var(--bg-card);
  border-radius: 4px;
  font-size: 12px;
  font-family: monospace;
  width: 100%;
}

.move-number {
  color: var(--text-secondary);
  min-width: 20px;
}

.white-move, .black-move {
  min-width: 50px;
}

/* ============================================
   RESPONSIVE - Chess-specific
   ============================================ */

/* 1035px: 보드 0.9배 (80px → 72px) */
@media (max-width: 1035px) {
  .chess-board {
    grid-template-columns: repeat(8, 72px);
    grid-template-rows: repeat(8, 72px);
    border-width: 7px;
  }

  .cell {
    width: 72px;
    height: 72px;
  }

  .piece {
    width: 56px;
    height: 56px;
  }

  .captured-pieces.captured-top-right,
  .captured-pieces.captured-bottom-left {
    font-size: 18px;
  }
}

/* 960px: 보드 0.9배 (72px → 61px) */
@media (max-width: 960px) {
  .chess-board {
    grid-template-columns: repeat(8, 61px);
    grid-template-rows: repeat(8, 61px);
    border-width: 6px;
  }

  .cell {
    width: 61px;
    height: 61px;
  }

  .piece {
    width: 48px;
    height: 48px;
  }

  .captured-pieces.captured-top-right,
  .captured-pieces.captured-bottom-left {
    font-size: 16px;
  }
}

@media (max-width: 900px) {
  .chess-board {
    grid-template-columns: repeat(8, 55px);
    grid-template-rows: repeat(8, 55px);
    border-width: 6px;
  }

  .cell {
    width: 55px;
    height: 55px;
  }

  .piece {
    width: 46px;
    height: 46px;
  }

  .captured-pieces.captured-top-right,
  .captured-pieces.captured-bottom-left {
    font-size: 18px;
  }
}

@media (max-width: 600px) {
  .game-header {
    max-width: 100%;
    gap: 6px;
  }

  /* Horizontal player cards on mobile */
  .player-card {
    padding: 6px 10px;
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    text-align: left;
  }

  .player-card .piece-indicator {
    font-size: 16px;
    margin: 0;
    flex-shrink: 0;
  }

  .player-card .player-row-1 {
    display: contents;
  }

  .player-card .player-row-1 .piece-indicator {
    order: -1;
  }

  .player-card .player-row-1 .name {
    flex: 1;
    min-width: 0;
  }

  .player-card .player-row-2 {
    display: contents;
  }

  .player-card .player-row-2 .rating {
    display: none;
  }

  .player-card .name {
    font-size: 13px;
    margin-bottom: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

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

  .player-card .timer {
    font-size: 15px;
    margin: 0;
    flex-shrink: 0;
  }

  .player-card .ai-badge {
    font-size: 8px;
    padding: 2px 5px;
    top: -4px;
    right: -4px;
  }

  .vs-text {
    font-size: 14px;
    flex-shrink: 0;
  }

  .board-container {
    padding: 8px;
  }

  .chess-board {
    grid-template-columns: repeat(8, 44px);
    grid-template-rows: repeat(8, 44px);
    border-width: 5px;
  }

  .cell {
    width: 44px;
    height: 44px;
  }

  .piece {
    width: 38px;
    height: 38px;
  }

  .cell.valid-move::after {
    width: 16px;
    height: 16px;
  }

  .captured-pieces.captured-top-right,
  .captured-pieces.captured-bottom-left {
    font-size: 16px;
    max-width: 150px;
  }

  .promotion-btn {
    width: 60px;
    height: 60px;
    padding: 8px;
  }

  .promotion-btn svg {
    width: 44px;
    height: 44px;
  }
}

@media (max-width: 380px) {
  .chess-board {
    grid-template-columns: repeat(8, 40px);
    grid-template-rows: repeat(8, 40px);
    border-width: 4px;
  }

  .cell {
    width: 40px;
    height: 40px;
  }

  .piece {
    width: 34px;
    height: 34px;
  }

  .cell.valid-move::after {
    width: 14px;
    height: 14px;
  }
}

/* ============================================
   SPEECH BUBBLE (Check/Checkmate)
   ============================================ */

.speech-bubble-container {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2000;
  pointer-events: none;
  display: none;
}

.speech-bubble-container.active {
  display: block;
  animation: bubble-appear 0.3s ease-out forwards;
}

.speech-bubble {
  position: relative;
  background: #fff;
  border: 4px solid #333;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  padding: 25px 40px;
  font-size: 32px;
  font-weight: bold;
  color: #333;
  text-align: center;
  box-shadow: 4px 4px 0 #333, 8px 8px 15px rgba(0, 0, 0, 0.3);
  font-family: 'Segoe UI', Arial, sans-serif;
  min-width: 150px;
}

.speech-bubble::before {
  content: '';
  position: absolute;
  top: -15px;
  left: 20%;
  width: 30px;
  height: 30px;
  background: #fff;
  border: 4px solid #333;
  border-radius: 50%;
  border-bottom: none;
  z-index: -1;
}

.speech-bubble::after {
  content: '';
  position: absolute;
  top: -10px;
  right: 25%;
  width: 25px;
  height: 25px;
  background: #fff;
  border: 4px solid #333;
  border-radius: 50%;
  border-bottom: none;
  z-index: -1;
}

.speech-bubble .cloud-bump-1 {
  position: absolute;
  top: -12px;
  left: 45%;
  width: 35px;
  height: 35px;
  background: #fff;
  border: 4px solid #333;
  border-radius: 50%;
  border-bottom: none;
  z-index: -1;
}

.speech-bubble .cloud-bump-2 {
  position: absolute;
  bottom: -8px;
  left: 30%;
  width: 20px;
  height: 20px;
  background: #fff;
  border: 4px solid #333;
  border-radius: 50%;
  border-top: none;
}

.speech-bubble .cloud-bump-3 {
  position: absolute;
  bottom: -10px;
  right: 35%;
  width: 25px;
  height: 25px;
  background: #fff;
  border: 4px solid #333;
  border-radius: 50%;
  border-top: none;
}

/* Check - Red/Orange */
.speech-bubble.check {
  background: linear-gradient(135deg, #fff5f0 0%, #ffe0d0 100%);
  border-color: #e65100;
  color: #e65100;
  box-shadow: 4px 4px 0 #e65100, 8px 8px 20px rgba(230, 81, 0, 0.4);
}

.speech-bubble.check::before,
.speech-bubble.check::after,
.speech-bubble.check .cloud-bump-1,
.speech-bubble.check .cloud-bump-2,
.speech-bubble.check .cloud-bump-3 {
  background: linear-gradient(135deg, #fff5f0 0%, #ffe0d0 100%);
  border-color: #e65100;
}

/* Checkmate - Dark Red */
.speech-bubble.checkmate {
  background: linear-gradient(135deg, #fff0f0 0%, #ffd0d0 100%);
  border-color: #c41e3a;
  color: #c41e3a;
  box-shadow: 4px 4px 0 #c41e3a, 8px 8px 20px rgba(196, 30, 58, 0.5);
}

.speech-bubble.checkmate::before,
.speech-bubble.checkmate::after,
.speech-bubble.checkmate .cloud-bump-1,
.speech-bubble.checkmate .cloud-bump-2,
.speech-bubble.checkmate .cloud-bump-3 {
  background: linear-gradient(135deg, #fff0f0 0%, #ffd0d0 100%);
  border-color: #c41e3a;
}

/* Stalemate/Draw - Gray/Blue */
.speech-bubble.draw {
  background: linear-gradient(135deg, #f0f5ff 0%, #d0e0f0 100%);
  border-color: #546e7a;
  color: #546e7a;
  box-shadow: 4px 4px 0 #546e7a, 8px 8px 20px rgba(84, 110, 122, 0.4);
}

.speech-bubble.draw::before,
.speech-bubble.draw::after,
.speech-bubble.draw .cloud-bump-1,
.speech-bubble.draw .cloud-bump-2,
.speech-bubble.draw .cloud-bump-3 {
  background: linear-gradient(135deg, #f0f5ff 0%, #d0e0f0 100%);
  border-color: #546e7a;
}

/* Warning (Self-Check) - Yellow/Orange */
.speech-bubble.warning {
  background: linear-gradient(135deg, #fffbe0 0%, #ffe0a0 100%);
  border-color: #f57c00;
  color: #e65100;
  box-shadow: 4px 4px 0 #f57c00, 8px 8px 20px rgba(245, 124, 0, 0.4);
}

.speech-bubble.warning::before,
.speech-bubble.warning::after,
.speech-bubble.warning .cloud-bump-1,
.speech-bubble.warning .cloud-bump-2,
.speech-bubble.warning .cloud-bump-3 {
  background: linear-gradient(135deg, #fffbe0 0%, #ffe0a0 100%);
  border-color: #f57c00;
}

@keyframes bubble-appear {
  0% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
  50% { transform: translate(-50%, -50%) scale(1.2); }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

@keyframes bubble-shake {
  0%, 100% { transform: translate(-50%, -50%) rotate(0deg); }
  25% { transform: translate(-50%, -50%) rotate(-3deg); }
  75% { transform: translate(-50%, -50%) rotate(3deg); }
}

.speech-bubble-container.shake {
  animation: bubble-appear 0.3s ease-out, bubble-shake 0.15s ease-in-out 0.3s 3;
}

/* Responsive speech bubble */
@media (max-width: 600px) {
  .speech-bubble {
    font-size: 24px;
    padding: 18px 30px;
    min-width: 120px;
  }

  .speech-bubble::before {
    width: 22px;
    height: 22px;
    top: -10px;
  }

  .speech-bubble::after {
    width: 18px;
    height: 18px;
    top: -8px;
  }
}

/* ============================================
   820px 이하: 모바일 레이아웃 (게임판 100% 너비)
   ============================================ */
@media (max-width: 820px) {
  .board-wrapper {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .board-container {
    width: 100%;
    padding: 8px;
    box-sizing: border-box;
  }

  .chess-board {
    width: 100%;
    aspect-ratio: 1 / 1;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
    border-width: 4px;
  }

  .cell {
    width: 100%;
    height: 100%;
  }

  .piece {
    width: 85%;
    height: 85%;
  }

  .cell.valid-move::after {
    width: 20%;
    height: 20%;
  }

  .captured-pieces.captured-top-right,
  .captured-pieces.captured-bottom-left {
    position: relative;
    top: auto;
    bottom: auto;
    left: auto;
    right: auto;
    font-size: 16px;
    max-width: 100%;
    justify-content: center;
    padding: 4px 0;
  }
}

/* ============================================
   RECONNECT OVERLAY
   ============================================ */

#reconnect-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 10000;
}

#reconnect-overlay.active {
  display: flex;
}

.reconnect-content {
  text-align: center;
  color: white;
  padding: 30px;
  background: rgba(50, 50, 50, 0.9);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.reconnect-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top-color: #6c5ce7;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.reconnect-text {
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 10px;
}

.reconnect-attempt {
  font-size: 14px;
  color: #aaa;
  margin-bottom: 15px;
}

.reconnect-refresh {
  display: none;
  padding: 12px 24px;
  font-size: 16px;
  background: #6c5ce7;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
}

.reconnect-refresh:hover {
  background: #5b4cdb;
}

/* ============================================
   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), inset 0 0 30px rgba(0, 0, 0, 0.3);
  background: linear-gradient(135deg, #f0d9b5 0%, #b58863 100%);
}

.tutorial-caption {
  font-size: 0.85rem;
  color: #a0a0c0;
  text-align: center;
  font-style: italic;
}

.tutorial-text {
  padding: 0 10px;
  text-align: center;
}

.tutorial-piece-preview {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  margin-bottom: 15px;
  min-height: 70px;
}

.tutorial-piece-preview .piece-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.tutorial-piece-preview .piece-svg {
  width: 50px;
  height: 50px;
}

.tutorial-piece-preview .piece-svg svg {
  width: 100%;
  height: 100%;
}

.tutorial-piece-preview .piece-label {
  font-size: 0.75rem;
  color: #a0a0c0;
}

body.theme-light .tutorial-piece-preview .piece-label {
  color: #666;
}

.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;
}

.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-progress {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.progress-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-progress span {
  font-size: 0.8rem;
  color: #808090;
}

.tutorial-navigation .btn {
  min-width: 90px;
}

.tutorial-navigation .btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Light theme */
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 .progress-dot {
  background: #ccc;
}

body.theme-light .progress-dot.active {
  background: #b8860b;
  box-shadow: 0 0 8px rgba(184, 134, 11, 0.5);
}

body.theme-light .tutorial-progress span {
  color: #888;
}

/* ============================================
   SPECTATOR MODE STYLES
   ============================================ */

/* Room List - Live Game Styling */
.room-item.room-live {
  border: 2px solid #e74c3c;
  background: linear-gradient(135deg, rgba(231, 76, 60, 0.1), rgba(192, 57, 43, 0.05));
  cursor: default;
}

.room-item.room-live:hover {
  transform: none;
  border-color: #c0392b;
}

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

.live-badge {
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  color: white;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  animation: live-pulse 1.5s infinite;
}

@keyframes live-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* ============================================
   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);
}

.participant-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 500;
}

.participant-badge.host {
  background: #f1c40f;
  color: #000;
}

.participant-badge.white {
  background: #ecf0f1;
  color: #2c3e50;
}

.participant-badge.black {
  background: #2c3e50;
  color: #fff;
}

.empty-participants {
  text-align: center;
  color: var(--text-secondary);
  padding: 20px;
  font-size: 13px;
}
