@import url('https://fonts.googleapis.com/css2?family=Inter:wght@200;300;400;500&display=swap');

* {
    -webkit-tap-highlight-color: transparent;
    box-sizing: border-box;
}

html, body {
    font-family: 'Inter', sans-serif;
    background: #0F0F10;
    color: rgba(255, 255, 255, 0.9);
    height: 100%;
    width: 100%;
    overflow: hidden;
    position: fixed;
    font-weight: 300;
}

body {
    overscroll-behavior: none;
    -webkit-overflow-scrolling: auto;
}

.accent-orange { color: #FF8C42; }
.bg-accent-orange { background-color: #FF8C42; }
.border-accent-orange { border-color: #FF8C42; }

.air-transition {
    transition: all 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.contacts-container {
    max-height: 90px;
    overflow: hidden;
    position: relative;
}

.contacts-container.expanded {
    max-height: 480px;
}

.contacts-container::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(to bottom, transparent, #0F0F10);
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.5s;
}

.contacts-container.expanded::after {
    opacity: 0;
}

.contacts-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    padding: 4px;
}

.contact-avatar {
    aspect-ratio: 1;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.1);
    overflow: hidden;
    transition: all 0.4s;
    opacity: 0.7;
    filter: grayscale(30%);
}

.contact-avatar:hover {
    opacity: 1;
    filter: grayscale(0%);
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(255,140,66,0.3);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #FF8C42;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.user-avatar:hover {
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(255,140,66,0.5);
}

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

.user-avatar::after {
    content: '';
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 8px;
    height: 8px;
    background: #FF8C42;
    border: 2px solid #0F0F10;
    border-radius: 50%;
}

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

.expand-btn {
    position: relative;
    z-index: 10;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 16px auto 0;
    transition: all 0.5s;
    background: #0F0F10;
}

.expand-btn:hover {
    background: rgba(255,140,66,0.2);
    border-color: #FF8C42;
    transform: rotate(180deg);
}

.contacts-container.expanded + .expand-btn-wrapper .expand-btn {
    transform: rotate(180deg);
}

.btn-plus {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255,140,66,0.15);
    border: 1px solid rgba(255,140,66,0.4);
    color: #FF8C42;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 20px;
    line-height: 1;
}

.btn-plus:hover {
    background: #FF8C42;
    color: #0F0F10;
    transform: rotate(90deg);
}

.search-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 15, 16, 0.95);
    backdrop-filter: blur(30px);
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transform: scale(0.95);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.search-modal.active {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1);
}

.search-input-wrapper {
    transform: translateY(-20px);
    opacity: 0;
    transition: all 0.6s 0.1s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-modal.active .search-input-wrapper {
    transform: translateY(0);
    opacity: 1;
}

.search-input {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(255,255,255,0.2);
    font-size: 32px;
    font-weight: 200;
    color: white;
    outline: none;
    padding: 20px 0;
    letter-spacing: -0.02em;
}

.search-input:focus {
    border-bottom-color: #FF8C42;
}

.search-input::placeholder {
    color: rgba(255,255,255,0.2);
}

.search-results {
    margin-top: 40px;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.5s 0.2s;
}

.search-modal.active .search-results {
    opacity: 1;
    transform: translateY(0);
}

.air-line {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,140,66,0.3), transparent);
}

.thin {
    font-weight: 200;
    letter-spacing: 0.02em;
}

.screen {
    position: absolute;
    inset: 0;
    overflow: hidden;
    background: #0F0F10;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s;
    display: flex;
    flex-direction: column;
}

.screen.hidden-right {
    transform: translateX(30%);
    opacity: 0;
    pointer-events: none;
}

.screen.hidden-left {
    transform: translateX(-30%);
    opacity: 0;
    pointer-events: none;
}

.screen.hidden-back {
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
}

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

.safe-top {
    padding-top: env(safe-area-inset-top);
}

.safe-bottom {
    padding-bottom: env(safe-area-inset-bottom);
}

.profile-avatar-large {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 3px solid #FF8C42;
    overflow: hidden;
    margin: 0 auto 20px;
    position: relative;
    cursor: pointer;
    transition: all 0.4s;
}

.profile-avatar-large:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(255,140,66,0.2);
}

.profile-avatar-large img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-upload-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 15, 16, 0.6);
    backdrop-filter: blur(2px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.4s;
    color: rgba(255,255,255,0.9);
}

.profile-avatar-large:hover .avatar-upload-overlay {
    opacity: 1;
}

.humanoid-section {
    background: rgba(255,140,66,0.03);
    border: 1px solid rgba(255,140,66,0.1);
    border-radius: 24px;
    padding: 32px 24px;
    margin-top: 32px;
}

.input-field {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(255,255,255,0.12);
    border-radius: 0;
    padding: 16px 0;
    color: white;
    font-size: 18px;
    font-weight: 200;
    margin-bottom: 28px;
    outline: none;
    transition: all 0.4s;
    font-family: 'Inter', sans-serif;
    letter-spacing: 0.02em;
}

.input-field:focus {
    border-bottom-color: #FF8C42;
    background: transparent;
    box-shadow: none;
}

.input-field::placeholder {
    color: rgba(255,255,255,0.25);
    font-weight: 200;
}

.input-field.error {
    border-bottom-color: #EF4444;
    animation: shake 0.5s ease;
}

.input-field.error::placeholder {
    color: #EF4444;
    opacity: 0.7;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

select.input-field {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%23FF8C42' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0 center;
    padding-right: 20px;
    cursor: pointer;
}

.btn-primary {
    width: 100%;
    background: transparent;
    color: #FF8C42;
    border: none;
    border-bottom: 1px solid rgba(255,140,66,0.3);
    border-radius: 0;
    padding: 16px 0;
    font-size: 14px;
    font-weight: 300;
    cursor: pointer;
    transition: all 0.4s;
    margin-top: 40px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    position: relative;
    overflow: hidden;
}

.btn-primary:hover:not(:disabled) {
    border-bottom-color: #FF8C42;
    color: #fff;
    letter-spacing: 0.2em;
}

.btn-primary:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    border-bottom-color: rgba(255,140,66,0.1);
}

.avatar-selector {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin: 20px 0;
}

.avatar-option {
    aspect-ratio: 1;
    border-radius: 50%;
    border: 2px solid transparent;
    overflow: hidden;
    cursor: pointer;
    opacity: 0.5;
    transition: all 0.3s;
}

.avatar-option:hover {
    opacity: 0.8;
}

.avatar-option.selected {
    opacity: 1;
    border-color: #FF8C42;
    box-shadow: 0 0 15px rgba(255,140,66,0.4);
}

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

.style-slider {
    width: 100%;
    height: 3px;
    border-radius: 2px;
    background: rgba(255,255,255,0.1);
    outline: none;
    -webkit-appearance: none;
    margin: 24px 0;
}

.style-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #FF8C42;
    cursor: pointer;
    box-shadow: 0 0 12px rgba(255,140,66,0.4);
    transition: transform 0.2s;
}

.style-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.humanoid-header-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid #FF8C42;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    margin-right: 12px;
    animation: pulse-orange 2s infinite;
}

@keyframes pulse-orange {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255,140,66,0.4); }
    50% { box-shadow: 0 0 0 8px rgba(255,140,66,0); }
}

.humanoid-header-avatar:hover {
    transform: scale(1.1);
}

.humanoid-header-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.badge-ai {
    position: absolute;
    bottom: -4px;
    right: -4px;
    background: #FF8C42;
    color: #0F0F10;
    font-size: 8px;
    font-weight: bold;
    padding: 2px 4px;
    border-radius: 4px;
    border: 2px solid #0F0F10;
}

.auth-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 40px 24px;
    position: relative;
}

.auth-logo {
    font-size: 48px;
    font-weight: 200;
    margin-bottom: 8px;
    letter-spacing: -0.05em;
    background: linear-gradient(135deg, #FF8C42 0%, #FFB347 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-subtitle {
    font-size: 14px;
    color: rgba(255,255,255,0.4);
    margin-bottom: 48px;
    text-align: center;
    font-weight: 300;
}

.auth-form {
    width: 100%;
    max-width: 320px;
}

.input-group {
    position: relative;
    margin-bottom: 32px;
}

.auth-input {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(255,255,255,0.15);
    border-radius: 0;
    padding: 16px 0;
    font-size: 22px;
    font-weight: 200;
    color: white;
    outline: none;
    transition: all 0.4s;
    font-family: 'Inter', sans-serif;
    letter-spacing: 0.02em;
}

.auth-input:focus {
    border-bottom-color: #FF8C42;
    background: transparent;
    box-shadow: none;
}

.auth-input::placeholder {
    color: rgba(255,255,255,0.25);
    font-weight: 200;
}

.nickname-wrapper {
    position: relative;
    display: flex;
    align-items: baseline;
    border-bottom: 1px solid rgba(255,255,255,0.15);
    transition: all 0.4s;
}

.nickname-wrapper:focus-within {
    border-bottom-color: #FF8C42;
}

.nickname-prefix {
    color: rgba(255,140,66,0.8);
    font-size: 22px;
    font-weight: 300;
    padding-right: 4px;
    letter-spacing: 0.02em;
}

.nickname-input {
    border: none !important;
    padding-left: 0 !important;
    flex: 1;
    background: transparent !important;
}

.check-btn {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: rgba(255,140,66,0.7);
    font-size: 12px;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.3s;
    letter-spacing: 0.05em;
    padding: 4px 0;
    border-bottom: 1px solid transparent;
}

.check-btn:hover {
    color: #FF8C42;
    border-bottom-color: #FF8C42;
}

.availability-status {
    position: absolute;
    right: 0;
    top: -20px;
    font-size: 11px;
    display: none;
    font-weight: 400;
    letter-spacing: 0.05em;
}

.availability-status.available {
    display: block;
    color: #4ADE80;
}

.availability-status.taken {
    display: block;
    color: #EF4444;
}

.auth-button {
    width: 100%;
    background: transparent;
    color: #FF8C42;
    border: none;
    border-bottom: 1px solid rgba(255,140,66,0.3);
    border-radius: 0;
    padding: 16px 0;
    font-size: 16px;
    font-weight: 300;
    cursor: pointer;
    transition: all 0.4s;
    margin-top: 40px;
    position: relative;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.auth-button:hover:not(:disabled) {
    border-bottom-color: #FF8C42;
    color: #fff;
    letter-spacing: 0.15em;
}

.auth-button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    border-bottom-color: rgba(255,140,66,0.1);
}

.auth-button .loading-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,140,66,0.3);
    border-top-color: #FF8C42;
    margin-right: 8px;
}

.auth-link {
    text-align: center;
    margin-top: 32px;
    color: rgba(255,255,255,0.3);
    font-size: 13px;
    font-weight: 300;
}

.auth-link a {
    color: rgba(255,140,66,0.8);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s;
    border-bottom: 1px solid transparent;
    padding-bottom: 2px;
}

.auth-link a:hover {
    color: #FF8C42;
    border-bottom-color: #FF8C42;
}

.auth-divider {
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    margin: 32px 0;
}

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: #FF8C42;
    animation: spin 0.8s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.demo-badge {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255,140,66,0.1);
    border: 1px solid rgba(255,140,66,0.2);
    color: rgba(255,140,66,0.6);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    font-weight: 400;
}

/* === СТИЛИ ДЛЯ ЧАТ-ХЕДЕРА === */
.chat-header-full {
    flex-shrink: 0;
    padding: 3rem 2rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    background: #0F0F10;
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.chat-header-full.hidden {
    opacity: 0;
    transform: translateY(-100%);
    height: 0;
    padding: 0;
    border: none;
}

.chat-header-compact {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 100;
    display: none;
    align-items: center;
    gap: 12px;
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.chat-header-compact.visible {
    display: flex;
}

@keyframes popIn {
    0% { transform: scale(0) rotate(-180deg); opacity: 0; }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.user-circle-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 2px solid #FF8C42;
    background: #0F0F10;
    color: #FF8C42;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 0 30px rgba(255,140,66,0.3), inset 0 0 20px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
    font-family: 'Inter', sans-serif;
    letter-spacing: -0.05em;
}

.user-circle-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 0 40px rgba(255,140,66,0.4), inset 0 0 20px rgba(0,0,0,0.1);
}

.back-arrow-compact {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(15,15,16,0.8);
    backdrop-filter: blur(10px);
    color: rgba(255,255,255,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.back-arrow-compact:hover {
    border-color: #FF8C42;
    color: #FF8C42;
    transform: translateX(-2px);
}

/* === ИСПРАВЛЕННЫЕ СТИЛИ ДЛЯ ЧАТА === */
#screen-chat {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    position: relative;
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    -webkit-overflow-scrolling: touch;
}

.messages-wrapper {
    padding: 1rem 2rem;
    min-height: 100%;
}

.messages-wrapper.with-header {
    padding-top: 1rem;
}

.messages-wrapper.full-height {
    padding-top: 0;
}

.chat-input-fixed {
    flex-shrink: 0;
    background: #0F0F10;
    border-top: 1px solid rgba(255,255,255,0.05);
    padding: 1rem 2rem;
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
    position: relative;
    z-index: 10;
}

@media (max-width: 768px) {
    .chat-input-fixed {
        padding: 0.75rem 1rem;
        padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
    }
    .messages-wrapper {
        padding: 1rem;
    }
}

@supports (-webkit-touch-callout: none) {
    .message-input {
        font-size: 16px;
    }
}

@media (max-width: 640px) {
    .chat-header-compact {
        top: 16px;
        left: 16px;
    }
    .user-circle-btn {
        width: 48px;
        height: 48px;
        font-size: 20px;
    }
    .back-arrow-compact {
        width: 36px;
        height: 36px;
    }
}

/* === ИСПРАВЛЕННОЕ ПОЛЕ ВВОДА === */
.input-container {
    position: relative;
    width: 100%;
    display: flex;
    align-items: flex-end;
    gap: 12px;
    padding: 8px 48px 8px 0;
}

.message-input {
    flex: 1;
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding: 12px 0;
    font-size: 16px;
    font-weight: 300;
    color: white;
    outline: none;
    transition: all 0.4s;
    font-family: 'Inter', sans-serif;
    letter-spacing: 0.02em;
    resize: none;
    min-height: 24px;
    max-height: 120px;
    line-height: 1.5;
    overflow-y: auto;
    width: 100%;
}

.message-input:focus {
    border-bottom-color: #FF8C42;
}

.message-input::placeholder {
    color: rgba(255,255,255,0.2);
}

.message-input::-webkit-scrollbar {
    display: none;
}

.attach-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: rgba(160, 160, 170, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    padding: 0;
    margin-bottom: 4px;
}

.attach-btn:hover {
    color: rgba(160, 160, 170, 0.9);
    transform: scale(1.1);
    background: rgba(160, 160, 170, 0.08);
}

.attach-btn:active {
    transform: scale(0.95);
}

.attach-btn svg {
    width: 22px;
    height: 22px;
    stroke-width: 1.8;
    transition: transform 0.3s ease;
}

.attach-btn:hover svg {
    transform: rotate(-45deg);
}

.file-input {
    display: none;
}

/* === ИСПРАВЛЕННАЯ СТРЕЛКА ОТПРАВКИ === */
.send-arrow {
    position: absolute;
    right: 0;
    bottom: 12px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 140, 66, 0.1);
    border: 1px solid rgba(255, 140, 66, 0.3);
    color: #FF8C42;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    z-index: 10;
}

.send-arrow.visible {
    opacity: 1;
    pointer-events: auto;
}

.send-arrow:hover {
    background: rgba(255, 140, 66, 0.2);
    transform: scale(1.1);
}

.send-arrow:active {
    transform: scale(0.95);
}

.success-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 140, 66, 0.3);
    border-radius: 16px;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 1000;
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3), 0 0 20px rgba(255, 140, 66, 0.1);
}

.success-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.success-toast-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 140, 66, 0.15);
    border: 1px solid rgba(255, 140, 66, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #FF8C42;
    flex-shrink: 0;
}

.success-toast-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.success-toast-title {
    font-size: 14px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.9);
    letter-spacing: 0.02em;
}

.success-toast-subtitle {
    font-size: 12px;
    font-weight: 300;
    color: rgba(255, 255, 255, 0.5);
}

.required-label {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.required-label::after {
    content: '*';
    color: #FF8C42;
    font-size: 10px;
    opacity: 0.8;
}

.field-error-hint {
    font-size: 11px;
    color: #EF4444;
    margin-top: -20px;
    margin-bottom: 12px;
    opacity: 0;
    transform: translateY(-5px);
    transition: all 0.3s ease;
    height: 0;
    overflow: hidden;
}

.field-error-hint.show {
    opacity: 1;
    transform: translateY(0);
    height: auto;
}

.pin-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    transform: scale(0.8);
    margin-left: 6px;
    flex-shrink: 0;
    position: relative;
    z-index: 10;
    padding: 8px;
    margin: -4px;
}

.chat-item:hover .pin-btn {
    opacity: 1;
    transform: scale(1);
}

.pin-btn:hover {
    color: #FF8C42;
    transform: scale(1.2) rotate(-15deg);
    background: rgba(255, 140, 66, 0.1);
}

.pin-btn.pinned {
    opacity: 1;
    color: #FF8C42;
    transform: scale(1);
}

.pin-btn.pinned:hover {
    transform: scale(1.1) rotate(0deg);
}

.pin-btn svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
    transition: all 0.3s ease;
    pointer-events: none;
}

.chat-item-wrapper {
    position: relative;
    overflow: hidden;
    touch-action: pan-y;
    user-select: none;
}

.chat-item {
    position: relative;
    z-index: 2;
    background: #0F0F10;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    padding-left: 12px;
}

.chat-item.swiping {
    transition: none;
}

.delete-bg {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 100%;
    background: linear-gradient(90deg, transparent 0%, rgba(239, 68, 68, 0.1) 30%, rgba(239, 68, 68, 0.3) 100%);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 24px;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.delete-bg.visible {
    opacity: 1;
}

.delete-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #EF4444;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: scale(0);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: none;
}

.delete-bg.visible .delete-icon {
    transform: scale(1);
}

.delete-icon svg {
    width: 20px;
    height: 20px;
}

.chat-item.deleting {
    animation: deleteSlide 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes deleteSlide {
    0% { transform: translateX(-100%); opacity: 1; }
    50% { transform: translateX(-100%); opacity: 0.5; }
    100% { transform: translateX(-100%) translateY(-20px); opacity: 0; height: 0; padding: 0; margin: 0; border: none; }
}

.pinned-section {
    margin-bottom: 16px;
}

.pinned-label {
    font-size: 10px;
    color: #FF8C42;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.pinned-label::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #FF8C42;
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(255, 140, 66, 0.5);
}

@keyframes pinPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

.pin-btn.pinned {
    animation: pinPulse 0.4s ease;
}

.chat-item.pinned-item {
    position: relative;
}

.chat-item.pinned-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 12px;
    bottom: 12px;
    width: 3px;
    background: #FF8C42;
    border-radius: 2px;
    box-shadow: 0 0 8px rgba(255, 140, 66, 0.4);
}

.chat-meta {
    display: flex;
    align-items: center;
    gap: 4px;
}

.undo-toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(15, 15, 16, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 140, 66, 0.3);
    border-radius: 24px;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    z-index: 1000;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

.undo-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.undo-text {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 300;
}

.undo-btn {
    background: transparent;
    border: none;
    color: #FF8C42;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    padding: 4px 12px;
    border-radius: 12px;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.undo-btn:hover {
    background: rgba(255, 140, 66, 0.15);
}

.chat-content {
    padding-left: 8px;
}

.pin-btn:active {
    transform: scale(0.9);
}

@media (pointer: coarse) {
    .pin-btn {
        opacity: 1;
        transform: scale(1);
        width: 32px;
        height: 32px;
    }
    .chat-item .pin-btn {
        opacity: 0.6;
    }
    .chat-item:hover .pin-btn, .pin-btn.pinned {
        opacity: 1;
    }
}

.skeleton-overlay {
    position: fixed;
    inset: 0;
    background: #0F0F10;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    opacity: 1;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

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

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.auth-skeleton-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 40px 24px;
    position: relative;
    width: 100%;
}

.skeleton-badge {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 28px;
    border-radius: 20px;
    background: linear-gradient(90deg, rgba(255,140,66,0.05) 25%, rgba(255,140,66,0.15) 50%, rgba(255,140,66,0.05) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border: 1px solid rgba(255,140,66,0.1);
}

.skeleton-logo {
    width: 140px;
    height: 48px;
    background: linear-gradient(90deg, rgba(255,140,66,0.1) 25%, rgba(255,140,66,0.2) 50%, rgba(255,140,66,0.1) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
    margin-bottom: 8px;
}

.skeleton-subtitle {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin-bottom: 48px;
}

.skeleton-subtitle-line {
    height: 14px;
    background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.03) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 7px;
}

.skeleton-subtitle-line:first-child {
    width: 200px;
}

.skeleton-subtitle-line:last-child {
    width: 160px;
}

.skeleton-auth-form {
    width: 100%;
    max-width: 320px;
}

.skeleton-input-group {
    margin-bottom: 32px;
    opacity: 0;
    animation: fadeInUp 0.4s ease forwards;
}

.skeleton-input-group:nth-child(1) { animation-delay: 0.1s; }
.skeleton-input-group:nth-child(2) { animation-delay: 0.2s; }
.skeleton-input-group:nth-child(3) { animation-delay: 0.3s; }

.skeleton-nickname-wrapper {
    display: flex;
    align-items: baseline;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    padding-bottom: 16px;
}

.skeleton-nickname-prefix {
    width: 60px;
    height: 22px;
    background: linear-gradient(90deg, rgba(255,140,66,0.1) 25%, rgba(255,140,66,0.2) 50%, rgba(255,140,66,0.1) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
    margin-right: 8px;
}

.skeleton-nickname-input {
    flex: 1;
    height: 22px;
    background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.03) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
}

.skeleton-check-btn {
    width: 70px;
    height: 20px;
    background: linear-gradient(90deg, rgba(255,140,66,0.08) 25%, rgba(255,140,66,0.15) 50%, rgba(255,140,66,0.08) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
    margin-left: 8px;
}

.skeleton-input {
    width: 100%;
    height: 22px;
    background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.03) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    padding-bottom: 16px;
}

.skeleton-button {
    width: 100%;
    height: 48px;
    background: linear-gradient(90deg, rgba(255,140,66,0.08) 25%, rgba(255,140,66,0.15) 50%, rgba(255,140,66,0.08) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
    margin-top: 40px;
    border-bottom: 1px solid rgba(255,140,66,0.15);
    opacity: 0;
    animation: fadeInUp 0.4s ease 0.4s forwards, shimmer 1.5s infinite;
}

.skeleton-divider-auth {
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.05), transparent);
    margin: 32px 0;
    opacity: 0;
    animation: fadeIn 0.4s ease 0.5s forwards;
}

@keyframes fadeIn {
    to { opacity: 1; }
}

.skeleton-link {
    display: flex;
    justify-content: center;
    gap: 8px;
    opacity: 0;
    animation: fadeInUp 0.4s ease 0.6s forwards;
}

.skeleton-link-text {
    width: 100px;
    height: 13px;
    background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.06) 50%, rgba(255,255,255,0.03) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
}

.skeleton-link-action {
    width: 60px;
    height: 13px;
    background: linear-gradient(90deg, rgba(255,140,66,0.1) 25%, rgba(255,140,66,0.2) 50%, rgba(255,140,66,0.1) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
}

.skeleton-header {
    padding: 3rem 1.5rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.skeleton-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.skeleton-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.03) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border: 2px solid rgba(255,140,66,0.3);
}

.skeleton-title-block {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.skeleton-line-title {
    width: 80px;
    height: 10px;
    background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.03) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 5px;
}

.skeleton-line-subtitle {
    width: 120px;
    height: 20px;
    background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.03) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 5px;
}

.skeleton-header-right {
    display: flex;
    gap: 12px;
}

.skeleton-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.03) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border: 1px solid rgba(255,255,255,0.1);
}

.skeleton-favorites {
    padding: 0 2rem 1.5rem;
}

.skeleton-favorites-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.skeleton-fav-label {
    width: 60px;
    height: 10px;
    background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.03) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 5px;
}

.skeleton-fav-count {
    width: 70px;
    height: 10px;
    background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.03) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 5px;
}

.skeleton-contacts-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 16px;
}

.skeleton-contact-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.skeleton-contact-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.03) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border: 1px solid rgba(255,255,255,0.05);
}

.skeleton-contact-name {
    width: 50px;
    height: 10px;
    background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.03) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 5px;
}

.skeleton-expand-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.03) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border: 1px solid rgba(255,255,255,0.1);
    margin: 0 auto;
}

.skeleton-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,140,66,0.1), transparent);
    margin: 0 2rem 1.5rem;
}

.skeleton-chat-list {
    flex: 1;
    padding: 0 2rem;
    overflow: hidden;
}

.skeleton-recent-label {
    width: 50px;
    height: 10px;
    background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.03) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 5px;
    margin-bottom: 16px;
}

.skeleton-chat-item {
    display: flex;
    gap: 12px;
    padding: 20px 0;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    opacity: 0;
    animation: fadeInUp 0.4s ease forwards;
}

.skeleton-chat-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.03) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    flex-shrink: 0;
}

.skeleton-chat-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.skeleton-chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.skeleton-chat-name {
    width: 100px;
    height: 16px;
    background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.03) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 8px;
}

.skeleton-chat-time {
    width: 40px;
    height: 12px;
    background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.03) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 6px;
}

.skeleton-chat-message {
    width: 70%;
    height: 14px;
    background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.03) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 7px;
}

.skeleton-chat-item:nth-child(1) { animation-delay: 0.1s; }
.skeleton-chat-item:nth-child(2) { animation-delay: 0.2s; }
.skeleton-chat-item:nth-child(3) { animation-delay: 0.3s; }
.skeleton-chat-item:nth-child(4) { animation-delay: 0.4s; }

.connection-status {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    padding: 8px;
    background: rgba(255, 140, 66, 0.1);
    border-bottom: 1px solid rgba(255, 140, 66, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    z-index: 10000;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
}

.connection-status.show {
    transform: translateY(0);
}

.connection-status.offline {
    background: rgba(239, 68, 68, 0.1);
    border-bottom-color: rgba(239, 68, 68, 0.2);
}

.connection-status-text {
    font-size: 12px;
    color: #FF8C42;
    font-weight: 300;
    letter-spacing: 0.05em;
}

.connection-status.offline .connection-status-text {
    color: #EF4444;
}

.pulse-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #FF8C42;
    animation: pulse 1.5s infinite;
}

.connection-status.offline .pulse-dot {
    background: #EF4444;
    animation: none;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2); }
}

.refresh-spinner {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 24px;
    height: 24px;
    border: 2px solid rgba(255,140,66,0.2);
    border-top-color: #FF8C42;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    z-index: 10001;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.refresh-spinner.show {
    opacity: 1;
}

.error-message {
    color: #EF4444;
    font-size: 12px;
    margin-top: -20px;
    margin-bottom: 20px;
    display: none;
}

.error-message.show {
    display: block;
}

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 20px;
    border: 1px solid rgba(255, 140, 66, 0.1);
    max-width: 80px;
    animation: typingAppear 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes typingAppear {
    from { opacity: 0; transform: translateY(10px) scale(0.9); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: #FF8C42;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out both;
    box-shadow: 0 0 10px rgba(255, 140, 66, 0.5);
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }
.typing-dot:nth-child(3) { animation-delay: 0s; }

@keyframes typingBounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; box-shadow: 0 0 15px rgba(255, 140, 66, 0.8); }
}

.typing-wrapper {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 16px;
    animation: floatIn 0.4s ease;
}

.typing-label {
    font-size: 11px;
    color: rgba(255, 140, 66, 0.6);
    margin-left: 12px;
    margin-top: 4px;
    font-weight: 300;
    letter-spacing: 0.05em;
    opacity: 0;
    animation: fadeIn 0.3s ease 0.2s forwards;
}

@keyframes fadeIn {
    to { opacity: 1; }
}

.typing-indicator::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 22px;
    background: linear-gradient(135deg, rgba(255, 140, 66, 0.1), transparent, rgba(255, 140, 66, 0.05));
    z-index: -1;
    opacity: 0;
    animation: glowPulse 2s infinite;
}

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

/* === ИСПРАВЛЕННЫЕ СТИЛИ ДЛЯ СООБЩЕНИЙ === */
.message-bubble {
    max-width: 75%;
    padding: 12px 16px;
    animation: floatIn 0.4s ease;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.message-bubble p {
    margin: 0;
    font-size: 15px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.message-user {
    background: rgba(255, 140, 66, 0.1);
    border-radius: 20px 20px 4px 20px;
    margin-left: auto;
    border: 1px solid rgba(255, 140, 66, 0.2);
}

.message-clone {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px 20px 20px 4px;
    margin-right: auto;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

@keyframes floatIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.message-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
    gap: 8px;
}

.message-time {
    font-size: 11px;
    color: rgba(255,255,255,0.4);
}

.save-btn {
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.3);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.save-btn:hover {
    color: #FF8C42;
    background: rgba(255,140,66,0.1);
}

.save-btn.saved {
    color: #4ADE80;
    background: rgba(74, 222, 128, 0.1);
}

.save-btn.saved svg {
    fill: currentColor;
}

@keyframes checkPop {
    0% { transform: scale(0); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

.save-btn.saved svg {
    animation: checkPop 0.3s ease;
}

#header-humanoid-container.hidden,
#humanoid-chat-item.hidden {
    display: none !important;
}

#header-humanoid-container:not(.hidden) {
    display: flex !important;
}

#humanoid-chat-item:not(.hidden) {
    display: block !important;
}

/* === СТИЛИ ДЛЯ ПОИСКА КЛОНОВ === */
.search-tab {
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.3);
    font-size: 12px;
    padding: 8px 16px;
    cursor: pointer;
    transition: all 0.3s;
    border-bottom: 2px solid transparent;
}

.search-tab.active {
    color: #FF8C42;
    border-bottom-color: #FF8C42;
}

.clone-search-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: rgba(255,255,255,0.03);
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.05);
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 12px;
}

.clone-search-item:hover {
    background: rgba(255,140,66,0.05);
    border-color: rgba(255,140,66,0.2);
}

.clone-search-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid #FF8C42;
    overflow: hidden;
    flex-shrink: 0;
}

.clone-search-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.clone-search-info {
    flex: 1;
    min-width: 0;
}

.clone-search-name {
    font-size: 16px;
    color: white;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.clone-search-owner {
    font-size: 12px;
    color: rgba(255,255,255,0.4);
}

.clone-search-profession {
    font-size: 11px;
    color: #FF8C42;
    margin-top: 4px;
}

.add-clone-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,140,66,0.1);
    border: 1px solid rgba(255,140,66,0.3);
    color: #FF8C42;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    flex-shrink: 0;
}

.add-clone-btn:hover {
    background: #FF8C42;
    color: #0F0F10;
}

.add-clone-btn.added {
    background: #4ADE80;
    border-color: #4ADE80;
    color: #0F0F10;
}

.external-clone-badge {
    display: inline-block;
    font-size: 10px;
    background: rgba(100, 200, 255, 0.2);
    color: #64C8FF;
    padding: 2px 8px;
    border-radius: 12px;
}
.wiki-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: rgba(160, 160, 170, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    padding: 0;
    margin-bottom: 4px;
    margin-right: 8px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 36px;
}

/* При наведении — оранжевая как акцент */
.wiki-btn:hover {
    color: #FF8C42;
    transform: scale(1.1);
    background: rgba(255, 140, 66, 0.1);
}

/* При нажатии — эффект "вдавливания" */
.wiki-btn:active {
    transform: scale(0.95);
    background: rgba(255, 140, 66, 0.2);
}

/* Если хочешь показывать "режим активен" (опционально) */
.wiki-btn.active {
    color: #FF8C42;
    background: rgba(255, 140, 66, 0.15);
    border: 1px solid rgba(255, 140, 66, 0.3);
}
/* Активное состояние (зажата) */
.wiki-btn.active {
    color: #FF8C42;
    background: rgba(255, 140, 66, 0.2);
    border: 1px solid rgba(255, 140, 66, 0.5);
    box-shadow: 0 0 10px rgba(255, 140, 66, 0.3);
}

/* Мигающий индикатор когда активен */
.wiki-btn.active::after {
    content: '';
    position: absolute;
    top: 2px;
    right: 2px;
    width: 6px;
    height: 6px;
    background: #FF8C42;
    border-radius: 50%;
    box-shadow: 0 0 5px #FF8C42;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}
/* === АДАПТИВНОСТЬ РЕФЕРАЛЬНОГО БЛОКА === */

/* Мобильные устройства (до 640px) */
@media (max-width: 640px) {
    #referral-section {
        padding: 20px 16px !important;
        margin-top: 16px !important;
    }
    
    #referral-section h4 {
        font-size: 16px !important;
    }
    
    #referral-section p {
        font-size: 11px !important;
        margin-bottom: 12px !important;
    }
    
    /* Ссылка - делаем компактнее */
    #referral-section .bg-white\\/5.rounded-xl.p-4 {
        padding: 12px !important;
    }
    
    #referral-section .flex.gap-2 {
        flex-direction: column !important;
        gap: 8px !important;
    }
    
    #referral-section input {
        font-size: 12px !important;
        padding: 10px !important;
        margin-bottom: 0 !important;
    }
    
    #referral-section button {
        width: 100% !important;
        padding: 10px !important;
        font-size: 12px !important;
    }
    
    /* Баланс - в одну строку */
    #referral-section .grid.grid-cols-2 {
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
    }
    
    #referral-section .grid .bg-white\\/5 {
        padding: 12px 8px !important;
    }
    
    #referral-section .text-2xl {
        font-size: 18px !important;
    }
    
    /* Переключатель */
    #referral-section .flex.items-center.justify-between {
        flex-direction: column !important;
        gap: 12px !important;
        text-align: center !important;
        padding: 12px !important;
    }
}

/* Очень маленькие экраны (до 380px) */
@media (max-width: 380px) {
    #referral-section .grid.grid-cols-2 {
        grid-template-columns: 1fr !important;
    }
}
/* === СТИЛИ ДЛЯ СТАТУСА ПРОВЕРКИ НИКА === */
.availability-status {
    position: absolute;
    right: 0;
    top: -20px;
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 0.05em;
    display: none;
}

.availability-status.available {
    display: block;
    color: #4ADE80 !important;
}

.availability-status.taken {
    display: block;
    color: #EF4444 !important;
}

.availability-status.text-green-400 {
    color: #4ADE80 !important;
    display: block;
}

.availability-status.text-red-400 {
    color: #EF4444 !important;
    display: block;
}

.availability-status.text-yellow-400 {
    color: #FBBF24 !important;
    display: block;
}

/* Стили для спиннера загрузки */
.availability-status .loading-spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid rgba(255,140,66,0.3);
    border-radius: 50%;
    border-top-color: #FF8C42;
    animation: spin 0.8s linear infinite;
    margin-right: 4px;
    vertical-align: middle;
}

/* Убедимся что старые классы не мешают */
.availability-status.available,
.availability-status.taken,
.availability-status.text-green-400,
.availability-status.text-red-400,
.availability-status.text-yellow-400 {
    display: block !important;
}