.kg-popup-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(3, 8, 18, .82);
}

.kg-popup-dialog {
    position: relative;
    width: min(1080px, 100%);
    height: calc(100dvh - 40px);
    max-height: calc(100dvh - 40px);
    overflow: hidden;
    border: 1px solid rgb(var(--kg-brand-cyan-rgb) / .25);
    border-radius: var(--kg-radius-2xl);
    background: #0c1422;
    box-shadow: 0 24px 80px var(--kg-shadow-black-a0p5);
}

.kg-popup-scroll { height: 100%; max-height: calc(100dvh - 40px); overflow-y: auto; overflow-x: clip; overscroll-behavior: contain; }
.kg-popup-body { min-height: 100%; }
.kg-popup-body > .kg-seo-page { box-sizing: border-box; width: 100%; max-width: 100%; min-height: 100%; margin: 0; }

.kg-popup-close {
    position: absolute;
    z-index: 3;
    top: 10px;
    right: 12px;
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 50%;
    color: var(--kg-text);
    background: rgba(0, 0, 0, .65);
    font: 32px/1 sans-serif;
    cursor: pointer;
}

.kg-popup-close:focus-visible, .kg-popup-retry:focus-visible { outline: 2px solid var(--kg-brand-cyan); outline-offset: 2px; }
.kg-popup-content { gap: 0; }
.kg-popup-content > .ai-accordion {
    margin: 0;
    border-radius: var(--kg-radius-2xl);
}
.kg-popup-content > [data-kg-render-block] { min-width: 0; max-width: 100%; }
.kg-popup-section-loading {
    opacity: 1;
    pointer-events: auto;
}
.kg-popup-section-loading:hover { border-color: rgb(var(--kg-brand-cyan-rgb) / .15); }
.kg-popup-section-loading > .ai-accordion-header {
    position: relative;
    overflow: hidden;
    cursor: not-allowed;
    background: transparent;
    animation: none;
}
.kg-popup-section-loading > .ai-accordion-header:hover { background: transparent; }
.kg-popup-section-loading > .ai-accordion-header .ai-accordion-title { color: rgba(255, 255, 255, .62); }
.kg-popup-section-loading > .ai-accordion-header::after {
    position: absolute;
    inset: 0;
    content: '';
    background: linear-gradient(105deg, transparent 25%, rgb(var(--kg-brand-cyan-rgb) / .13) 46%, var(--kg-wash-a0p12) 50%, rgb(var(--kg-brand-cyan-rgb) / .13) 54%, transparent 75%);
    transform: translateX(-100%);
    animation: kg-popup-shimmer 1.3s infinite linear;
    pointer-events: none;
}
.kg-popup-section-loading > .ai-accordion-content { max-height: 0; overflow: hidden; }
.kg-popup-section-loading--structured.ai-accordion-open > .ai-accordion-content { max-height: none; overflow: visible; }
.kg-popup-skeleton { box-sizing: border-box; min-width: 0; margin: 0 16px 16px; padding: 14px; border: 1px solid rgb(var(--kg-brand-cyan-rgb) / .1); border-radius: var(--kg-radius-card); background: var(--kg-scrim-0a0f19-a0p4); }
.kg-popup-skeleton--h2h { display: grid; gap: 10px; margin: 0; }
.kg-popup-skeleton--calendar { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px; }
.kg-popup-skeleton__team { display: grid; gap: 8px; min-width: 0; }
.kg-popup-skeleton__heading { display: block; width: 116px; height: 11px; }
.kg-popup-skeleton__team-heading { display: grid; grid-template-columns: 42px minmax(64px,120px); align-items: center; gap: 8px; }
.kg-popup-skeleton__team-heading i { height: 16px; }
.kg-popup-skeleton__team-heading b { height: 11px; }
.kg-popup-skeleton__matches { display: grid; gap: 7px; }
.kg-popup-skeleton__match { box-sizing: border-box; display: grid; grid-template-columns: 46px minmax(0,1fr) 28px; align-items: center; gap: 8px; min-width: 0; min-height: 38px; padding: 6px 7px; border: 1px solid rgb(var(--kg-brand-cyan-rgb) / .07); border-radius: var(--kg-radius-card); background: var(--kg-scrim-0a0f19-a0p34); }
.kg-popup-skeleton__match > i { height: 9px; }
.kg-popup-skeleton__match > b { display: grid; gap: 5px; min-width: 0; }
.kg-popup-skeleton__match em { height: 7px; }
.kg-popup-skeleton__match em:last-child { width: 76%; }
.kg-popup-skeleton__match strong { height: 16px; }
.kg-popup-skeleton__heading, .kg-popup-skeleton__team-heading i, .kg-popup-skeleton__team-heading b,
.kg-popup-skeleton__match > i, .kg-popup-skeleton__match em, .kg-popup-skeleton__match strong {
    border-radius: 999px; background: linear-gradient(90deg, var(--kg-wash-a0p06) 25%, rgb(var(--kg-brand-cyan-rgb) / .14) 50%, var(--kg-wash-a0p06) 75%);
    background-size: 200% 100%; animation: kg-popup-pulse 1.3s infinite linear;
}
.kg-popup-section-error > .ai-accordion-header { cursor: default; }
.kg-popup-section-error-label { color: rgba(255, 255, 255, .62); font-size: 12px; }
.kg-popup-section-error-body, .kg-popup-contributor-error { display: flex; align-items: center; justify-content: center; gap: 9px; margin: 8px 12px 12px; padding: 10px 12px; border: 1px solid rgba(248,113,113,.16); border-radius: var(--kg-radius-card); color: rgba(254,202,202,.78); background: rgba(127,29,29,.08); font-size: 12px; line-height: 1.35; text-align: center; }
.kg-comparison-tab-placeholder {
    box-sizing: border-box;
    display: inline-flex;
    min-width: 76px;
    height: 36px;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    border: 1px solid rgb(var(--kg-brand-cyan-rgb) / .08);
    border-radius: var(--kg-radius-card);
    color: rgba(255,255,255,.42);
    background: var(--kg-wash-1);
    cursor: not-allowed;
}
.ai-mode-switcher--icons-only .kg-comparison-tab-placeholder .ai-mode-label { display: inline; }
.kg-comparison-tab-terminal { display: none; }
.kg-comparison-tab-error { border-color: rgba(248,113,113,.35); color: rgba(254,202,202,.9); cursor: pointer; }
.kg-popup-content-loading { display: grid; gap: 12px; width: 100%; }
.kg-popup-loading-card, .kg-popup-loading-row {
    border: 1px solid rgb(var(--kg-brand-cyan-rgb) / .12);
    border-radius: var(--kg-radius-card);
    background: rgba(30, 41, 59, .32);
}
.kg-popup-loading-card { display: grid; gap: 18px; min-height: 168px; padding: 18px 20px; }
.kg-popup-loading-card > div { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.kg-popup-loading-title, .kg-popup-loading-card i, .kg-popup-loading-row::before, .kg-popup-block-progress span:first-child {
    display: block;
    border-radius: 10px;
    background: linear-gradient(90deg, #172337 25%, #24344d 50%, #172337 75%);
    background-size: 200% 100%;
    animation: kg-popup-pulse 1.3s infinite linear;
}
.kg-popup-loading-title { width: 32%; height: 16px; }
.kg-popup-loading-card i { height: 92px; }
.kg-popup-loading-row { height: 54px; padding: 19px 20px; }
.kg-popup-loading-row::before { content: ''; width: 38%; height: 14px; }
.kg-popup-loading-row--short::before { width: 26%; }
.kg-popup-block-progress { order: 99; height: 38px; padding: 14px 18px; opacity: .72; }
.kg-popup-block-progress span:first-child { width: 28%; height: 10px; }
.kg-popup-error { display: grid; place-items: center; align-content: center; min-height: 360px; padding: 32px; color: var(--kg-text); text-align: center; }
.kg-popup-retry { padding: 11px 22px; border: 0; border-radius: var(--kg-radius-button); color: var(--kg-on-accent); background: var(--kg-brand-cyan); font-weight: 700; cursor: pointer; }
.kg-popup-retry--compact { flex: 0 0 auto; padding: 6px 10px; font-size: 11px; line-height: 1.2; }
.kg-prediction-action__body { box-sizing: border-box; display: grid; min-height: 108px; align-content: center; justify-items: center; gap: 7px; margin: 10px 14px 12px; padding: 13px 16px; border: 1px solid rgb(var(--kg-brand-cyan-rgb) / .1); border-radius: var(--kg-radius-card); background: rgba(7,13,23,.48); }
.kg-prediction-action__button { width: min(100%, 360px); min-height: 44px; padding: 11px 20px; border: 1px solid rgb(var(--kg-brand-cyan-rgb) / .58); border-radius: var(--kg-radius-button); color: var(--kg-brand-cyan); background: linear-gradient(180deg, rgba(18,29,44,.96), rgba(10,18,30,.96)); box-shadow: inset 0 1px 0 var(--kg-wash-2); font: inherit; font-weight: 650; cursor: pointer; transition: border-color .16s ease, background .16s ease, color .16s ease; }
.kg-prediction-action__button:hover { border-color: rgb(var(--kg-brand-cyan-rgb) / .82); color: #a0f2f8; background: linear-gradient(180deg, rgba(23,38,55,.98), rgba(12,22,35,.98)); }
.kg-prediction-action__button:disabled { cursor: wait; opacity: .68; }
.kg-prediction-action__button:focus-visible { outline: 2px solid rgb(var(--kg-brand-cyan-rgb) / .72); outline-offset: 3px; }
.kg-prediction-action__disclaimer { margin: 0; color: rgba(203,213,225,.48); font-size: 11px; line-height: 1.3; text-align: center; }
.kg-prediction-action__status { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 7px; min-height: 18px; color: rgba(255,255,255,.68); font-size: 12px; text-align: center; }
[data-kgprediction-action-state="idle"] .kg-prediction-action__status { display: none; }
.kg-prediction-action__elapsed { color: var(--kg-brand-cyan); font-variant-numeric: tabular-nums; font-weight: 700; letter-spacing: .04em; }
.kg-prediction-action__elapsed:not([hidden]) + [data-kgprediction-message]:not(:empty)::before { content: '·'; margin-right: 7px; color: rgba(255,255,255,.32); }
[data-kgprediction-action-state="error"] .kg-prediction-action__status { color: #ffb4b4; }

@keyframes kg-popup-pulse { to { background-position: -200% 0; } }
@keyframes kg-popup-shimmer { to { transform: translateX(100%); } }

@media (max-width: 1024px) {
    .kg-popup-skeleton--calendar { grid-template-columns: 1fr; gap: 16px; }
}
@media (max-width: 480px) {
    .kg-prediction-action__body { margin: 6px 10px 14px; padding: 14px 12px; }
    .kg-prediction-action__button { width: 100%; }
    .kg-prediction-action__status { align-items: baseline; }
}

@media (max-width: 600px) {
    .kg-popup-overlay { padding: 0; place-items: stretch; }
    .kg-popup-dialog, .kg-popup-scroll { width: 100%; height: 100dvh; max-height: 100dvh; border: 0; border-radius: 0; }
    .kg-popup-body { min-height: 100dvh; }
    .kg-popup-loading-card { min-height: 150px; padding: 16px; }
    .kg-popup-loading-card > div { gap: 10px; }
    .kg-popup-loading-card i { height: 76px; }
    .kg-popup-section-error-label { display: none; }
    .kg-popup-skeleton { margin: 0 12px 12px; padding: 11px; }
    .kg-popup-scroll { scrollbar-width: none; -ms-overflow-style: none; }
    .kg-popup-scroll::-webkit-scrollbar { display: none; width: 0; height: 0; }
}

@media (min-width: 601px) {
    .kg-popup-scroll { scrollbar-gutter: stable; }
}

@media (prefers-reduced-motion: reduce) {
    .kg-popup-loading-title, .kg-popup-loading-card i, .kg-popup-loading-row::before, .kg-popup-block-progress span:first-child, .kg-popup-section-loading > .ai-accordion-header::after,
    .kg-popup-skeleton__heading, .kg-popup-skeleton__team-heading i, .kg-popup-skeleton__team-heading b,
    .kg-popup-skeleton__match > i, .kg-popup-skeleton__match em, .kg-popup-skeleton__match strong,
    .ai-show-more-container.is-loading::after { animation: none; }
}
