/* ============================================================
                     style-shared.css
              传棋Go · 公共样式（门户首页 + 所有子系统共用）
   ============================================================
   包含内容：
     1. 全局基础样式（深色/浅色主题共用）
     2. 门户首页专用样式（深色背景、呼吸动画、卡片布局）
     3. 子系统共用样式（棋盘、三栏布局、按钮、侧边栏）
     4. 响应式适配（手机/平板/大屏触控）
   ============================================================ */

/* ============================================================
   01. 全局重置 & 深空围棋背景（门户首页专用）
   ============================================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    margin: 0;              /* ✅ 确保没有默认边距 */
    padding: 0;             /* ✅ 确保没有默认内边距 */
    font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
    background: #0C0A08;   /* 玄铁曜黑 —— 深邃稳重，衬托光晕 */
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    /* 棋盘网格背景：利用 CSS 线条模拟围棋盘的经纬，增强文化识别度 */
    background-image: 
        linear-gradient(rgba(200, 169, 110, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(200, 169, 110, 0.04) 1px, transparent 1px);
    background-size: 60px 60px;

    position: relative;
}

/* 环境光晕：营造空间层次感，但不干扰文字可读性 */
body::before {
    content: '';
    position: fixed;
    top: -30%;
    left: -20%;
    width: 60%;
    height: 60%;
    background: radial-gradient(circle, rgba(255, 122, 0, 0.08) 0%, transparent 70%);
    pointer-events: none;   /* 让鼠标事件穿透，不影响交互 */
    z-index: 0;
}

body::after {
    content: '';
    position: fixed;
    bottom: -30%;
    right: -20%;
    width: 60%;
    height: 60%;
    background: radial-gradient(circle, rgba(201, 169, 78, 0.06) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}


/* ============================================================
   02. 门户首页专用样式（深色主题 + 呼吸动画）
   ============================================================ */

/* ---- 主容器 ---- */
.portal {
    max-width: 1200px;
    width: 100%;
    position: relative;
    z-index: 10;            /* 确保内容在背景光晕之上 */
}

/* ═══ 全局呼吸动画定义（7 层节奏） ═══ */
/* 所有呼吸动画均不改变文字本身的透明度，只通过 drop-shadow 的大小/亮度变化
   和微小的 transform 来制造“呼吸感”。文字始终保持锐利清晰，辨识度不受影响。 */

/* L3: 品牌名称（最慢，最克制） */
@keyframes breatheBrand {
    0% { filter: drop-shadow(0 0 2px rgba(200, 169, 110, 0.1)); transform: translateY(0); }
    50% { filter: drop-shadow(0 0 10px rgba(200, 169, 110, 0.25)); transform: translateY(-1px); }
    100% { filter: drop-shadow(0 0 2px rgba(200, 169, 110, 0.1)); transform: translateY(0); }
}

/* L1: 主标语（最明显，3.5s 一次大呼吸） */
@keyframes breatheHero {
    0% { filter: drop-shadow(0 0 8px rgba(255, 122, 0, 0.15)) drop-shadow(0 0 2px rgba(255, 122, 0, 0.05)); transform: translateY(0); }
    50% { filter: drop-shadow(0 0 30px rgba(255, 122, 0, 0.4)) drop-shadow(0 0 60px rgba(255, 122, 0, 0.12)); transform: translateY(-3px); }
    100% { filter: drop-shadow(0 0 8px rgba(255, 122, 0, 0.15)) drop-shadow(0 0 2px rgba(255, 122, 0, 0.05)); transform: translateY(0); }
}

/* L2: 英文副标语（4s 一次，光晕与颜色微变） */
@keyframes breatheSub {
    0% { color: rgba(200, 169, 110, 0.6); filter: drop-shadow(0 0 2px rgba(200, 169, 110, 0.05)); transform: translateY(0); }
    50% { color: rgba(200, 169, 110, 0.85); filter: drop-shadow(0 0 15px rgba(200, 169, 110, 0.2)); transform: translateY(-1px); }
    100% { color: rgba(200, 169, 110, 0.6); filter: drop-shadow(0 0 2px rgba(200, 169, 110, 0.05)); transform: translateY(0); }
}

/* L2b: 辅助描述行 */
@keyframes breatheSubFeel {
    0% { color: rgba(255, 255, 255, 0.5); letter-spacing: 6px; filter: drop-shadow(0 0 2px rgba(255, 122, 0, 0)); }
    50% { color: rgba(255, 255, 255, 0.85); letter-spacing: 8px; filter: drop-shadow(0 0 12px rgba(255, 122, 0, 0.15)); }
    100% { color: rgba(255, 255, 255, 0.5); letter-spacing: 6px; filter: drop-shadow(0 0 2px rgba(255, 122, 0, 0)); }
}

/* L4: 卡片主标题（3.8s，轻微位移 + 光晕） */
@keyframes breatheCardTitle {
    0% { color: #F5EFE6; transform: translateX(0); filter: drop-shadow(0 0 2px rgba(255, 122, 0, 0.05)); }
    50% { color: #FFFFFF; transform: translateX(3px); filter: drop-shadow(0 0 15px rgba(255, 122, 0, 0.2)); }
    100% { color: #F5EFE6; transform: translateX(0); filter: drop-shadow(0 0 2px rgba(255, 122, 0, 0.05)); }
}

/* L5: 卡片痛点文案（4.2s，颜色和光晕微变） */
@keyframes breathePain {
    0% { color: #FF7A00; filter: drop-shadow(0 0 2px rgba(255, 122, 0, 0.05)); transform: translateX(0); }
    50% { color: #FFA54F; filter: drop-shadow(0 0 12px rgba(255, 122, 0, 0.2)); transform: translateX(2px); }
    100% { color: #FF7A00; filter: drop-shadow(0 0 2px rgba(255, 122, 0, 0.05)); transform: translateX(0); }
}

/* L6: 底部状态栏（6s，极其微弱的光晕变化） */
@keyframes breatheStatus {
    0% { color: rgba(255, 255, 255, 0.3); filter: drop-shadow(0 0 2px rgba(46, 204, 113, 0)); }
    50% { color: rgba(255, 255, 255, 0.5); filter: drop-shadow(0 0 8px rgba(46, 204, 113, 0.08)); }
    100% { color: rgba(255, 255, 255, 0.3); filter: drop-shadow(0 0 2px rgba(46, 204, 113, 0)); }
}

/* L7: 版权信息（8s，几乎不可察觉的微光） */
@keyframes breatheCopyright {
    0% { color: rgba(200, 169, 110, 0.2); filter: drop-shadow(0 0 2px rgba(200, 169, 110, 0)); }
    50% { color: rgba(200, 169, 110, 0.35); filter: drop-shadow(0 0 6px rgba(200, 169, 110, 0.05)); }
    100% { color: rgba(200, 169, 110, 0.2); filter: drop-shadow(0 0 2px rgba(200, 169, 110, 0)); }
}


/* ---- 顶部导航栏（品牌文字自带呼吸） ---- */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;                    /* 顶部导航栏下边距 */
    padding-bottom: 15px;                   /* 顶部导航栏内边距 */
    border-bottom: 1px solid rgba(200, 169, 110, 0.15);
}

.brand {
    display: flex;
    align-items: center;
    gap: 18px;
    text-decoration: none;
}

/* 朱砂印章 Logo —— 静态，不呼吸，作为视觉锚点 */
.logo-seal {
    width: 52px;
    height: 52px;
    background: #D93B2B;
    border-radius: 8px 2px 8px 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: "STKaiti", "KaiTi", serif;
    font-size: 22px;
    font-weight: bold;
    color: #F5EFE6;
    transform: rotate(-3deg);
    box-shadow: 0 4px 20px rgba(217, 59, 43, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-text .name-cn {
    font-size: 26px;
    font-weight: 800;
    color: #F5EFE6;
    letter-spacing: 4px;
    line-height: 1.2;
    animation: breatheBrand 5s ease-in-out infinite;
    transition: all 0.8s cubic-bezier(0.23, 1, 0.32, 1);
}
.brand-text .name-cn span {
    color: #FF7A00;
}

.brand:hover .name-cn {
    animation: none;
    color: #FFFFFF;
    filter: drop-shadow(0 0 20px rgba(255, 122, 0, 0.3));
    transform: scale(1.02);
    transition-duration: 0.6s;
}
.brand:not(:hover) .name-cn {
    transition-duration: 1.5s;
}

.brand-text .name-en {
    font-size: 11px;
    color: rgba(200, 169, 110, 0.5);
    letter-spacing: 3px;
    font-weight: 300;
    animation: breatheBrand 5.5s ease-in-out infinite 0.3s;
    transition: all 0.8s ease;
}
.brand:hover .name-en {
    animation: none;
    color: rgba(200, 169, 110, 0.9);
    filter: drop-shadow(0 0 12px rgba(200, 169, 110, 0.15));
}
.brand:not(:hover) .name-en {
    transition-duration: 1.5s;
}

.lang-switch {
    color: rgba(255, 255, 255, 0.3);
    font-size: 13px;
    letter-spacing: 2px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 6px 16px;
    border-radius: 30px;
    cursor: default;
    transition: all 0.8s ease;
    animation: breatheBrand 6s ease-in-out infinite 0.6s;
}
.lang-switch:hover {
    animation: none;
    border-color: #FF7A00;
    color: #FF7A00;
    filter: drop-shadow(0 0 20px rgba(255, 122, 0, 0.15));
    transform: scale(1.03);
}
.lang-switch:not(:hover) {
    transition-duration: 1.8s;
}


/* ---- 主视觉区（L1 + L2 呼吸与亮灯） ---- */
.hero-section {
    text-align: center;
    margin-bottom: 70px;
    position: relative;
}

.hero-section .big-slogan-cn {
    font-size: clamp(36px, 5vw, 100px);
    font-weight: 900;
    color: #F5EFE6;
    letter-spacing: 8px;
    line-height: 1.2;
    white-space: normal;
    display: inline-block;
    padding: 10px 30px;
    margin: 0 -30px;
    border-radius: 20px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.hero-section .big-slogan-cn .highlight {
    background: linear-gradient(135deg, #FF7A00, #FFB347);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: breatheHero 3.5s ease-in-out infinite;
    transition-property: filter, background, transform;
    transition-duration: 2.5s, 2.5s, 2.5s;
    transition-timing-function: cubic-bezier(0.23, 1, 0.32, 1);
}

.hero-section .big-slogan-cn:hover .highlight,
.hero-section .big-slogan-cn:focus-within .highlight,
.hero-section .big-slogan-cn:active .highlight {
    animation: none;
    background: linear-gradient(135deg, #FFEA9A, #FF8C00);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 30px rgba(255, 122, 0, 0.8))
            drop-shadow(0 0 60px rgba(255, 122, 0, 0.4))
            drop-shadow(0 0 100px rgba(255, 122, 0, 0.2));
    transform: translateY(-4px) scale(1.02);
    transition-duration: 0.8s, 0.8s, 0.8s;
}

.hero-section .big-slogan-en {
    font-size: clamp(14px, 2vw, 24px);
    font-weight: 300;
    color: rgba(200, 169, 110, 0.6);
    letter-spacing: 8px;
    margin-top: 8px;
    font-style: italic;
    display: inline-block;
    padding: 5px 20px;
    cursor: default;
    animation: breatheSub 4s ease-in-out infinite 0.5s;
    transition: all 1.2s cubic-bezier(0.23, 1, 0.32, 1);
}
.hero-section .big-slogan-en:hover {
    animation: none;
    color: rgba(255, 215, 140, 0.95);
    filter: drop-shadow(0 0 25px rgba(200, 169, 110, 0.25));
    transform: translateY(-2px);
}
.hero-section .big-slogan-en:not(:hover) {
    transition-duration: 1.8s;
}

.hero-section .sub-feel {
    margin-top: 20px;
    font-size: 18px;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 6px;
    font-weight: 300;
    animation: breatheSubFeel 4.5s ease-in-out infinite 0.8s;
    transition: all 1s ease;
}
.hero-section .sub-feel span {
    color: #FF7A00;
    font-weight: 500;
    display: inline-block;
    transition: all 0.8s ease;
    cursor: default;
}
.hero-section .sub-feel span:hover {
    animation: none;
    color: #FFB347;
    filter: drop-shadow(0 0 20px rgba(255, 122, 0, 0.4));
    transform: scale(1.08);
}
.hero-section .sub-feel:not(:hover) {
    transition-duration: 1.5s;
}


/* ---- 三大功能卡片（L4 + L5 呼吸） ---- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    margin-bottom: 50px;
}

.card {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 24px;
    padding: 36px 24px 30px;
    border: 1px solid rgba(200, 169, 110, 0.15);
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-decoration: none;
    display: block;
    position: relative;
    overflow: hidden;
}

.card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 30% 20%, rgba(255, 122, 0, 0.05) 0%, transparent 70%);
    pointer-events: none;
    opacity: 0;
    transition: 0.8s ease;
}

.card:not(.disabled):hover {
    transform: translateY(-12px) scale(1.01);
    border-color: #FF7A00;
    box-shadow: 0 30px 80px rgba(255, 122, 0, 0.15);
    background: rgba(255, 122, 0, 0.05);
}
.card:not(.disabled):hover::after {
    opacity: 1;
}

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

.card-icon {
    font-size: 42px;
    display: block;
    filter: drop-shadow(0 8px 20px rgba(255, 122, 0, 0.2));
    transition: all 0.8s ease;
    animation: breatheBrand 4s ease-in-out infinite 0.2s;
}
.card:not(.disabled):hover .card-icon {
    animation: none;
    filter: drop-shadow(0 0 30px rgba(255, 122, 0, 0.6)) drop-shadow(0 8px 20px rgba(255, 122, 0, 0.2));
    transform: scale(1.08) rotate(-3deg);
}
.card:not(.disabled):not(:hover) .card-icon {
    transition-duration: 1.2s;
}

.card-number {
    font-size: 14px;
    font-weight: 900;
    color: rgba(200, 169, 110, 0.2);
    letter-spacing: 2px;
}

.card h2 {
    font-size: 32px;
    font-weight: 800;
    color: #F5EFE6;
    margin-bottom: 6px;
    letter-spacing: 2px;
    animation: breatheCardTitle 3.8s ease-in-out infinite 0.4s;
    transition: all 0.8s cubic-bezier(0.23, 1, 0.32, 1);
}
.card h2 small {
    font-size: 16px;
    font-weight: 300;
    color: rgba(255, 255, 255, 0.3);
    margin-left: 10px;
    letter-spacing: 4px;
    transition: all 0.8s ease;
}

.card:not(.disabled):hover h2 {
    animation: none;
    color: #FFFFFF;
    filter: drop-shadow(0 0 25px rgba(255, 122, 0, 0.3));
    transform: translateX(6px);
}
.card:not(.disabled):hover h2 small {
    color: rgba(255, 200, 100, 0.7);
    filter: drop-shadow(0 0 12px rgba(255, 122, 0, 0.2));
}
.card:not(.disabled):not(:hover) h2 {
    transition-duration: 1.5s;
}

.card .pain-point {
    font-size: 18px;
    font-weight: 500;
    color: #FF7A00;
    margin: 10px 0 14px;
    line-height: 1.4;
    min-height: 52px;
    letter-spacing: 1px;
    animation: breathePain 4.2s ease-in-out infinite 0.6s;
    transition: all 0.8s cubic-bezier(0.23, 1, 0.32, 1);
}
.card:not(.disabled):hover .pain-point {
    animation: none;
    color: #FFB347;
    filter: drop-shadow(0 0 18px rgba(255, 122, 0, 0.25));
    transform: translateX(3px);
}
.card:not(.disabled):not(:hover) .pain-point {
    transition-duration: 1.5s;
}

.card .feature-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
}
.card .feature-tags span {
    background: rgba(255, 122, 0, 0.08);
    border: 1px solid rgba(255, 122, 0, 0.1);
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 30px;
    letter-spacing: 1px;
    transition: all 0.6s ease;
    animation: breatheBrand 5s ease-in-out infinite 0.9s;
}
.card:not(.disabled):hover .feature-tags span {
    animation: none;
    background: rgba(255, 122, 0, 0.2);
    border-color: rgba(255, 122, 0, 0.4);
    color: rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 25px rgba(255, 122, 0, 0.08);
}
.card:not(.disabled):not(:hover) .feature-tags span {
    transition-duration: 1.2s;
}

.card-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 32px;
    border-radius: 60px;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 2px;
    transition: all 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    background: rgba(255, 122, 0, 0.1);
    color: #FF7A00;
    border: 1px solid rgba(255, 122, 0, 0.2);
    animation: breatheBrand 4.5s ease-in-out infinite 0.3s;
}
.card:not(.disabled):hover .card-btn {
    animation: none;
    background: #FF7A00;
    color: #0C0A08;
    box-shadow: 0 10px 30px rgba(255, 122, 0, 0.4);
    border-color: #FF7A00;
    transform: scale(1.04);
}
.card:not(.disabled):not(:hover) .card-btn {
    transition-duration: 1.5s;
}

.card.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(0.5);
    border-style: dashed;
}
.card.disabled .card-btn {
    background: transparent;
    color: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.05);
    animation: none;
}
.card.disabled .pain-point {
    color: rgba(255, 255, 255, 0.2);
    animation: none;
}
.card.disabled h2 {
    animation: none;
}
.card.disabled .card-icon {
    animation: none;
}
.card.disabled .feature-tags span {
    animation: none;
}


/* ---- 底部信息区（L6 + L7 极慢呼吸） ---- */
.footer-global {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 30px;
    border-top: 1px solid rgba(200, 169, 110, 0.08);
    flex-wrap: wrap;
    gap: 20px;
}

.status-global {
    display: flex;
    align-items: center;
    gap: 24px;
    color: rgba(255, 255, 255, 0.3);
    font-size: 13px;
    letter-spacing: 2px;
    animation: breatheStatus 6s ease-in-out infinite 1s;
    transition: all 1s ease;
}
.status-global:hover {
    animation: none;
    color: rgba(255, 255, 255, 0.5);
    filter: drop-shadow(0 0 10px rgba(46, 204, 113, 0.05));
}
.status-global:not(:hover) {
    transition-duration: 2s;
}

.status-global .dot-online {
    width: 8px;
    height: 8px;
    background: #2ECC71;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 20px #2ECC71;
    animation: pulse-dot 2s infinite;
}
@keyframes pulse-dot {
    0% { opacity: 0.4; transform: scale(0.9); }
    50% { opacity: 1; transform: scale(1.2); }
    100% { opacity: 0.4; transform: scale(0.9); }
}

.footer-global .copyright {
    color: rgba(200, 169, 110, 0.2);
    font-size: 12px;
    letter-spacing: 3px;
    animation: breatheCopyright 8s ease-in-out infinite 1.5s;
    transition: all 1.2s ease;
}
.footer-global .copyright:hover {
    animation: none;
    color: rgba(200, 169, 110, 0.4);
}
.footer-global .copyright:not(:hover) {
    transition-duration: 2.5s;
}

.footer-global .copyright strong {
    color: rgba(200, 169, 110, 0.4);
    font-weight: 500;
}


/* ---- 门户首页响应式适配 ---- */
@media (max-width: 800px) {
    .card-grid {
        grid-template-columns: 1fr;    /* 卡片纵向堆叠 */
        gap: 20px;
    }
    .navbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    .hero-section .big-slogan-cn {
        font-size: clamp(28px, 7vw, 38px);
        letter-spacing: 4px;
        white-space: nowrap;
        padding: 10px 15px;
        margin: 0 -15px;
    }
    .card .pain-point {
        min-height: auto;
        font-size: 16px;
    }
    .footer-global {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 400px) {
    .hero-section .big-slogan-cn {
        font-size: 24px;
        letter-spacing: 2px;
        padding: 8px 10px;
        margin: 0 -10px;
    }
}


/* ============================================================
   03. 子系统共用样式（棋盘、三栏布局、按钮、侧边栏）
   ============================================================ */
/* ============================================================
   棋盘区域统一包装器 - 标题和棋盘共用同宽居中
   ============================================================ */
.board-wrapper {
    width: 100%;
    max-width: 820px;           /* 标题和棋盘共用同一个最大宽度 */
    margin: 0 auto;             /* 整体居中 */
    display: flex;
    flex-direction: column;
    align-items: center;        /* 内部子元素水平居中 */
    gap: 12px;
    box-sizing: border-box;
}
/* ---------- 子系统：棋谱名称 ---------- */
/* 棋谱名称 - 宽度与包装器一致 */
.current-game-name {
    width: 100%;            /* 填满父容器宽度，填满包装器宽度 */
    max-width: 820px;       /* 与棋盘最大宽度一致 */
    margin: 0 auto;         /* 居中 */
    text-align: center;
    padding: 10px 15px;
    background: #fff8e1;
    border-radius: 6px;
    font-size: 16px;
    font-weight: bold;
    color: #5a3e18;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    word-break: break-all;
    box-sizing: border-box; /* 确保 padding 不撑宽 */
}

/* ---------- 子系统：棋盘画布 ---------- */
#goban {
    width: 100%;                /* 填满父容器宽度 */
    max-width: 820px;           /* 最大宽度略微减小，适合大部分屏幕 */
    height: auto;
    aspect-ratio: 1 / 1;        /* 保持正方形 */
    display: block;
    flex-shrink: 0;
    background: #dcb468;        /* ✅ 木色背景，彻底消除黑边 */
    border-radius: 4px;         /* 微微圆角 */
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* ---------- 子系统：三栏布局 ---------- */

#app {
    display: flex;
    width: 100vw;           /* ✅ 填满整个视口宽度 */
    height: 100vh;          /* ✅ 填满整个视口高度 */
    max-height: 100vh;
    min-width: 0;           /* 允许 flex 收缩 */
    overflow: hidden;       /* 防止滚动条导致宽度变化 */
}

/* ------左侧工具栏-------- */

#sidebar {
    width: 320px;
    min-width: 160px;
    flex-shrink: 0;
    flex-grow: 0;           /* ✅ 不自动伸展 */
    background: #2c2416;
    color: #e8d5b0;
    padding: 12px 10px;
    overflow-y: auto;
    overflow-x: hidden;
    height: 100vh;
    /* ✅ 贴左是 flex 的默认行为，不需要额外设置 */
}

#sidebar h2 {
    font-size: 15px;
    margin: 8px 0 4px 0;
    padding-bottom: 4px;
    border-bottom: 1px solid #5a4a32;
    color: #e8d5b0;
    font-weight: normal;
}
#sidebar h2:first-child { margin-top: 0; }

/* ============================================================
   ✅ 明亮干净的按钮方案 - 无光晕，纯色变化
   ============================================================ */

/* ----- 1. 所有按钮基础样式（干净，无阴影） ----- */
.btn {
    display: block;
    width: 100%;
    padding: 7px 8px;
    margin: 3px 0;
    border: 1px solid #5a4a32;
    background: #3d3220;
    color: #e8d5b0;
    border-radius: 4px;
    cursor: pointer;
    font-size: 15px;
    text-align: left;
    transition: all 0.15s ease;
    box-shadow: none !important;
}

/* ----- 2. 悬停：背景变亮一点（无发光） ----- */
.btn:hover {
    background: #4d3a28;
    border-color: #6a5a42;
    transform: translateY(-1px);
}

/* ----- 3. 点击：瞬间变亮金色，然后恢复（干净反馈） ----- */
.btn:active {
    background: #8b6914 !important;
    border-color: #b8960f !important;
    color: #fff !important;
    transform: translateY(1px);
}

/* ----- 4. 激活状态（持续亮色） ----- */
.btn.active {
    background: #8b6914 !important;
    color: #fff !important;
    border-color: #b8960f !important;
    transform: translateY(-1px);
}

.btn.active:hover {
    background: #9b7924 !important;
    border-color: #c9a84c !important;
}

.btn.active:active {
    background: #6a5210 !important;
    border-color: #8b6914 !important;
}

/* ----- 5. 金色按钮（导出、保存等） ----- */
.btn[style*="background:#8b6914"],
.btn[style*="background:#8b6914;"] {
    background: #8b6914 !important;
    color: #fff !important;
    border-color: #b8960f !important;
}

.btn[style*="background:#8b6914"]:hover,
.btn[style*="background:#8b6914;"]:hover {
    background: #9b7924 !important;
    border-color: #c9a84c !important;
}

.btn[style*="background:#8b6914"]:active,
.btn[style*="background:#8b6914;"]:active {
    background: #6a5210 !important;
    border-color: #8b6914 !important;
}

/* ----- 6. 红色按钮 ----- */
.btn[style*="background:#c22"],
.btn[style*="background:#c22;"] {
    background: #c22 !important;
    color: #fff !important;
    border-color: #d44 !important;
}

.btn[style*="background:#c22"]:hover,
.btn[style*="background:#c22;"]:hover {
    background: #d33 !important;
    border-color: #e55 !important;
}

.btn[style*="background:#c22"]:active,
.btn[style*="background:#c22;"]:active {
    background: #a11 !important;
    border-color: #c22 !important;
}

/* ----- 7. 模式切换按钮 ----- */
/* 模式切换按钮 - 看得见 */

.mode-btn {
    background: #3d3220;
    color: #e8d5b0;
    border: 1px solid #5a4a32;
    padding: 6px 12px;
    margin: 2px 0;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    text-align: center;
    transition: all 0.2s ease;
}
/* 悬停时更亮 */
.mode-btn:hover {
    background: #5a4a32;
    border-color: #8b6914;
}
/* 激活时金色 */
.mode-btn.active {
    background: #8b6914;
    color: #fff;
    border-color: #b8960f;
    box-shadow: 0 0 12px rgba(139, 105, 20, 0.3);
}

/* ----- 8. 棋盘规格按钮 ----- */
#size-btns .btn {
    text-align: center !important;
    background: #3d3220 !important;
    border-color: #5a4a32 !important;
    color: #e8d5b0 !important;
}

#size-btns .btn:hover {
    background: #4d3a28 !important;
    border-color: #6a5a42 !important;
}

#size-btns .btn:active {
    background: #8b6914 !important;
    border-color: #b8960f !important;
    color: #fff !important;
}

#size-btns .btn.active {
    background: #8b6914 !important;
    color: #fff !important;
    border-color: #b8960f !important;
}

/* ----- 9. SGF 管理区域按钮 ----- */
#sidebar .btn[data-btn-key*="sgf"],
#sidebar .btn[onclick*="exportSGF"],
#sidebar .btn[onclick*="saveCurrentVariation"],
#sidebar .btn[onclick*="clearVariationBranches"] {
    background: #3d3220 !important;
    color: #e8d5b0 !important;
    border-color: #5a4a32 !important;
}

#sidebar .btn[data-btn-key*="sgf"]:hover,
#sidebar .btn[onclick*="exportSGF"]:hover,
#sidebar .btn[onclick*="saveCurrentVariation"]:hover {
    background: #4d3a28 !important;
    border-color: #6a5a42 !important;
}

#sidebar .btn[data-btn-key*="sgf"]:active,
#sidebar .btn[onclick*="exportSGF"]:active,
#sidebar .btn[onclick*="saveCurrentVariation"]:active {
    background: #8b6914 !important;
    border-color: #b8960f !important;
    color: #fff !important;
}
/* 强制批量导出SGF按钮不高亮 */
button[data-btn-key="batchExportSGF"] {
    background-color: #3d3220 !important;
    color: #e8d5b0 !important;
    border-color: #555 !important;
    box-shadow: none !important;
}

button[data-btn-key="batchExportSGF"]:hover {
    background-color: #4d3d2a !important;
    color: #e8d5b0 !important;
    box-shadow: none !important;
}

button[data-btn-key="batchExportSGF"].active,
button[data-btn-key="batchExportSGF"]:active {
    background-color: #8b6914 !important;
    color: #fff !important;
}

/* ----- 10. 下拉菜单（干净） ----- */
select {
    width: 100%;
    padding: 5px;
    margin: 3px 0;
    border-radius: 4px;
    border: 1px solid #5a4a32;
    background: #3d3220;
    color: #e8d5b0;
    font-size: 13px;
    transition: all 0.15s ease;
}

select:hover {
    background: #4d3a28;
    border-color: #6a5a42;
}

select:focus {
    outline: none;
    border-color: #8b6914;
}

/* ----- 11. 禁用状态 ----- */
.btn:disabled,
.btn.disabled {
    opacity: 0.35 !important;
    cursor: not-allowed !important;
    transform: none !important;
}

#sidebar .btn-grid-two-col {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 4px !important;
    margin-bottom: 8px !important;
}

#set-black-btn.active,
#set-white-btn.active {
    background: #333 !important;
    color: white !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.btn-row {
    display: flex;
    gap: 4px;
}
.btn-row .btn {
    flex: 1;
    text-align: center;
}

select {
    width: 100%;
    padding: 5px;
    margin: 3px 0;
    border-radius: 4px;
    border: 1px solid #5a4a32;
    background: #3d3220;
    color: #e8d5b0;
    font-size: 13px;
}

/* ---------- 子系统：教学标记按钮尺寸 ---------- */
.marker-btn {
    width: 80px !important;
    min-width: 50px !important;
    max-width: 80px !important;
    height: 24px !important;
    line-height: 16px !important;
    padding: 4px !important;
    font-size: 20px !important;
    text-align: center !important;
}



/* ---------- 子系统：中间棋盘区域 ---------- */
#board-area {
    flex: 1;                /* ✅ 占据左右面板剩余的所有空间 */
    flex-shrink: 0;         /* ✅ 不收缩，保证棋盘完整 */
    display: flex;
    flex-direction: column;
    align-items: center;    /* 水平居中所有子元素 */
    justify-content: center;
    padding: 10px 20px;
    gap: 12px;
    min-width: 0;
    overflow: hidden;
    background: #f0e6d3;
    height: 100vh;
    width: 100%;
    box-sizing: border-box;
}
/* 棋盘容器：与标题同宽 */
/* 棋盘 + 右侧控制按钮的容器 */
#board-area > div:last-of-type {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    width: 100%;                /* 填满父容器宽度 */
    max-width: 820px;           /* 与标题一致 */
    justify-content: center;    /* 与标题最大宽度一致 */
    margin: 0 auto;             /* 容器本身居中 */
    box-sizing: border-box;
}

/* ---------- 子系统：右侧面板 ---------- */

#right {
    width: 280px;           /* 较窄 */
    min-width: 140px;       /* 最小宽度 */
    flex-shrink: 0;         /* 允许收缩 */
    flex-grow: 0;           /* ✅ 不自动伸展 */
    background: #fff;
    padding: 12px;
    overflow-y: auto;
    overflow-x: hidden;
    border-left: 1px solid #ccc;
    height: 100vh;
    /* ✅ 贴右是 flex 的默认行为，不需要额外设置 */
}

#right h3 {
    font-size: 16px;
    margin: 6px 0 4px;
    color: #5a3e18;
}
#info p {
    margin: 3px 0;
    font-size: 16px;
}
#info .turn {
    font-weight: bold;
    font-size: 16px;
}
#moves {
    height: 180px;
    overflow-y: auto;
    border: 1px solid #ddd;
    padding: 4px;
    font-size: 14px;
    background: #fafafa;
}
#moves div { padding: 1px 3px; }
#moves div.cur { background: #ffe4b5; }

#right .btn-grid-two-col .btn {
    font-size: 16px;
    padding: 4px 3px;
    text-align: center;
    line-height: 1.2;
}
#right .btn {
    font-size: 16px;
    padding: 4px 4px;
}

#chess-tools h2, .mode-section h2 { font-size: 16px; }
#chess-tools-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
}
#chess-tools-grid .btn {
    font-size: 13px;
    padding: 6px 4px;
    text-align: center;
}

/* ---------- 子系统：死活题专用面板 ---------- */
#tsumego-panel {
    display: none;
    margin-top: 15px;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
}
#tsumego-title { font-weight: bold; color: #8b2500; }
#tsumego-desc { font-size: 12px; color: #666; margin: 4px 0; }
#tsumego-hint { font-size: 12px; color: #0066cc; cursor: pointer; margin: 4px 0; display: none; }
#tsumego-result { font-size: 13px; font-weight: bold; margin: 4px 0; }

.prob-btn {
    display: block;
    width: 100%;
    padding: 5px 6px;
    margin: 2px 0;
    border: 1px solid #ccc;
    background: #f9f5ec;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    text-align: left;
}
.prob-btn:hover { background: #e8dcc8; }
.prob-btn.solved { opacity: .5; text-decoration: line-through; }

.marker-preview {
    display: inline-block;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    text-align: center;
    line-height: 22px;
    font-size: 12px;
    font-weight: bold;
    margin: 2px;
}
.marker-preview.red { background: #f44; color: #fff; }
.marker-preview.blue { background: #44f; color: #fff; }
.marker-preview.green { background: #4a4; color: #fff; }
.marker-preview.tri { background: #fa0; color: #fff; }

.panel-section {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}
.panel-section:last-child { border-bottom: none; }

.btn-stack {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.link-btn {
    font-size: 11px;
    color: #b8a88a;
    text-decoration: none;
    padding: 5px 0;
    display: block;
}
.link-btn:hover { text-decoration: underline; }

/* ---------- 子系统：教学摆棋/标记高亮 ---------- */
#teach-place-toggle.active {
    background: #3498db !important;
    color: white !important;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.5);
    transform: translateY(-1px);
    transition: all 0.2s ease;
}
.teach-brush-btn.active {
    background: #2ecc71 !important;
    color: white !important;
    box-shadow: 0 2px 8px rgba(46, 204, 113, 0.5);
    transform: translateY(-1px);
    transition: all 0.2s ease;
}
#teach-place-toggle:hover:not(.active),
.teach-brush-btn:hover:not(.active) {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}
#teach-place-toggle:disabled,
.teach-brush-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

#sidebar .btn[onclick="startEditProblem()"].active {
    background: #e74c3c !important;
    color: white !important;
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.5);
}
#sidebar .btn[onclick="setEditBrush(1)"].active,
#sidebar .btn[onclick="setEditBrush(2)"].active,
#sidebar .btn[onclick="setEditBrush(0)"].active {
    background: #9b59b6 !important;
    color: white !important;
    box-shadow: 0 2px 8px rgba(155, 89, 182, 0.5);
}

#mk-none.active,
#mk-circle.active,
#mk-cross.active,
#mk-tri.active,
#mk-A.active,
#mk-B.active,
#mk-C.active,
#mk-D.active {
    background: #9b59b6 !important;
    color: white !important;
    box-shadow: 0 2px 8px rgba(155, 89, 182, 0.5);
    transform: translateY(-1px);
    transition: all 0.2s ease;
}
#mk-none:hover:not(.active),
#mk-circle:hover:not(.active),
#mk-cross:hover:not(.active),
#mk-tri:hover:not(.active),
#mk-A:hover:not(.active),
#mk-B:hover:not(.active),
#mk-C:hover:not(.active),
#mk-D:hover:not(.active) {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

/* ---------- 子系统：模式显隐控制 ---------- */
.mode-section { display: none; }
.mode-section.active { display: block; }
.mode-action { display: none; }
.mode-action.active { display: inline-block; }


/* ============================================================
   04. 子系统响应式适配
   ============================================================ */

@media print {
    #sidebar, #right { display: none !important; }
    #board-area { padding: 0 !important; }
    #goban { width: 100% !important; height: auto !important; }
    .current-game-name { width: 100% !important; font-size: 16px; }
}

@media (max-width: 768px) {
    #app { flex-direction: column; }
    #sidebar, #right {
        width: 100% !important;
        max-height: 40vh;
        border-left: none;
        border-top: 1px solid #ccc;
    }
    #board-area { padding: 10px; flex: 1; min-height: 50vh; }
    #goban {
        width: 100% !important;
        height: auto !important;
        aspect-ratio: 1 / 1;
        max-width: 820px;
    }
    .current-game-name {
        width: 100% !important;
        font-size: 14px;
        padding: 8px 10px;
    }
    .btn-grid-two-col {
        grid-template-columns: 1fr 1fr !important;
        gap: 4px !important;
    }
    #sidebar .btn, #right .btn {
        font-size: 13px;
        padding: 6px 4px;
    }
    #sidebar h2 { font-size: 13px; margin: 6px 0 3px 0; }
    #right h3 { font-size: 13px; }
    #sidebar div[style*="display:flex"] {
        flex-wrap: wrap !important;
        gap: 2px !important;
        justify-content: center !important;
    }
    #sidebar div[style*="display:flex"] .btn {
        flex: 0 0 auto !important;
        min-width: 28px !important;
        padding: 4px 6px !important;
        font-size: 14px !important;
    }
    #sidebar p { font-size: 10px !important; }
}

@media (min-width: 769px) and (max-width: 1200px) {
    #sidebar { width: 220px !important; padding: 10px 8px; }
    #right { width: 220px !important; padding: 10px 8px; }
    #sidebar .btn, #right .btn { font-size: 12px; padding: 5px 6px; }
    #sidebar h2 { font-size: 13px; margin: 8px 0 4px 0; }
    #goban { width: 600px !important; height: 600px !important; }
    .current-game-name { width: 600px !important; font-size: 14px; }
    @media (pointer: coarse) {
        #sidebar .btn, #right .btn {
            min-height: 44px !important;
            min-width: 44px !important;
            padding: 10px 14px !important;
            font-size: 16px !important;
        }
        select { min-height: 44px; font-size: 16px; padding: 8px 12px; }
    }
}

@media (pointer: coarse) and (min-width: 1201px) {
    .btn, button, .clickable {
        min-height: 56px !important;
        min-width: 56px !important;
        padding: 14px 20px !important;
        font-size: 20px !important;
    }
    select { min-height: 56px; font-size: 20px; padding: 12px 16px; }
    #sidebar h2 { font-size: 18px; margin: 12px 0 8px 0; }
    #goban { width: 900px !important; height: 900px !important; }
    .current-game-name { width: 900px !important; font-size: 20px; padding: 14px 20px; }
    #sidebar p, .panel-section p { font-size: 14px !important; }
    #info p { font-size: 16px !important; }
    #info .turn { font-size: 20px !important; }
}

/* ============================================================
   05.对弈入口：只显示“对弈”模式，隐藏教学和死活题
   ============================================================ */

/* 对弈入口页面：隐藏非对弈的模式按钮 */
body.play-mode-only .mode-btn[onclick*="teach"],
body.play-mode-only .mode-btn[onclick*="tsumego"] {
    display: none !important;
}

/* 对弈入口页面：只显示对弈按钮并保持高亮 */
body.play-mode-only .mode-btn[onclick*="play"] {
    cursor: default;
    opacity: 1;
}

