/* 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);
}
.player-color-dot {
    width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
    border: 3px solid rgba(255,255,255,0.5);
}
.player-color-dot.black { background: #111; border-color: #aaa; }
.player-color-dot.white { background: #f5f5f5; border-color: #bbb; box-shadow: 0 0 6px rgba(0,0,0,0.4); }
.turn-label { font-weight: normal; opacity: 0.85; }
.skip-alert {
    background: #e67e22; color: #fff;
    padding: 6px 18px; border-radius: 8px;
    font-size: 1.1rem; 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 20px; background: rgba(0,0,0,0.2);
    border-radius: 12px; width: 100%; max-width: 560px;
    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);
}
.disc-display {
    width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}
.black-disc { background: radial-gradient(circle at 35% 35%, #555, #111); border: 2px solid rgba(255,255,255,0.2); }
.white-disc { background: radial-gradient(circle at 35% 35%, #fff, #ddd); border: 2px solid #aaa; }
.player-name-display { font-size: 1.2rem; font-weight: bold; }
.disc-count-wrap { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.disc-count {
    background: rgba(255,255,255,0.25); border-radius: 8px;
    padding: 4px 14px; font-size: 1.4rem; font-weight: bold;
    min-width: 50px; text-align: center;
}
.disc-count-label { font-size: 1rem; opacity: 0.8; }

/* Board */
.board-wrapper { display: flex; }
.board {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 3px;
    background: #145a32;
    padding: 10px;
    border-radius: 10px;
    border: 4px solid #0e3d22;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}

.square {
    width: clamp(52px, 8.5vw, 70px);
    height: clamp(52px, 8.5vw, 70px);
    background: #1e8449;
    border-radius: 4px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    position: relative;
    transition: background 0.15s;
}
.square:hover { background: #239b56; }
.square:focus { outline: 4px solid #f39c12; outline-offset: -4px; z-index: 2; }
.square.valid-move { cursor: pointer; }
.square.valid-move::after {
    content: '';
    width: 30%; height: 30%;
    border-radius: 50%;
    border: 3px solid rgba(255,255,255,0.5);
    position: absolute;
    pointer-events: none;
}
.square.valid-move.black-turn::after { border-color: rgba(0,0,0,0.6); background: rgba(0,0,0,0.2); }
.square.valid-move.white-turn::after { border-color: rgba(255,255,255,0.7); background: rgba(255,255,255,0.2); }
.square:not(.valid-move):not(.has-disc) { cursor: default; }

/* Discs */
.disc {
    width: 82%; height: 82%;
    border-radius: 50%;
    transition: transform 0.15s;
}
.disc.black-disc {
    background: radial-gradient(circle at 35% 35%, #555, #111);
    border: 2px solid rgba(255,255,255,0.15);
    box-shadow: 0 3px 8px rgba(0,0,0,0.5);
}
.disc.white-disc {
    background: radial-gradient(circle at 35% 35%, #fff, #ddd);
    border: 2px solid #aaa;
    box-shadow: 0 3px 8px rgba(0,0,0,0.4);
}
.square:hover .disc { transform: scale(1.05); }

/* Flip animation */
@keyframes flip-to-black {
    0%   { transform: scaleX(1); }
    50%  { transform: scaleX(0); }
    100% { transform: scaleX(1); }
}
@keyframes flip-to-white {
    0%   { transform: scaleX(1); }
    50%  { transform: scaleX(0); }
    100% { transform: scaleX(1); }
}
.disc.flipping { animation: flip-to-black 0.3s ease; }

/* End Screen */
.result-container {
    max-width: 520px; margin: auto; padding: 55px 40px;
    background: rgba(0,0,0,0.4); border-radius: 20px; text-align: center;
}
.result-container h1 { font-size: 3rem; margin-bottom: 20px; }
.final-scores { margin-bottom: 25px; display: flex; flex-direction: column; gap: 12px; }
.score-row {
    display: flex; align-items: center; justify-content: center; gap: 14px;
    font-size: 1.4rem; background: rgba(255,255,255,0.1);
    border-radius: 10px; padding: 12px 20px;
}
.score-disc {
    width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0;
}

/* Responsive */
@media (max-width: 768px) {
    .game-header { justify-content: center; }
    .header-left { display: none; }
    .header-center, .header-right { width: 100%; justify-content: center; }
}
