:root {
  --bg:#06120b; --bar:#0a1d12; --card:#0f2619; --card2:#14301f; --line:#1f4a31;
  --green:#00a651; --gold:#ffd54a; --text:#ecfff3; --muted:#8fb8a0; --live:#ff4d4d;
}
* { box-sizing:border-box; -webkit-tap-highlight-color:transparent; }
html, body { margin:0; background:var(--bg); color:var(--text); font-family:system-ui,-apple-system,"Segoe UI",sans-serif; }
[dir=rtl] body { font-family:"Segoe UI",Tahoma,"Noto Kufi Arabic",system-ui,sans-serif; }
a { color:inherit; text-decoration:none; }
button { font:inherit; color:inherit; cursor:pointer; }
img { object-fit:contain; }

/* top bar */
.top { position:sticky; top:0; z-index:20; display:flex; align-items:center; gap:8px; padding:10px 14px; background:var(--bar); border-bottom:1px solid var(--line); }
.top h1 { margin:0; font-size:20px; flex:1; white-space:nowrap; }
.top .back { border:0; background:none; font-size:22px; padding:2px 6px; display:none; }
.top.sub .back { display:block; }
.pill { border:1px solid var(--line); background:var(--card); border-radius:99px; padding:6px 12px; font-size:14px; font-weight:600; }
.pill.gold { border-color:var(--gold); color:var(--gold); }

main { max-width:760px; margin:0 auto; padding:10px 10px 90px; }

/* bottom nav */
nav.tabs { position:fixed; bottom:0; left:0; right:0; z-index:20; display:flex; justify-content:center; background:var(--bar); border-top:1px solid var(--line); padding-bottom:env(safe-area-inset-bottom); }
nav.tabs a { flex:1; max-width:190px; text-align:center; padding:8px 4px 10px; color:var(--muted); font-size:12px; font-weight:600; }
nav.tabs a span { display:block; font-size:22px; line-height:28px; filter:grayscale(1); opacity:.7; }
nav.tabs a.on { color:var(--green); }
nav.tabs a.on span { filter:none; opacity:1; }

/* cards & lists */
.card { background:var(--card); border:1px solid var(--line); border-radius:16px; margin:10px 0; overflow:hidden; }
.card-h { display:flex; align-items:center; gap:10px; padding:10px 14px; background:var(--card2); font-weight:700; font-size:15px; }
.card-h img { width:24px; height:24px; }
.card-h .grow { flex:1; }
.card-h .star { border:0; background:none; font-size:18px; padding:0 4px; }
.muted { color:var(--muted); }
.center { text-align:center; padding:22px 12px; }
.empty { text-align:center; color:var(--muted); padding:30px 16px; }

/* date strip */
.dates { display:flex; gap:6px; overflow-x:auto; padding:4px 0 6px; scrollbar-width:none; }
.dates::-webkit-scrollbar { display:none; }
.dates button { flex:0 0 auto; border:1px solid var(--line); background:var(--card); border-radius:12px; padding:7px 12px; font-size:13px; font-weight:600; color:var(--muted); line-height:1.2; }
.dates button b { display:block; color:var(--text); font-size:14px; }
.dates button.on { background:var(--green); border-color:var(--green); color:#fff; }
.dates button.on b { color:#fff; }
.dates button.live { border-color:var(--live); color:var(--live); }
.dates button.live.on { background:var(--live); color:#fff; }

/* match row */
.m { display:grid; grid-template-columns:1fr 74px 1fr; align-items:center; gap:6px; padding:11px 12px; border-top:1px solid var(--line); }
.m:hover { background:#ffffff08; }
.m .t { display:flex; align-items:center; gap:8px; font-size:14px; font-weight:600; min-width:0; }
.m .t span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.m .t.home { justify-content:flex-end; text-align:end; }
.m .t img { width:24px; height:24px; flex:0 0 24px; }
.m .t.win span { color:var(--text); } .m .t.lose span { color:var(--muted); }
.m .mid { text-align:center; font-weight:800; font-size:16px; }
.m .mid small { display:block; font-size:11px; font-weight:600; color:var(--muted); }
.m .mid.live { color:var(--live); }
.m .mid.live small { color:var(--live); }
.m .mid .time { font-size:14px; font-weight:700; color:var(--text); }
.fav { color:var(--gold); }
.date-h { padding:8px 14px; font-size:12px; font-weight:700; color:var(--muted); text-transform:uppercase; letter-spacing:.5px; border-top:1px solid var(--line); background:#0b2014; }

/* page header (match / team / league) */
.hero { background:radial-gradient(circle at 50% 0,#1a5b37,var(--card)); border:1px solid var(--line); border-radius:18px; padding:16px 12px; margin:10px 0; text-align:center; }
.hero .lg { font-size:13px; color:var(--muted); display:flex; gap:6px; align-items:center; justify-content:center; }
.hero .lg img { width:18px; height:18px; }
.vs { display:grid; grid-template-columns:1fr auto 1fr; align-items:start; gap:8px; margin-top:12px; }
.vs .side img { width:64px; height:64px; display:block; margin:0 auto 6px; }
.vs .side b { font-size:15px; }
.vs .score { font-size:40px; font-weight:900; padding-top:8px; min-width:110px; }
.vs .score small { display:block; font-size:13px; font-weight:700; color:var(--muted); }
.vs .score.live small { color:var(--live); }
.scorers { display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-top:10px; font-size:12px; color:var(--muted); }
.scorers div:first-child { text-align:end; }
.hero .big img { width:84px; height:84px; }
.hero h2 { margin:8px 0 4px; font-size:24px; }
.follow { border:0; border-radius:99px; padding:8px 18px; font-weight:800; background:var(--gold); color:#1d1d1d; margin-top:10px; font-size:14px; }
.follow.on { background:var(--card2); color:var(--text); border:1px solid var(--line); }

/* sub tabs */
.subtabs { display:flex; gap:6px; overflow-x:auto; margin:6px 0 4px; scrollbar-width:none; }
.subtabs button { flex:0 0 auto; border:0; background:none; padding:9px 14px; border-radius:99px; font-weight:700; color:var(--muted); font-size:14px; }
.subtabs button.on { background:var(--text); color:var(--bg); }

/* events timeline */
.ev { display:grid; grid-template-columns:1fr 46px 1fr; align-items:center; padding:9px 12px; border-top:1px solid var(--line); font-size:14px; }
.ev .min { text-align:center; font-weight:800; color:var(--muted); font-size:13px; }
.ev .h { text-align:end; } .ev .a { text-align:start; }
.ev small { display:block; color:var(--muted); font-size:12px; }
.ev.goal .min { color:var(--gold); }
.ev-note { text-align:center; padding:8px; font-size:12px; font-weight:700; color:var(--muted); background:#0b2014; border-top:1px solid var(--line); }

/* pitch */
.pitch { position:relative; margin:12px; border-radius:14px; padding:14px 6px; display:flex; flex-direction:column-reverse; gap:14px; min-height:430px; justify-content:space-around;
  background:repeating-linear-gradient(0deg,#1d7a3e 0 44px,#1a7038 44px 88px); border:2px solid #ffffff55; overflow:hidden; }
.pitch::before { content:""; position:absolute; left:25%; right:25%; bottom:-2px; height:60px; border:2px solid #ffffff55; border-bottom:0; }
.pitch::after { content:""; position:absolute; left:-2px; right:-2px; top:-2px; height:50%; border-bottom:2px solid #ffffff55; }
.prow { display:flex; justify-content:space-around; position:relative; z-index:1; }
.pl { width:72px; text-align:center; font-size:11px; font-weight:700; text-shadow:0 1px 2px #000; }
.pl i { display:grid; place-items:center; width:32px; height:32px; margin:0 auto 3px; border-radius:50%; background:#fff; color:#111; font-style:normal; font-size:13px; font-weight:900; border:2px solid #0006; text-shadow:none; }
.pl.gk i { background:var(--gold); }
.pl em { font-style:normal; display:block; }
.formation { text-align:center; font-weight:800; padding-top:12px; }
.bench { padding:4px 0; }
.bench div { padding:7px 14px; border-top:1px solid var(--line); font-size:14px; display:flex; gap:10px; }
.bench div b { width:24px; color:var(--muted); text-align:center; }

/* stats bars */
.st { padding:10px 14px; border-top:1px solid var(--line); }
.st .row { display:flex; justify-content:space-between; font-weight:800; font-size:14px; }
.st .row span:nth-child(2) { font-weight:600; color:var(--muted); font-size:13px; }
.st .bar { display:flex; gap:4px; margin-top:6px; height:8px; }
.st .bar i { border-radius:4px; background:#2a4a38; }
.st .bar i.h { background:var(--green); } .st .bar i.a { background:var(--gold); }

/* tables */
table { width:100%; border-collapse:collapse; font-size:14px; }
th, td { padding:8px 5px; text-align:center; }
th { color:var(--muted); font-size:12px; font-weight:700; }
td.tm { text-align:start; }
td.tm a { display:flex; align-items:center; gap:8px; }
td.tm img { width:22px; height:22px; flex:0 0 22px; }
tr { border-top:1px solid var(--line); }
tr.me td { background:#ffd54a1a; }
tr.me td:first-child { box-shadow:inset 3px 0 var(--gold); }
td.pts { font-weight:800; }

/* list rows (leagues, teams, squad, search) */
.li { display:flex; align-items:center; gap:12px; padding:11px 14px; border-top:1px solid var(--line); }
.li:first-child { border-top:0; }
.li img { width:30px; height:30px; flex:0 0 30px; }
.li .grow { flex:1; min-width:0; }
.li small { display:block; color:var(--muted); font-size:12px; }
.li .star { border:0; background:none; font-size:20px; padding:4px; }
.search { display:flex; gap:8px; margin:8px 0; }
.search input { flex:1; padding:12px 14px; border-radius:14px; border:1px solid var(--line); background:var(--card); color:var(--text); font-size:16px; }

/* goal pop-up */
#goal { position:fixed; inset:0; display:none; place-items:center; background:#000b; z-index:50; }
#goal.show { display:grid; animation:pop .3s ease-out; }
.goal-card { text-align:center; background:radial-gradient(circle,#0f6b37,#03140b); border:4px solid var(--gold); border-radius:24px; padding:26px 30px; margin:16px; box-shadow:0 0 60px #ffd54a88; }
.goal-word { font-size:clamp(44px,13vw,80px); font-weight:900; color:var(--gold); animation:shake .5s infinite alternate; }
.goal-team img { width:90px; height:90px; display:block; margin:10px auto; }
.goal-team b { font-size:24px; }
.goal-score { margin:14px 0 18px; font-size:18px; }
.goal-score span { color:var(--gold); font-size:28px; font-weight:800; margin:0 8px; }
@keyframes pop { from { transform:scale(.6); opacity:0; } }
@keyframes shake { from { transform:rotate(-4deg); } to { transform:rotate(4deg) scale(1.08); } }
.blink { animation:blink 1.2s infinite; }
@keyframes blink { 50% { opacity:.4; } }
.subtabs button img { width:20px; height:20px; vertical-align:middle; }
.side-tabs button { display:flex; align-items:center; gap:4px; }
[dir=rtl] .top .back, [dir=rtl] .card-h > .muted:last-child { display:inline-block; transform:scaleX(-1); }
[dir=rtl] .top:not(.sub) .back { display:none; }
