/* ==================== 基础样式 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #667eea;
    --primary-dark: #764ba2;
    --success: #27ae60;
    --danger: #e74c3c;
    --warning: #f39c12;
    --info: #3498db;
    --dark: #2c3e50;
    --light: #f8f9fa;
    --shadow: 0 5px 20px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.2);
}

body {
    font-family: 'Microsoft YaHei', 'PingFang SC', sans-serif;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

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

/* ==================== 标题 ==================== */
h1 {
    text-align: center;
    color: white;
    margin-bottom: 30px;
    font-size: 2.5em;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

h2 {
    color: var(--primary);
    margin-bottom: 20px;
    font-size: 1.5em;
}

h3 {
    color: var(--primary-dark);
    margin-bottom: 15px;
    font-size: 1.2em;
}

.subtitle {
    text-align: center;
    color: rgba(255,255,255,0.85);
    margin-bottom: 25px;
    font-size: 1.1em;
}

/* ==================== 表单 ==================== */
.forms {
    display: flex;
    gap: 30px;
    justify-content: center;
    flex-wrap: wrap;
}

.form-box {
    background: white;
    padding: 35px;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 380px;
}

.form-box h2, .form-box h3 {
    text-align: center;
    color: var(--primary);
}

input[type="text"], input[type="password"], select, textarea {
    width: 100%;
    padding: 14px;
    margin-bottom: 15px;
    border: 2px solid #e8e8e8;
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.3s;
    background: #fafafa;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

textarea {
    resize: vertical;
    min-height: 80px;
}

label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    cursor: pointer;
    font-size: 15px;
}

input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
}

/* ==================== 按钮 ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 32px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    text-decoration: none;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
    margin: 5px;
    font-weight: 500;
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.btn:active {
    transform: translateY(-1px);
}

.btn-large {
    padding: 18px 45px;
    font-size: 18px;
    border-radius: 30px;
}

.btn-small {
    padding: 10px 22px;
    font-size: 14px;
}

.btn-ai {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

.btn-ai:hover {
    box-shadow: 0 8px 25px rgba(17, 153, 142, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, #95a5a6 0%, #7f8c8d 100%);
}

.btn-secondary:hover {
    box-shadow: 0 8px 25px rgba(149, 165, 166, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
}

.btn-danger:hover {
    box-shadow: 0 8px 25px rgba(231, 76, 60, 0.4);
}

.btn-warning {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
}

.btn-group {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ==================== 提示框 ==================== */
.error, .success, .info, .warning {
    padding: 16px 20px;
    border-radius: 12px;
    margin-bottom: 25px;
    text-align: center;
    font-weight: 500;
}

.error { 
    background: #ffebee; 
    color: #c62828; 
    border: 1px solid #ef9a9a;
}

.success { 
    background: #e8f5e9; 
    color: #2e7d32; 
    border: 1px solid #a5d6a7;
}

.info { 
    background: #e3f2fd; 
    color: #1565c0; 
    border: 1px solid #90caf9;
}

.warning {
    background: #fff3e0;
    color: #e65100;
    border: 1px solid #ffcc80;
}

/* ==================== 用户主页 ==================== */
.profile-card {
    background: white;
    padding: 30px;
    border-radius: 20px;
    margin-bottom: 25px;
    box-shadow: var(--shadow);
}

.profile-card p {
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 16px;
    display: flex;
    justify-content: space-between;
}

.profile-card p:last-child {
    border-bottom: none;
}

.profile-card strong {
    color: var(--dark);
}

.title {
    color: var(--danger);
    font-weight: bold;
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    padding: 4px 15px;
    border-radius: 20px;
    font-size: 14px;
}

/* ==================== 区块 ==================== */
.section {
    background: white;
    padding: 30px;
    border-radius: 20px;
    margin-bottom: 25px;
    box-shadow: var(--shadow);
}

.section h3 {
    text-align: center;
    margin-bottom: 20px;
}

.game-modes {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.quick-links {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ==================== 游戏头部 ==================== */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 20px 30px;
    border-radius: 20px;
    margin-bottom: 25px;
    box-shadow: var(--shadow);
    flex-wrap: wrap;
    gap: 15px;
}

.player-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 25px;
    border-radius: 15px;
    background: #f8f9fa;
    transition: all 0.3s;
}

.player-info.active {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    box-shadow: 0 0 15px rgba(102, 126, 234, 0.3);
    transform: scale(1.05);
}

.name {
    font-weight: bold;
    font-size: 16px;
    color: var(--dark);
}

.title-tag {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.ai-level {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 12px;
}

.game-status {
    font-size: 22px;
    font-weight: bold;
    text-align: center;
}

.game-status .win { color: var(--success); }
.game-status .lose { color: var(--danger); }
.game-status .draw { color: var(--warning); }

.timer {
    font-size: 42px;
    color: var(--primary);
    margin-top: 8px;
    font-weight: bold;
    font-family: 'Courier New', monospace;
}

.timer.urgent {
    color: var(--danger);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* ==================== 悔棋提示 ==================== */
.undo-alert {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    border: 2px solid #ff9800;
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.undo-alert p {
    font-weight: bold;
    color: #e65100;
    font-size: 16px;
}

/* ==================== 缩放控制 ==================== */
.zoom-controls {
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.zoom-controls button, .zoom-controls form {
    display: inline-flex;
}

.zoom-controls button {
    padding: 10px 22px;
    border: none;
    border-radius: 20px;
    background: white;
    cursor: pointer;
    font-size: 14px;
    box-shadow: var(--shadow);
    transition: all 0.2s;
}

.zoom-controls button:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
}

/* ==================== 游戏布局 ==================== */
.game-layout {
    display: flex;
    gap: 25px;
    justify-content: center;
    align-items: flex-start;
    flex-wrap: wrap;
}

.board-area {
    flex: 1;
    min-width: 500px;
    max-width: 700px;
}

/* ==================== 棋盘 ==================== */
.board-wrapper {
    overflow: auto;
    padding: 25px;
    background: #f5f5f5;
    border-radius: 20px;
    margin-bottom: 25px;
    max-height: 75vh;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.05);
}

.board {
    display: inline-block;
    background: #deb887;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.3);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: top center;
}

.row {
    display: flex;
}

.cell {
    width: 42px;
    height: 42px;
    border: 1px solid #8b7355;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #deb887;
    transition: background 0.2s;
}

.cell:hover {
    background: #e8c9a0;
}

.cell-btn {
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
    cursor: pointer;
    position: absolute;
    top: 0;
    left: 0;
}

.cell-btn:hover {
    background: rgba(255,255,255,0.25);
}

.stone {
    font-size: 34px;
    line-height: 1;
    z-index: 2;
    transition: all 0.2s;
}

.stone.black { 
    color: #1a1a1a; 
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.stone.white { 
    color: #f8f8f8; 
    text-shadow: 1px 1px 3px rgba(0,0,0,0.4);
}

.stone.last-move {
    box-shadow: 0 0 0 3px #e74c3c, 0 0 15px #e74c3c;
    border-radius: 50%;
}

/* ==================== 聊天区域 ==================== */
.chat-area {
    width: 340px;
    background: white;
    border-radius: 20px;
    box-shadow: var(--shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 650px;
}

.chat-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 18px;
    text-align: center;
}

.chat-header h3 {
    margin: 0;
    font-size: 17px;
    color: white;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-message {
    padding: 12px 15px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    animation: fadeIn 0.3s ease;
}

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

.chat-message.own {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    margin-left: 20px;
}

.chat-message.other {
    background: white;
    margin-right: 20px;
}

.chat-message .chat-name {
    color: var(--primary);
    font-weight: bold;
    font-size: 13px;
    display: block;
    margin-bottom: 5px;
}

.chat-message .chat-text {
    color: #333;
    word-break: break-all;
    font-size: 14px;
    line-height: 1.5;
}

.chat-message .chat-time {
    color: #bbb;
    font-size: 11px;
    float: right;
    margin-top: 5px;
}

.chat-input {
    display: flex;
    padding: 18px;
    background: white;
    border-top: 1px solid #f0f0f0;
    gap: 10px;
}

.chat-input input {
    flex: 1;
    padding: 12px 18px;
    border: 2px solid #e8e8e8;
    border-radius: 25px;
    outline: none;
    font-size: 14px;
    transition: all 0.3s;
}

.chat-input input:focus {
    border-color: var(--primary);
}

.chat-input button {
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.chat-input button:hover {
    transform: scale(1.05);
}

.chat-input button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ==================== 加载动画 ==================== */
.loading {
    text-align: center;
    padding: 60px;
}

.spinner {
    width: 70px;
    height: 70px;
    border: 6px solid #f3f3f3;
    border-top: 6px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 25px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ==================== 好友系统 ==================== */
.friend-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.friend-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 15px;
    transition: all 0.3s;
}

.friend-card:hover {
    background: #e3f2fd;
    transform: translateX(5px);
}

.friend-info {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.friend-name {
    font-weight: bold;
    font-size: 17px;
    color: var(--dark);
}

.stats {
    color: var(--primary);
    font-size: 14px;
    background: rgba(102, 126, 234, 0.1);
    padding: 4px 12px;
    border-radius: 15px;
}

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

.friend-request {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px;
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    border-radius: 15px;
    margin-bottom: 12px;
}

.friend-request span {
    font-weight: 500;
    color: #e65100;
}

/* ==================== 通知 ==================== */
.notification-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.notification-item {
    padding: 22px;
    border-radius: 15px;
    background: #f8f9fa;
    transition: all 0.3s;
}

.notification-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.notification-item.unread {
    background: linear-gradient(135deg, #e3f2fd 0%, #f3e5f5 100%);
    border-left: 5px solid var(--primary);
}

.notification-item.read {
    opacity: 0.7;
}

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

.notif-type {
    color: var(--primary);
    font-size: 12px;
    text-transform: uppercase;
    font-weight: bold;
    letter-spacing: 1px;
}

.notif-time {
    color: #999;
    font-size: 13px;
}

.notification-item h4 {
    color: var(--dark);
    margin-bottom: 8px;
    font-size: 16px;
}

.notification-item p {
    color: #666;
    font-size: 14px;
    line-height: 1.6;
}

/* ==================== 观战 ==================== */
.spectator-bar {
    background: white;
    padding: 15px 25px;
    border-radius: 15px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.spectator-bar span:first-child {
    font-weight: bold;
    color: var(--primary);
}

.spectator-name {
    background: #e3f2fd;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 13px;
    color: var(--primary);
}

/* ==================== 游戏列表 ==================== */
.game-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.game-card {
    background: white;
    padding: 25px;
    border-radius: 20px;
    box-shadow: var(--shadow);
    transition: all 0.3s;
    text-align: center;
}

.game-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.game-players {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.game-players .player {
    font-weight: bold;
    font-size: 16px;
    color: var(--dark);
}

.game-players .vs {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: bold;
}

.game-meta {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
    color: #888;
    font-size: 14px;
}

.game-meta .mode {
    color: var(--primary);
    font-weight: 500;
}

/* ==================== 历史记录 ==================== */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.history-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px;
    border-radius: 20px;
    box-shadow: var(--shadow);
    transition: all 0.3s;
    flex-wrap: wrap;
    gap: 15px;
}

.history-card:hover {
    transform: translateX(5px);
}

.history-card.win {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    border-left: 5px solid var(--success);
}

.history-card.lose {
    background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
    border-left: 5px solid var(--danger);
}

.history-result {
    font-size: 28px;
    font-weight: bold;
}

.history-card.win .history-result {
    color: var(--success);
}

.history-card.lose .history-result {
    color: var(--danger);
}

.history-info {
    flex: 1;
}

.history-info p {
    color: #555;
    font-size: 14px;
    margin: 5px 0;
}

/* ==================== 复盘 ==================== */
.replay-controls {
    background: white;
    padding: 20px;
    border-radius: 20px;
    margin-bottom: 25px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 25px;
    flex-wrap: wrap;
}

.replay-controls span {
    font-size: 18px;
    font-weight: bold;
    color: var(--dark);
    min-width: 180px;
    text-align: center;
}

/* ==================== 设置 ==================== */
.setting-item {
    padding: 20px;
    background: #f8f9fa;
    border-radius: 15px;
    margin-bottom: 15px;
}

.setting-item label {
    font-size: 16px;
    color: var(--dark);
}

.setting-item select {
    margin-top: 10px;
}

/* ==================== AI提示 ==================== */
.ai-tips {
    background: white;
    padding: 25px;
    border-radius: 20px;
    margin-top: 25px;
    text-align: left;
    box-shadow: var(--shadow);
}

.ai-tips h3 {
    color: #11998e;
    margin-bottom: 18px;
    text-align: center;
}

.ai-tips ul {
    padding-left: 30px;
}

.ai-tips li {
    padding: 10px 0;
    color: #555;
    font-size: 15px;
}

.ai-tips li::marker {
    color: #11998e;
}

.ai-controls {
    margin-top: 25px;
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

/* ==================== 空状态 ==================== */
.empty {
    text-align: center;
    padding: 60px;
    color: #999;
    font-size: 18px;
}

/* ==================== 排行榜 ==================== */
.leaderboard-wrapper {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.leaderboard {
    background: white;
    padding: 30px;
    border-radius: 20px;
    box-shadow: var(--shadow);
}

.leaderboard h2 {
    text-align: center;
    margin-bottom: 25px;
    font-size: 1.4em;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

th, td {
    padding: 14px;
    text-align: center;
}

th {
    background: #f8f9fa;
    font-weight: bold;
    color: var(--primary);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

td {
    border-bottom: 1px solid #f0f0f0;
    font-size: 15px;
}

tr:hover td {
    background: #f8f9fa;
}

.top-1 { 
    background: linear-gradient(90deg, #ffd700 0%, #ffed4a 100%) !important; 
    font-weight: bold;
}

.top-2 { 
    background: linear-gradient(90deg, #c0c0c0 0%, #e8e8e8 100%) !important; 
    font-weight: bold;
}

.top-3 { 
    background: linear-gradient(90deg, #cd7f32 0%, #daa520 100%) !important; 
    font-weight: bold;
}

/* ==================== 响应式 ==================== */
@media (max-width: 900px) {
    .game-layout {
        flex-direction: column;
        align-items: center;
    }
    
    .board-area {
        min-width: auto;
        width: 100%;
    }
    
    .chat-area {
        width: 100%;
        max-width: 500px;
        height: 450px;
    }
    
    .leaderboard-wrapper {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    h1 {
        font-size: 1.8em;
    }
    
    .container {
        padding: 15px;
    }
    
    .form-box {
        padding: 25px;
    }
    
    .game-header {
        padding: 15px;
    }
    
    .chat-area {
        height: 400px;
    }
    
    .cell {
        width: 28px;
        height: 28px;
    }
    
    .stone {
        font-size: 22px;
    }
    
    .board-wrapper {
        padding: 15px;
    }
    
    .board {
        padding: 15px;
    }
    
    .history-card {
        flex-direction: column;
        text-align: center;
    }
    
    .friend-card {
        flex-direction: column;
        text-align: center;
    }
    
    .game-list {
        grid-template-columns: 1fr;
    }
}

/* ==================== 滚动条美化 ==================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* ==================== 动画 ==================== */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section, .form-box, .game-card, .history-card, .friend-card {
    animation: slideUp 0.5s ease;
}
