:root {
        color-scheme: light;
        font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
          "Segoe UI", sans-serif;
        --site-background: url("../media/pixel-night-4k.gif") center top / cover no-repeat;
        --card-background: rgba(255, 255, 255, 0.95);
        --button-background: #303030;
        --accent-color: #5a10b5;
        --personal-accent: #c291f6;
        --personal-strong: #8f3de0;
        --personal-soft: rgba(172, 78, 218, 0.24);
        --message-size: 14px;
        background: #050712;
        color: #17141c;
      }

      * {
        box-sizing: border-box;
      }

      [hidden] {
        display: none !important;
      }

      body {
        position: relative;
        isolation: isolate;
        min-width: 320px;
        min-height: 100vh;
        margin: 0;
        overflow-x: hidden;
        background: #050712;
      }

      body::before,
      body::after {
        position: fixed;
        inset: 0;
        pointer-events: none;
        content: "";
      }

      body::before {
        z-index: -2;
        bottom: -8vh;
        background: var(--site-background);
        clip-path: inset(0 0 8vh);
      }

      body::after {
        z-index: -1;
        background: linear-gradient(180deg, rgba(3, 6, 19, 0.24), rgba(4, 3, 16, 0.5));
      }

      main {
        display: grid;
        min-height: 100vh;
        place-items: center;
        padding: 32px 20px;
      }

      .session-loading { display: grid; place-content: center; justify-items: center; gap: 16px; min-height: 100dvh; padding: 24px; color: #ded3ef; text-align: center; }
      .session-loading p { max-width: 360px; margin: 0; font-size: 14px; line-height: 1.5; }
      .session-retry { min-height: 44px; padding: 10px 24px; border: 1px solid #c291f666; border-radius: 22px; background: #21152d; color: #f4e9ff; font: inherit; cursor: pointer; }
      .session-retry:focus-visible { outline: 2px solid #c291f6; outline-offset: 3px; }

      .auth-card {
        width: min(100%, 584px);
        padding: clamp(36px, 7vw, 56px) clamp(26px, 7vw, 68px) 48px;
        border: 1px solid rgba(255, 255, 255, 0.35);
        border-radius: 34px;
        background: var(--card-background);
        box-shadow: 0 24px 64px rgba(13, 3, 40, 0.28);
      }

      h1 {
        margin: 0 0 36px;
        text-align: center;
        font-size: clamp(24px, 3vw, 30px);
        font-weight: 500;
        letter-spacing: -0.03em;
      }

      form {
        display: grid;
        gap: 26px;
      }

      .field {
        display: grid;
        gap: 10px;
      }

      label {
        font-size: 18px;
        font-weight: 500;
      }

      input {
        width: 100%;
        min-height: 50px;
        padding: 0 14px;
        border: 1px solid #d8d8db;
        border-radius: 0;
        outline: none;
        background: #fff;
        color: #17141c;
        font: inherit;
        font-size: 16px;
        transition: border-color 160ms ease, box-shadow 160ms ease;
      }

      input::placeholder {
        color: #8a878d;
      }

      input:focus {
        border-color: var(--accent-color);
        box-shadow: 0 0 0 3px rgba(90, 16, 181, 0.14);
      }

      .submit-button {
        justify-self: center;
        min-width: 168px;
        min-height: 50px;
        margin-top: 12px;
        padding: 0 28px;
        border: 0;
        border-radius: 999px;
        background: var(--button-background);
        color: #fff;
        cursor: pointer;
        font: inherit;
        font-size: 17px;
        font-weight: 500;
        transition: transform 160ms ease, filter 160ms ease;
      }

      .submit-button:hover {
        filter: brightness(0.88);
        transform: translateY(-1px);
      }

      .submit-button:focus-visible,
      .register-link:focus-visible {
        outline: 3px solid rgba(90, 16, 181, 0.32);
        outline-offset: 4px;
      }

      .form-message {
        min-height: 22px;
        margin: -8px 0 0;
        color: #5c5860;
        text-align: center;
        font-size: 14px;
      }

      .bottom-actions {
        display: flex;
        justify-content: center;
        margin-top: 34px;
      }

      .register-link {
        color: #17141c;
        font-size: 16px;
        text-decoration: none;
        transition: color 160ms ease;
      }

      .register-link:hover {
        color: var(--accent-color);
        text-decoration: underline;
        text-underline-offset: 4px;
      }

      .registration-panel {
        display: grid;
        gap: 18px;
      }

      .registration-panel h2 {
        margin: 0;
        text-align: center;
        font-size: 25px;
        font-weight: 600;
      }

      .registration-note {
        margin: -8px 0 2px;
        color: #6d6971;
        text-align: center;
        font-size: 14px;
        line-height: 1.45;
      }

      .registration-form {
        display: grid;
        gap: 17px;
      }

      .registration-field {
        display: grid;
        gap: 8px;
      }

      .registration-field label {
        font-size: 16px;
        font-weight: 600;
      }

      .registration-field input {
        min-height: 50px;
      }

      .registration-field input.is-invalid {
        border-color: #a02c59;
        box-shadow: 0 0 0 3px rgba(160, 44, 89, 0.13);
      }

      .field-error {
        min-height: 18px;
        margin: -2px 0 0;
        color: #8a2450;
        font-size: 13px;
        line-height: 1.35;
      }

      .registration-actions {
        display: grid;
        justify-items: center;
        gap: 13px;
        margin-top: 2px;
      }

      .registration-submit {
        min-width: 210px;
      }

      .back-to-login {
        color: #17141c;
        font-size: 15px;
        text-decoration: none;
      }

      .back-to-login:hover {
        color: var(--accent-color);
        text-decoration: underline;
        text-underline-offset: 4px;
      }

      .registration-message {
        min-height: 20px;
        margin: -3px 0 0;
        color: #8a2450;
        text-align: center;
        font-size: 13px;
      }

      .welcome-screen {
        position: fixed;
        inset: 0;
        z-index: 1;
        overflow-y: auto;
        padding: 30px 24px 30px 108px;
      }

      .profile-shell {
        width: min(100%, 1280px);
        margin: 0 auto;
      }

      .profile-nav {
        position: fixed;
        top: 50%;
        left: 16px;
        z-index: 2;
        display: grid;
        gap: 9px;
        width: 72px;
        transform: translateY(-50%);
      }

      .profile-nav-button {
        position: relative;
        min-height: 54px;
        padding: 8px 5px;
        border: 1px solid rgba(255, 255, 255, 0.2);
        border-radius: 16px;
        background: rgba(8, 11, 35, 0.55);
        color: rgba(255, 255, 255, 0.72);
        cursor: pointer;
        font: inherit;
        font-size: 12px;
        font-weight: 700;
        backdrop-filter: blur(14px);
        transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
      }

      .profile-nav-icon { display: none; }
      .profile-nav-icon .desktop-nav-symbol { display: none; }
      .profile-nav-label { white-space: nowrap; }
      .profile-nav-badge {
        position: absolute;
        top: -5px;
        right: -4px;
        display: grid;
        place-items: center;
        min-width: 19px;
        height: 19px;
        padding: 0 5px;
        border: 2px solid #181521;
        border-radius: 999px;
        background: #ee7894;
        color: #fff;
        font-size: 10px;
        font-weight: 700;
        line-height: 1;
        font-variant-numeric: tabular-nums;
        pointer-events: none;
      }

      .profile-nav-button:hover,
      .profile-nav-button:focus-visible,
      .profile-nav-button.active {
        border-color: rgba(216, 169, 255, 0.62);
        background: linear-gradient(145deg, rgba(143, 61, 224, 0.72), rgba(209, 75, 206, 0.48));
        color: #fff;
        outline: none;
        transform: translateX(2px);
      }

      .profile-topbar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 18px;
        color: #fff;
      }

      .profile-brand {
        margin: 0;
        color: #f5d5ff;
        font-size: clamp(22px, 4vw, 34px);
        font-weight: 700;
        letter-spacing: -0.04em;
      }

      .profile-brand-note {
        margin: 6px 0 0;
        color: rgba(255, 255, 255, 0.66);
        font-size: 14px;
      }

      .profile-home { display: block; min-width: 0; text-decoration: none; border-radius: 12px; padding: 5px 0; }
      .profile-home:hover .profile-brand { color: #fff; }
      .profile-home:focus-visible { outline: 2px solid var(--personal-accent); outline-offset: 7px; }

      .profile-layout {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: 20px;
        margin-top: 22px;
      }

      .profile-card,
      .chat-card {
        border: 1px solid rgba(255, 255, 255, 0.32);
        border-radius: 28px;
        background: rgba(8, 11, 35, 0.58);
        box-shadow: 0 28px 90px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.12);
        backdrop-filter: blur(16px);
        color: #fff;
      }

      .profile-card {
        width: min(100%, 520px);
        margin: 0 auto;
        padding: 28px;
        animation: welcome-rise 520ms ease both;
      }

      .chat-card {
        min-height: 620px;
        padding: 0;
        overflow: hidden;
        animation: welcome-rise 620ms ease both;
      }

      .friends-card {
        min-height: 570px;
        padding: 28px;
      }

      .profile-card h2,
      .chat-card h2 {
        margin: 0;
        font-size: 22px;
        letter-spacing: -0.025em;
      }

      .profile-card-note,
      .chat-card-note {
        margin: 8px 0 0;
        color: rgba(255, 255, 255, 0.64);
        font-size: 13px;
        line-height: 1.45;
      }

      .profile-form {
        display: grid;
        gap: 18px;
        margin-top: 0;
      }

      .avatar-area {
        display: grid;
        justify-items: center;
        gap: 12px;
      }

      .profile-avatar,
      .profile-avatar-placeholder {
        width: 128px;
        height: 128px;
        border: 1px solid rgba(255, 255, 255, 0.46);
        border-radius: 50%;
        box-shadow: 0 0 32px rgba(177, 83, 255, 0.32);
      }

      .profile-avatar {
        display: block;
        object-fit: cover;
        background: #20114f;
      }

      .profile-avatar-placeholder {
        display: grid;
        place-items: center;
        background: radial-gradient(circle at 30% 22%, #ffdcff, #b448ef 38%, #28116a 78%);
        color: #fff;
        font-size: 42px;
        font-weight: 700;
      }

      .avatar-file-label {
        padding: 8px 14px;
        border: 1px solid rgba(255, 255, 255, 0.22);
        border-radius: 999px;
        background: rgba(255, 255, 255, 0.1);
        color: #fff;
        cursor: pointer;
        font-size: 13px;
        transition: background 160ms ease, transform 160ms ease;
      }

      .avatar-file-label:hover {
        background: rgba(255, 255, 255, 0.2);
        transform: translateY(-1px);
      }

      .avatar-file-label { font: inherit; font-size: 13px; }
      .avatar-file-note { margin: 0; color: #bbb4d0; font-size: 12px; text-align: center; }
      body.avatar-cropping { overflow: hidden; }
      .avatar-crop-dialog {
        box-sizing: border-box;
        width: min(720px, calc(100% - 24px));
        max-height: calc(100dvh - 24px);
        margin: auto;
        padding: clamp(16px, 3vw, 28px);
        overflow-y: auto;
        border: 1px solid rgba(199, 158, 255, .28);
        border-radius: 24px;
        background: #151126;
        color: #f5f0ff;
        box-shadow: 0 24px 100px #0009;
        color-scheme: dark;
      }
      .avatar-crop-dialog::backdrop { background: rgba(3, 3, 12, .8); backdrop-filter: blur(7px); }
      .avatar-crop-dialog h2 { margin: 0; text-align: center; font-size: 23px; letter-spacing: -.03em; }
      .avatar-crop-help { margin: 8px 0 18px; text-align: center; color: #bcb3d0; font-size: 13px; line-height: 1.5; }
      .avatar-crop-stage { height: clamp(220px, 45dvh, 400px); overflow: hidden; border-radius: 16px; background: #080711; }
      #avatar-crop-canvas { display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; outline-offset: -3px; }
      #avatar-crop-canvas.is-dragging { cursor: grabbing; }
      .avatar-crop-zoom { display: flex; align-items: center; gap: 12px; margin-top: 18px; }
      .avatar-crop-zoom input { flex: 1; width: 0; min-width: 30px; padding: 0; accent-color: var(--personal-accent); cursor: pointer; }
      .avatar-crop-zoom output { min-width: 44px; text-align: right; font-size: 12px; color: #cfc4e6; font-variant-numeric: tabular-nums; }
      .avatar-crop-dialog button { min-height: 44px; border-radius: 12px; padding: 10px 18px; border: 1px solid #c7a2ff30; background: #ffffff0b; color: #f5f0ff; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
      .avatar-crop-zoom button { min-width: 44px; padding: 6px; font-size: 22px; }
      .avatar-crop-dialog button:hover { background: #ffffff17; }
      .avatar-crop-footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; margin-top: 8px; }
      .avatar-crop-actions { display: flex; gap: 10px; margin-left: auto; }
      .avatar-crop-dialog .avatar-crop-save { background: linear-gradient(110deg, var(--personal-strong), #c48bf2); border-color: transparent; }
      .avatar-crop-dialog .avatar-crop-save:hover { filter: brightness(1.12); }
      .avatar-crop-dialog button:focus-visible, #avatar-crop-canvas:focus-visible, .avatar-file-label:focus-visible { outline: 2px solid #d5b4ff; outline-offset: 3px; }
      .avatar-crop-dialog button:disabled, .avatar-file-label:disabled, .profile-save:disabled { opacity: .5; cursor: wait; transform: none; }
      .avatar-crop-status { min-height: 36px; margin: 12px 0 0; color: #c8b9e4; font-size: 12px; line-height: 1.5; }

      .profile-field {
        display: grid;
        gap: 8px;
      }

      .profile-field label,
      .chat-controls label {
        color: rgba(255, 255, 255, 0.85);
        font-size: 14px;
        font-weight: 600;
      }

      .profile-field input,
      .profile-field textarea,
      .chat-controls input,
      .chat-form textarea {
        width: 100%;
        padding: 12px 13px;
        border: 1px solid rgba(255, 255, 255, 0.18);
        border-radius: 14px;
        outline: none;
        background: rgba(0, 0, 0, 0.2);
        color: #fff;
        font: inherit;
        font-size: 14px;
        resize: vertical;
        transition: border-color 160ms ease, box-shadow 160ms ease;
      }

      .profile-field textarea {
        min-height: 112px;
      }

      .profile-field input::placeholder,
      .profile-field textarea::placeholder,
      .chat-controls input::placeholder,
      .chat-form textarea::placeholder {
        color: rgba(255, 255, 255, 0.42);
      }

      .profile-field input:focus,
      .profile-field textarea:focus,
      .chat-controls input:focus,
      .chat-form textarea:focus {
        border-color: #d8a9ff;
        box-shadow: 0 0 0 3px rgba(190, 96, 255, 0.16);
      }

      .profile-save,
      .chat-button {
        min-height: 42px;
        border: 0;
        border-radius: 999px;
        background: linear-gradient(100deg, #8f3de0, #d14bce);
        color: #fff;
        cursor: pointer;
        font: inherit;
        font-size: 14px;
        font-weight: 700;
        transition: filter 160ms ease, transform 160ms ease;
      }

      .profile-save:hover,
      .chat-button:hover {
        filter: brightness(1.1);
        transform: translateY(-1px);
      }

      .profile-message,
      .chat-message {
        min-height: 18px;
        margin: 0;
        color: #dcbaff;
        font-size: 13px;
        line-height: 1.4;
      }

      .chat-head {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 18px;
      }

      .chat-status {
        display: inline-flex;
        align-items: center;
        gap: 7px;
        color: #b8ffdc;
        font-size: 12px;
        white-space: nowrap;
      }

      .chat-status::before {
        width: 7px;
        height: 7px;
        border-radius: 50%;
        background: #73ffc1;
        box-shadow: 0 0 10px #73ffc1;
        content: "";
      }

      .inbox {
        display: grid;
        gap: 9px;
        margin-top: 0;
      }

      .inbox-title {
        margin: 0;
        color: rgba(255, 255, 255, 0.78);
        font-size: 13px;
        font-weight: 700;
        letter-spacing: 0.04em;
        text-transform: uppercase;
      }

      .inbox-list {
        display: block;
        min-height: 280px;
        overflow-y: auto;
      }

      .inbox-empty {
        margin: 0;
        padding: 11px 13px;
        border: 1px dashed rgba(255, 255, 255, 0.16);
        border-radius: 13px;
        color: rgba(255, 255, 255, 0.48);
        font-size: 13px;
      }

      .inbox-item {
        display: flex;
        align-items: center;
        gap: 13px;
        width: 100%;
        min-height: 78px;
        padding: 12px 16px;
        border: 0;
        border-radius: 0;
        background: transparent;
        color: #fff;
        font: inherit;
        cursor: pointer;
        text-align: left;
        transition: background 160ms ease, border-color 160ms ease;
      }

      .inbox-avatar,
      .inbox-avatar-placeholder {
        display: grid;
        flex: 0 0 52px;
        place-items: center;
        width: 52px;
        height: 52px;
        border: 1px solid rgba(255, 255, 255, 0.26);
        border-radius: 50%;
        background: radial-gradient(circle at 30% 22%, #ffdcff, #b448ef 38%, #28116a 78%);
        color: #fff;
        font-size: 14px;
        font-weight: 700;
        object-fit: cover;
      }

      .inbox-item:hover,
      .inbox-item:focus-visible {
        border-color: rgba(216, 169, 255, 0.6);
        background: rgba(172, 78, 218, 0.2);
        outline: none;
      }

      .inbox-item.selected {
        border-color: rgba(216, 169, 255, 0.54);
        background: rgba(172, 78, 218, 0.24);
      }

      .inbox-item-name {
        display: block;
        overflow: hidden;
        font-size: 14px;
        font-weight: 600;
        text-overflow: ellipsis;
        white-space: nowrap;
      }

      .inbox-item-content {
        min-width: 0;
        flex: 1;
      }

      .inbox-item-preview {
        display: block;
        margin-top: 7px;
        overflow: hidden;
        color: rgba(255, 255, 255, 0.52);
        font-size: 13px;
        text-overflow: ellipsis;
        white-space: nowrap;
      }

      .inbox-item-time {
        color: rgba(255, 255, 255, 0.42);
        font-size: 11px;
        white-space: nowrap;
      }

      .messenger {
        display: grid;
        grid-template-columns: minmax(270px, 340px) minmax(0, 1fr);
        height: min(750px, calc(100dvh - 145px));
        min-height: 570px;
        background: rgba(12, 15, 29, 0.82);
      }

      .chat-list-panel {
        display: flex;
        flex-direction: column;
        min-width: 0;
        min-height: 0;
        border-right: 1px solid rgba(255, 255, 255, 0.08);
        background: rgba(28, 29, 38, 0.88);
      }

      .chat-list-header {
        display: flex;
        align-items: center;
        gap: 9px;
        padding: 23px 18px 16px;
      }

      .chat-list-header h2 { flex-shrink: 0; line-height: 1; white-space: nowrap; }

      .chat-count {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 22px;
        height: 22px;
        padding: 0 6px;
        border-radius: 8px;
        background: rgba(255,255,255,.08);
        color: #aaa3bd;
        font-size: 12px;
        line-height: 1;
      }

      .icon-button {
        display: grid;
        place-items: center;
        width: 34px;
        height: 34px;
        padding: 0;
        border: 1px solid rgba(255,255,255,.12);
        border-radius: 10px;
        background: rgba(255,255,255,.06);
        color: #dcbaff;
        font: inherit;
        font-size: 22px;
        cursor: pointer;
      }

      .icon-button:hover { background: rgba(197,127,255,.18); }
      .chat-search { flex: 1 1 0; min-width: 0; margin-left: auto; }
      .chat-search input,
      .chat-list-panel input {
        min-height: 42px;
        border: 1px solid rgba(255,255,255,.08);
        border-radius: 12px;
        background: rgba(0,0,0,.2);
        color: #fff;
        font-size: 13px;
      }
      .chat-search input::placeholder { color: #9893a6; }
      .chat-list-header .chat-search input { width: 100%; min-width: 0; min-height: 36px; padding: 8px 10px; }
      @media (max-width: 700px) {
        .chat-list-header .chat-search input { min-height: 42px; }
      }
      .chat-list-panel .inbox { display: flex; flex-direction: column; flex: 1; min-height: 0; }
      .chat-list-panel .inbox-list { flex: 1; }
      .chat-list-panel .inbox-empty { margin: 12px 16px; line-height: 1.6; }
      .chat-list-panel .chat-controls { margin: 0; padding: 0 16px 16px; grid-template-columns: 1fr; gap: 8px; }
      .chat-list-panel .chat-message { padding: 0 16px 10px; }
      .inbox-item-meta { display: grid; align-content: space-between; justify-items: end; gap: 10px; align-self: stretch; padding: 3px 0; }
      .inbox-receipt { display: flex; }
      .unread-badge {
        display: grid;
        place-items: center;
        min-width: 20px;
        height: 20px;
        padding: 0 5px;
        border-radius: 999px;
        background: #bd85f4;
        color: #171022;
        font-size: 11px;
        font-weight: 700;
      }
      .read-receipt { display: inline-flex; align-items: center; flex-shrink: 0; color: #a59ab8; vertical-align: middle; }
      .read-receipt.is-read { color: #96c6ff; }
      .read-receipt svg { display: block; width: 25px; height: 19px; }
      .chat-bubble-meta { display: flex; align-items: center; justify-content: flex-end; gap: 7px; flex-wrap: nowrap; clear: both; white-space: nowrap; text-align: right; }
      .inbox-item.has-unread .inbox-item-name { color: #fff; font-weight: 700; }
      .inbox-item.has-unread .inbox-item-preview { color: #ddd5eb; }
      .inbox-item.selected { box-shadow: inset 3px 0 #c99af7; }
      .conversation-panel { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
      .conversation-header {
        display: flex;
        align-items: center;
        gap: 12px;
        min-height: 83px;
        padding: 16px 24px;
        border-bottom: 1px solid rgba(255,255,255,.08);
      }
      .conversation-header .inbox-avatar,
      .conversation-header .inbox-avatar-placeholder { width: 42px; height: 42px; flex-basis: 42px; }
      .conversation-name { margin: 0; font-size: 16px; font-weight: 600; }
      .conversation-note { margin: 4px 0 0; color: #a39bb4; font-size: 12px; }
      #back-to-chats { display: none; }
      .conversation-panel .chat-messages {
        flex: 1;
        min-height: 180px;
        max-height: none;
        margin: 0;
        padding: 24px;
        border: 0;
        border-radius: 0;
        background: radial-gradient(ellipse at bottom right, rgba(101,45,148,.1), transparent);
      }
      .conversation-panel .chat-form {
        --send-button-size: 48px;
        --send-button-gap: 7px;
        --send-button-inset: 3px;
        --send-duration: 250ms;
        --send-easing: cubic-bezier(.2, .8, .2, 1);
        grid-template-columns: minmax(0,1fr);
        flex: 0 0 auto;
        gap: 0;
        margin: 0;
        padding: 12px 20px 4px;
        border-top: 1px solid rgba(255,255,255,.08);
      }
      /* Both controls stay inside the input; only the send slot grows smoothly. */
      .send-button-slot { position: relative; flex: 0 0 auto; width: 0; min-width: 0; height: calc(var(--send-button-size) + 2 * var(--send-button-inset)); transition: width var(--send-duration) var(--send-easing); }
      .chat-form.has-message .send-button-slot { width: calc(var(--send-button-size) + var(--send-button-gap)); }
      #chat-form #send-message {
        position: absolute;
        right: var(--send-button-gap);
        bottom: var(--send-button-inset);
        display: grid;
        place-items: center;
        width: var(--send-button-size);
        min-width: var(--send-button-size);
        height: var(--send-button-size);
        min-height: var(--send-button-size);
        margin: 0;
        padding: 0;
        border: 0;
        border-radius: 50%;
        background: transparent;
        box-shadow: none;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transform: translateX(-8px) scale(.72);
        transform-origin: center;
        transition: transform var(--send-duration) var(--send-easing), opacity var(--send-duration) ease, visibility 0s var(--send-duration), filter 160ms ease;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
      }
      #chat-form.has-message #send-message { opacity: 1; visibility: visible; pointer-events: auto; transform: translateX(0) scale(1); transition-delay: 0s; }
      #chat-form.has-message #send-message:disabled { opacity: .55; cursor: default; }
      #chat-form.has-message #send-message:not(:disabled):active { transform: translateX(0) scale(.94); }
      #chat-form #send-message:focus-visible { outline: 2px solid #fff; outline-offset: -3px; }
      .conversation-panel .chat-form textarea { resize: none; }
      .message-input-shell { display: flex; align-items: flex-end; min-width: 0; border: 1px solid rgba(204, 202, 221, .22); border-radius: 28px; background: linear-gradient(120deg, #242330, #191923); box-shadow: inset 0 1px rgba(255,255,255,.04); overflow: hidden; }
      .message-input-shell:focus-within { border-color: #b89be4; box-shadow: 0 0 0 3px #b78de81a; }
      .conversation-panel .message-input-shell textarea { flex: 1; width: 0; min-width: 0; min-height: 54px; padding: 16px 8px 14px 18px; border: 0; border-radius: 0; outline: none; box-shadow: none; background: transparent; color: #f4effa; font-size: 16px; line-height: 22px; }
      .conversation-panel .message-input-shell textarea::placeholder { color: #a8a4b3; }
      .emoji-toggle { flex: 0 0 48px; width: 48px; height: 48px; display: grid; place-items: center; margin: 3px 7px 3px 0; padding: 5px; border: 0; border-radius: 50%; background: transparent; cursor: pointer; }
      .emoji-toggle img { display: block; width: 38px; height: 38px; object-fit: contain; pointer-events: none; }
      .emoji-toggle:hover img, .emoji-toggle[aria-expanded="true"] img { filter: brightness(1.15) drop-shadow(0 0 4px #64b5ff66); }
      .emoji-toggle:focus-visible { outline-offset: -3px; }
      .emoji-picker { position: fixed; z-index: 100; width: min(370px, calc(100vw - 24px)); max-height: min(410px, calc(100dvh - 24px)); display: grid; grid-template-rows: auto auto auto minmax(0,1fr) auto; gap: 10px; padding: 14px; overflow: auto; border: 1px solid #bc94f64a; border-radius: 20px; background: #181329; box-shadow: 0 18px 70px #0009; color: #f6efff; color-scheme: dark; }
      .emoji-picker-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
      .emoji-picker-header h3 { margin: 0; font-size: 16px; }
      .emoji-picker-close { width: 36px; height: 36px; border: 0; border-radius: 10px; background: transparent; color: #c9bddc; font-size: 24px; cursor: pointer; }
      .emoji-picker-close:hover { background: #ffffff0d; }
      .emoji-search { width: 100%; min-height: 42px; padding: 10px 12px; border: 1px solid #c7a1ff30; border-radius: 12px; outline: none; background: #08071470; color: #fff; font: inherit; font-size: 16px; }
      .emoji-search:focus { border-color: #c291f6; }
      .emoji-search::placeholder { color: #a89abf; }
      .emoji-categories { display: flex; gap: 5px; overflow-x: auto; padding: 2px 1px 5px; }
      .emoji-category { flex-shrink: 0; min-height: 36px; padding: 6px 9px; border: 1px solid transparent; border-radius: 10px; background: transparent; color: #bcb0d0; font: inherit; font-size: 12px; cursor: pointer; }
      .emoji-category[aria-pressed="true"] { background: #b67aed26; border-color: #bb86f650; color: #f4e5ff; }
      .emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px,1fr)); align-content: start; gap: 4px; max-height: 224px; min-height: 44px; overflow-y: auto; overscroll-behavior: contain; padding: 3px; scrollbar-width: thin; }
      .emoji-option { display: grid; place-items: center; width: 100%; min-height: 42px; padding: 4px; border: 0; border-radius: 10px; background: transparent; font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; font-size: 27px; line-height: 1.25; cursor: pointer; }
      .emoji-option:hover, .emoji-option:focus-visible { background: #c291f629; }
      .emoji-empty { grid-column: 1 / -1; padding: 12px 4px; margin: 0; color: #b6a7ca; font-size: 13px; }
      .emoji-picker-note { margin: 0; color: #a99abd; font-size: 11px; line-height: 1.4; }
      .conversation-panel #send-status { flex: 0 0 auto; min-height: 0; margin: 0; padding: 6px 20px 0; }
      #send-status:empty { display: none; }
      .conversation-placeholder { display: grid; flex: 1; place-items: center; padding: 40px; text-align: center; }
      .placeholder-symbol { color: #cba5ef; font-size: 42px; }
      .conversation-placeholder h3 { margin: 18px 0 10px; font-size: 20px; font-weight: 500; }
      .conversation-placeholder p { max-width: 300px; margin: 0 auto; color: #a49bb5; font-size: 14px; line-height: 1.7; }
      .message-day { justify-self: center; margin: 4px 0 10px; padding: 5px 10px; border-radius: 999px; color: #ada2bc; background: rgba(255,255,255,.04); font-size: 11px; }
      button:focus-visible { outline: 2px solid #d8a9ff; outline-offset: 3px; }
      button:disabled { opacity: .55; cursor: wait; }

      @media (max-width: 900px) {
        .messenger { grid-template-columns: minmax(240px, 290px) minmax(0,1fr); }
      }

      @media (max-width: 700px) {
        .messenger { display: block; height: calc(100dvh - 260px); min-height: 420px; }
        .chat-list-panel { height: 100%; border-right: 0; }
        .conversation-panel { display: none; height: 100%; }
        .messenger.conversation-open .chat-list-panel { display: none; }
        .messenger.conversation-open .conversation-panel { display: flex; }
        #back-to-chats { display: grid; flex: 0 0 34px; }
        .conversation-header { padding: 12px 16px; min-height: 72px; }
        .conversation-panel .chat-messages { padding: 16px; }
        .conversation-panel .chat-form { padding: 12px 12px 4px; }
        .conversation-panel .chat-button { min-width: 44px; padding: 0 12px; width: auto; }
        #chat-view { padding: 0; min-height: 0; }
      }

      .friends-actions {
        display: grid;
        gap: 8px;
        margin-top: 24px;
      }

      .friend-tag-field { display: flex; align-items: center; min-width: 0; border: 1px solid rgba(194,151,246,.3); border-radius: 16px; background: linear-gradient(120deg, rgba(33,25,57,.95), rgba(20,17,39,.95)); box-shadow: inset 0 1px rgba(255,255,255,.05); }
      .friend-tag-field:focus-within { border-color: var(--personal-accent); box-shadow: 0 0 0 3px var(--personal-soft); }
      .friend-tag-field #friend-name { min-width: 0; width: 100%; min-height: 50px; padding: 13px 15px 13px 10px; border: 0; border-radius: 16px; background: transparent; color: #f4edff; box-shadow: none; outline: none; font-size: 16px; }
      .friend-tag-field #friend-name::placeholder { color: #a79bb8; }
      .friend-tag-field #friend-name:-webkit-autofill { -webkit-text-fill-color: #fcf4ff; box-shadow: 0 0 0 100px #2c203d inset; }

      .friends-list {
        display: grid;
        align-content: start;
        gap: 10px;
        margin-top: 22px;
      }

      .friend-item {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 13px;
        border: 1px solid rgba(255, 255, 255, 0.14);
        border-radius: 16px;
        background: rgba(255, 255, 255, 0.07);
      }

      .friend-avatar,
      .friend-avatar-placeholder {
        display: grid;
        flex: 0 0 42px;
        place-items: center;
        width: 42px;
        height: 42px;
        border: 1px solid rgba(255, 255, 255, 0.24);
        border-radius: 50%;
        background: radial-gradient(circle at 30% 22%, #ffdcff, #b448ef 38%, #28116a 78%);
        color: #fff;
        font-size: 13px;
        font-weight: 700;
        object-fit: cover;
      }

      .friend-info {
        min-width: 0;
        flex: 1;
      }

      .pixel-avatar {
        overflow: hidden;
        background: #060d22;
        line-height: 0;
      }

      .pixel-avatar svg {
        display: block;
        width: 100%;
        height: 100%;
        image-rendering: pixelated;
      }

      .friend-name {
        margin: 0;
        overflow: hidden;
        color: #fff;
        font-size: 14px;
        font-weight: 700;
        text-overflow: ellipsis;
        white-space: nowrap;
      }

      .friend-about {
        margin: 4px 0 0;
        overflow: hidden;
        color: rgba(255, 255, 255, 0.52);
        font-size: 12px;
        text-overflow: ellipsis;
        white-space: nowrap;
      }

      .friend-chat-button {
        min-height: 34px;
        padding: 0 12px;
        border: 1px solid rgba(255, 255, 255, 0.2);
        border-radius: 999px;
        background: rgba(255, 255, 255, 0.1);
        color: #fff;
        cursor: pointer;
        font: inherit;
        font-size: 12px;
      }

      .friend-chat-button:hover {
        background: rgba(255, 255, 255, 0.2);
      }

      .friends-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
      .friends-tab { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 42px; padding: 10px 15px; border: 1px solid #ffffff24; border-radius: 999px; background: #ffffff08; color: #bcb4ce; font: inherit; font-size: 13px; cursor: pointer; }
      .friends-tab[aria-pressed="true"] { color: var(--personal-accent); border-color: var(--personal-accent); background: var(--personal-soft); }
      .friends-tab-count { min-width: 20px; padding: 2px 5px; border-radius: 8px; background: #ffffff16; font-size: 11px; }
      .friend-request-actions { display: flex; flex-wrap: wrap; gap: 7px; }
      .friend-request-actions .chat-button { min-width: 0; min-height: 38px; padding: 8px 14px; font-size: 12px; }
      .friend-request-actions .preferences-secondary { min-height: 38px; padding: 8px 14px; }
      .friend-request-actions button:disabled, #friend-form button:disabled { opacity: .55; cursor: wait; }
      .notification-toggle { position: relative; display: grid; place-items: center; flex: 0 0 42px; width: 42px; height: 42px; border: 1px solid #ffffff22; border-radius: 50%; background: #151226b8; color: #e1d5f2; cursor: pointer; }
      .notification-toggle svg { width: 23px; height: 23px; }
      .notification-toggle:hover { background: var(--personal-soft); color: var(--personal-accent); }
      .notification-dot { position: absolute; top: 4px; right: 4px; width: 9px; height: 9px; border-radius: 50%; background: #ff87c7; box-shadow: 0 0 0 3px #21152d, 0 0 12px #ff87c7; }
      .notification-toggle.has-unread { border-color: #ee88cf77; }
      .notifications-dialog { width: min(460px, calc(100vw - 24px)); max-height: min(80dvh, 660px); padding: 20px; border: 1px solid #b8a0e343; border-radius: 24px; background: #121022; color: #f8f3ff; box-shadow: 0 22px 80px #0009; }
      .notifications-dialog::backdrop { background: #03030e99; backdrop-filter: blur(5px); }
      .notifications-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
      .notifications-heading h2 { margin: 0; font-size: 20px; }
      #notifications-close { width: 38px; height: 38px; border: 1px solid #ffffff20; border-radius: 50%; background: #ffffff08; color: #e8dcf9; font-size: 24px; cursor: pointer; }
      .notifications-list { display: grid; gap: 8px; max-height: 58dvh; overflow-y: auto; overscroll-behavior: contain; }
      .notification-item { display: flex; align-items: center; gap: 12px; padding: 12px; width: 100%; border: 1px solid #ffffff12; border-radius: 16px; background: #ffffff05; color: #e2d9ee; text-align: left; font: inherit; cursor: pointer; }
      .notification-item.is-unread { border-color: #d4a1ff4d; background: var(--personal-soft); }
      .notification-content { display: grid; gap: 5px; min-width: 0; font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
      .notification-content time { color: #a498b5; font-size: 11px; }
      .notifications-status { margin: 10px 0 0; color: #c9badc; font-size: 12px; line-height: 1.5; }
      .notifications-status:empty { display: none; }
      .notification-toggle:focus-visible, .friends-tab:focus-visible, .notification-item:focus-visible, #notifications-close:focus-visible { outline: 2px solid var(--personal-accent); outline-offset: 3px; }
      @media (max-width: 520px) {
        .friend-request { flex-wrap: wrap; }
        .friend-request-actions { width: 100%; padding-left: 54px; }
        .friends-tab { flex: 1 1 auto; padding: 9px 10px; font-size: 12px; }
      }

      .chat-controls {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: end;
        gap: 10px;
        margin-top: 22px;
      }

      .chat-controls label {
        grid-column: 1 / -1;
      }

      .chat-button {
        min-width: 120px;
        padding: 0 18px;
      }

      .chat-messages {
        display: grid;
        align-content: start;
        gap: 10px;
        min-height: 270px;
        max-height: 360px;
        margin-top: 18px;
        padding: 16px;
        overflow-y: auto;
        border: 1px solid rgba(255, 255, 255, 0.12);
        border-radius: 18px;
        background: rgba(0, 0, 0, 0.16);
      }

      .chat-empty {
        align-self: center;
        margin: auto;
        max-width: 320px;
        color: rgba(255, 255, 255, 0.54);
        text-align: center;
        font-size: 14px;
        line-height: 1.5;
      }

      .chat-bubble {
        justify-self: start;
        max-width: min(80%, 520px);
        padding: 10px 13px;
        border: 1px solid rgba(255, 255, 255, 0.12);
        border-radius: 16px 16px 16px 5px;
        background: rgba(255, 255, 255, 0.09);
      }

      .chat-bubble.mine {
        justify-self: end;
        border-radius: 16px 16px 5px 16px;
        background: rgba(172, 78, 218, 0.34);
      }

      .chat-bubble-text {
        margin: 0;
        color: rgba(255, 255, 255, 0.9);
        font-size: 14px;
        line-height: 1.45;
        white-space: pre-wrap;
        overflow-wrap: anywhere;
      }

      .chat-bubble-meta {
        margin: 5px 0 0;
        color: rgba(255, 255, 255, 0.46);
        font-size: 11px;
      }

      .chat-form {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 10px;
        align-items: end;
        margin-top: 14px;
      }

      .chat-form textarea {
        min-height: 48px;
        max-height: 120px;
      }

      .chat-form .chat-button {
        min-width: 110px;
      }

      .welcome-logout {
        min-width: 112px;
        min-height: 40px;
        border: 1px solid rgba(255, 255, 255, 0.24);
        border-radius: 999px;
        background: rgba(255, 255, 255, 0.12);
        color: #fff;
        cursor: pointer;
        font: inherit;
        font-size: 13px;
        transition: background 160ms ease, transform 160ms ease;
      }

      .welcome-logout:hover {
        background: rgba(255, 255, 255, 0.2);
        transform: translateY(-1px);
      }

      @media (max-width: 760px) {
        .welcome-screen { padding: 18px 14px; }
        .profile-nav {
          position: static;
          grid-template-columns: repeat(3, minmax(0, 1fr));
          width: 100%;
          margin: 0 auto 18px;
          transform: none;
        }

        .profile-nav-button:hover,
        .profile-nav-button:focus-visible,
        .profile-nav-button.active {
          transform: translateY(-1px);
        }

        .profile-topbar {
          display: grid;
          grid-template-columns: minmax(0,1fr) auto;
        }
        .profile-layout {
          grid-template-columns: 1fr;
        }

        .chat-card {
          min-height: 520px;
        }

      }

      @keyframes welcome-rise {
        from {
          opacity: 0;
          transform: translateY(18px) scale(0.98);
        }
        to {
          opacity: 1;
          transform: translateY(0) scale(1);
        }
      }

      @media (max-width: 520px) {
        main {
          padding: 20px 14px;
        }

        .auth-card {
          border-radius: 26px;
          padding: 34px 22px 38px;
        }

        h1 {
          margin-bottom: 30px;
        }

        label {
          font-size: 16px;
        }

        .welcome-screen {
          padding: 18px 14px 28px;
        }

        .profile-card,
        .chat-card {
          padding: 22px 18px;
          border-radius: 22px;
        }

        .chat-controls,
        .chat-form {
          grid-template-columns: 1fr;
        }

        .chat-button {
          width: 100%;
        }
      }
      .preferences-card { padding: 30px; background: rgba(12, 11, 29, .91); }
      .preferences-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
      .preferences-heading h2 { margin: 0; font-size: 28px; }
      .preferences-layout { display: grid; grid-template-columns: 205px minmax(0,1fr); gap: 32px; margin-top: 30px; }
      .preferences-categories { display: grid; align-content: start; gap: 6px; }
      .preferences-category {
        padding: 14px; border: 1px solid transparent; border-radius: 12px;
        background: transparent; color: #b6afc4; text-align: left; cursor: pointer; font: inherit; font-size: 14px;
      }
      .preferences-category span { display: block; color: inherit; font-weight: 600; }
      .preferences-category:hover, .preferences-category:focus-visible { background: rgba(255,255,255,.05); }
      .preferences-category[aria-pressed="true"] { color: #fff; background: var(--personal-soft); border-color: var(--personal-accent); }
      .preferences-form { gap: 22px; min-width: 0; }
      .preferences-group { display: grid; gap: 22px; align-content: start; min-height: 300px; }
      .preferences-group h3 { margin: 0; font-size: 19px; font-weight: 600; }
      .preferences-description { margin: 6px 0 0; color: #aca4bc; font-size: 13px; line-height: 1.65; }
      .preferences-row { display: flex; align-items: center; justify-content: space-between; gap: 22px; padding-bottom: 18px; border-bottom: 1px solid rgba(255,255,255,.08); }
      .preferences-row label { font-size: 14px; font-weight: 600; cursor: pointer; }
      .preferences-row input[type="checkbox"] { appearance: none; position: relative; flex: 0 0 44px; width: 44px; min-height: 26px; height: 26px; margin: 0; padding: 0; border: 1px solid #665b79; border-radius: 20px; background: #322b42; cursor: pointer; }
      .preferences-row input[type="checkbox"]::before { position: absolute; content: ""; width: 18px; height: 18px; left: 3px; top: 3px; border-radius: 50%; background: #bcb4c9; transition: transform .15s; }
      .preferences-row input[type="checkbox"]:checked { background: var(--personal-strong); border-color: var(--personal-accent); }
      .preferences-row input[type="checkbox"]:checked::before { transform: translateX(18px); background: #fff; }
      .preferences-row input[type="checkbox"]:focus-visible, .preferences-category:focus-visible { outline: 2px solid var(--personal-accent); outline-offset: 3px; }
      .preferences-row input:disabled, .preferences-row select:disabled { opacity: .5; cursor: wait; }
      .preferences-row select { min-width: 120px; padding: 9px 12px; border: 1px solid #5c506e; border-radius: 10px; background: #211b31; color: #fff; font: inherit; font-size: 13px; }
      .preferences-secondary { padding: 11px 15px; border: 1px solid #51435f; border-radius: 12px; background: transparent; color: #cec3dc; font: inherit; font-size: 12px; cursor: pointer; }
      .preferences-secondary:disabled { opacity: .4; cursor: default; }
      .preferences-info { padding: 16px; border: 1px solid rgba(255,255,255,.12); border-radius: 14px; background: rgba(255,255,255,.04); }
      .profile-display-name { margin: 12px 0 0; color: #fff; font-size: 22px; font-weight: 700; overflow-wrap: anywhere; }
      .profile-field input[type="date"] { min-width: 0; min-height: 46px; color-scheme: dark; }
      .profile-field .preferences-description { margin: 0; }
      #profile-message:empty, #preferences-message:empty { display: none; }
      .preferences-session { display: grid; grid-column: 1 / -1; justify-items: start; margin-top: 8px; padding-top: 14px; border-top: 1px solid #ffffff18; }
      .preferences-session .welcome-logout { padding: 10px 20px; border-color: #d9789455; background: #ca587a14; color: #f3b9cb; }
      .preferences-session .welcome-logout:hover { background: #ca587a29; }
      .send-icon { display: block; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
      .presence-status { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin: 4px 0 0; color: #a39bb4; font-size: 12px; line-height: 1.5; }
      .presence-status.is-online { color: #8de5bb; }
      .presence-device { display: inline-flex; flex-shrink: 0; align-items: center; color: inherit; }
      .presence-device svg { display: block; width: 16px; height: 16px; }
      .inbox-avatar-wrap { position: relative; flex: 0 0 52px; width: 52px; height: 52px; }
      .inbox-avatar-wrap.is-online::after {
        position: absolute; right: 1px; bottom: 1px; width: 11px; height: 11px; border: 3px solid #23202e;
        border-radius: 50%; background: #80dcae; content: "";
      }
      .friend-presence { margin-top: 4px; }
      .profile-save, .chat-button { background: linear-gradient(100deg, var(--personal-strong), var(--personal-accent)); }
      .profile-nav-button:hover, .profile-nav-button:focus-visible, .profile-nav-button.active { background: var(--personal-soft); border-color: var(--personal-accent); }
      .inbox-item.selected { background: var(--personal-soft); box-shadow: inset 3px 0 var(--personal-accent); }
      .inbox-item:hover { background: var(--personal-soft); }
      .unread-badge { background: var(--personal-accent); }
      .chat-bubble.mine { background: var(--personal-soft); }
      .chat-bubble-text { font-size: var(--message-size); }
      body.compact-chats .inbox-item { min-height: 64px; padding-top: 8px; padding-bottom: 8px; }
      body.compact-chats .inbox-avatar-wrap, body.compact-chats .inbox-avatar, body.compact-chats .inbox-avatar-placeholder { width: 44px; height: 44px; flex-basis: 44px; }
      @media (max-width: 760px) {
        .profile-nav { display: flex; overflow-x: auto; padding: 2px 2px 7px; }
        .profile-nav-button { flex: 1 0 78px; }
        .preferences-layout { grid-template-columns: minmax(0,1fr); gap: 22px; }
        .preferences-categories { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 6px; }
        .preferences-category { padding: 11px; }
        .preferences-heading { flex-direction: column; gap: 12px; }
        .preferences-card { padding: 22px 18px; }
        .preferences-row { gap: 14px; }
        .preferences-row select { min-width: 105px; }
        .preferences-group { min-height: 0; }
      }
      @media (prefers-reduced-motion: reduce) {
        .preferences-row input[type="checkbox"]::before { transition: none; }
        .conversation-panel .chat-form { --send-duration: 0ms; }
      }
      @media (max-width: 700px) {
        body.mobile-chat-page { overflow: hidden; overscroll-behavior-y: none; }
        .welcome-screen {
          --mobile-nav-height: 76px;
          --mobile-nav-bottom: calc(10px + env(safe-area-inset-bottom));
          padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) calc(var(--mobile-nav-height) + var(--mobile-nav-bottom) + 12px) max(10px, env(safe-area-inset-left));
          scroll-padding-bottom: calc(var(--mobile-nav-height) + var(--mobile-nav-bottom) + 12px);
        }
        .profile-nav {
          position: fixed;
          top: auto;
          bottom: var(--mobile-nav-bottom);
          left: max(10px, env(safe-area-inset-left));
          right: max(10px, env(safe-area-inset-right));
          z-index: 20;
          display: flex;
          gap: 2px;
          width: auto;
          max-width: 480px;
          height: var(--mobile-nav-height);
          margin: 0 auto;
          padding: 4px;
          overflow: visible;
          border: 1px solid rgba(232, 223, 255, .18);
          border-radius: 40px;
          background: rgba(22, 21, 31, .94);
          box-shadow: 0 8px 30px #0006, inset 0 1px 0 #ffffff0c;
          -webkit-backdrop-filter: blur(22px);
          backdrop-filter: blur(22px);
          transform: none;
        }
        .profile-nav-button {
          display: flex;
          flex: 1 1 0;
          flex-direction: column;
          align-items: center;
          justify-content: center;
          gap: 4px;
          min-width: 0;
          min-height: 0;
          padding: 7px 1px;
          border-color: transparent;
          border-radius: 34px;
          background: transparent;
          color: #bcb8cd;
          font-size: 11px;
          font-weight: 600;
          line-height: 1.2;
          -webkit-backdrop-filter: none;
          backdrop-filter: none;
          -webkit-tap-highlight-color: transparent;
          touch-action: manipulation;
        }
        .profile-nav-button:hover,
        .profile-nav-button:focus-visible,
        .profile-nav-button.active {
          border-color: transparent;
          background: var(--personal-soft);
          color: var(--personal-accent);
          transform: none;
        }
        .profile-nav-button:focus-visible { outline: 2px solid var(--personal-accent); outline-offset: -3px; }
        .profile-nav-icon { display: block; width: 29px; height: 29px; flex-shrink: 0; }
        .profile-nav-icon svg { display: block; width: 100%; height: 100%; }
        .profile-nav-button.active .profile-nav-icon { filter: drop-shadow(0 0 6px var(--personal-soft)); }
        .profile-nav-badge { top: 3px; left: calc(50% + 6px); right: auto; }
        .is-chat-screen > .profile-nav { position: absolute; }
        .profile-topbar { display: flex; flex-shrink: 0; min-height: 32px; }
        .profile-home { padding: 0; }
        .profile-brand { font-size: 21px; }
        .profile-brand-note { display: none; }
        .profile-layout { margin-top: 10px; gap: 10px; }
        .welcome-screen.is-chat-screen { top: var(--mobile-viewport-top, 0px); bottom: auto; height: var(--mobile-viewport-height, 100dvh); display: flex; flex-direction: column; overflow: hidden; }
        .is-chat-screen .profile-shell { display: flex; flex-direction: column; flex: 1; min-height: 0; width: 100%; }
        .is-chat-screen .profile-layout { display: flex; flex-direction: column; flex: 1; min-height: 0; }
        .is-chat-screen #chat-view { display: flex; flex: 1; min-height: 0; padding: 0; border-radius: 18px; box-shadow: none; animation: none; }
        .is-chat-screen .messenger { display: block; flex: 1; width: 100%; height: 100%; min-height: 0; }
        .is-chat-screen .chat-list-panel, .is-chat-screen .conversation-panel { min-height: 0; }
        .conversation-header { flex: 0 0 auto; min-height: 60px; padding: 8px 12px; gap: 10px; }
        .conversation-header > div { min-width: 0; flex: 1; }
        .conversation-name { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
        .conversation-header .presence-status { font-size: 11px; }
        .conversation-header .inbox-avatar, .conversation-header .inbox-avatar-placeholder { width: 36px; height: 36px; flex-basis: 36px; }
        #back-to-chats { width: 40px; height: 44px; flex-basis: 40px; border: 0; background: transparent; font-size: 30px; }
        .conversation-panel .chat-messages { flex: 1 1 0; min-height: 0; padding: 12px; overscroll-behavior: contain; }
        .chat-bubble { max-width: 88%; padding: 9px 11px; }
        .conversation-panel .chat-form { --send-button-size: 44px; --send-button-gap: 3px; --send-button-inset: 0px; flex: 0 0 auto; padding: 8px 10px 4px; align-items: end; }
        .message-input-shell { border-radius: 24px; }
        .conversation-panel .message-input-shell textarea { min-height: 44px; padding: 10px 4px 10px 14px; line-height: 22px; }
        .message-input-shell .emoji-toggle { width: 42px; height: 42px; flex-basis: 42px; margin: 1px 3px 1px 0; padding: 4px; }
        .message-input-shell .emoji-toggle img { width: 34px; height: 34px; }
        .conversation-panel #send-status { padding: 6px 12px 0; font-size: 11px; }
        .welcome-screen.is-conversation-screen { padding: 0; background: var(--theme-canvas, #0c0b1d); }
        .is-conversation-screen > .profile-nav, .is-conversation-screen .profile-topbar { display: none; }
        .is-conversation-screen .profile-layout { margin: 0; }
        .is-conversation-screen #chat-view { border: 0; border-radius: 0; }
        .is-conversation-screen .conversation-header { padding-top: calc(8px + env(safe-area-inset-top)); padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
        .is-conversation-screen .chat-form { padding-bottom: calc(4px + env(safe-area-inset-bottom)); padding-left: max(10px, env(safe-area-inset-left)); padding-right: max(10px, env(safe-area-inset-right)); }
      }
      /* Desktop dock: the same width as the content, directly below the chat. */
      @media (min-width: 701px) {
        .welcome-screen {
          --desktop-nav-height: 88px;
          --desktop-nav-bottom: 24px;
          --desktop-header-top: 24px;
          --desktop-header-height: 76px;
          --desktop-content-width: min(calc(100vw - 48px), 1280px);
          padding: calc(var(--desktop-header-top) + var(--desktop-header-height) + 16px) 24px calc(var(--desktop-nav-height) + var(--desktop-nav-bottom) + 8px);
          overflow-x: hidden;
          scroll-padding-top: calc(var(--desktop-header-top) + var(--desktop-header-height) + 16px);
          scroll-padding-bottom: calc(var(--desktop-nav-height) + var(--desktop-nav-bottom) + 16px);
        }
        .profile-shell {
          width: var(--desktop-content-width);
          margin-left: max(0px, calc((100vw - 48px - 1280px) / 2));
          margin-right: 0;
        }
        .profile-topbar {
          position: fixed;
          top: var(--desktop-header-top);
          left: 50%;
          z-index: 20;
          display: flex;
          width: var(--desktop-content-width);
          height: var(--desktop-header-height);
          transform: translateX(-50%);
        }
        .profile-layout { margin-top: 0; }
        .profile-nav {
          position: fixed;
          top: auto;
          bottom: var(--desktop-nav-bottom);
          left: 50%;
          right: auto;
          z-index: 20;
          display: flex;
          gap: 4px;
          width: var(--desktop-content-width);
          max-width: none;
          height: var(--desktop-nav-height);
          margin: 0;
          padding: 6px;
          overflow: visible;
          border: 2px solid transparent;
          border-radius: 999px;
          background: linear-gradient(110deg, #100d21, #090f20) padding-box, linear-gradient(100deg, #741bd6, #3225ba 55%, #1645b9) border-box;
          box-shadow: 0 12px 32px #0006, inset 0 1px 0 #ffffff08;
          transform: translateX(-50%);
        }
        .profile-nav-button {
          display: flex;
          flex: 1 1 0;
          flex-direction: row;
          align-items: center;
          justify-content: center;
          gap: 20px;
          min-width: 0;
          min-height: 0;
          padding: 10px 14px;
          border: 1px solid transparent;
          border-radius: 999px;
          background: transparent;
          color: #bdbacb;
          font-size: 16px;
          line-height: 1.2;
          font-weight: 600;
          backdrop-filter: none;
          -webkit-backdrop-filter: none;
          transform: none;
          transition: background 200ms ease, color 200ms ease, box-shadow 200ms ease;
        }
        .profile-nav-icon { display: block; flex: 0 0 38px; width: 38px; height: 38px; }
        .profile-nav-icon svg { display: block; width: 100%; height: 100%; }
        .profile-nav-icon:has(.desktop-nav-symbol) > svg:not(.desktop-nav-symbol) { display: none; }
        .profile-nav-icon .desktop-nav-symbol { display: block; }
        .profile-nav-button:hover { background: #7631bd20; border-color: transparent; color: #f1eaff; transform: none; }
        .profile-nav-button.active, .profile-nav-button.active:hover {
          color: #fff;
          border-color: transparent;
          background: radial-gradient(ellipse at 50% 110%, #9a42ff 0%, #650fe999 25%, transparent 65%), linear-gradient(110deg, #290858, #260958);
          box-shadow: inset 0 -2px 8px #a64cff88, 0 0 18px #7800ff26;
          transform: none;
        }
        .profile-nav-button.active .profile-nav-icon { filter: drop-shadow(0 0 5px #b880ff); }
        .profile-nav-button:focus-visible { outline: 2px solid #d5b4ff; outline-offset: -4px; transform: none; }
        .profile-nav-badge { top: 7px; right: 12px; left: auto; }
        .welcome-screen.is-chat-screen { display: flex; flex-direction: column; overflow: hidden; }
        .is-chat-screen .profile-shell { display: flex; flex-direction: column; flex: 1; min-height: 0; }
        .is-chat-screen .profile-topbar { flex-shrink: 0; }
        .is-chat-screen .profile-layout { flex: 1; min-height: 0; }
        .is-chat-screen #chat-view { min-height: 0; }
        .is-chat-screen .messenger { height: 100%; min-height: 0; }
      }
      @media (min-width: 701px) and (max-width: 1000px) {
        .profile-nav-button { gap: 10px; padding: 10px 8px; font-size: 13px; }
        .profile-nav-icon { flex-basis: 30px; width: 30px; height: 30px; }
      }
      @media (prefers-reduced-motion: reduce) {
        .profile-nav-button { transition: none; }
      }
