/* 围棋样式 - 手机/电脑自适应 */
* {
    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: 22px;
    letter-spacing: 6px;
}

.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;
}

/* 提子信息 */
#capture-bar {
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 26px;
    padding: 4px 0 6px;
    color: #f2d9b0;
    font-size: 14px;
    flex-shrink: 0;
}

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

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

.stone-icon {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
}
.stone-icon.black {
    background: radial-gradient(circle at 35% 35%, #666, #000);
    border: 1px solid #000;
}
.stone-icon.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: 10px 16px;
    background: rgba(0, 0, 0, 0.38);
    border-radius: 20px;
    margin: 8px 0;
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    flex-shrink: 0;
}

/* 按钮 */
#controls {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
    padding-bottom: 6px;
}

.btn {
    padding: 12px 26px;
    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;
}

.btn.hidden { display: none; }

/* 弹窗 */
.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: 26px 32px;
    border-radius: 16px;
    text-align: center;
    max-width: 86%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
}
.modal-content h2 {
    color: #3a2314;
    margin-bottom: 10px;
    font-size: 24px;
}
.modal-content p {
    color: #6d4c41;
    margin-bottom: 14px;
    font-size: 15px;
}

.score-box {
    background: #f5ecd8;
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 16px;
}

.score-row {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    font-size: 16px;
    color: #3a2314;
    padding: 4px 0;
}
.score-row b { color: #c0392b; font-size: 18px; }

.score-note {
    font-size: 12px;
    color: #8d6e63;
    margin-top: 6px;
}

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

/* 电脑大屏 */
@media (min-width: 700px) {
    #game-container { padding: 14px 20px; }
    #topbar h1 { font-size: 28px; }
    .difficulty { font-size: 16px; }
    .difficulty select { font-size: 16px; padding: 6px 12px; }
    #capture-bar { font-size: 15px; }
    #status { font-size: 18px; }
    .btn { padding: 14px 36px; font-size: 17px; }
}

/* 小屏手机 */
@media (max-width: 380px) {
    #topbar h1 { font-size: 18px; letter-spacing: 3px; }
    .difficulty select { padding: 4px 6px; font-size: 13px; }
    #capture-bar { font-size: 12px; gap: 14px; }
    #status { font-size: 14px; padding: 8px 12px; }
    .btn { padding: 10px 18px; font-size: 14px; }
    #controls { gap: 6px; }
}
