:root {
    --bg-color: #1a1a2e;
    --court-color: #16213e;
    --line-color: #e94560;
    --text-color: #ffffff;
    --accent-color: #0f3460;
}

body {
    margin: 0;
    padding: 20px;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Outfit', sans-serif;
}

.watch-layout {
    max-width: 1180px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 840px 300px;
    gap: 18px;
    align-items: start;
}

.side-panel {
    background: #111827;
    border: 1px solid #334155;
    border-radius: 12px;
    padding: 14px;
    position: sticky;
    top: 12px;
}

.side-panel h2, .side-panel h3 { margin: 0 0 10px; }

.mode-switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 10px;
}

.mode-btn {
    border: 1px solid #475569;
    background: #1e293b;
    color: #e2e8f0;
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    font-weight: 700;
}
.mode-btn.active {
    background: #0f3460;
    border-color: #e94560;
    color: #fff;
}

.mode-indicator {
    background: #0b1220;
    border: 1px solid #334155;
    color: #93c5fd;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .03em;
    text-transform: uppercase;
    padding: 8px 10px;
    margin-bottom: 10px;
}

.rules-list {
    margin: 0 0 12px 18px;
    padding: 0;
}
.rules-list li { margin-bottom: 8px; color: #dbeafe; }

.rules-6square {
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 10px;
    padding: 10px;
    margin-bottom: 10px;
}
.rules-6square-title {
    font-size: 12px;
    color: #fbbf24;
    text-transform: uppercase;
    margin-bottom: 6px;
    font-weight: 700;
}
#rules-6square.hidden { display: none; }

.panel-block {
    background: #1f2937;
    border: 1px solid #374151;
    border-radius: 10px;
    padding: 8px 10px;
    margin-bottom: 8px;
}
.panel-label { color: #93c5fd; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.panel-value { color: #fff; font-weight: 700; margin-top: 2px; }

.score-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 10px;
    font-size: 13px;
}
.score-table th, .score-table td {
    border-bottom: 1px solid #334155;
    padding: 6px;
    text-align: left;
}
.score-table th { color: #93c5fd; }

.match-log {
    max-height: 260px;
    overflow: auto;
    padding-left: 18px;
    margin: 0;
}
.match-log li { margin-bottom: 6px; color: #e2e8f0; font-size: 13px; }

.center-column { width: 840px; }

/* Top Bar */
#top-bar {
    width: 800px;
    height: 70px;
    background-color: #1a1a2e;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #e94560;
    margin: 0 auto 10px;
    border-radius: 10px 10px 0 0;
    padding: 0 20px;
    box-sizing: border-box;
}

.stat-group { display: flex; gap: 20px; }
.stat-box { display: flex; flex-direction: column; align-items: center; }
.stat-box .label { font-size: 12px; color: #a0a0a0; text-transform: uppercase; letter-spacing: 1px; }
.stat-box .value { font-size: 20px; font-weight: bold; color: #e94560; }

.small-btn {
    padding: 10px 20px;
    font-size: 16px;
    background-color: #0f3460;
    border: 1px solid #e94560;
    color: #fff;
    border-radius: 5px;
    cursor: pointer;
    font-family: 'Outfit', sans-serif;
    transition: all 0.2s;
}
.small-btn:hover { background-color: #e94560; transform: scale(1.05); }

/* Game Container */
#game-container {
    position: relative;
    width: 800px;
    height: 800px;
    margin: 0 auto;
    background-color: var(--court-color);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    border-radius: 0 0 10px 10px;
    overflow: hidden;
}

canvas { display: block; width: 100%; height: 100%; }

/* Screens */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: rgba(26, 26, 46, 0.95);
    z-index: 10;
    transition: opacity 0.3s ease;
}
.screen.hidden { opacity: 0; pointer-events: none; }
.screen.active { opacity: 1; pointer-events: auto; }

.screen h1 {
    font-size: 42px;
    margin-bottom: 16px;
    color: #e94560;
    text-shadow: 2px 2px 0 #0f3460;
    text-align: center;
}

.screen p { font-size: 20px; margin-bottom: 10px; color: #e0e0e0; }

#player-name-input {
    padding: 10px 20px;
    font-size: 20px;
    border: 2px solid #e94560;
    background-color: #0f3460;
    color: #fff;
    border-radius: 5px;
    margin-bottom: 20px;
    text-align: center;
    outline: none;
    font-family: 'Outfit', sans-serif;
}
#player-name-input::placeholder { color: #a0a0a0; }

button#start-btn,
button#restart-btn {
    padding: 15px 40px;
    font-size: 24px;
    font-weight: bold;
    color: #fff;
    background-color: #e94560;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: transform 0.1s ease, background-color 0.2s ease;
    font-family: 'Outfit', sans-serif;
    margin-top: 20px;
}
button:hover { background-color: #ff2e63; transform: scale(1.05); }
button:active { transform: scale(0.95); }

@media (max-width: 1460px) {
    .watch-layout {
        grid-template-columns: 1fr;
    }
    .center-column, #top-bar, #game-container { width: 100%; max-width: 800px; }
    .side-panel { position: static; }
}
