/* =========================================================
   KOP Edge Engine — Cards UI (v1)
   Reuses Market Context / Momentum Panel language
   Adds .kop-edge-* layer for the new Edge cards JS
   ========================================================= */

:root {
    --kop-accent: #0DDDB4;
    --kop-accent-dark: #09A587;
    --kop-accent-soft: rgba(13, 221, 180, 0.20);
    --kop-ink: #0f172a;
    --kop-muted: #64748b;
    --kop-border: rgba(148, 163, 184, 0.35);

    --kop-good: #16a34a;
    --kop-warn: #f59e0b;
    --kop-bad: #ef4444;
    --kop-blue: #38bdf8;

    --kop-card-bg: radial-gradient(circle at top left, #f9fafb, #ffffff);
    --kop-card-shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
    --kop-card-shadow-hover: 0 18px 40px rgba(15, 23, 42, 0.12);
}

/* ---------------------------------------------------------
   Base layout (same as your Market Context v2)
   Keep this so your sidebar + grid stay identical
   --------------------------------------------------------- */

.kop-mc-panel {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1.5rem 1rem 2rem;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--kop-ink);
    position: relative;
}

.kop-mc-layout {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
}

@media (max-width:900px) {
    .kop-mc-layout {
        flex-direction: column;
    }
}

/* Mobile filters toggle */
.kop-mc-filters-toggle {
    display: none;
}

@media (max-width:900px) {
    .kop-mc-filters-toggle {
        display: inline-flex;
        align-items: center;
        gap: .35rem;
        margin-bottom: .6rem;
        padding: .35rem .85rem;
        border-radius: 999px;
        border: 1px solid #0b1220;
        background: #0f172a;
        color: #f9fafb;
        font-size: .85rem;
        font-weight: 600;
        cursor: pointer;
        box-shadow: 0 10px 25px rgba(15, 23, 42, .45);
    }

    .kop-mc-filters-toggle::before {
        content: "☰";
        font-size: .95rem;
    }
}

/* Sidebar (unchanged) */
.kop-mc-sidebar {
    flex: 0 0 290px;
    max-width: 320px;
    background: #f9fafb;
    border-radius: 18px;
    border: 1px solid rgba(148, 163, 184, 0.45);
    padding: 1rem .9rem 1.1rem;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.05);
    position: sticky;
    top: 1rem;
    z-index: 10;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.35) transparent;
}

.kop-mc-sidebar::-webkit-scrollbar {
    width: 5px;
}

.kop-mc-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.kop-mc-sidebar::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.30);
    border-radius: 999px;
}

.kop-mc-sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.50);
}

@media (max-width:900px) {
    .kop-mc-sidebar {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: 80%;
        max-width: 320px;
        border-radius: 0;
        border-left: 1px solid rgba(148, 163, 184, 0.5);
        border-right: none;
        padding: 2.4rem 1rem 1.2rem;
        box-shadow: -18px 0 40px rgba(15, 23, 42, 0.45);
        height: 100vh;
        max-height: none;

        transform: translateX(100%);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        z-index: 40;
        transition: transform .18s ease, opacity .18s ease, visibility .18s ease;
    }

    .kop-mc-panel.kop-mc-sidebar-open .kop-mc-sidebar {
        transform: translateX(0);
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    body.admin-bar .kop-mc-sidebar {
        top: 46px;
        height: calc(100vh - 46px);
    }
}

.kop-mc-sidebar-close {
    display: none;
}

@media (max-width:900px) {
    .kop-mc-sidebar-close {
        display: inline-flex;
        position: fixed;
        top: .9rem;
        right: .9rem;
        width: 1.9rem;
        height: 1.9rem;
        align-items: center;
        justify-content: center;
        border-radius: 999px;
        border: 1px solid #cbd5e1;
        background: #e5e7eb;
        cursor: pointer;
        font-size: .95rem;
        font-weight: 700;
        color: #0f172a;
        z-index: 50;
    }

    .kop-mc-panel:not(.kop-mc-sidebar-open) .kop-mc-sidebar-close {
        display: none;
    }

    body.admin-bar .kop-mc-sidebar-close {
        top: 2.9rem;
    }
}

.kop-mc-overlay {
    display: none;
}

@media (max-width:900px) {
    .kop-mc-overlay {
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.45);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        z-index: 30;
        transition: opacity .18s ease, visibility .18s ease;
    }

    .kop-mc-panel.kop-mc-sidebar-open .kop-mc-overlay {
        display: block;
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }
}

body.kop-momentum-no-scroll {
    overflow: hidden;
}

/* Sidebar headings */
.kop-mc-title {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: .03em;
    text-transform: uppercase;
    color: #020617;
    margin: 0 0 .15rem;
}

.kop-mc-subtitle {
    margin: 0;
    font-size: .8rem;
    color: #6b7280;
}

.kop-mc-sidebar-section {
    margin-bottom: 1rem;
}

.kop-mc-sidebar-section:last-child {
    margin-bottom: 0;
}

.kop-mc-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: #4b5563;
    margin: 0 0 .35rem;
}

/* Filter pills */
.kop-mc-filters {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
}

.kop-mc-btn {
    border: 1px solid #d4d4dd;
    background: #f8fafc;
    border-radius: 999px;
    padding: .3rem .8rem;
    font-size: .8rem;
    font-weight: 500;
    color: #1e293b;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, box-shadow .15s ease, transform .08s ease;
    white-space: nowrap;
    user-select: none;
}

.kop-mc-btn:hover {
    background: #ecfeff;
    border-color: var(--kop-accent);
}

.kop-mc-btn.is-active {
    background: var(--kop-accent);
    color: #f9fafb;
    border-color: var(--kop-accent-dark);
    box-shadow: 0 0 0 1px var(--kop-accent-soft);
    transform: translateY(-1px);
}

.kop-mc-search {
    width: 100%;
    border-radius: 999px;
    border: 1px solid #d4d4dd;
    padding: .45rem .85rem;
    font-size: .85rem;
    outline: none;
    background: #fff;
    color: #0f172a;
}

.kop-mc-search::placeholder {
    color: #a1a1aa;
}

.kop-mc-search:focus {
    border-color: #38bdf8;
    box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.3);
}

/* Main */
.kop-mc-main {
    flex: 1 1 0;
    min-width: 0;
}

.kop-mc-main-header {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    margin-bottom: .9rem;
}

@media (min-width:700px) {
    .kop-mc-main-header {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: .75rem;
    }
}

.kop-mc-active {
    font-size: .75rem;
    color: #6b7280;
}

.kop-mc-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    align-items: center;
}

/* Cards grid */
.kop-mc-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: .9rem;
}

@media (min-width:900px) {
    .kop-mc-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.kop-mc-empty-state {
    padding: 18px;
    border: 1px dashed rgba(148, 163, 184, 0.45);
    border-radius: 14px;
    color: #475569;
}

/* ---------------------------------------------------------
   Edge cards layer (new)
   --------------------------------------------------------- */

.kop-edge-card {
    border-radius: 14px;
    border: 1px solid var(--kop-border);
    background: var(--kop-card-bg);
    padding: .85rem .85rem .9rem;
    box-shadow: var(--kop-card-shadow);
    display: flex;
    flex-direction: column;
    gap: .55rem;
    transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
    overflow: hidden;
    /* prevent drawer/pills bleed */
}

.kop-edge-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--kop-card-shadow-hover);
    border-color: rgba(56, 189, 248, 0.7);
}

/* Header: KO + league, pills right */
.kop-edge-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .75rem;
}

.kop-edge-ko {
    font-size: .78rem;
    font-weight: 650;
    color: #0f172a;
    line-height: 1.1;
}

.kop-edge-league {
    margin-top: .1rem;
    font-size: .78rem;
    color: #64748b;
    font-weight: 550;
}

.kop-edge-header-right {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    justify-content: flex-end;
}

/* Small pills (calm, premium) */
.kop-edge-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 999px;
    padding: .18rem .55rem;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(255, 255, 255, 0.92);
    font-size: .72rem;
    font-weight: 750;
    letter-spacing: .02em;
    color: #0f172a;
    white-space: nowrap;
}

.kop-edge-pill.is-market {
    background: rgba(2, 6, 23, 0.03);
    color: rgba(15, 23, 42, 0.85);
}

.kop-edge-pill.is-side {
    border-color: rgba(13, 221, 180, 0.40);
    background: rgba(13, 221, 180, 0.10);
    color: rgba(9, 88, 74, 0.98);
}

.kop-edge-pill.is-stage {
    background: #f3f4f6;
    border-color: #e5e7eb;
    color: #4b5563;
}

/* Teams row (matched vibe to kop-mc-teams) */
.kop-edge-teams {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: .6rem;
    padding-top: .1rem;
}

.kop-edge-team .k {
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #9ca3af;
}

.kop-edge-team .v {
    font-size: .95rem;
    font-weight: 650;
    color: #0f172a;
    line-height: 1.25;
    margin-top: .1rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kop-edge-team.right {
    text-align: right;
}

.kop-edge-vs {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
}

.kop-edge-vs {
    font-size: .72rem;
    color: #6b7280;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    padding: .1rem .45rem;
}

/* Hero row: title/why left, edge right */
.kop-edge-hero {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: .75rem;
    margin-top: .1rem;
}

.kop-edge-title {
    font-size: .98rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.15;
}

.kop-edge-hero-sub {
    margin-top: .25rem;
    display: flex;
    flex-wrap: wrap;
    gap: .35rem .45rem;
    align-items: center;
}

.kop-edge-why {
    font-size: .78rem;
    color: #475569;
    font-weight: 600;
    line-height: 1.25;
    max-width: 560px;
}

/* Edge box (hero number) */
.kop-edge-hero-right {
    flex: 0 0 auto;
    min-width: 92px;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: linear-gradient(180deg, rgba(2, 6, 23, 0.02), rgba(255, 255, 255, 0.92));
    padding: .55rem .65rem .55rem;
    box-shadow: 0 10px 24px rgba(15, 23, 42, .06);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-end;
}

.kop-edge-edge-label {
    font-size: .68rem;
    letter-spacing: .10em;
    text-transform: uppercase;
    color: rgba(100, 116, 139, .95);
    font-weight: 900;
}

.kop-edge-edge-val {
    margin-top: .2rem;
    font-size: 1.25rem;
    font-weight: 900;
    letter-spacing: .01em;
    color: #0f172a;
    line-height: 1;
}

/* =========================================================
   Score Bands (edge_primary: -6..+6)
   Applied to .kop-edge-card via JS: sb-g2/g1/y2/y1/o1/r1/r2
   ========================================================= */

.kop-edge-hero-right {
    --sb: rgba(148, 163, 184, .35);
    --sbGlow: rgba(148, 163, 184, .10);
    border-color: var(--sb);
    box-shadow: 0 10px 24px rgba(15, 23, 42, .06), 0 0 0 1px rgba(255, 255, 255, .25) inset;
}

/* dark green */
.kop-edge-card.sb-g2 .kop-edge-hero-right {
    --sb: rgba(22, 163, 74, .62);
    --sbGlow: rgba(22, 163, 74, .12);
    box-shadow: 0 14px 30px var(--sbGlow), 0 10px 24px rgba(15, 23, 42, .06);
}

/* green */
.kop-edge-card.sb-g1 .kop-edge-hero-right {
    --sb: rgba(34, 197, 94, .50);
    --sbGlow: rgba(34, 197, 94, .10);
    box-shadow: 0 12px 28px var(--sbGlow), 0 10px 24px rgba(15, 23, 42, .06);
}

/* yellow (strong neutral+) */
.kop-edge-card.sb-y2 .kop-edge-hero-right {
    --sb: rgba(245, 158, 11, .55);
    --sbGlow: rgba(245, 158, 11, .10);
    box-shadow: 0 12px 28px var(--sbGlow), 0 10px 24px rgba(15, 23, 42, .06);
}

/* yellow (neutral-) */
.kop-edge-card.sb-y1 .kop-edge-hero-right {
    --sb: rgba(234, 179, 8, .45);
    --sbGlow: rgba(234, 179, 8, .08);
    box-shadow: 0 12px 26px var(--sbGlow), 0 10px 24px rgba(15, 23, 42, .06);
}

/* orange */
.kop-edge-card.sb-o1 .kop-edge-hero-right {
    --sb: rgba(249, 115, 22, .52);
    --sbGlow: rgba(249, 115, 22, .10);
    box-shadow: 0 12px 26px var(--sbGlow), 0 10px 24px rgba(15, 23, 42, .06);
}

/* red */
.kop-edge-card.sb-r1 .kop-edge-hero-right {
    --sb: rgba(239, 68, 68, .52);
    --sbGlow: rgba(239, 68, 68, .10);
    box-shadow: 0 12px 26px var(--sbGlow), 0 10px 24px rgba(15, 23, 42, .06);
}

/* dark red */
.kop-edge-card.sb-r2 .kop-edge-hero-right {
    --sb: rgba(190, 18, 60, .60);
    --sbGlow: rgba(190, 18, 60, .12);
    box-shadow: 0 14px 30px var(--sbGlow), 0 10px 24px rgba(15, 23, 42, .06);
}

/* missing */
.kop-edge-card.sb-missing .kop-edge-hero-right {
    border-style: dashed;
    opacity: .92;
}

.kop-edge-hero-right {
    flex: 0 0 auto;
    min-width: 104px;
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background:
        radial-gradient(120px 90px at 20% 20%, rgba(255, 255, 255, .95), rgba(255, 255, 255, .55) 55%, rgba(2, 6, 23, .02)),
        linear-gradient(180deg, rgba(2, 6, 23, 0.02), rgba(255, 255, 255, 0.92));
    padding: .60rem .70rem .62rem;
    box-shadow: 0 12px 28px rgba(15, 23, 42, .08);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-end;
}

/* subtle gloss line */
.kop-edge-hero-right::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(135deg, rgba(255, 255, 255, .42), transparent 55%);
    opacity: .55;
}

/* tiny corner badge feel */
.kop-edge-edge-label {
    font-size: .66rem;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: rgba(100, 116, 139, .92);
    font-weight: 950;
}

.kop-edge-edge-val {
    margin-top: .18rem;
    font-size: 1.45rem;
    font-weight: 950;
    letter-spacing: -0.01em;
    color: #0f172a;
    line-height: 1;
}

/* optional: show “/ 6” as a faint cap if you add it in JS later */
.kop-edge-edge-val .cap {
    font-size: .85rem;
    font-weight: 800;
    opacity: .45;
    margin-left: .15rem;
}

/* Momentum block (keep feel, slightly tighter) */
.kop-edge-momentum {
    display: flex;
    flex-direction: column;
    gap: .25rem;
    margin-top: .05rem;
}

.kop-edge-momentum-top {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: .6rem;
}

.kop-edge-momentum-side {
    display: flex;
    align-items: baseline;
    gap: .35rem;
    font-size: .78rem;
    color: #475569;
    font-weight: 650;
}

.kop-edge-momentum-side.right {
    justify-content: flex-end;
    text-align: right;
}

.kop-edge-momentum-side .k {
    font-size: .68rem;
    letter-spacing: .10em;
    text-transform: uppercase;
    opacity: .55;
    font-weight: 900;
}

.kop-edge-momentum-mid {
    display: flex;
    align-items: baseline;
    gap: .35rem;
    justify-content: center;
    padding: .12rem .5rem;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(2, 6, 23, 0.02);
    font-size: .78rem;
    font-weight: 850;
    color: #0f172a;
}

.kop-edge-momentum-mid .k {
    font-size: .66rem;
    letter-spacing: .10em;
    text-transform: uppercase;
    opacity: .55;
    font-weight: 900;
}

/* Momentum gap bar — ported 1:1 from Market Context (center-anchored) */
.kop-edge-gap-row {
    display: flex;
    flex-direction: column;
    gap: .25rem;
    margin-top: .1rem;
}

.kop-edge-gap-label {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #9ca3af;
}

.kop-edge-gap-bar-wrap {
    display: flex;
    align-items: center;
    gap: .45rem;
}

.kop-edge-gap-bar-bg {
    flex: 1;
    height: .45rem;
    border-radius: 999px;
    background: linear-gradient(to right, #e0f2fe, #fef9c3, #fee2e2);
    position: relative;
    overflow: hidden;
}

/* KEY: fill grows from centre, max half-bar */
.kop-edge-gap-bar-fill {
    position: absolute;
    top: 0;
    bottom: 0;
    width: calc(50% * var(--kop-gap-abs, 0.4));
    border-radius: inherit;
    opacity: .95;
}

.kop-edge-gap-bar-fill.to-home {
    right: 50%;
    background: linear-gradient(to left, rgba(22, 101, 52, .9), rgba(15, 23, 42, .95));
}

.kop-edge-gap-bar-fill.to-away {
    left: 50%;
    background: linear-gradient(to right, rgba(244, 63, 94, .9), rgba(15, 23, 42, .95));
}

.kop-edge-gap-value {
    font-size: .8rem;
    font-weight: 600;
    color: #0f172a;
    min-width: 3rem;
    text-align: right;
}



/* ATK/DEF/FIN badges row */
.kop-edge-atkdef {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .6rem;
    margin-top: .05rem;
}

.kop-edge-atkdef-side {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    align-items: center;
    min-width: 0;
}

.kop-edge-atkdef-side.right {
    justify-content: flex-end;
    text-align: right;
}

.kop-edge-atkdef-side .side {
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .10em;
    color: #9ca3af;
    font-weight: 900;
    margin-right: .15rem;
}

/* Trend badge tokens */
.kop-edge-trend {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .16rem .5rem;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(255, 255, 255, 0.92);
    font-size: .72rem;
    font-weight: 850;
    color: #0f172a;
    white-space: nowrap;
}

.kop-edge-trend .k {
    font-size: .66rem;
    font-weight: 950;
    letter-spacing: .08em;
    text-transform: uppercase;
    opacity: .6;
}

/* Trend colors (borrow your palette logic) */
.kop-edge-trend.t-hot {
    background: #f97316;
    border-color: #ea580c;
    color: #fff;
}

.kop-edge-trend.t-warm {
    background: #facc15;
    border-color: #eab308;
    color: #1f2937;
}

.kop-edge-trend.t-stable {
    background: #e5e7eb;
    border-color: #9ca3af;
    color: #374151;
}

.kop-edge-trend.t-cool {
    background: #38bdf8;
    border-color: #0ea5e9;
    color: #0f172a;
}

.kop-edge-trend.t-freezing {
    background: #1d4ed8;
    border-color: #1e40af;
    color: #eff6ff;
}

/* Drawer (details) */
.kop-edge-drawer {
    margin-top: .1rem;
    border-top: 1px solid rgba(148, 163, 184, 0.22);
    padding-top: .55rem;
}

.kop-edge-drawer summary {
    list-style: none;
}

.kop-edge-drawer summary::-webkit-details-marker {
    display: none;
}

.kop-edge-drawer-sum {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(248, 250, 252, 0.92);
    border-radius: 14px;
    padding: .60rem .70rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    transition: transform .10s ease, box-shadow .12s ease, border-color .12s ease, background .12s ease;
    overflow: hidden;
}

.kop-edge-drawer-sum:hover {
    transform: translateY(-1px);
    border-color: rgba(56, 189, 248, .55);
    box-shadow: 0 12px 26px rgba(15, 23, 42, .10);
    background: #ffffff;
}

.kop-edge-drawer-sum>span:first-child {
    font-weight: 900;
    color: #0f172a;
    letter-spacing: .02em;
}

.kop-edge-drawer-sum .hint {
    margin-left: auto;
    font-size: .75rem;
    color: rgba(100, 116, 139, .95);
    font-weight: 650;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 280px;
}

.kop-edge-drawer-sum .chev {
    width: 26px;
    height: 26px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(148, 163, 184, .35);
    background: rgba(2, 6, 23, .03);
    transition: transform .16s ease;
    flex: 0 0 auto;
}

.kop-edge-drawer[open] .kop-edge-drawer-sum .chev {
    transform: rotate(180deg);
}

.kop-edge-drawer-body {
    margin-top: .55rem;
    animation: kopEdgeFadeIn .16s ease;
}

@keyframes kopEdgeFadeIn {
    from {
        opacity: 0;
        transform: translateY(-2px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.kop-edge-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

@media (max-width:600px) {
    .kop-edge-cols {
        grid-template-columns: 1fr;
    }
}

.kop-edge-col {
    border: 1px solid rgba(148, 163, 184, .22);
    background: linear-gradient(180deg, rgba(248, 250, 252, .92), rgba(255, 255, 255, .92));
    border-radius: 14px;
    padding: 10px 10px 9px;
    box-shadow: 0 10px 22px rgba(15, 23, 42, .05);
}

.kop-edge-col .h {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .12em;
    font-weight: 900;
    color: rgba(100, 116, 139, .95);
    margin-bottom: 8px;
}

.kop-edge-factor {
    font-size: 12px;
    color: #334155;
    padding: 6px 0;
    border-top: 1px dashed rgba(148, 163, 184, .22);
    line-height: 1.25;
}

.kop-edge-factor:first-child {
    border-top: none;
    padding-top: 0;
}

.kop-edge-muted {
    font-size: 12px;
    color: rgba(100, 116, 139, .95);
}

.kop-edge-flags {
    margin-top: 10px;
    border: 1px solid rgba(148, 163, 184, .22);
    background: linear-gradient(180deg, rgba(248, 250, 252, .92), rgba(255, 255, 255, .92));
    border-radius: 14px;
    padding: 10px 10px 9px;
    box-shadow: 0 10px 22px rgba(15, 23, 42, .05);
}

.kop-edge-flags .h {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .12em;
    font-weight: 900;
    color: rgba(100, 116, 139, .95);
    margin-bottom: 8px;
}

.kop-edge-flags .chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.kop-edge-flag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, .35);
    background: #fff;
    font-size: 12px;
    font-weight: 750;
    color: #0f172a;
}

.kop-edge-flag.is-muted {
    background: #f8fafc;
    color: rgba(15, 23, 42, .78);
}

.kop-edge-flag.is-amber {
    background: #fffbeb;
    border-color: rgba(245, 158, 11, .35);
    color: #92400e;
}

.kop-edge-flag.is-red {
    background: #fff1f2;
    border-color: rgba(239, 68, 68, .35);
    color: #9f1239;
}

/* Loading state (panel class added by JS) */
.kop-mc-panel.is-loading .kop-mc-grid {
    opacity: .65;
    filter: saturate(.9);
}

/* Mobile tightening */
@media (max-width:600px) {
    .kop-mc-panel {
        padding: .5rem .5rem 1.2rem;
    }

    .kop-mc-grid {
        grid-template-columns: 1fr !important;
        gap: .75rem;
    }

    .kop-edge-card {
        padding: .85rem;
    }

    .kop-edge-title {
        font-size: .95rem;
    }

    .kop-edge-hero-right {
        min-width: 86px;
    }

    .kop-edge-drawer-sum .hint {
        max-width: 200px;
    }
}

/* ------------------------------------------------------------
 * Edge Engine — Angle Category Top Bar (9 themes)
 * ------------------------------------------------------------ */
.kop-edge-card {
    overflow: hidden;
}

/* ensures top bar rounds correctly */

.kop-edge-anglebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .55rem .8rem;
    background: var(--ang-bg, rgba(15, 23, 42, .06));
    color: var(--ang-fg, #0f172a);
    border-bottom: 1px solid rgba(148, 163, 184, .25);
}

.kop-edge-anglebar-left {
    display: flex;
    align-items: baseline;
    gap: .55rem;
    min-width: 0;
}

.kop-edge-anglebar-k {
    font-size: .66rem;
    letter-spacing: .12em;
    text-transform: uppercase;
    font-weight: 900;
    opacity: .75;
    white-space: nowrap;
}

.kop-edge-anglebar-v {
    font-size: 1.02rem;
    font-weight: 900;
    letter-spacing: -0.01em;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kop-edge-anglebar-right {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex: 0 0 auto;
}

.kop-edge-anglechip {
    font-size: .68rem;
    font-weight: 850;
    letter-spacing: .06em;
    text-transform: uppercase;
    padding: .22rem .5rem;
    border-radius: 999px;
    background: var(--ang-chip-bg, rgba(15, 23, 42, .10));
    color: var(--ang-chip-fg, #0f172a);
    border: 1px solid rgba(15, 23, 42, .12);
    white-space: nowrap;
}

/* Small spacing tweak: hero should sit closer after removing title */
.kop-edge-hero {
    margin-top: .35rem;
}

.kop-edge-hero-left .kop-edge-hero-sub {
    margin-top: .15rem;
}

/* --- Angle top bar: integrate with card shell (softer, less sharp) --- */
.kop-edge-card {
    overflow: hidden;
    /* ensures anglebar clips to card radius */
}

/* bar itself */
.kop-edge-anglebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;

    padding: .65rem .85rem;
    background: color-mix(in srgb, var(--ang-bg) 72%, white);
    /* soften */
    color: var(--ang-fg);

    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    border-top-left-radius: inherit;
    border-top-right-radius: inherit;
}

/* add subtle “inset” line so it feels premium */
.kop-edge-anglebar::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35);
}

/* ensure ::after works */
.kop-edge-anglebar {
    position: relative;
}

/* left block */
.kop-edge-anglebar-left {
    display: flex;
    align-items: baseline;
    gap: .6rem;
    min-width: 0;
}

.kop-edge-anglebar-k {
    font-size: .68rem;
    letter-spacing: .14em;
    text-transform: uppercase;
    opacity: .75;
    font-weight: 900;
}

.kop-edge-anglebar-v {
    font-size: .98rem;
    font-weight: 850;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* right chip: match your pill language */
.kop-edge-anglechip {
    display: inline-flex;
    align-items: center;
    padding: .28rem .55rem;

    border-radius: 999px;
    font-size: .72rem;
    font-weight: 850;
    letter-spacing: .06em;
    text-transform: uppercase;

    background: var(--ang-chip-bg);
    color: var(--ang-chip-fg);
    border: 1px solid rgba(15, 23, 42, .12);
    box-shadow: 0 1px 0 rgba(255, 255, 255, .25);
}

/* ---------------------------------------------------------
   Market Stamp (NEW) — replaces ladder + path strip
   --------------------------------------------------------- */

.kop-edge-stamp {
    flex: 1 1 auto;
    min-width: 0;
    border-radius: 16px;
    border: 1px solid rgba(15, 23, 42, .10);
    background: rgba(255, 255, 255, .72);
    box-shadow: 0 10px 22px rgba(15, 23, 42, .06);
    padding: .60rem .70rem .65rem;
}

.kop-edge-stamp-top {
    display: flex;
    align-items: center;
    gap: .35rem;
    flex-wrap: wrap;
    margin-bottom: .55rem;
}

/* Behaviour chip (neutral, analytical) */
.kop-edge-behaviour {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .22rem .60rem;
    border-radius: 999px;
    border: 1px solid rgba(15, 23, 42, .10);
    background: rgba(2, 6, 23, .03);
    font-size: .72rem;
    font-weight: 900;
    letter-spacing: .02em;
    white-space: nowrap;
}

/* Market aligns */
.kop-edge-behaviour.is-agree {
    border-color: rgba(13, 221, 180, .35);
    /* accent teal */
    background: rgba(13, 221, 180, .12);
    color: #064e3b;
}

/* Market diverges */
.kop-edge-behaviour.is-disagree {
    border-color: rgba(100, 116, 139, .35);
    /* slate */
    background: rgba(100, 116, 139, .14);
    color: #1e293b;
}

/* Market unchanged */
.kop-edge-behaviour.is-flat {
    border-color: rgba(148, 163, 184, .35);
    background: rgba(148, 163, 184, .14);
    color: #334155;
}

/* Market unclear */
.kop-edge-behaviour.is-unknown {
    border-style: dashed;
    border-color: rgba(148, 163, 184, .45);
    background: rgba(248, 250, 252, .70);
    color: rgba(15, 23, 42, .65);
}


/* compact 24/60/KO strip */
.kop-edge-stamp-strip {
    border-radius: 14px;
    border: 1px solid rgba(15, 23, 42, .08);
    background: rgba(2, 6, 23, .02);
    padding: .55rem .60rem;
}

.kop-edge-stamp-head {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    margin-bottom: 6px;
}

.kop-edge-stamp-head .h {
    font-size: 11px;
    letter-spacing: .12em;
    text-transform: uppercase;
    opacity: .60;
    font-weight: 900;
    text-align: center;
}

.kop-edge-stamp-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    padding: 6px 0;
}

.kop-edge-stamp-row .v {
    font-weight: 900;
    font-size: 13px;
    text-align: center;
}

.kop-edge-stamp-row.is-line .v {
    font-weight: 800;
    opacity: .92;
}

.kop-edge-hero-left {
    flex: 1 1 auto;
    min-width: 0;
}

/* Make anglebar full-bleed inside padded card */
.kop-edge-anglebar {
    margin: -.85rem -.85rem .55rem;
    border-top-left-radius: 14px;
    border-top-right-radius: 14px;
}


.kop-edge-trend {
    padding: .12rem .42rem;
    font-size: .68rem;
    font-weight: 850;
}

.kop-edge-trend .k {
    font-size: .52rem;
}


.kop-edge-hero-right {
    min-width: 86px;
    padding: .50rem .60rem;
    align-items: flex-end;
}

.kop-edge-edge-val {
    font-size: 1.05rem;
}

.kop-edge-edge-sub {
    margin-top: .30rem;
    font-size: .72rem;
    font-weight: 750;
    color: rgba(15, 23, 42, .72);
    line-height: 1.15;
}

.kop-edge-behaviour::before {
    content: "●";
    font-size: .55rem;
    opacity: .65;
}

/* Base side pill */
.kop-edge-pill.is-side {
    border-width: 1px;
    font-weight: 800;
}

/* HOME side (teal / green) */
.kop-edge-pill.is-side.is-home {
    border-color: rgba(13, 221, 180, .45);
    background: rgba(13, 221, 180, .16);
    color: #064e3b;
}

/* AWAY side (rose / red) */
.kop-edge-pill.is-side.is-away {
    border-color: rgba(244, 63, 94, .40);
    background: rgba(244, 63, 94, .14);
    color: #7f1d1d;
}

.kop-edge-pill.is-side.is-home::before {
    content: "H";
    font-size: .65rem;
    font-weight: 900;
    opacity: .65;
}

.kop-edge-pill.is-side.is-away::before {
    content: "A";
    font-size: .65rem;
    font-weight: 900;
    opacity: .65;
}

/* =========================================================
   KOP Edge — Loading system (premium)
   Triggered by: .kop-mc-panel.is-loading
   ========================================================= */

/* Top progress bar */
.kop-mc-panel {
    position: relative;
}

.kop-mc-panel.is-loading::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    height: 3px;
    width: 100%;
    z-index: 50;
    background: linear-gradient(90deg, rgba(15, 23, 42, .08), rgba(15, 23, 42, .18), rgba(15, 23, 42, .08));
    background-size: 200% 100%;
    animation: kopEdgeBar 1.05s linear infinite;
    border-radius: 0 0 8px 8px;
}

@keyframes kopEdgeBar {
    0% {
        background-position: 0% 50%;
        opacity: .75;
    }

    100% {
        background-position: 200% 50%;
        opacity: .95;
    }
}

/* Active bar “Updating…” chip */
.kop-mc-panel.is-loading #kop-edge-active::after {
    content: "Updating…";
    margin-left: .55rem;
    display: inline-flex;
    align-items: center;
    padding: .18rem .5rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .02em;
    background: rgba(15, 23, 42, .06);
    border: 1px solid rgba(15, 23, 42, .10);
    color: rgba(15, 23, 42, .70);
}

/* Skeleton cards grid */
.kop-edge-skeleton {
    border: 1px solid rgba(15, 23, 42, .10);
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 6px 18px rgba(15, 23, 42, .06);
}

.kop-edge-skel-top {
    height: 34px;
    background: rgba(15, 23, 42, .06);
}

.kop-edge-skel-body {
    padding: 14px;
    display: grid;
    gap: 10px;
}

.kop-edge-skel-row {
    height: 12px;
    border-radius: 999px;
    background: rgba(15, 23, 42, .07);
}

.kop-edge-skel-row.w-90 {
    width: 90%;
}

.kop-edge-skel-row.w-70 {
    width: 70%;
}

.kop-edge-skel-row.w-55 {
    width: 55%;
}

.kop-edge-skel-row.w-35 {
    width: 35%;
}

.kop-edge-skel-chiprow {
    display: flex;
    gap: 8px;
    margin-top: 6px;
}

.kop-edge-skel-chip {
    height: 20px;
    width: 72px;
    border-radius: 999px;
    background: rgba(15, 23, 42, .07);
}

/* Shimmer */
.kop-edge-skeleton * {
    position: relative;
    overflow: hidden;
}

.kop-edge-skeleton *::after {
    content: "";
    position: absolute;
    top: 0;
    left: -150%;
    width: 150%;
    height: 100%;
    background: linear-gradient(90deg,
            transparent,
            rgba(255, 255, 255, .65),
            transparent);
    animation: kopEdgeShimmer 1.1s ease-in-out infinite;
}

@keyframes kopEdgeShimmer {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(220%);
    }
}

/* --- Drawer: Support / Oppose rows --- */
.kop-edge-votes {
    display: grid;
    gap: 10px;
    margin-bottom: 10px;
}

.kop-edge-vote-row .h {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: rgba(15, 23, 42, .70);
    margin-bottom: 6px;
}

.kop-edge-vote-row .chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* Chips */
.kop-edge-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 100%;
    padding: 7px 10px;
    border-radius: 999px;
    font-size: 12px;
    line-height: 1;
    border: 1px solid rgba(15, 23, 42, .12);
    background: rgba(15, 23, 42, .04);
    color: rgba(15, 23, 42, .92);
}

.kop-edge-chip .kop-edge-chip-k {
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    font-size: 11px;
    opacity: .75;
}

.kop-edge-chip .kop-edge-chip-t {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 360px;
}

.kop-edge-chip .kop-edge-chip-v {
    font-weight: 800;
    opacity: .85;
}

/* Support vs Oppose tone */
.kop-edge-chip.is-support {
    border-color: rgba(16, 185, 129, .25);
    background: rgba(16, 185, 129, .10);
}

.kop-edge-chip.is-oppose {
    border-color: rgba(239, 68, 68, .22);
    background: rgba(239, 68, 68, .08);
}

/* Drawer sections from drawer_json */
.kop-edge-sections {
    display: grid;
    gap: 10px;
    margin: 10px 0;
}

.kop-edge-sec {
    border: 1px solid rgba(15, 23, 42, .10);
    background: rgba(15, 23, 42, .03);
    border-radius: 14px;
    padding: 10px;
}

.kop-edge-sec .h {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: rgba(15, 23, 42, .70);
    margin-bottom: 6px;
}

.kop-edge-sec .b {
    display: grid;
    gap: 6px;
}

.kop-edge-line {
    font-size: 13px;
    color: rgba(15, 23, 42, .92);
}

/* Small muted dash */
.kop-edge-muted {
    color: rgba(15, 23, 42, .55);
    font-size: 13px;
}

/* =========================================================
   SCORE-ONLY PREMIUM TREATMENT (override, end of file)
   Driven ONLY by .kop-edge-card.sb-*
   ========================================================= */

/* 1) Card border reacts to score band (subtle but visible) */
.kop-edge-card {
    border: 1px solid rgba(148, 163, 184, 0.35);
}

.kop-edge-card.sb-g2 {
    border-color: rgba(22, 163, 74, .42);
    box-shadow: 0 12px 34px rgba(22, 163, 74, .08), 0 10px 30px rgba(15, 23, 42, .06);
}

.kop-edge-card.sb-g1 {
    border-color: rgba(34, 197, 94, .36);
    box-shadow: 0 12px 34px rgba(34, 197, 94, .07), 0 10px 30px rgba(15, 23, 42, .06);
}

.kop-edge-card.sb-y2 {
    border-color: rgba(245, 158, 11, .38);
    box-shadow: 0 12px 34px rgba(245, 158, 11, .07), 0 10px 30px rgba(15, 23, 42, .06);
}

.kop-edge-card.sb-y1 {
    border-color: rgba(234, 179, 8, .34);
    box-shadow: 0 12px 34px rgba(234, 179, 8, .06), 0 10px 30px rgba(15, 23, 42, .06);
}

.kop-edge-card.sb-o1 {
    border-color: rgba(249, 115, 22, .38);
    box-shadow: 0 12px 34px rgba(249, 115, 22, .07), 0 10px 30px rgba(15, 23, 42, .06);
}

.kop-edge-card.sb-r1 {
    border-color: rgba(239, 68, 68, .38);
    box-shadow: 0 12px 34px rgba(239, 68, 68, .07), 0 10px 30px rgba(15, 23, 42, .06);
}

.kop-edge-card.sb-r2 {
    border-color: rgba(190, 18, 60, .42);
    box-shadow: 0 12px 34px rgba(190, 18, 60, .08), 0 10px 30px rgba(15, 23, 42, .06);
}

/* 2) Score box becomes a real “badge” */
.kop-edge-hero-right {
    border-radius: 16px;
    min-width: 96px;
    padding: .55rem .65rem;

    /* base glass */
    background:
        radial-gradient(120px 90px at 20% 20%, rgba(255, 255, 255, .95), rgba(255, 255, 255, .60) 55%, rgba(2, 6, 23, .02)),
        linear-gradient(180deg, rgba(2, 6, 23, .02), rgba(255, 255, 255, .92));

    border: 1px solid rgba(148, 163, 184, .35);
    box-shadow:
        0 12px 28px rgba(15, 23, 42, .08),
        inset 0 1px 0 rgba(255, 255, 255, .55);

    position: relative;
    overflow: hidden;
}

/* tiny gloss line */
.kop-edge-hero-right::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(135deg, rgba(255, 255, 255, .55), transparent 55%);
    opacity: .55;
}

/* Score label + number typography */
.kop-edge-edge-label {
    font-size: .62rem;
    letter-spacing: .16em;
    text-transform: uppercase;
    font-weight: 950;
    color: rgba(100, 116, 139, .92);
}

.kop-edge-edge-val {
    margin-top: .18rem;
    font-size: 1.55rem;
    font-weight: 980;
    letter-spacing: -0.02em;
    line-height: 1;
    color: #0f172a;
}

/* Optional sublabel if you keep it later */
.kop-edge-edge-sub {
    margin-top: .22rem;
    font-size: .72rem;
    font-weight: 750;
    color: rgba(15, 23, 42, .62);
}

/* 3) Stronger band glow on the SCORE BOX (not the whole card) */
.kop-edge-card.sb-g2 .kop-edge-hero-right {
    border-color: rgba(22, 163, 74, .62);
    box-shadow: 0 16px 34px rgba(22, 163, 74, .16), 0 12px 28px rgba(15, 23, 42, .08), inset 0 1px 0 rgba(255, 255, 255, .55);
}

.kop-edge-card.sb-g1 .kop-edge-hero-right {
    border-color: rgba(34, 197, 94, .52);
    box-shadow: 0 15px 32px rgba(34, 197, 94, .14), 0 12px 28px rgba(15, 23, 42, .08), inset 0 1px 0 rgba(255, 255, 255, .55);
}

.kop-edge-card.sb-y2 .kop-edge-hero-right {
    border-color: rgba(245, 158, 11, .56);
    box-shadow: 0 15px 32px rgba(245, 158, 11, .14), 0 12px 28px rgba(15, 23, 42, .08), inset 0 1px 0 rgba(255, 255, 255, .55);
}

.kop-edge-card.sb-y1 .kop-edge-hero-right {
    border-color: rgba(234, 179, 8, .48);
    box-shadow: 0 14px 30px rgba(234, 179, 8, .12), 0 12px 28px rgba(15, 23, 42, .08), inset 0 1px 0 rgba(255, 255, 255, .55);
}

.kop-edge-card.sb-o1 .kop-edge-hero-right {
    border-color: rgba(249, 115, 22, .54);
    box-shadow: 0 15px 32px rgba(249, 115, 22, .14), 0 12px 28px rgba(15, 23, 42, .08), inset 0 1px 0 rgba(255, 255, 255, .55);
}

.kop-edge-card.sb-r1 .kop-edge-hero-right {
    border-color: rgba(239, 68, 68, .54);
    box-shadow: 0 15px 32px rgba(239, 68, 68, .14), 0 12px 28px rgba(15, 23, 42, .08), inset 0 1px 0 rgba(255, 255, 255, .55);
}

.kop-edge-card.sb-r2 .kop-edge-hero-right {
    border-color: rgba(190, 18, 60, .62);
    box-shadow: 0 16px 34px rgba(190, 18, 60, .16), 0 12px 28px rgba(15, 23, 42, .08), inset 0 1px 0 rgba(255, 255, 255, .55);
}

/* Missing score */
.kop-edge-card.sb-missing .kop-edge-hero-right {
    border-style: dashed;
    opacity: .92;
}