@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=Space+Mono:wght@400;700&display=swap');

:root {
    --mp-accent: #ff5c00;
    --mp-green: #16a34a;
    --mp-green-hover: #15803d;
    --mp-red: #dc2626;
    --mp-blue: #0ea5e9;
    --mp-bg: #f0ebe3;
    --mp-card: #ffffff;
    --mp-text: #1a1a1a;
    --mp-border: #1a1a1a;
    --mp-shadow: 5px 5px 0px #1a1a1a;
    --mp-shadow-sm: 3px 3px 0px #1a1a1a;
    --mp-radius: 12px;
    --mp-modal-z: 10000;
    --mp-toast-z: 10100;
}

/* ── FAB Button ──────────────────────────────────────────────── */

.mp-fab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    background: var(--mp-green);
    color: #fff;
    padding: 8px 12px;
    border: 2.5px solid var(--mp-border);
    box-shadow: var(--mp-shadow-sm);
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.15s;
    outline: none;
    white-space: nowrap;
    position: relative;
    flex-shrink: 0;
}

.mp-fab:hover {
    transform: translate(-1px, -1px);
    box-shadow: 4px 4px 0px #1a1a1a;
    background: var(--mp-green-hover);
}

.mp-fab:active {
    transform: translate(2px, 2px);
    box-shadow: 1px 1px 0px #1a1a1a;
}

.mp-fab:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
    box-shadow: var(--mp-shadow-sm);
}

.mp-fab__icon {
    width: 14px;
    height: 14px;
    object-fit: contain;
    margin-right: 6px;
    filter: drop-shadow(1px 1px 0px rgba(0, 0, 0, 0.2));
}

.mp-fab__label {
    font-size: 8px;
    /* letter-spacing: 0.5px; */
    font-family: 'Press Start 2P', monospace;
}

.mp-fab__badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: var(--mp-red);
    color: #fff;
    font-family: 'Press Start 2P', monospace;
    font-size: 6px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--mp-border);
    pointer-events: none;
}

/* Pulse animation when waiting */
@media (prefers-reduced-motion: no-preference) {
    .mp-fab--pulse {
        animation: mp-fab-pulse 2s ease-in-out infinite;
    }

    @keyframes mp-fab-pulse {

        0%,
        100% {
            box-shadow: var(--mp-shadow-sm);
        }

        50% {
            box-shadow: 3px 3px 0px #1a1a1a, 0 0 0 4px rgba(22, 163, 74, 0.25);
        }
    }
}

.mp-fab--live-session {
    background: var(--mp-text);
    color: #fff;
    border-color: var(--mp-text);
}

.mp-fab--live-session:hover {
    background: #000;
}

.mp-fab-live-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    background: var(--mp-red);
    border: 1px solid var(--mp-border);
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
    position: relative;
    top: -1px;
    animation: mp-blink-hard 1s steps(2, start) infinite;
}

@keyframes mp-blink-hard {

    0%,
    100% {
        background: var(--mp-red);
    }

    50% {
        background: #fff;
    }
}

/* Hide FAB on mobile */
@media (hover: none) and (pointer: coarse) {
    .mp-fab {
        display: none !important;
    }
}

/* Responsive adjustments for small desktops */
@media (max-width: 700px) {
    .mp-fab__label {
        display: none;
    }

    .mp-fab {
        padding: 8px 10px;
    }

    .mp-modal {
        max-width: 95%;
    }
}

/* ── Modal Overlay ───────────────────────────────────────────── */

.mp-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: var(--mp-modal-z);
    background: rgba(26, 26, 26, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.mp-modal-overlay--open {
    opacity: 1;
    visibility: visible;
}

.mp-modal {
    background: var(--mp-card);
    border: 2.5px solid var(--mp-border);
    box-shadow: 8px 8px 0px #1a1a1a;
    border-radius: var(--mp-radius);
    width: 100%;
    max-width: 440px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 0;
    position: relative;
}

@media (prefers-reduced-motion: no-preference) {
    .mp-modal {
        transform: translateY(20px) scale(0.97);
        transition: transform 0.25s ease;
    }

    .mp-modal-overlay--open .mp-modal {
        transform: translateY(0) scale(1);
    }
}

.mp-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px 14px;
    border-bottom: 2.5px solid #e0dbd3;
    background: linear-gradient(180deg, #ffffff 0%, #fafafa 100%);
}

.mp-modal__title {
    font-family: 'Press Start 2P', monospace;
    font-size: 11px;
    color: var(--mp-text);
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: 0.5px;
}

.mp-modal__icon {
    width: 16px;
    height: 16px;
    object-fit: contain;
}

.mp-modal__close {
    background: var(--mp-red);
    color: #fff;
    border: 2px solid var(--mp-border);
    border-radius: 6px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    transition: background 0.15s, transform 0.08s;
    font-weight: bold;
}

.mp-modal__close:hover {
    background: #b91c1c;
    transform: scale(1.05);
}

.mp-modal__close:active {
    transform: scale(0.95);
}

.mp-modal__body {
    padding: 20px;
    margin-top: -12px;
}

/* ── Modal Screens ───────────────────────────────────────────── */

.mp-screen {
    display: none;
}

.mp-screen--active {
    display: block;
}

/* Identity screen */
.mp-name-input {
    width: 100%;
    font-family: 'Press Start 2P', monospace;
    font-size: 11px;
    padding: 14px 16px;
    border: 2.5px solid var(--mp-border);
    border-radius: 8px;
    background: var(--mp-bg);
    color: var(--mp-text);
    outline: none;
    transition: box-shadow 0.15s, border-color 0.15s, background 0.15s;
    box-sizing: border-box;
}

.mp-name-input:focus {
    box-shadow: 0 0 0 3px rgba(255, 92, 0, 0.2);
    border-color: var(--mp-accent);
    background: #fff;
}

.mp-name-input::placeholder {
    color: #aaa;
    opacity: 0.7;
}

.mp-input-label {
    font-family: 'Press Start 2P', monospace;
    font-size: 7px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #999;
    margin-bottom: 8px;
    margin-top: 5px;
    display: block;
}

.mp-btn-row {
    display: flex;
    gap: 10px;
    margin-top: 18px;
}

.mp-btn {
    flex: 1;
    font-family: 'Press Start 2P', monospace;
    font-size: 9px;
    padding: 13px 12px;
    border: 2.5px solid var(--mp-border);
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.08s, box-shadow 0.08s, background 0.15s;
    outline: none;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    box-shadow: var(--mp-shadow-sm);
    font-weight: normal;
    letter-spacing: 0.5px;
}

.mp-btn:hover {
    transform: translate(-1px, -1px);
    box-shadow: 4px 4px 0px #1a1a1a;
}

.mp-btn:active {
    transform: translate(2px, 2px);
    box-shadow: 1px 1px 0px #1a1a1a;
}

.mp-btn--primary {
    background: var(--mp-accent);
    color: #fff;
}

.mp-btn--secondary {
    background: var(--mp-card);
    color: var(--mp-text);
}

.mp-btn--purple {
    background: var(--mp-purple);
    color: #fff;
}

.mp-btn--danger {
    background: var(--mp-red);
    color: #fff;
}

.mp-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: var(--mp-shadow-sm) !important;
}

/* ── Join Code Input (6 boxes) ───────────────────────────────── */

.mp-code-inputs {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin: 16px 0;
}

.mp-code-char {
    width: 46px;
    height: 54px;
    font-family: 'Press Start 2P', monospace;
    font-size: 18px;
    text-align: center;
    border: 2.5px solid var(--mp-border);
    border-radius: 8px;
    background: var(--mp-bg);
    color: var(--mp-text);
    outline: none;
    text-transform: uppercase;
    transition: box-shadow 0.15s, border-color 0.15s, transform 0.08s;
}

.mp-code-char:focus {
    border-color: var(--mp-accent);
    box-shadow: 0 0 0 3px rgba(255, 92, 0, 0.2);
    transform: translateY(-2px);
}

.mp-code-char:not(:placeholder-shown) {
    background: #fff;
    border-color: var(--mp-accent);
}

/* ── Connecting screen ───────────────────────────────────────── */

.mp-connecting {
    text-align: center;
    padding: 20px 0;
}

.mp-progress-bar {
    width: 100%;
    height: 12px;
    border: 2.5px solid var(--mp-border);
    border-radius: 6px;
    overflow: hidden;
    margin: 16px 0;
    background: var(--mp-bg);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.mp-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--mp-accent) 0%, #ff8c42 100%);
    border-radius: 3px;
    width: 100%;
    animation: mp-progress-indeterminate 1.5s ease-in-out infinite;
    position: relative;
    overflow: hidden;
}

.mp-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.3) 50%, transparent 100%);
    animation: mp-progress-shimmer 1.5s infinite;
}

@media (prefers-reduced-motion: no-preference) {
    .mp-progress-fill {
        animation: mp-progress 5s linear forwards;
    }

    @keyframes mp-progress {
        from {
            width: 0%;
        }

        to {
            width: 100%;
        }
    }

    @keyframes mp-progress-shimmer {
        0% {
            transform: translateX(-100%);
        }

        100% {
            transform: translateX(200%);
        }
    }

    @keyframes mp-progress-indeterminate {
        0% {
            transform: translateX(-100%);
        }

        50% {
            transform: translateX(0%);
        }

        100% {
            transform: translateX(100%);
        }
    }
}

.mp-connecting__text {
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    color: #999;
    margin-top: 8px;
}

/* ── Lobby Roster ────────────────────────────────────────────── */

.mp-invite-hint {
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    color: #999;
    text-align: center;
    margin: 8px 0 0 0;
    line-height: 1.5;
    padding: 0 8px;
}

.mp-room-code-display {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--mp-bg);
    border: 2px solid var(--mp-border);
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 16px;
}

.mp-room-code-text {
    font-family: 'Press Start 2P', monospace;
    font-size: 16px;
    /* letter-spacing: 5px; */
    color: var(--mp-accent);
    font-weight: bold;
}

.mp-copy-btn {
    font-family: 'Press Start 2P', monospace;
    font-size: 7px;
    background: var(--mp-text);
    color: #fff;
    border: 2px solid var(--mp-border);
    border-radius: 6px;
    padding: 7px 12px;
    cursor: pointer;
    transition: background 0.15s, transform 0.08s;
    outline: none;
    white-space: nowrap;
    letter-spacing: 0.5px;
}

.mp-divider {
    height: 1px;
    background: #ccc;
    margin: 16px 0;
    opacity: 0.5;
}

.mp-copy-btn:hover {
    background: #333;
    transform: translateY(-1px);
}

.mp-copy-btn:active {
    transform: translateY(1px);
}

.mp-player-count,
.mp-room-name-label {
    font-family: 'Press Start 2P', monospace;
    font-size: 7px;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
    display: block;
    text-align: left;
}

.mp-roster {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.mp-roster__player {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--mp-bg);
    border: 2px solid #e0dbd3;
    border-radius: 8px;
    transition: background 0.15s, border-color 0.15s, transform 0.08s;
}

.mp-roster__player:hover {
    background: #e8e2d8;
    transform: translateX(2px);
}

@media (prefers-reduced-motion: no-preference) {
    .mp-roster__player {
        animation: mp-slide-in 0.25s ease-out;
    }

    @keyframes mp-slide-in {
        from {
            opacity: 0;
            transform: translateX(-10px);
        }

        to {
            opacity: 1;
            transform: translateX(0);
        }
    }
}

.mp-roster__player--you {
    border-color: var(--mp-accent);
    background: #fff5f0;
    box-shadow: 0 0 0 2px rgba(255, 92, 0, 0.1);
}

.mp-roster__player--you:hover {
    background: #ffede0;
}

.mp-roster__name {
    font-family: 'Press Start 2P', monospace;
    font-size: 11px;
    color: var(--mp-text);
    display: flex;
    align-items: center;
    gap: 6px;
}

.mp-roster__crown {
    font-size: 16px;
    line-height: 1;
    margin-bottom: 6px;
}

.mp-roster__status {
    font-family: 'Space Mono', monospace;
    font-size: 9px;
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 700;
}

.mp-roster__status--host {
    background: var(--mp-accent);
    color: #fff;
}

.mp-roster__status--ready {
    background: var(--mp-green);
    color: #fff;
}

.mp-roster__status--waiting {
    background: #e0dbd3;
    color: #999;
}

/* Ready toggle button */
.mp-ready-btn {
    width: 100%;
    margin-top: 16px;
    font-family: 'Press Start 2P', monospace;
    font-size: 9px;
    padding: 12px;
    border: 2.5px solid var(--mp-border);
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.08s, box-shadow 0.08s, background 0.15s;
    box-shadow: var(--mp-shadow-sm);
    outline: none;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.mp-ready-icon,
.mp-btn-icon {
    font-family: 'Space Mono', monospace;
    font-size: 14px;
    line-height: 1;
    margin-top: -4px;
}

.mp-ready-btn--unready {
    background: var(--mp-green);
    color: #fff;
}

.mp-ready-btn--ready {
    background: var(--mp-card);
    color: var(--mp-text);
}

.mp-ready-btn:hover {
    transform: translate(-1px, -1px);
    box-shadow: 4px 4px 0px #1a1a1a;
}

/* ── Live Leaderboard (in-game Bento card) ───────────────────── */

.mp-leaderboard {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mp-lb-entry {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-radius: 8px;
    background: var(--mp-bg);
    border: 2px solid #e0dbd3;
    margin-bottom: 6px;
    transition: all 0.2s ease;
}

.mp-lb-entry:hover {
    transform: translateX(2px);
    border-color: #d0cbc3;
}

.mp-lb-entry--you {
    border-color: var(--mp-accent);
    background: #fff5f0;
    box-shadow: 0 2px 8px rgba(255, 92, 0, 0.15);
}

.mp-lb-entry--dead {
    opacity: 0.5;
    filter: grayscale(0.5);
}

.mp-lb-entry--disconnected {
    opacity: 0.35;
    filter: grayscale(1);
}

.mp-lb-entry--disconnected .mp-lb-name {
    text-decoration: line-through;
}

.mp-lb-rank {
    font-family: 'Press Start 2P', monospace;
    font-size: 10px;
    color: #999;
    width: 28px;
    text-align: center;
    flex-shrink: 0;
}

.mp-lb-entry:first-child .mp-lb-rank {
    color: #fbbf24;
    font-size: 11px;
}

.mp-lb-name {
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    color: var(--mp-text);
    flex: 1;
    margin: 0 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mp-lb-score {
    font-family: 'Press Start 2P', monospace;
    font-size: 12px;
    color: var(--mp-accent);
    flex-shrink: 0;
    min-width: 50px;
    text-align: right;
    font-weight: bold;
}

.mp-game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2.5px dashed var(--mp-border);
}

.mp-live-lb-title {
    font-family: 'Press Start 2P', monospace;
    font-size: 11px;
    color: var(--mp-text);
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.mp-live-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: 'Press Start 2P', monospace;
    font-size: 7px;
    color: var(--mp-red);
    background: #fff;
    padding: 6px 10px;
    border-radius: 8px;
    border: 2.5px solid var(--mp-border);
    box-shadow: 2px 2px 0px var(--mp-border);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.mp-live-dot {
    width: 6px;
    height: 6px;
    background: var(--mp-red);
    border-radius: 50%;
    animation: mp-blink-hard 1s steps(2, start) infinite;
}

.mp-leaderboard-container {
    background: transparent;
    border-radius: 8px;
    height: calc(100% - 40px);
    overflow-y: auto;
}

.mp-leaderboard--active .mp-lb-entry {
    background: #fff;
    border: 2.5px solid var(--mp-border);
    margin-bottom: 8px;
    margin-right: 3px;
    padding: 12px 14px;
    border-radius: 8px;
    transition: transform 0.08s ease, box-shadow 0.08s ease;
    box-shadow: 2px 2px 0px var(--mp-border);
}

.mp-leaderboard--active .mp-lb-entry:last-child {
    margin-bottom: 0;
}

.mp-leaderboard--active .mp-lb-entry:hover {
    transform: translate(-1px, -1px);
    box-shadow: 3px 3px 0px var(--mp-border);
    border-color: var(--mp-border);
}

.mp-game-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
}

.mp-end-game-btn {
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    background: var(--mp-red);
    color: #fff;
    border: 2.5px solid var(--mp-border);
    border-radius: 8px;
    padding: 12px 16px;
    cursor: pointer;
    transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.15s;
    display: flex;
    align-items: center;
    gap: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 4px 4px 0px var(--mp-border);
}

.mp-end-game-btn:hover {
    transform: translate(-1px, -1px);
    box-shadow: 5px 5px 0px var(--mp-border);
    background: #b91c1c;
}

.mp-end-game-btn:active {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0px var(--mp-border);
}

.mp-end-game-icon {
    font-size: 10px;
}

.mp-game-info {
    font-family: 'Space Mono', monospace;
    font-size: 9px;
    color: #666;
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    justify-content: center;
}

.mp-pulse-dot {
    width: 8px;
    height: 8px;
    background: #16a34a;
    border-radius: 50%;
    animation: mp-pulse 2s ease-in-out infinite;
}

@keyframes mp-pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.5;
        transform: scale(0.8);
    }
}

@media (prefers-reduced-motion: no-preference) {
    .mp-flash-green {
        animation: mp-flash-g 0.3s ease;
    }

    .mp-flash-red {
        animation: mp-flash-r 0.3s ease;
    }

    @keyframes mp-flash-g {
        0% {
            background: rgba(22, 163, 74, 0.3);
        }

        100% {
            background: transparent;
        }
    }

    @keyframes mp-flash-r {
        0% {
            background: rgba(220, 38, 38, 0.3);
        }

        100% {
            background: transparent;
        }
    }
}

/* ── Settings Lock Overlay ───────────────────────────────────── */

.mp-settings-lock {
    position: absolute;
    inset: 0;
    background: 
        repeating-linear-gradient(
            -45deg,
            transparent,
            transparent 10px,
            rgba(26, 26, 26, 0.05) 10px,
            rgba(26, 26, 26, 0.05) 20px
        ),
        rgba(240, 235, 227, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: var(--mp-radius);
}

.mp-settings-lock__glass {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
    background: #fff;
    border: 2.5px solid var(--mp-border);
    border-radius: 8px;
    box-shadow: 4px 4px 0px var(--mp-border);
    transform: translateY(0);
}

.mp-settings-lock__icon {
    font-size: 14px;
}

.mp-settings-lock__text {
    font-family: 'Press Start 2P', monospace;
    font-size: 7px;
    color: var(--mp-text);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ── Countdown Overlay ───────────────────────────────────────── */

.mp-countdown-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(26, 26, 26, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}

.mp-countdown-overlay--visible {
    opacity: 1;
    visibility: visible;
}

.mp-countdown-number {
    font-family: 'Press Start 2P', monospace;
    font-size: 72px;
    color: #fff;
    text-shadow: 6px 6px 0px var(--mp-accent), 0 0 20px rgba(255, 92, 0, 0.5);
    letter-spacing: 2px;
}

@media (prefers-reduced-motion: no-preference) {
    .mp-countdown-number {
        animation: mp-countdown-pop 0.8s ease-out;
    }

    @keyframes mp-countdown-pop {
        0% {
            transform: scale(2);
            opacity: 0;
        }

        50% {
            transform: scale(1);
            opacity: 1;
        }

        100% {
            transform: scale(0.95);
            opacity: 0.9;
        }
    }
}

/* ── Post-Game Modal Extras ──────────────────────────────────── */

.mp-winner-announce {
    text-align: center;
    padding: 20px 0 12px;
    border-bottom: 2px dashed #e0dbd3;
    margin-bottom: 16px;
}

.mp-winner-crown {
    font-size: 48px;
    display: block;
    margin-bottom: 12px;
    animation: mp-crown-bounce 0.6s ease-in-out;
}

@media (prefers-reduced-motion: no-preference) {
    @keyframes mp-crown-bounce {

        0%,
        100% {
            transform: translateY(0) rotate(0deg);
        }

        25% {
            transform: translateY(-10px) rotate(-5deg);
        }

        75% {
            transform: translateY(-10px) rotate(5deg);
        }
    }
}

.mp-winner-name {
    font-family: 'Press Start 2P', monospace;
    font-size: 13px;
    color: var(--mp-accent);
    margin-bottom: 6px;
    line-height: 1.6;
}

.mp-winner-label {
    font-family: 'Space Mono', monospace;
    font-size: 12px;
    color: #999;
    font-weight: 700;
    letter-spacing: 2px;
}


/* ── Toast System ────────────────────────────────────────────── */

.mp-toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: var(--mp-toast-z);
    display: flex;
    flex-direction: column-reverse;
    gap: 12px;
    pointer-events: none;
    max-width: 400px;
}

@media (max-width: 700px) {
    .mp-toast-container {
        bottom: 16px;
        right: 16px;
        left: 16px;
        max-width: none;
    }
}

.mp-toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border: 2.5px solid var(--mp-border);
    border-radius: 10px;
    box-shadow: 4px 4px 0px var(--mp-border), 0 4px 12px rgba(0, 0, 0, 0.15);
    font-family: 'Space Mono', monospace;
    font-size: 13px;
    color: var(--mp-text);
    pointer-events: auto;
    opacity: 0;
    transform: translateX(30px) scale(0.95);
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    line-height: 1.5;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.mp-toast--visible {
    opacity: 1;
    transform: translateX(0) scale(1);
}

.mp-toast--exit {
    opacity: 0;
    transform: translateX(30px) scale(0.9);
    transition: opacity 0.25s ease, transform 0.25s ease;
}


.mp-toast--info {
    background: linear-gradient(135deg, #e0f2fe 0%, #f0f9ff 100%);
    border-color: var(--mp-blue);
}

.mp-toast--info .mp-toast__icon {
    color: var(--mp-blue);
}

.mp-toast--success {
    background: linear-gradient(135deg, #dcfce7 0%, #f0fdf4 100%);
    border-color: var(--mp-green);
}

.mp-toast--success .mp-toast__icon {
    color: var(--mp-green);
}

.mp-toast--warning {
    background: linear-gradient(135deg, #fff7ed 0%, #fffbf5 100%);
    border-color: var(--mp-accent);
}

.mp-toast--warning .mp-toast__icon {
    color: var(--mp-accent);
}

.mp-toast--error {
    background: linear-gradient(135deg, #fee2e2 0%, #fef2f2 100%);
    border-color: var(--mp-red);
}

.mp-toast--error .mp-toast__icon {
    color: var(--mp-red);
}

.mp-toast--neutral {
    background: linear-gradient(135deg, #f5f5f5 0%, #ffffff 100%);
    border-color: var(--mp-border);
}

.mp-toast--neutral .mp-toast__icon {
    color: #666;
}

/* Icon styling */
.mp-toast__icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mp-toast__icon svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

/* Message text */
.mp-toast__msg {
    flex: 1;
    line-height: 1.5;
    font-weight: 500;
}

/* Close button */
.mp-toast__close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #999;
    padding: 4px;
    line-height: 1;
    flex-shrink: 0;
    border-radius: 4px;
    transition: background 0.15s, color 0.15s, transform 0.08s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.mp-toast__close:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--mp-text);
    transform: scale(1.1);
}

.mp-toast__close:active {
    transform: scale(0.95);
}

.mp-toast__close svg {
    width: 12px;
    height: 12px;
}

/* Progress bar */
.mp-toast__progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.mp-toast__progress-bar {
    height: 100%;
    width: 100%;
    transform-origin: left;
    transition: transform 0s linear;
}

.mp-toast--info .mp-toast__progress-bar {
    background: var(--mp-blue);
}

.mp-toast--success .mp-toast__progress-bar {
    background: var(--mp-green);
}

.mp-toast--warning .mp-toast__progress-bar {
    background: var(--mp-accent);
}

.mp-toast--error .mp-toast__progress-bar {
    background: var(--mp-red);
}

.mp-toast--neutral .mp-toast__progress-bar {
    background: #666;
}

/* Hover pause effect */
.mp-toast:hover .mp-toast__progress-bar {
    animation-play-state: paused;
}

/* Stacking animation */
@media (prefers-reduced-motion: no-preference) {
    .mp-toast {
        animation: mp-toast-bounce 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    }

    @keyframes mp-toast-bounce {
        0% {
            transform: translateX(100px) scale(0.8);
            opacity: 0;
        }
        50% {
            transform: translateX(-5px) scale(1.02);
        }
        100% {
            transform: translateX(0) scale(1);
            opacity: 1;
        }
    }
}

/* ── Bento Card Morph States ─────────────────────────────────── */

/* When card is in lobby mode */
.card--about.mp-morphed .about-body,
.card--about.mp-morphed .bookmark-hint,
.card--about.mp-morphed>.card__label {
    display: none;
}

.card--legend.mp-morphed .legend-list,
.card--legend.mp-morphed>.card__label {
    display: none;
}

/* ── Error Banner ────────────────────────────────────────────── */

.mp-error-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9998;
    background: var(--mp-red);
    color: #fff;
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    padding: 10px 20px;
    text-align: center;
    line-height: 1.6;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
}

.mp-error-banner__close {
    background: none;
    border: none;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    margin-left: 12px;
    vertical-align: middle;
}

/* ── Connection Status Dot (in header FAB area) ──────────────── */

.mp-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-left: 4px;
    vertical-align: middle;
}

.mp-status-dot--connected {
    background: var(--mp-green);
}

.mp-status-dot--connecting {
    background: var(--mp-accent);
}

.mp-status-dot--disconnected {
    background: var(--mp-red);
}

@media (prefers-reduced-motion: no-preference) {
    .mp-status-dot--connecting {
        animation: mp-dot-blink 1s ease-in-out infinite;
    }

    @keyframes mp-dot-blink {

        0%,
        100% {
            opacity: 1;
        }

        50% {
            opacity: 0.3;
        }
    }
}


/* ── Waiting Overlay (Dead Player) ────────────────────────────── */

.mp-waiting-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(26, 26, 26, 0.95);
    z-index: 10050;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.mp-waiting-overlay--visible {
    opacity: 1;
    pointer-events: all;
}

.mp-waiting-content {
    background: var(--mp-card);
    border: 3px solid var(--mp-border);
    border-radius: var(--mp-radius);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    padding: 32px;
    max-width: 500px;
    width: 90%;
    text-align: center;
}

.mp-waiting-skull {
    font-size: 64px;
    margin-bottom: 16px;
    animation: mp-skull-float 2s ease-in-out infinite;
}

@keyframes mp-skull-float {

    0%,
    100% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-10px);
    }
}

.mp-waiting-text {
    font-family: 'Press Start 2P', monospace;
    font-size: 18px;
    color: var(--mp-text);
    margin-bottom: 12px;
}

.mp-waiting-score {
    font-family: 'Space Mono', monospace;
    font-size: 14px;
    color: #666;
    margin-bottom: 24px;
}

.mp-waiting-score span {
    font-family: 'Press Start 2P', monospace;
    font-size: 16px;
    color: var(--mp-accent);
    font-weight: bold;
}

.mp-waiting-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-family: 'Space Mono', monospace;
    font-size: 12px;
    color: #999;
    margin-bottom: 24px;
    padding: 12px;
    background: var(--mp-bg);
    border-radius: 8px;
}

.mp-waiting-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #e0dbd3;
    border-top-color: var(--mp-accent);
    border-radius: 50%;
    animation: mp-spin 1s linear infinite;
}

@keyframes mp-spin {
    to {
        transform: rotate(360deg);
    }
}

.mp-waiting-lb-container {
    margin-top: 24px;
    text-align: left;
}

.mp-waiting-lb-title {
    font-family: 'Press Start 2P', monospace;
    font-size: 10px;
    color: var(--mp-text);
    margin-bottom: 12px;
    text-align: center;
}

.mp-waiting-lb-container .mp-leaderboard {
    max-height: 250px;
    overflow-y: auto;
}


/* ── Confirmation Modal ──────────────────────────────────────── */

.mp-confirm-overlay {
    position: fixed;
    inset: 0;
    z-index: 10100;
    background: rgba(26, 26, 26, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.mp-confirm-overlay--visible {
    opacity: 1;
    visibility: visible;
}

.mp-confirm-modal {
    background: var(--mp-card);
    border: 3px solid var(--mp-border);
    box-shadow: 8px 8px 0px #1a1a1a;
    border-radius: var(--mp-radius);
    width: 100%;
    max-width: 420px;
    padding: 24px;
    position: relative;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.25s ease;
}

.mp-confirm-overlay--visible .mp-confirm-modal {
    transform: scale(1) translateY(0);
}

.mp-confirm-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 2px dashed #e0dbd3;
}

.mp-confirm-icon {
    font-size: 32px;
    line-height: 1;
}

.mp-confirm-title {
    font-family: 'Press Start 2P', monospace;
    font-size: 14px;
    color: var(--mp-text);
    margin: 0;
    letter-spacing: 0.5px;
}

.mp-confirm-message {
    font-family: 'Space Mono', monospace;
    font-size: 13px;
    color: #666;
    line-height: 1.6;
    margin: 0 0 20px 0;
}

.mp-confirm-actions {
    display: flex;
    gap: 10px;
}

.mp-confirm-actions .mp-btn {
    flex: 1;
}
