/* Phone layout for the portal and competition home pages. */
body.ai-chat-open .qq-group-widget,
body.ai-chat-open .back-to-top,
body.ai-chat-open .social-sidebar {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

@media (max-width: 768px) {
    .hero-banner {
        height: auto;
        min-height: 0;
        padding: 10px 14px;
    }

    .hero-banner-text {
        flex-direction: column;
        gap: 2px;
        font-size: 14px;
        line-height: 1.5;
        letter-spacing: 0;
        text-align: center;
    }

    .hero-banner-text .divider {
        height: 0;
        margin: 0;
        overflow: hidden;
        visibility: hidden;
        line-height: 0;
    }

    .hero-content-section {
        padding: 32px 0 28px;
    }

    .hero-content-section .hero-content h1 {
        font-size: clamp(1.3rem, 6.3vw, 2rem) !important;
    }

    .hero-content p {
        font-size: 14.5px;
        line-height: 1.75;
        margin-bottom: 24px;
    }

    .hero-btns {
        gap: 10px;
    }

    .hero-btns .btn-group,
    .hero-btns .btn-group:last-child {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .hero-btns .btn-group > .btn {
        width: auto;
        min-width: 0;
        margin: 0;
        padding: 11px 8px;
        font-size: 14px;
        line-height: 1.35;
        white-space: normal;
    }

    .hero-btns .btn-group:first-child > .btn:first-child {
        grid-column: 1 / -1;
        font-size: 15px;
    }

    .hero-btns .btn-group:first-child > .btn:last-child:nth-child(even),
    .hero-btns .btn-group:not(:first-child) > .btn:last-child:nth-child(odd) {
        grid-column: 1 / -1;
    }

    .nav-actions {
        gap: 8px;
    }

    .nav-actions .nav-btn {
        width: 48px;
        height: 48px;
        border-radius: 8px;
        font-size: 12px;
        line-height: 1.3;
        letter-spacing: 0;
    }

    .social-sidebar-title {
        cursor: pointer;
        user-select: none;
        -webkit-tap-highlight-color: transparent;
    }

    .social-sidebar:not(.is-open) .social-btn {
        display: none;
    }

    .social-sidebar:not(.is-open) .social-sidebar-title {
        margin: 0;
        padding: 10px 6px;
        border-radius: 8px 0 0 8px;
        background: linear-gradient(180deg, #2a56c7, #1a3a8f);
        box-shadow: -2px 2px 10px rgba(26, 58, 143, 0.3);
        font-size: 12px;
        line-height: 1.25;
        writing-mode: vertical-rl;
        text-orientation: upright;
        letter-spacing: 1px;
        opacity: 0.92;
    }

    .ai-chatbot-container {
        right: 12px;
        bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    }

    .ai-chatbot-btn {
        width: 52px;
        height: 52px;
        font-size: 1.4rem;
    }

    .ai-chatbot-window {
        right: 0;
        bottom: 64px;
        width: calc(100vw - 24px);
        height: min(72vh, 580px);
    }

    .ai-chatbot-window .ai-chatbot-header {
        padding: 14px 16px;
        gap: 8px;
    }

    .ai-chatbot-window .ai-chatbot-header h4 {
        font-size: 1.1rem;
        white-space: nowrap;
    }

    .ai-chatbot-window .auto-speech-toggle {
        padding: 6px 10px;
        font-size: 0.8rem;
        white-space: nowrap;
    }

    .ai-chatbot-window .quick-questions {
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .ai-chatbot-window .quick-questions::-webkit-scrollbar {
        display: none;
    }

    .ai-chatbot-window .quick-question-btn {
        flex: 0 0 auto;
        white-space: nowrap;
    }

    .back-to-top {
        right: 16px;
        bottom: calc(80px + env(safe-area-inset-bottom, 0px));
        width: 44px;
        height: 44px;
        font-size: 1.2rem;
    }

    body .qq-group-widget {
        right: 12px;
        bottom: calc(134px + env(safe-area-inset-bottom, 0px));
    }

    body .qq-group-trigger {
        min-width: 0;
        width: 52px;
        height: 52px;
        padding: 0;
        flex-direction: column;
        gap: 1px;
        font-size: 11px;
        line-height: 1;
        white-space: nowrap;
    }

    body .qq-group-trigger-icon {
        width: 20px;
        height: 20px;
    }

    body .qq-group-panel {
        bottom: 62px;
        max-height: calc(100vh - 220px);
        overflow-y: auto;
    }
}

@media (max-width: 380px) {
    .hero-banner-text {
        font-size: 13px;
    }

    .ai-chatbot-window .auto-speech-toggle span {
        display: none;
    }

    .ai-chatbot-window .ai-comp-tabs {
        gap: 4px;
        padding: 8px 10px;
    }

    .ai-chatbot-window .ai-comp-tab {
        padding: 6px 8px;
        font-size: 0.8rem;
    }

    .hero-btns .btn-group > .btn {
        padding: 10px 6px;
        font-size: 13px;
    }
}
