* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Adopt index.html design tokens */
:root {
    --bg: #0d0f13;
    --card: #141821;
    --card-2: #1a1f27;
    --text: #e8eaed;
    --text-dim: #98a2b3;
    --primary: #2ce58d;
    --primary-2: #2ad1b8;
    --ring: rgba(44, 229, 141, 0.35);
    --safe-top: env(safe-area-inset-top);
    --safe-bottom: env(safe-area-inset-bottom);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background-color: #0d0f13;
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

h1 {
    display: none;
}

/* 牌桌 */
.poker-table {
    background: radial-gradient(ellipse at center, #2e7d32 0%, #1b5e20 100%);
    border-radius: 150px;
    width: 400px;
    max-width: 90%;
    height: 600px;
    margin: 0 auto;
    position: relative;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    border: 10px solid #8b4513;
}

/* 公共牌区域 */
.community-cards {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.pot-info {
	display: inline-block;
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 20px;
    background: rgba(0,0,0,0.5);
    padding: 10px 20px;
    border-radius: 10px;
}

.cards-row {
    display: flex;
    gap: 8px;
    justify-content: center;
}

/* 扑克牌样式 */
.card {
    width: 50px;
    height: 70px;
    background: white;
    border-radius: 5px;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.card.red {
    color: #e53935;
}

.card.black {
    color: #000;
}

.card-back {
    background: linear-gradient(45deg, #1976d2 25%, #2196f3 25%, #2196f3 50%, #1976d2 50%, #1976d2 75%, #2196f3 75%, #2196f3);
    background-size: 20px 20px;
}

/* 玩家位置 */
.players-container {
    position: relative;
    width: 100%;
    height: 100%;
}

.player-seat {
    position: absolute;
    width: 100px;
    background: rgba(0,0,0,0.7);
    border-radius: 8px;
    padding: 8px;
    text-align: center;
}

/* 6个座位的位置 - 竖版布局 */
#seat-0 { top: 70%; right: -60px; transform: translateY(-50%); } /* 庄位 */
#seat-1 { bottom: -40px; right: 50%; transform: translateX(50%); } /* 小盲位 */
#seat-2 { bottom: 15%; left: -60px; } /* 大盲位 */
#seat-3 { top: 30%; left: -60px; transform: translateY(-50%); } /* 枪口位 */
#seat-4 { top: -40px; left: 50%; transform: translateX(-50%); } /* 中间位 */
#seat-5 { top: 15%; right: -60px; } /* 关煞位 */

.player-name {
    font-weight: bold;
    margin-bottom: 5px;
}

.player-chips {
    color: #ffd700;
    margin-bottom: 5px;
}

.player-cards {
    display: flex;
    gap: 5px;
    justify-content: center;
    margin: 6x 0;
}

.player-cards .card {
    width: 35px;
    height: 50px;
}

.player-bet {
    color: #4CAF50;
    font-weight: bold;
}

.player-status {
    color: #ff9800;
    font-size: 12px;
    margin-top: 5px;
}

.player-seat.active {
    border: 2px solid #ffd700;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}

.player-seat.human {
    background: rgba(76, 175, 80, 0.3);
}

.player-last-action {
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    color: #fff;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 11px;
    white-space: nowrap;
    border: 1px solid rgba(255,255,255,0.2);
    display: none;
}

.player-last-action.show {
    display: block;
}

/* 报告按钮组 */
.report-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
}

#replay-hand-btn {
    padding: 10px 30px;
    background: #2196f3;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
}

#replay-hand-btn:hover {
    background: #1976d2;
}

/* 控制面板 */
.control-panel {
    margin-top: 40px;
    background: rgba(0,0,0,0.5);
    padding: 20px;
    border-radius: 10px;
}

.gto-suggestions {
    display: none;
}

.gto-suggestions h3 {
    margin-bottom: 10px;
    color: #4CAF50;
}

#gto-advice {
    font-size: 14px;
    line-height: 1.6;
}

.gto-action {
    margin: 5px 0;
    padding: 5px;
    background: rgba(255,255,255,0.05);
    border-radius: 3px;
}

/* 行动按钮 */
.action-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 10px;
}

.action-btn {
    font-size: 16px;
    font-weight: bold;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
    line-height: 1.2;
    min-height: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

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

#fold-btn {
    background: #e53935;
    color: white;
}

#fold-btn:hover:not(:disabled) {
    background: #c62828;
}

#check-btn, #call-btn {
    background: #2196f3;
    color: white;
}

#check-btn:hover:not(:disabled), #call-btn:hover:not(:disabled) {
    background: #1976d2;
}

#bet-btn, #raise-btn {
    background: #4CAF50;
    color: white;
}

#bet-btn:hover:not(:disabled), #raise-btn:hover:not(:disabled) {
    background: #388e3c;
}

#allin-btn {
    background: #ff9800;
    color: white;
}

#allin-btn:hover:not(:disabled) {
    background: #f57c00;
}

/* 下注控制 */
.bet-controls {
	margin-top: 5px;
    grid-column: span 2;
    background: rgba(255,255,255,0.1);
    padding: 10px 15px;
    border-radius: 5px;
}

.bet-controls label {
    display: block;
    margin-bottom: 5px;
}

#bet-amount {
    width: 70%;
    margin-right: 10px;
}

#bet-amount-input {
    width: 25%;
    padding: 5px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    border-radius: 3px;
}

/* 行动历史 */
.action-history {
    background: rgba(0,0,0,0.8);
    padding: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.2);
    margin-bottom: 20px;
}

#history-list {
    display: flex;
    flex-direction: row;
    gap: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    font-size: 13px;
    line-height: 1.4;
    -webkit-overflow-scrolling: touch;
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

#history-list::-webkit-scrollbar {
    display: none;  /* Chrome, Safari and Opera */
}

.history-item {
    flex-shrink: 0;
    padding: 5px 10px;
    background: rgba(255,255,255,0.1);
    border-radius: 15px;
    border: 1px solid rgba(255,255,255,0.2);
	font-size: 12px;
}

/* 游戏控制 */
.game-controls {
    margin-top: 20px;
    text-align: center;
}

#new-game-btn, #next-hand-btn, #replay-btn, #show-report-btn {
      padding: 15px 30px;
      font-size: 18px;
      font-weight: bold;
      background: #4CAF50;
      color: white;
      border: none;
      border-radius: 5px;
      cursor: pointer;
      transition: all 0.3s;
      margin: 0 5px;
}

#new-game-btn:hover, #next-hand-btn:hover, #replay-btn:hover, #show-report-btn:hover {
      background: #388e3c;
}

/* GTO分析报告 */
.gto-report {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.95);
    border: 2px solid #4CAF50;
    border-radius: 10px;
    padding: 30px;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 10px 50px rgba(0,0,0,0.8);
}

.gto-report h3 {
    color: #4CAF50;
    margin-bottom: 20px;
    text-align: center;
    font-size: 24px;
}

#report-content {
    margin: 20px 0;
    line-height: 1.8;
}

.report-section {
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(255,255,255,0.05);
    border-radius: 5px;
}

.report-section h4 {
    color: #2196f3;
    margin-bottom: 10px;
}

.decision-item {
    margin: 10px 0;
    padding: 10px;
    background: rgba(255,255,255,0.05);
    border-radius: 3px;
}

.correct-decision {
    border-left: 3px solid #4CAF50;
}

.suboptimal-decision {
    border-left: 3px solid #ff9800;
}

.poor-decision {
    border-left: 3px solid #e53935;
}

.ev-positive {
    color: #4CAF50;
}

.ev-negative {
    color: #e53935;
}

#close-report-btn {
    display: block;
    margin: 20px auto 0;
    padding: 10px 30px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
}

#close-report-btn:hover {
    background: #388e3c;
}

/* Language selector — unified height (match GTO trainer) */
.language-selector{
    max-width: 375px;
    margin: calc(16px + var(--safe-top, 0px)) auto 12px;
    padding: 16px;
    height: 120px; /* fixed height to keep consistent across pages */
    display: grid; /* enable vertical centering */
    align-content: center;
    background: var(--card-2);
    border-radius: 14px;
    box-shadow: 0 0 0 1px rgba(255,255,255,0.04) inset;
    border: 1px solid rgba(255,255,255,0.06);
}
.language-selector h2{
    margin: 0 0 10px 0;
    text-align: center;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: .3px;
    color: var(--text);
}
.language-buttons{
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.lang-btn{
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: var(--card);
    color: var(--text);
    box-shadow: 0 0 0 1px rgba(255,255,255,0.04) inset;
    border: none;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: transform .12s ease, background .2s ease, box-shadow .2s ease;
}
.lang-btn:hover{
    background: #1b222c;
}
.lang-btn:active{
    transform: scale(0.98);
    box-shadow: 0 0 0 2px var(--ring);
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.1);
}

::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.5);
}

/* 移动端适配 */
@media (max-width: 768px) {
    .container {
        width: 100%;
        padding: 10px;
    }
    
    h1 {
        font-size: 24px;
        margin-bottom: 20px;
    }
    
    /* 牌桌适配 */
    .poker-table {
        width: 300px;
        height: 450px;
        border-radius: 120px;
        border-width: 5px;
    }
    
    /* 座位调整 */
    .player-seat {
        width: 80px;
        padding: 5px;
        font-size: 11px;
    }
    
    #seat-0 { top: 70%; right: -45px; transform: translateY(-50%); }
    #seat-1 { bottom: -25px; right: 50%; transform: translateX(50%); }
    #seat-2 { bottom: 15%; left: -45px; }
    #seat-3 { top: 30%; left: -45px; transform: translateY(-50%); }
    #seat-4 { top: -25px; left: 50%; transform: translateX(-50%); }
    #seat-5 { top: 15%; right: -45px; }
    
    .player-cards .card {
        width: 30px;
        height: 40px;
    }
    
    /* 公共牌 */
    .pot-info {
        font-size: 16px;
        padding: 8px 15px;
    }
    
    .card {
        width: 30px;
        height: 45px;
    }
    
    /* 控制面板 */
    .control-panel {
        margin-top: 20px;
        padding: 15px;
    }
    
    .action-buttons {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    
    .action-btn {
        font-size: 14px;
        min-height: 40px;
    }
    
    /* GTO建议 */
    .gto-suggestions {
        order: 2;
    }
    
    /* 行动历史 */
    .action-history {
        max-height: 150px;
        margin-top: 5px;
        padding: 10px;
    }
    
    .action-history h3 {
        font-size: 16px;
    }
    
    /* 游戏控制 */
    #new-game-btn, #next-hand-btn, #replay-btn, #show-report-btn {
      padding: 12px 20px;
      font-size: 16px;
      margin: 2px;
    }
    
    /* GTO报告 */
    .gto-report {
        width: 95%;
        max-width: none;
        padding: 20px;
        max-height: 75vh;
    }
    
    .gto-report h3 {
        font-size: 20px;
    }
    
    .report-section {
        padding: 10px;
        font-size: 14px;
    }
    
    .decision-item {
        padding: 8px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    /* 更小屏幕的调整 */
    .poker-table {
        width: 250px;
        height: 380px;
        border-radius: 100px;
    }
    
    .player-seat {
        width: 70px;
        font-size: 10px;
        padding: 4px;
    }
    
    #seat-0 { top: 72%; right: -50px; transform: translateY(-50%); }
    #seat-1 { bottom: -20px; right: 50%; transform: translateX(50%); }
    #seat-2 { bottom: 13%; left: -45px; }
    #seat-3 { top: 28%; left: -45px; transform: translateY(-50%); }
    #seat-4 { top: -15px; left: 50%; transform: translateX(-50%); }
    #seat-5 { top: 13%; right: -45px; }
    
    .action-buttons {
        grid-template-columns: repeat(3, 1fr);
        grid-template-rows: repeat(2, 1fr);
    }
    
    .bet-controls label {
        font-size: 14px;
    }
    
    #bet-amount {
        width: 60%;
    }
    
    #bet-amount-input {
        width: 35%;
    }
}