:root {
  --grid-size: min(90vw, 800px);
  --tile-count: 8;
  --tile-size: calc(var(--grid-size) / var(--tile-count));
}

body {
  /* background-image: url("banner.jpg"); */
  background-size: cover;
  background-repeat: no-repeat;
  margin: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  /* stack scoreboard on top of grid */
  justify-content: center;
  align-items: center;
}

.preloader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  overflow: hidden;
}

.preloader video {
  width: 100vw;
  /* Viewport width */
  height: 100vh;
  /* Viewport height */
  object-fit: cover;
  /* Cover the entire area without distortion */
}

.companyLogo{
 position: absolute;
 top: 85%;
 left: 73%;
 width: min(60vw, 500px);
}

.magic{
 position: absolute;
 top: 2%;
 left: 0%;
 width: min(60vw, 500px);
}

 .score-board {
    max-width: 95vw;
    padding: 14px 22px;
    border-radius: 18px;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    background: linear-gradient(
      135deg,
      rgba(255, 126, 179, 0.35),
      rgba(255, 79, 145, 0.25)
    );
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);

    border: 1px solid rgba(255,255,255,0.25);
    box-shadow:
      0 12px 30px rgba(0,0,0,0.35),
      inset 0 1px 0 rgba(255,255,255,0.3);

    color: white;
  }


.score-item {
  flex: 1;
  min-width: 120px;
  padding: 10px;
  border-radius: 14px;
  background: rgba(0,0,0,0.25);
  box-shadow: inset 0 0 12px rgba(0,0,0,0.3);
}

.score-item h3 {
  margin: 0;
  font-size: 0.75rem;
  letter-spacing: 2px;
  opacity: 0.85;
}

.score-item h1 {
  margin-top: 6px;
  font-size: 1.9rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 0 10px rgba(255, 126, 179, 0.8);
}

#score {
  color: #ffd700;
  text-shadow: 0 0 12px rgba(255, 215, 0, 0.9);
}

#moves {
  color: #00ffd5;
  text-shadow: 0 0 10px rgba(0, 255, 213, 0.8);
}

#timer {
  color: #ffb347;
  text-shadow: 0 0 10px rgba(255, 179, 71, 0.8);
}


.grid {
  height: var(--grid-size);
  width: var(--grid-size);
  /* use fixed width instead of min-width */
  display: flex;
  flex-wrap: wrap;
  background-color: rgba(109, 127, 151, 0.5);
  padding: 5px;
  border-radius: 10px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5) inset, 0 1px 0 #fff;
  color: #85796b;
  margin: 0;
  /* remove extra margin */
}

.grid div {
  width: var(--tile-size);
  height: var(--tile-size);
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

h3 {
  font-family: "Montserrat", sans-serif;
  text-transform: uppercase;
}

h1 {
  font-family: "Montserrat", sans-serif;
  text-transform: uppercase;
  margin-top: -10px;
}

.invisible {
  background-color: white;
}

.modal {
  display: none;
  /* hidden by default */
  position: fixed;
  z-index: 999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  justify-content: center;
  align-items: center;
}

.modal-content {
  background: #fff;
  padding: 30px;
  border-radius: 12px;
  text-align: center;
  font-family: "Montserrat", sans-serif;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.modal-content h2 {
  margin-bottom: 15px;
}
.modal-content button {
  margin-top: 20px;
  padding: 14px 28px;
  background: linear-gradient(#ff7eb3, #ff4f91);
  color: white;

  border: none;
  border-radius: 14px;
  cursor: pointer;
  font-weight: bold;
  font-size: 1.1em;

  box-shadow: 0 6px 15px rgba(0,0,0,0.3);
  transition: transform 0.1s ease;
}

.modal-content button:active {
  transform: scale(0.95);
}


@keyframes pop {
  0% { transform: scale(0.9); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

#flash {
  position: fixed;
  inset: 0;
  background: white;
  opacity: 0;
  pointer-events: none;
  z-index: 99999;
}

.flash-active {
  animation: flashBoom 0.25s ease-out;
}

@keyframes flashBoom {
  0%   { opacity: 0; }
  30%  { opacity: 0.9; }
  100% { opacity: 0; }
}

.spawn {
  animation: pop 0.15s ease-in-out;
}


/* Combo destroy animation */
.combo-destroy {
  animation: comboPop 0.6s ease forwards;
}

@keyframes comboPop {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.4) rotate(10deg);
    opacity: 0.7;
  }
  100% {
    transform: scale(0);
    opacity: 0;
  }
}
/* Combo sparkle */
.combo {
  animation: sparkle 0.5s ease;
}

@keyframes sparkle {
  0% { box-shadow: 0 0 0 gold; transform: scale(1); }
  50% { box-shadow: 0 0 25px gold; transform: scale(1.3); }
  100% { box-shadow: 0 0 0 transparent; transform: scale(1); }
}

/* Bomb idle animation */
.bomb {
  animation: bombPulse 1.2s infinite ease-in-out;
}

@keyframes bombPulse {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.12); }
  100% { transform: scale(1); }
}

#bg-video {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  object-fit: cover;
  z-index: -2;
  filter: blur(4px) brightness(0.55);
}

/* Optional subtle motion overlay */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: radial-gradient(circle, transparent 40%, rgba(0,0,0,0.6));
  z-index: -1;
}


/* Floating combo text */
.combo-text {
  position: absolute;
  font-size: 36px;
  font-weight: bold;
  color: gold;
  text-shadow: 2px 2px 10px black;
  animation: floatUp 1s ease forwards;
  pointer-events: none;
  z-index: 999;
}

@keyframes floatUp {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-80px); }
}
/* Smooth bomb vanish animation */
.vanish {
  animation: vanish 1200ms cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
}


@keyframes vanish {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  100% {
    transform: scale(0.2);
    opacity: 0;
  }
}


/* Bomb explosion */
.explode {
  animation: explode 0.4s ease forwards;
}

@keyframes explode {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.6); opacity: 0.7; }
  100% { transform: scale(0); opacity: 0; }
}


/* Screen Shake.. */
.shake{
  animation: shake 0.4s;
}

@keyframes shake{
  0% { transform: translate(0);}
  20% { transform: translate(-8px, 4px);}
  40% { transform: translate(8px, -4px);}
  60% { transform: translate(-6px, 2px);}
  80% { transform: translate(6px, -2px);}
  100% { transform: translate(0);}
}

#effects-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
}
.effect-sprite {
  position: absolute;
  width: 100px;
  height: 100px;
  background-image: url("images/explode.png");
  background-size: 300% 300%;
  animation: spriteAnim 0.6s steps(3) forwards;
}

@keyframes spriteAnim {
  from { background-position: 0% 0; }
  to   { background-position: 100% 0; }
}

#moves {
  font-weight: bold;
  color: #ff4f91;
}


/* Particales........ */
.particle {
  position: fixed;
  width: 8px;
  height: 8px;
  background: gold;
  border-radius: 50%;
  pointer-events: none;
  animation: particle 0.6s ease-out forwards;
  z-index: 9999;
}

@keyframes particle{
  from{
    transform: scale(1) translate(0, 0);
    opacity: 1;
  }to{
    transform: scale(0) translate(var(--x), var(--y));
    opacity: 0;
  }
}

.striped-horizontal{
  background-image: linear-gradient(to right, transparent 30%, white 30%, white 40%, transparent 40%);
}

.striped-vertical{
  background-image: linear-gradient(
    to bottom,
    transparent 30%,
    white 30%,
    white 40%,
    transparent 40%
  );
}

@media (max-width: 768px) {
  body {
    justify-content: flex-start;
    padding-top: 20px;
  }

  .score-board {
    margin-bottom: 10px;
  }

  h1 {
    font-size: 1.3rem;
  }

  h3 {
    font-size: 0.9rem;
  }
}

@media (max-width: 480px) {
  :root {
    --grid-size: 95vw;
  }

  .combo-text {
    font-size: 24px;
  }
}

