:root {
    /* The UI's fonts by the page's language (<html lang>, set from the display language): Japanese
       fonts early for Japanese, the Latin system fonts first for English. */
    --ui-font: system-ui, -apple-system, "Segoe UI", "Hiragino Sans", "Yu Gothic UI", "Meiryo", sans-serif;
    --bg: #f6f6f6;
    --panel: #ffffff;
    --text: #222222;
    --muted: #5f6368;
    --link: #3c4043;
    --line: #e0e0e0;
    --accent: #e4501a;
    --accent-text: #ffffff;
    --accent-soft: #fde4d6;
    --error: #c42b1c;
    --warning: #9d5d00;
    --info: #2a64b8;
    --code-bg: #fbfbfb;
    --selection: #fbd3bd;
    --stderr: #7a5300;
    --ok: #107c41;
    --shadow: 0 8px 30px rgba(0, 0, 0, 0.18);
    color-scheme: light;
}
:root:lang(en) {
    --ui-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Hiragino Sans", "Yu Gothic UI", Meiryo, sans-serif;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #171717;
        --panel: #1f1f1f;
        --text: #e6e6e6;
        --muted: #a0a0a0;
        --link: #c8c8c8;
        --line: #363636;
        --accent: #f0743f;
        --accent-text: #1a0c05;
        --accent-soft: #3d2317;
        --error: #ff7b6b;
        --warning: #e3b341;
        --info: #79a8ff;
        --code-bg: #1b1b1b;
        --selection: #4d2c1d;
        --stderr: #e3b341;
        --ok: #3fb873;
        --shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
        color-scheme: dark;
    }
}
:root[data-theme="dark"] {
    --bg: #171717;
    --panel: #1f1f1f;
    --text: #e6e6e6;
    --muted: #a0a0a0;
    --link: #c8c8c8;
    --line: #363636;
    --accent: #f0743f;
    --accent-text: #1a0c05;
    --accent-soft: #3d2317;
    --error: #ff7b6b;
    --warning: #e3b341;
    --info: #79a8ff;
    --code-bg: #1b1b1b;
    --selection: #4d2c1d;
    --stderr: #e3b341;
    --ok: #3fb873;
    --shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
}

* {
    box-sizing: border-box;
}
html,
body {
    height: 100%;
    margin: 0;
}
body {
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--text);
    font: 14px/1.5 var(--ui-font);
}
.sr {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}
[hidden] {
    display: none !important;
}

button,
select,
.button {
    font: inherit;
    color: var(--text);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 4px 10px;
    min-height: 30px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}
select {
    padding-right: 4px;
    max-width: 260px;
}
button:hover,
.button:hover {
    border-color: var(--muted);
}
button:focus-visible,
select:focus-visible,
.button:focus-within {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}
button.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-text);
    font-weight: 600;
}
button:disabled {
    opacity: 0.5;
    cursor: default;
}

.bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    padding: 8px 16px;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
}
.brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 15px;
}
.logo {
    display: block;
    width: 26px;
    height: 26px;
}
.group {
    display: flex;
    align-items: center;
    gap: 6px;
}
.spacer {
    flex: 1;
}
#sample {
    max-width: 220px;
}
.links {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 14px;
}
.link {
    color: var(--link);
    text-decoration: none;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}
.icon-link .codicon {
    font-size: 20px;
}
.icon-link:hover {
    color: var(--text);
}
/* The .xlsm downloaded: what a session ends with, on a gradient of orange to red across its two
   halves (the main button and the arrow of the menu of the rest: sharing). */
.split {
    display: inline-flex;
}
.split > button:first-child {
    border-radius: 6px 0 0 6px;
}
.split > button:last-child {
    border-radius: 0 6px 6px 0;
    border-left-color: rgba(255, 255, 255, 0.45);
    padding: 4px 6px;
}
.split > button.primary:last-child {
    border-left-color: color-mix(in srgb, var(--accent-text) 40%, transparent);
}
.download-split {
    border-radius: 6px;
    background: linear-gradient(100deg, #f5871f 0%, #e8541e 55%, #d0302a 100%);
}
.download-split:hover {
    background: linear-gradient(100deg, #e57a14 0%, #d84816 55%, #bb2622 100%);
}
button.download {
    background: transparent;
    border-color: transparent;
    color: #ffffff;
    font-weight: 600;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.15);
}
.link:hover {
    text-decoration: underline;
}

/* The explorer (explorer.ts) on the left of the source and the output. */
.workbench {
    flex: 1;
    min-height: 0;
    display: flex;
    background: var(--line);
}
.explorer {
    flex: none;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--panel);
    font-size: 13px;
}
.workbench > .splitter {
    flex: none;
    width: 5px;
}
.explorer-head {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 0 6px 0 12px;
    min-height: 35px;
    border-bottom: 1px solid var(--line);
    flex: none;
}
.explorer-title {
    flex: 1;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tree {
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding: 4px 0;
    outline: none;
}
.tree-row {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 24px;
    padding-right: 6px;
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
    outline: none;
    border: 1px solid transparent;
}
.tree-row:hover {
    background: color-mix(in srgb, var(--accent-soft) 55%, transparent);
}
.tree-row.active {
    background: var(--accent-soft);
}
.tree-row:focus-visible,
.tree:focus-within .tree-row.focused {
    border-color: var(--accent);
}
.tree-row .codicon {
    flex: none;
    font-size: 16px;
    color: var(--muted);
}
.tree-row .codicon-file-code,
.tree-row .codicon-beaker,
.tree-row .codicon-window,
.tree-row .codicon-symbol-interface {
    color: var(--info);
}
.tree-row .codicon-settings-gear {
    color: var(--warning);
}
.twistie {
    flex: none;
    width: 16px;
}
.tree-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: ui-monospace, "Cascadia Code", Consolas, "Menlo", monospace;
    font-size: 12.5px;
}
.tree-row.has-error .tree-name {
    color: var(--error);
}
.tree-badge {
    flex: none;
    color: var(--error);
    font-size: 11px;
    font-weight: 700;
    padding: 0 2px;
}
.tree-actions {
    display: none;
    gap: 2px;
}
.tree-row:hover .tree-actions,
.tree-row.focused:focus .tree-actions {
    display: flex;
}
.tree-action {
    border: 0;
    background: none;
    min-height: 22px;
    padding: 2px;
    border-radius: 4px;
    color: var(--muted);
}
.tree-action:hover {
    background: color-mix(in srgb, var(--muted) 18%, transparent);
    color: var(--text);
}
.tree-action .codicon {
    font-size: 16px;
    color: inherit;
}
.tree-row.editing {
    cursor: default;
}
.tree-input {
    flex: 1;
    min-width: 0;
    font: 12.5px ui-monospace, "Cascadia Code", Consolas, "Menlo", monospace;
    color: var(--text);
    background: var(--code-bg);
    border: 1px solid var(--accent);
    border-radius: 3px;
    padding: 1px 4px;
    outline: none;
}
/* The explorer's toggle: at the left of the explorer's head while it is shown, of the editor's
   tabs while it is hidden (main.ts moves it). */
.explorer-head .explorer-toggle {
    margin: 0 4px 0 -6px;
}
.editor-head {
    display: flex;
    align-items: stretch;
    border-bottom: 1px solid var(--line);
    flex: none;
}
.editor-head .tabs {
    flex: 1;
    min-width: 0;
    border-bottom: 0;
}
.explorer-toggle-slot {
    display: flex;
    align-items: center;
    padding-left: 6px;
}
.explorer-toggle-slot:empty {
    display: none;
}
.icon-button {
    min-height: 30px;
    padding: 4px 6px;
}
.icon-button .codicon {
    font-size: 18px;
}
.icon-button[aria-pressed="true"] {
    background: var(--accent-soft);
    border-color: var(--accent);
}
.menu {
    position: fixed;
    z-index: 20;
    min-width: 200px;
    padding: 4px;
    display: flex;
    flex-direction: column;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    font-size: 13px;
}
.menu-item {
    border: 0;
    border-radius: 4px;
    background: none;
    min-height: 26px;
    padding: 3px 8px;
    gap: 8px;
    justify-content: flex-start;
}
.menu-item:hover:not(:disabled),
.menu-item:focus-visible {
    background: var(--accent-soft);
    outline: none;
}
.menu-item .codicon {
    font-size: 16px;
    color: var(--muted);
}
.menu-separator {
    height: 1px;
    margin: 4px 6px;
    background: var(--line);
}
.menu-label {
    flex: 1;
    text-align: left;
}
.menu-key {
    color: var(--muted);
    font-size: 12px;
    margin-left: 16px;
}
.editor-empty {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    background: var(--code-bg);
    text-align: center;
    padding: 16px;
}
.editor-empty p {
    margin: 2px 0;
}

.panes {
    flex: 1;
    min-width: 0;
    min-height: 0;
    display: grid;
    /* --split: the source pane's share of the width (the splitter sets it, main.ts). */
    grid-template-columns: minmax(0, calc(var(--split, 0.5) * 100%)) 5px minmax(0, 1fr);
    background: var(--line);
}
.splitter {
    cursor: col-resize;
    background: var(--line);
    touch-action: none;
    outline: none;
}
.splitter:hover,
.splitter:focus-visible,
body.splitting .splitter {
    background: var(--accent);
}
/* While the splitter is dragged, the frames (the book, the Designer) do not take the mouse. */
body.splitting {
    cursor: col-resize;
    user-select: none;
}
body.splitting iframe {
    pointer-events: none;
}
.pane {
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
    background: var(--panel);
}
.tabs {
    display: flex;
    align-items: stretch;
    gap: 2px;
    padding: 0 8px;
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
    flex: none;
}
.tabs button {
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    background: none;
    padding: 6px 10px;
    color: var(--muted);
}
.tabs button[aria-selected="true"] {
    color: var(--text);
    border-bottom-color: var(--accent);
    font-weight: 600;
}
.tabs .file {
    font-family: ui-monospace, "Cascadia Code", Consolas, "Menlo", monospace;
    font-size: 13px;
}
.tabs .file .x {
    margin-left: 4px;
    opacity: 0;
    padding: 1px;
    border-radius: 3px;
    font-size: 14px;
}
.tabs .file:hover .x,
.tabs .file[aria-selected="true"] .x {
    opacity: 0.7;
}
.tabs .file .dir {
    margin-left: 6px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 400;
}
.tabs .file .x:hover {
    opacity: 1;
    background: var(--accent-soft);
}
.tabs .file.has-error {
    color: var(--error);
}
.count {
    display: inline-block;
    min-width: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--accent-soft);
    color: var(--text);
    font-size: 12px;
    font-weight: 600;
    text-align: center;
}
.count.e {
    background: var(--error);
    color: #fff;
}
.count.w {
    background: var(--warning);
    color: #fff;
}
.count:empty {
    display: none;
}
.compile-time {
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
}
.subbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-bottom: 1px solid var(--line);
    flex: none;
    flex-wrap: wrap;
}
.book-name {
    font-weight: 600;
}
.seg {
    display: inline-flex;
}
.seg button {
    border-radius: 0;
    margin-left: -1px;
}
.seg button:first-child {
    border-radius: 6px 0 0 6px;
    margin-left: 0;
}
.seg button:last-child {
    border-radius: 0 6px 6px 0;
}
.seg button[aria-pressed="true"] {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--text);
    font-weight: 600;
    position: relative;
}
.tab-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
.editor {
    flex: 1;
    min-height: 0;
    overflow: hidden;
}
.editor .cm-editor {
    height: 100%;
    background: var(--code-bg);
}
.editor .cm-scroller {
    font-family: ui-monospace, "Cascadia Code", Consolas, "Menlo", "BIZ UDGothic", monospace;
    font-size: 13.5px;
    line-height: 1.55;
}

.problems {
    list-style: none;
    margin: 0;
    padding: 6px 0;
    overflow: auto;
    flex: 1;
}
.problems li {
    padding: 5px 14px;
    cursor: pointer;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 2px 10px;
}
.problems li:hover,
.problems li.selected {
    background: var(--accent-soft);
}
.problems .sev {
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
}
.problems .error .sev {
    color: var(--error);
}
.problems .warning .sev {
    color: var(--warning);
}
.problems .info .sev,
.problems .hint .sev {
    color: var(--info);
}
.problems .where {
    grid-column: 2;
    color: var(--muted);
    font-size: 12px;
    font-family: ui-monospace, Consolas, monospace;
}
.problems .empty {
    color: var(--muted);
    cursor: default;
    display: block;
}
.problems .empty:hover {
    background: none;
}
.explain {
    margin: 0;
    padding: 12px 14px;
    border-top: 1px solid var(--line);
    max-height: 45%;
    overflow: auto;
    white-space: pre-wrap;
    font: 13px/1.6 inherit;
    font-family: inherit;
    background: var(--code-bg);
}

.output {
    flex: 1;
    overflow: auto;
    padding: 10px 14px;
}
.output .hint {
    color: var(--muted);
}
.output pre {
    margin: 0 0 10px;
    padding: 8px 10px;
    border-radius: 6px;
    background: var(--code-bg);
    border: 1px solid var(--line);
    white-space: pre-wrap;
    word-break: break-word;
    font: 13px/1.55 ui-monospace, "Cascadia Code", Consolas, "Menlo", monospace;
}
.output .stderr {
    color: var(--stderr);
}
.output h3 {
    font-size: 13px;
    margin: 14px 0 6px;
    color: var(--muted);
    font-weight: 600;
}
.output .result {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    margin-bottom: 8px;
}
.output .ok {
    color: var(--ok);
}
.output .ng {
    color: var(--error);
}
.output .err {
    border-color: var(--error);
    color: var(--error);
}
.output a {
    color: var(--accent);
    cursor: pointer;
}
.tests {
    list-style: none;
    margin: 0 0 10px;
    padding: 0;
}
.tests li {
    padding: 3px 0;
}
.tests .passed::before {
    content: "✓ ";
    color: var(--ok);
    font-weight: 700;
}
.tests .failed::before {
    content: "✗ ";
    color: var(--error);
    font-weight: 700;
}
.tests .skipped::before,
.tests .todo::before {
    content: "○ ";
    color: var(--muted);
}
.tests .failure {
    margin: 2px 0 6px 18px;
    color: var(--error);
    font-size: 13px;
}
.book-frames {
    flex: 1;
    min-height: 0;
    position: relative;
}
/* The page drawn again after an edit is made under the one shown, and takes its place when it is
   drawn (a page reloaded in place goes white for a moment). */
.book {
    position: absolute;
    inset: 0;
    z-index: 1;
    border: 0;
    width: 100%;
    height: 100%;
    background: #fff;
}
.book.incoming {
    z-index: 0;
}
.editor[hidden],
.designer[hidden] {
    display: none;
}
.designer {
    flex: 1;
    min-height: 0;
    border: 0;
    width: 100%;
    background: var(--panel);
}
.picker-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: min(60vh, 420px);
    overflow-y: auto;
    margin-bottom: 12px;
}
.picker-list .pick {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 10px;
    text-align: left;
    border: 0;
    border-radius: 6px;
    background: transparent;
    padding: 6px 8px;
}
.picker-list .pick:hover,
.picker-list .pick:focus-visible {
    background: var(--accent-soft);
}
.pick-desc,
.pick-detail {
    color: var(--muted);
    font-size: 12px;
}
.pick-detail {
    color: var(--ok);
}
/* The user forms a run shows (forms.ts): over the page, which they block while one is modal. */
.form-layer {
    position: fixed;
    inset: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.form-layer[hidden] {
    display: none;
}
.form-layer.modal {
    pointer-events: auto;
    background: rgba(0, 0, 0, 0.25);
}
.form-box {
    position: absolute;
    pointer-events: auto;
}
.form-box iframe {
    display: block;
    border: 0;
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 32px);
    background: transparent;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

.dialog {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 18px 20px 14px;
    min-width: min(360px, calc(100vw - 32px));
    max-width: min(520px, calc(100vw - 32px));
    background: var(--panel);
    color: var(--text);
    box-shadow: var(--shadow);
}
.dialog::backdrop {
    background: rgba(0, 0, 0, 0.35);
}
.dialog h2 {
    margin: 0 0 8px;
    font-size: 14px;
    color: var(--muted);
    font-weight: 600;
}
.dialog p {
    margin: 0 0 14px;
    white-space: pre-wrap;
}
.dialog input {
    width: 100%;
    font: inherit;
    padding: 6px 8px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--code-bg);
    color: var(--text);
    margin-bottom: 14px;
}
.dialog-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}
.dialog-buttons button {
    min-width: 84px;
    justify-content: center;
}
.toast {
    position: fixed;
    left: 50%;
    bottom: 20px;
    transform: translateX(-50%);
    background: var(--text);
    color: var(--panel);
    padding: 8px 14px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    max-width: calc(100vw - 32px);
    z-index: 10;
}
.loading {
    display: grid;
    place-items: center;
    height: 100%;
    color: var(--muted);
}

@media (max-width: 860px) {
    .panes {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: minmax(320px, 1fr) minmax(320px, 1fr);
        gap: 1px;
    }
    .splitter {
        display: none;
    }
    .workbench {
        flex-direction: column;
    }
    .explorer {
        width: auto !important;
        max-height: 40vh;
        border-bottom: 1px solid var(--line);
    }
    body {
        height: auto;
        min-height: 100%;
    }
    .panes {
        min-height: 760px;
    }
    .bar {
        padding: 8px 16px;
    }
}
/* The playground's own icons (src/icons.ts): SVGs drawn like the codicons around them. */
.ras-icon {
    display: inline-flex;
    width: 16px;
    height: 16px;
    flex: none;
}
.ras-icon svg {
    display: block;
}
.menu-item .ras-icon {
    color: var(--muted);
}

/* The descriptions of the compiler: of a completion (complete.ts), of a name pointed at and of
   the call being written (hover.ts). */
.cm-tooltip.cm-completionInfo {
    max-width: 420px;
}

.cm-tooltip .cm-hover,
.cm-tooltip.cm-signature {
    max-width: 560px;
    max-height: 260px;
    overflow: auto;
    padding: 4px 8px;
    font-size: 13px;
}

.cm-tooltip .doc p {
    margin: 0 0 6px;
    white-space: pre-wrap;
}

.cm-tooltip .doc :last-child {
    margin-bottom: 0;
}

.cm-tooltip .doc pre,
.cm-signature .sig {
    margin: 0 0 6px;
    white-space: pre-wrap;
    font-family: ui-monospace, "Cascadia Code", Consolas, "Menlo", "BIZ UDGothic", monospace;
}

.cm-signature .sig:not(.active) {
    color: var(--muted);
}

.cm-signature .sig strong {
    color: var(--accent);
}

.cm-signature .sig:last-child {
    margin-bottom: 0;
}
