:root {
  --tile-size: 64px;
  --cols: 9;
  --rows: 9;
  --gap: 6px;
}

html,
body {
  height: 100%;
  margin: 0;
  font-family: Inter, system-ui, Segoe UI, Roboto, "Helvetica Neue", Arial;
}
body {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #0f172a, #071032);
  color: #fff;
}

.game-wrap {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

/* sidebar */
.hud {
  width: 240px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  box-shadow: 0 6px 24px rgba(2, 6, 23, 0.6);
}
.hud h1 {
  margin: 0 0 8px;
  font-size: 18px;
}
.score {
  font-size: 28px;
  font-weight: 700;
  margin: 8px 0;
}
.controls {
  margin-top: 12px;
  display: flex;
  gap: 8px;
}
.btn {
  background: #0ea5e9;
  border: none;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  color: #04233b;
}
.muted {
  background: #94a3b8;
}

/* board container */
.board-wrap {
  padding: 10px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.02),
    rgba(255, 255, 255, 0.01)
  );
  border-radius: 14px;
}
#board {
  display: grid;
  grid-template-columns: repeat(var(--cols), var(--tile-size));
  grid-gap: var(--gap);
  width: calc(var(--tile-size) * var(--cols) + var(--gap) * (var(--cols) - 1));
  height: calc(var(--tile-size) * var(--rows) + var(--gap) * (var(--rows) - 1));
  position: relative;
}

/* tile visuals */
.tile {
  width: var(--tile-size);
  height: var(--tile-size);
  border-radius: 10px;
  background-size: cover;
  background-position: center;
  box-shadow: 0 6px 12px rgba(2, 6, 23, 0.5);
  user-select: none;
  touch-action: none;
  position: relative;
  transform-origin: center;
  transition: transform 220ms cubic-bezier(0.2, 0.9, 0.2, 1), opacity 220ms;
}

/* blank tile is transparent */
.tile.blank {
  opacity: 0;
}

/* special candy styles (visual overlay) */
.stripe-vertical::after,
.stripe-horizontal::after {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 8px;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.25),
    rgba(0, 0, 0, 0.05)
  );
  mix-blend-mode: overlay;
}
.stripe-vertical::after {
  background: repeating-linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.2) 0 4px,
    transparent 4px 8px
  );
}
.stripe-horizontal::after {
  background: repeating-linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.2) 0 4px,
    transparent 4px 8px
  );
}

.wrapped {
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6) inset;
}
.color-bomb {
  border: 4px solid rgba(255, 255, 255, 0.2);
  background-image: conic-gradient(
    from 0deg,
    #fff,
    #f0f,
    #ff0,
    #0ff,
    #0f0,
    #f00,
    #fff
  );
  filter: grayscale(0.05);
}

/* small particle/boom */
.particle {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0.9;
}

/* combo badge */
.combo-badge {
  position: absolute;
  left: 50%;
  top: -32px;
  transform: translateX(-50%);
  background: #fffb;
  border-radius: 999px;
  padding: 6px 10px;
  color: #04233b;
  font-weight: 700;
  box-shadow: 0 6px 18px rgba(3, 7, 18, 0.6);
}

/* responsive */
@media (max-width: 700px) {
  .game-wrap {
    flex-direction: column;
    align-items: center;
  }
  .hud {
    width: 100%;
    max-width: 420px;
  }
}


@media (max-width: 600px) {
  :root {
    --tile-size: 42px;   /* smaller tiles for phones */
    --gap: 4px;
  }
}

@media (max-width: 400px) {
  :root {
    --tile-size: 34px;   /* very small screens */
    --gap: 3px;
  }
}
