/* BFF public site - variant C design system */
:root {
  --bg: #f5f7fb;
  --surface: #fcfdff;
  --ink: #131b34;
  --ink-2: #4e5566;
  --line: #dadee6;
  --line-2: #ccd1db;
  --navy: #142152;
  --on-navy: #f8fafe;
  --on-navy-2: #bfcae6;
  --navy-line: #37466e;
  --red: #c51e21;
  --gold: #ebc166;
  --chip: #dbe5f9;
  --quiet: #e3e8f2;
  --card-yellow: #edc23e;
  --font: 'Golos Text', system-ui, sans-serif;
  --font-display: 'Unbounded', 'Golos Text', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }

body {
  margin: 0;
  padding-top: 60px;
  padding-bottom: 76px;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: var(--navy); }
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
ul, ol { list-style: none; margin: 0; padding: 0; }
h1, h2, h3, p { margin: 0; }

:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; margin: 0; padding: 0; border: 0;
}

/* ---------- header ---------- */
.site-header {
  position: fixed; top: 0; left: 0; right: 0; height: 60px; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 8px 0 16px;
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.brand {
  display: flex; align-items: center; gap: 10px; min-height: 44px;
  text-decoration: none; color: var(--ink); min-width: 0;
}
.brand img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-name { font-family: var(--font-display); font-size: 16px; font-weight: 700; letter-spacing: 0.01em; }
.brand-sub { font-size: 12px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.header-nav { display: none; }

.lang { display: flex; align-items: center; flex: none; }
.lang-btn {
  min-width: 44px; height: 44px; border: 0; background: transparent;
  padding: 0 2px; cursor: pointer;
}
.lang-btn span {
  display: block; padding: 6px 8px; border-radius: 8px;
  color: var(--ink-2); font-size: 13px; font-weight: 600;
}
.lang-btn[aria-pressed="true"] span { background: var(--navy); color: var(--on-navy); font-weight: 700; }

/* ---------- nav links (shared by tab bar and header) ---------- */
.nav-link { text-decoration: none; position: relative; color: var(--ink-2); }
.nav-ico { position: relative; display: flex; align-items: center; justify-content: center; }
.live-dot {
  position: absolute; top: 2px; right: 12px; width: 9px; height: 9px;
  border-radius: 50%; background: var(--red); border: 2px solid var(--surface);
}

/* ---------- tab bar (phone) ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  height: 76px;
  height: calc(76px + env(safe-area-inset-bottom));
  display: flex; padding: 6px 4px 14px;
  padding: 6px 4px calc(14px + env(safe-area-inset-bottom));
  background: var(--surface); border-top: 1px solid var(--line);
}
.nav-tabbar {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; min-height: 44px; font-size: 12px; font-weight: 500;
}
.nav-tabbar .nav-ico { width: 56px; height: 30px; border-radius: 15px; }
.nav-tabbar[aria-current="page"] { color: var(--ink); font-weight: 700; }
.nav-tabbar[aria-current="page"] .nav-ico { background: var(--chip); }
.nav-tabbar[aria-current="page"] svg { stroke-width: 2; }

/* ---------- page ---------- */
.page { padding: 16px 16px 32px; }
.page-title { font-family: var(--font-display); font-size: 24px; font-weight: 700; line-height: 1.2; letter-spacing: -0.01em; }
.page-sub { margin-top: 4px; font-size: 14px; color: var(--ink-2); }
.section { margin-top: 32px; }
.section-head { display: flex; align-items: center; justify-content: space-between; }
.section-head h2 { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.more-link {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 4px;
  font-size: 14px; font-weight: 600; text-decoration: none; color: var(--navy);
}
.more-link:hover { text-decoration: underline; }
.group-label { margin: 8px 0 2px; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.group-label.is-live { color: var(--red); display: flex; align-items: center; gap: 6px; font-weight: 700; }
.group-label.is-live::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--red); }

.list { list-style: none; margin: 0; padding: 0; }

/* ---------- crest ---------- */
.crest { flex: none; display: block; object-fit: contain; border-radius: 4px; }
img.crest { border-radius: 50%; }

/* ---------- match row ---------- */
.match-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--line);
  color: var(--ink); text-decoration: none; list-style: none;
}
.match-row.is-live { grid-template-columns: minmax(0, 1fr) auto auto; min-height: 44px; }
.team {
  grid-column: 1; grid-row: 1; display: flex; align-items: center; gap: 10px; height: 28px; min-width: 0;
  font-size: 16px; font-weight: 400; color: var(--ink-2);
}
.team-away { grid-row: 2; flex-direction: row-reverse; justify-content: flex-end; }
.team-name { flex: 0 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.2; }
.team.is-win, .team.is-draw { font-weight: 600; color: var(--ink); }
.team.is-loss { font-weight: 400; color: var(--ink-2); }
.match-mid {
  grid-column: 2; grid-row: 1 / span 2; display: flex; align-items: center; justify-content: flex-end; gap: 8px;
}
.score, .score-col {
  font-family: var(--font-display); font-size: 16px; font-weight: 700; white-space: nowrap;
}
.score-col { display: flex; flex-direction: column; align-items: flex-end; min-width: 20px; }
.score-col .score { height: 28px; line-height: 28px; }
.score-col .score.is-loss { font-weight: 600; color: var(--ink-2); }
.match-row.is-scheduled .match-mid { display: none; }
.match-time { grid-column: 2; grid-row: 1 / span 2; font-size: 16px; font-weight: 600; justify-self: end; }
.live-min { color: var(--red); font-size: 13px; font-weight: 700; }
.chev { grid-column: 3; grid-row: 1 / span 2; color: var(--ink-2); }

/* ---------- controls ---------- */
.segmented {
  display: flex; gap: 2px; padding: 3px; margin-top: 12px;
  background: var(--quiet); border-radius: 12px;
}
.segmented button {
  flex: 1; height: 44px; border: 0; border-radius: 9px; background: transparent;
  font-size: 14px; font-weight: 500; color: var(--ink-2); cursor: pointer; padding: 0 6px;
}
.segmented button[aria-pressed="true"] {
  background: var(--surface); color: var(--ink); font-weight: 700;
  box-shadow: 0 1px 2px rgba(20, 33, 82, 0.12);
}
.select {
  width: 100%; height: 44px; margin-top: 12px; padding: 0 12px;
  border: 0; border-radius: 12px; background: var(--quiet); color: var(--ink);
  font: inherit; font-size: 14px; font-weight: 600;
}

/* ---------- live panel ---------- */
.live-panel {
  display: block; background: var(--navy); color: var(--on-navy);
  border-radius: 16px; padding: 16px 16px 2px; text-decoration: none;
}
a.live-panel:hover { color: var(--on-navy); }
.live-panel .live-head { display: flex; align-items: center; gap: 10px; min-height: 24px; }
.live-panel .live-sub { font-size: 13px; color: var(--on-navy-2); }
.live-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 8px;
  border-radius: 6px; background: var(--red); color: #fff;
  font-size: 13px; font-weight: 700;
}
.live-chip::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: #fff; }
.live-panel .live-team {
  display: flex; align-items: center; gap: 10px; min-height: 38px;
  font-size: 18px; font-weight: 600; color: var(--on-navy);
}
.live-panel .live-team .name { flex: 1; min-width: 0; }
.live-panel .live-team .pts {
  font-family: var(--font-display); font-size: 30px; font-weight: 700; line-height: 1; color: var(--on-navy);
}
.live-panel .live-team.is-trailing, .live-panel .live-team.is-trailing .pts { color: var(--on-navy-2); }
.live-panel .live-foot {
  margin-top: 10px; border-top: 1px solid var(--navy-line); min-height: 48px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  font-size: 14px; color: var(--on-navy-2);
}
.live-panel .live-foot strong { color: var(--on-navy); font-weight: 600; }
.live-panel .live-foot .go { flex: none; display: flex; align-items: center; gap: 2px; font-weight: 600; color: var(--on-navy); white-space: nowrap; }
.live-panel .live-foot .go svg { flex: none; max-width: none; }

/* full live screen */
.live-hero { text-align: center; }
.live-hero .teams-row { margin-top: 16px; display: flex; align-items: flex-start; }
.live-hero .side { flex: 1; display: flex; flex-direction: column; align-items: center; min-width: 0; }
.live-hero .side .name { margin-top: 8px; font-size: 16px; font-weight: 600; line-height: 20px; }
.live-hero .big-score {
  flex: none; height: 52px; display: flex; align-items: center; gap: 10px;
  font-family: var(--font-display); font-size: 44px; font-weight: 700; line-height: 1;
}
.live-hero .big-score .sep { font-size: 30px; color: var(--on-navy-2); }
.live-hero .scorers { margin: 12px 0 18px; display: flex; gap: 24px; font-size: 13px; line-height: 18px; color: var(--on-navy-2); }
.live-hero .scorers > div { flex: 1; }

/* ---------- timeline ---------- */
.timeline { list-style: none; margin: 14px 0 0; padding: 0; }
.tl-item { position: relative; display: flex; align-items: flex-start; gap: 12px; padding-bottom: 18px; }
.tl-item::before {
  content: ''; position: absolute; left: 67px; top: 36px; bottom: 2px; width: 1px; background: var(--line-2);
}
.tl-item:last-child::before { display: none; }
.tl-min { width: 40px; flex: none; text-align: right; padding-top: 7px; font-size: 15px; font-weight: 700; }
.tl-node {
  width: 32px; height: 32px; flex: none; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--quiet); color: var(--ink);
}
.tl-node.is-goal { background: var(--navy); color: #fff; }
.tl-body { flex: 1; min-width: 0; padding-top: 5px; }
.tl-title { display: flex; flex-wrap: wrap; align-items: center; gap: 0 6px; font-size: 16px; font-weight: 600; line-height: 22px; }
.tl-title .tl-what { white-space: nowrap; }
.tl-title .tl-team { display: flex; align-items: center; gap: 6px; min-width: 0; max-width: 100%; font-weight: 500; }
.tl-title .tl-team .crest { max-width: none; }
.tl-title .tl-team-name { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-detail { display: block; margin-top: 2px; font-size: 14px; line-height: 20px; color: var(--ink-2); }
.tl-score { flex: none; padding-top: 6px; font-family: var(--font-display); font-size: 15px; font-weight: 700; }

/* ---------- standings table ---------- */
.std-table { width: 100%; border-collapse: collapse; table-layout: fixed; margin-top: 12px; }
.std-table th {
  height: 36px; border-bottom: 1px solid var(--line-2);
  font-size: 12px; font-weight: 600; color: var(--ink-2); text-align: right;
}
.std-table th:nth-child(2), .std-table td:nth-child(2) { text-align: left; }
.std-table th:first-child, .std-table td:first-child { width: 38px; text-align: center; }
.std-table th:nth-child(3), .std-table td:nth-child(3) { width: 34px; }
.std-table th:nth-child(4), .std-table td:nth-child(4) { width: 46px; }
.std-table th:nth-child(5), .std-table td:nth-child(5) { width: 40px; }
.std-table td { padding: 8px 0; border-bottom: 1px solid var(--line); text-align: right; font-size: 15px; vertical-align: middle; }
.std-table td:nth-child(5) { font-weight: 700; }
.std-table tr.podium-end td { border-bottom-color: var(--line-2); }
.std-table .team-cell { display: flex; align-items: center; gap: 8px; min-width: 0; padding-left: 4px; }
.std-table td:nth-child(2) { overflow: hidden; position: relative; }
/* the whole team cell (row height >= 44px) is the tap target */
.std-table .team-cell a::after { content: ''; position: absolute; inset: 0; }
.std-table .team-cell > .team-text { min-width: 0; flex: 1; }
.std-table .team-cell a { display: block; color: var(--ink); text-decoration: none; font-weight: 500; min-width: 0; line-height: 24px; padding-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.std-table .team-detail { display: block; font-size: 13px; font-weight: 400; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pos {
  width: 26px; height: 26px; border-radius: 50%; margin: 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: var(--ink-2);
}
.pos.is-podium { background: var(--gold); color: var(--navy); }
.std-table abbr { text-decoration: none; }
.podium-note { margin-top: 12px; font-size: 13px; color: var(--ink-2); display: flex; align-items: center; gap: 8px; }
.podium-note::before { content: ''; flex: none; width: 12px; height: 12px; border-radius: 50%; background: var(--gold); }
.podium-note + .legend { margin-top: 4px; }
.legend { margin-top: 12px; font-size: 13px; color: var(--ink-2); }

/* ---------- teams / players ---------- */
.team-row, .player-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 0;
  border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none;
}
.team-row { min-height: 64px; }
.team-row .info { flex: 1; min-width: 0; }
.team-row .name { font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
.team-row .chev { flex: none; color: var(--ink-2); }
.team-row .meta { font-size: 13px; color: var(--ink-2); overflow-wrap: anywhere; }
.player-row { min-height: 56px; }
.player-row .num { width: 32px; font-size: 14px; font-weight: 600; text-align: center; flex: none; }
.player-row .photo { width: 40px; height: 40px; max-width: none; border-radius: 50%; object-fit: cover; background: var(--quiet); flex: none; }
.player-row .name { flex: 1; min-width: 0; font-size: 16px; overflow-wrap: anywhere; }
.player-row .photo.ph { display: flex; align-items: center; justify-content: center; color: var(--ink-2); }
.player-row .stat { white-space: nowrap; font-size: 13px; color: var(--ink-2); }

/* ---------- empty / skeleton ---------- */
.empty { padding: 32px 0; text-align: center; color: var(--ink-2); font-size: 14px; }
.skeleton-row {
  display: block; height: 48px; margin: 10px 0; border-radius: 8px; background: var(--quiet); list-style: none;
}

/* ---------- footer ---------- */
.site-footer {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px;
  padding: 16px; margin-top: 8px; font-size: 12px; color: var(--ink-2);
}
.site-footer a { color: var(--ink-2); display: inline-flex; align-items: center; min-height: 44px; }

/* ---------- desktop ---------- */
@media (min-width: 900px) {
  body { padding-bottom: 0; }
  .tabbar { display: none; }
  .site-header { padding: 0 16px; gap: 16px; }
  .header-nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
  .nav-header {
    display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px;
    border-radius: 8px; font-size: 14px; font-weight: 500;
  }
  .nav-header .nav-ico { position: static; }
  .nav-header .nav-ico svg { display: none; }
  .nav-header .live-dot { position: static; margin-left: 6px; }
  .nav-header[aria-current="page"] { background: var(--chip); color: var(--ink); font-weight: 700; }
  .page { max-width: 720px; margin: 0 auto; }
  .site-footer { max-width: 720px; margin: 8px auto 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ---------- home: top of table ---------- */
.top-row { display: flex; align-items: center; gap: 10px; height: 48px; border-bottom: 1px solid var(--line); }
.top-row .top-name { flex: 1; min-width: 0; font-size: 16px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-row .top-pts { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.top-row .top-word { width: 40px; font-size: 13px; color: var(--ink-2); }
.top-row .pos { margin: 0; flex: none; }
.live-panel .live-teams { margin-top: 14px; }
#live-slot:empty + .section { margin-top: 8px; }
.live-panel .last-goal { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- live page extras ---------- */
.live-hero .live-head { justify-content: center; flex-wrap: wrap; }
.live-hero .scorers > div { text-align: center; min-width: 0; overflow-wrap: anywhere; }
.live-sub-ink { font-size: 13px; color: var(--ink-2); }
.empty-state .live-back { display: inline-flex; align-items: center; min-height: 44px; }
.tl-item.empty { display: block; padding: 32px 0; }

/* ---------- team page ---------- */
.team-head { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.team-head > div { min-width: 0; }
.team-head .crest { max-width: none; }
.team-head .page-title, .team-head .page-sub { overflow-wrap: anywhere; }
#teams-wrap { margin-top: 8px; }
.live-hero .live-tour { font-size: 13px; line-height: 18px; color: var(--on-navy-2); margin-bottom: 10px; overflow-wrap: anywhere; }
.live-hero .side .name { overflow-wrap: anywhere; }
.section-title { margin: 24px 0 4px; font-size: 18px; font-weight: 700; }
