
/* BritRank Battles — UX polish pass 1 */

.battles-panel { overflow: hidden; }

.battle-mode-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    margin: 0 0 18px;
    border: 2px solid var(--theme-raw-111);
    background: var(--theme-raw-fff);
}

.battle-mode-tabs a {
    position: relative;
    display: block;
    padding: 12px 10px 11px;
    color: var(--theme-raw-111);
    background: var(--theme-raw-fff);
    text-decoration: none;
    text-align: center;
    font-weight: 1000;
    font-size: 12px;
    letter-spacing: .01em;
    text-transform: uppercase;
}

.battle-mode-tabs a + a { border-left: 2px solid var(--theme-raw-111); }
.battle-mode-tabs a.active {
    background: var(--theme-raw-111);
    color: var(--theme-raw-d8ff00);
}
.battle-mode-tabs a.active::after {
    content: "";
    position: absolute;
    left: 34%;
    right: 34%;
    bottom: -2px;
    height: 3px;
    background: var(--theme-raw-d8ff00);
}

.battle-message {
    margin: 0 14px 14px;
    padding: 10px 12px;
    border: 2px solid var(--theme-raw-111);
    background: var(--theme-raw-fff4b9);
    font-size: 11px;
    font-weight: 1000;
    text-transform: uppercase;
}

.battle-question {
    padding: 8px 14px 2px;
    text-align: center;
}

.battle-question-kicker {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
}

.battle-question small,
.battle-question-kicker span {
    color: var(--theme-raw-777);
    font-size: 9px;
    font-weight: 1000;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.battle-question-kicker span::before {
    content: "•";
    margin-right: 9px;
    color: var(--theme-raw-aaa);
}

.battle-question strong {
    display: block;
    margin-top: 4px;
    font-size: 21px;
    line-height: 1.06;
}

.battle-cards {
    display: grid;
    grid-template-columns: minmax(0,1fr) 48px minmax(0,1fr);
    gap: 10px;
    align-items: stretch;
    padding: 14px 14px 16px;
}

.battle-vs {
    display: grid;
    place-items: center;
    font-size: 17px;
    font-weight: 1000;
}

.battle-card {
    position: relative;
    min-width: 0;
    border: 3px solid var(--theme-raw-111);
    background: var(--theme-raw-fff);
    box-shadow: 4px 4px 0 var(--theme-raw-rgba-0-0-0-08-c5102c);
}

.battle-card form { height: 100%; }

.battle-pick {
    width: 100%;
    height: 100%;
    min-height: 270px;
    padding: 0;
    border: 0;
    background: var(--theme-raw-fff);
    color: var(--theme-raw-111);
    cursor: pointer;
    text-align: left;
}

.battle-pick:hover,
.battle-pick:focus-visible {
    outline: 0;
    background: var(--theme-raw-fafafa);
}

.battle-pick:hover .battle-pick-cta,
.battle-pick:focus-visible .battle-pick-cta {
    background: var(--theme-raw-111);
    color: var(--theme-raw-d8ff00);
}

.battle-card-image {
    display: block;
    width: 100%;
    height: 168px;
    object-fit: cover;
    border-bottom: 3px solid var(--theme-raw-111);
    background: var(--theme-raw-dedede);
}

.battle-card-fallback {
    display: grid;
    place-items: center;
    width: 100%;
    height: 168px;
    border-bottom: 3px solid var(--theme-raw-111);
    background: var(--theme-raw-e5e5e2);
    font-size: 58px;
    font-weight: 1000;
}

.battle-card-copy { padding: 12px 12px 9px; }
.battle-card-copy strong {
    display: block;
    font-size: 21px;
    line-height: 1.04;
}
.battle-card-copy span {
    display: block;
    margin-top: 5px;
    color: var(--theme-raw-777);
    font-size: 10px;
}

.battle-pick-cta {
    display: block;
    margin: 3px 11px 11px;
    padding: 10px 8px;
    background: var(--theme-raw-d8ff00);
    border: 2px solid var(--theme-raw-111);
    text-align: center;
    font-size: 11px;
    font-weight: 1000;
    text-transform: uppercase;
}

.battle-progress {
    display: grid;
    grid-template-columns: .8fr 1.2fr;
    border-top: 2px solid var(--theme-raw-111);
    background: var(--theme-raw-f6f6f4);
}

.battle-progress > div { padding: 10px 12px 9px; }
.battle-progress > div + div { border-left: 1px solid var(--theme-raw-bbb); }
.battle-progress strong { display: block; font-size: 18px; }
.battle-progress span {
    display: block;
    margin-top: 1px;
    color: var(--theme-raw-666);
    font-size: 9px;
    line-height: 1.25;
    font-weight: 1000;
    text-transform: uppercase;
}

.battle-meter {
    height: 5px;
    border-bottom: 2px solid var(--theme-raw-111);
    background: var(--theme-raw-e3e3df);
    overflow: hidden;
}
.battle-meter span {
    display: block;
    height: 100%;
    background: var(--theme-raw-d8ff00);
}

.battle-order-preview { padding: 14px; }

.battle-order-preview-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 9px;
}
.battle-order-preview-head > div { min-width: 0; }
.battle-order-preview-head strong {
    display: block;
    font-size: 13px;
    text-transform: uppercase;
}
.battle-order-preview-head span {
    display: block;
    margin-top: 2px;
    color: var(--theme-raw-777);
    font-size: 9px;
    line-height: 1.25;
}
.battle-order-preview-head a {
    flex: 0 0 auto;
    color: var(--theme-raw-111);
    font-size: 9px;
    font-weight: 1000;
    text-transform: uppercase;
}

.battle-mini-list { border: 2px solid var(--theme-raw-111); }
.battle-mini-row {
    display: grid;
    grid-template-columns: 32px 42px 1fr;
    gap: 8px;
    align-items: center;
    min-height: 44px;
    padding: 5px 8px;
    border-bottom: 1px solid var(--theme-raw-ddd);
}
.battle-mini-pos { font-size: 16px; font-weight: 1000; }
.battle-mini-thumb {
    width: 38px;
    height: 31px;
    object-fit: cover;
    background: var(--theme-raw-ddd);
}
.battle-mini-name {
    min-width: 0;
    font-size: 12px;
    font-weight: 1000;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.battle-mini-more {
    display: block;
    padding: 10px 12px;
    background: var(--theme-raw-f5f5f2);
    color: var(--theme-raw-111);
    text-align: center;
    text-decoration: none;
    font-size: 10px;
    font-weight: 1000;
    text-transform: uppercase;
}

.battle-bottom-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 2px 14px 15px;
}
.battle-bottom-actions a,
.battle-bottom-actions button {
    border: 2px solid var(--theme-raw-111);
    background: var(--theme-raw-fff);
    color: var(--theme-raw-111);
    padding: 9px 10px;
    font-size: 10px;
    font-weight: 1000;
    text-decoration: none;
    text-transform: uppercase;
    cursor: pointer;
}
.battle-bottom-actions .battle-continue {
    background: var(--theme-raw-111);
    color: var(--theme-raw-fff);
}
.battle-stop-note {
    color: var(--theme-raw-777);
    font-size: 9px;
    line-height: 1.25;
    text-align: right;
}

.battle-complete {
    margin: 14px;
    padding: 22px;
    border: 3px solid var(--theme-raw-111);
    background: var(--theme-raw-d8ff00);
    text-align: center;
}
.battle-complete strong {
    display: block;
    font-size: 24px;
    text-transform: uppercase;
}
.battle-complete span {
    display: block;
    margin-top: 7px;
    font-size: 12px;
}
.battle-complete a {
    display: inline-block;
    margin-top: 13px;
    padding: 10px 12px;
    border: 2px solid var(--theme-raw-111);
    background: var(--theme-raw-111);
    color: var(--theme-raw-fff);
    font-size: 10px;
    font-weight: 1000;
    text-decoration: none;
    text-transform: uppercase;
}

.provisional-rank-note {
    margin: 0 0 14px;
    padding: 12px 13px;
    border: 2px solid var(--theme-raw-111);
    background: var(--theme-raw-fff4b9);
}
.provisional-rank-note strong {
    display: block;
    font-size: 13px;
    text-transform: uppercase;
}
.provisional-rank-note span {
    display: block;
    margin-top: 4px;
    color: var(--theme-raw-555);
    font-size: 11px;
    line-height: 1.35;
}

@media (max-width: 720px) {
    .battle-cards {
        grid-template-columns: 1fr 34px 1fr;
        gap: 7px;
        padding-left: 9px;
        padding-right: 9px;
    }

    .battle-vs {
        min-height: 0;
        font-size: 14px;
    }

    .battle-pick { min-height: 0; }
    .battle-card-image,
    .battle-card-fallback { height: 145px; }

    .battle-card-copy { padding: 10px 9px 7px; }
    .battle-card-copy strong { font-size: 17px; }
    .battle-pick-cta {
        margin: 3px 8px 8px;
        padding: 9px 5px;
        font-size: 9px;
    }

    .battle-question-kicker span { display: none; }

    .battle-order-preview-head {
        align-items: flex-start;
        flex-direction: column;
        gap: 5px;
    }

    .battle-bottom-actions {
        align-items: flex-start;
        flex-direction: column;
    }

    .battle-stop-note { text-align: left; }
}

@media (max-width: 460px) {
    .battle-cards {
        grid-template-columns: 1fr;
    }

    .battle-vs {
        min-height: 26px;
    }

    .battle-card-image,
    .battle-card-fallback {
        height: 190px;
    }
}


/* Keep the long-ranking preview inside Battles instead of changing modes. */
.battle-mini-more-wrap {
    display: block;
}
.battle-mini-more-wrap > summary {
    list-style: none;
    cursor: pointer;
}
.battle-mini-more-wrap > summary::-webkit-details-marker {
    display: none;
}
.battle-mini-more-wrap[open] > .battle-mini-more {
    border-bottom: 1px solid var(--theme-raw-ddd);
}
.battle-mini-more-wrap[open] > .battle-mini-more::after {
    content: "  ▲";
}
.battle-mini-more-wrap:not([open]) > .battle-mini-more::after {
    content: "  ▼";
}


/* Smooth in-page Battle updates */
#battlesPanel {
    position: relative;
}

#battlesPanel.is-battle-loading::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 20;
    background: var(--theme-raw-rgba-255-255-255-26-80c1bc);
    pointer-events: none;
}

#battlesPanel.is-battle-loading .battle-card {
    opacity: .72;
}

#battlesPanel form[action="battle-action.php"] button:disabled {
    cursor: wait;
}

.battle-ajax-error {
    background: var(--theme-raw-ffd9d9);
}


/* Battles mobile polish pass */

.battle-stop-strip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--theme-raw-cfcfcf);
    background: var(--theme-raw-fffbea);
    color: var(--theme-raw-333);
}
.battle-stop-strip strong {
    flex: 0 0 auto;
    font-size: 10px;
    text-transform: uppercase;
}
.battle-stop-strip span {
    font-size: 10px;
    line-height: 1.25;
    color: var(--theme-raw-666);
}

@media (max-width: 760px) {
    .page-content,
    .ranking-layout,
    .ranking-main {
        min-width: 0;
    }

    .ranking-layout {
        grid-template-columns: 1fr !important;
        gap: 14px !important;
    }

    #battlesPanel,
    #publicRankingPanel {
        width: 100%;
        min-width: 0;
    }

    #publicRankingPanel {
        margin-top: 0;
    }

    .battle-mode-tabs {
        margin-bottom: 12px;
    }

    .battle-mode-tabs a {
        padding: 11px 8px 10px;
        font-size: 11px;
    }

    .battle-message {
        margin: 0 9px 10px;
        padding: 9px 10px;
        font-size: 10px;
    }

    .battle-question {
        padding: 5px 9px 0;
    }

    .battle-question strong {
        font-size: 19px;
    }

    .battle-question-kicker {
        gap: 5px;
    }

    .battle-question small {
        font-size: 8px;
    }

    .battle-cards {
        grid-template-columns: minmax(0,1fr) 30px minmax(0,1fr);
        gap: 7px;
        padding: 10px 9px 12px;
    }

    .battle-vs {
        font-size: 13px;
    }

    .battle-card {
        border-width: 2px;
        box-shadow: 2px 2px 0 var(--theme-raw-rgba-0-0-0-08-c5102c);
    }

    .battle-card-image,
    .battle-card-fallback {
        height: 130px;
        border-bottom-width: 2px;
    }

    .battle-card-copy {
        padding: 8px 8px 5px;
    }

    .battle-card-copy strong {
        font-size: 16px;
        line-height: 1.05;
    }

    .battle-card-copy span {
        margin-top: 3px;
        font-size: 8px;
        line-height: 1.15;
    }

    .battle-pick-cta {
        margin: 3px 7px 7px;
        padding: 10px 5px;
        font-size: 9px;
    }

    .battle-progress {
        grid-template-columns: .72fr 1.28fr;
    }

    .battle-progress > div {
        padding: 8px 9px;
    }

    .battle-progress strong {
        font-size: 16px;
    }

    .battle-progress span {
        font-size: 8px;
    }

    .battle-stop-strip {
        align-items: flex-start;
        padding: 8px 9px;
    }

    .battle-stop-strip strong,
    .battle-stop-strip span {
        font-size: 9px;
    }

    .battle-order-preview {
        padding: 10px 9px 12px;
    }

    .battle-order-preview-head {
        margin-bottom: 7px;
    }

    .battle-order-preview-head strong {
        font-size: 11px;
    }

    .battle-order-preview-head span,
    .battle-order-preview-head a {
        font-size: 8px;
    }

    .battle-mini-row {
        grid-template-columns: 28px 38px 1fr;
        min-height: 40px;
        padding: 4px 7px;
    }

    .battle-mini-pos {
        font-size: 14px;
    }

    .battle-mini-thumb {
        width: 34px;
        height: 28px;
    }

    .battle-mini-name {
        font-size: 11px;
    }

    .battle-mini-more {
        padding: 9px 8px;
        font-size: 9px;
    }

    .battle-bottom-actions {
        padding: 0 9px 12px;
    }

    .battle-bottom-actions a,
    .battle-bottom-actions button {
        width: 100%;
        padding: 11px 10px;
        text-align: center;
        font-size: 10px;
    }

    .public-ranking .ranking-panel-head,
    .public-ranking .panel-heading,
    .public-ranking .ranking-heading {
        min-width: 0;
    }
}

@media (max-width: 520px) {
    .battle-cards {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .battle-vs {
        min-height: 22px;
        font-size: 12px;
    }

    .battle-card-image,
    .battle-card-fallback {
        height: 180px;
    }

    .battle-card-copy strong {
        font-size: 18px;
    }

    .battle-card-copy span {
        font-size: 9px;
    }

    .battle-pick-cta {
        padding: 11px 7px;
        font-size: 10px;
    }

    .battle-progress {
        grid-template-columns: 1fr 1fr;
    }

    .battle-stop-strip {
        display: block;
    }

    .battle-stop-strip strong {
        display: block;
        margin-bottom: 2px;
    }
}


/* Mobile UX fixes: clearer Battle explanation, card breathing room, stronger VS. */
.ranking-interaction-anchor {
    display: block;
    position: relative;
    top: -10px;
    visibility: hidden;
}

.battle-explainer {
    max-width: 520px;
    margin: 6px auto 0;
    color: var(--theme-raw-555);
    font-size: 11px;
    line-height: 1.35;
}

.battle-card-copy {
    padding-left: 14px;
    padding-right: 14px;
}

.battle-vs {
    width: 40px;
    height: 40px;
    align-self: center;
    justify-self: center;
    border: 3px solid var(--theme-raw-111);
    border-radius: 50%;
    background: var(--theme-raw-111);
    color: var(--theme-raw-d8ff00);
    box-shadow: 3px 3px 0 var(--theme-raw-rgba-0-0-0-12-a6f872);
}

@media (max-width: 760px) {
    .battle-explainer {
        margin-top: 5px;
        padding: 0 8px;
        font-size: 10px;
    }

    .battle-card-copy {
        padding-left: 10px;
        padding-right: 10px;
    }

    .battle-vs {
        width: 34px;
        height: 34px;
        border-width: 2px;
        font-size: 11px;
    }

    /*
     * Large mobile lists skip the initial approval gate in JS. Keep the
     * resulting editor compact and clear.
     */
    .edit-mode-banner {
        margin-top: 8px;
    }
}

@media (max-width: 520px) {
    .battle-vs {
        width: 42px;
        height: 42px;
        margin: 1px auto;
    }

    .battle-card-copy {
        padding: 10px 12px 7px;
    }
}


/* Mobile UX fixes pass 2 */

/* The copy wrapper contains block elements, so make it a real block. */
.battle-card-copy {
    display: block;
    box-sizing: border-box;
    width: 100%;
    padding-left: 16px;
    padding-right: 16px;
}

/* On mobile, keep a visible gutter around contender names/details. */
@media (max-width: 760px) {
    .battle-card-copy {
        padding: 11px 14px 8px !important;
    }

    .battle-card-copy strong,
    .battle-card-copy > span {
        padding-left: 0;
        padding-right: 0;
    }

    /*
     * The public heading had two desktop elements competing for one row.
     * Stack them on mobile so the "full rankings / battle contributor"
     * text cannot sit underneath the black tab.
     */
    #publicRankingPanel .public-title-row {
        display: block !important;
        min-height: 0 !important;
    }

    #publicRankingPanel .public-title-row .panel-title {
        display: inline-flex;
        width: auto;
        max-width: 100%;
    }

    #publicRankingPanel .public-title-row .based-on {
        position: static !important;
        display: block;
        width: 100%;
        max-width: none;
        padding: 9px 12px 8px;
        border-top: 1px solid var(--theme-raw-ddd);
        text-align: left;
        line-height: 1.25;
        white-space: normal;
    }

    .provisional-rank-note strong {
        font-size: 15px;
    }

    .provisional-rank-note span {
        font-size: 11px;
        line-height: 1.4;
    }
}

@media (max-width: 520px) {
    .battle-card-copy {
        padding: 12px 15px 9px !important;
    }
}
