*, *::after, *::before {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  scrollbar-width: thin;
  font-family: "Sans-serif";
  font-weight: 500;
  user-select: none;
}

#bg-image {
  position: absolute;
  min-width: 100vw;
  min-height: 100vh;
  z-index: -1;
  background-image: url(./img/bg-image-jpg.jpg);
  background-size: cover;
  opacity: 0.5;
}

header {
  z-index: 3;
  width: 100vw;
  height: min(90px, 20vh);
  background-color: rgb(223, 194, 228);
  box-shadow: 0px 5px 5px rgb(220, 199, 224), inset 0px 5px 5px rgb(217, 181, 223);
  position: fixed;
  display: flex;
  align-items: center;
  flex-direction: column-reverse;
  margin: 0;
  padding: 5px;
  overflow: hidden;
}

.running-line {
  position: absolute;
  display: block;
  padding: 5px;
  text-align: center;
  font-size: min(2vw, 1em);
  white-space: nowrap;
}

main {
  padding-top: 100px;
}

#container-product-cards {
  display: grid;
  height: 80vh;
  width: 80vw;
  margin: 0 auto;
  grid-template-columns: repeat(4, 1fr);
  justify-items: center;
  text-align: center;
  overflow-y: auto;
  scrollbar-width: none;
}

.product-card {
  position: relative;
  display: inline;
  width: 300px;
  height: 200px;
  border: 1px solid rgba(49, 0, 105, 0.4);
  background-color: rgba(252, 247, 255, 0.75);
  margin: 20px;
}

#control-panel {
  position: relative;
  grid-column: 2 / 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  width: 650px;
  height: 200px;
  border: 1px solid rgba(69, 0, 139, 0.4);
  background-color: rgba(252, 247, 255, 0.75);
  margin: 20px;
}

#control-panel__shares-set-bar {
  margin: 10px;
  display: flex;
  gap: 15px;
  font-size: 12px;
}

#control-panel__balance-section {
  display: grid;
  grid-template-columns: 3fr 2fr 3fr;
  width: 96%;
  gap: 10px;
}

#control-panel__balance-section__outcome,
#control-panel__balance-section__income {
  display: flex;
  overflow: hidden;
  align-items: center;
  background-color: rgba(241, 223, 251, 0.75);
  box-shadow: 0px 0px 5px rgba(230, 154, 255, 0.6);
  gap: 10px;
  text-shadow:  rgba(255, 0, 0, 0.25);
}

#control-panel__balance-section__outcome {
  flex-direction: row-reverse;
}

#control-panel__balance-section__balance {
  font-size: 24px;
  margin: 5px;
}

#control-panel__log {
  overflow: hidden;
  margin: 10px auto;
  width: 96%;
  height: 60px;
  background-color: rgba(241, 223, 251, 0.75);
  box-shadow: 0px 0px 5px rgba(230, 154, 255, 0.6);
}

#control-panel__log > span {
  display: block;
}

.product-card__info-icon {
  position: absolute;
  left: 0;
  top: 0;
  width: 20px;
  height: 20px;
  background-color: rgba(44, 169, 253, 0.101);
  border-bottom: 1px solid rgba(53, 53, 71, 0.214);
  border-right: 1px solid rgba(53, 53, 71, 0.214);
  cursor: help;
}

.product-card__info-icon:hover {
  transition: all 1s;
  background-color: rgb(246, 218, 255);
  border-bottom: 1px solid rgb(246, 218, 255);
  border-right: 1px solid rgb(246, 218, 255);
}

.product-card__info-section {
  position: absolute;
  z-index: 1;
  left: 0;
  top: 30px;
  bottom: 0;
  padding: 5px;
  font-size: 16px;
  align-content: center;
  background-color: rgb(246, 218, 255);
}

.product-card__info-section-bridge {
  position: absolute;
  z-index: 2;
  width: 19.5px;
  height: 11px;
  top: 20px;
  background-color: rgb(246, 218, 255);
}

.product-card__ticker {
  position: absolute;
  right: 0;
  padding: 5px;
  border: 1px solid rgba(224, 3, 3, 0.539);
  background-color: rgb(255, 246, 246);
}

.product-card__name {
  margin: 50px 0 20px 0;
}

.product-card__price {
  font-size: 18px;
}

.product-card__button {
  margin: 10px 5px;
  width: 65px;
  height: 30px;
  font-size: 20px;
  cursor: pointer;
}

footer {
  z-index: 3;
  position: fixed;
  bottom: 0;
  width: 100vw;
  height: 24px;
  background-color: rgb(223, 194, 228);
  box-shadow: 0px 5px 5px rgb(217, 181, 223), inset 0px 5px 5px rgb(217, 181, 223);
  display: flex;
  justify-content: space-around;
  align-items: center;
  font-size: min(1.6vw, 1em);
}


@media screen and (max-width: 1734px) {

  /* Первая краевая точка - грид (4, 1fr) начинает кривиться и не влезать */

  #container-product-cards {
    height: 80vh;
    width: 60vw;
    grid-template-columns: repeat(2, 1fr);
  }

  #control-panel {
    grid-column: 1 / 3;
    grid-row: 2 / 3;
  }
}

@media screen and (max-width: 1164px) {

  /* Первая краевая точка - грид (2, 1fr) начинает кривиться и не влезать. Тут уже пора переходить на совершенно мобильную версию */

  /* Надо пересадить все величины на относительные, чтобы не было супермелко на телефонах */

  header {
    height: max(42px, 10vh);
  }
  main {
    display: flex;
    align-items: center;
    padding-top: 16vh;
  }

  #button-scroll-left {
    background: url(./img/scroll-arrow-left.png);
  }

  #button-scroll-right {
    background: url(./img/scroll-arrow-right.png);
    
  }

  #button-scroll-left,
  #button-scroll-right {
    border: none;
    background-size: 5vw;
    padding: 2vw;
    opacity: 0.1;
    transition: all 0.2s;
  }

  #button-scroll-left:hover,
  #button-scroll-right:hover {
    opacity: 0.3;
  }

  #container-product-cards {
    display: flex;
    height: 54vh;
    height: 42vh;
    width: 80vw;
    overflow-x: scroll;
    scrollbar-width: none;
    align-items: center;
  }
  
  .product-card {
    min-width: min(300px, 70%);
    height: 80%;
    max-height: 200px;
    min-height: 125px;
    margin: 2vw;
  }

  .product-card__name {
    font-size: max(14px, 2vw);
  }

  .product-card__ticker {
    font-size: max(12px, 1.6vw);
    padding: 0.4vh;
  }

  #control-panel__balance-section__current-portfolio-price {
    font-size: max(14px, 1.6vw);
  }

  .product-card__info-section {
    font-size: max(12px, 1.4vw);
  }

  #control-panel__balance-section__balance {
    font-size: max(18px, 3vw);
  }

  .product-card__button {
    margin: 5px 2px;
    width: max(56px, 7vw);
    height: max(56px, 7vw);
    font-size: 20px;
  }

  .product-card__name {
    margin: 3vh 0 2vh 0;
  }
  
  #control-panel {
    position: fixed;
    left: 1vw;
    right: 1vw;
    bottom: 4vh;
    width: 90%;
    height: 24vh;
    min-height: 124px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
  }

  #control-panel__shares-set-bar {
    display: flex;
    gap: 1vw;
    font-size: 1.6vw;
  }

  #control-panel__balance-section__outcome,
  #control-panel__balance-section__income,
  #control-panel__log {
    font-size: min(4vw, 3.5vh);
  }
}