* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  background: #050505;
  color: #f5f5f5;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

body {
  display: flex;
  flex-direction: column;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1rem;
  background: #0f0f0f;
  border-bottom: 1px solid #1c1c1c;
}

header button {
  background: #1e1e1e;
  border: 1px solid #333;
  color: inherit;
  padding: 0.3rem 0.8rem;
  font-size: 0.9rem;
  cursor: pointer;
}

header button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

main {
  flex: 1;
  display: flex;
  min-height: 0;
}

.sidebar {
  width: 220px;
  padding: 1rem;
  border-right: 1px solid #1c1c1c;
  background: #080808;
  font-size: 0.9rem;
}

.sidebar .stat {
  margin-bottom: 0.6rem;
}

.viewer {
  flex: 1;
  position: relative;
  overflow: auto;
  font-size: 13px;
  line-height: 20px;
  padding: 0;
}

#spacer {
  width: 1px;
  opacity: 0;
}

#content {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 1rem;
  font-variant-numeric: tabular-nums;
}

.row {
  display: flex;
  gap: 1rem;
}

.address {
  width: 80px;
  color: #5f5f5f;
}

.hex,
.ascii {
  display: grid;
  grid-template-columns: repeat(16, 2ch);
  gap: 0.5ch;
}

.ascii {
  gap: 0;
}

.byte,
.char {
  text-align: center;
  padding: 0 0.2ch;
  border-radius: 2px;
  cursor: pointer;
}

.byte:hover,
.char:hover {
  background: #1f1f1f;
}

.active {
  background: #2962ff !important;
}

#editor {
  position: absolute;
  top: 0;
  left: 0;
  transform: translate(-9999px, -9999px);
  background: #fff;
  color: #000;
  border-radius: 2px;
  padding: 0;
  transition: opacity 0.05s;
}

#editor input {
  border: none;
  font-family: inherit;
  font-size: 13px;
  padding: 0.2rem 0.3rem;
  width: 4ch;
  outline: none;
  background: transparent;
}

#editor.hidden {
  opacity: 0;
}

#editor.visible {
  opacity: 1;
}
