/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Microsoft YaHei', Arial, sans-serif;
}

:root {
    --primary-color: #e63946;
    --primary-dark: #c1121f;
    --secondary-color: #457b9d;
    --secondary-dark: #1d3557;
    --light-color: #f1faee;
    --dark-color: #1d3557;
    --board-color: #f8d49f;
    --gray-color: #6c757d;
    --gray-dark: #495057;
}

body {
    background-color: #f5f5f5;
    background-image: url('../assets/bg-pattern.svg');
    background-size: cover;
    background-attachment: fixed;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--dark-color);
    transition: all 0.3s ease;
}

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

.hidden {
    display: none !important;
}

/* 按钮样式 */
.btn {
    padding: 14px 28px;
    border: none;
    border-radius: 12px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.btn::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
    z-index: -1;
}

.btn:hover::after {
    height: 100%;
}

.primary-btn {
    background-color: var(--primary-color);
    color: white;
}

.primary-btn:hover {
    background-color: var(--primary-dark);
    transform: translateY(-3px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.2);
}

.secondary-btn {
    background-color: var(--secondary-color);
    color: white;
}

.secondary-btn:hover {
    background-color: var(--secondary-dark);
    transform: translateY(-3px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.2);
}

.back-btn {
    background-color: var(--gray-color);
    color: white;
    margin-top: 20px;
}

.back-btn:hover {
    background-color: var(--gray-dark);
}

/* 首页样式 */
.home-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
    text-align: center;
    background-color: rgba(255, 255, 255, 0.95);
    border-radius: 24px;
    padding: 50px 40px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.home-page::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 70%);
    z-index: -1;
}

.logo {
    margin-bottom: 50px;
    animation: fadeInDown 1s ease;
}

.logo h1 {
    font-size: 56px;
    color: var(--primary-color);
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.15);
    margin-bottom: 15px;
    font-weight: 900;
    letter-spacing: 2px;
}

.subtitle {
    font-size: 26px;
    color: var(--secondary-dark);
    font-weight: 500;
    animation: fadeIn 1.5s ease;
}

.buttons {
    display: flex;
    gap: 30px;
    margin-top: 40px;
    animation: fadeInUp 1s ease;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* 房间页面样式 */
.room-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.95);
    border-radius: 24px;
    padding: 40px 30px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    animation: fadeIn 0.8s ease;
}

.room-info {
    width: 100%;
    text-align: center;
    margin-bottom: 25px;
    animation: fadeInDown 0.8s ease;
}

.room-info h2 {
    font-size: 28px;
    color: var(--secondary-dark);
    margin-bottom: 20px;
    font-weight: 700;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.1);
}

.player-info {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 40px;
    margin-bottom: 25px;
    animation: fadeIn 1s ease;
}

.player {
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: all 0.3s ease;
}

.player-avatar {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    margin-bottom: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    border: 3px solid transparent;
}

.player-avatar.red {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-dark);
}

.player-avatar.black {
    background-color: var(--secondary-dark);
    color: white;
    border-color: #0a1c2e;
}

.player.active .player-avatar {
    transform: scale(1.1);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

.vs {
    font-size: 28px;
    font-weight: bold;
    color: var(--gray-color);
    position: relative;
}

.vs::before, .vs::after {
    content: '';
    position: absolute;
    height: 2px;
    width: 20px;
    background-color: var(--gray-color);
    top: 50%;
}

.vs::before {
    left: -25px;
}

.vs::after {
    right: -25px;
}

.game-status {
    font-size: 20px;
    font-weight: bold;
    color: var(--secondary-color);
    margin-bottom: 25px;
    padding: 10px 20px;
    border-radius: 30px;
    background-color: rgba(69, 123, 157, 0.1);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(69, 123, 157, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(69, 123, 157, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(69, 123, 157, 0);
    }
}

/* 棋盘样式 */
.game-container {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
    animation: fadeIn 1.2s ease;
}

.board-container {
    position: relative;
    width: 100%;
    max-width: 500px;
    transition: all 0.5s ease;
}

.board {
    width: 100%;
    aspect-ratio: 9/10;
    background-color: var(--board-color);
    background-image: url('../assets/board-bg.svg');
    background-size: 100% 100%;
    position: relative;
    border: 3px solid #8b4513;
    box-shadow: 0 15px 30px rgba(139, 69, 19, 0.3);
    border-radius: 8px;
    transition: all 0.3s ease;
    transform-style: preserve-3d;
    perspective: 1000px;
}

.board::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 50%);
    pointer-events: none;
    border-radius: 8px;
}

/* 棋子样式 */
.piece {
    position: absolute;
    width: 11.1%;
    height: 10%;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    z-index: 10;
}

.piece.red {
    background-color: #f8d49f;
    color: #e63946;
    border: 2px solid #e63946;
}

.piece.black {
    background-color: #f8d49f;
    color: #1d3557;
    border: 2px solid #1d3557;
}

.piece:hover {
    transform: scale(1.1);
    z-index: 20;
}

.piece.selected {
    box-shadow: 0 0 0 3px #ffd700;
}

.move-hint {
    position: absolute;
    width: 11.1%;
    height: 10%;
    border-radius: 50%;
    background-color: rgba(255, 215, 0, 0.5);
    z-index: 5;
    pointer-events: none;
}

/* 模态框样式 */
.join-room-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.modal-content {
    background-color: white;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.modal-content h2 {
    margin-bottom: 20px;
    color: #1d3557;
}

.modal-content input {
    width: 100%;
    padding: 12px;
    font-size: 18px;
    border: 2px solid #ddd;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
    letter-spacing: 4px;
}

.modal-content input:focus {
    outline: none;
    border-color: #457b9d;
}

.modal-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .logo h1 {
        font-size: 36px;
    }
    
    .subtitle {
        font-size: 18px;
    }
    
    .buttons {
        flex-direction: column;
    }
    
    .player-info {
        flex-direction: column;
        gap: 15px;
    }
    
    .vs {
        margin: 10px 0;
    }
}