/* Pixel Series Matchmaking renewed layout.
   This stylesheet is scoped to the canonical lobby and reuses the existing
   Matchmaking palette, components, states, and JavaScript contracts. */

.mmr-page .mmr-shell {
    width: min(100%, 1440px);
    margin: 0 auto;
    padding: 38px 24px 76px;
}

.mmr-page .mmc-hero {
    margin-bottom: 28px;
}

.mmr-page .mmc-hero-row {
    align-items: stretch;
    gap: 32px;
}

.mmr-page .mmc-hero-text {
    display: flex;
    flex: 1 1 440px;
    flex-direction: column;
    justify-content: center;
    padding: 10px 0;
}

.mmr-page .mmc-hero-eyebrow,
.mmr-page .mmc-hero-rule {
    display: none;
}

.mmr-page .mmc-hero-title {
    margin-bottom: 10px;
    font-size: clamp(42px, 5vw, 64px);
    line-height: 0.92;
    letter-spacing: -0.035em;
}

.mmr-page .mmc-hero-tagline {
    max-width: none;
    font-size: 16px;
    letter-spacing: 0.01em;
}

.mmr-page .mmc-profile {
    max-width: 650px;
    flex: 1 1 590px;
    min-height: 114px;
    border-top-width: 1px;
    border-left: 3px solid var(--color-ps-primary);
}

.mmr-page .mmc-profile-photo-wrap {
    width: 112px;
    flex-basis: 112px;
}

.mmr-page .mmc-profile-body {
    display: grid;
    grid-template-columns: minmax(190px, 0.8fr) minmax(200px, 1fr);
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
}

.mmr-page .mmc-profile-stats {
    gap: 1px;
    background: var(--color-ps-border);
}

.mmr-page .mmc-profile-stat {
    min-height: 64px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: var(--color-ps-elevated);
}

.mmr-page .mmc-profile-stat-num {
    font-size: 22px;
    font-variant-numeric: tabular-nums;
}

.mmr-page .mmc-profile-actions {
    display: grid;
    gap: 6px;
}

.mmr-page .mmc-profile-btn {
    min-height: 31px;
}

.mmr-command-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    gap: 20px;
    margin-top: 20px;
}

.mmr-command-panel,
.mmr-live-panel {
    min-width: 0;
    border: 1px solid var(--color-ps-border);
    background: var(--color-ps-surface);
}

.mmr-command-panel {
    padding: 24px;
}

.mmr-live-panel {
    display: flex;
    width: 100%;
    max-width: 100%;
    padding: 24px;
}

.mmr-panel-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}

.mmr-panel-title {
    margin: 0;
    font-family: var(--font-family-chakra);
    font-size: clamp(24px, 2.3vw, 34px);
    font-weight: 900;
    line-height: 1;
    letter-spacing: -0.025em;
    text-transform: uppercase;
    color: var(--color-ps-dark);
}

.mmr-page .mmc-banner {
    margin: 0 0 20px;
}

.mmr-page .mmc-shelf {
    margin-bottom: 18px;
}

.mmr-page .mmc-shelf-track {
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 12px;
}

.mmr-page .mmc-mode-card {
    min-height: 84px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 16px 18px;
    border-left: 4px solid rgba(44, 18, 217, 0.45);
    background: transparent;
}

.mmr-page .mmc-mode-card:hover {
    transform: none;
    background: var(--color-ps-hover);
}

.mmr-page .mmc-mode-card:focus-visible {
    outline: 2px solid var(--color-ps-primary-light);
    outline-offset: 3px;
}

.mmr-page .mmc-mode-card.is-active {
    border-color: var(--color-ps-primary);
    border-left: 4px solid var(--color-ps-primary);
    background: var(--color-ps-active);
}

html:not([data-theme='light']) .mmr-page .mmc-mode-card {
    border-color: rgba(67, 48, 235, 0.62);
}

html:not([data-theme='light']) .mmr-page .mmc-mode-card.is-active {
    border-color: var(--color-ps-primary);
}

html:not([data-theme='light']) .mmr-page .mmc-mode-card.is-active .mmc-mode-card-name {
    color: #fff;
}

.mmr-page .mmc-mode-card-head {
    align-items: center;
    margin-bottom: 9px;
}

.mmr-page .mmc-mode-card-name {
    font-size: 18px;
    letter-spacing: 0.015em;
}

.mmr-page .mmc-mode-card-badge,
.mmr-page .mmc-mode-card-size {
    border-radius: 0;
}

.mmr-page .mmc-chip {
    border: 0;
    padding: 0;
    background: transparent;
}

.mmr-page .mmc-cockpit {
    margin: 0;
    border: 0;
    border-top: 1px solid var(--color-ps-border);
    background: transparent;
    box-shadow: none;
}

.mmr-page .mmc-cockpit-glow {
    display: none;
}

.mmr-page .mmc-cockpit-grid {
    grid-template-columns: minmax(240px, 0.82fr) minmax(300px, 1.18fr);
}

.mmr-page .mmc-cockpit-identity,
.mmr-page .mmc-cockpit-action {
    padding: 22px 20px;
}

.mmr-page .mmc-cockpit-identity {
    border-right: 1px solid var(--color-ps-border);
}

.mmr-page .mmc-cockpit-action {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-content: start;
    align-items: center;
    gap: 12px 16px;
}

.mmr-page .mmc-action-mode {
    min-width: 0;
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
}

.mmr-page #mmc-startup-notice {
    grid-column: 1 / -1;
    margin: 0;
}

.mmr-page .mmc-cockpit-action > .mmc-cta {
    grid-column: 1;
    grid-row: 1;
}

.mmr-page .mmc-action-mode-name {
    font-size: clamp(23px, 2vw, 32px);
    line-height: 1;
}

.mmr-page .mmc-action-mode-state {
    margin-top: 5px;
}

.mmr-page .mmc-cta {
    min-width: 190px;
    min-height: 52px;
    padding: 14px 22px;
    border-radius: 0;
}

.mmr-page .mmc-cta:active {
    transform: translateY(1px) scale(0.99);
}

.mmr-page .mmc-cta:focus-visible,
.mmr-page .mmc-sound-btn:focus-visible,
.mmr-page .mmc-ladder-tab:focus-visible,
.mmr-page .mmc-chip-btn:focus-visible,
.mmr-page .mmc-page-btn:focus-visible {
    outline: 2px solid var(--color-ps-primary-light);
    outline-offset: 3px;
}

.mmr-page .mmc-auto-requeue {
    grid-column: 1 / -1;
    margin-top: 2px;
    padding: 10px 12px;
    border: 1px solid var(--color-ps-border-subtle);
    background: var(--color-ps-elevated);
}

.mmr-page .mmc-auto-requeue-switch::after {
    left: 1px;
    transform: translateX(0);
    transition:
        transform 0.28s cubic-bezier(0.22, 1, 0.36, 1),
        background-color 0.18s ease;
}

.mmr-page .mmc-auto-requeue-input:checked ~ .mmc-auto-requeue-switch::after {
    left: 1px;
    transform: translateX(16px);
}

.mmr-page .mmc-pip-row,
.mmr-page .mmc-action-meta,
.mmr-page .mmf-fallback,
.mmr-page .mmc-ban-countdown {
    grid-column: 1 / -1;
}

.mmr-page .mmc-action-meta {
    margin-top: 0;
    gap: 16px;
}

.mmr-page .mmc-queue-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.mmr-page .mmc-satellite-status {
    grid-column: 1 / -1;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 4px;
    color: #cf8585;
    font-size: 12px;
    line-height: 1.5;
}

.mmr-page .mmc-satellite-status[hidden] {
    display: none;
}

.mmr-page .mmc-satellite-status[data-online='true'] {
    color: #75b88a;
}

.mmr-page .mmc-satellite-status svg {
    flex-shrink: 0;
}

html[data-theme='light'] .mmr-page .mmc-satellite-status {
    color: #a84b4b;
}

html[data-theme='light'] .mmr-page .mmc-satellite-status[data-online='true'] {
    color: #357a4b;
}

@media (prefers-color-scheme: light) {
    html:not([data-theme='dark']):not([data-theme='light']) .mmr-page .mmc-satellite-status {
        color: #a84b4b;
    }

    html:not([data-theme='dark']):not([data-theme='light']) .mmr-page .mmc-satellite-status[data-online='true'] {
        color: #357a4b;
    }
}

.mmr-page .mmc-cockpit-rail {
    display: none;
    grid-column: 1 / -1;
    padding: 22px 20px 20px;
    border-top: 1px solid var(--color-ps-border);
    border-left: 0;
    background: rgba(255, 255, 255, 0.015);
}

.mmr-page .mmc-cockpit[data-phase='match'] .mmc-cockpit-rail,
.mmr-page .mmc-cockpit[data-phase='server'] .mmc-cockpit-rail,
.mmr-page .mmc-cockpit[data-phase='connecting'] .mmc-cockpit-rail,
.mmr-page .mmc-cockpit[data-phase='live'] .mmc-cockpit-rail,
.mmr-page .mmc-cockpit[data-debug-queue-steps='true'] .mmc-cockpit-rail {
    display: flex;
}

.mmr-page
    .mmc-cockpit:is(
        [data-phase='match'],
        [data-phase='server'],
        [data-phase='connecting'],
        [data-phase='live'],
        [data-debug-queue-steps='true']
    )
    .mmc-cockpit-grid {
    row-gap: 39px;
    padding-bottom: 17px;
}

.mmr-page .mmc-rail {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: start;
    gap: 0;
}

.mmr-page .mmc-rail::before {
    display: none;
}

.mmr-page .mmc-rail::after {
    content: '';
    position: absolute;
    z-index: 0;
    top: 18px;
    left: 10%;
    right: 10%;
    height: 1px;
    background: var(--color-ps-border);
}

.mmr-page .mmc-rail-step {
    position: relative;
    z-index: 1;
    min-width: 0;
    display: grid;
    grid-template-rows: 36px auto;
    justify-items: center;
    align-items: start;
    gap: 8px;
    padding: 0 14px;
    text-align: center;
}

.mmr-page .mmc-rail-step:not(:last-child)::after {
    display: none;
}

.mmr-page .mmc-rail-icon {
    position: relative;
    z-index: 1;
    margin: 0;
    background: var(--color-ps-surface);
}

.mmr-page .mmc-rail-meta {
    align-items: center;
}

.mmr-page .mmc-rail-timer {
    margin: 14px auto 0;
}

.mmr-live-panel .mmc-section {
    width: 100%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    margin: 0;
}

.mmr-page .mmc-section-head {
    min-height: 44px;
    margin-bottom: 14px;
}

.mmr-page .mmc-section-rule {
    display: none;
}

.mmr-page .mmc-section-title {
    font-size: clamp(22px, 2vw, 30px);
    letter-spacing: -0.02em;
}

.mmr-live-panel .mmc-live-grid {
    flex: 1;
    display: flex;
}

.mmr-live-panel .mmc-live-empty {
    width: 420px;
    max-width: 100%;
    min-height: 180px;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    border: 0;
    background: transparent;
}

.mmr-live-panel .mmc-live-empty-art {
    width: 64px;
    height: 64px;
    display: grid;
    place-items: center;
    margin: 0 auto 4px;
    color: var(--color-ps-dimmed);
    background: transparent;
    border: 0;
}

.mmr-live-panel .mmc-tile-grid {
    display: flex;
    flex-wrap: wrap;
    min-width: 0;
}

.mmr-live-panel .mmc-tile {
    flex: 0 1 420px;
    width: 420px;
    max-width: 100%;
    min-width: 0;
    min-height: 230px;
}

.mmr-page .mmc-alliance-shell {
    margin-top: 20px;
    margin-bottom: 0;
}

.mmr-data-stack {
    margin-top: 22px;
}

.mmr-data-stack > .mmc-section {
    margin: 0;
    padding: 24px;
    border: 1px solid var(--color-ps-border);
    background: var(--color-ps-surface);
}

.mmr-data-stack > .mmc-section + .mmc-section {
    margin-top: -1px;
}

.mmr-page .mmc-ladder-card,
.mmr-page .mmc-feed-card {
    border: 0;
    background: transparent;
    box-shadow: none;
}

.mmr-page .mmc-ladder-tabs {
    gap: 28px;
    padding: 0;
    border-bottom: 1px solid var(--color-ps-border);
    background: transparent;
}

.mmr-page .mmc-ladder-tab {
    min-width: 0;
    padding: 10px 2px 12px;
    border-bottom: 2px solid transparent;
    background: transparent;
}

.mmr-page .mmc-ladder-tab.is-active {
    border-bottom-color: var(--color-ps-primary-light);
    background: transparent;
    color: var(--color-ps-primary-light);
}

.mmr-page .mmc-ladder-table th,
.mmr-page .mmc-ladder-table td {
    padding-top: 10px;
    padding-bottom: 10px;
}

.mmr-page .mmc-ladder-table thead th {
    background: var(--color-ps-elevated);
}

.mmr-page .mmc-ladder-table tbody tr.is-me {
    background: var(--color-ps-active);
}

.mmr-page .mmc-feed-filters {
    display: grid;
    grid-template-columns: minmax(220px, 1.5fr) auto minmax(150px, 0.7fr) minmax(120px, 0.5fr);
    gap: 12px;
    padding: 0 0 16px;
    border-bottom: 1px solid var(--color-ps-border);
    background: transparent;
}

.mmr-page .mmc-feed-search,
.mmr-page .mmc-feed-select {
    min-height: 42px;
    border-radius: 0;
    background: transparent;
}

.mmr-page .mmc-feed-chips {
    border: 1px solid var(--color-ps-border);
}

.mmr-page .mmc-chip-btn {
    border: 0;
    border-radius: 0;
}

.mmr-page .mmc-feed-row {
    border-color: var(--color-ps-border-subtle);
}

.mmr-page .mmc-feed-row:hover {
    background: var(--color-ps-hover);
}

.mmr-page .mmc-feed-pagination {
    padding-right: 0;
    padding-left: 0;
}

.mmr-page .mmc-page-btn {
    border-radius: 0;
}

@media (max-width: 1120px) {
    .mmr-command-grid {
        grid-template-columns: 1fr;
    }

    .mmr-live-panel .mmc-live-empty {
        min-height: 180px;
    }

}

@media (max-width: 900px) {
    .mmr-page .mmr-shell {
        padding-top: 30px;
    }

    .mmr-page .mmc-hero-row {
        flex-direction: column;
    }

    .mmr-page .mmc-hero-text {
        flex-basis: auto;
    }

    .mmr-page .mmc-profile {
        max-width: none;
        flex-basis: auto;
    }

    .mmr-page .mmc-cockpit-grid {
        grid-template-columns: 1fr;
    }

    .mmr-page .mmc-cockpit-identity {
        border-right: 0;
        border-bottom: 1px solid var(--color-ps-border);
    }

    .mmr-page .mmc-feed-filters {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 640px) {
    .mmr-page .mmr-shell {
        padding: 24px 14px 56px;
    }

    .mmr-page .mmc-hero-title {
        font-size: clamp(38px, 14vw, 50px);
    }

    .mmr-page .mmc-profile {
        min-height: 0;
        flex-direction: column;
    }

    .mmr-page .mmc-profile-photo-wrap {
        width: 100%;
        height: 150px;
        flex-basis: 150px;
    }

    .mmr-page .mmc-profile-body {
        grid-template-columns: 1fr;
    }

    .mmr-command-panel,
    .mmr-live-panel,
    .mmr-data-stack > .mmc-section {
        padding: 18px 14px;
    }

    .mmr-panel-head {
        align-items: flex-start;
        flex-direction: column;
        gap: 7px;
    }

    .mmr-page .mmc-shelf-track {
        display: flex;
        padding-bottom: 8px;
    }

    .mmr-page .mmc-mode-card {
        min-width: 238px;
    }

    .mmr-page .mmc-cockpit-action {
        grid-template-columns: 1fr;
    }

    .mmr-page .mmc-action-mode {
        grid-column: 1;
        justify-self: start;
    }

    .mmr-page .mmc-cockpit-action > .mmc-cta {
        grid-column: 1;
        grid-row: auto;
    }

    .mmr-page .mmc-cta,
    .mmr-page .mmc-auto-requeue,
    .mmr-page .mmc-pip-row,
    .mmr-page .mmc-action-meta {
        grid-column: 1;
        width: 100%;
    }

    .mmr-page .mmc-rail-step {
        padding: 0 4px;
    }

    .mmr-page .mmc-rail-step:not(:last-child)::after {
        left: calc(50% + 16px);
        right: calc(-50% + 16px);
    }

    .mmr-page .mmc-rail-sub {
        display: none;
    }


    .mmr-page .mmc-ladder-tabs {
        gap: 12px;
        overflow-x: auto;
    }

    .mmr-page .mmc-ladder-tab {
        white-space: nowrap;
    }

    .mmr-page .mmc-feed-filters {
        grid-template-columns: 1fr;
    }

    .mmr-page .mmc-feed-chips {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    .mmr-page *,
    .mmr-page *::before,
    .mmr-page *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}

html[data-theme='light'] .mmr-live-panel .mmc-tile-art {
    filter: saturate(0.9) brightness(1.05);
    opacity: 1;
}

html[data-theme='light'] .mmr-live-panel .mmc-tile-shade {
    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.9) 0%,
        rgba(255, 255, 255, 0.64) 50%,
        rgba(255, 255, 255, 0.9) 100%
    );
}

@media (prefers-color-scheme: light) {
    html:not([data-theme='dark']):not([data-theme='light']) .mmr-live-panel .mmc-tile-art {
        filter: saturate(0.9) brightness(1.05);
        opacity: 1;
    }

    html:not([data-theme='dark']):not([data-theme='light']) .mmr-live-panel .mmc-tile-shade {
        background: linear-gradient(
            180deg,
            rgba(255, 255, 255, 0.9) 0%,
            rgba(255, 255, 255, 0.64) 50%,
            rgba(255, 255, 255, 0.9) 100%
        );
    }
}
