/* misc.roofus.fyi. Desktop is DESKTOP_QUERY from assets/js/config.js,
   (min-width: 900px) and (min-height: 501px); everything else gets the phone layout,
   landscape phones included. Colors and fonts come from assets/css/tokens.css. */

[hidden] {
    display: none !important;
}

html,
body {
    height: 100%;
}

html {
    background: var(--surface-canvas);
}

body {
    margin: 0;
    overflow: hidden;
    color: var(--text-primary);
    background: var(--surface-canvas);
    font-family: 'Accord W', sans-serif;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

button,
input,
select,
textarea {
    color: inherit;
}

svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex: none;
}

a {
    color: #a9caff;
}

h2 {
    margin: 0;
    font: 700 18px 'Halifax Bold', sans-serif;
}

.m-muted {
    color: var(--text-muted);
}

.m-error {
    min-height: 1.2em;
    margin: 0;
    color: #ff9b96;
    font-size: 14px;
}

.m-brand {
    font: 700 16px 'Space Mono', monospace;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--white-line);
}

/* ---------- Controls (the Uploads page's look) ---------- */

.m-input,
.m-select {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid var(--surface-border);
    border-radius: 6px;
    background: var(--surface-input);
    font: 400 14px 'Space Mono', monospace;
    outline: none;
}

.m-input:focus,
.m-select:focus {
    border-color: var(--brand-red);
}

.m-select {
    appearance: none;
    padding-right: 34px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23A2A6B0' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M7 10l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
}

.m-select option,
.m-select optgroup {
    background: var(--surface-input);
}

.m-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 32px;
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    background: var(--brand-house-grey);
    font: 400 12px 'Space Mono', monospace;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}

.m-btn svg {
    width: 16px;
    height: 16px;
}

.m-btn:hover {
    background: #5a5e67;
}

.m-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

.m-btn-primary {
    background: var(--brand-red);
}

.m-btn-primary:hover {
    background: var(--brand-red-muted);
}

.m-btn-quiet {
    background: transparent;
    border: 1px solid var(--surface-border);
}

.m-btn-quiet:hover {
    background: rgba(255, 255, 255, 0.05);
}

.m-btn-danger {
    background: #7a2421;
}

.m-btn-danger:hover {
    background: var(--brand-red);
}

.m-btn-wide {
    width: 100%;
}

.m-icon-btn {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    flex: none;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
}

.m-icon-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.06);
}

.m-link-quiet {
    padding: 0;
    border: none;
    background: none;
    color: var(--text-muted);
    font: 400 12px 'Space Mono', monospace;
    text-decoration: none;
    cursor: pointer;
}

.m-link-quiet:hover {
    color: var(--text-primary);
}

.m-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.m-check input {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--brand-red);
}

.m-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.m-end {
    justify-content: flex-end;
}

.m-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 4px;
    background: var(--brand-shadow-grey);
    color: var(--text-muted);
    font: 400 11px 'Space Mono', monospace;
    white-space: nowrap;
    vertical-align: middle;
}

.m-badge.is-on {
    background: rgba(78, 190, 106, 0.16);
    color: #8fdba3;
}

/* ---------- Login ---------- */

.m-login {
    display: grid;
    place-items: center;
    height: var(--vh-dynamic);
    padding: 16px;
    box-sizing: border-box;
}

.m-login-card {
    display: grid;
    gap: 12px;
    justify-items: center;
    width: min(340px, 100%);
    padding: 28px 24px;
    box-sizing: border-box;
    border: 1px solid var(--brand-shadow-grey);
    border-radius: 14px;
    background: var(--surface-card);
    text-align: center;
}

.m-login-card p {
    margin: 0 0 6px;
}

.m-login-badge {
    border-radius: 50%;
}

/* ---------- App shell ---------- */

.m-app {
    display: grid;
    grid-template-columns: 272px minmax(0, 1fr);
    /* --app-height follows the visual viewport on phones (set by misc.js), so the
       composer stays above the iOS keyboard. */
    height: var(--app-height, var(--vh-dynamic));
}

.m-sidebar {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
    padding: 16px 12px 14px;
    border-right: 1px solid var(--brand-shadow-grey);
    background: var(--surface-drawer);
}

.m-side-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 36px;
    padding: 0 6px;
}

.m-new-chat {
    justify-content: flex-start;
    min-height: 38px;
}

.m-chat-list {
    display: grid;
    align-content: start;
    gap: 2px;
    flex: 1;
    min-height: 0;
    margin: 0 -4px;
    padding: 0 4px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.m-chat-item {
    display: flex;
    align-items: center;
    gap: 4px;
    border-radius: 8px;
}

.m-chat-item:hover {
    background: rgba(255, 255, 255, 0.04);
}

.m-chat-item.is-active {
    background: var(--surface-card);
    box-shadow: inset 2px 0 0 var(--brand-red);
}

.m-chat-open {
    display: grid;
    gap: 2px;
    flex: 1;
    min-width: 0;
    padding: 8px 4px 8px 10px;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
}

.m-chat-title {
    overflow: hidden;
    font-size: 14px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.m-chat-when {
    color: var(--text-muted);
    font: 400 11px 'Space Mono', monospace;
}

.m-chat-del {
    width: 30px;
    height: 30px;
    opacity: 0;
}

.m-chat-item:hover .m-chat-del,
.m-chat-del:focus-visible {
    opacity: 1;
}

.m-chat-del svg {
    width: 16px;
    height: 16px;
}

.m-side-foot {
    display: flex;
    justify-content: space-between;
    padding: 8px 6px 0;
    border-top: 1px solid var(--brand-shadow-grey);
}

.m-scrim {
    position: fixed;
    inset: 0;
    z-index: 25;
    background: rgba(10, 10, 12, 0.55);
}

.m-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
}

.m-top {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--brand-shadow-grey);
}

.m-model-wrap {
    flex: 0 1 360px;
    min-width: 0;
    margin-right: auto;
}

.m-model-wrap .m-select {
    padding-top: 8px;
    padding-bottom: 8px;
    font-size: 13px;
}

/* The site's presence badge, showing LM Studio's state. */
.m-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border: 1px solid var(--house-grey);
    border-radius: 12px;
    background: var(--surface-input);
    color: var(--text-dim);
    font: 400 11px 'Space Mono', monospace;
    letter-spacing: 0.5px;
    white-space: nowrap;
    cursor: pointer;
}

.m-pill:hover {
    border-color: var(--red-primary);
    color: var(--white-line);
}

.m-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-muted);
}

.m-pill.is-up .m-dot {
    background: #4EBE6A;
    box-shadow: 0 0 6px rgba(78, 190, 106, 0.6);
    animation: m-pulse 2s infinite ease-in-out;
}

.m-pill.is-busy .m-dot {
    background: #E0A040;
    box-shadow: 0 0 6px rgba(224, 160, 64, 0.6);
    animation: m-pulse 0.9s infinite ease-in-out;
}

.m-pill.is-down .m-dot {
    background: var(--brand-red);
}

@keyframes m-pulse {
    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.4;
        transform: scale(0.85);
    }
}

.m-banner {
    margin: 12px auto 0;
    width: min(820px, calc(100% - 2 * var(--gutter)));
    box-sizing: border-box;
    padding: 12px 14px;
    border: 1px solid var(--brand-red);
    border-radius: 12px;
    background: rgba(200, 63, 59, 0.12);
    font-size: 14px;
}

.m-banner code {
    font: 400 12px 'Space Mono', monospace;
}

/* ---------- Messages ---------- */

.m-scroller {
    position: relative;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.m-empty {
    display: grid;
    place-items: center;
    gap: 6px;
    height: 100%;
    padding: 24px;
    box-sizing: border-box;
    text-align: center;
}

.m-empty img {
    border-radius: 50%;
    opacity: 0.85;
}

.m-messages {
    display: grid;
    gap: 22px;
    max-width: 820px;
    margin: 0 auto;
    padding: 24px var(--gutter) 12px;
    list-style: none;
}

.m-messages:empty {
    display: none;
}

.m-msg {
    display: grid;
    gap: 6px;
    min-width: 0;
}

.m-msg-user {
    justify-items: end;
}

.m-bubble {
    max-width: min(85%, 640px);
    padding: 10px 14px;
    border: 1px solid var(--brand-shadow-grey);
    border-radius: 14px 14px 4px 14px;
    background: var(--surface-card);
    line-height: 1.5;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.m-images {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
    max-width: min(85%, 640px);
}

.m-images button {
    padding: 0;
    border: none;
    background: none;
    cursor: zoom-in;
}

.m-images img {
    display: block;
    width: 120px;
    height: 120px;
    border: 1px solid var(--brand-shadow-grey);
    border-radius: 10px;
    object-fit: cover;
}

.m-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px 10px;
    min-height: 26px;
    color: var(--text-muted);
    font: 400 11px 'Space Mono', monospace;
}

.m-actions {
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: opacity 0.15s;
}

.m-msg:hover .m-actions,
.m-msg:focus-within .m-actions {
    opacity: 1;
}

@media (hover: none) {
    .m-actions {
        opacity: 1;
    }
}

.m-act {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 6px;
    border: none;
    border-radius: 6px;
    background: none;
    color: var(--text-muted);
    font: 400 11px 'Space Mono', monospace;
    cursor: pointer;
}

.m-act svg {
    width: 14px;
    height: 14px;
}

.m-act:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.06);
}

.m-msg-error {
    padding: 10px 12px;
    border: 1px solid rgba(200, 63, 59, 0.6);
    border-radius: 10px;
    background: rgba(200, 63, 59, 0.1);
    color: #ffb3af;
    font-size: 14px;
}

.m-think {
    border-left: 2px solid var(--brand-shadow-grey);
    padding-left: 12px;
    color: var(--text-muted);
}

.m-think summary {
    color: var(--text-muted);
    font: 400 12px 'Space Mono', monospace;
    cursor: pointer;
    list-style-position: inside;
}

.m-think-body {
    margin-top: 6px;
    font-size: 14px;
    line-height: 1.55;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.m-waiting {
    display: inline-flex;
    gap: 5px;
    padding: 10px 0;
}

.m-waiting span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: m-bounce 1.2s infinite ease-in-out;
}

.m-waiting span:nth-child(2) {
    animation-delay: 0.15s;
}

.m-waiting span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes m-bounce {
    0%,
    80%,
    100% {
        opacity: 0.3;
        transform: translateY(0);
    }

    40% {
        opacity: 1;
        transform: translateY(-4px);
    }
}

/* Rendered Markdown */
.m-md {
    min-width: 0;
    font-size: 15.5px;
    line-height: 1.65;
    overflow-wrap: anywhere;
}

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

.m-md > :last-child {
    margin-bottom: 0;
}

.m-md p,
.m-md ul,
.m-md ol,
.m-md blockquote,
.m-md table,
.m-md pre {
    margin: 0 0 0.85em;
}

.m-md ul,
.m-md ol {
    padding-left: 1.4em;
}

.m-md li + li {
    margin-top: 0.25em;
}

.m-md h1,
.m-md h2,
.m-md h3,
.m-md h4 {
    margin: 1.2em 0 0.5em;
    font: 700 1.15em 'Halifax Bold', sans-serif;
    line-height: 1.3;
}

.m-md h1 {
    font-size: 1.4em;
}

.m-md blockquote {
    padding-left: 12px;
    border-left: 2px solid var(--brand-red);
    color: var(--text-muted);
}

.m-md hr {
    border: none;
    border-top: 1px solid var(--brand-shadow-grey);
}

.m-md code {
    padding: 1px 5px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.07);
    font-family: 'Space Mono', monospace;
    font-size: 0.86em;
}

.m-md .m-code {
    position: relative;
}

.m-md pre {
    padding: 12px 14px;
    overflow-x: auto;
    border: 1px solid var(--brand-shadow-grey);
    border-radius: 8px;
    background: var(--surface-input);
    font: 400 13px/1.55 'Space Mono', monospace;
}

.m-md pre code {
    padding: 0;
    background: none;
    font-size: inherit;
    overflow-wrap: normal;
    white-space: pre;
}

.m-copy-code {
    position: absolute;
    top: 6px;
    right: 6px;
    padding: 2px 8px;
    border: 1px solid var(--brand-shadow-grey);
    border-radius: 5px;
    background: var(--surface-card);
    color: var(--text-muted);
    font: 400 11px 'Space Mono', monospace;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s;
}

.m-code:hover .m-copy-code,
.m-copy-code:focus-visible {
    opacity: 1;
}

@media (hover: none) {
    .m-copy-code {
        opacity: 1;
    }
}

.m-md table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    border-collapse: collapse;
    font-size: 14px;
}

.m-md th,
.m-md td {
    padding: 6px 10px;
    border: 1px solid var(--brand-shadow-grey);
    text-align: left;
}

.m-md img {
    max-width: 100%;
}

/* ---------- Composer ---------- */

.m-composer {
    width: 100%;
    max-width: 820px;
    margin: 0 auto;
    box-sizing: border-box;
    padding: 8px var(--gutter) max(16px, env(safe-area-inset-bottom));
}

.m-attachments {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.m-thumb {
    position: relative;
}

.m-thumb img {
    display: block;
    width: 64px;
    height: 64px;
    border: 1px solid var(--surface-border);
    border-radius: 10px;
    object-fit: cover;
}

.m-thumb button {
    position: absolute;
    top: -6px;
    right: -6px;
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 1px solid var(--surface-border);
    border-radius: 50%;
    background: var(--surface-card);
    color: var(--text-primary);
    cursor: pointer;
}

.m-thumb button svg {
    width: 12px;
    height: 12px;
    stroke-width: 2.4;
}

.m-attach-note {
    color: #ffcf8a;
    font: 400 12px 'Space Mono', monospace;
}

.m-compose-row {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    padding: 5px;
    border: 1px solid var(--surface-border);
    border-radius: 14px;
    background: var(--surface-card);
    transition: border-color 0.15s;
}

.m-compose-row:focus-within,
.m-composer.is-over .m-compose-row {
    border-color: var(--brand-red);
}

.m-textarea {
    flex: 1;
    min-width: 0;
    max-height: 40vh;
    margin: 0;
    padding: 8px 4px;
    border: none;
    outline: none;
    background: transparent;
    font: 400 15px/1.45 'Accord W', sans-serif;
    resize: none;
}

.m-textarea::placeholder {
    color: var(--text-muted);
}

.m-send {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    flex: none;
    padding: 0;
    border: none;
    border-radius: 10px;
    background: var(--brand-red);
    color: var(--white-line);
    cursor: pointer;
}

.m-send:hover {
    background: var(--brand-red-muted);
}

.m-send:disabled {
    background: var(--brand-house-grey);
    opacity: 0.6;
    cursor: default;
}

.m-send svg {
    stroke-width: 2.2;
}

.m-stop-icon {
    display: none;
    fill: currentColor;
}

.m-composer.is-busy .m-send-icon {
    display: none;
}

.m-composer.is-busy .m-stop-icon {
    display: block;
}

/* ---------- Dialogs ---------- */

.m-dialog {
    flex-direction: column;
    width: min(480px, calc(100vw - 32px));
    max-height: min(85vh, 780px);
    padding: 0;
    border: 1px solid var(--brand-shadow-grey);
    border-radius: 14px;
    background: var(--surface-card);
    color: var(--text-primary);
}

.m-dialog[open] {
    display: flex;
}

.m-dialog > form {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.m-dialog-wide {
    width: min(720px, calc(100vw - 32px));
}

.m-dialog::backdrop {
    background: rgba(10, 10, 12, 0.6);
}

.m-dialog-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 14px 0 20px;
}

.m-dialog-body {
    display: grid;
    align-content: start;
    gap: 14px;
    min-height: 0;
    padding: 14px 20px 20px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.m-dialog-body > h2 {
    margin-top: 4px;
}

.m-dialog-body > p {
    margin: 0;
}

.m-field {
    display: grid;
    gap: 6px;
    font-size: 14px;
}

.m-system {
    min-height: 96px;
    resize: vertical;
    font-family: 'Accord W', sans-serif;
    line-height: 1.45;
}

.m-model-list {
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.m-model {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 12px;
    align-items: center;
    padding: 12px 14px;
    border: 1px solid var(--brand-shadow-grey);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.12);
}

.m-model.is-loaded {
    border-color: rgba(78, 190, 106, 0.45);
}

.m-model-name {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    overflow-wrap: anywhere;
}

.m-model-meta {
    margin-top: 3px;
    color: var(--text-muted);
    font: 400 12px 'Space Mono', monospace;
    overflow-wrap: anywhere;
}

.m-model-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
}

.m-model-actions .m-select {
    width: auto;
    padding: 6px 30px 6px 10px;
    font-size: 12px;
}

.m-model-note {
    grid-column: 1 / -1;
    color: var(--text-muted);
    font: 400 12px 'Space Mono', monospace;
}

.m-model-note.is-error {
    color: #ff9b96;
}

.m-download {
    padding-top: 4px;
    border-top: 1px solid var(--brand-shadow-grey);
}

.m-download summary {
    padding: 8px 0;
    font: 700 15px 'Halifax Bold', sans-serif;
    cursor: pointer;
}

.m-download-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 150px auto;
    gap: 8px;
}

.m-download-list {
    display: grid;
    gap: 8px;
    margin: 10px 0 0;
    padding: 0;
    list-style: none;
    font: 400 12px 'Space Mono', monospace;
}

.m-download-list progress {
    width: 100%;
    height: 6px;
    accent-color: var(--brand-red);
}

.m-viewer {
    max-width: 100vw;
    max-height: 100vh;
    padding: 0;
    border: none;
    background: transparent;
}

.m-viewer::backdrop {
    background: rgba(5, 5, 7, 0.9);
}

.m-viewer img {
    display: block;
    max-width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
    border-radius: 8px;
    cursor: zoom-out;
}

.m-toast {
    position: fixed;
    left: 50%;
    bottom: calc(96px + env(safe-area-inset-bottom));
    z-index: 40;
    display: flex;
    align-items: center;
    gap: 14px;
    max-width: calc(100vw - 32px);
    box-sizing: border-box;
    padding: 10px 14px;
    border: 1px solid var(--surface-border);
    border-radius: 10px;
    background: var(--surface-drawer);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.4);
    font-size: 14px;
    transform: translateX(-50%);
}

.m-toast-btn {
    padding: 0;
    border: none;
    background: none;
    color: #ff8c87;
    font: 700 12px 'Space Mono', monospace;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
}

/* ---------- Desktop / phone ---------- */

@media (min-width: 900px) and (min-height: 501px) {
    .m-phone-only {
        display: none !important;
    }
}

@media not all and (min-width: 900px) and (min-height: 501px) {
    :root {
        --gutter: 14px;
    }

    .m-app {
        grid-template-columns: minmax(0, 1fr);
    }

    .m-sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        z-index: 30;
        width: min(84vw, 320px);
        box-sizing: border-box;
        padding-top: max(14px, env(safe-area-inset-top));
        padding-bottom: max(14px, env(safe-area-inset-bottom));
        padding-left: max(12px, env(safe-area-inset-left));
        transform: translateX(-102%);
        transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
        visibility: hidden;
    }

    .m-app.side-open .m-sidebar {
        transform: none;
        visibility: visible;
        box-shadow: 12px 0 40px rgba(0, 0, 0, 0.45);
    }

    .m-chat-del {
        opacity: 1;
    }

    .m-top {
        gap: 4px;
        padding: max(8px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) 8px max(8px, env(safe-area-inset-left));
    }

    .m-pill {
        padding: 3px 8px;
    }

    #status-text {
        display: none;
    }

    .m-composer {
        padding-left: max(var(--gutter), env(safe-area-inset-left));
        padding-right: max(var(--gutter), env(safe-area-inset-right));
        padding-bottom: max(10px, env(safe-area-inset-bottom));
    }

    /* 16px stops iOS from zooming in on focus. */
    .m-input,
    .m-select,
    .m-textarea,
    .m-model-wrap .m-select {
        font-size: 16px;
    }

    .m-btn {
        min-height: 40px;
    }

    .m-bubble,
    .m-images {
        max-width: 92%;
    }

    .m-images img {
        width: 96px;
        height: 96px;
    }

    /* Dialogs become bottom sheets. */
    .m-dialog,
    .m-dialog-wide {
        width: 100%;
        max-width: 100%;
        max-height: calc(var(--app-height, 100dvh) - 24px);
        margin: auto 0 0;
        border-width: 1px 0 0;
        border-radius: 16px 16px 0 0;
        padding-bottom: env(safe-area-inset-bottom);
        box-sizing: border-box;
    }

    .m-model {
        grid-template-columns: minmax(0, 1fr);
    }

    .m-model-actions {
        justify-content: flex-start;
    }

    .m-download-form {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .m-download-form .m-input:first-child {
        grid-column: 1 / -1;
    }

    .m-toast {
        bottom: calc(84px + env(safe-area-inset-bottom));
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }
}
