: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%;
  min-height:105px;
  color:#ffffff;

  display:flex;
  align-items:center;
  justify-content:space-between;

  padding:22px;

  border-radius:24px;

  background:rgba(255,255,255,.10);
  border:1px solid rgba(255,255,255,.20);

  backdrop-filter:blur(12px);

  box-shadow:
  0 0 25px rgba(255,215,0,.15),
  0 10px 30px rgba(0,0,0,.20);

  text-align:right;
}

.menu-card span{
  width:70px;
  height:70px;

  display:flex;
  align-items:center;
  justify-content:center;

  font-size:34px;

  border-radius:20px;

  background:rgba(255,255,255,.12);

  flex-shrink:0;
}

.menu-card strong{
  display:block;
  font-size:22px;
  font-weight:800;
  margin-bottom:6px;
}

.menu-card small{
  display:block;
  font-size:14px;
  color:rgba(255,255,255,.70);
}

.menu-content{
  flex:1;
}

.menu-content strong{
  display:block;
  font-size:22px;
  font-weight:900;
  margin-bottom:6px;
  color:#ffffff;
  text-shadow:0 0 8px rgba(255,255,255,.20);
}

.menu-content small{
  display:block;
  font-size:14px;
  font-weight:700;
  color:rgba(255,255,255,.85);
}

.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;
  width: 180px;
  max-width: 80%;
  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 {
  position: fixed;
  inset: 0;
  background: #07101d;
  z-index: 99999;
  display: flex;
  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;
}

.registration-page {
  position: fixed;
  inset: 0;
  background: #07101d;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.registration-card {
  width: 100%;
  max-width: 360px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 22px;
  padding: 22px;
  text-align: center;
}

.registration-card input {
  width: 100%;
  margin-bottom: 12px;
  padding: 13px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.08);
  color: #fff;
  font-family: "Cairo", sans-serif;
}

.registration-card button {
  width: 100%;
  padding: 14px;
  border: 0;
  border-radius: 16px;
  background: #d7a94b;
  color: #07101d;
  font-weight: 800;
  font-family: "Cairo", sans-serif;
}

#predictionPage input {
  width: 100%;
  margin: 8px 0 14px;
  padding: 13px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.08);
  color: #fff;
  font-family: "Cairo", sans-serif;
  font-size: 16px;
}

#predictionPage label {
  display: block;
  color: #b8c3d6;
  font-size: 13px;
  margin-top: 8px;
}

.first{
  background:rgba(255,215,0,.18);
  border-color:rgba(255,215,0,.9);
  box-shadow:0 0 16px rgba(255,215,0,.25);
}

.second{
  background:rgba(180,190,190,.12);
  border-color:rgba(220,220,220,.7);
}

.third{
  background:rgba(180,110,45,.16);
  border-color:rgba(205,127,50,.75);
}

.player-name{
  flex:1;
  text-align:right;
  padding-left:20px;
}

/* Compact Top 3 + Moving Products Strip */
.top3-card {
  margin: 12px 0 14px;
  padding: 12px;
  border-radius: 22px;
  background: rgba(8, 18, 30, 0.82);
  border: 1px solid rgba(215, 169, 75, 0.75);
  box-shadow: 0 0 18px rgba(215, 169, 75, 0.22);
}

.top3-card h3 {
  text-align: right;
  margin: 0 0 10px;
  font-size: 18px;
  font-weight: 900;
}

.top3-note {
  display: none;
}

.compact-top3 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
}

.top-player{
  display:flex;
  align-items:center;
  justify-content:space-between;

  gap:10px;
  padding:10px 14px;
  min-height:54px;
}

.player-name{
  flex:1;
  text-align:right;

  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;

  font-size:18px;
  font-weight:800;
}

.player-points{
  min-width:90px;
  text-align:left;
  font-size:16px;
  font-weight:800;
  color:#ffd54f;
}

.products-marquee{
  margin-top:12px;
  overflow:hidden;
  direction:ltr;
  border-radius:16px;
  border:1px solid rgba(215,169,75,.45);
  background:rgba(0,0,0,.25);
  padding:8px 0;
}

/* First install instruction page */
.install-intro-page {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 18px;
  overflow-y: auto;
  background:
    linear-gradient(rgba(5, 10, 20, 0.86), rgba(5, 10, 20, 0.94)),
    url("assets/bg.png") center/cover no-repeat;
}

.install-intro-card {
  width: 100%;
  max-width: 420px;
  padding: 8px 16px 14px;
  text-align: center;
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 18px 45px rgba(0,0,0,.35), 0 0 28px rgba(215,169,75,.18);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  margin-top: 10px;
  margin-bottom: 20px;
}

.intro-logo {
  width: 170px;
  height: 170px;
  object-fit: contain;
  display: block;
  margin: 0 auto -20px;
}

.install-intro-card h1 {
  margin: -6px 0 8px;
  font-size: 24px;
  line-height: 1.25;
}

.intro-subtitle,
.prize-note,
.install-note {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.8;
  margin: 10px 0;
}

.how-to-box {
  margin: 16px 0;
  padding: 14px;
  border-radius: 20px;
  background: rgba(0,0,0,.22);
  border: 1px solid rgba(255,255,255,.12);
}

.how-to-box h3 {
  margin: 0 0 12px;
  color: var(--primary);
  font-size: 17px;
}

.points-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,.09);
  font-size: 13px;
  text-align: right;
}

.points-row:last-child {
  border-bottom: 0;
}

.points-row b {
  flex-shrink: 0;
  color: #07101d;
  background: var(--primary);
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 12px;
}

.download-app-btn {
  width: 100%;
  min-height: 52px;
  margin-top: 10px;
  border: 0;
  border-radius: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f5d37b, #d7a94b);
  color: #07101d;
  font-family: "Cairo", sans-serif;
  font-weight: 900;
  font-size: 18px;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(215,169,75,.28);
}

.registration-page,
.app-shell {
  display: none;
}

.product-text{
  display:flex;
  flex-direction:column;
  gap:4px;
  width:130px;
}

.product-title{
  font-size:16px;
  font-weight:900;
  color:#fff;
  line-height:1.1;
}

.product-message{
  font-size:12px;
  font-weight:700;
  color:#ffd36a;
  line-height:1.3;
}

.products-track{
  display:flex;
  gap:12px;
  width:fit-content;
  animation:productsMove 80s linear infinite;
  will-change:transform;
}

@keyframes productsMove{
  from{
    transform:translateX(0);
  }

  to{
    transform:translateX(calc(-50% - 6px));
  }
}

.marquee-item{
  display:flex;
  align-items:center;
  gap:10px;
  flex:0 0 auto;
  padding:8px 12px;
  border-radius:16px;
  background:rgba(255,255,255,.06);
  border:1px solid rgba(215,169,75,.35);
}

.marquee-item img{
  width:68px;
  height:68px;
  object-fit:contain;
  border-radius:12px;
  background:rgba(255,255,255,.08);
  padding:5px;
  flex-shrink:0;
}

.user-summary-card{
  padding:16px;
  margin:12px 0 14px;
  text-align:center;
}

.user-summary-card h3{
  margin:0 0 12px;
  font-size:20px;
  font-weight:900;
}

.user-summary-row{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px;
}

.user-summary-row div{
  padding:12px;
  border-radius:16px;
  background:rgba(255,255,255,.07);
  border:1px solid rgba(255,255,255,.12);
}

.user-summary-row strong{
  display:block;
  font-size:24px;
  color:#ffd54f;
  font-weight:900;
}

.user-summary-row span{
  display:block;
  font-size:13px;
  color:rgba(255,255,255,.8);
}

/* Fix long names breaking leaderboard/top3 layout */
.top-player,
#leaderboardList > div {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.player-name,
#leaderboardList span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-points,
#leaderboardList strong {
  flex-shrink: 0;
  white-space: nowrap;
}

html,
body {
  overflow-x: hidden !important;
}

.prediction-teams-box{
  display:grid;
  grid-template-columns:1fr auto 1fr;
  gap:10px;
  align-items:center;
  margin:14px 0 18px;
}

.prediction-team{
  padding:14px 8px;
  border-radius:16px;
  background:rgba(255,255,255,.08);
  border:1px solid rgba(255,255,255,.16);
  text-align:center;
}

.prediction-team small{
  display:block;
  color:#ffd54f;
  font-size:12px;
  margin-bottom:6px;
  font-weight:800;
}

.prediction-team strong{
  display:block;
  font-size:15px;
  line-height:1.4;
}

.prediction-vs{
  font-weight:900;
  color:#d7a94b;
}

#enablePushBtn{
  width:100%;
  border:none;
  border-radius:12px;
  padding:14px;
  font-size:16px;
  font-weight:700;
  cursor:pointer;
}

#pushStatusBox{
  width:100%;
  margin-top:10px;
  padding:12px;
  border-radius:12px;
  text-align:center;
  font-weight:700;
}

.push-active{
  background:#123d22;
  color:#00ff88;
}

.push-disabled{
  background:#3d1212;
  color:#ff6b6b;
}