/* The creative tool's page: a desk with floating windows, in the Stack
   layout chosen for #154. */
:root {
  --bg: #d8d4cb;
  --panel: #ffffff;
  --line: #111111;
  --text: #1f1d1a;
  --muted: #6d675d;
  --accent: #2f5d8a;
  --northtalk-keyword: #7a3e9d;
  --northtalk-string: #2e7d32;
  --northtalk-number: #b25b00;
  --northtalk-comment: #8a8478;
  --northtalk-operator: #4a4a4a;
  /* Add-ons such as the Piano Roll colour with the number colour; keep the
     name their cached chunks use. */
  --number: var(--northtalk-number);
  --error: #b3261e;
  --paused: #fff3c4;
  color-scheme: light;
  font-family: system-ui, sans-serif;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  background-image: radial-gradient(rgb(0 0 0 / 6%) 1px, transparent 1px);
  background-size: 14px 14px;
  color: var(--text);
}
#menu {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  padding: 0.3rem 0.8rem;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
#project-title {
  flex: 1;
  text-align: center;
  font-family: 'Iowan Old Style', Georgia, serif;
}
h1 {
  font-size: 1rem;
  margin: 0;
}
.muted {
  color: var(--muted);
  font-weight: normal;
  font-size: 0.85rem;
}
button {
  font: inherit;
  border: 1.5px solid var(--line);
  background: var(--panel);
  color: var(--text);
  padding: 0.15rem 0.6rem;
}
button:hover:not(:disabled) {
  background: var(--line);
  color: var(--panel);
}
button:disabled {
  opacity: 0.4;
}

/* The desk: the Page at the design width, scaled down to fit, with room
   left for the Tools and Info windows. */
#desk {
  flex: 1;
  overflow: hidden auto;
  padding: 1.5rem 17rem 2rem 9rem;
}
#caption {
  display: flex;
  justify-content: space-between;
  margin: 0 auto 0.5rem;
  font-family: 'Iowan Old Style', Georgia, serif;
}
#stage {
  position: relative;
  margin: 0 auto;
  border: 1.5px solid var(--line);
  box-shadow: 6px 6px 0 rgb(0 0 0 / 85%);
  box-sizing: content-box;
}
.page {
  position: relative;
  overflow: hidden;
  transform-origin: 0 0;
}
#stage .page {
  position: absolute;
  top: 0;
  left: 0;
}
.el {
  position: absolute;
  box-sizing: border-box;
}
.el.hidden {
  opacity: 0.3;
}
.el.text {
  overflow: hidden;
  line-height: 1.35;
  white-space: pre-wrap;
}
.el.text p {
  margin: 0;
}
.el.image {
  display: grid;
  place-items: center;
  border: 2px dashed var(--muted);
  background: rgb(0 0 0 / 5%);
  color: var(--muted);
  font-size: 14px;
}
.el.placeholder {
  display: grid;
  place-items: center;
  padding: 4px;
  overflow: hidden;
  border: 2px dashed var(--muted);
  background: rgb(0 0 0 / 5%);
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  overflow-wrap: anywhere;
}
.el.button {
  display: grid;
  place-items: center;
  font-weight: 600;
  user-select: none;
}
.el.button-rounded {
  border-radius: 8px;
}
.el.button-rectangle,
.el.button-shadowed {
  border: 1px solid currentColor;
}
.el.button-shadowed {
  box-shadow: 3px 3px 0 currentColor;
}
.el.button-transparent .button-label {
  visibility: hidden;
}
.page.edit .el.button-transparent {
  outline: calc(1px / var(--scale, 1)) dashed var(--muted);
}
.el.rectangle,
.el.ellipse {
  border-style: solid;
}
.el.ellipse {
  border-radius: 50%;
}
.el.canvas {
  overflow: hidden;
}
.el.canvas canvas {
  display: block;
  width: 100%;
  height: 100%;
}
.el.line {
  pointer-events: none;
}
/* Preact's layer of a Page's Elements; they position against the Page. */
.elements {
  display: contents;
}
.el.line svg {
  position: absolute;
  overflow: visible;
  stroke-linecap: round;
}
.el.line line {
  pointer-events: stroke;
}
.el.line line.hit {
  stroke: transparent;
}
.page.edit .el {
  cursor: move;
  user-select: none;
}
.page.edit .el:hover:not(.selected) {
  outline: calc(1px / var(--scale, 1)) solid rgb(47 111 237 / 50%);
}
.page.edit .el.selected {
  outline: calc(2px / var(--scale, 1)) solid #2f6fed;
  outline-offset: calc(1px / var(--scale, 1));
}
.handles {
  position: absolute;
  pointer-events: none;
}
.handle {
  --size: calc(10px / var(--scale, 1));
  position: absolute;
  width: var(--size);
  height: var(--size);
  margin: calc(var(--size) / -2);
  background: #fff;
  border: calc(1.5px / var(--scale, 1)) solid #2f6fed;
  pointer-events: auto;
}
.handle.nw {
  left: 0;
  top: 0;
  cursor: nwse-resize;
}
.handle.n {
  left: 50%;
  top: 0;
  cursor: ns-resize;
}
.handle.ne {
  left: 100%;
  top: 0;
  cursor: nesw-resize;
}
.handle.e {
  left: 100%;
  top: 50%;
  cursor: ew-resize;
}
.handle.se {
  left: 100%;
  top: 100%;
  cursor: nwse-resize;
}
.handle.s {
  left: 50%;
  top: 100%;
  cursor: ns-resize;
}
.handle.sw {
  left: 0;
  top: 100%;
  cursor: nesw-resize;
}
.handle.w {
  left: 0;
  top: 50%;
  cursor: ew-resize;
}
.page-handles {
  --scale: 1;
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.page-handles .handle {
  --size: 12px;
  padding: 0;
  touch-action: none;
  z-index: 1;
}
.page-handles .handle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* The Pages strip. */
#strip {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 1rem;
  border-top: 1.5px solid var(--line);
  background: var(--panel);
}
#strip > button {
  flex: none;
  width: 2rem;
  height: 2rem;
  border-radius: 1rem;
  padding: 0;
}
#thumbnails {
  display: flex;
  gap: 0.8rem;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow-x: auto;
}
#thumbnails button {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--text);
  font-size: 0.7rem;
  text-align: center;
}
.thumbnail {
  width: 96px;
  overflow: hidden;
  border: 1.5px solid var(--line);
  pointer-events: none;
}
/* Palettes follow the Pages, set apart by a rule. */
#thumbnails li:not(.palette) + li.palette {
  border-left: 1.5px dashed var(--line);
  padding-left: 0.8rem;
}
#thumbnails [aria-current] .thumbnail {
  border-color: #ff3d7f;
  box-shadow: 3px 3px 0 #ff3d7f;
}

/* Floating windows, dragged by their title bars. */
.window {
  position: fixed;
  z-index: 10;
  background: var(--panel);
  border: 1.5px solid var(--line);
  box-shadow: 4px 4px 0 rgb(0 0 0 / 80%);
}
.window.front {
  z-index: 11;
}
.window .bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: grab;
  user-select: none;
  touch-action: none;
  background: repeating-linear-gradient(
    var(--panel) 0 2px,
    var(--line) 2px 3px
  );
}
.window .bar span {
  background: var(--panel);
  padding: 0 0.4rem;
}
.window .bar .close {
  width: 12px;
  height: 12px;
  padding: 0;
}
#tools-window {
  width: 7rem;
}
#tools {
  display: flex;
  flex-direction: column;
}
#tools button {
  display: flex;
  gap: 0.5rem;
  border: 0;
  border-bottom: 1px solid #ddd;
  text-align: left;
  font-size: 0.85rem;
}
#tools button span,
#tool-modes button span {
  width: 1rem;
  text-align: center;
}
/* Browse and Edit: the mode the desk is in, above the Element tools. */
#tool-modes {
  display: flex;
  flex-direction: column;
  border-bottom: 1.5px solid var(--line);
}
#tool-modes button {
  display: flex;
  gap: 0.5rem;
  border: 0;
  border-bottom: 1px solid #ddd;
  text-align: left;
  font-size: 0.85rem;
}
#tool-modes [aria-pressed='true'] {
  background: var(--accent);
  color: white;
}
#message-window {
  width: min(28rem, 100vw);
  height: 14rem;
  min-height: min(8rem, calc(100dvh - var(--window-top, 140px) - 8px));
}
#message-window .message-log {
  flex: 1 1 4rem;
  min-height: 2rem;
  list-style: none;
  margin: 0;
  padding: 0.4rem 0.5rem;
  overflow-y: auto;
  font:
    0.8rem ui-monospace,
    monospace;
  white-space: pre-wrap;
}
#message-window .message-log .command {
  color: var(--muted);
}
#message-window .message-log .command::before {
  content: '› ';
}
#message-window .message-log .error {
  color: var(--error);
}
#message-window .code-editor {
  flex: 0 1 auto;
  max-height: 40%;
  border-top: 1px solid var(--line);
}
#errors-window {
  width: 24rem;
}
#errors-panel {
  padding: 0.6rem;
  font-size: 0.8rem;
  max-height: 16rem;
  overflow-y: auto;
}
#errors-panel p {
  margin: 0 0 0.5rem;
}
#pause-on-errors {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin: 0 0 0.5rem;
}
#error-list {
  list-style: none;
  margin: 0 0 0.6rem;
  padding: 0;
}
#error-list button {
  display: flex;
  flex-direction: column;
  width: 100%;
  border: 0;
  border-bottom: 1px solid #ddd;
  padding: 0.35rem 0.2rem;
  text-align: left;
  color: var(--error);
}
#error-list .where {
  color: var(--text);
  font-weight: 600;
}
#error-list button:hover:not(:disabled) .where {
  color: inherit;
}
#error-list button.error-fix {
  display: inline-block;
  width: auto;
  margin: 0.25rem 0.2rem 0.35rem;
  border: 1px solid #bbb;
  border-radius: 4px;
  padding: 0.15rem 0.5rem;
  color: var(--text);
}
#variables-window {
  width: 22rem;
}
#variables-panel {
  padding: 0.6rem;
  font-size: 0.8rem;
  max-height: 22rem;
  overflow-y: auto;
}
#variables-panel p {
  margin: 0 0 0.5rem;
}
.variables-script h3 {
  margin: 0.4rem 0 0.2rem;
  font-size: inherit;
}
.variables-stopped {
  background: var(--paused);
  margin: 0 -0.5rem 0.4rem;
  padding: 0.1rem 0.5rem 0.3rem;
}
.variables-frame h4 {
  margin: 0.3rem 0 0.1rem;
  font-size: inherit;
}
.variables-frame h4 button {
  all: unset;
  cursor: pointer;
  text-decoration: underline;
}
.variables-frame[aria-current='true'] h4 button {
  font-weight: bold;
}
.variables-script ul {
  list-style: none;
  margin: 0 0 0.4rem;
  padding: 0;
}
.variables-script li {
  display: flex;
  gap: 0.6rem;
  padding: 0.1rem 0;
  border-bottom: 1px solid #eee;
}
.variables-script .name {
  flex: 0 0 auto;
  font-weight: 600;
}
.variables-script .toggle {
  border: 0;
  padding: 0;
  background: none;
  text-align: left;
}
.variables-script .value {
  min-width: 0;
  overflow-wrap: anywhere;
  font-family: ui-monospace, monospace;
}
.variables-script .element {
  border: 0;
  padding: 0;
  background: none;
  color: var(--accent);
  text-decoration: underline;
  font: inherit;
}
.variables-script .more {
  color: var(--muted);
}
/* A changed value lights up, then fades. */
.variables-script .changed {
  animation: variable-changed 600ms ease-out;
}
@keyframes variable-changed {
  from {
    background: #ffe58a;
  }
  to {
    background: transparent;
  }
}
#info-window {
  width: 15rem;
  min-width: 12rem;
  min-height: 8rem;
}
/* Info's fields take the height the window gives them, and scroll. */
#info-window > #info {
  flex: 1 1 auto;
  min-height: 0;
}
#info {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.6rem;
  font-size: 0.8rem;
  overflow-y: auto;
}
#sounds-window {
  width: 16rem;
  min-width: 12rem;
  min-height: 8rem;
}
#sounds-panel {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 0.5rem;
  min-height: 0;
  padding: 0.6rem;
  font-size: 0.8rem;
  overflow-y: auto;
}
.sound-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.sound-list .sound {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.sound-list .sound-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sound-list .placeholder .sound-name {
  font-style: italic;
  opacity: 0.6;
}
#instruments-window {
  width: 17rem;
  min-width: 13rem;
  min-height: 10rem;
}
#instruments-panel .instrument {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
#instruments-panel .instrument > .row .field:last-child:not(:first-child) {
  flex: 0 0 3.5rem;
}
#instruments-window:focus {
  outline: none;
}
.audition {
  display: flex;
  gap: 0.25rem;
  align-items: center;
}
.audition button {
  min-width: 1.8rem;
}
.audition button[aria-pressed='true'] {
  background: #2f6fed;
  color: #fff;
}
#instruments-panel .audition select {
  flex: 1 1 auto;
  min-width: 0;
}
.audition .check {
  margin-left: auto;
}
.instrument-tools {
  display: flex;
  gap: 0.25rem;
}
.instrument-tools button {
  min-width: 1.8rem;
}
.add-menu {
  position: relative;
}
.add-menu .menu {
  position: absolute;
  z-index: 10;
  top: 100%;
  left: 0;
  display: flex;
  flex-direction: column;
  min-width: 9rem;
  padding: 0.2rem;
  border: 1.5px solid var(--line);
  background: var(--panel);
}
.add-menu .menu button {
  border: 0;
  background: none;
  text-align: left;
  padding: 0.2rem 0.4rem;
}
.add-menu .menu button:hover:not(:disabled) {
  background: #2f6fed;
  color: #fff;
}
.add-menu .menu hr {
  width: 100%;
  margin: 0.15rem 0;
  border: 0;
  border-top: 1px solid var(--line);
}
.add-menu kbd {
  float: right;
  color: var(--muted);
  font: inherit;
}
.parameter-group summary {
  color: var(--muted);
  font-weight: 600;
  cursor: default;
  margin-bottom: 0.1rem;
}
.group-picture {
  display: block;
  width: 100%;
  height: auto;
  margin: 0.1rem 0 0.25rem;
  border: 1.5px solid var(--line);
  border-radius: 3px;
  touch-action: none;
}
.group-picture[aria-disabled] {
  opacity: 0.5;
}
.group-picture-line {
  fill: rgb(47 111 237 / 0.15);
  stroke: #2f6fed;
  stroke-width: 1.5;
  stroke-linejoin: round;
}
.group-picture[data-view='filter'] .group-picture-line {
  fill: none;
}
.group-picture-handle {
  fill: #2f6fed;
  stroke: #fff;
  stroke-width: 1.5;
  cursor: move;
}
.group-picture[aria-disabled] .group-picture-handle {
  cursor: default;
}
.parameter-row {
  display: grid;
  grid-template-columns: 4.6rem 1fr 3.9rem;
  gap: 0.35rem;
  align-items: center;
  min-height: 1.35rem;
}
.parameter-row.text,
.parameter-row.boolean {
  grid-template-columns: 4.6rem 1fr;
}
.parameter-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.slider {
  position: relative;
  height: 0.9rem;
  border: 1.5px solid var(--line);
  border-radius: 3px;
  overflow: hidden;
  touch-action: none;
  cursor: ew-resize;
}
.slider:focus-visible {
  outline: 2px solid #2f6fed;
  outline-offset: 1px;
}
.slider[aria-disabled] {
  opacity: 0.5;
  cursor: default;
}
.slider-fill {
  position: absolute;
  inset: 0 auto 0 0;
  background: #2f6fed;
  opacity: 0.55;
  pointer-events: none;
}
/* During Play, a faint tick marks the saved value when a Script's set has
   moved the thumb away from it (#2081). */
.slider-saved {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  margin-left: -1px;
  background: var(--line);
  opacity: 0.45;
  pointer-events: none;
}
.parameter-bound {
  margin-left: 0.2rem;
  font-size: 0.75em;
  cursor: help;
}
#instruments-panel input.slider-value {
  padding: 0 0.2rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
#instruments-panel input.parameter-text {
  min-width: 0;
  padding: 0 0.2rem;
  font-variant-numeric: tabular-nums;
}
.segmented {
  display: flex;
}
.segmented button {
  flex: 1 1 0;
  min-width: 0;
  padding: 0.05rem 0;
  font-size: 0.7rem;
  border: 1.5px solid var(--line);
  background: none;
  overflow: hidden;
  text-overflow: ellipsis;
}
.segmented button + button {
  border-left: 0;
}
.segmented button[aria-checked='true'] {
  background: #2f6fed;
  color: #fff;
}
.parameter-row .toggle {
  justify-self: start;
}
.instrument-hint {
  display: flex;
  gap: 0.3rem;
  align-items: flex-start;
  margin-top: auto;
}
.instrument-hint code {
  flex: 1 1 auto;
  min-width: 0;
  white-space: pre-wrap;
  color: var(--muted);
  font-size: 0.72rem;
  user-select: text;
}
#instruments-panel {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 0.5rem;
  min-height: 0;
  padding: 0.6rem;
  font-size: 0.8rem;
  overflow-y: auto;
}
.instrument-list {
  margin: 0;
  padding: 0;
  list-style: none;
  max-height: 9rem;
  overflow-y: auto;
}
.instrument-list li {
  display: flex;
  gap: 0.5rem;
  padding: 0.15rem 0.3rem;
  border-radius: 3px;
  cursor: default;
}
.instrument-list li.selected {
  background: #2f6fed;
  color: #fff;
}
.instrument-list li.selected .muted {
  color: inherit;
}
.instrument-list .instrument-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#info h2 {
  font-size: 0.85rem;
  margin: 0.2rem 0 0;
}
#info p {
  margin: 0;
}
:is(#info, #instruments-panel) .field {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
  flex: 1;
}
:is(#info, #instruments-panel) .field > span {
  color: var(--muted);
}
#info input:not([type='checkbox']),
#info textarea,
#info select,
#instruments-panel input:not([type='checkbox']),
#instruments-panel select {
  font: inherit;
  border: 1.5px solid var(--line);
  padding: 0.15rem 0.3rem;
  width: 100%;
}
#info input[type='color'] {
  height: 1.7rem;
  padding: 0.1rem;
}
#info input[aria-invalid] {
  border-color: var(--error);
}
#info .grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.3rem 0.5rem;
}
:is(#info, #instruments-panel) .row {
  display: flex;
  gap: 0.5rem;
}
:is(#info, #instruments-panel) .check {
  display: flex;
  gap: 0.3rem;
  align-items: center;
}
#info .problem {
  color: var(--error);
}
#info .suggestion button {
  font-family: ui-monospace, monospace;
}
/* Every window resizes from its bottom-right corner but stays on screen;
   a code window's editor takes the space the window gives it. */
.window.resizable {
  display: flex;
  flex-direction: column;
  max-width: calc(100vw - var(--window-left, 0px));
  max-height: calc(100dvh - var(--window-top, 140px) - 8px);
  overflow: auto;
  resize: both;
}
.window.resizable[hidden] {
  display: none;
}
.window.resizable > * {
  flex-shrink: 0;
}
.code-window {
  width: min(28rem, 100vw);
  height: 26rem;
  min-width: min(20rem, 100vw);
  min-height: min(16rem, calc(100dvh - var(--window-top, 140px) - 8px));
}
.code-editor {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.code-browser {
  width: min(54rem, 100vw);
  height: 34rem;
}
.code-browser > .code-browser-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  flex-shrink: 1;
}
.code-browser-columns {
  flex-shrink: 0;
  border-bottom: 1px solid var(--line);
}
/* Smalltalk-style columns, each narrowing the one to its left. */
.browser-columns {
  display: grid;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  /* A fixed row, so a long list scrolls inside its column instead of
     growing the grid past the window. */
  grid-template-rows: minmax(0, 1fr);
  height: 10rem;
}
.browser-column {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  border-right: 1px solid var(--line);
}
.browser-column:last-child {
  border-right: 0;
}
.browser-column h3 {
  margin: 0;
  padding: 0.15rem 0.4rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--line);
}
.browser-column ul {
  flex: 1;
  min-height: 0;
  overflow: auto;
  list-style: none;
  margin: 0;
  padding: 0;
}
.browser-column li button {
  display: block;
  width: 100%;
  border: 0;
  padding: 0.1rem 0.4rem;
  text-align: left;
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.browser-column li button[aria-current='true'] {
  background: var(--line);
  color: var(--panel);
}
.browser-column .path {
  opacity: 0.6;
}
.browser-column li.rename input {
  box-sizing: border-box;
  width: 100%;
  font-size: 0.8rem;
}
.browser-column li.rename [role='status'] {
  display: block;
  padding: 0 0.4rem;
  font-size: 0.75rem;
  color: var(--error);
}
.browser-column-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
  padding: 0.2rem;
  border-top: 1px solid var(--line);
}
.browser-column-footer button {
  font-size: 0.75rem;
}
.code-browser-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
/* One line between the columns and the editor: the Message Path, then the
   source's actions. */
.code-toolbar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0.4rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.8rem;
}
.code-toolbar [hidden] {
  display: none;
}
.code-toolbar .spacer {
  flex: 1;
}
.code-toolbar button {
  font-size: 0.8rem;
  padding: 0.05rem 0.5rem;
}
.code-toolbar .message-path {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
  padding: 0;
  border: 0;
}
.code-toolbar .message-path button {
  border: 0;
  padding: 0;
  text-decoration: underline;
  background: none;
  color: inherit;
}
.code-toolbar .message-path button[aria-current='true'] {
  font-weight: bold;
  text-decoration: none;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.test-results {
  max-height: 6rem;
  overflow: auto;
  margin: 0;
  padding: 0.2rem 0.4rem;
  border-top: 1px solid var(--line);
  font-size: 0.8rem;
}
.test-results p {
  margin: 0;
}
.test-results ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.test-results li.failed button {
  color: var(--error);
}
.test-results pre {
  font-size: 0.75rem;
  margin: 0 0 0.3rem 1rem;
  white-space: pre-wrap;
}
.dictionary-window {
  width: 30rem;
  height: 28rem;
}
.dictionary-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.dictionary-scope {
  margin: 0;
  padding: 0.2rem 0.4rem;
  font-size: 0.75rem;
  border-bottom: 1px solid var(--line);
}
.dictionary-content .browser-columns {
  flex-shrink: 0;
  border-bottom: 1px solid var(--line);
}
.dictionary-entry {
  flex: 1;
  overflow: auto;
  margin: 0;
  padding: 0.5rem;
  font-size: 0.85rem;
}
.dictionary-op > code {
  font-weight: bold;
  overflow-wrap: anywhere;
}
.dictionary-op p,
.dictionary-op ul,
.dictionary-op h4 {
  margin: 0.3rem 0;
}
.dictionary-op pre {
  margin: 0.2rem 0;
  white-space: pre-wrap;
}
.context-menu {
  position: fixed;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  min-width: 10rem;
  padding: 0.2rem 0;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 2px 2px 0 var(--line);
}
.context-menu button {
  border: 0;
  padding: 0.2rem 0.8rem;
  text-align: left;
}
.context-menu button:focus,
.context-menu button:hover:not(:disabled) {
  background: var(--line);
  color: var(--panel);
}
@media (max-width: 640px) {
  .browser-columns {
    grid-auto-flow: row;
    grid-auto-rows: minmax(0, 1fr);
    height: 16rem;
  }
  .browser-column {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}
.code-editor .cm-editor {
  height: 100%;
  font-size: 13px;
}
.code-editor .cm-scroller {
  overflow: auto;
}
.cm-scroller {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.cm-hint {
  font-size: 0.8em;
  opacity: 0.7;
  margin-right: 0.2em;
}
.cm-hover {
  white-space: pre-wrap;
  font-family: ui-monospace, monospace;
  padding: 0.3rem 0.5rem;
  max-width: 40rem;
}
.script-problems {
  border-top: 1px solid var(--line);
  padding: 0.3rem 0.5rem;
  font-size: 0.8rem;
}
.script-problems.bad {
  color: var(--error);
}

/* Breakpoints and the line a stopped Run is at (ADR 0147). */
.cm-breakpoints {
  width: 1.2em;
  cursor: pointer;
}
.bp {
  color: var(--error);
}
.bp-unverified {
  opacity: 0.4;
}
.cm-paused {
  background: var(--paused) !important;
}
/* The Playing Highlight (#2176): a Pattern Event's text while it sounds. */
.cm-playing {
  outline: 1.5px solid var(--accent);
  outline-offset: 0;
  border-radius: 2px;
}
/* Literal Editors (ADR 0175): the gutter mark and each pinned window. */
.literal-editor-mark {
  border: 0;
  background: none;
  padding: 0 0.2rem;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
}
.literal-editor-mark:hover {
  color: var(--accent);
}
.literal-editor-window {
  width: min(40rem, 100vw);
  height: 24rem;
  min-width: 16rem;
  min-height: 8rem;
}
/* A Literal Editor fills the window as it is resized. */
.literal-editor-window > .literal-editor-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  flex-shrink: 1;
  min-height: 0;
}
.literal-editor-notice:empty {
  display: none;
}
.literal-editor-notice {
  margin: 0;
  padding: 0.3rem 0.5rem;
  border-bottom: 1px solid var(--line);
  color: var(--error);
}
.literal-editor-window.unavailable .literal-editor-body {
  opacity: 0.4;
  pointer-events: none;
}
.code-toolbar .highlight-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.85rem;
}
.stopped-note {
  background: var(--paused);
  border-bottom: 1px solid var(--line);
  padding: 0.3rem 0.5rem;
  font-size: 0.8rem;
}

.punch-note {
  border-bottom: 1px solid var(--line);
  padding: 0.3rem 0.5rem;
  font-size: 0.8rem;
}

/* Header menus stay above the desk and floating windows. */
.menu {
  position: relative;
}
.menu summary {
  cursor: pointer;
}
.menu summary h1 {
  display: inline;
}
.menu-commands {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  z-index: 100;
  width: 15rem;
  padding: 0.4rem;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 3px 3px 0 rgb(0 0 0 / 30%);
}
.menu-commands button {
  display: flex;
  justify-content: space-between;
  width: 100%;
  border: 0;
  padding: 0.4rem 0.6rem;
  text-align: left;
}
.menu-commands [role='menuitemcheckbox'] {
  justify-content: flex-start;
}
.menu-commands [hidden] {
  display: none;
}
.menu-commands [role='menuitemcheckbox']::before {
  content: '';
  display: inline-block;
  width: 1.2em;
}
.menu-commands [aria-checked='true']::before {
  content: '✓';
}
.menu-commands kbd {
  font: inherit;
  color: var(--muted);
}

/* In-place rich text; its formatting controls head the Info window while editing. */
:is(#text-toolbar, #play-text-toolbar):not([hidden]) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.8rem;
}
#text-toolbar[data-scope='element']
  :is([data-text-command='paragraph'], [data-text-command='done']) {
  display: none;
}
:is(#text-toolbar, #play-text-toolbar) label {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
:is(#text-toolbar, #play-text-toolbar) input {
  width: 2rem;
  height: 1.7rem;
}
:is(#text-toolbar, #play-text-toolbar) [aria-pressed='true'] {
  background: var(--accent);
  color: white;
}
.page .el.text-editing {
  cursor: text;
  user-select: text;
  overflow: auto;
}
.el.text p {
  min-height: 1.35em;
}

/* Lasting banners: save failures, read-only viewing and other notices. */
.banner:not([hidden]) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.8rem;
  border-bottom: 1.5px solid var(--line);
  background: #fff3cd;
  font-size: 0.9rem;
}
.banner details {
  font-size: 0.8rem;
  color: var(--muted);
}

/* The Project list and the earlier-versions panel. */
#projects-window {
  width: 22rem;
}
#about-window {
  width: 18rem;
}
#about-panel {
  padding: 0.2rem 0.8rem 0.6rem;
  font-size: 0.85rem;
}
#about-panel h2 {
  font-size: 1.1rem;
  margin: 0.5rem 0;
}
#versions-window {
  width: 20rem;
}
#projects-panel,
#versions-panel {
  padding: 0.6rem;
  font-size: 0.85rem;
  max-height: calc(100vh - 12rem);
  overflow-y: auto;
}
#project-list,
#version-list {
  list-style: none;
  margin: 0 0 0.6rem;
  padding: 0;
}
#project-list li,
#version-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid #ddd;
}
#project-list .title,
#version-list .when {
  flex: 1;
  min-width: 8rem;
}
#project-list .current {
  font-weight: 700;
}
#project-list input {
  font: inherit;
  flex: 1;
  min-width: 8rem;
}
#projects-panel h3 {
  font-size: 0.9rem;
  margin: 0.6rem 0 0.3rem;
}
#example-list {
  list-style: none;
  margin: 0 0 0.4rem;
  padding: 0;
}
#example-list li {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
  padding: 0.35rem 0;
}
#storage-status {
  border-top: 1px solid #ddd;
  margin-top: 0.6rem;
}
#preview-note:not([hidden]) {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  align-items: center;
  background: #fff3cd;
  padding: 0.4rem;
  margin: 0 0 0.6rem;
}

.el.image:has(img) {
  border: 0;
  background: transparent;
}
.el.image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.message-path {
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid var(--line);
}
.message-path button {
  font-size: 0.8rem;
}
.script-problems {
  white-space: pre-wrap;
  max-height: 8rem;
  overflow: auto;
}

/* Edit controls cannot mutate or switch the authored Project while presenting. */
.playing #desk,
.playing #strip,
.playing #tools-window,
.playing #info-window,
.playing #sounds-window,
.playing #instruments-window,
.playing #projects-window,
.playing #versions-window,
.playing #errors-window,
.playing #variables-window,
.playing #message-window,
.playing #about-window,
.playing #file-menu,
.playing #edit-menu,
.playing #window-menu,
.playing #save-file,
.playing #save-file-as,
.playing #save-status,
.playing #core {
  display: none;
}
#reader {
  padding: 16px;
  overflow: auto;
  flex: 1;
}
/* The reader takes focus only to receive the reader's keys; it is not a
   control, so it shows no focus ring. Elements inside keep theirs. */
#reader:focus {
  outline: none;
}
/* Browsing plays the Page where it is edited, beside the windows. */
.browsing #caption,
.browsing #stage,
.browsing #strip,
.browsing #info-window,
.browsing #sounds-window {
  display: none;
}
#desk #reader {
  padding: 0;
  overflow: visible;
}
#desk #reader .play-scale {
  margin: 0 auto;
  border: 1.5px solid var(--line);
  box-shadow: 6px 6px 0 rgb(0 0 0 / 85%);
  box-sizing: content-box;
}
#reader .play-scale {
  position: relative;
}
/* Present places the Page with auto margins set from its alignment. */
.playing #reader {
  display: flex;
}
.playing #reader .play-scale {
  flex-shrink: 0;
}
#reader .page {
  position: absolute;
  top: 0;
  left: 0;
}
#reader .el[hidden] {
  display: none;
}
#reader .button {
  cursor: pointer;
}
#reader .button:focus-visible {
  outline: calc(2px / var(--scale, 1)) solid #2f6fed;
  outline-offset: calc(2px / var(--scale, 1));
}

.recipe-picker {
  padding: 12px;
  max-height: 340px;
  overflow: auto;
  border-bottom: 1px solid var(--line);
}
.recipe-picker label {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 8px 0;
}
.recipe-picker textarea {
  flex: 1;
}
.recipe-preview {
  max-height: 160px;
  overflow: auto;
  white-space: pre-wrap;
  font-size: 12px;
}
.script-window > .add-action {
  margin: 6px 12px;
  align-self: flex-start;
}
.recipe-picker [hidden] {
  display: none;
}

/* The `user` Grant's prompts cover the Page; notices sit at its top. */
.play-prompt-backdrop {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  background: rgb(0 0 0 / 25%);
}
.play-prompt-backdrop[hidden] {
  display: none;
}
.play-prompt {
  min-width: 260px;
  max-width: min(420px, 90vw);
  padding: 12px 16px;
  background: var(--panel);
  border: 1.5px solid var(--line);
  box-shadow: 6px 6px 0 rgb(0 0 0 / 85%);
}
.play-prompt p {
  margin: 0 0 10px;
  white-space: pre-wrap;
}
.play-prompt input[type='text'] {
  width: 100%;
  font: inherit;
}
.play-prompt-choices {
  display: grid;
  gap: 4px;
  max-height: 240px;
  overflow: auto;
}
.play-prompt-choices label {
  display: flex;
  gap: 6px;
  align-items: center;
}
.play-prompt-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}
.play-prompt .default {
  border-width: 2.5px;
}
.play-notices {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 11;
  display: grid;
  gap: 6px;
  pointer-events: none;
}
.play-notice {
  max-width: 280px;
  padding: 8px 12px;
  background: var(--panel);
  border: 1.5px solid var(--line);
  box-shadow: 3px 3px 0 rgb(0 0 0 / 85%);
  white-space: pre-wrap;
}
.play-notice strong {
  display: block;
}

/* Group geometry is a selection aid, never a painted or clipping container. */
.el.group {
  pointer-events: none;
  overflow: visible;
}
#page .el.group {
  outline: 1px dashed #6d7f9b;
}
#page .el.group.empty-group {
  pointer-events: auto;
  min-width: 12px;
  min-height: 12px;
  outline-style: dotted;
}
#page .el.group.selected {
  outline: 2px solid #2f6fed;
}

#message-window .message-context {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid var(--line);
}
#message-window .message-context select {
  flex: 1;
  min-width: 0;
}
#message-window .message-context [role='status'],
#message-window .message-log .context {
  font-size: 0.7rem;
  color: var(--muted);
}
#message-window .message-log .entry + .entry {
  margin-top: 0.5rem;
}

/* Diagnostics remain available when presenting. */
#performance-window {
  width: min(820px, calc(100vw - 24px));
  max-height: 80vh;
}
#performance-panel {
  padding: 12px;
  overflow: auto;
  max-height: calc(80vh - 32px);
}
.performance-charts {
  display: flex;
  gap: 12px;
}
.performance-charts figure {
  flex: 1;
  min-width: 0;
  margin: 8px 0;
}
.performance-charts svg {
  width: 100%;
  background: var(--panel);
}
.performance-cap {
  stroke: currentColor;
  stroke-dasharray: 3 3;
  opacity: 0.5;
}
.performance-script {
  border-top: 1px solid #aaa;
  padding: 8px 0;
}
.performance-script summary {
  cursor: pointer;
}
.performance-table {
  overflow-x: auto;
}
.performance-table table {
  border-collapse: collapse;
  width: 100%;
  font-variant-numeric: tabular-nums;
}
.performance-table th,
.performance-table td {
  text-align: right;
  padding: 4px 6px;
  white-space: nowrap;
}
.performance-table th:first-child {
  text-align: left;
}
body.playing #performance-window {
  z-index: 100;
}
/* Play, Pause and Step, side by side in the header. */
#play-controls {
  display: flex;
  gap: 0.3rem;
}
#play-controls [aria-pressed='true'] {
  background: var(--accent);
  color: white;
}
/* A paused Play Session ignores the reader, and says so. */
#reader.paused .page {
  cursor: not-allowed;
}
#reader.paused .play-scale::after {
  content: 'Paused';
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  padding: 0.1rem 0.5rem;
  background: var(--accent);
  color: white;
  font-size: 0.85rem;
  pointer-events: none;
  z-index: 1;
}
/* Watches: each one heads its own rows, and is greyed while Play runs. */
.variables-watches li.watch {
  display: block;
  padding: 0.2rem 0;
}
.variables-watches .watch-add,
.variables-watches .watch-head {
  display: flex;
  gap: 0.3rem;
  margin-bottom: 0.2rem;
}
.variables-watches .watch-add input {
  flex: 1;
  min-width: 0;
  font-family: ui-monospace, monospace;
}
.variables-watches .remove {
  margin-left: auto;
  padding: 0 0.4rem;
}
.variables-watches .error {
  color: #b00020;
}
.variables-watches .watch-effects {
  color: #8a5a00;
}
.variables-watches.stale li.watch {
  opacity: 0.6;
}
/* Copy as source (#1684). */
.variables-script .copy,
#message-window .message-log .copy {
  margin-left: auto;
  flex: 0 0 auto;
  border: 0;
  padding: 0 0.2rem;
  background: none;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
}
#message-window .message-log .copy {
  float: right;
}

.trust-prompt {
  max-width: min(32rem, calc(100vw - 32px));
  border: 1px solid var(--muted);
  border-radius: 8px;
}
.trust-prompt h2 {
  margin-top: 0;
  font-size: 1.1rem;
}
.trust-prompt code {
  overflow-wrap: anywhere;
}
.trust-prompt-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.music-sounds-dialog,
.sound-dialog {
  max-width: min(24rem, calc(100vw - 32px));
  border: 1px solid var(--muted);
  border-radius: 8px;
}
.music-sounds-dialog h2,
.sound-dialog h2 {
  margin-top: 0;
  font-size: 1.1rem;
}
.music-sounds-dialog select,
.sound-dialog input {
  width: 100%;
}
.music-sounds-buttons,
.sound-dialog-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}
.add-ons-dialog {
  max-width: min(32rem, calc(100vw - 32px));
  border: 1px solid var(--muted);
  border-radius: 8px;
}
.add-ons-dialog h2 {
  margin-top: 0;
  font-size: 1.1rem;
}
.add-ons-list {
  margin: 0;
  padding: 0;
  list-style: none;
}
.add-ons-list li p {
  margin: 2px 0 10px 24px;
}
.add-ons-list code {
  overflow-wrap: anywhere;
  font-size: 0.85em;
}
.add-ons-status:empty {
  display: none;
}
.add-ons-buttons {
  display: flex;
  justify-content: flex-end;
}

/* Browse's live-coding controls (ADR 0174): the tempo and bar. */
.play-clock {
  font-variant-numeric: tabular-nums;
}
.play-clock:empty {
  display: none;
}
