:root {
  --shell-bg: #363636;
  --shell-text: #ececec;
  --shell-text-strong: #fff;
  --shell-text-muted: #c8c8c8;
  --shell-border: #777;
  --shell-border-dark: #555;
  --shell-control-bg: #2b2b2b;
  --shell-control-hover: #424242;
  --shell-control-active: #4a4a4a;
}

html, body {
  margin: 0;
  height: 100%;
  background: #000;
  overflow: hidden;
}

#screen {
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  image-rendering: pixelated;
}

#help-hint {
  position: fixed;
  right: 8px;
  bottom: 8px;
  z-index: 20;
  padding: 5px 8px;
  border: 1px solid var(--shell-border);
  background: var(--shell-bg);
  color: var(--shell-text);
  font: 12px/1.2 monospace;
  cursor: pointer;
  opacity: 0.7;
}

#help-hint:hover,
#help-hint:focus {
  opacity: 1;
}

#help-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  background: rgba(0, 0, 0, 0.55);
}

#help-modal[hidden] {
  display: none;
}

#help-window {
  width: min(720px, 100%);
  max-height: calc(100vh - 32px);
  overflow: auto;
  box-sizing: border-box;
  padding: 16px 20px;
  border: 2px solid var(--shell-border);
  background: var(--shell-bg);
  color: var(--shell-text);
  font: 15px/1.6 monospace;
}

.help-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--shell-border);
}

#help-window h2,
#help-window h3 {
  margin: 0.4em 0;
  color: var(--shell-text-strong);
}

#help-window h2 {
  font-size: 20px;
}

#help-window h3 {
  font-size: 16px;
}

#help-close {
  border: 1px solid var(--shell-border);
  background: var(--shell-control-bg);
  color: var(--shell-text);
  font: 20px/1 monospace;
  cursor: pointer;
}

#help-close:hover,
#help-close:focus {
  background: var(--shell-control-hover);
}

#help-window table {
  width: 100%;
  margin: 0 0 12px;
  border-collapse: collapse;
}

#help-window th,
#help-window td {
  padding: 4px 8px;
  border: 1px solid var(--shell-border-dark);
  text-align: left;
  vertical-align: top;
}

#help-window th {
  color: var(--shell-text-strong);
  background: var(--shell-control-bg);
}

#help-window code,
#help-window kbd {
  color: var(--shell-text-strong);
  font: inherit;
}

#help-window a {
  color: var(--shell-text);
}

.help-note {
  margin: 0.6em 0;
  color: var(--shell-text-muted);
}

.help-tabs {
  display: flex;
  gap: 4px;
  margin-top: 10px;
  border-bottom: 1px solid var(--shell-border);
}

.help-tab {
  padding: 4px 14px;
  border: 1px solid var(--shell-border);
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  background: var(--shell-control-bg);
  color: var(--shell-text-muted);
  font: 14px/1.4 monospace;
  cursor: pointer;
}

.help-tab:hover {
  background: var(--shell-control-hover);
}

.help-tab[aria-selected="true"] {
  background: var(--shell-control-active);
  color: var(--shell-text-strong);
  font-weight: bold;
}

.help-panel {
  padding-top: 8px;
}
