/* hack to hide the upload button */
.unstylable-wrapper {
  position: relative;
  overflow: hidden;
  display: inline-block;
}

/* A pane's hex view keeps a readable width; a machine's memory panel takes what its side has. */
.hex-viewer-paintbox {
    min-width: 300px;
}

.machine-side .hex-viewer-paintbox {
    min-width: 0;
}

.unstylable-wrapper input[type=file]{
  font-size: 100px;
  position: absolute;
  left: 0;
  top: 0;
  opacity: 0;
}

.unstylable-wrapper select {
  position: absolute;
  left: 0;
  top: 0;
  opacity: 0;
}

.hex-view {
  display: flex;
  flex-direction: row;
  margin: 20px;
  min-height: 1em;
  font-size: 16px;
  font-family: Courier New, Courier, Lucida Sans Typewriter, Lucida Typewriter, monospace;
}

.offset {
  /*min-width: 3em;*/
  background-color: var(--table-header-background-color);
  color: var(--table-header-foreground-color);
  padding: 5px;
}

.hex,
.fixtext {
  border: 1px solid var(--separator-color);
  padding: 5px;
}

.hex div,
.fixtext div {
  width: 1.2em;
}

.selected {
  /*width: 8em;*/
  background-color: var(--default-selected-background-color);
  color: var(--default-selected-foreground-color);
  /*border-bottom: 1px solid #888;*/
  /*border-top: 1px solid #888;*/
}

.text {
  padding:3px;
  border: 1px solid #888;
}

.text div {
  /*width: 16em;*/
  line-height: 1em;
  vertical-align: middle;
}

.hex-table table {
  table-layout: fixed;
  border-collapse: collapse;
}

.hex-table table td {
  vertical-align: middle;
  box-sizing: border-box;
  border: 1px solid var(--separator-color);
}

.hex-table table td div {
  height: 1.2em;
  line-height: 1.2em;
  /*display:inline-block;*/
  vertical-align: middle;
}

span[data-control]:after {
  content: attr(data-control);
}

#switch-theme {
  float: right;
}

.instructions {
  padding: 2em;
  margin: 2em;
  border: 1px solid var(--separator-color);
}

.controlButton {
  padding: 5px;
  width: 30px;
  height: 30px;
  position: relative;
  display: inline-block;
}

.controlButton:hover {
  background-color: var(--default-hover-background-color);
}

.aboutIcon {
  width: 100px;
  height: 100px;
}

/* Hexy pane headers styling */
.pane-header {
  background-color: var(--table-header-background-color);
  color: var(--table-header-foreground-color);
  border-bottom: 1px solid var(--separator-color);
  padding: 6px 10px;
  align-items: center;
  box-sizing: border-box; /* include padding within width to avoid overflow into next pane */
}

/* Truncate overly long titles with ellipsis */
.pane-header .pane-title {
  min-width: 0;
  flex: 0 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The format and its note stay whole beside the name, which truncates first. */
.pane-header .pane-format {
  font-weight: normal;
  white-space: nowrap;
}

/* The pane's one header row and the bytes zone's bar keep the height of their icon buttons. */
.pane-header button.small,
.hexy-context-bar button.small {
  padding: 2px 8px;
  line-height: 20px;
  white-space: nowrap;
}

.hexy-context-bar .pane-title {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Interpretation and Structure section headers */
.interpret-header,
.entries-header {
  background-color: var(--table-header-background-color);
  color: var(--table-header-foreground-color);
  border-bottom: 1px solid var(--separator-color);
  padding: 6px 10px;
}

/* Optional: make header labels slightly bolder without changing layout */
.interpret-header,
.entries-header,
.pane-header span {
  font-weight: 600;
}

/* Unified styling for interpretation tables in Hexy */
.hexy-int-panel {
  font-family: Courier New, Courier, Lucida Sans Typewriter, Lucida Typewriter, monospace;
  font-size: 11px;
}

.hexy-filter-bar {
  align-items: center;
  padding: 4px 6px;
}

.hexy-int-table table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}

.hexy-int-table td,
.hexy-int-table th {
  vertical-align: middle;
  /* The columns have fixed widths: a long number breaks inside its cell rather than run into the next. */
  overflow-wrap: anywhere;
}

/* The file browser's table: sizes, times and notes take what they need on one line, names the rest; a pane too
   narrow for that scrolls the table sideways rather than squeeze the names out. */
.hexy-file-table table {
  min-width: 480px;
}

.hexy-file-table th:nth-child(2) {
  width: 76px;
}

.hexy-file-table th:nth-child(3) {
  width: 132px;
}

.hexy-file-table th:nth-child(4) {
  width: 76px;
}

.hexy-file-table td {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hexy-file-table td:nth-child(2) {
  text-align: right;
}

/* Overlay button alignment and spacing within table cells */
.hexy-int-table .overlay-buttons-container {
  display: inline-flex;
  margin-left: 8px;
}

/* One pane per source in the horizontal strip; a child opens to the right of its parent. The panes share the
   window until the user drags one's right edge, which keeps that width; once they no longer fit, the strip
   scrolls sideways. */
.hexy-pane {
  flex: 1 1 0;
  min-width: min(100%, 720px);
  height: 100%;
  min-height: 0;
}

.hexy-pane.fp-fixed-width {
  flex: 0 0 auto;
}

/* One pane shown alone: it takes the strip, whatever width the user gave it; the others wait hidden. */
.hexy-pane.hexy-pane-focused {
  flex: 0 0 100%;
  min-width: 100%;
}

.hexy-pane.hexy-pane-hidden {
  display: none;
}

.hexy-pane-strip {
  height: 100%;
  min-height: 0;
}

/* The picture tool shows each pixel of the bytes as a square of screen pixels. */
.hexy-picture img {
  image-rendering: pixelated;
}

/* The structure zone's tree beside the details, and the bytes zone below both. */
.hexy-tree-panel {
  border-right: 1px solid var(--separator-color);
}

/* The tree's fold handle: a tab on the panel's edge, as Raily's panel handles, which a header button is not. */
.hexy-tree-panel .expand-handle {
  display: flex;
  position: absolute;
  right: 0;
  bottom: 30px;
  width: 27px;
  height: 27px;
  align-content: center;
  justify-content: center;
  background-color: rgba(0, 0, 255, 0.55);
  overflow: hidden;
  cursor: pointer;
}

.hexy-tree-panel .expand-handle > div {
  color: white;
}

.hexy-bytes-zone {
  border-top: 1px solid var(--separator-color);
}

.hexy-details-line {
  display: block;
  padding: 2px 0;
}

/* The machine view: the listing beside the screen over the memory, half and half until the divider is dragged. */
.machine-view {
  min-width: 0;
}

/* Where even the screen's minimum does not leave the bars room, the side scrolls rather than hides them. */
.machine-side {
  width: 50%;
  min-width: 0;
  overflow: auto;
  padding-left: 6px;
  box-sizing: border-box;
}

/* Stacked, the memory beside the listing shows four bytes a line, which with its addresses takes a little over half;
   a side widened for a picture beside the screen must not take more. */
.machine-view.narrow .machine-side {
  width: 55%;
  max-width: 55%;
}

/* A listing in a pane's details has nothing else to give it a height; in the machine view the row below the screen
   does, and the listing shows what fits. */
.assembly-viewer {
  min-height: 240px;
}

.machine-view .assembly-viewer {
  min-height: 0;
}

/* The register and state lines end in an ellipsis; the full text is their hint. */
.machine-line {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.machine-registers {
  font-family: monospace;
}

/* The devices' indicators under the screen: dim until the program uses the device, orange once it asked in vain. */
.machine-devices > div {
  opacity: 0.4;
  transition: opacity 0.2s;
}

.machine-devices > .lit {
  opacity: 1;
  transition: none;
}

.machine-devices > .warning {
  opacity: 1;
}

/* The device whose console the screen shows in place of the board's. */
.machine-devices > .shown {
  opacity: 1;
  background-color: var(--default-selected-background-color);
}

.machine-devices > .warning svg {
  stroke: var(--warning-color);
}

/* A text screen is as high as its width makes 25 rows, or as the view lets it be and then narrower. */
.text-screen {
  position: relative;
  width: 100%;
  box-sizing: border-box;
  outline: none;
}

/* Fullscreen, the element is the display and the fit sizes its canvas holder: auto margins centre the holder.
   Its width is the display's in a text mode, which leaves the width to this rule, and its own in a picture's. */
.text-screen:fullscreen {
  display: flex;
  background-color: black;
}

.text-screen:fullscreen > div {
  flex: none;
  width: 100%;
  margin: auto;
}

.text-screen.narrowed > div {
  margin: 0 auto;
}
