/* 逆井字棋样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    text-align: center;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    max-width: 800px;
    width: 100%;
}

.header h1 {
    color: #333;
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.header p {
    color: #666;
    font-size: 1.1rem;
    margin-bottom: 30px;
}

.game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 2px solid #e9ecef;
}

.current-player {
    font-size: 1.2rem;
    font-weight: bold;
    color: #495057;
}

.current-player span {
    color: #007bff;
    font-size: 1.5rem;
}

.game-status {
    font-size: 1.1rem;
    color: #28a745;
    font-weight: bold;
}

.game-board-container {
    position: relative;
    display: inline-block;
    margin: 30px 0;
}

.expand-buttons {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 10;
}

.expand-btn {
    position: absolute;
    width: 40px;
    height: 40px;
    border: 2px solid #007bff;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    font-size: 1.2rem;
    font-weight: bold;
    color: #007bff;
    cursor: pointer;
    pointer-events: auto;
    transition: all 0.3s ease;
    display: none;
}

.expand-btn:hover {
    background: #007bff;
    color: white;
    transform: scale(1.1);
}

.expand-btn:disabled {
    background: #e9ecef;
    color: #6c757d;
    border-color: #6c757d;
    cursor: not-allowed;
    opacity: 0.5;
}

#expandUp {
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
}

#expandDown {
    bottom: -60px;
    left: 50%;
    transform: translateX(-50%);
}

#expandLeft {
    left: -60px;
    top: 50%;
    transform: translateY(-50%);
}

#expandRight {
    right: -60px;
    top: 50%;
    transform: translateY(-50%);
}

.game-board {
    display: grid;
    gap: 3px;
    background: #333;
    padding: 10px;
    border-radius: 10px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.cell {
    width: 80px;
    height: 80px;
    background: white;
    border: none;
    border-radius: 5px;
    font-size: 2rem;
    font-weight: bold;
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.cell:hover {
    background: #f8f9fa;
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.cell.x {
    color: #dc3545;
}

.cell.o {
    color: #007bff;
}

.cell.winning {
    background: #ffe6e6;
    animation: pulse 1s infinite;
}

.cell.new {
    background: #e8f5e8;
    animation: fadeIn 0.5s ease;
}

.board-info {
    display: flex;
    justify-content: space-between;
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 2px solid #e9ecef;
}

.board-size, .expand-info {
    font-size: 1.1rem;
    color: #495057;
}

.board-size span, .expand-info span {
    font-weight: bold;
    color: #007bff;
}

.game-controls {
    margin: 30px 0;
}

.control-btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    margin: 0 10px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3);
}

.control-btn:hover {
    background: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 123, 255, 0.4);
}

.expansion-status {
    margin-top: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 2px solid #e9ecef;
}

.expansion-status h3 {
    color: #333;
    margin-bottom: 15px;
}

.expand-status-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    max-width: 300px;
    margin: 0 auto;
}

.expand-status {
    padding: 10px;
    background: white;
    border-radius: 8px;
    border: 2px solid #28a745;
    color: #28a745;
    font-weight: bold;
    transition: all 0.3s ease;
}

.expand-status.used {
    background: #dc3545;
    border-color: #dc3545;
    color: white;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 15px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    border-bottom: 2px solid #e9ecef;
    background: #f8f9fa;
    border-radius: 15px 15px 0 0;
}

.modal-header h2 {
    color: #333;
    margin: 0;
}

.close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close:hover {
    color: #333;
}

.modal-body {
    padding: 30px;
    line-height: 1.6;
}

.modal-body h3 {
    color: #333;
    margin: 20px 0 10px 0;
    font-size: 1.3rem;
}

.modal-body p {
    color: #666;
    margin-bottom: 15px;
}

.modal-body ul {
    color: #666;
    margin-left: 20px;
    margin-bottom: 15px;
}

.modal-body li {
    margin-bottom: 8px;
}

.modal-body strong {
    color: #dc3545;
}

/* 动画效果 */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 20px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .cell {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }
    
    .game-info {
        flex-direction: column;
        gap: 10px;
    }
    
    .board-info {
        flex-direction: column;
        gap: 10px;
    }
    
    .control-btn {
        display: block;
        margin: 10px auto;
        width: 200px;
    }
    
    .expand-status-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .cell {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
    
    .expand-btn {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }
    
    #expandUp, #expandDown {
        top: -50px;
    }
    
    #expandDown {
        bottom: -50px;
    }
    
    #expandLeft {
        left: -50px;
    }
    
    #expandRight {
        right: -50px;
    }
}
