/* Era dos Imperios — mobile clássico ampliado.
   Mantém o menu superior em duas colunas e preserva o formato original do jogo.
   O conteúdo inteiro é ampliado proporcionalmente, sem transformar tabelas em cartões. */

.edi-mobile-nav,
.edi-mobile-bottom-nav {
    display: none;
}

.edi-mobile-content-scroll {
    display: block;
}

.edi-status-summary-table {
    display: grid;
    grid-template-columns: 54px 54px 96px 82px 66px;
    justify-content: center;
    align-items: stretch;
    width: 100%;
    max-width: 390px;
    margin: 0 auto;
    font-family: Verdana, Arial, sans-serif;
    line-height: 1.2;
}

.edi-status-summary-item {
    min-width: 0;
    text-align: center;
}

.edi-status-summary-head,
.edi-status-summary-value {
    display: block;
    box-sizing: border-box;
    white-space: nowrap;
    overflow: hidden;
}

.edi-status-summary-head {
    padding: 3px 1px;
    background: #663300;
    color: #fff;
    font-size: 10px;
    font-weight: bold;
}

.edi-status-summary-value {
    min-height: 21px;
    padding: 4px 1px 1px;
    color: #000;
    font-size: 11px;
    font-weight: bold;
}

.edi-status-summary-health .edi-status-summary-value {
    color: #8b1209;
}

body.edi-game-page .edi-empire-status-card {
    border-collapse: collapse !important;
    border-spacing: 0 !important;
    table-layout: fixed !important;
    width: 514px !important;
    min-width: 514px !important;
    max-width: none !important;
}

body.edi-game-page .edi-empire-status-card .edi-scroll-bg-top,
body.edi-game-page .edi-empire-status-card .edi-scroll-bg-mid,
body.edi-game-page .edi-empire-status-card .edi-scroll-bg-bottom {
    width: auto !important;
    max-width: none !important;
    overflow: hidden !important;
}

body.edi-game-page .edi-empire-status-card .edi-scroll-bg-top {
    background-image: url('../images/scrooltop.gif') !important;
    background-repeat: no-repeat !important;
    background-position: left top !important;
    background-size: 100% 80px !important;
}

body.edi-game-page .edi-empire-status-card .edi-scroll-bg-mid {
    background-image: url('../images/scroolmid.gif') !important;
    background-repeat: repeat-y !important;
    background-position: left top !important;
    background-size: 100% 30px !important;
}

body.edi-game-page .edi-empire-status-card .edi-scroll-img-bottom {
    display: block !important;
    width: 100% !important;
    min-width: 100% !important;
    height: 30px !important;
}

body.edi-game-page .edi-empire-status-card .edi-scroll-side-top,
body.edi-game-page .edi-empire-status-card .edi-scroll-side-mid,
body.edi-game-page .edi-empire-status-card .edi-scroll-side-bottom {
    width: 14px !important;
    min-width: 14px !important;
    max-width: 14px !important;
    padding: 0 !important;
}

@media (max-width: 760px) {
    html,
    body.edi-game-page {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        margin: 0 !important;
        /* Mantém o layout atual, mas permite navegar lateralmente após usar o zoom. */
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-x: auto;
        -webkit-text-size-adjust: 100%;
    }

    html {
        background: #eadcaf !important;
    }

    body.edi-game-page {
        min-height: 100dvh !important;
        padding: 0 0 76px !important;
        background: #eadcaf !important;
        color: #2b2117;
        /* Libera pinça, movimento vertical e movimento horizontal no celular. */
        touch-action: auto;
    }

    body.edi-game-page .edi-mobile-nav {
        display: block;
        position: sticky;
        top: 0;
        z-index: 9999;
        box-sizing: border-box;
        width: 100%;
        padding: 5px 7px;
        border-bottom: 2px solid #b98d42;
        background: #21150f;
        box-shadow: 0 2px 8px rgba(0,0,0,.32);
    }

    body.edi-game-page .edi-mobile-title {
        margin: 0 0 4px;
        color: #f7e6b7;
        text-align: center;
        font: bold 14px/1.15 Verdana, Arial, sans-serif;
    }

    body.edi-game-page .edi-mobile-view-tools {
        display: none !important;
    }

    body.edi-game-page .edi-mobile-nav details {
        overflow: hidden;
        border: 1px solid #8d6a32;
        border-radius: 6px;
        background: #efe2b9;
    }

    body.edi-game-page .edi-mobile-nav summary {
        min-height: 36px;
        padding: 8px 11px;
        color: #5c1b12;
        cursor: pointer;
        list-style: none;
        font: bold 14px/1.2 Verdana, Arial, sans-serif;
    }

    body.edi-game-page .edi-mobile-nav summary::-webkit-details-marker {
        display: none;
    }

    body.edi-game-page .edi-mobile-links {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 7px;
        padding: 8px;
        border-top: 1px solid rgba(92,27,18,.2);
        background: #fff5d5;
    }

    body.edi-game-page .edi-mobile-links a {
        display: flex;
        align-items: center;
        justify-content: center;
        box-sizing: border-box;
        min-width: 0;
        min-height: 42px;
        padding: 9px 6px;
        border: 1px solid rgba(92,27,18,.2);
        border-radius: 7px;
        background: #f8edc7;
        color: #5c1b12 !important;
        text-align: center;
        text-decoration: none !important;
        overflow-wrap: anywhere;
        font: bold 13px/1.25 Verdana, Arial, sans-serif;
    }

    /* Estrutura clássica: apenas retira as laterais decorativas e o menu antigo. */
    body.edi-game-page .edi-shell {
        display: block !important;
        width: 514px;
        min-width: 514px;
        max-width: none;
        margin: 8px 0 14px 3px !important;
        padding: 0 !important;
        background: #f0e5bd !important;
        text-align: left !important;
        transform-origin: top left !important;
        -webkit-transform-origin: top left !important;
    }

    body.edi-game-page .edi-frame {
        width: 514px;
        min-width: 514px;
        max-width: none;
        margin: 0 !important;
        border: 0 !important;
        background: #f0e5bd !important;
        table-layout: auto !important;
    }

    body.edi-game-page .edi-frame-top,
    body.edi-game-page .edi-frame-bottom,
    body.edi-game-page .edi-side-border,
    body.edi-game-page .edi-sidebar,
    body.edi-game-page .edi-content-leftmark,
    body.edi-game-page .edi-content-rightmark,
    body.edi-game-page .edi-content-corner,
    body.edi-game-page .edi-content-bottommark {
        display: none !important;
        width: 0 !important;
        height: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
        overflow: hidden !important;
    }

    body.edi-game-page .edi-inner-frame,
    body.edi-game-page .edi-maincell,
    body.edi-game-page .edi-content-box,
    body.edi-game-page .edi-content-box > tbody,
    body.edi-game-page .edi-content-box > tbody > tr,
    body.edi-game-page .edi-content-cell {
        display: block !important;
        width: 514px;
        min-width: 514px;
        max-width: none;
        box-sizing: border-box !important;
    }

    body.edi-game-page .edi-content-box {
        border: 0 !important;
        background: #f0e5bd !important;
        table-layout: auto !important;
    }

    body.edi-game-page .edi-content-cell {
        padding: 0 !important;
        background: #f0e5bd !important;
        color: #2b2117;
        overflow: visible !important;
        font: normal 14px/1.48 Verdana, Arial, sans-serif !important;
    }

    body.edi-game-page .edi-mobile-content-scroll {
        display: block !important;
        box-sizing: border-box !important;
        width: 514px;
        min-width: 514px;
        max-width: none;
        margin: 0 !important;
        padding: 9px 7px 18px !important;
        overflow: visible !important;
    }

    /* Mantém tabelas, rankings e formulários na aparência original. */
    body.edi-game-page .edi-mobile-content-scroll table {
        max-width: none !important;
    }

    body.edi-game-page .edi-mobile-content-scroll > table,
    body.edi-game-page .edi-mobile-content-scroll > form,
    body.edi-game-page .edi-mobile-content-scroll > center,
    body.edi-game-page .edi-mobile-content-scroll > div,
    body.edi-game-page .edi-mobile-content-scroll > p {
        margin-bottom: 8px;
    }

    body.edi-game-page .edi-content-cell,
    body.edi-game-page .edi-content-cell font,
    body.edi-game-page .edi-content-cell td,
    body.edi-game-page .edi-content-cell th,
    body.edi-game-page .edi-content-cell p,
    body.edi-game-page .edi-content-cell div,
    body.edi-game-page .edi-content-cell span,
    body.edi-game-page .edi-content-cell li,
    body.edi-game-page .edi-content-cell a,
    body.edi-game-page .edi-content-cell b,
    body.edi-game-page .edi-content-cell strong {
        font-size: 13px !important;
        line-height: 1.48 !important;
    }

    body.edi-game-page .edi-content-cell img {
        height: auto;
    }

    body.edi-game-page .edi-wide-classic-fit {
        transform-origin: top left !important;
        -webkit-transform-origin: top left !important;
    }

    body.edi-game-page .edi-content-cell input[type="text"],
    body.edi-game-page .edi-content-cell input[type="password"],
    body.edi-game-page .edi-content-cell input[type="email"],
    body.edi-game-page .edi-content-cell input[type="number"],
    body.edi-game-page .edi-content-cell input[type="search"],
    body.edi-game-page .edi-content-cell select,
    body.edi-game-page .edi-content-cell textarea {
        box-sizing: border-box !important;
        min-height: 34px;
        padding: 6px;
        font-size: 16px !important;
    }

    body.edi-game-page .edi-content-cell textarea {
        min-height: 90px;
    }

    body.edi-game-page .edi-content-cell input[type="submit"],
    body.edi-game-page .edi-content-cell input[type="button"],
    body.edi-game-page .edi-content-cell button,
    body.edi-game-page .edi-content-cell .forms {
        box-sizing: border-box !important;
        min-height: 35px;
        padding: 7px 10px;
        font-size: 14px !important;
    }

    body.edi-game-page .edi-content-cell pre,
    body.edi-game-page .edi-content-cell code {
        white-space: pre-wrap;
        word-break: break-word;
    }

    body.edi-game-page .edi-status-summary-table {
        grid-template-columns: 54px 54px 96px 82px 66px !important;
        width: 390px !important;
        max-width: 390px !important;
        margin: 4px auto 0 !important;
        transform: none !important;
    }

    body.edi-game-page .edi-status-summary-head {
        padding: 3px 1px !important;
        font-size: 10px !important;
    }

    body.edi-game-page .edi-status-summary-value {
        min-height: 21px !important;
        padding: 4px 1px 1px !important;
        font-size: 11px !important;
    }

    body.edi-game-page #tooltip {
        box-sizing: border-box !important;
        right: 10px !important;
        left: 10px !important;
        max-width: calc(100vw - 20px) !important;
        font-size: 13px !important;
    }
}

/* Correção de navegação durante a ampliação por pinça.
   Em repouso o jogo continua encaixado como antes. Enquanto o navegador está
   ampliado, o JS preserva o tamanho visual e devolve ao documento a largura
   clássica de 514px, permitindo arrastar também para esquerda e direita. */
@media (max-width: 760px) {
    html.edi-user-pinch-zoom,
    html.edi-user-pinch-zoom body.edi-game-page {
        width: auto !important;
        min-width: 100% !important;
        max-width: none !important;
        overflow-x: auto !important;
        overflow-y: auto !important;
        overscroll-behavior-x: auto !important;
        touch-action: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    html.edi-user-pinch-zoom body.edi-game-page .edi-shell {
        max-width: none !important;
        overflow: visible !important;
        touch-action: auto !important;
    }

    html.edi-user-pinch-zoom body.edi-game-page .edi-frame,
    html.edi-user-pinch-zoom body.edi-game-page .edi-inner-frame,
    html.edi-user-pinch-zoom body.edi-game-page .edi-maincell,
    html.edi-user-pinch-zoom body.edi-game-page .edi-content-box,
    html.edi-user-pinch-zoom body.edi-game-page .edi-content-cell,
    html.edi-user-pinch-zoom body.edi-game-page .edi-mobile-content-scroll {
        overflow: visible !important;
    }
}
