@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;600;700;900&display=swap');

/* ════════════════════════════════════════════
   CSS VARIABLES
   ════════════════════════════════════════════ */
:root {
  --green:   #00e676;
  --green2:  #00c853;
  --gold:    #ffd600;
  --red:     #ff1744;
  --live:    #ff3d00;
  --bg:      #080d18;
  --bg2:     #0d1425;
  --bg3:     #131c30;
  --card:    #0f1828;
  --card2:   #162035;
  --surface2:#111e33;
  --border:  rgba(255,255,255,0.06);
  --border2: rgba(255,255,255,0.12);
  --text:    #e2e8f5;
  --text-muted: #6b7a99;
  --radius:  16px;
  --radius-sm: 10px;
  --shadow:  0 8px 32px rgba(0,0,0,0.45);
  /* touch-friendly minimum */
  --tap-min: 44px;
}

/* ════════════════════════════════════════════
   RESET & BASE
   ════════════════════════════════════════════ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  direction: rtl;
  font-family: 'Vazirmatn', sans-serif;
  scroll-behavior: smooth;
  /* prevent font scaling in landscape on iOS */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  /* prevent horizontal overflow on mobile */
  overflow-x: hidden;
  /* GPU compositing layer for smoother scrolling */
  -webkit-overflow-scrolling: touch;
  background-image:
    radial-gradient(ellipse 80% 40% at 10% 0%,  rgba(0,230,118,.05) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 90% 100%, rgba(255,214,0,.04) 0%, transparent 60%);
}

img { max-width: 100%; height: auto; }

/* Scrollbar (desktop only) */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--bg3); border-radius: 99px; }

/* ════════════════════════════════════════════
   NAVBAR
   ════════════════════════════════════════════ */
.navbar {
  background: rgba(8,13,24,.95);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0 1rem;
  position: sticky;
  top: 0;
  z-index: 200;
  /* prevent blur from causing repaint lag */
  will-change: transform;
}

.nav-inner {
  max-width: 1280px;
  margin: auto;
  display: flex;
  align-items: center;
  height: 58px;
  gap: .75rem;
}

.nav-logo {
  font-size: 1.05rem;
  font-weight: 900;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: .4rem;
  white-space: nowrap;
  color: var(--text);
  flex-shrink: 0;
}
.nav-logo .logo-ball { font-size: 1.3rem; }
.nav-logo .logo-text span {
  background: linear-gradient(120deg, var(--green), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-links { display: flex; gap: .15rem; flex: 1; }
.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  padding: .4rem .75rem;
  border-radius: 8px;
  font-size: .85rem;
  font-weight: 500;
  transition: color .15s, background .15s;
  white-space: nowrap;
}
.nav-links a:hover, .nav-links a.active {
  color: var(--text);
  background: var(--bg3);
}

.nav-auth { display: flex; gap: .35rem; margin-right: auto; flex-shrink: 0; }

/* Hamburger */
.nav-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  background: none;
  border: none;
  padding: .5rem;
  min-width: var(--tap-min);
  min-height: var(--tap-min);
  align-items: center;
  justify-content: center;
}
.nav-hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform .25s, opacity .25s;
}
.nav-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.hide-xs { display: inline; }

/* ════════════════════════════════════════════
   BUTTONS — all touch-target ≥ 44px
   ════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  padding: .6rem 1.1rem;
  min-height: var(--tap-min);
  border-radius: 10px;
  font-family: 'Vazirmatn', sans-serif;
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: transform .15s, box-shadow .15s, background .15s;
  white-space: nowrap;
  /* prevent double-tap zoom */
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}
.btn:active { transform: scale(.97); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border2);
}
.btn-ghost:hover, .btn-ghost:focus { color: var(--text); background: var(--bg3); }

.btn-primary {
  background: linear-gradient(135deg, var(--green2), #007c3a);
  color: #fff;
  box-shadow: 0 3px 14px rgba(0,200,83,.22);
}
.btn-primary:hover { box-shadow: 0 5px 20px rgba(0,200,83,.32); }

.btn-gold {
  background: linear-gradient(135deg, var(--gold), #e65100);
  color: #111;
  box-shadow: 0 3px 14px rgba(255,214,0,.18);
}
.btn-red  { background: var(--red);  color: #fff; }
.btn-live { background: linear-gradient(135deg,#ff3d00,#b71c1c); color:#fff; animation: pulseLive 2s infinite; }

@keyframes pulseLive {
  0%,100% { box-shadow: 0 0 0 0 rgba(255,61,0,.4); }
  50%      { box-shadow: 0 0 0 8px rgba(255,61,0,0); }
}

.btn-sm  { padding: .4rem .8rem; font-size: .8rem; min-height: 36px; border-radius: 8px; }
.btn-xs  { padding: .3rem .6rem; font-size: .75rem; min-height: 32px; border-radius: 6px; }
.btn-block { width: 100%; }

/* ════════════════════════════════════════════
   LAYOUT
   ════════════════════════════════════════════ */
.container {
  max-width: 1280px;
  margin: auto;
  padding: 1.5rem 1rem;
}

.page-header  { margin-bottom: 1.5rem; }
.page-title   { font-size: clamp(1.2rem,4vw,1.7rem); font-weight: 900; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.page-title .accent {
  background: linear-gradient(120deg, var(--green), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px,1fr)); gap: 1rem; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: .85rem; }
.section-title  { font-size: .95rem; font-weight: 700; }

/* ════════════════════════════════════════════
   CARDS
   ════════════════════════════════════════════ */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}
.card-sm { padding: .85rem; }
.card-header {
  font-size: .9rem;
  font-weight: 700;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--border);
}

/* ════════════════════════════════════════════
   ALERTS
   ════════════════════════════════════════════ */
.alert {
  padding: .8rem 1rem;
  border-radius: 12px;
  font-size: .88rem;
  font-weight: 500;
  margin-bottom: .85rem;
  display: flex;
  align-items: flex-start;
  gap: .55rem;
  line-height: 1.5;
}
.alert-success { background: rgba(0,230,118,.1);  border: 1px solid rgba(0,230,118,.25);  color: #69f0ae; }
.alert-danger  { background: rgba(255,23,68,.1);   border: 1px solid rgba(255,23,68,.25);  color: #ff6e84; }
.alert-warning { background: rgba(255,214,0,.08);  border: 1px solid rgba(255,214,0,.25);  color: var(--gold); }
.alert-info    { background: rgba(33,150,243,.08); border: 1px solid rgba(33,150,243,.25); color: #64b5f6; }

/* ════════════════════════════════════════════
   HERO
   ════════════════════════════════════════════ */
.hero {
  text-align: center;
  padding: 3rem 1rem 2rem;
}
.hero-ball {
  font-size: clamp(3.5rem,12vw,5rem);
  display: block;
  margin: 0 auto 1.25rem;
  animation: float 3.5s ease-in-out infinite;
  /* offload to GPU */
  will-change: transform;
}
@keyframes float {
  0%,100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-12px) rotate(8deg); }
}
.hero h1 {
  font-size: clamp(1.6rem,5vw,3rem);
  font-weight: 900;
  line-height: 1.25;
  margin-bottom: .85rem;
}
.hero h1 .accent {
  background: linear-gradient(120deg, var(--green), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero p {
  color: var(--text-muted);
  font-size: clamp(.9rem,3vw,1.05rem);
  max-width: 520px;
  margin: 0 auto 1.75rem;
  line-height: 1.8;
}
.hero-btns {
  display: flex;
  gap: .85rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ════════════════════════════════════════════
   STATS BAR
   ════════════════════════════════════════════ */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px,1fr));
  gap: .65rem;
  margin: 1.25rem 0;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem .75rem;
  text-align: center;
}
.stat-number {
  font-size: clamp(1.5rem,5vw,2rem);
  font-weight: 900;
  background: linear-gradient(120deg, var(--green), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.1;
}
.stat-label { font-size: .75rem; color: var(--text-muted); margin-top: .25rem; }

/* ════════════════════════════════════════════
   LIVE BANNER
   ════════════════════════════════════════════ */
.live-banner {
  background: linear-gradient(135deg,rgba(255,61,0,.15),rgba(183,28,28,.1));
  border: 1px solid rgba(255,61,0,.3);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1.25rem;
}
.live-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--live);
  display: inline-block;
  animation: blink 1s infinite;
  margin-left: .3rem;
  flex-shrink: 0;
}
@keyframes blink { 0%,100% { opacity:1; } 50% { opacity:.2; } }

/* ════════════════════════════════════════════
   MATCH CARDS
   ════════════════════════════════════════════ */
.day-group { margin-bottom: 2rem; }
.day-label {
  display: flex;
  align-items: center;
  gap: .65rem;
  margin-bottom: .85rem;
}
.day-label-text {
  font-size: .95rem;
  font-weight: 700;
  background: linear-gradient(120deg, var(--green), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  white-space: nowrap;
}
.day-label-line { flex: 1; height: 1px; background: linear-gradient(90deg, var(--border2), transparent); }

.match-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  position: relative;
  overflow: hidden;
  margin-bottom: .75rem;
  /* no hover transform on mobile — causes jank */
  transition: border-color .2s;
}
.match-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--green), var(--gold));
  opacity: 0;
  transition: opacity .2s;
}
.match-card.is-live {
  border-color: rgba(255,61,0,.35);
  background: linear-gradient(135deg, var(--card), rgba(255,61,0,.04));
}
.match-card.is-live::before { opacity: 1; background: linear-gradient(90deg,#ff3d00,#ff9100); }

.match-meta {
  display: flex;
  align-items: center;
  gap: .4rem;
  flex-wrap: wrap;
  font-size: .75rem;
  color: var(--text-muted);
  margin-bottom: .7rem;
}

/* Teams row — the most important mobile layout */
.match-teams {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
}
.team {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .3rem;
  flex: 1;
  min-width: 0;
}
.team-flag { font-size: clamp(1.6rem,6vw,2.2rem); line-height: 1; }
.team-name {
  font-weight: 700;
  font-size: clamp(.75rem,2.5vw,.88rem);
  text-align: center;
  line-height: 1.3;
  word-break: break-word;
}

.vs-box {
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 10px;
  padding: .45rem .75rem;
  font-size: .8rem;
  font-weight: 800;
  color: var(--text-muted);
  flex-shrink: 0;
}
.score-box {
  display: flex;
  align-items: center;
  gap: .3rem;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 10px;
  padding: .45rem .7rem;
  flex-shrink: 0;
}
.score-num {
  font-size: clamp(1.4rem,5vw,2rem);
  font-weight: 900;
  background: linear-gradient(120deg, var(--green), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  min-width: 1.1ch;
  text-align: center;
  line-height: 1;
}
.score-live { background: linear-gradient(120deg,#ff3d00,#ff9100) !important; -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.score-sep  { font-size: 1.1rem; color: var(--text-muted); }

/* ════════════════════════════════════════════
   BADGES
   ════════════════════════════════════════════ */
.badge {
  padding: .2rem .6rem;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: .2rem;
  white-space: nowrap;
}
.badge-stage   { background: rgba(255,214,0,.1);    color: var(--gold); }
.badge-open    { background: rgba(0,230,118,.1);    color: var(--green); }
.badge-started { background: rgba(255,23,68,.1);    color: #ff6e84; }
.badge-live    { background: rgba(255,61,0,.2);     color: #ff6e40; animation: pulseLiveBg 1.5s infinite; }
.badge-done    { background: rgba(255,255,255,.06); color: var(--text-muted); }
.pts-3 { background: rgba(255,214,0,.12);   color: var(--gold); }
.pts-2 { background: rgba(0,230,118,.12);   color: var(--green); }
.pts-1 { background: rgba(33,150,243,.12);  color: #64b5f6; }
.pts-0 { background: rgba(255,255,255,.06); color: var(--text-muted); }

@keyframes pulseLiveBg {
  0%,100% { background: rgba(255,61,0,.2); }
  50%      { background: rgba(255,61,0,.35); }
}

/* ════════════════════════════════════════════
   PREDICTION FORM — mobile-first stepper
   ════════════════════════════════════════════ */
.predict-form {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: .9rem .85rem;
  margin-top: .85rem;
}
.predict-form-title {
  font-size: .8rem;
  color: var(--text-muted);
  margin-bottom: .6rem;
  text-align: center;
}

.score-input-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  margin-bottom: .65rem;
  flex-wrap: nowrap;          /* never wrap — keep on one line */
}

.team-label-sm {
  font-size: .75rem;
  color: var(--text-muted);
  min-width: 44px;
  max-width: 60px;
  text-align: center;
  line-height: 1.3;
  word-break: break-word;
}

.score-stepper {
  display: flex;
  align-items: center;
  gap: .3rem;
  flex-shrink: 0;
}

/* Big tappable stepper buttons */
.stepper-btn {
  width: 40px;
  height: 40px;
  border-radius: 9px;
  background: var(--bg2);
  border: 1px solid var(--border2);
  color: var(--text);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .12s, border-color .12s, color .12s;
  touch-action: manipulation;
  flex-shrink: 0;
  /* prevent long-press selection on mobile */
  -webkit-user-select: none;
  user-select: none;
}
.stepper-btn:active, .stepper-btn:hover {
  background: rgba(0,230,118,.15);
  border-color: var(--green);
  color: var(--green);
}

.score-input {
  width: 52px;
  height: 40px;
  text-align: center;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 9px;
  color: var(--text);
  font-size: 1.25rem;
  font-weight: 800;
  padding: .3rem;
  font-family: 'Vazirmatn', sans-serif;
  /* hide spinners */
  -moz-appearance: textfield;
  appearance: textfield;
}
.score-input::-webkit-inner-spin-button,
.score-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.score-input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(0,230,118,.12); }

.score-dash { font-size: 1.3rem; color: var(--text-muted); padding: 0 .1rem; flex-shrink: 0; }

.my-pred {
  background: rgba(0,230,118,.07);
  border: 1px solid rgba(0,230,118,.18);
  border-radius: 10px;
  padding: .55rem .9rem;
  font-size: .83rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .4rem;
  margin-top: .7rem;
  flex-wrap: wrap;
}
.locked-pred { background: rgba(255,23,68,.07); border-color: rgba(255,23,68,.18); }

/* ════════════════════════════════════════════
   FILTER TABS — horizontal scroll on mobile
   ════════════════════════════════════════════ */
.filter-tabs {
  display: flex;
  gap: .4rem;
  margin-bottom: 1.25rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.filter-tabs::-webkit-scrollbar { display: none; }
.filter-tab {
  padding: .4rem .9rem;
  border-radius: 999px;
  border: 1px solid var(--border2);
  color: var(--text-muted);
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: border-color .15s, color .15s, background .15s;
  white-space: nowrap;
  flex-shrink: 0;
  touch-action: manipulation;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
}
.filter-tab.active {
  background: linear-gradient(135deg, var(--green2), #007c3a);
  border-color: var(--green2);
  color: #fff;
}

/* ── Day Tabs ── */
#day-tabs-wrap {
  margin-bottom: 1rem;
  scrollbar-width: none;
}
#day-tabs-wrap::-webkit-scrollbar { display: none; }
.day-tab {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: .45rem .95rem;
  border-radius: 12px;
  border: 1px solid var(--border2);
  color: var(--text-muted);
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all .15s;
  min-width: 60px;
  min-height: 42px;
  flex-shrink: 0;
  touch-action: manipulation;
  background: var(--bg2);
}
.day-tab:hover {
  border-color: var(--green2);
  color: var(--green2);
}
.day-tab-active {
  background: linear-gradient(135deg, var(--green2), #007c3a) !important;
  border-color: var(--green2) !important;
  color: #fff !important;
  box-shadow: 0 2px 8px rgba(0,200,83,.25);
}

/* ════════════════════════════════════════════
   LEADERBOARD TABLE
   ════════════════════════════════════════════ */
.lb-table { width: 100%; border-collapse: collapse; }
.lb-table th {
  font-size: .75rem;
  color: var(--text-muted);
  font-weight: 600;
  padding: .5rem .75rem;
  text-align: right;
  border-bottom: 1px solid var(--border);
}
.lb-table td {
  padding: .75rem .75rem;
  border-bottom: 1px solid var(--border);
}
.lb-table tr:last-child td { border-bottom: none; }
.lb-table tr:hover td { background: rgba(255,255,255,.02); }

.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .8rem;
  flex-shrink: 0;
}
.user-cell { display: flex; align-items: center; gap: .6rem; }
.pts-big   { font-size: 1.1rem; font-weight: 900; color: var(--gold); }

/* ════════════════════════════════════════════
   AUTH FORMS
   ════════════════════════════════════════════ */
.auth-wrap  { max-width: 460px; margin: 2rem auto; padding: 0 1rem; }
.auth-card  { padding: 2rem 1.5rem; }
.auth-logo  { font-size: 2.2rem; margin-bottom: .85rem; display: block; text-align: center; }
.auth-title { font-size: 1.4rem; font-weight: 900; margin-bottom: .3rem; text-align: center; }
.auth-sub   { color: var(--text-muted); font-size: .87rem; margin-bottom: 1.75rem; text-align: center; }

.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-size: .82rem; font-weight: 600; margin-bottom: .35rem; color: var(--text-muted); }
.form-control {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 10px;
  color: var(--text);
  font-size: 1rem;   /* ≥16px prevents iOS zoom */
  padding: .7rem .95rem;
  font-family: 'Vazirmatn', sans-serif;
  transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none;
  appearance: none;
}
.form-control:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(0,230,118,.1);
}
.form-control::placeholder { color: var(--text-muted); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 100px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }

.auth-footer {
  text-align: center;
  margin-top: 1.25rem;
  font-size: .87rem;
  color: var(--text-muted);
}
.auth-footer a { color: var(--green); text-decoration: none; font-weight: 600; }
.divider {
  display: flex; align-items: center; gap: .85rem;
  margin: 1.1rem 0; color: var(--text-muted); font-size: .78rem;
}
.divider::before, .divider::after { content:''; flex:1; height:1px; background:var(--border); }

/* ════════════════════════════════════════════
   PROFILE
   ════════════════════════════════════════════ */
.profile-hero {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
}
.profile-avatar {
  width: 68px; height: 68px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.7rem; font-weight: 900;
  border: 3px solid;
  flex-shrink: 0;
}
.profile-name { font-size: clamp(1.2rem,4vw,1.5rem); font-weight: 900; }
.profile-sub  { color: var(--text-muted); font-size: .85rem; margin-top: .2rem; }

/* ════════════════════════════════════════════
   DATA TABLE (scrollable on mobile)
   ════════════════════════════════════════════ */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.data-table { width: 100%; border-collapse: collapse; font-size: .83rem; }
.data-table th {
  padding: .55rem .75rem;
  text-align: right;
  color: var(--text-muted);
  font-weight: 600;
  font-size: .75rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: .65rem .75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(255,255,255,.02); }

/* ════════════════════════════════════════════
   ADMIN
   ════════════════════════════════════════════ */
.admin-tabs {
  display: flex;
  gap: .25rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 0;
}
.admin-tabs::-webkit-scrollbar { display: none; }
.admin-tab {
  padding: .55rem .95rem;
  cursor: pointer;
  font-weight: 600;
  font-size: .83rem;
  color: var(--text-muted);
  border: none;
  background: none;
  border-bottom: 2px solid transparent;
  font-family: 'Vazirmatn', sans-serif;
  transition: color .15s, border-color .15s;
  white-space: nowrap;
  flex-shrink: 0;
  touch-action: manipulation;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  min-height: 40px;
}
.admin-tab.active, .admin-tab:hover { color: var(--green); border-bottom-color: var(--green); }
.admin-panel { display: none; }
.admin-panel.active { display: block; }

/* ════════════════════════════════════════════
   MODAL
   ════════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.75);
  z-index: 500;
  display: none;
  align-items: flex-end;    /* bottom sheet on mobile */
  justify-content: center;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  padding: 0;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--card2);
  border: 1px solid var(--border2);
  border-radius: var(--radius) var(--radius) 0 0;  /* bottom-sheet corners */
  padding: 1.5rem 1.25rem 2rem;
  width: 100%;
  max-width: 540px;
  box-shadow: 0 -16px 48px rgba(0,0,0,.55);
  animation: slideUpModal .25s ease;
  /* safe area for notch phones */
  padding-bottom: max(2rem, env(safe-area-inset-bottom));
  max-height: 90vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
@keyframes slideUpModal {
  from { transform: translateY(30px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.modal-title  { font-size: 1.05rem; font-weight: 800; }
.modal-close  {
  background: none; border: none;
  color: var(--text-muted); font-size: 1.3rem;
  cursor: pointer; padding: .3rem;
  min-width: var(--tap-min); min-height: var(--tap-min);
  display: flex; align-items: center; justify-content: center;
  touch-action: manipulation;
}
.modal-close:hover { color: var(--text); }

/* ════════════════════════════════════════════
   EMPTY STATE
   ════════════════════════════════════════════ */
.empty { text-align: center; padding: 2.5rem 1rem; color: var(--text-muted); }
.empty-icon { font-size: 2.8rem; margin-bottom: .85rem; display: block; }
.empty h3   { font-size: .95rem; margin-bottom: .35rem; color: var(--text); }

/* ════════════════════════════════════════════
   PROGRESS
   ════════════════════════════════════════════ */
.progress     { background: var(--bg3); border-radius: 999px; height: 5px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 999px; background: linear-gradient(90deg,var(--green),var(--gold)); transition: width .5s ease; }

/* ════════════════════════════════════════════
   SETTINGS
   ════════════════════════════════════════════ */
.settings-section        { margin-bottom: 1.75rem; }
.settings-section-title  { font-size: .95rem; font-weight: 700; margin-bottom: .9rem; padding-bottom: .65rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: .45rem; }
.danger-zone             { border: 1px solid rgba(255,23,68,.25); border-radius: var(--radius); padding: 1.25rem; background: rgba(255,23,68,.04); }

/* ════════════════════════════════════════════
   FOOTER
   ════════════════════════════════════════════ */
footer {
  border-top: 1px solid var(--border);
  padding: 1.75rem 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: .82rem;
  margin-top: 2.5rem;
  /* safe area bottom */
  padding-bottom: max(1.75rem, env(safe-area-inset-bottom));
}

/* ════════════════════════════════════════════
   ANIMATION
   ════════════════════════════════════════════ */
.fade-in { animation: fadeIn .3s ease; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  *, .fade-in, .hero-ball { animation: none !important; transition: none !important; }
}

/* ════════════════════════════════════════════
   MISC
   ════════════════════════════════════════════ */
.pw-shown { font-family: monospace; background: var(--bg3); padding: .2rem .4rem; border-radius: 6px; }
.rule-score-row { transition: .15s; }

/* ════════════════════════════════════════════
   AVG PREDICTION BAR — خطی و درصدی
   ════════════════════════════════════════════ */
.avg-pred-bar-wrap {
  margin-top: .7rem;
  padding-top: .7rem;
  border-top: 1px solid var(--border);
}
.avg-pred-bar-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: .75rem;
  color: var(--text-muted);
  margin-bottom: .35rem;
  gap: .3rem;
}
.avg-pred-bar-label strong { color: var(--text); font-size: .82rem; }
.avg-pred-bar-teams {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .72rem;
  font-weight: 700;
}
.avg-pred-bar-outer {
  height: 10px;
  border-radius: 999px;
  background: var(--bg3);
  border: 1px solid var(--border2);
  overflow: hidden;
  position: relative;
}
.avg-pred-bar-fill-1 {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--green2), var(--green));
  transition: width .6s cubic-bezier(.4,0,.2,1);
  float: right; /* RTL */
}
.avg-pred-bar-fill-2 {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #1982c4, #64b5f6);
  transition: width .6s cubic-bezier(.4,0,.2,1);
  float: left; /* RTL */
}
.avg-pred-bar-separator {
  height: 100%;
  width: 2px;
  background: var(--bg);
  display: inline-block;
  vertical-align: top;
}
.avg-pred-pcts {
  display: flex;
  justify-content: space-between;
  font-size: .7rem;
  margin-top: .3rem;
  color: var(--text-muted);
}
.avg-pred-pct-1 { color: var(--green); font-weight: 700; }
.avg-pred-pct-2 { color: #64b5f6; font-weight: 700; }
.avg-pred-pct-draw { color: var(--gold); font-weight: 700; }

/* ════════════════════════════════════════════
   RESPONSIVE — TABLET  ≤768px
   ════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* navbar */
  .nav-hamburger { display: flex; }
  .nav-links {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 58px; right: 0; left: 0;
    background: rgba(8,13,24,.98);
    border-bottom: 1px solid var(--border);
    padding: .75rem;
    gap: .2rem;
    z-index: 300;
    /* smooth drop */
    box-shadow: 0 12px 32px rgba(0,0,0,.5);
  }
  .nav-links.open { display: flex; }
  .nav-links a {
    padding: .85rem 1rem;
    border-radius: 10px;
    font-size: .92rem;
    min-height: var(--tap-min);
    display: flex;
    align-items: center;
  }
  .nav-auth { gap: .25rem; }
  .hide-xs  { display: none; }

  /* layout */
  .container { padding: 1rem .85rem; }
  .grid-2    { grid-template-columns: 1fr; }
  .form-row  { grid-template-columns: 1fr; }

  /* hero */
  .hero { padding: 2.5rem .75rem 1.5rem; }

  /* public results — stack names */
  .result-names-row { flex-direction: column; gap: .25rem; }

  /* stats bar */
  .stats-bar { grid-template-columns: repeat(2,1fr); }

  /* match card results grid */
  .result-grid { grid-template-columns: 1fr !important; }
}

/* ════════════════════════════════════════════
   RESPONSIVE — MOBILE  ≤480px
   ════════════════════════════════════════════ */
@media (max-width: 480px) {
  .navbar       { padding: 0 .75rem; }
  .nav-inner    { height: 54px; }
  .nav-links    { top: 54px; }

  .match-card   { padding: .85rem .75rem; }
  .card         { padding: 1rem .9rem; }
  .card-sm      { padding: .75rem; }

  /* score stepper — bigger tap areas */
  .stepper-btn  { width: 38px; height: 38px; font-size: 1.15rem; }
  .score-input  { width: 48px; height: 38px; font-size: 1.1rem; }
  .score-input-row { gap: .35rem; }
  .team-label-sm   { font-size: .7rem; min-width: 36px; }

  /* bottom sheet becomes taller */
  .modal { border-radius: var(--radius) var(--radius) 0 0; }

  /* profile avatar smaller */
  .profile-avatar { width: 56px; height: 56px; font-size: 1.4rem; }

  /* stat cards */
  .stats-bar { grid-template-columns: repeat(2,1fr); }
  .stat-card { padding: .85rem .6rem; }

  /* data tables → always horizontal scroll */
  .data-table th, .data-table td { padding: .5rem .55rem; }

  .btn-sm { padding: .38rem .65rem; font-size: .78rem; }
  .btn-xs { padding: .28rem .5rem;  font-size: .73rem; }

  /* admin table overflow */
  .admin-tabs { gap: .2rem; }
  .admin-tab  { padding: .45rem .7rem; font-size: .78rem; }
}

/* ════════════════════════════════════════════
   SAFE AREA (notch / Dynamic Island)
   ════════════════════════════════════════════ */
@supports (padding-top: env(safe-area-inset-top)) {
  .navbar {
    padding-left:  max(1rem, env(safe-area-inset-right));
    padding-right: max(1rem, env(safe-area-inset-left));
  }
}


/* day tabs improvements */
.day-tabs-wrap{overflow-x:auto;-webkit-overflow-scrolling:touch;margin-bottom:1.25rem}
.day-tabs-wrap::-webkit-scrollbar{display:none}
#day-tabs{display:flex;flex-wrap:nowrap}
.all-tab{
position:sticky;
right:0;
z-index:5;
background:var(--card);
flex:0 0 auto;
}
.day-tab{flex:0 0 auto}
