@font-face {
    font-family: Roboto;
    src: url("fonts/roboto-latin-wght-normal.woff2") format("woff2");
    font-weight: 100 900;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: Roboto;
    src: url("fonts/roboto-latin-ext-wght-normal.woff2") format("woff2");
    font-weight: 100 900;
    font-display: swap;
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
    --blue: linear-gradient(180deg, #2E4BE6 0%, #2E3DE6 100%);
    --blue-hover: linear-gradient(180deg, #3753ED 0%, #3746ED 100%);
    --blue-active: linear-gradient(180deg, #2943CC 0%, #2936CC 100%);
    --signal: #3C5BFF;
    --night: #050608;
    --surface: #1F2022;
    --peer: #303235;
    --text: rgba(255, 255, 255, 0.9);
    --text-soft: rgba(255, 255, 255, 0.72);
    --text-faint: rgba(255, 255, 255, 0.55);
    --hairline: rgba(217, 217, 217, 0.3);
    --danger: #FF8A80;
    --ease: cubic-bezier(0, 0, 0, 1);
    --sidebar-width: 320px;
    --bubble-size: 18px;
    --panel-width: 480px;
    --panel-top: 72px;
    --panel-bottom: 40px;
    --panel-radius: 40px;
    --header-height: 94px;
    --composer-height: 80px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html, body {
    height: 100%;
}

body {
    color: #fff;
    font-family: Roboto, system-ui, sans-serif;
    font-weight: 400;
    background: var(--night);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

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

button {
    background: none;
    border: none;
    cursor: pointer;
}

:focus-visible {
    outline: 2px solid #8FA2FF;
    outline-offset: 2px;
}

::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
}

/* The logo's three stacked squares, far too large, sit behind the glass and give it something to refract */
.backdrop {
    position: fixed;
    inset: 0;
    background-color: var(--night);
    background-image:
        radial-gradient(45% 55% at 16% 18%, rgba(46, 75, 230, 0.42), transparent 72%),
        radial-gradient(38% 48% at 88% 84%, rgba(186, 112, 66, 0.2), transparent 74%),
        radial-gradient(60% 60% at 74% 8%, rgba(92, 112, 150, 0.16), transparent 70%);
}

.backdrop::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 118vmin;
    height: 118vmin;
    background: url("images/mark.svg") center / contain no-repeat;
    opacity: 0.05;
    filter: blur(14px);
    transform: translate(-50%, -50%) scale(1.1);
    transition: transform 20s var(--ease), opacity 1.2s var(--ease);
}

.unlocked .backdrop::after {
    opacity: 0.07;
    transform: translate(-50%, -50%) scale(1);
}

.noise {
    position: fixed;
    inset: 0;
    z-index: 50;
    background: url("images/noise.svg") 0 0 / 350px auto;
    opacity: 0.09;
    pointer-events: none;
}

/* Top bar */
.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    transition: opacity 0.3s var(--ease);
}

.topbar-side {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-mark {
    display: block;
    width: 28px;
    height: 28px;
}

.line {
    width: 1px;
    align-self: stretch;
    background: var(--hairline);
}

.wordmark {
    font-size: 16px;
    font-weight: 900;
    letter-spacing: 22px;
    text-transform: uppercase;
}

.link {
    color: var(--text-faint);
    font-weight: 500;
    font-size: 13px;
    padding: 8px 0;
    transition: color 0.3s var(--ease);
}

.link:hover {
    color: #fff;
}

/* Buttons */
.button {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 30px;
    font-weight: 500;
    font-size: 16px;
    line-height: 1;
    background-color: rgba(255, 255, 255, 0.15);
    color: var(--text-soft);
    text-decoration: none;
    transition: background-color 0.1s var(--ease), color 0.1s var(--ease);
}

.button:hover {
    background-color: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.button:active {
    background-color: rgba(255, 255, 255, 0.25);
}

.button.primary {
    background: var(--blue);
    color: var(--text);
}

.button.primary:hover {
    background: var(--blue-hover);
    color: #fff;
}

.button.primary:active {
    background: var(--blue-active);
}

.button.primary:disabled {
    opacity: 0.75;
    cursor: progress;
}

.button.big {
    padding: 16px 24px;
}

.button.full {
    display: block;
    width: 100%;
}

.button.small {
    padding: 10px 16px;
    font-size: 14px;
}

.button.danger {
    background-color: rgba(255, 138, 128, 0.18);
    color: var(--danger);
}

.button-quiet {
    display: block;
    width: 100%;
    padding: 10px;
    margin-top: 4px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-faint);
    transition: color 0.3s var(--ease);
}

.button-quiet:hover {
    color: #fff;
}

.icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: var(--text-faint);
    cursor: pointer;
    position: relative;
    transition: color 0.2s var(--ease), background-color 0.2s var(--ease);
}

.icon-btn:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.08);
}

.icon-btn:focus-within {
    outline: 2px solid #8FA2FF;
    outline-offset: 2px;
}

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

[data-tooltip]::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 13px;
    white-space: nowrap;
    color: #fff;
    background: var(--surface);
    display: none;
    pointer-events: none;
}

[data-tooltip]:hover::before {
    display: block;
}

.chat-header [data-tooltip]::before {
    bottom: auto;
    top: calc(100% + 8px);
}

/* Lock screen */
.lock-screen {
    position: fixed;
    inset: 0;
    z-index: 3;
    display: flex;
    justify-content: center;
    overflow-y: auto;
    padding: 72px 16px 32px;
    transition: opacity 0.5s var(--ease), transform 0.7s var(--ease);
}

.lock-content {
    margin: auto 0;
    width: 400px;
    max-width: 100%;
}

.clock {
    text-align: center;
    font-size: 112px;
    line-height: 1;
    font-weight: 100;
    font-variant-numeric: tabular-nums;
    margin-bottom: 8px;
}

.clock-date {
    text-align: center;
    font-size: 22px;
    font-weight: 300;
    color: var(--text-soft);
    margin-bottom: 28px;
}

.lock-card {
    border-radius: 24px;
    padding: 20px;
    background-color: rgba(66, 66, 66, 0.5);
    backdrop-filter: blur(80px);
    box-shadow:
        rgba(255, 255, 255, 0.2) 0 1px 0 0 inset,
        rgba(0, 0, 0, 0.25) 0 40px 80px;
}

.lock-card.shake {
    animation: shake 0.4s var(--ease);
}

.field {
    margin-bottom: 14px;
}

.field label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-soft);
    margin-bottom: 6px;
}

.optional {
    font-weight: 400;
    color: var(--text-faint);
    margin-left: 4px;
}

.field input {
    display: block;
    width: 100%;
    height: 46px;
    padding: 0 14px;
    font-size: 16px;
    font-weight: 400;
    border: none;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.28);
    outline: none;
    transition: box-shadow 0.15s var(--ease);
}

.field input:focus {
    box-shadow: 0 0 0 2px var(--signal);
}

.input-row {
    position: relative;
}

.input-row input {
    padding-right: 68px;
}

.input-action {
    position: absolute;
    top: 3px;
    right: 3px;
    height: 40px;
    padding: 0 12px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-faint);
}

.input-action:hover {
    color: #fff;
}

.strength {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    font-size: 13px;
    color: var(--text-soft);
}

.strength-track {
    flex: 1;
    height: 4px;
    border-radius: 2px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.14);
}

.strength-bar {
    width: 0;
    height: 100%;
    background: var(--danger);
    transition: width 0.2s var(--ease), background-color 0.2s var(--ease);
}

.strength-bar.ok {
    background: #8FA2FF;
}

.lock-error {
    font-size: 14px;
    line-height: 1.4;
    color: var(--danger);
    margin-bottom: 14px;
}

.insecure-notice h2 {
    font-size: 20px;
    font-weight: 500;
    margin-bottom: 10px;
}

.insecure-notice p {
    font-weight: 300;
    line-height: 1.5;
    color: var(--text);
}

code {
    font-family: ui-monospace, "SF Mono", "Cascadia Code", Menlo, monospace;
    font-size: 0.9em;
    padding: 1px 5px;
    border-radius: 5px;
    background: rgba(0, 0, 0, 0.3);
}

/* The unlock: the lock screen lifts away while the panel rises into place */
.unlocked .lock-screen {
    opacity: 0;
    transform: translateY(-48px) scale(0.98);
    pointer-events: none;
    visibility: hidden;
    transition: opacity 0.5s var(--ease), transform 0.7s var(--ease), visibility 0s 0.7s;
}

/* The app: list of chats and open chat, side by side */
.shell {
    position: fixed;
    z-index: 4;
    top: var(--panel-top);
    bottom: var(--panel-bottom);
    left: 50%;
    display: flex;
    gap: 16px;
    transform: translateX(-50%);
    transition: transform 0.6s var(--ease) 0.08s, opacity 0.5s var(--ease) 0.08s;
}

.shell.hidden {
    opacity: 0;
    transform: translate(-50%, 36px);
    pointer-events: none;
    visibility: hidden;
}

.chat {
    position: relative;
    width: var(--panel-width);
}

.chat-backdrop {
    position: absolute;
    inset: 0;
    border-radius: var(--panel-radius);
    backdrop-filter: blur(80px);
    background:
        linear-gradient(0deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.03)),
        linear-gradient(0deg, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2)),
        linear-gradient(165deg, rgba(171, 171, 171, 0.1) 20%, rgba(0, 0, 0, 0.1) 66%);
    box-shadow: rgba(0, 0, 0, 0.2) 0 40px 80px;
}

.chat-border {
    position: absolute;
    inset: -1px;
    z-index: 3;
    border-radius: var(--panel-radius);
    pointer-events: none;
    box-shadow:
        rgba(0, 0, 0, 0.15) 1px 0 0 0 inset,
        rgba(255, 255, 255, 0.25) 0 1px 0 0 inset,
        rgba(255, 255, 255, 0.2) 0 -1px 0 0 inset;
}

.chat-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 2;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 23px;
    border-radius: var(--panel-radius) var(--panel-radius) 0 0;
    background-color: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(80px);
}

.recipient {
    display: flex;
    flex: 1;
    align-items: center;
    gap: 12px;
    min-width: 0;
    text-align: left;
    border-radius: 12px;
}

.recipient:disabled {
    cursor: default;
}

.chat-back {
    display: none;
}

.avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    font-size: 18px;
    font-weight: 500;
    color: var(--text);
    overflow: hidden;
}

.avatar img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-letter {
    background: hsl(var(--avatar-hue) 42% 38%);
}

.room-avatar {
    background: var(--blue);
    border-radius: 14px;
}

.avatar.small {
    width: 36px;
    height: 36px;
    font-size: 15px;
}

.avatar.large {
    width: 96px;
    height: 96px;
    font-size: 38px;
    box-shadow: 0 0 0 4px var(--surface);
}

.user {
    min-width: 0;
}

.user .name {
    font-weight: 500;
    font-size: 18px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user .status {
    font-weight: 500;
    font-size: 12px;
    line-height: 1.4;
    margin-top: 2px;
    color: var(--text-faint);
}

.status.offline {
    color: var(--danger);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

/* Messages */
.messages {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: calc(var(--header-height) + 8px) 24px calc(var(--composer-height) + 12px);
    border-radius: var(--panel-radius);
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
    outline: none;
}

.messages::-webkit-scrollbar {
    display: none;
}

.notice-open .messages {
    padding-bottom: calc(var(--composer-height) + 56px);
}

.spacer {
    flex: 1 0 auto;
}

.empty-state {
    margin: auto 8px;
    padding-bottom: 8vh;
    text-align: center;
}

.empty-state h2 {
    font-size: 24px;
    font-weight: 300;
    margin-bottom: 12px;
}

.empty-state p {
    font-size: 15px;
    font-weight: 300;
    line-height: 1.5;
    color: var(--text-soft);
    margin-bottom: 20px;
}

.new-password {
    margin-bottom: 20px;
}

.new-password-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-soft);
    margin-bottom: 8px;
}

.new-password code {
    display: inline-block;
    padding: 8px 14px;
    border-radius: 12px;
    font-size: 17px;
    user-select: all;
}

.empty-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.date,
.system {
    align-self: stretch;
    text-align: center;
    font-size: 14px;
    line-height: 1.3;
    color: var(--text-faint);
}

.date {
    padding: 32px 10px 16px;
}

.system {
    padding: 10px;
}

.system.warning {
    color: var(--danger);
}

.msg {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    max-width: 82%;
    align-self: flex-start;
}

.msg.mine {
    align-items: flex-end;
    align-self: flex-end;
}

.msg.new-group {
    margin-top: 16px;
}

.msg.has-avatar.mine {
    flex-direction: row-reverse;
}

.msg.has-avatar {
    flex-direction: row;
    align-items: flex-start;
    gap: 8px;
}

.msg-avatar {
    flex: 0 0 36px;
}

.avatar-button {
    display: block;
    border-radius: 50%;
}

.msg-column {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 0;
}

.msg.unreadable .message {
    font-size: 14px;
    font-style: italic;
    color: var(--text-faint);
    background: transparent;
    border: 1px dashed var(--hairline);
}

.load-more {
    align-self: center;
    margin: 8px 0;
}

.sender {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-faint);
    margin: 0 0 4px 4px;
    transition: color 0.2s var(--ease);
}

.sender:hover {
    color: #fff;
}

.message {
    padding: 8px 16px;
    background: var(--peer);
    color: var(--text);
    font-size: var(--bubble-size);
    line-height: 1.4;
    font-weight: 300;
    max-width: 100%;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
    border-radius: 16px 16px 16px 3px;
    transform-origin: left bottom;
    animation: msg-appear 0.2s var(--ease);
}

.msg.continued .message {
    border-radius: 6px 16px 16px 3px;
}

.msg.mine .message {
    background: var(--blue);
    border-radius: 16px 16px 3px 16px;
    transform-origin: right bottom;
}

.msg.mine.continued .message {
    border-radius: 16px 6px 3px 16px;
}

.message a {
    color: inherit;
}

.message strong {
    font-weight: 500;
}

.message .title {
    display: block;
    font-size: 26px;
    font-weight: 500;
    line-height: 1.25;
    margin: 2px 0;
}

.message .fine {
    display: block;
    font-size: 13px;
    color: var(--text-soft);
}

.message code {
    background: rgba(0, 0, 0, 0.25);
}

.msg.emoji .message {
    padding: 2px 0;
    background: none;
    font-size: 44px;
    line-height: 1.15;
}

.msg.media .message {
    padding: 0;
    overflow: hidden;
    background: rgba(40, 39, 39, 0.6);
    border-radius: 14px;
}

.media-frame {
    display: block;
    width: 100%;
    padding: 0;
    cursor: zoom-in;
}

.message img,
.message video {
    display: block;
    max-width: 100%;
    max-height: 340px;
}

.message audio {
    display: block;
    width: 280px;
    max-width: 100%;
    margin: 8px;
}

.caption {
    padding: 8px 14px 10px;
    font-size: 16px;
}

.file-card {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 220px;
    padding: 12px 14px;
    text-decoration: none;
    color: var(--text);
}

a.file-card:hover {
    background: rgba(255, 255, 255, 0.06);
}

.file-icon {
    flex: 0 0 auto;
    color: var(--text-soft);
}

.file-text {
    min-width: 0;
}

.file-name {
    font-size: 15px;
    font-weight: 400;
    line-height: 1.3;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.file-detail {
    font-size: 12px;
    line-height: 1.4;
    color: var(--text-faint);
}

.progress {
    height: 4px;
    margin-top: 6px;
    border-radius: 2px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.15);
}

.progress-bar {
    height: 100%;
    width: 0;
    background: var(--blue);
    transition: width 0.15s linear;
}

.msg-status {
    font-size: 12px;
    color: var(--text-faint);
    margin: 3px 4px 0;
}

.msg-status.failed {
    color: var(--danger);
}

button.file-card {
    width: 100%;
    text-align: left;
}

button.file-card:hover {
    background: rgba(255, 255, 255, 0.06);
}

.msg-status button {
    font-size: 12px;
    font-weight: 500;
    color: #fff;
    text-decoration: underline;
    margin-left: 4px;
}

/* Notice pill, shared by "reconnecting" and "new messages" */
.notice {
    position: absolute;
    z-index: 2;
    left: 50%;
    bottom: calc(var(--composer-height) + 12px);
    transform: translateX(-50%);
    max-width: 90%;
    padding: 8px 16px;
    font-size: 14px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 38px;
    background: rgba(0, 0, 0, 0.8);
    transition: bottom 0.3s var(--ease), opacity 0.3s var(--ease);
}

.notice.hidden {
    bottom: calc(var(--composer-height) - 8px);
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

.notice:not(.actionable) {
    cursor: default;
}

/* Composer */
.composer {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    padding: 12px 16px 16px;
    border-radius: 0 0 var(--panel-radius) var(--panel-radius);
    background: rgba(85, 85, 85, 0.01);
    backdrop-filter: blur(80px);
}

.composer-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

#msg-input {
    flex: 1;
    min-width: 0;
    min-height: 44px;
    max-height: 160px;
    padding: 11px 16px;
    font-size: 16px;
    line-height: 22px;
    font-weight: 400;
    border: none;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.1);
    resize: none;
    outline: none;
    scrollbar-width: none;
    transition: background-color 0.15s var(--ease);
}

#msg-input:focus {
    background: rgba(255, 255, 255, 0.14);
}

.composer-row .icon-btn {
    height: 44px;
    width: 44px;
}

.send-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    color: var(--text);
    background: var(--blue);
    transition: opacity 0.15s var(--ease), background 0.15s var(--ease);
}

.send-btn:hover {
    background: var(--blue-hover);
}

.send-btn:active {
    background: var(--blue-active);
}

.send-btn:disabled {
    opacity: 0.35;
    cursor: default;
}

.attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
    max-height: 132px;
    overflow-y: auto;
    scrollbar-width: none;
}

.attachment {
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 100%;
    padding: 4px 4px 4px 4px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.1);
}

.attachment img {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    object-fit: cover;
    display: block;
}

.attachment .file-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
}

.attachment-name {
    font-size: 13px;
    max-width: 180px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.attachment-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    color: var(--text-faint);
    border-radius: 50%;
}

.attachment-remove:hover {
    color: #fff;
}

.attachment-remove svg {
    width: 16px;
    height: 16px;
}

.drop-overlay {
    position: absolute;
    inset: 12px;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 30px;
    border: 1px dashed rgba(255, 255, 255, 0.5);
    background: rgba(46, 75, 230, 0.35);
    backdrop-filter: blur(12px);
    font-size: 20px;
    font-weight: 300;
    pointer-events: none;
    transition: opacity 0.15s var(--ease);
}

.drop-overlay.hidden {
    opacity: 0;
}

/* Image viewer */
.viewer {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.8);
    cursor: zoom-out;
    transition: opacity 0.3s var(--ease);
}

.viewer.hidden {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

.viewer img {
    max-width: 94vw;
    max-height: 90vh;
    border-radius: 8px;
}

/* How it works */
.about {
    position: fixed;
    inset: 0;
    z-index: 26;
    overflow-y: auto;
    padding: 96px 16px 96px;
    background: var(--surface);
    transition: opacity 0.3s var(--ease);
}

.about.hidden {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

.back {
    position: fixed;
    top: 24px;
    left: 24px;
    padding: 8px 12px;
    color: var(--text-faint);
    transition: color 0.3s var(--ease);
}

.back:hover {
    color: #fff;
}

.back::before {
    content: "\2190";
    margin-right: 10px;
}

.about-content {
    max-width: 640px;
    margin: 0 auto;
    font-size: 20px;
    line-height: 1.6;
    font-weight: 300;
    color: rgba(255, 255, 255, 0.8);
}

.about-wordmark {
    color: var(--signal);
    font-size: 48px;
    font-weight: 900;
    line-height: 1;
    letter-spacing: 48px;
    padding-left: 48px;
    text-transform: uppercase;
    text-align: center;
    margin-bottom: 64px;
}

.about-content h3 {
    font-size: 32px;
    font-weight: 500;
    line-height: 1.2;
    margin: 72px 0 32px;
}

.about-content p + p {
    margin-top: 28px;
}

@keyframes msg-appear {
    from { transform: scale(0.9); }
    to { transform: scale(1); }
}

@keyframes shake {
    20% { transform: translateX(-8px); }
    50% { transform: translateX(6px); }
    80% { transform: translateX(-3px); }
}

/* Short windows: same limits the reference uses to keep the panel on screen */
@media (max-height: 760px) {
    .clock {
        font-size: 72px;
    }

    .clock-date {
        font-size: 18px;
        margin-bottom: 18px;
    }

    .lock-screen {
        padding-top: 64px;
    }

    :root {
        --panel-top: 60px;
        --panel-bottom: 20px;
        --panel-radius: 32px;
        --panel-width: 440px;
    }

    .chat-header {
        padding: 12px 16px;
    }

    .avatar {
        width: 40px;
        height: 40px;
    }

    :root {
        --bubble-size: 16px;
    }
}

@media (max-height: 620px) {
    .clock-date {
        display: none;
    }

    .clock {
        font-size: 48px;
        margin-bottom: 12px;
    }
}

/* Too narrow for two panels: one at a time, list first */
@media (max-width: 880px) {
    .shell .sidebar,
    .shell .chat {
        width: min(480px, calc(100vw - 32px));
    }

    .shell:not(.show-chat) .chat,
    .shell.show-chat .sidebar {
        display: none;
    }

    .chat-back {
        display: flex;
    }
}

/* Phones: the panel becomes the whole screen */
@media (max-width: 767px) {
    :root {
        --panel-top: 0px;
        --panel-bottom: 0px;
        --panel-radius: 0px;
        --panel-width: 100vw;
        --sidebar-width: 100vw;
    }

    .shell {
        left: 0;
        right: 0;
        transform: none;
    }

    .shell.hidden {
        transform: translateY(36px);
    }

    .shell .sidebar,
    .shell .chat {
        width: 100vw;
    }

    .sidebar-border {
        display: none;
    }

    .sidebar-header {
        padding-top: calc(12px + env(safe-area-inset-top));
    }

    .unlocked .topbar {
        opacity: 0;
        pointer-events: none;
        visibility: hidden;
    }

    .topbar {
        padding: 14px 16px;
    }

    .wordmark {
        letter-spacing: 16px;
    }

    .chat-border {
        display: none;
    }

    .chat-header {
        padding: 12px 16px;
        padding-top: calc(12px + env(safe-area-inset-top));
    }

    .messages {
        padding-left: 16px;
        padding-right: 16px;
    }

    .composer {
        padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    }

    .avatar {
        width: 36px;
        height: 36px;
        font-size: 15px;
    }

    .user .name {
        font-size: 16px;
    }

    :root {
        --bubble-size: 17px;
    }

    .message {
        font-weight: 400;
    }

    .about-content {
        font-size: 18px;
    }

    .about-wordmark {
        font-size: 32px;
        letter-spacing: 28px;
        padding-left: 28px;
    }

    .about-content h3 {
        font-size: 24px;
        margin: 48px 0 20px;
    }

    [data-tooltip]::before {
        content: none;
    }

    .clock {
        font-size: 80px;
    }
}


/* Sidebar */
.sidebar {
    position: relative;
    display: flex;
    flex-direction: column;
    width: var(--sidebar-width);
    border-radius: var(--panel-radius);
    backdrop-filter: blur(80px);
    background:
        linear-gradient(0deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.03)),
        linear-gradient(0deg, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2)),
        linear-gradient(165deg, rgba(171, 171, 171, 0.1) 20%, rgba(0, 0, 0, 0.1) 66%);
    box-shadow: rgba(0, 0, 0, 0.2) 0 40px 80px;
}

.sidebar-border {
    position: absolute;
    inset: -1px;
    border-radius: var(--panel-radius);
    pointer-events: none;
    box-shadow:
        rgba(0, 0, 0, 0.15) 1px 0 0 0 inset,
        rgba(255, 255, 255, 0.25) 0 1px 0 0 inset,
        rgba(255, 255, 255, 0.2) 0 -1px 0 0 inset;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 16px 16px 16px 20px;
    border-radius: var(--panel-radius) var(--panel-radius) 0 0;
    background-color: rgba(255, 255, 255, 0.05);
}

.sidebar-user {
    display: flex;
    flex: 1;
    align-items: center;
    gap: 12px;
    min-width: 0;
    text-align: left;
    border-radius: 12px;
}

.sidebar-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 4px 12px 20px;
    scrollbar-width: none;
}

.sidebar-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 40px;
    margin: 14px 4px 4px 8px;
}

.sidebar-section-head h2 {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-soft);
}

.chat-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.chat-row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px;
    text-align: left;
    border-radius: 16px;
    transition: background-color 0.15s var(--ease);
}

.chat-row:hover {
    background-color: rgba(255, 255, 255, 0.07);
}

.chat-row.active {
    background-color: rgba(255, 255, 255, 0.12);
}

.chat-row-text {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 2px;
    min-width: 0;
}

.chat-row-name {
    font-size: 15px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-row-preview {
    font-size: 13px;
    font-weight: 300;
    color: var(--text-soft);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.badge {
    flex: 0 0 auto;
    min-width: 22px;
    padding: 3px 7px;
    font-size: 12px;
    font-weight: 500;
    line-height: 16px;
    text-align: center;
    color: #fff;
    border-radius: 11px;
    background: var(--blue);
}

.person-avatar {
    position: relative;
    display: block;
    flex: 0 0 auto;
}

.online-dot {
    position: absolute;
    right: -1px;
    bottom: -1px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #4CD08A;
    box-shadow: 0 0 0 2px #26282B;
}

.sidebar-empty {
    padding: 24px 12px;
    text-align: center;
    font-size: 14px;
    font-weight: 300;
    color: var(--text-soft);
}

.sidebar-empty p {
    margin-bottom: 12px;
}

.chat-welcome {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px;
    text-align: center;
}

.chat-welcome h2 {
    font-size: 24px;
    font-weight: 300;
    margin-bottom: 8px;
}

.chat-welcome p {
    font-size: 15px;
    font-weight: 300;
    color: var(--text-soft);
}

.composer-block {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 8px;
    font-size: 14px;
    line-height: 1.4;
    color: var(--text-soft);
}

.composer-block p {
    flex: 1;
}

/* Lock card forms */
.lock-card form .button-quiet + .button-quiet {
    margin-top: 0;
}

.lock-title {
    font-size: 22px;
    font-weight: 500;
    margin-bottom: 10px;
}

.lock-note {
    font-size: 15px;
    font-weight: 300;
    line-height: 1.5;
    color: var(--text);
    margin-bottom: 14px;
}

.lock-buttons {
    display: flex;
    gap: 8px;
    margin: 12px 0 16px;
}

.check-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    font-size: 14px;
    color: var(--text-soft);
    cursor: pointer;
}

.check-row input {
    width: 18px;
    height: 18px;
    accent-color: var(--signal);
}

.field-hint {
    display: block;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.4;
    color: var(--text-faint);
    margin-top: 4px;
}

.field textarea,
.field input[type="search"] {
    display: block;
    width: 100%;
    padding: 11px 14px;
    font-size: 16px;
    line-height: 1.4;
    border: none;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.28);
    outline: none;
    resize: vertical;
    transition: box-shadow 0.15s var(--ease);
}

.field textarea:focus,
.field input[type="search"]:focus {
    box-shadow: 0 0 0 2px var(--signal);
}

.recovery-key {
    display: block;
    padding: 14px;
    font-size: 16px;
    line-height: 1.5;
    text-align: center;
    overflow-wrap: anywhere;
    border-radius: 12px;
    user-select: all;
}

.form-error {
    font-size: 14px;
    line-height: 1.4;
    color: var(--danger);
    margin-bottom: 14px;
}

/* Dialogs */
.dialog-layer {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    animation: fade-in 0.2s var(--ease);
}

.dialog {
    position: relative;
    width: 440px;
    max-width: 100%;
    max-height: 100%;
    overflow-y: auto;
    border-radius: 24px;
    background: var(--surface);
    outline: none;
    box-shadow:
        rgba(255, 255, 255, 0.14) 0 1px 0 0 inset,
        rgba(0, 0, 0, 0.4) 0 40px 80px;
    scrollbar-width: thin;
    animation: dialog-rise 0.25s var(--ease);
}

.dialog-body {
    padding: 24px;
}

.dialog-body h2 {
    font-size: 22px;
    font-weight: 500;
    margin-bottom: 10px;
}

.dialog-text {
    font-size: 15px;
    font-weight: 300;
    line-height: 1.5;
    color: var(--text);
    margin-bottom: 18px;
}

.dialog-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 18px;
}

.dialog-actions.start {
    justify-content: flex-start;
}

.people-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 0 -10px;
}

.person-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    text-align: left;
    border-radius: 14px;
}

.person-row:hover {
    background-color: rgba(255, 255, 255, 0.07);
}

.person-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.person-name {
    font-size: 15px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.person-sub {
    font-size: 13px;
    color: var(--text-faint);
}

.toast {
    position: fixed;
    z-index: 40;
    left: 50%;
    bottom: 24px;
    max-width: calc(100vw - 32px);
    padding: 10px 18px;
    font-size: 14px;
    line-height: 1.4;
    text-align: center;
    color: var(--text);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 24px;
    background: rgba(0, 0, 0, 0.88);
    transform: translateX(-50%);
    transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
}

.toast.hidden {
    opacity: 0;
    transform: translate(-50%, 12px);
    pointer-events: none;
    visibility: hidden;
}

.icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Profiles */
.profile-dialog {
    width: 420px;
}

.banner {
    height: 140px;
    overflow: hidden;
}

.banner img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.banner-plain {
    background: linear-gradient(135deg, hsl(var(--avatar-hue) 42% 30%), hsl(calc(var(--avatar-hue) + 50) 36% 16%));
}

.profile-head {
    position: relative;
    padding-bottom: 52px;
}

.profile-avatar {
    position: absolute;
    left: 24px;
    bottom: 0;
}

.profile-body {
    padding-top: 12px;
}

.profile-body .profile-name {
    font-size: 26px;
    margin-bottom: 2px;
    overflow-wrap: anywhere;
}

.profile-handle {
    font-size: 14px;
    color: var(--text-faint);
    margin-bottom: 14px;
}

.profile-bio {
    font-size: 16px;
    font-weight: 300;
    line-height: 1.5;
    color: var(--text);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    margin-bottom: 14px;
}

.safety {
    margin-top: 16px;
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.05);
}

.safety summary {
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}

.safety .field-hint {
    margin: 10px 0;
}

.safety .form-error {
    margin: 10px 0;
}

.safety-code {
    display: block;
    padding: 10px;
    font-size: 15px;
    line-height: 1.6;
    text-align: center;
    border-radius: 10px;
}

/* Settings */
.settings-dialog {
    width: 820px;
    height: min(640px, 100%);
    overflow: hidden;
}

.settings {
    display: flex;
    height: 100%;
}

.settings-nav {
    display: flex;
    flex-direction: column;
    flex: 0 0 240px;
    gap: 2px;
    padding: 20px 12px;
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.03);
}

.settings-title {
    font-size: 22px;
    font-weight: 500;
    padding: 4px 12px 14px;
}

.settings-nav button {
    padding: 10px 12px;
    font-size: 15px;
    text-align: left;
    color: var(--text-soft);
    border-radius: 12px;
    transition: background-color 0.15s var(--ease), color 0.15s var(--ease);
}

.settings-nav button:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.06);
}

.settings-nav button.active {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.12);
}

.settings-nav-end {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: auto;
    padding-top: 16px;
}

.settings-nav .danger-text {
    color: var(--danger);
}

.settings-page {
    flex: 1;
    min-width: 0;
    padding: 24px 28px 32px;
    overflow-y: auto;
    outline: none;
    scrollbar-width: thin;
}

.settings-page > h2 {
    font-size: 22px;
    font-weight: 500;
    margin-bottom: 18px;
    padding-right: 40px;
}

.settings-back {
    display: none;
}

.dialog-close {
    position: absolute;
    top: 14px;
    right: 14px;
}

.settings-stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.settings-subhead {
    font-size: 15px;
    font-weight: 500;
    margin-top: 10px;
}

.profile-preview {
    overflow: hidden;
    border-radius: 16px;
    background: rgba(0, 0, 0, 0.2);
}

.profile-preview .banner {
    height: 110px;
}

.profile-preview .avatar.large {
    box-shadow: 0 0 0 4px #2A2B2E;
}

.image-control,
.setting-row,
.switch-row,
.admin-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.image-buttons,
.admin-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
}

.file-button {
    cursor: pointer;
}

.file-button:focus-within {
    outline: 2px solid #8FA2FF;
    outline-offset: 2px;
}

.switch-text {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
}

.switch-label {
    font-size: 15px;
    font-weight: 500;
}

.char-count {
    margin: -8px 0 0;
    text-align: right;
}

.switch-row {
    position: relative;
    cursor: pointer;
}

.switch-input {
    position: absolute;
    right: 0;
    width: 44px;
    height: 26px;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

.switch-track {
    position: relative;
    flex: 0 0 44px;
    height: 26px;
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.18);
    transition: background-color 0.15s var(--ease);
    pointer-events: none;
}

.switch-track::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.15s var(--ease);
}

.switch-input:checked + .switch-track {
    background: var(--signal);
}

.switch-input:checked + .switch-track::after {
    transform: translateX(18px);
}

.switch-input:focus-visible + .switch-track {
    outline: 2px solid #8FA2FF;
    outline-offset: 2px;
}

.setting-block {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.choice-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.choice {
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-soft);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.08);
}

.choice:hover {
    background: rgba(255, 255, 255, 0.14);
}

.choice.active {
    color: #fff;
    background: var(--blue);
}

.info-block h3 {
    font-size: 15px;
    font-weight: 500;
    margin-bottom: 4px;
}

.info-block p {
    font-size: 14px;
    font-weight: 300;
    line-height: 1.5;
    color: var(--text);
}

.admin-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.new-invite {
    padding: 14px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.05);
}

.new-invite .field-hint {
    margin: 0 0 10px;
}

.new-invite .dialog-actions {
    margin-top: 10px;
}

/* Choices from the settings menu */
:root[data-text-size="small"] {
    --bubble-size: 15px;
}

:root[data-text-size="large"] {
    --bubble-size: 21px;
}

:root[data-accent="teal"] {
    --blue: linear-gradient(180deg, #0F8A8A 0%, #0B7A7F 100%);
    --blue-hover: linear-gradient(180deg, #129797 0%, #0E878C 100%);
    --blue-active: linear-gradient(180deg, #0C7777 0%, #09696D 100%);
    --signal: #1FB5B5;
}

:root[data-accent="rose"] {
    --blue: linear-gradient(180deg, #C43A6A 0%, #B52F5E 100%);
    --blue-hover: linear-gradient(180deg, #D14475 0%, #C23869 100%);
    --blue-active: linear-gradient(180deg, #A9305B 0%, #9C2850 100%);
    --signal: #E85A8C;
}

:root[data-accent="amber"] {
    --blue: linear-gradient(180deg, #B4701A 0%, #A46214 100%);
    --blue-hover: linear-gradient(180deg, #C17A1F 0%, #B06A18 100%);
    --blue-active: linear-gradient(180deg, #9C6115 0%, #8D5510 100%);
    --signal: #D98F2B;
}

.plain-backdrop .backdrop {
    background-image: none;
}

.plain-backdrop .backdrop::after {
    display: none;
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes dialog-rise {
    from { transform: translateY(12px); }
    to { transform: translateY(0); }
}

@media (max-width: 880px) {
    .topbar {
        display: none;
    }

    .lock-screen {
        padding-top: 40px;
    }
}

@media (max-width: 767px) {
    .topbar {
        display: flex;
    }

    .lock-screen {
        padding-top: 72px;
    }

    .dialog-layer {
        padding: 0;
        align-items: flex-end;
    }

    .dialog {
        width: 100%;
        border-radius: 24px 24px 0 0;
        max-height: 92%;
    }

    .settings-dialog {
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    .settings-nav {
        flex: 1;
        background: none;
    }

    .settings-page {
        display: none;
        padding: 16px 16px 40px;
    }

    .settings.page-open .settings-nav {
        display: none;
    }

    .settings.page-open .settings-page {
        display: block;
    }

    .settings-back {
        display: block;
        margin-bottom: 12px;
        padding: 8px 0;
        font-size: 15px;
        color: var(--text-soft);
    }

    .settings-back::before {
        content: "\2190";
        margin-right: 8px;
    }

    .admin-row {
        flex-wrap: wrap;
    }
}

.reduce-motion *,
.reduce-motion *::before,
.reduce-motion *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
        transition-delay: 0s !important;
    }
}
