/* =============================================
   ASCEND — Game Styles
   ============================================= */

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

html,
body {
    width: 100%;
    height: 100%;
    background: #050510;
    overflow: hidden;
    font-family: 'Courier New', monospace;
}

#canvas-container {
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

canvas {
    display: block;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

/* ── NAV BAR ── */
#nav-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: rgba(5, 5, 16, 0.85);
    border-bottom: 1px solid #1a1a3a;
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 12px;
    z-index: 200;
}

.nav-title {
    color: #00ffcc;
    font-size: 15px;
    letter-spacing: 3px;
    font-weight: bold;
}

.nav-sep {
    width: 1px;
    height: 18px;
    background: #2a2a4a;
}

.nav-btn {
    background: none;
    border: 1px solid #333;
    color: #999;
    font-family: inherit;
    font-size: 12px;
    padding: 4px 14px;
    cursor: pointer;
    border-radius: 3px;
    letter-spacing: 1px;
    transition: all .15s;
    text-decoration: none;
}

.nav-btn:hover {
    border-color: #00ffcc;
    color: #00ffcc;
}

.nav-btn.active {
    border-color: #00ffcc;
    color: #00ffcc;
    background: rgba(0, 255, 204, 0.08);
}

.nav-spacer {
    flex: 1;
}

#preset-select {
    background: #111;
    border: 1px solid #333;
    color: #aaa;
    font-family: inherit;
    font-size: 12px;
    padding: 3px 8px;
    border-radius: 3px;
}

/* ── HUD ── */
#hud {
    position: fixed;
    pointer-events: none;
    z-index: 10;
}

#timer-container {
    position: fixed;
    top: 56px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid #00ffcc;
    border-radius: 4px;
    padding: 6px 22px;
    color: #00ffcc;
    font-size: 24px;
    letter-spacing: 4px;
    text-shadow: 0 0 12px #00ffcc;
    min-width: 170px;
    text-align: center;
}

#dash-container {
    position: fixed;
    bottom: 24px;
    left: 24px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid #ff6b35;
    border-radius: 4px;
    padding: 6px 12px;
}

#dash-label {
    color: #ff6b35;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

#dash-bar-bg {
    width: 90px;
    height: 10px;
    background: rgba(255, 107, 53, 0.2);
    border: 1px solid #ff6b35;
    border-radius: 2px;
    overflow: hidden;
}

#dash-bar {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #ff6b35, #ffaa00);
    transition: width 0.05s linear;
    box-shadow: 0 0 6px #ff6b35;
}

#controls-hint {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid #333;
    border-radius: 4px;
    padding: 8px 12px;
    color: #555;
    font-size: 11px;
    line-height: 1.8;
}

#controls-hint span {
    color: #888;
}

/* ── WIN SCREEN ── */
#win-screen {
    position: fixed;
    inset: 0;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.85);
    z-index: 100;
}

#win-screen.active {
    display: flex;
}

#win-title {
    color: #00ffcc;
    font-size: 56px;
    letter-spacing: 8px;
    text-shadow: 0 0 30px #00ffcc, 0 0 60px #00ffcc88;
    margin-bottom: 16px;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1
    }

    50% {
        opacity: .7
    }
}

#win-time {
    color: #fff;
    font-size: 32px;
    letter-spacing: 4px;
    margin-bottom: 36px;
}

#win-time span {
    color: #ffaa00;
    text-shadow: 0 0 10px #ffaa00;
}

#restart-btn {
    background: none;
    border: 2px solid #00ffcc;
    color: #00ffcc;
    font-family: inherit;
    font-size: 16px;
    letter-spacing: 4px;
    padding: 12px 36px;
    cursor: pointer;
    text-transform: uppercase;
    transition: all .2s;
    pointer-events: all;
}

#restart-btn:hover {
    background: #00ffcc22;
    box-shadow: 0 0 20px #00ffcc44;
}

/* ── START SCREEN ── */
#start-screen {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.92);
    z-index: 100;
}

#game-title {
    color: #00ffcc;
    font-size: 72px;
    letter-spacing: 12px;
    text-shadow: 0 0 40px #00ffcc, 0 0 80px #00ffcc66;
    margin-bottom: 8px;
}

#game-subtitle {
    color: #ff6b35;
    font-size: 16px;
    letter-spacing: 6px;
    margin-bottom: 50px;
    text-shadow: 0 0 10px #ff6b3588;
}

.start-control-row {
    display: flex;
    gap: 24px;
    margin-bottom: 8px;
}

.key-hint {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid #444;
    color: #ccc;
    font-size: 12px;
    padding: 5px 12px;
    border-radius: 3px;
}

.key-hint strong {
    color: #00ffcc;
}

#press-start {
    color: #fff;
    font-size: 20px;
    letter-spacing: 4px;
    margin-top: 40px;
    animation: pulse 1s ease-in-out infinite;
}

/* ── MULTIPLAYER BUTTONS (start screen) ── */
.mp-buttons {
    display: flex;
    gap: 16px;
    margin-top: 24px;
}

.mp-btn {
    background: none;
    border: 2px solid #00ffcc;
    color: #00ffcc;
    font-family: inherit;
    font-size: 14px;
    letter-spacing: 3px;
    padding: 10px 28px;
    cursor: pointer;
    border-radius: 4px;
    transition: all .2s;
    pointer-events: all;
}

.mp-btn:hover {
    background: rgba(0, 255, 204, 0.12);
    box-shadow: 0 0 20px rgba(0, 255, 204, 0.3);
}

.mp-btn-solo {
    border-color: #ffd93d;
    color: #ffd93d;
    font-size: 16px;
    padding: 12px 36px;
}

.mp-btn-solo:hover {
    background: rgba(255, 217, 61, 0.12);
    box-shadow: 0 0 20px rgba(255, 217, 61, 0.3);
}

.lobby-name-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.lobby-name-row .lobby-url-input {
    flex: 1;
    color: #ccc;
    font-size: 14px;
}

/* ── LOBBY SCREEN ── */
#lobby-screen,
#results-screen {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.92);
    z-index: 150;
}

#lobby-screen.active,
#results-screen.active {
    display: flex;
}

.lobby-card {
    background: rgba(10, 10, 20, 0.95);
    border: 1px solid #1a1a3a;
    border-radius: 8px;
    padding: 32px 40px;
    min-width: 380px;
    max-width: 460px;
    text-align: center;
}

.lobby-title {
    color: #00ffcc;
    font-size: 14px;
    letter-spacing: 4px;
    margin-bottom: 8px;
}

.lobby-code {
    color: #fff;
    font-size: 48px;
    letter-spacing: 12px;
    text-shadow: 0 0 20px #00ffcc;
    margin-bottom: 12px;
}

.lobby-url-row {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
}

.lobby-url-input {
    flex: 1;
    background: #111;
    border: 1px solid #333;
    color: #888;
    font-family: inherit;
    font-size: 11px;
    padding: 6px 8px;
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.lobby-copy-btn {
    background: none;
    border: 1px solid #333;
    color: #888;
    font-family: inherit;
    font-size: 10px;
    padding: 6px 10px;
    cursor: pointer;
    border-radius: 3px;
    letter-spacing: 1px;
    transition: all .15s;
}

.lobby-copy-btn:hover {
    border-color: #00ffcc;
    color: #00ffcc;
}

.lobby-section-label {
    color: #555;
    font-size: 11px;
    letter-spacing: 2px;
    margin-bottom: 8px;
    text-align: left;
}

.lobby-players {
    list-style: none;
    margin-bottom: 20px;
    text-align: left;
}

.lobby-players li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    border-bottom: 1px solid #1a1a2a;
    font-size: 13px;
    color: #ccc;
}

.lobby-color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.lobby-player-name {
    flex: 1;
}

.lobby-ready-badge {
    font-size: 10px;
    letter-spacing: 1px;
    color: #555;
    border: 1px solid #333;
    padding: 2px 8px;
    border-radius: 3px;
}

.lobby-ready-badge.ready {
    color: #00ffcc;
    border-color: #00ffcc;
    background: rgba(0, 255, 204, 0.08);
}

.lobby-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.lobby-controls select {
    background: #111;
    border: 1px solid #333;
    color: #aaa;
    font-family: inherit;
    font-size: 12px;
    padding: 7px 10px;
    border-radius: 3px;
}

.lobby-btn {
    background: none;
    border: 2px solid #555;
    color: #aaa;
    font-family: inherit;
    font-size: 13px;
    letter-spacing: 2px;
    padding: 8px 20px;
    cursor: pointer;
    border-radius: 4px;
    transition: all .2s;
}

.lobby-btn:hover {
    border-color: #888;
    color: #fff;
}

.lobby-btn.ready-active {
    border-color: #00ffcc;
    color: #00ffcc;
    background: rgba(0, 255, 204, 0.08);
}

.lobby-btn-primary {
    border-color: #00ffcc;
    color: #00ffcc;
}

.lobby-btn-primary:hover {
    background: rgba(0, 255, 204, 0.12);
    box-shadow: 0 0 16px rgba(0, 255, 204, 0.25);
}

.lobby-btn-primary.disabled,
.lobby-btn-primary:disabled {
    border-color: #333;
    color: #444;
    cursor: not-allowed;
    box-shadow: none;
    background: none;
}

/* ── RESULTS ── */
.results-list li {
    font-size: 15px;
    padding: 8px 0;
}

.result-pos {
    font-size: 18px;
    min-width: 32px;
}

.result-name {
    flex: 1;
}

.result-time {
    color: #ffaa00;
    letter-spacing: 2px;
}

/* ── NET ERROR TOAST ── */
#net-error {
    display: none;
    position: fixed;
    top: 52px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 50, 50, 0.9);
    color: #fff;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    padding: 8px 24px;
    border-radius: 4px;
    z-index: 300;
    letter-spacing: 1px;
}

/* ── SPECTATE OVERLAY ── */
#spectate-overlay {
    display: none;
    position: fixed;
    top: 50px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    z-index: 120;
    pointer-events: none;
}

#spectate-overlay.active {
    display: block;
    animation: fadeInDown 0.4s ease;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.spectate-banner {
    background: rgba(0, 255, 204, 0.15);
    border: 1px solid rgba(0, 255, 204, 0.4);
    color: #00ffcc;
    font-family: 'Courier New', monospace;
    font-size: 18px;
    letter-spacing: 4px;
    padding: 10px 32px;
    border-radius: 6px;
    text-shadow: 0 0 10px rgba(0, 255, 204, 0.5);
}

.spectate-banner span {
    color: #ffd93d;
    margin-left: 8px;
}

.spectate-sub {
    color: #888;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    letter-spacing: 3px;
    margin-top: 6px;
    animation: pulse 2s ease-in-out infinite;
}