:root {
    --fp-app-height: 100dvh;
    --fp-app-width: 100vw;
    --fp-safe-top: env(safe-area-inset-top, 0px);
    --fp-safe-right: env(safe-area-inset-right, 0px);
    --fp-safe-bottom: env(safe-area-inset-bottom, 0px);
    --fp-safe-left: env(safe-area-inset-left, 0px);
    --fp-install-shadow: 0 22px 50px rgba(15, 23, 42, 0.18);
    --fp-install-border: rgba(148, 163, 184, 0.18);
    --fp-install-bg: rgba(255, 255, 255, 0.92);
    --fp-install-text: #12233d;
    --fp-install-muted: #5d6f89;
    --fp-install-accent: #1e88e5;
}

html.fp-pwa-shell {
    min-height: 100%;
    width: 100%;
    background: #f7fbff;
    overflow-x: clip;
    overscroll-behavior-y: none;
    -webkit-text-size-adjust: 100%;
}

html.fp-pwa-shell body {
    min-height: var(--fp-app-height, 100dvh);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: clip;
    overscroll-behavior-y: none;
    touch-action: manipulation;
}

html.fp-pwa-shell.fp-standalone body {
    min-height: var(--fp-app-height, 100dvh);
}

html.fp-pwa-shell.fp-standalone *:not(input):not(textarea):not(select):not([contenteditable="true"]) {
    -webkit-touch-callout: none;
}

html.fp-pwa-shell.fp-standalone input,
html.fp-pwa-shell.fp-standalone textarea,
html.fp-pwa-shell.fp-standalone select,
html.fp-pwa-shell.fp-standalone [contenteditable="true"] {
    -webkit-user-select: text;
    user-select: text;
}

.fp-install-sheet {
    position: fixed;
    left: 14px;
    right: 14px;
    bottom: calc(14px + var(--fp-safe-bottom));
    z-index: 2147483000;
    max-width: 460px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 12px;
    align-items: flex-start;
    padding: 14px 50px 14px 14px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid var(--fp-install-border);
    box-shadow: var(--fp-install-shadow);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    opacity: 0;
    transform: translateY(24px);
    pointer-events: none;
    transition: opacity 0.24s ease, transform 0.24s ease;
}

.fp-install-sheet.is-visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.fp-install-sheet__badge {
    width: 40px;
    height: 40px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #eef6ff 0%, #dcecff 100%);
    color: var(--fp-install-accent);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
}

.fp-install-sheet__content {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.fp-install-sheet__title {
    color: var(--fp-install-text);
    font-size: 16px;
    font-weight: 800;
    line-height: 1.2;
}

.fp-install-sheet__text {
    color: var(--fp-install-muted);
    font-size: 13px;
    line-height: 1.45;
}

.fp-install-sheet__note {
    color: #72839d;
    font-size: 12px;
    line-height: 1.45;
}

.fp-install-sheet__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 2px;
}

.fp-install-sheet__action,
.fp-install-sheet__close {
    appearance: none;
    border: 0;
    cursor: pointer;
    transition: transform 0.16s ease, opacity 0.16s ease, background 0.16s ease;
}

.fp-install-sheet__action {
    min-width: 132px;
    padding: 11px 16px;
    border-radius: 14px;
    background: linear-gradient(135deg, #42a5f5 0%, #1e88e5 100%);
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    box-shadow: 0 10px 20px rgba(30, 136, 229, 0.24);
}

.fp-install-sheet__close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.06);
    color: rgba(15, 23, 42, 0.72);
    font-size: 18px;
    font-weight: 500;
}

.fp-install-sheet__action:active,
.fp-install-sheet__close:active {
    transform: scale(0.96);
}

html.fp-standalone .fp-install-sheet,
html.fp-telegram-webapp .fp-install-sheet {
    display: none !important;
}

@media (min-width: 768px) {
    .fp-install-sheet {
        left: 24px;
        right: 24px;
        bottom: 24px;
        padding: 16px 52px 16px 16px;
    }
}

@media (max-width: 420px) {
    .fp-install-sheet {
        padding: 14px 46px 14px 14px;
    }

    .fp-install-sheet__controls {
        width: 100%;
    }

    .fp-install-sheet__action {
        flex: 1 1 auto;
    }
}
