* {
  box-sizing: border-box;
  text-align: center;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: auto;
  background: #000;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: auto;
}

#myCanvas {
  width: min(100vw, calc(100vh - 120px));
  height: min(100vw, calc(100vh - 120px));
  margin: auto;
  background: black;
}

#gui {
  height: 120px;
  background: #111;
  color: #f5f5f5;

  display: flex;
  align-items: center;

  padding: 12px 16px;
  gap: 20px;

  grid-area: gui;

  border-top: 1px solid #222;
}

#matrixContainer {
  display: grid;
  justify-self: start;
  grid-template-columns: repeat(5, 48px);
  gap: 4px;

  max-height: 96px;
  overflow-y: auto;

  padding: 6px;
  background: #1a1a1a;
  border-radius: 6px;
}


#matrixContainer div {
  background: #f5f5f5;
  color: #000;
  border-radius: 4px;
  padding: 6px;
  font-size: 10px;
  text-align: center;
  outline: none;
  user-select: text;
}

#matrixContainer div:focus {
  background: #ffffff;
  box-shadow: 0 0 0 2px #4da3ff;
}

#controlsContainer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
}

#gui label {
  display: flex;
  flex-direction: column;
  font-size: 12px;
  gap: 4px;
  min-width: 140px;
}

#gui input[type="range"] {
  width: 140px;
}

#gui span {
  font-size: 11px;
  color: #bbb;
}

#gui button {
  background: #222;
  color: #fff;
  border: 1px solid #333;
  border-radius: 6px;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.15s ease, border 0.15s ease;
}

#gui button:hover {
  background: #2c2c2c;
  border-color: #444;
}

#gui button:active {
  background: #1b1b1b;
}

#matrixContainer::-webkit-scrollbar {
  width: 6px;
}

#matrixContainer::-webkit-scrollbar-thumb {
  background: #444;
  border-radius: 3px;
}

#matrixContainer::-webkit-scrollbar-track {
  background: transparent;
}
