/* ============ PREDICTION GAME — REDESIGN ============ */

.prediction-modal {
    display: none;
    
    inset: 0;
    z-index: 10600;
    align-items: center;
    justify-content: center;
    padding: 14px;
    background: radial-gradient(circle at 20% 20%, rgba(212,168,83,.15), transparent 40%),
                radial-gradient(circle at 80% 80%, rgba(237,75,158,.12), transparent 40%),
                rgba(0,0,0,.85);
    backdrop-filter: blur(10px);
    font-family: 'Kanit', Arial, sans-serif;
    color: #fff;
    overflow-y: auto;
}
.prediction-modal.open { display: flex; }

/* ---------- Shell ---------- */
.pg-shell {
    position: relative;
    width: 100%;
    max-width: 540px;
    max-height: 96vh;
    overflow-y: auto;
    background: linear-gradient(160deg, rgba(24,18,18,.99), rgba(14,10,10,.99));
    border: 1px solid rgba(212,168,83,.35);
    border-radius: 24px;
    box-shadow: 0 30px 80px rgba(0,0,0,.8), 0 0 40px rgba(212,168,83,.1);
    animation: pgIn .35s cubic-bezier(.16,1,.3,1);
}
@keyframes pgIn {
    from { opacity: 0; transform: translateY(24px) scale(.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- Orbs ---------- */
.pg-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(70px);
    pointer-events: none;
    z-index: 0;
}
.pg-orb-1 { width: 260px; height: 260px; background: rgba(212,168,83,.18); top: -100px; left: -80px; }




/* ---------- Header ---------- */
.pg-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px;
    border-bottom: 1px solid rgba(212,168,83,.15);
}
.pg-head-left { display: flex; align-items: center; gap: 10px; }
.pg-badge {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 5px 10px;
    border-radius: 8px;
    background: rgba(212,168,83,.15);
    color: #ffd47a;
    border: 1px solid rgba(212,168,83,.35);
}
.pg-badge[data-phase="new"]    { background: rgba(74,222,160,.15); color: #4adea0; border-color: rgba(74,222,160,.4); }
.pg-badge[data-phase="live"]   { background: rgba(255,107,53,.15); color: #ff6b35; border-color: rgba(255,107,53,.4); }
.pg-badge[data-phase="result"] { background: rgba(237,75,158,.15); color: #ed4b9e; border-color: rgba(237,75,158,.4); }

.pg-head-left h2 {
    font-size: 16px;
    font-weight: 700;
    background: linear-gradient(90deg, #d4a853, #f5d68a);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.pg-head-right { display: flex; align-items: center; gap: 8px; }
.pg-balance { display: flex; flex-direction: column; align-items: flex-end; margin-right: 4px; }
.pg-balance-label { font-size: 9px; text-transform: uppercase; letter-spacing: 1px; color: #a08b6b; }
.pg-balance-value { font-size: 15px; font-weight: 700; color: #ffd47a; }
.pg-balance-value small { font-size: 10px; color: #a08b6b; }

.pg-icon-btn {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    border: 1px solid rgba(212,168,83,.25);
    background: rgba(212,168,83,.06);
    color: #d4a853;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all .2s;
}
.pg-icon-btn:hover { background: rgba(212,168,83,.15); transform: translateY(-1px); }

/* ---------- Hero ---------- */
.pg-hero {
    display: grid;
    grid-template-columns: 130px 1fr;
    gap: 16px;
    padding: 20px;
    align-items: center;
}

.pg-timer-wrap { position: relative; width: 130px; height: 130px; margin: 0 auto; }
.pg-timer-svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.pg-timer-track { fill: none; stroke: rgba(212,168,83,.12); stroke-width: 6; }
.pg-timer-progress {
    fill: none;
    stroke: url(#pgGrad);
    stroke-width: 6;
    stroke-linecap: round;
    stroke-dasharray: 339.29;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1s linear, stroke .3s;
    filter: drop-shadow(0 0 6px rgba(212,168,83,.6));
}
.pg-timer-wrap.phase-live .pg-timer-progress { stroke: #ff6b35; filter: drop-shadow(0 0 6px rgba(255,107,53,.6)); }
.pg-timer-wrap.phase-result .pg-timer-progress { stroke: #ed4b9e; filter: drop-shadow(0 0 6px rgba(237,75,158,.6)); }

.pg-timer-text {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.pg-timer-text span { font-size: 30px; font-weight: 800; color: #fff; line-height: 1; }
.pg-timer-text small { font-size: 10px; color: #a08b6b; text-transform: uppercase; letter-spacing: 1px; }

.pg-price-wrap { text-align: right; }
.pg-price-label { font-size: 11px; color: #a08b6b; text-transform: uppercase; letter-spacing: 1px; }
.pg-price-value {
    font-size: 32px;
    font-weight: 800;
    color: #fff;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
    transition: color .3s;
}
.pg-price-value.up   { color: #4adea0; }
.pg-price-value.down { color: #ed4b9e; }
.pg-price-diff {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 4px;
    font-size: 11px;
    color: #a08b6b;
}
.pg-delta { font-weight: 700; }
.pg-delta.pos { color: #4adea0; }
.pg-delta.neg { color: #ed4b9e; }

/* ---------- Chart ---------- */
.pg-chart-wrap {
    position: relative;
    height: 150px;
    margin: 0 20px 16px;
    padding: 8px;
    background: rgba(255,255,255,.02);
    border: 1px solid rgba(212,168,83,.12);
    border-radius: 14px;
    overflow: hidden;
}
.pg-chart-wrap canvas { width: 100% !important; height: 100% !important; display: block; }

/* ---------- Result Overlay ---------- */
.pg-result-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #fff;
    backdrop-filter: blur(8px);
    animation: pgOverlayIn .5s ease;
    border-radius: 14px;
}
@keyframes pgOverlayIn {
    from { opacity: 0; transform: scale(.8); }
    to   { opacity: 1; transform: scale(1); }
}
.pg-result-overlay.won      { background: linear-gradient(135deg, rgba(74,222,160,.4), rgba(31,163,134,.3)); }
.pg-result-overlay.lost     { background: linear-gradient(135deg, rgba(237,75,158,.4), rgba(184,52,110,.3)); }
.pg-result-overlay.cancelled{ background: linear-gradient(135deg, rgba(255,107,53,.4), rgba(200,80,30,.3)); }
.pg-result-overlay .icon { font-size: 40px; }
.pg-result-overlay .sub { font-size: 11px; letter-spacing: 0; color: rgba(255,255,255,.8); text-transform: none; font-weight: 500; }

/* ---------- Pools ---------- */
.pg-pools {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 0 20px 16px;
}
.pg-pool {
    padding: 12px;
    border-radius: 16px;
    border: 1px solid;
    position: relative;
    overflow: hidden;
}
.pg-pool-up { background: rgba(74,222,160,.06); border-color: rgba(74,222,160,.25); }
.pg-pool-down { background: rgba(237,75,158,.06); border-color: rgba(237,75,158,.25); }

.pg-pool-head {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 8px;
}
.pg-pool-up .pg-pool-head { color: #4adea0; }
.pg-pool-down .pg-pool-head { color: #ed4b9e; }
.pg-pool-pct { margin-left: auto; font-size: 11px; color: #a08b6b; }

.pg-pool-bar {
    height: 4px;
    background: rgba(0,0,0,.4);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 8px;
}
.pg-pool-bar span {
    display: block;
    height: 100%;
    border-radius: 2px;
    transition: width .5s ease;
}
.pg-pool-up .pg-pool-bar span { background: linear-gradient(90deg, #4adea0, #1fa386); }
.pg-pool-down .pg-pool-bar span { background: linear-gradient(90deg, #ed4b9e, #b8346e); }

.pg-pool-sum { font-size: 15px; font-weight: 700; color: #fff; }
.pg-pool-count { font-size: 11px; color: #a08b6b; margin-top: 2px; }

/* ---------- Bet form ---------- */
.pg-bet-form {
    padding: 16px 20px;
    border-top: 1px solid rgba(212,168,83,.15);
    position: relative;
}
.pg-bet-form.live-locked { opacity: .5; pointer-events: none; }
.pg-bet-form.live-locked::after {
    content: 'Ставки закрыты — раунд в игре';
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,.6);
    border-radius: 12px;
    font-weight: 700; font-size: 13px;
    color: #ff6b35;
    letter-spacing: .5px;
}

.pg-dir-btns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 12px;
}
.pg-dir {
    padding: 15px;
    border-radius: 14px;
    border: 2px solid;
    background: transparent;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all .2s;
}
.pg-dir-up   { color: #4adea0; border-color: rgba(74,222,160,.4); }
.pg-dir-down { color: #ed4b9e; border-color: rgba(237,75,158,.4); }
.pg-dir-up.selected,   .pg-dir-up:hover   { background: linear-gradient(135deg, #4adea0, #1fa386); color: #00301a; transform: translateY(-2px); box-shadow: 0 8px 20px rgba(74,222,160,.3); }
.pg-dir-down.selected, .pg-dir-down:hover { background: linear-gradient(135deg, #ed4b9e, #b8346e); color: #fff; transform: translateY(-2px); box-shadow: 0 8px 20px rgba(237,75,158,.3); }

.pg-amount-row { display: flex; gap: 10px; margin-bottom: 12px; }
.pg-amount-input { flex: 1; position: relative; }
.pg-amount-input input {
    width: 100%;
    padding: 14px 60px 14px 14px;
    border-radius: 14px;
    border: 2px solid rgba(212,168,83,.25);
    background: rgba(0,0,0,.35);
    color: #fff;
    font-size: 16px;
    font-weight: 700;
}
.pg-amount-input input:focus {
    outline: none;
    border-color: #d4a853;
    box-shadow: 0 0 0 4px rgba(212,168,83,.15);
}
.pg-amount-currency {
    position: absolute;
    right: 16px; top: 50%;
    transform: translateY(-50%);
    font-size: 11px;
    font-weight: 700;
    color: #a08b6b;
    letter-spacing: 1px;
}
.pg-max {
    padding: 0 20px;
    border-radius: 14px;
    border: 2px solid rgba(212,168,83,.3);
    background: rgba(212,168,83,.08);
    color: #d4a853;
    font-weight: 800;
    font-size: 12px;
    cursor: pointer;
    letter-spacing: 1px;
    transition: all .2s;
}
.pg-max:hover { background: rgba(212,168,83,.2); }

.pg-place {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, #d4a853, #b8922f);
    color: #0a0808;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 8px 24px rgba(212,168,83,.3);
    transition: all .2s;
}
.pg-place:hover { transform: translateY(-2px); box-shadow: 0 12px 32px rgba(212,168,83,.4); }
.pg-place:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.pg-hint {
    margin-top: 10px;
    text-align: center;
    font-size: 10px;
    color: #a08b6b;
    letter-spacing: .5px;
}

/* ---------- Result block ---------- */
.pg-result {
    padding: 30px 20px;
    text-align: center;
    border-top: 1px solid rgba(212,168,83,.15);
}
.pg-result .big-icon { font-size: 56px; margin-bottom: 10px; }
.pg-result .big-icon.up   { color: #4adea0; }
.pg-result .big-icon.down { color: #ed4b9e; }
.pg-result .big-icon.draw,
.pg-result .big-icon.cancelled { color: #ff6b35; }
.pg-result .title { font-size: 22px; font-weight: 800; margin-bottom: 6px; }
.pg-result .sub { font-size: 13px; color: #a08b6b; }
.pg-result .next { margin-top: 12px; font-size: 12px; color: #d4a853; font-weight: 700; }

/* ---------- Footer ---------- */
.pg-footer {
    display: flex;
    gap: 8px;
    padding: 12px 20px 16px;
    border-top: 1px solid rgba(212,168,83,.15);
}
.pg-foot {
    flex: 1;
    padding: 10px;
    border-radius: 12px;
    border: 1px solid rgba(212,168,83,.2);
    background: rgba(212,168,83,.04);
    color: #c9b89a;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all .2s;
}
.pg-foot:hover { background: rgba(212,168,83,.15); color: #fff; border-color: rgba(212,168,83,.4); }

/* ---------- Sub-modals ---------- */
.pg-sub-modal {
    position: fixed;
    inset: 0;
    z-index: 10601;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0,0,0,.85);
    backdrop-filter: blur(8px);
}
.pg-sub-modal.open { display: flex; }
.pg-sub-shell {
    width: 100%;
    max-width: 500px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(160deg, rgba(24,18,18,.99), rgba(14,10,10,.99));
    border: 1px solid rgba(212,168,83,.3);
    border-radius: 20px;
    overflow: hidden;
}
.pg-sub-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(212,168,83,.15);
}
.pg-sub-head h3 {
    margin: 0;
    font-size: 15px;
    color: #ffd47a;
    display: flex;
    gap: 8px;
    align-items: center;
}
.pg-sub-body { padding: 16px 20px; overflow-y: auto; flex: 1; }

/* ---------- Loader / Toasts ---------- */
.pg-loader { text-align: center; padding: 30px; color: #a08b6b; font-size: 13px; }
.pg-loader i { display: block; font-size: 22px; margin-bottom: 8px; }

.pg-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 700;
    z-index: 11000;
    background: linear-gradient(135deg, #d4a853, #b8922f);
    color: #0a0808;
    box-shadow: 0 10px 30px rgba(0,0,0,.5);
    animation: pgToastIn .3s ease;
}
.pg-toast.error   { background: linear-gradient(135deg, #ed4b9e, #b8346e); color: #fff; }
.pg-toast.success { background: linear-gradient(135deg, #4adea0, #1fa386); color: #00301a; }
@keyframes pgToastIn { from { opacity: 0; transform: translate(-50%, 20px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---------- Поддержка истории/рейтинга/статистики ---------- */
.pg-hi-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    margin-bottom: 8px;
    border-radius: 10px;
    background: rgba(255,255,255,.04);
    border-left: 4px solid rgba(212,168,83,.3);
}
.pg-hi-item.up { border-left-color: #4adea0; }
.pg-hi-item.down { border-left-color: #ed4b9e; }
.pg-hi-item.cancelled, .pg-hi-item.draw { border-left-color: #ff6b35; }

.pg-lb-item {
    display: grid;
    grid-template-columns: 40px 1fr auto;
    gap: 10px;
    padding: 10px 14px;
    margin-bottom: 6px;
    border-radius: 10px;
    background: rgba(255,255,255,.04);
    align-items: center;
}
.pg-lb-rank { font-weight: 800; color: #d4a853; text-align: center; }
.pg-lb-rank.r1 { color: #ffd700; }
.pg-lb-rank.r2 { color: #c0c0c0; }
.pg-lb-rank.r3 { color: #cd7f32; }
.pg-lb-user { font-size: 12px; word-break: break-all; }
.pg-lb-profit.pos { color: #4adea0; font-weight: 700; }
.pg-lb-profit.neg { color: #ed4b9e; font-weight: 700; }

.pg-stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.pg-stat-box {
    padding: 12px;
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(212,168,83,.15);
    border-radius: 12px;
    text-align: center;
}
.pg-stat-lbl { font-size: 10px; color: #a08b6b; text-transform: uppercase; letter-spacing: .5px; }
.pg-stat-val { font-size: 18px; font-weight: 800; color: #fff; margin-top: 2px; }
.pg-stat-val.pos { color: #4adea0; }
.pg-stat-val.neg { color: #ed4b9e; }

/* ---------- Адаптив ---------- */
@media (max-width: 480px) {
    .prediction-modal { padding: 0; }
    .pg-shell { border-radius: 0; max-height: 100vh; }
    .pg-hero { grid-template-columns: 110px 1fr; padding: 16px; }
    .pg-timer-wrap { width: 110px; height: 110px; }
    .pg-timer-text span { font-size: 24px; }
    .pg-price-value { font-size: 26px; }
    .pg-chart-wrap { height: 120px; }
    .pg-footer { flex-wrap: wrap; }
}

/* ---------- Bot activity ---------- */
.pg-bot-activity {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 20px 12px;
    padding: 10px 14px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(118,69,217,.15), rgba(31,199,212,.1));
    border: 1px solid rgba(118,69,217,.35);
    animation: pgBotIn .4s ease;
}
@keyframes pgBotIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.pg-bot-icon {
    width: 34px; height: 34px;
    border-radius: 10px;
    background: linear-gradient(135deg, #7645d9, #1fc7d4);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(118,69,217,.35);
}
.pg-bot-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.pg-bot-text span { font-size: 13px; font-weight: 700; color: #fff;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pg-bot-text small { font-size: 11px; color: #a08b6b; }
.pg-bot-activity.up   { border-color: rgba(74,222,160,.4); background: linear-gradient(135deg, rgba(74,222,160,.1), rgba(31,199,212,.08)); }
.pg-bot-activity.down { border-color: rgba(237,75,158,.4); background: linear-gradient(135deg, rgba(237,75,158,.1), rgba(118,69,217,.08)); }
.pg-bot-activity.up   .pg-bot-icon { background: linear-gradient(135deg, #4adea0, #1fa386); }
.pg-bot-activity.down .pg-bot-icon { background: linear-gradient(135deg, #ed4b9e, #b8346e); }

/* ============ PAGES: history / leaderboard / stats ============ */
.pg-page {
    max-width: 640px;
    margin: 0 auto;
    padding: 16px;
    color: #fff;
    font-family: 'Kanit', Arial, sans-serif;
}
.pg-page-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: linear-gradient(90deg, #d4a853, #b8922f);
    border-radius: 16px;
    margin-bottom: 16px;
    color: #0a0808;
}
.pg-page-head h1 {
    margin: 0;
    font-size: 18px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}
.pg-back {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(0,0,0,.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #0a0808;
    text-decoration: none;
    font-size: 16px;
    transition: background .2s;
}
.pg-back:hover { background: rgba(0,0,0,.35); }
.pg-page-head .pg-icon-btn {
    background: rgba(0,0,0,.2);
    border: none;
    color: #0a0808;
}
.pg-page-head .pg-icon-btn:hover { background: rgba(0,0,0,.35); }

.pg-page-body {
    background: linear-gradient(160deg, rgba(24,18,18,.99), rgba(14,10,10,.99));
    border: 1px solid rgba(212,168,83,.3);
    border-radius: 16px;
    padding: 16px;
    min-height: 200px;
}

/* History */
.pg-history-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    margin-bottom: 8px;
    background: rgba(255,255,255,.04);
    border-radius: 12px;
    border-left: 4px solid rgba(212,168,83,.3);
}
.pg-history-card.up { border-left-color: #4adea0; }
.pg-history-card.down { border-left-color: #ed4b9e; }
.pg-history-card.cancelled, .pg-history-card.draw { border-left-color: #ff6b35; }

.pg-hc-left { min-width: 110px; }
.pg-hc-round { font-size: 13px; font-weight: 700; color: #fff; }
.pg-hc-date { font-size: 10px; color: #a08b6b; margin-top: 2px; }
.pg-hc-mid { flex: 1; min-width: 0; }
.pg-hc-prices { font-size: 13px; color: #fff; font-variant-numeric: tabular-nums; }
.pg-hc-pool { font-size: 10px; color: #a08b6b; margin-top: 2px; }
.pg-hc-result {
    font-size: 13px;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 8px;
    background: rgba(212,168,83,.1);
    color: #d4a853;
}
.pg-hc-result.up { background: rgba(74,222,160,.15); color: #4adea0; }
.pg-hc-result.down { background: rgba(237,75,158,.15); color: #ed4b9e; }
.pg-hc-result.cancelled, .pg-hc-result.draw { background: rgba(255,107,53,.15); color: #ff6b35; }

.pg-load-more {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    margin-top: 12px;
    border: 1px solid rgba(212,168,83,.25);
    background: rgba(212,168,83,.06);
    color: #d4a853;
    font-weight: 700;
    font-size: 13px;
    border-radius: 12px;
    cursor: pointer;
    transition: all .2s;
}
.pg-load-more:hover { background: rgba(212,168,83,.15); }

/* Leaderboard */
.pg-lb-row {
    display: grid;
    grid-template-columns: 60px 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 12px 14px;
    margin-bottom: 6px;
    background: rgba(255,255,255,.04);
    border-radius: 12px;
    border-left: 4px solid rgba(212,168,83,.2);
}
.pg-lb-row.r1 { border-left-color: #ffd700; background: linear-gradient(90deg, rgba(255,215,0,.08), rgba(255,215,0,.02)); }
.pg-lb-row.r2 { border-left-color: #c0c0c0; }
.pg-lb-row.r3 { border-left-color: #cd7f32; }

.pg-lb-rank {
    font-size: 20px;
    font-weight: 800;
    text-align: center;
    color: #d4a853;
}
.pg-lb-rank.r1 { color: #ffd700; }
.pg-lb-rank.r2 { color: #c0c0c0; }
.pg-lb-rank.r3 { color: #cd7f32; }
.pg-lb-name { font-size: 13px; color: #fff; word-break: break-all; }
.pg-lb-profit { font-size: 14px; font-weight: 700; }
.pg-lb-profit.pos { color: #4adea0; }
.pg-lb-profit.neg { color: #ed4b9e; }

/* Stats */
.pg-big-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}
@media (max-width: 480px) {
    .pg-big-stats { grid-template-columns: 1fr 1fr; }
}
.pg-big-stat {
    padding: 12px;
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(212,168,83,.15);
    border-radius: 12px;
    text-align: center;
}
.pg-big-stat.pos { border-color: rgba(74,222,160,.3); background: rgba(74,222,160,.06); }
.pg-big-stat.neg { border-color: rgba(237,75,158,.3); background: rgba(237,75,158,.06); }

.pg-bs-label {
    font-size: 10px;
    color: #a08b6b;
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 4px;
}
.pg-bs-value {
    font-size: 20px;
    font-weight: 800;
    color: #fff;
}
.pg-big-stat.pos .pg-bs-value { color: #4adea0; }
.pg-big-stat.neg .pg-bs-value { color: #ed4b9e; }

.pg-money-stats {
    background: rgba(212,168,83,.05);
    border: 1px solid rgba(212,168,83,.15);
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 16px;
}
.pg-ms-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 13px;
    color: #a08b6b;
}
.pg-ms-row strong { color: #fff; font-weight: 700; }
.pg-ms-row strong.pos { color: #4adea0; }

.pg-section-title {
    font-size: 13px;
    font-weight: 800;
    color: #d4a853;
    margin: 16px 0 10px;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.pg-stats-bet {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 10px;
    align-items: center;
    padding: 10px 12px;
    margin-bottom: 6px;
    background: rgba(255,255,255,.04);
    border-radius: 10px;
    border-left: 3px solid rgba(212,168,83,.3);
}
.pg-stats-bet.won { border-left-color: #4adea0; }
.pg-stats-bet.lost { border-left-color: #ed4b9e; }
.pg-stats-bet.cancelled { border-left-color: #ff6b35; }

.pg-sb-round { font-size: 12px; color: #fff; font-weight: 700; }
.pg-sb-date { font-size: 10px; color: #a08b6b; margin-top: 2px; }
.pg-sb-amt { font-size: 12px; color: #fff; font-variant-numeric: tabular-nums; }
.pg-sb-payout { font-size: 13px; font-weight: 700; color: #a08b6b; }
.pg-sb-payout.pos { color: #4adea0; }
.pg-sb-payout.neg { color: #ed4b9e; }

.pg-empty {
    text-align: center;
    padding: 40px 20px;
    color: #a08b6b;
    font-size: 13px;
}
.pg-loader-wrap { min-height: 160px; display: flex; align-items: center; justify-content: center; }

/* ============ FORCE vertical layout (фикс конфликта с bootstrap/header) ============ */
.pg-page,
.pg-page-body,
.pg-history-card,
.pg-lb-row,
.pg-big-stats,
.pg-money-stats,
.pg-stats-bet {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
}

/* История: 3 блока в ряд, но каждый ряд — целиком */
.pg-history-card {
    flex-direction: row !important;
    align-items: center !important;
    gap: 12px !important;
}

/* Рейтинг: строка с 3 колонками */
.pg-lb-row {
    flex-direction: row !important;
    display: grid !important;
    grid-template-columns: 60px 1fr auto !important;
    align-items: center !important;
    gap: 12px !important;
}

/* Статистика: сетка 3 в ряд */
.pg-big-stats {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 10px !important;
}

/* Последние ставки: одна строка = 3 колонки */
.pg-stats-bet {
    display: grid !important;
    grid-template-columns: 1fr auto auto !important;
    gap: 10px !important;
    align-items: center !important;
}

/* Оборот/выигрыш — по строке */
.pg-money-stats {
    display: flex !important;
    flex-direction: column !important;
}
.pg-ms-row {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    width: 100% !important;
}

/* Шапка страницы — горизонтально */
.pg-page-head {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
}

/* <a> не должен быть display:block */
.pg-back,
.pg-load-more {
    display: inline-flex !important;
}

a.pg-foot {
    text-decoration: none !important;
    display: inline-flex !important;
    flex: 1 !important;
}

@media (max-width: 480px) {
    .pg-big-stats { grid-template-columns: 1fr 1fr !important; }
    .pg-lb-row { grid-template-columns: 40px 1fr auto !important; gap: 8px !important; }
    .pg-history-card { flex-wrap: wrap !important; }
    .pg-hc-left { min-width: 100%; }
}

/* ============ FORCE vertical layout ============ */
body .pg-page,
body .pg-page .pg-page-body,
body .pg-page .pg-page-body #historyList,
body .pg-page .pg-page-body #leaderboardList,
body .pg-page .pg-page-body #statsBox {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
}

body .pg-page .pg-history-card {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 12px !important;
}

body .pg-page .pg-lb-row {
    display: grid !important;
    grid-template-columns: 60px 1fr auto !important;
    align-items: center !important;
    gap: 12px !important;
}

body .pg-page .pg-big-stats {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 10px !important;
}

body .pg-page .pg-stats-bet {
    display: grid !important;
    grid-template-columns: 1fr auto auto !important;
    gap: 10px !important;
    align-items: center !important;
}

body .pg-page .pg-money-stats {
    display: flex !important;
    flex-direction: column !important;
}
body .pg-page .pg-money-stats .pg-ms-row {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    width: 100% !important;
}

body .pg-page .pg-page-head {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
}

body .pg-page .pg-back,
body .pg-page .pg-load-more {
    display: inline-flex !important;
}

a.pg-foot {
    text-decoration: none !important;
    display: inline-flex !important;
    flex: 1 !important;
}

@media (max-width: 480px) {
    body .pg-page .pg-big-stats { grid-template-columns: 1fr 1fr !important; }
    body .pg-page .pg-lb-row { grid-template-columns: 40px 1fr auto !important; gap: 8px !important; }
    body .pg-page .pg-history-card { flex-wrap: wrap !important; }
    body .pg-page .pg-history-card .pg-hc-left { min-width: 100%; }
}

/* ============ QUICK AMOUNTS + DIRECT UP/DOWN ============ */
.pg-quick-amounts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}
.pg-quick-amt {
    flex: 1 1 auto;
    min-width: 54px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1.5px solid rgba(212,168,83,.25);
    background: rgba(212,168,83,.04);
    color: #c9b89a;
    font-weight: 800;
    font-size: 13px;
    cursor: pointer;
    transition: all .15s;
    text-align: center;
}
.pg-quick-amt:hover {
    border-color: rgba(212,168,83,.5);
    color: #fff;
    background: rgba(212,168,83,.12);
}
.pg-quick-amt.active {
    border-color: #d4a853;
    background: linear-gradient(180deg, rgba(212,168,83,.28), rgba(212,168,83,.12));
    color: #ffd47a;
    box-shadow: 0 4px 14px rgba(212,168,83,.25);
}
.pg-quick-amt:disabled { opacity: .4; cursor: not-allowed; }

.pg-custom-amt {
    flex: 1 1 120px;
    position: relative;
    min-width: 120px;
}
.pg-custom-amt input {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 48px 10px 12px;
    border-radius: 12px;
    border: 1.5px solid rgba(212,168,83,.25);
    background: rgba(0,0,0,.3);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
}
.pg-custom-amt input:focus {
    outline: none;
    border-color: #d4a853;
    box-shadow: 0 0 0 3px rgba(212,168,83,.15);
}
.pg-custom-cur {
    position: absolute;
    right: 10px; top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    font-weight: 700;
    color: #a08b6b;
    letter-spacing: .5px;
}

/* Кнопки UP/DOWN — большие, с суммой */
.pg-bet-form .pg-dir {
    flex-direction: column;
    gap: 4px;
    padding: 16px 12px;
}
.pg-bet-form .pg-dir span {
    font-size: 17px;
    font-weight: 800;
    letter-spacing: 1px;
}
.pg-bet-form .pg-dir small {
    font-size: 11px;
    font-weight: 600;
    opacity: .8;
    color: inherit;
}

.pg-bet-form.live-locked {
    opacity: .55;
    pointer-events: none;
}

/* ============ MOBILE: страховка от overflow ============ */
@media (max-width: 768px) {
    body:has(.prediction-modal.open) {
        overflow: hidden !important;
        
        width: 100%;
        height: 100dvh;
    }
    .prediction-modal {
        padding: 0;
        align-items: stretch;
        overflow: hidden;
    }
    .prediction-modal .pg-shell {
        max-height: 100dvh;
        height: 100dvh;
        border-radius: 0;
    }
}

/* Fallback для старых браузеров, не поддерживающих dvh */
@supports not (height: 100dvh) {
    @media (max-width: 768px) {
        .prediction-modal .pg-shell {
            max-height: 100vh;
            height: 100vh;
        }
    }
}

/* ============================================================
   ЖЁСТКИЙ ФИКС ДЛЯ МОБИЛЬНЫХ (не зависит от flex и sticky)
   ============================================================ */
@media (max-width: 768px) {
    /* 1. Модалка на весь экран */
    .prediction-modal {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        padding: 0 !important;
        background: #0a0808 !important;
        z-index: 999999 !important;
        display: flex !important;
        flex-direction: column !important;
    }
    
    .prediction-modal.open {
        display: flex !important;
    }

    /* 2. Карточка занимает всё пространство */
    .prediction-modal .pg-shell {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        max-width: 100% !important;
        height: 100dvh !important;
        max-height: 100dvh !important;
        margin: 0 !important;
        border-radius: 0 !important;
        border: none !important;
        overflow: hidden !important; /* Отключаем скролл всей карточки */
    }

    /* 3. Всё, что внутри, кроме футера, сжимается, но не растягивает */
    .prediction-modal .pg-head,
    .prediction-modal .pg-hero,
    .prediction-modal .pg-chart-wrap,
    .prediction-modal .pg-pools,
    .prediction-modal .pg-bot-activity,
    .prediction-modal .pg-bet-form,
    .prediction-modal .pg-result {
        flex-shrink: 0 !important;
    }

    /* 4. Футер — в самом низу, не скроллится, не исчезает */
    .prediction-modal .pg-footer {
        flex-shrink: 0 !important;
        margin-top: auto !important; /* Прижимаем к низу */
        background: #141010 !important;
        border-top: 1px solid rgba(212, 168, 83, 0.3) !important;
        padding: 10px 12px !important;
        padding-bottom: max(10px, env(safe-area-inset-bottom)) !important;
        position: relative !important;
        z-index: 100 !important;
    }

    /* 5. Уменьшаем отступы, чтобы влезло */
    .prediction-modal .pg-head { padding: 10px 14px !important; }
    .prediction-modal .pg-hero { padding: 10px 14px !important; grid-template-columns: 90px 1fr !important; gap: 10px !important; }
    .prediction-modal .pg-timer-wrap { width: 90px !important; height: 90px !important; }
    .prediction-modal .pg-timer-text span { font-size: 22px !important; }
    .prediction-modal .pg-price-value { font-size: 24px !important; }
    .prediction-modal .pg-chart-wrap { height: 100px !important; margin: 0 12px 8px !important; }
    .prediction-modal .pg-pools { padding: 0 12px 8px !important; gap: 8px !important; }
    .prediction-modal .pg-pool { padding: 8px !important; }
    .prediction-modal .pg-pool-sum { font-size: 13px !important; }
    .prediction-modal .pg-bet-form { padding: 10px 12px !important; }
    
    /* 6. Кнопки быстрой суммы и UP/DOWN делаем компактнее */
    .prediction-modal .pg-quick-amounts { gap: 6px !important; margin-bottom: 8px !important; }
    .prediction-modal .pg-quick-amt { padding: 8px 6px !important; font-size: 12px !important; }
    .prediction-modal .pg-custom-amt input { padding: 8px 40px 8px 10px !important; font-size: 12px !important; }
    .prediction-modal .pg-dir-btns { gap: 8px !important; margin-bottom: 8px !important; }
    .prediction-modal .pg-bet-form .pg-dir { padding: 12px 8px !important; }
    .prediction-modal .pg-bet-form .pg-dir span { font-size: 15px !important; }
    .prediction-modal .pg-bet-form .pg-dir small { font-size: 10px !important; }
}

/* ===== МОБИЛЬНАЯ ВЕРСТКА: ХЕДЕР И ФУТЕР ВСЕГДА НА МЕСТЕ ===== */
@media (max-width: 768px) {
    /* Оверлей на весь экран */
    .prediction-modal {
        padding: 0 !important;
        align-items: stretch !important;
        overflow: hidden !important;
    }
    
    /* Сама карточка — колонка, прижатая к экрану */
    .pg-shell {
        display: flex !important;
        flex-direction: column !important;
        height: 100dvh !important;
        max-height: 100dvh !important;
        border-radius: 0 !important;
        border: none !important;
        overflow: hidden !important; 
    }

    /* 1. ШАПКА (заголовок + баланс) — не сжимается и не скроллится */
    .pg-shell .pg-head {
        flex-shrink: 0 !important;
    }

    /* 2. ЦЕНТРАЛЬНАЯ ЧАСТЬ (всё, что между шапкой и футером) — скроллится */
    /* Нам нужно обернуть её в скроллируемый блок, но так как в HTML нет общей обертки, 
       мы делаем скролл для всех элементов КРОМЕ шапки и футера, 
       используя отдельный контейнер-обертку (создадим её в JS на следующем шаге) 
       или просто разрешим скролл всему контенту, а футер вытолкнем */
       
    /* Проще: задаем отступы и скролл для main-части */
    .pg-shell .pg-hero,
    .pg-shell .pg-chart-wrap,
    .pg-shell .pg-pools,
    .pg-shell .pg-bot-activity,
    .pg-shell .pg-bet-form,
    .pg-shell .pg-result {
        flex-shrink: 0 !important;
    }

    /* 3. ФУТЕР — всегда прибит к низу */
    .pg-shell .pg-footer {
        flex-shrink: 0 !important;
        margin-top: auto !important; /* Толкает футер вниз */
        background: rgba(20, 16, 16, 0.98) !important;
        backdrop-filter: blur(10px) !important;
        border-top: 1px solid rgba(212, 168, 83, 0.25) !important;
        padding: 12px 20px !important;
        padding-bottom: max(12px, env(safe-area-inset-bottom)) !important;
        z-index: 100 !important;
    }
    
    /* Убираем огромный пустой пробел */
    .pg-bet-form {
        margin-bottom: 0 !important;
    }
    .pg-shell {
        gap: 0 !important;
    }
}
