*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --green: #00ff87;
  --blue: #60a5fa;
  --amber: #fbbf24;
  --red: #f87171;
  --bg: #080d14;
  --surface: rgba(255,255,255,0.05);
  --border: rgba(255,255,255,0.08);
  --t35: rgba(255,255,255,0.35);
  --t60: rgba(255,255,255,0.6);
}

html { font-size: 14px; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: #fff;
  min-height: 100vh;
  overflow-x: hidden;
}

/* BG */
.bg-mesh {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 80% 50% at 20% 10%, rgba(0,255,135,0.07) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 80%, rgba(96,165,250,0.07) 0%, transparent 60%);
}

/* HEADER */
.header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(8,13,20,0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex; align-items: center; gap: 12px;
  max-width: 1280px; margin: 0 auto;
  padding: 10px 20px;
}
.logo {
  display: flex; align-items: center; gap: 8px;
  font-size: 16px; font-weight: 800; letter-spacing: -0.5px;
  color: #fff; white-space: nowrap;
}
.logo-mark { font-size: 18px; }

.nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 8px; border: none;
  background: transparent; color: var(--t60);
  font-family: inherit; font-size: 13px; font-weight: 500;
  cursor: pointer; white-space: nowrap; transition: all .15s;
}
.nav-btn:hover { background: var(--surface); color: #fff; }
.nav-btn.active { background: rgba(0,255,135,0.12); color: var(--green); }

.header-actions { display: flex; gap: 8px; }
.icon-btn {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 8px; cursor: pointer;
  font-size: 14px; transition: background .15s;
}
.icon-btn:hover { background: rgba(255,255,255,0.1); }

/* MAIN */
.main {
  position: relative; z-index: 1;
  max-width: 1280px; margin: 0 auto;
  padding: 24px 20px 100px;
}
.page-head {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 20px;
}
.page-head h1 { font-size: 22px; font-weight: 800; letter-spacing: -0.5px; }

/* GLASS */
.glass {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  backdrop-filter: blur(12px);
  position: relative; overflow: hidden;
}
.glass.glow { border-color: rgba(0,255,135,0.2); box-shadow: 0 0 24px rgba(0,255,135,0.06); }
.glass.card { padding: 20px; }
.clickable { cursor: pointer; transition: transform .15s, box-shadow .15s; }
.clickable:hover { transform: translateY(-2px); box-shadow: 0 8px 32px rgba(0,0,0,0.3); }

/* GRIDS */
.grid { display: flex; flex-direction: column; gap: 16px; }
.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

@media (max-width: 700px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* BADGE */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 20px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.3px;
}

/* LIVE */
.live {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 700; color: var(--green);
}
.live-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--green);
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.3); }
}

/* FILTERS */
.filters {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  margin-bottom: 16px;
}
.filter-btn {
  padding: 5px 12px; border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface); color: var(--t60);
  font-family: inherit; font-size: 12px; font-weight: 500;
  cursor: pointer; transition: all .15s;
}
.filter-btn:hover { color: #fff; border-color: rgba(255,255,255,0.2); }
.filter-btn.active { background: rgba(0,255,135,0.15); color: var(--green); border-color: rgba(0,255,135,0.3); }

/* MATCH CARD — new FotMob-style */
.mc-wrap {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 14px;
  padding: 12px 14px;
  transition: background .15s, transform .15s, box-shadow .15s;
  cursor: pointer;
}
.mc-wrap:hover {
  background: rgba(255,255,255,0.07);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
}
.mc-live {
  border-color: rgba(0,255,135,0.2);
  box-shadow: 0 0 20px rgba(0,255,135,0.05);
}
.mc-live:hover { box-shadow: 0 8px 24px rgba(0,255,135,0.12); }

/* SKELETON */
.skeleton-card {
  height: 110px;
  border-radius: 14px;
  background: linear-gradient(90deg, rgba(255,255,255,0.04) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.04) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { 0% { background-position: 200% 0 } 100% { background-position: -200% 0 } }

/* NEWS */
.news-layout { display: flex; flex-direction: column; gap: 16px; }
.news-featured {
  display: flex; overflow: hidden; text-decoration: none; color: inherit;
  border-radius: 16px; min-height: 180px;
}
.news-feat-img { width: 280px; min-height: 180px; object-fit: cover; flex-shrink: 0; }
.news-feat-body { padding: 20px 24px; display: flex; flex-direction: column; justify-content: center; gap: 10px; }
.news-feat-title { font-size: 18px; font-weight: 700; line-height: 1.35; }
.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.news-card { display: flex; flex-direction: column; text-decoration: none; color: inherit; overflow: hidden; border-radius: 14px; }
.news-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.4); }
.news-card-img { width: 100%; height: 150px; object-fit: cover; }
.news-card-placeholder { height: 150px; display: flex; align-items: center; justify-content: center; font-size: 40px; background: rgba(255,255,255,0.04); }
.news-card-body { padding: 12px; }
.news-card-title { font-size: 13px; font-weight: 600; line-height: 1.4; }
.news-source-badge {
  display: inline-block; font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .4px; color: var(--blue); padding: 2px 8px;
  background: rgba(96,165,250,0.12); border-radius: 20px;
}
.news-meta { font-size: 11px; color: var(--t35); }

/* TRANSFER ROW */
.transfer-row {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px; border-bottom: 1px solid rgba(255,255,255,0.05);
  cursor: pointer; transition: background .15s;
}
.transfer-row:hover { background: rgba(255,255,255,0.04); }
.transfer-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(96,165,250,0.12); color: var(--blue);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800; flex-shrink: 0;
}

/* OLD refs still used */
.match-card { padding: 14px; }
.match-league { font-size: 11px; font-weight: 600; color: var(--t35); text-transform: uppercase; letter-spacing: 0.5px; }
.match-time { font-size: 12px; color: var(--t35); }
.flag { font-size: 14px; }
.match-score { font-size: 16px; font-weight: 800; min-width: 20px; text-align: right; }
.match-score.dim { color: var(--t35); }
.xg-bar { flex: 1; height: 3px; border-radius: 2px; background: rgba(255,255,255,0.08); display: flex; overflow: hidden; }

@media (max-width: 700px) {
  .news-feat-img { width: 120px; min-height: 120px; }
  .news-feat-title { font-size: 14px; }
}

/* CARD HEAD */
.card-head {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 16px;
}
.ic { font-size: 16px; }
.card-title { font-size: 14px; font-weight: 700; flex: 1; }
.card-title-right { font-size: 13px; }

/* STAT BAR */
.stat { margin-bottom: 12px; }
.stat-top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 5px; font-size: 12px;
}
.stat-label { font-size: 11px; color: var(--t35); text-transform: uppercase; letter-spacing: 0.5px; }
.stat-bar {
  height: 4px; border-radius: 2px; overflow: hidden;
  display: flex; background: rgba(255,255,255,0.05);
}
.stat-bar > div { height: 100%; transition: width .4s; }

/* PITCH */
.pitch { width: 100%; border-radius: 8px; display: block; }

/* LEGEND */
.legend {
  display: flex; gap: 16px; align-items: center;
  font-size: 11px; color: var(--t60); margin-top: 8px; flex-wrap: wrap;
}
.legend .right { margin-left: auto; color: var(--t35); }
.dot-inline {
  display: inline-block; width: 8px; height: 8px;
  border-radius: 50%; margin-right: 4px; vertical-align: middle;
}

/* TABLE */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  padding: 8px 10px; text-align: left;
  font-size: 11px; font-weight: 600; color: var(--t35);
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
td { padding: 10px 10px; border-bottom: 1px solid rgba(255,255,255,0.04); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.02); }

.pos {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 6px;
  font-size: 12px; font-weight: 700;
  background: rgba(255,255,255,0.06);
}
.pos.ucl { background: rgba(96,165,250,0.2); color: var(--blue); }
.pos.uel { background: rgba(251,191,36,0.2); color: var(--amber); }

/* FORM */
.form { display: flex; gap: 3px; }
.form-dot {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 4px;
  font-size: 9px; font-weight: 700;
}
.form-w { background: rgba(0,255,135,0.2); color: var(--green); }
.form-l { background: rgba(248,113,113,0.2); color: var(--red); }
.form-d { background: rgba(255,255,255,0.1); color: var(--t60); }

/* SCOREBOARD */
.scoreboard { padding: 24px; text-align: center; }
.sb-live { margin-bottom: 12px; }
.sb-teams { display: flex; align-items: center; justify-content: center; gap: 16px; }
.sb-team { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: 1; }
.sb-flag { font-size: 36px; }
.sb-name { font-size: 15px; font-weight: 700; }
.sb-score { font-size: 42px; font-weight: 900; letter-spacing: -1px; }
.sb-min { font-size: 13px; color: var(--green); font-weight: 600; }

/* ROWS */
.row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.row:last-child { border-bottom: none; }
.row-rank { font-size: 12px; color: var(--t35); min-width: 18px; }
.row-flag { font-size: 18px; }
.row-main { flex: 1; min-width: 0; }
.row-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub { font-size: 11px; color: var(--t35); margin-top: 2px; }
.row-stat { text-align: center; min-width: 44px; }
.lbl { font-size: 10px; color: var(--t35); text-transform: uppercase; letter-spacing: 0.3px; }
.val { font-size: 14px; font-weight: 700; margin-top: 2px; }

/* PLAYER */
.player-head { display: flex; align-items: center; gap: 20px; }
.player-avatar { font-size: 56px; }
.player-name { font-size: 22px; font-weight: 800; letter-spacing: -0.5px; }
.player-meta { font-size: 13px; color: var(--t60); margin-top: 4px; }
.player-badges { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }

/* MINI STAT */
.mini-stat { text-align: center; padding: 10px; background: var(--surface); border-radius: 10px; }
.mini-stat .val { font-size: 18px; font-weight: 800; color: var(--green); }

/* XG ROW */
.xg-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 0; border-bottom: 1px solid var(--border);
}
.xg-row:last-child { border-bottom: none; }
.xg-mini-bar {
  width: 80px; height: 4px; border-radius: 2px;
  background: rgba(255,255,255,0.06); overflow: hidden; flex-shrink: 0;
}

/* NEWS */
.news-thumb {
  font-size: 28px; margin-bottom: 10px;
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
}
.news-title { font-size: 13px; font-weight: 600; margin: 8px 0 4px; line-height: 1.4; }
.news-time { font-size: 11px; color: var(--t35); }

/* FADE */
.fade { animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* BOTTOM NAV */
.bottom-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  background: rgba(8,13,20,0.92);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  padding: 8px 16px 12px;
  justify-content: space-around;
}
.bn-btn {
  background: none; border: none; cursor: pointer;
  font-size: 20px; padding: 8px 12px; border-radius: 10px;
  color: var(--t35); transition: all .15s;
}
.bn-btn:hover { background: var(--surface); color: #fff; }
.bn-btn.active { color: var(--green); }

@media (max-width: 640px) {
  /* Nav */
  .bottom-nav { display: flex; }
  .nav { display: none; }
  .header-actions { display: none; }
  .main { padding: 12px 10px 88px; }

  /* Grids */
  .grid-cards { grid-template-columns: 1fr; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }

  /* Scoreboard */
  .scoreboard { padding: 16px 12px; }
  .sb-score { font-size: 32px; }
  .sb-name { font-size: 13px; }
  .sb-teams { gap: 8px; }

  /* Match cards */
  .mc-wrap { padding: 10px 12px; }

  /* Tables — standings */
  table { font-size: 12px; }
  th, td { padding: 7px 6px; }

  /* Player head */
  .player-head { flex-direction: column; align-items: flex-start; gap: 12px; }

  /* News */
  .news-featured { flex-direction: column; }
  .news-feat-img { width: 100%; height: 180px; min-height: unset; }
  .news-feat-body { padding: 14px 16px; }
  .news-feat-title { font-size: 15px; }
  .news-grid { grid-template-columns: 1fr; }

  /* Page head */
  .page-head h1 { font-size: 18px; }

  /* Filters overflow */
  .filters { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; scrollbar-width: none; }
  .filters::-webkit-scrollbar { display: none; }
  .filter-btn { flex-shrink: 0; }

  /* Lineup grid */
  .lineup-grid { grid-template-columns: 1fr !important; }
}

/* Additional: prevent horizontal overflow everywhere */
* { max-width: 100%; }
img { max-width: 100%; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { min-width: 480px; }

/* Safe area for notched phones (iPhone X+) */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .bottom-nav { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
  .main { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
}
