/* ============================================
   POOL (당구) GAME - SPECIFIC STYLES
   Common styles are in ../css/common.css
   ============================================ */

/* Pool-specific CSS Variables */
:root {
  --table-felt: #0d5c1e;
  --table-rail: #5c3d2e;
}

body.theme-light {
  --table-felt: #0d5c1e;
  --table-rail: #5c3d2e;
}

/* ============================================
   PLAYER CARD (Pool-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);
  padding: 6px 10px;
}

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

/* Ball indicator for Pool */
.player-card .ball-indicator {
  display: flex;
  gap: 3px;
}

.player-card .ball-indicator .ball-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
}

.ball-dot.solid {
  background: linear-gradient(135deg, #ffd700 0%, #ff8c00 100%);
  box-shadow: inset -2px -2px 4px rgba(0,0,0,0.3);
}

.ball-dot.stripe {
  background: linear-gradient(135deg, #4169e1 0%, #1e90ff 100%);
  border: 2px solid white;
  box-shadow: inset -2px -2px 4px rgba(0,0,0,0.3);
}

.player-card .name {
  font-weight: bold;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.player-card .timer {
  font-family: monospace;
  font-size: 14px;
  font-weight: bold;
  background: var(--bg-primary);
  padding: 2px 6px;
  border-radius: 4px;
}

.player-card .timer.warning {
  color: var(--warning);
  animation: pulse 1s infinite;
}

.player-card .timer.danger {
  color: var(--accent);
  animation: pulse 0.5s infinite;
}

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

/* Inactive player card styling */
.player-card.inactive {
  opacity: 0.5;
  filter: grayscale(30%);
}

.player-card.inactive .name,
.player-card.inactive .rating {
  color: var(--text-secondary);
}

/* ============================================
   TURN INDICATOR
   ============================================ */

.turn-indicator {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 20px;
  border-radius: 20px;
  font-weight: bold;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 1px;
  z-index: 100;
  animation: fadeInDown 0.3s ease;
}

.turn-indicator.my-turn {
  background: linear-gradient(135deg, #4caf50, #2e7d32);
  color: white;
  box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);
}

.turn-indicator.opponent-turn {
  background: linear-gradient(135deg, #f44336, #c62828);
  color: white;
  box-shadow: 0 4px 15px rgba(244, 67, 54, 0.4);
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* Table container turn states */
.table-container.opponent-turn #game-canvas {
  cursor: not-allowed;
}

.table-container.my-turn #game-canvas {
  cursor: crosshair;
}

/* ============================================
   POOL TABLE STYLES
   ============================================ */

/* Table Container - Pool table frame */
.table-container {
  position: relative;
  background: transparent;
  padding: 0;
  border-radius: 0;
  box-shadow: none;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

#game-canvas {
  display: block;
  width: 100%;
  max-width: 1000px;
  height: auto;
  border-radius: 8px;
  cursor: crosshair;
  background: transparent;
}

/* ============================================
   SPIN CONTROL
   ============================================ */

.spin-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  /* 최대 60px, 화면 작아지면 40px까지 축소 */
  height: clamp(40px, 8vw, 60px);
  gap: clamp(6px, 2vw, 20px);
  padding: 0 clamp(8px, 2vw, 20px);
  background: var(--bg-secondary);
  border-radius: 10px;
  width: 100%;
  max-width: 800px;
  transition: opacity 0.3s ease;
}

.spin-control.disabled {
  opacity: 0.4;
  pointer-events: none;
}

.spin-label {
  font-weight: bold;
  color: var(--text-secondary);
  font-size: 14px;
}

.cue-ball-control {
  position: relative;
}

#spin-canvas {
  background: white;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

/* ============================================
   POWER METER (Enhanced 3D Design)
   ============================================ */

.power-meter {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: linear-gradient(145deg, rgba(0,0,0,0.3), rgba(0,0,0,0.1));
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.05);
}

.power-label {
  font-weight: bold;
  color: var(--text-secondary);
  font-size: 13px;
  min-width: 50px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.power-bar {
  flex: 1;
  /* 기본 20px, 화면 작아지면 14px까지 축소 */
  height: clamp(14px, 3vw, 20px);
  background: linear-gradient(180deg, #1a1a1a 0%, #2a2a2a 50%, #1a1a1a 100%);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.5), inset 0 -1px 2px rgba(255,255,255,0.05);
  position: relative;
  border: 1px solid rgba(0,0,0,0.3);
}

.power-bar::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  right: 2px;
  height: 8px;
  background: linear-gradient(180deg, rgba(255,255,255,0.08), transparent);
  border-radius: 10px 10px 0 0;
  pointer-events: none;
}

.power-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(180deg,
    #4ade80 0%,
    #22c55e 20%,
    #facc15 50%,
    #f97316 70%,
    #ef4444 90%,
    #dc2626 100%
  );
  background-size: 100% 100%;
  transition: width 0.08s ease-out;
  position: relative;
  border-radius: 10px;
  box-shadow: 0 0 10px rgba(255,150,50,0.3), inset 0 1px 2px rgba(255,255,255,0.3);
}

.power-fill::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  right: 2px;
  height: 40%;
  background: linear-gradient(180deg, rgba(255,255,255,0.4), transparent);
  border-radius: 8px 8px 0 0;
}

/* Power segments markers */
.power-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: repeating-linear-gradient(
    90deg,
    transparent 0px,
    transparent 9.5%,
    rgba(0,0,0,0.3) 9.5%,
    rgba(0,0,0,0.3) 10%
  );
  pointer-events: none;
}

.power-value {
  min-width: 48px;
  text-align: right;
  font-weight: bold;
  font-family: 'Courier New', monospace;
  font-size: 16px;
  color: #fff;
  text-shadow: 0 0 8px rgba(255,200,100,0.5);
  background: linear-gradient(180deg, rgba(0,0,0,0.3), rgba(0,0,0,0.1));
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.1);
}

/* ============================================
   BALL STATUS PANEL
   ============================================ */

.ball-status {
  padding: 15px;
  background: var(--bg-card);
  border-radius: 10px;
}

.ball-status-header {
  font-weight: bold;
  margin-bottom: 10px;
  color: var(--text-secondary);
  font-size: 14px;
  text-transform: uppercase;
}

.balls-remaining {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.ball-mini {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: bold;
  color: white;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
  box-shadow: inset -2px -2px 4px rgba(0,0,0,0.3), 0 2px 4px rgba(0,0,0,0.2);
}

.ball-mini.pocketed {
  opacity: 0.3;
}

/* Ball colors */
.ball-1 { background: linear-gradient(135deg, #ffd700 0%, #daa520 100%); }
.ball-2 { background: linear-gradient(135deg, #4169e1 0%, #1e3a8a 100%); }
.ball-3 { background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%); }
.ball-4 { background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 100%); }
.ball-5 { background: linear-gradient(135deg, #ea580c 0%, #c2410c 100%); }
.ball-6 { background: linear-gradient(135deg, #059669 0%, #047857 100%); }
.ball-7 { background: linear-gradient(135deg, #7f1d1d 0%, #450a0a 100%); }
.ball-8 { background: linear-gradient(135deg, #1f2937 0%, #111827 100%); }
.ball-9 { background: linear-gradient(135deg, #ffd700 0%, #daa520 100%); border: 3px solid white; }
.ball-10 { background: linear-gradient(135deg, #4169e1 0%, #1e3a8a 100%); border: 3px solid white; }
.ball-11 { background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%); border: 3px solid white; }
.ball-12 { background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 100%); border: 3px solid white; }
.ball-13 { background: linear-gradient(135deg, #ea580c 0%, #c2410c 100%); border: 3px solid white; }
.ball-14 { background: linear-gradient(135deg, #059669 0%, #047857 100%); border: 3px solid white; }
.ball-15 { background: linear-gradient(135deg, #7f1d1d 0%, #450a0a 100%); border: 3px solid white; }

/* ============================================
   FOUL MODAL
   ============================================ */

.foul-content {
  text-align: center;
}

.foul-reason {
  font-size: 18px;
  color: var(--warning);
  margin: 20px 0;
  padding: 15px;
  background: rgba(251, 191, 36, 0.1);
  border-radius: 8px;
}

/* ============================================
   TUTORIAL (Pool-specific)
   ============================================ */

.tutorial-content {
  min-height: 380px;
  padding: 25px;
  background: linear-gradient(180deg, rgba(26, 26, 46, 0.5) 0%, rgba(15, 15, 30, 0.8) 100%);
  border-radius: 12px;
}

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

.tutorial-step h3 {
  font-size: 26px;
  margin-bottom: 15px;
  color: var(--accent);
  text-shadow: 0 2px 10px rgba(79, 172, 254, 0.3);
}

.tutorial-step p {
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-secondary);
  margin-bottom: 20px;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

.tutorial-image {
  max-width: 420px;
  margin: 20px auto;
  background: linear-gradient(145deg, #1e1e3a 0%, #0d0d1a 100%);
  border-radius: 16px;
  padding: 15px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4),
              inset 0 1px 0 rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(79, 172, 254, 0.15);
}

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

.tutorial-caption {
  margin-top: 12px;
  font-size: 14px;
  color: #4facfe;
  font-weight: 600;
  background: linear-gradient(90deg, #4facfe, #00f2fe);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tutorial-navigation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 20px;
  margin-top: 10px;
  border-top: 1px solid rgba(79, 172, 254, 0.2);
}

.tutorial-progress {
  color: var(--text-secondary);
  font-weight: 500;
}

/* ============================================
   ANIMATIONS
   ============================================ */

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

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

/* ============================================
   RESPONSIVE - Pool-specific adjustments
   ============================================ */

@media (max-width: 600px) {
  /* Horizontal player cards */
  .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 .ball-indicator {
    flex-shrink: 0;
  }

  .player-card .ball-indicator .ball-dot {
    width: 12px;
    height: 12px;
  }

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

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

/* Extra small phones (< 380px) */
@media (max-width: 380px) {
  .player-card {
    padding: 6px 8px;
    min-width: 85px;
  }

  .player-card .name {
    font-size: 11px;
    max-width: 65px;
  }

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

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

/* ============================================
   MOBILE VERTICAL MODE - Rotate 90deg
   Flex-based layout: table fills remaining space
   ============================================ */

@media (max-width: 900px) {
  /* Hide ads on mobile game */
  .ad-container {
    display: none !important;
  }

  /* Game area fills available height, children stack vertically */
  .game-area {
    width: 100%;
    /* iOS Safari 호환: 100vh 문제 해결 */
    height: calc(100vh - 60px);
    height: calc(100dvh - 60px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    overflow: hidden;
    /* iOS 홈바 영역 확보 */
    padding-bottom: env(safe-area-inset-bottom);
    box-sizing: border-box;
  }

  /* Header and controls have fixed height */
  .game-header {
    flex-shrink: 0;
  }

  .spin-control {
    flex-shrink: 0;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    max-width: 100%;
    position: relative;
    z-index: 10;
  }

  /* Table container takes remaining space */
  .table-container {
    flex: 1;
    min-height: 0; /* Allow flex shrink */
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    overflow: visible;
    position: relative;
  }

  #game-canvas.vertical-mode {
    position: absolute;
    left: 50%;
    /* top은 JS에서 동적으로 계산 */
    top: 0;
    transform: translateX(-50%) rotate(90deg);
    transform-origin: center center;
    /* After rotation: canvas width(900) becomes visual height, canvas height(460) becomes visual width */
    /* Limit both: visual width (canvas height) by vw, visual height (canvas width) by container */
    max-height: 92vw;
    /* iOS Safari 호환 */
    max-width: calc(100vh - 200px);
    max-width: calc(100dvh - 200px);
    width: auto;
    height: auto;
  }

  .spin-label {
    display: none;
  }

  .cue-ball-control {
    flex-shrink: 0;
  }

  #spin-canvas {
    width: 40px;
    height: 40px;
  }

  .power-meter {
    flex: 1;
    padding: 4px 8px;
    gap: 6px;
  }

  .power-label {
    display: none;
  }

  .power-value {
    min-width: 40px;
    font-size: 14px;
    padding: 3px 6px;
  }
  /* Horizontal player cards */
  .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 .player-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
  }

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

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

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

@media (max-width: 600px) {
  .game-area {
    /* iOS Safari 호환 */
    height: calc(100vh + 20px);
    height: calc(100dvh + 20px);
    gap: 4px;
  }


  #spin-canvas {
    width: 36px;
    height: 36px;
  }

  .power-value {
    min-width: 36px;
    font-size: 13px;
  }
}

@media (max-width: 380px) {
  .game-area {
    /* iOS Safari 호환 */
    height: calc(100vh - 45px);
    height: calc(100dvh - 45px);
    gap: 2px;
  }

  #spin-canvas {
    width: 32px;
    height: 32px;
  }

  .power-value {
    min-width: 28px;
    font-size: 11px;
  }
}

/* ============================================
   820px 이하: 모바일 레이아웃 (common.css 규칙 적용)
   ============================================ */
@media (max-width: 820px) {
  .table-container {
    width: 100%;
    padding: 0 6px;
    box-sizing: border-box;
  }

  #game-canvas {
    width: 100%;
    max-width: 100%;
  }
}

/* ============================================
   SPEECH BUBBLE (Foul/Warning notifications)
   ============================================ */

.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: 'Noto Sans KR', 'Malgun Gothic', 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;
}

/* Warning - Yellow (Foul notifications) */
.speech-bubble.warning {
  background: linear-gradient(135deg, #fffff0 0%, #fff8dc 100%);
  border-color: #daa520;
  color: #b8860b;
  box-shadow: 4px 4px 0 #daa520, 8px 8px 20px rgba(218, 165, 32, 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, #fffff0 0%, #fff8dc 100%);
  border-color: #daa520;
}

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

/* Mobile responsive */
@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;
  }
}
