/* ═══════════════════════════════════════════════════════════
   Match-Detail-Modal — Statistik-Overlay
   ═══════════════════════════════════════════════════════════ */

/* ── Overlay ───────────────────────────────────────────── */
.md-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 2rem 1rem;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    overflow-y: auto;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.md-modal-overlay.md-modal-visible {
    opacity: 1;
}

/* ── Modal Box ─────────────────────────────────────────── */
.md-modal-box {
    position: relative;
    width: 100%;
    max-width: 680px;
    margin: 1rem auto;
    background: linear-gradient(160deg, #0f1923, #162536);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    color: #c9d1d9;
    overflow: hidden;
    transform: translateY(20px);
    transition: transform 0.25s ease;
}
.md-modal-visible .md-modal-box {
    transform: translateY(0);
}

/* ── Close Button ──────────────────────────────────────── */
.md-modal-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 10;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: #7a8ea0;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
.md-modal-close:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

/* ── Loading ───────────────────────────────────────────── */
.md-modal-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 3rem 2rem;
    color: #7a8ea0;
    text-align: center;
}

/* ── Header ────────────────────────────────────────────── */
.md-modal-header {
    padding: 1.25rem 1.5rem 0.5rem;
}
.md-modal-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}
.md-modal-board,
.md-modal-time {
    font-size: 0.8rem;
    color: #7a8ea0;
}
.md-modal-board i,
.md-modal-time i {
    margin-right: 0.3rem;
    font-size: 0.7rem;
}

/* ── Score Bar ─────────────────────────────────────────── */
.md-modal-score {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    padding: 1rem 1.5rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.md-modal-player {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    justify-content: flex-end;
}
.md-modal-player-right {
    justify-content: flex-start;
}
.md-player-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: #e1e8ee;
}
.md-winner .md-player-name {
    color: #d4a017;
}
.md-trophy {
    color: #d4a017;
    font-size: 0.9rem;
}
.md-modal-legs {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0;
}
.md-legs-num {
    font-size: 1.8rem;
    font-weight: 800;
    color: #4a5568;
    min-width: 1.8rem;
    text-align: center;
    line-height: 1;
}
.md-legs-win {
    color: #d4a017;
}
.md-legs-sep {
    font-size: 1.4rem;
    color: #4a5568;
    font-weight: 300;
}

/* ── Section ───────────────────────────────────────────── */
.md-modal-section {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}
.md-modal-section-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #7a8ea0;
    margin: 0 0 0.75rem;
}
.md-modal-section-title i {
    margin-right: 0.4rem;
    font-size: 0.7rem;
}

/* ── Stats Table ───────────────────────────────────────── */
.md-stats-table {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.md-stat-row {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 0.75rem;
    align-items: center;
    padding: 0.45rem 0.75rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 6px;
}
.md-stat-row:nth-child(odd) {
    background: rgba(255, 255, 255, 0.04);
}
.md-stat-label {
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: #7a8ea0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}
.md-stat-val {
    font-size: 0.95rem;
    font-weight: 700;
    color: #c9d1d9;
}
.md-stat-val:first-child {
    text-align: right;
}
.md-stat-val:last-child {
    text-align: left;
}
.md-stat-better {
    color: #d4a017;
}

/* ── Leg Timeline ──────────────────────────────────────── */
.md-legs-timeline {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.md-leg-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.4rem 0.75rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 6px;
    font-size: 0.85rem;
}
.md-leg-item:nth-child(odd) {
    background: rgba(255, 255, 255, 0.04);
}
.md-leg-num {
    font-weight: 700;
    color: #7a8ea0;
    font-size: 0.75rem;
    min-width: 42px;
}
.md-leg-winner {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-weight: 600;
    color: #e1e8ee;
    min-width: 100px;
}
.md-leg-detail {
    color: #7a8ea0;
    font-size: 0.78rem;
    margin-left: auto;
}
.md-leg-active {
    opacity: 0.5;
}
.md-leg-info {
    color: #7a8ea0;
    font-style: italic;
    font-size: 0.8rem;
}
.md-empty-hint {
    color: #7a8ea0;
    font-size: 0.85rem;
    text-align: center;
    padding: 0.5rem 0;
}

/* ── Vision 180 Feed ───────────────────────────────────── */
.md-v180-feed {
    max-height: 260px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
    scrollbar-width: thin;
    scrollbar-color: #2a4058 transparent;
}
.md-v180-feed::-webkit-scrollbar { width: 5px; }
.md-v180-feed::-webkit-scrollbar-thumb { background: #2a4058; border-radius: 3px; }

.md-v180-msg {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.35rem 0.6rem;
    border-radius: 4px;
    font-size: 0.8rem;
    line-height: 1.4;
    background: rgba(255, 255, 255, 0.02);
}
.md-v180-msg:nth-child(odd) {
    background: rgba(255, 255, 255, 0.04);
}
.md-v180-time {
    color: #4a5568;
    font-size: 0.7rem;
    font-weight: 600;
    min-width: 38px;
    flex-shrink: 0;
    padding-top: 1px;
}
.md-v180-icon {
    color: #4a5568;
    font-size: 0.65rem;
    flex-shrink: 0;
    padding-top: 3px;
}
.md-v180-text {
    color: #a0adb8;
}
.md-v180-highlight {
    background: rgba(212, 160, 23, 0.08) !important;
}
.md-v180-highlight .md-v180-icon {
    color: #d4a017;
}
.md-v180-highlight .md-v180-text {
    color: #d4a017;
    font-weight: 600;
}
.md-v180-end .md-v180-icon {
    color: var(--success, #22c55e);
}

/* ── Mobile ────────────────────────────────────────────── */
@media (max-width: 768px) {
    .md-modal-overlay {
        padding: 0.5rem;
    }
    .md-modal-box {
        max-width: 100%;
        border-radius: 12px;
        margin: 0.5rem auto;
    }
    .md-modal-score {
        gap: 0.75rem;
        padding: 0.75rem 1rem;
    }
    .md-player-name {
        font-size: 0.9rem;
    }
    .md-legs-num {
        font-size: 1.4rem;
    }
    .md-modal-section {
        padding: 0.75rem 1rem;
    }
    .md-stat-row {
        gap: 0.4rem;
        padding: 0.35rem 0.5rem;
    }
    .md-stat-val {
        font-size: 0.85rem;
    }
    .md-stat-label {
        font-size: 0.65rem;
    }
    .md-leg-item {
        flex-wrap: wrap;
    }
    .md-leg-detail {
        width: 100%;
        margin-left: 0;
        padding-left: calc(42px + 0.75rem);
    }
}
