.platform-footer {
    position: relative;
    z-index: 2;
    width: 100%;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(8, 8, 13, 0.62);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.platform-footer-inner {
    width: min(1180px, calc(100% - 40px));
    min-height: 48px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    color: #aaaac6;
    font-size: 13px;
}

.platform-footer-links {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.platform-footer a {
    color: #c7d2fe;
    text-decoration: none;
    font-weight: 700;
}

.platform-footer a:hover {
    color: #fff;
    text-decoration: underline;
}

body.chat-page {
    --kiki-site-footer-height: 48px;
    --kiki-mobile-nav-height: 60px;
    --kiki-mobile-bottom-clearance: calc(var(--kiki-mobile-nav-height) + var(--kiki-site-footer-height) + env(safe-area-inset-bottom));
    flex-direction: column;
}

body.chat-page .app-container {
    flex: 1 1 auto;
    min-height: 0;
    height: calc(100vh - var(--kiki-site-footer-height));
    height: calc(100dvh - var(--kiki-site-footer-height));
}

body.chat-page .platform-footer {
    flex: 0 0 auto;
    z-index: 210;
}

.is-smartphone body.chat-page {
    padding-bottom: var(--kiki-mobile-bottom-clearance);
}

.is-smartphone body.chat-page .app-container {
    height: calc(100vh - var(--kiki-site-footer-height));
    height: calc(100dvh - var(--kiki-site-footer-height));
}

@media (max-width: 768px) {
    body.chat-page .app-container {
        height: calc(100vh - var(--kiki-site-footer-height));
        height: calc(100dvh - var(--kiki-site-footer-height));
    }
}

.is-smartphone body.chat-page .mobile-nav {
    bottom: var(--kiki-site-footer-height);
    height: var(--kiki-mobile-nav-height);
}

.is-smartphone body.chat-page .input-area,
.is-smartphone body.chat-page .chat-input-area {
    bottom: var(--kiki-mobile-bottom-clearance);
}

.is-smartphone body.chat-page .messages-container {
    padding-bottom: calc(var(--kiki-input-area-height, 120px) + var(--kiki-mobile-bottom-clearance));
}

.is-smartphone body.chat-page .scroll-bottom-btn {
    bottom: calc(var(--kiki-input-area-height, 120px) + var(--kiki-mobile-bottom-clearance));
}

.is-smartphone body.chat-page .sidebar,
.is-smartphone body.chat-page .sidebar-overlay,
.is-smartphone body.chat-page .panel-overlay {
    bottom: var(--kiki-mobile-bottom-clearance);
}

.is-smartphone body.chat-page .sidebar-overlay,
.is-smartphone body.chat-page .panel-overlay {
    inset-block-end: var(--kiki-mobile-bottom-clearance);
}

.is-smartphone body.chat-page .character-panel.open,
.is-smartphone body.chat-page .world-info-panel.open {
    bottom: var(--kiki-mobile-bottom-clearance);
}

.is-smartphone body.chat-page .character-panel,
.is-smartphone body.chat-page .world-info-panel {
    max-height: min(75vh, calc(100dvh - var(--kiki-mobile-bottom-clearance) - 16px)) !important;
}

.is-smartphone body.chat-page .character-panel .panel-content,
.is-smartphone body.chat-page .world-info-panel .panel-content {
    padding-bottom: calc(24px + env(safe-area-inset-bottom)) !important;
}

.is-smartphone body.chat-page .modal {
    margin-bottom: var(--kiki-mobile-bottom-clearance);
    max-height: calc(100dvh - var(--kiki-mobile-bottom-clearance) - 18px);
}

.is-smartphone body.chat-page .header-dropdown-menu {
    position: fixed;
    top: calc(68px + env(safe-area-inset-top));
    left: 12px;
    right: 12px;
    bottom: calc(var(--kiki-mobile-bottom-clearance) + 12px);
    width: auto;
    min-width: 0;
    max-height: none;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.is-smartphone body.chat-page #upgradeToast {
    bottom: calc(var(--kiki-mobile-bottom-clearance) + 16px) !important;
}

@media (max-width: 640px) {
    body.chat-page {
        --kiki-site-footer-height: 72px;
    }

    .platform-footer-inner {
        min-height: var(--kiki-site-footer-height);
        padding: 8px 0;
        flex-direction: column;
        justify-content: center;
        gap: 6px;
        text-align: center;
    }

    .platform-footer-links {
        justify-content: center;
        gap: 12px;
    }
}
