/* ==================== 主题变量 ==================== */
:root {
    --bg-primary: #0a0a12;
    --bg-secondary: rgba(22, 22, 35, 0.82);
    --bg-tertiary: rgba(30, 30, 48, 0.88);
    --border-primary: rgba(120, 130, 180, 0.08);
    --border-secondary: rgba(120, 130, 180, 0.14);
    --border-hover: rgba(140, 150, 200, 0.25);
    --text-primary: #e4e4f0;
    --text-secondary: #9a9ab8;
    --text-muted: #5c5c7a;
    --accent: #7b8cff;
    --accent-soft: rgba(123, 140, 255, 0.1);
    --glow-blue: rgba(123, 140, 255, 0.2);
    --particle-color: rgba(123, 140, 255, 0.06);
    --glass-bg: rgba(22, 22, 35, 0.55);
    --glass-border: rgba(120, 130, 180, 0.1);
    --panel-shadow: 0 2px 12px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(120, 130, 180, 0.06);
    --btn-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    --scrollbar-thumb: rgba(120, 130, 180, 0.15);
    --board-start: #d4a96a;
    --board-end: #c49555;
}

[data-theme="light"] {
    --bg-primary: #f0f2f8;
    --bg-secondary: rgba(255, 255, 255, 0.92);
    --bg-tertiary: rgba(235, 240, 250, 0.92);
    --border-primary: rgba(60, 80, 140, 0.08);
    --border-secondary: rgba(60, 80, 140, 0.12);
    --border-hover: rgba(60, 80, 140, 0.22);
    --text-primary: #1a1e2e;
    --text-secondary: #4a5068;
    --text-muted: #8890a8;
    --accent: #4a80ff;
    --accent-soft: rgba(74, 128, 255, 0.08);
    --glow-blue: rgba(74, 128, 255, 0.12);
    --particle-color: rgba(74, 128, 255, 0.04);
    --glass-bg: rgba(255, 255, 255, 0.72);
    --glass-border: rgba(60, 80, 140, 0.08);
    --panel-shadow: 0 2px 12px rgba(60, 80, 140, 0.06), 0 0 0 1px rgba(60, 80, 140, 0.04);
    --btn-shadow: 0 2px 8px rgba(60, 80, 140, 0.08);
    --scrollbar-thumb: rgba(60, 80, 140, 0.15);
    --board-start: #ecdab4;
    --board-end: #dcc89e;
}

[data-theme="ocean"] {
    --bg-primary: #091422;
    --bg-secondary: rgba(17, 34, 64, 0.8);
    --bg-tertiary: rgba(26, 48, 80, 0.85);
    --border-primary: rgba(100, 255, 218, 0.06);
    --border-secondary: rgba(100, 255, 218, 0.12);
    --border-hover: rgba(100, 255, 218, 0.25);
    --text-primary: #ccd6f6;
    --text-secondary: #8892b0;
    --text-muted: #4a5a7a;
    --accent: #64ffda;
    --accent-soft: rgba(100, 255, 218, 0.08);
    --glow-blue: rgba(100, 255, 218, 0.18);
    --particle-color: rgba(100, 255, 218, 0.06);
    --glass-bg: rgba(17, 34, 64, 0.55);
    --glass-border: rgba(100, 255, 218, 0.08);
    --panel-shadow: 0 2px 12px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(100, 255, 218, 0.04);
    --btn-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    --scrollbar-thumb: rgba(100, 255, 218, 0.2);
    --board-start: #ccb88a;
    --board-end: #bca87a;
}

[data-theme="forest"] {
    --bg-primary: #0a150d;
    --bg-secondary: rgba(20, 38, 24, 0.8);
    --bg-tertiary: rgba(28, 51, 32, 0.85);
    --border-primary: rgba(80, 200, 120, 0.06);
    --border-secondary: rgba(80, 200, 120, 0.12);
    --border-hover: rgba(80, 200, 120, 0.25);
    --text-primary: #d0f0d8;
    --text-secondary: #88b898;
    --text-muted: #4a7a58;
    --accent: #50c878;
    --accent-soft: rgba(80, 200, 120, 0.08);
    --glow-blue: rgba(80, 200, 120, 0.18);
    --particle-color: rgba(80, 200, 120, 0.06);
    --glass-bg: rgba(20, 38, 24, 0.55);
    --glass-border: rgba(80, 200, 120, 0.08);
    --panel-shadow: 0 2px 12px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(80, 200, 120, 0.04);
    --btn-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    --scrollbar-thumb: rgba(80, 200, 120, 0.2);
    --board-start: #d0b478;
    --board-end: #c0a468;
}

[data-theme="sunset"] {
    --bg-primary: #150a0e;
    --bg-secondary: rgba(38, 18, 24, 0.8);
    --bg-tertiary: rgba(51, 26, 34, 0.85);
    --border-primary: rgba(255, 112, 136, 0.06);
    --border-secondary: rgba(255, 112, 136, 0.12);
    --border-hover: rgba(255, 112, 136, 0.25);
    --text-primary: #ffd0d8;
    --text-secondary: #c88898;
    --text-muted: #7a4858;
    --accent: #ff7088;
    --accent-soft: rgba(255, 112, 136, 0.08);
    --glow-blue: rgba(255, 112, 136, 0.18);
    --particle-color: rgba(255, 112, 136, 0.06);
    --glass-bg: rgba(38, 18, 24, 0.55);
    --glass-border: rgba(255, 112, 136, 0.08);
    --panel-shadow: 0 2px 12px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 112, 136, 0.04);
    --btn-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    --scrollbar-thumb: rgba(255, 112, 136, 0.2);
    --board-start: #d8b080;
    --board-end: #c8a070;
}

/* ==================== 全局重置 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', sans-serif;
    background: var(--bg-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    overflow: auto;
}

/* ==================== 背景粒子 ==================== */
.bg-particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.particle {
    position: absolute;
    width: 2px;
    height: 2px;
    background: var(--particle-color);
    border-radius: 50%;
    animation: float linear infinite;
}

@keyframes float {
    0% { transform: translateY(100vh) rotate(0deg); opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { transform: translateY(-100vh) rotate(720deg); opacity: 0; }
}

.container {
    padding: 32px;
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 28px;
    width: 100%;
    position: relative;
}

.header-left {
    text-align: center;
}

.header-right {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ==================== 自定义下拉框 ==================== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.custom-select {
    position: relative;
}

.select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: var(--bg-tertiary);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 400;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: var(--btn-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.04);
    user-select: none;
}

.select-trigger:hover {
    border-color: var(--border-hover);
    box-shadow: var(--btn-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 0 12px var(--accent-soft);
}

.custom-select.open .select-trigger {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-soft), var(--btn-shadow);
}

.select-arrow {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
    transition: transform 0.25s ease;
}

.select-arrow path {
    fill: none;
    stroke: var(--text-muted);
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.custom-select.open .select-arrow {
    transform: rotate(180deg);
}

.custom-select .select-dropdown {
    display: none;
}

.select-dropdown {
    position: fixed;
    background: var(--bg-tertiary);
    backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 4px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.04);
    z-index: 1001;
    max-height: 200px;
    overflow-y: auto;
}

.select-option {
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.76rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.select-option:hover {
    background: var(--accent-soft);
    color: var(--text-primary);
}

.select-option.selected {
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 500;
}

.select-dropdown::-webkit-scrollbar {
    width: 3px;
}

.select-dropdown::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 2px;
}

.header-right .select-trigger {
    padding: 7px 12px;
    font-size: 0.72rem;
    color: var(--text-secondary);
}

.header-right .select-trigger:hover {
    color: var(--text-primary);
}

h1 {
    font-size: 2rem;
    font-weight: 200;
    letter-spacing: 0.5em;
    color: var(--text-primary);
    text-shadow: 0 0 40px var(--glow-blue), 0 0 80px var(--accent-soft);
}

.subtitle {
    font-size: 0.65rem;
    letter-spacing: 0.8em;
    color: var(--text-muted);
    margin-top: 6px;
    font-weight: 300;
}

.main {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    flex-shrink: 0;
}

.sidebar {
    width: 180px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 10px;
    box-shadow: var(--panel-shadow);
}

.panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 14px;
    transition: all 0.25s ease;
    box-shadow: var(--panel-shadow);
}

.panel:hover {
    border-color: var(--border-secondary);
    box-shadow: var(--panel-shadow), 0 0 0 1px var(--accent-soft);
}

.panel-title {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--text-muted);
    margin-bottom: 10px;
    font-weight: 500;
}

/* ==================== 状态与比分 ==================== */
.status {
    font-size: 0.85rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 400;
}

.thinking-dots {
    display: inline-flex;
    gap: 2px;
}

.thinking-dots span {
    animation: dotPulse 1.2s infinite;
    font-size: 1.1em;
}

.thinking-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.thinking-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes dotPulse {
    0%, 60%, 100% { opacity: 0.3; }
    30% { opacity: 1; }
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.dot.black {
    background: radial-gradient(circle at 35% 35%, #444 0%, #0a0a0a 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6), inset 0 1px 2px rgba(255, 255, 255, 0.08);
}

.dot.white {
    background: radial-gradient(circle at 35% 35%, #fff 0%, #d0d0d0 100%);
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25), inset 0 1px 2px rgba(255, 255, 255, 0.9);
}

/* ==================== 比分显示 ==================== */
.score-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    font-size: 1.3rem;
    font-weight: 300;
    letter-spacing: 0.02em;
}

.score-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.score-divider {
    color: var(--text-muted);
    font-weight: 200;
}

/* ==================== 设置面板 ==================== */
.settings {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.field label {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    font-weight: 500;
}

.mute-btn {
    background: var(--bg-tertiary);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 7px 12px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1;
    box-shadow: var(--btn-shadow);
    display: flex;
    align-items: center;
    justify-content: center;
}

.mute-btn:hover {
    border-color: var(--border-hover);
}

/* ==================== 操作按钮 ==================== */
.start-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 70%, #fff));
    border: none;
    color: #fff;
    padding: 12px;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
    letter-spacing: 0.12em;
    box-shadow: 0 4px 20px var(--glow-blue), 0 2px 8px rgba(0, 0, 0, 0.2);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.start-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px var(--glow-blue), 0 4px 12px rgba(0, 0, 0, 0.2);
    filter: brightness(1.08);
}

.start-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px var(--glow-blue);
}

/* ==================== 胜率面板 ==================== */
.toggle-winrate-btn {
    width: 100%;
    background: var(--bg-tertiary);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    padding: 8px;
    border-radius: 8px;
    font-size: 0.72rem;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 0.06em;
}

.toggle-winrate-btn:hover {
    color: var(--text-secondary);
    border-color: var(--border-secondary);
}

.toggle-winrate-btn.active {
    background: var(--accent-soft);
    border-color: color-mix(in srgb, var(--accent) 20%, transparent);
    color: var(--accent);
}

.winrate-panel {
    overflow: hidden;
}

.winrate-bar {
    display: flex;
    height: 22px;
    border-radius: 6px;
    overflow: hidden;
    background: var(--bg-tertiary);
}

.winrate-black {
    background: linear-gradient(90deg, #1a1a1a 0%, #333 100%);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 36px;
}

.winrate-white {
    background: linear-gradient(90deg, #ddd 0%, #fff 100%);
    color: #333;
    font-size: 0.68rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 36px;
}

.winrate-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 0.6rem;
    color: var(--text-muted);
    font-weight: 400;
}

.btn-row {
    display: flex;
    gap: 8px;
}

.btn-row button {
    flex: 1;
    background: var(--bg-tertiary);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    padding: 10px;
    border-radius: 10px;
    font-size: 0.78rem;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 0.08em;
    position: relative;
    overflow: hidden;
    box-shadow: var(--btn-shadow);
}

.btn-row button:hover {
    color: var(--text-primary);
    border-color: var(--border-secondary);
    box-shadow: var(--btn-shadow), 0 0 16px var(--accent-soft);
}

.btn-row button:active {
    transform: scale(0.97);
}

.btn-row button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-row button:disabled:hover {
    border-color: var(--glass-border);
    color: var(--text-secondary);
    box-shadow: none;
}

.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    transform: scale(0);
    animation: rippleEffect 0.6s linear;
    pointer-events: none;
}

@keyframes rippleEffect {
    to { transform: scale(4); opacity: 0; }
}

/* ==================== 棋谱列表 ==================== */
.move-list {
    max-height: 180px;
    overflow-y: auto;
    font-size: 0.72rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.move-list::-webkit-scrollbar {
    width: 3px;
}

.move-list::-webkit-scrollbar-track {
    background: transparent;
}

.move-list::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 2px;
}

.move-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 6px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.move-item:hover {
    background: var(--accent-soft);
}

.move-item.current {
    color: var(--text-primary);
    background: var(--accent-soft);
    border-left: 2px solid var(--accent);
    padding-left: 4px;
}

.move-num {
    color: var(--text-muted);
    min-width: 28px;
    font-size: 0.68rem;
}

.move-player {
    color: var(--text-muted);
    min-width: 16px;
}

.move-coord {
    color: var(--text-secondary);
    font-weight: 500;
}

.ai-tag {
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 0.58rem;
    padding: 1px 5px;
    border-radius: 4px;
    margin-left: 4px;
    font-weight: 500;
}

/* ==================== Toast 确认弹窗 ==================== */
.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.92);
    background: var(--glass-bg);
    backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border);
    border-radius: 18px;
    padding: 28px 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 1001;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.04);
    min-width: 280px;
}

.toast.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.toast span {
    color: var(--text-primary);
    font-size: 0.92rem;
    text-align: center;
    line-height: 1.5;
}

.toast-btns {
    display: flex;
    gap: 12px;
    width: 100%;
}

.toast-btn {
    flex: 1;
    background: var(--bg-tertiary);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.toast-btn:hover {
    color: var(--text-primary);
    border-color: var(--border-secondary);
}

.toast-btn.confirm {
    background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 70%, #fff));
    border: none;
    color: #fff;
    font-weight: 500;
    box-shadow: 0 4px 16px var(--glow-blue);
}

.toast-btn.confirm:hover {
    filter: brightness(1.1);
    box-shadow: 0 6px 24px var(--glow-blue);
}

/* ==================== 胜利弹窗 ==================== */
.victory-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(12px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.victory-overlay.show {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.victory-modal {
    background: var(--glass-bg);
    backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 36px 48px;
    text-align: center;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.04);
    animation: modalPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalPop {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.victory-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.victory-icon.black {
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.6));
}

.victory-icon.white {
    filter: drop-shadow(0 4px 12px rgba(255, 255, 255, 0.3));
}

.victory-text {
    font-size: 1.4rem;
    font-weight: 300;
    letter-spacing: 0.12em;
    color: var(--text-primary);
    margin-bottom: 24px;
}

.victory-btns {
    display: flex;
    gap: 12px;
}

.victory-btn {
    flex: 1;
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
    letter-spacing: 0.06em;
    border: none;
}

.victory-btn.primary {
    background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 70%, #fff));
    color: #fff;
    box-shadow: 0 4px 20px var(--glow-blue);
}

.victory-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px var(--glow-blue);
}

.victory-btn.secondary {
    background: var(--bg-tertiary);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
}

.victory-btn.secondary:hover {
    color: var(--text-primary);
    border-color: var(--border-secondary);
}

.board-container {
    position: relative;
}

.board-wrap {
    background: linear-gradient(145deg, var(--board-start) 0%, var(--board-end) 100%);
    border-radius: 12px;
    padding: 4px;
    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.5),
        0 2px 8px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.15),
        inset 0 -1px 0 rgba(0, 0, 0, 0.1);
}

#board {
    display: block;
    border-radius: 8px;
    cursor: crosshair;
    touch-action: none;
}

.keyboard-hint {
    margin-top: 26px;
    display: flex;
    justify-content: center;
    gap: 16px;
    font-size: 0.72rem;
    color: var(--text-muted);
    z-index: 1;
    padding-bottom: 24px;
    flex-shrink: 0;
}

.keyboard-spacer {
    flex: 1;
    min-height: 0;
}

.keyboard-hint span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.key {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 5px;
    background: var(--bg-tertiary);
    border: 1px solid var(--glass-border);
    border-radius: 5px;
    font-size: 0.65rem;
    font-weight: 500;
    color: var(--text-secondary);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

/* ==================== 桌面端隐藏移动端元素 ==================== */
.mobile-bar, .mobile-overlay, .mobile-top-bar, .mobile-title {
    display: none;
}

/* ==================== 移动端响应式 ==================== */
@media (max-width: 700px) {
/* ==================== 容器与头部 ==================== */
.container {
        padding: 4px;
        padding-bottom: 0;
        height: 100vh;
        height: 100dvh;
        display: flex;
        flex-direction: column;
    }

    .header {
        margin-bottom: 4px;
        flex-wrap: wrap;
        gap: 2px;
        flex-shrink: 0;
    }

    .header .header-left {
        display: none;
    }

    .header-right {
        position: static;
        transform: none;
        width: 100%;
        display: flex;
        justify-content: center;
        gap: 16px;
    }

/* ==================== 标题与副标题 ==================== */
h1 {
        font-size: 1.2rem;
        letter-spacing: 0.4em;
    }

    .subtitle {
        font-size: 0.5rem;
        margin-top: 1px;
    }

/* ==================== 主布局 ==================== */
.main {
        flex-direction: column;
        align-items: center;
        gap: 0;
        flex: 1;
        min-height: auto;
    }

/* ==================== 侧边栏面板 ==================== */
.sidebar {
        display: none;
    }

    .mobile-top-bar {
        display: flex;
        flex-direction: column;
        padding: 6px 12px;
        background: var(--bg-secondary);
        backdrop-filter: blur(16px);
        border-bottom: 1px solid var(--glass-border);
        flex-shrink: 0;
        position: relative;
        z-index: 50;
    }

    .mobile-top-bar-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .mobile-winrate-bar-wrap {
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.25s ease, padding 0.25s ease, opacity 0.2s ease;
        opacity: 0;
        padding: 0 0;
    }

    .mobile-winrate-bar-wrap.show {
        max-height: 50px;
        opacity: 1;
        padding: 8px 0 0;
    }

    .mobile-title {
        display: flex;
        flex-direction: column;
        align-items: center;
        padding: 0;
        margin-top: 40px;
        flex-shrink: 0;
    }

    .mobile-title h1 {
        font-size: 2rem;
        letter-spacing: 0.4em;
        margin: 0;
    }

    .mobile-title .subtitle {
        font-size: 0.9rem;
    }

    .mobile-status {
        font-size: 0.8rem;
        color: var(--text-primary);
        display: flex;
        align-items: center;
        gap: 6px;
    }

    .mobile-score {
        font-size: 1rem;
        font-weight: 300;
        color: var(--text-primary);
        display: flex;
        align-items: center;
        gap: 6px;
    }

    .mobile-score .dot {
        width: 10px;
        height: 10px;
    }

    .mobile-right {
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .mobile-winrate-toggle {
        background: var(--bg-tertiary);
        border: 1px solid var(--glass-border);
        border-radius: 6px;
        width: 28px;
        height: 28px;
        display: flex;
        align-items: center;
        justify-content: center;
        color: var(--text-muted);
        cursor: pointer;
        transition: all 0.2s ease;
        pointer-events: auto;
        position: relative;
        z-index: 51;
    }

    .mobile-winrate-toggle:active {
        transform: scale(0.92);
    }

    .mobile-winrate-toggle.active {
        color: var(--accent);
        background: var(--accent-soft);
        border-color: color-mix(in srgb, var(--accent) 20%, transparent);
    }

/* ==================== 棋盘容器 ==================== */
.board-container {
        flex: 1;
        min-height: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
    }

    .board-wrap {
        width: 100%;
        max-width: 100%;
        max-height: 100%;
        border-radius: 10px;
        padding: 3px;
    }

    #board {
        width: 100%;
        height: auto;
    }

    .mobile-bar {
        display: flex;
        flex-direction: column;
        gap: 0;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--bg-secondary);
        backdrop-filter: blur(20px);
        border-top: 1px solid var(--glass-border);
        padding: 8px 12px;
        z-index: 100;
        box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.3);
    }

    .mobile-bar-btns {
        display: flex;
        gap: 6px;
    }

    .mobile-game-btns {
        display: flex;
        gap: 6px;
        flex: 1;
    }

    .mobile-action-btn {
        flex: 1;
        background: var(--bg-tertiary);
        border: 1px solid var(--glass-border);
        color: var(--text-secondary);
        padding: 10px 8px;
        border-radius: 8px;
        font-size: 0.78rem;
        cursor: pointer;
        transition: all 0.15s ease;
    }

    .mobile-action-btn:active {
        transform: scale(0.96);
    }

    .mobile-action-btn:disabled {
        opacity: 0.35;
        cursor: not-allowed;
    }

    .mobile-action-btn:disabled:active {
        transform: none;
    }

    .mobile-action-btn.primary {
        flex: 1;
        background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 70%, #fff));
        color: #fff;
        border: none;
        font-weight: 500;
    }

    .mobile-action-btn.menu-btn {
        flex: 0 0 auto;
        width: 42px;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 10px;
    }

    .mobile-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: var(--bg-primary);
        z-index: 200;
        flex-direction: column;
        animation: slideUpOverlay 0.25s ease;
    }

    .mobile-overlay.open {
        display: flex;
    }

    @keyframes slideUpOverlay {
        from { transform: translateY(100%); }
        to { transform: translateY(0); }
    }

    .mobile-overlay-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 16px 16px 8px;
        font-size: 1rem;
        font-weight: 500;
        color: var(--text-primary);
    }

    .mobile-overlay-close {
        background: none;
        border: none;
        color: var(--text-secondary);
        cursor: pointer;
        padding: 4px;
    }

    .mobile-overlay-tabs {
        display: flex;
        gap: 4px;
        padding: 0 16px;
        border-bottom: 1px solid var(--glass-border);
    }

    .mobile-tab {
        flex: 1;
        background: none;
        border: none;
        border-bottom: 2px solid transparent;
        color: var(--text-muted);
        padding: 12px 8px;
        font-size: 0.82rem;
        cursor: pointer;
        transition: all 0.2s ease;
    }

    .mobile-tab.active {
        color: var(--accent);
        border-bottom-color: var(--accent);
    }

    .mobile-overlay-body {
        flex: 1;
        overflow-y: auto;
        padding: 16px;
    }

    .mobile-panel {
        display: none;
    }

    .mobile-panel.active {
        display: block;
    }

    .mobile-panel .move-list {
        max-height: 60vh;
    }

    .mobile-panel .settings {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .mobile-panel .field {
        display: flex;
        flex-direction: column;
        gap: 4px;
    }

    .mobile-panel .winrate-bar {
        margin-top: 8px;
    }

    .victory-modal {
        padding: 28px 32px;
        margin: 16px;
        border-radius: 20px;
    }

    .victory-text {
        font-size: 1.2rem;
    }

/* ==================== 快捷键提示 ==================== */
.keyboard-hint {
        display: none;
    }
}
