:root {
  --cell-size: 45px;
  --gap-size: 7px;
  --grid-size: 15;
}

body {
  font-family: 'Poppins', sans-serif;
  text-align: center;
  background: #111;
  color: white;
}

#gameWrapper {
  display: none;
  position: relative;
  display: inline-block;
  padding: 20px;
}

#grid {
  display: grid;
  grid-template-columns: repeat(var(--grid-size), var(--cell-size));
  gap: var(--gap-size);

  margin:0px;
  padding: 12px;position: relative;
  z-index: 10;
  width: calc(
    (var(--cell-size) * var(--grid-size)) +
    (var(--gap-size) * (var(--grid-size) - 1))
  );
  background: rgba(0, 0, 0, 0.85); /* 🔥 main black backing */
  border-radius: 16px;

  box-shadow: 
    0 0 0 2px rgba(255,255,255,0.05), 
    0 0 30px rgba(0,0,0,0.6);
}


.cell {
  width: 40px;
  height: 40px;
  border-radius: 10px;

  background: #2a2a2a; /* 👈 softer grey */
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: inset 0 0 6px rgba(0,0,0,0.6);

  display: flex;
  align-items: center;
  justify-content: center;
  
  font-weight: bold;
  color: #e5e5e5;

  transition: all 0.2s ease;
}

.selected {
  background: linear-gradient(135deg, #00e5ff, #00bcd4);
  transform: scale(1.15);
  box-shadow: 0 0 10px rgba(0,229,255,0.8);
}

.found {
  background: linear-gradient(135deg, #22c55e, #4ade80);
  color: white;
  box-shadow: 0 0 12px rgba(34,197,94,0.8);
}

#winScreen {
  position: fixed;
  top:0;
  left:0;
  width:100%;
  height:100%;
  background: rgba(0,0,0,0.95);
  display:none;
  align-items:center;
  justify-content:center;
  flex-direction:column;
  z-index:999;
}

#resetBtn {
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  padding:12px 24px;
  font-size:18px;
  border:none;
  border-radius:8px;
  background:#00e5ff;
  cursor:pointer;
}

.dim {
  opacity: 0.15;
  transition: opacity 0.2s ease;
}

/*
@media (max-width: 600px) {
  #grid {
    grid-template-columns: repeat(15, 28px);
  }

  .cell {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }  
}
*/

.bg-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  overflow: hidden; /* 🔥 important for cropping */
}

@media (min-width:1350px) {
  .hero-bg {
    width: 1080px;
  }
}

#grid, .cell {
  user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
}

#trailCanvas {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 5;
}

.word-list {
  margin-top: 24px;
  display: grid;
  grid-template-columns: repeat(4, 1fr); /* 🔲 square layout */
  gap: 10px;

  width: 100%;
  margin-left: auto;
  margin-right: auto;
}

.word-item {
  padding: 20px;
  border-radius: 10px;

  background: #1f1f1f;
  color: #e5e5e5;

  font-weight: bold; /* 🔥 stronger text */
  text-align: center;
  letter-spacing: 1px;

  transition: all 0.25s ease;
}

.word-item.found {
  background: #22c55e;
  color: white;
  transform: scale(1.025);
}

/* Logo */
.brand-logo img {
  width: 400px;
}

.brand-logo {
  display: flex;
  justify-content: space-between; 
  align-items: center;

  width: 100%;
  margin-bottom: 10px;
}

.header {
  margin-top: 100px;
  margin-bottom: 60px;
  padding-left: 15%;
  padding-right: 15%;
  }

#timer {
  font-weight: bold;
  font-size: 70px;
  color: #fff;

  padding: 6px 12px;
  border-radius: 8px;

  font-family: 'Bebas Neue', sans-serif;
  letter-spacing: 1px;
}

@keyframes pulseWarning {
  0% { transform: scale(1); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

.timer-warning {
  animation: pulseWarning 0.8s infinite;
}

@keyframes screenShake {
  0% { transform: translate(0, 0); }
  20% { transform: translate(-4px, 2px); }
  40% { transform: translate(4px, -2px); }
  60% { transform: translate(-3px, 1px); }
  80% { transform: translate(3px, -1px); }
  100% { transform: translate(0, 0); }
}

.shake1 {
  animation: screenShake 0.8s infinite;
}

.shake2 {
  animation: screenShake 0.6s infinite;
}

.shake3 {
   animation: screenShake 0.4s infinite;
}

.shake4 {
  animation: screenShake 0.2s infinite; 
}

#winScreen {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);

  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;

  text-align: center;
  color: white;
}

#resultCount {
  font-size: 2vh;
  margin-bottom: 10px;
}

#resultMessage {
  font-size: 1.5vh;
  margin-bottom: 50px;
}

#resetBtn {
  background: #22c55e;
  color: rgb(255, 255, 255);

  border: none;
  border-radius: 10px;

  padding: 12px 24px;
  font-size: 1vh;
  font-weight: bold;

  cursor: pointer;

  box-shadow: 0 0 10px rgba(34,197,94,0.6);

  transition: all 0.2s ease;
}

#resetBtn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 20px rgba(34,197,94,0.9);
}

#resetBtn:active {
  transform: scale(0.95);
  box-shadow: 0 0 8px rgba(34,197,94,0.5);
}

@keyframes glowPulse {
  0% { box-shadow: 0 0 10px rgba(34,197,94,0.6); }
  50% { box-shadow: 0 0 25px rgba(34,197,94,1); }
  100% { box-shadow: 0 0 10px rgba(34,197,94,0.6); }
}

#resetBtn {
  animation: glowPulse 5s ease-in-out infinite;
}

.hide {
  display: none;
}

.show {
  display: block;
}

/* Final States */

/* Hero final position */
.hero-in-game {
  position: absolute;
  bottom: -40px;
  left: 50%;
  transform: translateX(-50%) scale(0.6);
}

/* Logo final position */
.logo-in-game {
  position: absolute;
  top: 20px;
  left: 20px;
  transform: scale(0.7);
}

.main-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.curve-bg {
  position: absolute;
  bottom: -60px; /* 👈 push down to show only top part */
  width: 100%;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0.95;
}

.hero-bg {
  position: absolute;
  bottom: -200px; /* 👈 push down to show only top part */
  width: 80%;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0.95;
  z-index: 1;
}