/* ============================================
   GO-STOP (고스톱) GAME - 전통 레이아웃
   ============================================ */

/* Go-Stop specific CSS Variables */
:root {
  --card-width: clamp(37px, calc((100vw - 330px) * 0.0704), 57px);
  --card-height: clamp(56px, calc((100vw - 330px) * 0.1056), 86px);
  --card-border-radius: 4px;
  --field-bg: #1a472a;
  --field-bg-dark: #0f2a18;
  --card-back: #8B0000;
  --card-back-pattern: #a00000;
  --gold: #ffd700;
  --panel-bg: rgba(0, 0, 0, 0.3);
}

body.theme-light {
  --field-bg: #2d8a4e;
  --field-bg-dark: #1a5f2a;
}

/* ============================================
   GAME BOARD - 전통 레이아웃
   ============================================ */

.board-container {
  position: relative;
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* 게임 중 모바일 광고 숨김 */
.ad-game-mobile {
  display: none !important;
}

.gostop-board {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: linear-gradient(135deg, var(--field-bg) 0%, var(--field-bg-dark) 100%);
  padding: 8px 16px;
  border-radius: 12px;
  box-shadow:
    0 5px 30px rgba(0, 0, 0, 0.5),
    inset 0 0 100px rgba(0, 0, 0, 0.3);
  min-width: auto;
  width: 100%;
  max-width: calc(100vw - 330px);
  position: relative;
  border: 2px solid rgba(255, 255, 255, 0.1);
  overflow: hidden;
  flex: 1;
  justify-content: center;
}

/* ============================================
   PLAYER ROW (플레이어 영역)
   ============================================ */

.player-row {
  display: flex;
  gap: 20px;
  align-items: stretch;
}

/* 상대 영역: 획득패(좌) + 손패(우) */
.opponent-row {
  flex-direction: row;
}

/* 내 영역: 손패(좌) + 획득패(우) */
.my-row {
  flex-direction: row;
}

/* ============================================
   HAND AREA (손패 영역) - 2줄
   ============================================ */

.hand-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  padding: 6px;
}

.hand-area .cards-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
}

/* 상대 손패 - 뒷면, 겹침 */
.opponent-hand .cards-row {
  gap: 0;
}

.opponent-hand .card {
  margin-left: -15px;
}

.opponent-hand .card:first-child {
  margin-left: 0;
}

/* 내 손패 - 2줄 배치 (5x2) */
.my-hand {
  border: 1px solid rgba(255, 215, 0, 0.3);
}

.my-hand .cards-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  max-width: calc(var(--card-width) * 5 + 16px);
}

.my-hand .cards-row .card {
  width: var(--card-width);
  height: var(--card-height);
}

/* ============================================
   CAPTURED AREA (획득패) - 전통 스타일
   ============================================ */

.captured-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 8px;
  padding: 4px;
  overflow: hidden;
  /* 기본 2줄, 넘치면 3줄까지 자동 확장 */
  min-height: calc(var(--card-height) * 2 + 20px);
  height: auto;
  max-height: calc(var(--card-height) * 3 + 30px);
}

.captured-traditional {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  align-content: flex-start;
  gap: 4px;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* 상대 획득패 - 역순 (피-띠-열끗-광) */
.opponent-captured .captured-traditional {
  direction: rtl;
}

.opponent-captured .captured-group {
  direction: ltr;
}

/* 내 획득패 - 정순 (광-열끗-띠-피) */
.my-captured .captured-traditional {
  direction: ltr;
}

/* 획득패 그룹 (광/열끗/띠/피) - 각 그룹 구분 */
.captured-group {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  padding: 2px 4px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.2);
  border-left: 2px solid rgba(255, 255, 255, 0.2);
  flex: 0 0 auto;
}

/* 그룹별 테두리 색상 */
.captured-group.captured-gwang {
  border-left-color: var(--gold);
  background: rgba(255, 215, 0, 0.15);
}

.captured-group.captured-animal {
  border-left-color: #ff6b6b;
  background: rgba(255, 107, 107, 0.15);
}

.captured-group.captured-ribbon {
  border-left-color: #4ecdc4;
  background: rgba(78, 205, 196, 0.15);
}

.captured-group.captured-junk {
  border-left-color: #95a5a6;
  background: rgba(149, 165, 166, 0.15);
}

/* 겹침 스타일 - 더 많이 겹침 */
.captured-group .card {
  margin-left: -30px;
  margin-top: 0;
  transition: transform 0.2s;
  flex-shrink: 0;
}

.captured-group .card:first-child {
  margin-left: 0;
}

.captured-group .card:hover {
  transform: translateY(-3px) scale(1.05);
  z-index: 10;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

/* 획득패 카드 크기 */
.captured-area .card {
  width: var(--card-width);
  height: var(--card-height);
}

/* 2줄 레이아웃용 row 스타일 */
.captured-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 4px;
  width: 100%;
  height: 50%;
}

.captured-row .captured-group {
  flex: 0 0 auto;
}

.captured-row .captured-group .card {
  margin-left: -30px;
}

.captured-row .captured-group .card:first-child {
  margin-left: 0;
}

.captured-traditional.double-row {
  flex-direction: column;
  flex-wrap: nowrap;
  justify-content: space-around;
}

/* 카드가 많을 때 - 더 많이 겹침 */
.captured-traditional.many-cards .captured-group .card {
  margin-left: -35px;
}

/* 카드가 아주 많을 때 - 더욱 많이 겹침 */
.captured-traditional.very-many-cards .captured-group .card {
  margin-left: -40px;
}

/* ============================================
   FIELD ROW (바닥 영역) - 2x2 + 덱 + 2x2
   ============================================ */

.field-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(8px, 2vw, 30px);
  padding: 10px 20px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 8px;
}

.field-group {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: calc(var(--card-width) * 2 + 8px);
  max-height: calc(var(--card-height) * 2 + 8px);
  overflow: visible;
  flex-shrink: 0;
}

.field-group .card {
  width: var(--card-width);
  height: var(--card-height);
  flex-shrink: 0;
}

/* 카드가 4장 초과시 겹침 */
.field-group .card:nth-child(n+5) {
  margin-left: calc(var(--card-width) * -0.7);
}

/* 덱 영역 */
.deck-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.deck {
  position: relative;
  cursor: pointer;
  transition: transform 0.2s;
}

.deck:hover {
  transform: scale(1.05);
}

/* 손패가 없을 때 덱 클릭 가능 표시 */
.deck.clickable {
  animation: deckPulse 1s ease-in-out infinite;
}

@keyframes deckPulse {
  0%, 100% { box-shadow: 0 0 10px rgba(255, 215, 0, 0.5); }
  50% { box-shadow: 0 0 25px rgba(255, 215, 0, 0.9); }
}

.deck::before,
.deck::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  background: var(--card-back);
  border-radius: var(--card-border-radius);
  z-index: -1;
}

.deck::before {
  top: 2px;
  left: 2px;
  opacity: 0.8;
}

.deck::after {
  top: 4px;
  left: 4px;
  opacity: 0.6;
}

.deck-count {
  position: absolute;
  bottom: -22px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: bold;
}

.flipped-card {
  min-width: var(--card-width);
  min-height: var(--card-height);
}

/* ============================================
   GAME INFO INLINE (바닥 영역 우측)
   ============================================ */

/* 점수 표시 영역 */
.score-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(3px, 1vw, 8px) clamp(6px, 1.5vw, 12px);
  background: rgba(0, 0, 0, 0.5);
  border-radius: 8px;
  min-width: clamp(38px, 6vw, 60px);
  flex-shrink: 1;
}

.score-display .score-label {
  font-size: clamp(7px, 1.2vw, 10px);
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 2px;
}

.score-display .score-value {
  font-size: clamp(12px, 2.2vw, 20px);
  font-weight: bold;
  color: var(--gold);
}

.opponent-score-display {
  border: 1px solid rgba(255, 100, 100, 0.4);
}

.opponent-score-display .score-value {
  color: #ff6b6b;
}

.my-score-display {
  border: 1px solid rgba(100, 200, 255, 0.4);
}

.my-score-display .score-value {
  color: #64c8ff;
}

/* 고/배수 정보 영역 */
.game-info-inline {
  display: flex;
  flex-direction: column;
  gap: clamp(2px, 0.8vw, 8px);
  padding: clamp(4px, 1vw, 10px) clamp(6px, 1.5vw, 15px);
  background: rgba(0, 0, 0, 0.4);
  border-radius: 8px;
  border: 1px solid rgba(255, 215, 0, 0.3);
  flex-shrink: 1;
}

.go-info-box {
  display: flex;
  flex-direction: column;
  gap: clamp(2px, 0.6vw, 6px);
}

.go-info-row {
  display: flex;
  align-items: center;
  gap: clamp(4px, 0.8vw, 8px);
}

.go-info-row .go-label {
  font-size: clamp(7px, 1.1vw, 10px);
  color: rgba(255, 255, 255, 0.6);
  min-width: clamp(14px, 2.5vw, 25px);
}

.go-info-row .go-value {
  font-size: clamp(10px, 1.5vw, 14px);
  font-weight: bold;
  color: var(--gold);
}

.go-info-row .go-multiplier {
  font-size: clamp(8px, 1.3vw, 12px);
  color: #ff9500;
  font-weight: bold;
}

.game-info-inline .special-status {
  font-size: 11px;
  padding: 4px 8px;
}

/* ============================================
   BOMB/SHAKE CONTAINER
   ============================================ */

/* ============================================
   SCORE DISPLAY ON CAPTURED AREA
   ============================================ */

.captured-area .score-badge {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.7);
  color: var(--gold);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: bold;
  white-space: nowrap;
}

.opponent-captured .score-badge {
  color: #ff6b6b;
}

/* ============================================
   HWATU CARDS (화투 카드) - 새 디자인
   ============================================ */

.card {
  width: var(--card-width);
  height: var(--card-height);
  border-radius: var(--card-border-radius);
  background: #fff;
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 0;
  overflow: hidden;
  user-select: none;
}

.card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow:
    0 12px 20px rgba(0, 0, 0, 0.4),
    0 0 0 2px rgba(255, 215, 0, 0.5);
  z-index: 10;
}

.card.selected {
  transform: translateY(-12px) scale(1.05);
  box-shadow:
    0 15px 30px rgba(233, 69, 96, 0.5),
    0 0 0 3px var(--accent);
}

.card.disabled {
  opacity: 0.5;
  pointer-events: none;
}

.card.matching {
  animation: cardGlow 0.5s ease-in-out infinite alternate;
}

@keyframes cardGlow {
  from { box-shadow: 0 0 5px var(--gold); }
  to { box-shadow: 0 0 20px var(--gold), 0 0 30px var(--gold); }
}

/* Card Back (뒷면) */
.card.card-back {
  background: url('/gostop/images/back.png') center/cover no-repeat;
  border: 2px solid #600;
  cursor: default;
}

.card.card-back::before {
  display: none;
}

.card.card-back::after {
  display: none;
}

/* Card Content */
.card-month {
  position: absolute;
  top: 2px;
  left: 2px;
  font-size: 9px;
  font-weight: bold;
  color: #333;
  background: rgba(255, 255, 255, 0.9);
  padding: 1px 3px;
  border-radius: 2px;
  line-height: 1;
}

.card-image {
  font-size: 28px;
  line-height: 1;
  margin-top: 8px;
}

/* 스프라이트 시트 기반 카드 이미지 */
.card-sprite {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-repeat: no-repeat;
  border-radius: var(--card-border-radius);
}

/* 개별 카드 이미지 파일 */
.card-image-file {
  width: 100%;
  height: 100%;
  object-fit: fill;
  border-radius: var(--card-border-radius);
  pointer-events: none;
}

/* 광 배지 */
.card-badge {
  position: absolute;
  font-size: 10px;
  font-weight: bold;
  padding: 2px 4px;
  border-radius: 3px;
  z-index: 2;
}

.gwang-badge {
  top: 2px;
  right: 2px;
  background: linear-gradient(135deg, var(--gold), #ffed4a);
  color: #8B4513;
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.5);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.card-type {
  position: absolute;
  bottom: 2px;
  font-size: 8px;
  font-weight: bold;
  padding: 1px 4px;
  border-radius: 2px;
  text-transform: uppercase;
}

.card-type.gwang {
  background: linear-gradient(135deg, var(--gold), #ffed4a);
  color: #333;
}

.card-type.animal {
  background: linear-gradient(135deg, #ff6b6b, #ee5a5a);
  color: #fff;
}

.card-type.ribbon {
  background: linear-gradient(135deg, #4ecdc4, #44a3a0);
  color: #fff;
}

.card-type.junk {
  background: linear-gradient(135deg, #95a5a6, #7f8c8d);
  color: #fff;
}

/* Month-specific card backgrounds - disabled for image cards */
/*
.card[data-month="1"] { background: linear-gradient(180deg, #e8f5e9 0%, #c8e6c9 100%); }
...
*/

/* Gwang (광) cards special styling */
.card[data-type="gwang"] {
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.3),
    0 0 15px rgba(255, 215, 0, 0.4),
    inset 0 0 20px rgba(255, 215, 0, 0.1);
  border: 2px solid var(--gold);
}

.card[data-type="gwang"]::before {
  content: '★';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 50px;
  color: rgba(255, 215, 0, 0.15);
  z-index: 0;
  pointer-events: none;
}


/* ============================================
   GAME LOG
   ============================================ */

.game-log-container {
  max-height: 150px;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  padding: 10px;
  margin-top: 10px;
}

.log-entry {
  font-size: 12px;
  padding: 5px 8px;
  margin-bottom: 3px;
  color: rgba(255, 255, 255, 0.8);
  background: var(--panel-bg);
  border-radius: 4px;
  border-left: 3px solid transparent;
}

.log-entry.go {
  color: var(--success);
  border-left-color: var(--success);
}

.log-entry.stop {
  color: var(--accent);
  border-left-color: var(--accent);
}

.log-entry.match {
  color: var(--warning);
  border-left-color: var(--warning);
}

.log-entry.special {
  color: #ff6b35;
  border-left-color: #ff6b35;
  background: rgba(255, 107, 53, 0.1);
  font-weight: bold;
}

/* ============================================
   SPECIAL STATUS (흔들기/고 상태)
   ============================================ */

.special-status {
  background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
  color: white;
  padding: 6px 12px;
  border-radius: 15px;
  font-weight: bold;
  font-size: 12px;
  animation: pulse 1.5s ease-in-out infinite;
}

.go-count-status {
  background: var(--panel-bg);
  color: rgba(255, 255, 255, 0.8);
  padding: 4px 10px;
  border-radius: 10px;
  font-size: 11px;
}

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

/* ============================================
   SPECIAL EFFECTS
   ============================================ */

.special-effect {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 42px;
  font-weight: bold;
  color: #ff6b35;
  text-shadow:
    0 0 20px rgba(255, 107, 53, 0.8),
    0 0 40px rgba(255, 107, 53, 0.6),
    2px 2px 4px rgba(0, 0, 0, 0.5);
  animation: specialEffect 1.5s ease-out forwards;
  z-index: 1000;
  pointer-events: none;
}

@keyframes specialEffect {
  0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
  20% { transform: translate(-50%, -50%) scale(1.3); opacity: 1; }
  80% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1.2); opacity: 0; }
}

/* Card animations */
@keyframes sweep {
  0% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.1); }
  100% { opacity: 0; transform: scale(0.8) translateY(50px); }
}

.card.sweeping {
  animation: sweep 0.5s ease-out forwards;
}

@keyframes bomb {
  0% { transform: scale(1); }
  50% { transform: scale(1.5); opacity: 0.5; }
  100% { transform: scale(1); opacity: 1; }
}

.bomb-effect {
  animation: bomb 0.5s ease-out;
}

/* 카드 뒤집기 애니메이션 */
@keyframes flipCard {
  0% { transform: rotateY(180deg) scale(0.8); }
  50% { transform: rotateY(90deg) scale(1.1); }
  100% { transform: rotateY(0deg) scale(1); }
}

.card.flipping {
  animation: flipCard 0.5s ease-out forwards;
  transform-style: preserve-3d;
}

/* 카드 내려놓기 애니메이션 */
@keyframes playCard {
  0% { transform: translateY(-100px) scale(0.5); opacity: 0; }
  60% { transform: translateY(10px) scale(1.1); opacity: 1; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

.card.playing {
  animation: playCard 0.4s ease-out forwards;
}

/* 카드 매칭 애니메이션 */
@keyframes matchCard {
  0% { transform: scale(1); box-shadow: 0 0 0 rgba(255, 215, 0, 0); }
  50% { transform: scale(1.2); box-shadow: 0 0 30px rgba(255, 215, 0, 0.8); }
  100% { transform: scale(0); opacity: 0; }
}

.card.matching-capture {
  animation: matchCard 0.6s ease-out forwards;
}

/* 카드 획득 이동 애니메이션 */
@keyframes captureCard {
  0% { transform: translate(0, 0) scale(1); opacity: 1; }
  100% { transform: translate(var(--capture-x, -200px), var(--capture-y, 100px)) scale(0.5); opacity: 0.5; }
}

.card.capturing {
  animation: captureCard 0.5s ease-in-out forwards;
}

/* 덱에서 카드 뽑기 애니메이션 */
@keyframes drawFromDeck {
  0% { transform: translateX(0) rotateY(180deg); opacity: 0.8; }
  100% { transform: translateX(80px) rotateY(0deg); opacity: 1; }
}

.card.drawing {
  animation: drawFromDeck 0.4s ease-out forwards;
}

/* 카드 등장 애니메이션 (손패) - JS에서 직접 적용 */
@keyframes dealCard {
  0% { transform: translateY(-50px) rotate(-10deg); opacity: 0; }
  100% { transform: translateY(0) rotate(0deg); opacity: 1; }
}

.card.dealing {
  animation: dealCard 0.3s ease-out backwards;
}

/* 쓸 (Sweep) 특수 효과 */
@keyframes sweepFlash {
  0% { background: rgba(255, 215, 0, 0); }
  50% { background: rgba(255, 215, 0, 0.3); }
  100% { background: rgba(255, 215, 0, 0); }
}

.field-area.sweep-effect {
  animation: sweepFlash 0.5s ease-out;
}

/* 고 외침 애니메이션 */
@keyframes goCallEffect {
  0% { transform: scale(0.5); opacity: 0; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

.go-call {
  animation: goCallEffect 0.5s ease-out;
}

/* 획득 카드 영역 애니메이션 */
@keyframes capturingIn {
  0% { transform: scale(1.5) rotate(10deg); opacity: 0; }
  50% { transform: scale(1.1) rotate(-5deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.card.capturing-in {
  animation: capturingIn 0.4s ease-out forwards;
}

/* 턴 변경 표시 애니메이션 */
@keyframes turnIndicator {
  0% { opacity: 0; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.1); }
  100% { opacity: 1; transform: scale(1); }
}

.player-card.active {
  animation: turnIndicator 0.3s ease-out;
}

/* ============================================
   GO-STOP MODAL
   ============================================ */

.gostop-choice {
  text-align: center;
}

.gostop-choice p {
  color: var(--text-secondary);
  margin-bottom: 10px;
}

#gostop-score-info {
  font-size: 24px;
  color: var(--warning);
  font-weight: bold;
}

#gostop-go-count {
  font-size: 16px;
  color: var(--success);
}

/* ============================================
   GAME OVER MODAL
   ============================================ */

.final-score {
  font-size: 48px;
  font-weight: bold;
  color: var(--warning);
  margin: 20px 0;
}

.yaku-summary {
  background: var(--bg-card);
  padding: 15px;
  border-radius: 10px;
  margin-bottom: 20px;
  text-align: left;
}

.yaku-summary-item {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  border-bottom: 1px solid var(--bg-primary);
}

.yaku-summary-item:last-child {
  border-bottom: none;
}

.yaku-summary-item .yaku-name {
  color: var(--text-primary);
}

.yaku-summary-item .yaku-points {
  color: var(--success);
  font-weight: bold;
}

.penalty-divider {
  margin: 10px 0;
  padding: 5px 0;
  border-top: 1px dashed var(--bg-primary);
  color: var(--accent);
  font-weight: bold;
  text-align: center;
}

.yaku-summary-item.penalty {
  background: rgba(255, 107, 53, 0.1);
  border-radius: 5px;
  padding: 5px 8px;
  margin: 2px 0;
}

.yaku-summary-item.penalty .yaku-name,
.yaku-summary-item.penalty .yaku-points {
  color: var(--accent);
}

.total-multiplier {
  margin-top: 10px;
  padding: 10px;
  background: linear-gradient(135deg, var(--warning) 0%, #ff9800 100%);
  color: #000;
  font-weight: bold;
  font-size: 16px;
  text-align: center;
  border-radius: 8px;
}

/* ============================================
   RESPONSIVE - 850px (고/점수 표시 축소)
   ============================================ */

@media (max-width: 850px) {
  .field-row {
    gap: 10px;
    padding: 8px 10px;
  }
}

/* ============================================
   RESPONSIVE - Tablet (900px)
   ============================================ */

@media (max-width: 900px) {
  :root {
    --card-width: 42px;
    --card-height: 63px;
  }

  .gostop-board {
    padding: 8px;
    gap: 5px;
    min-width: auto;
  }

  .my-hand .cards-row {
    max-width: 240px;
  }

  .captured-group .card {
    margin-left: -20px;
  }

  .captured-row {
    height: 50%;
    gap: 2px;
  }

  .captured-row .card {
    margin-left: -18px;
  }

  .captured-row .card:first-child {
    margin-left: 0;
  }
}

/* ============================================
   RESPONSIVE - Mobile (700px)
   통일 레이아웃 (웹/모바일 동일)
   ============================================ */

@media (max-width: 700px) {
  :root {
    --card-width: 34px;
    --card-height: 51px;
  }

  .gostop-board {
    padding: 5px;
    gap: 4px;
    min-width: auto;
    max-width: 100%;
  }

  .player-row {
    gap: 4px;
  }

  /* 손패 영역 */
  .hand-area {
    flex: 1.5;
    padding: 4px;
  }

  .my-hand .cards-row {
    gap: 2px;
    max-width: 200px;
  }

  /* 상대 손패 */
  .opponent-hand .card {
    margin-left: -14px;
  }

  /* 획득패 영역 */
  .captured-area {
    flex: 1;
    padding: 2px;
    min-height: calc(var(--card-height) + 6px);
  }

  .captured-traditional {
    gap: 2px;
  }

  .captured-group {
    padding: 1px 2px;
  }

  .captured-group .card {
    margin-left: -24px;
  }

  .captured-traditional.many-cards .captured-group .card {
    margin-left: -28px;
  }

  .captured-traditional.very-many-cards .captured-group .card {
    margin-left: -30px;
  }

  .captured-row {
    height: 50%;
    gap: 2px;
  }

  .captured-row .card {
    margin-left: -20px;
  }

  .captured-row .card:first-child {
    margin-left: 0;
  }

  /* 바닥 영역 */
  .field-row {
    gap: 8px;
    padding: 5px;
  }

  .field-group {
    gap: 2px;
  }

  /* 덱 */
  .deck .card {
    width: var(--card-width);
    height: var(--card-height);
  }

  .deck-count {
    font-size: 8px;
    bottom: -14px;
  }

  .flipped-card {
    min-width: var(--card-width);
    min-height: var(--card-height);
  }

  .flipped-card .card {
    width: var(--card-width);
    height: var(--card-height);
  }

  /* 게임 정보 인라인 */
  .game-info-inline {
    padding: 3px 6px;
    gap: 2px;
  }

  .game-info-inline .info-value {
    font-size: 11px;
  }

  .game-info-inline .info-label {
    font-size: 7px;
  }

  .game-log-container {
    display: none;
  }
}

/* ============================================
   RESPONSIVE - Small Mobile (480px)
   ============================================ */

@media (max-width: 480px) {
  :root {
    --card-width: 28px;
    --card-height: 42px;
  }

  .gostop-board {
    padding: 4px;
    gap: 3px;
    min-width: auto;
    max-width: 100%;
  }

  .player-row {
    gap: 3px;
  }

  /* 손패 영역 */
  .hand-area {
    flex: 1.5;
    padding: 3px;
  }

  .my-hand .cards-row {
    gap: 2px;
    max-width: 160px;
  }

  /* 상대 손패 */
  .opponent-hand .card {
    margin-left: -12px;
  }

  /* 획득패 영역 */
  .captured-area {
    flex: 1;
    padding: 2px;
    min-height: calc(var(--card-height) + 4px);
  }

  .captured-traditional {
    gap: 2px;
  }

  .captured-group {
    padding: 1px;
  }

  .captured-group .card {
    margin-left: -20px;
  }

  .captured-traditional.many-cards .captured-group .card {
    margin-left: -22px;
  }

  .captured-traditional.very-many-cards .captured-group .card {
    margin-left: -24px;
  }

  .captured-row {
    height: 50%;
    gap: 2px;
  }

  .captured-row .card {
    margin-left: -16px;
  }

  .captured-row .card:first-child {
    margin-left: 0;
  }

  /* 바닥 영역 */
  .field-row {
    gap: 5px;
    padding: 4px;
  }

  .field-group {
    gap: 2px;
  }

  /* 덱 */
  .deck .card {
    width: var(--card-width);
    height: var(--card-height);
  }

  .deck-count {
    font-size: 7px;
    bottom: -12px;
  }

  .flipped-card {
    min-width: var(--card-width);
    min-height: var(--card-height);
  }

  .flipped-card .card {
    width: var(--card-width);
    height: var(--card-height);
  }

  /* 점수 표시 */
  .score-display {
    padding: 4px 6px;
    min-width: 40px;
  }

  .score-display .score-label {
    font-size: 8px;
  }

  .score-display .score-value {
    font-size: 14px;
  }

  /* 게임 정보 인라인 */
  .game-info-inline {
    padding: 2px 5px;
    gap: 2px;
  }

  .go-info-row .go-label {
    font-size: 8px;
    min-width: 20px;
  }

  .go-info-row .go-value {
    font-size: 10px;
  }

  .go-info-row .go-multiplier {
    font-size: 9px;
  }

  /* 게임 컨트롤 버튼 */
  .game-controls {
    padding: 3px;
    gap: 4px;
  }

  .game-controls .btn {
    padding: 6px 8px;
    font-size: 11px;
  }
}

/* ============================================
   RESPONSIVE - Extra Small (380px)
   ============================================ */

@media (max-width: 380px) {
  :root {
    --card-width: 24px;
    --card-height: 36px;
  }

  .gostop-board {
    padding: 3px;
    gap: 2px;
  }

  .player-row {
    gap: 2px;
  }

  .hand-area {
    padding: 2px;
  }

  .my-hand .cards-row {
    gap: 1px;
    max-width: 140px;
  }

  .opponent-hand .card {
    margin-left: -10px;
  }

  /* 획득패 영역 - 손패/깔린패와 동일 크기, 2층 구조 */
  .captured-area {
    padding: 2px;
    min-height: calc(var(--card-height) * 2 + 4px);
  }

  .captured-traditional {
    gap: 2px 4px;
  }

  .captured-group {
    padding: 1px 2px;
    border-left-width: 1px;
  }

  .captured-area .card {
    width: var(--card-width);
    height: var(--card-height);
  }

  .captured-group .card {
    margin-left: -16px;
  }

  .captured-traditional.many-cards .captured-group .card {
    margin-left: -18px;
  }

  .captured-traditional.very-many-cards .captured-group .card {
    margin-left: -20px;
  }

  .captured-row {
    height: 50%;
    gap: 2px;
  }

  .captured-row .card {
    margin-left: -14px;
  }

  .captured-row .card:first-child {
    margin-left: 0;
  }

  .field-row {
    gap: 4px;
    padding: 3px;
  }

  .field-group {
    gap: 1px;
  }

  .deck .card {
    width: var(--card-width);
    height: var(--card-height);
  }

  .flipped-card {
    min-width: var(--card-width);
    min-height: var(--card-height);
  }

  .flipped-card .card {
    width: var(--card-width);
    height: var(--card-height);
  }

  /* 점수 표시 - 초소형 */
  .score-display {
    padding: 2px 4px;
    min-width: 30px;
  }

  .score-display .score-label {
    font-size: 7px;
  }

  .score-display .score-value {
    font-size: 12px;
  }

  .game-info-inline {
    padding: 2px 4px;
    gap: 1px;
  }

  .go-info-row .go-label {
    font-size: 7px;
    min-width: 16px;
  }

  .go-info-row .go-value {
    font-size: 9px;
  }

  .go-info-row .go-multiplier {
    font-size: 8px;
  }

  .game-controls .btn {
    padding: 5px 6px;
    font-size: 10px;
  }
}

/* ============================================
   ADDITIONAL EFFECTS
   ============================================ */

/* 화면 흔들림 효과 (폭탄) */
@keyframes shakeEffect {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
  20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.shake-effect {
  animation: shakeEffect 0.3s ease-in-out;
}

/* 고 외침 오버레이 */
.go-call-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  pointer-events: none;
  z-index: 2000;
}

.go-call-overlay .go-call {
  font-size: 120px;
  font-weight: bold;
  color: #ff4444;
  text-shadow:
    0 0 30px rgba(255, 68, 68, 0.9),
    0 0 60px rgba(255, 68, 68, 0.7),
    0 0 90px rgba(255, 68, 68, 0.5),
    4px 4px 8px rgba(0, 0, 0, 0.5);
  animation: goCallEffect 0.8s ease-out forwards;
}

/* 특수 효과 타입별 스타일 */
.special-effect.sweep {
  color: #ffd700;
  text-shadow:
    0 0 20px rgba(255, 215, 0, 0.9),
    0 0 40px rgba(255, 215, 0, 0.7);
}

.special-effect.bomb {
  color: #ff4444;
  font-size: 52px;
  text-shadow:
    0 0 30px rgba(255, 68, 68, 0.9),
    0 0 60px rgba(255, 68, 68, 0.7);
}

.special-effect.jjok {
  color: #4CAF50;
  text-shadow:
    0 0 20px rgba(76, 175, 80, 0.9),
    0 0 40px rgba(76, 175, 80, 0.7);
}

.special-effect.go {
  color: #ff4444;
  font-size: 60px;
  text-shadow:
    0 0 25px rgba(255, 68, 68, 0.9),
    0 0 50px rgba(255, 68, 68, 0.7);
}

/* ============================================
   BOMB/SHAKE BUTTONS (폭탄/흔들기 버튼)
   ============================================ */

.bomb-shake-container {
  display: flex;
  gap: 10px;
  justify-content: center;
  align-items: center;
  padding: 8px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 8px;
  margin: 5px auto;
  animation: bombShakeFadeIn 0.3s ease-out;
}

@keyframes bombShakeFadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.bomb-btn {
  background: linear-gradient(135deg, #ff4444 0%, #cc0000 100%) !important;
  color: white !important;
  border: 2px solid #ff6666 !important;
  font-weight: bold;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  animation: bombPulse 1.5s infinite;
}

.bomb-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 20px rgba(255, 68, 68, 0.7);
}

@keyframes bombPulse {
  0%, 100% {
    box-shadow: 0 0 5px rgba(255, 68, 68, 0.5);
  }
  50% {
    box-shadow: 0 0 20px rgba(255, 68, 68, 0.8);
  }
}

.shake-btn {
  background: linear-gradient(135deg, #ffd700 0%, #ff8c00 100%) !important;
  color: #1a1a2e !important;
  border: 2px solid #ffdd44 !important;
  font-weight: bold;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  animation: shakePulse 1.5s infinite;
}

.shake-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.7);
}

@keyframes shakePulse {
  0%, 100% {
    box-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
  }
  50% {
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
  }
}

/* 흔들기 효과 스타일 */
.special-effect.shake {
  color: #ffd700;
  font-size: 48px;
  text-shadow:
    0 0 20px rgba(255, 215, 0, 0.9),
    0 0 40px rgba(255, 215, 0, 0.7);
}

/* ============================================
   CARD SELECT MODAL (2장 선택)
   ============================================ */

.card-select-modal {
  max-width: 500px;
}

.card-select-container {
  display: flex;
  justify-content: center;
  gap: 30px;
  padding: 20px;
}

.card-select-container .card {
  width: 100px;
  height: 150px;
  cursor: pointer;
  transition: all 0.3s ease;
  transform-origin: center;
}

.card-select-container .card:hover {
  transform: scale(1.1) translateY(-10px);
  box-shadow: 0 10px 30px rgba(255, 215, 0, 0.5);
}

.card-select-container .card .card-sprite {
  width: 100%;
  height: 100%;
}

.selectable-large {
  animation: cardPulse 1s infinite;
}

@keyframes cardPulse {
  0%, 100% {
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
  }
  50% {
    box-shadow: 0 0 25px rgba(255, 215, 0, 0.9);
  }
}

/* ============================================
   SPEECH BUBBLE (구름 말풍선 - 장기 스타일)
   ============================================ */

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

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

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

.speech-bubble {
  position: relative;
  background: #fff;
  border: 4px solid #333;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  padding: 20px 35px;
  font-size: 20px;
  font-weight: bold;
  text-align: center;
  color: #333;
  box-shadow: 4px 4px 0 #333, 8px 8px 15px rgba(0, 0, 0, 0.3);
  min-width: 140px;
}

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

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

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

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

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

/* 4광 - 금색 */
.speech-bubble.gwang4 {
  background: linear-gradient(135deg, #fffde0 0%, #fff0a0 100%);
  border-color: #d4a000;
  color: #8B4513;
  box-shadow: 4px 4px 0 #d4a000, 8px 8px 20px rgba(212, 160, 0, 0.4);
}
.speech-bubble.gwang4::before,
.speech-bubble.gwang4::after,
.speech-bubble.gwang4 .bump-top,
.speech-bubble.gwang4 .bump-bottom-1,
.speech-bubble.gwang4 .bump-bottom-2 {
  background: linear-gradient(135deg, #fffde0 0%, #fff0a0 100%);
  border-color: #d4a000;
}

/* 5광 - 빨간 금색 */
.speech-bubble.gwang5 {
  background: linear-gradient(135deg, #fff0e0 0%, #ffd0a0 100%);
  border-color: #ff6600;
  color: #8B0000;
  box-shadow: 4px 4px 0 #ff6600, 8px 8px 20px rgba(255, 102, 0, 0.4);
  font-size: 22px;
}
.speech-bubble.gwang5::before,
.speech-bubble.gwang5::after,
.speech-bubble.gwang5 .bump-top,
.speech-bubble.gwang5 .bump-bottom-1,
.speech-bubble.gwang5 .bump-bottom-2 {
  background: linear-gradient(135deg, #fff0e0 0%, #ffd0a0 100%);
  border-color: #ff6600;
}

/* 홍단 - 빨강 */
.speech-bubble.hongdan {
  background: linear-gradient(135deg, #fff5f5 0%, #ffe0e0 100%);
  border-color: #c41e3a;
  color: #c41e3a;
  box-shadow: 4px 4px 0 #c41e3a, 8px 8px 20px rgba(196, 30, 58, 0.4);
}
.speech-bubble.hongdan::before,
.speech-bubble.hongdan::after,
.speech-bubble.hongdan .bump-top,
.speech-bubble.hongdan .bump-bottom-1,
.speech-bubble.hongdan .bump-bottom-2 {
  background: linear-gradient(135deg, #fff5f5 0%, #ffe0e0 100%);
  border-color: #c41e3a;
}

/* 청단 - 파랑 */
.speech-bubble.cheongdan {
  background: linear-gradient(135deg, #f0f8ff 0%, #d0e8ff 100%);
  border-color: #1e5fc4;
  color: #1e5fc4;
  box-shadow: 4px 4px 0 #1e5fc4, 8px 8px 20px rgba(30, 95, 196, 0.4);
}
.speech-bubble.cheongdan::before,
.speech-bubble.cheongdan::after,
.speech-bubble.cheongdan .bump-top,
.speech-bubble.cheongdan .bump-bottom-1,
.speech-bubble.cheongdan .bump-bottom-2 {
  background: linear-gradient(135deg, #f0f8ff 0%, #d0e8ff 100%);
  border-color: #1e5fc4;
}

/* 초단 - 초록 */
.speech-bubble.chodan {
  background: linear-gradient(135deg, #f0fff0 0%, #d0f0d0 100%);
  border-color: #228b22;
  color: #228b22;
  box-shadow: 4px 4px 0 #228b22, 8px 8px 20px rgba(34, 139, 34, 0.4);
}
.speech-bubble.chodan::before,
.speech-bubble.chodan::after,
.speech-bubble.chodan .bump-top,
.speech-bubble.chodan .bump-bottom-1,
.speech-bubble.chodan .bump-bottom-2 {
  background: linear-gradient(135deg, #f0fff0 0%, #d0f0d0 100%);
  border-color: #228b22;
}

/* 고도리 - 보라 */
.speech-bubble.godori {
  background: linear-gradient(135deg, #fff0f5 0%, #ffe0f0 100%);
  border-color: #9c27b0;
  color: #9c27b0;
  box-shadow: 4px 4px 0 #9c27b0, 8px 8px 20px rgba(156, 39, 176, 0.4);
}
.speech-bubble.godori::before,
.speech-bubble.godori::after,
.speech-bubble.godori .bump-top,
.speech-bubble.godori .bump-bottom-1,
.speech-bubble.godori .bump-bottom-2 {
  background: linear-gradient(135deg, #fff0f5 0%, #ffe0f0 100%);
  border-color: #9c27b0;
}

/* 쪽 - 노랑 */
.speech-bubble.jjok {
  background: linear-gradient(135deg, #fffde0 0%, #fff8b0 100%);
  border-color: #e6a800;
  color: #8B6914;
  box-shadow: 4px 4px 0 #e6a800, 8px 8px 20px rgba(230, 168, 0, 0.4);
}
.speech-bubble.jjok::before,
.speech-bubble.jjok::after,
.speech-bubble.jjok .bump-top,
.speech-bubble.jjok .bump-bottom-1,
.speech-bubble.jjok .bump-bottom-2 {
  background: linear-gradient(135deg, #fffde0 0%, #fff8b0 100%);
  border-color: #e6a800;
}

/* 따닥 - 주황 */
.speech-bubble.ttadak {
  background: linear-gradient(135deg, #fff5e0 0%, #ffe0b0 100%);
  border-color: #e67300;
  color: #8B4500;
  box-shadow: 4px 4px 0 #e67300, 8px 8px 20px rgba(230, 115, 0, 0.4);
}
.speech-bubble.ttadak::before,
.speech-bubble.ttadak::after,
.speech-bubble.ttadak .bump-top,
.speech-bubble.ttadak .bump-bottom-1,
.speech-bubble.ttadak .bump-bottom-2 {
  background: linear-gradient(135deg, #fff5e0 0%, #ffe0b0 100%);
  border-color: #e67300;
}

/* 싹쓸이 - 청록 */
.speech-bubble.sweep {
  background: linear-gradient(135deg, #e0ffff 0%, #b0f0f0 100%);
  border-color: #008b8b;
  color: #006666;
  box-shadow: 4px 4px 0 #008b8b, 8px 8px 20px rgba(0, 139, 139, 0.4);
}
.speech-bubble.sweep::before,
.speech-bubble.sweep::after,
.speech-bubble.sweep .bump-top,
.speech-bubble.sweep .bump-bottom-1,
.speech-bubble.sweep .bump-bottom-2 {
  background: linear-gradient(135deg, #e0ffff 0%, #b0f0f0 100%);
  border-color: #008b8b;
}

/* 폭탄 - 빨강 */
.speech-bubble.bomb {
  background: linear-gradient(135deg, #ffe0e0 0%, #ffb0b0 100%);
  border-color: #cc0000;
  color: #8B0000;
  box-shadow: 4px 4px 0 #cc0000, 8px 8px 20px rgba(204, 0, 0, 0.4);
}
.speech-bubble.bomb::before,
.speech-bubble.bomb::after,
.speech-bubble.bomb .bump-top,
.speech-bubble.bomb .bump-bottom-1,
.speech-bubble.bomb .bump-bottom-2 {
  background: linear-gradient(135deg, #ffe0e0 0%, #ffb0b0 100%);
  border-color: #cc0000;
}

@keyframes bubbleAppear {
  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 bubbleShake {
  0%, 100% {
    transform: translate(-50%, -50%) rotate(0deg);
  }
  25% {
    transform: translate(-50%, -50%) rotate(-3deg);
  }
  75% {
    transform: translate(-50%, -50%) rotate(3deg);
  }
}

@keyframes bubbleFadeOut {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.8);
  }
}

.speech-bubble-container.fade-out {
  animation: bubbleFadeOut 0.3s ease-in forwards;
}

/* ============================================
   MOBILE / TABLET LAYOUT (820px 이하)
   ============================================ */

@media screen and (max-width: 820px) {
  /* 게임 중 광고 숨김 (게임룸 활성화 시에만) */
  .game-room.active ~ .sidebar,
  .game-room.active .ad-container,
  .game-room.active .ad-chat-bottom,
  .game-room.active .ad-game-mobile,
  .game-room.active .chat-wrapper {
    display: none !important;
  }

  /* 게임룸 전체 화면 (활성화 시에만) */
  .game-room.active {
    flex: 1;
    display: flex;
    flex-direction: column;
  }

  /* 게임 영역 전체 화면 */
  .game-room.active .game-area {
    flex: 1;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
  }

  /* 게임 헤더 축소 */
  .game-room.active .game-header {
    flex-shrink: 0;
  }

  .game-room.active .board-container {
    flex: 1;
    width: 100%;
    display: flex;
    flex-direction: column;
  }

  /* 말풍선 축소 */
  .speech-bubble {
    font-size: 18px;
    padding: 12px 20px;
  }
}

/* ============================================
   820px 이하: 모바일 레이아웃 (common.css 규칙 적용)
   화투 카드가 한 화면에 다 보이도록 크기 조정
   손패는 최대 2줄
   ============================================ */
@media (max-width: 820px) {
  /* 카드 크기: 화면 너비의 10% */
  :root {
    --card-width: min(calc(100vw * 0.10), 60px);
    --card-height: min(calc(100vw * 0.15), 90px);
  }

  .board-container {
    width: 100%;
    padding: 0 4px;
    box-sizing: border-box;
    overflow: hidden;
  }

  .gostop-board {
    width: 100%;
    max-width: 100% !important;
    padding: 4px;
    gap: 2px;
    min-height: 0;
    overflow: hidden;
  }

  /* 플레이어 영역 간격 축소 */
  .player-row {
    gap: 4px;
  }

  /* 손패 영역 */
  .hand-area {
    padding: 3px;
    flex: 1;
  }

  .hand-area .cards-row {
    gap: 2px;
  }

  /* 내 손패 - 5장씩 2줄 (최대 10장) */
  .my-hand .cards-row {
    max-width: calc(var(--card-width) * 5 + 12px);
    gap: 2px;
    flex-wrap: wrap;
    justify-content: center;
  }

  /* 상대 손패 - 더 많이 겹치게 */
  .opponent-hand .card {
    margin-left: calc(var(--card-width) * -0.4);
  }

  .opponent-hand .card:first-child {
    margin-left: 0;
  }

  /* 획득패 영역 */
  .captured-area {
    min-height: calc(var(--card-height) + 8px);
    max-height: calc(var(--card-height) * 2 + 16px);
    padding: 2px;
    overflow: hidden;
    flex: 1;
  }

  .captured-traditional {
    flex-wrap: wrap;
    gap: 2px;
    width: 100%;
  }

  /* 획득패 그룹 - 영역에 맞게 자동 조절 */
  .captured-group {
    padding: 1px 2px;
    max-width: 100%;
    overflow: hidden;
  }

  .captured-group .card {
    margin-left: calc(var(--card-width) * -0.7);
  }

  .captured-group .card:first-child {
    margin-left: 0;
  }

  /* 바닥 필드 영역 */
  .field-row {
    gap: 6px;
    padding: 4px 6px;
    flex-wrap: wrap;
    margin: 8px 0;
  }

  .field-group {
    gap: 2px;
    max-width: calc(var(--card-width) * 2 + 4px);
    max-height: calc(var(--card-height) * 2 + 4px);
  }

  /* 덱 영역 */
  .deck-area {
    gap: 3px;
  }

  .deck-count {
    font-size: 8px;
    padding: 1px 4px;
    bottom: -14px;
  }

  /* 점수 표시 */
  .score-display {
    padding: 8px 12px;
    min-width: 55px;
  }

  .score-display .score-label {
    font-size: 12px;
  }

  .score-display .score-value {
    font-size: 24px;
  }

  /* 게임 정보 */
  .game-info-inline {
    padding: 8px 12px;
    gap: 5px;
  }

  .go-info-row .go-label {
    font-size: 12px;
    min-width: 20px;
  }

  .go-info-row .go-value {
    font-size: 16px;
  }

  .go-info-row .go-multiplier {
    font-size: 14px;
  }

  /* 고/스톱 카운터 */
  .go-stop-counter {
    font-size: 10px;
    padding: 2px 5px;
  }
}

/* ============================================
   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: 820px;
  width: 95%;
  max-height: 90vh;
  overflow-y: auto;
}

.tutorial-wrapper {
  display: flex;
  gap: 25px;
  margin: 20px 0;
}

.tutorial-visual {
  flex: 0 0 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#tutorial-canvas {
  background: linear-gradient(135deg, var(--field-bg) 0%, var(--field-bg-dark) 100%);
  border-radius: 12px;
  border: 2px solid rgba(255, 215, 0, 0.3);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.tutorial-caption {
  margin-top: 12px;
  font-size: 13px;
  color: var(--gold);
  text-align: center;
  min-height: 20px;
  line-height: 1.4;
}

.tutorial-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.tutorial-card-preview {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 15px;
  min-height: 70px;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  padding: 10px;
}

.tutorial-card-preview .card {
  width: 45px;
  height: 68px;
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  cursor: default;
  transform: none;
  background: #8B0000;
  overflow: hidden;
}

.tutorial-card-preview .card:hover {
  transform: translateY(-3px);
}

.tutorial-card-preview .card img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 4px;
}

.tutorial-text h3 {
  margin: 0 0 12px 0;
  color: var(--gold);
  font-size: 20px;
}

.tutorial-text p {
  margin: 0;
  line-height: 1.7;
  color: var(--text-primary);
  font-size: 14px;
  white-space: pre-line;
}

.tutorial-navigation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 15px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.tutorial-dots {
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: center;
}

.tutorial-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  cursor: pointer;
  transition: all 0.3s ease;
}

.tutorial-dot:hover {
  background: rgba(255, 255, 255, 0.5);
}

.tutorial-dot.active {
  background: var(--gold);
  transform: scale(1.2);
}

.tutorial-dot.completed {
  background: var(--success);
}

/* Responsive Tutorial */
@media (max-width: 700px) {
  .modal-tutorial {
    max-width: 95%;
    padding: 15px;
  }

  .tutorial-wrapper {
    flex-direction: column;
    gap: 15px;
  }

  .tutorial-visual {
    flex: none;
    width: 100%;
  }

  #tutorial-canvas {
    width: 100%;
    max-width: 340px;
    height: auto;
    aspect-ratio: 380 / 260;
  }

  .tutorial-card-preview .card {
    width: 38px;
    height: 57px;
  }

  .tutorial-text h3 {
    font-size: 17px;
  }

  .tutorial-text p {
    font-size: 13px;
  }

  .tutorial-dot {
    width: 8px;
    height: 8px;
  }

  .tutorial-navigation .btn {
    padding: 8px 16px;
    font-size: 13px;
  }
}

/* ============================================
   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;
  background: var(--accent);
  color: white;
}

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