@font-face {
    font-family: "Spline Sans";
    src: url("fonts/spline-sans.woff2") format("woff2");
    font-weight: 300 700;
    font-display: swap;
}

@font-face {
    font-family: "Spline Sans Mono";
    src: url("fonts/spline-sans-mono.woff2") format("woff2");
    font-weight: 300 700;
    font-display: swap;
}

:root {
    --ground: #1a1d1d;
    --raised: #242829;
    --line: #3a4043;
    --line-strong: #5a6165;
    --text: #d7dcdb;
    --text-strong: #ffffff;
    --text-dim: #98a09f;
    --accent: #ffaff3;
    --attention: #e8c170;
    --good: #a8d8a0;

    --font-text: "Spline Sans", system-ui, sans-serif;
    --font-code: "Spline Sans Mono", ui-monospace, monospace;

    --space-1: 8px;
    --space-2: 16px;
    --space-3: 24px;
    --space-5: 40px;
    --row: 56px;
    --control: 40px;

    --page-width: 1120px;
    --page-inset: 32px;
    --link-inset: 14px;
    --bar-inset: max(
        calc(var(--page-inset) - var(--link-inset)),
        calc(50% - var(--page-width) / 2 + var(--page-inset) - var(--link-inset))
    );
}

body {
    margin: 0;
    background: var(--ground);
    color: var(--text);
    font-family: var(--font-text);
    font-size: 17px;
    line-height: 1.5;
}

h1 {
    margin: 0;
    font-size: 38px;
    line-height: 1.2;
    font-weight: 600;
    color: var(--text-strong);
}

code {
    font-family: var(--font-code);
    color: var(--accent);
}

a {
    color: var(--text);
}

a:hover {
    color: var(--text-strong);
}

a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.top-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    padding: 4px var(--bar-inset);
    background: var(--raised);
    border-bottom: 1px solid var(--line);
}

.brand {
    color: var(--accent);
    font-size: 18px;
    font-weight: 600;
}

.top-bar nav,
.page-links {
    display: flex;
    flex-wrap: wrap;
}

.top-bar a,
.page-links a {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 0 var(--link-inset);
    text-decoration: none;
}

.top-bar nav a {
    flex-direction: column;
    justify-content: center;
}

.top-bar nav a::after {
    content: attr(data-label);
    height: 0;
    overflow: hidden;
    visibility: hidden;
    font-weight: 600;
}

.top-bar a[aria-current] {
    background: var(--accent);
    color: var(--ground);
    font-weight: 600;
}

.account-menu {
    position: relative;
    margin-left: auto;
}

.account-menu button {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 0 var(--link-inset);
    background: none;
    border: none;
    border-radius: 0;
    color: var(--text);
    font: inherit;
    white-space: nowrap;
    cursor: pointer;
}

.account-menu > button {
    font-family: var(--font-code);
    font-size: 15px;
}

.account-menu button:hover,
.account-menu > button[aria-expanded="true"] {
    color: var(--text-strong);
}

.account-menu > button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

.account-menu [role="menu"] {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    z-index: 1;
    min-width: 100%;
    background: var(--raised);
    border: 1px solid var(--line-strong);
}

.account-menu [role="menuitem"] {
    width: 100%;
}

.account-menu [role="menuitem"]:hover,
.account-menu [role="menuitem"]:focus {
    background: var(--line);
    color: var(--text-strong);
    outline: none;
}

.page-links {
    padding: 0 var(--bar-inset);
    border-bottom: 1px dashed var(--line);
}

.page-links a[aria-current] {
    color: var(--text-strong);
    box-shadow: inset 0 -2px var(--accent);
}

.page {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
    max-width: var(--page-width);
    margin: 0 auto;
    padding: var(--space-5) var(--page-inset);
}

.page p {
    margin: var(--space-1) 0 0;
}

h2,
h3 {
    margin: 0;
    font-weight: 600;
    color: var(--text-strong);
}

h2 {
    font-size: 32px;
    line-height: 1.2;
}

h3 {
    font-size: 21px;
}

.page .prompt {
    margin: 0;
    font-family: var(--font-code);
    font-size: 16px;
    line-height: 1.5;
    font-weight: 400;
    color: var(--text-strong);
}

.prompt::before {
    content: "$ ";
    color: var(--accent);
}

.prompt + h1 {
    margin-top: var(--space-1);
}

.page .did {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0 var(--space-2);
}

.did code,
.dim {
    color: var(--text-dim);
}

.block {
    margin: var(--space-1) 0 0;
    border-top: 1px dashed var(--line);
}

.row {
    display: grid;
    grid-template-columns: 200px minmax(0, 1fr) auto;
    column-gap: var(--space-3);
    align-items: center;
    min-height: var(--row);
    border-bottom: 1px dashed var(--line);
}

.row > strong,
.row > label,
.row > .label {
    grid-column: 1;
    font-weight: 600;
    color: var(--text-strong);
    overflow-wrap: anywhere;
}

.row > .details {
    grid-column: 2;
    min-width: 0;
}

.row > .actions {
    grid-column: 3;
    display: flex;
    justify-content: flex-end;
    gap: var(--space-1);
}

.row > .actions:empty {
    display: none;
}

.row a {
    display: flex;
    align-items: center;
    min-height: 44px;
}

.row.warning > strong,
.row.warning a {
    color: var(--attention);
}

.row.warning > .details {
    color: var(--text-strong);
}

.row.warning a {
    font-weight: 600;
}

.block form {
    display: contents;
}

.inline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-1) var(--space-2);
}

.inline input {
    flex: 1 1 200px;
}

.row input:not([type="radio"]) {
    width: 100%;
    max-width: 520px;
    min-height: var(--control);
    padding: 0 12px;
    font-size: 16px;
}

.dialog {
    width: calc(100% - 2 * var(--space-3));
    max-width: 520px;
    box-sizing: border-box;
    margin-top: 20vh;
    padding: 0 var(--space-3) var(--space-3);
    overflow: visible;
    background: var(--ground);
    border: 1px solid var(--line-strong);
    color: var(--text);
}

.dialog[open] {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.dialog::backdrop {
    background: rgb(26 29 29 / 0.78);
}

.dialog > .prompt {
    width: fit-content;
    margin: -13px 0 0 -10px;
    padding: 0 10px;
    background: var(--ground);
}

.dialog form,
.dialog-field {
    display: flex;
    flex-direction: column;
}

.dialog form {
    gap: var(--space-2);
}

.dialog-field {
    gap: var(--space-1);
}

.dialog-field label {
    font-weight: 600;
    color: var(--text-strong);
}

.dialog-field input {
    min-height: 44px;
    padding: 0 12px;
    font-size: 16px;
}

.dialog p {
    margin: 0;
}

.dialog-problem {
    color: var(--attention);
}

.dialog-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-1) var(--space-2);
    margin-top: var(--space-1);
}

.qr {
    display: block;
    width: 200px;
    height: 200px;
    margin: var(--space-2) 0;
    image-rendering: pixelated;
}

.codes {
    display: grid;
    grid-template-columns: repeat(2, max-content);
    gap: 0 var(--space-5);
    padding: var(--space-1) 0;
}

.prompt.path a {
    color: inherit;
}

.row > .name {
    grid-column: 1;
    font-family: var(--font-code);
    overflow-wrap: anywhere;
}

.row.wide > .details {
    grid-column: 1 / span 2;
    font-family: var(--font-code);
}

.row.note > .details {
    grid-column: 1 / span 2;
    color: var(--text-dim);
}

.preview {
    display: block;
    overflow: hidden;
    color: var(--text-dim);
    font-family: var(--font-code);
    font-size: 15px;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.row code.long {
    font-size: 15px;
    overflow-wrap: anywhere;
}

a.action {
    display: inline-flex;
    align-items: center;
    box-sizing: border-box;
    text-decoration: none;
}

.editor {
    display: block;
    width: 100%;
    min-height: 320px;
    box-sizing: border-box;
    margin: var(--space-1) 0;
    padding: 12px;
    background: var(--ground);
    border: 1px solid var(--line-strong);
    border-radius: 0;
    color: var(--text-strong);
    font-family: var(--font-code);
    font-size: 15px;
    line-height: 1.5;
    resize: vertical;
}

.row:has(> .details > .editor) > label {
    align-self: start;
    margin-top: var(--space-3);
}

.editor:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.document {
    margin: var(--space-2) 0;
    overflow-x: auto;
    color: var(--text-dim);
    font-family: var(--font-code);
    font-size: 15px;
    line-height: 1.5;
}

.json-name {
    color: var(--accent);
}

.json-text {
    color: var(--good);
}

.json-value {
    color: var(--attention);
}

.action.file {
    position: relative;
    display: inline-flex;
    align-items: center;
    box-sizing: border-box;
}

.action.file input {
    position: absolute;
    inset: 0;
    width: 100%;
    min-height: 0;
    padding: 0;
    opacity: 0;
    cursor: pointer;
}

.action.file:focus-within {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.colours {
    padding: var(--space-1) 0;
}

.row .colours input {
    flex: 1 1 130px;
    max-width: 180px;
}

.prose {
    max-width: 68ch;
}

.prose > :first-child {
    margin-top: 0;
}

.prose h1 {
    margin: 0 0 var(--space-3);
}

.prose h2,
.prose h3 {
    margin: var(--space-5) 0 var(--space-2);
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-strong);
}

.prose h2 {
    font-size: 24px;
}

.prose h3 {
    font-size: 19px;
}

.prose p,
.prose ul,
.prose ol,
.prose pre,
.prose blockquote,
.prose table {
    margin: 0 0 var(--space-2);
}

.prose ul,
.prose ol {
    padding-left: var(--space-3);
}

.prose li + li {
    margin-top: 4px;
}

.prose a {
    color: var(--text-strong);
}

.prose a:hover {
    color: var(--accent);
}

.prose strong {
    font-weight: 600;
    color: var(--text-strong);
}

.prose pre {
    padding: var(--space-2);
    overflow-x: auto;
    border: 1px dashed var(--line-strong);
    font-size: 15px;
}

.prose pre code {
    color: var(--text-strong);
}

.prose blockquote {
    padding-left: var(--space-2);
    border-left: 2px solid var(--accent);
    color: var(--text-dim);
}

.prose table {
    border-collapse: collapse;
}

.prose th,
.prose td {
    padding: var(--space-1) var(--space-2);
    border-bottom: 1px dashed var(--line);
    text-align: left;
}

.prose th {
    font-weight: 600;
    color: var(--text-strong);
}

.prose hr {
    margin: var(--space-5) 0;
    border: none;
    border-top: 1px dashed var(--line-strong);
}

.prose img {
    max-width: 100%;
}

.message-body {
    display: block;
    padding: var(--space-2) 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.row code {
    font-size: 18px;
}

.action {
    min-height: var(--control);
    padding: 0 var(--space-2);
    background: none;
    border: 1px solid var(--line-strong);
    border-radius: 0;
    color: var(--text);
    font: inherit;
    font-size: 16px;
    white-space: nowrap;
    cursor: pointer;
}

.action:hover {
    border-color: var(--text);
    color: var(--text-strong);
}

.action:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.action:disabled {
    opacity: 0.6;
    cursor: default;
}

.action.accept,
.action.accept:hover {
    background: var(--attention);
    border-color: var(--attention);
    color: var(--ground);
    font-weight: 600;
}

.action.primary,
.action.primary:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--ground);
    font-weight: 600;
}

.choices {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
}

.choices label {
    position: relative;
    display: flex;
}

.choices input {
    position: absolute;
    inset: 0;
    min-height: 0;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

.choices span,
.choice {
    display: flex;
    align-items: center;
    min-height: var(--control);
    padding: 0 var(--space-2);
    border: 1px solid var(--line-strong);
    font-size: 16px;
}

.choice {
    background: none;
    border-radius: 0;
    color: inherit;
    font-family: inherit;
    cursor: pointer;
}

.choice:disabled {
    cursor: default;
}

.choices input:checked + span,
.choice[aria-pressed="true"] {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--ground);
}

.choices input:focus-visible + span,
.choice:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.menu-button,
.menu {
    display: none;
}

.button,
input {
    box-sizing: border-box;
    min-height: 52px;
    border-radius: 0;
    font: inherit;
}

.button {
    padding: 0 22px;
    background: var(--accent);
    border: none;
    color: var(--ground);
    font-weight: 600;
    cursor: pointer;
}

input {
    padding: 0 14px;
    background: var(--ground);
    border: 1px solid var(--line-strong);
    color: var(--text-strong);
    font-family: var(--font-code);
    font-size: 18px;
}

input::placeholder {
    color: var(--text-dim);
}

.button:focus-visible,
input:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.button:disabled,
input:disabled {
    opacity: 0.6;
    cursor: default;
}

.landing {
    --landing-inset: clamp(24px, 4.5vw, 64px);
    --sign-in-room: 400px;

    display: flex;
    flex-wrap: wrap;
    min-height: 100vh;
}

.about,
.sign-in {
    flex: 1 1 360px;
    box-sizing: border-box;
    display: grid;
    padding: 56px var(--landing-inset) 64px;
}

.about {
    grid-template-rows: auto 1fr auto;
    row-gap: 48px;
    background: var(--raised);
    border-right: 1px solid var(--line);
}

.about .brand {
    font-size: 22px;
}

.about > div {
    align-self: center;
}

.about h1 {
    font-size: clamp(34px, 4.2vw, 54px);
    line-height: 1.08;
    text-wrap: balance;
}

.about p {
    max-width: 460px;
    margin: 20px 0 0;
    font-size: 20px;
}

.assurances {
    margin: 0;
    padding: 0;
    list-style: none;
    border-top: 1px dashed var(--line-strong);
}

.assurances li {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 48px;
    border-bottom: 1px dashed var(--line-strong);
}

.assurances li::before {
    content: "";
    flex: none;
    width: 10px;
    height: 10px;
    background: var(--good);
}

.sign-in > div {
    align-self: center;
    width: 100%;
    max-width: 520px;
    height: var(--sign-in-room);
}

.sign-in form {
    margin-top: 22px;
}

.sign-in label {
    display: block;
    margin-bottom: 8px;
}

.field {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.combobox {
    position: relative;
    flex: 1 1 220px;
    min-width: 0;
}

.combobox input {
    width: 100%;
}

.suggestions {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 1;
    margin: 0;
    padding: 0;
    list-style: none;
    background: var(--raised);
    border: 1px solid var(--line-strong);
}

.suggestions li {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 56px;
    padding: 0 12px;
    cursor: pointer;
}

.who {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.3;
}

.who > * {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.who code {
    font-size: 15px;
}

.suggestions li + li {
    border-top: 1px dashed var(--line);
}

.suggestions li:hover,
.suggestions li[aria-selected="true"] {
    background: var(--line);
    color: var(--text-strong);
}

.suggestions img,
.no-avatar {
    flex: none;
    width: 32px;
    height: 32px;
    background: var(--ground);
}

.lookup:not(:empty) {
    margin-top: 28px;
}

.create-account {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    margin-top: 16px;
}

.lookup h3::before {
    content: "";
    display: inline-block;
    width: 10px;
    height: 10px;
    margin-right: 12px;
}

.lookup .attention::before {
    background: var(--attention);
}

@media (max-width: 720px) {
    .top-bar {
        position: relative;
        flex-wrap: nowrap;
        justify-content: space-between;
        padding: 0 2px;
    }

    .top-bar nav,
    .top-bar .account-menu,
    .page-links {
        display: none;
    }

    .top-bar .brand,
    .menu-button {
        min-height: 52px;
    }

    .menu-button {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 0 var(--link-inset);
        background: none;
        border: none;
        border-radius: 0;
        color: var(--text);
        font: inherit;
        font-size: 16px;
        cursor: pointer;
    }

    .menu-button:focus-visible {
        outline: 2px solid var(--accent);
        outline-offset: -2px;
    }

    .top-bar .menu {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        z-index: 2;
        box-sizing: border-box;
        display: flex;
        flex-direction: column;
        min-height: calc(100vh - 53px);
        margin-top: 1px;
        padding: var(--space-1) var(--space-2) var(--space-3);
        background: var(--raised);
    }

    .top-bar .menu a,
    .top-bar .menu div {
        border-bottom: 1px dashed var(--line);
    }

    .top-bar .menu a {
        flex-direction: row;
        justify-content: flex-start;
        min-height: 48px;
        padding: 0;
    }

    .top-bar .menu a::after {
        display: none;
    }

    .top-bar .menu div {
        display: flex;
        flex-direction: column;
        padding: var(--space-1) 0;
    }

    .top-bar .menu div a {
        min-height: 44px;
        padding-left: var(--space-2);
        border-bottom: none;
    }

    .top-bar .menu div span {
        display: flex;
        align-items: center;
        min-height: 32px;
        color: var(--text-dim);
    }

    .top-bar .menu a[aria-current] {
        padding-left: var(--space-2);
    }

    .top-bar .menu footer {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        gap: var(--space-1) var(--space-2);
        padding-top: var(--space-2);
    }

    .top-bar .menu footer code {
        min-width: 0;
        overflow-wrap: anywhere;
        color: var(--text);
        font-size: 15px;
    }

    .page {
        padding: var(--space-3) var(--space-2) var(--space-5);
    }

    .row {
        grid-template-columns: minmax(0, 1fr) auto;
        column-gap: var(--space-2);
        padding: var(--space-1) 0;
    }

    .row > strong,
    .row > label,
    .row > .label {
        grid-column: 1;
        grid-row: 1;
    }

    .row > .details {
        grid-column: 1;
        grid-row: 2;
    }

    .row > .actions {
        grid-column: 2;
        grid-row: 1 / span 2;
    }

    .row:has(> .details > .editor) > label {
        margin-top: 0;
    }

    .row .colours input {
        flex: 1 1 40%;
        max-width: none;
    }

    .row > .details > .choices {
        padding-top: var(--space-1);
    }

    .row > .details:first-child,
    .row > .details:first-child + .actions {
        grid-row: 1;
    }

    .row > .details:only-child,
    .row > .actions:only-child {
        grid-column: 1 / -1;
        grid-row: 1;
    }

    .row > :only-child .action {
        flex: 1;
        width: 100%;
        min-height: 44px;
    }

    .row.form-row,
    .row.confirming {
        grid-template-columns: minmax(0, 1fr);
        row-gap: var(--space-1);
        padding: var(--space-2) 0;
    }

    .row.confirming > .actions {
        grid-column: 1;
        grid-row: 3;
    }

    .row.confirming .action {
        flex: 1;
        min-height: 44px;
    }

    .row input:not([type="radio"]) {
        max-width: none;
        min-height: 44px;
    }

    .choices span,
    .choice {
        min-height: 44px;
    }

    .landing {
        --sign-in-room: auto;

        align-content: flex-start;
    }

    .about {
        border-right: none;
        border-bottom: 1px solid var(--line);
    }
}
