:root {
  --bg: #07172e;
  --bg-2: #0b1f3a;
  --card: #102a4c;
  --card-2: #143258;
  --line: #1d3f6b;
  --text: #eaf2ff;
  --muted: #8fa9cc;
  --accent: #00d68f;
  --accent-2: #ffcc33;
  --live: #ff4d5e;
  --shadow: 0 6px 20px rgba(0,0,0,.35);
  --radius: 16px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

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

body {
  min-height: 100vh;
  background:
    radial-gradient(1200px 400px at 50% -120px, #14365f 0%, transparent 70%),
    var(--bg);
  padding-bottom: env(safe-area-inset-bottom);
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(env(safe-area-inset-top) + 12px) 16px 12px;
  background: linear-gradient(180deg, var(--bg-2) 70%, rgba(11,31,58,.85) 100%);
  border-bottom: 1px solid rgba(255,255,255,.06);
  backdrop-filter: blur(8px);
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-logo { font-size: 26px; line-height: 1; }
.brand-text { min-width: 0; }
.brand-text h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: .2px;
  white-space: nowrap;
}
.brand-text p {
  margin: 2px 0 0;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- Language picker ---------- */
.lang-wrap { position: relative; flex-shrink: 0; }
.lang-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--card);
  color: var(--text);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.lang-btn .chev { font-size: 10px; color: var(--muted); }
.lang-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--card);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 14px;
  box-shadow: var(--shadow);
  min-width: 168px;
  z-index: 40;
}
[dir="rtl"] .lang-menu { right: auto; left: 0; }
.lang-menu li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 14px;
  cursor: pointer;
}
.lang-menu li:hover, .lang-menu li.active { background: var(--card-2); }
.lang-menu li .code { font-weight: 800; font-size: 12px; color: var(--accent); width: 26px; }
.lang-menu li.active .code { color: var(--accent-2); }

/* ---------- Filter bar ---------- */
.filter-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 16px;
  scrollbar-width: none;
}
.filter-bar::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0;
  border: 1px solid rgba(255,255,255,.14);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}
.chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #022;
  font-weight: 800;
}

/* ---------- Match list ---------- */
.match-list { padding: 4px 16px 40px; }

.day-head {
  position: sticky;
  top: 52px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 18px 0 10px;
  padding: 6px 0;
  font-size: 13px;
  font-weight: 800;
  color: var(--accent-2);
  text-transform: uppercase;
  letter-spacing: .5px;
  background: linear-gradient(180deg, var(--bg) 60%, transparent);
}
.day-head::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(255,255,255,.08);
}

.match {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(180deg, var(--card) 0%, var(--card-2) 100%);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: transform .08s ease, border-color .15s ease;
}
.match:active { transform: scale(.985); border-color: var(--accent); }

.m-time {
  flex-shrink: 0;
  width: 52px;
  text-align: center;
}
.m-time .t { font-size: 15px; font-weight: 800; }
.m-time .n { font-size: 10px; color: var(--muted); margin-top: 2px; }

.m-divider { width: 1px; align-self: stretch; background: rgba(255,255,255,.08); }

.m-body { flex: 1; min-width: 0; }
.m-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
}
.m-row .flag { font-size: 20px; width: 24px; text-align: center; flex-shrink: 0; }
.m-row .name {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.m-row .name.ph { color: var(--muted); font-style: italic; font-weight: 500; }

.m-foot {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 11px;
  color: var(--muted);
}
.m-city::before { content: "📍"; margin-inline-end: 3px; }
.m-round {
  margin-inline-start: auto;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(0,214,143,.14);
  color: var(--accent);
  font-weight: 700;
  white-space: nowrap;
}

.m-arrow { flex-shrink: 0; color: var(--muted); font-size: 18px; }
[dir="rtl"] .m-arrow { transform: scaleX(-1); }

/* ---------- Modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(3,10,22,.65);
  backdrop-filter: blur(3px);
}
.modal[hidden] { display: none; }
.modal-card {
  position: relative;
  width: 100%;
  max-width: 480px;
  background: linear-gradient(180deg, var(--card-2) 0%, var(--bg-2) 100%);
  border: 1px solid rgba(255,255,255,.1);
  border-bottom: none;
  border-radius: 22px 22px 0 0;
  padding: 26px 22px calc(28px + env(safe-area-inset-bottom));
  box-shadow: var(--shadow);
  animation: sheet .25s ease;
}
@keyframes sheet { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }
.modal-close {
  position: absolute;
  top: 14px;
  inset-inline-end: 14px;
  width: 32px; height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,.1);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
}
.modal-flags {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  font-size: 44px;
}
.modal-flags .m-vs { font-size: 16px; color: var(--muted); font-weight: 700; }
.modal-teams {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 10px;
  font-size: 18px;
  font-weight: 800;
  text-align: center;
}
.modal-teams .m-dash { color: var(--muted); }
.modal-meta {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin-top: 8px;
}
.modal-soon {
  margin-top: 22px;
  padding: 20px;
  border-radius: 16px;
  background: rgba(0,214,143,.08);
  border: 1px dashed rgba(0,214,143,.4);
  text-align: center;
}
.modal-soon .soon-icon { font-size: 30px; }
.modal-soon p { margin: 10px 0 0; font-size: 14px; color: var(--text); }
