:root {
    --mobile-primary-topbar-height: 54px;
    --mobile-primary-section-height: 56px;
    --mobile-primary-header-height: calc(
        var(--mobile-primary-topbar-height) +
        var(--mobile-primary-section-height) +
        env(safe-area-inset-top, 0px)
    );
}

.mobile-primary-header {
    display: none;
    box-sizing: border-box;
    color: #17191f;
    background: #fff;
    font-family: Pretendard, "Pretendard Variable", -apple-system, BlinkMacSystemFont,
        "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
    -webkit-font-smoothing: antialiased;
}

.mobile-primary-header *,
.mobile-primary-header *::before,
.mobile-primary-header *::after {
    box-sizing: border-box;
}

.mobile-primary-header a {
    color: inherit;
    text-decoration: none;
}

.mobile-primary-header button {
    margin: 0;
    border: 0;
    color: inherit;
    background: transparent;
    font: inherit;
    cursor: pointer;
}

.mobile-primary-header :where(a, button):focus-visible {
    outline: 3px solid rgba(40, 100, 220, 0.3);
    outline-offset: -3px;
}

.mobile-primary-header__topbar {
    display: flex;
    min-height: calc(var(--mobile-primary-topbar-height) + env(safe-area-inset-top, 0px));
    padding: env(safe-area-inset-top, 0px) 12px 0 18px;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(232, 234, 238, 0.88);
    background: rgba(255, 255, 255, 0.97);
}

.mobile-primary-header__brand {
    display: inline-flex;
    min-width: 0;
    min-height: 44px;
    align-items: center;
    gap: 8px;
    color: #17191f;
    letter-spacing: -0.045em;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}

.mobile-primary-header__brand-icon {
    display: grid;
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    place-items: center;
    border-radius: 8px;
    color: #17191f;
    background: #ffd633;
}

.mobile-primary-header__brand-icon svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.mobile-primary-header__brand-name {
    font-size: 19px;
    font-weight: 720;
    line-height: 1;
}

.mobile-primary-header__actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
}

.mobile-primary-header__icon-button {
    position: relative;
    display: inline-grid;
    width: 44px;
    min-width: 44px;
    height: 44px;
    padding: 0;
    place-items: center;
    border-radius: 12px;
    color: #17191f;
    background: transparent;
    -webkit-tap-highlight-color: transparent;
}

.mobile-primary-header__icon-button > svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.mobile-primary-header__menu-button.is-logged-in {
    color: #caa500;
}

.mobile-primary-header__sections {
    display: flex;
    width: 100%;
    min-height: var(--mobile-primary-section-height);
    padding: 0 12px;
    align-items: stretch;
    overflow: hidden;
    border-bottom: 1px solid #e8eaee;
    background: rgba(255, 255, 255, 0.98);
}

.mobile-primary-header__section {
    position: relative;
    display: flex;
    order: 0;
    flex: 0 0 42px;
    min-width: 0;
    min-height: var(--mobile-primary-section-height);
    padding: 0 2px;
    align-items: center;
    justify-content: center;
    color: #747c89;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}

.mobile-primary-header__section strong {
    overflow: hidden;
    font-size: 13px;
    font-weight: 550;
    line-height: 1;
    letter-spacing: -0.035em;
    text-overflow: ellipsis;
}

.mobile-primary-header__section span {
    display: none;
}

.mobile-primary-header__heading {
    display: flex;
    margin: 0;
    padding: 0;
    align-items: baseline;
    gap: 7px;
    color: inherit;
    font: inherit;
}

.mobile-primary-header__section.is-active {
    order: -1;
    flex: 1 1 auto;
    gap: 7px;
    padding: 0 8px 0 6px;
    justify-content: flex-start;
    color: #17191f;
}

.mobile-primary-header__section.is-active::after {
    position: absolute;
    bottom: -1px;
    left: 6px;
    width: 32px;
    height: 3px;
    background: #ffd633;
    content: "";
}

.mobile-primary-header__section.is-active strong {
    flex: 0 0 auto;
    overflow: visible;
    font-size: 20px;
    font-weight: 720;
    letter-spacing: -0.05em;
}

.mobile-primary-header__section.is-active span {
    display: block;
    min-width: 0;
    overflow: hidden;
    color: #747c89;
    font-size: 11px;
    font-weight: 500;
    line-height: 1;
    letter-spacing: -0.035em;
    text-overflow: ellipsis;
}

.mobile-primary-header__section.is-active .mobile-primary-header__rss-label {
    flex: 0 0 auto;
    margin-left: -3px;
    color: #9a7a00;
    font-size: 9px;
    font-weight: 650;
    letter-spacing: 0;
}

@supports (backdrop-filter: blur(12px)) {
    .mobile-primary-header__topbar,
    .mobile-primary-header__sections {
        background: rgba(255, 255, 255, 0.9);
        backdrop-filter: saturate(150%) blur(14px);
        -webkit-backdrop-filter: saturate(150%) blur(14px);
    }
}

body.is-mobile-home .mobile-primary-header {
    position: sticky;
    z-index: 40;
    top: 0;
    display: block;
    width: 100%;
    background: #fff;
}

@media (max-width: 768px) {
    body.mobile-main-shell {
        --header-height: var(--mobile-primary-header-height) !important;
    }

    body.mobile-main-shell .mobile-primary-header {
        position: fixed;
        z-index: 1000;
        top: 0;
        right: 0;
        left: 0;
        display: block;
        width: 100%;
        min-width: 0;
        height: var(--mobile-primary-header-height);
    }

    body.mobile-main-shell .improved-header {
        display: none !important;
    }

    body.mobile-main-shell .right-sidebar-menu {
        top: calc(var(--mobile-primary-topbar-height) + env(safe-area-inset-top, 0px)) !important;
        height: calc(100dvh - var(--mobile-primary-topbar-height) - env(safe-area-inset-top, 0px)) !important;
        max-height: calc(100dvh - var(--mobile-primary-topbar-height) - env(safe-area-inset-top, 0px)) !important;
    }

    body.mobile-main-shell .header-pc-mini-panel[hidden] {
        display: none !important;
    }

    body.mobile-main-shell .header-pc-mini-panel:not([hidden]) {
        position: fixed;
        z-index: 1002;
        top: calc(var(--mobile-primary-topbar-height) + env(safe-area-inset-top, 0px));
        right: 12px;
        display: block !important;
        width: min(420px, calc(100vw - 24px));
        max-height: calc(100dvh - var(--mobile-primary-topbar-height) - env(safe-area-inset-top, 0px) - 12px);
        overflow-y: auto;
        border: 1px solid #e3e6ea;
        border-radius: 0 0 14px 14px;
        background: #fff;
        box-shadow: 0 14px 34px rgba(15, 23, 42, 0.14);
        overscroll-behavior: contain;
    }

    body.mobile-primary-title-integrated [data-mobile-primary-title-source] {
        position: absolute !important;
        width: 1px !important;
        height: 1px !important;
        padding: 0 !important;
        margin: -1px !important;
        overflow: hidden !important;
        clip: rect(0, 0, 0, 0) !important;
        clip-path: inset(50%) !important;
        border: 0 !important;
        white-space: nowrap !important;
    }

    body.mobile-primary-title-integrated [data-mobile-primary-title-support] {
        display: none !important;
    }

    body.mobile-primary-title-integrated [data-mobile-primary-title-block="collapse"] {
        position: absolute !important;
        width: 1px !important;
        height: 1px !important;
        min-width: 0 !important;
        min-height: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
        overflow: hidden !important;
        clip: rect(0, 0, 0, 0) !important;
        clip-path: inset(50%) !important;
        border: 0 !important;
    }

    body.mobile-primary-title-integrated .news-title-section,
    body.mobile-primary-title-integrated .news-title,
    body.mobile-primary-title-integrated .news-title-row {
        width: 100%;
    }

    body.mobile-primary-title-integrated .news-title-row {
        justify-content: flex-end;
    }

    body.mobile-primary-title-integrated .news-title-badges {
        margin-left: auto;
    }

    body.mobile-primary-title-integrated.main-page .news-header:not(.news-header--has-admin-actions) {
        display: none !important;
    }

    body.mobile-primary-title-integrated.main-page .news-header--has-admin-actions .rss-badge {
        display: none !important;
    }

    body.mobile-primary-title-integrated.mobile-main-shell.fc-forum-app main.board-list-page .board-page-hero [data-mobile-primary-title-support],
    body.mobile-primary-title-integrated.mobile-main-shell.fc-forum-app main.board-list-page .board-page-hero .board-rss-badge {
        display: none !important;
    }

    body.mobile-primary-title-integrated.fc-forum-app main.board-list-page .board-hero-title-line {
        justify-content: flex-end !important;
    }
}

@media (max-width: 359px) {
    .mobile-primary-header__topbar {
        padding-right: 6px;
        padding-left: 12px;
    }

    .mobile-primary-header__icon-button {
        width: 42px;
        min-width: 42px;
    }

    .mobile-primary-header__sections {
        padding-right: 8px;
        padding-left: 8px;
    }

    .mobile-primary-header__section {
        flex-basis: 39px;
    }

    .mobile-primary-header__section.is-active {
        gap: 5px;
        padding-right: 4px;
        padding-left: 4px;
    }

    .mobile-primary-header__heading {
        gap: 5px;
    }

    .mobile-primary-header__section.is-active::after {
        left: 4px;
    }

    .mobile-primary-header__section.is-active strong {
        font-size: 19px;
    }

    .mobile-primary-header__section.is-active span {
        font-size: 10px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .mobile-primary-header *,
    .mobile-primary-header *::before,
    .mobile-primary-header *::after {
        scroll-behavior: auto !important;
        transition: none !important;
    }
}
