* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: Arial, Helvetica, sans-serif;
  background: #d9d9d9;
  color: #111;
}

.app {
  display: flex;
  width: 100%;
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  width: 320px;
  min-width: 320px;
  padding: 18px;
  background: #f3f3f3;
  border-right: 1px solid #b5b5b5;
  overflow-y: auto;
}

.sidebar h1 {
  margin-top: 0;
  font-size: 22px;
  margin-bottom: 20px;
}

.panel-block {
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid #cccccc;
}

.panel-block h2 {
  margin: 0 0 14px 0;
  font-size: 16px;
}

.control-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 14px;
}

.control-group label {
  font-size: 13px;
  margin-bottom: 6px;
  font-weight: bold;
}

.control-group input,
.control-group select,
.control-group button {
  font-size: 14px;
  padding: 8px;
}

.control-group input[type="range"] {
  padding: 0;
}

.control-group span {
  margin-top: 6px;
  font-size: 12px;
  color: #333;
}

.control-group button {
  cursor: pointer;
  border: 1px solid #444;
  background: #ffffff;
}

.control-group button:hover {
  background: #e9e9e9;
}

#cell-map-wrapper {
  width: 100%;
  overflow: auto;
  padding: 6px 0;
}

#cell-map {
  display: grid;
  gap: 2px;
  width: fit-content;
  background: #d0d0d0;
  padding: 2px;
}

.map-cell {
  width: 18px;
  aspect-ratio: 1 / 1;
  background: #00aaaa;
  cursor: pointer;
}

.map-cell.selected {
  background: #55ffff;
}

.selected-cell-label {
  margin-top: 10px;
  font-size: 13px;
}

.pattern-editor-panel {
  width: 260px;
  min-width: 260px;
  padding: 18px;
  background: #ececec;
  border-right: 1px solid #b5b5b5;
  overflow-y: auto;
}

.pattern-editor-panel h2 {
  margin-top: 0;
  font-size: 18px;
  margin-bottom: 16px;
}

#pattern-editor {
  display: grid;
  gap: 1px;
  width: 216px;
  height: 216px;
  background: #666666;
  padding: 1px;
}

.pattern-pixel {
  background: #ffffff;
  border: 1px solid #cfcfcf;
  cursor: pointer;
}

.main-area {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  overflow: auto;
}

#canvas-frame {
  display: inline-block;
  background: white;
}

#sketch-holder {
  line-height: 0;
}