/* Clean rebuilt multiplayer layer. This file is intentionally scoped to .mpn-* */

.mpn-modal,
.mpn-game {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: none;
    font-family: 'Share Tech Mono', 'Courier New', monospace;
    color: #b6f9ff;
}

.mpn-modal.active,
.mpn-game.active {
    display: flex;
}

.mpn-modal {
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.88);
    padding: 18px;
}

.mpn-panel {
    width: min(940px, 96vw);
    max-height: 92vh;
    overflow: auto;
    border: 1px solid rgba(0, 255, 170, 0.65);
    background: rgba(0, 10, 8, 0.94);
    box-shadow: 0 0 24px rgba(0, 255, 170, 0.24);
    padding: 18px;
}

.mpn-title,
.mpn-heading {
    font-family: 'Orbitron', sans-serif;
    color: #fff;
    letter-spacing: 0.14em;
    text-shadow: 0 0 12px #00ffaa;
}

.mpn-title {
    font-size: clamp(20px, 4vw, 34px);
    margin-bottom: 12px;
}

.mpn-heading {
    font-size: 13px;
    margin: 10px 0 8px;
}

.mpn-grid {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 16px;
}

.mpn-card {
    border: 1px solid rgba(0, 255, 170, 0.28);
    background: rgba(0, 255, 170, 0.045);
    padding: 12px;
}

.mpn-lobbies {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 340px;
    overflow-y: auto;
    padding-right: 5px;
}

.mpn-lobby {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    align-items: center;
    border: 1px solid rgba(0, 255, 170, 0.22);
    background: rgba(0, 0, 0, 0.58);
    color: #b6f9ff;
    padding: 10px;
    cursor: pointer;
    text-align: left;
}

.mpn-lobby:hover,
.mpn-lobby.selected {
    border-color: #00ffaa;
    box-shadow: 0 0 12px rgba(0, 255, 170, 0.2);
}

.mpn-lobby strong {
    color: #fff;
    font-family: 'Orbitron', sans-serif;
    letter-spacing: 0.08em;
}

.mpn-pill {
    display: inline-block;
    border: 1px solid rgba(255, 255, 255, 0.25);
    padding: 2px 7px;
    margin: 4px 5px 0 0;
    font-size: 11px;
    color: #d9ffff;
}

.mpn-pill.red { border-color: #ff4d6a; color: #ffd0db; }
.mpn-pill.blue { border-color: #3a8aff; color: #bbe0ff; }

.mpn-form {
    display: grid;
    gap: 10px;
}

.mpn-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.mpn-row.between {
    justify-content: space-between;
}

.mpn-label {
    display: grid;
    gap: 5px;
    color: #7cebd7;
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.mpn-input,
.mpn-select {
    background: #020806;
    color: #fff;
    border: 1px solid rgba(0, 255, 170, 0.55);
    padding: 10px 11px;
    min-height: 40px;
    font: inherit;
    outline: none;
}

.mpn-input:focus,
.mpn-select:focus {
    box-shadow: 0 0 0 2px rgba(0, 255, 170, 0.18);
}

.mpn-btn {
    appearance: none;
    border: 1px solid #00ffaa;
    background: #fff;
    color: #00110d;
    min-height: 40px;
    padding: 9px 14px;
    font-family: 'Orbitron', sans-serif;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.10em;
    cursor: pointer;
}

.mpn-btn:hover {
    background: #00ffaa;
}

.mpn-btn.ghost {
    background: transparent;
    color: #b6f9ff;
}

.mpn-btn.danger {
    border-color: #ff4d6a;
    color: #ffd0db;
    background: transparent;
}

.mpn-btn:disabled {
    opacity: 0.42;
    cursor: default;
}

.mpn-note,
.mpn-status {
    color: #70cdbc;
    font-size: 12px;
    line-height: 1.5;
}

.mpn-error {
    color: #ff9aaa;
    min-height: 18px;
    font-size: 12px;
}

.mpn-host-card {
    display: none;
    margin-top: 12px;
    border-color: rgba(255, 255, 255, 0.24);
}

.mpn-host-card.active {
    display: block;
}

.mpn-pin {
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(24px, 6vw, 46px);
    color: #fff;
    letter-spacing: 0.18em;
    text-shadow: 0 0 14px #00ffaa;
}

.mpn-game {
    z-index: 90;
    flex-direction: column;
    background: #000;
}

.mpn-game-top {
    height: 58px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 12px;
    color: #d9ffff;
    border-bottom: 1px solid rgba(0, 255, 170, 0.22);
    background: rgba(0, 0, 0, 0.82);
}

.mpn-game-status {
    font-size: 12px;
    color: #70cdbc;
}

.mpn-score-line {
    font-family: 'Orbitron', sans-serif;
    color: #fff;
    letter-spacing: 0.12em;
}

.mpn-red { color: #ff4d6a; }
.mpn-blue { color: #3a8aff; }
.mpn-white { color: #fff; }

.mpn-stage {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#mpnCanvas {
    width: min(100vw, calc(100vh * 1.58));
    height: min(calc(100vw / 1.58), calc(100vh - 70px));
    display: block;
    background: #000;
    touch-action: none;
    cursor: crosshair;
}

.mpn-help {
    position: absolute;
    left: 50%;
    bottom: 16px;
    transform: translateX(-50%);
    padding: 7px 12px;
    border: 1px solid rgba(0, 255, 170, 0.38);
    background: rgba(0, 0, 0, 0.72);
    color: #d9ffff;
    font-size: 12px;
    letter-spacing: 0.06em;
    pointer-events: none;
}

.mpn-score-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    opacity: 0;
    transform: scale(0.96);
    transition: opacity 260ms ease, transform 260ms ease;
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(46px, 11vw, 124px);
    letter-spacing: 0.08em;
    text-shadow: 0 0 18px rgba(255, 255, 255, 0.45);
}

.mpn-score-overlay.show {
    opacity: 1;
    transform: scale(1);
}

.mpn-end-overlay {
    position: absolute;
    inset: 0;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    background: rgba(0, 0, 0, 0.72);
}

.mpn-end-overlay.show {
    display: flex;
}

.mpn-end-text {
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(42px, 10vw, 110px);
    color: #fff;
    letter-spacing: 0.18em;
    text-shadow: 0 0 22px #00ffaa;
}

.mpn-trackpad {
    display: none;
}

@media (max-width: 780px), (pointer: coarse) {
    .mpn-grid {
        grid-template-columns: 1fr;
    }

    .mpn-panel {
        max-height: 96vh;
        padding: 14px;
    }

    .mpn-game-top {
        height: 52px;
        padding: 6px 8px;
    }

    .mpn-stage {
        flex: 0 0 auto;
        height: 52vh;
        align-items: flex-start;
        padding-top: 2px;
    }

    #mpnCanvas {
        width: 100vw;
        height: min(52vh, calc(100vw / 1.58));
    }

    .mpn-help {
        bottom: 6px;
        font-size: 11px;
    }

    .mpn-trackpad {
        display: block;
        flex: 1 1 auto;
        margin: 8px auto 12px;
        width: min(92vw, 560px);
        min-height: 118px;
        border: 1px solid rgba(0, 255, 170, 0.55);
        background:
            radial-gradient(circle at center, rgba(0, 255, 170, 0.16), rgba(0, 255, 170, 0.035) 45%, rgba(0, 0, 0, 0.45) 100%),
            linear-gradient(90deg, transparent 49.5%, rgba(255,255,255,0.18) 50%, transparent 50.5%),
            linear-gradient(0deg, transparent 49.5%, rgba(255,255,255,0.18) 50%, transparent 50.5%);
        box-shadow: inset 0 0 22px rgba(0, 255, 170, 0.12), 0 0 18px rgba(0, 255, 170, 0.14);
        touch-action: none;
        user-select: none;
        position: relative;
    }

    .mpn-trackpad::after {
        content: "TRACKPAD";
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        color: rgba(214, 255, 250, 0.26);
        font-family: 'Orbitron', sans-serif;
        letter-spacing: 0.18em;
        font-size: 12px;
        pointer-events: none;
    }
}
