.kg-module {
  width: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  margin-top: 16px;
  padding: 40px 0 0;
}

.kg-module__header {
  margin-bottom: 32px;
}

.kg-module.main_mod .container {
  max-width: 56rem;
  margin: 0 auto;
  padding-left: 0;
  padding-right: 0;
  text-align: center;
}

.kg-module.main_mod .title {
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  margin-bottom: 1.5rem;
  line-height: 1.15;
  font-size: clamp(1.75rem, 7vw, 4.5rem);
  white-space: nowrap;
}

.kg-module.main_mod .title-gradient {
  display: inline;
  background: linear-gradient(to right, hsl(var(--primary)), hsl(var(--secondary)), hsl(var(--accent)));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

@media (min-width: 768px) {
  .kg-module.main_mod .title {
    font-size: 3.75rem;
    line-height: 1.1;
  }
}

@media (min-width: 1024px) {
  .kg-module.main_mod .title {
    font-size: 4.5rem;
    line-height: 1.05;
  }
}

@media (max-width: 767px) {
  .kg-module.main_mod .title {
    font-size: clamp(1rem, 8vw, 1.75rem);
    white-space: nowrap;
  }
}

.kg-card {
  position: relative;
  border-radius: var(--kg-radius-2xl);
  overflow: hidden;
  border: 1px solid var(--kg-border);
  background: var(--kg-wash-2);
  transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
  cursor: pointer;
  display: block;
  text-decoration: none;
  color: inherit;
}

.kg-card:hover {
  transform: translateY(-3px);
  border-color: rgb(var(--kg-brand-cyan-rgb) / 0.3);
  box-shadow: 0 8px 40px rgb(var(--kg-brand-cyan-rgb) / 0.08), 0 2px 8px var(--kg-shadow-deep);
}

.kg-card__bg {
  position: absolute;
  inset: 0;
  background-image: var(--bg-img);
  background-size: cover;
  background-position: center;
  opacity: 0.12;
  transition: opacity 0.22s;
}

.kg-card:hover .kg-card__bg { opacity: 0.18; }

.kg-card__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, rgba(7,11,16,0.55) 0%, rgba(7,11,16,0.30) 50%, rgba(7,11,16,0.70) 100%);
}

.kg-card__inner {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.kg-featured-wrap { margin-bottom: 16px; }

.kg-card--featured { min-height: 240px; }

.kg-card--featured .kg-card__inner { padding: 28px 32px 24px; gap: 20px; }

.kg-card__top {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.kg-card__league {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  width: 100%;
}

.kg-card__flag {
  width: 20px;
  height: 15px;
  object-fit: cover;
  border-radius: 2px;
  flex-shrink: 0;
  opacity: 0.7;
}

.kg-card__league-name {
  font-size: 0.75rem;
  color: #6b7a8d;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.kg-card__match {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.kg-card__team {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.kg-card__logo-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
}

.kg-card__logo { object-fit: contain; display: block; opacity: 0.85; }

.kg-card--featured .kg-card__logo { width: 64px; height: 64px; }
.kg-card--small   .kg-card__logo  { width: 44px; height: 44px; }

.kg-card__team-name {
  font-size: 0.9375rem;
  font-weight: 700;
  color: #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
  text-align: center;
  width: 100%;
}

.kg-card--small .kg-card__team-name { font-size: 0.8125rem; max-width: none; }

.kg-card__center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.kg-card__score-row {
  display: flex;
  flex-direction: row;
  align-items: center;
}

.kg-card__score-home,
.kg-card__score-away {
  display: inline-block;
  font-size: 1.75rem;
  font-weight: 800;
  color: #f1f5f9;
  line-height: 1;
}

.kg-card__score-sep {
  display: inline-block;
  font-size: 1.75rem;
  font-weight: 800;
  color: rgba(255,255,255,0.3);
  line-height: 1;
  padding: 0 5px;
}

.kg-card--featured .kg-card__score-home,
.kg-card--featured .kg-card__score-away,
.kg-card--featured .kg-card__score-sep { font-size: 2.5rem; }

.kg-card--small .kg-card__score-home,
.kg-card--small .kg-card__score-away,
.kg-card--small .kg-card__score-sep   { font-size: 1.375rem; }

.kg-card__datetime {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.kg-card__date {
  font-size: 0.75rem;
  color: var(--kg-text-secondary);
  font-weight: 500;
  white-space: nowrap;
}

.kg-card__time {
  font-size: 1rem;
  font-weight: 600;
  color: #cbd5e1;
  white-space: nowrap;
}

.kg-card--small .kg-card__time { font-size: 0.875rem; }

.kg-card__footer {
  display: flex;
  align-items: center;
  justify-content: center;
}

.kg-card--featured .kg-card__footer { padding-top: 4px; }

.kg-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}


/* === Горизонтальная строка карточек === */
.kg-module--carousel,
.kg-carousel-fade {
  --kg-carousel-fade-left: 0px;
  --kg-carousel-fade-right: 64px;
}

.kg-module--carousel {
  margin-top: 32px;
}

.kg-module--carousel .kg-module__header {
  margin-bottom: 20px;
}

.kg-carousel {
  position: relative;
  width: 100%;
  max-width: 100%;
  margin-left: 0;
  margin-right: 0;
  overflow: visible;
}

.kg-carousel:not(.kg-carousel--has-prev),
.kg-carousel-fade:not(.kg-carousel--has-prev) {
  --kg-carousel-fade-left: 0px;
}

.kg-carousel:not(.kg-carousel--has-next),
.kg-carousel-fade:not(.kg-carousel--has-next) {
  --kg-carousel-fade-right: 0px;
}

.kg-carousel--has-prev {
  --kg-carousel-fade-left: 64px;
}

.kg-carousel--has-next {
  --kg-carousel-fade-right: 64px;
}

.kg-carousel__track {
  display: flex;
  gap: 16px;
  margin: 0;
  padding: 6px 0 8px 0;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}

/* Shared Blog carousel edge-fade contract. Layout stays consumer-owned. */
.kg-carousel__track,
.kg-carousel-fade__track {
  -webkit-mask-image: linear-gradient(
    to right,
    transparent 0,
    #000 var(--kg-carousel-fade-left),
    #000 calc(100% - var(--kg-carousel-fade-right)),
    transparent 100%
  );
  mask-image: linear-gradient(
    to right,
    transparent 0,
    #000 var(--kg-carousel-fade-left),
    #000 calc(100% - var(--kg-carousel-fade-right)),
    transparent 100%
  );
}

.kg-carousel__track::-webkit-scrollbar {
  display: none;
}

/* Небольшой хвост, чтобы последняя карточка не упиралась в fade */
.kg-carousel__track::after {
  content: '';
  flex: 0 0 64px;
}

.kg-carousel .kg-card--small {
  flex: 0 0 calc((100% - 48px) / 3.25);
  min-width: 0;
  scroll-snap-align: start;
}

.kg-carousel .kg-card--small:hover {
  transform: translateY(-2px);
  outline: 1px solid rgb(var(--kg-brand-cyan-rgb) / 0.26);
  outline-offset: -1px;
}

.kg-carousel__nav {
  display: none;
}

@media (min-width: 1024px) {
  .kg-carousel__nav {
    position: absolute;
    top: 50%;
    z-index: 10;
    width: 42px;
    height: 42px;
    border-radius: 999px;
    border: 1px solid rgb(var(--kg-brand-cyan-rgb) / 0.35);
    background: rgba(7,11,16,0.86);
    color: #e2eaf0;
    box-shadow: 0 10px 28px var(--kg-shadow-black-a0p35), 0 0 18px rgb(var(--kg-brand-cyan-rgb) / 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-50%);
    transition: opacity 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
  }

  .kg-carousel__nav span {
    display: block;
    font-size: 2rem;
    line-height: 1;
    margin-top: -2px;
  }

  .kg-carousel__nav--prev {
    left: 10px;
  }

  .kg-carousel__nav--next {
    right: 10px;
  }

  .kg-carousel:hover .kg-carousel__nav:not(:disabled) {
    opacity: 1;
    pointer-events: auto;
  }

  .kg-carousel__nav:not(:disabled):hover {
    border-color: rgb(var(--kg-brand-cyan-rgb) / 0.65);
    background: rgba(10,18,26,0.94);
    box-shadow: 0 12px 34px var(--kg-shadow-black-a0p42), 0 0 24px rgb(var(--kg-brand-cyan-rgb) / 0.2);
  }

  .kg-carousel__nav:disabled {
    opacity: 0;
    pointer-events: none;
  }
}

@media (max-width: 1023px) {
  .kg-module--carousel,
  .kg-carousel-fade {
    --kg-carousel-fade-left: 0px;
    --kg-carousel-fade-right: 54px;
  }

  .kg-carousel--has-prev {
    --kg-carousel-fade-left: 54px;
  }

  .kg-carousel--has-next {
    --kg-carousel-fade-right: 54px;
  }

  .kg-carousel .kg-card--small {
    flex-basis: calc((100% - 24px) / 2.25);
  }
}

@media (max-width: 767px) {
  .kg-module--carousel,
  .kg-carousel-fade {
    --kg-carousel-fade-left: 0px;
    --kg-carousel-fade-right: 34px;
  }

  .kg-carousel--has-prev {
    --kg-carousel-fade-left: 34px;
  }

  .kg-carousel--has-next {
    --kg-carousel-fade-right: 34px;
  }

  .kg-module--carousel .kg-module__header {
    margin-bottom: 14px;
  }

  .kg-carousel__track {
    gap: 12px;
    scroll-snap-type: x mandatory;
    padding: 6px 0 8px 0;
  }

  .kg-carousel__track::after {
    flex-basis: 34px;
  }

  .kg-carousel .kg-card--small {
    flex: 0 0 76%;
    max-width: none;
  }
}

.kg-card--small .kg-card__inner { padding: 18px 18px 16px; gap: 14px; }

.kg-card__badge {
  position: absolute;
  bottom: -19px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: var(--kg-radius-3xl);
  font-size: 0.45rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  opacity: 0.85;
}

.kg-card__badge--derby     { background: rgba(239,68,68,0.18);   border: 1px solid rgba(239,68,68,0.4);   color: #f87171; }
.kg-card__badge--final     { background: rgba(234,179,8,0.15);   border: 1px solid rgba(234,179,8,0.4);   color: #fbbf24; }
.kg-card__badge--top_match { background: rgb(var(--kg-brand-cyan-rgb) / 0.12);  border: 1px solid rgb(var(--kg-brand-cyan-rgb) / 0.35); color: var(--kg-brand-cyan); }
.kg-card__badge--world_cup { background: rgba(139,92,246,0.15);  border: 1px solid rgba(139,92,246,0.4);  color: #a78bfa; }

.kg-card--small .kg-card__badge { bottom: -20px; }

.kg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 28px;
  border-radius: 50px;
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
  cursor: pointer;
  transition: opacity 0.18s, transform 0.15s, box-shadow 0.18s;
  border: none;
  font-family: inherit;
}

.kg-btn:hover { opacity: 0.88; transform: translateY(-1px); }

.kg-btn--forecast {
  background: var(--kg-brand-cyan);
  color: var(--kg-on-accent);
  box-shadow: 0 0 16px rgb(var(--kg-brand-cyan-rgb) / 0.25);
}

.kg-btn--forecast:hover { box-shadow: 0 0 28px rgb(var(--kg-brand-cyan-rgb) / 0.42); }

.kg-btn--review {
  background: var(--kg-wash-3);
  color: #c8d4e0;
  border: 1px solid rgb(var(--kg-brand-cyan-rgb) / 0.35);
}

.kg-btn--review:hover {
  background: rgb(var(--kg-brand-cyan-rgb) / 0.08);
  border-color: rgb(var(--kg-brand-cyan-rgb) / 0.6);
  color: #e2eaf0;
}

.kg-card--small .kg-btn { padding: 7px 20px; font-size: 0.8125rem; }

.kg-card--finished { background: var(--kg-wash-1); }
.kg-card--finished .kg-card__bg { opacity: 0.07; filter: grayscale(30%); }

@media (max-width: 767px) {
  .kg-module { margin-top: 12px; }
  .kg-grid { grid-template-columns: 1fr; gap: 12px; }
  .kg-card--featured { min-height: 200px; }
  .kg-card--featured .kg-card__inner { padding: 20px 20px 18px; gap: 16px; }
  .kg-card--featured .kg-card__logo { width: 48px; height: 48px; }
  .kg-card--featured .kg-card__score-home,
  .kg-card--featured .kg-card__score-away,
  .kg-card--featured .kg-card__score-sep { font-size: 1.875rem; }
  .kg-card--featured .kg-card__team-name { font-size: 0.875rem; }
  .kg-card--small .kg-card__team-name { max-width: none; }
}


.kg-module.main_mod .title-inner {
  display: inline-flex;
  align-items: flex-end;
  gap: 0.2em;
}

.kg-module.main_mod .title-icon {
  height: 1.7em;
  width: auto;
  flex-shrink: 0;
  filter: none;
}

/*
 * Shared lower-page section rhythm. content-bottom is rendered after the
 * article/component and therefore owns both its entry gap and module-peer
 * gap, using the same adaptive scale as the calculator Tool UI.
 */
.content-bottom {
  --kg-section-stack-gap: clamp(2rem, 3vw, 3rem);
  display: grid;
  gap: var(--kg-section-stack-gap);
  margin-block-start: var(--kg-section-stack-gap);
}

.content-bottom > .tools,
.content-bottom > .kg-module,
.content-bottom > .content-bottom__module {
  min-width: 0;
}

/* Do not add instance margins to the placement-owned grid gap. */
.content-bottom > .kg-module {
  margin-block: 0;
}

/*
 * Home football hub: the module is the first block under the header, so it
 * reproduces the /football geometry (hub controls, then the section heading
 * with the same inset and divider). Scoped to this module instance only; the
 * global .title-gradient rule stays intact for other consumers.
 */
.content-bottom:has(> .kg-module--football-home) {
  margin-block-start: 0;
}

.kg-module.main_mod.kg-module--football-home {
  margin-top: 0;
  padding-top: 0;
}

.kg-module.main_mod.kg-module--football-home .kg-module__header.container {
  box-sizing: border-box;
  width: calc(100% - 32px);
  max-width: 968px;
  margin: 114px auto 24px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--kg-border);
  text-align: left;
}

.kg-module.main_mod.kg-module--football-home .title {
  margin: 0;
  color: var(--kg-brand-cyan);
  font-size: 32px;
  line-height: 1.5;
  text-shadow: 0 0 20px rgba(61, 217, 235, 0.3);
}

.kg-module.main_mod.kg-module--football-home .title-gradient {
  background: none;
  color: inherit;
  -webkit-text-fill-color: currentColor;
}

@media (max-width: 768px) {
  .kg-module.main_mod.kg-module--football-home .kg-module__header.container {
    width: 100%;
    margin-top: 56px;
    padding: 16px;
    text-align: center;
  }

  .kg-module.main_mod.kg-module--football-home .title {
    font-size: 24px;
    line-height: 1.5;
  }
}

/* === Серверная подгрузка карточек (только экземпляры с load_more) === */
.kg-load-more {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  /* Совпадает с вертикальным gap сетки .kg-grid (16px desktop / 12px mobile) */
  margin-top: 16px;
}

.kg-load-more__btn {
  appearance: none;
  width: 100%;
  min-height: 44px;
  padding: 10px 18px;
  /* Фактический фон .kg-card = rgba(255,255,255,.04) + тёмный слой .kg-card__overlay поверх; кнопка повторяет оба слоя */
  border: 1px solid var(--kg-border);
  border-radius: var(--kg-radius-xl);
  background:
    linear-gradient(160deg, rgba(7, 11, 16, 0.55) 0%, rgba(7, 11, 16, 0.30) 50%, rgba(7, 11, 16, 0.70) 100%),
    var(--kg-wash-2);
  color: #d8dee4;
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.18s, border-color 0.18s, opacity 0.18s;
}

.kg-load-more__btn:hover:not(:disabled) {
  border-color: rgb(var(--kg-brand-cyan-rgb) / 0.3);
  color: #eef2f5;
}

.kg-load-more__btn:focus-visible {
  outline: 2px solid var(--kg-brand-cyan);
  outline-offset: 3px;
}

.kg-load-more__btn:disabled {
  cursor: progress;
  opacity: 0.6;
}

.kg-load-more__btn.is-loading::after {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-left: 10px;
  vertical-align: -2px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: kg-load-more-spin 0.8s linear infinite;
}

.kg-load-more__error {
  margin: 0;
  color: #f87171;
  font-size: 0.875rem;
  text-align: center;
}

.kg-load-more__error[hidden] { display: none; }

@keyframes kg-load-more-spin { to { transform: rotate(360deg); } }

@media (max-width: 767px) {
  /* Mobile gap сетки .kg-grid = 12px (см. блок выше), кнопка держит тот же ритм */
  .kg-load-more { margin-top: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .kg-load-more__btn.is-loading::after { animation-duration: 2.4s; }
}
