/* 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: 600px; 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: 16px 22px; font-size: 1.2rem;
    border: 3px solid #fff; background: transparent; color: #fff;
    border-radius: 12px; cursor: pointer; transition: all 0.2s;
    min-width: 130px; min-height: 70px;
    display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.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; }
.size-hint { font-size: 0.85rem; opacity: 0.75; font-weight: normal; }
.setting-btn.active .size-hint { opacity: 0.65; }

.komi-wrap { display: flex; justify-content: center; }
.komi-input { max-width: 140px; width: 140px; }

.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: 10px; 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%;
    flex-shrink: 0; transition: all 0.3s;
}
.player-color-dot.black { background: #111; border: 3px solid #fff; }
.player-color-dot.white { background: #fff; border: 3px solid #bbb; box-shadow: 0 0 6px rgba(0,0,0,0.4); }
.turn-label { font-weight: normal; opacity: 0.85; }

.ko-alert {
    background: #8e44ad; 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;
    white-space: nowrap; 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; }
a.action-btn { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.pass-btn { background: #e67e22; color: #fff; }
.pass-btn:hover { background: #ca6f1e; }

/* 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: 12px;
    padding: 10px 18px; background: rgba(0,0,0,0.2);
    border-radius: 12px; width: 100%; max-width: 600px;
    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-stone {
    width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
}
.black-stone { background: radial-gradient(circle at 35% 35%, #555, #111); border: 2px solid rgba(255,255,255,0.3); }
.white-stone { background: radial-gradient(circle at 35% 35%, #fff, #ddd); border: 2px solid #aaa; box-shadow: 0 2px 4px rgba(0,0,0,0.3); }

.player-name-display { font-size: 1.2rem; font-weight: bold; }
.captures-info { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.captures-label { font-size: 1rem; opacity: 0.8; }
.captures-count {
    background: rgba(255,255,255,0.25); border-radius: 8px;
    padding: 4px 14px; font-size: 1.3rem; font-weight: bold;
    min-width: 44px; text-align: center;
}
.pass-badge {
    margin-left: 10px; background: rgba(255,255,255,0.2);
    border-radius: 6px; padding: 3px 10px;
    font-size: 0.9rem; font-style: italic; opacity: 0.8;
}

/* Canvas */
.board-wrapper {
    display: flex; align-items: center; justify-content: center;
    padding: 12px;
    background: linear-gradient(135deg, #6b3f10, #3d1f05);
    border-radius: 10px;
    box-shadow: 0 12px 50px rgba(0,0,0,0.7), inset 0 2px 6px rgba(255,200,80,0.15);
}
#go-canvas {
    cursor: crosshair;
    border-radius: 2px;
    box-shadow: inset 0 0 8px rgba(0,0,0,0.3);
    touch-action: none;
    display: block;
}

/* 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: 2.8rem; margin-bottom: 20px; }
.score-details { margin-bottom: 20px; }
.score-row {
    display: flex; align-items: center; gap: 14px; justify-content: center;
    padding: 10px 0; font-size: 1.3rem; border-bottom: 1px solid rgba(255,255,255,0.15);
}
.score-row:last-child { border-bottom: none; }
.score-stone {
    width: 20px; height: 20px; 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; }
    .player-indicator { font-size: 1.2rem; padding: 10px 15px; }
}
