/* Editable lecture examples backed by the local JupyterLite Python REPL. */
.opt-live-code {
  margin: .8rem 0 1.4rem;
  border: 1px solid color-mix(in srgb, var(--md-primary-fg-color) 28%, var(--md-default-fg-color--lightest));
  border-radius: .68rem;
  background: var(--md-default-bg-color);
  overflow: hidden;
  box-shadow: 0 .12rem .5rem color-mix(in srgb, var(--md-primary-fg-color) 7%, transparent);
}
.opt-live-code__output[hidden] { display: none !important; }
.opt-live-code__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .55rem .7rem;
  border-bottom: 1px solid color-mix(in srgb, var(--md-primary-fg-color) 45%, transparent);
  background: color-mix(in srgb, var(--md-primary-fg-color) 10%, var(--md-default-bg-color));
}
.opt-live-code__label {
  font-weight: 750;
  color: var(--md-default-fg-color--light);
}
.opt-live-code__actions {
  display: flex;
  flex-wrap: wrap;
  gap: .42rem;
}
.opt-live-code button {
  appearance: none;
  border: 1px solid #347d2e;
  border-radius: .42rem;
  padding: .4rem .68rem;
  font: inherit;
  font-weight: 680;
  cursor: pointer;
  background: #419d3a;
  color: #fff;
}
.opt-live-code button:hover { filter: brightness(.96); }
.opt-live-code button:disabled { cursor: wait; opacity: .7; }
.opt-live-code__copy,
.opt-live-code__reset {
  background: transparent !important;
  color: #347d2e !important;
}

.opt-live-code__editor {
  box-sizing: border-box;
  width: 100%;
  min-height: 8rem;
  max-height: 34rem;
  margin: 0;
  border: 0;
  padding: .92rem 1rem;
  overflow: auto;
  white-space: pre;
  overflow-wrap: normal;
  tab-size: 4;
  font-family: var(--md-code-font-family, monospace);
  font-size: .82rem;
  line-height: 1.55;
  color: var(--md-code-fg-color);
  background: var(--md-code-bg-color);
  caret-color: var(--md-code-fg-color);
  cursor: text;
  user-select: text;
  outline: 0;
}
.opt-live-code__editor:focus {
  box-shadow: inset 0 0 0 2px color-mix(in srgb, #419d3a 62%, transparent);
}
.opt-live-code__editor::selection,
.opt-live-code__editor *::selection {
  color: inherit;
  background: color-mix(in srgb, #419d3a 25%, transparent);
}

.opt-code-comment { color: #6a737d; font-style: italic; }
.opt-code-string { color: #0b7a53; }
.opt-code-number { color: #b31d28; }
.opt-code-keyword { color: #7c3aed; font-weight: 600; }
.opt-code-builtin { color: #176b31; font-weight: 600; }
.opt-code-function { color: #8a4b08; }
.opt-code-operator { color: #7c2d12; }
[data-md-color-scheme="slate"] .opt-code-comment { color: #9ca3af; }
[data-md-color-scheme="slate"] .opt-code-string { color: #86efac; }
[data-md-color-scheme="slate"] .opt-code-number { color: #fca5a5; }
[data-md-color-scheme="slate"] .opt-code-keyword { color: #c4b5fd; }
[data-md-color-scheme="slate"] .opt-code-builtin { color: #86efac; }
[data-md-color-scheme="slate"] .opt-code-function { color: #fcd34d; }
[data-md-color-scheme="slate"] .opt-code-operator { color: #fdba74; }

.opt-live-code__output {
  border-top: 1px solid var(--md-default-fg-color--lightest);
  background: var(--md-default-bg-color);
}
.opt-live-code__starting,
.opt-live-code__error {
  padding: .7rem .85rem;
  color: var(--md-default-fg-color--light);
  font-size: .9rem;
}
.opt-live-code__error { color: var(--md-typeset-color); }
.opt-live-code__frame {
  display: block;
  width: 100%;
  border: 0;
  background: var(--md-default-bg-color);
}

@media (max-width: 760px) {
  .opt-live-code__header {
    align-items: stretch;
    flex-direction: column;
  }
  .opt-live-code__actions {
    display: grid;
    grid-template-columns: 1fr;
  }
  .opt-live-code button { width: 100%; }
  .opt-live-code__editor { font-size: .78rem; }
}
