@font-face {
    font-family: "MuseoModerno";
    src: url("./fonts/MuseoModerno.woff2") format("woff2");
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
}

:root {
    color-scheme: dark;
    font-family: system-ui, sans-serif;
    font-size: 14px;
    color: #d6d9df;
    background: #1c1f24;
    --border: #30343b;
    --muted: #9299a5;
    --mono: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

#editor { flex: 1; display: flex; flex-direction: column; }

header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 24px 24px 0;
}

.brand-name { margin: 0; font-family: "MuseoModerno", sans-serif; font-size: 24px; font-weight: 300; }
footer { display: flex; justify-content: center; flex-shrink: 0; padding-bottom: 5px; }
.version {
    display: inline-block;
    max-width: calc(100% - 56px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #747b87;
    font-size: 12px;
    text-decoration: none;
}
.version:hover { text-decoration: underline; }
.version:focus-visible { outline: 2px solid #a6bfdf; outline-offset: 4px; }
h2 { margin: 0; font-size: 12px; font-weight: 500; color: var(--muted); }

.cm-editor { flex: 1; font-size: 14px; }
.cm-editor .cm-scroller { font-family: var(--mono); line-height: 1.65; }
.cm-editor .cm-content { padding: 24px 0 14px; }
.cm-editor .cm-line { padding: 0 16px 0 10px; }
.cm-editor.cm-focused { outline: none; }
.cm-editor .cm-gutters { border: 0; }
.cm-editor .cm-lineNumbers .cm-gutterElement { padding: 0 12px 0 8px; min-width: 36px; }
.cm-editor .cm-foldGutter .cm-gutterElement { padding: 0 6px; cursor: pointer; }
.cm-editor .cm-foldPlaceholder { border: 0; padding: 0 3px; color: var(--muted); background: transparent; }
.cm-editor .cm-change-gutter .cm-gutterElement { position: relative; width: 8px; padding: 0; }
.cm-change-added { border-left: 3px solid #83b58d; }
.cm-change-modified { border-left: 3px solid #82a7d8; }
.cm-change-deleted::before {
    content: "";
    position: absolute;
    left: 0;
    top: -3px;
    border-left: 6px solid #df8b8b;
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
}
.cm-change-deleted-end::before { top: auto; bottom: -3px; }

#apply { position: fixed; right: 48px; bottom: 48px; z-index: 30; }

button {
    min-width: 86px;
    padding: 8px 18px;
    border: 1px solid #8ca9ce;
    border-radius: 4px;
    font: inherit;
    font-weight: 500;
    color: #151c25;
    background: #a6bfdf;
    cursor: pointer;
}

button:hover:enabled { background: #bad0ec; }
button:focus-visible, pre:focus-visible { outline: 2px solid #a6bfdf; outline-offset: 3px; }
button:disabled { color: #747b87; background: #252930; border-color: var(--border); cursor: default; }

.output {
    position: fixed;
    right: 48px;
    bottom: 104px;
    z-index: 40;
    display: flex;
    flex-direction: column;
    width: min(520px, calc(100% - 96px));
    max-height: min(420px, calc(100dvh - 128px));
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 16px;
    background: #252930;
    box-shadow: 0 8px 32px #0006;
}

.output[hidden] { display: none; }
.output-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
#close-output { display: grid; place-items: center; width: 32px; height: 32px; min-width: 32px; padding: 0; border: 0; color: inherit; background: transparent; }
#close-output:hover { background: #35445c; }

pre {
    flex: 1;
    overflow: auto;
    margin: 12px 0 0;
    font: 12px/1.65 var(--mono);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    tab-size: 4;
}

.output-error { color: #eea1a1; }

@media (max-width: 640px) {
    header { padding-inline: 14px; }
    #apply { right: 28px; }
    .output { right: 28px; width: calc(100% - 56px); }
}
