/* Theme tokens and shared document defaults. */
:root {
  --o-bg: #111315;
  --o-panel: #1d2023;
  --o-ink: #e1e1db;
  --o-muted: #a3a8a8;
  --o-accent: #d5bf91;
  --o-ascii: #bcc9c6;
  --o-line: #4e5051;
  --o-title-bg: #292c2e;
  --o-title-fill: #e1e1db;
  --o-title-ink: #1d2023;
  --o-menu-ink: #f3eee2;
  --o-menu-muted: #c8c5bc;
  --o-accent-ink: #172019;
  --o-focus: #f3eee2;
  --o-scan: 0.04;
  --o-split: 46;
  --page-gutter: clamp(0px, 1.6vw, 24px);
  color-scheme: dark;
  --o-edge-light: color-mix(in srgb, var(--o-ink) 40%, var(--o-panel));
  --o-edge-dark: color-mix(in srgb, var(--o-bg) 65%, #000);
  --o-raised-border: var(--o-edge-light) var(--o-edge-dark) var(--o-edge-dark) var(--o-edge-light);
  --o-inset-border: var(--o-edge-dark) var(--o-edge-light) var(--o-edge-light) var(--o-edge-dark);
  font: 16px/1.4 var(--o-font-ui, 'Lucida Console', monospace);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: #0b0d0e;
  color: var(--o-ink);
  padding: var(--page-gutter);
}
button,
input,
select {
  font: inherit;
}
button,
summary {
  touch-action: manipulation;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: default;
  opacity: 0.45;
}
button,
select,
input {
  border-radius: 0;
}
button:focus-visible,
a:focus-visible,
summary:focus-visible,
input:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--o-focus);
  outline-offset: 3px;
}
.o-menu > summary:focus-visible {
  outline-color: currentColor;
  outline-offset: -4px;
}
.o-language select:focus-visible {
  outline-color: var(--o-title-ink);
}
.o-header a:focus-visible,
.o-terminal-title button:focus-visible {
  outline-color: var(--o-title-ink);
}
[hidden] {
  display: none !important;
}
a {
  color: inherit;
  text-underline-offset: 3px;
}
.skip-link {
  position: fixed;
  top: 8px;
  left: 12px;
  z-index: 100;
  max-width: calc(100vw - 24px);
  padding: 10px 14px;
  color: #172019;
  background: #eddbad;
  transform: translateY(-150%);
}
.skip-link:focus {
  transform: none;
}
/* Application shell, header, and primary settings bar. */
.o-app {
  height: calc(var(--o-viewport-height, 100dvh) - var(--page-gutter) * 2);
  min-height: 0;
  min-width: 0;
  width: 100%;
  max-width: 1560px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: var(--o-bg);
  color: var(--o-ink);
  border: 3px solid;
  border-color: var(--o-raised-border);
  border-radius: 0;
  box-shadow: 6px 6px 0 #0008;
  isolation: isolate;
}
.o-header {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 8px 12px;
  border-bottom: 2px solid var(--o-edge-dark);
  background: var(--o-title-fill);
  color: var(--o-title-ink);
}
.o-bar {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  flex-shrink: 0;
  position: relative;
  /* Workstation menus remain reachable above nonmodal windows. */
  z-index: 90;
  background: var(--o-panel);
  padding: 3px;
  gap: 3px;
}
.o-wordmark {
  color: inherit;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  letter-spacing: 0.1em;
}
.o-wordmark::before {
  content: '';
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  border: 2px solid currentColor;
  box-shadow:
    inset 3px 3px 0 var(--o-title-fill),
    inset 5px 5px 0 currentColor;
}
.o-brand {
  white-space: nowrap;
}
.o-brand span {
  opacity: 0.75;
}
.o-language {
  display: flex;
  letter-spacing: normal;
}
.o-language select {
  padding: 6px 4px;
  color: var(--o-menu-muted);
  background: var(--o-panel);
  font-size: 16px;
  width: 104px;
}
.o-language option {
  background: var(--o-panel);
  color: var(--o-menu-ink);
}
.o-top-links {
  display: flex;
  align-items: center;
  letter-spacing: normal;
  gap: 12px;
}
.o-portfolio-note {
  max-width: 260px;
  color: inherit;
  text-align: right;
  font-size: 16px;
}
.o-portfolio-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-height: 44px;
  padding: 10px 18px;
  background: var(--o-accent);
  color: var(--o-accent-ink);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  font-size: 16px;
}
.o-header .o-portfolio-link {
  min-height: 36px;
  padding-block: 5px;
  background: var(--o-panel);
  color: var(--o-menu-ink);
}
.o-portfolio-link:hover {
  filter: brightness(1.1);
}
.o-library-link {
  color: var(--o-accent);
}
/* Settings menus, common controls, and palette editor. */
.o-menu {
  flex: 1;
  position: relative;
  min-width: 0;
  background: var(--o-panel);
  color: var(--o-menu-muted);
  border: 2px solid;
  border-color: var(--o-raised-border);
}
.o-menu:first-child {
  border-radius: 0;
}
.o-menu > summary {
  cursor: pointer;
  user-select: none;
  list-style: none;
  white-space: nowrap;
  text-align: center;
  font-size: 16px;
  padding: 5px 8px;
  min-height: 36px;
}
.o-menu > summary:hover,
.o-menu[open] > summary {
  color: var(--o-menu-ink);
  background: var(--o-title-bg);
  box-shadow: inset 0 2px var(--o-accent);
}
.o-menu summary::-webkit-details-marker {
  display: none;
}
.o-menu > summary::after {
  content: '⌃';
  margin-left: 8px;
  font-size: 16px;
}
.o-dropdown {
  position: absolute;
  bottom: calc(100% + 5px);
  left: 0;
  width: 290px;
  max-height: min(660px, var(--o-menu-space, calc(100dvh - 110px)));
  overflow: auto;
  overscroll-behavior: contain;
  padding: 17px;
  background: var(--o-panel);
  color: var(--o-menu-ink);
  border: 3px solid;
  border-color: var(--o-raised-border);
  box-shadow: 5px 5px 0 #0009;
  font-size: 16px;
}
.o-menu[data-menu='sound'] .o-dropdown,
.o-menu[data-menu='session'] .o-dropdown,
.o-menu[data-menu='help'] .o-dropdown {
  left: auto;
  right: 0;
}
.o-field {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin: 0 0 17px;
}
.o-field output {
  margin-left: auto;
  color: var(--o-menu-muted);
  font-size: 16px;
}
.o-field select {
  width: 100%;
  padding: 7px;
  color: var(--o-menu-ink);
  background: var(--o-panel);
}
.o-field input[type='range'] {
  width: 100%;
  accent-color: var(--o-accent);
  margin: 4px 0;
  appearance: none;
  height: 6px;
  background: var(--o-bg);
  border: 1px solid var(--o-line);
}
.o-field input[type='range']::-moz-range-thumb {
  width: 12px;
  height: 16px;
  border: 2px solid;
  border-color: var(--o-raised-border);
  border-radius: 0;
  background: var(--o-ink);
}
.o-field input[type='range']::-webkit-slider-thumb {
  appearance: none;
  width: 16px;
  height: 20px;
  border: 2px solid;
  border-color: var(--o-raised-border);
  border-radius: 0;
  background: var(--o-ink);
}
.o-check {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 13px 0;
}
.o-check input {
  width: 17px;
  height: 17px;
  accent-color: var(--o-accent);
  flex-shrink: 0;
}
.o-menu-note {
  margin: 14px 0 0;
  color: var(--o-menu-muted);
  line-height: 1.6;
  font-size: 16px;
}
.o-action {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 10px 13px;
  background: var(--o-accent);
  color: var(--o-accent-ink);
}
.o-action:hover:not(:disabled) {
  filter: brightness(1.1);
}
.o-secondary {
  margin-top: 15px;
  background: transparent;
  border-color: var(--o-menu-muted);
  color: var(--o-menu-ink);
}
.o-volume {
  margin: 18px 0 0;
}
.o-stripes {
  flex-shrink: 0;
  background: var(--o-accent);
  height: 2px;
  opacity: 1;
  margin-inline: 5px;
}
.o-color-menu {
  width: 350px;
}
.o-color-help {
  margin: -4px 0 16px;
}
.o-color-adjust {
  border: 1px solid var(--o-menu-muted);
  margin: 0;
  padding: 10px 13px 0;
  min-width: 0;
}
.o-color-adjust legend {
  padding: 0 5px;
  font-size: 16px;
}
.o-color-adjust .o-field {
  margin-bottom: 12px;
}
.o-color-adjust input[type='range'] {
  min-height: 24px;
}
.o-color-preview {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: -2px 0 14px;
}
#color-swatch {
  width: 28px;
  height: 28px;
  border: 1px solid var(--o-menu-muted);
  background: var(--o-selected-color);
}
#color-selected {
  font-size: 16px;
}
.o-hex-fields {
  margin-top: 14px;
}
.o-hex-fields summary {
  padding: 7px 0;
  cursor: pointer;
}
.o-hex-fields .o-color-grid {
  margin-top: 10px;
}
#color-contrast {
  margin-bottom: 6px;
}
.o-color-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 11px 14px;
}
.o-color-grid label {
  display: grid;
  gap: 4px;
  font-size: 16px;
}
.o-color-grid input {
  width: 100%;
  min-width: 0;
  padding: 6px 7px;
  background: var(--o-panel);
  color: var(--o-menu-ink);
}
.o-color-grid input[aria-invalid='true'] {
  border-style: dashed;
}
.o-color-group {
  grid-column: 1 / -1;
  color: var(--o-menu-muted);
  letter-spacing: 0.1em;
  margin-top: 4px;
  font-size: 16px;
}
.o-color-feedback {
  color: var(--o-menu-ink);
  margin: 12px 0 0;
  font-size: 16px;
}
.o-color-feedback:empty {
  display: none;
}
.o-session-identity {
  margin: 0 0 14px;
  overflow-wrap: anywhere;
}
.o-help-menu {
  width: 345px;
  line-height: 1.65;
}
.o-help-menu p {
  margin: 0 0 12px;
}
.o-help-menu p:not(:first-child) {
  margin-top: 12px;
}
.o-help-menu .o-menu-heading {
  color: var(--o-menu-ink);
  font-size: 16px;
}
.o-help-menu code {
  font: inherit;
  color: var(--o-menu-ink);
  background: var(--o-title-bg);
  padding: 1px 4px;
}
.o-help-menu > code {
  display: block;
  overflow-wrap: anywhere;
  padding: 5px 7px;
  margin: 5px 0;
}
.o-help-menu a {
  font-size: 16px;
}
/* Shared raised and inset control chrome. */
.o-menu[open],
.o-menu:active {
  border-color: var(--o-inset-border);
}
.o-action,
.o-portfolio-link,
.o-tiny-button,
.o-program-tool,
.o-program-choice {
  border-width: 2px;
  border-style: solid;
  border-color: var(--o-raised-border);
  box-shadow: 1px 1px 0 var(--o-edge-dark);
}
.o-action:active:not(:disabled),
.o-portfolio-link:active,
.o-tiny-button:active,
.o-program-tool:active,
.o-program-choice:active {
  border-color: var(--o-inset-border);
  box-shadow: none;
}
.o-field select,
.o-language select,
.o-color-grid input {
  border: 2px solid;
  border-color: var(--o-inset-border);
}
/* Layered screen background and upper ASCII/content display. */
.o-screen {
  flex: 1;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  margin: 5px;
  border: 2px solid;
  border-color: var(--o-inset-border);
}
.o-site-background {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: var(--o-background-opacity, 0.25);
  pointer-events: none;
  z-index: -1;
  image-rendering: pixelated;
}
.o-screen {
  isolation: isolate;
  background: var(--o-bg);
}
.o-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: var(--o-background-tile, none);
  opacity: var(--o-background-opacity, 0.25);
  image-rendering: pixelated;
}
.o-app[data-background='true'] .o-terminal {
  background: color-mix(in srgb, var(--o-panel) 65%, transparent);
}
.o-app[data-background='true'] .o-terminal-emulator .xterm-viewport {
  background-color: transparent;
}
@media (prefers-reduced-motion: reduce) {
  .o-site-background,
  .o-screen::before {
    display: none;
  }
}
.o-screen::after {
  content: '';
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: 8;
  background: repeating-linear-gradient(to bottom, transparent 0 2px, #050d09 2px 3px);
  opacity: var(--o-scan);
  box-shadow: inset 0 0 60px #0003;
}
.o-main {
  flex: 0 1 calc(var(--o-split) * 1%);
  min-height: 160px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 12px 18px 9px;
}
.o-stage-head,
.o-stage-foot,
.o-terminal-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.o-stage-head {
  color: var(--o-muted);
  flex-shrink: 0;
  font-size: 16px;
  letter-spacing: 0;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--o-line);
}
.o-object-label {
  color: var(--o-accent);
}
.o-visual {
  flex: 1;
  min-height: 0;
  min-width: 0;
  position: relative;
  display: grid;
  place-items: center;
  margin: 4px 0;
  overflow: hidden;
}
.o-object-frame {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  /* Explicit dimensions keep size containment from changing the surrounding grid. */
  container: ascii-display / size;
}
.o-ascii {
  padding: 0;
  margin: 0;
  font:
    var(--o-ascii-size, 12px) / var(--o-ascii-leading, 11px) 'Courier New',
    Courier,
    monospace;
  color: var(--o-ascii);
  white-space: pre;
  user-select: none;
  text-shadow: 0 0 3px color-mix(in srgb, var(--o-ascii) 20%, transparent);
}
/* Short, wide displays need more character rows, rather than larger glyphs. */
@container ascii-display (min-width: 800px) {
  .o-ascii {
    --o-ascii-size: clamp(4px, 3.636364cqh, 12px);
    --o-ascii-leading: 0.916667;
  }
}
.o-app[data-glow='false'] .o-ascii,
.o-app[data-glow='false'] .o-terminal-emulator .xterm .xterm-screen {
  text-shadow: none;
}
.o-stage-foot {
  color: var(--o-muted);
  flex-shrink: 0;
  font-size: 16px;
}
.o-status {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 65%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.o-status::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--o-accent);
  flex-shrink: 0;
}
.o-tiny-button {
  color: var(--o-ink);
  padding: 4px 9px;
  font-size: 16px;
  background: var(--o-title-bg);
}
.o-tiny-button:hover {
  background: var(--o-title-bg);
}
.o-divider {
  flex: 0 0 9px;
  height: 9px;
  display: grid;
  place-items: center;
  border-block: 1px solid var(--o-line);
  color: var(--o-muted);
  line-height: 4px;
  cursor: row-resize;
  touch-action: none;
  user-select: none;
  position: relative;
  z-index: 9;
  background: repeating-linear-gradient(
    to bottom,
    var(--o-edge-dark) 0 1px,
    var(--o-title-bg) 1px 3px
  );
  border-block-color: var(--o-edge-light);
}
.o-divider span {
  letter-spacing: 3px;
  background: var(--o-panel);
  padding-inline: 12px;
  transform: none;
}
/* Terminal chrome, boot feedback, and emulator viewport. */
.o-terminal {
  flex: 1;
  min-height: 220px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--o-panel);
}
.o-terminal-title {
  flex-shrink: 0;
  padding-inline: 20px;
  background: var(--o-title-fill);
  color: var(--o-title-ink);
  min-height: 36px;
  padding-block: 4px;
  border-block: 1px solid;
  border-color: var(--o-edge-light) var(--o-edge-dark);
}
.o-terminal-title strong {
  font-weight: 400;
  color: inherit;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.o-terminal-title strong::before {
  content: '>_';
  color: inherit;
}
.o-terminal-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.o-runtime-label {
  color: inherit;
  white-space: nowrap;
  font-size: 16px;
  letter-spacing: 0;
}
.o-runtime-label[data-status='ready'] {
  color: inherit;
}
.o-runtime-label[data-status='error'] {
  color: inherit;
  text-decoration: underline;
}
.o-terminal-actions button {
  width: 27px;
  padding: 2px 5px;
  font-size: 14px;
}
#compact-return-object {
  display: none;
}
.o-terminal-content {
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.o-boot-panel {
  display: flex;
  align-items: center;
  gap: 30px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--o-line);
}
.o-boot-copy {
  flex: 1;
  min-width: 0;
}
.o-boot-copy p {
  margin: 0;
  color: var(--o-muted);
  line-height: 1.65;
  font-size: 16px;
}
.o-boot-copy .o-boot-heading {
  color: var(--o-ink);
  margin-bottom: 4px;
  font-size: 16px;
}
.o-boot-button {
  width: auto;
  min-width: 155px;
  flex-shrink: 0;
}
.o-boot-panel.is-working {
  padding-block: 9px;
  gap: 16px;
}
.o-boot-panel.is-working .o-boot-heading {
  display: none;
}
.o-boot-panel.is-working .o-boot-button {
  padding-block: 6px;
}
.o-startup-details {
  margin-top: 5px;
}
.o-startup-details[hidden] {
  display: none;
}
.o-boot-copy .o-startup-note {
  color: var(--o-ink);
  font-size: 16px;
}
.o-startup-note:empty {
  display: none;
}
.o-startup-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  align-items: center;
  color: var(--o-muted);
  line-height: 1.65;
  font-size: 16px;
}
#startup-elapsed {
  font-variant-numeric: tabular-nums;
}
.o-startup-meta a {
  text-underline-offset: 3px;
}
.o-startup-meta a:focus-visible {
  outline-offset: 3px;
}
/* FitAddon measures #terminal's full height. Keep its inset outside that box. */
.o-terminal-viewport {
  min-height: 0;
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 12px 17px 6px 20px;
}
.o-terminal-emulator {
  min-height: 0;
  min-width: 0;
  /* Scale the 80-cell screen with xterm; keep the surrounding viewport uncapped. */
  width: min(100%, calc(80ch + 16px));
  align-self: center;
  font: var(--o-terminal-font-size, 16px) / 1 var(--o-font-terminal, 'Lucida Console', monospace);
  letter-spacing: 0;
  flex: 1;
  overflow: hidden;
}
.o-terminal-emulator .xterm {
  height: 100%;
}
.o-terminal-emulator .xterm-helper-textarea {
  font-size: 16px !important;
}
.o-terminal-emulator .xterm-viewport {
  scrollbar-width: thin;
  scrollbar-color: var(--o-line) var(--o-panel);
}
.o-terminal-emulator .xterm .xterm-screen {
  text-shadow: 0 0 2px color-mix(in srgb, var(--o-ink) 10%, transparent);
}
.o-app:not([data-runtime='ready']) .o-terminal-emulator:empty {
  display: none;
}
.o-footer {
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  border-top: 1px solid var(--o-line);
  color: var(--o-muted);
  font-size: 16px;
  letter-spacing: 0;
  gap: 4px;
  padding: 4px;
  background: var(--o-title-bg);
}
.o-footer > span:first-child {
  flex: 1;
}
.o-footer > span {
  padding: 2px 7px;
  border: 1px solid;
  border-color: var(--o-inset-border);
}
.o-live {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
/* Gallery and Markdown content inside the upper display. */
.o-gallery {
  width: 100%;
  height: 100%;
  margin: 0;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
/* Size the display independently of source pixels, including small retro variants. */
.o-gallery img {
  display: block;
  width: 100%;
  height: 0;
  min-height: 0;
  flex: 1 1 0;
  object-fit: contain;
  image-rendering: pixelated;
}
.o-gallery-caption {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--o-muted);
  padding-top: 7px;
  font-size: 16px;
}
.o-gallery-caption span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.o-gallery-caption span:not(:first-child) {
  flex-shrink: 0;
}
.o-gallery-navigation {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding-top: 7px;
}
.o-page {
  height: 100%;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 12px 18px;
  scrollbar-color: var(--o-muted) var(--o-panel);
}
.o-page:focus-visible {
  outline-offset: -2px;
}
.o-app[data-page='true'] .o-object-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.o-maximized .o-main,
.o-maximized .o-divider,
.o-maximized .skip-link[href='#stage'] {
  display: none;
}
.o-maximized .o-terminal {
  min-height: 0;
}
.o-noscript {
  max-width: 900px;
  margin: 20px auto;
  color: #f3eee2;
}
/* Responsive shell and small-screen layout adjustments. */
/* A desktop workstation is a 4:3 frame bounded by both viewport axes. */
@media (min-width: 1000px) and (min-height: 700px) {
  body {
    display: grid;
    place-items: center;
    min-height: 100dvh;
  }
  .o-app:not([data-compact-input='true']) {
    width: min(
      100%,
      1560px,
      calc((var(--o-viewport-height, 100dvh) - var(--page-gutter) * 2) * 4 / 3)
    );
    height: auto;
    aspect-ratio: 4 / 3;
  }
}

@media (max-width: 380px) {
  .o-wordmark .o-brand {
    font-size: 12px;
    letter-spacing: 0.1em;
  }
  .o-brand span {
    display: none;
  }
}

/* Software-keyboard and condensed-display layouts. */
/* Let the guest, editor cursor and control keys fit above a software keyboard. */
.o-app[data-compact-input='true'] .o-divider,
.o-app[data-compact-input='true'] .o-header,
.o-app[data-compact-input='true'] .o-footer {
  display: none;
}
.o-app[data-compact-input='true'] .o-terminal {
  min-height: 0;
}
.o-app[data-compact-input='true'] {
  position: fixed;
  top: calc(var(--o-viewport-offset, 0px) + var(--page-gutter));
  left: var(--page-gutter);
  right: var(--page-gutter);
  width: auto;
  height: calc(var(--o-viewport-height, 100dvh) - var(--page-gutter) * 2);
  aspect-ratio: auto;
  max-width: none;
  z-index: 30;
}
.o-condensed-display .o-main {
  display: flex;
  position: absolute;
  top: 3px;
  right: 56px;
  width: 96px;
  height: 42px;
  min-height: 0;
  padding: 0;
  z-index: 2;
  pointer-events: none;
}
.o-condensed-display .o-visual {
  margin: 0;
  height: 100%;
  width: 100%;
}
.o-condensed-display .o-stage-head,
.o-condensed-display .o-stage-foot,
.o-condensed-display .o-gallery-caption,
.o-condensed-display .o-gallery-navigation {
  display: none;
}
.o-condensed-display .o-ascii {
  font-size: 5px;
  line-height: 4px;
}
.o-condensed-display .o-terminal-title {
  min-height: 48px;
  padding-block: 2px;
}
.o-condensed-display .o-terminal-actions button {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  padding: 0;
}
.o-condensed-display #compact-return-object {
  display: none;
}
.o-condensed-display[data-gallery='true'] #compact-return-object {
  display: inline-grid;
}
.o-condensed-display:not(.o-maximized) .o-terminal-title {
  position: relative;
  padding-right: 156px;
}
.o-condensed-display:not(.o-maximized) .o-terminal-actions {
  position: absolute;
  right: 4px;
  top: 2px;
  gap: 4px;
}
.o-condensed-display[data-gallery='true'] .o-main {
  right: 104px;
}
.o-condensed-display[data-gallery='true']:not(.o-maximized) .o-terminal-title {
  padding-right: 208px;
}
.o-condensed-display:not(.o-maximized) .o-runtime-label {
  display: none;
}
.o-condensed-display:not([data-runtime='ready']) .o-main,
.o-condensed-display:not([data-runtime='ready']) .skip-link[href='#stage'],
.o-app.o-maximized .o-main {
  display: none;
}
@media (max-width: 900px) {
  .o-bar {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .o-header {
    padding: 10px 15px;
    gap: 12px;
  }
  .o-portfolio-note {
    display: none;
  }
  .o-menu > summary::after {
    margin-left: 4px;
  }
  .o-dropdown {
    font-size: 13px;
  }

  .o-app {
    padding-top: env(safe-area-inset-top);
    padding-right: env(safe-area-inset-right);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
  }
}
@media (max-height: 600px) {
  .o-main {
    min-height: 100px;
  }
  .o-terminal {
    min-height: 0;
  }
}
@media (max-width: 900px) and (max-height: 560px) {
  .o-main,
  .o-divider,
  .o-app:not([data-page='true']):not([data-music='true']):not([data-display-focus='true'])
    .skip-link[href='#stage'] {
    display: none;
  }
}
/* Reading needs a full panel even while the software keyboard condenses the ASCII display. */
.o-app[data-page='true']:not(.o-maximized) .o-main,
.o-app[data-music='true']:not(.o-maximized) .o-main,
.o-app[data-display-focus='true']:not(.o-maximized) #stage {
  display: flex;
  position: relative;
  top: auto;
  right: auto;
  width: auto;
  height: auto;
  flex: 0 1 calc(var(--o-split) * 1%);
  min-height: 120px;
  padding: 10px 14px;
  pointer-events: auto;
}
.o-app[data-page='true'] .o-visual,
.o-app[data-music='true'] .o-visual {
  height: auto;
}
.o-app[data-page='true'] .o-stage-head,
.o-app[data-page='true'] .o-stage-foot,
.o-app[data-music='true'] .o-stage-head,
.o-app[data-music='true'] .o-stage-foot {
  display: flex;
}
.o-app[data-page='true'] .o-stage-head {
  min-height: 20px;
}
/* Keep the active upper view visible when focus returns to its content. */
/* IDs also override feature-specific condensed layouts loaded after this stylesheet. */
.o-app[data-display-focus='true']:not(.o-maximized) #stage {
  z-index: auto;
}
.o-app[data-display-focus='true']:not(.o-maximized) #visual {
  width: auto;
  height: auto;
  margin: 4px 0;
}
.o-app[data-display-focus='true']:not(.o-maximized)
  #stage
  :is(.o-stage-head, .o-stage-foot, .o-gallery-caption, .o-gallery-navigation) {
  display: flex;
}
.o-app[data-display-focus='true']:not(.o-maximized) #stage .o-stage-head {
  min-height: 20px;
}
.o-app[data-display-focus='true']:not(.o-maximized) #ascii {
  font-size: var(--o-ascii-size, 12px);
  line-height: var(--o-ascii-leading, 11px);
}
.o-app[data-display-focus='true']:not(.o-maximized) .o-terminal {
  min-height: 0;
}
/* A short panel may scroll its gallery instead of clipping keyboard-reachable controls. */
.o-app[data-display-focus='true'][data-gallery='true']:not(.o-maximized) #visual {
  place-items: start stretch;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.o-app[data-display-focus='true']:not(.o-maximized) #gallery {
  min-height: 120px;
  justify-content: flex-start;
}
.o-app[data-display-focus='true']:not(.o-maximized) #stage .o-gallery-navigation {
  padding-inline: 3px;
  padding-bottom: 4px;
}
.o-app[data-display-focus='true'] :is(#stage, #object-frame, #gallery):focus-visible {
  outline-offset: -3px;
}
@media (pointer: coarse) {
  .o-portfolio-link {
    min-width: 44px;
    min-height: 44px;
  }
  .o-language select {
    min-height: 44px;
  }
  .o-menu > summary,
  .o-action,
  .o-dropdown select,
  .o-color-grid input {
    min-height: 44px;
  }
  .o-color-adjust input[type='range'] {
    min-height: 44px;
  }
  .o-color-grid input,
  .o-dropdown select {
    font-size: 16px;
  }
  .o-tiny-button {
    min-height: 44px;
  }
  .o-terminal-actions button {
    min-width: 44px;
  }
  .o-divider {
    flex-basis: 14px;
  }
  .o-dropdown .o-check {
    min-height: 44px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
  }
}
@media (max-width: 680px) {
  :root {
    --page-gutter: 0px;
  }
  .o-app {
    border: 2px solid;
    border-color: var(--o-raised-border);
    border-radius: 0;
    min-height: 0;
  }
  .o-bar {
    border-radius: 0;
    gap: 2px;
    padding: 2px;
  }
  .o-header {
    padding: 6px 8px;
    border-radius: 0;
    gap: 10px;
  }
  .o-portfolio-link {
    padding-inline: 12px;
    gap: 10px;
  }
  .o-menu {
    min-width: 0;
    width: 100%;
  }
  .o-menu:first-child,
  .o-menu:last-child {
    border-radius: 0;
  }
  .o-menu > summary::after {
    display: none;
  }
  .o-dropdown {
    position: fixed;
    bottom: var(--o-menu-bottom, 44px);
    left: 10px !important;
    right: 10px !important;
    width: auto;
    max-height: var(--o-menu-space, calc(100dvh - 94px));
    transform: none;
  }
  .o-color-menu {
    max-width: 400px;
    margin-inline: auto;
  }
  .o-main {
    min-height: 145px;
    padding: 8px 10px;
  }
  .o-stage-foot {
    gap: 8px;
  }
  .o-stage-foot .o-tiny-button {
    font-size: 10px;
  }
  .o-terminal {
    min-height: 250px;
  }
  .o-terminal-title {
    padding-inline: 13px;
  }
  .o-terminal-actions {
    gap: 6px;
  }
  .o-terminal-viewport {
    padding: 9px 8px 5px 10px;
  }
  .o-boot-panel {
    padding: 13px;
    gap: 12px;
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .o-boot-button {
    min-width: 112px;
    padding: 9px;
    font-size: 16px;
    gap: 10px;
  }
  .o-screen {
    margin: 3px;
  }
  .o-wordmark {
    gap: 6px;
    letter-spacing: 0;
  }
  .o-wordmark::before {
    display: none;
  }
  .o-brand span {
    display: none;
  }
  .o-top-links {
    gap: 6px;
  }
  .o-header .o-portfolio-link {
    padding-inline: 8px;
    gap: 6px;
  }
  .o-language select {
    width: 88px;
  }
  .o-menu > summary {
    padding: 7px 4px;
    min-height: 44px;
    font-size: 16px;
    line-height: 1.25;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .o-boot-copy {
    flex-basis: 60%;
  }
  .o-stage-head,
  .o-stage-foot,
  .o-footer {
    font-size: 14px;
  }
  .o-terminal-title strong::before {
    display: none;
  }
}
@media (min-width: 681px) and (max-width: 900px) {
  .o-menu > summary {
    min-height: 44px;
  }
  /* Each wrapped row anchors its menus toward the available screen space. */
  .o-bar .o-menu .o-dropdown {
    left: 0;
    right: auto;
  }
  .o-menu:nth-child(3n) .o-dropdown {
    left: auto;
    right: 0;
  }
}

/* Reclaim object rows from decorative spacing in short desktop workspaces. */
@media (min-width: 901px) and (max-height: 600px) {
  .o-app:not(.o-maximized) #stage {
    padding-block: 5px;
  }
  .o-app:not(.o-maximized) #stage .o-stage-head {
    padding-bottom: 3px;
  }
  .o-app:not(.o-maximized) #stage #visual {
    margin-block: 2px;
  }
}
