*,
*::before,
*::after {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
}

:root {
  --graph-area-bg: #040222;
  --graph-area-two-bg: rgb(24, 173, 166);
  --node-circle-fill: white;
  --highlighted: rgb(14, 168, 0);
  --node-label-fill: rgb(0, 0, 0);
  --edge-stroke: white;
}

body {
  display: flex;
  flex-direction: column;
  height: 100vh;
  font-family: "Open Sans", sans-serif;
}

button {
  cursor: pointer;
}

button {
  font-family: inherit;
}

#main-area {
  display: flex;
  flex-direction: row;
  flex: 4;
}

#buttons-area {
  flex: 1;
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  gap: 2rem;
  padding: 1rem 2rem;
  align-items: center;
  background-color: rgb(7, 7, 17);
}

#graph-area {
  flex: 1;
  background-color: var(--graph-area-bg);
}

#graph-area-two {
  flex: 0;
  background-color: var(--graph-area-two-bg);
}

#graph-area-two.active {
  flex: 1;
}

.node {
  transform-origin: center;
}

.node.highlighted .node-circle {
  fill: var(--highlighted);
  filter: drop-shadow(0 0 20px var(--highlighted));
}

.node.highlighted .node-label {
  fill: white;
}

.node.selected .node-circle {
  stroke: red;
  stroke-width: 5px;
}

.node-circle {
  fill: var(--node-circle-fill);
  transition: 0.3s ease;
  transform-origin: center;
  animation: node-circle-appear 0.3s ease forwards;
}

@keyframes node-circle-appear {
  from {
    transform: scale(0);
  }
  to {
    transform: scale(1);
    color: #3e3eff;
  }
}

.node-label,
.node-distance-label {
  fill: var(--node-label-fill);
  font-weight: 600;
  font-size: 1.5rem;
}

.node-distance-label {
  opacity: 0;
  fill: white;
  font-size: 1.3rem;
}

#graph-area.animation .node-distance-label {
  opacity: 1;
}

.node:hover .node-circle {
  filter: drop-shadow(0 0 30px rgba(255, 255, 255, 0.3));
}

.edge {
  fill: none;
  stroke: var(--edge-stroke);
  stroke-width: 4px;
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  animation: stroke-anim 2s ease forwards;
}

.edge.highlighted {
  stroke: var(--highlighted);
  box-shadow: 0 0 30px 0 var(--highlighted);
  filter: drop-shadow(0 0 20px var(--highlighted));
}

.edge.selected {
  stroke: red;
}

@keyframes stroke-anim {
  to {
    stroke-dashoffset: 0;
  }
}

#graph-area-two .special-edge {
  stroke-dasharray: 6, 10;
  animation: none;
}

.graph-infos-area {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
  position: fixed;
  top: 1rem;
  left: 1rem;
  color: white;
  padding: 1rem 2rem;
}

.main-title {
  font-weight: 900;
}

.graph-order,
.graph-size,
.graph-connected,
.graph-is-tree {
  font-size: 1.5rem;
  font-weight: 500;
}

.btn {
  border: 2px solid var(--main-color);
  border-radius: 30px;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--main-color);
  padding: 1rem 3.5rem;
  background-color: transparent;
  cursor: pointer;
  transition: 0.2s ease;
}

.btn:hover {
  background-color: var(--hover-color);
}

.popup {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0.8rem 5rem;
  position: fixed;
  left: 50%;
  border-radius: 30px;
  transform: translate(-50%, -50%);
  bottom: 2rem;
  background-color: var(--bg-color);
  color: white;
  transform-origin: center;
  transition: 0.4s ease;
  animation: popup-appear 0.35s ease;
}

@keyframes popup-appear {
  from {
    transform: translate(-50%, 200%);
  }
}
.fade-out {
  transform: translate(-50%, 300%);
}

.popup-text {
  font-size: 1.4rem;
  font-weight: 600;
}

.help-btn {
  position: fixed;
  z-index: 9;
  top: 40px;
  right: 40px;
  width: 50px;
  height: 50px;
  font-size: 1.5rem;
  font-weight: 900;
  border: 2px solid white;
  background-color: transparent;
  color: white;
  border-radius: 50%;
  transition: 0.3s ease;
}

.help-btn:hover {
  background-color: white;
  color: var(--graph-area-bg);
}

#help-screen {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 30px;
  background-color: white;
  display: flex;
  flex-direction: column;
  gap: 30px;
  justify-content: center;
  align-items: center;
  padding: 40px;
  font-size: 1.6rem;
  font-weight: 500;
  max-width: 500px;
  transition: 0.3s ease;
}

#close-help-screen {
  position: absolute;
  top: 10px;
  right: 10px;
  border: none;
  color: white;
  font-size: 1.2rem;
  font-weight: 900;
  width: 30px;
  height: 30px;
  border-radius: 30px;
  background-color: rgb(255, 60, 60);
}

#help-screen.close {
  transform: translate(-50%, -200%);
  opacity: 0;
}
