:root {
    color-scheme: dark;
    --ink: #f7f8ff;
    --muted: #9ba7c4;
    --muted-strong: #bdc6dc;
    --page: #080b15;
    --panel: #101629;
    --panel-soft: #151d34;
    --panel-raised: #1b2440;
    --line: rgba(183, 198, 239, 0.14);
    --line-strong: rgba(183, 198, 239, 0.24);
    --accent: #7b8dff;
    --accent-bright: #98a6ff;
    --accent-soft: rgba(123, 141, 255, 0.16);
    --cyan: #47d7e8;
    --green: #4ee0a2;
    --danger: #ff647c;
    --shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
}

* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    overflow: hidden;
    background: var(--page);
}

body,
button,
input,
textarea {
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
    color: var(--ink);
    background:
        radial-gradient(circle at 12% -10%, rgba(80, 103, 235, 0.18), transparent 35%),
        radial-gradient(circle at 100% 100%, rgba(71, 215, 232, 0.08), transparent 34%),
        var(--page);
}

button,
input,
textarea {
    color: inherit;
}

button {
    border: 0;
}

button:not(:disabled) {
    cursor: pointer;
}

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

[hidden] {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.app-shell {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.app-header {
    position: relative;
    z-index: 30;
    min-height: 76px;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 22px;
    border-bottom: 1px solid var(--line);
    background: rgba(10, 14, 28, 0.94);
    box-shadow: 0 6px 30px rgba(0, 0, 0, 0.22);
}

.brand-block,
.profile-button,
.network-status,
.user-main,
.conversation-tab,
.message-bubble-header,
.call-topline {
    display: flex;
    align-items: center;
}

.brand-block {
    gap: 12px;
    min-width: 210px;
}

.brand-mark {
    width: 42px;
    height: 42px;
    display: block;
    object-fit: cover;
    border: 1px solid rgba(145, 160, 255, 0.5);
    border-radius: 14px;
    background: #eef6ff;
    box-shadow: 0 10px 24px rgba(91, 109, 239, 0.28);
}

.brand-block h1,
.brand-block p,
.sidebar-heading h2,
.sidebar-heading p,
.conversation-heading h2,
.conversation-heading p,
.modal-heading h2,
.modal-heading p,
.call-topline h2,
.call-topline p {
    margin: 0;
}

.brand-block h1 {
    font-size: 1.03rem;
    letter-spacing: -0.01em;
}

.brand-block p {
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.77rem;
}

.header-spacer {
    flex: 1;
}

.network-status {
    gap: 8px;
    padding: 8px 11px;
    color: var(--muted-strong);
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 0.78rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #7c8498;
    box-shadow: 0 0 0 4px rgba(124, 132, 152, 0.12);
}

.network-status.connected .status-dot {
    background: var(--green);
    box-shadow: 0 0 0 4px rgba(78, 224, 162, 0.14), 0 0 14px rgba(78, 224, 162, 0.6);
}

.network-status.reconnecting .status-dot {
    background: #ffc765;
    box-shadow: 0 0 0 4px rgba(255, 199, 101, 0.14);
}

.profile-button {
    gap: 10px;
    min-width: 0;
    padding: 5px 8px 5px 5px;
    border: 1px solid transparent;
    border-radius: 14px;
    text-align: left;
    background: transparent;
}

.profile-button:hover {
    border-color: var(--line);
    background: rgba(255, 255, 255, 0.035);
}

.profile-copy {
    display: flex;
    flex-direction: column;
    max-width: 150px;
}

.profile-copy strong,
.profile-copy small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-copy strong {
    font-size: 0.86rem;
}

.profile-copy small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.7rem;
}

.avatar {
    --avatar-x: 0%;
    --avatar-y: 0%;
    flex: 0 0 auto;
    display: inline-block;
    border: 1px solid rgba(183, 198, 239, 0.3);
    border-radius: 34%;
    background-image: url("profile-sprites-100.png");
    background-repeat: no-repeat;
    background-size: 1000% 1000%;
    background-position: var(--avatar-x) var(--avatar-y);
    background-color: #11172a;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.avatar-small {
    width: 34px;
    height: 34px;
}

.avatar-medium {
    width: 38px;
    height: 38px;
}

.avatar-large {
    width: 46px;
    height: 46px;
}

.app-body {
    position: relative;
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    max-width: 1720px;
    width: 100%;
    margin: 0 auto;
    border-right: 1px solid var(--line);
    border-left: 1px solid var(--line);
    background: rgba(11, 15, 29, 0.72);
}

.user-sidebar {
    z-index: 20;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 22px 16px 16px;
    border-right: 1px solid var(--line);
    background: rgba(13, 18, 34, 0.88);
}

.sidebar-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 0 4px;
}

.eyebrow {
    color: var(--accent-bright);
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.sidebar-heading h2 {
    margin-top: 5px;
    font-size: 1.28rem;
}

.count-badge {
    display: inline-grid;
    min-width: 22px;
    height: 22px;
    place-items: center;
    margin-left: 5px;
    padding: 0 6px;
    border-radius: 999px;
    color: #cdd3ff;
    background: var(--accent-soft);
    font-size: 0.7rem;
    vertical-align: 2px;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 20px 0 14px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.025);
}

.search-box:focus-within {
    border-color: rgba(123, 141, 255, 0.65);
    box-shadow: 0 0 0 3px rgba(123, 141, 255, 0.1);
}

.search-box input {
    width: 100%;
    height: 42px;
    padding: 0;
    border: 0;
    outline: 0;
    color: var(--ink);
    background: transparent;
    font-size: 0.84rem;
}

.search-box input::placeholder,
.message-input-wrap textarea::placeholder {
    color: #6f7a98;
}

.user-main div {
    min-width: 0;
}

.user-main strong,
.user-main small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-main strong {
    font-size: 0.84rem;
}

.user-main small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.7rem;
}

.user-list {
    min-height: 0;
    overflow: auto;
    scrollbar-width: thin;
    scrollbar-color: #38425f transparent;
}

.user-card {
    margin-bottom: 6px;
    padding: 10px;
    border: 1px solid transparent;
    border-radius: 14px;
    background: transparent;
}

.user-card:hover,
.user-card.active {
    border-color: var(--line);
    background: rgba(255, 255, 255, 0.035);
}

.user-card.active {
    border-color: rgba(123, 141, 255, 0.35);
    background: var(--accent-soft);
}

.user-main {
    gap: 10px;
}

.user-main div {
    flex: 1;
}

.online-dot {
    width: 7px;
    height: 7px;
    margin-left: auto;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 9px rgba(78, 224, 162, 0.55);
}

.user-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-top: 9px;
}

.user-action {
    min-height: 30px;
    padding: 4px 6px;
    border: 1px solid var(--line);
    border-radius: 9px;
    color: var(--muted-strong);
    background: rgba(255, 255, 255, 0.025);
    font-size: 0.7rem;
    font-weight: 700;
}

.user-action.message-action {
    grid-column: 1 / -1;
    color: #d8dcff;
    border-color: rgba(123, 141, 255, 0.28);
    background: rgba(123, 141, 255, 0.1);
}

.user-action:hover {
    color: #ffffff;
    border-color: var(--line-strong);
    background: rgba(255, 255, 255, 0.07);
}

.sidebar-empty {
    flex: 1;
    min-height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 24px;
    color: var(--muted);
    text-align: center;
}

.sidebar-empty strong {
    margin-top: 12px;
    color: var(--muted-strong);
    font-size: 0.85rem;
}

.sidebar-empty span {
    max-width: 185px;
    margin-top: 5px;
    font-size: 0.72rem;
    line-height: 1.5;
}

.empty-orbit {
    width: 42px;
    height: 42px;
    border: 1px solid rgba(123, 141, 255, 0.42);
    border-radius: 50%;
    box-shadow: 0 0 22px rgba(123, 141, 255, 0.14), inset 0 0 16px rgba(123, 141, 255, 0.12);
}

.invite-actions {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
    margin-top: 12px;
}

.invite-button {
    width: 100%;
    min-width: 0;
    padding-right: 8px;
    padding-left: 8px;
}

.conversation-panel {
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: rgba(10, 14, 27, 0.55);
}

.conversation-topbar {
    min-height: 62px;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 9px 18px;
    border-bottom: 1px solid var(--line);
    background: rgba(16, 22, 41, 0.72);
}

.conversation-tabs {
    flex: 1;
    min-width: 0;
    display: flex;
    gap: 7px;
    overflow-x: auto;
    scrollbar-width: none;
}

.conversation-tabs::-webkit-scrollbar {
    display: none;
}

.conversation-tab {
    flex: 0 0 auto;
    gap: 7px;
    min-height: 40px;
    max-width: 190px;
    padding: 7px 11px;
    border: 1px solid transparent;
    border-radius: 12px;
    color: var(--muted);
    background: transparent;
    font-size: 0.78rem;
    font-weight: 700;
}

.conversation-tab > span:not(.tab-icon):not(.tab-unread):not(.tab-close) {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.conversation-tab:hover {
    color: var(--muted-strong);
    background: rgba(255, 255, 255, 0.035);
}

.conversation-tab.active {
    color: #ffffff;
    border-color: rgba(123, 141, 255, 0.32);
    background: var(--accent-soft);
}

.tab-icon {
    color: var(--cyan);
    font-size: 0.7rem;
}

.tab-unread {
    min-width: 18px;
    height: 18px;
    display: inline-grid;
    place-items: center;
    padding: 0 5px;
    border-radius: 999px;
    color: #081019;
    background: var(--cyan);
    font-size: 0.62rem;
}

.tab-close {
    display: grid;
    width: 20px;
    height: 20px;
    place-items: center;
    margin-left: 1px;
    padding: 0;
    border-radius: 50%;
    color: var(--muted);
    font-size: 1rem;
    line-height: 1;
}

.tab-close:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.11);
}

.conversation-actions {
    flex: 0 0 auto;
    display: flex;
    gap: 7px;
}

.call-button,
.primary-button,
.secondary-button,
.send-button {
    min-height: 38px;
    padding: 8px 13px;
    border-radius: 11px;
    font-size: 0.75rem;
    font-weight: 800;
}

.call-button,
.secondary-button {
    color: var(--muted-strong);
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.035);
}

.call-button.primary,
.primary-button,
.send-button {
    color: #ffffff;
    border: 1px solid rgba(151, 164, 255, 0.35);
    background: linear-gradient(145deg, #6779f3, #855fe8);
    box-shadow: 0 9px 20px rgba(75, 87, 190, 0.18);
}

.files-panel {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.files-heading {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 22px 26px 18px;
    border-bottom: 1px solid var(--line);
}

.files-heading h2 {
    margin-top: 4px;
    font-size: 1.35rem;
}

.files-heading > div > p:last-child {
    margin: 7px 0 0;
    color: var(--muted);
    font-size: 0.76rem;
    line-height: 1.5;
}

.files-add-wrap {
    flex: 0 0 auto;
}

.files-add-button {
    min-width: 112px;
}

.files-statusbar {
    flex: 0 0 auto;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 9px 26px;
    color: var(--muted-strong);
    border-bottom: 1px solid var(--line);
    background: rgba(16, 22, 41, 0.58);
    font-size: 0.72rem;
    font-weight: 700;
}

.files-live-note {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--muted);
    font-weight: 600;
}

.files-live-note > span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 10px rgba(78, 224, 162, 0.58);
}

.files-list {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    align-content: start;
    gap: 12px;
    overflow-y: auto;
    padding: 20px 26px 28px;
    scrollbar-width: thin;
    scrollbar-color: #39425f transparent;
}

.file-card {
    min-width: 0;
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr) auto;
    align-items: center;
    gap: 13px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(21, 29, 52, 0.72);
}

.file-card.unavailable {
    background: rgba(15, 20, 36, 0.66);
}

.file-kind-icon {
    --file-icon-x: 0%;
    --file-icon-y: 0%;
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background-image: url("file-type-sprites.png");
    background-repeat: no-repeat;
    background-size: 400% 400%;
    background-position: var(--file-icon-x) var(--file-icon-y);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.24);
}

.file-thumbnail {
    width: 52px;
    height: 52px;
    display: block;
    object-fit: cover;
    border: 1px solid rgba(183, 198, 239, 0.24);
    border-radius: 14px;
    background: #0d1324;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.24);
}

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

.file-name {
    display: block;
    overflow: hidden;
    color: var(--ink);
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.86rem;
    font-weight: 800;
}

.file-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 5px 9px;
    margin-top: 7px;
    color: var(--muted);
    font-size: 0.69rem;
}

.file-availability {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #83e9bd;
    font-weight: 800;
}

.file-availability::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--green);
}

.file-card.unavailable .file-availability {
    color: #ff9aaa;
}

.file-card.unavailable .file-availability::before {
    background: var(--danger);
}

.file-actions {
    display: flex;
    gap: 7px;
}

.file-action {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--muted-strong);
    background: rgba(255, 255, 255, 0.035);
    font-size: 0.68rem;
    font-weight: 800;
    text-decoration: none;
}

.file-action:hover {
    color: #ffffff;
    border-color: var(--line-strong);
    background: rgba(255, 255, 255, 0.075);
}

.file-action.primary {
    color: #ffffff;
    border-color: rgba(123, 141, 255, 0.32);
    background: rgba(123, 141, 255, 0.16);
}

.file-action:disabled,
.file-action.disabled {
    opacity: 0.44;
    cursor: not-allowed;
    pointer-events: none;
}

.files-empty {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 32px;
    color: var(--muted);
    text-align: center;
}

.files-empty-icon {
    width: 62px;
    height: 62px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(123, 141, 255, 0.28);
    border-radius: 18px;
    color: var(--accent-bright);
    background: rgba(123, 141, 255, 0.09);
    font-size: 1.55rem;
}

.files-empty h3 {
    margin: 17px 0 6px;
    color: var(--muted-strong);
    font-size: 1rem;
}

.files-empty p {
    max-width: 460px;
    margin: 0;
    font-size: 0.76rem;
    line-height: 1.55;
}

.call-button:hover,
.secondary-button:hover {
    color: #ffffff;
    border-color: var(--line-strong);
    background: rgba(255, 255, 255, 0.075);
}

.primary-button:hover,
.send-button:hover,
.call-button.primary:hover {
    filter: brightness(1.08);
}

.conversation-heading {
    min-height: 76px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 14px 24px;
    border-bottom: 1px solid var(--line);
}

.conversation-heading h2 {
    margin-top: 4px;
    font-size: 1.25rem;
}

.presence-label {
    color: var(--muted);
    font-size: 0.72rem;
    text-align: right;
}

.presence-label.online {
    color: #83e9bd;
}

.message-area {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 24px clamp(16px, 4vw, 54px);
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: #39425f transparent;
}

.welcome-state {
    min-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    color: var(--muted);
    text-align: center;
}

.welcome-state h3 {
    margin: 18px 0 6px;
    color: var(--muted-strong);
    font-size: 1rem;
}

.welcome-state p {
    max-width: 370px;
    margin: 0;
    font-size: 0.78rem;
    line-height: 1.55;
}

.welcome-signal {
    width: 62px;
    height: 62px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(123, 141, 255, 0.2);
    border-radius: 50%;
    box-shadow: 0 0 44px rgba(123, 141, 255, 0.13);
}

.welcome-signal span {
    width: 22px;
    height: 22px;
    border: 2px solid var(--accent-bright);
    border-radius: 50%;
    box-shadow: 0 0 20px rgba(123, 141, 255, 0.5);
}

.message-row {
    display: flex;
    align-items: flex-end;
    gap: 9px;
    margin-bottom: 17px;
}

.message-row.local {
    justify-content: flex-end;
}

.message-column {
    min-width: 0;
    max-width: min(72%, 690px);
}

.message-bubble {
    position: relative;
    min-width: min(210px, 100%);
    padding: 11px 13px;
    border: 1px solid var(--line);
    border-radius: 16px 16px 16px 5px;
    color: #e8ebf6;
    background: var(--panel-raised);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.12);
    word-break: break-word;
}

.message-row.local .message-bubble {
    border-color: rgba(130, 145, 255, 0.32);
    border-radius: 16px 16px 5px 16px;
    color: #ffffff;
    background: linear-gradient(145deg, #5668dc, #7756ca);
}

.message-bubble-header {
    gap: 8px;
    margin-bottom: 9px;
}

.message-bubble-header .avatar {
    width: 30px;
    height: 30px;
}

.message-bubble-header strong {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    color: var(--muted-strong);
    font-size: 0.76rem;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.message-bubble-header time {
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 0.64rem;
    font-variant-numeric: tabular-nums;
}

.message-row.local .message-bubble-header strong,
.message-row.local .message-bubble-header time {
    color: #eef0ff;
}

.message-bubble p {
    margin: 0;
    white-space: pre-wrap;
    line-height: 1.48;
    font-size: 0.9rem;
}

.message-link {
    color: #8feaf5;
    text-decoration: underline;
    text-decoration-color: rgba(143, 234, 245, 0.45);
    text-underline-offset: 2px;
}

.local .message-link {
    color: #ffffff;
}

.message-media {
    display: block;
    overflow: hidden;
    width: min(430px, 100%);
    margin-bottom: 9px;
    padding: 0;
    border: 0;
    border-radius: 11px;
    background: #080b13;
}

.message-media img {
    display: block;
    width: 100%;
    max-height: 390px;
    object-fit: contain;
}

.video-thumbnail {
    position: relative;
}

.video-thumbnail::after {
    content: "▶";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    padding-left: 3px;
    border: 1px solid rgba(255, 255, 255, 0.48);
    border-radius: 50%;
    color: #ffffff;
    background: rgba(8, 12, 24, 0.74);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    transform: translate(-50%, -50%);
    font-size: 1rem;
}

.media-failed {
    padding: 18px;
    color: var(--muted);
    border: 1px dashed var(--line-strong);
    border-radius: 10px;
    font-size: 0.76rem;
    font-style: italic;
}

.system-message {
    display: flex;
    justify-content: center;
    margin: 12px 0 18px;
}

.system-message span {
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.025);
    font-size: 0.69rem;
}

.typing-indicator {
    min-height: 25px;
    padding: 3px clamp(22px, 5vw, 62px);
    color: var(--muted);
    font-size: 0.71rem;
}

.composer {
    display: flex;
    align-items: flex-end;
    gap: 9px;
    padding: 12px 18px calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: rgba(16, 22, 41, 0.92);
}

.composer-icon-button,
.icon-button {
    display: grid;
    place-items: center;
    color: var(--muted-strong);
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.035);
}

.composer-icon-button {
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    font-size: 1.35rem;
}

.composer-icon-button.loading {
    color: var(--cyan);
    animation: pulse 1s ease-in-out infinite;
}

.icon-button {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 11px;
    font-size: 1.35rem;
    line-height: 1;
}

.composer-icon-button:hover,
.icon-button:hover {
    color: #ffffff;
    border-color: var(--line-strong);
    background: rgba(255, 255, 255, 0.075);
}

.message-input-wrap {
    flex: 1;
    min-width: 0;
    display: flex;
    min-height: 42px;
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: rgba(7, 10, 19, 0.6);
}

.message-input-wrap:focus-within {
    border-color: rgba(123, 141, 255, 0.62);
    box-shadow: 0 0 0 3px rgba(123, 141, 255, 0.1);
}

.message-input-wrap textarea {
    width: 100%;
    max-height: 126px;
    padding: 0;
    border: 0;
    outline: 0;
    resize: none;
    color: var(--ink);
    background: transparent;
    font-size: 0.88rem;
    line-height: 1.45;
}

.send-button {
    flex: 0 0 auto;
    min-width: 68px;
    height: 42px;
}

.modal-overlay {
    position: fixed;
    z-index: 100;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(3, 5, 12, 0.82);
    backdrop-filter: blur(12px);
}

.modal-card,
.call-card {
    width: min(100%, 630px);
    max-height: min(90vh, 760px);
    overflow: auto;
    border: 1px solid var(--line-strong);
    border-radius: 23px;
    background:
        radial-gradient(circle at 100% 0, rgba(123, 141, 255, 0.16), transparent 34%),
        #11172a;
    box-shadow: var(--shadow);
}

.modal-card {
    padding: clamp(20px, 4vw, 32px);
}

.modal-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.modal-heading h2 {
    margin-top: 5px;
    font-size: 1.45rem;
}

.modal-intro {
    margin: 12px 0 22px;
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.55;
}

.qr-modal {
    width: min(100%, 430px);
}

.qr-code-shell {
    width: min(100%, 292px);
    margin: 0 auto;
    padding: 18px;
    border-radius: 18px;
    background: #ffffff;
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.3);
}

#qrCode,
#qrCode img,
#qrCode canvas {
    display: block;
    width: 100%;
    height: auto;
}

.qr-address {
    margin: 18px 0 0;
    color: var(--muted);
    font-size: 0.72rem;
    line-height: 1.5;
    overflow-wrap: anywhere;
    text-align: center;
}

.field-label,
.avatar-fieldset legend {
    color: var(--muted-strong);
    font-size: 0.75rem;
    font-weight: 800;
}

.text-field {
    width: 100%;
    height: 46px;
    margin-top: 8px;
    padding: 0 13px;
    border: 1px solid var(--line);
    border-radius: 12px;
    color: var(--ink);
    background: rgba(6, 9, 18, 0.62);
    font-size: 0.9rem;
}

.avatar-fieldset {
    min-width: 0;
    margin: 22px 0 0;
    padding: 0;
    border: 0;
}

.avatar-fieldset legend {
    margin-bottom: 10px;
}

.avatar-picker {
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 9px;
}

.avatar-choice {
    position: relative;
    aspect-ratio: 1;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 17px;
    background: transparent;
}

.avatar-choice .avatar {
    width: 100%;
    height: 100%;
    border-radius: 14px;
}

.avatar-choice:hover,
.avatar-choice.selected {
    border-color: var(--accent-bright);
    box-shadow: 0 0 0 3px rgba(123, 141, 255, 0.14), 0 8px 20px rgba(0, 0, 0, 0.24);
}

.avatar-choice.selected::after {
    content: "✓";
    position: absolute;
    right: -4px;
    bottom: -4px;
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    border: 2px solid #11172a;
    border-radius: 50%;
    color: #0a0f18;
    background: var(--cyan);
    font-size: 0.7rem;
    font-weight: 900;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 9px;
    margin-top: 24px;
}

.call-card {
    width: min(100%, 760px);
    overflow: hidden;
}

.call-topline {
    justify-content: space-between;
    gap: 18px;
    padding: 18px 20px;
}

.call-topline h2 {
    margin-top: 5px;
    font-size: 1.2rem;
}

.call-timer {
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    font-size: 0.78rem;
}

.call-stage {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background:
        radial-gradient(circle at center, rgba(123, 141, 255, 0.22), transparent 40%),
        #070a13;
}

.call-stage > #remoteVideo {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    background: #05070d;
}

.call-stage.audio-mode > #remoteVideo {
    display: none;
}

.call-avatar-stage {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.call-stage.video-mode.remote-video-active .call-avatar-stage {
    opacity: 0;
}

.call-avatar {
    width: clamp(90px, 18vw, 145px);
    height: clamp(90px, 18vw, 145px);
    margin-bottom: 10px;
    border: 3px solid rgba(255, 255, 255, 0.18);
    border-radius: 38%;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3), 0 0 44px rgba(123, 141, 255, 0.18);
}

.call-avatar-stage strong {
    font-size: 1.1rem;
}

.call-avatar-stage span {
    color: var(--muted);
    font-size: 0.78rem;
}

.local-video {
    position: absolute;
    right: 14px;
    bottom: 14px;
    width: 23%;
    min-width: 110px;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.25);
    border-radius: 12px;
    background: #0b0e16;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.4);
    transform: scaleX(-1);
}

.call-stage.audio-mode .local-video {
    display: none;
}

.call-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 17px;
    border-top: 1px solid var(--line);
}

.call-control {
    min-width: 100px;
    min-height: 42px;
    padding: 8px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    color: var(--muted-strong);
    background: rgba(255, 255, 255, 0.055);
    font-size: 0.76rem;
    font-weight: 800;
}

.call-control.active {
    color: #ffffff;
    background: rgba(123, 141, 255, 0.25);
}

.call-control.danger {
    color: #ffffff;
    border-color: rgba(255, 100, 124, 0.36);
    background: rgba(255, 100, 124, 0.2);
}

.call-control.accept {
    color: #07140f;
    border-color: rgba(78, 224, 162, 0.42);
    background: var(--green);
}

.media-overlay {
    z-index: 120;
}

.media-viewer {
    position: relative;
    width: min(100%, 1100px);
    max-height: 92vh;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.media-viewer img,
.media-viewer video {
    max-width: 100%;
    max-height: calc(92vh - 65px);
    border-radius: 14px;
    background: #000000;
    box-shadow: var(--shadow);
}

.media-viewer p {
    max-width: 80%;
    margin: 10px 0 0;
    overflow: hidden;
    color: #d7dcef;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.78rem;
}

.media-close {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 2;
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: #ffffff;
    background: rgba(0, 0, 0, 0.55);
    font-size: 1.5rem;
    line-height: 1;
}

.toast-region {
    position: fixed;
    z-index: 200;
    right: 18px;
    bottom: 18px;
    display: flex;
    align-items: flex-end;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    max-width: min(360px, calc(100vw - 36px));
    padding: 11px 14px;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    color: var(--ink);
    background: #202944;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.34);
    font-size: 0.78rem;
    animation: toast-in 180ms ease-out;
}

.toast.error {
    border-color: rgba(255, 100, 124, 0.35);
    background: #3a1d2a;
}

.sidebar-scrim,
.mobile-only {
    display: none;
}

@keyframes pulse {
    0%, 100% { opacity: 0.55; }
    50% { opacity: 1; }
}

@keyframes toast-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 860px) {
    .mobile-only {
        display: grid;
    }

    .app-header {
        min-height: 66px;
        padding: 8px 12px;
    }

    .brand-block {
        min-width: 0;
    }

    .brand-mark {
        width: 38px;
        height: 38px;
    }

    .brand-block p,
    .network-status,
    .profile-copy small {
        display: none;
    }

    .profile-copy {
        max-width: 105px;
    }

    .app-body {
        display: block;
        border: 0;
    }

    .user-sidebar {
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        width: min(86vw, 330px);
        border-right-color: var(--line-strong);
        box-shadow: 20px 0 50px rgba(0, 0, 0, 0.44);
        transform: translateX(-105%);
        transition: transform 180ms ease-out;
    }

    .app-body.sidebar-open .user-sidebar {
        transform: translateX(0);
    }

    .sidebar-scrim {
        position: absolute;
        z-index: 15;
        inset: 0;
        display: block;
        background: rgba(2, 4, 10, 0.65);
        opacity: 0;
        pointer-events: none;
        transition: opacity 180ms ease-out;
    }

    .app-body.sidebar-open .sidebar-scrim {
        opacity: 1;
        pointer-events: auto;
    }

    .conversation-panel {
        height: 100%;
    }
}

@media (max-width: 600px) {
    .app-header {
        gap: 8px;
    }

    .brand-block {
        gap: 8px;
    }

    .brand-block h1 {
        font-size: 0.92rem;
    }

    #headerAvatar {
        width: 35px;
        height: 35px;
    }

    .profile-copy {
        display: none;
    }

    .conversation-topbar {
        min-height: 56px;
        padding: 7px 10px;
    }

    .conversation-tab {
        min-height: 38px;
        max-width: 150px;
        padding: 6px 9px;
    }

    .conversation-actions {
        gap: 5px;
    }

    .call-button {
        min-height: 36px;
        padding: 6px 8px;
        font-size: 0.68rem;
    }

    .conversation-heading {
        min-height: 62px;
        padding: 10px 15px;
    }

    .conversation-heading h2 {
        font-size: 1.05rem;
    }

    .presence-label {
        max-width: 42%;
        font-size: 0.64rem;
    }

    .files-heading {
        align-items: stretch;
        flex-direction: column;
        gap: 14px;
        padding: 17px 16px 15px;
    }

    .files-heading h2 {
        font-size: 1.12rem;
    }

    .files-add-button {
        width: 100%;
    }

    .files-statusbar {
        align-items: flex-start;
        flex-direction: column;
        gap: 5px;
        padding: 9px 16px;
    }

    .files-list {
        grid-template-columns: minmax(0, 1fr);
        gap: 10px;
        padding: 14px 12px 20px;
    }

    .file-card {
        grid-template-columns: 46px minmax(0, 1fr);
        gap: 11px;
        padding: 12px;
    }

    .file-kind-icon,
    .file-thumbnail {
        width: 46px;
        height: 46px;
        border-radius: 12px;
    }

    .file-actions {
        grid-column: 1 / -1;
    }

    .file-action {
        flex: 1;
    }

    .message-area {
        padding: 17px 12px;
    }

    .message-column {
        max-width: 84%;
    }

    .message-bubble {
        padding: 9px 11px;
    }

    .message-bubble p {
        font-size: 0.85rem;
    }

    .typing-indicator {
        padding-right: 18px;
        padding-left: 18px;
    }

    .composer {
        gap: 7px;
        padding: 9px 10px calc(9px + env(safe-area-inset-bottom));
    }

    .composer-icon-button,
    .send-button {
        height: 40px;
    }

    .composer-icon-button {
        width: 40px;
    }

    .send-button {
        min-width: 58px;
        padding: 7px 10px;
    }

    .modal-overlay {
        align-items: end;
        padding: 0;
    }

    .modal-card,
    .call-card {
        width: 100%;
        max-height: 94vh;
        border-right: 0;
        border-bottom: 0;
        border-left: 0;
        border-radius: 22px 22px 0 0;
    }

    .avatar-picker {
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 6px;
    }

    .avatar-choice {
        border-radius: 13px;
    }

    .avatar-choice .avatar {
        border-radius: 10px;
    }

    .call-stage {
        aspect-ratio: 4 / 5;
    }

    .local-video {
        width: 31%;
        min-width: 94px;
    }

    .call-actions {
        gap: 7px;
        padding: 13px 10px calc(13px + env(safe-area-inset-bottom));
    }

    .call-control {
        min-width: 0;
        flex: 1;
        padding: 7px 8px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
