/* 游戏界面样式 */

.game-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.95);
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.game-info {
    display: flex;
    align-items: center;
    gap: 30px;
}

.current-turn {
    font-size: 18px;
    font-weight: bold;
    color: #ff6b6b;
}

.game-stats {
    display: flex;
    gap: 20px;
    color: #666;
}

.game-actions {
    display: flex;
    gap: 10px;
}

.game-board-container {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 20px;
    height: calc(100vh - 140px);
}

/* 游戏棋盘 */
.game-board {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    padding: 20px;
    display: grid;
    grid-template-columns: repeat(15, 1fr);
    grid-template-rows: repeat(15, 1fr);
    gap: 2px;
    aspect-ratio: 1;
    max-height: calc(100vh - 200px);
}

.board-cell {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 30px;
}

.board-cell:hover {
    background: #e9ecef;
    transform: scale(1.05);
}

/* 特殊格子样式 */
.board-cell.start {
    background: linear-gradient(45deg, #2ed573, #7bed9f);
    color: white;
    font-weight: bold;
}

.board-cell.home {
    background: linear-gradient(45deg, #70a1ff, #5352ed);
    color: white;
}

.board-cell.finish {
    background: linear-gradient(45deg, #ffa502, #ff6348);
    color: white;
    font-weight: bold;
}



/* 有内容的格子样式 */
.board-cell.has-content {
    position: relative;
}

/* 内容弹窗样式 - 简化版确保显示 */
.content-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: 99999;
}

.content-modal-content {
    background: #667eea;
    border-radius: 15px;
    padding: 20px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.content-modal-header {
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 20px 20px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.content-modal-header h3 {
    margin: 0;
    color: white;
    font-size: 24px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.content-modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.content-modal-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.content-modal-body {
    padding: 30px 20px;
}

.content-modal-body p {
    margin: 0;
    color: rgba(255, 255, 255, 0.9);
    font-size: 18px;
    line-height: 1.6;
    text-align: center;
}

.content-modal-footer {
    padding: 20px;
    border-radius: 0 0 20px 20px;
}

.content-modal-ok {
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
    border: none;
    color: white;
    padding: 12px 30px;
    border-radius: 25px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

.content-modal-ok:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { 
        transform: translateY(-50px) scale(0.9);
        opacity: 0;
    }
    to { 
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.board-cell.safe {
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
    color: white;
}

.board-cell.path {
    background: #ffffff;
    border: 2px solid #ddd;
}

/* 棋子样式 - 已删除旧样式，使用JavaScript动态生成 */

/* 游戏控制区域 */
.game-controls {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    height: 100%;
    overflow-y: auto;
}

.dice-area {
    text-align: center;
}

/* 单机模式中的掷骰子区域样式 */
#soloDiceArea {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(248, 249, 250, 0.95));
    border-radius: 20px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    margin-bottom: 20px;
    border: 2px solid rgba(255, 107, 107, 0.2);
    position: relative;
    overflow: hidden;
}

#soloDiceArea::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 107, 107, 0.1) 0%, transparent 70%);
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-10px) rotate(180deg); }
}

#soloDiceArea .dice-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 25px;
    position: relative;
    z-index: 1;
}

/* 单机模式棋子区域美化 */
.pieces-area {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(248, 249, 250, 0.9));
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    border: 2px solid rgba(84, 160, 255, 0.2);
    position: relative;
    overflow: hidden;
}

.pieces-area::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(84, 160, 255, 0.1) 0%, transparent 70%);
    animation: float 8s ease-in-out infinite reverse;
}

.pieces-area h4 {
    color: #333;
    font-weight: 600;
    margin-bottom: 20px;
    text-align: center;
    position: relative;
    z-index: 1;
    font-size: 18px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.pieces-selection {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-top: 15px;
    position: relative;
    z-index: 1;
}

.piece-btn {
    padding: 12px 8px;
    font-size: 14px;
    border-radius: 10px;
    border: 2px solid #e9ecef;
    background: linear-gradient(135deg, #ffffff, #f8f9fa);
    transition: all 0.3s ease;
    cursor: pointer;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.piece-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
    border-color: #ff6b6b;
    background: linear-gradient(135deg, #ff6b6b, #ff8e8e);
    color: white;
}

.piece-btn:active {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
}

.dice {
    width: 80px;
    height: 80px;
    background: linear-gradient(45deg, #ffffff, #f8f9fa);
    border: 3px solid #ff6b6b;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 2em;
    font-weight: bold;
    color: #ff6b6b;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
}

.dice.rolling {
    animation: diceRoll 1s ease-in-out infinite;
    transform-origin: center;
}

.dice.result-bounce {
    animation: resultBounce 0.6s ease-out;
}

@keyframes diceRoll {
    0% { transform: rotate(0deg) scale(1); }
    25% { transform: rotate(90deg) scale(1.1); }
    50% { transform: rotate(180deg) scale(1.2); }
    75% { transform: rotate(270deg) scale(1.1); }
    100% { transform: rotate(360deg) scale(1); }
}

@keyframes resultBounce {
    0% { transform: scale(1); }
    30% { transform: scale(1.3); }
    50% { transform: scale(1.1); }
    70% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.pieces-area h4 {
    margin-bottom: 15px;
    color: #333;
    text-align: center;
}

.pieces-selection {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.piece-btn {
    padding: 15px;
    border: 2px solid #ddd;
    border-radius: 10px;
    background: #f8f9fa;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    font-size: 14px;
    color: #666;
}

.piece-btn:hover {
    border-color: #ff6b6b;
    background: #fff;
    transform: translateY(-2px);
}

.piece-btn.available {
    border-color: #2ed573;
    background: linear-gradient(45deg, #2ed573, #7bed9f);
    color: white;
}

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

.piece-btn.disabled:hover {
    transform: none;
    border-color: #ddd;
    background: #f8f9fa;
}

/* 游戏结果模态框 */
.game-result {
    text-align: center;
    padding: 20px;
}

.game-result h2 {
    margin-bottom: 20px;
    font-size: 2em;
}

.game-result.winner {
    color: #2ed573;
}

.game-result.loser {
    color: #ff3838;
}

.game-result .stats {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin: 20px 0;
}

.game-result .stats div {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.game-result .actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

/* 响应式设计 */
/* 平板端优化 (768px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    .game-board-container {
        grid-template-columns: 1fr 300px;
        gap: 15px;
    }
    
    #soloDiceArea {
        min-height: 180px;
        margin-bottom: 15px;
    }
    
    #soloDiceArea .dice-area {
        gap: 20px;
    }
    
    .dice {
        width: 70px;
        height: 70px;
        font-size: 1.8em;
    }
    
    .pieces-area h4 {
        font-size: 16px;
        margin-bottom: 15px;
    }
    
    .pieces-selection {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .piece-btn {
        padding: 12px 8px;
        font-size: 14px;
    }
}

/* 手机端优化 (最大768px) */
@media (max-width: 768px) {
    .game-container {
        padding: 10px;
    }
    
    .game-board-container {
        grid-template-columns: 1fr;
        gap: 15px;
        height: auto;
        min-height: calc(100vh - 120px);
    }
    
    .game-controls {
        order: -1;
        flex-direction: column;
        padding: 15px;
        background: rgba(255, 255, 255, 0.95);
        border-radius: 15px;
        box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    }
    
    /* 单机模式手机端优化 */
    #soloDiceArea {
        min-height: 150px;
        margin-bottom: 15px;
        border-radius: 15px;
        padding: 20px;
    }
    
    #soloDiceArea .dice-area {
        gap: 15px;
    }
    
    .dice-area,
    .pieces-area {
        flex: 1;
        text-align: center;
    }
    
    .pieces-area h4 {
        font-size: 16px;
        margin-bottom: 15px;
        color: #333;
        font-weight: 600;
    }
    
    .pieces-selection {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        margin-top: 10px;
    }
    
    .piece-btn {
        padding: 12px 8px;
        font-size: 13px;
        border-radius: 8px;
        border: 2px solid #e9ecef;
        background: linear-gradient(135deg, #ffffff, #f8f9fa);
        transition: all 0.3s ease;
    }
    
    .piece-btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0,0,0,0.15);
        border-color: #ff6b6b;
    }
    
    .game-board {
        grid-template-columns: repeat(15, 1fr);
        grid-template-rows: repeat(15, 1fr);
        gap: 1px;
        padding: 8px;
        background: rgba(255, 255, 255, 0.9);
        border-radius: 15px;
        box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    }
    
    .board-cell {
        min-height: 18px;
        font-size: 10px;
    }
    
    .piece {
        width: 14px;
        height: 14px;
    }
    
    .dice {
        width: 60px;
        height: 60px;
        font-size: 1.5em;
        margin-bottom: 10px;
    }
    
    .btn {
        padding: 10px 20px;
        font-size: 14px;
        border-radius: 8px;
    }
}

/* 小屏幕手机优化 (最大480px) */
@media (max-width: 480px) {
    .game-container {
        padding: 5px;
    }
    
    .game-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
        padding: 15px;
        margin-bottom: 15px;
    }
    
    .game-info {
        flex-direction: column;
        gap: 10px;
    }
    
    .game-stats {
        justify-content: center;
        flex-direction: column;
        gap: 5px;
        font-size: 14px;
    }
    
    .game-actions {
        justify-content: center;
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }
    
    .game-board-container {
        height: auto;
        min-height: calc(100vh - 180px);
        gap: 10px;
    }
    
    .game-controls {
        flex-direction: column;
        gap: 15px;
        padding: 12px;
        order: -1;
    }
    
    /* 单机模式小屏幕优化 */
    #soloDiceArea {
        min-height: 120px;
        margin-bottom: 12px;
        padding: 15px;
        border-radius: 12px;
    }
    
    #soloDiceArea .dice-area {
        gap: 12px;
    }
    
    .dice-area,
    .pieces-area {
        width: 100%;
        text-align: center;
    }
    
    .pieces-area h4 {
        font-size: 14px;
        margin-bottom: 12px;
    }
    
    .pieces-selection {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        margin-top: 8px;
    }
    
    .piece-btn {
        padding: 10px 6px;
        font-size: 12px;
        border-radius: 6px;
        min-height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .game-board {
        grid-template-columns: repeat(15, 1fr);
        grid-template-rows: repeat(15, 1fr);
        gap: 0.5px;
        padding: 5px;
        border-radius: 12px;
    }
    
    .board-cell {
        min-height: 15px;
        font-size: 8px;
        padding: 2px;
    }
    
    .piece {
        width: 12px;
        height: 12px;
    }
    
    .dice {
        width: 50px;
        height: 50px;
        font-size: 1.2em;
        margin-bottom: 8px;
    }
    
    .btn {
        padding: 8px 16px;
        font-size: 13px;
        border-radius: 6px;
        width: 100%;
        margin-bottom: 5px;
    }
    
    .current-turn {
        font-size: 16px;
    }
}

/* 单机模式触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    .piece-btn {
        min-height: 44px; /* 确保触摸目标足够大 */
        padding: 12px 8px;
    }
    
    .btn {
        min-height: 44px;
        padding: 12px 20px;
    }
    
    .dice {
        min-width: 60px;
        min-height: 60px;
    }
    
    #soloDiceArea {
        min-height: 160px;
    }
    
    .pieces-area {
        padding: 15px;
    }
    
    .pieces-selection {
        gap: 10px;
    }
}

/* 横屏手机优化 */
@media (max-width: 768px) and (orientation: landscape) {
    .game-board-container {
        grid-template-columns: 1fr 250px;
        height: calc(100vh - 100px);
    }
    
    .game-controls {
        order: 1;
        flex-direction: row;
        gap: 15px;
    }
    
    #soloDiceArea {
        min-height: 120px;
        flex: 1;
    }
    
    .pieces-area {
        flex: 1;
        min-height: 120px;
    }
    
    .pieces-selection {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .game-board {
        grid-template-columns: repeat(15, 1fr);
        grid-template-rows: repeat(15, 1fr);
        gap: 1px;
        padding: 5px;
    }
    
    .board-cell {
        min-height: 16px;
        font-size: 9px;
    }
    
    .piece {
        width: 13px;
        height: 13px;
    }
}

/* 聊天区域样式 */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 300px;
}

.chat-area h4 {
    margin-bottom: 15px;
    color: #333;
    text-align: center;
    border-bottom: 2px solid #ff6b6b;
    padding-bottom: 10px;
}

.chat-messages {
    flex: 1;
    background: #f8f9fa;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
    overflow-y: auto;
    max-height: 200px;
    min-height: 150px;
}

.chat-message {
    margin-bottom: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    background: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.chat-message.system {
    background: #e3f2fd;
    color: #1976d2;
    text-align: center;
    font-style: italic;
}

/* 任务消息样式 */
.chat-message.task-message {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: 2px solid #5a6fd8;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    position: relative;
    overflow: hidden;
}

.chat-message.task-message::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #ff6b6b, #feca57, #48dbfb, #ff9ff3);
    animation: rainbow 3s linear infinite;
}

@keyframes rainbow {
    0% { background-position: 0% 50%; }
    100% { background-position: 100% 50%; }
}

.chat-message.task-message .task-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-weight: bold;
}

.chat-message.task-message .task-icon {
    font-size: 18px;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-5px); }
    60% { transform: translateY(-3px); }
}

.chat-message.task-message .task-title {
    font-size: 14px;
    opacity: 0.9;
}

.chat-message.task-message .task-content {
    font-size: 16px;
    line-height: 1.5;
    margin-bottom: 8px;
    font-weight: 500;
}

.chat-message.task-message .message-time {
    font-size: 12px;
    opacity: 0.7;
    text-align: right;
}

/* 游戏模式消息特殊样式 */
.chat-message.system.game-mode-change {
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
    color: #d63384;
    border: 2px solid #e91e63;
    box-shadow: 0 4px 15px rgba(233, 30, 99, 0.2);
    font-weight: 600;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.chat-message.system.game-mode-change::before {
    content: '🎮';
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
}

.chat-message.system.game-mode-change .message-text {
    padding-left: 30px;
}

/* 回合提示样式 */
.chat-message.turn-indicator {
    background: linear-gradient(135deg, #ffeaa7 0%, #fab1a0 100%);
    color: #2d3436;
    border: 2px solid #fdcb6e;
    box-shadow: 0 4px 15px rgba(253, 203, 110, 0.3);
    text-align: center;
    font-weight: 600;
    position: relative;
    overflow: hidden;
}

.chat-message.turn-indicator::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #00b894, #00cec9, #0984e3, #6c5ce7);
    animation: rainbow 2s linear infinite;
}

.chat-message.turn-indicator .turn-text {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 5px;
}

.chat-message.turn-indicator .message-time {
    font-size: 12px;
    opacity: 0.7;
    text-align: right;
}

.chat-message .sender {
    font-weight: bold;
    color: #ff6b6b;
    font-size: 12px;
    margin-bottom: 3px;
}

.chat-message .message-text {
    color: #333;
    line-height: 1.4;
}

.chat-message .message-time {
    font-size: 10px;
    color: #999;
    text-align: right;
    margin-top: 3px;
}

.chat-input-container {
    display: flex;
    gap: 8px;
}

.chat-input-container input {
    flex: 1;
    padding: 8px 12px;
    border: 2px solid #e1e5e9;
    border-radius: 20px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s ease;
}

.chat-input-container input:focus {
    border-color: #ff6b6b;
}

.chat-input-container .btn {
    padding: 8px 16px;
    font-size: 12px;
    border-radius: 20px;
    white-space: nowrap;
}



.chat-area {
    position: relative;
}
