/* style.css - 中国象棋 手机优先 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: #1a1a2e;
    color: #eee;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 8px;
}

/* Header - Status Bar */
#status-bar {
    width: 100%;
    max-width: 500px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 4px;
    margin-bottom: 4px;
    font-size: 14px;
}

#status-text {
    font-weight: 600;
    font-size: 15px;
    color: #f0d060;
}

#turn-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
}

.turn-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.turn-dot.red {
    background: #e74c3c;
    box-shadow: 0 0 6px #e74c3c;
}

.turn-dot.black {
    background: #2c3e50;
    border: 1px solid #888;
    box-shadow: 0 0 6px rgba(136,136,136,0.5);
}

/* AI Reasoning Display */
#ai-reasoning {
    width: 100%;
    max-width: 500px;
    flex-direction: column;
    align-items: flex-start;
    padding: 6px 8px;
    margin-bottom: 2px;
    background: rgba(240, 208, 96, 0.08);
    border-radius: 6px;
    border-left: 3px solid #f0d060;
}

#ai-source {
    font-size: 11px;
    color: #f0d060;
    font-weight: 600;
    margin-bottom: 2px;
}

#ai-reason-text {
    font-size: 12px;
    color: #ccc;
    line-height: 1.4;
}

#fallback-warning {
    width: 100%;
    max-width: 500px;
    padding: 6px 8px;
    margin-bottom: 2px;
    font-size: 11px;
    color: #e67e22;
    background: rgba(230, 126, 34, 0.1);
    border-radius: 6px;
    border-left: 3px solid #e67e22;
}

/* AI Thinking */
#ai-thinking {
    display: none;
    align-items: center;
    gap: 8px;
    color: #f0d060;
    font-size: 13px;
    font-weight: 500;
}

#ai-thinking.show {
    display: flex;
}

.thinking-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(240, 208, 96, 0.3);
    border-top-color: #f0d060;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Board Container */
#board-container {
    position: relative;
    width: 100%;
    max-width: 500px;
    aspect-ratio: 9 / 10;
    margin: 4px auto;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

#chess-board {
    display: block;
    width: 100%;
    height: 100%;
    background: #d4a85c;
    cursor: pointer;
}

/* Controls - New Game & Undo */
#controls {
    width: 100%;
    max-width: 500px;
    display: flex;
    gap: 10px;
    justify-content: center;
    padding: 8px 0;
    flex-wrap: wrap;
}

.btn {
    padding: 10px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    touch-action: manipulation;
}

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

.btn-new {
    background: #e74c3c;
    color: white;
}

.btn-undo {
    background: #3498db;
    color: white;
}

.btn-new:hover {
    background: #c0392b;
}

.btn-undo:hover {
    background: #2980b9;
}

/* Game Over Overlay */
#game-over-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 100;
    align-items: center;
    justify-content: center;
}

#game-over-overlay.show {
    display: flex;
}

#game-over-box {
    background: #2d2d44;
    border-radius: 16px;
    padding: 30px 40px;
    text-align: center;
    box-shadow: 0 8px 40px rgba(0,0,0,0.6);
    max-width: 85%;
}

#game-over-box h2 {
    font-size: 24px;
    margin-bottom: 8px;
}

#game-over-box .result-text {
    font-size: 18px;
    margin-bottom: 20px;
    color: #ccc;
}

#game-over-box .btn {
    background: #e67e22;
    color: white;
    padding: 12px 36px;
    font-size: 16px;
}

/* Move History (compact) */
#move-history {
    width: 100%;
    max-width: 500px;
    padding: 4px 4px 0;
    font-size: 12px;
    color: #888;
    text-align: center;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* Responsive adjustments */
@media (max-width: 400px) {
    #status-text {
        font-size: 13px;
    }
    #ai-thinking {
        font-size: 11px;
    }
    .btn {
        padding: 8px 16px;
        font-size: 13px;
    }
    #game-over-box h2 {
        font-size: 20px;
    }
}

/* Landscape mode */
@media (max-height: 500px) {
    body {
        flex-direction: row;
        flex-wrap: wrap;
        padding: 4px;
    }
    #board-container {
        max-width: 60vh;
    }
    #status-bar {
        max-width: 60vh;
    }
    #controls {
        max-width: 60vh;
    }
}
