@font-face {
  font-family: "Vazir";
  src: url(Vazir-Regular.ttf);
}

:root{
  --header-h: 64px;
  --radius: 18px;
}

html, body {
  height: 100%;
  margin: 0;
}

body {
  font-family: "Vazir", sans-serif;
  cursor: pointer;
  background: #ffffff;
  padding-top: var(--header-h);
}

/* ===== Header (sticky + glass) ===== */
.site-header{
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  height: var(--header-h);
  z-index: 9999;
  background: linear-gradient(90deg, rgba(7,30,57,.92), rgba(11,42,74,.92));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.header-inner{
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 18px;
}

.header-right{
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-wrap{
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-decoration: none;
  font-weight: 800;
}

.logo{
  width: 38px;
  height: 38px;
  object-fit: contain;
  border-radius: 10px;
}

.brand{ white-space: nowrap; }

.site-nav{
  display: flex;
  align-items: center;
  gap: 6px;
}

.site-nav a{
  color: rgba(255,255,255,.92);
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 12px;
  transition: transform .15s ease, background .15s ease;
  white-space: nowrap;
}

.site-nav a:hover{
  background: rgba(255,255,255,.10);
  transform: translateY(-1px);
}

.header-left{
  color: rgba(255,255,255,.92);
  font-weight: 700;
  white-space: nowrap;
}

.header-left .phone{
  color: #fff;
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 12px;
  background: rgba(255,255,255,.10);
  margin-right: 6px;
}

/* Mobile menu */
.nav-toggle{
  display: none;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.08);
  color: #fff;
  border-radius: 12px;
  padding: 8px 10px;
  font-size: 18px;
  line-height: 1;
}

@media (max-width: 860px){
  .nav-toggle{ display: inline-flex; align-items: center; justify-content: center; }
  .site-nav{
    position: absolute;
    top: var(--header-h);
    right: 12px;
    left: 12px;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 12px;
    border-radius: var(--radius);
    background: rgba(11,42,74,.96);
    border: 1px solid rgba(255,255,255,.10);
  }
  .site-nav.open{ display: flex; }
}

/* ===== Title under header ===== */
.hero-title{
  padding: 16px 14px 8px;
  text-align: center;
}

.hero-title h1{
  margin: 0;
  font-size: 18px;
  line-height: 1.8;
  font-weight: 900;
  color: #0b2a4a;
}

/* ===== Game layout fixes ===== */
.page{
  padding: 10px 0 24px;
}

.container {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  /* keep game visible below header+title */
  min-height: calc(100vh - var(--header-h) - 90px);
  padding: 12px;
  box-sizing: border-box;
  touch-action: none; /* prevent scroll while playing on mobile */
}

#score {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 2em;
  font-weight: 900;
  z-index: 5;
}

#introduction {
  width: 220px;
  height: 150px;
  position: absolute;
  font-weight: 600;
  font-size: 0.9em;
  font-family: "Vazir";
  text-align: center;
  transition: opacity 2s;
  user-select: none;
  opacity: 1;
  z-index: 5;
  pointer-events: none;
}

#perfect {
  position: absolute;
  opacity: 0;
  transition: opacity 2s;
  z-index: 5;
  pointer-events: none;
}

#restart {
  width: 140px;
  height: 50px;
  position: absolute;
  border-radius: 14px;
  border: 0;
  background: #0b2a4a;
  color: #fff;
  font-weight: 900;
  font-size: 1em;
  font-family: "Vazir";
  display: none;
  cursor: pointer;
  z-index: 6;
  box-shadow: 0 10px 22px rgba(11,42,74,.18);
}

canvas{
  border-radius: 16px;
  box-shadow: 0 14px 40px rgba(0,0,0,.08);
  background: #fff;
}


/* === SCORE v4 (Neon) === */
.score-wrapper{
  margin: 15px auto;
  text-align: center;
}
.score-box{
  display: inline-block;
  padding: 8px 22px;
  border-radius: 25px;
  font-weight: bold;
  background: rgba(0,0,0,.6);
  color: #00f7ff;
  margin-bottom: 6px;
}
.score-sub{
  font-size: 13px;
  color: #555;
}
.neon{
  text-shadow:
    0 0 5px #00f7ff,
    0 0 10px #00f7ff,
    0 0 20px #00f7ff;
  box-shadow:
    0 0 10px rgba(0,247,255,.6),
    0 0 20px rgba(0,247,255,.4);
  animation: neonPulse 1.5s infinite alternate;
}
@keyframes neonPulse{
  from{opacity:.8}
  to{opacity:1}
}



/* === HEADER mobile fixes v6 === */
.menu-toggle{
  display:none;
  background: transparent;
  border: 0;
  color: #fff;
  font-size: 26px;
  line-height: 1;
  padding: 6px 10px;
  cursor: pointer;
}

#siteNav{
  display:flex;
  align-items:center;
  gap: 6px;
}

#siteNav a{
  display:inline-block;
  padding: 6px 8px;
  border-radius: 10px;
}

#siteNav a:hover{
  background: rgba(255,255,255,.12);
}

@media (max-width: 860px){
  .site-header{
    padding: 10px 12px;
    gap: 10px;
  }
  .menu-toggle{
    display:inline-flex;
    align-items:center;
    justify-content:center;
  }
  /* keep right group on one line; phone won't overlap */
  .header-right{
    gap: 10px;
  }
  /* turn nav into dropdown panel */
  #siteNav{
    position: absolute;
    top: calc(100% + 8px);
    right: 12px;
    left: 12px;
    display: none;
    flex-direction: column;
    align-items: stretch;
    padding: 10px;
    background: rgba(11,42,74,.96);
    border-radius: 16px;
    z-index: 2000;
    box-shadow: 0 10px 25px rgba(0,0,0,.25);
  }
  #siteNav a{
    padding: 10px 12px;
    margin: 0;
  }
  #siteNav.open{
    display:flex;
  }
  /* phone stays visible and doesn't get covered */
  .header-phone{
    font-size: 14px;
    padding-inline-start: 8px;
    white-space: nowrap;
  }
}

/* ultra small: move phone to next line so nothing overlaps */
@media (max-width: 520px){
  .site-header{
    flex-direction: column;
    align-items: stretch;
  }
  .header-right{
    width: 100%;
    justify-content: flex-start;
  }
  .header-phone{
    text-align: left;
    padding: 4px 0 0 0;
  }
  #siteNav{
    right: 12px;
    left: 12px;
  }
}



/* === Mobile header layout + clickability v7 === */
.site-header{
  pointer-events: auto; /* ensure header receives taps */
}
.site-header *{
  pointer-events: auto;
}

@media (max-width: 860px){
  .site-header{
    flex-wrap: wrap;
    row-gap: 8px;
  }
  .header-right{
    flex: 1 1 auto;
    min-width: 0;
    flex-wrap: wrap;
  }
  .brand{
    font-size: 14px;
  }
  .header-phone{
    flex: 0 0 100%;
    text-align: left;
    font-size: 13px;
  }
  .logo{
    width: 34px;
    height: 34px;
  }
  .menu-toggle{
    order: 3;
    margin-inline-start: auto;
  }
  #siteNav{
    right: 12px;
    left: 12px;
  }
}

/* smaller phones */
@media (max-width: 420px){
  .brand{font-size:13px}
  .header-phone{font-size:12px}
}

/* Make sure the game can't steal taps meant for header */
.game-container, canvas{
  position: relative;
  z-index: 1;
}



/* === Mobile minimal header (logo + home) v8 === */
.mobile-header{
  display:none;
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 3000;
  background: rgba(11,42,74,.98);
  padding: 10px 12px;
}
.mobile-home{
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
}
.mobile-logo{
  width: 34px;
  height: 34px;
}
.mobile-brand{
  font-size: 15px;
}

/* On mobile: hide the big header entirely */
@media (max-width: 860px){
  .site-header{ display:none !important; }
  .mobile-header{ display:block; }
  /* push content below the mobile header */
  .site-title{ margin-top: 75px !important; }
}

/* On desktop: keep everything as-is */
@media (min-width: 861px){
  .mobile-header{ display:none; }
}
