﻿/* Lobby player panel */
.mm-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px;
    border: 2px solid rgba(var(--sc-primary-rgb), 0.25);
    border-radius: 14px;
    background-color: rgba(32, 35, 42, 0.96);
    overflow: hidden;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.mm-panel-opponent {
    border-color: rgba(255, 122, 107, 0.3);
}

.mm-panel.is-ready {
    border-color: #4cd97b;
    box-shadow: 0 0 16px rgba(76, 217, 123, 0.35);
}

.mm-panel-banner {
    position: absolute;
    inset: 0 0 auto 0;
    height: 70px;
    background-size: cover;
    background-position: center;
    opacity: 0.45;
    mask-image: linear-gradient(to bottom, #000, transparent);
    -webkit-mask-image: linear-gradient(to bottom, #000, transparent);
}

.mm-panel-header {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px;
}

.mm-panel-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--sc-primary);
}

.mm-panel-opponent .mm-panel-avatar {
    border-color: #ff7a6b;
}

.mm-panel-name {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    line-height: 1.2;
}

.mm-panel-name span {
    font-size: 18px;
    font-weight: bold;
    color: var(--sc-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mm-panel-name small {
    font-size: 12px;
    color: #ffcc00;
}

.mm-ready-button {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 2px solid #4cd97b;
    border-radius: 999px;
    background: transparent;
    color: #4cd97b;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.15s ease;
    animation: mm-ready-pulse 1.6s ease-in-out infinite;
}

.mm-ready-button:hover {
    background: rgba(76, 217, 123, 0.15);
}

.mm-ready-button:active {
    transform: scale(0.94);
}

.mm-ready-button:disabled {
    opacity: 0.4;
    cursor: default;
    animation: none;
}

.mm-ready-button.is-ready {
    background: #4cd97b;
    color: var(--sc-bg);
    animation: mm-ready-pop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mm-ready-button.is-ready:hover {
    background: #ff9e57;
    border-color: #ff9e57;
}

.mm-ready-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.55);
}

.mm-ready-badge.is-ready {
    color: #4cd97b;
    font-weight: bold;
    animation: mm-ready-pop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mm-ready-badge ion-icon, .mm-ready-button ion-icon {
    font-size: 20px;
}

.mm-panel-hint {
    margin: 0;
    text-align: center;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
}

@keyframes mm-ready-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(76, 217, 123, 0.45); }
    50% { box-shadow: 0 0 0 6px rgba(76, 217, 123, 0); }
}

@keyframes mm-ready-pop {
    0% { transform: scale(0.7); }
    100% { transform: scale(1); }
}

/* Ready-up screen: fits one screen, the player's fighter front and centre */

.mm-lobby {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: calc(100dvh - var(--sc-safe-top) - var(--sc-safe-bottom) - 72px);
    overflow: hidden;
}

.mm-lobby-vs {
    align-self: center;
    margin: -4px 0;
    font-size: 14px;
}

.mm-panel.is-compact {
    flex: none;
    padding: 8px 12px;
}

.mm-panel.is-compact .mm-panel-banner {
    opacity: 0.35;
}

.mm-panel.is-compact .mm-panel-avatar {
    width: 40px;
    height: 40px;
}

.mm-panel-self {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
}

.mm-panel-fighter {
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* The carousel's card scales down to whatever space is left */
.mm-panel-fighter .skanimals-card {
    max-height: 100%;
    overflow: hidden;
}

.mm-ready-cta {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 54px;
    margin-top: 10px;
    border: 0;
    border-radius: var(--sc-radius-lg);
    background: var(--sc-gradient-primary);
    color: var(--sc-navy);
    font-family: var(--sc-font-display);
    font-size: 19px;
    font-weight: 700;
    box-shadow: var(--sc-glow-primary);
    cursor: pointer;
    transition: transform 0.2s var(--sc-ease-spring);
}

.mm-ready-cta:active { transform: scale(0.97); }
.mm-ready-cta:disabled { opacity: 0.4; box-shadow: none; }

.mm-ready-cta.is-ready {
    background: var(--sc-gradient-success);
    animation: mm-ready-pulse 1.6s ease-in-out infinite;
}

@keyframes mm-ready-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(61, 220, 132, 0.5); }
    50% { box-shadow: 0 0 0 8px rgba(61, 220, 132, 0); }
}

/* The opponent's pick, small, inside their strip */
.mm-preview {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    padding: 6px 10px 6px 6px;
    border: 1px solid var(--sc-line-strong);
    border-radius: var(--sc-radius);
    background: rgba(var(--sc-bg-rgb), 0.55);
}

.mm-preview img {
    width: 52px;
    height: 52px;
    flex: none;
    object-fit: contain;
    filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.4));
}

.mm-preview-text {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
}

.mm-preview-text strong { font-size: 15px; }
.mm-preview-text small { color: var(--sc-gold); font-size: 12px; }
.mm-preview-text span { color: var(--sc-text-muted); font-size: 12px; }

.mm-preview-weak {
    flex: none;
    padding: 3px 9px;
    border-radius: var(--sc-radius-pill);
    background: var(--sc-gold-soft);
    color: var(--sc-gold);
    font-size: 12px;
    font-weight: 700;
}

.mm-preview-weak.is-unknown {
    background: var(--sc-surface-3);
    color: var(--sc-text-muted);
}

/* The roster: every Skanimal that can fight, picked by tapping (BattleRoster) */
.mm-roster {
    display: flex;
    flex-direction: column;
    gap: 8px;
    height: 100%;
    min-height: 0;
}

.mm-roster-hint {
    margin: 2px 0 0;
    color: var(--sc-text-muted);
    font-size: 12px;
    text-align: center;
}

.mm-roster-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    align-content: start;
    gap: 8px;
    flex: 1;
    min-height: 0;
    padding: 4px 2px 8px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.mm-roster-tile {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-width: 0;
    padding: 18px 6px 8px;
    border: 2px solid rgba(var(--sc-primary-rgb), 0.18);
    border-radius: var(--sc-radius-md, 12px);
    background: rgba(var(--sc-primary-rgb), 0.06);
    color: var(--sc-text);
    cursor: pointer;
    animation: mm-roster-in 0.35s var(--sc-ease-spring) both;
    animation-delay: calc(min(var(--i), 12) * 35ms);
    transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.2s var(--sc-ease-spring);
}

.mm-roster-tile:hover { border-color: rgba(var(--sc-primary-rgb), 0.5); }
.mm-roster-tile:active { transform: scale(0.95); }
.mm-roster-tile:disabled { cursor: default; opacity: 0.55; }
.mm-roster-tile.is-selected:disabled { opacity: 1; }

.mm-roster-tile.is-selected {
    border-color: var(--sc-primary);
    background: rgba(var(--sc-primary-rgb), 0.16);
    box-shadow: 0 0 14px rgba(var(--sc-primary-rgb), 0.35);
}

.mm-roster-tile.is-ready {
    border-color: #4cd97b;
    background: rgba(76, 217, 123, 0.14);
    box-shadow: 0 0 14px rgba(76, 217, 123, 0.4);
}

.mm-roster-tile img {
    width: 64px;
    height: 64px;
    object-fit: contain;
}

.mm-roster-level {
    position: absolute;
    top: 5px;
    left: 6px;
    color: var(--sc-gold, #ffcc00);
    font-size: 11px;
    font-weight: 700;
}

.mm-roster-lock {
    position: absolute;
    top: 4px;
    right: 6px;
    color: #4cd97b;
    font-size: 14px;
}

.mm-roster-name {
    max-width: 100%;
    overflow: hidden;
    font-family: var(--sc-font-display);
    font-size: 14px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mm-roster-meta {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    color: var(--sc-text-muted);
    font-size: 11px;
}

@keyframes mm-roster-in {
    from { opacity: 0; transform: translateY(10px) scale(0.92); }
    to { opacity: 1; transform: none; }
}

/* The picked Skanimal's details, with the lock-in button */
.mm-roster-sheet {
    position: fixed;
    inset: 0;
    z-index: 2050;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0 0 var(--sc-safe-bottom);
    background: rgba(4, 11, 30, 0.72);
    backdrop-filter: blur(4px);
    animation: mm-fade 0.2s ease both;
}

.mm-roster-sheet-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: min(100%, 460px);
    max-height: calc(100dvh - var(--sc-safe-top) - 16px);
    padding: 14px 14px 18px;
    border: 1px solid rgba(var(--sc-primary-rgb), 0.3);
    border-bottom: 0;
    border-radius: 20px 20px 0 0;
    background: var(--sc-surface, #141a2e);
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
    animation: mm-roster-sheet-up 0.32s var(--sc-ease-out) both;
}

.mm-roster-sheet-card {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.mm-roster-sheet-card .skanimals-card {
    max-width: 100% !important;
    margin: 0 auto;
}

.mm-roster-sheet-actions {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 10px;
}

.mm-roster-lockin {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-color: transparent;
    background: var(--sc-gradient-success);
    color: var(--sc-navy);
    font-weight: 700;
}

@keyframes mm-roster-sheet-up {
    from { transform: translateY(100%); }
    to { transform: none; }
}

@media (min-height: 700px) and (min-width: 600px) {
    .mm-roster-sheet { align-items: center; }
    .mm-roster-sheet-body { border-bottom: 1px solid rgba(var(--sc-primary-rgb), 0.3); border-radius: 20px; }
}
