.tiny_algorithm-editor {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    min-width: 0;
}

.tiny_algorithm-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem;
}

.tiny_algorithm-toolbar .tiny_algorithm-fnselect {
    width: auto;
}

.tiny_algorithm-toolbar .tiny_algorithm-sep {
    width: 1px;
    align-self: stretch;
    background: #ced4da;
    margin: 0 .25rem;
}

.tiny_algorithm-toolbar .tiny_algorithm-speed {
    width: 64px;
}

.tiny_algorithm-main {
    display: flex;
    gap: .75rem;
    min-height: 0;
}

.tiny_algorithm-canvas {
    position: relative;
    flex: 1 1 auto;
    height: 540px;
    overflow: auto;
    background: #fff;
    border: 1px solid #ced4da;
    border-radius: .25rem;
    outline: none;
}

.tiny_algorithm-canvas svg {
    display: block;
    margin: 0 auto;
}

.tiny_algorithm-side {
    flex: 0 0 320px;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    height: 540px;
    overflow: auto;
}

.tiny_algorithm-props,
.tiny_algorithm-pane {
    border: 1px solid #dee2e6;
    border-radius: .25rem;
    padding: .5rem;
    background: #f8f9fa;
}

.tiny_algorithm-field {
    margin-bottom: .4rem;
}

.tiny_algorithm-field label {
    font-size: .8rem;
    margin-bottom: .1rem;
}

.tiny_algorithm-actions {
    display: flex;
    gap: .3rem;
    flex-wrap: wrap;
}

.tiny_algorithm-node {
    cursor: pointer;
}

.tiny_algorithm-node:hover > :first-child {
    filter: brightness(.95);
}

.tiny_algorithm-node.tiny_algorithm-selected > :first-child {
    stroke: #2563eb;
    stroke-width: 3;
}

.tiny_algorithm-node:focus {
    outline: none;
}

.tiny_algorithm-node:focus > :first-child {
    stroke: #1d4ed8;
    stroke-width: 3;
    stroke-dasharray: 6 3;
}

/* The branch a decision has just taken: thicker and in the colour of the running block. */
.tiny_algorithm-edge.tiny_algorithm-taken > path:not(.tiny_algorithm-arrow) {
    stroke: #c2410c;
    stroke-width: 3;
}

.tiny_algorithm-edge.tiny_algorithm-taken > .tiny_algorithm-arrow {
    fill: #c2410c;
}

.tiny_algorithm-edge.tiny_algorithm-taken > text {
    fill: #9a3412;
    font-weight: bold;
}

/* A line of the generated code can be clicked to find its block; the selected block's lines are blue like the block. */
.tiny_algorithm-codeline[data-block] {
    cursor: pointer;
}

.tiny_algorithm-codeline[data-block]:hover {
    background: #eff6ff;
}

.tiny_algorithm-codeline-selected {
    background: #dbeafe;
    box-shadow: inset 3px 0 #2563eb;
}

/* The lines of the running block are marked like the block (after the selected lines, so this mark wins). */
.tiny_algorithm-codeline-current {
    background: #fed7aa;
    box-shadow: inset 3px 0 #c2410c;
}

/* Blocks after a Break, Continue or Return in the same list are never reached. */
.tiny_algorithm-node.tiny_algorithm-unreachable {
    opacity: .45;
}

/* The running block is marked by its border too, not only by its colour. */
.tiny_algorithm-node.tiny_algorithm-running > :first-child {
    fill: #fdba74;
    stroke: #9a3412;
    stroke-width: 3.5;
}

.tiny_algorithm-slot {
    cursor: pointer;
    opacity: .55;
}

.tiny_algorithm-slot:hover,
.tiny_algorithm-slot:focus {
    opacity: 1;
    outline: none;
}

.tiny_algorithm-slot:focus circle {
    stroke: #1d4ed8;
    stroke-width: 2.5;
}

.tiny_algorithm-palette {
    position: absolute;
    z-index: 10;
    display: grid;
    grid-template-columns: repeat(2, minmax(110px, 1fr));
    gap: .2rem;
    padding: .4rem;
    background: #fff;
    border: 1px solid #adb5bd;
    border-radius: .3rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .2);
}

.tiny_algorithm-palette.tiny_algorithm-context {
    grid-template-columns: minmax(140px, 1fr);
}

.tiny_algorithm-palette.tiny_algorithm-context .btn {
    text-align: left;
}

.tiny_algorithm-palette .tiny_algorithm-paste {
    grid-column: 1 / -1;
    font-weight: 600;
}

/* Dragging a block: blocks take the touch gestures, the + signs become the places to drop it. */
.tiny_algorithm-canvas .tiny_algorithm-node[role="button"] {
    cursor: grab;
    touch-action: none;
}

/* Pressing and moving over the diagram drags a block; it must not select (and scroll to) the text of the blocks. */
.tiny_algorithm-editor .tiny_algorithm-canvas svg {
    user-select: none;
}

.tiny_algorithm-dragging .tiny_algorithm-canvas {
    cursor: grabbing;
}

.tiny_algorithm-placing .tiny_algorithm-slot circle {
    stroke: #1d4ed8;
    stroke-width: 2;
}

.tiny_algorithm-place-note {
    margin: 0 0 .25rem;
    padding: .25rem .5rem;
    background: #dbeafe;
    border-radius: .25rem;
    font-size: .85rem;
}

.tiny_algorithm-placing .tiny_algorithm-slot,
.tiny_algorithm-dragging .tiny_algorithm-slot {
    opacity: .9;
}

.tiny_algorithm-slot.tiny_algorithm-drop {
    opacity: 1;
}

.tiny_algorithm-slot.tiny_algorithm-drop circle {
    fill: #dbeafe;
    stroke: #1d4ed8;
    stroke-width: 3;
}

.tiny_algorithm-drag-source {
    opacity: .45;
}

/* Fingers: larger + signs and menu items. */
@media (pointer: coarse) {
    .tiny_algorithm-slot {
        transform: scale(1.5);
        transform-box: fill-box;
        transform-origin: center;
    }
    .tiny_algorithm-palette .btn {
        padding: .5rem .75rem;
    }
}

.tiny_algorithm-console {
    font-family: Consolas, monospace;
    font-size: .85rem;
    min-height: 90px;
    max-height: 180px;
    overflow: auto;
    background: #111827;
    color: #e5e7eb;
    padding: .4rem;
    border-radius: .25rem;
    white-space: pre-wrap;
}

.tiny_algorithm-console .tiny_algorithm-error {
    color: #fca5a5;
}

.tiny_algorithm-console .tiny_algorithm-info {
    color: #93c5fd;
}

.tiny_algorithm-console .tiny_algorithm-input {
    display: inline-block;
    width: 10rem;
    background: #1f2937;
    color: #fff;
    border-color: #4b5563;
}

.tiny_algorithm-code {
    position: relative;
    max-height: 220px;
    overflow: auto;
    margin: 0;
    font-size: .8rem;
    line-height: 1.4;
    background: #fff;
    border: 1px solid #dee2e6;
    padding: .4rem;
}

@media (max-width: 900px) {
    .tiny_algorithm-main {
        flex-direction: column;
    }
    .tiny_algorithm-side {
        flex-basis: auto;
        height: auto;
    }

}

.tiny_algorithm-zoom {
    display: inline-flex;
    gap: .15rem;
    align-items: center;
}

.tiny_algorithm-zoom .tiny_algorithm-zoom-btn {
    min-width: 2.2rem;
}

/* Reader view (runner): diagram on the left,
generated code on the right; stacked when the content area is narrow. */
.tiny_algorithm-viewer-host,
.qtype_algorithm_container {
    /* stylelint-disable-next-line csstree/validator */
    container-type: inline-size;
}

.tiny_algorithm-viewer {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    gap: 1rem;
    align-items: start;
    max-width: 100%;
    margin: .5rem 0;
}

.tiny_algorithm-viewer.tiny_algorithm-no-code,
.tiny_algorithm-viewer.tiny_algorithm-hide-code {
    grid-template-columns: minmax(0, 1fr);
}

.tiny_algorithm-viewer.tiny_algorithm-hide-code .tiny_algorithm-view-code {
    display: none;
}

.tiny_algorithm-viewer .tiny_algorithm-view-main,
.tiny_algorithm-viewer .tiny_algorithm-view-code {
    min-width: 0;
}

.tiny_algorithm-viewer .tiny_algorithm-view-svg {
    overflow: auto;
    max-height: 640px;
    background: #fff;
    border: 1px solid #ced4da;
    border-radius: .25rem;
}

.tiny_algorithm-viewer .tiny_algorithm-view-svg svg {
    display: block;
    margin: 0 auto;
}

/* The zoom and the full screen button in the corner of the diagram (as in the editor). */
.tiny_algorithm-viewer .tiny_algorithm-view-canvas {
    position: relative;
}

.tiny_algorithm-viewer .tiny_algorithm-view-canvas > .tiny_algorithm-zoom {
    position: absolute;
    right: 8px;
    bottom: 8px;
    gap: 2px;
    opacity: .9;
}

.tiny_algorithm-viewer .tiny_algorithm-zoom-btn svg {
    display: block;
    margin: 0 auto;
}

/* Variables and Code are switches: pressed means the panel is shown. */
.tiny_algorithm-viewer .tiny_algorithm-view-bar .tiny_algorithm-toggle[aria-pressed="true"] {
    background: #dbeafe;
    border-color: #3b82f6;
    color: #1e3a8a;
}

.tiny_algorithm-viewer .tiny_algorithm-view-bar .tiny_algorithm-toggle[aria-pressed="false"] {
    background: #fff;
    border-color: #ced4da;
    color: #4b5563;
}

/* The field where the algorithm reads a value, with its ✓ button (phone keyboards often have no Enter). */
.tiny_algorithm-console .tiny_algorithm-inputform {
    display: inline-flex;
    gap: .25rem;
    align-items: center;
    margin: 0;
    vertical-align: middle;
}

.tiny_algorithm-console .tiny_algorithm-inputok {
    min-width: 2.2rem;
    line-height: 1.2;
}

/* Full screen: through the browser, or covering the window where the browser cannot (iPhone). */
html.tiny_algorithm-noscroll,
html.tiny_algorithm-noscroll body {
    overflow: hidden;
}

.tiny_algorithm-viewer.tiny_algorithm-fullscreen {
    position: fixed;
    inset: 0;
    z-index: 1100;
    margin: 0;
    padding: .75rem;
    overflow: auto;
    align-content: start;
    background: #fff;
}

.tiny_algorithm-viewer.tiny_algorithm-fullscreen .tiny_algorithm-view-svg {
    height: calc(100dvh - 230px);
    min-height: 220px;
    max-height: none;
}

.tiny_algorithm-viewer.tiny_algorithm-fullscreen .tiny_algorithm-code {
    max-height: calc(100dvh - 6rem);
}

.tiny_algorithm-viewer.tiny_algorithm-fullscreen > .tiny_algorithm-textdesc {
    display: none;
}

/* On a wide screen the code stays beside the diagram, also when the page column around the widget is narrow. */
@media (min-width: 820px) {
    .tiny_algorithm-viewer.tiny_algorithm-fullscreen:not(.tiny_algorithm-hide-code):not(.tiny_algorithm-no-code) {
        grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    }
}

/* A phone: the speed slider without its words, smaller gaps. */
/* stylelint-disable-next-line csstree/validator */
@container (max-width: 480px) {
    .tiny_algorithm-viewer .tiny_algorithm-speedbox > span {
        display: none;
    }

    .tiny_algorithm-viewer .tiny_algorithm-speedbox .tiny_algorithm-speed {
        width: 80px;
    }

    .tiny_algorithm-viewer .tiny_algorithm-view-bar {
        gap: .25rem;
    }
}

.tiny_algorithm-viewer .tiny_algorithm-view-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem;
    margin: .4rem 0;
}

.tiny_algorithm-viewer .tiny_algorithm-speed {
    width: 100px;
}

.tiny_algorithm-viewer .tiny_algorithm-console {
    min-height: 70px;
    max-height: 220px;
}

/* Without the code panel a click on a block does nothing, so the blocks do not look clickable. */
.tiny_algorithm-viewer.tiny_algorithm-hide-code .tiny_algorithm-node,
.tiny_algorithm-viewer.tiny_algorithm-no-code .tiny_algorithm-node {
    cursor: default;
}

.tiny_algorithm-viewer.tiny_algorithm-hide-code .tiny_algorithm-node:hover > :first-child,
.tiny_algorithm-viewer.tiny_algorithm-no-code .tiny_algorithm-node:hover > :first-child {
    filter: none;
}

.tiny_algorithm-viewer .tiny_algorithm-node.tiny_algorithm-running > :first-child {
    fill: #fdba74;
    stroke: #9a3412;
    stroke-width: 3.5;
}

.tiny_algorithm-viewer .tiny_algorithm-code-bar {
    display: flex;
    align-items: center;
    gap: .4rem;
    margin-bottom: .4rem;
}

.tiny_algorithm-viewer .tiny_algorithm-code-bar .tiny_algorithm-codelang {
    width: auto;
}

.tiny_algorithm-viewer .tiny_algorithm-code-bar .tiny_algorithm-code-close {
    margin-left: auto;
    font-size: 1.4rem;
    line-height: 1;
    padding: 0 .4rem;
}

.tiny_algorithm-viewer .tiny_algorithm-code {
    max-height: 640px;
    overflow: auto;
    margin: 0;
    padding: .6rem;
    font-size: .85rem;
    background: #f8f9fa;
    border: 1px solid #ced4da;
    border-radius: .25rem;
    white-space: pre;
}

/* stylelint-disable-next-line csstree/validator */
@container (max-width: 819px) {
    .tiny_algorithm-viewer {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Variable watch */
.tiny_algorithm-watch {
    font-size: .85rem;
}

.tiny_algorithm-watch .tiny_algorithm-watch-empty {
    color: #6b7280;
    margin: 0;
}

.tiny_algorithm-watch table {
    width: 100%;
    margin: 0;
    border-collapse: collapse;
    font-family: Consolas, monospace;
}

.tiny_algorithm-watch th,
.tiny_algorithm-watch td {
    padding: .15rem .4rem;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
    vertical-align: top;
    word-break: break-word;
}

.tiny_algorithm-watch th {
    width: 30%;
    font-weight: 600;
}

.tiny_algorithm-watch td.tiny_algorithm-changed {
    background: #fef3c7;
}

.tiny_algorithm-watch table.tiny_algorithm-matrix {
    width: auto;
}

.tiny_algorithm-watch .tiny_algorithm-matrix td {
    padding: .05rem .35rem;
    border: 1px solid #e5e7eb;
    text-align: right;
}

.tiny_algorithm-viewer .tiny_algorithm-view-watch {
    margin-top: .5rem;
}

.tiny_algorithm-viewer.tiny_algorithm-hide-watch .tiny_algorithm-view-watch {
    display: none;
}

/* The editor dialog can fill the window (the button beside its close button) */
.modal-header .tiny_algorithm-modal-maxbtn {
    margin-left: auto;
    padding: .25rem .5rem;
    color: inherit;
    opacity: .6;
}

.modal-header .tiny_algorithm-modal-maxbtn:hover,
.modal-header .tiny_algorithm-modal-maxbtn:focus {
    opacity: 1;
}

.modal-header .tiny_algorithm-modal-maxbtn + [data-action="hide"] {
    margin-left: .25rem;
}

.modal-dialog.tiny_algorithm-modal-max {
    max-width: none;
    width: calc(100vw - 1rem);
    height: calc(100vh - 1rem);
    margin: .5rem;
}

.modal-dialog.tiny_algorithm-modal-max .modal-content {
    height: 100%;
}

.modal-dialog.tiny_algorithm-modal-max .modal-body {
    flex: 1 1 auto;
    overflow: auto;
}

.modal-dialog.tiny_algorithm-modal-max .tiny_algorithm-canvas,
.modal-dialog.tiny_algorithm-modal-max .tiny_algorithm-side {
    height: calc(100vh - 290px);
    min-height: 300px;
}

/* Turtle graphics: the drawing (y up, fitted to the lines) and the turtle */
.tiny_algorithm-turtle-svg {
    display: block;
    width: 100%;
    height: 260px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: .25rem;
}

.tiny_algorithm-turtle-marker {
    stroke: #fff;
    stroke-width: 1;
}

.tiny_algorithm-turtle-note {
    margin: .25rem 0 0;
    color: #92400e;
    font-size: .85rem;
}

.tiny_algorithm-viewer .tiny_algorithm-view-turtle {
    margin-top: .5rem;
}

/* The array panel: numbers as bars, other values as boxes; read elements amber, written green */
.tiny_algorithm-arrays {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.tiny_algorithm-arrays-empty {
    margin: 0;
    color: #6b7280;
    font-size: .85rem;
}

.tiny_algorithm-array-title {
    font-family: SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .8rem;
    font-weight: 600;
}

.tiny_algorithm-array-note {
    color: #92400e;
    font-size: .8rem;
}

.tiny_algorithm-array-row {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    overflow-x: auto;
    padding-bottom: .25rem;
}

.tiny_algorithm-array-cell {
    position: relative;
    flex: 1 1 0;
    min-width: 1.6rem;
    max-width: 3rem;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-end;
    text-align: center;
    font-family: SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .7rem;
}

.tiny_algorithm-array-value {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tiny_algorithm-array-bar {
    display: none;
    background: #93c5fd;
    border-radius: 2px 2px 0 0;
    transition: height .25s ease, background-color .25s ease;
}

.tiny_algorithm-array-bars .tiny_algorithm-array-row {
    min-height: 8rem;
}

.tiny_algorithm-array-bars .tiny_algorithm-array-bar {
    display: block;
}

.tiny_algorithm-array-bars .tiny_algorithm-array-negative .tiny_algorithm-array-bar {
    background: #fca5a5;
}

.tiny_algorithm-array:not(.tiny_algorithm-array-bars) .tiny_algorithm-array-value {
    border: 1px solid #cbd5e1;
    border-radius: 3px;
    padding: .2rem .1rem;
    background: #fff;
    transition: background-color .25s ease;
}

.tiny_algorithm-array-index {
    color: #6b7280;
    font-size: .65rem;
}

.tiny_algorithm-array-pointer {
    min-height: 1rem;
    color: #6d28d9;
    font-weight: 700;
    white-space: nowrap;
}

.tiny_algorithm-array-bars .tiny_algorithm-array-read .tiny_algorithm-array-bar,
.tiny_algorithm-array-grid .tiny_algorithm-array-read,
.tiny_algorithm-array:not(.tiny_algorithm-array-bars) .tiny_algorithm-array-read .tiny_algorithm-array-value {
    background: #fbbf24;
}

.tiny_algorithm-array-bars .tiny_algorithm-array-written .tiny_algorithm-array-bar,
.tiny_algorithm-array-grid .tiny_algorithm-array-written,
.tiny_algorithm-array:not(.tiny_algorithm-array-bars) .tiny_algorithm-array-written .tiny_algorithm-array-value {
    background: #4ade80;
}

.tiny_algorithm-array-read .tiny_algorithm-array-value,
.tiny_algorithm-array-written .tiny_algorithm-array-value {
    font-weight: 700;
}

/* Many elements: thin bars without values and indexes; the index variables still point at theirs. */
.tiny_algorithm-array-dense .tiny_algorithm-array-row {
    gap: 1px;
}

.tiny_algorithm-array-dense .tiny_algorithm-array-cell {
    min-width: 3px;
}

.tiny_algorithm-array-dense .tiny_algorithm-array-index {
    visibility: hidden;
}

.tiny_algorithm-array-grid {
    display: grid;
    gap: 2px;
    overflow-x: auto;
    font-family: SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .7rem;
}

.tiny_algorithm-array-box {
    border: 1px solid #cbd5e1;
    border-radius: 3px;
    padding: .2rem .15rem;
    text-align: center;
    background: #fff;
    transition: background-color .25s ease;
}

.tiny_algorithm-array-box.tiny_algorithm-heat1 {
    background: #dbeafe;
}

.tiny_algorithm-array-box.tiny_algorithm-heat2 {
    background: #bfdbfe;
}

.tiny_algorithm-array-box.tiny_algorithm-heat3 {
    background: #93c5fd;
}

.tiny_algorithm-array-box.tiny_algorithm-heat4 {
    background: #60a5fa;
}

/* Two elements that swap move over each other (tiny_algorithm/arrayview); their bars keep their height meanwhile */
.tiny_algorithm-array-swapping {
    z-index: 1;
}

.tiny_algorithm-array-swapping .tiny_algorithm-array-bar,
.tiny_algorithm-array-swapping .tiny_algorithm-array-value {
    transition: none;
}

/* The part of an array between two index variables ("@range low high" in a comment): a bracket under its elements,
   over the gaps between them */
.tiny_algorithm-array-inrange::after {
    content: "";
    position: absolute;
    left: -1px;
    right: -1px;
    bottom: -.25rem;
    height: .4rem;
    border-bottom: 3px solid #7c3aed;
    pointer-events: none;
}

.tiny_algorithm-array-rangestart::after {
    left: 0;
    border-left: 3px solid #7c3aed;
}

.tiny_algorithm-array-rangeend::after {
    right: 0;
    border-right: 3px solid #7c3aed;
}

/* An array of records: a table, a row for each element */
.tiny_algorithm-array-table {
    border-collapse: collapse;
    font-family: SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .75rem;
}

.tiny_algorithm-array-table th,
.tiny_algorithm-array-table td {
    padding: .1rem .4rem;
    border: 1px solid #cbd5e1;
    text-align: left;
    transition: background-color .25s ease;
}

.tiny_algorithm-array-table tr.tiny_algorithm-array-read td {
    background: #fef3c7;
}

.tiny_algorithm-array-table tr.tiny_algorithm-array-written td {
    background: #dcfce7;
}

.tiny_algorithm-array-counts {
    margin: .4rem 0 0;
    font-size: .75rem;
    color: #374151;
    font-variant-numeric: tabular-nums;
}

.tiny_algorithm-viewer .tiny_algorithm-view-arrays {
    margin-top: .5rem;
}

/* The call tree: running call blue, waiting calls light blue, finished calls grey with their value, repeated calls amber */
.tiny_algorithm-calltree-empty,
.tiny_algorithm-calltree-summary {
    margin: 0 0 .25rem;
    color: #4b5563;
    font-size: .85rem;
}

.tiny_algorithm-calltree-scroll {
    overflow: auto;
    max-height: 22rem;
}

.tiny_algorithm-calltree-svg {
    display: block;
    font-family: SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
}

.tiny_algorithm-calltree-edge {
    stroke: #94a3b8;
    stroke-width: 1.2;
}

.tiny_algorithm-calltree-node rect {
    fill: #fff;
    stroke: #64748b;
    stroke-width: 1.2;
}

.tiny_algorithm-calltree-node text {
    fill: #1f2937;
}

.tiny_algorithm-calltree-done rect {
    fill: #f1f5f9;
}

.tiny_algorithm-calltree-repeated rect {
    fill: #fde68a;
    stroke: #b45309;
}

.tiny_algorithm-calltree-waiting rect {
    fill: #dbeafe;
    stroke: #2563eb;
}

.tiny_algorithm-calltree-current rect {
    fill: #2563eb;
    stroke: #1e40af;
    stroke-width: 2;
}

.tiny_algorithm-calltree-current text {
    fill: #fff;
}

.tiny_algorithm-calltree-svg .tiny_algorithm-calltree-value {
    fill: #047857;
    font-size: 11px;
    paint-order: stroke;
    stroke: #fff;
    stroke-width: 3px;
}

.tiny_algorithm-viewer .tiny_algorithm-view-calltree {
    margin-top: .5rem;
}

/* AI hints: the button after an error or beside a failed test, and the answer as plain text */
.tiny_algorithm-ai-btn {
    margin-left: .35rem;
    padding: 0 .4rem;
    font-size: .8rem;
}

.tiny_algorithm-ai:empty {
    display: none;
}

.tiny_algorithm-ai {
    margin: .35rem 0;
    padding: .5rem .75rem;
    border-left: 3px solid #7c3aed;
    border-radius: 4px;
    background: #f5f3ff;
    color: #1f2937;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: .85rem;
    white-space: normal;
}

.tiny_algorithm-ai-note,
.tiny_algorithm-ai-wait {
    margin: 0 0 .25rem;
    color: #6b7280;
    font-size: .75rem;
}

.tiny_algorithm-ai-text {
    white-space: pre-wrap;
}

/* Complexity: the steps for each size n, the reference curves n, n log n, n² and a table */
.tiny_algorithm-cx-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: .5rem 1rem;
    margin-bottom: .5rem;
}

.tiny_algorithm-cx-field {
    display: flex;
    flex-direction: column;
    gap: .15rem;
    font-size: .85rem;
}

.tiny_algorithm-cx-field input {
    min-width: 14rem;
}

.tiny_algorithm-cx-status {
    min-height: 1.2rem;
    color: #4b5563;
    font-size: .85rem;
}

.tiny_algorithm-cx-verdict {
    margin: 0 0 .25rem;
    font-weight: 600;
}

.tiny_algorithm-cx-legend {
    display: flex;
    gap: 1rem;
    font-size: .85rem;
}

.tiny_algorithm-cx-swatch {
    display: inline-block;
    width: .9rem;
    height: .9rem;
    margin-right: .3rem;
    border-radius: 2px;
    vertical-align: -.1rem;
}

.tiny_algorithm-cx-chart {
    display: block;
    width: 100%;
    max-width: 640px;
    height: auto;
    background: #fcfcfb;
    font-family: inherit;
}

.tiny_algorithm-cx-grid {
    stroke: #e1e0d9;
    stroke-width: 1;
}

.tiny_algorithm-cx-tick {
    fill: #6b6a65;
    font-size: 11px;
}

.tiny_algorithm-cx-axis {
    fill: #3f3e3a;
    font-size: 12px;
}

.tiny_algorithm-cx-ref {
    fill: none;
    stroke: #898781;
    stroke-width: 1.5;
    stroke-dasharray: 4 4;
}

.tiny_algorithm-cx-reflabel {
    fill: #6b6a65;
    font-size: 11px;
}

.tiny_algorithm-cx-line {
    fill: none;
    stroke-width: 2;
    stroke-linejoin: round;
}

.tiny_algorithm-cx-dot {
    stroke: #fcfcfb;
    stroke-width: 2;
}

.tiny_algorithm-cx-label {
    fill: #1f1f1d;
    font-size: 12px;
    font-weight: 600;
}

.tiny_algorithm-cx-note {
    color: #4b5563;
    font-size: .8rem;
}

.tiny_algorithm-cx-table {
    width: auto;
}

/* Code to diagram: the pasted code and the lines that became comments */
.tiny_algorithm-ci-code {
    font-family: SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .85rem;
    white-space: pre;
    tab-size: 4;
}

.tiny_algorithm-ci-note {
    margin-top: .5rem;
    font-size: .85rem;
}

.tiny_algorithm-ci-note li {
    font-family: SFMono-Regular, Menlo, Consolas, monospace;
}

/* Class view: the copies of an exercise the students are changing */
.tiny_algorithm-class-dialog .tiny_algorithm-dialog {
    width: 1200px;
    max-width: 96vw;
}

.tiny_algorithm-class-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem 1.25rem;
    margin-bottom: .75rem;
    font-size: .85rem;
}

.tiny_algorithm-class-status {
    font-weight: 600;
}

.tiny_algorithm-class-note {
    color: #4b5563;
}

.tiny_algorithm-class-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: .75rem;
}

.tiny_algorithm-class-card {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    padding: .5rem;
    border: 1px solid #d1d5db;
    border-radius: .5rem;
    background: #fff;
    text-align: left;
    cursor: pointer;
}

.tiny_algorithm-class-card:hover,
.tiny_algorithm-class-card:focus {
    border-color: #4f46e5;
    box-shadow: 0 0 0 2px rgba(79, 70, 229, .25);
}

.tiny_algorithm-class-head {
    display: flex;
    justify-content: space-between;
    gap: .5rem;
    font-size: .85rem;
}

.tiny_algorithm-class-time {
    color: #6b7280;
    font-variant-numeric: tabular-nums;
}

.tiny_algorithm-class-tests {
    align-self: flex-start;
    padding: 0 .4rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 600;
}

.tiny_algorithm-class-pass {
    background: #dcfce7;
    color: #166534;
}

.tiny_algorithm-class-fail {
    background: #fef3c7;
    color: #92400e;
}

.tiny_algorithm-class-picture {
    height: 160px;
    overflow: hidden;
    display: flex;
    justify-content: center;
}

.tiny_algorithm-class-picture svg {
    width: 100%;
    height: 100%;
}

.tiny_algorithm-class-empty {
    color: #6b7280;
}

.tiny_algorithm-class-large {
    width: 1100px;
    max-width: 92vw;
}

/* A block of a fill-the-gaps problem with a field to type */
.tiny_algorithm-gap > rect,
.tiny_algorithm-gap > polygon {
    stroke: #2563eb;
    stroke-width: 2.5;
    stroke-dasharray: 6 3;
}

/* A block of a Parsons problem that Check order found out of place */
.tiny_algorithm-misplaced > rect,
.tiny_algorithm-misplaced > polygon {
    stroke: #dc2626;
    stroke-width: 3;
}

/* Analysis tab of the class view of a quiz question */
.tiny_algorithm-class-tabs {
    display: flex;
    gap: .25rem;
    margin-bottom: .75rem;
    border-bottom: 1px solid #d1d5db;
}

.tiny_algorithm-class-tab {
    padding: .35rem .9rem;
    border: 1px solid transparent;
    border-bottom: 0;
    border-radius: .4rem .4rem 0 0;
    background: none;
    color: #374151;
}

.tiny_algorithm-class-tab.active {
    border-color: #d1d5db;
    background: #fff;
    color: #111827;
    font-weight: 600;
    margin-bottom: -1px;
}

.tiny_algorithm-ana-section {
    margin: 1rem 0;
}

.tiny_algorithm-ana-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 .5rem;
}

.tiny_algorithm-ana-facts {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.tiny_algorithm-ana-facts ul {
    margin: 0;
    padding-left: 1.2rem;
}

.tiny_algorithm-ana-hist {
    display: flex;
    align-items: flex-end;
    gap: .3rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.tiny_algorithm-ana-hist li {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 2.4rem;
}

.tiny_algorithm-ana-histcol {
    display: flex;
    align-items: flex-end;
    width: 100%;
    height: 90px;
    background: #f3f4f6;
}

.tiny_algorithm-ana-histbar {
    width: 100%;
    background: #f59e0b;
}

.tiny_algorithm-ana-histbar.tiny_algorithm-ana-full {
    background: #16a34a;
}

.tiny_algorithm-ana-histlabel {
    font-size: .75rem;
    color: #4b5563;
}

.tiny_algorithm-ana-scroll {
    overflow-x: auto;
}

.tiny_algorithm-ana-table {
    border-collapse: collapse;
    width: 100%;
    font-size: .9rem;
}

.tiny_algorithm-ana-table th,
.tiny_algorithm-ana-table td {
    padding: .3rem .5rem;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
    vertical-align: top;
}

.tiny_algorithm-ana-pass {
    white-space: nowrap;
}

.tiny_algorithm-ana-meter {
    display: inline-block;
    width: 70px;
    height: .6rem;
    background: #fde68a;
    vertical-align: middle;
}

.tiny_algorithm-ana-meterfill {
    display: block;
    height: 100%;
    background: #16a34a;
}

.tiny_algorithm-ana-outputs,
.tiny_algorithm-ana-errors {
    margin: 0;
    padding-left: 1.1rem;
}

.tiny_algorithm-ana-outputs code {
    white-space: pre-wrap;
}

.tiny_algorithm-ana-times {
    color: #4b5563;
    font-variant-numeric: tabular-nums;
}

.tiny_algorithm-ana-err {
    color: #b91c1c;
}

.tiny_algorithm-ana-hidden {
    margin-left: .3rem;
    padding: 0 .3rem;
    border-radius: 999px;
    background: #e5e7eb;
    font-size: .7rem;
    font-weight: 400;
}

.tiny_algorithm-ana-note {
    color: #4b5563;
    font-size: .85rem;
}

.tiny_algorithm-ana-heat {
    max-height: 420px;
    overflow: auto;
    border: 1px solid #e5e7eb;
}

.tiny_algorithm-ana-heat svg {
    max-width: 100%;
    height: auto;
}

.tiny_algorithm-heat-1 > rect,
.tiny_algorithm-heat-1 > polygon {
    fill: #fee2e2;
}

.tiny_algorithm-heat-2 > rect,
.tiny_algorithm-heat-2 > polygon {
    fill: #fca5a5;
}

.tiny_algorithm-heat-3 > rect,
.tiny_algorithm-heat-3 > polygon {
    fill: #f87171;
}

.tiny_algorithm-heat-4 > rect,
.tiny_algorithm-heat-4 > polygon {
    fill: #ef4444;
}

/* Files of an algorithm and the files it writes */
.tiny_algorithm-files .tiny_algorithm-file {
    margin-bottom: .5rem;
}

.tiny_algorithm-files .tiny_algorithm-file-head {
    display: flex;
    gap: .25rem;
    align-items: center;
    margin-bottom: .25rem;
}

.tiny_algorithm-files pre {
    max-height: 160px;
    overflow: auto;
    margin: 0;
    padding: .25rem .4rem;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: .25rem;
    font-size: .85rem;
}

.tiny_algorithm-files-output {
    margin-top: .5rem;
}

.tiny_algorithm-viewer .tiny_algorithm-view-files {
    margin-top: .5rem;
}

/* Help for the operators and functions */
.tiny_algorithm-help-wrap {
    overflow-x: auto;
}

.tiny_algorithm-help {
    font-size: .85rem;
}

.tiny_algorithm-help th[scope="row"] {
    font-weight: normal;
    white-space: nowrap;
}

.tiny_algorithm-help td:nth-child(3) code,
.tiny_algorithm-help td:nth-child(4) code {
    white-space: nowrap;
}

/* All the comments of a diagram, numbered as the bubbles of their blocks */
.tiny_algorithm-viewer .tiny_algorithm-noteslist {
    margin-top: .5rem;
    padding: .4rem .6rem;
    border: 1px solid #fde68a;
    border-radius: .25rem;
    background: #fffbeb;
    color: #1f2937;
    font-size: .9rem;
}

.tiny_algorithm-viewer .tiny_algorithm-noteslist ol {
    margin: .25rem 0 0;
    padding-left: 1.6rem;
}

.tiny_algorithm-viewer .tiny_algorithm-noteslist-block {
    padding: 0 .35rem 0 0;
    font-weight: 600;
    vertical-align: baseline;
}

.tiny_algorithm-viewer .tiny_algorithm-noteslist-note {
    white-space: pre-wrap;
}

/* Student workspace (editable diagrams in content) */
.tiny_algorithm-workspace {
    margin: .5rem 0;
    outline: none;
}

.tiny_algorithm-workspace .tiny_algorithm-ws-bar,
.tiny_algorithm-tests .tiny_algorithm-tests-bar,
.tiny_algorithm-template-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem;
    margin-bottom: .4rem;
}

.tiny_algorithm-workspace .tiny_algorithm-ws-modified {
    padding: .1rem .5rem;
    border-radius: 1rem;
    background: #dbeafe;
    color: #1e3a8a;
    font-size: .8rem;
}

.tiny_algorithm-workspace .tiny_algorithm-ws-note {
    color: #065f46;
    font-size: .8rem;
}

.tiny_algorithm-workspace .tiny_algorithm-ws-body .tiny_algorithm-viewer {
    margin-top: 0;
}

.tiny_algorithm-workspace .tiny_algorithm-ws-solution {
    margin-top: .75rem;
    padding-top: .5rem;
    border-top: 1px dashed #ced4da;
}

.tiny_algorithm-workspace.tiny_algorithm-fullscreen {
    position: fixed;
    inset: 0;
    z-index: 1100;
    margin: 0;
    padding: .75rem;
    overflow: auto;
    background: #fff;
}

.tiny_algorithm-workspace.tiny_algorithm-fullscreen .tiny_algorithm-canvas,
.tiny_algorithm-workspace.tiny_algorithm-fullscreen .tiny_algorithm-side {
    height: calc(100vh - 160px);
}

.tiny_algorithm-workspace.tiny_algorithm-fullscreen .tiny_algorithm-view-svg {
    max-height: calc(100vh - 260px);
}

/* Tests */
.tiny_algorithm-tests {
    margin-top: .75rem;
}

.tiny_algorithm-tests .tiny_algorithm-tests-list {
    margin: 0;
    padding-left: 0;
    list-style: none;
}

.tiny_algorithm-tests .tiny_algorithm-test {
    padding: .4rem 0;
    border-top: 1px solid #e5e7eb;
}

.tiny_algorithm-tests .tiny_algorithm-test-head {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.tiny_algorithm-tests .tiny_algorithm-test-hidden {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    margin: 0 0 0 .75rem;
    font-size: .85rem;
}

.tiny_algorithm-tests .tiny_algorithm-test-hidden .form-check-input {
    position: static;
    margin: 0;
}

.tiny_algorithm-tests-teacher .tiny_algorithm-test-head .btn-link {
    margin-left: auto;
}

.tiny_algorithm-tests .tiny_algorithm-test-inputs {
    color: #4b5563;
}

.tiny_algorithm-tests .tiny_algorithm-test-cols {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: .5rem;
    margin-top: .3rem;
    font-size: .85rem;
}

.tiny_algorithm-tests .tiny_algorithm-test-out {
    min-height: 2rem;
    max-height: 160px;
    overflow: auto;
    margin: 0;
    padding: .3rem .4rem;
    background: #f8f9fa;
    border: 1px solid #ced4da;
    border-radius: .25rem;
    white-space: pre;
}

.tiny_algorithm-tests .tiny_algorithm-diff-line {
    background: #fee2e2;
}

.tiny_algorithm-tests .tiny_algorithm-pass {
    color: #15803d;
    font-weight: 600;
}

.tiny_algorithm-tests .tiny_algorithm-fail {
    color: #b91c1c;
    font-weight: 600;
}

.tiny_algorithm-tests .tiny_algorithm-stale {
    color: #6b7280;
    font-weight: 600;
}

.tiny_algorithm-tests-stale .tiny_algorithm-test-mark,
.tiny_algorithm-tests-stale .tiny_algorithm-test-cols {
    opacity: .55;
}

.tiny_algorithm-tests .tiny_algorithm-test-mark {
    width: 1.2rem;
    text-align: center;
}

.tiny_algorithm-tests .tiny_algorithm-test-note,
.tiny_algorithm-tests .tiny_algorithm-tests-empty,
.tiny_algorithm-pane-note {
    color: #6b7280;
    font-size: .85rem;
}

/* The solution of an exercise is in the page even when students cannot show it. */
.tiny_algorithm-solution-note {
    color: #92400e;
    font-size: .85rem;
    margin: .5rem 0;
}

.tiny_algorithm-tests .tiny_algorithm-error {
    color: #b91c1c;
    font-size: .85rem;
}

/* Dialog tabs and options */
.tiny_algorithm-tabs {
    margin-bottom: .5rem;
}

.tiny_algorithm-footer-options {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem 0;
}

/* State of a run next to the buttons. */
.tiny_algorithm-status {
    font-size: .85rem;
    padding: .1rem .55rem;
    border-radius: 999px;
    background: #fed7aa;
    color: #7c2d12;
    white-space: nowrap;
}

.tiny_algorithm-status-done {
    background: #dcfce7;
    color: #14532d;
}

.tiny_algorithm-status-error {
    background: #fee2e2;
    color: #7f1d1d;
}

.tiny_algorithm-status-stopped {
    background: #e5e7eb;
    color: #374151;
}

/* Breakpoints: a red dot on the block and before its code lines. */
.tiny_algorithm-bpdot {
    fill: #dc2626;
    stroke: #fff;
    stroke-width: 1.5;
}

.tiny_algorithm-codeline-bp {
    box-shadow: inset 4px 0 #dc2626;
}

/* The block where an error stopped the algorithm. */
.tiny_algorithm-node.tiny_algorithm-errorblock > :first-child {
    fill: #fee2e2;
    stroke: #dc2626;
    stroke-width: 3.5;
}

.tiny_algorithm-codeline-error {
    background: #fee2e2;
    box-shadow: inset 3px 0 #dc2626;
}

/* The hint under an input value that does not fit the type. */
.tiny_algorithm-inputhint {
    display: block;
    color: #fca5a5;
    font-size: .8rem;
}

/* The calls running now, above the variables. */
.tiny_algorithm-stack {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem;
    font-size: .8rem;
    color: #4b5563;
    margin-bottom: .3rem;
}

.tiny_algorithm-stack-sep {
    color: #9ca3af;
}

/* The toolbar fits in one row: the zoom is in the corner of the diagram, the file actions in the File menu. */
.tiny_algorithm-grow {
    flex: 1 1 auto;
}

.tiny_algorithm-speedbox {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    font-size: .75rem;
    color: #4b5563;
}

/* Step back: the timeline of the run under the bar of the viewer and above the console of the editor. */
.tiny_algorithm-timeline {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin: .25rem 0;
    font-size: .8rem;
    color: #374151;
}

.tiny_algorithm-timeline[hidden] {
    display: none;
}

.tiny_algorithm-timeline-range {
    flex: 1 1 auto;
    min-width: 6rem;
}

.tiny_algorithm-timeline-label {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.tiny_algorithm-canvaswrap {
    position: relative;
    min-width: 0;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
}

.tiny_algorithm-canvaswrap > .tiny_algorithm-zoom {
    position: absolute;
    bottom: 18px;
    right: 18px;
    display: flex;
    gap: 2px;
    opacity: .9;
}

.tiny_algorithm-filemenu {
    position: absolute;
    z-index: 20;
    min-width: 12rem;
    background: #fff;
    border: 1px solid #ced4da;
    border-radius: .25rem;
    box-shadow: 0 8px 20px rgba(0, 0, 0, .12);
    padding: .25rem 0;
}

/* The colours of the items do not depend on the theme (some themes paint a focused item dark with dark text). */
.tiny_algorithm-filemenu .dropdown-item {
    display: block;
    width: 100%;
    padding: .3rem 1rem;
    border: 0;
    text-align: left;
    white-space: nowrap;
    color: #1d2125;
    background: transparent;
}

.tiny_algorithm-filemenu .dropdown-divider {
    margin: .25rem 0;
    border-top: 1px solid #dee2e6;
}

.tiny_algorithm-filemenu .dropdown-item:hover,
.tiny_algorithm-filemenu .dropdown-item:focus {
    color: #1d2125;
    background: #e9ecef;
}

.tiny_algorithm-toolbar {
    position: relative;
}

/* A bar above an empty diagram. */
.tiny_algorithm-emptybar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .5rem;
    background: #dbeafe;
    color: #1e3a8a;
    font-size: .875rem;
    padding: .25rem .6rem;
    border-radius: .25rem;
    margin-bottom: .4rem;
}

/* Dialogs (trace table, shortcuts) inside the widget, so full screen keeps them. */
.tiny_algorithm-editor,
.tiny_algorithm-viewer {
    position: relative;
}

.tiny_algorithm-dialog-back {
    position: absolute;
    inset: 0;
    z-index: 30;
    background: rgba(17, 24, 39, .35);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 2rem 1rem;
}

.tiny_algorithm-dialog {
    background: #fff;
    border-radius: .4rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
    max-width: 900px;
    width: 100%;
    max-height: 100%;
    display: flex;
    flex-direction: column;
}

.tiny_algorithm-dialog-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .75rem;
    padding: .5rem .75rem;
    border-bottom: 1px solid #e5e7eb;
}

.tiny_algorithm-dialog-actions {
    display: flex;
    gap: .35rem;
    align-items: center;
}

.tiny_algorithm-dialog-close {
    font-size: 1.4rem;
    line-height: 1;
    padding: 0 .25rem;
}

.tiny_algorithm-dialog-body {
    padding: .6rem .75rem;
    overflow: auto;
}

.tiny_algorithm-trace-wrap {
    max-height: 60vh;
    overflow: auto;
    border: 1px solid #e5e7eb;
}

.tiny_algorithm-trace {
    border-collapse: collapse;
    font-family: SFMono-Regular, Consolas, monospace;
    font-size: .8rem;
    font-variant-numeric: tabular-nums;
}

.tiny_algorithm-trace th,
.tiny_algorithm-trace td {
    padding: .15rem .5rem;
    border-bottom: 1px solid #f0f2f4;
    text-align: left;
    white-space: nowrap;
}

.tiny_algorithm-trace thead th {
    position: sticky;
    top: 0;
    background: #eef2f7;
}

.tiny_algorithm-trace tbody tr {
    cursor: pointer;
}

.tiny_algorithm-trace tbody tr:hover,
.tiny_algorithm-trace tbody tr:focus {
    background: #dbeafe;
}

.tiny_algorithm-trace .tiny_algorithm-changed {
    background: #fef08a;
}

.tiny_algorithm-trace-note {
    font-size: .8rem;
    color: #4b5563;
    margin: .4rem 0 0;
}

.tiny_algorithm-shortcuts {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: .3rem 1rem;
    margin: 0 0 .5rem;
}

.tiny_algorithm-shortcuts dd {
    margin: 0;
}

/* A short message at the bottom of the widget (Block deleted · Undo). */
.tiny_algorithm-toast {
    position: absolute;
    left: 50%;
    bottom: 1rem;
    transform: translateX(-50%);
    z-index: 25;
    background: #1f2937;
    color: #fff;
    padding: .4rem .8rem;
    border-radius: .35rem;
    box-shadow: 0 8px 20px rgba(0, 0, 0, .25);
    display: flex;
    gap: .75rem;
    align-items: center;
}

.tiny_algorithm-toast .btn-link {
    color: #93c5fd;
}

/* The comment of a block. */
.tiny_algorithm-tooltip {
    position: absolute;
    z-index: 15;
    max-width: 280px;
    background: #1f2937;
    color: #fff;
    font-size: .8rem;
    padding: .35rem .6rem;
    border-radius: .3rem;
    box-shadow: 0 6px 16px rgba(0, 0, 0, .2);
    white-space: pre-wrap;
    pointer-events: none;
}

.tiny_algorithm-noteicon {
    cursor: help;
}

.tiny_algorithm-textdesc {
    margin-top: .5rem;
    border: 1px solid #e5e7eb;
    border-radius: .25rem;
    padding: .3rem .6rem;
}

.tiny_algorithm-textdesc summary {
    cursor: pointer;
    font-weight: 600;
}

.tiny_algorithm-textdesc pre {
    margin: .4rem 0 .2rem;
    white-space: pre-wrap;
}

/* Tabs of the side panel: only on a narrow screen. */
.tiny_algorithm-tabbar {
    display: none;
}

@media (max-width: 640px) {
    .tiny_algorithm-tabbar {
        display: flex;
        gap: .25rem;
        border-bottom: 1px solid #e5e7eb;
    }

    .tiny_algorithm-tabbar [aria-selected="true"] {
        font-weight: 600;
        text-decoration: underline;
    }

    .tiny_algorithm-side[data-sidetab="console"] [data-sidepane="watch"],
    .tiny_algorithm-side[data-sidetab="console"] [data-sidepane="code"],
    .tiny_algorithm-side[data-sidetab="watch"] [data-sidepane="console"],
    .tiny_algorithm-side[data-sidetab="watch"] [data-sidepane="code"],
    .tiny_algorithm-side[data-sidetab="code"] [data-sidepane="console"],
    .tiny_algorithm-side[data-sidetab="code"] [data-sidepane="watch"],
    .tiny_algorithm-side:not([data-sidetab="turtle"]) [data-sidepane="turtle"],
    .tiny_algorithm-side:not([data-sidetab="files"]) [data-sidepane="files"],
    .tiny_algorithm-side[data-sidetab="files"] [data-sidepane="console"],
    .tiny_algorithm-side[data-sidetab="files"] [data-sidepane="watch"],
    .tiny_algorithm-side[data-sidetab="files"] [data-sidepane="code"],
    .tiny_algorithm-side[data-sidetab="turtle"] [data-sidepane="files"],
    .tiny_algorithm-side[data-sidetab="turtle"] [data-sidepane="console"],
    .tiny_algorithm-side[data-sidetab="turtle"] [data-sidepane="watch"],
    .tiny_algorithm-side[data-sidetab="turtle"] [data-sidepane="code"],
    .tiny_algorithm-side:not([data-sidetab="arrays"]) [data-sidepane="arrays"],
    .tiny_algorithm-side[data-sidetab="arrays"] [data-sidepane="console"],
    .tiny_algorithm-side[data-sidetab="arrays"] [data-sidepane="watch"],
    .tiny_algorithm-side[data-sidetab="arrays"] [data-sidepane="code"],
    .tiny_algorithm-side[data-sidetab="arrays"] [data-sidepane="turtle"],
    .tiny_algorithm-side[data-sidetab="arrays"] [data-sidepane="files"],
    .tiny_algorithm-side:not([data-sidetab="calltree"]) [data-sidepane="calltree"],
    .tiny_algorithm-side[data-sidetab="calltree"] [data-sidepane="console"],
    .tiny_algorithm-side[data-sidetab="calltree"] [data-sidepane="watch"],
    .tiny_algorithm-side[data-sidetab="calltree"] [data-sidepane="code"],
    .tiny_algorithm-side[data-sidetab="calltree"] [data-sidepane="turtle"],
    .tiny_algorithm-side[data-sidetab="calltree"] [data-sidepane="files"],
    .tiny_algorithm-side[data-sidetab="calltree"] [data-sidepane="arrays"] {
        display: none;
    }
}

.tiny_algorithm-test-run {
    margin-left: auto;
}

/* A wide editor (full screen): the code in its own column, right of the diagram and the side panel. */
.tiny_algorithm-wide .tiny_algorithm-main > .tiny_algorithm-pane {
    flex: 0 0 34%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    margin: 0;
}

.tiny_algorithm-wide .tiny_algorithm-main > .tiny_algorithm-pane .tiny_algorithm-code {
    flex: 1 1 auto;
    max-height: none;
}

/* The text description goes under the diagram (and the code), over the whole width. */
.tiny_algorithm-viewer > .tiny_algorithm-textdesc {
    grid-column: 1 / -1;
}

/* Titles of the panels of the editor (not headings: they would break the heading order of the page). */
.tiny_algorithm-panetitle {
    font-weight: 700;
    margin-bottom: .5rem;
}

/* Templates dialog and CodeLab button */
.tiny_algorithm-templates-wrap {
    max-height: 65vh;
    overflow-y: auto;
}

.tiny_algorithm-template-item {
    border: 1px solid #e5e7eb;
    border-radius: .35rem;
    background: #fff;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.tiny_algorithm-template-item:hover {
    border-color: #3b82f6;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .06);
}

.tiny_algorithm-btn-codelab {
    font-weight: 500;
}

/* The dialog of the record types: a name and its fields on each row */
.tiny_algorithm-record-row {
    display: grid;
    grid-template-columns: minmax(6rem, 1fr) 3fr auto;
    gap: .35rem;
    align-items: center;
    margin-bottom: .35rem;
}

.tiny_algorithm-record-head {
    margin-bottom: .1rem;
}

/* Less movement: the bars, highlights and boxes change without animation when the user asks for reduced motion */
@media (prefers-reduced-motion: reduce) {
    [class*="tiny_algorithm-"],
    [class*="tiny_algorithm-"] > rect,
    [class*="tiny_algorithm-"] > polygon {
        transition: none;
        animation: none;
        scroll-behavior: auto;
    }
}

/* Forced colours (Windows high contrast): the browser sets the text colour to the system one; the blocks are drawn
   in it (currentcolor) on the page background, the running block with a thick border, the selected and focused ones
   with a dashed one, and the highlights of the arrays with an outline instead of a colour */
@media (forced-colors: active) {
    .tiny_algorithm-node > rect,
    .tiny_algorithm-node > polygon,
    .tiny_algorithm-node > ellipse {
        fill: transparent;
        stroke: currentcolor;
    }

    .tiny_algorithm-node text,
    .tiny_algorithm-node tspan,
    .tiny_algorithm-arrow {
        fill: currentcolor;
    }

    .tiny_algorithm-edge > path {
        stroke: currentcolor;
    }

    .tiny_algorithm-running > rect,
    .tiny_algorithm-running > polygon {
        stroke-width: 5;
    }

    .tiny_algorithm-selected > rect,
    .tiny_algorithm-selected > polygon,
    .tiny_algorithm-node:focus > rect,
    .tiny_algorithm-node:focus > polygon,
    .tiny_algorithm-misplaced > rect,
    .tiny_algorithm-misplaced > polygon {
        stroke-width: 3;
        stroke-dasharray: 6 3;
    }

    .tiny_algorithm-array-read,
    .tiny_algorithm-array-written {
        outline: 3px solid;
    }

    .tiny_algorithm-array-bar,
    .tiny_algorithm-ana-histbar,
    .tiny_algorithm-ana-meterfill {
        background: currentcolor;
        forced-color-adjust: none;
    }
}

/* More contrast when the user asks for it: darker borders and texts of the secondary parts */
@media (prefers-contrast: more) {
    .tiny_algorithm-class-note,
    .tiny_algorithm-ana-note,
    .tiny_algorithm-ana-times,
    .tiny_algorithm-array-counts,
    .tiny_algorithm-class-time {
        color: #111827;
    }

    .tiny_algorithm-node > rect,
    .tiny_algorithm-node > polygon {
        stroke-width: 2;
    }
}

/* The code panel of the editor can be closed (Show code in the toolbar opens it again). */
.tiny_algorithm-editor.tiny_algorithm-hide-code .tiny_algorithm-pane.tiny_algorithm-code-pane,
.tiny_algorithm-editor.tiny_algorithm-hide-code .tiny_algorithm-tabbar [data-sidetab="code"] {
    display: none;
}

.tiny_algorithm-editor .tiny_algorithm-code-pane .tiny_algorithm-code-close {
    float: right;
    font-size: 1.4rem;
    line-height: 1;
    padding: 0 .4rem;
}
