:root {
  --bg: #0a1410;
  --bg2: #0f1f18;
  --card: #14241d;
  --card2: #1a3026;
  --line: #25453700;
  --border: #244536;
  --green: #00c46a;
  --green-dim: #0a9d57;
  --accent: #ffd24a;
  --red: #ff4d4d;
  --text: #eaf4ee;
  --muted: #8aa89a;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: radial-gradient(1200px 600px at 50% -10%, #103022 0%, var(--bg) 55%) fixed;
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }

.demo-banner {
  background: linear-gradient(90deg, #6b4d00, #8a6500);
  color: #fff2cc;
  text-align: center;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
}

/* ── Top bar ── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; max-width: 1100px; margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo { font-size: 34px; }
.brand h1 { font-size: 22px; font-weight: 900; letter-spacing: -0.5px; }
.brand .sub { font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: 1px; text-transform: uppercase; }
.status { display: flex; align-items: center; gap: 8px; }
.updated { font-size: 12px; color: var(--muted); }
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 0 rgba(255,77,77,.7); animation: pulse 1.4s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(255,77,77,.6);} 70%{box-shadow:0 0 0 8px rgba(255,77,77,0);} 100%{box-shadow:0 0 0 0 rgba(255,77,77,0);} }

/* ── Tabs ── */
.tabs {
  display: flex; gap: 8px; overflow-x: auto; padding: 0 16px 4px;
  max-width: 1100px; margin: 0 auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 0 0 auto; background: var(--card); color: var(--muted);
  border: 1px solid var(--border); border-radius: 999px; padding: 9px 16px;
  font-size: 14px; font-weight: 700; cursor: pointer; transition: .15s; white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--green); color: #04130c; border-color: var(--green); }

main { max-width: 1100px; margin: 18px auto 60px; padding: 0 16px; }
.tab-panel { display: none; animation: fade .2s ease; }
.tab-panel.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(4px);} to {opacity:1; transform:none;} }

.section-title { font-size: 14px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; margin: 22px 4px 10px; }
.empty { text-align: center; color: var(--muted); padding: 50px 20px; font-size: 15px; }

/* ── Match card ── */
.matches { display: grid; gap: 10px; }
.match {
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 14px 16px; cursor: pointer; transition: .15s; box-shadow: var(--shadow);
}
.match:hover { border-color: var(--green-dim); transform: translateY(-1px); }
.match-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.round { font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
.state { font-size: 12px; font-weight: 800; padding: 2px 9px; border-radius: 999px; }
.state.live { background: rgba(255,77,77,.15); color: var(--red); }
.state.ft { background: rgba(138,168,154,.15); color: var(--muted); }
.state.ns { background: rgba(0,196,106,.12); color: var(--green); }
.teams-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; }
.team { display: flex; align-items: center; gap: 10px; }
.team.away { flex-direction: row-reverse; text-align: right; }
.team img { width: 30px; height: 22px; object-fit: contain; border-radius: 3px; flex: 0 0 auto; }
.team .nm { font-weight: 700; font-size: 15px; }
.scoreline { text-align: center; min-width: 70px; }
.scoreline .sc { font-size: 26px; font-weight: 900; letter-spacing: 1px; }
.scoreline .vs { font-size: 13px; color: var(--muted); font-weight: 700; }
.scoreline .clock { font-size: 11px; color: var(--red); font-weight: 700; margin-top: 2px; }
.scoreline .kickoff { font-size: 11px; color: var(--muted); margin-top: 2px; }
.venue-line { font-size: 11px; color: var(--muted); margin-top: 10px; display: flex; align-items: center; gap: 5px; }

/* ── Standings ── */
.group { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 6px 6px 10px; margin-bottom: 14px; box-shadow: var(--shadow); }
.group h3 { font-size: 14px; padding: 12px 12px 8px; font-weight: 800; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 9px 8px; text-align: center; }
th { color: var(--muted); font-size: 11px; text-transform: uppercase; font-weight: 700; }
td.tname, th.tname { text-align: left; }
tbody tr { border-top: 1px solid var(--border); }
.tname { display: flex; align-items: center; gap: 9px; font-weight: 700; }
.tname img { width: 24px; height: 18px; object-fit: contain; border-radius: 3px; }
.rank { color: var(--muted); font-weight: 800; width: 22px; }
tr.qual .rank { color: var(--green); }
td.pts { font-weight: 900; color: var(--accent); }

/* ── Bracket ── */
.bracket { display: flex; gap: 18px; overflow-x: auto; padding-bottom: 16px; }
.bracket-col { flex: 0 0 220px; }
.bracket-col h4 { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 10px; font-weight: 800; }
.bk { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 10px; margin-bottom: 12px; cursor: pointer; }
.bk:hover { border-color: var(--green-dim); }
.bk .r { display: flex; justify-content: space-between; align-items: center; gap: 6px; padding: 3px 0; font-size: 13px; }
.bk .r img { width: 22px; height: 16px; object-fit: contain; }
.bk .r .n { flex: 1; font-weight: 600; }
.bk .r.win .n { color: var(--green); font-weight: 800; }
.bk .r .g { font-weight: 900; }

/* ── Modal ── */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.7); display: flex; align-items: flex-start; justify-content: center; padding: 20px; z-index: 50; overflow-y: auto; backdrop-filter: blur(3px); }
.modal-card { background: var(--bg2); border: 1px solid var(--border); border-radius: 18px; max-width: 720px; width: 100%; position: relative; overflow: hidden; box-shadow: var(--shadow); margin: auto; }
.modal-close { position: absolute; top: 12px; right: 12px; z-index: 5; background: rgba(0,0,0,.5); color: #fff; border: none; width: 34px; height: 34px; border-radius: 50%; font-size: 16px; cursor: pointer; }
.venue-hero { height: 180px; background-size: cover; background-position: center; position: relative; }
.venue-hero .ov { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,.1), rgba(15,31,24,.95)); display: flex; flex-direction: column; justify-content: flex-end; padding: 16px; }
.venue-hero .vn { font-size: 20px; font-weight: 900; }
.venue-hero .vc { font-size: 13px; color: var(--muted); font-weight: 600; }
.modal-pad { padding: 18px; }
.m-score { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; margin-bottom: 6px; }
.m-score .team img { width: 44px; height: 32px; }
.m-score .nm { font-size: 16px; }
.m-score .big { font-size: 38px; font-weight: 900; }
.m-state { text-align: center; font-size: 12px; color: var(--muted); margin-bottom: 16px; font-weight: 700; }
.chips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0; }
.chip { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 10px; text-align: center; }
.chip .k { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.chip .v { font-size: 14px; font-weight: 800; margin-top: 3px; }
.blurb { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; font-size: 13px; line-height: 1.5; color: #cfe3d8; margin-bottom: 10px; }
.blurb b { color: var(--text); }
.sub-h { font-size: 13px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; margin: 18px 0 10px; }
.events li { list-style: none; display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.events .min { font-weight: 800; color: var(--accent); min-width: 38px; }
.lineups { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.xi h5 { font-size: 13px; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.xi h5 img { width: 22px; height: 16px; }
.xi .form { font-size: 11px; color: var(--muted); font-weight: 700; }
.xi ul { list-style: none; }
.xi li { font-size: 13px; padding: 4px 0; color: #cfe3d8; }
.xi li .no { display: inline-block; width: 22px; color: var(--muted); font-weight: 700; }
.share { display: flex; gap: 8px; margin-top: 16px; }
.share a { flex: 1; text-align: center; padding: 10px; border-radius: 10px; font-size: 13px; font-weight: 800; text-decoration: none; color: #fff; }
.share .fb { background: #1877f2; }
.share .x { background: #000; border: 1px solid #333; }
.share .wa { background: #25d366; color: #04130c; }

.foot { text-align: center; padding: 24px; color: var(--muted); font-size: 12px; }
.foot a { color: var(--green); text-decoration: none; }

@media (max-width: 560px) {
  .brand h1 { font-size: 18px; }
  .team .nm { font-size: 13px; }
  .scoreline .sc { font-size: 22px; }
  .lineups { grid-template-columns: 1fr; }
  .chips { grid-template-columns: 1fr 1fr; }
}

/* ── Language toggle ── */
.lang-toggle {
  background: var(--card); color: var(--text); border: 1px solid var(--border);
  border-radius: 999px; width: 38px; height: 32px; font-weight: 800; font-size: 14px;
  cursor: pointer; transition: .15s;
}
.lang-toggle:hover { border-color: var(--green); color: var(--green); }

/* ── Arabic / RTL ── */
body.rtl { font-family: 'Cairo', 'Inter', system-ui, sans-serif; }
/* Keep score rows left-to-right in every language so each goal count stays
   locked to its team (home left, away right) and digits never bidi-flip. */
.teams-row, .m-score { direction: ltr; }
.scoreline .sc, .scoreline .vs, .scoreline .clock, .scoreline .kickoff, .m-score .big { direction: ltr; unicode-bidi: isolate; }
body.rtl .bk .r { direction: ltr; }
body.rtl .events .min { direction: ltr; }

/* ── Match-detail extras: scorer/assist/cards/bench/coach ── */
.events .who { display: flex; flex-direction: column; }
.events .tm { color: var(--muted); font-weight: 600; font-size: 12px; }
.events .tag { color: var(--accent); font-size: 12px; }
.events .assist { color: var(--muted); font-size: 12px; }
.events.cards { margin-top: 6px; }
.xi ul.start li .pos { color: var(--muted); font-size: 11px; margin-inline-start: auto; padding-inline-start: 8px; }
.xi ul.start li { display: flex; align-items: center; }
.bench-h { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; font-weight: 800; margin: 10px 0 4px; }
.xi ul.bench li { color: var(--muted); font-size: 12px; padding: 3px 0; }
.coach { margin-top: 10px; font-size: 12px; color: var(--muted); }
.coach b { color: var(--text); }
