/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', 'Noto Sans KR', sans-serif;
    user-select: none;
}

body {
    background-color: #0f111a;
    color: #f3f4f6;
    overflow: hidden;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

#app {
    width: 100%;
    height: 100%;
    max-width: 1400px;
    max-height: 900px;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    background: radial-gradient(circle, #1a1f35 0%, #0c0e17 100%);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    overflow: hidden;
}
/* 게임 화면(1920×1080 스테이지)은 #app 캡(1400×900)을 넘으므로 게임 활성 시 풀뷰포트로 해제 */
body:has(#game-room.active) #app {
    max-width: none; max-height: none; border-radius: 0; border: none; box-shadow: none;
}

/* Screen Switcher */
.screen {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
    display: flex;
    flex-direction: column;
}

.screen.active {
    opacity: 1;
    visibility: visible;
}

/* Buttons and UI Elements */
.btn {
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 14px;
}

.btn-primary {
    background: linear-gradient(135deg, #ffd700 0%, #b8860b 100%);
    color: #000;
    box-shadow: 0 4px 15px rgba(218, 165, 32, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(218, 165, 32, 0.5);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #991b1b 100%);
    color: white;
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
}

.btn-accent {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 4px;
}

/* Badge */
.badge {
    background-color: rgba(255, 255, 255, 0.1);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: #ffd700;
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.badge-accent {
    background-color: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
    border: 1px solid rgba(96, 165, 250, 0.3);
}

/* 1. Lobby Screen */
#lobby {
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle, #251c41 0%, #0d091a 100%);
}

.lobby-card {
    background: rgba(15, 15, 25, 0.85);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    max-width: 450px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.lobby-header {
    text-align: center;
    margin-bottom: 30px;
}

.lobby-header h1 {
    font-size: 36px;
    font-weight: 800;
    background: linear-gradient(to right, #ffd700, #ffa500);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 2px;
}

.lobby-header p {
    color: #9ca3af;
    font-size: 14px;
    margin-top: 5px;
}

.lobby-form .form-group {
    margin-bottom: 20px;
}

.lobby-form label {
    display: block;
    font-size: 12px;
    color: #9ca3af;
    margin-bottom: 6px;
    font-weight: 600;
    text-transform: uppercase;
}

.lobby-form input {
    width: 100%;
    padding: 12px;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: white;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.lobby-form input:focus {
    border-color: #ffd700;
    outline: none;
    background-color: rgba(255, 255, 255, 0.1);
}

.lobby-form button {
    width: 100%;
    margin-top: 10px;
}

.lobby-footer {
    text-align: center;
    margin-top: 25px;
    font-size: 11px;
    color: #4b5563;
}

/* 2. Game Room Screen */
#game-room {
    background: #05080f;
}
/* 게임 화면: 1920×1080 가상 스테이지를 뷰포트에 맞춰 비율유지 스케일(레터박스 → 절대 안 잘림) */
#game-room.active {
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
#game-stage {
    width: 1920px;
    height: 1080px;
    flex: 0 0 auto;
    position: relative;     /* 좌(로그)·중(보드 1440×1080)·우(헤더) 절대배치 컨테이너 */
    background: #0b0d19;
    overflow: hidden;
    transform: scale(var(--gs, 1));
    transform-origin: center center;
}

/* 헤더: 우측 240px 여백에 세로 패널(정보 + 관리 버튼) */
.game-header {
    position: absolute;
    right: 0;
    top: 0;
    width: 240px;
    height: 1080px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    padding: 26px 18px;
    background-color: rgba(0, 0, 0, 0.45);
    border-left: 1px solid rgba(255, 255, 255, 0.06);
}
.game-header .room-info { justify-content: center; }
.game-header .pot-info { margin: 2px 0; }
.game-header .btn { width: 100%; }
/* 패널 타이틀 */
.header-title {
    font-size: 13px; font-weight: 800; letter-spacing: 3px; color: #cbd5e1;
    text-align: center; padding-bottom: 10px; margin-bottom: 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}
/* 관리 버튼 그룹: 패널 하단으로 분산(상단 정보와 분리) */
.header-actions {
    margin-top: auto; display: flex; flex-direction: column; gap: 12px;
    padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.header-actions-label {
    font-size: 11px; font-weight: 700; letter-spacing: 2px; color: #94a3b8; text-align: center;
}

.room-info {
    display: flex;
    gap: 10px;
}

.pot-info {
    text-align: center;
}

.pot-title {
    font-size: 11px;
    color: #9ca3af;
    font-weight: 700;
    letter-spacing: 1px;
}

.pot-amount {
    font-size: 24px;
    font-weight: 800;
    color: #ffd700;
}

/* 보드: 중앙 1440×1080(높이 꽉, 좌우 240px 여백). 원본 4:3과 동일 비율이라 왜곡 없음 */
.table-container {
    position: absolute;
    left: 240px;
    top: 0;
    width: 1440px;
    height: 1080px;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
}
/* PixiJS 캔버스: 원본 1024×768 → table-container 안에서 비율유지 최대(크기는 JS fitGameStage가 설정) */
#pixi-stage { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; }
#pixi-stage canvas { display: block; }
/* 보드 위 오버레이: 다음판/더블업(하단 중앙), 타짜 패널(상단 중앙). 인라인보다 우선하도록 #game-stage 셀렉터 사용 */
#game-stage .nexthand-bar { position: absolute; left: 240px; right: 240px; bottom: 44px; z-index: 60; margin: 0; }
#game-stage #tazza-panel { position: absolute; left: 240px; right: 240px; top: 24px; z-index: 60; margin: 0; max-width: none; }

.poker-table {
    width: 90%;
    height: 80%;
    max-width: 1000px;
    max-height: 520px;
    background: radial-gradient(ellipse at center, #0a5f38 0%, #042f1b 100%);
    border: 24px solid #3d2511; /* 목재 테두리 */
    border-radius: 50% / 50%;
    box-shadow: 
        inset 0 0 40px rgba(0, 0, 0, 0.8),
        0 15px 35px rgba(0, 0, 0, 0.6),
        0 0 0 2px #1f140a;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Table Center Info */
.table-center {
    width: 250px;
    height: 120px;
    background-color: rgba(0, 0, 0, 0.6);
    border: 2px solid rgba(255, 215, 0, 0.3);
    border-radius: 60px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 10px 20px rgba(0,0,0,0.5);
    z-index: 10;
}

.game-status {
    text-align: center;
}

.status-label {
    font-size: 10px;
    color: #9ca3af;
    font-weight: 700;
    letter-spacing: 1.5px;
}

.status-value {
    font-size: 20px;
    font-weight: 800;
    color: #ffffff;
    margin: 4px 0;
}

.call-money-info {
    font-size: 12px;
    color: #ffd700;
    font-weight: 600;
}

/* Player Seat Positions */
.player-seat {
    position: absolute;
    width: 130px;
    height: 130px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 5;
    transition: transform 0.3s ease;
}

/* Seat 5-Way Positions around the Ellipse */
.seat-0 { bottom: -40px; left: 50%; transform: translateX(-50%); } /* 본인 (중앙 하단) */
.seat-1 { right: -30px; top: 60%; transform: translateY(-50%); }  /* 우측 하단 */
.seat-2 { right: 80px; top: -30px; }                             /* 우측 상단 */
.seat-3 { left: 80px; top: -30px; }                              /* 좌측 상단 */
.seat-4 { left: -30px; top: 60%; transform: translateY(-50%); }   /* 좌측 하단 */

/* Player Avatar & Details */
.player-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: #1e293b;
    border: 3px solid #64748b;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    position: relative;
}

.player-details {
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 4px 8px;
    text-align: center;
    margin-top: 6px;
    width: 110px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.player-name {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-chips {
    display: block;
    font-size: 11px;
    color: #ffd700;
    font-weight: 600;
}

/* Active Turn Highlight */
.player-seat.active-turn .player-avatar {
    border-color: #ffd700;
    animation: pulse-border 1.5s infinite;
}

@keyframes pulse-border {
    0% { box-shadow: 0 0 0 0 rgba(255, 215, 0, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(255, 215, 0, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 215, 0, 0); }
}

/* Dealer Button */
.dealer-button {
    position: absolute;
    width: 20px;
    height: 20px;
    background-color: white;
    color: black;
    border-radius: 50%;
    font-weight: 800;
    font-size: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1px solid #ccc;
    top: 5px;
    right: 35px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* Card Slot Layout */
.player-cards {
    position: absolute;
    display: flex;
    gap: -15px; /* 약간 포개지게 설정 */
    pointer-events: none;
}

/* 본인 자리(Seat 0)의 카드는 좀 더 크게, 테이블 외부 영역으로 */
.seat-0 .player-cards {
    bottom: 110px;
    gap: 5px;
    pointer-events: auto; /* 본인 카드는 터치/클릭 가능 */
}

/* 타인 자리는 카드를 작게 표시 */
.seat-1 .player-cards, .seat-2 .player-cards, .seat-3 .player-cards, .seat-4 .player-cards {
    position: absolute;
    transform: scale(0.6);
}

.seat-1 .player-cards { left: -80px; top: 10px; }
.seat-2 .player-cards { bottom: -60px; }
.seat-3 .player-cards { bottom: -60px; }
.seat-4 .player-cards { right: -80px; top: 10px; }

/* Card CSS representation */
.card {
    width: 50px;
    height: 70px;
    border-radius: 6px;
    background-color: white;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    border: 1px solid #ccc;
    position: relative;
    background-size: cover;
    background-position: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.seat-0 .card {
    width: 70px;
    height: 100px;
    cursor: pointer;
}

/* Selected Card for Discard */
.card.selected-discard {
    transform: translateY(-20px) scale(1.05);
    box-shadow: 0 12px 20px rgba(239, 68, 68, 0.5);
    border: 2px solid #ef4444;
}

.card-back {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border: 2px solid #ffffff;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
}

/* Card Suit Colors */
.card.red { color: #ef4444; }
.card.black { color: #1e293b; }

.card-suit {
    position: absolute;
    top: 5px;
    left: 5px;
    font-size: 14px;
    font-weight: bold;
}

.card-value {
    position: absolute;
    bottom: 5px;
    right: 5px;
    font-size: 16px;
    font-weight: 800;
}

/* Bottom Betting Controller Action Bar */
.action-bar {
    background-color: rgba(15, 23, 42, 0.95);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding: 15px 30px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex-shrink: 0;
}

.action-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    width: 100%;
}

.btn-bet {
    flex: 1;
    max-width: 130px;
    padding: 14px;
    border-radius: 8px;
    font-weight: 800;
    font-size: 13px;
    border: none;
    cursor: pointer;
    text-transform: uppercase;
    color: white;
    transition: all 0.15s ease;
    box-shadow: 0 4px 6px rgba(0,0,0,0.15);
}

.btn-bet:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.3);
}

.btn-bet:active:not(:disabled) {
    transform: translateY(1px);
}

.btn-bet:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: none;
}

.btn-die { background: linear-gradient(135deg, #475569 0%, #1e293b 100%); }
.btn-check { background: linear-gradient(135deg, #10b981 0%, #047857 100%); }
.btn-call { background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%); }
.btn-half { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); }
.btn-quarter { background: linear-gradient(135deg, #ec4899 0%, #be185d 100%); }
.btn-bbing { background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%); }

/* Slider & Custom Raise Panel */
.custom-bet-slider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

.custom-bet-slider input[type="range"] {
    flex: 1;
    -webkit-appearance: none;
    background: #334155;
    height: 6px;
    border-radius: 3px;
    outline: none;
}

.custom-bet-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ffd700;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

#bet-range-value {
    font-weight: 700;
    color: #ffd700;
    min-width: 60px;
    text-align: right;
}

/* Logging console */
/* 원본 CGameHistDlg/CGameResultDlg(setPos 5,565): 게임 화면 좌하단 패널 → 보드 위 오버레이로 고정.
   같은 위치에 [진행]/[결과] 탭으로 전환(원본도 CChatScoreDlg 심볼 공유). */
.log-panel {
    position: absolute;     /* #game-stage(1920×1080) 좌측 240px 여백 전체에 세로 패널 */
    left: 0;
    top: 0;
    height: 1080px;
    width: 240px;           /* 보드 좌측 여백(240px) → 보드와 겹치지 않음 */
    z-index: 50;
    border-radius: 0;
    background-color: rgba(0, 0, 0, 0.78);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.log-panel .header-title { padding: 12px 12px 9px; margin-bottom: 0; flex-shrink: 0; }
.log-tabs { display: flex; flex-shrink: 0; border-bottom: 1px solid rgba(255, 255, 255, 0.1); }
.log-tab {
    flex: 1; background: none; border: 0; color: #888; font-size: 12px; padding: 5px 0;
    cursor: pointer; font-family: inherit;
}
.log-tab:hover { color: #ccc; }
.log-tab.active { color: #fde047; border-bottom: 2px solid #fde047; }
.log-console, .result-console {
    flex: 1; overflow-y: auto; padding: 8px 14px; font-family: monospace; font-size: 11px;
}
.result-line { line-height: 1.5; }
.result-line.hdr { color: #888; text-align: center; margin: 5px 0 2px; }
.result-line.win { color: #ff8600; font-weight: 700; }   /* 원본 승=주황 #FF8600 */
.result-line.lose { color: #dddddd; }                    /* 원본 패=흰색 */

.log-message {
    margin-bottom: 4px;
    line-height: 1.4;
}

.log-message.system { color: #9ca3af; }
.log-message.info { color: #60a5fa; }
.log-message.success { color: #34d399; }
.log-message.error { color: #f87171; }
.log-message.bet { color: #fbbf24; }
.log-message.win { color: #fde047; font-weight: 700; }
