/* Foot Holics Mini App — native Telegram look.
   CSS variables default to Telegram's dark theme and are overridden at runtime
   by telegram.js from the user's actual themeParams. */
:root {
  --tg-bg: #17212b;
  --tg-secondary-bg: #232e3c;
  --tg-text: #ffffff;
  --tg-hint: #708499;
  --tg-link: #6ab3f3;
  --tg-button: #5288c1;
  --tg-button-text: #ffffff;
  --tg-header-bg: #17212b;

  --radius: 12px;
  --gap: 12px;
  --maxw: 720px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--tg-bg);
  color: var(--tg-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--gap) calc(env(safe-area-inset-bottom) + 24px);
}

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--tg-header-bg);
  padding: 14px 4px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.app-header__name {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0;
  line-height: 1.1;
}
.app-header__tagline {
  font-size: 0.78rem;
  color: var(--tg-hint);
  margin: 2px 0 0;
}

/* Filter chips */
.filters {
  display: flex;
  gap: 8px;
  padding: 6px 0 12px;
  overflow-x: auto;
  scrollbar-width: none;
}
.filters::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  border: none;
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  background: var(--tg-secondary-bg);
  color: var(--tg-hint);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.chip--active {
  background: var(--tg-button);
  color: var(--tg-button-text);
}

/* ── Match list (gallery) ─────────────────────────────────────────────── */
.match-list {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

.match-card {
  background: var(--tg-secondary-bg);
  border-radius: var(--radius);
  padding: 14px 14px 12px;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}
.match-card:active { transform: scale(0.99); opacity: 0.92; }

.match-card__top {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
}
.match-card__score {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  white-space: nowrap;
  padding: 0 6px;
}

/* Teams (shared by card + match header) */
.team {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.team--away { flex-direction: row-reverse; text-align: right; }
.team__name {
  font-size: 0.92rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.team__crest {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border-radius: 6px;
  object-fit: cover;
  background: #0e1621;
}
.team__crest--code {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--tg-text);
}

.match-card__sub {
  margin: 10px 0 0;
  font-size: 0.76rem;
  color: var(--tg-hint);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Live / full-time badge */
.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 5px;
  white-space: nowrap;
}
.live-badge--on {
  background: #e0182d;
  color: #fff;
}
.live-badge--on::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
  animation: live-pulse 1.2s ease-in-out infinite;
}
.live-badge--ft {
  background: var(--tg-bg);
  color: var(--tg-hint);
  border: 1px solid var(--tg-hint);
}
@keyframes live-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

.match-header__live { text-align: center; margin: 8px 0 0; }
.match-card__avail {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--tg-link);
}
.avail__dot { color: var(--tg-hint); font-weight: 400; }
.avail__go { margin-left: auto; color: var(--tg-hint); font-size: 1.1rem; }
.match-card__avail--soon { color: var(--tg-hint); font-weight: 500; font-style: italic; }
.avail__soon { font-size: 0.72rem; }

/* ── Match detail header ──────────────────────────────────────────────── */
.match-header {
  padding: 18px 6px 14px;
}
.match-header__top {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
}
.match-header__top .team__name { white-space: normal; font-size: 1rem; }
.match-header__top .team__crest { width: 40px; height: 40px; }
.match-header__score {
  font-size: 1.5rem;
  font-weight: 800;
  white-space: nowrap;
  padding: 0 6px;
}
.match-header__sub {
  text-align: center;
  margin: 12px 0 0;
  font-size: 0.82rem;
  color: var(--tg-hint);
}
.match-header__result {
  text-align: center;
  margin: 4px 0 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--tg-link);
}

/* ── Sections (Full / Highlights / Goals / Moments) ───────────────────── */
.section { margin-top: 18px; }
.section__title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--tg-hint);
  margin: 0 0 10px;
  padding-left: 2px;
}

/* Full-width clip row */
.clip-row {
  width: 100%;
  border: none;
  text-align: left;
  background: var(--tg-secondary-bg);
  color: var(--tg-text);
  border-radius: var(--radius);
  padding: 8px 12px 8px 8px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.1s ease, opacity 0.1s ease;
}
.clip-row:active { transform: scale(0.99); opacity: 0.9; }
.clip-row__thumb {
  position: relative;
  flex: 0 0 auto;
  width: 84px;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  overflow: hidden;
  background: #0e1621;
  display: flex;
  align-items: center;
  justify-content: center;
}
.clip-row__thumb img { width: 100%; height: 100%; object-fit: cover; }
.clip-row__play {
  position: absolute;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 7px 0 7px 12px;
  border-color: transparent transparent transparent #fff;
  filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.6));
}
.clip-row__title {
  flex: 1 1 auto;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.25;
}
.clip-row__dur {
  flex: 0 0 auto;
  font-size: 0.74rem;
  color: var(--tg-hint);
  font-variant-numeric: tabular-nums;
}

/* Coming-soon note (no media yet) */
.coming-soon {
  background: var(--tg-secondary-bg);
  border-radius: var(--radius);
  padding: 16px 16px;
  text-align: center;
  color: var(--tg-hint);
  font-size: 0.86rem;
}
.coming-soon p { margin: 4px 0; }
.coming-soon strong { color: var(--tg-text); }

/* Match stats table */
.stat-table { display: flex; flex-direction: column; gap: 6px; }
.stat-row {
  display: grid;
  grid-template-columns: 3ch 1fr 3ch;
  align-items: center;
  gap: 8px;
  background: var(--tg-secondary-bg);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.84rem;
}
.stat-row__l { text-align: center; color: var(--tg-hint); font-size: 0.76rem; }
.stat-row__h { text-align: left; font-weight: 700; }
.stat-row__a { text-align: right; font-weight: 700; }

/* Lineups */
.lineups { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.lu { list-style: none; margin: 0; padding: 0; }
.lu li {
  font-size: 0.82rem;
  padding: 5px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  gap: 6px;
}
.lu:last-child li { text-align: right; flex-direction: row-reverse; }
.lu__num {
  display: inline-flex;
  min-width: 20px;
  height: 20px;
  align-items: center;
  justify-content: center;
  background: var(--tg-bg);
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--tg-hint);
}
.lu__pos { color: var(--tg-hint); font-size: 0.72rem; }

/* Goals grid (compact chips) */
.goal-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.goal-chip {
  border: none;
  background: var(--tg-secondary-bg);
  color: var(--tg-text);
  border-radius: 10px;
  padding: 11px 12px;
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.1s ease, opacity 0.1s ease;
}
.goal-chip:active { transform: scale(0.97); opacity: 0.9; }
.goal-chip__play {
  flex: 0 0 auto;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 6px 0 6px 10px;
  border-color: transparent transparent transparent var(--tg-link);
}
.goal-chip__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* States */
.state {
  text-align: center;
  color: var(--tg-hint);
  padding: 48px 16px;
  font-size: 0.9rem;
}
.spinner {
  width: 30px;
  height: 30px;
  margin: 0 auto 14px;
  border: 3px solid var(--tg-secondary-bg);
  border-top-color: var(--tg-button);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.btn {
  border: none;
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 0.9rem;
  font-weight: 600;
  background: var(--tg-button);
  color: var(--tg-button-text);
  cursor: pointer;
}
