/* 基础重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

/* 防止页面滚动和缩放 */
html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    touch-action: none;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

/* 应用容器 */
#app {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

/* 状态栏 */
.status-bar {
    height: 60px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 15px;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.player-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-width: 70px;
    padding: 8px 12px;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.player-info.active {
    background: rgba(102, 126, 234, 0.2);
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.4);
}

.player-info.active .stone-icon {
    transform: scale(1.2);
    filter: drop-shadow(0 0 8px rgba(102, 126, 234, 0.8));
}

.player-info.active .label {
    color: #667eea;
    font-weight: 600;
}

@keyframes glow {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

.player-info .stone-icon {
    font-size: 22px;
    line-height: 1;
}

.player-info.black .stone-icon {
    color: #333;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.player-info.white .stone-icon {
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.player-info .label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
}

.player-info .captures {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.5);
}

.game-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.game-info .move-number {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 600;
}

.game-info .current-player {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
}

.ai-level-badge {
    font-size: 10px;
    padding: 2px 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    color: white;
    margin-top: 2px;
}

/* 棋盘区域 */
.board-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
    position: relative;
}

#go-board {
    max-width: 100%;
    max-height: 100%;
    border-radius: 8px;
    box-shadow: 
        0 10px 40px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.1);
}

/* 控制栏 */
.control-bar {
    height: 70px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 0 15px 15px;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: calc(15px + env(safe-area-inset-bottom));
}

.btn {
    flex: 1;
    max-width: 80px;
    height: 44px;
    margin: 0 5px;
    border: none;
    border-radius: 22px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.4);
}

.btn:disabled {
    background: linear-gradient(135deg, #555 0%, #666 100%);
    box-shadow: none;
    cursor: not-allowed;
    opacity: 0.6;
    transform: none;
}

.btn-primary {
    width: 100%;
    max-width: none;
    height: 50px;
    margin-top: 20px;
    font-size: 16px;
}

/* 消息提示 */
.message-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 15px 25px;
    border-radius: 10px;
    font-size: 14px;
    text-align: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    max-width: 80%;
    white-space: pre-line;
}

.message-toast.show {
    opacity: 1;
}

/* 模态框 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 16px;
    width: 90%;
    max-width: 350px;
    max-height: 80%;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal-overlay.show .modal-content {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header h2 {
    color: white;
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}

.modal-close:hover {
    color: white;
}

.modal-body {
    padding: 20px;
}

/* 菜单项 */
.menu-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 10px;
}

.menu-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(5px);
}

.menu-icon {
    font-size: 20px;
    width: 30px;
    text-align: center;
}

.toggle {
    margin-left: auto;
    padding: 4px 12px;
    background: rgba(102, 126, 234, 0.5);
    border-radius: 12px;
    font-size: 12px;
}

.toggle.on {
    background: #667eea;
}

/* 表单 */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    margin-bottom: 10px;
}

.button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.option-btn {
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: white;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.option-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.option-btn.selected {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: transparent;
}

/* 响应式适配 */
@media (max-width: 375px) {
    .status-bar {
        height: 55px;
        padding: 0 10px;
    }
    
    .player-info .label {
        font-size: 11px;
    }
    
    .player-info .captures {
        font-size: 9px;
    }
    
    .game-info .move-number {
        font-size: 14px;
    }
    
    .btn {
        height: 40px;
        font-size: 13px;
    }

    .player-info {
        min-width: 55px;
    }
}

/* 深色模式优化 */
@media (prefers-color-scheme: dark) {
    #app {
        background: linear-gradient(135deg, #0f0f1a 0%, #0a0f1a 100%);
    }
}

/* 棋子动画 */
@keyframes stonePlace {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* 安全区支持 */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .control-bar {
        padding-bottom: calc(15px + env(safe-area-inset-bottom));
    }
}

/* 大模态框 */
.modal-large {
    max-width: 90%;
    max-height: 90%;
}

/* 帮助内容样式 */
.help-content {
    padding: 15px;
}

.help-content section {
    margin-bottom: 25px;
}

.help-content h3 {
    color: #667eea;
    font-size: 16px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.help-content ul {
    list-style: none;
    padding: 0;
}

.help-content li {
    color: rgba(255, 255, 255, 0.8);
    font-size: 13px;
    line-height: 1.8;
    padding-left: 15px;
    position: relative;
    margin-bottom: 6px;
}

.help-content li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: #667eea;
}

.help-content strong {
    color: white;
    font-weight: 600;
}

.help-content .tips {
    background: rgba(102, 126, 234, 0.1);
    border-radius: 10px;
    padding: 15px;
}

.help-content .tips p {
    color: rgba(255, 255, 255, 0.85);
    font-size: 13px;
    line-height: 1.7;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.help-content .tips p:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

/* 对局结果统计 */
.result-content {
    text-align: center;
    padding: 25px 20px;
}

.result-winner {
    font-size: 28px;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 8px;
    text-shadow: 0 0 20px rgba(102, 126, 234, 0.5);
}

.result-margin {
    font-size: 18px;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 25px;
}

.result-stats {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 25px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-item:last-child {
    border-bottom: none;
}

.stat-label {
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
}

.stat-value {
    color: white;
    font-size: 14px;
    font-weight: 600;
}

.result-buttons {
    display: flex;
    gap: 10px;
}

.result-buttons .btn {
    flex: 1;
    max-width: none;
}
