/* OldGames Multiplayer Arena — single Command Deck theme (2026-08).
   Structural layout, host/player UI, dialogs and mobile controls live here.
   Do not add page-level multiplayer skins; extend this file instead. */

@import url("https://fonts.googleapis.com/css2?family=Orbitron:wght@600;700;800&family=Rajdhani:wght@500;600;700&display=swap");

:root {
    --mp-bg: #03050c;
    --mp-panel: rgba(10, 14, 27, .94);
    --mp-panel-2: rgba(16, 22, 39, .88);
    --mp-line: rgba(132, 154, 205, .18);
    --mp-line-strong: rgba(70, 224, 255, .4);
    --mp-text: #f5f8ff;
    --mp-muted: #8f9bb8;
    --mp-cyan: #43e6ff;
    --mp-blue: #5f8dff;
    --mp-lime: #91f7b5;
    --mp-amber: #ffc86b;
    --mp-danger: #ff6781;
    --mp-radius: 16px;
    --mp-shadow: 0 22px 62px rgba(0, 0, 0, .45);
}

html:has(.mp-game-container),
body.mp-host-mode,
body:has(.mp-game-container) {
    position: static !important;
    width: 100% !important;
    height: auto !important;
    min-height: 100%;
    margin: 0;
    background: var(--mp-bg);
}

body.mp-host-mode,
body:has(.mp-game-container) {
    overflow: hidden;
}

.mp-game-container {
    position: fixed;
    inset: 0;
    z-index: 2147481000;
    display: grid;
    grid-template-columns: clamp(184px, 14.5vw, 218px) minmax(0, 1fr) clamp(248px, 20vw, 296px);
    gap: 12px;
    width: 100%;
    height: 100dvh;
    padding: 12px;
    overflow: hidden;
    color: var(--mp-text);
    background:
        radial-gradient(900px 520px at 10% -10%, rgba(67, 230, 255, .12), transparent 62%),
        radial-gradient(780px 560px at 102% 10%, rgba(95, 141, 255, .12), transparent 64%),
        linear-gradient(180deg, #050817, var(--mp-bg));
    font-family: "Rajdhani", system-ui, -apple-system, sans-serif;
    box-sizing: border-box;
}

.mp-game-container *,
.mp-game-container *::before,
.mp-game-container *::after,
.mp-share-overlay *,
.mp-control-settings-overlay * {
    box-sizing: border-box;
}

.mp-game-container::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: .22;
    background-image:
        linear-gradient(rgba(132, 154, 205, .11) 1px, transparent 1px),
        linear-gradient(90deg, rgba(132, 154, 205, .11) 1px, transparent 1px);
    background-size: 48px 48px;
    -webkit-mask-image: radial-gradient(circle at 50% 40%, #000, transparent 78%);
            mask-image: radial-gradient(circle at 50% 40%, #000, transparent 78%);
}

.mp-game-container > * {
    position: relative;
    z-index: 1;
}

.mp-left-rail,
.mp-main-content,
.mp-right-rail {
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    border: 1px solid var(--mp-line);
    border-radius: 20px;
    background: linear-gradient(160deg, rgba(15, 20, 37, .96), rgba(6, 9, 18, .96));
    box-shadow: var(--mp-shadow), inset 0 1px 0 rgba(255, 255, 255, .045);
}

.mp-left-rail {
    display: grid;
    grid-template-rows: auto minmax(142px, 29vh) auto auto;
    align-content: start;
    gap: 11px;
    padding: 11px;
}

.mp-main-content {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto auto;
    gap: 11px;
    padding: 11px;
}

.mp-right-rail {
    display: grid;
    grid-template-rows: minmax(150px, 36%) minmax(0, 1fr);
    gap: 11px;
    padding: 11px;
}

.mp-room-brand,
.mp-game-info,
.mp-room-info,
.mp-mode-badge,
.mp-stat,
.mp-streaming-indicator,
.mp-action-dock,
.mp-players-section,
.mp-room-chat {
    border: 1px solid var(--mp-line);
    border-radius: var(--mp-radius);
    background: var(--mp-panel-2);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .035);
}

.mp-room-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 50px;
    padding: 8px;
}

.mp-room-brand::before {
    content: "OG";
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border-radius: 10px;
    color: #031018;
    background: linear-gradient(135deg, var(--mp-cyan), #79b9ff);
    box-shadow: 0 8px 22px rgba(67, 230, 255, .2);
    font: 800 .64rem/1 "Orbitron", sans-serif;
}

.mp-room-brand span {
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
    color: var(--mp-text);
    font: 800 .57rem/1.15 "Orbitron", sans-serif;
    letter-spacing: .06em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mp-room-brand strong {
    padding: 5px 6px;
    border: 1px solid rgba(145, 247, 181, .2);
    border-radius: 7px;
    color: var(--mp-lime);
    background: rgba(145, 247, 181, .06);
    font: 800 .48rem/1 "Orbitron", sans-serif;
    letter-spacing: .05em;
}

.mp-game-cover {
    position: relative;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    padding: 8px;
    border: 1px solid var(--mp-line);
    border-radius: 16px;
    background: rgba(3, 6, 14, .7);
}

.mp-game-cover img,
.mp-cover-image,
.mp-game-cover-placeholder,
.mp-cover-placeholder {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 0;
    border-radius: 11px;
    object-fit: contain;
    object-position: center;
    background: #0d1324;
}

.mp-game-cover img {
    padding: 7px;
    background:
        radial-gradient(circle at 50% 28%, rgba(67, 230, 255, .13), transparent 58%),
        linear-gradient(145deg, #0d1425, #050811);
}

.mp-game-cover img[hidden],
.mp-game-cover-placeholder[hidden] {
    display: none !important;
}

.mp-game-cover-placeholder,
.mp-cover-placeholder {
    display: grid;
    place-items: center;
    color: var(--mp-cyan);
    background: linear-gradient(135deg, rgba(67, 230, 255, .1), rgba(95, 141, 255, .12));
    font: 800 .72rem/1 "Orbitron", sans-serif;
}

.mp-game-cover-overlay {
    position: absolute;
    inset: auto 8px 8px;
    height: 34%;
    pointer-events: none;
    border-radius: 0 0 11px 11px;
    background: linear-gradient(transparent, rgba(3, 5, 12, .72));
}

.mp-game-info {
    min-width: 0;
    padding: 12px;
}

.mp-game-title {
    display: -webkit-box;
    overflow: hidden;
    margin: 0 0 8px;
    color: var(--mp-text);
    font-size: 1.08rem;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: 0;
    text-transform: none;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.mp-game-system {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 25px;
    padding: 0 8px;
    border: 1px solid rgba(67, 230, 255, .2);
    border-radius: 7px;
    color: var(--mp-cyan);
    background: rgba(67, 230, 255, .055);
    font-size: .62rem;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.mp-game-system span:first-child {
    color: var(--mp-muted);
    font-size: .52rem;
}

.mp-room-info {
    padding: 8px;
}

.mp-room-info .mp-btn { width: 100%; }

.mp-header {
    display: grid;
    grid-template-columns: minmax(175px, auto) minmax(0, 1fr) auto;
    align-items: stretch;
    gap: 9px;
    min-height: 64px;
}

.mp-mode-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 9px 11px;
}

.mp-mode-icon {
    display: grid;
    place-items: center;
    width: 37px;
    height: 37px;
    flex: 0 0 37px;
    border-radius: 11px;
    color: #031018;
    background: linear-gradient(135deg, var(--mp-cyan), #74b5ff);
    font: 800 .65rem/1 "Orbitron", sans-serif;
}

.mp-mode-icon.player {
    color: #fff;
    background: linear-gradient(135deg, var(--mp-blue), #885fff);
}

.mp-mode-text {
    color: var(--mp-text);
    font: 800 .75rem/1.1 "Orbitron", sans-serif;
}

.mp-mode-label {
    margin-top: 4px;
    color: var(--mp-muted);
    font-size: .7rem;
    line-height: 1;
}

.mp-header-stats,
.mp-session-panel {
    display: grid;
    grid-template-columns: repeat(4, minmax(62px, 1fr));
    gap: 7px;
    min-width: 0;
}

.mp-stat {
    display: grid;
    place-items: center;
    align-content: center;
    min-width: 0;
    padding: 7px;
    text-align: center;
}

.mp-stat-value {
    max-width: 100%;
    overflow: hidden;
    color: var(--mp-cyan);
    font: 800 .86rem/1 "Orbitron", sans-serif;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mp-stat-label {
    margin-top: 5px;
    color: var(--mp-muted);
    font-size: .56rem;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.mp-streaming-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-width: 76px;
    padding: 0 10px;
    color: var(--mp-muted);
    font: 800 .57rem/1 "Orbitron", sans-serif;
    letter-spacing: .06em;
}

.mp-streaming-dot,
.mp-player-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--mp-lime);
    box-shadow: 0 0 10px rgba(145, 247, 181, .62);
}

.mp-streaming-indicator.is-online {
    color: var(--mp-lime);
    border-color: rgba(145, 247, 181, .24);
    background: rgba(145, 247, 181, .055);
}

.mp-streaming-indicator.is-offline {
    color: var(--mp-muted);
}

.mp-streaming-indicator.is-offline .mp-streaming-dot {
    background: #65708a;
    box-shadow: none;
}

.mp-game-display {
    min-width: 0;
    min-height: 0;
    display: grid;
    place-items: center;
    overflow: hidden;
    padding: 9px;
    border: 1px solid var(--mp-line);
    border-radius: 18px;
    background: rgba(2, 4, 10, .78);
    box-shadow: inset 0 0 34px rgba(67, 230, 255, .04);
}

.mp-video-wrapper {
    position: relative;
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    border: 1px solid rgba(67, 230, 255, .2);
    border-radius: 13px;
    background: #000;
}

.mp-video-wrapper::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 8;
    pointer-events: none;
    border-radius: inherit;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .025), inset 0 0 52px rgba(67, 230, 255, .035);
}

#mp-stream-video,
.mp-video-wrapper video,
.mp-host-emulator-shell,
#mp-host-emulator-slot,
#mp-host-emulator-slot #game-display-area,
#mp-host-emulator-slot #game,
#mp-host-emulator-slot canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    object-fit: contain !important;
    background: #000 !important;
}

/* The solo-player skin applies a late #game#game aspect-ratio rule. Inside
   multiplayer that rule shrank the EmulatorJS shell while its toolbar kept
   overflowing, cutting off both the image and controls on notebooks. The
   arena owns this slot and allocates the full remaining track explicitly. */
html.nexus-player-active body.nexus-exact-player.game-active:has(.mp-arena-v6) #mp-host-emulator-slot #game-display-area#game-display-area {
    position: absolute !important;
    top: 0 !important;
    right: auto !important;
    bottom: auto !important;
    left: 0 !important;
    display: grid !important;
    grid-template-rows: 36px minmax(0, 1fr) !important;
    gap: 0 !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
}

html.nexus-player-active body.nexus-exact-player.game-active:has(.mp-arena-v6) #mp-host-emulator-slot #nexus-live-hud {
    grid-row: 1 !important;
    width: 100% !important;
    height: 36px !important;
    min-height: 36px !important;
    margin: 0 !important;
    border-radius: 0 !important;
}

body.mp-host-mode:has(.mp-arena-v6) #mp-host-emulator-slot #arcade-status-bar {
    display: none !important;
}

/* Arcade-family multiplayer deliberately waits for a real click so FBNeo,
   FBA and MAME can unlock audio before their first frame. EJS_ready moves the
   start button here; keep the gate visible until the click starts the core. */
body.mp-host-mode:has(.mp-arena-v6) #mp-host-emulator-slot #arcade-status-bar.og-arcade-start-gate {
    position: absolute !important;
    inset: 36px 0 0 !important;
    z-index: 10000 !important;
    display: flex !important;
    min-height: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: rgba(2, 5, 14, 0.92) !important;
}

body.mp-host-mode #arcade-status-bar.og-arcade-start-gate > :not(.ejs_start_button) {
    display: none !important;
}

html.nexus-player-active body.nexus-exact-player.game-active:has(.mp-arena-v6) #mp-host-emulator-slot #game#game {
    grid-row: 2 !important;
    place-self: stretch !important;
    flex: 1 1 auto !important;
    width: calc(100% - 16px) !important;
    height: calc(100% - 8px) !important;
    max-width: none !important;
    max-height: none !important;
    min-width: 0 !important;
    min-height: 0 !important;
    margin: 0 8px 8px !important;
    aspect-ratio: auto !important;
    border-radius: 12px !important;
    contain: layout paint !important;
}

body.mp-host-mode:has(.mp-arena-v6) #mp-host-emulator-slot #game .ejs_canvas_parent,
body.mp-host-mode:has(.mp-arena-v6) #mp-host-emulator-slot #game canvas.ejs_canvas {
    width: 100% !important;
    height: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    object-fit: contain !important;
    background: #000 !important;
}

/* Native controls are represented in the arena dock. Keeping the EmulatorJS
   menu visible created a second toolbar whose wide buttons escaped the frame. */
body.mp-host-mode:has(.mp-arena-v6) #mp-host-emulator-slot #game .ejs_menu_bar {
    display: none !important;
}

.mp-host-emulator-shell {
    position: relative;
}

.mp-connecting-overlay {
    position: absolute;
    inset: 0;
    z-index: 12;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 10px;
    padding: 20px;
    color: var(--mp-text);
    background: rgba(3, 6, 14, .88);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    text-align: center;
}

.mp-connecting-overlay.hidden,
.mp-connecting-overlay.is-hidden { display: none; }

.mp-spinner {
    width: 34px;
    height: 34px;
    border: 3px solid rgba(67, 230, 255, .14);
    border-top-color: var(--mp-cyan);
    border-radius: 50%;
    animation: mpSpin .8s linear infinite;
}

@keyframes mpSpin { to { transform: rotate(360deg); } }

.mp-connecting-text {
    color: var(--mp-text);
    font: 800 .78rem/1.2 "Orbitron", sans-serif;
}

.mp-connecting-room {
    color: var(--mp-muted);
    font-size: .76rem;
}

.mp-action-dock {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 7px;
    min-width: 0;
    padding: 8px;
}

.mp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-width: 0;
    min-height: 45px;
    padding: 7px 9px;
    border: 1px solid var(--mp-line);
    border-radius: 10px;
    color: var(--mp-text);
    background: rgba(255, 255, 255, .035);
    box-shadow: none;
    cursor: pointer;
    font-family: "Rajdhani", system-ui, sans-serif;
    font-weight: 800;
    transition: border-color .16s ease, background .16s ease, transform .16s ease, filter .16s ease;
}

.mp-btn:hover:not(:disabled) {
    border-color: var(--mp-line-strong);
    background: rgba(67, 230, 255, .075);
    transform: translateY(-1px);
}

.mp-btn:disabled,
.mp-btn-loading {
    cursor: wait;
    opacity: .62;
}

.mp-btn span:first-child {
    display: grid;
    place-items: center;
    min-width: 31px;
    height: 21px;
    padding: 0 5px;
    border-radius: 6px;
    color: var(--mp-cyan);
    background: rgba(67, 230, 255, .09);
    font: 800 .48rem/1 "Orbitron", sans-serif;
}

.mp-btn span:last-child {
    min-width: 0;
    overflow: hidden;
    font-size: .73rem;
    line-height: 1;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mp-btn-primary {
    color: #031018;
    border-color: transparent;
    background: linear-gradient(135deg, var(--mp-cyan), #77b7ff);
    box-shadow: 0 10px 24px rgba(67, 230, 255, .17);
}

.mp-btn-primary:hover:not(:disabled) {
    border-color: transparent;
    background: linear-gradient(135deg, #75eeff, #91c7ff);
    filter: brightness(1.04);
}

.mp-btn-primary span:first-child,
.mp-btn-primary span:last-child { color: #031018; }
.mp-btn-primary span:first-child { background: rgba(255, 255, 255, .3); }

.mp-btn-danger {
    border-color: rgba(255, 103, 129, .28);
    color: #ffdbe2;
    background: rgba(255, 103, 129, .075);
}

.mp-btn-danger:hover:not(:disabled) {
    border-color: rgba(255, 103, 129, .55);
    background: rgba(255, 103, 129, .13);
}

.mp-btn-danger span:first-child {
    color: var(--mp-danger);
    background: rgba(255, 103, 129, .1);
}

.mp-save-file-btn span:first-child,
.mp-load-file-btn span:first-child {
    color: var(--mp-amber);
    background: rgba(255, 200, 107, .09);
}

.mp-players-section,
.mp-room-chat {
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    padding: 11px;
}

.mp-players-section {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
}

.mp-room-chat {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
}

.mp-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 28px;
    margin-bottom: 8px;
    color: var(--mp-text);
    font: 800 .64rem/1 "Orbitron", sans-serif;
    letter-spacing: .07em;
    text-transform: uppercase;
}

.mp-section-title::before {
    content: "";
    width: 7px;
    height: 7px;
    flex: 0 0 7px;
    border-radius: 3px;
    background: var(--mp-cyan);
    box-shadow: 0 0 10px rgba(67, 230, 255, .5);
}

.mp-section-title::after {
    content: "";
    flex: 1 1 auto;
    height: 1px;
    background: linear-gradient(90deg, var(--mp-line), transparent);
}

#mp-players-list {
    min-height: 0;
    overflow: auto;
}

.mp-player-card,
.mp-player-card-placeholder {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 9px;
    align-items: center;
    min-width: 0;
    min-height: 54px;
    margin-bottom: 7px;
    padding: 8px;
    border: 1px solid var(--mp-line);
    border-radius: 11px;
    background: rgba(255, 255, 255, .028);
}

.mp-player-card.is-host { border-color: rgba(255, 200, 107, .22); }
.mp-player-card.is-you { border-color: rgba(67, 230, 255, .26); }
.mp-player-card.mp-empty-slot { opacity: .55; border-style: dashed; }
.mp-player-card-placeholder { display: block; color: var(--mp-muted); text-align: center; }

.mp-player-avatar {
    position: relative;
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    overflow: visible;
    border: 1px solid rgba(67, 230, 255, .3);
    border-radius: 11px;
    color: #031018;
    background: linear-gradient(135deg, var(--mp-cyan), #78b8ff);
    font: 800 .64rem/1 "Orbitron", sans-serif;
}

.mp-player-avatar img {
    width: 100%;
    height: 100%;
    border-radius: inherit;
    object-fit: cover;
}

.mp-player-status-dot {
    position: absolute;
    right: -2px;
    bottom: -2px;
    width: 9px;
    height: 9px;
    border: 2px solid #0a0e1b;
}

.mp-player-info,
.mp-player-name,
.mp-player-meta { min-width: 0; }

.mp-player-name {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--mp-text);
    font-size: .82rem;
    font-weight: 800;
}

.mp-player-name > span:first-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mp-player-badge {
    flex: 0 0 auto;
    min-height: 18px;
    padding: 0 5px;
    border: 1px solid rgba(67, 230, 255, .2);
    border-radius: 5px;
    color: var(--mp-cyan);
    background: rgba(67, 230, 255, .06);
    font: 800 .44rem/18px "Orbitron", sans-serif;
}

.mp-badge-host {
    color: var(--mp-amber);
    border-color: rgba(255, 200, 107, .22);
    background: rgba(255, 200, 107, .06);
}

.mp-player-meta {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-top: 4px;
    color: var(--mp-muted);
    font-size: .67rem;
}

.mp-player-ping { display: inline-flex; align-items: center; gap: 3px; }
.mp-ping-good { color: var(--mp-lime); }
.mp-ping-medium,
.mp-ping-ok { color: var(--mp-amber); }
.mp-ping-poor,
.mp-ping-bad { color: var(--mp-danger); }

.mp-chat-messages {
    min-height: 130px;
    overflow: auto;
    padding: 7px;
    border: 1px solid var(--mp-line);
    border-radius: 11px;
    background: rgba(2, 4, 10, .48);
}

.mp-chat-empty {
    display: grid;
    place-items: center;
    min-height: 100%;
    color: var(--mp-muted);
    font-size: .72rem;
    text-align: center;
}

.mp-chat-message {
    margin-bottom: 7px;
    padding: 8px 9px;
    border: 1px solid var(--mp-line);
    border-left: 2px solid var(--mp-cyan);
    border-radius: 9px;
    background: rgba(255, 255, 255, .032);
}

.mp-chat-message.is-self {
    border-left-color: var(--mp-lime);
    background: rgba(145, 247, 181, .045);
}

.mp-chat-message.is-system {
    border-left-color: var(--mp-amber);
    background: rgba(255, 200, 107, .045);
}

.mp-chat-meta {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    color: var(--mp-muted);
    font-size: .62rem;
}

.mp-chat-text {
    margin-top: 4px;
    overflow-wrap: anywhere;
    color: var(--mp-text);
    font-size: .76rem;
    line-height: 1.3;
}

.mp-chat-input-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 70px;
    gap: 7px;
    margin-top: 8px;
}

.mp-chat-input,
.mp-share-input {
    width: 100%;
    min-width: 0;
    height: 40px;
    padding: 0 11px;
    border: 1px solid var(--mp-line);
    border-radius: 10px;
    outline: 0;
    color: var(--mp-text);
    background: rgba(2, 4, 10, .68);
    font: 600 .86rem/1 "Rajdhani", system-ui, sans-serif;
}

.mp-chat-input:focus,
.mp-share-input:focus {
    border-color: var(--mp-cyan);
    box-shadow: 0 0 0 3px rgba(67, 230, 255, .1);
}

.mp-chat-send,
.mp-copy-btn {
    min-width: 0;
    height: 40px;
    border: 0;
    border-radius: 10px;
    color: #031018;
    background: linear-gradient(135deg, var(--mp-cyan), #76b7ff);
    cursor: pointer;
    font: 800 .57rem/1 "Orbitron", sans-serif;
}

.mp-share-overlay,
.mp-control-settings-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    place-items: center;
    padding: 18px;
    color: var(--mp-text);
    background: rgba(2, 4, 10, .82);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    font-family: "Rajdhani", system-ui, sans-serif;
}

.mp-share-overlay.active,
.mp-share-overlay.show,
.mp-control-settings-overlay.active,
.mp-control-settings-overlay.show { display: grid; }

.mp-share-modal,
.mp-control-settings-modal {
    width: min(620px, 100%);
    max-height: calc(100dvh - 36px);
    overflow: auto;
    padding: 20px;
    border: 1px solid var(--mp-line-strong);
    border-radius: 20px;
    background: linear-gradient(160deg, #11182c, #080b16);
    box-shadow: 0 34px 90px rgba(0, 0, 0, .7);
}

.mp-share-title,
.mp-control-settings-title h3 {
    margin: 0;
    color: var(--mp-text);
    font: 800 .92rem/1.2 "Orbitron", sans-serif;
}

.mp-share-subtitle,
.mp-control-settings-title span,
.mp-hint-text {
    display: block;
    margin-top: 7px;
    color: var(--mp-muted);
    font-size: .78rem;
    line-height: 1.4;
}

.mp-share-link {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 74px;
    gap: 8px;
    margin: 16px 0 12px;
}

.mp-share-qr {
    display: grid;
    place-items: center;
    min-height: 104px;
    margin-bottom: 12px;
    border: 1px dashed var(--mp-line);
    border-radius: 13px;
    color: var(--mp-cyan);
    background: rgba(67, 230, 255, .045);
    font: 800 .75rem/1 "Orbitron", sans-serif;
}

.mp-control-settings-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.mp-controller-status,
.mp-mapping-info-bar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    margin: 14px 0;
    padding: 11px;
    border: 1px solid var(--mp-line);
    border-radius: 12px;
    background: rgba(255, 255, 255, .03);
}

.mp-controller-status-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--mp-lime);
    box-shadow: 0 0 9px rgba(145, 247, 181, .55);
}

.mp-controller-status-info { min-width: 0; }
.mp-controller-status-info strong { display: block; font-size: .82rem; }
.mp-controller-status-info span { display: block; margin-top: 3px; color: var(--mp-muted); font-size: .7rem; }
.mp-controller-rescan { min-height: 35px; }

.mp-binding-list {
    display: grid;
    gap: 7px;
    margin-top: 12px;
}

.mp-binding-item,
.mp-binding-row {
    display: grid;
    grid-template-columns: minmax(105px, 1fr) minmax(0, 1.5fr) auto;
    gap: 9px;
    align-items: center;
    min-height: 52px;
    padding: 8px 10px;
    border: 1px solid var(--mp-line);
    border-radius: 11px;
    background: rgba(255, 255, 255, .025);
}

.mp-binding-label,
.mp-binding-info { min-width: 0; }
.mp-binding-label-title { color: var(--mp-text); font-size: .78rem; font-weight: 800; }
.mp-binding-label-value,
.mp-binding-sub { margin-top: 3px; color: var(--mp-muted); font-size: .66rem; }
.mp-binding-actions { display: flex; gap: 6px; }

.mp-binding-btn,
.mp-binding-clear,
.mp-key,
.mp-control-key {
    min-height: 32px;
    padding: 0 9px;
    border: 1px solid var(--mp-line);
    border-radius: 8px;
    color: var(--mp-text);
    background: rgba(255, 255, 255, .04);
    cursor: pointer;
    font: 800 .65rem/1 "Rajdhani", system-ui, sans-serif;
}

.mp-binding-btn-keyboard { border-color: rgba(67, 230, 255, .25); }
.mp-binding-btn-controller { border-color: rgba(95, 141, 255, .3); }
.mp-binding-clear { color: var(--mp-danger); }

.mp-mapping-info-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.mp-mapping-info-title { color: var(--mp-text); font-size: .75rem; font-weight: 800; }

.mp-control-settings-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 15px;
    padding-top: 13px;
    border-top: 1px solid var(--mp-line);
}

.mp-notification {
    position: fixed;
    top: 18px;
    left: 50%;
    z-index: 2147483600;
    max-width: min(440px, calc(100vw - 28px));
    padding: 11px 15px;
    border: 1px solid var(--mp-line-strong);
    border-radius: 11px;
    color: var(--mp-text);
    background: #10172a;
    box-shadow: 0 18px 44px rgba(0, 0, 0, .5);
    transform: translateX(-50%);
    font-weight: 700;
}

.mp-video-wrapper:fullscreen,
.mp-video-wrapper:-webkit-full-screen,
.mp-video-fullscreen-fallback {
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    max-height: none !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: #000 !important;
}

.mp-fullscreen-exit-btn {
    position: fixed;
    top: max(12px, env(safe-area-inset-top));
    right: max(12px, env(safe-area-inset-right));
    z-index: 2147483640;
}

/* Emulator controls keep a predictable position after the host UI is moved
   into the shared arena. The FPS badge is duplicated by the arena metrics. */
.mp-host-layout .fullscreen-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 40;
}

.mp-host-layout #fps-display { display: none !important; }

/* N64 host keeps the complete 4:3 image inside the shared arena. */
body.mp-n64wasm-host #mp-host-emulator-slot {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #000;
}

body.mp-n64wasm-host #game {
    flex: 0 1 auto !important;
    width: auto !important;
    height: 100% !important;
    max-width: 100% !important;
    aspect-ratio: 4 / 3;
    margin: 0 auto !important;
    overflow: hidden !important;
    background: #000 !important;
}

body.mp-n64wasm-host #middleDiv,
body.mp-n64wasm-host #canvasDiv {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    background: #000 !important;
}

body.mp-n64wasm-host #canvasDiv[style*="display: none"] {
    display: flex !important;
}

body.mp-n64wasm-host #canvas {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    background: #000 !important;
}

body.mp-n64wasm-host #topPanel,
body.mp-n64wasm-host #maindiv,
body.mp-n64wasm-host #bottomPanel,
body.mp-n64wasm-host #lblErrorOuter,
body.mp-n64wasm-host .og-n64-hero,
body.mp-n64wasm-host .github-link,
body.mp-n64wasm-host .github-logo,
body.mp-n64wasm-host .hudbar,
body.mp-n64wasm-host #nexus-live-hud,
body.mp-n64wasm-host .arcade-action-dock,
body.mp-n64wasm-host #arcade-player-header,
body.mp-n64wasm-host #game-sidebar { display: none !important; }

/* Remote N64 stream: preserve the entire image instead of zooming/cropping. */
body.mp-n64-joiner .mp-video-wrapper {
    aspect-ratio: 4 / 3;
    width: min(100%, 94vh);
    height: auto;
    max-height: calc(100dvh - 180px);
}

body.mp-n64-joiner #mp-stream-video { object-fit: contain !important; }

/* The arena already exposes Controls in its action dock. */
body:has(.mp-arena-v6) #mpc-fab { display: none !important; }

/* Touch controller for joiners. It is hidden on pointer-precise desktops. */
.arcade-pad {
    display: none;
    position: static;
    inset: auto;
    z-index: auto;
    min-width: 0;
    margin: 0;
    padding: 8px;
    border: 1px solid var(--mp-line);
    border-radius: var(--mp-radius);
    background: var(--mp-panel-2);
    box-shadow: none;
    pointer-events: auto;
    touch-action: none;
}

.arcade-surface {
    display: grid;
    grid-template-columns: minmax(112px, 1fr) auto minmax(150px, 1.15fr);
    gap: 14px;
    align-items: center;
    width: auto;
    max-width: none;
    height: auto;
    margin: 0;
}

.arcade-stick-zone {
    display: grid;
    place-items: center;
    width: auto;
    height: auto;
    min-height: 128px;
    touch-action: none;
}

.arcade-stick-base {
    position: relative;
    width: 112px;
    height: 112px;
    border: 1px solid rgba(67, 230, 255, .25);
    border-radius: 50%;
    background: radial-gradient(circle, rgba(67, 230, 255, .08), rgba(0, 0, 0, .42));
}

.arcade-stick-gate {
    position: absolute;
    inset: 19px;
    border: 1px dashed rgba(255, 255, 255, .12);
    border-radius: 22px;
    transform: rotate(45deg);
}

.arcade-stick-knob {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 48px;
    height: 48px;
    border: 2px solid rgba(255, 255, 255, .18);
    border-radius: 50%;
    background: linear-gradient(135deg, var(--mp-cyan), var(--mp-blue));
    box-shadow: 0 8px 22px rgba(67, 230, 255, .2);
    transform: translate(-50%, -50%);
}

.arcade-meta {
    display: grid;
    gap: 7px;
}

.arcade-meta-btn,
.arcade-btn {
    border: 1px solid var(--mp-line);
    color: var(--mp-text);
    background: rgba(255, 255, 255, .045);
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

.arcade-meta-btn {
    min-width: 62px;
    min-height: 34px;
    border-radius: 9px;
    font: 800 .54rem/1 "Orbitron", sans-serif;
}

.arcade-buttons {
    display: grid;
    grid-template-columns: repeat(2, 62px);
    gap: 10px;
    justify-content: end;
}

.arcade-btn {
    width: 62px;
    height: 62px;
    border-radius: 50%;
    font: 800 .9rem/1 "Orbitron", sans-serif;
}

.arcade-btn:active,
.arcade-btn.is-active,
.arcade-meta-btn:active,
.arcade-meta-btn.is-active {
    border-color: var(--mp-cyan);
    background: rgba(67, 230, 255, .16);
    transform: scale(.96);
}

.meta-dot {
    display: inline-block;
    width: 5px;
    height: 5px;
    margin-right: 4px;
    border-radius: 50%;
    background: var(--mp-lime);
}

.mp-game-container :focus-visible,
.mp-share-overlay :focus-visible,
.mp-control-settings-overlay :focus-visible {
    outline: 2px solid var(--mp-cyan);
    outline-offset: 2px;
}

.mp-game-container *,
.mp-share-overlay *,
.mp-control-settings-overlay * {
    scrollbar-width: thin;
    scrollbar-color: rgba(67, 230, 255, .34) rgba(255, 255, 255, .04);
}

@media (max-width: 1180px) and (min-width: 1025px) {
    .mp-game-container { grid-template-columns: 176px minmax(0, 1fr) 240px; gap: 9px; padding: 9px; }
    .mp-left-rail,
    .mp-main-content,
    .mp-right-rail { border-radius: 17px; }
    .mp-header { grid-template-columns: minmax(155px, auto) minmax(0, 1fr); }
    .mp-streaming-indicator { grid-column: 1 / -1; min-height: 30px; }
    .mp-mode-label { display: none; }
}

@media (max-width: 1024px) {
    html:has(.mp-game-container),
    body.mp-host-mode,
    body:has(.mp-game-container) {
        position: static !important;
        width: 100% !important;
        height: auto !important;
        min-height: 100dvh !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        touch-action: pan-y !important;
    }

    body.mp-host-mode,
    body:has(.mp-game-container) { overflow: auto; }
    .mp-game-container {
        position: relative !important;
        inset: auto !important;
        grid-template-columns: minmax(0, 1fr);
        height: auto !important;
        min-height: 100dvh !important;
        overflow: visible !important;
        padding: 9px;
    }
    .mp-main-content {
        order: 1;
        display: flex;
        flex-direction: column;
        min-height: 0;
        overflow: visible;
    }
    .mp-game-display {
        flex: 0 0 auto;
        width: 100%;
        min-height: 0;
        aspect-ratio: 4 / 3;
    }
    body[data-mp-system="nds"] .mp-game-display,
    body[data-mp-system="melonds"] .mp-game-display {
        aspect-ratio: 2 / 3;
    }
    .mp-video-wrapper { min-height: 0; }
    .mp-left-rail {
        order: 2;
        grid-template-columns: auto 76px minmax(0, 1fr) minmax(116px, auto);
        grid-template-rows: 76px;
        align-items: stretch;
    }
    .mp-right-rail {
        order: 3;
        grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr);
        grid-template-rows: minmax(260px, auto);
    }
    .mp-room-brand { min-width: 150px; }
    .mp-room-brand strong { display: none; }
    .mp-game-cover { padding: 4px; }
    .mp-game-info { display: grid; align-content: center; }
    .mp-room-info { display: grid; align-content: center; }
    .mp-action-dock { display: flex; overflow-x: auto; }
    .mp-action-dock .mp-btn { flex: 0 0 112px; }
    .mp-chat-messages { min-height: 210px; }
    body.mp-n64-joiner .mp-video-wrapper { width: min(100%, 76vh); max-height: 58dvh; }

    body.mp-host-mode #mobileControls.mobile-gamepad,
    body.mp-host-mode #emuArcadeMobilePad.arcade-pad {
        position: relative !important;
        inset: auto !important;
        z-index: 3 !important;
        width: 100% !important;
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        margin: 0 !important;
    }

    html body.emulator-page.mp-host-mode:has(.mp-arena-v6) #mobileControls.mobile-gamepad.og-pad-owned {
        position: relative !important;
        top: auto !important;
        right: auto !important;
        bottom: auto !important;
        left: auto !important;
        z-index: 3 !important;
        width: 100% !important;
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        margin: 0 !important;
    }
}

@media (max-width: 680px) {
    .mp-main-content { min-height: 0; padding: 8px; }
    .mp-header { grid-template-columns: minmax(0, 1fr); }
    .mp-header-stats,
    .mp-session-panel { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .mp-streaming-indicator { grid-column: auto; min-height: 34px; }
    .mp-left-rail {
        grid-template-columns: 68px minmax(0, 1fr);
        grid-template-rows: 68px auto;
    }
    .mp-room-brand { display: none; }
    .mp-game-cover { grid-row: 1 / 3; }
    .mp-room-info { padding: 0; border: 0; background: transparent; }
    .mp-right-rail { grid-template-columns: 1fr; grid-template-rows: auto minmax(310px, auto); }
    .mp-video-wrapper { min-height: 0; }
    .mp-action-dock {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        overflow: visible;
    }
    .mp-action-dock .mp-btn { flex: initial; }
    .mp-btn span:last-child { font-size: .68rem; }
    .arcade-pad { display: block; }
    .arcade-surface { grid-template-columns: minmax(104px, 1fr) auto minmax(130px, 1fr); gap: 8px; }
    .arcade-stick-base { width: 100px; height: 100px; }
    .arcade-buttons { grid-template-columns: repeat(2, 54px); gap: 8px; }
    .arcade-btn { width: 54px; height: 54px; }
    .arcade-meta-btn { min-width: 56px; }
    .mp-binding-item,
    .mp-binding-row { grid-template-columns: minmax(0, 1fr); }
    .mp-binding-actions { flex-wrap: wrap; }
}

@media (pointer: coarse) {
    .arcade-pad { display: block; }
    .mp-btn,
    .mp-chat-send,
    .mp-copy-btn { min-height: 44px; }
}

/* Explicit mobile QA/embedded mode. This also wins over the legacy emulator
   skin rule that hides its own arcade controller on precise pointers. */
body.arcade-player-ui.mp-touch-controls #mpPlayerArcadePad {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

@media (orientation: landscape) and (max-height: 560px) and (pointer: coarse) {
    .mp-game-container {
        grid-template-columns: minmax(0, 1fr) 250px;
        min-height: 100dvh;
        padding: 6px;
    }
    .mp-main-content { order: 1; min-height: calc(100dvh - 12px); }
    .mp-left-rail { display: none; }
    .mp-right-rail { order: 2; grid-template-columns: 1fr; grid-template-rows: 42% minmax(0, 1fr); }
    .mp-header { display: none; }
    .mp-main-content { grid-template-rows: minmax(0, 1fr) auto auto; }
    .mp-video-wrapper { min-height: 0; }
    .mp-action-dock { padding: 6px; }
    .mp-action-dock .mp-btn { min-height: 38px; flex-basis: 98px; }
    .arcade-pad { padding: 5px; }
    .arcade-stick-zone { min-height: 94px; }
    .arcade-stick-base { width: 88px; height: 88px; }
    .arcade-buttons { grid-template-columns: repeat(4, 46px); }
    .arcade-btn { width: 46px; height: 46px; }
}

@media (prefers-reduced-motion: reduce) {
    .mp-game-container *,
    .mp-game-container *::before,
    .mp-game-container *::after,
    .mp-share-overlay *,
    .mp-control-settings-overlay * {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}

/* ================================================================
   ROOM STUDIO v7 — social-first multiplayer room
   A distinct, Discord-inspired structure without copying its branding.
   ================================================================ */

:root {
    --mp-bg: #050611;
    --mp-panel: rgba(12, 13, 27, .96);
    --mp-panel-2: rgba(20, 22, 42, .78);
    --mp-line: rgba(163, 174, 255, .15);
    --mp-line-strong: rgba(92, 232, 255, .42);
    --mp-text: #f7f7ff;
    --mp-muted: #949bb8;
    --mp-cyan: #5ce8ff;
    --mp-blue: #7b86ff;
    --mp-violet: #a871ff;
    --mp-lime: #77f2b0;
    --mp-radius: 18px;
}

.mp-game-container.mp-arena-v6 {
    grid-template-columns: clamp(210px, 16vw, 264px) minmax(520px, 1fr) clamp(300px, 22vw, 360px);
    gap: 10px;
    padding: 10px;
    background:
        radial-gradient(900px 620px at 47% -24%, rgba(120, 92, 255, .22), transparent 62%),
        radial-gradient(620px 520px at 102% 46%, rgba(55, 221, 255, .12), transparent 72%),
        linear-gradient(145deg, #090a18 0%, #050611 58%, #080c17 100%);
}

.mp-game-container.mp-arena-v6::before {
    opacity: .32;
    background-image:
        radial-gradient(circle at center, rgba(255,255,255,.13) 0 1px, transparent 1.3px),
        linear-gradient(rgba(128, 143, 214, .055) 1px, transparent 1px),
        linear-gradient(90deg, rgba(128, 143, 214, .055) 1px, transparent 1px);
    background-size: 28px 28px, 56px 56px, 56px 56px;
}

.mp-arena-v6 .mp-left-rail,
.mp-arena-v6 .mp-main-content,
.mp-arena-v6 .mp-right-rail {
    border-color: rgba(168, 178, 255, .14);
    border-radius: 22px;
    background: linear-gradient(165deg, rgba(20, 22, 42, .97), rgba(7, 8, 18, .98));
    box-shadow: 0 24px 80px rgba(0,0,0,.5), inset 0 1px rgba(255,255,255,.045);
}

.mp-arena-v6 .mp-left-rail {
    grid-template-rows: auto minmax(120px, 25vh) auto minmax(118px, auto) auto;
    gap: 9px;
    padding: 9px;
}

.mp-arena-v6 .mp-main-content {
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 9px;
    padding: 9px;
}

/* The side rails already expose player count, connection and audio state.
   Removing the duplicated summary strip gives the game the full-height stage
   on both host and guest layouts. Runtime nodes stay mounted for JS updates. */
.mp-arena-v6 .mp-header {
    display: none !important;
}

.mp-arena-v6 .mp-right-rail {
    grid-template-rows: minmax(170px, 38%) minmax(0, 1fr);
    gap: 9px;
    padding: 9px;
}

.mp-arena-v6 .mp-room-brand {
    position: relative;
    min-height: 58px;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.mp-arena-v6 .mp-room-brand::before {
    width: 40px;
    height: 40px;
    flex-basis: 40px;
    border-radius: 14px;
    background: linear-gradient(140deg, #72efff 0%, #8d7cff 68%, #bb6cff 100%);
    box-shadow: 0 10px 28px rgba(123, 134, 255, .35);
}

.mp-arena-v6 .mp-room-brand strong {
    color: #aefbd0;
    border-color: rgba(119,242,176,.22);
    background: rgba(119,242,176,.08);
}

.mp-arena-v6 .mp-game-cover,
.mp-arena-v6 .mp-game-info,
.mp-arena-v6 .mp-room-info,
.mp-arena-v6 .mp-mode-badge,
.mp-arena-v6 .mp-stat,
.mp-arena-v6 .mp-streaming-indicator,
.mp-arena-v6 .mp-action-dock,
.mp-arena-v6 .mp-players-section,
.mp-arena-v6 .mp-room-chat,
.mp-voice-channel {
    border-color: rgba(167,178,255,.14);
    background: linear-gradient(150deg, rgba(30,33,60,.72), rgba(14,16,32,.82));
}

.mp-arena-v6 .mp-game-display {
    overflow: hidden;
    padding: 6px;
    border: 1px solid rgba(92,232,255,.23);
    border-radius: 24px;
    background: linear-gradient(145deg, rgba(92,232,255,.13), rgba(168,113,255,.12));
    box-shadow: 0 26px 70px rgba(0,0,0,.45), 0 0 0 1px rgba(255,255,255,.025) inset;
}

.mp-arena-v6 .mp-video-wrapper {
    border-radius: 18px;
    background: #020307;
}

.mp-arena-v6 .mp-action-dock {
    padding: 7px;
    border-radius: 18px;
    background: rgba(15,17,34,.9);
    scrollbar-color: rgba(92,232,255,.34) transparent;
}

.mp-arena-v6 .mp-btn {
    border-radius: 12px;
    transition: transform .18s ease, border-color .18s ease, background .18s ease, box-shadow .18s ease;
}

.mp-arena-v6 .mp-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    border-color: rgba(92,232,255,.45);
    box-shadow: 0 10px 26px rgba(0,0,0,.28);
}

.mp-arena-v6 .mp-btn-primary {
    color: #07121a;
    background: linear-gradient(135deg, #5ce8ff, #8bb2ff 55%, #b58cff);
}

.mp-arena-v6 .mp-section-title {
    min-height: 38px;
    color: #d8dcff;
    letter-spacing: .08em;
}

.mp-arena-v6 .mp-section-title::before {
    background: linear-gradient(#5ce8ff, #a871ff);
    box-shadow: 0 0 14px rgba(92,232,255,.62);
}

.mp-arena-v6 .mp-player-card {
    border-radius: 14px;
    background: rgba(8,10,23,.56);
}

.mp-arena-v6 .mp-player-card.is-host,
.mp-arena-v6 .mp-player-card.is-you {
    border-color: rgba(92,232,255,.32);
    background: linear-gradient(130deg, rgba(92,232,255,.09), rgba(123,134,255,.08));
}

.mp-arena-v6 .mp-room-chat {
    background: linear-gradient(165deg, rgba(21,24,45,.9), rgba(7,9,19,.96));
}

.mp-arena-v6 .mp-chat-messages {
    border-color: rgba(167,178,255,.1);
    background:
        radial-gradient(420px 260px at 50% 100%, rgba(123,134,255,.08), transparent 68%),
        rgba(4,6,14,.7);
}

.mp-arena-v6 .mp-chat-input-row {
    padding: 6px;
    border: 1px solid rgba(167,178,255,.14);
    border-radius: 14px;
    background: rgba(5,7,16,.72);
}

.mp-arena-v6 .mp-chat-input {
    border: 0;
    background: transparent;
}

.mp-arena-v6 .mp-chat-send {
    border-radius: 10px;
    background: linear-gradient(135deg, #5ce8ff, #8d7cff);
}

/* Voice channel */
.mp-voice-channel {
    --voice-level: 0;
    position: relative;
    isolation: isolate;
    min-width: 0;
    overflow: hidden;
    padding: 8px;
    border: 1px solid var(--mp-line);
    border-radius: 16px;
    transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}

.mp-voice-channel::before {
    content: "";
    position: absolute;
    z-index: -1;
    inset: -45% -20%;
    opacity: 0;
    pointer-events: none;
    background: radial-gradient(circle at 20% 50%, rgba(119,242,176,.2), transparent 42%);
    transform: translateX(-14%);
    transition: opacity .22s ease, transform .32s ease;
}

.mp-voice-channel.is-speaking {
    border-color: rgba(119,242,176,.32);
    box-shadow: 0 0 var(--voice-channel-glow, 8px) rgba(119,242,176,.08), inset 0 0 0 1px rgba(119,242,176,.035);
}

.mp-voice-channel.is-speaking::before {
    opacity: .82;
    transform: translateX(0);
}

.mp-voice-heading {
    display: grid;
    grid-template-columns: 28px minmax(0,1fr) 8px;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.mp-voice-heading-icon {
    position: relative;
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 9px;
    color: #07121a;
    background: linear-gradient(135deg, #5ce8ff, #9c7dff);
    box-shadow: 0 7px 18px rgba(92,232,255,.16);
}

.mp-voice-heading-icon::after {
    content: "";
    position: absolute;
    inset: -4px;
    border: 1px solid rgba(119,242,176,.65);
    border-radius: 12px;
    opacity: 0;
}

.mp-voice-channel.is-speaking .mp-voice-heading-icon::after { animation: mpVoiceHalo 1.15s ease-out infinite; }

.mp-voice-heading strong,
.mp-voice-heading small { display: block; min-width: 0; }
.mp-voice-heading strong { color: #f5f5ff; font-size: .82rem; line-height: 1; }
.mp-voice-heading small { margin-top: 4px; color: var(--mp-muted); font-size: .58rem; letter-spacing: .08em; text-transform: uppercase; }
.mp-voice-live-dot { width: 7px; height: 7px; border-radius: 50%; background: #77f2b0; box-shadow: 0 0 12px rgba(119,242,176,.8); }
.mp-voice-channel.is-speaking .mp-voice-live-dot { animation: mpVoiceLiveDot .82s ease-in-out infinite alternate; }

.mp-voice-now {
    display: flex;
    align-items: center;
    gap: 7px;
    min-height: 22px;
    margin-bottom: 4px;
    padding: 3px 7px;
    overflow: hidden;
    border: 1px solid rgba(167,178,255,.1);
    border-radius: 9px;
    color: #7f88a6;
    background: rgba(5,7,17,.36);
    font-size: .59rem;
    font-weight: 700;
    white-space: nowrap;
    transition: color .18s ease, border-color .18s ease, background .18s ease;
}
.mp-voice-now.is-active { color: #bffbd7; border-color: rgba(119,242,176,.2); background: rgba(119,242,176,.065); }
.mp-voice-now > span:last-child { overflow: hidden; text-overflow: ellipsis; }
.mp-voice-now-wave,.mp-voice-wave { display: inline-flex; align-items: center; justify-content: center; gap: 2px; }
.mp-voice-now-wave { flex: 0 0 28px; height: 14px; }
.mp-voice-now-wave i,.mp-voice-wave i { display: block; width: 2px; height: 3px; border-radius: 999px; background: currentColor; transform-origin: center; }
.mp-voice-now.is-active .mp-voice-now-wave i { animation: mpVoiceBar .46s ease-in-out infinite alternate; }
.mp-voice-now-wave i:nth-child(2),.mp-voice-wave i:nth-child(2) { animation-delay: -.32s!important; }
.mp-voice-now-wave i:nth-child(3),.mp-voice-wave i:nth-child(3) { animation-delay: -.17s!important; }
.mp-voice-now-wave i:nth-child(4),.mp-voice-wave i:nth-child(4) { animation-delay: -.38s!important; }
.mp-voice-now-wave i:nth-child(5),.mp-voice-wave i:nth-child(5) { animation-delay: -.09s!important; }

.mp-voice-members { display: grid; gap: 4px; max-height: 68px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(119,242,176,.25) transparent; }
.mp-voice-member {
    --voice-level: 0;
    display: grid;
    grid-template-columns: 27px minmax(0,1fr) 32px 23px;
    align-items: center;
    gap: 6px;
    min-height: 32px;
    padding: 2px 5px;
    border: 1px solid transparent;
    border-radius: 11px;
    color: #aeb5ce;
    background: rgba(5,7,17,.2);
    transition: color .15s ease, border-color .15s ease, background .15s ease, transform .15s ease;
}
.mp-voice-member.is-speaking { color: #ecfff5; border-color: rgba(119,242,176,.18); background: linear-gradient(90deg,rgba(119,242,176,.12),rgba(119,242,176,.035)); transform: translateX(1px); }
.mp-voice-avatar { position: relative; display: grid; place-items: center; width: 27px; height: 27px; border: 1px solid rgba(167,178,255,.18); border-radius: 9px; color: #d9dcff; background: rgba(123,134,255,.12); font-size: .64rem; font-weight: 800; transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease; }
.mp-voice-avatar b { position: relative; z-index: 0; }
.mp-voice-avatar img { position: absolute; z-index: 1; inset: 0; width: 100%; height: 100%; border-radius: inherit; object-fit: cover; }
.mp-voice-avatar::after { content:""; position:absolute; inset:-3px; border:1px solid rgba(119,242,176,.68); border-radius:13px; opacity:0; }
.mp-voice-member.is-speaking .mp-voice-avatar { border-color: #77f2b0; box-shadow: 0 0 var(--voice-glow, 5px) rgba(119,242,176,.26); transform: scale(var(--voice-scale, 1)); }
.mp-voice-member.is-speaking .mp-voice-avatar::after { animation:mpVoiceAvatarRing .88s ease-out infinite; }
.mp-voice-member-copy { display:grid; min-width:0; gap:2px; }
.mp-voice-member-name { overflow: hidden; font-size: .7rem; font-weight: 800; line-height:1; text-overflow: ellipsis; white-space: nowrap; }
.mp-voice-member-copy small { overflow:hidden; color:#707995; font-size:.52rem; line-height:1; text-overflow:ellipsis; white-space:nowrap; transition:color .15s ease; }
.mp-voice-member.is-speaking .mp-voice-member-copy small { color:#77f2b0; }
.mp-voice-wave { width:32px; height:19px; color:#525b78; }
.mp-voice-wave i { height:var(--voice-meter-height, 3px); max-height:16px; transition:height 70ms linear, color .15s ease; }
.mp-voice-member.is-speaking .mp-voice-wave { color:#77f2b0; }
.mp-voice-member.is-speaking .mp-voice-wave i { animation:mpVoiceBar .42s ease-in-out infinite alternate; }
.mp-voice-member-state { color: #77809e; font: 800 .43rem/1 "Orbitron", sans-serif; text-align:right; }
.mp-voice-member.is-speaking .mp-voice-member-state { color:#77f2b0; }
.mp-voice-member.is-muted .mp-voice-avatar,.mp-voice-member.is-muted .mp-voice-wave { opacity:.58; }

@keyframes mpVoiceBar { from { transform:scaleY(.45); opacity:.58; } to { transform:scaleY(1.18); opacity:1; } }
@keyframes mpVoiceHalo { 0% { opacity:.75; transform:scale(.85); } 100% { opacity:0; transform:scale(1.28); } }
@keyframes mpVoiceAvatarRing { 0% { opacity:.7; transform:scale(.9); } 100% { opacity:0; transform:scale(1.28); } }
@keyframes mpVoiceLiveDot { from { transform:scale(.8); opacity:.65; } to { transform:scale(1.2); opacity:1; } }

@media (prefers-reduced-motion: reduce) {
    .mp-voice-channel *,
    .mp-voice-channel *::before,
    .mp-voice-channel *::after { animation:none!important; transition-duration:.01ms!important; }
}
.mp-voice-hint { display:none; align-items:center; justify-content:center; flex-wrap:wrap; gap:6px; margin-top:5px; color:#7f88a6; font-size:.58rem; text-align:center; }
.mp-voice-hint.is-error { display:flex; color: #ff899b; }
.mp-voice-hint button { min-height:24px; padding:0 8px; border:1px solid rgba(255,137,155,.34); border-radius:8px; color:#ffdce2; background:rgba(255,103,129,.09); font:800 .52rem/1 "Orbitron",sans-serif; cursor:pointer; }
.mp-voice-hint button:hover { border-color:rgba(255,137,155,.7); background:rgba(255,103,129,.16); }
.mp-voice-hint button[hidden] { display:none!important; }

.mp-voice-control { position: relative; overflow: hidden; }
.mp-voice-control.is-active { color: #dffff0; border-color: rgba(119,242,176,.4); background: rgba(119,242,176,.09); }
.mp-voice-control.is-active#mp-deafen-btn { color: #ffe1e6; border-color: rgba(255,103,129,.4); background: rgba(255,103,129,.09); }
.mp-input-meter { position: absolute; inset: auto 7px 4px; height: 2px; overflow: hidden; border-radius: 2px; background: rgba(255,255,255,.08); }
.mp-input-meter b { display: block; width: 0; height: 100%; background: linear-gradient(90deg,#5ce8ff,#77f2b0); transition: width 70ms linear; }

/* Advanced room voice modal */
.mp-voice-settings-overlay {
    position: fixed;
    inset: 0;
    z-index: 2147483400;
    display: none;
    place-items: center;
    padding: 18px;
    color: var(--mp-text);
    background: rgba(2,3,10,.78);
    -webkit-backdrop-filter: blur(18px);
            backdrop-filter: blur(18px);
    font-family: "Rajdhani", system-ui, sans-serif;
}
.mp-voice-settings-overlay.is-open { display: grid; }
.mp-voice-settings-modal { width: min(720px, 96vw); max-height: min(760px, 92dvh); overflow: auto; border: 1px solid rgba(168,178,255,.22); border-radius: 24px; background: linear-gradient(155deg,#171a31,#090b18 74%); box-shadow: 0 34px 100px rgba(0,0,0,.65); }
.mp-voice-settings-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 22px 22px 18px; border-bottom: 1px solid rgba(168,178,255,.12); }
.mp-voice-settings-head h3 { margin: 3px 0 5px; font: 800 1.32rem/1 "Orbitron",sans-serif; }
.mp-voice-settings-head p { margin: 0; color: var(--mp-muted); }
.mp-modal-kicker { color: var(--mp-cyan); font: 800 .58rem/1 "Orbitron",sans-serif; letter-spacing: .16em; }
#mp-voice-settings-close { width: 38px; height: 38px; border: 1px solid rgba(168,178,255,.18); border-radius: 12px; color: #c5c9df; background: rgba(255,255,255,.035); font-size: 1.35rem; cursor: pointer; }
.mp-voice-settings-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; padding: 20px 22px; }
.mp-voice-field { display: grid; gap: 8px; padding: 13px; border: 1px solid rgba(168,178,255,.12); border-radius: 15px; background: rgba(5,7,17,.5); color: #aeb5ce; font-size: .76rem; font-weight: 700; }
.mp-voice-field-wide { grid-column: 1/-1; }
.mp-voice-field select { width: 100%; min-height: 40px; padding: 0 10px; border: 1px solid rgba(168,178,255,.18); border-radius: 10px; color: #f6f7ff; background: #101326; }
.mp-voice-field input[type="range"] { width: 100%; accent-color: #7b86ff; }
.mp-voice-field span b { float: right; color: var(--mp-cyan); }
.mp-voice-test { align-content: start; }
.mp-voice-test-meter { height: 8px; overflow: hidden; border-radius: 6px; background: rgba(255,255,255,.08); }
.mp-voice-test-meter b { display:block; width:0; height:100%; background:linear-gradient(90deg,#5ce8ff,#77f2b0,#ffc86b); transition:width 70ms linear; }
.mp-voice-test-copy { min-height: 30px; color: var(--mp-muted, #8f9ab4); font-size: 12px; line-height: 1.3; }
.mp-voice-test button { min-height: 38px; border: 1px solid rgba(92,232,255,.3); border-radius: 10px; color:#dffbff; background:rgba(92,232,255,.08); cursor:pointer; }
.mp-voice-toggle { display:flex; align-items:center; gap:10px; padding:12px; border:1px solid rgba(168,178,255,.12); border-radius:14px; background:rgba(5,7,17,.45); }
.mp-voice-toggle input { width:18px; height:18px; accent-color:#7b86ff; }
.mp-voice-toggle span,.mp-voice-toggle b,.mp-voice-toggle small { display:block; }
.mp-voice-toggle b { font-size:.76rem; }
.mp-voice-toggle small { margin-top:2px; color:var(--mp-muted); font-size:.65rem; }
.mp-voice-settings-foot { display:flex; align-items:center; justify-content:space-between; gap:14px; padding:16px 22px 20px; border-top:1px solid rgba(168,178,255,.1); color:var(--mp-muted); }
#mp-voice-settings-save { min-height:42px; padding:0 22px; border:0; border-radius:12px; color:#07121a; background:linear-gradient(135deg,#5ce8ff,#9c7dff); font-weight:800; cursor:pointer; }

.mp-mic-help-overlay { position:fixed; inset:0; z-index:100020; display:none; place-items:center; padding:18px; background:rgba(3,4,12,.82); backdrop-filter:blur(12px); }
.mp-mic-help-overlay.is-open { display:grid; }
.mp-mic-help-modal { position:relative; width:min(470px,96vw); padding:24px; border:1px solid rgba(255,137,155,.28); border-radius:22px; color:#f5f6ff; background:linear-gradient(155deg,#1d2038,#090b18 76%); box-shadow:0 32px 90px rgba(0,0,0,.68); }
.mp-mic-help-modal h3 { margin:6px 42px 10px 0; font:800 1.2rem/1.1 "Orbitron",sans-serif; }
.mp-mic-help-modal p { margin:0; color:#aeb5ce; font-size:.82rem; line-height:1.55; }
.mp-mic-help-modal p strong { color:#fff; }
.mp-mic-help-close { position:absolute; top:14px; right:14px; width:36px; height:36px; border:1px solid rgba(168,178,255,.2); border-radius:11px; color:#d8dcf3; background:rgba(255,255,255,.04); font-size:1.25rem; cursor:pointer; }
.mp-mic-help-actions { display:flex; justify-content:flex-end; gap:9px; margin-top:20px; }
.mp-mic-help-actions button { min-height:40px; padding:0 14px; border:1px solid rgba(168,178,255,.2); border-radius:11px; color:#d8dcf3; background:rgba(255,255,255,.045); font-weight:800; cursor:pointer; }
.mp-mic-help-actions .mp-mic-help-retry { border:0; color:#07121a; background:linear-gradient(135deg,#5ce8ff,#9c7dff); }

body[data-mp-system="nds"] .mp-game-container,
body[data-mp-system="melonds"] .mp-game-container { --mp-cyan: #69d9ff; --mp-blue: #6f9cff; --mp-violet: #8fc4ff; }
body[data-mp-system="psp"] .mp-game-container { --mp-cyan: #80e5ff; --mp-blue: #8578ff; --mp-violet: #c06fff; }

@media (max-width: 1180px) and (min-width: 1025px) {
    .mp-game-container.mp-arena-v6 { grid-template-columns: minmax(0,1fr) 320px; overflow-y:auto; }
    .mp-arena-v6 .mp-left-rail { grid-column:1/-1; display:grid; grid-template-columns:auto 110px minmax(160px,1fr) minmax(210px,1.2fr) 150px; grid-template-rows:auto; align-items:stretch; }
    .mp-arena-v6 .mp-game-cover { min-height:100px; }
    .mp-voice-channel { min-height:100px; }
}

@media (max-width: 1024px) and (min-width: 761px) {
    .mp-game-container.mp-arena-v6 { grid-template-columns: minmax(0,1fr); }
    .mp-arena-v6 .mp-left-rail {
        grid-template-columns: minmax(150px,.8fr) 96px minmax(160px,1fr) minmax(190px,1.15fr);
        grid-template-rows: auto auto;
    }
    .mp-arena-v6 .mp-voice-channel { min-height: 96px; }
    .mp-arena-v6 .mp-room-info { grid-column: 1/-1; }
}

@media (max-width: 760px) {
    .mp-game-container.mp-arena-v6 { position:relative; inset:auto; display:flex; flex-direction:column; width:100%; min-height:100dvh; height:auto; padding:7px; overflow-y:auto; }
    .mp-arena-v6 .mp-main-content { order:1; min-height:72dvh; overflow:visible; grid-template-rows:minmax(0,1fr) auto; }
    .mp-arena-v6 .mp-left-rail { order:2; display:grid; grid-template-columns:1fr 1fr; }
    .mp-arena-v6 .mp-room-brand,.mp-arena-v6 .mp-game-cover { display:none; }
    .mp-arena-v6 .mp-right-rail { order:3; min-height:70dvh; grid-template-rows:auto minmax(420px,1fr); overflow:visible; }
    .mp-voice-channel { min-height:130px; }
    .mp-voice-settings-grid { grid-template-columns:1fr; }
    .mp-voice-field-wide { grid-column:auto; }
}
