/* style.css */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
    background: #f2f2f6;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 12px;
}

/* Основной контейнер (мобильная версия по умолчанию) */
.tma-container {
    max-width: 400px;
    width: 100%;
    background: #ffffff;
    border-radius: 36px;
    box-shadow: 0 8px 28px rgba(0,0,0,0.08), 0 0 0 1px rgba(0,0,0,0.02);
    position: relative;
    overflow: hidden;
}

/* Экран авторизации */
.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 600px;
    background: #ffffff;
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 320px;
    text-align: center;
}

.login-card h1 {
    font-size: 28px;
    margin-bottom: 8px;
    color: #000;
}

.login-card p {
    color: #6c6c70;
    margin-bottom: 32px;
}

.login-step {
    transition: all 0.2s;
}

.input-group {
    display: flex;
    align-items: center;
    background: #f8f8fa;
    border: 1px solid #e9e9ed;
    border-radius: 30px;
    padding: 12px 20px;
    margin-bottom: 20px;
}

.input-group i {
    color: #33766C;
    margin-right: 12px;
    font-size: 18px;
}

.input-group input {
    flex: 1;
    border: none;
    background: none;
    outline: none;
    font-size: 16px;
    color: #000;
}

.input-group input::placeholder {
    color: #8e8e93;
}

.login-btn {
    background: #33766C;
    color: white;
    border: none;
    width: 100%;
    padding: 16px;
    border-radius: 60px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 12px;
    transition: background 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.login-btn:hover {
    background: #2a5e55;
}

.login-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.login-link {
    background: none;
    border: none;
    color: #33766C;
    font-size: 14px;
    cursor: pointer;
    text-decoration: underline;
}

.login-hint {
    font-size: 13px;
    color: #8e8e93;
    margin-top: 16px;
}

.login-error {
    background: #ffeeee;
    color: #d32f2f;
    border-radius: 30px;
    padding: 12px;
    margin-top: 20px;
    font-size: 14px;
}

/* Основное приложение */
.app-screen {
    display: flex;
    flex-direction: column;
    height: 760px;
    background: #ffffff;
    color: #000000;
    position: relative;
}

.app-header {
    padding: 20px 20px 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e9e9ed;
    background: #ffffff;
}

.app-header h1 {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.5px;
    color: #000000;
}

.app-header i {
    color: #33766C;
    font-size: 20px;
}

.content-area {
    flex: 1;
    overflow-y: auto;
    padding: 16px 16px 8px 16px;
    scrollbar-width: thin;
    scrollbar-color: #33766C #e9e9ed;
}

.content-area::-webkit-scrollbar {
    width: 4px;
}
.content-area::-webkit-scrollbar-thumb {
    background: #33766C;
    border-radius: 20px;
}

.tab-bar {
    display: flex;
    justify-content: space-around;
    align-items: center;
    background: #ffffff;
    padding: 8px 12px;
    border-top: 1px solid #e9e9ed;
    border-radius: 0 0 36px 36px;
    backdrop-filter: blur(10px);
}

.tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #8e8e93;
    transition: all 0.1s ease;
    padding: 4px 0;
    border-radius: 12px;
    width: 20%;
    cursor: pointer;
}

.tab-item i {
    font-size: 22px;
    margin-bottom: 4px;
}

.tab-item span {
    font-size: 11px;
    font-weight: 500;
}

.tab-item.active {
    color: #33766C;
}

/* Общие стили для контента */
.banner {
    background: linear-gradient(135deg, #f8f8fa 0%, #ffffff 100%);
    border: 1px solid #e9e9ed;
    border-radius: 18px;
    padding: 20px;
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.02);
    transition: box-shadow 0.2s;
}

.banner:hover {
    box-shadow: 0 8px 24px rgba(51,118,108,0.1);
}

.banner h3 {
    font-size: 18px;
    font-weight: 600;
    color: #33766C;
}

.banner p {
    font-size: 14px;
    color: #6c6c70;
    margin-top: 4px;
}

.section-title {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin: 24px 0 16px;
}

.section-title h2 {
    font-size: 20px;
    font-weight: 600;
    color: #000000;
}

.section-title a {
    color: #33766C;
    font-size: 14px;
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.2s;
}

.section-title a:hover {
    opacity: 0.8;
}

.chip-row {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 8px;
    margin-bottom: 16px;
    scrollbar-width: none;
}

.chip {
    background: #f2f2f6;
    padding: 12px 22px;
    border-radius: 40px;
    font-size: 15px;
    font-weight: 500;
    color: #1c1c1e;
    white-space: nowrap;
    border: 1px solid #e9e9ed;
    cursor: pointer;
    transition: all 0.2s;
}

.chip:hover {
    background: #e9e9ed;
    border-color: #33766C;
}

.chip i {
    margin-right: 8px;
    color: #33766C;
}

.shorts-reel {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    margin-bottom: 24px;
}

.short-video {
    min-width: 140px;
    height: 200px;
    background: #f2f2f6;
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 16px;
    position: relative;
    background-size: cover;
    border: 1px solid #e9e9ed;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.short-video:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(51,118,108,0.15);
}

.short-video i {
    position: absolute;
    top: 12px;
    left: 12px;
    color: white;
    background: #33766C;
    border-radius: 50%;
    padding: 8px;
    font-size: 14px;
}

.tools-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 12px;
}

.tool-card {
    background: #ffffff;
    border-radius: 24px;
    padding: 20px 16px;
    border: 1px solid #e9e9ed;
    box-shadow: 0 4px 12px rgba(0,0,0,0.02);
    transition: all 0.25s ease;
    cursor: pointer;
    position: relative;
}

.tool-card:hover {
    transform: translateY(-6px);
    border-color: #33766C;
    box-shadow: 0 16px 32px rgba(51,118,108,0.12);
}

.tool-icon {
    background: #f8f8fa;
    width: 56px;
    height: 56px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
    transition: background 0.2s;
}

.tool-card:hover .tool-icon {
    background: #ffffff;
}

.tool-icon i {
    font-size: 32px;
    color: #33766C;
}

.tool-title {
    font-weight: 600;
    font-size: 18px;
    color: #000000;
    margin-bottom: 6px;
}

.tool-desc {
    font-size: 13px;
    color: #6c6c70;
    margin-bottom: 16px;
    line-height: 1.4;
}

.price {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 600;
    color: #33766C;
}

.price i {
    font-size: 14px;
}

.favorite-icon {
    position: absolute;
    top: 16px;
    right: 16px;
    color: #c6c6c8;
    font-size: 20px;
    cursor: pointer;
    transition: color 0.2s, transform 0.2s;
    z-index: 2;
}
.favorite-icon:hover {
    transform: scale(1.1);
}
.favorite-icon.active {
    color: #33766C;
}

/* Чаты — заглушка */
.chat-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    color: #8e8e93;
    text-align: center;
    background: #f8f8fa;
    border-radius: 32px;
    padding: 40px;
}

.chat-placeholder i {
    font-size: 80px;
    margin-bottom: 20px;
    color: #33766C40;
}

.chat-placeholder h3 {
    font-size: 22px;
    margin-bottom: 8px;
    color: #000;
}

/* История */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.history-item {
    background: #ffffff;
    border-radius: 28px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    border: 1px solid #e9e9ed;
    box-shadow: 0 4px 12px rgba(0,0,0,0.02);
    transition: box-shadow 0.2s;
}

.history-item:hover {
    box-shadow: 0 8px 24px rgba(51,118,108,0.08);
}

.history-icon {
    width: 56px;
    height: 56px;
    background: #f8f8fa;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: #33766C;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}

.history-info {
    flex: 1;
}

.history-title {
    font-weight: 600;
    font-size: 18px;
    color: #000;
    margin-bottom: 6px;
}

.history-meta {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: #6c6c70;
    margin-bottom: 8px;
}

.history-preview {
    font-size: 14px;
    color: #3a3a3c;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 280px;
}

.history-open-btn {
    background: none;
    border: 1.5px solid #33766C60;
    color: #33766C;
    padding: 10px 20px;
    border-radius: 40px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.history-open-btn:hover {
    background: #33766C;
    color: white;
    border-color: #33766C;
}

/* Профиль - ОБНОВЛЁННАЯ ВЕРСИЯ */
.profile-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 32px;
    flex-wrap: nowrap;
}

.profile-avatar {
    width: 60px;
    height: 60px;
    background: #f2f2f6;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #33766C;
    font-size: 28px;
    color: #33766C;
    flex-shrink: 0;
}

.profile-user-info {
    flex: 1;
    min-width: 0;
}

.profile-user-info h2 {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 22px;
    margin-bottom: 4px;
    color: #000;
}

.profile-user-info .user-id {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 14px;
    color: #6c6c70;
}

/* Кнопка «Получить генерацию» */
.claim-inline-btn {
    background: #33766C;
    border: none;
    color: white;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 60px;
    font-size: 14px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
    margin-left: auto;
}

.claim-inline-btn:hover {
    background: #2a5e55;
}

.balance-card {
    background: linear-gradient(135deg, #f8f8fa 0%, #ffffff 100%);
    padding: 24px;
    border-radius: 32px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 28px;
    border: 1px solid #e9e9ed;
    box-shadow: 0 8px 20px rgba(0,0,0,0.02);
}

.balance-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #000;
    font-size: 18px;
}

.balance-actions {
    display: flex;
    gap: 16px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.action-btn {
    background: #ffffff;
    border: 1px solid #e9e9ed;
    color: #33766C;
    padding: 12px 24px;
    border-radius: 60px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s;
}

.action-btn:hover {
    background: #33766C;
    color: white;
    border-color: #33766C;
}

.referral-block {
    background: #ffffff;
    border-radius: 32px;
    padding: 24px;
    margin-bottom: 24px;
    border: 1px solid #e9e9ed;
    box-shadow: 0 8px 20px rgba(0,0,0,0.02);
}

.referral-stats {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    color: #000;
    font-size: 16px;
}

.referral-link {
    background: #f8f8fa;
    border-radius: 20px;
    padding: 14px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border: 1px solid #e9e9ed;
    font-size: 14px;
    word-break: break-all;
}

.share-btn {
    background: #33766C;
    border: none;
    color: white;
    font-weight: 600;
    padding: 14px;
    border-radius: 60px;
    width: 100%;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: background 0.2s;
}

.share-btn:hover {
    background: #2a5e55;
}

.settings-grid {
    display: flex;
    gap: 16px;
}

.settings-item {
    background: #ffffff;
    padding: 20px;
    border-radius: 28px;
    width: 50%;
    cursor: pointer;
    border: 1px solid #e9e9ed;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(0,0,0,0.02);
}

.settings-item:hover {
    border-color: #33766C;
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(51,118,108,0.1);
}

.settings-item i {
    color: #33766C;
    font-size: 28px;
    margin-bottom: 12px;
}

.settings-item p {
    font-weight: 600;
    color: #000;
    margin-bottom: 6px;
    font-size: 16px;
}

.settings-item span {
    color: #6c6c70;
    font-size: 13px;
}

/* Модальные окна */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s, visibility 0.3s;
}

.modal-overlay.active {
    visibility: visible;
    opacity: 1;
}

.modal-content {
    max-width: 400px;
    width: 90%;
    background: #ffffff;
    border-radius: 40px;
    padding: 28px;
    border: 1px solid #e9e9ed;
    box-shadow: 0 30px 60px rgba(0,0,0,0.2);
    max-height: 85vh;
    overflow-y: auto;
    transform: scale(0.95);
    transition: transform 0.3s;
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.close-modal {
    float: right;
    font-size: 28px;
    color: #33766C;
    cursor: pointer;
    transition: opacity 0.2s;
}

.close-modal:hover {
    opacity: 0.7;
}

.result-detail {
    margin-top: 20px;
}

.result-detail-text {
    background: #f8f8fa;
    border-radius: 24px;
    padding: 22px;
    color: #000;
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 24px;
    white-space: pre-line;
    border: 1px solid #e9e9ed;
}

.result-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.result-actions button {
    background: #ffffff;
    border: 1px solid #e9e9ed;
    color: #33766C;
    padding: 12px 24px;
    border-radius: 60px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.result-actions button:hover {
    background: #33766C;
    color: white;
    border-color: #33766C;
}

.hidden {
    display: none !important;
}

/* Форма инструмента */
.tool-form-container {
    margin: 20px 0;
}

.tool-field {
    margin-bottom: 20px;
}

.tool-field label {
    display: block;
    font-weight: 500;
    font-size: 15px;
    color: #000;
    margin-bottom: 8px;
}

.tool-field input[type="text"],
.tool-field textarea,
.tool-field select {
    width: 100%;
    padding: 14px 18px;
    border: 1px solid #e9e9ed;
    border-radius: 28px;
    background: #f8f8fa;
    font-size: 15px;
    color: #000;
    outline: none;
    transition: border-color 0.2s;
}

.tool-field input[type="text"]:focus,
.tool-field textarea:focus,
.tool-field select:focus {
    border-color: #33766C;
}

.tool-field textarea {
    min-height: 100px;
    resize: vertical;
}

.tool-field input[type="file"] {
    width: 100%;
    padding: 12px;
    background: #f8f8fa;
    border: 1px dashed #33766C;
    border-radius: 28px;
    color: #33766C;
    cursor: pointer;
}

.user-status {
    background: #33766C20;
    padding: 6px 14px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 600;
    color: #33766C;
    border: 1px solid #33766C40;
    display: inline-block;
    white-space: nowrap;
}

/* ================== КОМПЬЮТЕРНАЯ ВЕРСИЯ (от 900px) ================== */
@media (min-width: 900px) {
    .tma-container {
        max-width: 1400px;
        width: 100%;
        height: calc(100vh - 40px);
        margin: 0 auto;
        border-radius: 48px 48px 0 0;
        box-shadow: 0 20px 40px rgba(0,0,0,0.08);
    }

    body {
        padding: 20px;
        background: #e5e5ea;
    }

    .app-screen {
        height: 100%;
    }

    .app-header {
        padding: 28px 32px 20px 32px;
    }
    .app-header h1 {
        font-size: 32px;
    }
    .app-header i {
        font-size: 28px;
    }

    .tab-bar {
        justify-content: center;
        gap: 40px;
        padding: 16px 32px;
        border-top: none;
        border-bottom: 1px solid #e9e9ed;
        border-radius: 0;
        background: #ffffff;
    }

    .tab-item {
        width: auto;
        flex-direction: row;
        gap: 12px;
        padding: 10px 24px;
        border-radius: 60px;
        transition: background 0.2s;
    }

    .tab-item i {
        font-size: 24px;
        margin-bottom: 0;
    }

    .tab-item span {
        font-size: 16px;
    }

    .tab-item:hover {
        background: #f2f2f6;
    }

    .tab-item.active {
        background: #33766C10;
        color: #33766C;
    }

    .content-area {
        padding: 32px 32px 24px 32px;
    }

    .tools-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 24px;
    }

    .tool-card {
        padding: 28px 20px;
        border-radius: 32px;
    }
    .tool-icon {
        width: 70px;
        height: 70px;
        border-radius: 24px;
    }
    .tool-icon i {
        font-size: 38px;
    }
    .tool-title {
        font-size: 20px;
    }
    .tool-desc {
        font-size: 14px;
    }

    .banner {
        padding: 28px;
        border-radius: 32px;
    }

    .chip {
        padding: 14px 28px;
        font-size: 16px;
    }

    .short-video {
        min-width: 180px;
        height: 240px;
        border-radius: 32px;
    }

    .history-item {
        padding: 24px;
        border-radius: 36px;
    }
    .history-icon {
        width: 70px;
        height: 70px;
        border-radius: 24px;
        font-size: 32px;
    }
    .history-title {
        font-size: 20px;
    }

    /* Профиль на десктопе */
    .profile-header {
        gap: 24px;
    }
    
    .profile-avatar {
        width: 80px;
        height: 80px;
        font-size: 36px;
        border-width: 3px;
    }
    
    .profile-user-info h2 {
        font-size: 28px;
    }
    
    .claim-inline-btn {
        padding: 12px 24px;
        font-size: 16px;
        gap: 10px;
    }

    .balance-card {
        padding: 32px;
    }
    
    .settings-item {
        padding: 24px;
    }
    .settings-item i {
        font-size: 32px;
    }

    .modal-content {
        max-width: 600px;
        padding: 36px;
        border-radius: 48px;
    }
    
    .user-status {
        padding: 8px 20px;
        font-size: 16px;
    }
}

/* ================== ОЧЕНЬ БОЛЬШИЕ ЭКРАНЫ ================== */
@media (min-width: 1200px) {
    .tools-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 28px;
    }

    .tab-bar {
        gap: 60px;
    }

    .content-area {
        padding: 40px 40px 32px 40px;
    }

    .app-header {
        padding: 32px 40px 24px 40px;
    }
}

@media (min-width: 1600px) {
    .tools-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

/* Toast уведомления */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #ffffff;
    color: #000000;
    padding: 14px 24px;
    border-radius: 60px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    border: 1px solid #e9e9ed;
    z-index: 2000;
    transition: transform 0.3s ease, opacity 0.3s ease;
    opacity: 0;
    pointer-events: none;
    max-width: 90%;
    width: auto;
    min-width: 200px;
    text-align: center;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.toast-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.toast-icon {
    font-size: 24px;
}

.toast-icon.success {
    color: #4CAF50;
}

.toast-icon.error {
    color: #F44336;
}

.toast-message {
    font-size: 16px;
    font-weight: 500;
}

/* Мобильные корректировки для истории */
@media (max-width: 899px) {
    .history-open-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
    .history-item {
        gap: 12px;
    }
}