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

body {
    font-family: 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    min-height: 100vh;
    color: #fff;
}

/* 登录界面 */
#login-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-box {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    font-size: 2.5em;
    margin-bottom: 30px;
}

.login-box input {
    display: block;
    width: 100%;
    padding: 15px;
    margin: 10px 0;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
}

.login-box button {
    width: 100%;
    padding: 15px;
    margin-top: 20px;
    border: none;
    border-radius: 10px;
    font-size: 18px;
    font-weight: bold;
    background: linear-gradient(135deg, #e94560, #ff6b6b);
    color: #fff;
    cursor: pointer;
    transition: all 0.3s;
}

.login-box button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(233, 69, 96, 0.4);
}

/* 等待房间 */
#waiting-room {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.waiting-box {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 30px;
    border-radius: 20px;
    width: 100%;
    max-width: 500px;
}

.waiting-box h2 {
    text-align: center;
    margin-bottom: 20px;
}

.waiting-box h2 span {
    color: #ffd700;
}

/* 设置区域 */
.settings-area {
    background: rgba(0, 0, 0, 0.2);
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 20px;
}

.settings-area h3 {
    margin-bottom: 15px;
    color: #ffd700;
    font-size: 1em;
}

.setting-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.setting-row label {
    min-width: 80px;
    color: #ccc;
}

.setting-row select,
.setting-row input {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
}

.setting-row .hint {
    color: #888;
    font-size: 12px;
}

/* 玩家面板 */
.players-panel {
    margin-bottom: 20px;
}

.players-panel h3 {
    margin-bottom: 10px;
    color: #ccc;
}

#players-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.player-item {
    background: rgba(255, 255, 255, 0.1);
    padding: 10px 15px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.player-item.ready {
    background: rgba(100, 255, 100, 0.2);
}

.player-avatar { font-size: 24px; }
.player-name { font-size: 14px; }

.host-badge {
    background: #ffd700;
    color: #333;
    padding: 2px 8px;
    border-radius: 5px;
    font-size: 12px;
}

.ready-status {
    color: #aaa;
    font-size: 12px;
}

/* 头像选择 */
.avatar-select {
    margin-bottom: 20px;
}

.avatar-select h3 {
    margin-bottom: 10px;
    color: #ccc;
}

.avatars {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.avatar-btn {
    width: 50px;
    height: 50px;
    font-size: 28px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: all 0.3s;
}

.avatar-btn:hover {
    border-color: #ffd700;
}

.avatar-btn.selected {
    border-color: #ffd700;
    background: rgba(255, 215, 0, 0.2);
}

/* 准备按钮 */
.ready-button {
    width: 100%;
    padding: 15px;
    font-size: 18px;
    font-weight: bold;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #e94560, #ff6b6b);
    color: #fff;
    cursor: pointer;
    transition: all 0.3s;
}

.ready-button:hover {
    transform: translateY(-2px);
}

.ready-button.start {
    background: linear-gradient(135deg, #4CAF50, #8BC34A);
}

.ready-button.cancel {
    background: linear-gradient(135deg, #ff9800, #f57c00);
}

/* 游戏界面 */
#game-screen {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 顶部信息栏 */
.top-bar {
    background: rgba(0, 0, 0, 0.3);
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.room-info, .turn-info {
    font-size: 14px;
    color: #aaa;
}

.room-info span, .turn-info span {
    color: #ffd700;
}

#players-bar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.player-mini {
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(255, 255, 255, 0.1);
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 12px;
}

.player-mini.current {
    background: rgba(255, 215, 0, 0.3);
    border: 1px solid #ffd700;
}

.player-mini .avatar { font-size: 16px; }
.player-mini .pos { color: #ffd700; }

/* 游戏区域 */
.game-area {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow: auto;
}

.board-wrapper {
    position: relative;
    width: 600px;
    height: 600px;
}

.game-board {
    position: relative;
    width: 100%;
    height: 100%;
}

/* 格子 */
.cell {
    position: absolute;
    width: 35px;
    height: 35px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: #ddd;
    transition: all 0.3s;
}

.cell.forward {
    background: rgba(100, 255, 100, 0.3);
    border-color: #4CAF50;
}

.cell.backward {
    background: rgba(255, 100, 100, 0.3);
    border-color: #f44336;
}

.cell.current {
    background: rgba(255, 215, 0, 0.4);
    border-color: #ffd700;
}

/* 棋子 */
.chess-piece {
    font-size: 24px;
    z-index: 10;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

/* 移动中的棋子 */
.chess-piece.moving {
    position: absolute;
    font-size: 24px;
    z-index: 100;
    pointer-events: none;
}

/* 高亮格子 */
.cell.highlighted {
    background: rgba(255, 215, 0, 0.6) !important;
    border-color: #ffd700 !important;
    transform: scale(1.15);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.8);
    z-index: 5;
}

/* 中间骰子 */
.dice-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 80px;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    z-index: 20;
}

.dice-center:hover:not(.disabled) {
    transform: translate(-50%, -50%) scale(1.1);
}

.dice-center.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.dice-center.rolling {
    animation: shake 0.5s;
}

@keyframes shake {
    0%, 100% { transform: translate(-50%, -50%) rotate(0deg); }
    25% { transform: translate(-50%, -50%) rotate(-20deg) scale(1.1); }
    75% { transform: translate(-50%, -50%) rotate(20deg) scale(1.1); }
}

/* 消息提示 */
#message-box {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 15px 30px;
    border-radius: 10px;
    display: none;
    z-index: 1000;
    font-size: 14px;
    max-width: 90%;
    text-align: center;
}

#message-box.error {
    background: rgba(233, 69, 96, 0.9);
}

/* 游戏结束弹窗 */
.game-over-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.game-over-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    padding: 40px 60px;
    border-radius: 20px;
    text-align: center;
    border: 2px solid #ffd700;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.3);
}

.game-over-content h2 {
    font-size: 2em;
    margin-bottom: 20px;
    color: #ffd700;
}

.winner-text {
    font-size: 1.5em;
    margin-bottom: 30px;
    color: #fff;
}

.restart-button {
    padding: 15px 40px;
    font-size: 18px;
    font-weight: bold;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #4CAF50, #8BC34A);
    color: #fff;
    cursor: pointer;
    transition: all 0.3s;
}

.restart-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(76, 175, 80, 0.4);
}

/* 响应式 */
@media (max-width: 700px) {
    .login-box, .waiting-box {
        padding: 25px;
    }
    
    .login-box h1 {
        font-size: 2em;
    }
    
    /* 游戏区域 - 自适应屏幕 */
    .game-area {
        padding: 10px;
        overflow: hidden;
    }
    
    .board-wrapper {
        width: calc(100vw - 20px);
        height: calc(100vw - 20px);
        max-width: 400px;
        max-height: 400px;
        min-width: 300px;
        min-height: 300px;
    }
    
    .cell {
        width: 22px;
        height: 22px;
        font-size: 8px;
    }
    
    .chess-piece {
        font-size: 16px;
    }
    
    .dice-center {
        font-size: 50px;
    }
    
    .top-bar {
        font-size: 11px;
        padding: 8px 10px;
        gap: 10px;
    }
    
    .player-mini {
        padding: 4px 8px;
        font-size: 10px;
    }
    
    .player-mini .avatar {
        font-size: 14px;
    }
}
