:root {
    --bg: #f8f9fc;
    --card: #ffffff;
    --border: #d1d9e6;
    --text: #1f2a44;
    --text-light: #6b7280;
    --blue: #3b82f6;
    --red: #ef4444;
    --green: #10b981;
    --gray: #9ca3af;
}

* {
    box-sizing: border-box;
}

body {
    font-family: system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    margin: 0;
    padding: 24px 16px;
    min-height: 100vh;
    line-height: 1.5;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

h1 {
    margin: 0 0 1.2rem;
    color: #111827;
    font-size: 2.1rem;
    font-weight: 700;
}

#network {
    width: 100%;
    height: 580px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--card);
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.status-bar {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.status {
    font-size: 1.1rem;
    font-weight: 500;
}

#player {
    color: var(--text);
}

#player-won {
    font-weight: bold;
    padding: 6px 12px;
    border-radius: 8px;
    background: #e0f2fe;
    color: #1e40af;
}

#player-won.winner {
    background: #d1fae5;
    color: #065f46;
}

.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin: 1.5rem 0;
    align-items: flex-start;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.color-chooser legend {
    font-weight: 600;
    margin-bottom: 0.6rem;
    color: #374151;
}

.color-chooser label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    cursor: pointer;
}

.color-chooser input[type="radio"] {
    accent-color: var(--blue);
}

#debug-section {
    margin-top: 1.5rem;
}

#debug-display {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 1rem;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.92rem;
    white-space: pre-wrap;
    max-height: 320px;
    overflow-y: auto;
    display: none;
}

#debug-switch:checked ~ #debug-display {
    display: block;
}

.button-group {
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
}

button {
    font-size: 0.95rem;
    padding: 0.65rem 1.3rem;
    border-radius: 8px;
    border: none;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.13s ease;
}

button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

button.primary {
    background: var(--blue);
    color: white;
}

button.danger {
    background: var(--red);
    color: white;
}

button.success {
    background: var(--green);
    color: white;
}

button.neutral {
    background: #6b7280;
    color: white;
}

@media (max-width: 680px) {
    .controls {
        flex-direction: column;
    }
    #network {
        height: 460px;
    }
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    position: relative;
}
.mode-toggle {
    display: flex;
    background: #f0f0f0;
    border-radius: 999px;
    padding: 4px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}
.mode-btn {
    padding: 8px 20px;
    border: none;
    background: transparent;
    border-radius: 999px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #555;
}
.mode-btn.active {
    background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    color: #1a1a1a;
}
.mode-btn:hover:not(.active) {
    background: rgba(0,0,0,0.05);
}
.mode-section {
    transition: opacity 0.4s ease, transform 0.4s ease;
}
.hidden {
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
    height: 0;
    margin: 0;
    overflow: hidden;
}
#player strong {
    font-size: 1.1em;
}
#network {
    position: relative;
}

#overlay {
    position: absolute;
    inset: 0;
    backdrop-filter: blur(3px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

#network.disabled {
    filter: grayscale(40%) brightness(85%);
}

.overlay-box {
    background: #6f6f6f;
    padding: 40px 50px;
    border-radius: 18px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.4);
    text-align: center;
    color: white;
}

.overlay-box h2 {
    margin-bottom: 30px;
    font-weight: 600;
}

.overlay-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
}

.overlay-btn {
    padding: 14px 30px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 140px;
}

.left-btn {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
}

.left-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(59,130,246,0.4);
}

.right-btn {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

.right-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(239,68,68,0.4);
}
