/* FIFA World Cup 2026 — дизайн-система (оригинальная, вдохновлённая турнирной эстетикой) */

:root {
  /* Брендовые цвета: глубокий фиолетово-синий градиент (стиль WC2026) + акценты */
  --bg-primary: #FFFFFF;
  --bg-secondary: #F4F6FB;
  --brand: #2A0E5C;            /* глубокий фиолетовый */
  --brand-2: #4A1FB8;          /* пурпур */
  --brand-3: #0A58CA;          /* синий */
  --accent: #FF2D78;           /* розовый акцент (WC2026 vibe) */
  --accent-2: #00E0B8;         /* бирюзовый */
  --gold: #FFC93C;             /* золото трофея */
  --win: #00C853;
  --loss: #f30000;
  --text-primary: #15122B;
  --text-secondary: #6B7280;
  --border: #E8EAF2;

  --font-main: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 4px 16px rgba(42, 14, 92, 0.08);
  --shadow-lg: 0 8px 28px rgba(42, 14, 92, 0.16);
  --tabbar-h: 62px;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  font-family: var(--font-main);
  background: var(--bg-secondary);
  color: var(--text-primary);
  max-width: 600px;
  margin: 0 auto;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
  min-height: 100vh;
  overflow-x: hidden;
}

/* ═══ Хедер с футбольной символикой ═══ */
.app-header {
  position: sticky; top: 0; z-index: 30;
  overflow: hidden;
  padding-top: env(safe-area-inset-top, 0px);
}
.header-bg {
  position: absolute; inset: 0;
  background: linear-gradient(135deg, #2A0E5C 0%, #4A1FB8 55%, #0A58CA 100%);
}
.header-bg::after {
  /* декоративный «мяч»-паттерн */
  content: ''; position: absolute; right: -30px; top: -30px;
  width: 150px; height: 150px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, rgba(255,255,255,.18), transparent 60%);
}
.header-content {
  position: relative; z-index: 1;
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
}
.header-trophy {
  font-size: 30px;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.3));
  animation: trophy-bob 3s ease-in-out infinite;
}
@keyframes trophy-bob { 0%,100%{transform:translateY(0) rotate(-4deg);} 50%{transform:translateY(-3px) rotate(4deg);} }
.header-text { display: flex; flex-direction: column; }
.app-title { font-size: 18px; font-weight: 800; color: #fff; letter-spacing: .3px; }
.app-subtitle { font-size: 11px; color: rgba(255,255,255,.8); margin-top: 1px; }
.header-stripe {
  position: relative; z-index: 1; height: 4px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--gold) 50%, var(--accent-2) 100%);
}

/* ═══ Контент + свайп-анимации ═══ */
.content { padding: 12px; }
.tab-content { display: none; }
.tab-content.active { display: block; }
.tab-content.slide-left { animation: slideL .28s cubic-bezier(.22,.61,.36,1); }
.tab-content.slide-right { animation: slideR .28s cubic-bezier(.22,.61,.36,1); }
@keyframes slideL { from { opacity:.3; transform: translateX(36px); } to { opacity:1; transform:none; } }
@keyframes slideR { from { opacity:.3; transform: translateX(-36px); } to { opacity:1; transform:none; } }

/* ═══ Карусель дат ═══ */
.date-carousel {
  display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 12px;
  scrollbar-width: none;
}
.date-carousel::-webkit-scrollbar { display: none; }
.date-chip {
  flex: 0 0 auto; background: #fff; border: 1.5px solid var(--border);
  border-radius: 14px; padding: 8px 14px; text-align: center; cursor: pointer;
  transition: all .18s; min-width: 58px;
}
.date-chip.active {
  background: linear-gradient(135deg, var(--brand-2), var(--brand-3));
  color: #fff; border-color: transparent; box-shadow: var(--shadow);
}
.date-chip .dc-day { font-size: 17px; font-weight: 800; display: block; }
.date-chip .dc-month { font-size: 11px; opacity: .75; }
.date-chip .dc-count { font-size: 10px; opacity: .6; }

/* ═══ Карточки матчей ═══ */
.cards-list { display: flex; flex-direction: column; gap: 10px; }

.match-card {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px; position: relative; overflow: hidden;
}
.match-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: linear-gradient(180deg, var(--brand-2), var(--accent));
}
.mc-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.mc-stage { font-size: 11px; color: var(--brand-2); text-transform: uppercase; letter-spacing: .5px; font-weight: 700; }
.mc-time { font-size: 12px; color: var(--text-secondary); font-weight: 600; }
.mc-teams { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mc-team { flex: 1; text-align: center; font-weight: 700; font-size: 15px; }
.mc-vs { font-size: 11px; color: #fff; background: var(--brand-2); padding: 3px 8px; border-radius: 8px; font-weight: 700; }

.mc-summary {
  margin-top: 10px; font-size: 12.5px; color: var(--text-secondary);
  line-height: 1.45; background: var(--bg-secondary); padding: 8px 10px; border-radius: 8px;
}
.prob-bar { display: flex; height: 9px; border-radius: 5px; overflow: hidden; margin-top: 10px; }
.prob-bar .ph { background: var(--brand-2); }
.prob-bar .pd { background: #B9BECC; }
.prob-bar .pa { background: var(--accent); }
.prob-legend { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-secondary); margin-top: 4px; }
.mc-prediction { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 14px; }
.pred-tag { background: linear-gradient(135deg,var(--brand-2),var(--accent)); color: #fff; font-weight: 800; padding: 4px 11px; border-radius: 8px; font-size: 13px; }
.pred-score { color: var(--text-secondary); font-size: 13px; }
.conf { margin-left: auto; font-size: 12px; color: var(--text-secondary); }
.conf b { color: var(--accent); }

/* ═══ Группы ═══ */
.qz-legend { display: flex; flex-wrap: wrap; gap: 10px 16px; font-size: 11.5px; color: var(--text-secondary); margin-bottom: 12px; padding: 0 4px; }
.qz-legend span { display: flex; align-items: center; gap: 5px; }
.qz-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.qz-dot.direct { background: var(--win); }
.qz-dot.playoff { background: var(--gold); }

.groups-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 480px) { .groups-grid { grid-template-columns: 1fr 1fr; } }

.group-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.group-head {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff;
}
.group-badge {
  width: 26px; height: 26px; border-radius: 8px; background: rgba(255,255,255,.2);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px;
}
.group-title { font-weight: 700; font-size: 14px; }

.group-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.group-table th {
  font-size: 10px; color: var(--text-secondary); font-weight: 600; text-transform: uppercase;
  padding: 7px 4px; text-align: center; border-bottom: 1px solid var(--border);
}
.group-table th.gt-team-h { text-align: left; padding-left: 10px; }
.group-table td { padding: 8px 4px; text-align: center; border-bottom: 1px solid #F2F3F8; }
.group-table tr:last-child td { border-bottom: none; }
.gt-pos { font-weight: 700; color: var(--text-secondary); width: 22px; }
.gt-team { text-align: left !important; padding-left: 10px !important; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 130px; }
.gt-flag { margin-right: 6px; }
.gt-pts { font-weight: 800; color: var(--brand-2); }
.gt-gd { color: var(--text-secondary); }
/* зоны выхода — цветная полоска слева */
.group-table tr.qz-direct td.gt-pos { box-shadow: inset 3px 0 0 var(--win); }
.group-table tr.qz-playoff td.gt-pos { box-shadow: inset 3px 0 0 var(--gold); }
@media (max-width: 380px) { .gt-hide { display: none; } }

/* ═══ Плей-офф сетка ═══ */
.playoff-hint { font-size: 11.5px; color: var(--text-secondary); text-align: center; margin-bottom: 10px; }
.bracket-scroll {
  display: flex; gap: 14px; overflow-x: auto; padding: 4px 4px 14px;
  scrollbar-width: thin; -webkit-overflow-scrolling: touch;
}
.bracket-scroll::-webkit-scrollbar { height: 5px; }
.bracket-scroll::-webkit-scrollbar-thumb { background: var(--brand-2); border-radius: 3px; }
.bracket-col { flex: 0 0 auto; display: flex; flex-direction: column; justify-content: space-around; gap: 10px; min-width: 168px; }
.bracket-round-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase; color: #fff;
  background: linear-gradient(135deg,var(--brand),var(--brand-2));
  padding: 6px 10px; border-radius: 8px; text-align: center; letter-spacing: .4px;
}
.bracket-match {
  background: #fff; border-radius: var(--radius-sm); box-shadow: var(--shadow);
  overflow: hidden; border: 1px solid var(--border);
}
.bracket-match.tbd { opacity: .7; }
.bm-date { font-size: 9.5px; color: var(--text-secondary); text-align: center; padding: 3px 4px 0; }
.bm-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px; font-size: 13px; font-weight: 600;
}
.bm-row:first-child { border-bottom: 1px solid #F2F3F8; }
.bm-row.bm-win { background: rgba(0,200,83,.08); }
.bm-row.bm-win .bm-team { color: var(--win); font-weight: 800; }
.bm-team { display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bm-team.bm-src { font-size: 11px; font-weight: 500; color: var(--text-secondary); font-style: italic; }
.bm-flag { font-size: 14px; }
.bm-score { font-weight: 800; color: var(--brand-2); min-width: 16px; text-align: right; }

.final-block { display: flex; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
.final-card { flex: 1; min-width: 150px; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-lg); overflow: hidden; }
.final-card.final { border: 2px solid var(--gold); }
.final-title {
  text-align: center; font-weight: 800; font-size: 13px; padding: 10px;
  background: linear-gradient(135deg, var(--gold), #ffd86b); color: #5a3a00;
}
.final-card.third .final-title { background: linear-gradient(135deg,#cd7f32,#e0a060); color: #fff; }

/* ═══ Завершённые ═══ */
.history-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; text-align: center; }
.hc-score { font-size: 22px; font-weight: 800; margin: 6px 0; }
.hc-score .ht { font-size: 14px; font-weight: 700; }
.hc-forecast { font-size: 13px; color: var(--text-secondary); margin-top: 6px; }
.badge { display: inline-block; margin-top: 10px; padding: 5px 14px; border-radius: 20px; font-size: 13px; font-weight: 800; color: #fff; }
.badge.win { background: var(--win); }
.badge.loss { background: var(--loss); }
.badge.pending { background: var(--brand-2); }
.badge.none { background: #B9BECC; }

/* ═══ Статистика ═══ */
.stat-block { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 12px; }
.stat-block h3 { font-size: 14px; margin-bottom: 12px; }
.donut-wrap { display: flex; align-items: center; gap: 16px; }
.donut-legend { font-size: 13px; }
.donut-legend div { margin: 4px 0; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }
.big-number { font-size: 32px; font-weight: 800; color: var(--brand-2); }
.market-bar-wrap { margin: 8px 0; }
.market-bar-label { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }
.market-bar { height: 8px; background: var(--bg-secondary); border-radius: 4px; overflow: hidden; }
.market-bar-fill { height: 100%; background: linear-gradient(90deg,var(--brand-2),var(--accent)); }
.team-stat { display: flex; justify-content: space-between; font-size: 13px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.team-wr { font-weight: 700; }
.team-wr.high { color: var(--win); }
.team-wr.low { color: var(--loss); }

/* ═══ Навигация ═══ */
.tab-bar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 600px; height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: #fff; border-top: 1px solid var(--border); display: flex; z-index: 40;
  box-shadow: 0 -2px 12px rgba(42,14,92,.06);
}
.tab {
  flex: 1; background: none; border: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; color: var(--text-secondary); transition: color .15s; position: relative;
}
.tab.active { color: var(--brand-2); }
.tab.active::before {
  content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 26px; height: 3px; border-radius: 0 0 3px 3px;
  background: linear-gradient(90deg,var(--brand-2),var(--accent));
}
.tab-icon { font-size: 19px; }
.tab-label { font-size: 10px; font-weight: 600; }

/* ═══ Утилиты ═══ */
.hidden { display: none !important; }
.load-more { width: 100%; margin-top: 12px; padding: 12px; background: linear-gradient(135deg,var(--brand-2),var(--brand-3)); color: #fff; border: none; border-radius: var(--radius); font-size: 14px; font-weight: 700; cursor: pointer; }
.empty, .loading { text-align: center; color: var(--text-secondary); padding: 40px 20px; font-size: 14px; }
.skeleton { background: linear-gradient(90deg,#eee 25%,#f5f5f5 50%,#eee 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: var(--radius); height: 110px; margin-bottom: 10px; }
@keyframes shimmer { 0%{background-position:200% 0;} 100%{background-position:-200% 0;} }
