* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    touch-action: pan-y;
}

.app-container {
    max-width: 400px;
    width: 100%;
    min-height: 600px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    margin: 20px;
    position: relative;
}

.loading-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 600px;
}

.loader {
    border: 5px solid #f3f3f3;
    border-top: 5px solid #764ba2;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ====================== ЭКРАН РЕГИСТРАЦИИ ====================== */
.profile-screen {
    padding: 40px 25px 180px 25px;
    height: 600px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #764ba2 #e0e0e0;
}

.profile-screen::-webkit-scrollbar {
    width: 6px;
}

.profile-screen::-webkit-scrollbar-thumb {
    background: #764ba2;
    border-radius: 10px;
}

.hidden {
    display: none !important;
}

.title {
    font-size: 28px;
    font-weight: 700;
    color: #333;
    margin-bottom: 40px;
    text-align: center;
}

.input-group {
    margin-bottom: 25px;
}

.input-group label {
    display: block;
    font-size: 14px;
    color: #666;
    margin-bottom: 8px;
    font-weight: 500;
}

.input-group input,
.input-group select {
    width: 100%;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 15px;
    font-size: 16px;
    transition: border-color 0.3s;
    background: white;
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: #764ba2;
}

/* Закреплённая кнопка "Сохранить и продолжить" */
.save-btn-container {
    position: sticky;
    bottom: 20px;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.98);
    padding: 15px 25px 20px 25px;
    margin: 0 -25px;
    z-index: 100;
    box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.15);
}

.vk-button {
    background: #0077ff;
    color: white;
    border: none;
    padding: 16px;
    border-radius: 15px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s, transform 0.1s;
    width: 100%;
    touch-action: manipulation;
}

.vk-button:hover {
    background: #0066cc;
}

.vk-button:active {
    transform: scale(0.98);
}

/* ====================== ОСНОВНОЙ ИНТЕРФЕЙС ====================== */
.main-interface {
    display: flex;
    flex-direction: column;
    height: 600px;
    padding: 25px;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.pet-info {
    font-size: 20px;
    font-weight: 600;
    color: #333;
    background: #f0f0f0;
    padding: 10px 20px;
    border-radius: 30px;
}

.edit-profile-btn, .upload-photo-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 50%;
    transition: background 0.3s;
}

.edit-profile-btn:hover, .upload-photo-btn:hover {
    background: #f0f0f0;
}

.tabs {
    display: flex;
    gap: 10px;
    margin: 10px 0 20px;
    flex-wrap: wrap;
}

.tab-btn {
    flex: 1 1 auto;
    padding: 12px;
    border: none;
    border-radius: 25px;
    background: #f0f0f0;
    font-size: 16px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: all 0.3s;
    touch-action: manipulation;
    min-width: 100px;
}

.tab-btn.active {
    background: #764ba2;
    color: white;
}

.tab-content {
    display: none;
    flex: 1;
    overflow-y: auto;
}

.tab-content.active {
    display: block;
}

/* Чат */
.chat-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.chat-messages {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 20px;
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    -webkit-overflow-scrolling: touch;
}

.chat-input-wrapper {
    flex: 0 0 auto;
    padding: 12px 16px 16px 16px;
    background: white;
    border-top: 1px solid #eee;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.06);
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;
}

.chat-input-area {
    display: flex;
    align-items: center;
    gap: 8px;
}

#chatInput {
    flex: 1;
    height: 48px;
    min-width: 120px;
    padding: 0 18px;
    border: 2px solid #e0e0e0;
    border-radius: 9999px;
    font-size: 16px;
    line-height: 44px;
    background: white;
}

#chatInput:focus {
    border-color: #764ba2;
    outline: none;
}

.send-btn, .clear-chat-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
    background: transparent;
    transition: opacity 0.2s, transform 0.1s;
}

.send-btn {
    background: #764ba2;
    color: white;
}

.clear-chat-btn {
    background: #d0d0d0;
    color: #555;
}

.send-btn:active, .clear-chat-btn:active {
    opacity: 0.7;
    transform: scale(0.96);
}

.chat-message {
    max-width: 80%;
    padding: 10px 15px;
    border-radius: 20px;
    margin-bottom: 10px;
    word-break: break-word;
}

.chat-message.user {
    align-self: flex-end;
    background: #764ba2;
    color: white;
    border-bottom-right-radius: 5px;
}

.chat-message.assistant {
    align-self: flex-start;
    background: #e0e0e0;
    color: #333;
    border-bottom-left-radius: 5px;
}

.chat-message.assistant.typing {
    font-style: italic;
    color: #999;
}

/* Гороскоп */
.horoscope-text {
    white-space: pre-wrap;
    word-break: break-word;
}

.horoscope-placeholder {
    color: #999;
    font-style: italic;
    text-align: center;
}

.horoscope-timer {
    text-align: center;
    margin-top: 15px;
    color: #666;
    font-size: 14px;
    font-style: italic;
}

/* Объявления */
.bulletin-container {
    padding: 16px;
}

.bulletin-title {
    text-align: center;
    font-size: 20px;
    font-weight: 600;
    color: #333;
    margin-bottom: 20px;
}

.bulletin-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.bulletin-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    border: none;
    border-radius: 30px;
    background: #f5f5f5;
    color: #2a5885;
    font-size: 16px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.bulletin-item:active {
    background: #e0e0e0;
    transform: scale(0.98);
}

.bulletin-icon {
    font-size: 24px;
    min-width: 40px;
    text-align: center;
}

.bulletin-text {
    flex: 1;
}

.bulletin-note {
    margin-top: 20px;
    color: #999;
    font-size: 13px;
    text-align: center;
}

/* Карточки питомцев */
.pet-card {
    margin-bottom: 10px;
}

.like-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border-radius: 20px;
    transition: background 0.2s;
}

.like-btn:hover {
    background: rgba(0,0,0,0.05);
}

.like-btn:active {
    transform: scale(0.95);
}

/* Лента и посты */
.feed-subtabs {
    display: flex;
    gap: 10px;
    padding: 10px;
    border-bottom: 1px solid #eee;
}

.feed-subtab-btn {
    flex: 1;
    padding: 8px;
    background: #f0f0f0;
    border: none;
    border-radius: 20px;
    cursor: pointer;
}

.feed-subtab-btn.active {
    background: #764ba2;
    color: white;
}

.post-card {
    background: white;
    border-radius: 20px;
    margin-bottom: 15px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.post-header {
    display: flex;
    align-items: center;
    padding: 10px;
    gap: 10px;
}

.post-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.post-author {
    font-weight: bold;
}

.post-image {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
}

.post-caption {
    padding: 10px;
    font-size: 14px;
}

.post-date {
    padding: 5px 10px 10px;
    font-size: 12px;
    color: #999;
}