:root {
  --bg: #07101d;
  --bg-2: #0b1728;
  --card: rgba(255, 255, 255, 0.08);
  --card-border: rgba(255, 255, 255, 0.12);
  --text: #ffffff;
  --muted: #b8c3d6;
  --primary: #d7a94b;
  --primary-dark: #b98d37;
  --danger: #ff4d6d;
  --success: #38d39f;
  --warning: #ffb703;
  --radius: 22px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Cairo", sans-serif;
  background:
    linear-gradient(rgba(5, 10, 20, 0.78), rgba(5, 10, 20, 0.88)),
    url("assets/bg.png") center/cover no-repeat fixed;
  color: var(--text);
  min-height: 100vh;
}

.bg-overlay {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at top right, rgba(215, 169, 75, 0.14), transparent 28%),
    radial-gradient(circle at bottom left, rgba(255, 77, 109, 0.10), transparent 24%);
  pointer-events: none;
}

.app-shell {
  width: 100%;
  max-width: 420px;
  margin: auto;
  padding: 16px 10px 24px;
  position: relative;
  z-index: 1;
}

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: var(--radius);
  box-shadow:
    0 0 25px rgba(255, 215, 0, 0.26),
    0 10px 30px rgba(0, 0, 0, 0.25);
}

/* Pages */
.page {
  display: none;
}

.page.active {
  display: block;
}

/* Header */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 82px;
  height: 82px;
  object-fit: contain;
  flex-shrink: 0;
}

.brand-text h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
}

.brand-text p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

/* Hero */
.hero {
  padding: 22px 18px;
  margin-bottom: 16px;
}

.hero-badge {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(215, 169, 75, 0.16);
  color: var(--primary);
  font-size: 12px;
  margin-bottom: 10px;
}

.hero h2 {
  margin: 0 0 10px;
  font-size: 26px;
  line-height: 1.35;
}

.hero p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.9;
}

/* Front Page Menu */
.front-menu {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-top: 18px;
}

.menu-card {
  width: 100%;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.08);
  color: #fff;
  border-radius: 22px;
  padding: 18px 16px;
  text-align: right;
  font-family: "Cairo", sans-serif;
  cursor: pointer;
  box-shadow: 0 14px 40px rgba(0,0,0,0.22);
}

.menu-card span {
  display: block;
  font-size: 28px;
  margin-bottom: 8px;
}

.menu-card strong {
  display: block;
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 4px;
}

.menu-card small {
  display: block;
  font-size: 13px;
  color: rgba(255,255,255,0.72);
}

.back-btn {
  border: 0;
  background: rgba(255,255,255,0.12);
  color: #fff;
  border-radius: 14px;
  padding: 10px 14px;
  margin-bottom: 14px;
  font-family: "Cairo", sans-serif;
  font-weight: 700;
  cursor: pointer;
}

/* Section Head */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.section-head h3 {
  margin: 0;
  font-size: 18px;
}

.section-link {
  color: var(--primary);
  text-decoration: none;
  font-size: 13px;
}

.live-dot {
  width: 10px;
  height: 10px;
  background: var(--danger);
  border-radius: 50%;
  box-shadow: 0 0 0 6px rgba(255, 77, 109, 0.12);
}

/* Countdown */
.countdown {
  padding: 18px;
  margin-bottom: 18px;
}

.next-match {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: center;
  text-align: center;
  margin-bottom: 18px;
}

.team {
  font-weight: 700;
}

.team-with-flag {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

.team-with-flag .flag {
  width: 90px;
  height: 60px;

  border-radius: 6px;

  object-fit: contain;
  object-position: center;
}

.team-with-flag span {
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  line-height: 1.25;
  max-width: 85px;
  word-break: break-word;
}

.vs-block {
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-items: center;
}

.vs {
  font-size: 18px;
  font-weight: 800;
  color: var(--primary);
}

.vs-block small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

.timer {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.time-box {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 18px;
  padding: 14px 8px;
  text-align: center;
}

.time-box span {
  display: block;
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 6px;
}

.time-box small {
  color: var(--muted);
  font-size: 12px;
}

/* Matches */
.matches-section,
.groups-section,
.products-section {
  margin-bottom: 18px;
}

.matches-grid,
.groups-grid {
  display: grid;
  gap: 14px;
}

.match-card {
  padding: 16px;
}

.match-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.stage {
  color: var(--muted);
  font-size: 13px;
}

.status {
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 700;
}

.status.upcoming {
  background: rgba(255, 183, 3, 0.14);
  color: var(--warning);
}

.status.live {
  background: rgba(255, 77, 109, 0.14);
  color: var(--danger);
}

.status.finished {
  background: rgba(56, 211, 159, 0.14);
  color: var(--success);
}

.teams-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  align-items: center;
  text-align: center;
}

.team-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.flag{
  width:90px;
  height:60px;

  object-fit:cover;

  border-radius:6px;
  display:block;

  border:1px solid rgba(255,255,255,.2);
}

.team-box span {
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  line-height: 1.25;
  max-width: 95px;
  word-break: break-word;
}

.score-time strong {
  display: block;
  font-size: 20px;
  color: var(--primary);
}

.score-time small {
  color: var(--muted);
  font-size: 12px;
}

/* Groups */
.group-card {
  padding: 16px;
}

.group-title {
  font-size: 17px;
  font-weight: 800;
  margin-bottom: 12px;
  color: var(--primary);
}

.group-table {
  display: grid;
  gap: 8px;
}

.table-row {
  display: grid;
  grid-template-columns: 1.6fr .6fr .6fr;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255,255,255,0.04);
  font-size: 13px;
}

.table-row.head {
  background: rgba(255,255,255,0.08);
  font-weight: 800;
}

.team-name {
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: right;
  min-width: 0;
}

.team-name span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flag-small{
  width:36px;
  height:24px;

  min-width:36px;
  min-height:24px;

  border-radius:4px;

  object-fit:cover;
  object-position:center;

  border:1px solid rgba(255,255,255,.2);
}

.flag-wrap{
  width:90px;
  height:60px;

  min-width:90px;
  min-height:60px;

  overflow:hidden;

  border-radius:6px;

  border:1px solid rgba(255,255,255,.25);

  background:transparent;

  display:flex;
  align-items:center;
  justify-content:center;
}

/* Products */
.products {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 8px;
}

.product {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  height: 165px;
  min-width: 0;
}

.product img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  display: block;
}

.product-name {
  height: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  padding: 4px 6px;
  text-align: center;
  line-height: 1.3;
}

.product:hover {
  transform: scale(1.02);
  transition: 0.2s ease;
}

/* Popup */
.popup {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.70);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 9999;
}

.popup-content {
  width: 90%;
  max-width: 260px;
  padding: 12px;
  border-radius: 16px;
  background: rgba(18, 28, 45, 0.96);
  border: 1px solid rgba(255,255,255,0.12);
}

.popup-content img {
  width: 100%;
  max-height: 140px;
  object-fit: contain;
  display: block;
  margin-bottom: 10px;
}

.popup-content h3 {
  font-size: 14px;
  margin: 8px 0;
}

.popup-content p {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.7;
}

.close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.10);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  margin-bottom: 8px;
}

/* Install */
.install-section {
  text-align: center;
  margin-top: 20px;
}

#installBtn {
  display: none;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  width: 220px;
  max-width: 90%;
  border: 0;
  border-radius: 16px;
  padding: 14px 18px;
  background: linear-gradient(135deg, #d7a94b, #b98d37);
  color: #07101d;
  font-family: "Cairo", sans-serif;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  transition: 0.3s;
}

#installBtn:hover {
  transform: scale(1.05);
}

/* Desktop */
@media (min-width: 600px) {
  .front-menu {
    grid-template-columns: 1fr 1fr;
  }
}
.intro-video-screen {
  display: none;
  position: fixed;
  inset: 0;
  background: #07101d;
  z-index: 99999;
  display: none;
  align-items: center;
  justify-content: center;
}

.intro-video-screen.hide {
  opacity: 0;
  visibility: hidden;
  transition: 0.6s ease;
}

.intro-video-screen video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (min-width: 768px) {
  .app-shell {
    max-width: 900px;
    padding: 24px;
  }

  .matches-grid,
  .groups-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .hero h2 {
    font-size: 36px;
  }

  .products {
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    padding: 12px;
  }

  .product {
    height: 220px;
  }

  .product img {
    height: 165px;
  }

  .product-name {
    height: 55px;
    font-size: 12px;
  }

  .team-with-flag span {
    font-size: 15px;
    max-width: 120px;
  }
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.stat-card {
  padding: 18px;
  text-align: center;
}

.stat-card strong {
  display: block;
  font-size: 26px;
  color: var(--primary);
  margin-bottom: 6px;
}

.stat-card span {
  font-size: 13px;
  color: var(--muted);
}

.predict-btn {
  margin-top: 14px;
  width: 100%;
  border: 0;
  border-radius: 16px;
  padding: 12px 14px;
  background: linear-gradient(135deg, #d7a94b, #b98d37);
  color: #07101d;
  font-family: "Cairo", sans-serif;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(215, 169, 75, 0.25);
}

.predict-btn:hover {
  transform: scale(1.02);
  transition: 0.2s ease;
}

/* First download landing page */
.landing-page {
  position: fixed;
  inset: 0;
  z-index: 99998;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background:
    linear-gradient(rgba(5, 10, 20, 0.84), rgba(5, 10, 20, 0.95)),
    url("assets/bg.png") center/cover no-repeat;
}

.landing-page.hide {
  display: none;
}

.landing-card {
  width: 100%;
  max-width: 420px;
  padding: 26px 20px;
  text-align: center;
}

.landing-logo {
  width: 130px;
  height: 130px;
  object-fit: contain;
  margin-bottom: 14px;
}

.landing-card h1 {
  font-size: 25px;
  line-height: 1.45;
  margin: 0 0 12px;
}

.landing-card p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.8;
  margin: 0 0 16px;
}

.landing-card ul {
  list-style: none;
  padding: 0;
  margin: 0 0 20px;
  text-align: right;
}

.landing-card li {
  padding: 8px 0;
  color: #fff;
  font-size: 14px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.landing-download-btn,
.landing-open-btn {
  width: 100%;
  border: 0;
  border-radius: 16px;
  padding: 14px 16px;
  font-family: "Cairo", sans-serif;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
}

.landing-download-btn {
  background: linear-gradient(135deg, #d7a94b, #b98d37);
  color: #07101d;
}

.landing-open-btn {
  margin-top: 10px;
  background: rgba(255,255,255,0.12);
  color: #fff;
}

/* Home live matches replacement */
.home-live-card {
  padding: 16px;
  margin-bottom: 16px;
}

#homeLiveMatchesGrid {
  margin-top: 12px;
}

#homeLiveMatchesGrid .match-card {
  background: rgba(255, 77, 109, 0.10);
  border-color: rgba(255, 77, 109, 0.22);
}
