:root{
  --bg: #0b1020;
  --card: #111a33;
  --text: #e9eefc;
  --muted: rgba(233,238,252,.72);
  --line: rgba(233,238,252,.12);
  --accent: #6ea8fe;

  --radius: 14px;
  --pad: 14px;

  --avatar: 26px;
}

*{ box-sizing: border-box; }
html,body{ height: 100%; }
body{
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg); /* однотонный фон */
  color: var(--text);
}

a{ color: var(--accent); text-decoration: none; }
a:hover{ text-decoration: underline; }

.container{
  width: min(1180px, calc(100% - 24px));
  margin: 0 auto;
}

.site-header{
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(11,16,32,.78);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.header-inner{
  padding: 14px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-title{
  font-weight: 800;
  letter-spacing: .2px;
  font-size: 20px;
  line-height: 1.1;
}
.brand-subtitle{
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
}

.layout{
  padding: 18px 0 26px;
  display: grid;
  grid-template-columns: 1.65fr .95fr;
  gap: 16px;
  align-items: start;
}

/* разрыв между карточками, чтобы не "слипались" */
.main-col,
.side-col{
  display: grid;
  gap: 16px;
}

.card{
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.02));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.card-header{
  padding: 12px var(--pad);
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.02);
}
.card-header h2{
  margin: 0;
  font-size: 15px;
  letter-spacing: .2px;
}

.card-header-row{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-body{
  padding: var(--pad);
}

.btn{
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.03);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
}
.btn:hover{
  border-color: rgba(110,168,254,.35);
  background: rgba(110,168,254,.08);
}
.btn:active{ transform: translateY(1px); }

.summary-grid{
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.summary-item{
  background: rgba(255,255,255,.02);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  min-height: 64px;
}
.summary-label{
  font-size: 12px;
  color: var(--muted);
}
.summary-value{
  margin-top: 6px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
}
.summary-sub{
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.table-wrap{
  width: 100%;
  overflow: auto;
  border-radius: 12px;
  border: 1px solid var(--line);
}

.table{
  width: 100%;
  border-collapse: collapse;
  min-width: 640px; /* desktop/tablet допускаем, на мобилке переопределим */
  background: rgba(0,0,0,.08);
}
.table th, .table td{
  padding: 10px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  font-size: 13px;
}
.table thead th{
  position: sticky;
  top: 0;
  background: rgba(17,26,51,.92);
  backdrop-filter: blur(8px);
  z-index: 1;
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}
.table tbody tr:hover{
  background: rgba(110,168,254,.06);
}

.col-pos{ width: 44px; text-align: right; }
.col-num{ width: 64px; text-align: right; }
.col-gfga{ width: 110px; text-align: center; }
.col-team{ width: 220px; }

.t-right{ text-align: right; }
.t-center{ text-align: center; }

.team-cell{
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 200px;
}
.avatar{
  width: var(--avatar);
  height: var(--avatar);
  border-radius: 999px;
  object-fit: cover;
  border: 1px solid rgba(233,238,252,.22);
  background: rgba(255,255,255,.06);
  flex: 0 0 var(--avatar);
}

.hint{
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
}

/* матчи */
.match-list{
  display: grid;
  gap: 8px;
}
.match{
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: rgba(255,255,255,.02);
}
.match[role="button"]{
  cursor: pointer;
}
.match[role="button"]:hover{
  border-color: rgba(110,168,254,.35);
  background: rgba(110,168,254,.06);
}
.match[role="button"]:focus{
  outline: 2px solid rgba(110,168,254,.35);
  outline-offset: 2px;
}

.match-top{
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  align-items: center;
}
.match-team{
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.match-team.right{ justify-content: flex-end; }
.match-name{
  font-size: 13px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.match-score{
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  font-weight: 800;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(0,0,0,.12);
  min-width: 64px;
  text-align: center;
}
.match-meta{
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.site-footer{
  border-top: 1px solid var(--line);
  background: rgba(11,16,32,.65);
}
.footer-inner{
  padding: 14px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}
.footer-sep{ color: rgba(233,238,252,.35); }

/* ===== Модальное окно ===== */
.modal{
  display: none;
  position: fixed;
  inset: 0;
  z-index: 50;
}
.modal[aria-hidden="false"]{ display: block; }

.modal-backdrop{
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.55);
}

.modal-dialog{
  position: relative;
  width: min(760px, calc(100% - 20px));
  margin: 10vh auto;
  background: rgba(17,26,51,.98);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}

.modal-header{
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.modal-title{
  font-weight: 800;
  font-size: 14px;
}
.modal-sub{
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
}

.modal-body{
  padding: 14px;
  max-height: 60vh;
  overflow: auto;
}

/* ===== Таймлайн: секции по таймам ===== */
.timeline{
  display: grid;
  gap: 12px;
}

.timeline-section{
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255,255,255,.02);
}

.timeline-section-header{
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  background: rgba(0,0,0,.12);
}

.timeline-section-title{
  font-weight: 900;
  font-size: 13px;
}

.timeline-section-range{
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.timeline-section-body{
  padding: 10px;
  display: grid;
  gap: 10px;
}

.event{
  border: 1px solid var(--line);
  background: rgba(0,0,0,.10);
  border-radius: 12px;
  padding: 10px;
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 10px;
}

.event-minute{
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  text-align: right;
  color: var(--muted);
}

.event-title{
  display: flex;
  align-items: center;
  white-space: nowrap;        /* запрет переноса */
  gap: 8px;
  font-weight: 800;
  font-size: 13px;
  line-height: 1.2;
}

.event-icon{
  width: 22px;
  height: 22px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.03);
  flex: 0 0 22px;
}

.event-icon.goal{ border-color: rgba(61,220,151,.35); }
.event-icon.penalty{ border-color: rgba(61,220,151,.35); }
.event-icon.owngoal{ border-color: rgba(255,153,102,.40); }

.event-icon.yellow{ border-color: rgba(255,204,102,.40); }
.event-icon.red{ border-color: rgba(255,102,102,.45); }
.event-icon.sub{ border-color: rgba(110,168,254,.40); }

.event-icon svg{
  width: 14px;
  height: 14px;
  display: block;
  opacity: .95;
}

.event-sub{
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.2;
  white-space: nowrap;        /* запрет переноса */
}

/* Адаптив */
@media (max-width: 980px){
  .layout{
    grid-template-columns: 1fr;
  }
  .summary-grid{
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px){
  :root{ --avatar: 22px; }
  .summary-grid{ grid-template-columns: 1fr; }
}

/* ===== Mobile: без горизонтального скролла, сокращённые таблицы ===== */
@media (max-width: 640px){

  html, body{ overflow-x: hidden; }

  .table-wrap{ overflow: visible; }
  .table{
    min-width: 0; /* переопределяем min-width: 640px */
    width: 100%;
  }

  /* Аватары на мобилке убираем */
  .avatar{ display: none; }
  .team-cell{ gap: 0; min-width: 0; }
  .match-team{ gap: 0; }

  /* --- Турнирная таблица: Место/Команда/И/З‑П/Очки --- */
  #standingsTable th:nth-child(4),
  #standingsTable td:nth-child(4),
  #standingsTable th:nth-child(5),
  #standingsTable td:nth-child(5),
  #standingsTable th:nth-child(6),
  #standingsTable td:nth-child(6){
    display: none; /* В/Н/П */
  }

  #standingsTable th,
  #standingsTable td{
    padding: 10px 8px;
    font-size: 12.5px;
  }

  #standingsTable th:nth-child(1),
  #standingsTable td:nth-child(1),
  #standingsTable th:nth-child(3),
  #standingsTable td:nth-child(3),
  #standingsTable th:nth-child(8),
  #standingsTable td:nth-child(8){
    text-align: right;
  }

  #standingsTable th:nth-child(7),
  #standingsTable td:nth-child(7){
    text-align: center;
    white-space: nowrap;
  }

  #standingsTable td:nth-child(2){ min-width: 0; }
  #standingsTable .team-cell > span{
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
    max-width: 100%;
  }

  /* --- Бомбардиры: # / Игрок (под ним команда) / Голы --- */
  #scorersTable th:nth-child(3){ display: none; } /* заголовок "Команда" */
  #scorersTable td:nth-child(3){ display: none; } /* ячейки команды (скрыты как колонка) */

  #scorersTable th,
  #scorersTable td{
    padding: 10px 8px;
    font-size: 12.5px;
  }

  #scorersTable th:nth-child(1),
  #scorersTable td:nth-child(1),
  #scorersTable th:nth-child(4),
  #scorersTable td:nth-child(4){
    text-align: right;
  }

  #scorersTable td:nth-child(2){
    min-width: 0;
    white-space: normal;
    overflow: visible;
    line-height: 1.15;
    font-weight: 800;
  }

  /* команда под игроком (берём из data-team-fallback) */
  #scorersTable td:nth-child(2)::after{
    content: attr(data-team-fallback);
    display: block;
    margin-top: 4px;
    font-weight: 600;
    font-size: 12px;
    color: var(--muted);
    line-height: 1.1;
  }

  .modal-dialog{ margin: 8vh auto; }
  .event{ grid-template-columns: 56px 1fr; }
}
/* ===== Social buttons (round, branded) ===== */

.social-btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;

  width: 34px;
  height: 34px;

  border-radius: 999px;         /* круг */
  border: 1px solid transparent;
  color: #fff;                  /* SVG белый через currentColor */
  text-decoration: none;

  box-shadow: 0 6px 16px rgba(0,0,0,.18);
  transition: transform .12s ease, filter .12s ease, opacity .12s ease;
}

.social-btn:hover{
  text-decoration: none;
  filter: brightness(1.05);
}

.social-btn:active{
  transform: translateY(1px);
}

.social-btn:focus{
  outline: 2px solid rgba(110,168,254,.45);
  outline-offset: 2px;
}

.social-btn.vk{
  background: #0077ff;          /* VK blue */
  border-color: rgba(255,255,255,.18);
}

.social-btn.tg{
  background: #229ed9;          /* Telegram blue */
  border-color: rgba(255,255,255,.18);
}

.social-ic{
  width: 18px;
  height: 18px;
  display: block;
}
