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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #fff;
}

.page {
    display: none;
    min-height: 100vh;
}

.page.active {
    display: block !important;
}

/* Homepage Styles */
.hero-section {
    text-align: center;
    padding: 100px 20px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.9) 0%, rgba(118, 75, 162, 0.9) 100%);
    backdrop-filter: blur(10px);
}

.main-title {
    font-size: 4rem;
    font-weight: bold;
    margin-bottom: 20px;
    background: linear-gradient(45deg, #fff, #f0f0f0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.subtitle {
    font-size: 1.5rem;
    margin-bottom: 40px;
    opacity: 0.9;
}

.action-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    padding: 15px 30px;
    border: none;
    border-radius: 50px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    font-weight: 600;
}

.btn.primary {
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
}

.btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.6);
}

.btn.secondary {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
}

.btn.secondary:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    padding: 60px 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.feature-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 40px 30px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    background: rgba(255, 255, 255, 0.15);
}

.feature-card h3 {
    font-size: 2rem;
    margin-bottom: 15px;
}

.feature-card p {
    font-size: 1.1rem;
    opacity: 0.9;
    line-height: 1.6;
}

/* 通知动画 */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100px);
    }
}

/* Game Page Styles */
.game-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 20px;
}

.back-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.game-info {
    display: flex;
    gap: 20px;
    font-size: 1.1rem;
    flex-direction: column;
    align-items: flex-end;
}

.score-display {
    display: flex;
    gap: 15px;
    font-weight: bold;
}

.score-display span {
    background: rgba(255, 255, 255, 0.2);
    padding: 5px 15px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.game-main {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 20px;
    margin-bottom: 20px;
}

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.game-settings {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px;
}

.game-settings h3 {
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.setting-group {
    margin-bottom: 15px;
}

.setting-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.setting-group select {
    width: 100%;
    padding: 8px 12px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    font-size: 1rem;
    cursor: pointer;
}

.setting-group select:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}

.board-container {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: visible;
}

/* 棋盘四边光流动特效 */
.board-container {
    position: relative;
    overflow: visible;
}

/* 上边流动光 */
.board-container::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    height: 4px;
    background: linear-gradient(90deg, 
        #ff6b6b 0%, 
        #4ecdc4 20%, 
        #45b7d1 40%, 
        #96ceb4 60%, 
        #ffeaa7 80%, 
        #ff6b6b 100%);
    background-size: 300% 100%;
    animation: topFlow 4s linear infinite;
    z-index: -1;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 0 10px rgba(255, 107, 107, 0.5);
}

/* 左边流动光 */
.board-container::after {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    bottom: -4px;
    width: 4px;
    background: linear-gradient(180deg, 
        #ff6b6b 0%, 
        #4ecdc4 20%, 
        #45b7d1 40%, 
        #96ceb4 60%, 
        #ffeaa7 80%, 
        #ff6b6b 100%);
    background-size: 100% 300%;
    animation: leftFlow 4s linear infinite;
    z-index: -1;
    border-radius: 20px 0 0 20px;
    box-shadow: 0 0 10px rgba(78, 205, 196, 0.5);
}

/* 右边流动光 */
.board-container {
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.3),
        0 0 0 2px rgba(255, 255, 255, 0.5),
        inset 0 0 20px rgba(255, 255, 255, 0.1),
        /* 右边光效 */
        4px 0 0 rgba(255, 234, 167, 0.8),
        -4px 0 0 rgba(150, 206, 180, 0.8);
}

/* 下边流动光 */
#gameBoard {
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.3),
        0 0 0 2px rgba(255, 255, 255, 0.5),
        inset 0 0 20px rgba(255, 255, 255, 0.1),
        /* 下边光效 */
        0 4px 0 rgba(255, 234, 167, 0.8),
        0 -4px 0 rgba(150, 206, 180, 0.8);
    cursor: pointer;
    position: relative;
}

@keyframes topFlow {
    0% {
        background-position: 0% 50%;
        opacity: 0.6;
    }
    50% {
        background-position: 100% 50%;
        opacity: 1;
    }
    100% {
        background-position: 200% 50%;
        opacity: 0.6;
    }
}

@keyframes leftFlow {
    0% {
        background-position: 50% 0%;
        opacity: 0.6;
    }
    50% {
        background-position: 50% 100%;
        opacity: 1;
    }
    100% {
        background-position: 50% 200%;
        opacity: 0.6;
    }
}

@keyframes rightFlow {
    0% {
        background-position: 0% 50%;
        opacity: 0.6;
    }
    50% {
        background-position: 100% 50%;
        opacity: 1;
    }
    100% {
        background-position: 200% 50%;
        opacity: 0.6;
    }
}

@keyframes bottomFlow {
    0% {
        background-position: 50% 0%;
        opacity: 0.6;
        background-position: 200% 0%;
    }
    100% {
        background-position: 0% 0%;
    }
}

#gameBoard {
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.3),
        0 0 0 2px rgba(255, 255, 255, 0.5),
        inset 0 0 20px rgba(255, 255, 255, 0.1);
    cursor: pointer;
    position: relative;
    z-index: 1;
}

/* 棋子精致化样式 */
.piece-shadow {
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

.piece-glow {
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.5));
}

/* 房间功能样式 */
.room-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.room-buttons .btn {
    flex: 1;
}

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

.name-input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.name-input {
    flex: 1;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 14px;
}

.name-input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.name-input:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.3);
}

#playerInfo {
    background: rgba(76, 175, 80, 0.1);
    border-radius: 4px;
    padding: 8px 12px;
    margin-bottom: 15px;
    text-align: center;
    color: #4CAF50;
    font-weight: bold;
}

#roomInfo {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
}

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

.room-id-display label {
    font-weight: bold;
    min-width: 60px;
}

.room-id-display span {
    flex: 1;
    font-family: monospace;
    font-size: 18px;
    font-weight: bold;
    color: #4CAF50;
    background: rgba(76, 175, 80, 0.1);
    padding: 5px 10px;
    border-radius: 4px;
    text-align: center;
}

.room-players {
    margin-bottom: 15px;
}

.player-info {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    padding: 8px 12px;
    margin-bottom: 8px;
    font-size: 14px;
}

.player-info:last-child {
    margin-bottom: 0;
}

.btn.small {
    padding: 5px 10px;
    font-size: 12px;
    min-width: auto;
}

.room-status {
    text-align: center;
    color: #ffc107;
    font-weight: bold;
    margin-bottom: 10px;
}

.sync-button {
    text-align: center;
    margin-top: 10px;
}

#joinRoomForm {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.room-input {
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-family: monospace;
    font-size: 16px;
    text-align: center;
}

.room-input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.room-input:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.3);
}

.btn.secondary {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn.secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

.chat-container {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    height: 600px;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.voice-btn {
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.voice-btn:hover {
    transform: scale(1.05);
}

.voice-btn.recording {
    background: linear-gradient(45deg, #e74c3c, #c0392b);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(231, 76, 60, 0); }
    100% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0); }
}

.chat-messages {
    flex: 1;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    padding: 15px;
    overflow-y: auto;
    margin-bottom: 15px;
    min-height: 400px;
}

.message {
    margin-bottom: 10px;
    padding: 8px 12px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.message.own {
    background: rgba(102, 126, 234, 0.3);
    margin-left: 20px;
}

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

.chat-input {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 25px;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    font-size: 1rem;
}

.chat-input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}

.send-btn {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.send-btn:hover {
    transform: scale(1.05);
}

.game-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 20px;
    border-radius: 15px;
}

.game-controls .btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 12px 25px;
}

.game-controls .btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .game-main {
        grid-template-columns: 1fr;
    }
    
    .chat-container {
        height: 400px;
    }
    
    #gameBoard {
        width: 100%;
        max-width: 500px;
        height: auto;
    }
}

@media (max-width: 768px) {
    .main-title {
        font-size: 2.5rem;
    }
    
    .subtitle {
        font-size: 1.2rem;
    }
    
    .game-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .game-info {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .features {
        grid-template-columns: 1fr;
        padding: 40px 20px;
    }
}
