* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

body {
  font-family: 'Phantom Sans', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #000;
  color: #fff;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overflow: hidden;
  padding: 0;
  margin: 0;
}

.game-container {
  position: absolute;
  width: 100%;
  max-width: 1200px;
  display: flex;
  margin: 0;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.bg{
  margin: 0;
}

h1 {
  font-size: clamp(1.8rem, 4vw, 3rem);
  font-weight: 700;
  background:#6fd;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-align: center;
  margin-bottom: 1rem;
}

#timer {
  font-size: clamp(1rem, 2.5vw, 1.4rem);
  font-weight: 600;
  color: #64ffda;
  background: rgba(100, 255, 218, 0.1);
  padding: 0.75rem 1.5rem;
  border-radius: 50px;
  border: 2px solid rgba(100, 255, 218, 0.3);
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
}

#score {
  font-size: clamp(1rem, 2.5vw, 1.4rem);
  font-weight: 560;
  color: #64d0ff;
  background: rgba(100, 237, 255, 0.1);
  padding: 0.7rem 1rem;
  border-radius: 50px;
  border: 2px solid rgba(100, 196, 255, 0.3);
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
}

.blob {
  font-size: clamp(1rem, 2.5vw, 1.4rem);
  font-weight: 600;
  color: #64ffda;
  padding: 0;
  margin-top: 1rem;
  border-radius: 50px;
  transition: all 0.3s ease;
}

.reaction-container {
  width: 100%;
  padding: 0;
  display: flex;
  justify-content: center;
  min-height: 120px;
  align-items: center;
  border-radius: 20px;
  overflow: hidden;
  position: relative;
}


.reaction-bars {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  z-index: 3;
  pointer-events: none;
}

.progress-line {
  position: relative;
  height: 8px;
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  display: flex;
  align-items: center;
  font-size: 0.6rem;
  color: #fff;
  overflow: hidden;
}

.bar-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  opacity: 1;
  z-index: 1;
}

.bar-left,
.bar-right {
  position: relative;
  z-index: 2;
  padding: 0 4px;
  white-space: nowrap;
}

.bar-left {
  flex: 1;
}

.bar-right {
  flex-shrink: 0;
}

.reaction {
  font-size: clamp(1.2rem, 3vw, 2rem);
  width: 100%;
  user-select: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 2rem;
  background: #fff1;
  border-radius: 20px;
  border: 1px solid #fff2;
  backdrop-filter: blur(10px);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.reaction::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: #fff1;
  transition: left 0.5s ease;
}

.compound {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  position: relative;
  margin: 0.2rem;
}

.coef {
  min-width: 40px;
  height: 40px;
  font-size: clamp(1rem, 2vw, 1.3rem);
  font-weight: 700;
  background-color: #0e2822;
  border: 2px solid rgba(80, 255, 182, 0.863);
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.coef:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 8px 25px rgba(102, 234, 194, 0.5);
  border-color: rgb(71, 255, 212);
}

.coef:active {
  transform: translateY(0) scale(0.95);
}

.formula {
  font-size: clamp(1.1rem, 2.5vw, 1.6rem);
  font-weight: 600;
  color: #e2e8f0;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.formula sub {
  font-size: 0.7em;
  color: #64ffda;
}

.minus-btn {
  position: absolute;
  bottom: -10px;
  left: 24px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff6b6b, #ee5a52);
  color: white;
  font-weight: bold;
  font-size: 14px;
  cursor: pointer;
  border: 2px solid rgba(255, 255, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(255, 107, 107, 0.4);
}

.minus-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 15px rgba(255, 107, 107, 0.6);
}

.arrow,
.plus {
  font-size: clamp(1.2rem, 3vw, 2rem);
  font-weight: bold;
  color: #64ffda;
  margin: 0 0.5rem;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.arrow {
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  margin: 0 1rem;
}

.blur-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  backdrop-filter: blur(10px);
  background: rgba(15, 15, 35, 0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  font-weight: 700;
  z-index: 20;
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 1;
  border-radius: 20px;
  cursor: pointer;
  color: #64ffda;
  text-shadow: 0 2px 10px rgba(100, 255, 218, 0.5);
}

.blur-overlay.hidden {
  backdrop-filter: blur(0px);
  background: rgba(15, 15, 35, 0.1);
  pointer-events: none;
  opacity: 0;
}

.blur-overlay:hover {
  background: rgba(15, 15, 35, 0.4);
  text-shadow: 0 2px 15px rgba(100, 255, 218, 0.8);
}

#tutorial {
  font-size: clamp(0.9rem, 2vw, 1.1rem);
  color: #94a3b8;
  text-align: center;
  background: rgba(255, 255, 255, 0.05);
  padding: 1rem 2rem;
  border-radius: 15px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  max-width: 600px;
  line-height: 1.6;
}

.success-animation {
  animation: successPulse 0.6s ease-out;
}

@keyframes successPulse {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.05);
  }

  100% {
    transform: scale(1);
  }
}

.balanced-reaction {
  border-color: rgba(100, 255, 218, 0.5) !important;
  box-shadow: 0 0 30px rgba(100, 255, 218, 0.3);
}

@media screen and (orientation: landscape){
  .reaction:hover::before {
  left: 100%;
}
}

@media (max-width: 768px) {
  body {
    padding: 0.5rem;
  }

  .game-container {
    gap: 1.5rem;
  }

  .reaction {
    padding: 1.5rem 1rem;
    gap: 0.3rem;
  }

  .compound {
    margin: 0.1rem;
  }

  .coef {
    min-width: 35px;
    height: 35px;
  }

  .arrow,
  .plus {
    margin: 0 0.3rem;
  }

  .arrow {
    margin: 0 0.5rem;
  }

  #tutorial {
    padding: 0.8rem 1.5rem;
    margin: 0 0.5rem;
  }
}

@media (max-width: 480px) {
  .reaction {
    padding: 1rem 0.5rem;
  }

  .coef {
    min-width: 32px;
    height: 32px;
  }

  .minus-btn {
    width: 20px;
    height: 20px;
    font-size: 12px;
    top: -6px;
    right: -6px;
  }
}
