/* A lesson's code blocks (docs/design/code-blocks/round-1/FEATURES.md; tools/courses/render/code_blocks.py): the header
   row holds the language's name and the block's keys on one row at every width, and the keys are 44 px tall (the
   owner's rule for a target). The words are the ink on the block's own ground: 16.6:1 or more in each look. */
.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 44px;
  margin: 0 0 6px;
  min-width: 0;
}

.code-head .code-label {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font: 650 calc(15px * var(--text-scale, 1))/1.35 var(--ui);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.code-keys {
  display: flex;
  flex: none;
  gap: 8px;
}

.code-key {
  min-width: 64px;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  font: 650 calc(15px * var(--text-scale, 1))/1.35 var(--ui);
  cursor: pointer;
}

.code-key[hidden] { display: none; }
.code-key:hover { background: var(--accent-soft); }
.code-key:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
/* A Run key whose program is running: it keeps the focus and its words, and a press does nothing. */
.code-key[aria-disabled="true"] { color: var(--dim); cursor: progress; }
.code-key[aria-disabled="true"]:hover { background: var(--panel); }

/* A block with Run, Reset and Copy: on a narrow screen the keys are 44 px targets with less padding and the label
   keeps the language's name alone, so the row stays one row at 320 px. */
@media (max-width: 480px) {
  .code-keys { gap: 6px; }
  .code-key { min-width: 44px; padding: 0 9px; }
  .code-head .code-word { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}

/* What a run printed, under the block's code (site/js/code-run.js): a status line, then the Output and Error boxes. */
.code-out { margin-top: 10px; min-width: 0; }
.code-status {
  margin: 0 0 6px;
  color: var(--ink);
  font: 400 calc(15px * var(--text-scale, 1))/1.35 var(--ui);
  overflow-wrap: anywhere;
}
.code-stream { margin-top: 8px; min-width: 0; }
.code-stream[hidden] { display: none; }
.code-stream-label {
  display: block;
  margin: 0 0 5px;
  color: var(--ink);
  font: 650 calc(15px * var(--text-scale, 1))/1.35 var(--ui);
}
.code-stream pre {
  max-height: 22em;
  margin: 0;
  padding: 10px 12px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--bg);
  color: var(--ink);
  font: calc(14px * var(--text-scale, 1))/1.5 var(--mono);
  white-space: pre;
  tab-size: 4;
}
.code-stream[data-code-stream="error"] pre { border-left: 4px double var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; }

.code-block { min-width: 0; }
.q .code-block, .ans .code-block { margin-block: 10px; }

/* The page's one polite live region: it says "Copied" without moving the reader's focus. */
.code-said {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
