:root {
    --lapi-night: #2a1f4e;
    --lapi-lavender: #b8a0e8;
    --lapi-gold: #e8c86d;
    --lapi-gold-deep: #d4a853;
    --lapi-text: #f8f4ff;
    --lapi-muted: rgba(248, 244, 255, 0.78);
    --lapi-card: rgba(255, 255, 255, 0.94);
    --lapi-hub-bg: #f6f0ff;
    --pets: #ff8a65;
    --kids: #7e9cff;
    --talk: #66bb6a;
    --shadow: 0 18px 50px rgba(42, 31, 78, 0.14);
}

* { box-sizing: border-box; }

[hidden] {
    display: none !important;
}

html, body {
    margin: 0;
    min-height: 100%;
}

body {
    font-family: 'Inter', system-ui, sans-serif;
    color: #2d2438;
    background: var(--lapi-hub-bg);
}

body.landing-tg-boot {
    overflow: hidden;
}

/* —— Loaders —— */
.landing-handoff-loader {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 12px;
    background: #fdf9f6;
    color: #2d2438;
    font-family: 'Inter', system-ui, sans-serif;
}

.landing-handoff-loader.is-visible { display: flex; }

.landing-handoff-loader__box {
    text-align: center;
    color: var(--lapi-text);
}

.landing-handoff-loader__spinner {
    width: 52px;
    height: 52px;
    margin: 0 auto;
    border-radius: 50%;
    border: 4px solid rgba(255, 138, 101, 0.2);
    border-top-color: #ff8a65;
    border-right-color: #7e9cff;
    animation: lapi-spin .9s linear infinite;
}

.landing-handoff-loader__title {
    margin: 0;
    font-weight: 700;
    font-size: 1rem;
}

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

/* —— Brand welcome —— */
.landing-welcome {
    position: fixed;
    inset: 0;
    z-index: 5000;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    background: #1a1230;
}

.landing-welcome__top {
    flex: 0 0 auto;
    padding: max(24px, env(safe-area-inset-top)) 20px 18px;
    text-align: center;
    background: linear-gradient(180deg, #ebe3f8 0%, #d8c8f0 100%);
}

.landing-welcome__art {
    flex: 0 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    background: linear-gradient(180deg, #d8c8f0 0%, #1a1230 42%, #1a1230 58%, #231838 100%);
}

.landing-welcome__art img {
    display: block;
    width: auto;
    max-width: min(100%, 480px);
    height: auto;
}

.landing-welcome__bottom {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 20px 20px max(32px, env(safe-area-inset-bottom));
    background: linear-gradient(180deg, #231838 0%, #1a1230 100%);
}

.landing-welcome__badge {
    display: inline-block;
    margin: 0 0 14px;
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(42, 31, 78, 0.08);
    color: var(--lapi-gold-deep);
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .14em;
}

.landing-welcome__title {
    margin: 0;
    max-width: 18ch;
    margin-inline: auto;
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: clamp(1.75rem, 5.5vw, 2.45rem);
    font-weight: 700;
    line-height: 1.14;
    color: #2a1f4e;
}

.landing-welcome__cta {
    width: 100%;
    max-width: 360px;
    margin: 0 auto;
    padding: 16px 24px;
    border: none;
    border-radius: 16px;
    font: 700 1.05rem 'Inter', system-ui, sans-serif;
    color: #2a1f4e;
    cursor: pointer;
    background: linear-gradient(90deg, #e8c86d, #d4b8f0, #f0d878, #c4b5fd, #e8c86d);
    background-size: 300% 100%;
    animation: gold-lavender-shift 4s ease infinite;
    box-shadow: 0 8px 32px rgba(232, 200, 109, 0.45);
}

@keyframes gold-lavender-shift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* —— Hub —— */
.landing-hub {
    position: relative;
    min-height: 100vh;
    max-width: 520px;
    margin: 0 auto;
    padding: 24px 16px 32px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.landing-hub__head {
    text-align: center;
}

html:not(.lapi-tg-env) .landing-welcome__art {
    display: none !important;
}

html:not(.lapi-tg-env) .landing-welcome__top {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-bottom: 24px;
}

html:not(.lapi-tg-env) .landing-welcome__bottom {
    flex: 0 0 auto;
    background: linear-gradient(180deg, #ebe3f8 0%, #e8ddf8 100%);
}

.landing-hub__login-btn {
    margin-top: 14px;
}

.landing-support-email {
    color: var(--lapi-night);
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.landing-referral-banner {
    background: linear-gradient(135deg, rgba(255, 232, 220, 0.9), rgba(212, 245, 234, 0.9));
    border-radius: 16px;
    padding: 14px;
    margin-bottom: 12px;
}

.landing-referral-banner p {
    margin: 0;
    font-size: .9rem;
    line-height: 1.45;
    color: #3c2a21;
}

.landing-referral-stats {
    display: flex;
    gap: 12px;
    margin-top: 12px;
}

.landing-referral-stat {
    flex: 1;
    text-align: center;
    padding: 10px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.75);
}

.landing-referral-stat strong {
    display: block;
    font-size: 1.35rem;
    color: #ff7a59;
}

.landing-referral-stat span {
    font-size: .72rem;
    color: #8a7568;
}

.landing-referral-pending {
    margin: 10px 0 0;
    white-space: pre-line;
    font-size: .88rem;
    line-height: 1.45;
    color: #2d6a4f;
}

.landing-referral-tg-hint {
    margin: 8px 0 0;
    font-size: .82rem;
    line-height: 1.45;
    color: #8a7568;
}

.landing-referral-invite-btn--disabled,
.landing-referral-invite-btn--disabled:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    filter: grayscale(0.15);
}

.landing-hub__title {
    margin: 0;
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.65rem;
    font-weight: 700;
    color: var(--lapi-night);
}

.landing-hub__apps {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.landing-app-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    width: 100%;
    padding: 18px 18px 16px;
    border: none;
    border-radius: 20px;
    text-align: left;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: transform .15s ease;
}

.landing-app-btn:active { transform: scale(.98); }

.landing-app-btn--pets {
    color: #3c2a21;
    background: linear-gradient(135deg, #ffe8dc 0%, #ffd9ce 42%, #d4f5ea 100%);
    box-shadow: 0 10px 24px rgba(255, 217, 206, 0.55);
}

.landing-app-btn--kids {
    color: #3c2a21;
    background: linear-gradient(135deg, #f5eed8 0%, #ebe3f8 55%, #e8ddf8 100%);
    box-shadow: 0 10px 24px rgba(235, 227, 248, 0.55);
}

.landing-app-btn--talk {
    color: #3c2a21;
    background: linear-gradient(135deg, #e0ebe5 0%, #efe4e8 55%, #f5e8ec 100%);
    box-shadow: 0 10px 24px rgba(224, 235, 229, 0.5);
}

.landing-app-btn__icon { font-size: 1.75rem; line-height: 1; }

.landing-app-btn__label {
    font-size: 1.15rem;
    font-weight: 800;
}

.landing-app-btn__desc {
    font-size: .88rem;
    opacity: .92;
}

.landing-talk-gate {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px 32px;
}

.landing-talk-gate__card {
    width: min(420px, 100%);
    background: #fff;
    border-radius: 24px;
    padding: 28px 22px 24px;
    box-shadow: var(--shadow);
    text-align: center;
}

.landing-talk-gate__emoji {
    font-size: 3rem;
    line-height: 1;
    margin-bottom: 8px;
}

.landing-talk-gate__title {
    margin: 0 0 12px;
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.55rem;
    font-weight: 700;
    color: var(--night);
}

.landing-talk-gate__text {
    margin: 0 0 18px;
    color: var(--muted);
    line-height: 1.5;
    font-size: .95rem;
}

.landing-kids-gate__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.landing-kids-gate__actions .landing-welcome__cta,
.landing-kids-gate__actions .landing__btn {
    min-width: 140px;
}

.landing-hub__secondary {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.landing-block {
    padding: 18px 16px;
    border-radius: 18px;
    background: var(--lapi-card);
    box-shadow: var(--shadow);
}

.landing-block__title {
    margin: 0 0 10px;
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--lapi-night);
}

.landing-block__line {
    margin: 0 0 6px;
    font-size: .95rem;
    line-height: 1.45;
}

.landing-block__line--muted { color: #6b5f7a; }

.landing-block__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}

.landing-card-bound {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
}

.landing-card-bound__info {
    margin: 0;
    font-weight: 600;
    color: var(--lapi-night);
}

.landing-block__hint,
.landing-block__error {
    margin: 10px 0 0;
    font-size: .88rem;
    line-height: 1.45;
}

.landing-block__hint { color: #6b5f7a; }
.landing-block__error { color: #c62828; }

.landing-hub__footer {
    margin-top: auto;
    text-align: center;
    font-size: .88rem;
    color: #6b5f7a;
}

.landing-block__actions--stack {
    flex-direction: column;
    align-items: stretch;
}

.landing-block__actions--stack .landing__btn {
    text-align: center;
    text-decoration: none;
}

.landing-block__actions--stack a.landing__btn {
    display: block;
}

.landing-hub__footer a {
    color: var(--lapi-night);
    font-weight: 700;
}

/* —— Buttons —— */
.landing__btn {
    appearance: none;
    border: none;
    border-radius: 14px;
    padding: 12px 18px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.landing__btn:disabled {
    opacity: .65;
    cursor: wait;
}

.landing__btn--gold {
    color: #2a1f4e;
    background: linear-gradient(90deg, #e8c86d, #d4b8f0, #f0d878);
    background-size: 200% 100%;
    animation: gold-lavender-shift 4s ease infinite;
}

.landing__btn--ghost {
    background: rgba(42, 31, 78, 0.08);
    color: #2d2438;
}

/* —— Modals —— */
.landing-login,
.landing-legal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(26, 18, 48, 0.55);
}

.landing-login.is-visible,
.landing-legal.is-visible {
    display: flex;
}

.landing-login__card,
.landing-legal__card {
    width: min(420px, 100%);
    max-height: 92vh;
    overflow: auto;
    padding: 22px 18px;
    border-radius: 20px;
    background: #fff;
    box-shadow: var(--shadow);
}

.landing-login__card h2,
.landing-legal__card h2 {
    margin: 0 0 8px;
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.35rem;
}

.landing-login__lead {
    margin: 0 0 14px;
    font-size: .9rem;
    line-height: 1.45;
    color: #6b5f7a;
}

.landing-login__label {
    display: block;
    margin: 0 0 6px;
    font-size: .85rem;
    font-weight: 700;
}

.landing-login__input {
    width: 100%;
    margin: 0 0 12px;
    padding: 12px 14px;
    border: 1px solid rgba(42, 31, 78, 0.12);
    border-radius: 12px;
    font: inherit;
}

.landing-login__input--otp {
    letter-spacing: .35em;
    text-align: center;
    font-weight: 800;
}

.landing-login__error {
    margin: 0 0 10px;
    font-size: .9rem;
    color: #c62828;
}

.landing-login__error--hint { color: #6b5f7a; }

.landing-login__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 6px;
}

.landing-login__lead--divider {
    margin-top: 14px;
    text-align: center;
    font-size: .82rem;
    opacity: .85;
}

.landing-telegram-widget-wrap {
    display: flex;
    justify-content: center;
    margin: 8px 0 14px;
    min-height: 44px;
}

.landing-legal__scroll {
    max-height: 42vh;
    overflow: auto;
    margin: 12px 0;
    padding: 12px;
    border-radius: 12px;
    background: #faf8fc;
    font-size: .82rem;
    line-height: 1.45;
    white-space: pre-wrap;
}

.landing-legal__check {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    margin: 0 0 10px;
    font-size: .88rem;
    line-height: 1.4;
}

.landing-legal__error {
    margin: 0 0 10px;
    color: #c62828;
    font-size: .88rem;
}
