:root {
  --background: rgb(25, 25, 25);
  --window: rgba(43, 44, 58, 0.7);
  --group: rgb(25, 25, 35);
  --button: rgb(177, 181, 202);
  --highlight: rgb(83, 117, 255);
  --detail: rgb(193, 196, 219);
  --detail-highlight: rgb(82, 120, 248);
  --detail-contrast: rgb(67, 67, 73);
  --highlight-time: 0.2s;
}

* {
  margin: 0;
  padding: 0;
  font-family: 'Courier New', Courier, monospace;
  box-sizing: border-box;
  user-select: none;
  color: var(--detail);
}

h1 {
  text-align: center;
  font-size: large;
  margin-top: 4px;
  margin-bottom: 4px;
}

body {
  background-color: var(--background);
  overflow: hidden;
}

#simulation-screen {
  width: 100%;
  height: 100%;
}

#simulation-screen.hovering {
  cursor: pointer;
}

#simulation-screen.dragging {
  cursor: grab !important;
}

.main-container {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column-reverse;
  pointer-events: none;
}

.horizontal-bar {
  display: flex;
  width: 100%;
  height: auto;
  flex-shrink: 0;
}

.horizontal-bar-inner {
  flex: 1;
  margin: 8px;
  margin-top: 0;
  height: 48px;
  background-color: var(--window);
  display: flex;
  flex-direction: row;
  justify-content: center;
}

.horizontal-bar-segment {
  flex: 1;
  height: 100%;
  display: flex;
  justify-content: center;
  flex-direction: row;
  align-items: center;
  gap: 16px;
  /* border-left: 1px solid var(--outline);
    border-right: 1px solid var(--outline); */
}

.content-container {
  display: flex;
  padding: 8px;
  flex: 1;
  min-height: 0;
}

.side-bar {
  height: 100%;
  width: 360px;
  display: flex;
  flex-direction: column;
  padding: 4px;
  gap: 4px;
  box-sizing: border-box;
  overflow: overlay;
  scrollbar-gutter: stable;
}

.side-bar::-webkit-scrollbar {
  width: 4px;
  background: none;
}

.side-bar::-webkit-scrollbar-thumb {
  background-color: var(--detail);
  border-radius: 2px;
}

.window {
  background-color: var(--window);
  border-radius: 5px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  pointer-events: all;
}

/* #region Collapsible */
collapsible-dropdown {
  padding: 2px;
}

.collapsible-select {
  position: relative;
  padding: 2px;
  transition: color var(--highlight-time);
  width: 100%;
  border-radius: 5px;
}

.collapsible-select::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform: scaleX(1);
  border-bottom: 2px solid;
  border-bottom-color: var(--detail);
  transition: transform 0.2s ease, border-bottom-color var(--highlight-time);
}

.collapsible-select:hover {
  cursor: pointer;
  color: var(--detail-highlight);
}

.collapsible-select:hover::after {
  border-bottom-color: var(--detail-highlight);
}

collapsible-dropdown.expanded .collapsible-select::after {
  transform: scaleX(0);
}

.collapsible-content {
  margin-top: 0px;
  height: 0;
  width: 100%;
  overflow: hidden;
  transition: height 0.2s ease, margin-top var(--highlight-time);
}

collapsible-dropdown.expanded .collapsible-content {
  margin-top: 4px;
}

.collapsible-content-wrapper {
  background-color: var(--group);
  margin: 1px;
  padding: 4px;
  border-radius: 5px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border: 2px solid var(--detail);
  overflow: hidden;
}
/* #endregion */

/* #region Buttons */
button {
  border: none;
  background: var(--button);
  border-radius: 4px;
  padding: 2px;
  color: var(--detail-contrast);
  transition: background-color var(--highlight-time) ease;
}

button:hover {
  cursor: pointer;
  background-color: var(--highlight);
}

.pause-button,
.skip-button,
.skip-button::after,
.skip-button.double::before {
  background: transparent !important;
  border-radius: 0 !important;
  padding: 0 !important;
  box-sizing: border-box;
  width: 0;
  height: 24px;
  border-color: transparent transparent transparent var(--button);
  cursor: pointer;
  transition: border-color var(--highlight-time) !important;
}

.pause-button:hover,
.skip-button:hover,
.skip-button:hover::after,
.skip-button.double:hover::before {
  border-color: transparent transparent transparent var(--highlight);
}

.pause-button {
  border-style: double;
  border-width: 0px 0 0px 20px;
  transition: border-color var(--highlight-time), border-width 0.2s ease !important;
}

.pause-button.paused {
  border-style: solid;
  border-width: 12px 0 12px 20px;
}

.skip-button {
  position: relative;
  margin-right: 2px;
  --rotation: 0;
}

.skip-button.back {
  margin-right: 0;
  margin-left: 2px;
  --rotation: 180deg;
  transform: rotate(180deg);
}

.skip-button.double {
  margin-right: 14px;
}

.skip-button.double.back {
  margin-right: 0;
  margin-left: 14px;
}

.skip-button,
.skip-button.double::before {
  border-style: solid;
  border-width: 12px 0 12px 18px;
}

.skip-button::after {
  content: "";
  position: absolute;
  border-style: solid;
  border-width: 0px 0 0px 4px;
  transform: translate(-4px, -50%);
}

.skip-button.double::after {
  transform: translate(10px, -50%);
}

.skip-button.double::before {
  content: "";
  position: absolute;
  transform: translate(-4px, -50%);
}

@keyframes skip-animation {
  0% {
    transform: rotate(var(--rotation)) translateX(0);
  }

  50% {
    transform: rotate(var(--rotation)) translateX(4px);
  }

  100% {
    transform: rotate(var(--rotation)) translateX(0);
  }
}

.skip-button.skipped {
  animation: skip-animation 0.3s ease-out;
}

.reverse-button {
  position: relative;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: transform 0.4s ease-out !important;
}

.reverse-button::before,
.reverse-button::after {
  content: "";
  position: absolute;
  background: transparent;
  border-style: solid;
  border-width: 12px 12px 0 12px;
  border-color: var(--button) transparent transparent transparent;
  transition: border-color 0.2s;
}

.reverse-button::before {
  transform: translateY(-6px);
}

.reverse-button::after {
  transform: translateY(6px) rotate(180deg);
}

.reverse-button .arrow {
  position: relative;
  height: 2px;
  width: 18px;
  background-color: var(--button);
  transition: background-color 0.2s;
}

.reverse-button .arrow::after {
  position: absolute;
  content: "";
  background: transparent;
  border-style: solid;
  border-width: 0 2px 2px 0;
  border-color: transparent var(--button) var(--button) transparent;
  transform: translate(4px, calc(-50% + 1px)) rotate(-45deg);
  width: 4px;
  height: 4px;
  transition: border-color 0.2s;
}

.reverse-button:hover::after,
.reverse-button:hover::before {
  cursor: pointer;
  border-color: var(--highlight) transparent transparent transparent;
}

.reverse-button:hover .arrow {
  background-color: var(--highlight);
}

.reverse-button:hover .arrow::after {
  border-color: transparent var(--highlight) var(--highlight) transparent;
}

.reverse-button.reversed {
  transform: rotate(180deg);
}

/* #endregion */

/* #region Label */
.display-label {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  font-size: small;
  height: auto;
  gap: 4px;
}

.display-label .label {
  display: flex;
  align-items: center;
  /* word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: nowrap; */
}

.display-label .display {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  width: auto;
  height: auto;
}
/* #endregion */

/* #region Text Input */
.unit-container {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.text-input-container {
  display: flex;
  flex-direction: row;
  justify-content: center;
  height: auto;
  overflow: hidden;
  align-items: center;
  padding: 2px;
  height: 24px;
}

.text-input {
  position: relative;
  outline: none;
  white-space: nowrap;
  transition: color var(--highlight-time);
  min-width: 1ch;
  flex-shrink: 0;
}

.text-input::after {
  position: absolute;
  content: "";
  left: 0;
  height: 100%;
  width: 100%;
  border-bottom: 2px solid var(--highlight);
  transform: scaleX(0);
  transition: transform var(--highlight-time) ease;
  pointer-events: none;
}

.text-input:focus {
  color: var(--detail-highlight);
}

.text-input:focus::after {
  transform: scaleX(1);
}
/* #endregion */

/* #region Quantity Input */
.qi-container {
  display: flex;
  flex-direction: row;
  gap: 4px;
  height: 24px;
}

.qi-slider-container {
  position: relative;
  width: 100px;
  height: 24px;
  display: flex;
  align-items: center;
}

.qi-slider {
  appearance: none;
  width: 100%;
  height: 6px;
  background: transparent;
  z-index: 3;
}

.qi-slider::-webkit-slider-thumb {
  appearance: none;
  cursor: pointer;
  width: 4px;
  height: 18px;
  border-radius: 0;
  background-color: var(--button);
  transition: background-color 0.2s, height 0.2s ease;
}

.qi-slider::-moz-range-thumb {
  appearance: none;
  cursor: pointer;
  width: 4px;
  height: 18px;
  border-radius: 0;
  background-color: var(--button);
  transition: background-color var(--highlight-time), height var(--highlight-time) ease;
}

.qi-slider::-webkit-slider-thumb:hover {
  height: 16px;
  background-color: var(--highlight);
}

.qi-slider::-moz-range-thumb:hover {
  height: 16px;
  background-color: var(--highlight);
}

.qi-slider-background {
  position: absolute;
  width: 100%;
  height: 4px;
  left: 0;
  background-color: var(--button);
  z-index: 0;
}

.qi-slider-progress {
  position: absolute;
  left: 0%;
  right: 100%;
  height: 4px;
  background-color: var(--highlight);
  z-index: 1;
}

.qi-slider-marker-container {
  position: absolute;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  z-index: 2;
}

.qi-slider-marker-container div {
  width: 1px;
  height: 8px;
  background-color: var(--button);
  transition: background-color var(--highlight-time);
}

.qi-slider-marker-container div.highlighted {
  background-color: var(--highlight) !important;
}
/* #endregion */

/* #region Item Lister */
.item-list-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  height: auto;
}

.item-create {
  order: 1000;
}

.listed-item {
  display: flex;
  flex-direction: column;
  border: 1px dashed var(--detail);
  padding: 4px;
  gap: 4px;
}

.item-delete {
  order: 1000;
}
/* #endregion */

/* #region Vector Input */
.ai-container, .vi-container, .vi-format-container, .vi-component-container {
  display: flex;
  flex-direction: row;
  align-items: center;
  height: 24px;
}

.vi-container {
  gap: 6px;
}

.vi-format-container.hidden {
  display: none;
}
/* #endregion */

/* #region Option Select */
.option-select {
  position: relative;
  display: inline-block;
  overflow: visible;
}

.option-select::after {
  content: "";
  position: absolute;
  border-bottom: 2px solid var(--detail);
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform: scaleX(1);
  transition: transform 0.2s ease, border-color var(--highlight-time);
  pointer-events: none;
}

.option-select:hover::after {
  border-color: var(--detail-highlight);
}

.option-select.showing::after {
  transform: scaleX(0);
}

.option-selector {
  text-align: center;
  width: 100%;
}

.option-container {
  position: absolute;
  top: calc(100% + 4px);
  display: inline-block;
  z-index: 10;
  height: 0;
  transition: height 0.2s ease;
  overflow: hidden;
}

.option-wrapper {
  display: flex;
  flex-direction: column;
  background-color: var(--button);
  border-radius: 4px;
  overflow: hidden;
}

.option-item {
  padding: 2px;
  color: var(--detail-contrast);
  transition: background-color var(--highlight-time);
  white-space: nowrap;
}

.option-item:hover, .option-item.selected {
  background-color: var(--highlight);
}
/* #endregion */

/* .sidebar-toggle {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 1000;
  width: 32px;
  height: 32px;
  background: var(--button);
  border-radius: 4px;
  transition: transform 0.3s;
}

.sidebar-toggle::before {
  content: "☰";
  font-size: 24px;
  color: var(--detail-contrast);
}

@media screen and (max-width: 768px) {
  .main-container {
    flex-direction: column;
  }

  .content-container {
    position: fixed;
    top: 0;
    left: -100%;
    width: 75vw;
    height: 100vh;
    padding: 0;
    z-index: 999;
    transition: left 0.3s ease;
    background: var(--window);
    box-shadow: 4px 0 12px rgba(0, 0, 0, 0.2);
  }

  .content-container.active {
    left: 0;
  }

  .side-bar {
    width: 100%;
    height: 100%;
    padding: 16px;
    border-radius: 0;
  }

  .sidebar-toggle {
    display: block;
  }

  .sidebar-toggle.active {
    transform: rotate(90deg);
  }

  .horizontal-bar {
    margin-top: 48px;
  }

  .content-container.active~.main-container::after {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 998;
  }
}

@media screen and (max-width: 768px) {
  .horizontal-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100vw;
    padding: 8px;
    box-sizing: border-box;
    background: var(--window);
    z-index: 1001;
    transform-origin: bottom left;
  }

  .horizontal-bar-inner {
    width: 100%;
    height: auto;
    margin: 0;
    padding: 8px;
    gap: 8px;
    display: flex;
    justify-content: center;
    transform: scale(1);
    transition: transform 0.2s;
  }

  @media screen and (max-width: 480px) {
    .horizontal-bar-inner {
      transform: scale(0.9);
    }
  }

  @media screen and (max-width: 400px) {
    .horizontal-bar-inner {
      transform: scale(0.8);
    }
  }

  @media screen and (max-width: 360px) {
    .horizontal-bar-inner {
      transform: scale(0.7);
    }
  }

  @media screen and (max-width: 320px) {
    .horizontal-bar-inner {
      transform: scale(0.65);
    }
  }

  .horizontal-bar-segment {
    gap: 8px;
    padding: 0 4px;
  }

  button {
    min-width: 36px;
    min-height: 36px;
  }

  .horizontal-bar-segment>div {
    font-size: 0.9em;
  }

  .qi-slider-container {
    width: 80px;
  }

  quantity-input {
    min-width: 120px;
  }
} */