:root {
    --primary: #2c3e50;
    --accent: #3498db;
    --bg: #f5f7fa;
    --card-bg: #ffffff;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bg);
    color: #333;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
header {
    background-color: var(--primary);
    color: white;
    padding: 2rem 0;
    margin-bottom: 2rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

header.compact-header {
    padding: 1rem 0;
}

.flex-row {
    display: flex;
    align-items: center;
    gap: 20px;
}

.back-btn {
    color: white;
    text-decoration: none;
    font-weight: bold;
    padding: 5px 10px;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 4px;
}

/* List Layout */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    padding-bottom: 40px;
}

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    overflow: hidden;
    transition: transform 0.2s;
    padding: 20px;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.card h3 { margin-top: 0; color: var(--primary); }

.meta {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 15px;
    display: flex;
    gap: 10px;
}

.badge {
    background: #e1f0fa;
    color: var(--accent);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85em;
}

.card-btn {
    display: block;
    width: 100%;
    text-align: center;
    background: var(--primary);
    color: white;
    text-decoration: none;
    padding: 10px 0;
    border-radius: 4px;
    margin-top: 15px;
}

.card-btn:hover { background: #34495e; }

/* Viewer Layout */
.viewer-layout {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
}

.board-wrapper {
    flex: 2;
    min-width: 300px;
    /* 确保棋盘有背景色，防止加载前全白 */
    background: #f0f0f0; 
    border-radius: 4px;
    padding: 10px;
}

#board {
    width: 100%;
    /* 关键：强制设置纵横比为 1:1，让浏览器提前预留空间 */
    aspect-ratio: 1 / 1; 
    /* 兼容性写法：如果浏览器不支持 aspect-ratio，给一个最小高度 */
    min-height: 500px; 
    
    /* 确保内容垂直居中 */
    display: flex;
    justify-content: center;
}

.info-wrapper {
    flex: 1;
    min-width: 250px;
}

#info-list {
    list-style: none;
    padding: 0;
}

#info-list li {
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

.ai-panel {
    background: #fdfdfe;
    border-top: 3px solid #3498db; /* 顶部蓝条装饰 */
}

.ai-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    text-align: center;
    background: #f8f9fa;
    padding: 10px;
    border-radius: 6px;
}

.stat-item {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.75rem;
    color: #7f8c8d;
}

.stat-value {
    font-size: 1.1rem;
    font-weight: bold;
    color: #2c3e50;
    font-family: "Consolas", monospace;
}

.ai-pv-text {
    font-family: "Consolas", monospace;
    font-size: 0.85rem;
    color: #555;
    background: #eee;
    padding: 5px;
    border-radius: 4px;
    margin-top: 5px;
    word-break: break-all;
}

/* --- 列表页卡片美化 --- */
.card-header-poetic {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 5px;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 10px;
}

.card-header-poetic h3 {
    margin: 0;
    color: #2c3e50;
    font-family: "KaiTi", "楷体", serif; /* 使用楷体增加文化感 */
    font-size: 1.4rem;
}

.game-num {
    background: #aab7b8;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
}

.sub-title {
    color: #7f8c8d;
    font-size: 0.9rem;
    margin-bottom: 15px;
}

.stone {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 5px;
    border: 1px solid #ccc;
}
.stone.black { background: black; }
.stone.white { background: white; }

/* --- 详情页美化 --- */
.header-titles {
    display: flex;
    flex-direction: column;
}

#poetic-title {
    margin: 0;
    font-family: "KaiTi", "楷体", serif;
}

#game-title {
    color: rgba(255,255,255,0.8);
    font-weight: normal;
}

/* 文化赏析卡片 - 重点 */
.cultural-card {
    background: #fffbf0; /* 淡米黄色背景，仿古书纸张 */
    border: 1px solid #e6dcc8;
    margin-bottom: 20px;
}

.card-title-bar {
    text-align: center;
    color: #8e44ad; /* 紫气东来 */
    font-weight: bold;
    margin-bottom: 10px;
    font-family: "KaiTi", "楷体", serif;
    font-size: 1.1rem;
}

.cultural-text {
    line-height: 1.8;
    color: #444;
    text-align: justify;
    font-size: 0.95rem;
    margin: 0;
}

.label {
    display: inline-block;
    width: 60px;
    color: #888;
}

        /* 返回按钮 */
        .back-nav {
            position: fixed;
            top: 2px;
            left: 100px;
            z-index: 100;
        }
        
        .back-nav a {
            text-decoration: none;
            color: #666;
            font-size: 0.9rem;
            border: 1px solid #ccc;
            padding: 5px 12px;
            border-radius: 20px;
            background: rgba(255,255,255,0.9);
            transition: all 0.2s;
        }
        
        .back-nav a:hover {
            border-color: var(--text-color);
            color: var(--text-color);
        }
