/* 国际象棋样式 —— 手机/电脑自适应（与本站其他游戏保持一致的深色木质风） */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: linear-gradient(135deg, #1a0f08 0%, #3a2314 50%, #1a0f08 100%);
    min-height: 100vh;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

#game-container {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 10px;
    max-width: 760px;
    margin: 0 auto;
}

/* 顶栏 */
#topbar {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 4px 2px;
    color: #f2d9b0;
    flex-shrink: 0;
}

#topbar h1 {
    font-size: 20px;
    letter-spacing: 3px;
}

.difficulty {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
}

.difficulty select {
    background: rgba(255, 255, 255, 0.15);
    color: #f2d9b0;
    border: 1px solid rgba(255, 215, 160, 0.35);
    border-radius: 8px;
    padding: 5px 8px;
    font-size: 14px;
    -webkit-appearance: none;
    appearance: none;
}

.difficulty select option {
    background: #3a2314;
    color: #f2d9b0;
}

/* 信息条 */
#infobar {
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 16px;
    padding: 4px 0 6px;
    color: #f2d9b0;
    font-size: 13px;
    flex-shrink: 0;
}

.info-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(0, 0, 0, 0.3);
    padding: 3px 12px;
    border-radius: 12px;
}

.info-item b { color: #f1c40f; }

.dot {
    display: inline-block;
    width: 11px;
    height: 11px;
    border-radius: 50%;
}
.dot.black { background: radial-gradient(circle at 35% 35%, #666, #000); border: 1px solid #000; }
.dot.white { background: radial-gradient(circle at 35% 35%, #fff, #ccc); border: 1px solid #999; }

/* 棋盘 */
#board-wrap {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 0;
    width: 100%;
}

#board {
    display: block;
    border-radius: 6px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
    max-width: 100%;
    max-height: 100%;
    touch-action: manipulation;
}

/* 状态栏 */
#status {
    color: #f2d9b0;
    font-size: 16px;
    font-weight: bold;
    text-align: center;
    padding: 9px 16px;
    background: rgba(0, 0, 0, 0.38);
    border-radius: 20px;
    margin: 8px 0;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    flex-shrink: 0;
}

/* 按钮 */
#controls {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
    padding-bottom: 4px;
    flex-wrap: wrap;
    justify-content: center;
}

.btn {
    padding: 12px 30px;
    font-size: 16px;
    font-weight: bold;
    border: none;
    border-radius: 24px;
    cursor: pointer;
    background: #7a5230;
    color: #fff4e2;
    transition: all 0.2s;
    touch-action: manipulation;
}

.btn:active {
    transform: scale(0.95);
    opacity: 0.85;
}

/* 版本/引擎标识 */
#build {
    font-size: 11px;
    color: rgba(242, 217, 176, 0.55);
    padding: 2px 0 6px;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

/* 弹窗 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.82);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}
.modal.hidden { display: none; }

.modal-content {
    background: #fdf6e3;
    padding: 24px 28px;
    border-radius: 16px;
    text-align: center;
    max-width: 88%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
}
.modal-content h2 {
    color: #3a2314;
    margin-bottom: 10px;
    font-size: 22px;
}
.modal-content p {
    color: #6d4c41;
    margin-bottom: 14px;
    font-size: 15px;
}

.score-box {
    background: #f5ecd8;
    border-radius: 10px;
    padding: 10px 14px;
    margin-bottom: 16px;
}
.score-note {
    font-size: 12px;
    color: #8d6e63;
    margin-top: 4px;
    word-break: break-all;
}
.score-note b { color: #3a2314; }
.score-note.legend {
    margin-top: 8px;
    line-height: 1.6;
    text-align: left;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 4px;
}

/* 升变选择 */
#promo-choices {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 8px;
}

.promo-btn {
    width: 58px;
    height: 68px;
    font-size: 32px;
    line-height: 1;
    background: #f0e2c8;
    border: 2px solid #c9ab7d;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: #2b2b2b;
}
.promo-btn span {
    font-size: 11px;
    color: #6d4c41;
}
.promo-btn:active { transform: scale(0.94); }

.modal-content .btn {
    background: #c0392b;
    color: #fff;
}

.modal-content .btn.btn-ghost {
    background: #8d6e63;
}

/* 电脑大屏 */
@media (min-width: 700px) {
    #game-container { padding: 14px 20px; }
    #topbar h1 { font-size: 26px; }
    .difficulty { font-size: 16px; }
    .difficulty select { font-size: 16px; padding: 6px 12px; }
    #infobar { font-size: 15px; }
    #status { font-size: 18px; }
    .btn { padding: 14px 38px; font-size: 17px; }
    .promo-btn { width: 66px; height: 78px; font-size: 38px; }
}

/* 小屏手机 */
@media (max-width: 380px) {
    #topbar h1 { font-size: 17px; letter-spacing: 2px; }
    .difficulty select { padding: 4px 6px; font-size: 13px; }
    #infobar { font-size: 12px; gap: 10px; }
    #status { font-size: 14px; padding: 8px 12px; }
    .btn { padding: 10px 22px; font-size: 14px; }
    #controls { gap: 6px; }
    .promo-btn { width: 50px; height: 60px; font-size: 28px; }
}
