/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', 'PingFang SC', 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    min-height: 100vh;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: calc(100vh - 60px);
}

/* 头部样式 */
.header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

.header h1 {
    font-size: 3rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* 区域样式 */
.section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    backdrop-filter: blur(10px);
}

/* 登录区域 */
.login-box {
    text-align: center;
    max-width: 400px;
    margin: 0 auto;
}

.login-box h2 {
    margin-bottom: 30px;
    color: #333;
    font-size: 1.8rem;
}

.input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

.input-group input {
    flex: 1;
    min-width: 200px;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.input-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.hint {
    color: #666;
    font-size: 0.9rem;
    margin-top: 10px;
}

/* 按钮样式 */
button {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.primary-btn, #login-btn, #create-room-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.primary-btn:hover, #login-btn:hover, #create-room-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.secondary-btn, #refresh-btn, #logout-btn {
    background: #f8f9fa;
    color: #333;
    border: 2px solid #ddd;
}

.secondary-btn:hover, #refresh-btn:hover, #logout-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

/* 用户信息 */
.user-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
}

#username-display {
    color: #667eea;
}

/* 大厅统计 */
.lobby-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 30px;
}

.stat-item {
    text-align: center;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 10px;
    min-width: 120px;
}

.stat-number {
    display: block;
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* 操作按钮 */
.actions {
    text-align: center;
    margin-bottom: 30px;
}

.actions button {
    margin: 0 10px;
}

/* 房间列表 */
.rooms-list h3 {
    margin-bottom: 20px;
    color: #333;
    text-align: center;
}

#available-rooms {
    min-height: 100px;
}

.room-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    margin-bottom: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.3s;
}

.room-item:hover {
    border-color: #667eea;
    background: #e7f3ff;
}

.room-info {
    display: flex;
    flex-direction: column;
}

.room-id {
    font-weight: bold;
    color: #333;
}

.room-players {
    color: #666;
    font-size: 0.9rem;
}

.no-rooms {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 40px 20px;
}

/* 等待区域 */
.waiting-box {
    text-align: center;
    max-width: 400px;
    margin: 0 auto;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.waiting-hint {
    color: #666;
    margin: 15px 0;
}

/* 游戏页面样式 */
.game-header {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.game-info h1 {
    color: #333;
    font-size: 2rem;
}

.room-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* 玩家信息 */
.players-info {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    margin-bottom: 20px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.player-card {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    border-radius: 10px;
    background: #f8f9fa;
    min-width: 200px;
}

.player-card.my-player {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.player-color {
    font-size: 2rem;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: white;
}

.black-stone {
    color: #000;
}

.white-stone {
    color: #666;
}

.player-details {
    flex: 1;
}

.player-name {
    display: block;
    font-weight: bold;
    font-size: 1.1rem;
}

.player-label {
    display: block;
    font-size: 0.9rem;
    opacity: 0.8;
}

.vs-divider {
    font-size: 1.5rem;
    font-weight: bold;
    color: #667eea;
}

/* 游戏状态 */
.game-status {
    text-align: center;
    margin-bottom: 20px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.turn-indicator {
    font-size: 1.2rem;
    font-weight: bold;
    padding: 10px 20px;
    border-radius: 25px;
    background: #f8f9fa;
    display: inline-block;
}

.turn-indicator.my-turn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.game-message {
    margin-top: 10px;
    color: #666;
}

/* 棋盘样式 */
.board-container {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.game-board {
    display: grid;
    grid-template-columns: repeat(15, 30px);
    grid-template-rows: repeat(15, 30px);
    gap: 1px;
    background: #8B4513;
    padding: 10px;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.board-cell {
    width: 30px;
    height: 30px;
    background: #DEB887;
    border: 1px solid #8B4513;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
    font-weight: bold;
    transition: background-color 0.2s;
    position: relative;
}

.board-cell:hover {
    background: #F5DEB3;
}

.board-cell.black-stone {
    color: #000;
}

.board-cell.white-stone {
    color: #333;
}

/* 游戏控制 */
.game-controls {
    text-align: center;
    margin-bottom: 20px;
}

.game-controls button {
    margin: 0 10px;
}

/* 弹窗样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 15px;
    padding: 30px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.modal-header h2 {
    margin-bottom: 20px;
    color: #333;
}

.winner-info {
    margin: 20px 0;
}

.winner-stone {
    font-size: 4rem;
    margin-bottom: 10px;
}

.modal-footer {
    margin-top: 30px;
}

.modal-footer button {
    margin: 0 10px;
}

/* 消息提示 */
.error-message, .success-message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 8px;
    color: white;
    font-weight: bold;
    z-index: 1000;
    animation: slideIn 0.3s ease-out;
}

.error-message {
    background: #dc3545;
}

.success-message {
    background: #28a745;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* 底部 */
.footer {
    text-align: center;
    padding: 20px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .players-info {
        flex-direction: column;
        gap: 15px;
    }
    
    .game-board {
        grid-template-columns: repeat(15, 25px);
        grid-template-rows: repeat(15, 25px);
    }
    
    .board-cell {
        width: 25px;
        height: 25px;
        font-size: 16px;
    }
    
    .input-group {
        flex-direction: column;
    }
    
    .input-group input {
        min-width: auto;
    }
    
    .lobby-stats {
        flex-direction: column;
        gap: 15px;
        align-items: center;
    }
    
    .game-info {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .game-board {
        grid-template-columns: repeat(15, 20px);
        grid-template-rows: repeat(15, 20px);
    }
    
    .board-cell {
        width: 20px;
        height: 20px;
        font-size: 14px;
    }
    
    .player-card {
        min-width: auto;
        flex-direction: column;
        text-align: center;
    }
}