/* ============================================
   YUT NORI (윷놀이) GAME - SPECIFIC STYLES
   Common styles are in ../css/common.css
   ============================================ */

/* Yut-specific CSS Variables */
:root {
  --board-bg: #f5deb3;
  --board-line: #8b4513;
  --team1-color: #e74c3c;
  --team2-color: #3498db;
  --yut-wood: #deb887;
  --yut-dark: #8b4513;
}

body.theme-light {
  --board-bg: #f5deb3;
  --board-line: #8b4513;
}

/* ============================================
   PLAYER CARD (Game-specific layout)
   ============================================ */

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

.player-card .piece-indicator {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  flex-shrink: 0;
}

.player-card .piece-indicator.team1 {
  background: var(--team1-color);
  border: 2px solid #c0392b;
}

.player-card .piece-indicator.team2 {
  background: var(--team2-color);
  border: 2px solid #2980b9;
}

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

.player-card .pieces-info {
  font-size: 12px;
  color: var(--text-secondary);
}

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

/* ============================================
   YUT THROW AREA
   ============================================ */

/* 판 위 던지기 버튼 */
.btn-throw-on-board {
  position: absolute;
  top: 73%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 12px 25px;
  font-size: 18px;
  font-weight: bold;
  background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
  color: white;
  border: 3px solid #922b21;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  transition: all 0.2s ease;
  z-index: 100;
}

.btn-throw-on-board:hover:not(:disabled) {
  transform: translate(-50%, -50%) scale(1.08);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  background: linear-gradient(135deg, #c0392b 0%, #922b21 100%);
}

.btn-throw-on-board:disabled {
  background: linear-gradient(135deg, #7f8c8d 0%, #606060 100%);
  border-color: #505050;
  cursor: not-allowed;
  opacity: 0.5;
}

/* 결과 말풍선 */
.yut-result-bubble {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 30;
  animation: bubble-pop 0.3s ease-out;
}

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

.bubble-content {
  background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
  padding: 20px 35px;
  border-radius: 20px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
  text-align: center;
  border: 3px solid #ddd;
}

.bubble-content .result-text {
  display: block;
  font-size: 36px;
  font-weight: bold;
  color: #2c3e50;
}

.bubble-content .result-value {
  display: block;
  font-size: 18px;
  color: #7f8c8d;
  margin-top: 5px;
}

.bubble-tail {
  width: 0;
  height: 0;
  border-left: 15px solid transparent;
  border-right: 15px solid transparent;
  border-top: 20px solid #fff;
  position: absolute;
  bottom: -18px;
  left: 50%;
  transform: translateX(-50%);
  filter: drop-shadow(0 3px 3px rgba(0,0,0,0.2));
}

/* 남은 이동 표시 (판 위) */
.pending-moves-on-board {
  position: absolute;
  top: 5%;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 15;
}

.pending-moves-on-board .pending-move {
  padding: 6px 12px;
  font-size: 14px;
  font-weight: bold;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.yut-area, .yut-controls {
  display: none; /* 더 이상 사용 안함 */
}

.yut-sticks {
  display: flex;
  gap: 8px;
  perspective: 500px;
}

.yut-stick {
  width: 20px;
  height: 70px;
  background: linear-gradient(90deg, var(--yut-wood) 0%, #c4a56a 50%, var(--yut-wood) 100%);
  border-radius: 4px;
  position: relative;
  transition: transform 0.5s ease;
  box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.3);
}

.yut-stick.flat {
  background: linear-gradient(90deg, #8b4513 0%, #a0522d 50%, #8b4513 100%);
}

.yut-stick.throwing {
  animation: yut-throw-3d 1s ease-in-out;
}

@keyframes yut-throw-3d {
  0% {
    transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg) translateY(0);
  }
  20% {
    transform: rotateX(180deg) rotateY(45deg) rotateZ(30deg) translateY(-60px) scale(1.1);
  }
  40% {
    transform: rotateX(360deg) rotateY(90deg) rotateZ(-20deg) translateY(-80px) scale(1.15);
  }
  60% {
    transform: rotateX(540deg) rotateY(135deg) rotateZ(15deg) translateY(-50px) scale(1.1);
  }
  80% {
    transform: rotateX(680deg) rotateY(170deg) rotateZ(-5deg) translateY(-20px) scale(1.05);
  }
  100% {
    transform: rotateX(720deg) rotateY(180deg) rotateZ(0deg) translateY(0) scale(1);
  }
}

.yut-result {
  font-size: 20px;
  font-weight: bold;
  color: var(--accent);
  min-height: 28px;
  text-align: center;
}

.btn-throw {
  padding: 10px 25px;
  font-size: 14px;
  font-weight: bold;
}

.btn-throw:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Pending Moves */
.pending-moves {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 5px;
}

.pending-move {
  padding: 6px 14px;
  background: var(--bg-secondary);
  border-radius: 6px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 13px;
  border: 2px solid transparent;
}

.pending-move:hover {
  background: var(--accent);
  transform: scale(1.05);
}

.pending-move.selected {
  border-color: #f1c40f;
  box-shadow: 0 0 10px rgba(241, 196, 15, 0.5);
}

.pending-move.highlight {
  animation: pulse-highlight 0.8s ease-in-out infinite;
  border-color: #f1c40f;
}

@keyframes pulse-highlight {
  0%, 100% { transform: scale(1); box-shadow: 0 0 5px rgba(241, 196, 15, 0.5); }
  50% { transform: scale(1.05); box-shadow: 0 0 15px rgba(241, 196, 15, 0.8); }
}

.pending-move.do { color: #95a5a6; }
.pending-move.gae { color: #3498db; }
.pending-move.geol { color: #2ecc71; }
.pending-move.yut { color: #f39c12; }
.pending-move.mo { color: #e74c3c; }
.pending-move.backDo { color: #9b59b6; }

/* ============================================
   GAME BOARD - TOP-DOWN VIEW
   ============================================ */

.board-container {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px 0;
  min-height: 500px;
}

.board-3d-wrapper {
  position: relative;
}

#game-board {
  background: linear-gradient(135deg, #e8d4b8 0%, #d4a574 50%, #c4956a 100%);
  border-radius: 8px;
  box-shadow:
    0 15px 35px rgba(0, 0, 0, 0.3),
    0 30px 60px rgba(0, 0, 0, 0.15),
    inset 0 2px 10px rgba(255, 255, 255, 0.1);
  cursor: pointer;
  border: 6px solid #8b5a2b;
}

/* 대기 말 영역 */
.waiting-pieces {
  position: absolute;
  display: flex;
  flex-direction: column;
  gap: clamp(5px, 0.5vw, 8px);
  padding: clamp(8px, 1vw, 12px);
  background: linear-gradient(145deg, #3a3a4a 0%, #2a2a35 50%, #252530 100%);
  border-radius: 12px;
  z-index: 10;
  border: 2px solid rgba(255, 255, 255, 0.1);
  box-shadow:
    0 8px 20px rgba(0, 0, 0, 0.4),
    0 4px 8px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    inset 0 -2px 5px rgba(0, 0, 0, 0.2);
}

.waiting-pieces.player1 {
  top: 50%;
  transform: translateY(-50%);
  /* 기본 위치: 오른쪽 */
  right: clamp(-80px, calc(-4vw - 20px), -40px);
  left: auto;
}

.waiting-pieces.player2 {
  top: 50%;
  transform: translateY(-50%);
  /* 기본 위치: 왼쪽 */
  left: clamp(-80px, calc(-4vw - 20px), -40px);
  right: auto;
}

/* 위치 클래스 - 게스트(P2)일 때 동적으로 swap */
.waiting-pieces.player1.player2-pos {
  /* P1 컨테이너를 왼쪽으로 이동 */
  left: clamp(-80px, calc(-4vw - 20px), -40px);
  right: auto;
}

.waiting-pieces.player2.player1-pos {
  /* P2 컨테이너를 오른쪽으로 이동 */
  right: clamp(-80px, calc(-4vw - 20px), -40px);
  left: auto;
}

.waiting-piece {
  /* clamp로 대기말 크기도 유동적으로 (넓을때 48px, 좁을때 38px) */
  width: clamp(38px, calc(28px + 1.5vw), 48px);
  height: clamp(38px, calc(28px + 1.5vw), 48px);
  cursor: pointer;
  transition: transform 0.2s, width 0.2s, height 0.2s;
}

.waiting-piece:hover {
  transform: scale(1.15);
}

.waiting-piece.selected {
  filter: drop-shadow(0 0 8px #f1c40f);
  transform: scale(1.2);
}

.waiting-piece.finished {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  opacity: 0.7;
  cursor: default;
  background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
}

.waiting-label {
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.7);
  text-align: center;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* 골인 영역 */
.finish-area {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  padding: 6px 12px;
  background: rgba(46, 204, 113, 0.3);
  border: 2px solid #2ecc71;
  border-radius: 15px;
  z-index: 10;
}

.finish-area .piece {
  width: 24px;
  height: 24px;
  border-radius: 50%;
}

/* ============================================
   TUTORIAL
   ============================================ */

.tutorial-content {
  min-height: 350px;
  padding: 20px;
}

.tutorial-step {
  text-align: center;
}

.tutorial-step.hidden {
  display: none;
}

.tutorial-step h3 {
  font-size: 24px;
  margin-bottom: 20px;
  color: var(--accent);
}

.tutorial-step p {
  font-size: 16px;
  line-height: 1.8;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.tutorial-image {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin: 20px auto;
  padding: 15px;
  background: var(--bg-card);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.tutorial-image canvas {
  border-radius: 6px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.yut-results-list {
  text-align: left;
  list-style: none;
  padding: 0;
  margin: 15px auto;
  max-width: 400px;
}

.yut-results-list li {
  padding: 10px 15px;
  margin: 6px 0;
  background: var(--bg-secondary);
  border-radius: 8px;
  font-size: 14px;
  display: flex;
  justify-content: space-between;
}

.yut-results-list li strong {
  color: var(--accent);
}

.tutorial-tips {
  text-align: left;
  margin-top: 20px;
}

.tutorial-tips .tip {
  padding: 12px 15px;
  margin: 10px 0;
  background: var(--bg-secondary);
  border-radius: 8px;
  font-size: 14px;
  color: var(--text-secondary);
  border-left: 4px solid var(--accent);
}

.tutorial-navigation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 20px;
  border-top: 1px solid var(--bg-card);
}

.tutorial-progress {
  color: var(--text-secondary);
  font-size: 14px;
}

/* ============================================
   GAME RESULT
   ============================================ */

.game-result {
  text-align: center;
  padding: 20px;
}

.game-result .result-icon {
  font-size: 48px;
  margin-bottom: 15px;
}

.game-result .result-text {
  font-size: 28px;
  font-weight: bold;
  margin-bottom: 10px;
}

.game-result .result-text.win {
  color: var(--success);
}

.game-result .result-text.lose {
  color: var(--accent);
}

.rating-change {
  font-size: 18px;
  font-weight: bold;
  padding: 8px 16px;
  border-radius: 20px;
  display: inline-block;
  margin-top: 10px;
}

.rating-change.positive {
  background: rgba(46, 204, 113, 0.2);
  color: #2ecc71;
}

.rating-change.negative {
  background: rgba(231, 76, 60, 0.2);
  color: #e74c3c;
}

/* ============================================
   RANKING
   ============================================ */

.ranking-item {
  display: flex;
  align-items: center;
  padding: 12px 15px;
  background: var(--bg-secondary);
  border-radius: 8px;
  margin-bottom: 8px;
}

.ranking-item .rank {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  margin-right: 12px;
  background: var(--bg-card);
}

.ranking-item .rank.gold {
  background: linear-gradient(135deg, #f1c40f, #f39c12);
  color: #000;
}

.ranking-item .rank.silver {
  background: linear-gradient(135deg, #bdc3c7, #95a5a6);
  color: #000;
}

.ranking-item .rank.bronze {
  background: linear-gradient(135deg, #cd6133, #a0522d);
  color: #fff;
}

.ranking-item .name {
  flex: 1;
  font-weight: 500;
}

.ranking-item .rating {
  color: var(--warning);
  font-weight: bold;
}

/* ============================================
   CHAT
   ============================================ */

.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-weight: bold;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  margin-bottom: 8px;
  color: #ccc;
  font-size: 14px;
}

.participant-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.participant-item {
  display: flex;
  align-items: center;
  padding: 10px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  gap: 10px;
}

.participant-item.current-turn {
  background: rgba(108, 92, 231, 0.3);
  border: 1px solid rgba(108, 92, 231, 0.5);
}

.participant-item.waiting {
  opacity: 0.6;
  font-style: italic;
}

.participant-avatar {
  font-size: 24px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.participant-info {
  flex: 1;
}

.participant-name {
  font-weight: bold;
  color: #fff;
  font-size: 14px;
}

.participant-role {
  font-size: 12px;
  color: #aaa;
  margin-top: 2px;
}

.turn-indicator {
  font-size: 18px;
}

.empty-participants {
  text-align: center;
  color: #888;
  padding: 20px;
  font-style: italic;
}

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

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

.room-item.room-live {
  border: 2px solid #e74c3c;
  background: linear-gradient(135deg, rgba(231, 76, 60, 0.1), rgba(192, 57, 43, 0.05));
}

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

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

/* ============================================
   RESPONSIVE
   ============================================ */

/* 1160px, 1024px 대기말 미디어쿼리 제거 - clamp()로 대체됨 */

@media (max-width: 980px) {
  /* 대기말 영역을 보드 위/아래로 이동 */
  .board-container {
    flex-direction: column;
    padding: 10px;
    min-height: auto;
  }

  .board-3d-wrapper {
    order: 2;
  }

  .waiting-pieces {
    position: relative !important;
    left: auto !important;
    right: auto !important;
    top: auto !important;
    transform: none !important;
    flex-direction: row !important;
    justify-content: center;
    width: 100%;
    padding: 8px 12px;
    margin: 5px 0;
  }

  .waiting-pieces.player1 {
    order: 3;  /* 홍팀을 오른쪽으로 */
  }

  .waiting-pieces.player2 {
    order: 1;  /* 청팀을 왼쪽으로 */
  }

  .waiting-label {
    margin-bottom: 0;
    margin-right: 10px;
  }

  .waiting-piece {
    width: 40px;
    height: 40px;
  }

  /* 골인 영역도 조정 */
  .finish-area {
    position: relative;
    top: auto;
    left: auto;
    transform: none;
    margin: 5px auto;
    order: 0;
  }
}

@media (max-width: 820px) {
  .yut-area {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    padding: 10px;
  }

  .yut-sticks {
    gap: 6px;
  }

  .yut-stick {
    width: 16px;
    height: 55px;
  }

  .yut-result {
    font-size: 18px;
    min-width: 80px;
  }

  .btn-throw {
    padding: 8px 20px;
    font-size: 13px;
  }

  .pending-moves {
    width: 100%;
  }

  #game-board {
    max-width: calc(100vw - 40px);
  }

  .waiting-piece {
    width: 36px;
    height: 36px;
  }

  /* 결과 말풍선 위치 조정 */
  .yut-result-bubble {
    top: 40%;
  }

  /* 던지기 버튼 - 보드 위에 유지 (중앙돌 아래) */
  .btn-throw-on-board {
    position: absolute;
    top: 65%;
    bottom: auto;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 20px;
    font-size: 14px;
  }

  /* 남은 이동 표시 - 보드 위에 유지 */
  .pending-moves-on-board {
    position: absolute;
    top: 3%;
    left: 50%;
    transform: translateX(-50%);
  }

  .pending-moves-on-board .pending-move {
    padding: 4px 8px;
    font-size: 12px;
  }
}

@media (max-width: 600px) {
  .player-card {
    min-width: 110px;
    padding: 6px 8px;
  }

  .player-card .name {
    font-size: 12px;
  }

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

  .yut-stick {
    width: 14px;
    height: 50px;
  }

  .pending-move {
    padding: 5px 10px;
    font-size: 12px;
  }

  .tutorial-step h3 {
    font-size: 20px;
  }

  .tutorial-step p {
    font-size: 14px;
  }

  .yut-results-list li {
    font-size: 13px;
    padding: 8px 12px;
  }

  .waiting-piece {
    /* 모바일에서는 더 작게 */
    width: clamp(28px, calc(20px + 1.5vw), 36px);
    height: clamp(28px, calc(20px + 1.5vw), 36px);
  }

  .btn-throw-on-board {
    padding: 8px 16px;
    font-size: 14px;
    top: 65%;
    bottom: auto;
  }

  .pending-moves-on-board .pending-move {
    padding: 3px 6px;
    font-size: 11px;
  }
}

/* ============================================
   SPEECH BUBBLE (말풍선)
   ============================================ */

.speech-bubble {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  background: linear-gradient(135deg, #ffd700, #ffb347);
  color: #333;
  padding: 20px 35px;
  border-radius: 20px;
  font-size: 2em;
  font-weight: bold;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55),
              opacity 0.3s ease;
}

.speech-bubble::after {
  content: '';
  position: absolute;
  bottom: -15px;
  left: 50%;
  transform: translateX(-50%);
  border: 15px solid transparent;
  border-top-color: #ffb347;
  border-bottom: 0;
}

.speech-bubble.show {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

.speech-bubble.hide {
  transform: translate(-50%, -50%) scale(1.2);
  opacity: 0;
}

/* Capture speech bubble - exciting style */
.speech-bubble.capture {
  background: linear-gradient(135deg, #ff6b6b, #ff8e53);
  animation: bubble-bounce 0.5s ease;
}

/* Finish speech bubble */
.speech-bubble.finish {
  background: linear-gradient(135deg, #4ecdc4, #44a08d);
}

/* Win speech bubble */
.speech-bubble.win {
  background: linear-gradient(135deg, #f093fb, #f5576c);
  font-size: 2.5em;
}

@keyframes bubble-bounce {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  25% { transform: translate(-50%, -50%) scale(1.1); }
  50% { transform: translate(-50%, -50%) scale(0.95); }
  75% { transform: translate(-50%, -50%) scale(1.05); }
}

/* Emoji style */
.speech-bubble .emoji {
  font-size: 1.2em;
  margin-right: 8px;
}
