/* ---------------- ENEMY CONTACT: POPUP OVER THE MATCH (Esc) ---------------- */
/* Class selection, statistics and the end of the match (markup: EnemyContactBundle play.html.twig).
   Same look as the game menu (/css/game-menu.css) in the Enemy Contact palette. */

/* Before the first class is chosen the match is not shown yet: the menu picture is behind the popup */
body {
    background: #10130e url(/enemy-contact/images/slides/jg.jpg) center / cover no-repeat fixed;
}

/* Palette of the popup and the loader */
:root {
    --ec-accent:      #c0841a;
    --ec-accent-hi:   #d8961f;
    --ec-accent-text: #f0b24a;
    --ec-white:       #f5f5f5;
    --ec-gray-200:    #d4d4d4;
    --ec-gray-400:    #b0b0b0;
    --ec-gray-800:    #3a3d33;
    --ec-line:        rgba(255, 255, 255, 0.14);
}

#menu-interface {
    position: fixed;
    inset: 0;
    z-index: 1000;
    overflow-y: auto;
    padding: 24px 16px;
    box-sizing: border-box;
    font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--ec-white);
    text-align: center;
    /* The match stays visible behind the popup, only darkened */
    background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.35) 30%, rgba(0, 0, 0, 0.75) 100%);
}

#menu-interface *,
#menu-interface *::before,
#menu-interface *::after {
    box-sizing: border-box;
}

.ec-popup-card {
    width: 100%;
    max-width: 880px;
    margin: auto;
    overflow: hidden;
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(46, 49, 40, 0.94), rgba(30, 32, 27, 0.94));
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.06),
        0 24px 60px rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
}

/* Hazard stripes, as in the game menu */
.ec-popup-kerb {
    height: 10px;
    background: repeating-linear-gradient(135deg, var(--ec-accent) 0 18px, #1d1f19 18px 36px);
}

.ec-popup-header {
    position: relative;
    padding: 18px 24px 6px;
}

/* Exit to the game menu: a small link in the top left corner, away from the game buttons */
.ec-popup-exit {
    position: absolute;
    top: 12px;
    left: 14px;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-decoration: none;
    color: var(--ec-gray-400);
    border: 1px solid rgba(255, 255, 255, 0.12);
    transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.ec-popup-exit:hover,
.ec-popup-exit:focus-visible {
    color: var(--ec-white);
    border-color: rgba(255, 90, 79, 0.6);
    background: rgba(225, 6, 0, 0.15);
}

@media (max-width: 600px) {
    /* No room next to the title: the link goes above it */
    .ec-popup-exit {
        position: static;
        display: inline-block;
        margin-bottom: 8px;
    }
}

.ec-popup-eyebrow {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--ec-accent-text);
}

.ec-popup-title {
    margin: 4px 0 0;
    font-size: 32px;
    font-weight: 800;
    font-style: italic;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ec-white);
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.45);
}

.ec-popup-title::after {
    content: '';
    display: block;
    width: 64px;
    height: 4px;
    margin: 10px auto 0;
    background: var(--ec-accent);
    transform: skewX(-20deg);
}

.ec-popup-actions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    padding: 14px 24px;
}

/* ---- Buttons ---- */
.ec-btn {
    display: inline-block;
    min-width: 180px;
    padding: 11px 20px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 8px;
    text-align: center;
    text-decoration: none;
    font: inherit;
    font-size: 15px;
    font-weight: 800;
    font-style: italic;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ec-white);
    background: var(--ec-gray-800);
    cursor: pointer;
    transition: transform 0.15s ease, background-color 0.15s ease;
}

.ec-btn:hover,
.ec-btn:focus-visible {
    color: var(--ec-white);
    background: #4a4e41;
    transform: translateY(-1px);
}

.ec-btn:focus-visible {
    outline: 2px solid var(--ec-white);
    outline-offset: 3px;
}

.ec-btn:disabled {
    opacity: 0.5;
    cursor: default;
    transform: none;
}

.ec-btn-primary {
    border-color: var(--ec-accent);
    background: var(--ec-accent);
    box-shadow: 0 6px 18px rgba(192, 132, 26, 0.35);
}

.ec-btn-primary:hover,
.ec-btn-primary:focus-visible {
    background: var(--ec-accent-hi);
}

.ec-btn-ghost {
    background: transparent;
}

.ec-btn-ghost:hover,
.ec-btn-ghost:focus-visible {
    background: rgba(255, 255, 255, 0.08);
}

#menu-interface .ec-btn.hide {
    display: none;
}

/* ---- Class selection ---- */
.ec-classes {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    padding: 6px 24px 24px;
}

.ec-class {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ec-class-image {
    overflow: hidden;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(0, 0, 0, 0.3);
}

.ec-class-image img {
    display: block;
    width: 100%;
    height: auto;
}

/* The class is taken while the player is alive (game-popup.js adds "disabled") */
.ec-class-image.disabled {
    opacity: 0.55;
}

.ec-class-name {
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--ec-gray-200);
}

.ec-class .ec-btn {
    min-width: 0;
    width: 100%;
}

/* ---- Statistics ---- */
#change-statistics {
    padding: 4px 24px 20px;
}

#statistics_map {
    margin-bottom: 10px;
    font-size: 30px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

#menu-interface .statistics-content {
    width: 100%;
    max-height: 50vh;
    overflow-y: auto;
}

#menu-interface .statistics-content table {
    width: 100%;
    border-collapse: collapse;
}

#menu-interface .statistics-content thead td {
    padding: 0 8px 8px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--ec-gray-400);
    border-bottom: 2px dashed var(--ec-line);
}

#menu-interface .statistics-content tbody td {
    padding: 7px 8px;
}

/* ---- End of the match ---- */
.ec-end-status {
    padding: 4px 24px 10px;
    font-size: 42px;
    font-weight: 800;
    font-style: italic;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ec-accent-text);
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.45);
}

/* ---- Small screens ---- */
@media (max-width: 600px) {
    .ec-classes {
        grid-template-columns: 1fr;
    }

    .ec-btn {
        min-width: 0;
        flex: 1 1 140px;
    }

    .ec-popup-title {
        font-size: 24px;
    }
}

@media (max-height: 520px) {
    #menu-interface {
        padding: 8px;
    }

    .ec-popup-header {
        padding: 8px 20px 2px;
    }

    .ec-popup-title {
        font-size: 20px;
    }

    .ec-classes {
        gap: 10px;
        padding-bottom: 12px;
    }

    .ec-class-image img {
        max-height: 30vh;
        object-fit: contain;
    }
}

/* ---------------- LOADING OF THE MATCH ---------------- */
#loading-page {
    position: fixed;
    inset: 0;
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
    font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--ec-white);
    text-align: center;
    /* The menu picture of the page body, darkened */
    background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.35) 30%, rgba(0, 0, 0, 0.8) 100%);
}

.ec-loader {
    width: 100%;
    max-width: 560px;
    overflow: hidden;
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(46, 49, 40, 0.94), rgba(30, 32, 27, 0.94));
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.06),
        0 24px 60px rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    animation: ec-loader-in 0.4s ease-out both;
}

.ec-loader-body {
    padding: 22px 28px 24px;
}

.ec-loader-title {
    margin-top: 6px;
    font-size: 26px;
    font-weight: 800;
    font-style: italic;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.45);
}

/* Progress bar: the filled part grows, the stripes run while something is loading */
.ec-loader-bar {
    position: relative;
    height: 12px;
    margin-top: 20px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.ec-loader-bar-fill {
    width: 4%;
    height: 100%;
    border-radius: inherit;
    background: repeating-linear-gradient(135deg, var(--ec-accent) 0 12px, var(--ec-accent-hi) 12px 24px);
    background-size: 34px 34px;
    box-shadow: 0 0 14px rgba(240, 178, 74, 0.45);
    transition: width 0.6s ease;
    animation: ec-loader-stripes 0.8s linear infinite;
}

.ec-loader-status {
    margin-top: 10px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--ec-gray-200);
    font-variant-numeric: tabular-nums;
}

/* Controls */
.ec-loader-keys {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 18px;
    margin: 22px 0 0;
    padding: 16px 0 0;
    list-style: none;
    text-align: left;
    font-size: 13px;
    color: var(--ec-gray-400);
    border-top: 2px dashed var(--ec-line);
}

.ec-loader-keys li {
    display: flex;
    align-items: center;
    gap: 4px;
}

.ec-loader-keys kbd {
    display: inline-block;
    min-width: 24px;
    padding: 2px 6px;
    border-radius: 5px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    text-align: center;
    color: var(--ec-white);
    background: var(--ec-gray-800);
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.5);
}

.ec-loader-keys kbd:last-of-type {
    margin-right: 6px;
}

@keyframes ec-loader-stripes {
    to { background-position: 34px 0; }
}

@keyframes ec-loader-in {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to   { opacity: 1; transform: none; }
}

@media (max-width: 480px) {
    .ec-loader-keys {
        grid-template-columns: 1fr;
    }

    .ec-loader-title {
        font-size: 20px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ec-loader,
    .ec-loader-bar-fill {
        animation: none;
    }
}

/* ---------------- BACK TO THE GAME WITHOUT THE MOUSE CAPTURE ---------------- */
#ec-resume {
    position: fixed;
    inset: 0;
    z-index: 950;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.25);
}

#ec-resume[hidden] {
    display: none;
}

.ec-resume-text {
    padding: 12px 26px;
    border-radius: 8px;
    font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    font-weight: 800;
    font-style: italic;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ec-white);
    background: rgba(30, 32, 27, 0.9);
    border: 1px solid var(--ec-accent);
}
