/* --- bet-again.css ----------------------------------------------------------
 *
 * The results card (fixed, every page) and the BET AGAIN picks it shares with
 * a settled market's page. See public/js/bet-again.js.
 *
 * Above the header and the rail, below every modal (wallet, daily gift and the
 * lobby's own sit at 200 and up): the card must never cover a dialog the
 * player opened on purpose.
 */

.ba-card {
    /* bottom: 84px clears the session widget (session.js), a 50px button
       fixed at bottom/right 20px on the lobby and the markets page. */
    position: fixed; right: 20px; bottom: 84px; z-index: 150;
    width: 400px; max-height: calc(100vh - 168px); overflow-y: auto; overscroll-behavior: contain;
    box-sizing: border-box; padding: 20px;
    background: var(--surface); border: 1px solid var(--accent); border-radius: 10px;
    box-shadow: 0 18px 50px rgba(0,0,0,0.55), 0 0 0 4px rgba(157,92,255,0.10);
    color: var(--text); font-family: var(--font-ui);
    animation: ba-in 0.28s ease-out;
}
@keyframes ba-in { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }

.ba-x {
    position: absolute; top: 12px; right: 12px; width: 30px; height: 30px;
    display: grid; place-items: center; border-radius: 6px; cursor: pointer;
    background: none; border: 1px solid transparent; color: var(--text-dim);
}
.ba-x:hover { color: #fff; border-color: var(--border-strong); }

.ba-eyebrow { font-size: 10px; font-weight: 800; letter-spacing: 0.08em; color: var(--text-dim); }
.ba-title { margin-top: 6px; padding-right: 30px; font-size: 21px; font-weight: 800; color: #fff; line-height: 1.25; }

.ba-net-row { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.ba-net { font-size: 30px; font-weight: 900; color: var(--text); font-variant-numeric: tabular-nums; }
.ba-net.win { color: var(--win); }
.ba-net.loss { color: var(--danger); }
.ba-net-lab { font-size: 10px; font-weight: 800; letter-spacing: 0.06em; color: var(--text-dim); line-height: 1.5; }
.ba-back { margin-top: 4px; font-size: 12px; color: var(--text-muted); }

.ba-results { margin-top: 14px; display: flex; flex-direction: column; border-top: 1px solid var(--border); }
.ba-res {
    display: grid; grid-template-columns: 66px minmax(0, 1fr) auto; align-items: center; gap: 10px;
    padding: 9px 0; border-bottom: 1px solid var(--border); color: var(--text); text-decoration: none;
}
.ba-res:hover .ba-res-q { color: #fff; text-decoration: underline; }
.ba-res-q { font-size: 12.5px; font-weight: 600; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ba-res-amt { font-size: 13px; font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ba-res-amt.win { color: var(--win); }
.ba-res-amt.loss { color: var(--danger); }
.ba-res-amt.void { color: var(--text-muted); }
.ba-badge {
    font-size: 9px; font-weight: 900; letter-spacing: 0.06em; padding: 3px 6px; border-radius: 4px;
    border: 1px solid var(--border-strong); color: var(--text-muted); justify-self: start; text-align: center;
}
.ba-badge.win { color: var(--text-on-accent); background: var(--win); border-color: var(--win); }
.ba-badge.loss { color: var(--danger); border-color: rgba(255,77,109,0.5); }
.ba-more { padding: 9px 0 0; font-size: 12px; font-weight: 700; color: var(--accent-bright); text-decoration: none; }

.ba-again-head { margin-top: 18px; }
.ba-again-sub { margin-top: 3px; font-size: 12px; color: var(--text-muted); }
.ba-foot { display: block; margin-top: 14px; font-size: 12px; font-weight: 700; color: var(--text-dim); text-decoration: none; }
.ba-foot:hover, .ba-more:hover { color: #fff; }

/* --- the picks ------------------------------------------------------------- */

.ba-picks { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.ba-pick {
    padding: 12px; border-radius: 8px; background: var(--surface-raised); border: 1px solid var(--border);
}
.ba-pick.done { border-color: rgba(53,217,155,0.45); }
.ba-q { display: block; font-size: 13.5px; font-weight: 700; color: #fff; line-height: 1.35; text-decoration: none; }
.ba-q:hover { text-decoration: underline; }
.ba-meta { margin-top: 4px; font-size: 10px; font-weight: 800; letter-spacing: 0.04em; color: var(--text-dim); }
.ba-outs { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.ba-out {
    display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0;
    padding: 8px 10px; border-radius: 6px; cursor: pointer; text-align: left;
    background: var(--surface); border: 1px solid var(--border-strong); color: var(--text); font: inherit;
}
.ba-out:hover { border-color: var(--accent); }
.ba-out.on { border-color: var(--accent); background: rgba(157,92,255,0.12); }
.ba-out-name { font-size: 12.5px; font-weight: 800; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ba-out.on .ba-out-name { color: var(--accent-bright); }
.ba-out-pct { font-size: 10px; font-weight: 800; color: var(--text-dim); }

.ba-confirm { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border-strong); }
.ba-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ba-chip {
    font: inherit; font-size: 10px; font-weight: 800; letter-spacing: 0.04em; cursor: pointer;
    padding: 7px 9px; border-radius: 5px; color: var(--text-muted);
    background: var(--surface); border: 1px solid var(--border-strong);
}
.ba-chip.on { color: var(--text-on-accent); background: var(--accent); border-color: var(--accent); }
.ba-amt {
    flex: 1 1 110px; min-width: 0; box-sizing: border-box; height: 32px; padding: 0 10px; border-radius: 5px;
    background: var(--surface-sunken); border: 1px solid var(--border-strong); color: #fff;
    font: inherit; font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums;
}
.ba-amt:focus { outline: none; border-color: var(--accent); }
.ba-quote { margin-top: 8px; font-size: 12px; color: var(--text-muted); line-height: 1.45; }
.ba-money { color: var(--win); font-weight: 900; }
.ba-moves { color: var(--gold); }
.ba-actions { display: flex; gap: 8px; margin-top: 10px; }
.ba-go {
    flex: 1; min-width: 0; padding: 10px 12px; border-radius: 6px; cursor: pointer; border: none;
    background: var(--accent); color: #fff; font: inherit; font-size: 12px; font-weight: 900; letter-spacing: 0.03em;
    line-height: 1.3; overflow-wrap: anywhere;
}
.ba-go:hover:not(:disabled) { filter: brightness(1.1); }
.ba-go:disabled { background: var(--surface); color: var(--text-dim); cursor: default; }
.ba-cancel {
    padding: 10px 12px; border-radius: 6px; cursor: pointer; font: inherit; font-size: 11px; font-weight: 800;
    background: none; border: 1px solid var(--border-strong); color: var(--text-muted);
}
.ba-cancel:hover { color: #fff; }
.ba-msg { margin-top: 6px; font-size: 12px; }
.ba-msg:empty { display: none; }
.ba-msg.bad { color: var(--danger); }
.ba-done { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: 12.5px; font-weight: 700; color: var(--win); }
.ba-done a { color: var(--accent-bright); text-decoration: none; margin-left: auto; }

/* On a market's own page the picks sit in a panel, two across when there is room. */
.ba-again-title { margin-top: 5px; font-size: 18px; font-weight: 800; color: #fff; }
.ba-picks-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); align-items: start; }

/* A phone: a bottom sheet across the full width. */
@media (max-width: 700px) {
    .ba-card {
        left: 0; right: 0; bottom: 0; width: auto; max-height: 82vh;
        border-radius: 14px 14px 0 0; border-bottom: none; padding: 18px 16px 22px;
    }
    .ba-title { font-size: 19px; }
    /* The sheet spans the bottom edge, so the session widget would sit on
       top of its content; it comes back when the card is closed. */
    body.ba-open #session-widget { display: none; }
    .ba-net { font-size: 26px; }
}
