/* poker_app.css */
:root {
    --table-felt-color: #00695c; 
    --player-bg: rgba(0, 0, 0, 0.6);
    --text-light: #e0e0e0; 
    --text-gold: #ffc107;
    --btn-fold: #6c757d; 
    --btn-call: #28a745;
    --btn-raise: #e67e22; 
    --btn-check: #3498db;
}

body {
    font-family: 'Noto Sans KR', sans-serif; 
    background-color: #111;
    color: var(--text-light); 
    margin: 0; 
    display: flex; 
    flex-direction: column;
    justify-content: center; 
    align-items: center; 
    height: 100vh; 
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    -ms-user-select: none;
    -webkit-touch-callout: none;
}

button,
input,
select,
textarea {
    user-select: auto;
    -webkit-user-select: auto;
    -ms-user-select: auto;
}
nav { width: 100%; max-width: 1020px; margin: 0 auto 15px auto; background-color: rgba(0,0,0,0.3); padding: 10px 0; border-radius: 8px; z-index: 100009; }
nav a { color: #fff; text-decoration: none; padding: 8px 15px; margin: 0 5px; border-radius: 6px; }

.player-name-area {
    display: flex;
    align-items: baseline; /* 텍스트 높이를 보기 좋게 정렬 */
    gap: 8px;              /* 이름과 코인 사이 간격 */
}

.player-total-coins {
    font-size: 0.8em;        /* 총 코인 글씨를 약간 작게 */
    color: #ff9253;        /* 색상을 약간 다르게 하여 구분 */
    font-weight: normal;
}

.poker-table-wrapper {
  width: 100%;
  height: 100vh; /* 전체 화면 높이 */
  max-width: 2200px;
  display: flex;
  justify-content: center;
  align-items: center;
  background: url('../images/QtrZ4dY.png') no-repeat center center;
  background-size: 100% 100%;
}
.poker-table { position: relative; width: 100%; height: 90%; max-width: 1700px; max-height: 900px; position: relative;}
.player-seat { position: absolute; width: 420px; min-height: 295px; height: auto; display: flex; flex-direction: column; align-items: center; }
.player-box {
    --player-seat-bg-image: url('../images/poker_seats/seat-bg-0.png');
    position: relative;
    border-radius: 8px;
    padding: 8px;
    border: 2px solid transparent;
    width: 100%;
    min-height: 285px;
    box-sizing: border-box;
    transition: border-color 0.3s;
    background:
        linear-gradient(90deg, rgba(4, 9, 18, 0.34), rgba(4, 9, 18, 0.10)),
        var(--player-seat-bg-image) center / cover no-repeat,
        rgba(0, 0, 0, 0.14);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), 0 8px 18px rgba(0, 0, 0, 0.28);
    overflow: visible;
    isolation: isolate;
}
/* .player-box { background: var(--player-bg); border-radius: 8px; padding: 8px; border: 2px solid transparent; width: 100%; box-sizing: border-box; transition: border-color 0.3s; } */
.player-seat[data-relative-seat-index="0"] .player-box { --player-seat-bg-image: url('../images/poker_seats/seat-bg-0.png'); }
.player-seat[data-relative-seat-index="1"] .player-box { --player-seat-bg-image: url('../images/poker_seats/seat-bg-1.png'); }
.player-seat[data-relative-seat-index="2"] .player-box { --player-seat-bg-image: url('../images/poker_seats/seat-bg-2.png'); }
.player-seat[data-relative-seat-index="3"] .player-box { --player-seat-bg-image: url('../images/poker_seats/seat-bg-3.png'); }
.player-seat[data-relative-seat-index="4"] .player-box { --player-seat-bg-image: url('../images/poker_seats/seat-bg-4.png'); }
.player-box.active-turn { border: 3px solid var(--text-gold);
  box-shadow: 0 0 10px var(--text-gold);
}

.player-header { 
    display: flex; 
    align-items: center;     
    gap: 8px; 
    margin-bottom: 8px; 
    position: relative;
    z-index: 98; 
}

#player-main .player-header { cursor: pointer; z-index: 98; }
#player-main .avatar-change-trigger .avatar {
    cursor: pointer;
}
#player-main .avatar-change-trigger .avatar:hover {
    border-color: #ffc107;
    box-shadow: 0 0 12px rgba(255, 193, 7, 0.75);
}

.avatar { width: 90px; height: 90px; border-radius: 40%; border: 2px solid var(--text-gold); }

.player-info { text-align: left; width: 250px; font-size: 0.9em; flex-grow: 1; }
.player-name { font-weight: bold; }
.player-money {  color: var(--text-gold);
}

.card-area {
    display: flex;
    align-items: center;
    min-height: 178px;
    padding-left: 18px;
    position: relative;
    z-index: 30;
    overflow: visible;
}
.card {
    --card-rot: 0deg;
    --card-y: 0px;
    border-radius: 6px;
    box-shadow: 2px 2px 10px rgba(0,0,0,0.5);
    position: absolute;
    transform: translateY(var(--card-y)) rotate(var(--card-rot));
    transform-origin: 50% 108%;
    transition: all 0.4s ease;
    user-select: none;
    -webkit-user-select: none;
    -webkit-user-drag: none;
    touch-action: none;
}

.card:hover {
  z-index: 10;
  transform: translateY(calc(var(--card-y) - 12px)) rotate(var(--card-rot)) scale(1.04);
}
.card-inner { position: absolute; width: 100%; height: 100%; transition: transform 0.6s; transform-style: preserve-3d; }
.card.is-flipped .card-inner { transform: rotateY(180deg); }
.card-face { 
    position: absolute; 
    width: 100%; 
    height: 107%; 
    /* backface-visibility: hidden; */ /* <-- 이 줄을 삭제하거나 주석 처리 */
    border-radius: 10px; 
}

/* 3D 플립 애니메이션이 필요한 일반 카드에만 이 규칙을 다시 적용합니다. */
.card-inner > .card-face {
    backface-visibility: hidden;
}
.card-face-back { background: url('../images/cards/BACK.png') no-repeat center center; background-size: cover; }
.card-face-front { background-color: white; transform: rotateY(180deg); background-size: cover; }
.card-area:hover .card { transform: translateY(calc(var(--card-y) - 8px)) rotate(var(--card-rot)) !important; z-index: 10; }
.card-area .card:hover ~ .card { transform: translateX(42px) translateY(var(--card-y)) rotate(var(--card-rot)) !important; }

.card.winning-card {
    transform: translateY(-20px);
    box-shadow: 0 0 20px #ffeb3b;
    z-index: 20;
}
.winning-card:hover {
    transform: translateY(-30px); /* 기존(-20px)보다 살짝 더 올라가게 설정 */
    box-shadow: 0 0 25px #ffffff;  /* 호버 시 그림자 효과를 더 밝게 */
}

#deck-area {
    position: absolute;
    top: 5%;
    left: 50%;
    transform: translate(-50%, -150%); /* 팟(Pot)보다 살짝 위쪽에 위치 */
    width: 155px;
    height: 205px;
    z-index: 10000; /* 카드가 다른 요소들보다 위에 표시되도록 높은 z-index 설정 */
    /* 이 div는 눈에 보일 필요가 없으므로 배경색 등은 지정하지 않습니다. */
}


/* 덱에 있는 카드의 뒷면을 보여줍니다. */
#deck-area .card {
  background: url('../images/cards/BACK.png') no-repeat center center;
  background-size: cover;
}

#opponent-1 { 
    top: 63% !important; 
    left: 3% !important; 
    transform: translateY(-50%); 
}
/* Seat 2 (왼쪽 상단) */
#opponent-2 { 
    top: 1.5% !important; 
    left: 3% !important; 
}
/* Seat 3 (오른쪽 상단) */
#opponent-3 { 
    top: 1.5% !important; 
    right: 3% !important; 
}
/* Seat 4 (오른쪽 중간) */
#opponent-4 { 
    top: 63% !important; 
    right: 3% !important; 
    transform: translateY(-50%); 
}

#player-main { bottom: 0.5% !important; left: 50% !important; transform: translateX(-50%); width: 430px !important; min-height: 330px !important; }
#player-main .player-box { min-height: 320px !important; }
#player-main .card-area { min-height: 215px !important; }
/* 
#player-main .card {
    width: 115px;
    height: 165px;
} */

/* .pot-area { position: absolute; top: 30%; left: 50%; transform: translate(-50%, -50%); text-align: center; }

.pot-total { font-size: 1.2em; font-weight: bold; color: var(--text-gold); background: rgba(0,0,0,0.5); padding: 5px 10px; border-radius: 5px; } */
.pot-area {
    position: absolute;
    top: 28%;   /* 칩 위치 */
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 220;
    pointer-events: none;
}

.pot-total {
    position: absolute;
    top: 50%;   /* 금액 위치 따로 설정 */
    left: 50%;
    transform: translate(-48%, -50%);

    font-size: 1.5em;
    font-weight: bold;
    color: var(--text-gold);
    background: rgba(0, 0, 0, 0.737);
    padding: 1px 10px;
    border-radius: 5px;
    z-index: 230;
    pointer-events: auto;
}
.pre-game-controls { position: absolute; bottom: 10%; left: 52%; transform: translateX(-50%); display: flex; gap: 10px; align-items: center; background: rgba(0,0,0,0.7); padding: 15px; border-radius: 10px; }
#startGameBtn { padding:10px 20px; font-size:1.2em; background-color: #28a745; color: white; border: none; border-radius: 5px; cursor: pointer; font-weight: bold;}
.action-buttons { 
    position: absolute; 
    bottom: -30px;       /* 하단 여백 확보 */
    left: 50%;          /* 55%에서 50%로 변경 */
    transform: translateX(-50%); 
    display: none; 
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); 
    width: auto;        /* 고정 너비 해제 */
    min-width: 500px;   /* 최소 너비 설정 */
    gap: 12px;
    justify-content: center; /* 버튼들을 가로 중앙으로 */
    align-items: center;
    z-index: 1000;
}

.action-buttons button { 
    width: 110px;             /* 가로 고정 */
    height: 65px;            /* 세로 고정 */
    display: flex;
    flex-direction: column;  /* 텍스트와 금액 상하 배치 */
    align-items: center;
    justify-content: center;
    padding: 5px; 
    font-size: 1rem; 
    color: white; 
    border: 1px solid rgba(255,255,255,0.2); 
    border-radius: 10px; 
    font-weight: bold; 
    cursor: pointer; 
    background: linear-gradient(180deg, #444 0%, #222 100%);
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    line-height: 1.2;
}
/* 버튼 내 액션 텍스트 (예: 콜, 하프) */
.btn-label {
    font-size: 0.95rem;
    display: block;
}

/* 버튼 내 금액 텍스트 (예: ₩1,000) */
.btn-amount {
    font-size: 0.65rem;
    color: var(--text-gold);
    margin-top: 2px;
    font-weight: normal;
}

.action-buttons button:disabled { 
    opacity: 0.4; 
    background-color: #555; 
    color: #999; 
    cursor: not-allowed; 
}
#btn-fold { color: var(--btn-fold); }
#btn-check { color: var(--btn-check); }
#btn-call { color: var(--btn-call); }
#btn-half { color: var(--btn-raise); }
#btn-allin { color: var(--btn-raise); }

#btn-pping {
    color: #48dbfb; /* '삥' 버튼 색상 (예시) */
}
#btn-ddadang {
    color: #ff6b6b; /* '따당' 버튼 색상 (예시) */
}
/* .action-buttons {
    display: none;
    grid-template-columns: repeat(7, 1fr); 
    gap: 8px;
    align-items: center;} */
    

.action-bubble {
    position: absolute;
    transform: translate(-50%, -50%); /* 이전 단계에서 수정한 부분 */
    background-color: rgba(255, 255, 255, 0.9);
    color: #111;
    
    /* ▼▼▼ 이 부분을 수정합니다 ▼▼▼ */
    padding: 10px 20px; /* 상하 여백을 10px, 좌우 여백을 20px로 늘림 */
    font-size: 1.0em;   /* 글자 크기를 살짝 줄여 균형 맞춤 */
    /* ▲▲▲ 수정 완료 ▲▲▲ */

    border-radius: 20px;
    font-weight: bold;
    white-space: nowrap;
    opacity: 0;
    transition: all 0.5s ease-out;
    pointer-events: none;
    z-index: 99;
}
.action-bubble.show {
    opacity: 1;
    top: calc(50% - 10px);
    z-index: 100;
}

.action-bubble.last-action-bubble {
    background: rgba(8, 10, 12, 0.58);
    color: rgba(235, 235, 235, 0.82);
    border: 1px solid rgba(230, 230, 230, 0.28);
    box-shadow: 0 6px 14px rgba(0,0,0,0.28);
    filter: grayscale(1);
    text-shadow: 0 1px 3px rgba(0,0,0,0.9);
    transform: translate(-50%, -50%) scale(0.9);
    z-index: 86;
}

.action-bubble.last-action-bubble.show {
    opacity: 0.46;
    z-index: 86;
}

.action-bubble.last-action-bubble.is-hovered {
    opacity: 1;
    filter: none;
    color: #ffffff;
    background: linear-gradient(135deg, rgba(12, 20, 32, 0.96), rgba(24, 72, 98, 0.96));
    border-color: rgba(255, 215, 0, 0.82);
    box-shadow: 0 10px 22px rgba(0,0,0,0.42), 0 0 12px rgba(255, 215, 0, 0.32);
    transform: translate(-50%, -50%) scale(1);
    z-index: 101;
}

.action-bubble.chat-bubble {
    max-width: 260px;
    white-space: normal;
    word-break: break-word;
    line-height: 1.35;
    color: #ffffff;
    background: linear-gradient(135deg, rgba(20, 28, 44, 0.96), rgba(0, 118, 128, 0.94));
    border: 2px solid rgba(255, 215, 0, 0.78);
    box-shadow: 0 0 16px rgba(0, 255, 204, 0.34), 0 8px 18px rgba(0,0,0,0.45);
    text-shadow: 0 1px 3px rgba(0,0,0,0.85);
}

.action-bubble.spectator-chat-bubble {
    border-color: rgba(255, 214, 92, 0.9);
    background: linear-gradient(135deg, rgba(43, 31, 72, 0.96), rgba(28, 84, 95, 0.94));
    box-shadow: 0 0 16px rgba(255, 214, 92, 0.28), 0 8px 18px rgba(0,0,0,0.45);
}

.action-bubble.chat-bubble::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -10px;
    width: 16px;
    height: 16px;
    background: inherit;
    border-right: 2px solid rgba(255, 215, 0, 0.78);
    border-bottom: 2px solid rgba(255, 215, 0, 0.78);
    transform: translateX(-50%) rotate(45deg);
}

.spectator-notice {
    position: absolute;
    left: 50%;
    top: 12%;
    transform: translateX(-50%);
    z-index: 10030;
    max-width: min(520px, 86vw);
    padding: 10px 16px;
    border-radius: 999px;
    border: 2px solid rgba(255, 215, 0, 0.78);
    background: rgba(8, 16, 28, 0.9);
    color: #fff6b8;
    font-size: 1rem;
    font-weight: 800;
    text-align: center;
    text-shadow: 0 2px 4px rgba(0,0,0,0.95);
    box-shadow: 0 0 18px rgba(255, 215, 0, 0.26), 0 10px 22px rgba(0,0,0,0.5);
    pointer-events: none;
}

.spectator-notice[data-mode="joined"] {
    color: #caffd8;
    border-color: rgba(77, 255, 143, 0.85);
    box-shadow: 0 0 18px rgba(77, 255, 143, 0.34), 0 10px 22px rgba(0,0,0,0.5);
}

.spectator-waiting-info {
    padding: 10px 16px;
    border-radius: 999px;
    border: 2px solid rgba(255, 215, 0, 0.72);
    background: rgba(0,0,0,0.72);
    color: #fff6b8;
    font-weight: 800;
    text-align: center;
}

.btn-kick-spectator {
    background: #7f1d1d;
    color: #fff;
    border: 1px solid #ef4444;
}

.spectator-seat-join {
    position: absolute;
    width: 150px;
    min-height: 48px;
    z-index: 10040;
    border: 2px solid rgba(255, 215, 0, 0.9);
    border-radius: 999px;
    background: linear-gradient(135deg, #1f8f4d, #34d399);
    color: #08140d;
    font-size: 1rem;
    font-weight: 1000;
    cursor: pointer;
    box-shadow: 0 0 18px rgba(52, 211, 153, 0.42), 0 8px 18px rgba(0,0,0,0.45);
    text-shadow: 0 1px 1px rgba(255,255,255,0.35);
    animation: spectator-seat-pulse 1.1s ease-in-out infinite;
}

.spectator-seat-join:disabled {
    cursor: default;
    background: linear-gradient(135deg, #f59e0b, #fde047);
    color: #1d1300;
}

.spectator-seat-join.is-requested,
.spectator-reserve-button.is-requested,
#autoPlayBtn.is-on {
    border-color: #fff2a8 !important;
    background: linear-gradient(135deg, #ffd65c, #ff8a2a) !important;
    color: #1d1300 !important;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.42), 0 0 18px rgba(255, 214, 92, 0.82) !important;
    transform: translateY(1px) scale(0.98);
}

@keyframes spectator-seat-pulse {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.18); }
}
.player-box.folded-player {
    opacity: 0.6; /* 반투명 효과 */
    filter: grayscale(80%); /* 흑백에 가깝게 변경 */
    transition: all 0.5s;
  }

/* 폴드한 플레이어의 카드 위에는 호버 효과를 주지 않음 */
.player-box.folded-player .card:hover {
    transform: none !important;
}
#pot-chips-container {
    position: relative; /* 자식 요소(칩)들의 위치 기준점 */
    width: 22.5rem; /* 200px */
    height: 9.375rem; /* 150px */
    margin: 0.625rem auto; /* 10px */
    perspective: 500px; /* 칩에 3D 효과를 주기 위함 */
}

.pot-chip {
    transition: transform 0.3s ease-out; /* 회전 애니메이션 효과 추가 */
    position: absolute; /* 칩들이 겹쳐서 쌓일 수 있도록 */
    width: 3.125rem;  /* 50px */
    height: 3.125rem; /* 50px */
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    /* 칩에 약간의 입체감을 줍니다. */
    filter: drop-shadow(2px 2px 3px rgba(0,0,0,0.5));
}

.flying-chip {
    position: fixed; /* 화면 전체를 기준으로 자유롭게 이동 */
    width: 3.125rem; /* 50px */
    height: 3.125rem; /* 50px */
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    z-index: 250; /* 다른 요소들보다 항상 위에 있도록 */
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1); /* 부드러운 애니메이션 효과 */
    filter: drop-shadow(5px 5px 5px rgba(0,0,0,0.3));
}


/* 모달 배경 */
.modal {
    display: none; /* 평소에는 숨김 */
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.6);
}

/* 모달 내용물 박스 */
.modal-content {
    background-color: #2c3e50;
    margin: 10% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 600px;
    border-radius: 10px;
    text-align: center;
}

/* 닫기 버튼 */
.close-button {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

/* 아바타가 표시될 그리드 */
#avatarGrid {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
    max-height: 400px;
    overflow-y: auto;
}

/* 그리드 안의 개별 아바타 이미지 */
#avatarGrid img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: border-color 0.2s;
}

#avatarGrid img:hover {
    border-color: #ffc107; /* 호버 시 노란색 테두리 */
}
.avatar-picker-message {
    width: 100%;
    color: #fff;
    padding: 20px 0;
}
.avatar-picker-message.error {
    color: #ff8a8a;
}
.room-selection-container {
    position: absolute; bottom: 50%; left: 50%;
    transform: translateX(-50%); background: rgba(0,0,0,0.7);
    padding: 20px; border-radius: 10px; text-align: center;
    width: 80%; max-width: 500px;
}
#roomList { display: flex; flex-direction: column; gap: 10px; margin-top: 15px; }
.room-button {
    padding: 15px; font-size: 1.1em; background-color: #28a745;
    color: white; border: none; border-radius: 8px; cursor: pointer;
    font-weight: bold; transition: background-color 0.2s;
}
.room-button:hover { background-color: #218838; }
.room-button span { font-weight: normal; color: #d4edda; margin-left: 10px; }
/* --------------------------------------------------------------------------------------------------------------- */
.waiting-popup {
    display: none; /* 평소에는 숨겨져 있음 */
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 30px;
    background-color: rgba(0, 0, 0, 0.85);
    color: #fff;
    border: 2px solid #ffc107;
    border-radius: 10px;
    text-align: center;
    z-index: 500; /* 다른 게임 UI 요소들 위에 표시 */
}

.waiting-popup p {
    margin: 0;
    font-size: 1.2em;
}

.waiting-popup p:first-child {
    font-weight: bold;
    margin-bottom: 10px;
}
/* 준비/시작 버튼 공통 스타일 */
#preGameControls.is-seat-attached {
    display: none !important;
}

.seat-control-area {
    position: absolute;
    left: 50%;
    bottom: 10px;
    z-index: 180;
    display: flex;
    width: calc(100% - 18px);
    max-height: 88px;
    transform: translateX(-50%);
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    pointer-events: auto;
}

.seat-control-area[hidden] {
    display: none !important;
}

#preGameControls .btn,
.seat-control-area .btn {
    padding: 12px 28px;
    font-size: 1.2em;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    transition: all 0.2s ease-in-out;
    margin: 0 10px;
}

.seat-control-area .btn {
    margin: 0;
    max-width: 100%;
    white-space: nowrap;
}
#preGameControls .btn:hover,
.seat-control-area .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 8px rgba(0,0,0,0.3);
}
#preGameControls .btn:active,
.seat-control-area .btn:active {
    transform: translateY(1px);
}
/* 준비 버튼 (파란색) */
.btn.btn-ready {
    background: linear-gradient(145deg, #3498db, #2980b9);
}
/* 게임 시작 버튼 (녹색) */
.btn.btn-start {
    background: linear-gradient(145deg, #2ecc71, #27ae60);
}
/* 승리 표시 스타일 */
.winner-indicator {
    position: absolute;
    bottom: -150px; /* 플레이어 박스 위쪽 바깥으로 25px 이동 */
    left: 50%;
    transform: translateX(-50%);
    background-color: #ffc107; /* 노란색 배경 */
    color: #1a1a1a; /* 어두운 글자색 */
    padding: 10px 25px;
    border-radius: 25px;
    font-size: 1.5em;
    font-weight: bold;
    white-space: nowrap; /* 글자가 두 줄로 나뉘지 않도록 */
    z-index: 50; /* 카드보다 위에 표시되도록 */
    box-shadow: 0 0 10px rgba(255, 255, 0, 0.7);
}

.winner-indicator {
    bottom: 8px !important;
    z-index: 210 !important;
}

.poker-win-celebration {
    position: absolute;
    left: 50%;
    top: 8%;
    z-index: 30000;
    width: min(94vw, 760px);
    transform: translate(-50%, -50%);
    text-align: center;
    pointer-events: none;
    filter: drop-shadow(0 16px 22px rgba(0, 0, 0, 0.68));
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.poker-win-celebration::before {
    content: "";
    position: absolute;
    inset: -22px 0 -18px 0;
    z-index: -1;
    background: radial-gradient(circle, rgba(255, 214, 79, 0.28), rgba(0, 0, 0, 0.04) 62%, transparent 72%);
    animation: winAuraPulse 1.05s ease-in-out infinite alternate;
}

.poker-win-celebration.is-fading {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.94);
}

.win-letter-row,
.win-hand-row {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.04em;
}



.win-hand-arc {
    position: relative;
    height: clamp(96px, 13vw, 150px);
    margin-bottom: 24px; /* 기존 -8px 제거 */
    display: flex;
    justify-content: center;
    align-items: flex-end;
    pointer-events: none;
}
.win-letter-row {
    margin-top: 10px;
}
.arc-hand-letter {
    display: inline-block;
    color: #fff2a8;
    font-size: clamp(2.5rem, 8.8vw, 6.6rem);
    font-weight: 950;
    line-height: 0.9;
    transform-origin: center 160%;
    transform: translateY(var(--arc-y)) rotate(var(--rot)) scale(0.82);
    text-shadow: 0 0 12px #ffe66d, 0 0 34px rgba(255, 137, 0, 0.94), 4px 5px 0 #4c1800;
    opacity: 0;
    animation: arcHandDrop 0.95s cubic-bezier(.18, 1.38, .34, 1) forwards;
    animation-delay: calc(var(--i) * 0.07s);
}

.win-letter {
    display: inline-block;
    min-width: 0.35em;
    color: #fff6b0;
    font-size: clamp(2rem, 8vw, 5.8rem);
    font-weight: 900;
    line-height: 0.98;
    text-shadow: 0 0 10px #ffcf33, 0 0 28px rgba(255, 154, 0, 0.92), 3px 4px 0 #5a2100;
    opacity: 0;
    transform-origin: center;
    animation: winLetterCrash 0.95s cubic-bezier(.18, 1.38, .34, 1) forwards;
    animation-delay: calc(var(--i) * 0.085s);
}

.hand-letter {
    display: inline-block;
    margin-top: 12px;
    min-width: 0.24em;
    color: #9ffcff;
    font-size: clamp(1rem, 3.5vw, 2rem);
    font-weight: 800;
    line-height: 1.15;
    text-shadow: 0 0 8px rgba(41, 245, 255, 0.95), 2px 2px 0 #061b24;
    opacity: 0;
    animation: handLetterSlide 0.7s ease-out forwards;
    animation-delay: calc(0.75s + var(--i) * 0.045s);
}



.win-card-arc {
    position: relative;
    gap: clamp(6px, 1.3vw, 14px);
    height: clamp(86px, 11vw, 132px);
    margin-top: 14px;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    pointer-events: none;
    perspective: 900px;
    transform-style: preserve-3d;
}

.win-card-arc-card {
    display: inline-flex;
    width: clamp(46px, 6vw, 72px);
    height: clamp(64px, 8.4vw, 102px);
    border-radius: 6px;
    opacity: 0;
    transform-origin: center 170%;
    transform: translateY(var(--arc-y)) rotate(var(--rot)) scale(0.9);
    transform-style: preserve-3d;
    animation: winCardArcFly 0.92s cubic-bezier(.18, 1.34, .26, 1) forwards;
    animation-delay: calc(1.05s + var(--i) * 0.09s);
}

.win-card-flip-inner {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 6px;
    transform-style: preserve-3d;
    animation: winCardYFlip 0.92s cubic-bezier(.2, .85, .2, 1) forwards;
    animation-delay: calc(1.05s + var(--i) * 0.09s);
    box-shadow: 0 5px 12px rgba(0,0,0,0.58), 0 0 14px rgba(255,214,92,0.45);
}

.win-card-mini-face {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 6px;
    overflow: hidden;
    background-repeat: no-repeat;
    background-position: center;
    background-size: cover;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.win-card-mini-front {
    transform: rotateY(0deg);
}

.win-card-mini-back {
    background: url('../images/cards/BACK.png') no-repeat center center;
    background-size: cover;
    transform: rotateY(180deg);
}

.poker-win-celebration.is-rival-win .win-letter {
    color: #ffd6d6;
    text-shadow: 0 0 10px #ff6b6b, 0 0 24px rgba(255, 66, 66, 0.9), 3px 4px 0 #3e0000;
}



.poker-win-celebration.is-special-win::before {
    background: radial-gradient(circle, color-mix(in srgb, var(--win-accent, #ffd65c) 34%, transparent), rgba(0, 0, 0, 0.04) 62%, transparent 74%);
    animation: winAuraPulse 0.72s ease-in-out infinite alternate;
}

.poker-win-celebration.win-rank-9 {
    --win-accent: #ffef5c;
}

.poker-win-celebration.win-rank-8 {
    --win-accent: #45f7ff;
}

.poker-win-celebration.win-rank-7 {
    --win-accent: #ff4fd8;
}

.poker-win-celebration.win-rank-6 {
    --win-accent: #75ff8a;
}

.poker-win-celebration.is-random-mission-win {
    --win-accent: #ff9f2f;
}

.poker-win-celebration.is-special-win .win-letter,
.poker-win-celebration.is-special-win .hand-letter,
.poker-win-celebration.is-special-win .win-card-flip-inner {
    filter: drop-shadow(0 0 10px var(--win-accent, #ffd65c));
}

.poker-win-celebration.is-special-win .arc-hand-letter {
    color: var(--win-accent, #fff2a8);
    text-shadow:
        0 0 12px var(--win-accent, #ffd65c),
        0 0 34px color-mix(in srgb, var(--win-accent, #ffd65c) 78%, #ffffff 10%),
        4px 5px 0 #2a1300;
}

.poker-win-celebration.win-rank-9 .arc-hand-letter {
    color: transparent;
    background: linear-gradient(90deg, #ff2d55, #ffb000, #fff84a, #32ff7e, #34c8ff, #8b5cff, #ff2dcb, #ff2d55);
    background-size: 280% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    text-shadow: 0 0 16px rgba(255,255,255,0.95), 0 0 34px rgba(255, 70, 220, 0.88), 4px 5px 0 rgba(40,0,52,0.75);
    animation-name: arcHandDrop, royalWinRainbowGlow;
    animation-duration: 0.95s, 1.15s;
    animation-timing-function: cubic-bezier(.18, 1.38, .34, 1), linear;
    animation-fill-mode: forwards, both;
    animation-iteration-count: 1, infinite;
}

@keyframes royalWinRainbowGlow {
    from { background-position: 0% 50%; filter: drop-shadow(0 0 10px #fff); }
    to { background-position: 280% 50%; filter: drop-shadow(0 0 22px #ff4fd8); }
}

@keyframes winLetterCrash {
    0% {
        opacity: 0;
        transform: translate3d(calc(-44vw + var(--i) * 10px), -38vh, 0) rotate(-540deg) scale(1.9);
        filter: blur(5px);
    }
    62% {
        opacity: 1;
        transform: translate3d(0, 0, 0) rotate(8deg) scale(1.18);
        filter: blur(0);
    }
    74% { transform: translate3d(-5px, 2px, 0) rotate(-5deg) scale(0.96); }
    84% { transform: translate3d(4px, -2px, 0) rotate(3deg) scale(1.08); }
    100% {
        opacity: 1;
        transform: translate3d(0, 0, 0) rotate(0) scale(1);
        filter: blur(0);
    }
}

@keyframes handLetterSlide {
    0% {
        opacity: 0;
        transform: translateX(44px) scale(1.22);
        filter: blur(4px);
    }
    70% {
        opacity: 1;
        transform: translateX(-3px) scale(1.04);
        filter: blur(0);
    }
    100% {
        opacity: 1;
        transform: translateX(0) scale(1);
        filter: blur(0);
    }
}



@keyframes arcHandDrop {
    0% {
        opacity: 0;
        transform: translateY(calc(var(--arc-y) - 70px)) rotate(calc(var(--rot) - 130deg)) scale(1.55);
        filter: blur(5px);
    }
    62% {
        opacity: 1;
        transform: translateY(calc(var(--arc-y) + 4px)) rotate(calc(var(--rot) + 5deg)) scale(1.08);
        filter: blur(0);
    }
    78% {
        transform: translateY(calc(var(--arc-y) - 3px)) rotate(calc(var(--rot) - 3deg)) scale(0.96);
    }
    100% {
        opacity: 1;
        transform: translateY(var(--arc-y)) rotate(var(--rot)) scale(1);
        filter: blur(0);
    }
}



@keyframes winCardArcFly {
    0% {
        opacity: 0;
        transform: translate3d(calc(48vw - var(--i) * 40px), 34vh, 0) rotate(var(--rot)) scale(1.28);
        filter: blur(5px);
    }
    66% {
        opacity: 1;
        transform: translateY(calc(var(--arc-y) - 5px)) rotate(calc(var(--rot) - 5deg)) scale(1.08);
        filter: blur(0);
    }
    82% {
        transform: translateY(calc(var(--arc-y) + 4px)) rotate(calc(var(--rot) + 3deg)) scale(0.96);
    }
    100% {
        opacity: 1;
        transform: translateY(var(--arc-y)) rotate(var(--rot)) scale(1);
        filter: blur(0);
    }
}

@keyframes winCardYFlip {
    0% {
        transform: rotateY(2160deg);
    }
    68% {
        transform: rotateY(160deg);
    }
    84% {
        transform: rotateY(-36deg);
    }
    100% {
        transform: rotateY(0deg);
    }
}

@keyframes winAuraPulse {
    from { opacity: 0.55; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1.04); }
}

.ready-indicator {
    position: absolute !important;
    top: 120px !important;
    left: 50% !important;
    z-index: 170;
    transform: translateX(-50%) !important;
    color: #20ff35 !important;
    font-size: clamp(1.7rem, 3vw, 2.5rem) !important;
    font-weight: 900 !important;
    letter-spacing: 0;
    line-height: 1;
    pointer-events: none !important;
    text-shadow: 0 0 9px rgba(32, 255, 53, 0.85), 2px 2px 3px #000;
}

.kick-button {
    position: absolute !important;
    left: 50% !important;
    bottom: 30px !important;
    top: auto !important;
    z-index: 185;
    transform: translateX(-50%) !important;
    padding: 6px 12px !important;
    background: #c0392b !important;
    border: none !important;
    color: #fff !important;
    border-radius: 4px !important;
    cursor: pointer !important;
    font-weight: 700;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.38);
}

.card.selectable:hover {
    cursor: pointer;
    box-shadow: 0 0 20px #00a8ff;
    transform: translateY(-15px) scale(1.05);
}
.game-instruction {
    position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%);
    color: rgb(255, 241, 43); background: rgba(0,0,0,0.7); padding: 6px 25px; border-radius: 10px;
    z-index:190; pointer-events: none; font-size: 1.4em;
    max-width: calc(100% - 18px);
    text-align: center;
    white-space: nowrap;
}
/* poker_app.css 파일 맨 끝에 추가 */
.opener-info {
    position: absolute;
    top: 45.5%;
    left: 50%;
    transform: translateX(-50%);
    color: #ffc107;
    font-size: 1.1em;
    font-weight: bold;
    text-shadow: 1px 1px 2px #000;
    padding: 1px 15px;
    background-color: rgba(0, 0, 0, 0.737);
    border-radius: 10px; 
    z-index: 240;
    pointer-events: none;
}

/* poker_app.css 파일 맨 끝에 추가 */

.flying-card {
    position: fixed;
    background-size: cover;
    border-radius: 5px; /* 카드 모양과 맞춤 */
    z-index: 1000;
    transition: all 0.3s ease-out;
}
/* poker_app.css 파일 맨 끝에 추가 */
.fullscreenBtn {
    padding: 10px 15px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    margin-left: 10px;
}
.squeeze-container {
    transform-style: preserve-d;
    /* [수정됨] 다른 카드와 동일하게 absolute로 변경 */
    position: absolute; 
}

.squeeze-container .card-face-front {
    /* 쪼는 카드 아래에 깔릴 앞면 카드 */
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1; /* 뒷면 카드(squeeze-top)보다 아래 */
    backface-visibility: hidden; /* 뒷면은 보이지 않도록 */
}

.squeeze-top {
    /* 쪼아 움직일 뒷면 카드 */
    cursor: grab;
    position: absolute;
    top: 0;
    left: 0;
    width: 107%;
    height: 109%;
    touch-action: none; 
    z-index: 2; /* 항상 앞면 카드 위에 있도록 */
    transition: transform 0.2s ease-out, opacity 0.3s ease-out; /* 제자리로 돌아오거나 사라질 때 부드럽게 */
    background-size: cover; /* 이미지가 카드 크기에 맞게 꽉 차도록 */
    cursor: grab;
}

.squeeze-top:active {
    cursor: grabbing;
}

/* 이름 옆 등급 아이콘 스타일 */
.player-name {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: bold;
}

/* 등급별 특별 색상 효과 (선택 사항) */
.tier-gold { color: #ffd700; text-shadow: 0 0 5px rgba(255, 215, 0, 0.5); }
.tier-master { color: #ff4500; animation: pulse 2s infinite; }

.game-time {
    position: absolute;
    top: 13px;
    left: 17px;
    font-size: 12px;
    color: #00ffcc;
    font-family: monospace;
    text-shadow: 0 0 5px rgba(0,255,200,0.7);
    z-index: 9999;
    pointer-events: none;
}
.game-time2 {
    top: 10%;
    left: 50%;
    font-size: 12px;
}

/* --- [모바일] 세로모드 겹침 해결 및 배치 최적화 --- */
@media screen and (max-width: 600px) {
    body {
        justify-content: flex-start;
    }

    nav {
        max-width: calc(100vw - 8px);
        margin: 2px auto 4px auto;
        padding: 4px 2px;
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 3px;
    }

    nav a,
    nav button {
        padding: 5px 7px !important;
        margin: 0 !important;
        font-size: 0.72rem !important;
        line-height: 1.1;
        z-index: 100009;
    }

    .poker-table-wrapper {
        height: calc(100dvh - 36px);
        min-height: 0;
        align-items: stretch;
    }

    .poker-table {
        transform: scale(1); /* 강제 축소 대신 요소별 개별 배치 사용 */
        width: 100%;
        height: 100%;
        max-height: none;
        overflow: hidden;
    }

    /* 좌석들을 화면 끝으로 최대한 밀어서 공간 확보 */
    .player-seat {
        width: 128px;    /* 모바일 좌석 너비 축소 */
        min-height: 138px;
        height: auto;
    }

    .player-box {
        min-height: 132px;
        padding: 5px;
    }

    #opponent-1 { left: 2%; top: 43%; transform: translateY(-50%); }
    #opponent-4 { right: 2%; top: 43%; transform: translateY(-50%); }
    #opponent-2 { left: 2%; top: 6%; }
    #opponent-3 { right: 2%; top: 6%; }
    #player-main { bottom: 6px !important; left: 50% !important; transform: translateX(-50%); width: min(88vw, 390px) !important; min-height: 222px !important; }
    #player-main .player-box { min-height: 214px !important; }

    .player-header {
        gap: 4px;
        margin-bottom: 3px;
        transform: none;
    }

    /* 아바타 크기를 줄여 카드 영역 확보 */
    .avatar {
        width: 38px;
        height: 38px;
    }

    .player-info {
        width: 84px;
        font-size: 0.62rem;
        line-height: 1.1;
    }

    .player-name-area {
        gap: 3px;
        flex-wrap: wrap;
    }

    .player-name { font-size: 0.66rem; }
    .player-money,
    .player-total-coins { font-size: 0.58rem; }

    .card-area {
        min-height: 78px;
        padding-left: 28px;
    }

    #player-main .card-area {
        min-height: 118px !important;
        padding-left: 36px;
    }

    /* 카드 크기를 모바일 화면에 맞게 대폭 축소 */
    .card {
        width: 46px !important;
        height: 64px !important;
        margin-left: -29px; /* 카드 겹침 간격 조정 */
    }
    
    #player-main .card {
        width: 58px !important;
        height: 78px !important;
        margin-left: -24px;
    }
   #pot-chips-container {
    position: relative; /* 자식 요소(칩)들의 위치 기준점 */
    width: 12.5rem; /* 200px */
    height: 9.375rem; /* 150px */
    margin: 0.625rem auto; /* 10px */
    perspective: 500px; /* 칩에 3D 효과를 주기 위함 */
    }

    .pot-area {
        top: 15%;
    }

    .pot-total {
        top: 48%;
        width: min(88vw, 330px);
        text-align: center;
        font-size: 0.86rem;
        line-height: 1.25;
        padding: 1px 4px;
    }

    .game-time {
        top: 40px;
        left: 8px;
        font-size: 9px;
    }

    .game-time2 {
        font-size: 0.68rem !important;
        padding: 3px 6px !important;
        margin: 2px !important;
    }

    .opener-info {
        top: 42%;
        width: min(86vw, 300px);
        font-size: 0.72rem;
        line-height: 1.2;
        padding: 3px 6px;
        text-align: center;
        white-space: normal;
    }

    .pre-game-controls,
    #preGameControls {
        bottom: 3% !important;
        width: min(92vw, 320px);
        gap: 5px !important;
        padding: 8px !important;
        flex-wrap: wrap;
        justify-content: center;
    }

    #preGameControls .btn,
    .seat-control-area .btn,
    #startGameBtn {
        padding: 6px 10px !important;
        font-size: 0.78rem !important;
    }

    .seat-control-area {
        bottom: 5px;
        width: calc(100% - 8px);
        max-height: 52px;
        gap: 4px;
    }

    .ready-indicator {
        top: 30px !important;
        left: 58% !important;
        font-size: 1.05rem !important;
    }

    .kick-button {
        bottom: 5px !important;
        padding: 4px 7px !important;
        font-size: 0.68rem !important;
    }

/* ✨ [수정] 버튼 간격 벌어짐 해결: flex로 변경하여 중앙 응집 */
    .action-buttons {
        bottom: 6px;
        width: 96vw;
        min-width: unset; /* 전체를 채우지 않도록 해제 */
        justify-content: center;
        gap: 4px;
        flex-wrap: wrap;
    }
    .action-buttons button {
        width: 58px; /* 버튼 가로 크기 고정 */
        height: 42px;
        flex-shrink: 0; /* 크기 유지 */
        padding: 2px;
        font-size: 0.68rem;
    }
    .btn-label { font-size: 0.68rem; }
    .btn-amount { font-size: 0.55rem; }
    .game-instruction {
        bottom: 5px; 
        left: 50%; 
        transform: translateX(-50%);
        font-size: 0.72em;
        white-space: nowrap;
        padding: 4px 8px;
        max-width: calc(100% - 8px);
    }

    .poker-win-celebration {
        top: 8%;
        width: 96vw;
    }

    .hand-letter {
        margin-top: 7px;
    }
    .pot-chip {
    transition: transform 0.3s ease-out; /* 회전 애니메이션 효과 추가 */
    position: absolute; /* 칩들이 겹쳐서 쌓일 수 있도록 */
    width: 2.225rem;  /* 50px */
    height: 2.225rem; /* 50px */
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    /* 칩에 약간의 입체감을 줍니다. */
    filter: drop-shadow(2px 2px 3px rgba(0,0,0,0.5));
    }
    .flying-chip {
    position: fixed; /* 화면 전체를 기준으로 자유롭게 이동 */
    width: 2.225rem; /* 50px */
    height: 2.225rem; /* 50px */
    }
}
/*============================poker_app.css 파일 맨 끝에 추가 ========================================*/
/* poker_app.css 맨 끝에 추가 */

.hand-rank-panel {

    /* ✨ 내 자리(player-main)와 동일한 하단 높이와 중앙 기준선 적용 */

    /* ✨ 내 자리의 너비(350px) 절반인 175px에 여백 15px를 더해 옆에 딱 붙임 */
    /* margin-left: 250px;  */
    
    width: 200px;
    height: 330px;
    background: rgba(0, 0, 0, 0.85); 
    border: 2px solid #ffc107;      
    border-radius: 12px;
    padding: 15px;
    color: #fff;
    z-index: 100;
    transition: none; /* 크기 조절 시 흔들림 방지 */
}

.current-hand-display {
    text-align: center;
    border-bottom: 1px solid rgba(255, 215, 0, 0.3);
    padding-bottom: 10px;
    margin-bottom: 10px;
}

.my-hand-name {
    font-size: 1.2rem;
    font-weight: bold;
    color: #ffc107; /* 강조색 */
    margin-top: 5px;
}

.rank-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.rank-list li {
    font-size: 0.9rem;
    padding: 2px 5px;
    color: #888; /* 기본은 흐리게 */
    transition: all 0.3s;
}

.rank-list li.mission-rank {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    margin: 2px 0;
    border-radius: 6px;
    border-left: 4px solid transparent;
    color: #f4f4f4;
    text-shadow: 0 1px 3px rgba(0,0,0,0.9);
}

.rank-list li.random-mission-candidate {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    margin: 2px 0;
    border-radius: 6px;
    border-left: 4px solid transparent;
}

.rank-list li.mission-rank .rank-name,
.rank-list li.random-mission-candidate .rank-name {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.82rem;
}

.mission-badge {
    flex: 0 0 auto;
    padding: 1px 6px;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 900;
    color: #111;
    background: #ffe66d;
    box-shadow: inset 0 -1px 0 rgba(0,0,0,0.25), 0 0 8px rgba(255,255,255,0.15);
}

.random-mission-badge {
    display: none;
    color: #1a1200;
    background: linear-gradient(90deg, #fff16a, #ffb33d);
    box-shadow: 0 0 10px rgba(255, 204, 75, 0.5);
}

.random-mission-candidate.random-mission-active {
    color: #fff7d0;
    background: linear-gradient(90deg, rgba(255, 186, 53, 0.34), rgba(255, 236, 130, 0.08));
    border-left-color: #ffcc4b !important;
    text-shadow: 0 1px 3px rgba(0,0,0,0.9);
}

.random-mission-candidate.random-mission-active .random-mission-badge {
    display: inline-flex;
}

.mission-rank-full-house {
    background: linear-gradient(90deg, rgba(35, 126, 255, 0.34), rgba(35, 126, 255, 0.08));
    border-left-color: #46a7ff !important;
}

.mission-rank-four-card {
    background: linear-gradient(90deg, rgba(177, 85, 255, 0.38), rgba(177, 85, 255, 0.08));
    border-left-color: #c47cff !important;
}

.mission-rank-straight-flush {
    background: linear-gradient(90deg, rgba(255, 76, 76, 0.38), rgba(255, 166, 48, 0.12));
    border-left-color: #ff5f5f !important;
}

.mission-rank-royal {
    position: relative;
    overflow: hidden;
    background: linear-gradient(90deg, rgba(255, 34, 98, 0.36), rgba(255, 216, 72, 0.24), rgba(49, 225, 128, 0.22), rgba(55, 169, 255, 0.28), rgba(178, 89, 255, 0.3));
    border-left-color: #ffd700 !important;
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.2);
}

.mission-rank-royal::after {
    content: "";
    position: absolute;
    inset: -40% -65%;
    background: linear-gradient(110deg, transparent 35%, rgba(255,255,255,0.45) 50%, transparent 65%);
    transform: translateX(-60%);
    animation: royal-shine 2.4s ease-in-out infinite;
    pointer-events: none;
}

.rainbow-royal {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    font-weight: 1000;
    letter-spacing: 0;
}

.rainbow-royal span {
    animation: royal-letter-rainbow 1.6s linear infinite;
}

.rainbow-royal span:nth-child(1) { animation-delay: 0s; }
.rainbow-royal span:nth-child(2) { animation-delay: 0.08s; }
.rainbow-royal span:nth-child(3) { animation-delay: 0.16s; }
.rainbow-royal span:nth-child(4) { animation-delay: 0.24s; }
.rainbow-royal span:nth-child(5) { animation-delay: 0.32s; }
.rainbow-royal span:nth-child(6) { animation-delay: 0.40s; }
.rainbow-royal span:nth-child(7) { animation-delay: 0.48s; }
.rainbow-royal span:nth-child(8) { animation-delay: 0.56s; }

.mission-rank-royal .mission-badge {
    position: relative;
    z-index: 1;
    color: #1b102b;
    background: linear-gradient(90deg, #fff06a, #ff9df0, #8df9ff);
    box-shadow: 0 0 10px rgba(255, 239, 106, 0.55);
}

.mission-rank.active-rank {
    background-size: 180% 100%;
    box-shadow: 0 0 14px rgba(255, 215, 0, 0.35);
}

.mission-success-banner {
    position: absolute;
    left: 50%;
    top: -54px;
    z-index: 5;
    min-width: 178px;
    max-width: 260px;
    padding: 8px 12px;
    border-radius: 999px;
    text-align: center;
    font-size: 0.92rem;
    font-weight: 1000;
    letter-spacing: 0;
    color: #fff;
    transform: translateX(-50%);
    pointer-events: none;
    border: 2px solid rgba(255,255,255,0.72);
    box-shadow: 0 0 18px rgba(255,255,255,0.25), 0 8px 18px rgba(0,0,0,0.45);
    text-shadow: 0 2px 4px rgba(0,0,0,0.95);
    animation: mission-success-pulse 1.05s ease-in-out infinite;
}

.mission-success-banner[hidden] {
    display: none;
}

.mission-success-banner.mission-success-pop {
    animation: mission-success-pop 0.42s ease-out, mission-success-pulse 1.05s ease-in-out 0.42s infinite;
}

.mission-success-full-house {
    background: linear-gradient(90deg, #1265d8, #46a7ff);
}

.mission-success-random {
    background: linear-gradient(90deg, #d58a00, #ffdf5c);
    color: #231600;
    text-shadow: 0 1px 1px rgba(255,255,255,0.28);
    border-color: rgba(255, 246, 190, 0.92);
    box-shadow: 0 0 20px rgba(255, 205, 75, 0.48), 0 8px 18px rgba(0,0,0,0.45);
}

.mission-success-four-card {
    background: linear-gradient(90deg, #7d26d9, #d58cff);
}

.mission-success-straight-flush {
    background: linear-gradient(90deg, #dd2f3b, #ffad30);
}

.mission-success-royal {
    color: transparent;
    background:
        linear-gradient(#111, #111) padding-box,
        linear-gradient(90deg, #ff3b5c, #ffb000, #fff25a, #39e87c, #39b7ff, #bd6dff, #ff3b5c) border-box;
    background-color: #111;
    border-color: transparent;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.62), 0 0 34px rgba(189, 109, 255, 0.35), 0 8px 18px rgba(0,0,0,0.5);
}

.mission-success-royal .mission-success-rainbow {
    background: linear-gradient(90deg, #ff3b5c, #ffb000, #fff25a, #39e87c, #39b7ff, #bd6dff, #ff3b5c);
    background-size: 260% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: royal-success-rainbow 1.4s linear infinite;
    text-shadow: none;
}

@keyframes mission-success-pulse {
    0%, 100% { transform: translateX(-50%) scale(1); filter: brightness(1); }
    50% { transform: translateX(-50%) scale(1.08); filter: brightness(1.22); }
}

@keyframes mission-success-pop {
    0% { transform: translateX(-50%) scale(0.68); opacity: 0; }
    68% { transform: translateX(-50%) scale(1.14); opacity: 1; }
    100% { transform: translateX(-50%) scale(1); opacity: 1; }
}

@keyframes royal-success-rainbow {
    0% { background-position: 0% 50%; }
    100% { background-position: 260% 50%; }
}

@keyframes royal-letter-rainbow {
    0% { color: #ff3b5c; text-shadow: 0 0 8px rgba(255, 59, 92, 0.7); }
    18% { color: #ffb000; text-shadow: 0 0 8px rgba(255, 176, 0, 0.75); }
    36% { color: #fff25a; text-shadow: 0 0 8px rgba(255, 242, 90, 0.75); }
    54% { color: #39e87c; text-shadow: 0 0 8px rgba(57, 232, 124, 0.75); }
    72% { color: #39b7ff; text-shadow: 0 0 8px rgba(57, 183, 255, 0.75); }
    90% { color: #bd6dff; text-shadow: 0 0 8px rgba(189, 109, 255, 0.75); }
    100% { color: #ff3b5c; text-shadow: 0 0 8px rgba(255, 59, 92, 0.7); }
}

@keyframes royal-shine {
    0%, 35% { transform: translateX(-60%); opacity: 0; }
    50% { opacity: 1; }
    75%, 100% { transform: translateX(60%); opacity: 0; }
}

/* 🌟 현재 내가 가진 족보일 때 강조되는 스타일 */
.rank-list li.active-rank {
    color: #fff;
    font-weight: bold;
    background: rgba(255, 193, 7, 0.2);
    border-left: 4px solid #ffc107;
    transform: translateX(5px);
}

.admin-bot-level-panel,
.admin-forced-rank-panel {
    margin-top: 12px;
    padding: 10px;
    border: 1px solid rgba(255, 214, 92, 0.45);
    background: rgba(0, 0, 0, 0.28);
    border-radius: 6px;
}

.admin-panel-title {
    color: #ffd65c;
    font-weight: 700;
    font-size: 13px;
    margin-bottom: 8px;
}

.admin-forced-rank-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 6px 8px;
    border: 1px solid rgba(255, 214, 92, 0.35);
    background: rgba(255, 214, 92, 0.12);
    color: #ffd65c;
    border-radius: 5px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
}

.admin-forced-rank-toggle:hover {
    background: rgba(255, 214, 92, 0.2);
}

.admin-bot-level-list {
    display: grid;
    gap: 6px;
    font-size: 13px;
    color: #fff;
}

.admin-bot-level-item {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 6px 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 5px;
}

.admin-bot-level-badge {
    color: #00ffcc;
    white-space: nowrap;
}

.admin-forced-rank-options {
    display: grid;
    gap: 5px;
    font-size: 12px;
    margin-top: 8px;
}

.admin-forced-rank-options.is-collapsed {
    display: none;
}

.admin-forced-rank-options label {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #fff;
    cursor: pointer;
}
/* [poker_app.css] 맨 끝에 추가 */

@keyframes lucky-pulse {
    0% { transform: scale(1); text-shadow: 0 0 5px #ffc107; }
    50% { transform: scale(1.3); text-shadow: 0 0 20px #ff0000, 0 0 30px #ffc107; color: #ff0000; }
    100% { transform: scale(1); text-shadow: 0 0 5px #ffc107; }
}

.lucky-revel {
    animation: lucky-pulse 0.5s ease-in-out 20; /* 3번 강조 */
    z-index: 101;
}
/* 모바일 대응: 가로폭이 좁으면 가이드를 숨기거나 크기를 줄입니다 */
@media screen and (max-width: 600px) {
    .hand-rank-panel {
        width: 120px !important;
        height: 330px !important;
        font-size: 0.9rem;
        
        /* ✨ 모바일 내 자리 기준선에 맞춰 고정 */
        bottom: 17%; 
        left: -17%;
        
        /* ✨ 모바일 좌석 너비(140px) 절반인 70px에 여백 10px를 더해 배치 */
        margin-left: 78px; 
        
        right: auto; /* 기존 right 설정 해제 */
        padding: 8px;
        display: block; /* 모바일에서도 표시되도록 유지 (원하시면 숨길 수도 있음) */
    }
    
    .my-hand-name { font-size: 0.9rem; }
    .rank-list {
        list-style: none;
        padding: 0;
        margin: 0;
    }
    .rank-list li {
        font-size: 0.6rem;
        padding: 1px 5px;
        color: #888; /* 기본은 흐리게 */
        transition: all 0.3s;
    }

    .rank-list li.mission-rank {
        gap: 3px;
        padding: 1px 4px;
    }

    .mission-badge {
        padding: 0 4px;
        font-size: 0.5rem;
    }

    .mission-success-banner {
        top: -42px;
        min-width: 126px;
        max-width: 172px;
        padding: 6px 8px;
        font-size: 0.66rem;
    }
}
/* poker_app.css 또는 인라인 스타일에 추가 */
.hand-rank-panel {
    position: fixed;              /* 화면 크기 변경에도 뷰포트 기준으로 유지 */
    z-index: 1000;
    cursor: move;                 /* 드래그할 때 손 모양 */
    user-select: none;            /* 텍스트 드래그 방지 */
    -webkit-user-select: none;
    -ms-user-select: none;
    touch-action: none;
    transition: none;             /* 드래그 중 부드러움 방지 */
}

.hand-rank-panel:active {
    cursor: grabbing;
}

/* 드래그 핸들 (선택사항이지만 추천) */
.hand-rank-panel .drag-handle {
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.6);
    color: #ffd700;
    text-align: center;
    font-weight: bold;
    border-radius: 4px 4px 0 0;
    cursor: move;
}
.hand-rank-panel {
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    border-radius: 8px;
    overflow: visible;
}

.drag-handle {
    padding: 10px 12px;
    background: linear-gradient(#2a2a2a, #1f1f1f);
    color: #ffd700;
    text-align: center;
    font-weight: bold;
    cursor: move;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.reset-btn {
    position: absolute;
    right: 12px;
    font-size: 18px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 50%;
    transition: all 0.2s;
}

.reset-btn:hover {
    background: rgba(255, 215, 0, 0.2);
    transform: rotate(180deg);
}

.hand-rank-panel:active,
.hand-rank-panel.dragging {
    cursor: grabbing;
    box-shadow: 0 8px 25px rgba(0,0,0,0.6);
}

/* Final mobile portrait table tuning */
@media screen and (max-width: 600px) and (orientation: portrait) {
    .poker-table-wrapper {
        height: calc(100dvh - 34px) !important;
    }

    .player-seat {
        width: 140px !important;
        min-height: 136px !important;
    }

    .player-box {
        min-height: 130px !important;
        padding: 4px !important;
        overflow: visible !important;
    }

    #opponent-2 {
        top: 5.5% !important;
        left: 3% !important;
    }

    #opponent-3 {
        top: 5.5% !important;
        right: 3% !important;
    }

    #opponent-1 {
        top: 49% !important;
        left: 3% !important;
        transform: translateY(-50%) !important;
    }

    #opponent-4 {
        top: 49% !important;
        right: 3% !important;
        transform: translateY(-50%) !important;
    }

    #player-main {
        bottom: 54px !important;
        left: 50% !important;
        width: min(86vw, 350px) !important;
        min-height: 190px !important;
    }

    #player-main .player-box {
        min-height: 184px !important;
    }

    .player-header {
        gap: 3px !important;
        margin-bottom: 2px !important;
    }

    .avatar {
        width: 40px !important;
        height: 40px !important;
    }

    .player-info {
        width: 82px !important;
        font-size: 0.62rem !important;
        line-height: 1.05 !important;
    }

    .player-name {
        font-size: 0.68rem !important;
    }

    .player-money,
    .player-total-coins {
        font-size: 0.58rem !important;
    }

    .card-area {
        min-height: 78px !important;
        padding-left: 8px !important;
    }

    #player-main .card-area {
        min-height: 116px !important;
        padding-left: 18px !important;
    }

    .card {
        width: 46px !important;
        height: 64px !important;
        margin-left: 0 !important;
    }

    #player-main .card {
        width: 58px !important;
        height: 80px !important;
        margin-left: 0 !important;
    }

    .pot-total {
        top: 52% !important;
        left: 50% !important;
        width: min(76vw, 300px) !important;
        font-size: 0.78rem !important;
        z-index: 900 !important;
    }

    .opener-info {
        top: 44% !important;
        width: min(78vw, 300px) !important;
        font-size: 0.68rem !important;
        z-index: 900 !important;
    }

    .action-buttons {
        bottom: 6px !important;
        gap: 5px !important;
        width: min(92vw, 340px) !important;
        grid-template-columns: repeat(2, minmax(94px, 1fr)) !important;
    }

    .action-buttons button {
        width: 94px !important;
        height: 42px !important;
        font-size: 0.74rem !important;
    }

    .hand-rank-panel {
        width: 108px !important;
        height: 300px !important;
        right: -4px !important;
        left: auto !important;
        bottom: 18% !important;
        margin-left: 0 !important;
        font-size: 0.72rem !important;
        padding: 7px !important;
    }

    .hand-rank-panel .drag-handle {
        touch-action: none !important;
        cursor: grab;
    }

    .hand-rank-panel button,
    .hand-rank-panel input,
    .hand-rank-panel label,
    .admin-forced-rank-panel,
    .admin-forced-rank-toggle,
    .admin-forced-rank-options {
        touch-action: manipulation !important;
        pointer-events: auto !important;
    }

    .admin-forced-rank-toggle {
        min-height: 34px;
        font-size: 0.7rem !important;
        padding: 5px 6px !important;
    }

    .admin-forced-rank-options {
        max-height: 130px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}


.spectator-count-display {
    position: fixed;
    top: 42px;
    left: 8px;
    z-index: 1200;
    padding: 3px 30px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.62);
    border: 1px solid rgba(255, 214, 92, 0.52);
    color: #ffd65c;
    font-size: 12px;
    font-weight: 800;
    text-shadow: 0 1px 2px #000;
    pointer-events: none;
}

.bot-control-area {
    position: absolute;
    top: auto;
    bottom: calc(3% + 336px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 10002;
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
}

.bot-control-area .btn-add-bot {
    position: relative;
    min-width: 178px;
    min-height: 58px;
    padding: 14px 30px 14px 54px;
    border: 2px solid rgba(255, 230, 120, 0.92);
    border-radius: 18px;
    background:
        radial-gradient(circle at 22% 24%, rgba(255, 255, 255, 0.55), transparent 18%),
        linear-gradient(135deg, #ffcf33 0%, #f28b16 48%, #0fbc9f 100%);
    color: #1b1000;
    font-size: 1.22rem;
    font-weight: 950;
    letter-spacing: 0.02em;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.45);
    box-shadow:
        0 0 0 3px rgba(0, 0, 0, 0.46),
        0 0 24px rgba(255, 207, 51, 0.72),
        0 10px 24px rgba(0, 0, 0, 0.5);
    cursor: pointer;
    overflow: hidden;
    animation: add-bot-pulse 1.55s ease-in-out infinite;
}

.bot-control-area .btn-add-bot .bot-add-cost {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    border-radius: inherit;
    background: linear-gradient(135deg, #17313a 0%, #0f7f70 52%, #d77a0d 100%);
    font-size: 1rem;
    line-height: 1.1;
    color: #fff7c5;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85);
    opacity: 0;
    transform: scale(0.94);
    transition: opacity 160ms ease, transform 160ms ease;
    pointer-events: none;
}

.bot-control-area .btn-add-bot:hover .bot-add-cost,
.bot-control-area .btn-add-bot:focus-visible .bot-add-cost {
    opacity: 1;
    transform: scale(1);
}

.bot-control-area .btn-add-bot::before {
    content: "";
    position: absolute;
    left: 16px;
    top: 50%;
    width: 28px;
    height: 28px;
    transform: translateY(-50%);
    border-radius: 50%;
    background:
        radial-gradient(circle at 50% 44%, #fff7c2 0 16%, transparent 18%),
        linear-gradient(135deg, #10242d, #2f5260);
    box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.32), 0 0 12px rgba(0, 255, 214, 0.72);
}

.bot-control-area .btn-add-bot::after {
    content: "";
    position: absolute;
    inset: -55% auto -55% -28%;
    width: 42%;
    transform: rotate(18deg);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
    animation: add-bot-shine 2.4s ease-in-out infinite;
}

.bot-control-area .btn-add-bot:hover {
    transform: translateY(-3px) scale(1.04);
    box-shadow:
        0 0 0 3px rgba(0, 0, 0, 0.48),
        0 0 34px rgba(255, 230, 92, 0.95),
        0 14px 30px rgba(0, 0, 0, 0.58);
}

.bot-control-area .btn-add-bot:active {
    transform: translateY(1px) scale(0.99);
}

.bot-cost-float {
    position: fixed;
    z-index: 2147483647;
    color: #ffe45c;
    font-size: 1.34rem;
    font-weight: 950;
    line-height: 1;
    white-space: nowrap;
    pointer-events: none;
    text-shadow: 0 2px 4px #000, 0 0 8px #000, 0 0 18px rgba(255, 196, 0, 1);
    transform: translate(-50%, 0) scale(0.82);
    animation: bot-cost-float-up 1.05s ease-out forwards;
}

@keyframes bot-cost-float-up {
    0% { opacity: 0; transform: translate(-50%, 0) scale(0.72); }
    16% { opacity: 1; transform: translate(-50%, -18px) scale(1.18); }
    68% { opacity: 1; transform: translate(-50%, -62px) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -92px) scale(0.9); }
}

@keyframes add-bot-pulse {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.16); }
}

@keyframes add-bot-shine {
    0%, 42% { left: -34%; opacity: 0; }
    58% { opacity: 1; }
    100% { left: 112%; opacity: 0; }
}

.spectator-kick-controls {
    position: fixed;
    top: 70px;
    left: 8px;
    z-index: 1201;
    display: flex;
    flex-direction: column;
    gap: 5px;
    align-items: flex-start;
}

.spectator-kick-controls .btn-kick-spectator {
    position: static !important;
    transform: none !important;
    font-size: 11px;
    padding: 5px 8px;
    white-space: nowrap;
}

.admin-forced-target-row {
    display: flex !important;
    align-items: center;
    gap: 6px;
}

.admin-forced-target-row select {
    flex: 1;
    min-width: 0;
    padding: 5px 7px;
    border-radius: 6px;
    border: 1px solid rgba(255, 214, 92, 0.45);
    background: rgba(0, 0, 0, 0.72);
    color: #ffe780;
    font-weight: 700;
}

.admin-forced-rank-button {
    width: 100%;
    min-height: 30px;
    border: 1px solid rgba(255, 214, 92, 0.42);
    border-radius: 7px;
    background: linear-gradient(135deg, rgba(20, 34, 38, 0.96), rgba(60, 43, 10, 0.92));
    color: #ffe780;
    font-size: 0.76rem;
    font-weight: 800;
    cursor: pointer;
    text-align: left;
    padding: 6px 9px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.admin-forced-rank-button:hover {
    border-color: rgba(255, 235, 140, 0.9);
    box-shadow: 0 0 10px rgba(255, 214, 92, 0.42);
}

.admin-forced-rank-button.is-pending,
.admin-forced-rank-button:disabled {
    color: #1b1000;
    background: linear-gradient(135deg, #ffd65c, #ff8a2a);
    border-color: #fff2a8;
    cursor: wait;
    box-shadow: 0 0 14px rgba(255, 214, 92, 0.72);
}

.admin-forced-rank-button.is-pending::after {
    content: " 예약중..";
    font-size: 0.68rem;
    font-weight: 900;
}

@media (max-width: 600px) {
    .bot-control-area {
        top: auto;
        bottom: 250px;
    }

    .bot-control-area .btn-add-bot {
        min-width: 138px;
        min-height: 44px;
        padding: 10px 18px 10px 42px;
        border-radius: 14px;
        font-size: 0.92rem;
    }

    .bot-control-area .btn-add-bot::before {
        left: 12px;
        width: 22px;
        height: 22px;
    }
}
