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

:root {
    --navbar-height: 56px;
    --accent:        #00d4c0;
    --accent-light:  #3de8d8;
    --accent-glow:   rgba(0, 212, 192, 0.25);
    --accent-dim:    rgba(0, 212, 192, 0.45);
    --bg-deep:       #0d1220;
    --bg-card:       #111827;
    --bg-surface:    #16213e;
}

body {
    background: var(--bg-deep);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
}

/* ─── Navbar ─────────────────────────────────────── */
.navbar {
    background: linear-gradient(180deg, #131b2e 0%, #0d1220 100%) !important;
    border-bottom: 1px solid var(--accent-dim);
    box-shadow: 0 1px 0 rgba(0, 212, 192, 0.08), 0 4px 24px rgba(0, 0, 0, 0.6);
}

.navbar-brand {
    font-size: 22px;
    font-weight: 800;
    color: var(--accent) !important;
    text-shadow: 0 0 12px rgba(0, 212, 192, 0.55);
    letter-spacing: 5px;
    cursor: pointer;
    text-transform: uppercase;
}

/* Quit confirmation modal */
.quit-confirm-modal .modal-body {
    padding: 28px 24px 12px;
}

.quit-confirm-modal .modal-footer {
    padding: 12px 24px 20px;
    gap: 10px;
}

.quit-confirm-title {
    font-size: 18px;
    font-weight: 700;
    color: #eee;
    margin-bottom: 6px;
}

.quit-confirm-sub {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 0;
}

/* Quit / back-to-menu button */
.nav-quit-btn {
    opacity: 0.45;
    transition: opacity 0.2s !important;
}

.nav-quit-btn:hover {
    opacity: 1 !important;
}

/* Compact glass buttons inside navbar */
.navbar .game-btn {
    padding: 5px 13px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 7px;
    letter-spacing: 0.3px;
    background: linear-gradient(180deg, rgba(255,255,255,0.06) 0%, rgba(0,0,0,0.15) 100%);
    border: 1px solid rgba(0, 212, 192, 0.3);
    color: rgba(255, 255, 255, 0.75);
    box-shadow:
        0 0 10px rgba(0, 212, 192, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        inset 0 -1px 0 rgba(0, 0, 0, 0.25);
    transition: border-color 0.2s, box-shadow 0.2s, color 0.2s;
}

.navbar .game-btn:hover {
    border-color: rgba(0, 212, 192, 0.65);
    color: #fff;
    box-shadow:
        0 0 18px rgba(0, 212, 192, 0.22),
        inset 0 1px 0 rgba(255, 255, 255, 0.15),
        inset 0 -1px 0 rgba(0, 0, 0, 0.25);
    transform: none;
}

.navbar .game-btn.secondary {
    border-color: rgba(255, 255, 255, 0.12);
    background: linear-gradient(180deg, rgba(255,255,255,0.04) 0%, rgba(0,0,0,0.12) 100%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.07),
        inset 0 -1px 0 rgba(0, 0, 0, 0.2);
}

.navbar .game-btn.secondary:hover {
    border-color: rgba(0, 212, 192, 0.4);
    box-shadow:
        0 0 14px rgba(0, 212, 192, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        inset 0 -1px 0 rgba(0, 0, 0, 0.2);
}

/* ─── HUD score cards ─────────────────────────────── */
.score-display {
    display: flex;
    align-items: center;
    gap: 10px;
}

.hud-card {
    display: flex;
    align-items: stretch;
    height: 32px;
    border-radius: 8px;
    overflow: hidden;
    font-size: 12px;
    font-weight: 600;
}

.hud-p1 {
    border: 1px solid rgba(0, 212, 192, 0.4);
    box-shadow:
        0 0 16px rgba(0, 212, 192, 0.14),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.hud-p2 {
    border: 1px solid rgba(255, 107, 107, 0.4);
    box-shadow:
        0 0 16px rgba(255, 107, 107, 0.14),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.hud-slice {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 0 10px;
    background: linear-gradient(180deg, rgba(255,255,255,0.05) 0%, rgba(0,0,0,0.1) 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    white-space: nowrap;
}

.hud-slice:last-child { border-right: none; }

.hud-name { font-weight: 700; letter-spacing: 0.4px; }

.hud-p1 .hud-name {
    background: linear-gradient(180deg, rgba(0,212,192,0.2) 0%, rgba(0,212,192,0.1) 100%);
    color: var(--accent-light);
    text-shadow: 0 0 8px rgba(0, 212, 192, 0.5);
}

.hud-p2 .hud-name {
    background: linear-gradient(180deg, rgba(255,107,107,0.2) 0%, rgba(255,107,107,0.1) 100%);
    color: #ff8a8a;
    text-shadow: 0 0 8px rgba(255, 107, 107, 0.5);
}

.hud-icon { font-size: 11px; opacity: 0.55; line-height: 1; }

.hud-val { color: #e8e8e8; min-width: 18px; text-align: right; }

/* ─── Game container ──────────────────────────────── */
#gameContainer {
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    width: 100%;
    height: calc(100% - var(--navbar-height));
}

#gameCanvas { display: block; }

/* ─── Game Over overlay ───────────────────────────── */
#gameOver {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(180deg, #131b2e 0%, #0d1220 100%);
    padding: 32px 36px 28px;
    border-radius: 18px;
    text-align: center;
    display: none;
    border: 1px solid var(--accent-dim);
    box-shadow:
        0 0 60px rgba(0, 212, 192, 0.2),
        0 24px 70px rgba(0, 0, 0, 0.75),
        inset 0 1px 0 rgba(255, 255, 255, 0.07);
    z-index: 200;
    min-width: 340px;
}

#gameOverTitle {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: 1px;
    margin-bottom: 22px;
}

.go-close-btn {
    position: absolute;
    top: 12px;
    right: 14px;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.35);
    font-size: 18px;
    line-height: 1;
    padding: 4px 7px;
    border-radius: 6px;
    cursor: pointer;
    transition: color 0.2s, background 0.2s;
}

.go-close-btn:hover {
    color: rgba(255, 255, 255, 0.85);
    background: rgba(255, 255, 255, 0.07);
}

.go-stats {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 24px;
}

.go-sub {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
    letter-spacing: 0.5px;
    margin-bottom: 4px;
    text-transform: uppercase;
}

.go-stat-card {
    height: 42px;
    font-size: 14px;
    min-width: 280px;
}

.go-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* ─── Buttons (full-size CTAs) ────────────────────── */
.game-btn {
    background: linear-gradient(180deg, var(--accent-light) 0%, #009e92 100%);
    border: none;
    padding: 15px 40px;
    font-size: 16px;
    color: #0a1520;
    font-weight: 800;
    letter-spacing: 0.5px;
    border-radius: 10px;
    cursor: pointer;
    transition: box-shadow 0.2s, transform 0.15s;
    box-shadow:
        0 0 28px rgba(0, 212, 192, 0.45),
        0 6px 20px rgba(0, 0, 0, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.35),
        inset 0 -2px 0 rgba(0, 0, 0, 0.2);
}

.game-btn:hover {
    transform: translateY(-1px);
    box-shadow:
        0 0 40px rgba(0, 212, 192, 0.65),
        0 10px 28px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.35),
        inset 0 -2px 0 rgba(0, 0, 0, 0.2);
    color: #0a1520;
}

.game-btn.secondary {
    background: linear-gradient(180deg, rgba(255,255,255,0.08) 0%, rgba(0,0,0,0.2) 100%);
    border: 1px solid rgba(0, 212, 192, 0.3);
    color: rgba(255, 255, 255, 0.75);
    box-shadow:
        0 0 14px rgba(0, 212, 192, 0.1),
        0 4px 14px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        inset 0 -1px 0 rgba(0, 0, 0, 0.25);
}

.game-btn.secondary:hover {
    border-color: rgba(0, 212, 192, 0.55);
    color: #fff;
    box-shadow:
        0 0 24px rgba(0, 212, 192, 0.25),
        0 6px 18px rgba(0, 0, 0, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.12),
        inset 0 -1px 0 rgba(0, 0, 0, 0.25);
}

/* ─── Modals ──────────────────────────────────────── */
.modal-content {
    background: linear-gradient(180deg, #131b2e 0%, #0d1220 100%);
    border: 1px solid var(--accent-dim);
    border-radius: 18px;
    box-shadow:
        0 0 60px rgba(0, 212, 192, 0.15),
        0 30px 80px rgba(0, 0, 0, 0.8),
        inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

.modal-header {
    border-bottom: 1px solid rgba(0, 212, 192, 0.2);
    padding: 20px 24px 16px;
}

.modal-title {
    color: var(--accent-light);
    font-weight: 800;
    letter-spacing: 2px;
    font-size: 15px;
    text-shadow: 0 0 12px rgba(0, 212, 192, 0.4);
}

.btn-close { filter: invert(1) opacity(0.6); }
.btn-close:hover { filter: invert(1) opacity(1); }

.modal-body { color: #dde; padding: 20px 24px; }
.modal-footer { padding: 16px 24px 20px; }

/* ─── Leaderboard tabs ────────────────────────────── */
.lb-tabs {
    display: flex;
    margin-bottom: 16px;
    border-bottom: 1px solid rgba(0, 212, 192, 0.18);
}

.lb-tab {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    padding: 8px 22px;
    color: rgba(255, 255, 255, 0.3);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    cursor: pointer;
    transition: color 0.2s, border-bottom-color 0.2s;
}

.lb-tab:hover { color: rgba(255, 255, 255, 0.7); }

.lb-tab.active {
    color: var(--accent-light);
    border-bottom-color: var(--accent);
}

/* ─── Leaderboard table ───────────────────────────── */
.lb-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.lb-filter-group {
    display: flex;
    align-items: center;
    gap: 5px;
}

.lb-filter-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.28);
    margin-right: 3px;
    white-space: nowrap;
}

.lb-filter-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.38);
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    cursor: pointer;
    transition: border-color 0.18s, color 0.18s, background 0.18s;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.lb-filter-btn:hover {
    border-color: rgba(0, 212, 192, 0.4);
    color: rgba(255, 255, 255, 0.75);
}

.lb-filter-btn.active {
    background: rgba(0, 212, 192, 0.1);
    border-color: rgba(0, 212, 192, 0.5);
    color: var(--accent-light);
}

.leaderboard-scroll.lb-loading {
    opacity: 0.4;
    transition: opacity 0.15s;
    pointer-events: none;
}

.leaderboard-scroll {
    max-height: 60vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 212, 192, 0.3) rgba(255, 255, 255, 0.03);
}

.leaderboard-scroll::-webkit-scrollbar { width: 4px; }
.leaderboard-scroll::-webkit-scrollbar-track { background: rgba(255,255,255,0.03); border-radius: 2px; }
.leaderboard-scroll::-webkit-scrollbar-thumb { background: rgba(0,212,192,0.3); border-radius: 2px; }

.leaderboard-table { width: 100%; border-collapse: collapse; }

.leaderboard-table thead tr { border-bottom: 1px solid rgba(0, 212, 192, 0.35); }

.leaderboard-table th {
    padding: 10px 14px;
    color: var(--accent);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    white-space: nowrap;
    background: transparent;
}

.leaderboard-table td {
    padding: 11px 14px;
    color: #aaa;
    font-size: 14px;
    white-space: nowrap;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    background: transparent;
    vertical-align: middle;
}

.leaderboard-table tbody tr:hover td { background: rgba(0, 212, 192, 0.05); color: #ddd; }

.leaderboard-table td:first-child { color: rgba(255,255,255,0.28); font-size: 12px; text-align: center; width: 36px; }
.leaderboard-table tbody tr:nth-child(1) td:first-child { color: #ffd700; font-weight: 700; }
.leaderboard-table tbody tr:nth-child(2) td:first-child { color: #c0c0c0; font-weight: 700; }
.leaderboard-table tbody tr:nth-child(3) td:first-child { color: #cd7f32; font-weight: 700; }

.leaderboard-table td:nth-child(2) { color: #eee; font-weight: 600; }
.leaderboard-table td:nth-child(3) { color: var(--accent-light); font-weight: 700; font-size: 15px; }

/* ─── Form elements ───────────────────────────────── */
.form-label { color: var(--accent-light); font-weight: 700; font-size: 13px; letter-spacing: 0.5px; }

.form-control, .form-select {
    background: rgba(255,255,255,0.04) !important;
    border: 1px solid rgba(255,255,255,0.12) !important;
    color: #eee !important;
    border-radius: 10px !important;
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.3) !important;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus, .form-select:focus {
    border-color: var(--accent-dim) !important;
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.3), 0 0 0 3px rgba(0,212,192,0.12) !important;
    outline: none;
}

.form-select option { background: #131b2e; color: #eee; }

.form-check-input:checked {
    background-color: var(--accent);
    border-color: var(--accent);
}

.form-check-label { color: #ccc; }

/* ─── Player count toggle (1P / 2P) ──────────────── */
.btn-group .btn {
    background: linear-gradient(180deg, rgba(255,255,255,0.05) 0%, rgba(0,0,0,0.15) 100%);
    border: 1px solid rgba(0, 212, 192, 0.3) !important;
    color: rgba(255,255,255,0.55);
    padding: 12px 30px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.07);
}

.btn-group .btn:hover {
    background: linear-gradient(180deg, rgba(0,212,192,0.12) 0%, rgba(0,212,192,0.04) 100%);
    color: #fff;
    border-color: rgba(0, 212, 192, 0.55) !important;
}

.btn-group .btn.active {
    background: linear-gradient(180deg, rgba(0,212,192,0.18) 0%, rgba(0,212,192,0.08) 100%);
    color: var(--accent-light);
    border-color: var(--accent-dim) !important;
    font-weight: 700;
    box-shadow:
        0 0 16px rgba(0,212,192,0.2),
        inset 0 1px 0 rgba(255,255,255,0.12),
        inset 0 -1px 0 rgba(0,0,0,0.2);
}

/* ─── Controls info ───────────────────────────────── */
.controls-info {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 12px;
    padding: 15px;
    margin-top: 20px;
}

.controls-info h6 { color: var(--accent); margin-bottom: 10px; font-size: 12px; letter-spacing: 1px; }
.controls-info p { margin-bottom: 5px; font-size: 14px; }

.p1-color { color: var(--accent-light); }
.p2-color { color: #ff8a8a; }

/* ─── Keycaps ─────────────────────────────────────── */
.keycaps { display: flex; gap: 16px; flex-wrap: wrap; }
.keygroup { display: inline-flex; flex-direction: column; gap: 6px; }
.keyrow { display: flex; gap: 6px; justify-content: center; }

.keycap {
    min-width: 34px;
    height: 34px;
    padding: 0 8px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.15);
    background: linear-gradient(180deg, rgba(255,255,255,0.07) 0%, rgba(0,0,0,0.3) 100%);
    box-shadow:
        0 3px 0 rgba(0,0,0,0.5),
        inset 0 1px 0 rgba(255,255,255,0.12);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #e8e8e8;
    letter-spacing: 0.5px;
}

.keycap.wide { min-width: 80px; }
.keylabel { font-size: 11px; text-transform: uppercase; letter-spacing: 0.8px; color: rgba(255,255,255,0.5); margin-bottom: 2px; }
.pause-label { color: rgba(255,255,255,0.5); }

/* ─── Splash screen ───────────────────────────────── */
#splashScreen {
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    width: 100%;
    height: calc(100% - var(--navbar-height));
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-deep);
    z-index: 10;
}

.splash-title {
    font-size: 80px;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: 20px;
    text-shadow:
        0 0 30px rgba(255,255,255,0.15),
        0 2px 4px rgba(0,0,0,0.6);
    text-transform: uppercase;
    margin-bottom: 56px;
    user-select: none;
}

.splash-menu {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    width: 100%;
    max-width: 520px;
    padding: 0 24px;
}

/* Glass 3D button */
.splash-btn {
    width: 100%;
    background: linear-gradient(180deg, rgba(255,255,255,0.07) 0%, rgba(0,0,0,0.2) 100%);
    border: 1px solid rgba(0, 212, 192, 0.45);
    padding: 17px 40px;
    font-size: 16px;
    letter-spacing: 4px;
    color: rgba(255,255,255,0.82);
    font-weight: 700;
    border-radius: 14px;
    cursor: pointer;
    text-transform: uppercase;
    transition: border-color 0.25s, box-shadow 0.25s, color 0.25s, transform 0.15s;
    box-shadow:
        0 0 24px rgba(0, 212, 192, 0.16),
        0 6px 20px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.13),
        inset 0 -1px 0 rgba(0, 0, 0, 0.3);
}

.splash-btn:hover {
    border-color: rgba(0, 212, 192, 0.75);
    color: #fff;
    transform: translateY(-1px);
    box-shadow:
        0 0 40px rgba(0, 212, 192, 0.3),
        0 10px 28px rgba(0, 0, 0, 0.55),
        inset 0 1px 0 rgba(255, 255, 255, 0.18),
        inset 0 -1px 0 rgba(0, 0, 0, 0.3);
}

.splash-btn.ghost {
    border-color: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.38);
    box-shadow:
        0 4px 14px rgba(0,0,0,0.4),
        inset 0 1px 0 rgba(255,255,255,0.06),
        inset 0 -1px 0 rgba(0,0,0,0.2);
}

.splash-btn.ghost:hover {
    border-color: rgba(0, 212, 192, 0.35);
    color: rgba(255, 255, 255, 0.65);
    box-shadow:
        0 0 20px rgba(0, 212, 192, 0.1),
        0 6px 18px rgba(0, 0, 0, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        inset 0 -1px 0 rgba(0, 0, 0, 0.2);
}
