:root {
  --face: #adadad;
  --light: #eeeeee;
  --shadow: #606060;
  --dark: #252525;

  /* Toolbox sizing */
  --tool-size: 96px;
  --tool-gap: 7px;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  color: #080808;
  background-color: #666666;
  background-image:
    linear-gradient(45deg, #595959 25%, transparent 25%),
    linear-gradient(-45deg, #595959 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #595959 75%),
    linear-gradient(-45deg, transparent 75%, #595959 75%);

  background-size: 12px 12px;

  background-position:
    0 0,
    0 6px,
    6px -6px,
    -6px 0;

  font-family: "Courier New", "Lucida Console", monospace;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: -0.25px;
  image-rendering: pixelated;
}

button,
input,
select,
textarea {
  color: #080808;
  font: inherit;
  font-weight: 400;
}

button {
  user-select: none;
}

.desktop-window {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* TITLE BAR */

.title-bar {
  min-height: 38px;
  display: flex;
  align-items: center;
  padding: 4px 7px;
  background: #b7b7b7;
  border-top: 2px solid #eeeeee;
  border-left: 2px solid #eeeeee;
  border-right: 3px solid #383838;
  border-bottom: 3px solid #383838;

  box-shadow:
    inset 0 -1px #777777,
    inset 0 1px #dddddd;
}

.title-logo {
  width: 22px;
  height: 22px;
  margin: 0 8px 0 2px;
  object-fit: contain;
  image-rendering: pixelated;
}

.title-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.window-controls {
  display: flex;
  gap: 5px;
  margin-left: 12px;
}

/* BEVELED BUTTONS */

.bevel-button {
  background: var(--face);
  border-top: 2px solid var(--light);
  border-left: 2px solid var(--light);
  border-right: 2px solid var(--dark);
  border-bottom: 2px solid var(--dark);
  cursor: pointer;
}

.bevel-button:hover:not(:disabled) {
  background: #b7b7b7;
}

.bevel-button:active:not(:disabled),
.bevel-button.active {
  border-top-color: var(--dark);
  border-left-color: var(--dark);
  border-right-color: var(--light);
  border-bottom-color: var(--light);
  background: #999999;
}

.bevel-button:focus-visible {
  outline: 1px dotted #000000;
  outline-offset: -5px;
}

.bevel-button:disabled {
  color: #666666;
  cursor: default;
}

.window-button {
  width: 28px;
  height: 25px;
  padding: 0;
  display: grid;
  place-items: center;
  line-height: 1;
}

/* TOP MENU */

.menu-groove {
  position: relative;
  z-index: 20;
  padding: 5px 6px;
  background: #aaaaaa;
  border-top: 2px solid #e5e5e5;
  border-bottom: 3px solid #3e3e3e;

  box-shadow:
    inset 0 2px #cfcfcf,
    inset 0 -1px #737373;
}

.menu-row {
  display: flex;
  gap: 5px;
}

.menu {
  position: relative;
}

.menu-button {
  min-width: 49px;
  height: 29px;
  padding: 2px 11px;
}

.menu-button.open {
  border-top-color: var(--dark);
  border-left-color: var(--dark);
  border-right-color: var(--light);
  border-bottom-color: var(--light);
  background: #999999;
}

.menu-dropdown {
  display: none;
  position: absolute;
  left: 0;
  top: 31px;
  min-width: 205px;
  padding: 4px;
  background: #adadad;
  border-top: 2px solid #eeeeee;
  border-left: 2px solid #eeeeee;
  border-right: 2px solid #282828;
  border-bottom: 2px solid #282828;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.4);
}

.menu.open .menu-dropdown {
  display: block;
}

.menu-item {
  width: 100%;
  height: 27px;
  padding: 3px 9px;
  text-align: left;
  background: transparent;
  border: 0;
  cursor: pointer;
  white-space: nowrap;
}

.menu-item:hover,
.menu-item:focus-visible {
  color: #ffffff;
  background: #222266;
  outline: 0;
}

.menu-separator {
  height: 2px;
  margin: 4px 2px;
  background: #666666;
  border-bottom: 1px solid #dddddd;
}

/* MAIN WORKSPACE */

.workspace {
  flex: 1;
  min-height: 0;
  display: grid;

  grid-template-columns:
    clamp(215px, 21vw, 270px)
    minmax(420px, 1fr);

  gap: 12px;
  padding: 10px 12px;
}

.empty-left-space {
  min-width: 0;
}

/* TOOLBOX */

.toolbox {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 7px;
  background: #adadad;
  border-top: 3px solid #eeeeee;
  border-left: 3px solid #eeeeee;
  border-right: 3px solid #3b3b3b;
  border-bottom: 3px solid #3b3b3b;

  box-shadow:
    inset 0 0 0 1px #858585,
    2px 2px 0 #555555;
}

.toolbox-title {
  flex: 0 0 auto;
  margin: 0 0 7px;
  text-align: center;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 20px;
  font-weight: 400;
  line-height: 1;
}

.toolbox-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-color: #777777 #b5b5b5;
  scrollbar-width: thin;
}

.toolbox-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, var(--tool-size)));
  grid-auto-rows: var(--tool-size);
  justify-content: center;
  align-content: start;
  gap: var(--tool-gap);
}

.tool-button {
  position: relative;
  width: var(--tool-size);
  height: var(--tool-size);
  min-width: 0;
  padding: 4px 3px 3px;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;

  background: #adadad;
  border-top: 2px solid #eeeeee;
  border-left: 2px solid #eeeeee;
  border-right: 2px solid #505050;
  border-bottom: 2px solid #505050;

  cursor: pointer;
  overflow: hidden;
}

.tool-button:hover {
  background: #b8b8b8;
}

.tool-button:active,
.tool-button.active {
  padding: 6px 1px 1px 5px;
  background: #989898;
  border-top-color: #454545;
  border-left-color: #454545;
  border-right-color: #eeeeee;
  border-bottom-color: #eeeeee;
}

.tool-button:focus-visible {
  outline: 1px dotted #000000;
  outline-offset: -6px;
}

.tool-icon {
  width: 62px;
  height: 62px;
  flex: 0 0 auto;
  display: block;
  object-fit: contain;
  pointer-events: none;
  image-rendering: pixelated;
}

.tool-label {
  width: 100%;
  min-height: 23px;
  display: grid;
  place-items: center;
  text-align: center;

  font-family: Georgia, "Times New Roman", serif;
  font-size: 13px;
  font-weight: 400;
  line-height: 0.95;
  white-space: normal;
  pointer-events: none;
}

.tool-button[data-tool="intMenu"] {
  grid-column: 1;
}

/* TOOLBOX BOTTOM BUTTONS */

.toolbox-footer {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-top: 9px;
}

.toolbox-footer-button {
  min-width: 0;
  height: 34px;
  padding: 3px 5px;

  font-family: Georgia, "Times New Roman", serif;
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
}

.toolbox.adjusting .tool-button {
  cursor: grab;
}

.toolbox.adjusting .tool-button:active {
  cursor: grabbing;
}

.toolbox.adjusting .tool-button::after {
  content: "";
  position: absolute;
  inset: 2px;
  border: 1px dashed #333333;
  pointer-events: none;
}

.tool-button.dragging {
  opacity: 0.55;
}

.tool-button.drag-over {
  outline: 2px dotted #111111;
  outline-offset: -5px;
}

/* VIEWPORT */

.viewport-column {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.viewport-window {
  flex: 1;
  min-height: 260px;
  padding: 8px;
  background: #888888;
  border-top: 5px solid #3f3f3f;
  border-left: 5px solid #3f3f3f;
  border-right: 5px solid #e7e7e7;
  border-bottom: 5px solid #e7e7e7;

  box-shadow:
    3px 3px 0 #4a4a4a,
    -2px -2px 0 #d4d4d4;
}

.viewport-inner {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  background: #000000;
  border-top: 3px solid #111111;
  border-left: 3px solid #111111;
  border-right: 3px solid #dddddd;
  border-bottom: 3px solid #dddddd;
  cursor: crosshair;
}

#viewport {
  display: block;
  width: 100%;
  height: 100%;
  background: #000000;
  image-rendering: pixelated;
}

.viewport-message {
  position: absolute;
  left: 50%;
  top: 17px;
  transform: translateX(-50%);
  padding: 5px 9px;
  color: #cfcfcf;
  background: rgba(0, 0, 0, 0.78);
  border: 1px solid #777777;
  font-size: 12px;
  white-space: nowrap;
  pointer-events: none;
}

.crosshair {
  display: none;
  position: absolute;
  left: 50%;
  top: 50%;
  width: 13px;
  height: 13px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.crosshair::before,
.crosshair::after {
  content: "";
  position: absolute;
  background: #b7b7b7;
  box-shadow: 1px 1px #111111;
}

.crosshair::before {
  left: 6px;
  top: 0;
  width: 1px;
  height: 13px;
}

.crosshair::after {
  left: 0;
  top: 6px;
  width: 13px;
  height: 1px;
}

body.pointer-locked .crosshair {
  display: block;
}

/* TRANSPORT BUTTONS */

.transport-shell {
  align-self: center;
  padding: 9px 18px 8px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--face);
  border-top: 3px solid var(--light);
  border-left: 3px solid var(--light);
  border-right: 3px solid #393939;
  border-bottom: 3px solid #393939;

  box-shadow:
    inset 0 0 0 1px #8d8d8d,
    2px 2px 0 #555555;
}

.transport-button {
  width: 51px;
  height: 51px;
  padding: 0;
  display: grid;
  place-items: center;
}

.transport-button:disabled {
  cursor: default;
}

.transport-button:disabled .symbol {
  opacity: 0.35;
}

.symbol {
  display: block;
  position: relative;
}

.play-symbol {
  width: 0;
  height: 0;
  margin-left: 4px;
  border-top: 11px solid transparent;
  border-bottom: 11px solid transparent;
  border-left: 18px solid #050505;
}

.pause-symbol {
  width: 18px;
  height: 24px;
  border-left: 6px solid #050505;
  border-right: 6px solid #050505;
}

.stop-symbol {
  width: 17px;
  height: 17px;
  background: #050505;
}

.fast-symbol {
  width: 32px;
  height: 23px;
}

.fast-symbol::before,
.fast-symbol::after {
  content: "";
  position: absolute;
  top: 1px;
  width: 0;
  height: 0;
  border-top: 11px solid transparent;
  border-bottom: 11px solid transparent;
  border-left: 15px solid #050505;
}

.fast-symbol::before {
  left: 0;
}

.fast-symbol::after {
  left: 15px;
}

/* DIALOG WINDOWS */

.dialog-background {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  place-items: center;
  background: rgba(0, 0, 0, 0.18);
}

.dialog-background.visible {
  display: grid;
}

.dialog {
  width: min(410px, calc(100vw - 30px));
  background: #adadad;
  border-top: 3px solid #eeeeee;
  border-left: 3px solid #eeeeee;
  border-right: 3px solid #292929;
  border-bottom: 3px solid #292929;
  box-shadow: 5px 5px 0 rgba(0, 0, 0, 0.45);
}

.dialog-title {
  padding: 6px 8px;
  color: #ffffff;
  background: #222266;
}

.dialog-content {
  padding: 18px;
  line-height: 1.55;
  white-space: pre-line;
}

.dialog-actions {
  padding: 0 18px 15px;
  display: flex;
  justify-content: center;
  gap: 8px;
}

.dialog-ok,
.dialog-button {
  min-width: 90px;
  height: 31px;
}

/* FLOATING EDITOR WINDOWS */

.floating-window {
  position: fixed;
  z-index: 70;
  min-width: 260px;
  background: #adadad;
  border-top: 3px solid #eeeeee;
  border-left: 3px solid #eeeeee;
  border-right: 3px solid #292929;
  border-bottom: 3px solid #292929;
  box-shadow: 5px 5px 0 rgba(0, 0, 0, 0.4);
}

.floating-window.hidden {
  display: none;
}

.floating-title-bar {
  min-height: 28px;
  padding: 4px 6px;
  display: flex;
  align-items: center;
  gap: 7px;
  color: #ffffff;
  background: #222266;
  cursor: move;
  user-select: none;
}

.floating-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.floating-close {
  width: 22px;
  height: 20px;
  padding: 0;
}

.floating-content {
  padding: 10px;
}

/* FORM CONTROLS */

.gris-field {
  display: grid;
  grid-template-columns: 95px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.gris-input,
.gris-select,
.gris-textarea {
  width: 100%;
  min-width: 0;
  padding: 4px 5px;
  background: #ffffff;
  border-top: 2px solid #4a4a4a;
  border-left: 2px solid #4a4a4a;
  border-right: 2px solid #eeeeee;
  border-bottom: 2px solid #eeeeee;
  outline: 0;
}

.gris-textarea {
  min-height: 90px;
  resize: vertical;
}

.gris-input:focus,
.gris-select:focus,
.gris-textarea:focus {
  outline: 1px dotted #111111;
  outline-offset: -4px;
}

/* SELECTED OBJECT AND GIZMOS */

.object-selected {
  outline: 1px dotted #ffffff;
}

.gizmo-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.gizmo-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  transform: translate(-50%, -50%);
  background: #dddddd;
  border: 1px solid #111111;
  pointer-events: auto;
  cursor: move;
}

.vertex-handle {
  position: absolute;
  width: 8px;
  height: 8px;
  transform: translate(-50%, -50%);
  background: #eeeeee;
  border: 1px solid #111111;
  pointer-events: auto;
  cursor: crosshair;
}

.vertex-handle.active {
  width: 11px;
  height: 11px;
  background: #ffffff;
}

/* UTILITY STATES */

.hidden-workspace {
  display: none;
}

.hidden {
  display: none !important;
}

body.maximized .workspace {
  grid-template-columns: 1fr;
  padding: 6px;
}

body.maximized .toolbox {
  display: none;
}

/* SMALL SCREENS */

@media (max-width: 760px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .toolbox,
  .empty-left-space {
    display: none;
  }

  .menu-button {
    min-width: 42px;
    padding-left: 7px;
    padding-right: 7px;
  }

  .transport-button {
    width: 45px;
    height: 45px;
  }
}

/* SHORT SCREENS */

@media (max-height: 620px) {
  :root {
    --tool-size: 82px;
    --tool-gap: 5px;
  }

  .tool-icon {
    width: 50px;
    height: 50px;
  }

  .tool-label {
    font-size: 11px;
  }

  .toolbox-footer-button {
    height: 30px;
    font-size: 11px;
  }

  .transport-button {
    width: 43px;
    height: 43px;
  }
}