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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    min-height: 100vh;
    color: #fff;
}

.screen { min-height: 100vh; display: flex; flex-direction: column; }
.screen.hidden { display: none !important; }

/* Settings */
.settings-container {
    max-width: 580px; margin: auto; padding: 40px;
    background: rgba(0,0,0,0.3); border-radius: 20px; text-align: center;
}
.settings-container h1 { font-size: 3.5rem; margin-bottom: 10px; text-shadow: 2px 2px 4px rgba(0,0,0,0.5); }
.settings-container h2 { font-size: 2rem; margin-bottom: 35px; font-weight: normal; opacity: 0.9; }

.setting-group { margin-bottom: 28px; }
.setting-group label { display: block; font-size: 1.4rem; margin-bottom: 12px; }
.player-input {
    width: 100%; padding: 14px 18px; font-size: 1.3rem;
    border: 3px solid #fff; border-radius: 10px;
    background: rgba(255,255,255,0.9); color: #2c3e50; text-align: center;
}
.player-input:focus { outline: 4px solid #f39c12; outline-offset: 2px; }

.button-group { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.setting-btn {
    padding: 14px 22px; font-size: 1.15rem;
    border: 3px solid #fff; background: transparent; color: #fff;
    border-radius: 12px; cursor: pointer; transition: all 0.2s;
    min-width: 130px; min-height: 60px;
    display: inline-flex; align-items: center; justify-content: center;
}
.setting-btn:hover { background: rgba(255,255,255,0.2); transform: scale(1.05); }
.setting-btn:focus { outline: 4px solid #f39c12; outline-offset: 2px; }
.setting-btn.active { background: #fff; color: #2c3e50; font-weight: bold; }

.rules-summary {
    background: rgba(255,255,255,0.1); border-radius: 12px;
    padding: 18px 22px; margin: 20px 0; text-align: left;
}
.rules-summary h3 { font-size: 1.3rem; margin-bottom: 10px; }
.rules-summary ul { list-style: none; }
.rules-summary li { font-size: 1.05rem; padding: 5px 0; opacity: 0.9; }
.rules-summary li::before { content: '• '; color: #f39c12; font-weight: bold; }

.primary-btn {
    margin-top: 20px; padding: 20px 50px; font-size: 1.8rem;
    background: #e74c3c; color: #fff; border: none; border-radius: 15px;
    cursor: pointer; font-weight: bold; transition: all 0.2s;
    min-height: 70px; display: block; width: 100%;
}
.primary-btn:hover { background: #c0392b; transform: scale(1.03); box-shadow: 0 5px 20px rgba(231,76,60,0.5); }
.primary-btn:focus { outline: 4px solid #f39c12; outline-offset: 3px; }
.secondary-btn { margin-top: 15px; background: rgba(255,255,255,0.2); border: 3px solid #fff; }
.secondary-btn:hover { background: rgba(255,255,255,0.35); transform: scale(1.03); box-shadow: none; }

/* Header */
.game-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 25px; background: rgba(0,0,0,0.3);
    flex-wrap: wrap; gap: 10px; min-height: 80px;
}
.game-header h1 { font-size: 1.8rem; }
.header-center { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.header-right { display: flex; gap: 12px; flex-wrap: wrap; }

.player-indicator {
    display: flex; align-items: center; gap: 12px;
    background: rgba(255,255,255,0.15); padding: 12px 22px;
    border-radius: 12px; font-size: 1.4rem; font-weight: bold;
    border: 3px solid rgba(255,255,255,0.3); transition: all 0.3s;
}
.player-color-dot {
    width: 28px; height: 28px; border-radius: 50%;
    border: 3px solid rgba(255,255,255,0.6); flex-shrink: 0; transition: all 0.3s;
}
.player-color-dot.white { background: #f5f5f5; border-color: #ccc; }
.player-color-dot.black { background: #1a1a1a; border-color: #fff; }
.turn-label { font-weight: normal; opacity: 0.85; }

.capture-alert {
    background: #e74c3c; color: #fff;
    padding: 6px 18px; border-radius: 8px;
    font-size: 1.2rem; font-weight: bold;
    animation: pulse 0.6s infinite alternate;
}
@keyframes pulse { from { opacity: 1; } to { opacity: 0.65; } }

.action-btn {
    padding: 14px 22px; font-size: 1.1rem;
    background: rgba(255,255,255,0.9); color: #2c3e50;
    border: none; border-radius: 10px; cursor: pointer;
    font-weight: bold; transition: all 0.2s; min-height: 52px;
    text-decoration: none; display: inline-flex; align-items: center; justify-content: center;
}
.action-btn:hover { background: #fff; transform: scale(1.05); }
.action-btn:focus { outline: 4px solid #f39c12; outline-offset: 2px; }

/* Game Area */
.game-area {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 15px; gap: 12px; overflow: auto;
}

/* Player Info */
.player-info {
    display: flex; align-items: center; gap: 14px;
    padding: 10px 18px; background: rgba(0,0,0,0.2);
    border-radius: 12px; width: 100%; max-width: 580px;
    border: 3px solid transparent; transition: all 0.3s; min-height: 56px;
}
.player-info.active {
    border-color: #f39c12; background: rgba(243,156,18,0.2);
    box-shadow: 0 0 15px rgba(243,156,18,0.4);
}
.player-dot {
    width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
}
.white-dot { background: #f5f5f5; border: 3px solid #999; }
.black-dot { background: #1a1a1a; border: 3px solid #fff; }
.player-name-display { font-size: 1.2rem; font-weight: bold; }
.piece-count { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.count-badge {
    background: rgba(255,255,255,0.25); border-radius: 8px;
    padding: 4px 12px; font-size: 1.3rem; font-weight: bold;
    min-width: 48px; text-align: center;
}
.count-label { font-size: 1rem; opacity: 0.8; }

/* Board */
.board-wrapper { display: flex; }
.board {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    border: 4px solid #6d4c1f;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}

.square {
    width: clamp(44px, 6.5vw, 62px);
    height: clamp(44px, 6.5vw, 62px);
    display: flex; align-items: center; justify-content: center;
    cursor: default; position: relative; user-select: none;
}
.square.light { background: #f0d0a0; }
.square.dark  { background: #6d4c1f; cursor: pointer; }
.square.dark:hover { filter: brightness(1.25); }
.square.dark:focus { outline: 4px solid #f39c12; outline-offset: -4px; z-index: 2; }
.square.selected { background: #27ae60 !important; box-shadow: inset 0 0 0 4px #1e8449; }
.square.valid-move { background: #5dade2 !important; }
.square.must-move { box-shadow: inset 0 0 0 4px #e74c3c; }

/* Valid move dot */
.square.valid-move::after {
    content: '';
    position: absolute; width: 35%; height: 35%;
    border-radius: 50%; background: rgba(255,255,255,0.4);
    pointer-events: none;
}

/* Pieces */
.piece {
    width: 80%; height: 80%;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: clamp(16px, 2.5vw, 24px);
    font-weight: bold;
    transition: transform 0.1s;
    position: relative;
    cursor: pointer;
}
.piece-white {
    background: radial-gradient(circle at 35% 35%, #fff, #ddd);
    border: 3px solid #999;
    box-shadow: 0 3px 8px rgba(0,0,0,0.4), inset 0 1px 3px rgba(255,255,255,0.8);
    color: #555;
}
.piece-black {
    background: radial-gradient(circle at 35% 35%, #555, #111);
    border: 3px solid rgba(255,255,255,0.3);
    box-shadow: 0 3px 8px rgba(0,0,0,0.5), inset 0 1px 3px rgba(255,255,255,0.15);
    color: #ddd;
}
.piece.dame::after {
    content: '♛';
    position: absolute;
    font-size: clamp(12px, 1.8vw, 18px);
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    line-height: 1;
}
.piece-white.dame::after { color: #8B6914; }
.piece-black.dame::after { color: #f0c040; }

.square:hover .piece,
.square.selected .piece { transform: scale(1.1); }

/* End Screen */
.result-container {
    max-width: 500px; margin: auto; padding: 60px 40px;
    background: rgba(0,0,0,0.4); border-radius: 20px; text-align: center;
}
.result-container h1 { font-size: 3rem; margin-bottom: 20px; }
.result-container p { font-size: 1.6rem; margin-bottom: 15px; opacity: 0.9; }

/* Responsive */
@media (max-width: 768px) {
    .game-header { justify-content: center; }
    .header-left { display: none; }
    .header-center, .header-right { width: 100%; justify-content: center; }
    .player-indicator { font-size: 1.2rem; padding: 10px 15px; }
}
