* {
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow-x: hidden;
}

body {
    background: linear-gradient(145deg, #2a6b5e 0%, #1d4e44 100%);
    min-height: 100vh;
    min-height: -webkit-fill-available;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'Segoe UI', 'Noto Sans CJK SC', 'Microsoft YaHei', 'PingFang SC', system-ui, -apple-system, sans-serif;
    margin: 0;
    padding: 0;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    -webkit-overflow-scrolling: touch;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.game-container {
    display: -webkit-flex;
    display: flex;
    gap: 20px;
    background: #e8bc7e;
    border-radius: 32px;
    box-shadow: 0 25px 40px rgba(0, 0, 0, 0.4), inset 0 1px 2px rgba(255, 255, 255, 0.3);
    padding: 20px;
    -webkit-align-items: flex-start;
    align-items: flex-start;
    max-width: 100%;
    max-height: 100%;
    overflow: auto;
}

.left-panel {
    display: -webkit-flex;
    display: flex;
    -webkit-flex-direction: column;
    flex-direction: column;
    -webkit-align-items: center;
    align-items: center;
}

.right-panel {
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-width: 380px;
    max-width: 480px;
    min-height: 680px;
    overflow-x: hidden;
    word-wrap: break-word;
}

.right-panel .control-panel {
    background: #d9b56a;
    border-radius: 20px;
    padding: 15px;
    box-shadow: inset 0 1px 3px #fff8, 0 4px 8px #00000030;
    flex-shrink: 0;
}

.right-panel .history-panel {
    margin-top: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #d9b56a;
    border-radius: 20px;
    padding: 15px;
    box-shadow: inset 0 1px 3px #fff8, 0 4px 8px #00000030;
}

.right-panel .history-panel .history-list {
    flex: 1;
    overflow-y: auto;
}

.right-panel .info-panel {
    background: #d9b56a;
    border-radius: 60px;
    padding: 8px 20px;
    box-shadow: inset 0 1px 3px #fff8, 0 4px 8px #00000030;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 15px;
    flex-wrap: nowrap;
    flex-shrink: 0;
}

.right-panel .status {
    background: #2c2118;
    color: #ffefb9;
    padding: 10px 15px;
    border-radius: 15px;
    font-size: 0.9rem;
    font-weight: bold;
    text-align: center;
}

.right-panel .toggle-config,
.right-panel .action-btn {
    background: #8b5a2b;
    color: #fff;
    border: none;
    padding: 8px 14px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: bold;
    transition: background 0.2s;
    height: 36px;
    line-height: 1.2;
}

.right-panel .toggle-config:hover,
.right-panel .action-btn:hover {
    background: #6b4423;
}

.right-panel .config-panel {
    background: #d9b56a;
    border-radius: 20px;
    padding: 15px;
    box-shadow: inset 0 1px 3px #fff8, 0 4px 8px #00000030;
}

canvas {
    display: block;
    margin: 0 auto;
    border-radius: 6px;
    box-shadow: inset 0 0 0 2px #f9e0a0, 0 0 0 3px #b97f3a;
    cursor: pointer;
    background-color: #f7e9c3;
}

.control-panel {
    margin-top: 2px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mode-select {
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: center;
}

.mode-select select {
    padding: 6px 10px;
    border-radius: 15px;
    border: 2px solid #b97f3a;
    background: #ffcf7a;
    font-size: 0.85rem;
    font-weight: bold;
    color: #3b2a1f;
    cursor: pointer;
    font-family: inherit;
    flex: 1;
    min-width: 0;
}

.mode-select select:focus {
    outline: none;
    border-color: #8b5a2b;
}

.mode-select span {
    flex-shrink: 0;
}

.mode-select button {
    padding: 6px 12px;
    border-radius: 15px;
    flex-shrink: 0;
    font-size: 0.85rem;
    height: 36px;
    line-height: 1.2;
}

.mode-select button:disabled {
    background: #999;
    cursor: not-allowed;
    opacity: 0.6;
}

.ai-level-select {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding: 6px 10px;
    background: rgba(185, 127, 58, 0.2);
    border-radius: 20px;
}

.ai-level-select label {
    font-size: 0.85rem;
    color: #3b2a1f;
    font-weight: 500;
    white-space: nowrap;
}

.ai-level-select select {
    padding: 4px 10px;
    border-radius: 15px;
    border: 2px solid #b97f3a;
    background: #ffcf7a;
    font-size: 0.8rem;
    color: #3b2a1f;
    font-family: inherit;
    cursor: pointer;
    flex: 1;
    max-width: 160px;
}

.ai-level-select select:focus {
    outline: none;
    border-color: #8b5a2b;
}

/* 红黑方AI级别容器 - 并排显示 */
#aiLevelContainer {
    display: flex;
    justify-content: center;
    gap: 20px;
}

#aiLevelContainer > div {
    display: flex;
    align-items: center;
    gap: 5px;
}

.top-buttons {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    justify-content: center;
}

.top-buttons button {
    flex: 1;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    height: 36px;
    line-height: 1.2;
}

.info-panel {
    margin-top: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    flex-wrap: nowrap;
    background: #d9b56a;
    border-radius: 60px;
    padding: 8px 20px;
    box-shadow: inset 0 1px 3px #fff8, 0 4px 8px #00000030;
}

.turn-indicator {
    background: #2c2118;
    padding: 8px 16px;
    border-radius: 40px;
    color: #f7e9b0;
    font-weight: bold;
    font-size: 1rem;
    letter-spacing: 2px;
    box-shadow: inset 0 1px 2px #fffa, 0 2px 5px #00000040;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.turn-icon {
    font-size: 1.4rem;
    filter: drop-shadow(0 2px 2px rgba(0,0,0,0.3));
}

.ai-thought {
    background: #2e241d;
    padding: 8px 16px;
    border-radius: 40px;
    color: #f5d742;
    font-family: monospace;
    font-size: 1rem;
    font-weight: bold;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: inset 0 1px 1px #ffeeaa, 0 2px 4px #00000030;
    text-align: center;
}

button {
    background: #ffcf7a;
    border: none;
    font-size: 0.85rem;
    font-weight: bold;
    padding: 6px 14px;
    border-radius: 32px;
    cursor: pointer;
    transition: 0.2s;
    font-family: inherit;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    color: #3b2a1f;
    line-height: 1.2;
}

button:active {
    transform: scale(0.96);
    box-shadow: 0 1px 2px black;
}

.status {
    background: #000000aa;
    color: #ffefb9;
    padding: 4px 16px;
    border-radius: 28px;
    font-size: 0.85rem;
    font-weight: bold;
    backdrop-filter: blur(2px);
}

@keyframes pulse {
    0% { opacity: 0.6; text-shadow: 0 0 0px gold;}
    100% { opacity: 1; text-shadow: 0 0 4px #ffcc44;}
}

.ai-thinking {
    animation: pulse 0.8s infinite;
}

/* 配置面板 */
.config-panel {
    margin-top: 15px;
    background: #d9b56a;
    border-radius: 20px;
    padding: 15px 20px;
    box-shadow: inset 0 1px 3px #fff8, 0 4px 8px #00000030;
}

/* 模态窗口 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: #e8bc7e;
    border-radius: 20px;
    padding: 25px 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    max-width: 450px;
    width: 90%;
    animation: modalIn 0.3s ease-out;
}

/* 配置面板特殊样式 - 更宽且支持滚动 */
.config-modal-content {
    max-width: 750px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.config-scrollable {
    overflow-y: auto;
    max-height: calc(85vh - 140px);
    padding-right: 5px;
}

.config-scrollable::-webkit-scrollbar {
    width: 6px;
}

.config-scrollable::-webkit-scrollbar-track {
    background: rgba(139, 90, 43, 0.2);
    border-radius: 3px;
}

.config-scrollable::-webkit-scrollbar-thumb {
    background: rgba(139, 90, 43, 0.5);
    border-radius: 3px;
}

.config-buttons-fixed {
    margin-top: auto;
    padding-top: 15px;
    border-top: 1px solid rgba(139, 90, 43, 0.3);
    background: #e8bc7e;
}

/* 配置行容器 - 并排显示 */
.config-row-container {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.config-row-container > * {
    flex: 1;
}

@keyframes modalIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #c9a55a;
}

.modal-title {
    font-size: 1.2rem;
    font-weight: bold;
    color: #3b2a1f;
}

.modal-close {
    background: #8b5a2b;
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    line-height: 1;
    padding: 0;
    transition: background 0.2s;
}

.modal-close:hover {
    background: #6b4423;
}

.config-title {
    font-size: 1rem;
    font-weight: bold;
    color: #3b2a1f;
    margin-bottom: 10px;
    text-align: center;
}

.config-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.llm-config-section {
    background: rgba(139, 90, 43, 0.1);
    border-radius: 10px;
    padding: 10px;
}

.config-section-title {
    font-weight: bold;
    font-size: 0.9rem;
    color: #5a4030;
    margin-bottom: 8px;
    padding-bottom: 5px;
    border-bottom: 1px solid rgba(139, 90, 43, 0.3);
}

.config-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
}

.config-row label {
    min-width: 50px;
    font-size: 0.85rem;
}

.config-row input[type="text"],
.config-row select {
    flex: 1;
    padding: 5px 8px;
    border-radius: 8px;
    border: 1px solid #b97f3a;
    background: #ffcf7a;
    font-size: 0.8rem;
}

.music-label {
    font-size: 0.8rem;
    color: #5a4030;
}

.config-row label {
    min-width: 80px;
    font-size: 0.9rem;
    color: #3b2a1f;
    font-weight: bold;
}

.config-row input, .config-row select {
    flex: 1;
    padding: 6px 12px;
    border-radius: 12px;
    border: 2px solid #b97f3a;
    background: #fff8e8;
    font-size: 0.9rem;
    font-family: inherit;
}

.config-row input:focus, .config-row select:focus {
    outline: none;
    border-color: #8b5a2b;
}

.config-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 10px;
}

.config-buttons button {
    padding: 6px 16px;
    font-size: 0.9rem;
}

.btn-primary {
    background: #4caf50;
    color: white;
}

.btn-secondary {
    background: #ff9800;
    color: white;
}

.hidden {
    display: none !important;
}

.toggle-config {
    background: #6b8e23;
    color: white;
    width: 100%;
    margin-top: 10px;
}

/* 游戏记录面板 */
.history-panel .history-title {
    flex-shrink: 0;
}

.history-panel .history-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.history-title {
    font-size: 1rem;
    font-weight: bold;
    color: #3b2a1f;
    margin-bottom: 10px;
    text-align: center;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

/* 自定义滚动条样式 */
.history-list::-webkit-scrollbar {
    width: 8px;
}

.history-list::-webkit-scrollbar-track {
    background: rgba(139, 90, 43, 0.2);
    border-radius: 4px;
}

.history-list::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #c9a55a, #a07830);
    border-radius: 4px;
    border: 1px solid #8b5a2b;
}

.history-list::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #dbb86a, #b8944a);
}

.history-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px;
    background: rgba(255,255,255,0.3);
    border-radius: 10px;
    font-size: 0.85rem;
    flex-wrap: wrap;
}

/* 聊天样式 */
.chat-message {
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 12px;
    max-width: 90%;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.chat-red {
    background: #ffcccc;
    margin-right: auto;
    border-bottom-left-radius: 2px;
}

.chat-black {
    background: #e0e0e0;
    margin-left: auto;
    border-bottom-right-radius: 2px;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    font-size: 0.75rem;
}

.chat-name {
    font-weight: bold;
    color: #333;
}

.chat-step {
    color: #666;
}

.chat-content {
    font-size: 0.9rem;
    font-weight: bold;
}

.chat-thinking-toggle {
    font-size: 0.75rem;
    color: #666;
    cursor: pointer;
    margin-top: 5px;
    text-decoration: underline;
}

.history-thinking {
    width: 100%;
    padding: 8px;
    margin-top: 5px;
    background: rgba(255,255,255,0.7);
    border-radius: 8px;
    font-size: 0.8rem;
    color: #333;
    line-height: 1.4;
    box-sizing: border-box;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-height: 300px;
    overflow-y: auto;
}

/* 历史记录中推理过程和最终结论的样式 */
.history-reasoning-section,
.history-conclusion-section {
    margin-top: 8px;
}

.history-reasoning-toggle,
.history-conclusion-toggle {
    font-size: 0.75rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.history-reasoning-toggle {
    color: #1976d2;
    background: rgba(25, 118, 210, 0.1);
}

.history-conclusion-toggle {
    color: #388e3c;
    background: rgba(56, 142, 60, 0.1);
}

.history-reasoning-content,
.history-conclusion-content {
    width: 100%;
    padding: 8px;
    margin-top: 4px;
    border-radius: 8px;
    font-size: 0.8rem;
    line-height: 1.4;
    box-sizing: border-box;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-height: 200px;
    overflow-y: auto;
    display: block;
}

.history-reasoning-content {
    background: rgba(25, 118, 210, 0.08);
    color: #333;
}

/* 推理过程内容滚动条样式 */
.history-reasoning-content::-webkit-scrollbar {
    width: 6px;
}

.history-reasoning-content::-webkit-scrollbar-track {
    background: rgba(25, 118, 210, 0.1);
    border-radius: 3px;
}

.history-reasoning-content::-webkit-scrollbar-thumb {
    background: rgba(25, 118, 210, 0.4);
    border-radius: 3px;
}

.history-reasoning-content::-webkit-scrollbar-thumb:hover {
    background: rgba(25, 118, 210, 0.6);
}

.history-conclusion-content {
    background: rgba(56, 142, 60, 0.08);
    color: #333;
}

/* 最终结论内容滚动条样式 */
.history-conclusion-content::-webkit-scrollbar {
    width: 6px;
}

.history-conclusion-content::-webkit-scrollbar-track {
    background: rgba(56, 142, 60, 0.1);
    border-radius: 3px;
}

.history-conclusion-content::-webkit-scrollbar-thumb {
    background: rgba(56, 142, 60, 0.4);
    border-radius: 3px;
}

.history-conclusion-content::-webkit-scrollbar-thumb:hover {
    background: rgba(56, 142, 60, 0.6);
}

.toggle-icon {
    font-size: 0.7rem;
}

.history-num {
    font-weight: bold;
    color: #8b4513;
    min-width: 30px;
}

.history-move {
    font-family: monospace;
    color: #3b2a1f;
}

/* 提示词样式 */
.chat-prompt-section {
    margin-top: 8px;
}

.chat-prompt-toggle {
    font-size: 0.75rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #7b1fa2;
    background: rgba(123, 31, 162, 0.1);
}

.chat-prompt-toggle:hover {
    background: rgba(123, 31, 162, 0.2);
}

.chat-prompt-content {
    margin-top: 6px;
    padding: 8px 10px;
    font-size: 0.7rem;
    line-height: 1.4;
    border-radius: 6px;
    white-space: pre-wrap;
    word-break: break-word;
    background: rgba(123, 31, 162, 0.05);
    border-left: 3px solid #7b1fa2;
    color: #6a1b9a;
    max-height: 300px;
    overflow-y: auto;
}

/* 提示词内容滚动条样式 */
.chat-prompt-content::-webkit-scrollbar {
    width: 6px;
}

.chat-prompt-content::-webkit-scrollbar-track {
    background: rgba(123, 31, 162, 0.1);
    border-radius: 3px;
}

.chat-prompt-content::-webkit-scrollbar-thumb {
    background: rgba(123, 31, 162, 0.4);
    border-radius: 3px;
}

.chat-prompt-content::-webkit-scrollbar-thumb:hover {
    background: rgba(123, 31, 162, 0.6);
}

/* 动画效果 */
@keyframes pieceMove {
    0% { transform: translate(0, 0); }
    100% { transform: translate(var(--dx), var(--dy)); }
}

@keyframes captureEffect {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.5); opacity: 0.5; }
    100% { transform: scale(0); opacity: 0; }
}

.captured {
    animation: captureEffect 0.4s ease-out forwards;
}

/* 拖尾效果 */
.trail {
    position: absolute;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,200,100,0.6) 0%, transparent 70%);
    pointer-events: none;
    animation: fadeOut 0.5s ease-out forwards;
}

@keyframes fadeOut {
    0% { opacity: 0.8; transform: scale(1); }
    100% { opacity: 0; transform: scale(1.5); }
}

.thinking-dots::after {
    content: '';
    animation: dots 1.5s infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* 联机模式样式 */
.online-panel {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #c9a65a;
}

.online-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.btn-online {
    background: linear-gradient(145deg, #4CAF50, #45a049);
    color: white;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: bold;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(76, 175, 80, 0.3);
    height: 36px;
    line-height: 1.2;
}

.btn-online:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.4);
}

.btn-online:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-donate {
    background: linear-gradient(145deg, #ff6b6b, #ee5a5a);
    box-shadow: 0 3px 10px rgba(255, 107, 107, 0.3);
}

.btn-donate:hover {
    box-shadow: 0 5px 15px rgba(255, 107, 107, 0.4);
}

/* 打赏模态窗口 */
.donate-content {
    text-align: center;
    padding: 20px;
}

.donate-qrcode {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.donate-item {
    text-align: center;
}

.donate-item img {
    width: 180px;
    height: 180px;
    border-radius: 10px;
    border: 2px solid #ddd;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.donate-item p {
    margin-top: 10px;
    font-weight: bold;
    color: #3b2a1f;
}

.donate-tip {
    background: #fff8e8;
    border-radius: 10px;
    padding: 12px 16px;
    margin-top: 15px;
    color: #5a4030;
    font-size: 0.9rem;
    line-height: 1.5;
}

.donate-placeholder {
    width: 180px;
    height: 180px;
    border-radius: 10px;
    border: 2px dashed #ccc;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f9f9f9;
    color: #999;
    font-size: 0.85rem;
}

/* 背景音乐控制 */
.music-control {
    background: rgba(139, 90, 43, 0.08);
    border-radius: 10px;
    padding: 10px;
}

.music-title {
    font-weight: bold;
    font-size: 0.9rem;
    color: #3b2a1f;
    margin-bottom: 8px;
    padding-bottom: 5px;
    border-bottom: 1px solid rgba(139, 90, 43, 0.3);
}

.music-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
}

.music-row label {
    min-width: 60px;
    font-size: 0.9rem;
    color: #3b2a1f;
}

.music-row input[type="range"] {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: #d9b56a;
    outline: none;
    -webkit-appearance: none;
}

.music-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: linear-gradient(145deg, #8b5a2b, #6b4423);
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.music-row input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: linear-gradient(145deg, #8b5a2b, #6b4423);
    cursor: pointer;
    border: none;
}

.progress-container {
    flex: 1;
    display: flex;
    align-items: center;
}

.progress-container input[type="range"] {
    width: 100%;
}

.volume-value {
    min-width: 40px;
    text-align: right;
    font-size: 0.85rem;
    color: #5a4030;
}

/* 确认模态窗口 */
.confirm-content, .alert-content {
    padding: 20px;
}

.confirm-content p, .alert-content p {
    margin: 0 0 20px 0;
    font-size: 1rem;
    color: #333;
}

.confirm-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.btn-cancel-action {
    flex: 1;
    padding: 12px 20px;
    background: #f5f5f5;
    color: #333;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-cancel-action:hover {
    background: #eee;
    border-color: #ccc;
}

.btn-confirm-action {
    flex: 1;
    padding: 12px 20px;
    background: linear-gradient(145deg, #4CAF50, #45a049);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-confirm-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 3px 10px rgba(76, 175, 80, 0.3);
}

/* 房间码显示 */
.room-code-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.room-code {
    font-size: 2rem;
    font-weight: bold;
    letter-spacing: 8px;
    color: #4CAF50;
    background: #f5f5f5;
    padding: 10px 20px;
    border-radius: 10px;
    border: 2px dashed #4CAF50;
}

/* 分享链接区域 */
.share-link-section {
    margin: 15px 0;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 10px;
}

.share-link-label {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 10px;
}

.share-link-box {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.share-link-box input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.85rem;
    background: #fff;
    color: #333;
}

.share-btn {
    width: 100%;
    padding: 10px;
    background: linear-gradient(145deg, #FF9800, #F57C00);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.share-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 3px 10px rgba(255, 152, 0, 0.3);
}

/* 二维码区域 */
.qrcode-section {
    margin: 15px 0;
    padding: 15px;
    background: #fff;
    border-radius: 10px;
    display: inline-block;
}

.qrcode-label {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 10px;
}

.qrcode-container {
    display: flex;
    justify-content: center;
    padding: 10px;
    background: #fff;
}

.qrcode-container canvas {
    border-radius: 8px;
}

.share-tips {
    color: #666;
    margin: 10px 0;
}

.copy-btn {
    background: #2196F3;
    color: white;
    padding: 8px 16px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
}

.copy-btn:hover {
    background: #1976D2;
}

.share-tips {
    color: #666;
    margin: 10px 0;
}

/* 加载动画 */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #4CAF50;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* LLM测试进度条样式 */
.progress-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #e0e0e0;
    border-top: 5px solid #2196F3;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 20px auto 10px;
}

.progress-bar-container {
    width: 100%;
    height: 20px;
    background: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    margin: 15px 0 10px;
}

.progress-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #2196F3, #4CAF50);
    border-radius: 10px;
    transition: width 0.3s ease;
    animation: progressPulse 1.5s ease-in-out infinite;
}

@keyframes progressPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.progress-text {
    font-size: 1.1rem;
    color: #333;
    margin: 10px 0 5px;
    font-weight: bold;
}

.progress-detail {
    font-size: 0.9rem;
    color: #666;
    margin: 5px 0;
}

.llm-test-content {
    padding: 20px;
}

.cancel-btn {
    background: #f44336;
    color: white;
    padding: 10px 30px;
    border-radius: 20px;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    margin-top: 10px;
}

.cancel-btn:hover {
    background: #d32f2f;
}

/* 联机状态指示 */
.online-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #4CAF50;
    color: white;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: bold;
    height: 36px;
    line-height: 1.2;
    box-shadow: 0 3px 10px rgba(76, 175, 80, 0.3);
}

.online-dot {
    width: 8px;
    height: 8px;
    background: #fff;
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* 创建/加入房间模态窗口样式 */
.create-room-content, .join-room-content {
    padding: 20px;
}

.side-select, .nickname-input, .room-code-input {
    margin-bottom: 20px;
    text-align: left;
}

.side-select label, .nickname-input label, .room-code-input label {
    display: block;
    margin-bottom: 10px;
    font-weight: bold;
    color: #3b2a1f;
}

.side-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.side-btn {
    flex: 1;
    padding: 15px 20px;
    border: 2px solid #ddd;
    border-radius: 15px;
    background: #f5f5f5;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.side-btn:hover {
    border-color: #4CAF50;
}

.side-btn.active {
    border-color: #4CAF50;
    background: #e8f5e9;
    color: #2e7d32;
}

.nickname-input input, .room-code-input input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 1rem;
    box-sizing: border-box;
}

.nickname-input input:focus, .room-code-input input:focus {
    outline: none;
    border-color: #4CAF50;
}

/* 自定义棋局选项样式 */
.custom-board-option {
    margin-bottom: 20px;
    padding: 12px 15px;
    background: #f5f5f5;
    border-radius: 10px;
    text-align: left;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 1rem;
    color: #3b2a1f;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.btn-confirm {
    width: 100%;
    padding: 15px;
    background: linear-gradient(145deg, #4CAF50, #45a049);
    color: white;
    border: none;
    border-radius: 15px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-confirm:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.4);
}

.hidden { display: none !important; }

/* 右侧面板切换按钮 */
.toggle-panel-btn {
    position: absolute;
    right: -12px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 48px;
    background: linear-gradient(145deg, #c9a55a, #b8944a);
    color: #5a4030;
    border: 2px solid #a07830;
    border-left: none;
    border-radius: 0 12px 12px 0;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 2px 2px 6px rgba(0,0,0,0.2);
    z-index: 100;
    transition: all 0.2s ease;
    padding: 0;
}

.toggle-panel-btn:hover {
    background: linear-gradient(145deg, #dbb86a, #c9a55a);
    box-shadow: 2px 2px 8px rgba(0,0,0,0.3);
}

.toggle-panel-btn:active {
    transform: translateY(-50%) scale(0.92);
}

.toggle-panel-btn::after {
    content: '›';
    font-size: 1.1rem;
    font-weight: bold;
    transition: transform 0.2s ease;
}

.toggle-panel-btn.collapsed::after {
    content: '‹';
}

.chessboard-wrapper {
    position: relative;
    display: inline-block;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    border-radius: 8px;
}

.right-panel.collapsed {
    display: none !important;
}

.game-container.panel-collapsed {
    justify-content: center;
}

/* 思考内容弹出框样式 */
.thinking-content {
    background: #fff !important;
    color: #333;
}

/* 测试连接弹窗棋盘样式 */
.test-board-container {
    margin-bottom: 15px;
    padding: 10px;
    background: linear-gradient(135deg, #e8d5b7 0%, #d4b896 100%);
    border-radius: 8px;
    border: 2px solid #8b5a2b;
}

.test-board {
    display: flex;
    flex-direction: column;
    gap: 1px;
    background: #8b5a2b;
    border: 2px solid #8b5a2b;
}

.test-board-header {
    display: flex;
    background: #c9a55a;
}

.test-board-row {
    display: flex;
    gap: 1px;
    background: #8b5a2b;
}

.test-cell {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5e6c8;
    font-family: "SimSun", serif;
    font-size: 18px;
    font-weight: bold;
}

.test-header-cell {
    background: #c9a55a;
    font-size: 12px;
    color: #5a3a1a;
}

.test-row-cell {
    background: #c9a55a;
    font-size: 12px;
    color: #5a3a1a;
}

.test-cell.piece-red {
    color: #d32f2f;
    text-shadow: 1px 1px 1px rgba(0,0,0,0.3);
}

.test-cell.piece-black {
    color: #1a1a1a;
    text-shadow: 1px 1px 1px rgba(0,0,0,0.3);
}

/* 测试连接弹窗提示词样式 */
.thinking-prompt {
    white-space: pre;
    font-family: "SimSun", "Songti SC", "Noto Serif SC", serif;
    font-size: 13px;
    line-height: 1.3;
    color: #333;
    background: #f5f5f5;
    padding: 12px;
    border-radius: 5px;
    margin-bottom: 15px;
    overflow-x: auto;
}

/* 测试连接弹窗滚动条样式 */
.thinking-content::-webkit-scrollbar {
    width: 8px;
}

.thinking-content::-webkit-scrollbar-track {
    background: rgba(139, 90, 43, 0.2);
    border-radius: 4px;
}

.thinking-content::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #c9a55a, #a07830);
    border-radius: 4px;
    border: 1px solid #8b5a2b;
}

.thinking-content::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #dbb86a, #b8944a);
}

.thinking-section {
    margin-bottom: 10px;
}

.thinking-toggle {
    cursor: pointer;
    padding: 8px 12px;
    background: #f5f5f5;
    border-radius: 5px;
    font-weight: bold;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

.thinking-toggle:hover {
    background: #eee;
}

.toggle-icon {
    font-size: 12px;
    color: #666;
}

.thinking-reasoning {
    padding: 10px;
    color: #666;
    font-size: 13px;
    line-height: 1.6;
    border-left: 3px solid #ddd;
    margin-top: 5px;
    max-height: 300px;
    overflow-y: auto;
}

.thinking-conclusion {
    padding: 10px;
    color: #333;
    font-size: 14px;
    line-height: 1.6;
    background: #f9f9f9;
    border-radius: 5px;
    margin-top: 10px;
}

/* 移动端优化 */
@media screen and (max-width: 900px) {
    body {
        position: relative;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        align-items: flex-start;
        background: linear-gradient(145deg, #2a6b5e 0%, #1d4e44 100%);
    }

    .game-container {
        -webkit-flex-direction: column;
        flex-direction: column;
        gap: 15px;
        padding: 12px;
        border-radius: 20px;
        max-width: 100%;
        max-height: none;
        box-sizing: border-box;
        overflow: visible;
        background: #e8bc7e;
        margin: 10px;
    }

    .left-panel {
        width: 100%;
        display: -webkit-flex;
        display: flex;
        -webkit-justify-content: center;
        justify-content: center;
        flex-shrink: 0;
        position: sticky;
        top: 10px;
        z-index: 10;
    }

    .chessboard-wrapper {
        width: 100%;
        max-width: calc(100vw - 44px);
    }

    .chessboard-wrapper canvas {
        width: 100% !important;
        height: auto !important;
        max-width: calc(100vw - 44px);
    }

    .right-panel {
        min-width: 100%;
        max-width: 100%;
        min-height: auto;
        width: 100%;
        max-height: 60vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* 隐藏面板切换按钮 */
    .toggle-panel-btn {
        display: none !important;
    }
}

@media screen and (max-width: 700px) {
    body {
        padding: 8px;
        padding-top: max(8px, env(safe-area-inset-top));
        padding-bottom: max(8px, env(safe-area-inset-bottom));
        min-height: auto;
        -webkit-align-items: flex-start;
        align-items: flex-start;
    }

    .game-container {
        padding: 10px;
        border-radius: 16px;
        gap: 12px;
    }

    /* 控制面板 */
    .control-panel {
        padding: 12px;
    }

    .mode-select {
        -webkit-flex-wrap: wrap;
        flex-wrap: wrap;
        gap: 6px;
    }

    .mode-select select {
        -webkit-flex: 1 1 calc(50% - 20px);
        flex: 1 1 calc(50% - 20px);
        min-width: 120px;
        padding: 8px 10px;
        font-size: 0.8rem;
    }

    .mode-select span {
        width: 100%;
        text-align: center;
        order: -1;
        margin-bottom: 4px;
    }

    .mode-select button {
        width: 100%;
        margin-top: 6px;
    }

    /* AI级别选择 */
    #aiLevelContainer {
        flex-direction: column;
        gap: 8px;
    }

    #aiLevelContainer > div {
        width: 100%;
        justify-content: space-between;
    }

    #aiLevelContainer label {
        font-size: 0.8rem;
    }

    #aiLevelContainer select {
        max-width: 120px;
    }

    /* 状态提示 */
    .status {
        font-size: 0.8rem;
        padding: 8px 12px;
    }

    /* 按钮组 */
    .top-buttons {
        flex-wrap: wrap;
        gap: 6px;
    }

    .top-buttons button {
        flex: 1 1 calc(50% - 3px);
        min-width: 80px;
        padding: 8px 10px;
        font-size: 0.8rem;
    }

    /* 自定义棋局按钮 */
    .custom-game-row {
        margin-top: 8px;
    }

    /* 联机按钮 */
    .online-panel {
        margin-top: 10px;
        padding-top: 10px;
    }

    .online-buttons {
        flex-wrap: wrap;
        gap: 6px;
    }

    .online-buttons button {
        flex: 1 1 calc(50% - 3px);
        min-width: 100px;
    }

    /* 信息面板 */
    .info-panel {
        flex-direction: column;
        gap: 8px;
        padding: 10px 15px;
        border-radius: 20px;
    }

    .turn-indicator {
        font-size: 0.9rem;
        padding: 6px 12px;
    }

    .turn-icon {
        font-size: 1.2rem;
    }

    .ai-thought {
        font-size: 0.85rem;
        padding: 6px 12px;
        width: 100%;
    }

    /* 历史记录面板 */
    .history-panel {
        max-height: 200px;
    }

    .history-title {
        font-size: 0.9rem;
        margin-bottom: 8px;
    }

    .history-item {
        font-size: 0.8rem;
        padding: 4px 8px;
    }

    /* 模态窗口适配 */
    .modal-content {
        padding: 15px;
        width: 95%;
        max-width: 95%;
        margin: 10px;
        border-radius: 16px;
    }

    .config-modal-content {
        max-width: 95%;
        max-height: 90vh;
    }

    .config-scrollable {
        max-height: calc(90vh - 120px);
    }

    .modal-header {
        margin-bottom: 15px;
        padding-bottom: 10px;
    }

    .modal-title {
        font-size: 1rem;
    }

    .modal-close {
        width: 28px;
        height: 28px;
        font-size: 1.2rem;
    }

    /* 配置行容器 */
    .config-row-container {
        flex-direction: column;
        gap: 10px;
    }

    .config-row {
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
    }

    .config-row label {
        min-width: auto;
        font-size: 0.85rem;
    }

    .config-row input, .config-row select {
        font-size: 0.85rem;
        padding: 8px 10px;
    }

    .llm-config-section {
        padding: 8px;
    }

    .config-section-title {
        font-size: 0.85rem;
    }

    /* 音乐控制 */
    .music-control {
        padding: 8px;
    }

    .music-title {
        font-size: 0.85rem;
    }

    .music-row {
        flex-wrap: wrap;
        gap: 6px;
    }

    .music-row label {
        min-width: 50px;
        font-size: 0.8rem;
    }

    .volume-value {
        font-size: 0.75rem;
    }

    /* 棋子皮肤 */
    .piece-skin-section {
        padding: 8px;
    }

    .piece-skin-title {
        font-size: 0.85rem;
    }

    .piece-skin-options {
        flex-wrap: wrap;
    }

    .piece-skin-option {
        flex: 1 1 calc(33% - 8px);
        max-width: none;
        padding: 6px;
    }

    .skin-preview {
        width: 60px;
        height: 32px;
    }

    .skin-piece {
        width: 24px;
        height: 24px;
        font-size: 12px;
    }

    .skin-name {
        font-size: 0.75rem;
    }

    /* 自定义棋局模态窗口 */
    .custom-board-modal-content {
        max-width: 95%;
        max-height: 90vh;
    }

    .custom-board-content {
        flex-direction: column;
        gap: 15px;
    }

    .piece-selector-section {
        min-width: auto;
    }

    .piece-selector-title {
        font-size: 0.9rem;
    }

    .piece-btn {
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
    }

    .editor-hint {
        font-size: 0.7rem;
    }

    #customBoardCanvas {
        max-width: 100%;
        height: auto !important;
    }

    .first-move-section {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .first-move-options {
        width: 100%;
        justify-content: space-around;
    }

    .custom-board-footer {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }

    .footer-info {
        text-align: center;
    }

    .footer-buttons {
        justify-content: center;
    }

    .footer-buttons button {
        flex: 1;
    }

    /* 打赏模态窗口 */
    .donate-qrcode {
        flex-direction: column;
        align-items: center;
        gap: 20px;
    }

    .donate-item img {
        width: 150px;
        height: 150px;
    }

    /* 房间码显示 */
    .room-code {
        font-size: 1.5rem;
        letter-spacing: 4px;
        padding: 8px 15px;
    }

    .room-code-display {
        flex-direction: column;
        gap: 8px;
    }

    /* 分享链接 */
    .share-link-box {
        flex-direction: column;
        gap: 6px;
    }

    .share-link-box input {
        font-size: 0.75rem;
    }

    /* 二维码 */
    .qrcode-section {
        padding: 10px;
    }

    /* 确认/取消按钮 */
    .confirm-buttons {
        flex-direction: column;
        gap: 10px;
    }

    .btn-cancel-action, .btn-confirm-action {
        padding: 10px 15px;
        font-size: 0.9rem;
    }

    .btn-confirm {
        padding: 12px;
        font-size: 1rem;
    }

    /* 侧选择按钮 */
    .side-buttons {
        flex-direction: column;
        gap: 10px;
    }

    .side-btn {
        padding: 12px 15px;
    }

    /* 输入框 */
    .nickname-input input, .room-code-input input {
        padding: 10px 12px;
        font-size: 0.9rem;
    }

    /* 进度条 */
    .progress-bar-container {
        height: 16px;
    }

    .progress-text {
        font-size: 1rem;
    }

    .progress-detail {
        font-size: 0.85rem;
    }
}

@media (max-width: 400px) {
    body {
        padding: 4px;
    }

    .game-container {
        padding: 8px;
        border-radius: 12px;
        gap: 10px;
    }

    .control-panel {
        padding: 10px;
    }

    .mode-select select {
        flex: 1 1 100%;
        min-width: auto;
    }

    .mode-select span {
        font-size: 0.85rem;
    }

    .top-buttons button {
        flex: 1 1 100%;
    }

    .online-buttons button {
        flex: 1 1 100%;
    }

    .info-panel {
        padding: 8px 12px;
    }

    .turn-indicator {
        font-size: 0.85rem;
        padding: 5px 10px;
    }

    .ai-thought {
        font-size: 0.75rem;
    }

    .status {
        font-size: 0.75rem;
        padding: 6px 10px;
    }

    .history-panel {
        max-height: 150px;
    }

    .modal-content {
        padding: 12px;
        border-radius: 12px;
    }

    .piece-skin-option {
        flex: 1 1 100%;
    }
}

/* 访客模式样式 */
.visitor-status {
    background: linear-gradient(145deg, #9c27b0, #7b1fa2);
    box-shadow: 0 3px 10px rgba(156, 39, 176, 0.3);
}

.visitor-dot {
    font-size: 14px;
    animation: none;
}

.visitor-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(156, 39, 176, 0.1);
    color: #9c27b0;
    padding: 6px 14px;
    border-radius: 15px;
    font-size: 0.85rem;
    margin-top: 8px;
}

.visitor-record {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: linear-gradient(135deg, #f3e5f5 0%, #e1bee7 100%);
    border-left: 3px solid #9c27b0;
    border-radius: 0 8px 8px 0;
    margin: 5px 0;
    font-size: 0.85rem;
    color: #6a1b9a;
}

.visitor-icon {
    font-size: 16px;
}

.visitor-message {
    flex: 1;
}

/* 棋子换肤样式 */
.piece-skin-section {
    background: rgba(139, 90, 43, 0.08);
    border-radius: 10px;
    padding: 10px;
    margin-top: 10px;
}

.piece-skin-title {
    font-weight: bold;
    font-size: 0.9rem;
    color: #3b2a1f;
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid rgba(139, 90, 43, 0.3);
}

.piece-skin-options {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.piece-skin-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 8px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    background: rgba(255, 255, 255, 0.3);
    flex: 1;
    max-width: 100px;
}

.piece-skin-option:hover {
    background: rgba(255, 255, 255, 0.5);
    border-color: rgba(139, 90, 43, 0.3);
}

.piece-skin-option.active {
    background: rgba(255, 207, 122, 0.5);
    border-color: #8b5a2b;
}

.skin-preview {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
    padding: 5px;
    background: #f7e9c3;
    border-radius: 6px;
    width: 80px;
    height: 40px;
}

.skin-piece {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    font-family: "KaiTi", "STKaiti", "楷体", "SimSun", serif;
}

/* 经典皮肤预览 */
.skin-default .skin-piece.red {
    background: linear-gradient(145deg, #ff5a4a, #b8241a);
    color: #fffef0;
    border: 2px solid #d4af37;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.skin-default .skin-piece.black {
    background: linear-gradient(145deg, #787878, #2a2a2a);
    color: #f5f5f5;
    border: 2px solid #d4af37;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

/* 木质皮肤预览 */
.skin-wood .skin-piece.red {
    background: linear-gradient(145deg, #e8a87c, #b8744a);
    color: #8b0000;
    border: 2px solid #8b5a2b;
    box-shadow: inset 0 -2px 4px rgba(0,0,0,0.2);
}

.skin-wood .skin-piece.black {
    background: linear-gradient(145deg, #8b7355, #4a3728);
    color: #f5f5dc;
    border: 2px solid #5a4030;
    box-shadow: inset 0 -2px 4px rgba(0,0,0,0.2);
}

/* 玉石皮肤预览 */
.skin-jade .skin-piece.red {
    background: linear-gradient(145deg, #ff9a9a, #e05050);
    color: #fff;
    border: 2px solid #ffd700;
    box-shadow: 0 0 8px rgba(255, 100, 100, 0.3);
}

.skin-jade .skin-piece.black {
    background: linear-gradient(145deg, #a0d8a0, #60a860);
    color: #fff;
    border: 2px solid #c0c0c0;
    box-shadow: 0 0 8px rgba(100, 200, 100, 0.3);
}

.skin-name {
    font-size: 0.8rem;
    color: #5a4030;
    font-weight: bold;
}

/* 走动动画预览样式 */
.anim-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 30px;
    background: #f7e9c3;
    border-radius: 4px;
}

.anim-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #8b5a2b;
}

.anim-line {
    width: 40px;
    height: 3px;
    background: linear-gradient(90deg, #8b5a2b 0%, #8b5a2b 30%, transparent 30%, transparent 40%, #8b5a2b 40%, #8b5a2b 70%, transparent 70%);
    border-radius: 2px;
}

.anim-arc {
    width: 40px;
    height: 20px;
    border: none;
    background: transparent;
    position: relative;
}

.anim-arc::before {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #8b5a2b;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    animation: arcMove 1s ease-in-out infinite;
}

.anim-arc::after {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #8b5a2b;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.3;
}

@keyframes arcMove {
    0% { left: 0; top: 50%; }
    50% { left: 50%; top: 10%; }
    100% { left: 100%; top: 50%; }
}

.anim-bounce {
    width: 40px;
    height: 20px;
    position: relative;
}

.anim-bounce::before {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #8b5a2b;
    left: 0;
    top: 50%;
    animation: bounceMove 1s ease-in-out infinite;
}

.anim-bounce::after {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #8b5a2b;
    right: 0;
    top: 50%;
    opacity: 0.3;
}

@keyframes bounceMove {
    0%, 100% { transform: translateY(0); }
    25% { transform: translateY(-10px); }
    50% { transform: translateY(0); }
    75% { transform: translateY(-5px); }
}

/* 动画棋子覆盖层 */
.anim-piece {
    position: absolute;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: "KaiTi", "STKaiti", "楷体", "SimSun", serif;
    font-weight: bold;
    pointer-events: none;
    z-index: 100;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

/* 自定义棋局编辑器样式 */
.custom-board-modal-content {
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
}

.custom-board-content {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
}

.piece-selector-section {
    flex: 1;
    min-width: 200px;
}

.piece-selector-title {
    font-weight: bold;
    font-size: 0.95rem;
    color: #3b2a1f;
    margin-bottom: 10px;
}

.piece-selector-groups {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.piece-group-container {
    background: rgba(139, 90, 43, 0.1);
    border-radius: 10px;
    padding: 10px;
}

.piece-group-label {
    font-weight: bold;
    font-size: 0.85rem;
    margin-bottom: 8px;
}

.piece-group-label.red {
    color: #c62828;
}

.piece-group-label.black {
    color: #333;
}

.piece-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.piece-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid;
    font-size: 0.85rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.piece-btn.red {
    background: linear-gradient(135deg, #ff6b6b, #ee5a5a);
    border-color: #c62828;
    color: white;
}

.piece-btn.black {
    background: linear-gradient(135deg, #616161, #424242);
    border-color: #212121;
    color: white;
}

.piece-btn:hover {
    transform: scale(1.1);
}

.piece-btn.selected {
    box-shadow: 0 0 0 3px #ffd700;
    transform: scale(1.15);
}

.editor-hint {
    margin-top: 10px;
    font-size: 0.75rem;
    color: #666;
    line-height: 1.4;
}

.editor-hint span {
    font-weight: bold;
    color: #8b5a2b;
}

.preview-board-section {
    flex: 1;
}

.preview-board-title {
    font-weight: bold;
    font-size: 0.95rem;
    color: #3b2a1f;
    margin-bottom: 10px;
}

#customBoardCanvas {
    background: #f7e9c3;
    border-radius: 6px;
    box-shadow: inset 0 0 0 2px #f9e0a0, 0 0 0 3px #b97f3a;
    cursor: pointer;
}

.first-move-section {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 15px;
    background: rgba(139, 90, 43, 0.1);
    border-radius: 10px;
    margin-bottom: 15px;
}

.first-move-label {
    font-weight: bold;
    font-size: 0.9rem;
    color: #3b2a1f;
}

.first-move-options {
    display: flex;
    gap: 15px;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    font-size: 0.9rem;
}

.radio-option input {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.custom-board-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 10px;
    border-top: 2px solid #c9a55a;
}

.footer-info {
    font-size: 0.85rem;
    color: #666;
}

.footer-buttons {
    display: flex;
    gap: 10px;
}

.footer-buttons button {
    padding: 8px 16px;
    border-radius: 15px;
    font-size: 0.9rem;
    font-weight: bold;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.custom-game-row {
    display: flex;
    justify-content: center;
    margin-top: 5px;
}

.action-btn.custom-btn {
    background: linear-gradient(135deg, #00b894, #00a884);
    width: 100%;
}

.action-btn.custom-btn:hover {
    background: linear-gradient(135deg, #00c9a7, #00b090);
}

/* 微信浏览器特殊适配 */
.wechat-browser body {
    position: relative !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
}

.wechat-browser .game-container {
    -webkit-overflow-scrolling: touch;
}

.wechat-browser .history-list {
    -webkit-overflow-scrolling: touch;
}

.wechat-browser .modal-content {
    -webkit-overflow-scrolling: touch;
}

/* 微信浏览器输入框优化 */
.wechat-browser input,
.wechat-browser select,
.wechat-browser textarea {
    font-size: 16px !important; /* 防止iOS自动缩放 */
}

/* 微信浏览器触摸反馈 */
.wechat-browser button:active,
.wechat-browser select:active {
    opacity: 0.8;
    -webkit-transform: scale(0.98);
    transform: scale(0.98);
}

/* ========== 残局库样式 ========== */

/* 残局库快捷入口 */
.endgame-quick-access {
    display: flex;
    gap: 10px;
    padding: 10px 0;
    border-top: 1px solid #c9a55a;
    margin-top: 10px;
}

.btn-endgame-library,
.btn-random-endgame {
    flex: 1;
    padding: 10px 15px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-endgame-library {
    background: linear-gradient(135deg, #6c5ce7, #a29bfe);
    color: white;
}

.btn-endgame-library:hover {
    background: linear-gradient(135deg, #7d6ff0, #b3adff);
    transform: translateY(-1px);
}

.btn-random-endgame {
    background: linear-gradient(135deg, #fdcb6e, #f9ca24);
    color: #2d3436;
}

.btn-random-endgame:hover {
    background: linear-gradient(135deg, #fed579, #fad346);
    transform: translateY(-1px);
}

/* 当前加载的残局信息 */
.endgame-info {
    padding: 10px;
    margin-top: 10px;
    background: linear-gradient(135deg, #74b9ff, #0984e3);
    border-radius: 8px;
    color: white;
}

.endgame-info.hidden {
    display: none;
}

.endgame-loaded-info {
    font-size: 14px;
}

.endgame-loaded-info strong {
    font-size: 16px;
    display: block;
    margin-bottom: 5px;
}

.endgame-loaded-info .difficulty {
    color: #ffeaa7;
    font-size: 12px;
}

.endgame-loaded-info p {
    margin: 5px 0 0 0;
    font-size: 13px;
    opacity: 0.9;
}

/* 残局库模态窗口 */
.endgame-library-modal-content {
    max-width: 600px;
    max-height: 80vh;
}

.endgame-library-content {
    display: flex;
    flex-direction: column;
    max-height: 65vh;
}

/* 筛选栏 */
.endgame-filter-bar {
    display: flex;
    gap: 10px;
    padding: 15px;
    background: #f5f5f5;
    border-radius: 8px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.endgame-filter-bar select,
.endgame-filter-bar input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
}

.endgame-filter-bar select {
    min-width: 100px;
}

.endgame-filter-bar input {
    flex: 1;
    min-width: 150px;
}

/* 残局列表 */
.endgame-list {
    flex: 1;
    overflow-y: auto;
    padding-right: 5px;
}

.endgame-item {
    display: flex;
    align-items: center;
    padding: 15px;
    background: white;
    border-radius: 10px;
    margin-bottom: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: all 0.2s;
    cursor: pointer;
}

.endgame-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.endgame-item-icon {
    font-size: 28px;
    margin-right: 15px;
}

.endgame-item-content {
    flex: 1;
}

.endgame-item-name {
    font-size: 16px;
    font-weight: 600;
    color: #2d3436;
    margin-bottom: 3px;
}

.endgame-item-meta {
    display: flex;
    gap: 10px;
    font-size: 12px;
    color: #636e72;
    margin-bottom: 5px;
}

.endgame-item-difficulty {
    color: #fdcb6e;
}

.endgame-item-type {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.endgame-item-type.kill {
    background: #ff7675;
    color: white;
}

.endgame-item-type.draw {
    background: #74b9ff;
    color: white;
}

.endgame-item-type.pattern {
    background: #a29bfe;
    color: white;
}

.endgame-item-type.fun {
    background: #55efc4;
    color: #2d3436;
}

.endgame-item-desc {
    font-size: 13px;
    color: #636e72;
    margin-bottom: 5px;
}

.endgame-item-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.endgame-tag {
    padding: 2px 8px;
    background: #dfe6e9;
    border-radius: 4px;
    font-size: 11px;
    color: #636e72;
}

.endgame-item-stats {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    min-width: 80px;
}

.endgame-item-rate {
    font-size: 14px;
    font-weight: 600;
    color: #00b894;
}

.endgame-item-plays {
    font-size: 11px;
    color: #b2bec3;
}

.endgame-load-btn {
    padding: 8px 16px;
    background: linear-gradient(135deg, #00b894, #00a884);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 5px;
}

.endgame-load-btn:hover {
    background: linear-gradient(135deg, #00c9a7, #00b090);
}

/* 分页 */
.endgame-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    padding: 15px;
    border-top: 1px solid #eee;
}

.endgame-pagination button {
    padding: 8px 16px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.endgame-pagination button:hover:not(:disabled) {
    background: #00b894;
    color: white;
    border-color: #00b894;
}

.endgame-pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.endgame-pagination span {
    font-size: 14px;
    color: #636e72;
}

/* 空状态 */
.endgame-empty {
    text-align: center;
    padding: 40px;
    color: #b2bec3;
}

.endgame-empty-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

/* 加载状态 */
.endgame-loading {
    text-align: center;
    padding: 40px;
    color: #636e72;
}

.endgame-loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #dfe6e9;
    border-top-color: #00b894;
    border-radius: 50%;
    animation: endgame-spin 1s linear infinite;
    margin-left: 10px;
    vertical-align: middle;
}

@keyframes endgame-spin {
    to { transform: rotate(360deg); }
}
